|
|
@@ -1324,6 +1324,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal profitMarginSum = new BigDecimal("0.00");
|
|
|
for (Long item : carrierId) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
+ List<BoxNumberProfit> profitList = boxNumberProfitList.stream().filter(e -> e.getCarrierId().equals(item)).collect(Collectors.toList());
|
|
|
+ if (!profitList.isEmpty()) {
|
|
|
+ map.put("corpName", profitList.get(0).getCarrierCnName());
|
|
|
+ } else {
|
|
|
+ map.put("corpName", "");
|
|
|
+ }
|
|
|
Integer teu = boxNumberProfitList.stream().filter(e -> e.getCarrierId().equals(item)).map(BoxNumberProfit::getTeu).filter(Objects::nonNull).reduce(0, Integer::sum);
|
|
|
map.put("teu", teu);
|
|
|
teuSum = teuSum + teu;
|
|
|
@@ -1331,12 +1337,18 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal amountProfitLoc = boxNumberProfitList.stream().filter(e -> e.getCarrierId().equals(item)).map(BoxNumberProfit::getAmountProfitLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
map.put("amountProfitLoc", amountProfitLoc);
|
|
|
amountProfitSum = amountProfitSum.add(amountProfitLoc);
|
|
|
- BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
- map.put("profitMargin", profitMargin);
|
|
|
- profitMarginSum = profitMarginSum.add(profitMargin);
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0 ){
|
|
|
+ BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ map.put("profitMargin", profitMargin);
|
|
|
+ profitMarginSum = profitMarginSum.add(profitMargin);
|
|
|
+ }else{
|
|
|
+ map.put("profitMargin", new BigDecimal("0.00"));
|
|
|
+ profitMarginSum = profitMarginSum.add(new BigDecimal("0.00"));
|
|
|
+ }
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
Map<String, Object> mapSum = new HashMap<>();
|
|
|
+ mapSum.put("corpName", "总计");
|
|
|
mapSum.put("teu", teuSum);
|
|
|
mapSum.put("amountProfitLoc", amountProfitSum);
|
|
|
mapSum.put("profitMargin", profitMarginSum);
|
|
|
@@ -1349,6 +1361,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal profitMarginSum = new BigDecimal("0.00");
|
|
|
for (Long item : corpId) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
+ List<BoxNumberProfit> profitList = boxNumberProfitList.stream().filter(e -> e.getCorpId().equals(item)).collect(Collectors.toList());
|
|
|
+ if (!profitList.isEmpty()) {
|
|
|
+ map.put("corpName", profitList.get(0).getCarrierCnName());
|
|
|
+ } else {
|
|
|
+ map.put("corpName", "");
|
|
|
+ }
|
|
|
Integer teu = boxNumberProfitList.stream().filter(e -> e.getCorpId().equals(item)).map(BoxNumberProfit::getTeu).filter(Objects::nonNull).reduce(0, Integer::sum);
|
|
|
map.put("teu", teu);
|
|
|
teuSum = teuSum + teu;
|
|
|
@@ -1356,12 +1374,18 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal amountProfitLoc = boxNumberProfitList.stream().filter(e -> e.getCorpId().equals(item)).map(BoxNumberProfit::getAmountProfitLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
map.put("amountProfitLoc", amountProfitLoc);
|
|
|
amountProfitSum = amountProfitSum.add(amountProfitLoc);
|
|
|
- BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
- map.put("profitMargin", profitMargin);
|
|
|
- profitMarginSum = profitMarginSum.add(profitMargin);
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0){
|
|
|
+ BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ map.put("profitMargin", profitMargin);
|
|
|
+ profitMarginSum = profitMarginSum.add(profitMargin);
|
|
|
+ }else{
|
|
|
+ map.put("profitMargin", new BigDecimal("0.00"));
|
|
|
+ profitMarginSum = profitMarginSum.add(new BigDecimal("0.00"));
|
|
|
+ }
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
Map<String, Object> mapSum = new HashMap<>();
|
|
|
+ mapSum.put("corpName", "总计");
|
|
|
mapSum.put("teu", teuSum);
|
|
|
mapSum.put("amountProfitLoc", amountProfitSum);
|
|
|
mapSum.put("profitMargin", profitMarginSum);
|
|
|
@@ -1374,6 +1398,12 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal profitMarginSum = new BigDecimal("0.00");
|
|
|
for (Long item : srcId) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
+ List<BoxNumberProfit> profitList = boxNumberProfitList.stream().filter(e -> e.getSrcId().equals(item) && e.getSrcType().equals("SALES")).collect(Collectors.toList());
|
|
|
+ if (!profitList.isEmpty()) {
|
|
|
+ map.put("corpName", profitList.get(0).getCarrierCnName());
|
|
|
+ } else {
|
|
|
+ map.put("corpName", "");
|
|
|
+ }
|
|
|
Integer teu = boxNumberProfitList.stream().filter(e -> e.getSrcId().equals(item) && e.getSrcType().equals("SALES")).map(BoxNumberProfit::getTeu).filter(Objects::nonNull).reduce(0, Integer::sum);
|
|
|
map.put("teu", teu);
|
|
|
teuSum = teuSum + teu;
|
|
|
@@ -1381,12 +1411,19 @@ public class StatisticAnalysisServiceImpl implements IStatisticAnalysisService {
|
|
|
BigDecimal amountProfitLoc = boxNumberProfitList.stream().filter(e -> e.getSrcId().equals(item) && e.getSrcType().equals("SALES")).map(BoxNumberProfit::getAmountProfitLoc).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
map.put("amountProfitLoc", amountProfitLoc);
|
|
|
amountProfitSum = amountProfitSum.add(amountProfitLoc);
|
|
|
- BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
- map.put("profitMargin", profitMargin);
|
|
|
- profitMarginSum = profitMarginSum.add(profitMargin);
|
|
|
+ if (new BigDecimal("0.00").compareTo(amountProfitLoc) != 0){
|
|
|
+ BigDecimal profitMargin = amountProfitLoc.divide(amountDrLoc, MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"));
|
|
|
+ map.put("profitMargin", profitMargin);
|
|
|
+ profitMarginSum = profitMarginSum.add(profitMargin);
|
|
|
+ }else{
|
|
|
+ map.put("profitMargin", new BigDecimal("0.00"));
|
|
|
+ profitMarginSum = profitMarginSum.add(new BigDecimal("0.00"));
|
|
|
+ }
|
|
|
+ mapList.add(map);
|
|
|
mapList.add(map);
|
|
|
}
|
|
|
Map<String, Object> mapSum = new HashMap<>();
|
|
|
+ mapSum.put("corpName", "总计");
|
|
|
mapSum.put("teu", teuSum);
|
|
|
mapSum.put("amountProfitLoc", amountProfitSum);
|
|
|
mapSum.put("profitMargin", profitMarginSum);
|