Browse Source

2024年6月24日17:04:34

纪新园 1 year ago
parent
commit
826d1db6a3

+ 6 - 0
blade-service-api/blade-system-api/src/main/java/org/springblade/system/entity/Dept.java

@@ -238,5 +238,11 @@ public class Dept implements Serializable {
 	@TableField(exist = false)
 	private String contacts;
 
+	/**
+	 * 报表时间
+	 */
+	@TableField(exist = false)
+	private String date;
+
 
 }

+ 4 - 0
blade-service/blade-los/src/main/java/org/springblade/los/finance/genleg/service/impl/FinGenlegServiceImpl.java

@@ -568,15 +568,19 @@ public class FinGenlegServiceImpl extends ServiceImpl<FinGenlegMapper, FinGenleg
 			finGenlegReport.setDate(date);
 			finGenlegReportList.add(finGenlegReport);
 		}
+		List<Map<String, Object>> mapList = new ArrayList<>();
 		for (FinGenlegReport item : finGenlegReportList) {
 			FinGenlegReport finGenlegReport = new FinGenlegReport();
 			BeanUtil.copyProperties(item, finGenlegReport);
 			finGenlegReport.setDate(date);
 			map.put("gl_"+item.getAccCode(), finGenlegReport);
+			mapList.add(map);
 		}
 		Map<String, Object> sortedMap = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
 		sortedMap.putAll(map);
+		dept.setDate(startYear+"-"+startMonth);
 		sortedMap.put("dept", dept);
+		sortedMap.put("mapList", mapList);
 		return R.data(sortedMap);
 	}
 

+ 46 - 9
blade-service/blade-los/src/main/java/org/springblade/los/statisticAnalysis/service/impl/StatisticAnalysisServiceImpl.java

@@ -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);

+ 6 - 2
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/controller/PurchaseOrderController.java

@@ -43,14 +43,12 @@ import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 import java.math.BigDecimal;
-import java.math.BigInteger;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -174,6 +172,7 @@ public class PurchaseOrderController extends BladeController {
 					 @RequestParam(value = "orderType", required = false) String orderType,//是否生成发货 0 否 1 是
 					 @RequestParam(value = "srcOrderNo", required = false) String srcOrderNo,//是否生成发货 0 否 1 是
 					 @RequestParam(value = "orderAmount", required = false) String orderAmount,//采购金额
+					 @RequestParam(value = "tabType", required = false) String tabType,
 					 Order order
 	) {
 
@@ -235,6 +234,11 @@ public class PurchaseOrderController extends BladeController {
 		if (ObjectUtils.isNotNull(createFreight)) {
 			queryWrapper.eq("create_freight", createFreight);
 		}
+		if ("1".equals(tabType)) {
+			queryWrapper.apply("order_status != '货备齐'");
+		} else if ("2".equals(tabType)) {
+			queryWrapper.eq("order_status", "货备齐");
+		}
 		queryWrapper.orderByDesc("create_time");
 		queryWrapper.orderByDesc("src_order_no");
 		Page<Order> page = new Page<>(current, size);