Browse Source

2023年2月1日08:29:42

纪新园 2 years ago
parent
commit
07bf1f9db0

+ 2 - 2
blade-service-api/trade-finance-api/src/main/java/org/springblade/finance/feign/IFinanceClient.java

@@ -36,8 +36,8 @@ public interface IFinanceClient {
 	@GetMapping("/settlement/detail")
 	R<Settlement> detail(Settlement settlement);
 
-	@GetMapping("/settlement/listAll")
-	R<List<Settlement>> listAll(@RequestBody Settlement settlement);
+	@PostMapping("/settlement/dataAnalysisList")
+	R<List<Settlement>> dataAnalysisList(@RequestBody Settlement settlement);
 
 	@PostMapping("/settlement/getById")
 	R<Settlement> getById(@RequestParam Long id);

+ 1 - 0
blade-service/blade-box-tube/src/main/java/org/springblade/box/tube/mapper/ArchivesMapper.xml

@@ -46,6 +46,7 @@
             <if test="boxAccessStatus != null and boxAccessStatus !=''">box_access_status = #{boxAccessStatus},</if>
             <if test="addressId != null">address_id = #{addressId},</if>
             <if test="newDate != null">new_date = #{newDate},</if>
+            <if test="status != null and status != ''">status = #{status},</if>
         </trim>
         where code = #{code}
     </update>

+ 3 - 3
blade-service/blade-land/src/main/java/org/springblade/land/controller/StatisticsAnalysisController.java

@@ -71,11 +71,11 @@ public class StatisticsAnalysisController {
 			Settlement settlement = new Settlement();
 			settlement.setCorpId(dataAnalysisVO_.getCorpId());
 			settlement.setBillType("付费");
-			R<List<Settlement>> r = financeClient.listAll(settlement);
+			R<List<Settlement>> r = financeClient.dataAnalysisList(settlement);
 			if (r.isSuccess() && ObjectUtils.isNotNull(r.getData()) && r.getData().size() > 0) {
-				dataAnalysisVO_.setRealPay(r.getData().stream().map(Settlement::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
+				dataAnalysisVO_.setRealPay(r.getData().stream().filter(e -> e.getAmount().compareTo(new BigDecimal("0.00")) >= 0).map(Settlement::getAmount).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add));
 				dataAnalysisVO_.setNotPay(dataAnalysisVO_.getFreightPay().subtract(dataAnalysisVO_.getRealPay()).subtract(dataAnalysisVO_.getPlatformBuy()));
-			}else{
+			} else {
 				dataAnalysisVO_.setRealPay(new BigDecimal("0.00"));
 				dataAnalysisVO_.setNotPay(dataAnalysisVO_.getFreightPay().subtract(dataAnalysisVO_.getRealPay()).subtract(dataAnalysisVO_.getPlatformBuy()));
 			}

+ 2 - 2
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/OrderItemServiceImpl.java

@@ -490,7 +490,7 @@ public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem
 		addChange(id, "完工", 1);
 
 		OrderItem data = baseMapper.selectById(id);
-		LambdaQueryWrapper<OrderItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		/*LambdaQueryWrapper<OrderItem> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(OrderItem::getTenantId, AuthUtil.getTenantId())
 			.eq(OrderItem::getIsDeleted, 0)
 			.eq(OrderItem::getKind, 2)
@@ -506,7 +506,7 @@ public class OrderItemServiceImpl extends ServiceImpl<OrderItemMapper, OrderItem
 			LandOrder landOrder = new LandOrder();
 			landOrder.setId(data.getOrderId());
 			orderService.generateBill(landOrder);
-		}
+		}*/
 		sendMsgToCorp(data, "WG");
 		sendMsgToUser(data, "WG");
 		sendMsgToFleet(data, "WG");

+ 38 - 2
blade-service/blade-land/src/main/java/org/springblade/land/service/impl/OrderServiceImpl.java

@@ -37,6 +37,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.*;
 import org.springblade.finance.dto.ApplyDTO;
 import org.springblade.finance.feign.IFinanceClient;
+import org.springblade.finance.vojo.Acc;
 import org.springblade.finance.vojo.Items;
 import org.springblade.land.constant.LandConst;
 import org.springblade.land.entity.*;
@@ -1290,6 +1291,22 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 		if (ObjectUtils.isNull(order)) {
 			throw new RuntimeException("未查到单据信息");
 		}
+		//获取账单信息
+		Acc acc = new Acc();
+		acc.setSrcParentId(order.getId());
+		acc.setTradeType("ZDLU");
+		acc.setSrcType(9);
+		R<List<Acc>> r = financeClient.getAccListByCondition(acc);
+		if (r.isSuccess() && ObjectUtils.isNotNull(r.getData())) {
+			for (Acc acc_ : r.getData()) {
+				//判断是否有结算 true 不允许撤销审核  false 删除账单信息并撤销审核
+				if (!acc_.getSettlementAmount().equals(new BigDecimal("0.00"))) {
+					throw new SecurityException("订单已结算,不允许撤销");
+				} else {
+					financeClient.remove(acc_.getId() + "");
+				}
+			}
+		}
 		Long pid = order.getId();
 		List<Items> itemsList = new ArrayList<>();
 		Items LandOrderItems = new Items();
@@ -1309,9 +1326,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 		LandOrderItems.setCostType(pid.toString());
 		LandOrderItems.setSrcFeesId(pid);
 		CorpsDesc corpsDesc = corpsDescClient.getCorpId(order.getSalesman());
+		String chargeMember = "";
 		if (ObjectUtils.isNotNull(corpsDesc)) {
-			LandOrderItems.setChargeMember(corpsDesc.getCname());
+			chargeMember = corpsDesc.getCname();
 		}
+		LandOrderItems.setChargeMember(chargeMember);
 		LandOrderItems.setDepartureHarbor(order.getStation());
 		if (ObjectUtils.isNotNull(order.getDispatcher())) {
 			LandOrderItems.setShipName(order.getDispatcher() + "");
@@ -1404,6 +1423,22 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 		List<OrderFee> transportItemFeesList = orderFeeMapper.selectList(lambdaQueryWrapper);
 		if (CollectionUtils.isNotEmpty(transportItemFeesList)) {
 			for (OrderFee transportItemFees : transportItemFeesList) {
+				//获取账单信息
+				Acc acc1 = new Acc();
+				acc1.setSrcParentId(transportItemFees.getId());
+				acc1.setTradeType("ZDLU");
+				acc1.setSrcType(10);
+				R<List<Acc>> r1 = financeClient.getAccListByCondition(acc1);
+				if (r1.isSuccess() && ObjectUtils.isNotNull(r1.getData())) {
+					for (Acc acc_ : r1.getData()) {
+						//判断是否有结算 true 不允许撤销审核  false 删除账单信息并撤销审核
+						if (!acc_.getSettlementAmount().equals(new BigDecimal("0.00"))) {
+							throw new SecurityException("订单已结算,不允许撤销");
+						} else {
+							financeClient.remove(acc_.getId() + "");
+						}
+					}
+				}
 				Items items = new Items();
 				amount = transportItemFees.getAmount();
 				//计算单价
@@ -1441,7 +1476,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, LandOrder> implem
 				items.setStockTime(order.getBsDate());
 				items.setSrcSysNo(order.getOrderNo());
 				items.setFleetId(transportItemFees.getFleetId());
-				LandOrderItems.setPlateNo(transportItemFees.getPlateNo());
+				items.setChargeMember(chargeMember);
+				items.setPlateNo(transportItemFees.getPlateNo());
 				//获取费用id
 				if (ObjectUtils.isNotNull(transportItemFees.getFeeId())) {
 					items.setCostType(transportItemFees.getFeeId().toString());

+ 24 - 4
blade-service/trade-finance/src/main/java/org/springblade/finance/controller/ProfitStatisticsController.java

@@ -2,6 +2,7 @@ package org.springblade.finance.controller;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -18,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.servlet.http.HttpServletResponse;
 import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 
 
@@ -37,18 +39,26 @@ public class ProfitStatisticsController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入acc")
 	public R<IPage<AccProfitStatisticsExcel>> list(AccProfitStatisticsExcel accProfitStatisticsExcel, Query query) {
-		IPage<AccProfitStatisticsExcel> pages = accService.accProfitStatistics(Condition.getPage(query), accProfitStatisticsExcel);
+		accProfitStatisticsExcel.setBillType("收费");
+		IPage<AccProfitStatisticsExcel> pages = new Page<>();
+		if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
+			pages = accService.accProfitStatisticsCode(Condition.getPage(query), accProfitStatisticsExcel);
+		} else {
+			pages = accService.accProfitStatistics(Condition.getPage(query), accProfitStatisticsExcel);
+		}
 		for (AccProfitStatisticsExcel accOne : pages.getRecords()) {
 			AccProfitStatisticsExcel accProfitStatisticsExcel1 = new AccProfitStatisticsExcel();
 			accProfitStatisticsExcel1.setBillType("付费");
+			AccProfitStatisticsExcel accProfitStatisticsExcel_ = new AccProfitStatisticsExcel();
 			if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
 				accProfitStatisticsExcel1.setSrcSysno(accOne.getSrcSysno());
 				accProfitStatisticsExcel1.setWhetherStatistics("1");
+				accProfitStatisticsExcel_ = accService.getAccProfitStatisticsCode(accProfitStatisticsExcel1);
 			} else {
 				accProfitStatisticsExcel1.setAccSysNo(accOne.getAccSysNo());
 				accProfitStatisticsExcel1.setWhetherStatistics("0");
+				accProfitStatisticsExcel_ = accService.getAccProfitStatistics(accProfitStatisticsExcel1);
 			}
-			AccProfitStatisticsExcel accProfitStatisticsExcel_ = accService.getAccProfitStatistics(accProfitStatisticsExcel);
 			if (ObjectUtils.isNotNull(accProfitStatisticsExcel_)) {
 				accOne.setAnswerPayAmount(accProfitStatisticsExcel_.getAnswerPayAmount());
 				accOne.setAlreadyPayAmount(accProfitStatisticsExcel_.getAlreadyPayAmount());
@@ -58,6 +68,7 @@ public class ProfitStatisticsController {
 				accOne.setAlreadyPayAmount(new BigDecimal("0.00"));
 				accOne.setProfitAmount(accOne.getReceivableAmount().subtract(new BigDecimal("0.00")));
 			}
+			accOne.setDate(accProfitStatisticsExcel.getDate());
 		}
 		return R.data(pages);
 	}
@@ -69,18 +80,26 @@ public class ProfitStatisticsController {
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入acc")
 	public void export(AccProfitStatisticsExcel accProfitStatisticsExcel, HttpServletResponse response) {
-		List<AccProfitStatisticsExcel> accProfitStatisticsExcelList = accService.accProfitStatisticsList(accProfitStatisticsExcel);
+		accProfitStatisticsExcel.setBillType("收费");
+		List<AccProfitStatisticsExcel> accProfitStatisticsExcelList = new ArrayList<>();
+		if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
+			accProfitStatisticsExcelList = accService.accProfitStatisticsListcode(accProfitStatisticsExcel);
+		} else {
+			accProfitStatisticsExcelList = accService.accProfitStatisticsList(accProfitStatisticsExcel);
+		}
 		for (AccProfitStatisticsExcel accOne : accProfitStatisticsExcelList) {
 			AccProfitStatisticsExcel accProfitStatisticsExcel1 = new AccProfitStatisticsExcel();
 			accProfitStatisticsExcel1.setBillType("付费");
+			AccProfitStatisticsExcel accProfitStatisticsExcel_ = new AccProfitStatisticsExcel();
 			if ("1".equals(accProfitStatisticsExcel.getWhetherStatistics())) {
 				accProfitStatisticsExcel1.setSrcSysno(accOne.getSrcSysno());
 				accProfitStatisticsExcel1.setWhetherStatistics("1");
+				accProfitStatisticsExcel_ = accService.getAccProfitStatisticsCode(accProfitStatisticsExcel1);
 			} else {
 				accProfitStatisticsExcel1.setAccSysNo(accOne.getAccSysNo());
 				accProfitStatisticsExcel1.setWhetherStatistics("0");
+				accProfitStatisticsExcel_ = accService.getAccProfitStatistics(accProfitStatisticsExcel1);
 			}
-			AccProfitStatisticsExcel accProfitStatisticsExcel_ = accService.getAccProfitStatistics(accProfitStatisticsExcel);
 			if (ObjectUtils.isNotNull(accProfitStatisticsExcel_)) {
 				accOne.setAnswerPayAmount(accProfitStatisticsExcel_.getAnswerPayAmount());
 				accOne.setAlreadyPayAmount(accProfitStatisticsExcel_.getAlreadyPayAmount());
@@ -90,6 +109,7 @@ public class ProfitStatisticsController {
 				accOne.setAlreadyPayAmount(new BigDecimal("0.00"));
 				accOne.setProfitAmount(accOne.getReceivableAmount().subtract(new BigDecimal("0.00")));
 			}
+			accOne.setDate(accProfitStatisticsExcel.getDate());
 		}
 		ExcelUtil.export(response, "收付费利润统计", "收付费利润统计", accProfitStatisticsExcelList, AccProfitStatisticsExcel.class);
 	}

+ 41 - 2
blade-service/trade-finance/src/main/java/org/springblade/finance/controller/SettlementController.java

@@ -223,12 +223,51 @@ public class SettlementController extends BladeController {
 	}
 
 	/**
+	 * 分页 结算表
+	 */
+	@GetMapping("/newList")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入settlement")
+	public R<IPage<Settlement>> newList(Settlement settlement, Query query) {
+		LambdaQueryWrapper<Settlement> settlementLambdaQueryWrapper = new LambdaQueryWrapper<>();
+		settlementLambdaQueryWrapper.between(StringUtils.isNotBlank(settlement.getSettlementStartDate()) && StringUtils.isNotBlank(settlement.getSettlementEndDate()), Settlement::getSettlementDate, settlement.getSettlementStartDate(), settlement.getSettlementEndDate());
+		settlementLambdaQueryWrapper.between(StringUtils.isNotBlank(settlement.getCreateStartDate()) && StringUtils.isNotBlank(settlement.getCreateEndDate()), Settlement::getCreateTime, settlement.getCreateStartDate(), settlement.getCreateEndDate());
+		settlementLambdaQueryWrapper.like(StringUtils.isNotBlank(settlement.getSrcOrderno()), Settlement::getSrcOrderno, settlement.getSrcOrderno());
+		settlementLambdaQueryWrapper.like(StringUtils.isNotBlank(settlement.getSysNo()), Settlement::getSysNo, settlement.getSysNo());
+		settlementLambdaQueryWrapper.like(StringUtils.isNotBlank(settlement.getBillNo()), Settlement::getBillNo, settlement.getBillNo());
+		settlementLambdaQueryWrapper.like(StringUtils.isNotBlank(settlement.getAccount()), Settlement::getAccount, settlement.getAccount());
+		settlementLambdaQueryWrapper.like(StringUtils.isNotBlank(settlement.getRemark()), Settlement::getRemark, settlement.getRemark());
+		settlementLambdaQueryWrapper.like(StringUtils.isNotBlank(settlement.getAccountName()), Settlement::getAccountName, settlement.getAccountName());
+		settlementLambdaQueryWrapper.like(settlement.getCorpId() != null, Settlement::getCorpId, settlement.getCorpId());
+		settlementLambdaQueryWrapper.eq(StringUtils.isNotBlank(settlement.getFinanceStatus()), Settlement::getFinanceStatus, settlement.getFinanceStatus());
+		settlementLambdaQueryWrapper.eq(StringUtils.isNotBlank(settlement.getCheckStatus()), Settlement::getCheckStatus, settlement.getCheckStatus());
+		settlementLambdaQueryWrapper.eq(StringUtils.isNotBlank(settlement.getBillType()), Settlement::getBillType, settlement.getBillType());
+		settlementLambdaQueryWrapper.ge(Func.isNotEmpty(settlement.getCompletionTimeStart()), Settlement::getCompletionTime, settlement.getCompletionTimeStart());//单据完成开始日期
+		settlementLambdaQueryWrapper.le(Func.isNotEmpty(settlement.getCompletionTimeEnd()), Settlement::getCompletionTime, settlement.getCompletionTimeEnd());//单据完成结束日期
+		settlementLambdaQueryWrapper.eq(Settlement::getTenantId, AuthUtil.getTenantId());
+		settlementLambdaQueryWrapper.eq(Settlement::getIsDeleted, 0);
+		settlementLambdaQueryWrapper.ge(Settlement::getAmount, new BigDecimal("0.00"));//金额
+		settlementLambdaQueryWrapper.orderByDesc(Settlement::getCreateTime);
+		IPage<Settlement> pages = settlementService.page(Condition.getPage(query), settlementLambdaQueryWrapper);
+		List<Settlement> settlementList = pages.getRecords();
+		if (CollectionUtils.isNotEmpty(settlementList)) {
+			settlementList.forEach(e -> {
+				R<CorpsDesc> corpMessage = corpsDescClient.getCorpMessage(e.getCorpId());
+				if (corpMessage.getData() != null) {
+					e.setCorpName(corpMessage.getData().getCname());
+				}
+			});
+		}
+		return R.data(pages);
+	}
+
+	/**
 	 *  结算表
 	 */
-	@GetMapping("/listAll")
+	@PostMapping("/dataAnalysisList")
 	@ApiOperationSupport(order = 2)
 	@ApiOperation(value = "分页", notes = "传入settlement")
-	public R<List<Settlement>> listAll(Settlement settlement) {
+	public R<List<Settlement>> dataAnalysisList(@RequestBody Settlement settlement) {
 		LambdaQueryWrapper<Settlement> settlementLambdaQueryWrapper = new LambdaQueryWrapper<>();
 		settlementLambdaQueryWrapper.eq(Settlement::getTenantId, AuthUtil.getTenantId());
 		settlementLambdaQueryWrapper.eq(Settlement::getIsDeleted, 0);

+ 5 - 0
blade-service/trade-finance/src/main/java/org/springblade/finance/mapper/AccMapper.java

@@ -98,7 +98,12 @@ public interface AccMapper extends BaseMapper<Acc> {
 
 	List<AccProfitStatisticsExcel> accProfitStatistics(IPage<AccProfitStatisticsExcel> page, @Param("accProfitStatisticsExcel")AccProfitStatisticsExcel accProfitStatisticsExcel);
 
+	List<AccProfitStatisticsExcel> accProfitStatisticsCode(IPage<AccProfitStatisticsExcel> page, @Param("accProfitStatisticsExcel")AccProfitStatisticsExcel accProfitStatisticsExcel);
+
 	AccProfitStatisticsExcel getAccProfitStatistics(@Param("accProfitStatisticsExcel")AccProfitStatisticsExcel accProfitStatisticsExcel);
 
 	List<AccProfitStatisticsExcel> accProfitStatisticsList(@Param("accProfitStatisticsExcel")AccProfitStatisticsExcel accProfitStatisticsExcel);
+	List<AccProfitStatisticsExcel> accProfitStatisticsListcode(@Param("accProfitStatisticsExcel")AccProfitStatisticsExcel accProfitStatisticsExcel);
+
+	AccProfitStatisticsExcel getAccProfitStatisticsCode(@Param("accProfitStatisticsExcel")AccProfitStatisticsExcel accProfitStatisticsExcel);
 }

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

@@ -571,7 +571,7 @@
     </select>
     <select id="accProfitStatistics" resultType="org.springblade.finance.excel.AccProfitStatisticsExcel">
         SELECT
-            GROUP_CONCAT( DISTINCT fa.AccSysNo SEPARATOR ',' ) AS accSysNo,
+            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,
@@ -600,20 +600,52 @@
         <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno !=''">
             AND fa.Src_SysNo = #{accProfitStatisticsExcel.srcSysno}
         </if>
-        <if test="accProfitStatisticsExcel.date !=null and accProfitStatisticsExcel.date !=''">
+        <if test="accProfitStatisticsExcel.date != null">
             AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
         </if>
-        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno == 0">
             GROUP BY fa.AccSysNo
+
+    </select>
+    <select id="accProfitStatisticsCode" 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,
+        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS alreadyPayAmount
+        FROM
+        finance_acc fa
+        LEFT JOIN basic_corps_desc bcd ON fa.Corpid = bcd.id
+        LEFT JOIN basic_corps_desc bcd1 ON fa.Companyid = bcd1.id
+        WHERE
+        fa.Src_SysNo IS NOT NULL
+        AND fa.Src_SysNo != ""
+        AND fa.is_deleted = 0
+        <if test="accProfitStatisticsExcel.tenantId !=null and accProfitStatisticsExcel.tenantId !=''">
+            AND fa.tenant_id = #{accProfitStatisticsExcel.tenantId}
         </if>
-        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno == 1">
-            GROUP BY fa.Src_SysNo
+        <if test="accProfitStatisticsExcel.billType !=null and accProfitStatisticsExcel.billType !=''">
+            AND fa.Bill_type = #{accProfitStatisticsExcel.billType}
+        </if>
+        <if test="accProfitStatisticsExcel.accSysNo !=null and accProfitStatisticsExcel.accSysNo !=''">
+            AND fa.AccSysNo = #{accProfitStatisticsExcel.accSysNo}
         </if>
+        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno !=''">
+            AND fa.Src_SysNo = #{accProfitStatisticsExcel.srcSysno}
+        </if>
+        <if test="accProfitStatisticsExcel.date != null">
+            AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
+        </if>
+            GROUP BY fa.Src_SysNo
 
     </select>
     <select id="getAccProfitStatistics" resultType="org.springblade.finance.excel.AccProfitStatisticsExcel">
         SELECT
-        GROUP_CONCAT( DISTINCT fa.AccSysNo SEPARATOR ',' ) AS accSysNo,
+        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,
@@ -642,19 +674,14 @@
         <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno !=''">
             AND fa.Src_SysNo = #{accProfitStatisticsExcel.srcSysno}
         </if>
-        <if test="accProfitStatisticsExcel.date !=null and accProfitStatisticsExcel.date !=''">
+        <if test="accProfitStatisticsExcel.date != null">
             AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
         </if>
-        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno == 0">
             GROUP BY fa.AccSysNo
-        </if>
-        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno == 1">
-            GROUP BY fa.Src_SysNo
-        </if>
     </select>
     <select id="accProfitStatisticsList" resultType="org.springblade.finance.excel.AccProfitStatisticsExcel">
         SELECT
-        GROUP_CONCAT( DISTINCT fa.AccSysNo SEPARATOR ',' ) AS accSysNo,
+        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,
@@ -683,15 +710,84 @@
         <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno !=''">
             AND fa.Src_SysNo = #{accProfitStatisticsExcel.srcSysno}
         </if>
-        <if test="accProfitStatisticsExcel.date !=null and accProfitStatisticsExcel.date !=''">
+        <if test="accProfitStatisticsExcel.date != null">
             AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
         </if>
-        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno == 0">
             GROUP BY fa.AccSysNo
+    </select>
+
+    <select id="accProfitStatisticsListcode" 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,
+        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS alreadyPayAmount
+        FROM
+        finance_acc fa
+        LEFT JOIN basic_corps_desc bcd ON fa.Corpid = bcd.id
+        LEFT JOIN basic_corps_desc bcd1 ON fa.Companyid = bcd1.id
+        WHERE
+        fa.Src_SysNo IS NOT NULL
+        AND fa.Src_SysNo != ""
+        AND fa.is_deleted = 0
+        <if test="accProfitStatisticsExcel.tenantId !=null and accProfitStatisticsExcel.tenantId !=''">
+            AND fa.tenant_id = #{accProfitStatisticsExcel.tenantId}
         </if>
-        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno == 1">
-            GROUP BY fa.Src_SysNo
+        <if test="accProfitStatisticsExcel.billType !=null and accProfitStatisticsExcel.billType !=''">
+            AND fa.Bill_type = #{accProfitStatisticsExcel.billType}
+        </if>
+        <if test="accProfitStatisticsExcel.accSysNo !=null and accProfitStatisticsExcel.accSysNo !=''">
+            AND fa.AccSysNo = #{accProfitStatisticsExcel.accSysNo}
+        </if>
+        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno !=''">
+            AND fa.Src_SysNo = #{accProfitStatisticsExcel.srcSysno}
+        </if>
+        <if test="accProfitStatisticsExcel.date != null">
+            AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
+        </if>
+       GROUP BY fa.Src_SysNo
+    </select>
+    <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,
+        sum( ifnull( fa.Settlement_Amount, 0 ) ) AS alreadyPayAmount
+        FROM
+        finance_acc fa
+        LEFT JOIN basic_corps_desc bcd ON fa.Corpid = bcd.id
+        LEFT JOIN basic_corps_desc bcd1 ON fa.Companyid = bcd1.id
+        WHERE
+        fa.Src_SysNo IS NOT NULL
+        AND fa.Src_SysNo != ""
+        AND fa.is_deleted = 0
+        <if test="accProfitStatisticsExcel.tenantId !=null and accProfitStatisticsExcel.tenantId !=''">
+            AND fa.tenant_id = #{accProfitStatisticsExcel.tenantId}
         </if>
+        <if test="accProfitStatisticsExcel.billType !=null and accProfitStatisticsExcel.billType !=''">
+            AND fa.Bill_type = #{accProfitStatisticsExcel.billType}
+        </if>
+        <if test="accProfitStatisticsExcel.accSysNo !=null and accProfitStatisticsExcel.accSysNo !=''">
+            AND fa.AccSysNo = #{accProfitStatisticsExcel.accSysNo}
+        </if>
+        <if test="accProfitStatisticsExcel.srcSysno !=null and accProfitStatisticsExcel.srcSysno !=''">
+            AND fa.Src_SysNo = #{accProfitStatisticsExcel.srcSysno}
+        </if>
+        <if test="accProfitStatisticsExcel.date != null">
+            AND DATE_FORMAT(fa.create_time,'%Y-%m') = DATE_FORMAT(#{accProfitStatisticsExcel.date},'%Y-%m')
+        </if>
+            GROUP BY fa.Src_SysNo
     </select>
 
 </mapper>

+ 4 - 0
blade-service/trade-finance/src/main/java/org/springblade/finance/service/IAccService.java

@@ -117,7 +117,11 @@ public interface IAccService extends IService<Acc> {
 
     IPage<AccProfitStatisticsExcel> accProfitStatistics(IPage<AccProfitStatisticsExcel> page, AccProfitStatisticsExcel accProfitStatisticsExcel);
 
+    IPage<AccProfitStatisticsExcel> accProfitStatisticsCode(IPage<AccProfitStatisticsExcel> page, AccProfitStatisticsExcel accProfitStatisticsExcel);
+
 	AccProfitStatisticsExcel getAccProfitStatistics(AccProfitStatisticsExcel accProfitStatisticsExcel);
+	AccProfitStatisticsExcel getAccProfitStatisticsCode(AccProfitStatisticsExcel accProfitStatisticsExcel);
 
 	List<AccProfitStatisticsExcel> accProfitStatisticsList(AccProfitStatisticsExcel accProfitStatisticsExcel);
+	List<AccProfitStatisticsExcel> accProfitStatisticsListcode(AccProfitStatisticsExcel accProfitStatisticsExcel);
 }

+ 16 - 0
blade-service/trade-finance/src/main/java/org/springblade/finance/service/impl/AccServiceImpl.java

@@ -495,14 +495,30 @@ public class AccServiceImpl extends ServiceImpl<AccMapper, Acc> implements IAccS
 	}
 
 	@Override
+	public IPage<AccProfitStatisticsExcel> accProfitStatisticsCode(IPage<AccProfitStatisticsExcel> page, AccProfitStatisticsExcel accProfitStatisticsExcel) {
+		accProfitStatisticsExcel.setTenantId(AuthUtil.getTenantId());
+		return page.setRecords(baseMapper.accProfitStatisticsCode(page, accProfitStatisticsExcel));
+	}
+
+	@Override
 	public AccProfitStatisticsExcel getAccProfitStatistics(AccProfitStatisticsExcel accProfitStatisticsExcel) {
 		accProfitStatisticsExcel.setTenantId(AuthUtil.getTenantId());
 		return baseMapper.getAccProfitStatistics(accProfitStatisticsExcel);
 	}
+@Override
+	public AccProfitStatisticsExcel getAccProfitStatisticsCode(AccProfitStatisticsExcel accProfitStatisticsExcel) {
+		accProfitStatisticsExcel.setTenantId(AuthUtil.getTenantId());
+		return baseMapper.getAccProfitStatisticsCode(accProfitStatisticsExcel);
+	}
 
 	@Override
 	public List<AccProfitStatisticsExcel> accProfitStatisticsList(AccProfitStatisticsExcel accProfitStatisticsExcel) {
 		accProfitStatisticsExcel.setTenantId(AuthUtil.getTenantId());
 		return baseMapper.accProfitStatisticsList(accProfitStatisticsExcel);
 	}
+	@Override
+	public List<AccProfitStatisticsExcel> accProfitStatisticsListcode(AccProfitStatisticsExcel accProfitStatisticsExcel) {
+		accProfitStatisticsExcel.setTenantId(AuthUtil.getTenantId());
+		return baseMapper.accProfitStatisticsListcode(accProfitStatisticsExcel);
+	}
 }

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

@@ -2827,6 +2827,8 @@ public class SettlementServiceImpl extends ServiceImpl<SettlementMapper, Settlem
 			acc.setSrcType(e.getSrcType());
 			acc.setSrcFeesId(e.getSrcFeesId());
 
+			acc.setChargeMember(e.getChargeMember());
+
 			LambdaQueryWrapper<Acc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 			lambdaQueryWrapper.eq(Acc::getIsDeleted, 0)
 				.eq(Acc::getTenantId, AuthUtil.getTenantId())