Browse Source

2023年2月1日17:06:15

纪新园 2 years ago
parent
commit
c51db18c84

+ 31 - 5
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/service/impl/TradingBoxServiceImpl.java

@@ -746,7 +746,29 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 
 			auditProecessDTO.setProcessType("卖箱审批");
 
-		} else {
+		} else if ("ZR".equals(tradingBox.getType()) && checkFlag == 3) {
+			if (tradingBox.getCheckFlag() == 3 && selectTradingBox.getStatus() != 0) {
+				throw new SecurityException("订单已开启审核,请勿重复提交");
+			}
+			//是否开启流程
+			pathsActs = iCheckClient.getActsByActId(113, "status");
+			//获取审批信息
+			auditPathsLevels = iCheckClient.listLevelsByActId(113, "status");
+
+			auditProecessDTO.setProcessType("租入审批");
+
+		}else if ("ZC".equals(tradingBox.getType()) && checkFlag == 4) {
+			if (tradingBox.getCheckFlag() == 4 && selectTradingBox.getStatus() != 0) {
+				throw new SecurityException("订单已开启审核,请勿重复提交");
+			}
+			//是否开启流程
+			pathsActs = iCheckClient.getActsByActId(114, "status");
+			//获取审批信息
+			auditPathsLevels = iCheckClient.listLevelsByActId(114, "status");
+
+			auditProecessDTO.setProcessType("租出审批");
+
+		}else {
 			throw new SecurityException("请核失败:请核标识设置不正确");
 		}
 
@@ -1712,10 +1734,14 @@ public class TradingBoxServiceImpl extends ServiceImpl<TradingBoxMapper, Trading
 
 		//账单数据
 		ApplyDTO applyDTO = new ApplyDTO();
