Rev 13681 | Blame | Compare with Previous | Last modification | View Log | RSS feed
package in.shop2020.serving.services;import java.io.BufferedWriter;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.FileWriter;import java.io.IOException;import java.util.ArrayList;import java.util.Collections;import java.util.HashMap;import java.util.List;import java.util.Map;import java.util.Map.Entry;import javax.mail.MessagingException;import org.apache.poi.hssf.usermodel.HSSFCellStyle;import org.apache.poi.hssf.usermodel.HSSFFont;import org.apache.poi.hssf.usermodel.HSSFRow;import org.apache.poi.hssf.usermodel.HSSFSheet;import org.apache.poi.hssf.usermodel.HSSFWorkbook;import org.apache.poi.hssf.util.HSSFColor;import org.apache.thrift.TException;import in.shop2020.model.v1.catalog.CatalogServiceException;import in.shop2020.model.v1.catalog.Category;import in.shop2020.model.v1.catalog.Item;import in.shop2020.model.v1.order.FlipkartFaSalesSnapshot;import in.shop2020.thrift.clients.CatalogClient;import in.shop2020.utils.EmailUtils;import in.shop2020.utils.FASalesSnapshot;import in.shop2020.utils.FkExcelRow;import in.shop2020.utils.FkSaleComparator;import in.shop2020.utils.FkStockEstAvgSaleCompartor;import in.shop2020.utils.FkStockEstValueComparator;import in.shop2020.utils.FlipkartConsumer;import in.shop2020.utils.GmailUtils;public class CreateSendFAStockEstReportMT{private static final String FLIPKART_FBA_SHEET = "/tmp/Mobiles-Tablets-FA-Stock-Estimation.xls";private static final String FLIPKART_FBA_SHEET_BODY = "/tmp/Mobiles-Tablets-FA-Stock-Estimation-body.html";public static void main(String[] args) throws IOException, MessagingException {CatalogClient catalogServiceClient = null;try {catalogServiceClient = new CatalogClient("catalog_service_server_host_amazon","catalog_service_server_port");//catalogServiceClient = new CatalogClient();} catch (Exception e) {e.printStackTrace();}in.shop2020.model.v1.catalog.CatalogService.Client catalogClient = catalogServiceClient.getClient();Map<Long, Long> currentFaInventoryMap = FlipkartConsumer.getCurrentFAInventory();Map<Long,Double> currentFAInventorySellingPriceMap = FlipkartConsumer.getCurrentFAInventorySellingPrice();List<FlipkartFaSalesSnapshot> salessnapshots = FlipkartConsumer.getFlipkartFbaSalesSnapshotForDays(4);Map<Long, Map<Long,FASalesSnapshot>> itemId5daysSale = new HashMap<Long, Map<Long,FASalesSnapshot>>();boolean skip = false;for(FlipkartFaSalesSnapshot salessnapshot : salessnapshots) {try {if(itemId5daysSale.containsKey(salessnapshot.getItem_id())) {for (Entry<Long, FASalesSnapshot> saleentry : itemId5daysSale.get(salessnapshot.getItem_id()).entrySet()) {if(saleentry.getValue().getDateOfSale().longValue() == salessnapshot.getDateOfSale()) {if(!salessnapshot.isIsOutOfStock()){if(saleentry.getValue().getTotalOrderCount()==-1){saleentry.getValue().setTotalOrderCount(salessnapshot.getTotalOrderCount());saleentry.getValue().setTotalSale((float) (salessnapshot.getTotalSale()));}else{saleentry.getValue().setTotalOrderCount(saleentry.getValue().getTotalOrderCount()+ salessnapshot.getTotalOrderCount());saleentry.getValue().setTotalSale((float) (saleentry.getValue().getTotalSale() + salessnapshot.getTotalSale()));}itemId5daysSale.get(salessnapshot.getItem_id()).put(saleentry.getValue().getDateOfSale(),saleentry.getValue());}skip = true;break;}}if(!skip){FASalesSnapshot faSalesSnapshot = new FASalesSnapshot();if(!salessnapshot.isIsOutOfStock()) {faSalesSnapshot.setTotalOrderCount(salessnapshot.getTotalOrderCount());faSalesSnapshot.setTotalSale((float) salessnapshot.getTotalSale());faSalesSnapshot.setDateOfSale(salessnapshot.getDateOfSale());}else {faSalesSnapshot.setTotalOrderCount(-1);faSalesSnapshot.setTotalSale((float) 0);faSalesSnapshot.setDateOfSale(salessnapshot.getDateOfSale());}itemId5daysSale.get(salessnapshot.getItem_id()).put(faSalesSnapshot.getDateOfSale(),faSalesSnapshot);}skip=false;}else{Map<Long,FASalesSnapshot> last5daysSale = new HashMap<Long,FASalesSnapshot>();FASalesSnapshot faSalesSnapshot = new FASalesSnapshot();if (!salessnapshot.isIsOutOfStock()) {faSalesSnapshot.setTotalOrderCount(salessnapshot.getTotalOrderCount());faSalesSnapshot.setTotalSale((float) salessnapshot.getTotalSale());faSalesSnapshot.setDateOfSale(salessnapshot.getDateOfSale());}else {faSalesSnapshot.setTotalOrderCount(-1);faSalesSnapshot.setTotalSale((float) 0);faSalesSnapshot.setDateOfSale(salessnapshot.getDateOfSale());}last5daysSale.put(faSalesSnapshot.getDateOfSale(),faSalesSnapshot);itemId5daysSale.put(salessnapshot.getItem_id(),last5daysSale);}} catch (Exception e) {e.printStackTrace();}}HSSFWorkbook hwb = new HSSFWorkbook();HSSFSheet sheet1 = hwb.createSheet("MOVING");HSSFSheet sheet2 = hwb.createSheet("SLOW-MOVING");HSSFSheet sheet3 = hwb.createSheet("NOT-MOVING");int i=0;HSSFRow rowhead1 = sheet1.createRow((short) 0);HSSFRow rowhead2 = sheet2.createRow((short) 0);HSSFRow rowhead3 = sheet3.createRow((short) 0);rowhead1.createCell(i).setCellValue("ITEM-ID");rowhead1.createCell(++i).setCellValue("BRAND");rowhead1.createCell(++i).setCellValue("CATEGORY");rowhead1.createCell(++i).setCellValue("PRODUCT-GROUP");rowhead1.createCell(++i).setCellValue("PRODUCT-NAME");rowhead1.createCell(++i).setCellValue("SALES-HISTORY");rowhead1.createCell(++i).setCellValue("AVG-SALE");rowhead1.createCell(++i).setCellValue("STOCK-QUANTITY");rowhead1.createCell(++i).setCellValue("SELLING-PRICE");rowhead1.createCell(++i).setCellValue("STOCK-VALUE");rowhead1.createCell(++i).setCellValue("NOD-STOCK");rowhead1.createCell(++i).setCellValue("MOVEMENT-CATEGORY");i=0;rowhead2.createCell(i).setCellValue("ITEM-ID");rowhead2.createCell(++i).setCellValue("BRAND");rowhead2.createCell(++i).setCellValue("CATEGORY");rowhead2.createCell(++i).setCellValue("PRODUCT-GROUP");rowhead2.createCell(++i).setCellValue("PRODUCT-NAME");rowhead2.createCell(++i).setCellValue("SALES-HISTORY");rowhead2.createCell(++i).setCellValue("AVG-SALE");rowhead2.createCell(++i).setCellValue("STOCK-QUANTITY");rowhead2.createCell(++i).setCellValue("SELLING-PRICE");rowhead2.createCell(++i).setCellValue("STOCK-VALUE");rowhead2.createCell(++i).setCellValue("NOD-STOCK");rowhead2.createCell(++i).setCellValue("MOVEMENT-CATEGORY");i=0;rowhead3.createCell(i).setCellValue("ITEM-ID");rowhead3.createCell(++i).setCellValue("BRAND");rowhead3.createCell(++i).setCellValue("CATEGORY");rowhead3.createCell(++i).setCellValue("PRODUCT-GROUP");rowhead3.createCell(++i).setCellValue("PRODUCT-NAME");rowhead3.createCell(++i).setCellValue("SALES-HISTORY");rowhead3.createCell(++i).setCellValue("AVG-SALE");rowhead3.createCell(++i).setCellValue("STOCK-QUANTITY");rowhead3.createCell(++i).setCellValue("SELLING-PRICE");rowhead3.createCell(++i).setCellValue("STOCK-VALUE");rowhead3.createCell(++i).setCellValue("NOD-STOCK");rowhead3.createCell(++i).setCellValue("MOVEMENT-CATEGORY");List<FkExcelRow> Moving_List = new ArrayList<FkExcelRow>();List<FkExcelRow> Replenishment_Items = new ArrayList<FkExcelRow>();List<FkExcelRow> Slow_Moving_Items = new ArrayList<FkExcelRow>();List<FkExcelRow> Not_Moving_Item_List = new ArrayList<FkExcelRow>();for (Entry<Long, Map<Long, FASalesSnapshot>> entry : itemId5daysSale.entrySet()) {Item item = null;Category category = null;try {//System.out.println("Item ID is " + entry.getKey());item = catalogClient.getItem(entry.getKey());if (item.getId() == 0) {continue;}if (item.getProductGroup().equalsIgnoreCase("Mobile Phone") || item.getProductGroup().equalsIgnoreCase("Handsets") || item.getProductGroup().equalsIgnoreCase("Tablets") ||item.getProductGroup().equalsIgnoreCase("Compact Cameras") ||item.getProductGroup().equalsIgnoreCase("DSLR Cameras") ||item.getProductGroup().equalsIgnoreCase("Cameras") ||item.getProductGroup().equalsIgnoreCase("Digital Camera") ||item.getProductGroup().equalsIgnoreCase("Lenses")) {}else {continue;}if (item.isSetCategory() && item.getCategory() != 0) {category = catalogClient.getCategory(item.getCategory());}}catch (CatalogServiceException e) {e.printStackTrace();} catch (TException e) {e.printStackTrace();}FkExcelRow fkExcelRow = new FkExcelRow();int count = 1;Double total_sale = 0.0;int total_sale_days = 0;float avg_total_sale = 0;StringBuilder total_days_sale = new StringBuilder();List<FASalesSnapshot> fiveDaySale = new ArrayList<FASalesSnapshot>(entry.getValue().values());Collections.sort(fiveDaySale, new FkSaleComparator());long stockQuantity = 0;if(currentFaInventoryMap.containsKey(entry.getKey())){stockQuantity = currentFaInventoryMap.get(entry.getKey());}else{stockQuantity = 0;}for(FASalesSnapshot sale : fiveDaySale) {if (sale.getTotalOrderCount() != -1) {total_days_sale.append(sale.getTotalOrderCount());avg_total_sale = avg_total_sale + sale.getTotalOrderCount();total_sale = total_sale + sale.getTotalSale();total_sale_days++;} else {if(stockQuantity>0){total_days_sale.append("0");total_sale_days++;}else {total_days_sale.append("X");}}if (count != entry.getValue().size()) {total_days_sale.append("-");}count++;}if(entry.getValue().size()<5){while(count<=5){total_days_sale.append("-");if(stockQuantity>0){total_days_sale.append("0");total_sale_days++;} else {total_days_sale.append("X");}count++;}}float total_sale_avg = 0;if (total_sale_days != 0) {total_sale_avg = avg_total_sale / total_sale_days;}fkExcelRow.setItem_id(entry.getKey());float days_of_stock = 0;double sellingPrice = 0.0;//if(currentFAInventorySellingPriceMap.containsKey(entry.getKey())){sellingPrice = currentFAInventorySellingPriceMap.get(entry.getKey());}else{sellingPrice = total_sale/avg_total_sale;}double stockValue = stockQuantity*sellingPrice;if(total_sale_avg>0){days_of_stock = (stockQuantity/total_sale_avg);}fkExcelRow.setBrand(item.getBrand());fkExcelRow.setProductGroup(item.getProductGroup());fkExcelRow.setCategory(category.getLabel());fkExcelRow.setProductName(item.getModelName()+" "+item.getModelNumber()+" "+item.getColor());fkExcelRow.setSalesHistory(total_days_sale.toString());fkExcelRow.setAvgSale(total_sale_avg);fkExcelRow.setStockQuantity(stockQuantity);fkExcelRow.setSellingPrice(sellingPrice);fkExcelRow.setStockValue(stockValue);fkExcelRow.setNodStock(days_of_stock);if (total_sale_avg > 0) {if(days_of_stock<=20){fkExcelRow.setMovementCategory("MOVING");Moving_List.add(fkExcelRow);if(days_of_stock<=5){Replenishment_Items.add(fkExcelRow);}}if(days_of_stock>20){fkExcelRow.setMovementCategory("SLOW-MOVING");Slow_Moving_Items.add(fkExcelRow);}}else{if(total_sale_avg == 0 && stockQuantity>0){fkExcelRow.setMovementCategory("NON-MOVING");Not_Moving_Item_List.add(fkExcelRow);}}}Collections.sort(Moving_List, new FkStockEstValueComparator());Collections.sort(Replenishment_Items, new FkStockEstAvgSaleCompartor());Collections.sort(Slow_Moving_Items, new FkStockEstValueComparator());Collections.sort(Not_Moving_Item_List, new FkStockEstValueComparator());HSSFRow row = null;int iterator = 1;long movingStock = 0;double movingStockValue = 0;for (FkExcelRow excelrow : Moving_List){movingStock = movingStock+excelrow.getStockQuantity();movingStockValue = movingStockValue+excelrow.getStockValue();row = sheet1.createRow((short) iterator);HSSFCellStyle style = hwb.createCellStyle();style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);HSSFFont font = hwb.createFont();style.setFillForegroundColor(HSSFColor.WHITE.index);font.setColor(HSSFColor.BLACK.index);style.setFont(font);i=0;row.createCell(i).setCellValue(excelrow.getItem_id());row.createCell(++i).setCellValue(excelrow.getBrand());row.createCell(++i).setCellValue(excelrow.getCategory());row.createCell(++i).setCellValue(excelrow.getProductGroup());row.createCell(++i).setCellValue(excelrow.getProductName());row.createCell(++i).setCellValue(excelrow.getSalesHistory());row.createCell(++i).setCellValue(String.format("%.2f",excelrow.getAvgSale()));row.createCell(++i).setCellValue(excelrow.getStockQuantity());row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getSellingPrice()));row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getStockValue()));row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getNodStock()));row.createCell(++i).setCellValue(excelrow.getMovementCategory());iterator++;}iterator = 1;double not_moving_value = 0;long not_moving_count = 0;for (FkExcelRow excelrow : Not_Moving_Item_List) {not_moving_value = not_moving_value + excelrow.getStockValue();not_moving_count = not_moving_count + excelrow.getStockQuantity();row = sheet3.createRow((short) iterator);HSSFCellStyle style = hwb.createCellStyle();style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);HSSFFont font = hwb.createFont();style.setFillForegroundColor(HSSFColor.WHITE.index);font.setColor(HSSFColor.BLACK.index);style.setFont(font);i=0;row.createCell(i).setCellValue(excelrow.getItem_id());row.createCell(++i).setCellValue(excelrow.getBrand());row.createCell(++i).setCellValue(excelrow.getCategory());row.createCell(++i).setCellValue(excelrow.getProductGroup());row.createCell(++i).setCellValue(excelrow.getProductName());row.createCell(++i).setCellValue(excelrow.getSalesHistory());row.createCell(++i).setCellValue(String.format("%.2f",excelrow.getAvgSale()));row.createCell(++i).setCellValue(excelrow.getStockQuantity());row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getSellingPrice()));row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getStockValue()));row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getNodStock()));row.createCell(++i).setCellValue(excelrow.getMovementCategory());iterator++;}iterator = 1;double slow_moving_value = 0;long slow_moving_count = 0;for (FkExcelRow excelrow : Slow_Moving_Items) {slow_moving_value = slow_moving_value + excelrow.getStockValue();slow_moving_count = slow_moving_count + excelrow.getStockQuantity();row = sheet2.createRow((short) iterator);HSSFCellStyle style = hwb.createCellStyle();style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);HSSFFont font = hwb.createFont();style.setFillForegroundColor(HSSFColor.WHITE.index);font.setColor(HSSFColor.BLACK.index);style.setFont(font);i=0;row.createCell(i).setCellValue(excelrow.getItem_id());row.createCell(++i).setCellValue(excelrow.getBrand());row.createCell(++i).setCellValue(excelrow.getCategory());row.createCell(++i).setCellValue(excelrow.getProductGroup());row.createCell(++i).setCellValue(excelrow.getProductName());row.createCell(++i).setCellValue(excelrow.getSalesHistory());row.createCell(++i).setCellValue(String.format("%.2f",excelrow.getAvgSale()));row.createCell(++i).setCellValue(excelrow.getStockQuantity());row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getSellingPrice()));row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getStockValue()));row.createCell(++i).setCellValue(String.format("%.0f",excelrow.getNodStock()));row.createCell(++i).setCellValue(excelrow.getMovementCategory());iterator++;}FileOutputStream fileOut = null;try {fileOut = new FileOutputStream(FLIPKART_FBA_SHEET);} catch (FileNotFoundException e) {e.printStackTrace();}try {hwb.write(fileOut);} catch (IOException e) {e.printStackTrace();}try {fileOut.close();} catch (IOException e) {e.printStackTrace();}StringBuffer sb = new StringBuffer();sb.append("<html><table border=\"1\" align=\"center\">"+ "<caption><b>" + "ITEMS TO REPLENISH" + "</b></caption>"+ "<tr>" + "<td><b>" + "ITEM-ID" + "</b></td>" + "<td><b>"+ "BRAND" + "</b></td>" + "<td><b>" + "CATEGORY" + "</b></td>"+ "<td><b>" + "PRODUCT-GROUP" + "</b></td>" + "<td><b>"+ "PRODUCT-NAME" + "</b></td>" + "<td><b>" + "SALES-HISTORY"+ "</b></td>" + "<td><b>" + "AVG-SALE" + "</b></td>"+ "</b></td>" + "<td><b>" + "CURRENT-STOCK" + "</b></td>"+ "<td><b>" + "NO-OF-DAYS-STOCK" + "</b></td>"+ "<td><b>" + "STOCK-VALUE" + "</b></td>"+ "</tr>");int count = 0;for(FkExcelRow excelRow: Replenishment_Items){if (count < 10) {sb.append("<tr>" + "<td>"+ excelRow.getItem_id() +"</td>"+"<td>"+ excelRow.getBrand() +"</td>"+"<td>"+ excelRow.getCategory() +"</td>"+"<td>"+ excelRow.getProductGroup() +"</td>"+"<td>"+ excelRow.getProductName() +"</td>"+"<td>"+ excelRow.getSalesHistory() +"</td>"+"<td>"+ Math.round(excelRow.getAvgSale() * 100.0) / 100.0 +"</td>"+"<td>"+ excelRow.getStockQuantity() +"</td>"+"<td>"+ String.format("%.0f",excelRow.getNodStock()) +"</td>"+"<td>"+ String.format("%.0f",excelRow.getStockValue()) +"</td></tr>");count++;}else{break;}}sb.append("</table>");sb.append("<table border=\"1\" align=\"center\">"+ "<caption><b>" + "SLOW-MOVING-ITEMS" + "</b></caption>"+ "<tr>" + "<td><b>" + "ITEM-ID" + "</b></td>" + "<td><b>"+ "BRAND" + "</b></td>" + "<td><b>" + "CATEGORY" + "</b></td>"+ "<td><b>" + "PRODUCT-GROUP" + "</b></td>" + "<td><b>"+ "PRODUCT-NAME" + "</b></td>" + "<td><b>" + "SALES-HISTORY"+ "</b></td>" + "<td><b>" + "AVG-SALE" + "</b></td>"+ "</b></td>" + "<td><b>" + "CURRENT-STOCK" + "</b></td>"+ "<td><b>" + "NO-OF-DAYS-STOCK" + "</b></td>"+ "<td><b>" + "STOCK-VALUE" + "</b></td>"+ "</tr>");count = 0;for(FkExcelRow excelRow : Slow_Moving_Items){if (count < 10) {sb.append("<tr>" + "<td>"+ excelRow.getItem_id() +"</td>"+"<td>"+ excelRow.getBrand() +"</td>"+"<td>"+ excelRow.getCategory() +"</td>"+"<td>"+ excelRow.getProductGroup() +"</td>"+"<td>"+ excelRow.getProductName() +"</td>"+"<td>"+ excelRow.getSalesHistory() +"</td>"+"<td>"+ Math.round(excelRow.getAvgSale() * 100.0) / 100.0 +"</td>"+"<td>"+ excelRow.getStockQuantity() +"</td>"+"<td>"+ String.format("%.0f",excelRow.getNodStock()) +"</td>"+"<td>"+ String.format("%.0f",excelRow.getStockValue()) +"</td></tr>");count++;}else{break;}}sb.append("</table>");sb.append("<table border=\"1\" align=\"center\">"+ "<caption><b>" + "NON-MOVING-ITEMS" + "</b></caption>"+ "<tr>" + "<td><b>" + "ITEM-ID" + "</b></td>" + "<td><b>"+ "BRAND" + "</b></td>" + "<td><b>" + "CATEGORY" + "</b></td>"+ "<td><b>" + "PRODUCT-GROUP" + "</b></td>" + "<td><b>"+ "PRODUCT-NAME" + "</b></td>" + "<td><b>" + "SALES-HISTORY"+ "</b></td>" + "<td><b>" + "AVG-SALE" + "</b></td>"+ "</b></td>" + "<td><b>" + "CURRENT-STOCK" + "</b></td>"+ "<td><b>" + "NO-OF-DAYS-STOCK" + "</b></td>"+ "<td><b>" + "STOCK-VALUE" + "</b></td>"+ "</tr>");count = 0;for(FkExcelRow excelRow : Not_Moving_Item_List){if (count < 10) {sb.append("<tr>" + "<td>"+ excelRow.getItem_id() +"</td>"+"<td>"+ excelRow.getBrand() +"</td>"+"<td>"+ excelRow.getCategory() +"</td>"+"<td>"+ excelRow.getProductGroup() +"</td>"+"<td>"+ excelRow.getProductName() +"</td>"+"<td>"+ excelRow.getSalesHistory() +"</td>"+"<td>"+ Math.round(excelRow.getAvgSale() * 100.0) / 100.0 +"</td>"+"<td>"+ excelRow.getStockQuantity() +"</td>"+"<td>"+ String.format("%.0f",excelRow.getNodStock()) +"</td>"+"<td>"+ String.format("%.0f",excelRow.getStockValue()) +"</td></tr>");count++;}else{break;}}sb.append("</table></html>");StringBuffer stockSummary = new StringBuffer();stockSummary.append("<html><table border=\"1\" align=\"center\">" +"<caption><b>"+ "STOCK SUMMARY" + "</b></caption>" +"<tr>" + "<td><b>"+ "STOCK-TYPE" + "</b></td>" +"<td><b>"+"NO-OF-SKUS" + "</b></td>" +"<td><b>"+ "QTY" + "</b></td>" +"<td><b>" + "VALUE"+"</tr>");stockSummary.append("<tr>" + "<td><b>"+ "MOVING" + "</b></td>" +"<td><b>" +Moving_List.size()+ "</b></td>" +"<td><b>"+ "</b>"+movingStock+"</td>" +"<td><b>" + String.format("%.0f",movingStockValue)+"</tr>");stockSummary.append("<tr>" + "<td><b>"+ "SLOW-MOVING" + "</b></td>"+"<td><b>" + Slow_Moving_Items.size() + "</b></td>" +"<td><b>"+ "</b>"+slow_moving_count+"</td>" +"<td><b>" +String.format("%.0f",slow_moving_value)+"</tr>");stockSummary.append("<tr>" + "<td><b>"+ "NOT-MOVING" + "</b></td>" +"<td><b>" + Not_Moving_Item_List.size() + "</b></td>" +"<td><b>"+ "</b>"+not_moving_count+"</td>" +"<td><b>" +String.format("%.0f",not_moving_value)+"</tr>");stockSummary.append("<tr>" + "<td><b>"+ "TOTAL" + "</b></td>"+"<td><b>" + (Moving_List.size() +Slow_Moving_Items.size()+ Not_Moving_Item_List.size()) + "</b></td>" +"<td><b>"+ "</b>"+(movingStock+not_moving_count+slow_moving_count)+"</td>" +"<td><b>" +String.format("%.0f",(movingStockValue+not_moving_value+slow_moving_value))+"</tr>");stockSummary.append("</table></html>");BufferedWriter out = new BufferedWriter(new FileWriter(FLIPKART_FBA_SHEET_BODY));out.write(stockSummary.toString()+sb.toString());out.flush();out.close();String emailFromAddress = "build-staging@shop2020.in";String password = "shop2020";String[] sendTo = new String[]{"rajneesh.arora@shop2020.in","manish.sharma@shop2020.in","chaitnaya.vats@shop2020.in","khushal.bhatia@shop2020.in","manoj.kumar@shop2020.in","amit.gupta@shop2020.in","manoj.pal@shop2020.in","ankush.dhingra@saholic.com","j.p.gupta@shop2020.in","chandan.kumar@saholic.com","muvin.khan@shop2020.in"};//String[] sendTo = new String[] { "manish.sharma@shop2020.in" };String emailSubjectTxt = "FA Stock Estimation Sheet (Mobiles and Tablets)";try {GmailUtils mailer = new GmailUtils();mailer.sendSSLMessage(sendTo, emailSubjectTxt, "", emailFromAddress, password, FLIPKART_FBA_SHEET, FLIPKART_FBA_SHEET_BODY);} catch (Exception ex) {ex.printStackTrace();EmailUtils emailUtils = new EmailUtils();emailUtils.sendEmail(sendTo, emailSubjectTxt, "", emailFromAddress, FLIPKART_FBA_SHEET, FLIPKART_FBA_SHEET_BODY);}}}