Просмотр исходного кода

物流结算单字段统一、贸易结算单查询sql修改、字段返回驼峰问题处理

xucaiqin 2 лет назад
Родитель
Сommit
f042b92b97

+ 15 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementTradeController.java

@@ -1,6 +1,7 @@
 package com.sckw.payment.controller;
 
 import com.sckw.core.model.page.PageRes;
+import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
 import com.sckw.payment.model.constant.TradeUnitType;
@@ -41,6 +42,7 @@ public class KwpSettlementTradeController {
     @PostMapping(name = "收款-销售结算单列表", path = "pageSellList")
     public HttpResult pageListCollection(@RequestBody @Valid SettlementTradeReq settlementReq) {
         settlementReq.setUnitType(TradeUnitType.PURCHASE);
+        settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
         settlementReq.check();
         return HttpResult.ok(kwpSettlementTradeService.pageListCollection(settlementReq));
     }
@@ -54,6 +56,8 @@ public class KwpSettlementTradeController {
     @PostMapping(name = "收款-表头统计数量", path = "getSellCount")
     public HttpResult getCount(@RequestBody @Valid SettlementTradeReq settlementReq) {
         settlementReq.setUnitType(TradeUnitType.PURCHASE);
+        settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
+        settlementReq.setEntId(LoginUserHolder.getEntId());
         settlementReq.check();
         return HttpResult.ok(kwpSettlementTradeService.getCount(settlementReq));
     }
@@ -68,6 +72,8 @@ public class KwpSettlementTradeController {
     public HttpResult getSellSum(@RequestBody @Valid SettlementTradeReq settlementReq) {
         settlementReq.check();
         settlementReq.setUnitType(TradeUnitType.PURCHASE);
+        settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
+        settlementReq.setEntId(LoginUserHolder.getEntId());
         return HttpResult.ok(kwpSettlementTradeService.getCountListCollection(settlementReq));
     }
 
@@ -76,17 +82,17 @@ public class KwpSettlementTradeController {
         settlementReq.check();
         List<ISettlement> list;
         settlementReq.setUnitType(TradeUnitType.PURCHASE);
+        settlementReq.setUnitTypeTwo(TradeUnitType.SELL);
         if (CollectionUtils.isEmpty(settlementReq.getIdList())) {
             PageRes<ISettlement> pageResult = kwpSettlementTradeService.pageListCollection(settlementReq);
             list = pageResult.getList();
         } else {
-            list = kwpSettlementTradeService.selectList(settlementReq.getIdList(),TradeUnitType.PURCHASE);
+            list = kwpSettlementTradeService.selectList(settlementReq.getIdList(), TradeUnitType.PURCHASE);
         }
         return this.export(response, list);
     }
 
 
-
     //   ========= 付款 采购 =========
 
     /**
@@ -99,6 +105,7 @@ public class KwpSettlementTradeController {
     public HttpResult pageListPayment(@RequestBody @Valid SettlementTradeReq settlementReq) {
         settlementReq.check();
         settlementReq.setUnitType(TradeUnitType.SELL);
+        settlementReq.setUnitTypeTwo(TradeUnitType.PURCHASE);
         return HttpResult.ok(kwpSettlementTradeService.pageListCollection(settlementReq));
     }
 
@@ -112,6 +119,8 @@ public class KwpSettlementTradeController {
     public HttpResult getPurchaseCount(@RequestBody @Valid SettlementTradeReq settlementReq) {
         settlementReq.check();
         settlementReq.setUnitType(TradeUnitType.SELL);
+        settlementReq.setUnitTypeTwo(TradeUnitType.PURCHASE);
+        settlementReq.setEntId(LoginUserHolder.getEntId());
         return HttpResult.ok(kwpSettlementTradeService.getCount(settlementReq));
     }
 
@@ -125,6 +134,8 @@ public class KwpSettlementTradeController {
     public HttpResult getCountListPayment(@RequestBody @Valid SettlementTradeReq settlementReq) {
         settlementReq.check();
         settlementReq.setUnitType(TradeUnitType.SELL);
+        settlementReq.setUnitTypeTwo(TradeUnitType.PURCHASE);
+        settlementReq.setEntId(LoginUserHolder.getEntId());
         return HttpResult.ok(kwpSettlementTradeService.getCountListCollection(settlementReq));
     }
 
@@ -133,11 +144,12 @@ public class KwpSettlementTradeController {
         settlementReq.check();
         List<ISettlement> list;
         settlementReq.setUnitType(TradeUnitType.SELL);
+        settlementReq.setUnitTypeTwo(TradeUnitType.PURCHASE);
         if (CollectionUtils.isEmpty(settlementReq.getIdList())) {
             PageRes<ISettlement> pageResult = kwpSettlementTradeService.pageListCollection(settlementReq);
             list = pageResult.getList();
         } else {
-            list = kwpSettlementTradeService.selectList(settlementReq.getIdList(),TradeUnitType.SELL);
+            list = kwpSettlementTradeService.selectList(settlementReq.getIdList(), TradeUnitType.SELL);
         }
         return this.export(response, list);
     }

+ 2 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerShipperDto.java

@@ -1,6 +1,7 @@
 package com.sckw.payment.model.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -23,6 +24,7 @@ public class LedgerShipperDto implements ILedger {
     /**
      * 物流对账单编号
      */
+    @JsonProperty("lLedgerNo")
     private String lLedgerNo;
 
     /**

+ 7 - 5
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementLogisticsDto.java

@@ -1,7 +1,7 @@
 package com.sckw.payment.model.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
-import com.sckw.payment.model.KwpSettlementLogistics;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.AllArgsConstructor;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
@@ -32,6 +32,7 @@ public class SettlementLogisticsDto {
     /**
      * 物流订单对账id
      */
+    @JsonProperty("lLedgerId")
     private Long lLedgerId;
 
     /**
@@ -91,7 +92,7 @@ public class SettlementLogisticsDto {
      */
     private Integer status;
 
-    private String statusText;
+    private String statusLabel;
 
     /**
      * 创建人
@@ -101,7 +102,7 @@ public class SettlementLogisticsDto {
     /**
      * 创建人名称
      */
-    private String createByText;
+    private String createByLabel;
 
     /**
      * 创建时间
@@ -118,7 +119,7 @@ public class SettlementLogisticsDto {
     /**
      * 更新人名称
      */
-    private String updateByText;
+    private String updateByLabel;
 
     /**
      * 更新时间
@@ -148,6 +149,7 @@ public class SettlementLogisticsDto {
     /**
      * 对账单编号
      */
+    @JsonProperty("lLedgerNo")
     private String lLedgerNo;
 
     /**
@@ -158,7 +160,7 @@ public class SettlementLogisticsDto {
     /**
      * 客户名称
      */
-    private String customerName;
+    private String firmName;
 
 
     /**

+ 10 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementPurchaseDto.java

@@ -1,6 +1,7 @@
 package com.sckw.payment.model.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -25,6 +26,11 @@ public class SettlementPurchaseDto implements ISettlement {
      * 结算单编号
      */
     private String stOrderNo;
+    /**
+     * 对账单编号
+     */
+    @JsonProperty("tLedgerNo")
+    private String tLedgerNo;
 
     /**
      * 结算单名称
@@ -77,4 +83,8 @@ public class SettlementPurchaseDto implements ISettlement {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createTime;
 
+    private String firmName;
+    private Long updateBy;
+    private String updateByLabel;
+
 }

+ 11 - 59
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementSellDto.java

@@ -1,8 +1,9 @@
 package com.sckw.payment.model.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Getter;
 import lombok.Setter;
-import lombok.ToString;
 
 import java.util.Date;
 
@@ -12,8 +13,8 @@ import java.util.Date;
  * @author Aick Spt
  * @date 2023-07-20 12:26
  */
+@Getter
 @Setter
-@ToString
 public class SettlementSellDto implements ISettlement {
 
     /**
@@ -25,6 +26,11 @@ public class SettlementSellDto implements ISettlement {
      * 结算单编号
      */
     private String stOrderNo;
+    /**
+     * 对账单编号
+     */
+    @JsonProperty("tLedgerNo")
+    private String tLedgerNo;
 
     /**
      * 结算单名称
@@ -77,62 +83,8 @@ public class SettlementSellDto implements ISettlement {
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private Date createTime;
 
-    public Long getId() {
-        return id;
-    }
-
-    public String getStOrderNo() {
-        return stOrderNo;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public String getTotalPrice() {
-        return totalPrice;
-    }
-
-    public String getActualPrice() {
-        return actualPrice;
-    }
-
-    public String getWaitPrice() {
-        return waitPrice;
-    }
-
-    public Date getReceiptTime() {
-        return receiptTime;
-    }
-
-    public String getAuditUser() {
-        return auditUser;
-    }
-
-    public String getAuditPhone() {
-        return auditPhone;
-    }
-
-
-    public String getTradingLabel() {
-        return tradingLabel;
-    }
-
-    @Override
-    public String getTrading() {
-        return trading;
-    }
-
-    @Override
-    public Integer getStatus() {
-        return status;
-    }
-
-    public String getStatusLabel() {
-        return statusLabel;
-    }
+    private String firmName;
+    private Long updateBy;
+    private String updateByLabel;
 
-    public Date getCreateTime() {
-        return createTime;
-    }
 }

+ 21 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/SettlementTradeDto.java

@@ -1,6 +1,7 @@
 package com.sckw.payment.model.dto;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonProperty;
 
 import java.math.BigDecimal;
 import java.util.Date;
@@ -36,6 +37,8 @@ public class SettlementTradeDto implements ISettlement {
      * 结算单编号
      */
     private String stOrderNo;
+    @JsonProperty("tLedgerNo")
+    private String tLedgerNo;
 
     /**
      * 结算单名称
@@ -94,6 +97,8 @@ public class SettlementTradeDto implements ISettlement {
      */
     private Integer status;
     private String statusLabel;
+    //客户企业名称
+    private String firmName;
 
     /**
      * 创建人
@@ -122,6 +127,22 @@ public class SettlementTradeDto implements ISettlement {
      */
     private Integer delFlag;
 
+    public String gettLedgerNo() {
+        return tLedgerNo;
+    }
+
+    public void settLedgerNo(String tLedgerNo) {
+        this.tLedgerNo = tLedgerNo;
+    }
+
+    public String getFirmName() {
+        return firmName;
+    }
+
+    public void setFirmName(String firmName) {
+        this.firmName = firmName;
+    }
+
     public Long getLedgerId() {
         return ledgerId;
     }

+ 18 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/SettlementTradeReq.java

@@ -26,7 +26,25 @@ public class SettlementTradeReq extends BasePara implements TimeBase {
      * @see SettlementEnum
      */
     private Integer status;
+    private String trading;
     private Integer unitType;
+    private Integer unitTypeTwo;
+
+    public String getTrading() {
+        return trading;
+    }
+
+    public void setTrading(String trading) {
+        this.trading = trading;
+    }
+
+    public Integer getUnitTypeTwo() {
+        return unitTypeTwo;
+    }
+
+    public void setUnitTypeTwo(Integer unitTypeTwo) {
+        this.unitTypeTwo = unitTypeTwo;
+    }
 
     private String ids;
     private Long entId;

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/SettlementLogisticsVo.java

@@ -141,7 +141,7 @@ public class SettlementLogisticsVo {
      * 客户名称
      */
     @ExcelProperty(value = "客户名称")
-    private String customerName;
+    private String firmName;
 
 
     /**

+ 35 - 8
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -13,6 +13,7 @@ import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.OrderGenerateUtils;
 import com.sckw.core.utils.StringTimeUtil;
 import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.core.web.response.HttpResult;
 import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
 import com.sckw.payment.model.*;
 import com.sckw.payment.model.constant.LedgerEnum;
@@ -29,8 +30,9 @@ import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.EntCacheResDto;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
 import com.sckw.transport.api.dubbo.TransportDubboService;
+import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
 import com.sckw.transport.api.model.dto.LogisticsOrderDTO;
-import com.sckw.transport.api.model.vo.KwtLogisticsOrderVO;
+import io.seata.spring.annotation.GlobalTransactional;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
@@ -134,7 +136,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      * @param logisticsReq
      * @return
      */
-    @Transactional(rollbackFor = Exception.class)
+    @GlobalTransactional(name = "default_tx_group", rollbackFor = Exception.class)
     public String sendLedger(LogisticsSendReq logisticsReq) {
         String id = logisticsReq.getId();
         if (StringUtils.isBlank(id)) {
@@ -159,7 +161,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      *
      * @param id 物流对账单id
      */
-    private void removeDraft(Long id) {
+    public void removeDraft(Long id) {
         //删除 kwp_ledger_logistics_order
         logisticsOrderService.remove(id);
         //删除 kwp_ledger_logistics_track
@@ -174,7 +176,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      * @param logisticsSendReq 物流对账单新增参数
      * @return
      */
-    private Long saveDraft(LogisticsSendReq logisticsSendReq) {
+    public Long saveDraft(LogisticsSendReq logisticsSendReq) {
         KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
         kwpLedgerLogistics.setId(Objects.isNull(logisticsSendReq.getIdLong()) ? new IdWorker(1).nextId() : logisticsSendReq.getIdLong());
         kwpLedgerLogistics.setEntId(LoginUserHolder.getEntId());
@@ -222,16 +224,27 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         List<Long> ids = logisticsSendReq.getIdList();
         //验当前订单是否已存在绑定的对账单
         logisticsOrderService.check(ids);
-        List<KwtLogisticsOrderVO> acceptCarriageOrderDetail = transportDubboService.getAcceptCarriageOrderDetail(logisticsSendReq.getIdsList());
+        List<LogisticsOrderDTO> acceptCarriageOrderDetail = transportDubboService.getAcceptCarriageOrderList(logisticsSendReq.getIdsList());
         if (CollectionUtils.isEmpty(acceptCarriageOrderDetail) || acceptCarriageOrderDetail.size() < ids.size()) {
             throw new BusinessException("未找到物流订单!");
         }
+        //更新物流订单状态为已绑定
+        AccountCheckingBindDTO accountCheckingBindDTO = new AccountCheckingBindDTO();
+        accountCheckingBindDTO.setLOrderList(ids);
+        accountCheckingBindDTO.setStatus("1");
+        accountCheckingBindDTO.setUpdateBy(LoginUserHolder.getUserId());
+        accountCheckingBindDTO.setUpdateName(LoginUserHolder.getUserName());
+        HttpResult httpResult = transportDubboService.logisticsOrderAccountCheckingBind(accountCheckingBindDTO);
+        if (httpResult.getCode() != 60200) {
+            throw new BusinessException(httpResult.getMsg());
+        }
+
         List<KwpLedgerLogisticsOrder> collect = acceptCarriageOrderDetail.stream().map(a -> {
             KwpLedgerLogisticsOrder logisticsOrder = new KwpLedgerLogisticsOrder();
             logisticsOrder.setId(new IdWorker(NumberConstant.ONE).nextId());
             logisticsOrder.setLLedgerId(kwpLedgerLogistics.getId());
-            logisticsOrder.setLOrderId(a.getId());
-            logisticsOrder.setLOrderNo(a.getLOrderNo());
+            logisticsOrder.setLOrderId(Long.parseLong(a.getLOrderId()));
+            logisticsOrder.setLOrderNo(a.getLOrderNO());
             logisticsOrder.setRemark(Global.EMPTY_STRING);
             logisticsOrder.setStatus(NumberConstant.ZERO);
             logisticsOrder.setCreateBy(LoginUserHolder.getUserId());
@@ -307,7 +320,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      * @param logisticsReq 物流对账单保存的参数
      * @return
      */
-    @Transactional(rollbackFor = Exception.class)
+    @GlobalTransactional(name = "default_tx_group", rollbackFor = Exception.class)
     public String sendLedgerDraft(LogisticsSendReq logisticsReq) {
         logisticsReq.setGenerateTime(null);
         logisticsReq.setStatus(LedgerEnum.SAVE.getStatus());
@@ -322,6 +335,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      * @param id 物流对账单id
      * @return
      */
+    @GlobalTransactional(rollbackFor = Exception.class)
     public String remove(Long id) {
         KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(id);
         if (Objects.isNull(kwpLedgerLogistics)) {
@@ -331,6 +345,17 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         kwpLedgerLogistics.setDelFlag(Global.DELETED);
         logisticsMapper.updateById(kwpLedgerLogistics);
         logisticsTrackService.saveTrack(id, Global.EMPTY_STRING, LedgerTrackEnum.DELETE);
+        List<KwpLedgerLogisticsOrder> kwpLedgerLogisticsOrders = logisticsOrderService.queryList(id);
+        //更新物流订单状态为已解绑
+        AccountCheckingBindDTO accountCheckingBindDTO = new AccountCheckingBindDTO();
+        accountCheckingBindDTO.setLOrderList(kwpLedgerLogisticsOrders.stream().map(KwpLedgerLogisticsOrder::getLOrderId).collect(Collectors.toList()));
+        accountCheckingBindDTO.setStatus("0");
+        accountCheckingBindDTO.setUpdateBy(LoginUserHolder.getUserId());
+        accountCheckingBindDTO.setUpdateName(LoginUserHolder.getUserName());
+        HttpResult httpResult = transportDubboService.logisticsOrderAccountCheckingBind(accountCheckingBindDTO);
+        if (httpResult.getCode() != 60200) {
+            throw new BusinessException(httpResult.getMsg());
+        }
         return "删除成功";
     }
 
@@ -340,6 +365,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      * @param id 物流对账单id
      * @return
      */
+    @Transactional(rollbackFor = Exception.class)
     public String backOrder(Long id) {
         KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(id);
         if (Objects.isNull(kwpLedgerLogistics)) {
@@ -374,6 +400,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      * @param ledgerReq 驳回参数
      * @return
      */
+    @Transactional(rollbackFor = Exception.class)
     public String doBack(LedgerReq ledgerReq) {
         KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(ledgerReq.getIdLong());
         if (Objects.isNull(kwpLedgerLogistics)) {

+ 5 - 5
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementLogisticsService.java

@@ -245,7 +245,7 @@ public class KwpSettlementLogisticsService {
      * @date 2023-08-07 10:14
      */
     private void setDetailDesc(SettlementLogisticsDto settlementLogisticsDto) {
-        settlementLogisticsDto.setStatusText(SettlementEnum.getStatusDesc(settlementLogisticsDto.getStatus()));
+        settlementLogisticsDto.setStatusLabel(SettlementEnum.getStatusDesc(settlementLogisticsDto.getStatus()));
         if (settlementLogisticsDto.getLedgerSettlePrice() != null) {
             if (settlementLogisticsDto.getActualPrice() != null) {
                 settlementLogisticsDto.setResiduePrice(settlementLogisticsDto.getLedgerSettlePrice().subtract(settlementLogisticsDto.getActualPrice()));
@@ -255,8 +255,8 @@ public class KwpSettlementLogisticsService {
         } else {
             settlementLogisticsDto.setResiduePrice(new BigDecimal(0));
         }
-        settlementLogisticsDto.setCreateByText("创建人名称");//"创建人名称"
-        settlementLogisticsDto.setUpdateByText("更新人名称");//"更新人名称"
+        settlementLogisticsDto.setCreateByLabel("创建人名称");//"创建人名称"
+        settlementLogisticsDto.setUpdateByLabel("更新人名称");//"更新人名称"
 
         Map<Long, UserCacheResDto> map = new HashMap<>();
         Long createBy = settlementLogisticsDto.getCreateBy();
@@ -269,7 +269,7 @@ public class KwpSettlementLogisticsService {
         }
         if (Objects.nonNull(userCacheResDto)) {
             //写入对应数据
-            settlementLogisticsDto.setCreateByText(userCacheResDto.getName());
+            settlementLogisticsDto.setCreateByLabel(userCacheResDto.getName());
         }
         userCacheResDto = map.get(updateBy);
         if (Objects.isNull(userCacheResDto)) {
@@ -279,7 +279,7 @@ public class KwpSettlementLogisticsService {
         }
         if (Objects.nonNull(userCacheResDto)) {
             //写入对应数据
-            settlementLogisticsDto.setUpdateByText(userCacheResDto.getName());
+            settlementLogisticsDto.setUpdateByLabel(userCacheResDto.getName());
         }
     }
 

+ 5 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementTradeService.java

@@ -19,6 +19,7 @@ import com.sckw.payment.model.vo.res.SettlementLogisticsStatusCountVo;
 import com.sckw.payment.model.vo.res.SettlementSumVo;
 import com.sckw.system.api.RemoteSystemService;
 import com.sckw.system.api.model.dto.res.SysDictResDto;
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import jakarta.annotation.Resource;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.stereotype.Service;
@@ -109,6 +110,8 @@ public class KwpSettlementTradeService {
                     settlementSellDto.setActualPrice(settlementSellDto.changePrice(settlementTradeDto.getActualPrice()));
                     settlementSellDto.setTotalPrice(settlementSellDto.changePrice(settlementTradeDto.getTotalPrice()));
                     settlementSellDto.setWaitPrice(settlementSellDto.changePrice(settlementTradeDto.getWaitPrice()));
+                    UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(settlementTradeDto.getUpdateBy());
+                    settlementSellDto.setUpdateByLabel(Objects.nonNull(userCacheResDto)?userCacheResDto.getName():"");
                     res.add(settlementSellDto);
                 }
                 changeDict(res);
@@ -124,6 +127,8 @@ public class KwpSettlementTradeService {
                     settlementSellDto.setActualPrice(settlementSellDto.changePrice(settlementTradeDto.getActualPrice()));
                     settlementSellDto.setTotalPrice(settlementSellDto.changePrice(settlementTradeDto.getTotalPrice()));
                     settlementSellDto.setWaitPrice(settlementSellDto.changePrice(settlementTradeDto.getWaitPrice()));
+                    UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(settlementTradeDto.getUpdateBy());
+                    settlementSellDto.setUpdateByLabel(Objects.nonNull(userCacheResDto)?userCacheResDto.getName():"");
                     res.add(settlementSellDto);
                 }
                 changeDict(res);

+ 2 - 2
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementLogisticsMapper.xml

@@ -78,7 +78,7 @@
                l.url          as attachmentUrl,
 
                lu.unit_type   as unitType,
-               lu.firm_name   as CustomerName,
+               lu.firm_name   as firmName,
 
         <include refid="Join_Column_List"/>
         from kwp_settlement_logistics s
@@ -175,7 +175,7 @@
                l.url          as attachmentUrl,
 
                lu.unit_type   as unitType,
-               lu.firm_name   as CustomerName,
+               lu.firm_name   as firmName,
         <include refid="Join_Column_List"/>
         from kwp_settlement_logistics s
                  left join kwp_ledger_logistics l on s.l_ledger_id = l.id

+ 82 - 7
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementTradeMapper.xml

@@ -71,6 +71,7 @@
         select kst.id,
                kst.status,
                kst.st_order_no,
+               klt.t_ledger_no                                    tLedgerNo,
                kst.create_time,
                kst.receipt_time,
                cast(kst.actual_price as char)                     actualPrice,
@@ -83,11 +84,37 @@
                kst.create_time,
                klt.name,
                klt.trading,
-               kltu.firm_name
+               kltu.firm_name                                     firmName,
+               kst.update_by
         from kwp_settlement_trade kst
                  inner join kwp_ledger_trade klt on kst.t_ledger_id = klt.id and klt.del_flag = 0
-                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
-        <include refid="query"/>
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0 and
+                                                          kltu.unit_type = #{settlementReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_trade_unit kltu2 on klt.id = kltu2.t_ledger_id and kltu2.del_flag = 0 and
+                                                           kltu2.unit_type =
+                                                           #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            kst.del_flag = 0
+              and kltu2.top_ent_id = #{settlementReq.entId,jdbcType=INTEGER}
+            <if test="settlementReq.keywords != null and settlementReq.keywords != ''">
+                and (
+                            klt.name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kltu.firm_name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+            <if test="settlementReq.trading != null and settlementReq.trading != ''">
+                and klt.trading = #{settlementReq.trading,jdbcType=VARCHAR}
+            </if>
+            <if test="settlementReq.status != null">
+                and kst.status = #{settlementReq.status,jdbcType=INTEGER}
+            </if>
+            <if test="settlementReq.startCreateTime != null and settlementReq.startCreateTime != '' and settlementReq.endCreateTime != null and settlementReq.endCreateTime != ''">
+                and kst.create_time between #{settlementReq.startCreateTime,jdbcType=TIMESTAMP} and #{settlementReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="settlementReq.startReceiptTime != null and settlementReq.startReceiptTime != '' and settlementReq.endReceiptTime != null and settlementReq.endReceiptTime != ''">
+                and kst.receipt_time between #{settlementReq.startReceiptTime,jdbcType=TIMESTAMP} and #{settlementReq.endReceiptTime,jdbcType=TIMESTAMP}
+            </if>
+        </where>
         order by kst.create_time desc
     </select>
 
@@ -98,8 +125,32 @@
                IFNULL(sum(kst.total_price) - sum(kst.actual_price), 0) waitReceive
         from kwp_settlement_trade kst
                  inner join kwp_ledger_trade klt on kst.t_ledger_id = klt.id and klt.del_flag = 0
-                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
-        <include refid="query"/>
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0 and
+                                                          kltu.unit_type = #{settlementReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_trade_unit kltu2 on klt.id = kltu2.t_ledger_id and kltu2.del_flag = 0 and
+                                                           kltu2.unit_type = #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            kst.del_flag = 0
+              and kltu2.top_ent_id = #{settlementReq.entId,jdbcType=INTEGER}
+            <if test="settlementReq.keywords != null and settlementReq.keywords != ''">
+                and (
+                            klt.name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kltu.firm_name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+            <if test="settlementReq.status != null">
+                and kst.status = #{settlementReq.status,jdbcType=INTEGER}
+            </if>
+            <if test="settlementReq.trading != null and settlementReq.trading != ''">
+                and klt.trading = #{settlementReq.trading,jdbcType=VARCHAR}
+            </if>
+            <if test="settlementReq.startCreateTime != null and settlementReq.startCreateTime != '' and settlementReq.endCreateTime != null and settlementReq.endCreateTime != ''">
+                and kst.create_time between #{settlementReq.startCreateTime,jdbcType=TIMESTAMP} and #{settlementReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="settlementReq.startReceiptTime != null and settlementReq.startReceiptTime != '' and settlementReq.endReceiptTime != null and settlementReq.endReceiptTime != ''">
+                and kst.receipt_time between #{settlementReq.startReceiptTime,jdbcType=TIMESTAMP} and #{settlementReq.endReceiptTime,jdbcType=TIMESTAMP}
+            </if>
+        </where>
     </select>
     <select id="countOrder" resultType="java.util.Map">
         select count(1)                           "0",
@@ -108,8 +159,32 @@
                count(if(kst.status = 1, 1, null)) "1"
         from kwp_settlement_trade kst
                  inner join kwp_ledger_trade klt on kst.t_ledger_id = klt.id and klt.del_flag = 0
-                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
-        <include refid="query"/>
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0 and
+                                                          kltu.unit_type = #{settlementReq.unitType,jdbcType=INTEGER}
+                 inner join kwp_ledger_trade_unit kltu2 on klt.id = kltu2.t_ledger_id and kltu2.del_flag = 0 and
+                                                           kltu2.unit_type = #{settlementReq.unitTypeTwo,jdbcType=INTEGER}
+        <where>
+            kst.del_flag = 0
+              and kltu2.top_ent_id = #{settlementReq.entId,jdbcType=INTEGER}
+            <if test="settlementReq.keywords != null and settlementReq.keywords != ''">
+                and (
+                            klt.name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kltu.firm_name like concat('%', #{settlementReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+            <if test="settlementReq.trading != null and settlementReq.trading != ''">
+                and klt.trading = #{settlementReq.trading,jdbcType=VARCHAR}
+            </if>
+            <if test="settlementReq.status != null">
+                and kst.status = #{settlementReq.status,jdbcType=INTEGER}
+            </if>
+            <if test="settlementReq.startCreateTime != null and settlementReq.startCreateTime != '' and settlementReq.endCreateTime != null and settlementReq.endCreateTime != ''">
+                and kst.create_time between #{settlementReq.startCreateTime,jdbcType=TIMESTAMP} and #{settlementReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="settlementReq.startReceiptTime != null and settlementReq.startReceiptTime != '' and settlementReq.endReceiptTime != null and settlementReq.endReceiptTime != ''">
+                and kst.receipt_time between #{settlementReq.startReceiptTime,jdbcType=TIMESTAMP} and #{settlementReq.endReceiptTime,jdbcType=TIMESTAMP}
+            </if>
+        </where>
     </select>
 
     <select id="selectByIds" resultType="com.sckw.payment.model.dto.SettlementTradeDto">