-		if ("BUY".equals(billType)) {
-			applyDTO.setBillType("申请");
-		} else {
-			applyDTO.setBillType("收费");
+		if ("ZR".equals(billType) || "ZC".equals(billType)){
+			applyDTO.setBillType("");
+		}else{
+			if ("BUY".equals(billType)) {
+				applyDTO.setBillType("申请");
+			} else {
+				applyDTO.setBillType("收费");
+			}
 		}
 		applyDTO.setTradeType("BOX");
 		applyDTO.setBelongCompany(tradingBox.getPurchaseCompanyName());

+ 1 - 1
blade-service/blade-check/src/main/java/org/springblade/check/controller/AuditProecessController.java

@@ -345,7 +345,7 @@ public class AuditProecessController extends BladeController {
 			auditProecessService.cmyCheck(auditProecess);
 		} else if ("rzgl".equals(proecess.getCheckType())) {
 			auditProecessService.financingyCheck(auditProecess);
-		} else if ("BUY".equals(proecess.getCheckType()) || "SELL".equals(proecess.getCheckType())) {
+		} else if ("BUY".equals(proecess.getCheckType()) || "SELL".equals(proecess.getCheckType()) || "ZR".equals(proecess.getCheckType()) || "ZC".equals(proecess.getCheckType())) {
 			auditProecessService.tradingBoxCheck(auditProecess);
 		} else if ("CKZY".equals(proecess.getCheckType()) || "JKFC".equals(proecess.getCheckType())) {
 			auditProecessService.transportCheck(auditProecess);

+ 33 - 13
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/OrderServiceImpl.java

@@ -47,7 +47,6 @@ import org.springblade.land.util.MessageUtil;
 import org.springblade.land.vo.DataAnalysisVO;
 import org.springblade.land.vo.OrderAcctVO;
 import org.springblade.land.vo.OrderVO;
-import org.springblade.purchase.sales.entity.Order;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
 import org.springblade.system.user.entity.User;
@@ -854,45 +853,66 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 			//客户
 			if (!ObjectUtil.isEmpty(record.getCorpId())) {
 				if (ObjectUtil.isNotEmpty(corpsDescList)) {
-					record.setCorpName(corpsDescList.stream().filter(e -> e.getId().equals(record.getCorpId())).findFirst().get().getCname());
-					record.setCorpShortName(corpsDescList.stream().filter(e -> e.getId().equals(record.getCorpId())).findFirst().get().getShortName());
+					CorpsDesc corpsDesc = fleetList.stream().anyMatch(e -> e.getId().equals(record.getCorpId())) ? fleetList.stream().filter(e -> e.getId().equals(record.getCorpId())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(corpsDesc)) {
+						record.setCreateUserName(corpsDesc.getCname());
+						record.setCorpShortName(corpsDesc.getShortName());
+					}
 				}
 			}
 			//创建人
 			if (!ObjectUtil.isEmpty(record.getCreateUser())) {
 				if (ObjectUtil.isNotEmpty(createUserList)) {
-					record.setCreateUserName(createUserList.stream().filter(e -> e.getId().equals(record.getCreateUser())).findFirst().get().getRealName());
+					User user = dispatcherList.stream().anyMatch(e -> e.getId().equals(record.getCreateUser())) ? dispatcherList.stream().filter(e -> e.getId().equals(record.getCreateUser())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						record.setCreateUserName(user.getRealName());
+					}
 				}
 			}
 			//业务员
 			if (!ObjectUtil.isEmpty(record.getSalesman())) {
 				if (ObjectUtil.isNotEmpty(salesmanList)) {
-					record.setSalesmanName(salesmanList.stream().filter(e -> e.getId().equals(record.getSalesman())).findFirst().get().getRealName());
+					User user = dispatcherList.stream().anyMatch(e -> e.getId().equals(record.getSalesman())) ? dispatcherList.stream().filter(e -> e.getId().equals(record.getSalesman())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						record.setSalesmanName(user.getRealName());
+					}
 				}
 			}
 			//调度员
 			if (!ObjectUtil.isEmpty(record.getDispatcher())) {
 				if (ObjectUtil.isNotEmpty(dispatcherList)) {
-					record.setDispatcherName(dispatcherList.stream().filter(e -> e.getId().equals(record.getDispatcher())).findFirst().get().getRealName());
+					User user = dispatcherList.stream().anyMatch(e -> e.getId().equals(record.getDispatcher())) ? dispatcherList.stream().filter(e -> e.getId().equals(record.getDispatcher())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						record.setDispatcherName(user.getRealName());
+					}
 				}
 			}
 			//调度部门
 			if (!ObjectUtil.isEmpty(record.getDispatchDept())) {
 				if (ObjectUtil.isNotEmpty(dispatchDeptList)) {
-					record.setDispatchDeptName(dispatchDeptList.getData().stream().filter(e -> e.getId().equals(record.getDispatchDept())).findFirst().get().getDeptName());
+					User user = dispatcherList.stream().anyMatch(e -> e.getId().equals(record.getDispatchDept())) ? dispatcherList.stream().filter(e -> e.getId().equals(record.getDispatchDept())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						record.setDispatchDeptName(user.getRealName());
+					}
 				}
 			}
 			//车队
 			if (!ObjectUtil.isEmpty(record.getFleetId())) {
 				if (ObjectUtil.isNotEmpty(fleetList)) {
-					record.setFleetName(fleetList.stream().filter(e -> e.getId().equals(record.getFleetId())).findFirst().get().getCname());
-					record.setFleetShortName(fleetList.stream().filter(e -> e.getId().equals(record.getFleetId())).findFirst().get().getShortName());
+					CorpsDesc corpsDesc = fleetList.stream().anyMatch(e -> e.getId().equals(record.getFleetId())) ? fleetList.stream().filter(e -> e.getId().equals(record.getFleetId())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(corpsDesc)) {
+						record.setFleetName(corpsDesc.getCname());
+						record.setFleetShortName(corpsDesc.getShortName());
+					}
 				}
 			}
 			//司机
 			if (!ObjectUtil.isEmpty(record.getDriverId())) {
 				if (ObjectUtil.isNotEmpty(driverList)) {
-					record.setDriverName(driverList.stream().filter(e -> e.getId().equals(record.getDriverId())).findFirst().get().getName());
+					LandDriver landDriver = driverList.stream().anyMatch(e -> e.getId().equals(record.getDriverId())) ? driverList.stream().filter(e -> e.getId().equals(record.getDriverId())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(landDriver)) {
+						record.setFleetName(landDriver.getName());
+					}
 				}
 			}
 			//装货地址货物体积总和
@@ -1301,7 +1321,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 			for (Acc acc_ : r.getData()) {
 				//判断是否有结算 true 不允许撤销审核  false 删除账单信息并撤销审核
 				if (!acc_.getSettlementAmount().equals(new BigDecimal("0.00"))) {
-					throw new SecurityException("订单已结算,不允许撤销");
+					throw new SecurityException("订单已结算,更新账单失败");
 				} else {
 					financeClient.remove(acc_.getId() + "");
 				}
@@ -1419,7 +1439,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 		lambdaQueryWrapper.eq(OrderFee::getIsDeleted, 0);
 		lambdaQueryWrapper.eq(OrderFee::getOrderId, pid);
 		lambdaQueryWrapper.eq(OrderFee::getTenantId, AuthUtil.getTenantId());
-		lambdaQueryWrapper.eq(OrderFee::getSubmitPay, 0);
+//		lambdaQueryWrapper.eq(OrderFee::getSubmitPay, 0);
 		List<OrderFee> transportItemFeesList = orderFeeMapper.selectList(lambdaQueryWrapper);
 		if (CollectionUtils.isNotEmpty(transportItemFeesList)) {
 			for (OrderFee transportItemFees : transportItemFeesList) {
@@ -1433,7 +1453,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 					for (Acc acc_ : r1.getData()) {
 						//判断是否有结算 true 不允许撤销审核  false 删除账单信息并撤销审核
 						if (!acc_.getSettlementAmount().equals(new BigDecimal("0.00"))) {
-							throw new SecurityException("订单已结算,不允许撤销");
+							throw new SecurityException("订单已结算,更新账单失败");
 						} else {
 							financeClient.remove(acc_.getId() + "");
 						}

+ 6 - 0
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/partsapp/AppPartsController.java

@@ -161,6 +161,9 @@ public class AppPartsController extends BladeController {
 		if ("1".equals(order.getModular())) {
 			lambdaQueryWrapper.apply("balance_amount > 0");
 		}
+		if (AuthUtil.getUserRole().contains("销售") || AuthUtil.getUserRole().contains("业务员")){
+			lambdaQueryWrapper.eq(Order::getCreateUser,AuthUtil.getUserId());
+		}
 		if ("0".equals(order.getSort())) {
 			if ("1".equals(order.getTypeSort())) {
 				lambdaQueryWrapper.orderByAsc(Order::getCorpId);
@@ -354,6 +357,9 @@ public class AppPartsController extends BladeController {
 		lambdaQueryWrapper.eq(Order::getTradeType, OrderTypeEnum.PARTS.getType());
 		lambdaQueryWrapper.eq(Order::getConfirmStatus, 1);
 		lambdaQueryWrapper.eq(ObjectUtils.isNotNull(order.getSalesName()), Order::getSalesName, order.getSalesName());//业务员
+		if (AuthUtil.getUserRole().contains("销售") || AuthUtil.getUserRole().contains("业务员")){
+			lambdaQueryWrapper.eq(Order::getCreateUser,AuthUtil.getUserId());
+		}
 		List<Order> orderList = orderService.list(lambdaQueryWrapper);
 
 		BigDecimal total = new BigDecimal("0.00");

+ 68 - 30
blade-service/trade-finance/src/main/java/org/springblade/finance/controller/ProfitStatisticsController.java

@@ -39,7 +39,6 @@ public class ProfitStatisticsController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入acc")
 	public R<IPage<AccProfitStatisticsExcel>> list(AccProfitStatisticsExcel accProfitStatisticsExcel, Query query) {
-		accProfitStatisticsExcel.setBillType("收费");
 		IPage<AccProfitStatisticsExcel> pages = new Page<>();
 		if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
 			pages = accService.accProfitStatisticsCode(Condition.getPage(query), accProfitStatisticsExcel);
@@ -47,27 +46,47 @@ public class ProfitStatisticsController {
 			pages = accService.accProfitStatistics(Condition.getPage(query), accProfitStatisticsExcel);
 		}
 		for (AccProfitStatisticsExcel accOne : pages.getRecords()) {
-			AccProfitStatisticsExcel accProfitStatisticsExcel1 = new AccProfitStatisticsExcel();
-			accProfitStatisticsExcel1.setBillType("付费");
-			AccProfitStatisticsExcel accProfitStatisticsExcel_ = new AccProfitStatisticsExcel();
+
+			AccProfitStatisticsExcel accProfitStatisticsCollect = new AccProfitStatisticsExcel();
+			accProfitStatisticsCollect.setBillType("收费");
+			AccProfitStatisticsExcel accProfitStatisticsExcelCollect = new AccProfitStatisticsExcel();
+			if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
+				accProfitStatisticsCollect.setSrcSysno(accOne.getSrcSysno());
+				accProfitStatisticsCollect.setWhetherStatistics("1");
+				accProfitStatisticsExcelCollect = accService.getAccProfitStatisticsCode(accProfitStatisticsCollect);
+			} else {
+				accProfitStatisticsCollect.setAccSysNo(accOne.getAccSysNo());
+				accProfitStatisticsCollect.setWhetherStatistics("0");
+				accProfitStatisticsExcelCollect = accService.getAccProfitStatistics(accProfitStatisticsCollect);
+			}
+			if (ObjectUtils.isNotNull(accProfitStatisticsExcelCollect)) {
+				accOne.setReceivableAmount(accProfitStatisticsExcelCollect.getReceivableAmount());
+				accOne.setReceivedAmount(accProfitStatisticsExcelCollect.getReceivedAmount());
+			} else {
+				accOne.setReceivableAmount(new BigDecimal("0.00"));
+				accOne.setReceivedAmount(new BigDecimal("0.00"));
+			}
+
+			AccProfitStatisticsExcel accProfitStatisticsPay = new AccProfitStatisticsExcel();
+			accProfitStatisticsPay.setBillType("申请");
+			AccProfitStatisticsExcel accProfitStatisticsExcelPay = new AccProfitStatisticsExcel();
 			if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
-				accProfitStatisticsExcel1.setSrcSysno(accOne.getSrcSysno());
-				accProfitStatisticsExcel1.setWhetherStatistics("1");
-				accProfitStatisticsExcel_ = accService.getAccProfitStatisticsCode(accProfitStatisticsExcel1);
+				accProfitStatisticsPay.setSrcSysno(accOne.getSrcSysno());
+				accProfitStatisticsPay.setWhetherStatistics("1");
+				accProfitStatisticsExcelPay = accService.getAccProfitStatisticsCode(accProfitStatisticsPay);
 			} else {
-				accProfitStatisticsExcel1.setAccSysNo(accOne.getAccSysNo());
-				accProfitStatisticsExcel1.setWhetherStatistics("0");
-				accProfitStatisticsExcel_ = accService.getAccProfitStatistics(accProfitStatisticsExcel1);
+				accProfitStatisticsPay.setAccSysNo(accOne.getAccSysNo());
+				accProfitStatisticsPay.setWhetherStatistics("0");
+				accProfitStatisticsExcelPay = accService.getAccProfitStatistics(accProfitStatisticsPay);
 			}
-			if (ObjectUtils.isNotNull(accProfitStatisticsExcel_)) {
-				accOne.setAnswerPayAmount(accProfitStatisticsExcel_.getAnswerPayAmount());
-				accOne.setAlreadyPayAmount(accProfitStatisticsExcel_.getAlreadyPayAmount());
-				accOne.setProfitAmount(accOne.getReceivableAmount().subtract(accProfitStatisticsExcel_.getAnswerPayAmount()));
+			if (ObjectUtils.isNotNull(accProfitStatisticsExcelPay)) {
+				accOne.setAnswerPayAmount(accProfitStatisticsExcelPay.getAnswerPayAmount());
+				accOne.setAlreadyPayAmount(accProfitStatisticsExcelPay.getAlreadyPayAmount());
 			} else {
 				accOne.setAnswerPayAmount(new BigDecimal("0.00"));
 				accOne.setAlreadyPayAmount(new BigDecimal("0.00"));
-				accOne.setProfitAmount(accOne.getReceivableAmount().subtract(new BigDecimal("0.00")));
 			}
+			accOne.setProfitAmount(accOne.getReceivableAmount().subtract(accOne.getAnswerPayAmount()));
 			accOne.setDate(accProfitStatisticsExcel.getDate());
 		}
 		return R.data(pages);
@@ -80,7 +99,7 @@ public class ProfitStatisticsController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入acc")
 	public void export(AccProfitStatisticsExcel accProfitStatisticsExcel, HttpServletResponse response) {
-		accProfitStatisticsExcel.setBillType("收费");
+		accProfitStatisticsExcel.setBillType("申请");
 		List<AccProfitStatisticsExcel> accProfitStatisticsExcelList = new ArrayList<>();
 		if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
 			accProfitStatisticsExcelList = accService.accProfitStatisticsListcode(accProfitStatisticsExcel);
@@ -88,27 +107,46 @@ public class ProfitStatisticsController {
 			accProfitStatisticsExcelList = accService.accProfitStatisticsList(accProfitStatisticsExcel);
 		}
 		for (AccProfitStatisticsExcel accOne : accProfitStatisticsExcelList) {
-			AccProfitStatisticsExcel accProfitStatisticsExcel1 = new AccProfitStatisticsExcel();
-			accProfitStatisticsExcel1.setBillType("付费");
-			AccProfitStatisticsExcel accProfitStatisticsExcel_ = new AccProfitStatisticsExcel();
+			AccProfitStatisticsExcel accProfitStatisticsCollect = new AccProfitStatisticsExcel();
+			accProfitStatisticsCollect.setBillType("收费");
+			AccProfitStatisticsExcel accProfitStatisticsExcelCollect = new AccProfitStatisticsExcel();
+			if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
+				accProfitStatisticsCollect.setSrcSysno(accOne.getSrcSysno());
+				accProfitStatisticsCollect.setWhetherStatistics("1");
+				accProfitStatisticsExcelCollect = accService.getAccProfitStatisticsCode(accProfitStatisticsCollect);
+			} else {
+				accProfitStatisticsCollect.setAccSysNo(accOne.getAccSysNo());
+				accProfitStatisticsCollect.setWhetherStatistics("0");
+				accProfitStatisticsExcelCollect = accService.getAccProfitStatistics(accProfitStatisticsCollect);
+			}
+			if (ObjectUtils.isNotNull(accProfitStatisticsExcelCollect)) {
+				accOne.setReceivableAmount(accProfitStatisticsExcelCollect.getReceivableAmount());
+				accOne.setReceivedAmount(accProfitStatisticsExcelCollect.getReceivedAmount());
+			} else {
+				accOne.setReceivableAmount(new BigDecimal("0.00"));
+				accOne.setReceivedAmount(new BigDecimal("0.00"));
+			}
+
+			AccProfitStatisticsExcel accProfitStatisticsPay = new AccProfitStatisticsExcel();
+			accProfitStatisticsPay.setBillType("申请");
+			AccProfitStatisticsExcel accProfitStatisticsExcelPay = new AccProfitStatisticsExcel();
 			if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
-				accProfitStatisticsExcel1.setSrcSysno(accOne.getSrcSysno());
-				accProfitStatisticsExcel1.setWhetherStatistics("1");
-				accProfitStatisticsExcel_ = accService.getAccProfitStatisticsCode(accProfitStatisticsExcel1);
+				accProfitStatisticsPay.setSrcSysno(accOne.getSrcSysno());
+				accProfitStatisticsPay.setWhetherStatistics("1");
+				accProfitStatisticsExcelPay = accService.getAccProfitStatisticsCode(accProfitStatisticsPay);
 			} else {
-				accProfitStatisticsExcel1.setAccSysNo(accOne.getAccSysNo());
-				accProfitStatisticsExcel1.setWhetherStatistics("0");
-				accProfitStatisticsExcel_ = accService.getAccProfitStatistics(accProfitStatisticsExcel1);
+				accProfitStatisticsPay.setAccSysNo(accOne.getAccSysNo());
+				accProfitStatisticsPay.setWhetherStatistics("0");
+				accProfitStatisticsExcelPay = accService.getAccProfitStatistics(accProfitStatisticsPay);
 			}
-			if (ObjectUtils.isNotNull(accProfitStatisticsExcel_)) {
-				accOne.setAnswerPayAmount(accProfitStatisticsExcel_.getAnswerPayAmount());
-				accOne.setAlreadyPayAmount(accProfitStatisticsExcel_.getAlreadyPayAmount());
-				accOne.setProfitAmount(accOne.getReceivableAmount().subtract(accProfitStatisticsExcel_.getAnswerPayAmount()));
+			if (ObjectUtils.isNotNull(accProfitStatisticsExcelPay)) {
+				accOne.setAnswerPayAmount(accProfitStatisticsExcelPay.getAnswerPayAmount());
+				accOne.setAlreadyPayAmount(accProfitStatisticsExcelPay.getAlreadyPayAmount());
 			} else {
 				accOne.setAnswerPayAmount(new BigDecimal("0.00"));
 				accOne.setAlreadyPayAmount(new BigDecimal("0.00"));
-				accOne.setProfitAmount(accOne.getReceivableAmount().subtract(new BigDecimal("0.00")));
 			}
+			accOne.setProfitAmount(accOne.getReceivableAmount().subtract(accOne.getAnswerPayAmount()));
 			accOne.setDate(accProfitStatisticsExcel.getDate());
 		}
 		ExcelUtil.export(response, "收付费利润统计", "收付费利润统计", accProfitStatisticsExcelList, AccProfitStatisticsExcel.class);

+ 6 - 0
blade-service/trade-finance/src/main/java/org/springblade/finance/excel/AccProfitStatisticsExcel.java

@@ -109,4 +109,10 @@ public class AccProfitStatisticsExcel implements Serializable {
 	 */
 	@TableField(exist = false)
 	private String whetherStatistics;
+
+	/**
+	 * 是否显示为 0
+	 */
+	@TableField(exist = false)
+	private String show;
 }

+ 10 - 28
blade-service/trade-finance/src/main/java/org/springblade/finance/mapper/AccMapper.xml

@@ -575,11 +575,7 @@
             GROUP_CONCAT( DISTINCT fa.Src_Bill_NO SEPARATOR ',' ) AS srcBillNo,
             GROUP_CONCAT( DISTINCT fa.Src_SysNo SEPARATOR ',' ) AS srcSysno,
             GROUP_CONCAT( DISTINCT bcd.cname SEPARATOR ',' ) AS corpName,
-            GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company,
-            sum( ifnull( fa.Amount, 0 ) ) AS receivableAmount,
-            sum( ifnull( fa.Settlement_Amount, 0 ) ) AS receivedAmount,
-            sum( ifnull( fa.Amount, 0 ) ) AS answerPayAmount,
-            sum( ifnull( fa.Settlement_Amount, 0 ) ) AS alreadyPayAmount
+            GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company
         FROM
             finance_acc fa
             LEFT JOIN basic_corps_desc bcd ON fa.Corpid = bcd.id
@@ -612,11 +608,7 @@
         GROUP_CONCAT( DISTINCT fa.Src_Bill_NO SEPARATOR ',' ) AS srcBillNo,
         fa.Src_SysNo AS srcSysno,
         GROUP_CONCAT( DISTINCT bcd.cname SEPARATOR ',' ) AS corpName,
-        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company,
-        sum( ifnull( fa.Amount, 0 ) ) AS receivableAmount,
-        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS receivedAmount,
-        sum( ifnull( fa.Amount, 0 ) ) AS answerPayAmount,
-        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS alreadyPayAmount
+        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company
         FROM
         finance_acc fa
         LEFT JOIN basic_corps_desc bcd ON fa.Corpid = bcd.id
@@ -646,10 +638,6 @@
     <select id="getAccProfitStatistics" resultType="org.springblade.finance.excel.AccProfitStatisticsExcel">
         SELECT
         fa.AccSysNo AS accSysNo,
-        GROUP_CONCAT( DISTINCT fa.Src_Bill_NO SEPARATOR ',' ) AS srcBillNo,
-        GROUP_CONCAT( DISTINCT fa.Src_SysNo SEPARATOR ',' ) AS srcSysno,
-        GROUP_CONCAT( DISTINCT bcd.cname SEPARATOR ',' ) AS corpName,
-        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company,
         sum( ifnull( fa.Amount, 0 ) ) AS receivableAmount,
         sum( ifnull( fa.Settlement_Amount, 0 ) ) AS receivedAmount,
         sum( ifnull( fa.Amount, 0 ) ) AS answerPayAmount,
@@ -677,6 +665,9 @@
         <if test="accProfitStatisticsExcel.date != null">
             AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
         </if>
+        <if test="accProfitStatisticsExcel.show != null and accProfitStatisticsExcel.show !='' and accProfitStatisticsExcel.show == 0">
+            AND fa.Amount > 0
+        </if>
             GROUP BY fa.AccSysNo
     </select>
     <select id="accProfitStatisticsList" resultType="org.springblade.finance.excel.AccProfitStatisticsExcel">
@@ -685,11 +676,7 @@
         GROUP_CONCAT( DISTINCT fa.Src_Bill_NO SEPARATOR ',' ) AS srcBillNo,
         GROUP_CONCAT( DISTINCT fa.Src_SysNo SEPARATOR ',' ) AS srcSysno,
         GROUP_CONCAT( DISTINCT bcd.cname SEPARATOR ',' ) AS corpName,
-        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company,
-        sum( ifnull( fa.Amount, 0 ) ) AS receivableAmount,
-        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS receivedAmount,
-        sum( ifnull( fa.Amount, 0 ) ) AS answerPayAmount,
-        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS alreadyPayAmount
+        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company
         FROM
         finance_acc fa
         LEFT JOIN basic_corps_desc bcd ON fa.Corpid = bcd.id
@@ -722,11 +709,7 @@
         GROUP_CONCAT( DISTINCT fa.Src_Bill_NO SEPARATOR ',' ) AS srcBillNo,
         fa.Src_SysNo AS srcSysno,
         GROUP_CONCAT( DISTINCT bcd.cname SEPARATOR ',' ) AS corpName,
-        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company,
-        sum( ifnull( fa.Amount, 0 ) ) AS receivableAmount,
-        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS receivedAmount,
-        sum( ifnull( fa.Amount, 0 ) ) AS answerPayAmount,
-        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS alreadyPayAmount
+        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company
         FROM
         finance_acc fa
         LEFT JOIN basic_corps_desc bcd ON fa.Corpid = bcd.id
@@ -755,11 +738,7 @@
     <select id="getAccProfitStatisticsCode"
             resultType="org.springblade.finance.excel.AccProfitStatisticsExcel">
         SELECT
-        GROUP_CONCAT( DISTINCT fa.AccSysNo SEPARATOR ',' ) AS accSysNo,
-        GROUP_CONCAT( DISTINCT fa.Src_Bill_NO SEPARATOR ',' ) AS srcBillNo,
         fa.Src_SysNo AS srcSysno,
-        GROUP_CONCAT( DISTINCT bcd.cname SEPARATOR ',' ) AS corpName,
-        GROUP_CONCAT( DISTINCT bcd1.cname SEPARATOR ',' ) AS company,
         sum( ifnull( fa.Amount, 0 ) ) AS receivableAmount,
         sum( ifnull( fa.Settlement_Amount, 0 ) ) AS receivedAmount,
         sum( ifnull( fa.Amount, 0 ) ) AS answerPayAmount,
@@ -787,6 +766,9 @@
         <if test="accProfitStatisticsExcel.date != null">
             AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
         </if>
+        <if test="accProfitStatisticsExcel.show != null and accProfitStatisticsExcel.show !='' and accProfitStatisticsExcel.show == 0">
+            AND fa.Amount > 0
+        </if>
             GROUP BY fa.Src_SysNo
     </select>
 

+ 5 - 2
blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/SettlementServiceImpl.java

@@ -2758,9 +2758,12 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 			if ("064132".equals(AuthUtil.getTenantId())){
 				acc.setBillType(e.getSrcFeesType());
 			}else {
-				acc.setBillType(billType);
+				if (ObjectUtils.isNotNull(billType)){
+					acc.setBillType(billType);
+				}else{
+					acc.setBillType(e.getSrcFeesType());
+				}
 			}
-
 			if ("收费".equals(e.getSrcFeesType())) {
 				acc.setDc("d");
 			} else {

+ 16 - 31
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/controller/PurchaseOrderController.java

@@ -277,7 +277,7 @@ public class PurchaseOrderController extends BladeController {
 				if (e.getBelongToCorpId() != null) {
 					if (ObjectUtil.isNotEmpty(belongToCorpList)) {
 						CorpsDesc corpsDesc = belongToCorpList.stream().filter(d -> d.getId().equals(e.getBelongToCorpId())).findFirst().orElse(null);
-						if (ObjectUtils.isNotNull(corpsDesc)){
+						if (ObjectUtils.isNotNull(corpsDesc)) {
 							e.setBelongToCorpName(corpsDesc.getCname());
 						}
 //						e.setBelongToCorpName(belongToCorpList.stream().filter(d -> d.getId().equals(e.getBelongToCorpId())).findFirst().get().getCname());
@@ -288,7 +288,7 @@ public class PurchaseOrderController extends BladeController {
 				if (e.getCreateUser() != null) {
 					if (ObjectUtil.isNotEmpty(createUserList)) {
 						User user = createUserList.stream().filter(d -> d.getId().equals(e.getCreateUser())).findFirst().orElse(null);
-						if (ObjectUtils.isNotNull(user)){
+						if (ObjectUtils.isNotNull(user)) {
 							e.setCreateUserName(user.getName());
 						}
 //						e.setCreateUserName(createUserList.stream().filter(d -> d.getId().equals(e.getCreateUser())).findFirst().get().getRealName());
@@ -299,7 +299,7 @@ public class PurchaseOrderController extends BladeController {
 				if (e.getUpdateUser() != null) {
 					if (ObjectUtil.isNotEmpty(updateUserList)) {
 						User user = updateUserList.stream().filter(d -> d.getId().equals(e.getCreateUser())).findFirst().orElse(null);
-						if (ObjectUtils.isNotNull(user)){
+						if (ObjectUtils.isNotNull(user)) {
 							e.setUpdateUserName(user.getName());
 						}
 //						e.setUpdateUserName(updateUserList.stream().filter(d -> d.getId().equals(e.getUpdateUser())).findFirst().get().getRealName());
@@ -310,7 +310,7 @@ public class PurchaseOrderController extends BladeController {
 				if (e.getCorpId() != null) {
 					if (ObjectUtil.isNotEmpty(corpList)) {
 						CorpsDesc corpsDesc = corpList.stream().filter(d -> d.getId().equals(e.getCorpId())).findFirst().orElse(null);
-						if (ObjectUtils.isNotNull(corpsDesc)){
+						if (ObjectUtils.isNotNull(corpsDesc)) {
 							e.setStrCorpName(corpsDesc.getCname());
 						}
 //						e.setStrCorpName(corpList.stream().filter(d -> d.getId().equals(e.getCorpId())).findFirst().get().getCname());
@@ -320,7 +320,7 @@ public class PurchaseOrderController extends BladeController {
 				if (e.getPurchaserId() != null) {
 					if (ObjectUtil.isNotEmpty(purchaserList)) {
 						CorpsDesc corpsDesc = purchaserList.stream().filter(d -> d.getId().equals(e.getPurchaserId())).findFirst().orElse(null);
-						if (ObjectUtils.isNotNull(corpsDesc)){
+						if (ObjectUtils.isNotNull(corpsDesc)) {
 							e.setStrPurchaserName(corpsDesc.getCname());
 						}
 //						e.setStrPurchaserName(purchaserList.stream().filter(d -> d.getId().equals(e.getPurchaserId())).findFirst().get().getCname());
@@ -893,18 +893,13 @@ public class PurchaseOrderController extends BladeController {
 		int size = rubberStockDto.getSize() == null ? 1 : rubberStockDto.getSize();
 		iPage.setCurrent(current);
 		iPage.setSize(size);
-		if ("1".equals(rubberStockDto.getRubberDistinguish())){
+		CorpsDesc corpsDesc = new CorpsDesc();
+		corpsDesc.setTenantId(AuthUtil.getTenantId());
+		List<CorpsDesc> corpsDescList = corpsDescClient.getCorp(corpsDesc);
+		//商品
+		List<GoodsDesc> goodsList = goodsDescClient.selectGoodsDescAll();
+		if ("1".equals(rubberStockDto.getRubberDistinguish())) {
 			IPage<RubberStockDto> pages = orderService.rubberStock(iPage, rubberStockDto);
-			//客户
-			List<CorpsDesc> corpsDescList = castToList(redisTemplate.opsForValue().get("corps"), CorpsDesc.class);
-			if (ObjectUtils.isNull(corpsDescList)) {
-				CorpsDesc corpsDesc = new CorpsDesc();
-				corpsDesc.setTenantId(AuthUtil.getTenantId());
-				corpsDescList = corpsDescClient.getCorp(corpsDesc);
-				redisClient.basicData("all");
-			}
-			//商品
-			List<GoodsDesc> goodsList = castToList(redisTemplate.opsForValue().get("goods"), GoodsDesc.class);
 			for (RubberStockDto rubberStock : pages.getRecords()) {
 				//获取供应商中文名
 				CorpsDesc corpMessage = corpsDescList.stream().filter(corp -> corp.getId().equals(rubberStock.getCorpIdC())).findFirst().orElse(null);
@@ -931,28 +926,18 @@ public class PurchaseOrderController extends BladeController {
 				if (ObjectUtils.isNotNull(goodsDesc)) {
 					rubberStock.setItemNameC(goodsDesc.getCname());
 				}
-				if(ObjectUtils.isNotNull(rubberStock.getAmountX()) && ObjectUtils.isNotNull(rubberStock.getAmountC())){
+				if (ObjectUtils.isNotNull(rubberStock.getAmountX()) && ObjectUtils.isNotNull(rubberStock.getAmountC())) {
 					rubberStock.setProfit(rubberStock.getAmountX().subtract(rubberStock.getAmountC()));
 					rubberStock.setNoProfit(rubberStock.getAmountX().subtract(rubberStock.getAmountC()));
-				}else{
+				} else {
 					rubberStock.setProfit(new BigDecimal(0.00));
 					rubberStock.setNoProfit(new BigDecimal(0.00));
 				}
 
 			}
 			return R.data(pages);
-		}else{
+		} else {
 			IPage<RubberStockDto> pages = orderService.rubberStockXS(iPage, rubberStockDto);
-			//客户
-			List<CorpsDesc> corpsDescList = castToList(redisTemplate.opsForValue().get("corps"), CorpsDesc.class);
-			if (ObjectUtils.isNull(corpsDescList)) {
-				CorpsDesc corpsDesc = new CorpsDesc();
-				corpsDesc.setTenantId(AuthUtil.getTenantId());
-				corpsDescList = corpsDescClient.getCorp(corpsDesc);
-				redisClient.basicData("all");
-			}
-			//商品
-			List<GoodsDesc> goodsList = castToList(redisTemplate.opsForValue().get("goods"), GoodsDesc.class);
 			for (RubberStockDto rubberStock : pages.getRecords()) {
 				//获取供应商中文名
 				CorpsDesc corpMessage = corpsDescList.stream().filter(corp -> corp.getId().equals(rubberStock.getCorpIdC())).findFirst().orElse(null);
@@ -979,10 +964,10 @@ public class PurchaseOrderController extends BladeController {
 				if (ObjectUtils.isNotNull(goodsDesc)) {
 					rubberStock.setItemNameC(goodsDesc.getCname());
 				}
-				if(ObjectUtils.isNotNull(rubberStock.getAmountX()) && ObjectUtils.isNotNull(rubberStock.getAmountC())){
+				if (ObjectUtils.isNotNull(rubberStock.getAmountX()) && ObjectUtils.isNotNull(rubberStock.getAmountC())) {
 					rubberStock.setProfit(rubberStock.getAmountX().subtract(rubberStock.getAmountC()));
 					rubberStock.setNoProfit(rubberStock.getAmountX().subtract(rubberStock.getAmountC()));
-				}else{
+				} else {
 					rubberStock.setProfit(new BigDecimal(0.00));
 					rubberStock.setNoProfit(new BigDecimal(0.00));
 				}