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

Merge branch 'dev-xcq' into dev

xucaiqin 2 лет назад
Родитель
Сommit
7b89cc1fd6
39 измененных файлов с 1912 добавлено и 149 удалено
  1. 7 0
      sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/GlobalSystemExceptionHandler.java
  2. 11 6
      sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java
  3. 81 14
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerLogisticsController.java
  4. 75 14
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerTradeController.java
  5. 21 4
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java
  6. 12 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerTradeMapper.java
  7. 13 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpWalletRelationMapper.java
  8. 62 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpWalletRelation.java
  9. 3 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/LedgerEnum.java
  10. 19 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/PayCenterEnum.java
  11. 30 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/ILedger.java
  12. 342 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerCarrierDto.java
  13. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerLogisticsDto.java
  14. 121 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerPurchaseDto.java
  15. 121 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerSellDto.java
  16. 127 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerShipperDto.java
  17. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerTradeDto.java
  18. 3 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LedgerConfirmReq.java
  19. 1 1
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LedgerReq.java
  20. 5 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LedgerSuccessReq.java
  21. 1 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LogisticsReq.java
  22. 1 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LogisticsSendReq.java
  23. 2 3
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/TradeReq.java
  24. 1 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/TradeSendReq.java
  25. 38 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/LedgerLogisticsDetailVo.java
  26. 37 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/LedgerTradeDetailVo.java
  27. 15 2
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/AbsLedger.java
  28. 11 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsOrderService.java
  29. 105 37
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java
  30. 11 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeOrderService.java
  31. 97 27
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java
  32. 41 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpWalletRelationService.java
  33. 95 0
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java
  34. 34 11
      sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/dubbo/PayCenterServiceImpl.java
  35. 2 2
      sckw-modules/sckw-payment/src/main/resources/bootstrap-dev.yml
  36. 5 1
      sckw-modules/sckw-payment/src/main/resources/bootstrap.yml
  37. 130 12
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml
  38. 209 10
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml
  39. 21 0
      sckw-modules/sckw-payment/src/main/resources/mapper/KwpWalletRelationMapper.xml

+ 7 - 0
sckw-common/sckw-common-core/src/main/java/com/sckw/core/exception/GlobalSystemExceptionHandler.java

@@ -9,6 +9,7 @@ import org.springframework.context.annotation.Configuration;
 import org.springframework.util.CollectionUtils;
 import org.springframework.validation.FieldError;
 import org.springframework.web.bind.MethodArgumentNotValidException;
+import org.springframework.web.bind.MissingServletRequestParameterException;
 import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
@@ -53,6 +54,12 @@ public class GlobalSystemExceptionHandler {
         return HttpResult.error(HttpStatus.UN_LOGIN_CODE, HttpStatus.UN_LOGIN_MESSAGE, ex.getMessage());
     }
 
+    @ResponseBody
+    @ExceptionHandler(MissingServletRequestParameterException.class)
+    public HttpResult noArgs(MissingServletRequestParameterException ex) {
+        String format = "参数:[%s]不能为空";
+        return HttpResult.error(HttpStatus.PARAMETERS_PATTERN_ERROR_CODE, String.format(format, ex.getParameterName()));
+    }
 
     /**
      * 注解校验异常处理

+ 11 - 6
sckw-modules/sckw-example/src/main/java/com/sckw/example/controller/TestController.java

@@ -3,7 +3,8 @@ package com.sckw.example.controller;
 import com.sckw.payment.api.dubbo.PayCenterDubboService;
 import com.sckw.payment.api.model.constant.ChannelEnum;
 import com.sckw.payment.api.model.dto.MemberDetail;
-import lombok.AllArgsConstructor;
+import com.sckw.payment.api.model.dto.R;
+import com.sckw.payment.api.model.dto.WalletDto;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -11,19 +12,23 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.List;
+
 @Slf4j
-@AllArgsConstructor
 @RestController
 @RequestMapping("/test")
 public class TestController {
     @DubboReference(version = "2.0.0", group = "design", check = false)
-    PayCenterDubboService payCenterDubboService;
+    private PayCenterDubboService payCenterDubboService;
 
     @GetMapping("/detail")
-    public MemberDetail download(@RequestParam("type") String uid, String channel) {
-        MemberDetail memberDetail = payCenterDubboService.memberDetail(uid, ChannelEnum.HF);
-        return memberDetail;
+    public R<MemberDetail> download(@RequestParam("uid") Long uid, String channel) {
+        return payCenterDubboService.memberDetail(uid, ChannelEnum.HF);
     }
 
+    @GetMapping("/wall")
+    public R<List<WalletDto>> wall(@RequestParam("uid") Long uid, String channel, Long filter) {
+        return payCenterDubboService.wallet(uid, null, filter);
+    }
 
 }

+ 81 - 14
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerLogisticsController.java

@@ -3,7 +3,7 @@ package com.sckw.payment.controller;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
-import com.sckw.payment.model.dto.LedgerLogisticsDto;
+import com.sckw.payment.model.dto.ILedger;
 import com.sckw.payment.model.vo.req.*;
 import com.sckw.payment.model.vo.res.LedgerLogisticsVo;
 import com.sckw.payment.service.KwpLedgerLogisticsService;
@@ -51,19 +51,56 @@ public class KwpLedgerLogisticsController {
     }
 
     /**
-     * 物流对账单列表查询
+     * 托运方物流对账单列表查询
      *
      * @param logisticsReq
      * @return
      */
-    @PostMapping("pageList")
-    public HttpResult pageList(@RequestBody @Valid LogisticsReq logisticsReq) {
-        return HttpResult.ok(kwpLedgerLogisticsService.pageList(logisticsReq));
+    @PostMapping("shipperList")
+    public HttpResult shipperList(@RequestBody @Valid LogisticsReq logisticsReq) {
+        return HttpResult.ok(kwpLedgerLogisticsService.shipperList(logisticsReq));
     }
 
-    @GetMapping("count")
-    public HttpResult count() {
-        return HttpResult.ok(kwpLedgerLogisticsService.orderCount());
+    /**
+     * 承运方物流对账单列表查询
+     *
+     * @param logisticsReq
+     * @return
+     */
+    @PostMapping("carrierList")
+    public HttpResult carrierList(@RequestBody @Valid LogisticsReq logisticsReq) {
+        return HttpResult.ok(kwpLedgerLogisticsService.carrierList(logisticsReq));
+    }
+
+    /**
+     * 查询物流对账单详情(修改物流对账单接口使用)
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("queryDetail")
+    public HttpResult queryDetail(@RequestParam("id") Long id) {
+        return HttpResult.ok(kwpLedgerLogisticsService.queryDetail(id));
+    }
+
+    /**
+     * 托运方
+     *
+     * @return
+     */
+    @GetMapping("shipperCount")
+    public HttpResult shipperCount() {
+        return HttpResult.ok(kwpLedgerLogisticsService.orderCount(1));
+    }
+
+    /**
+     * 承运方
+     *
+     * @return
+     */
+    @GetMapping("carrierCount")
+    public HttpResult carrierCount() {
+        return HttpResult.ok(kwpLedgerLogisticsService.orderCount(2));
     }
 
     /**
@@ -136,22 +173,52 @@ public class KwpLedgerLogisticsController {
     }
 
     /**
-     * 导出
+     * 托运方-导出
+     *
+     * @param response
+     * @param logisticsReq
+     * @return
+     */
+    @PostMapping("exportShipper")
+    public HttpResult exportShipper(HttpServletResponse response, @RequestBody LogisticsReq logisticsReq) {
+        List<Long> ids = logisticsReq.getIds();
+        List<ILedger> list;
+        if (CollectionUtils.isEmpty(ids)) {
+            PageRes<ILedger> pageResult = kwpLedgerLogisticsService.shipperList(logisticsReq);
+            list = pageResult.getList();
+        } else {
+            list = kwpLedgerLogisticsService.selectShipperList(ids);
+        }
+        if (CollectionUtils.isEmpty(list)) {
+            return HttpResult.error("没有可导出的数据");
+        }
+        List<LedgerLogisticsVo> collect = list.stream().map(a -> {
+            LedgerLogisticsVo ledgerLogisticsVo = new LedgerLogisticsVo();
+            BeanUtils.copyProperties(a, ledgerLogisticsVo);
+            return ledgerLogisticsVo;
+        }).collect(Collectors.toList());
+
+        ExcelUtil.downData(response, LedgerLogisticsVo.class, collect);
+        return null;
+    }
+
+    /**
+     * 承运方
      *
      * @param response
      * @param logisticsReq
      * @return
      */
-    @PostMapping("export")
-    public HttpResult export(HttpServletResponse response, @RequestBody LogisticsReq logisticsReq) {
+    @PostMapping("exportCarrier")
+    public HttpResult exportCarrier(HttpServletResponse response, @RequestBody LogisticsReq logisticsReq) {
         List<Long> ids = logisticsReq.getIds();
-        List<LedgerLogisticsDto> list;
+        List<ILedger> list;
         if (CollectionUtils.isEmpty(ids)) {
-            PageRes<LedgerLogisticsDto> pageResult = kwpLedgerLogisticsService.pageList(logisticsReq);
+            PageRes<ILedger> pageResult = kwpLedgerLogisticsService.carrierList(logisticsReq);
             list = pageResult.getList();
 
         } else {
-            list = kwpLedgerLogisticsService.selectList(ids);
+            list = kwpLedgerLogisticsService.selectCarrierList(ids);
         }
         if (CollectionUtils.isEmpty(list)) {
             return HttpResult.error("没有可导出的数据");

+ 75 - 14
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerTradeController.java

@@ -3,7 +3,7 @@ package com.sckw.payment.controller;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
-import com.sckw.payment.model.dto.LedgerTradeDto;
+import com.sckw.payment.model.dto.ILedger;
 import com.sckw.payment.model.vo.req.*;
 import com.sckw.payment.model.vo.res.LedgerTradeVo;
 import com.sckw.payment.service.KwpLedgerTradeService;
@@ -51,14 +51,36 @@ public class KwpLedgerTradeController {
     }
 
     /**
-     * 贸易对账单列表查询
+     * 贸易对账单列表查询 销售方
      *
      * @param tradeReq
      * @return
      */
-    @PostMapping("pageList")
-    public HttpResult pageList(@RequestBody @Valid TradeReq tradeReq) {
-        return HttpResult.ok(kwpLedgerTradeService.pageList(tradeReq));
+    @PostMapping("sellList")
+    public HttpResult sellList(@RequestBody @Valid TradeReq tradeReq) {
+        return HttpResult.ok(kwpLedgerTradeService.sellList(tradeReq));
+    }
+
+    /**
+     * 贸易对账单列表查询 采购方
+     *
+     * @param tradeReq
+     * @return
+     */
+    @PostMapping("purchaseList")
+    public HttpResult purchaseList(@RequestBody @Valid TradeReq tradeReq) {
+        return HttpResult.ok(kwpLedgerTradeService.purchaseList(tradeReq));
+    }
+
+    /**
+     * 查询物流对账单详情(修改物流对账单接口使用)
+     *
+     * @param id
+     * @return
+     */
+    @GetMapping("queryDetail")
+    public HttpResult queryDetail(@RequestParam("id") Long id) {
+        return HttpResult.ok(kwpLedgerTradeService.queryDetail(id));
     }
 
     /**
@@ -66,9 +88,19 @@ public class KwpLedgerTradeController {
      *
      * @return
      */
-    @GetMapping("count")
-    public HttpResult count() {
-        return HttpResult.ok(kwpLedgerTradeService.orderCount());
+    @GetMapping("sellCount")
+    public HttpResult sellCount() {
+        return HttpResult.ok(kwpLedgerTradeService.orderCount(1));
+    }
+
+    /**
+     * 贸易订单数分类统计
+     *
+     * @return
+     */
+    @GetMapping("purchaseCount")
+    public HttpResult purchaseCount() {
+        return HttpResult.ok(kwpLedgerTradeService.orderCount(2));
     }
 
     /**
@@ -116,7 +148,7 @@ public class KwpLedgerTradeController {
     }
 
     /**
-     * 贸易对账单-驳回
+     * 贸易对账单-驳回对账
      *
      * @param ledgerReq
      * @return
@@ -147,14 +179,43 @@ public class KwpLedgerTradeController {
      * @param tradeReq
      * @return
      */
-    @PostMapping("export")
-    public HttpResult export(HttpServletResponse response, @RequestBody @Valid TradeReq tradeReq) {
-        List<LedgerTradeDto> list;
+    @PostMapping("sellExport")
+    public HttpResult sellExport(HttpServletResponse response, @RequestBody @Valid TradeReq tradeReq) {
+        List<ILedger> list;
+        if (CollectionUtils.isEmpty(tradeReq.getIds())) {
+            PageRes<ILedger> pageResult = kwpLedgerTradeService.sellList(tradeReq);
+            list = pageResult.getList();
+        } else {
+            list = kwpLedgerTradeService.selectSellList(tradeReq.getIds());
+        }
+
+        if (CollectionUtils.isEmpty(list)) {
+            return HttpResult.error("没有可导出的数据");
+        }
+        List<LedgerTradeVo> collect = list.stream().map(a -> {
+            LedgerTradeVo ledgerTradeVo = new LedgerTradeVo();
+            BeanUtils.copyProperties(a, ledgerTradeVo);
+            return ledgerTradeVo;
+        }).collect(Collectors.toList());
+        ExcelUtil.downData(response, LedgerTradeVo.class, collect);
+        return null;
+    }
+
+    /**
+     * 导出
+     *
+     * @param response
+     * @param tradeReq
+     * @return
+     */
+    @PostMapping("purchaseExport")
+    public HttpResult purchaseExport(HttpServletResponse response, @RequestBody @Valid TradeReq tradeReq) {
+        List<ILedger> list;
         if (CollectionUtils.isEmpty(tradeReq.getIds())) {
-            PageRes<LedgerTradeDto> pageResult = kwpLedgerTradeService.pageList(tradeReq);
+            PageRes<ILedger> pageResult = kwpLedgerTradeService.purchaseList(tradeReq);
             list = pageResult.getList();
         } else {
-            list = kwpLedgerTradeService.selectList(tradeReq.getIds());
+            list = kwpLedgerTradeService.selectPurchaseList(tradeReq.getIds());
         }
 
         if (CollectionUtils.isEmpty(list)) {

+ 21 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java

@@ -2,7 +2,9 @@ package com.sckw.payment.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.payment.model.KwpLedgerLogistics;
+import com.sckw.payment.model.dto.LedgerCarrierDto;
 import com.sckw.payment.model.dto.LedgerLogisticsDto;
+import com.sckw.payment.model.dto.LedgerShipperDto;
 import com.sckw.payment.model.vo.req.LogisticsReq;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -17,16 +19,31 @@ import java.util.Map;
 
 @Mapper
 public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics> {
+
     /**
+     * 托运方
+     *
      * @param logisticsReq
-     * @param ids          客户单位id
      * @return
      */
-    List<LedgerLogisticsDto> pageSelect(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("ids") List<Long> ids);
+    List<LedgerShipperDto> shipperSelect(@Param("logisticsReq") LogisticsReq logisticsReq);
+
+    /**
+     * 承运方
+     *
+     * @param logisticsReq
+     * @return
+     */
+    List<LedgerCarrierDto> carrierSelect(@Param("logisticsReq") LogisticsReq logisticsReq);
+
+    Map<String, Long> countOrder(@Param("entId") Long entId, @Param("unitType") Integer unitType);
+
+    LedgerLogisticsDto selectId(@Param("id") Long id);
+
 
-    Map<String, Long> countOrder(@Param("entId") Long entId);
+    List<LedgerShipperDto> selectShipperIds(@Param("ids") List<Long> ids);
 
-    List<LedgerLogisticsDto> selectIds(@Param("ids") List<Long> ids);
+    List<LedgerCarrierDto> selectCarrierIds(@Param("ids") List<Long> ids);
 
 
 }

+ 12 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerTradeMapper.java

@@ -2,6 +2,8 @@ package com.sckw.payment.dao;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.payment.model.KwpLedgerTrade;
+import com.sckw.payment.model.dto.LedgerPurchaseDto;
+import com.sckw.payment.model.dto.LedgerSellDto;
 import com.sckw.payment.model.dto.LedgerTradeDto;
 import com.sckw.payment.model.vo.req.TradeReq;
 import org.apache.ibatis.annotations.Mapper;
@@ -19,7 +21,15 @@ import java.util.Map;
 public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
     List<LedgerTradeDto> pageSelect(@Param("tradeReq") TradeReq tradeReq);
 
-    Map<String, Long> countOrder(@Param("entId") Long entId);
+    List<LedgerSellDto> sellList(@Param("tradeReq") TradeReq tradeReq);
 
-    List<LedgerTradeDto> selectIds(@Param("ids") List<Long> ids);
+    List<LedgerPurchaseDto> purchaseList(@Param("tradeReq") TradeReq tradeReq);
+
+    Map<String, Long> countOrder(@Param("entId") Long entId, @Param("unitType") Integer unitType);
+
+    LedgerTradeDto selectId(@Param("id") Long id);
+
+    List<LedgerSellDto> selectSellIds(@Param("ids") List<Long> ids);
+
+    List<LedgerPurchaseDto> selectPurchaseIds(@Param("ids") List<Long> ids);
 }

+ 13 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpWalletRelationMapper.java

@@ -0,0 +1,13 @@
+package com.sckw.payment.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.sckw.payment.model.KwpWalletRelation;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+* @date 2023-07-24 10:47:47
+* @author xucaiqin
+*/
+@Mapper
+public interface KwpWalletRelationMapper extends BaseMapper<KwpWalletRelation> {
+}

+ 62 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/KwpWalletRelation.java

@@ -0,0 +1,62 @@
+package com.sckw.payment.model;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+* @date 2023-07-24 10:47:47
+* @author xucaiqin
+*/
+/**
+    * 企业与中台用户关系表
+    */
+@Data
+@TableName(value = "kwp_wallet_relation")
+public class KwpWalletRelation {
+    @TableId(value = "id", type = IdType.INPUT)
+    private Long id;
+
+    /**
+     * 企业id(顶级企业才有线上支付功能)
+     */
+    @TableField(value = "ent_id")
+    private Long entId;
+
+    /**
+     * 中台用户id
+     */
+    @TableField(value = "`uid`")
+    private String uid;
+
+    /**
+     * 用户状态(0正常、1已锁)
+     */
+    @TableField(value = "`status`")
+    private Integer status;
+
+    @TableField(value = "create_by")
+    private Long createBy;
+
+    @TableField(value = "create_time")
+    private Date createTime;
+
+    @TableField(value = "update_by")
+    private Long updateBy;
+
+    /**
+     * 更新时间
+     */
+    @TableField(value = "update_time")
+    private Date updateTime;
+
+    /**
+     * 是否删除(0未删除,1删除)
+     */
+    @TableField(value = "del_flag")
+    private Integer delFlag;
+}

+ 3 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/LedgerEnum.java

@@ -15,7 +15,9 @@ public enum LedgerEnum {
     TO_LEDGER(2, "待对账"),
     LEDGERED(3, "已对账"),
     SUCCESS(4, "已完成"),
-    BACK(5, "已退回");
+    BACK(5, "已退回"),
+    REVOCATION(6, "已撤回");
+
     private int status;
     private String desc;
 

+ 19 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/PayCenterEnum.java

@@ -0,0 +1,19 @@
+package com.sckw.payment.model.constant;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @author xucaiqin
+ * @date 2023-07-21 17:53:28
+ */
+@Getter
+@AllArgsConstructor
+public enum PayCenterEnum {
+    DETAIL("/v1/member/detail", "会员详情"),
+    WITHDRAW("/v1/wallet/withdraw/detail", "提现详情"),
+    WALLET("/v1/member/wallet", "钱包清单");
+    private final String addr;
+    private final String desc;
+
+}

+ 30 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/ILedger.java

@@ -0,0 +1,30 @@
+package com.sckw.payment.model.dto;
+
+/**
+ * 对账
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 18:11:24
+ */
+public interface ILedger {
+
+    void setTaxRateLabel(String taxRateLabel);
+
+    void setTaxRate(Integer taxRate);
+
+    Integer getTaxRate();
+
+
+    void setTrading(Integer trading);
+
+    Integer getTrading();
+
+    void setTradingLabel(String tradingLabel);
+
+    void setStatus(Integer status);
+
+    Integer getStatus();
+
+
+    void setStatusLabel(String statusLabel);
+}

+ 342 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerCarrierDto.java

@@ -0,0 +1,342 @@
+package com.sckw.payment.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 对账-物流订单 承运方
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 18:11:24
+ */
+public class LedgerCarrierDto implements ILedger {
+
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 物流对账单编号
+     */
+    private String lLedgerNo;
+
+    /**
+     * 对账单名称
+     */
+    private String name;
+
+    /**
+     * 企业id
+     */
+    private Long entId;
+
+    /**
+     * 托运单位
+     */
+    private Long checkEntId;
+
+    /**
+     * 承运单位
+     */
+    private Long carrierEntId;
+
+
+    /**
+     * 开始日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime startTime;
+
+    /**
+     * 结束日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime endTime;
+
+
+    /**
+     * 发票税率(%)
+     */
+    private String taxRateLabel;
+    private Integer taxRate;
+
+    /**
+     * 交易方式(预付款、货到付款)
+     */
+    private Integer trading;
+    private String tradingLabel;
+
+
+    /**
+     * 总应收/元
+     */
+    private BigDecimal totalPrice;
+    /**
+     * 不含税金额
+     */
+    private BigDecimal exTaxPrice;
+
+    /**
+     * 实际结算金额
+     */
+    private BigDecimal settlePrice;
+
+    /**
+     * 已收款/元
+     */
+    private BigDecimal actualPrice;
+
+    /**
+     * 对账清单凭证
+     */
+    private String url;
+    /**
+     * 生成时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime generateTime;
+    /**
+     * 预计收款时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime receiptTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态状态(1-已保存、2-待对账、3-已对账、4-已完成、5-已退回)
+     */
+    private Integer status;
+    private String statusLabel;
+
+    /**
+     * 客户联系人
+     */
+    private String contacts;
+    /**
+     * 客户联系人电话
+     */
+    private String phone;
+    private String firmName;
+
+    /**
+     * 订单数量
+     */
+    private Integer orderCount;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getlLedgerNo() {
+        return lLedgerNo;
+    }
+
+    public void setlLedgerNo(String lLedgerNo) {
+        this.lLedgerNo = lLedgerNo;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public Long getEntId() {
+        return entId;
+    }
+
+    public void setEntId(Long entId) {
+        this.entId = entId;
+    }
+
+    public Long getCheckEntId() {
+        return checkEntId;
+    }
+
+    public void setCheckEntId(Long checkEntId) {
+        this.checkEntId = checkEntId;
+    }
+
+    public Long getCarrierEntId() {
+        return carrierEntId;
+    }
+
+    public void setCarrierEntId(Long carrierEntId) {
+        this.carrierEntId = carrierEntId;
+    }
+
+    public LocalDateTime getStartTime() {
+        return startTime;
+    }
+
+    public void setStartTime(LocalDateTime startTime) {
+        this.startTime = startTime;
+    }
+
+    public LocalDateTime getEndTime() {
+        return endTime;
+    }
+
+    public void setEndTime(LocalDateTime endTime) {
+        this.endTime = endTime;
+    }
+
+    public String getTaxRateLabel() {
+        return taxRateLabel;
+    }
+
+    @Override
+    public void setTaxRateLabel(String taxRateLabel) {
+        this.taxRateLabel = taxRateLabel;
+    }
+
+    public Integer getTaxRate() {
+        return taxRate;
+    }
+
+    public void setTaxRate(Integer taxRate) {
+        this.taxRate = taxRate;
+    }
+
+    public Integer getTrading() {
+        return trading;
+    }
+
+    public void setTrading(Integer trading) {
+        this.trading = trading;
+    }
+
+    public String getTradingLabel() {
+        return tradingLabel;
+    }
+
+    @Override
+    public void setTradingLabel(String tradingLabel) {
+        this.tradingLabel = tradingLabel;
+    }
+
+    public BigDecimal getTotalPrice() {
+        return totalPrice;
+    }
+
+    public void setTotalPrice(BigDecimal totalPrice) {
+        this.totalPrice = totalPrice;
+    }
+
+    public BigDecimal getExTaxPrice() {
+        return exTaxPrice;
+    }
+
+    public void setExTaxPrice(BigDecimal exTaxPrice) {
+        this.exTaxPrice = exTaxPrice;
+    }
+
+    public BigDecimal getSettlePrice() {
+        return settlePrice;
+    }
+
+    public void setSettlePrice(BigDecimal settlePrice) {
+        this.settlePrice = settlePrice;
+    }
+
+    public BigDecimal getActualPrice() {
+        return actualPrice;
+    }
+
+    public void setActualPrice(BigDecimal actualPrice) {
+        this.actualPrice = actualPrice;
+    }
+
+    public String getUrl() {
+        return url;
+    }
+
+    public void setUrl(String url) {
+        this.url = url;
+    }
+
+    public LocalDateTime getGenerateTime() {
+        return generateTime;
+    }
+
+    public void setGenerateTime(LocalDateTime generateTime) {
+        this.generateTime = generateTime;
+    }
+
+    public LocalDateTime getReceiptTime() {
+        return receiptTime;
+    }
+
+    public void setReceiptTime(LocalDateTime receiptTime) {
+        this.receiptTime = receiptTime;
+    }
+
+    public String getRemark() {
+        return remark;
+    }
+
+    public void setRemark(String remark) {
+        this.remark = remark;
+    }
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public String getStatusLabel() {
+        return statusLabel;
+    }
+
+    @Override
+    public void setStatusLabel(String statusLabel) {
+        this.statusLabel = statusLabel;
+    }
+
+    public String getContacts() {
+        return contacts;
+    }
+
+    public void setContacts(String contacts) {
+        this.contacts = contacts;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getFirmName() {
+        return firmName;
+    }
+
+    public void setFirmName(String firmName) {
+        this.firmName = firmName;
+    }
+
+    public Integer getOrderCount() {
+        return orderCount;
+    }
+
+    public void setOrderCount(Integer orderCount) {
+        this.orderCount = orderCount;
+    }
+}

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerLogisticsDto.java

@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
  */
 @Getter
 @Setter
-public class LedgerLogisticsDto {
+public class LedgerLogisticsDto implements ILedger {
     /**
      * 主键
      */

+ 121 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerPurchaseDto.java

@@ -0,0 +1,121 @@
+package com.sckw.payment.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 对账-贸易订单 采购方
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 18:11:24
+ */
+@Getter
+@Setter
+public class LedgerPurchaseDto implements ILedger {
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 贸易对账单编号
+     */
+    private String tLedgerNo;
+
+    /**
+     * 对账单名称
+     */
+    private String name;
+
+
+    /**
+     * 开始日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime startTime;
+
+    /**
+     * 结束日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime endTime;
+
+    /**
+     * 发票税率(%)
+     */
+    private Integer taxRate;
+    private String taxRateLabel;
+
+    /**
+     * 交易方式(预付款、货到付款)
+     */
+    private Integer trading;
+    private String tradingLabel;
+
+
+    /**
+     * 总应收/元
+     */
+    private BigDecimal totalPrice;
+    /**
+     * 不含税金额
+     */
+    private BigDecimal exTaxPrice;
+
+    /**
+     * 实际结算金额
+     */
+    private BigDecimal settlePrice;
+
+    /**
+     * 已收款/元
+     */
+    private BigDecimal actualPrice;
+
+    /**
+     * 对账审核人电话
+     */
+    private String auditPhone;
+
+    /**
+     * 对账审核人名称
+     */
+    private String auditUser;
+
+    /**
+     * 对账清单凭证
+     */
+    private String url;
+    /**
+     * 生成时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime generateTime;
+    /**
+     * 预计收款日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime receiptTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态(1-已保存、2-待对账、3-已对账、4-已完成、5-已退回)
+     */
+    private Integer status;
+    private String statusLabel;
+    private String contacts;
+    private String phone;
+    private String firmName;
+
+    /**
+     * 订单数量
+     */
+    private Integer orderCount;
+}

+ 121 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerSellDto.java

@@ -0,0 +1,121 @@
+package com.sckw.payment.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 对账-贸易订单 销售方
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 18:11:24
+ */
+@Getter
+@Setter
+public class LedgerSellDto implements ILedger {
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 贸易对账单编号
+     */
+    private String tLedgerNo;
+
+    /**
+     * 对账单名称
+     */
+    private String name;
+
+
+    /**
+     * 开始日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime startTime;
+
+    /**
+     * 结束日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime endTime;
+
+    /**
+     * 发票税率(%)
+     */
+    private Integer taxRate;
+    private String taxRateLabel;
+
+    /**
+     * 交易方式(预付款、货到付款)
+     */
+    private Integer trading;
+    private String tradingLabel;
+
+
+    /**
+     * 总应收/元
+     */
+    private BigDecimal totalPrice;
+    /**
+     * 不含税金额
+     */
+    private BigDecimal exTaxPrice;
+
+    /**
+     * 实际结算金额
+     */
+    private BigDecimal settlePrice;
+
+    /**
+     * 已收款/元
+     */
+    private BigDecimal actualPrice;
+
+    /**
+     * 对账审核人电话
+     */
+    private String auditPhone;
+
+    /**
+     * 对账审核人名称
+     */
+    private String auditUser;
+
+    /**
+     * 对账清单凭证
+     */
+    private String url;
+    /**
+     * 生成时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime generateTime;
+    /**
+     * 预计收款日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime receiptTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态(1-已保存、2-待对账、3-已对账、4-已完成、5-已退回)
+     */
+    private Integer status;
+    private String statusLabel;
+    private String contacts;
+    private String phone;
+    private String firmName;
+
+    /**
+     * 订单数量
+     */
+    private Integer orderCount;
+}

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

@@ -0,0 +1,127 @@
+package com.sckw.payment.model.dto;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+
+/**
+ * 对账-物流订单 托运方
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 18:11:24
+ */
+@Getter
+@Setter
+public class LedgerShipperDto implements ILedger {
+    /**
+     * 主键
+     */
+    private Long id;
+    /**
+     * 物流对账单编号
+     */
+    private String lLedgerNo;
+
+    /**
+     * 对账单名称
+     */
+    private String name;
+    /**
+     * 开始日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime startTime;
+
+    /**
+     * 结束日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime endTime;
+
+
+    /**
+     * 发票税率(%)
+     */
+    private String taxRateLabel;
+    private Integer taxRate;
+
+    /**
+     * 交易方式(预付款、货到付款)
+     */
+    private Integer trading;
+    private String tradingLabel;
+
+
+    /**
+     * 总应收/元
+     */
+    private BigDecimal totalPrice;
+    /**
+     * 不含税金额
+     */
+    private BigDecimal exTaxPrice;
+
+    /**
+     * 实际结算金额
+     */
+    private BigDecimal settlePrice;
+
+    /**
+     * 已收款/元
+     */
+    private BigDecimal actualPrice;
+    /**
+     * 对账审核人电话
+     */
+    private String auditPhone;
+
+    /**
+     * 对账审核人名称
+     */
+    private String auditUser;
+    /**
+     * 对账清单凭证
+     */
+    private String url;
+    /**
+     * 生成时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime generateTime;
+    /**
+     * 预计收款时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime receiptTime;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 状态状态(1-已保存、2-待对账、3-已对账、4-已完成、5-已退回)
+     */
+    private Integer status;
+    private String statusLabel;
+
+    /**
+     * 客户联系人
+     */
+    private String contacts;
+    /**
+     * 客户联系人电话
+     */
+    private String phone;
+    private String firmName;
+
+    /**
+     * 订单数量
+     */
+    private Integer orderCount;
+
+
+}

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerTradeDto.java

@@ -15,7 +15,7 @@ import java.time.LocalDateTime;
  */
 @Getter
 @Setter
-public class LedgerTradeDto {
+public class LedgerTradeDto implements ILedger {
     /**
      * 主键
      */

+ 3 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LedgerConfirmReq.java

@@ -2,6 +2,7 @@ package com.sckw.payment.model.vo.req;
 
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -20,11 +21,13 @@ public class LedgerConfirmReq {
      * 对账审核人
      */
     @NotBlank(message = "对账审核人不能为空")
+    @Size(max = 25, message = "对账审核人不能超过25个字符")
     private String auditUser;
     /**
      * 对账审核人联系方式
      */
     @NotBlank(message = "对账审核人联系方式为空")
+    @Size(max = 11, message = "对账审核人联系方式不能超过11个字符")
     private String auditPhone;
     @NotBlank(message = "对账清单凭证不能为空")
     private String url;

+ 1 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LedgerReq.java

@@ -16,6 +16,6 @@ public class LedgerReq {
     @NotNull(message = "对账单id不能为空")
     private Long id;
     @NotBlank(message = "驳回原因不能为空")
-    @Size(max = 400, message = "最大不能超过400字符")
+    @Size(max = 200, message = "最大不能超过200字符")
     private String remark;
 }

+ 5 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LedgerSuccessReq.java

@@ -3,6 +3,7 @@ package com.sckw.payment.model.vo.req;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import jakarta.validation.constraints.NotBlank;
 import jakarta.validation.constraints.NotNull;
+import jakarta.validation.constraints.Size;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -20,11 +21,15 @@ public class LedgerSuccessReq {
     @NotNull(message = "物流对账单id不能为空")
     private Long id;
     @NotBlank(message = "财务联系人不能为空")
+    @Size(max = 25, message = "财务联系人不能超过25个字符")
     private String successUser;
+
     @NotNull(message = "预计收款日期不能为空")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private LocalDateTime receiptTime;
+
     @NotBlank(message = "财务联系电话不能为空")
+    @Size(max = 11, message = "财务联系电话不能超过11个字符")
     private String successPhone;
 
 }

+ 1 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LogisticsReq.java

@@ -31,4 +31,5 @@ public class LogisticsReq extends BasePara {
     private Integer status;
     private List<Long> ids;
     private Long entId;
+    private Integer unitType;
 }

+ 1 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/LogisticsSendReq.java

@@ -28,6 +28,7 @@ public class LogisticsSendReq {
     /**
      * 名称
      */
+    @Size(max = 25, message = "对账表名称不能超过25字")
     @NotBlank(message = "对账表名称不能为空")
     private String name;
     /**

+ 2 - 3
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/TradeReq.java

@@ -3,7 +3,6 @@ package com.sckw.payment.model.vo.req;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.sckw.core.model.vo.BasePara;
 import com.sckw.payment.model.constant.LedgerEnum;
-import jakarta.validation.constraints.NotNull;
 import lombok.Getter;
 import lombok.Setter;
 
@@ -21,9 +20,7 @@ public class TradeReq extends BasePara {
     @Serial
     private static final long serialVersionUID = 5328731681168692784L;
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
-    @NotNull(message = "生成开始时间不能为空")
     private LocalDateTime startCreateTime;
-    @NotNull(message = "生成结束时间不能为空")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
     private LocalDateTime endCreateTime;
     private Integer trading;
@@ -32,4 +29,6 @@ public class TradeReq extends BasePara {
      */
     private Integer status;
     private List<Long> ids;
+    private Long entId;
+
 }

+ 1 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/req/TradeSendReq.java

@@ -29,6 +29,7 @@ public class TradeSendReq {
     /**
      * 名称
      */
+    @Size(max = 25, message = "对账表名称不能超过25字")
     @NotBlank(message = "对账表名称不能为空")
     private String name;
     /**

+ 38 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/LedgerLogisticsDetailVo.java

@@ -0,0 +1,38 @@
+package com.sckw.payment.model.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.transport.api.model.dto.vo.LogisticsOrderVO;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 对账单详情
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 17:04:51
+ */
+@Getter
+@Setter
+public class LedgerLogisticsDetailVo {
+    private Long id;
+    private String lLedgerNo;
+    private String name;
+    private String firmName;
+    private Integer trading;
+    private Integer taxRate;
+    private BigDecimal totalPrice;
+    private BigDecimal actualPrice;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime startTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime endTime;
+
+    private List<LogisticsOrderVO> orderList;
+    private String remark;
+
+
+}

+ 37 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/vo/res/LedgerTradeDetailVo.java

@@ -0,0 +1,37 @@
+package com.sckw.payment.model.vo.res;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.sckw.order.api.model.OrderDetailRes;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.math.BigDecimal;
+import java.time.LocalDateTime;
+import java.util.List;
+
+/**
+ * 对账单详情
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 17:04:51
+ */
+@Getter
+@Setter
+public class LedgerTradeDetailVo {
+    private Long id;
+    private String tLedgerNo;
+    private String name;
+    private String firmName;
+    private Integer trading;
+    private Integer taxRate;
+    private BigDecimal totalPrice;
+    private BigDecimal actualPrice;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime startTime;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private LocalDateTime endTime;
+
+    private List<OrderDetailRes> orderList;
+    private String remark;
+
+}

+ 15 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/AbsLedger.java

@@ -12,6 +12,19 @@ import java.util.Objects;
  * @date 2023-07-13 15:40:37
  */
 public abstract class AbsLedger {
+    public void orderCheck(Object order) {
+        if (Objects.isNull(order)) {
+            throw new BusinessException("对账单不存在!");
+        }
+    }
+
+    public void detailCheck(Integer status) {
+        List<Integer> objects = Lists.newArrayList(LedgerEnum.SAVE.getStatus(), LedgerEnum.BACK.getStatus(), LedgerEnum.REVOCATION.getStatus());
+        if (Objects.nonNull(status) && !objects.contains(status)) {
+            throw new BusinessException("只有【已保存】、【已撤回】和【已退回】的单据才支持修改!");
+        }
+    }
+
     public void backCheck(Integer status) {
         if (Objects.nonNull(status) && LedgerEnum.TO_LEDGER.getStatus() != status) {
             throw new BusinessException("只有【待对账】的单据才支持对账驳回!");
@@ -25,9 +38,9 @@ public abstract class AbsLedger {
     }
 
     public void deleteCheck(Integer status) {
-        List<Integer> objects = Lists.newArrayList(LedgerEnum.BACK.getStatus(), LedgerEnum.SAVE.getStatus());
+        List<Integer> objects = Lists.newArrayList(LedgerEnum.BACK.getStatus(), LedgerEnum.REVOCATION.getStatus());
         if (Objects.nonNull(status) && !objects.contains(status)) {
-            throw new BusinessException("只有【已保存】和【已退回】的单据才支持删除!");
+            throw new BusinessException("只有【已保存】、【已撤回】和【已退回】的单据才支持删除!");
         }
     }
 

+ 11 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsOrderService.java

@@ -1,12 +1,15 @@
 package com.sckw.payment.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.sckw.core.utils.CollectionUtils;
 import com.sckw.payment.dao.KwpLedgerLogisticsOrderMapper;
 import com.sckw.payment.model.KwpLedgerLogisticsOrder;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -33,4 +36,12 @@ public class KwpLedgerLogisticsOrderService {
             logisticsOrderMapper.insert(logisticsOrder);
         }
     }
+
+    public List<KwpLedgerLogisticsOrder> queryList(Long id) {
+        List<KwpLedgerLogisticsOrder> kwpLedgerLogisticsOrders = logisticsOrderMapper.selectList(new LambdaQueryWrapper<KwpLedgerLogisticsOrder>().eq(KwpLedgerLogisticsOrder::getLLedgerId, id).eq(KwpLedgerLogisticsOrder::getDelFlag, 0));
+        if (CollectionUtils.isEmpty(kwpLedgerLogisticsOrders)) {
+            return new ArrayList<>();
+        }
+        return kwpLedgerLogisticsOrders;
+    }
 }

+ 105 - 37
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -14,13 +14,15 @@ import com.sckw.payment.model.*;
 import com.sckw.payment.model.constant.LedgerEnum;
 import com.sckw.payment.model.constant.LedgerTrackEnum;
 import com.sckw.payment.model.constant.LogisticsUnitType;
-import com.sckw.payment.model.dto.LedgerCountVo;
-import com.sckw.payment.model.dto.LedgerLogisticsDto;
+import com.sckw.payment.model.dto.*;
 import com.sckw.payment.model.vo.req.*;
+import com.sckw.payment.model.vo.res.LedgerLogisticsDetailVo;
 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.vo.KwtLogisticsOrderVO;
+import com.sckw.transport.api.model.dto.vo.LogisticsOrderVO;
 import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -54,7 +56,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private TransportDubboService transportDubboService;
 
-    private void changeDict(List<LedgerLogisticsDto> list) {
+    private void changeDict(List<ILedger> list) {
         List<SysDictResDto> taxRateDict = remoteSystemService.queryDictByType(DictTypeEnum.TAX_RATE.getType());
         Map<String, String> taxRateMap = new HashMap<>();
         Map<String, String> tradingMap = new HashMap<>();
@@ -66,7 +68,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         if (!CollectionUtils.isEmpty(tradingDict)) {
             tradingMap = tradingDict.stream().collect(Collectors.toMap(SysDictResDto::getValue, SysDictResDto::getLabel, (a, b) -> a));
         }
-        for (LedgerLogisticsDto logisticsDto : list) {
+        for (ILedger logisticsDto : list) {
             Integer trading = logisticsDto.getTrading();
             logisticsDto.setTradingLabel(tradingMap.get(String.valueOf(trading)));
             Integer taxRate = logisticsDto.getTaxRate();
@@ -76,19 +78,28 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         }
     }
 
-    /**
-     * 分页查询物流对账单列表
-     *
-     * @param logisticsReq 查询参数
-     * @return
-     */
-    public PageRes<LedgerLogisticsDto> pageList(LogisticsReq logisticsReq) {
+    public PageRes<ILedger> shipperList(LogisticsReq logisticsReq) {
+        logisticsReq.setEntId(LoginUserHolder.getEntId());
+        PageHelper.startPage(logisticsReq.getPage(), logisticsReq.getPageSize());
+        List<LedgerShipperDto> kwpLedgerLogisticsList = logisticsMapper.shipperSelect(logisticsReq);
+        //字典转换
+        if (!CollectionUtils.isEmpty(kwpLedgerLogisticsList)) {
+            List<ILedger> ledgerShipperDto = new ArrayList<>(kwpLedgerLogisticsList);
+            changeDict(ledgerShipperDto);
+            return new PageRes<>(new PageInfo<>(ledgerShipperDto));
+        }
+        return new PageRes<>(new PageInfo<>());
+    }
+
+    public PageRes<ILedger> carrierList(LogisticsReq logisticsReq) {
         logisticsReq.setEntId(LoginUserHolder.getEntId());
         PageHelper.startPage(logisticsReq.getPage(), logisticsReq.getPageSize());
-        List<LedgerLogisticsDto> kwpLedgerLogisticsList = logisticsMapper.pageSelect(logisticsReq, new ArrayList<>());
+        List<LedgerCarrierDto> kwpLedgerLogisticsList = logisticsMapper.carrierSelect(logisticsReq);
         //字典转换
         if (!CollectionUtils.isEmpty(kwpLedgerLogisticsList)) {
-            changeDict(kwpLedgerLogisticsList);
+            List<ILedger> ledgerShipperDto = new ArrayList<>(kwpLedgerLogisticsList);
+            changeDict(ledgerShipperDto);
+            return new PageRes<>(new PageInfo<>(ledgerShipperDto));
         }
         return new PageRes<>(new PageInfo<>(kwpLedgerLogisticsList));
     }
@@ -164,6 +175,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         }
         /*保存物流订单关联数据*/
         List<String> ids = logisticsSendReq.getIds();
+        //todo-xcq 校验当前订单是否已存在绑定的对账单
         List<KwtLogisticsOrderVO> acceptCarriageOrderDetail = transportDubboService.getAcceptCarriageOrderDetail(ids);
         if (CollectionUtils.isEmpty(acceptCarriageOrderDetail)) {
             throw new BusinessException("未找到物流订单!");
@@ -187,6 +199,12 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         /*保存企业相关信息*/
         Long checkEntId = logisticsSendReq.getCheckEntId();
 
+        Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(Collections.singletonList(checkEntId));
+        EntCacheResDto entCacheResDto = entMap.get(checkEntId);
+        if (Objects.isNull(entCacheResDto)) {
+            entCacheResDto = new EntCacheResDto();
+        }
+
         List<KwpLedgerLogisticsUnit> logisticsUnits = new ArrayList<>();
         KwpLedgerLogisticsUnit kwpLedgerLogisticsUnit = new KwpLedgerLogisticsUnit();
         kwpLedgerLogisticsUnit.setId(new IdWorker(1).nextId());
@@ -194,10 +212,10 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         kwpLedgerLogisticsUnit.setLLedgerNo(kwpLedgerLogistics.getLLedgerNo());
         kwpLedgerLogisticsUnit.setUnitType(LogisticsUnitType.SHIPPER);
         kwpLedgerLogisticsUnit.setEntId(checkEntId);
-        kwpLedgerLogisticsUnit.setTopEntId(checkEntId);//todo-xcq
-        kwpLedgerLogisticsUnit.setFirmName("");
-        kwpLedgerLogisticsUnit.setContacts("");
-        kwpLedgerLogisticsUnit.setPhone("");
+        kwpLedgerLogisticsUnit.setTopEntId(entCacheResDto.getId());
+        kwpLedgerLogisticsUnit.setFirmName(entCacheResDto.getFirmName());
+        kwpLedgerLogisticsUnit.setContacts(entCacheResDto.getContacts());
+        kwpLedgerLogisticsUnit.setPhone(entCacheResDto.getPhone());
         kwpLedgerLogisticsUnit.setRemark("");
         kwpLedgerLogisticsUnit.setStatus(0);
         kwpLedgerLogisticsUnit.setCreateBy(LoginUserHolder.getUserId());
@@ -207,17 +225,22 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         kwpLedgerLogisticsUnit.setDelFlag(0);
 
         logisticsUnits.add(kwpLedgerLogisticsUnit);
-
+        Long entId = LoginUserHolder.getEntId();
+        Map<Long, EntCacheResDto> entCarrierMap = remoteSystemService.queryEntTreeByIds(Collections.singletonList(entId));
+        EntCacheResDto entCacheResDto1 = entCarrierMap.get(entId);
+        if (Objects.isNull(entCacheResDto1)) {
+            entCacheResDto1 = new EntCacheResDto();
+        }
         KwpLedgerLogisticsUnit carrierUnit = new KwpLedgerLogisticsUnit();
         carrierUnit.setId(new IdWorker(1).nextId());
         carrierUnit.setLLedgerId(kwpLedgerLogistics.getId());
         carrierUnit.setLLedgerNo(kwpLedgerLogistics.getLLedgerNo());
         carrierUnit.setUnitType(LogisticsUnitType.CARRIER);
-        carrierUnit.setEntId(LoginUserHolder.getEntId());
-        carrierUnit.setTopEntId(checkEntId);//todo-xcq
-        carrierUnit.setFirmName("");
-        carrierUnit.setContacts("");
-        carrierUnit.setPhone("");
+        carrierUnit.setEntId(entId);//顶级企业id
+        carrierUnit.setTopEntId(entCacheResDto1.getId());//顶级企业id
+        carrierUnit.setFirmName(entCacheResDto1.getFirmName());
+        carrierUnit.setContacts(entCacheResDto1.getContacts());
+        carrierUnit.setPhone(entCacheResDto1.getPhone());
         carrierUnit.setRemark("");
         carrierUnit.setStatus(0);
         carrierUnit.setCreateBy(LoginUserHolder.getUserId());
@@ -276,7 +299,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         }
         revokeCheck(kwpLedgerLogistics.getStatus());
 
-        kwpLedgerLogistics.setStatus(LedgerEnum.BACK.getStatus());
+        kwpLedgerLogistics.setStatus(LedgerEnum.REVOCATION.getStatus());
         kwpLedgerLogistics.setUpdateBy(LoginUserHolder.getUserId());
         kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
         logisticsMapper.updateById(kwpLedgerLogistics);
@@ -322,9 +345,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
     @Transactional(rollbackFor = Exception.class)
     public Integer confirmOrder(LedgerConfirmReq confirmReq) {
         KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(confirmReq.getId());
-        if (Objects.isNull(kwpLedgerLogistics)) {
-            throw new BusinessException("对账单不存在!");
-        }
+        orderCheck(kwpLedgerLogistics);
         confirmCheck(kwpLedgerLogistics.getStatus());
         kwpLedgerLogistics.setStatus(LedgerEnum.LEDGERED.getStatus());
         kwpLedgerLogistics.setAuditPhone(confirmReq.getAuditPhone());
@@ -345,9 +366,8 @@ public class KwpLedgerLogisticsService extends AbsLedger {
     @Transactional(rollbackFor = Exception.class)
     public String orderSuccess(LedgerSuccessReq ledgerReq) {
         KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(ledgerReq.getId());
-        if (Objects.isNull(kwpLedgerLogistics)) {
-            throw new BusinessException("对账单不存在!");
-        }
+        orderCheck(kwpLedgerLogistics);
+
         successCheck(kwpLedgerLogistics.getStatus());
 
         kwpLedgerLogistics.setReceiptTime(ledgerReq.getReceiptTime());
@@ -370,7 +390,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         kwpSettlementLogistics.setSuccessUser(ledgerReq.getSuccessUser());
         kwpSettlementLogistics.setSuccessPhone(ledgerReq.getSuccessPhone());
         kwpSettlementLogistics.setReceiptTime(ledgerReq.getReceiptTime());
-        kwpSettlementLogistics.setStatus(0);
+        kwpSettlementLogistics.setStatus(1);//1-待结算
         kwpSettlementLogistics.setCreateBy(LoginUserHolder.getUserId());
         kwpSettlementLogistics.setCreateTime(LocalDateTime.now());
         kwpSettlementLogistics.setUpdateBy(LoginUserHolder.getUserId());
@@ -383,8 +403,12 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         return "对账完成";
     }
 
-    public List<LedgerCountVo> orderCount() {
-        Map<String, Long> map = logisticsMapper.countOrder(LoginUserHolder.getEntId());
+    /**
+     * @param unitType 1-托运方 2-承运方
+     * @return
+     */
+    public List<LedgerCountVo> orderCount(Integer unitType) {
+        Map<String, Long> map = logisticsMapper.countOrder(LoginUserHolder.getEntId(), unitType);
         LedgerCountVo ledgerCountVo;
         List<LedgerCountVo> res = new ArrayList<>();
         for (LedgerEnum value : LedgerEnum.values()) {
@@ -397,9 +421,53 @@ public class KwpLedgerLogisticsService extends AbsLedger {
         return res;
     }
 
-    public List<LedgerLogisticsDto> selectList(List<Long> ids) {
-        List<LedgerLogisticsDto> ledgerLogisticsDto = logisticsMapper.selectIds(ids);
-        changeDict(ledgerLogisticsDto);
-        return ledgerLogisticsDto;
+    /**
+     * 托运方
+     *
+     * @param ids
+     * @return
+     */
+    public List<ILedger> selectShipperList(List<Long> ids) {
+        List<LedgerShipperDto> ledgerLogisticsDto = logisticsMapper.selectShipperIds(ids);
+        List<ILedger> ledgerLogistics = new ArrayList<>(ledgerLogisticsDto);
+        changeDict(ledgerLogistics);
+        return ledgerLogistics;
+    }
+
+    /**
+     * 承运方
+     *
+     * @param ids
+     * @return
+     */
+    public List<ILedger> selectCarrierList(List<Long> ids) {
+        List<LedgerCarrierDto> ledgerLogisticsDto = logisticsMapper.selectCarrierIds(ids);
+        List<ILedger> ledgerLogistics = new ArrayList<>(ledgerLogisticsDto);
+        changeDict(ledgerLogistics);
+        return ledgerLogistics;
+    }
+
+    public LedgerLogisticsDetailVo queryDetail(Long id) {
+        LedgerLogisticsDto ledgerLogisticsDto = logisticsMapper.selectId(id);
+        orderCheck(ledgerLogisticsDto);
+        detailCheck(ledgerLogisticsDto.getStatus());
+
+        List<KwpLedgerLogisticsOrder> kwpLedgerLogisticsOrders = logisticsOrderService.queryList(ledgerLogisticsDto.getId());
+        LedgerLogisticsDetailVo ledgerLogisticsDetailVo = new LedgerLogisticsDetailVo();
+        ledgerLogisticsDetailVo.setId(ledgerLogisticsDto.getId());
+        ledgerLogisticsDetailVo.setLLedgerNo(ledgerLogisticsDto.getLLedgerNo());
+        ledgerLogisticsDetailVo.setName(ledgerLogisticsDto.getName());
+        ledgerLogisticsDetailVo.setFirmName(ledgerLogisticsDto.getFirmName());
+        ledgerLogisticsDetailVo.setTrading(ledgerLogisticsDto.getTrading());
+        ledgerLogisticsDetailVo.setTaxRate(ledgerLogisticsDto.getTaxRate());
+        ledgerLogisticsDetailVo.setTotalPrice(ledgerLogisticsDto.getTotalPrice());
+        ledgerLogisticsDetailVo.setActualPrice(ledgerLogisticsDto.getActualPrice());
+        ledgerLogisticsDetailVo.setStartTime(ledgerLogisticsDto.getStartTime());
+        ledgerLogisticsDetailVo.setEndTime(ledgerLogisticsDto.getEndTime());
+        ledgerLogisticsDetailVo.setRemark(ledgerLogisticsDto.getRemark());
+
+        List<LogisticsOrderVO> acceptCarriageOrderList = transportDubboService.getAcceptCarriageOrderList(kwpLedgerLogisticsOrders.stream().map(a -> Long.toString(a.getLOrderId())).collect(Collectors.toList()));
+        ledgerLogisticsDetailVo.setOrderList(acceptCarriageOrderList);
+        return ledgerLogisticsDetailVo;
     }
 }

+ 11 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeOrderService.java

@@ -1,5 +1,6 @@
 package com.sckw.payment.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.payment.dao.KwpLedgerTradeOrderMapper;
@@ -8,6 +9,7 @@ import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
 import java.time.LocalDateTime;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -36,4 +38,13 @@ public class KwpLedgerTradeOrderService {
             }
         }
     }
+
+    public List<KwpLedgerTradeOrder> queryList(Long id) {
+        List<KwpLedgerTradeOrder> kwpLedgerLogisticsOrders = tradeOrderMapper.selectList(new LambdaQueryWrapper<KwpLedgerTradeOrder>().eq(KwpLedgerTradeOrder::getTLedgerId, id).eq(KwpLedgerTradeOrder::getDelFlag, 0));
+
+        if (CollectionUtils.isEmpty(kwpLedgerLogisticsOrders)) {
+            return new ArrayList<>();
+        }
+        return kwpLedgerLogisticsOrders;
+    }
 }

+ 97 - 27
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java

@@ -17,10 +17,11 @@ import com.sckw.payment.model.*;
 import com.sckw.payment.model.constant.LedgerEnum;
 import com.sckw.payment.model.constant.LedgerTrackEnum;
 import com.sckw.payment.model.constant.TradeUnitType;
-import com.sckw.payment.model.dto.LedgerCountVo;
-import com.sckw.payment.model.dto.LedgerTradeDto;
+import com.sckw.payment.model.dto.*;
 import com.sckw.payment.model.vo.req.*;
+import com.sckw.payment.model.vo.res.LedgerTradeDetailVo;
 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 jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
@@ -56,7 +57,7 @@ public class KwpLedgerTradeService extends AbsLedger {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private TradeOrderInfoService tradeOrderInfoService;
 
-    private void changeDict(List<LedgerTradeDto> list) {
+    private void changeDict(List<ILedger> list) {
         List<SysDictResDto> taxRateDict = remoteSystemService.queryDictByType(DictTypeEnum.TAX_RATE.getType());
         Map<String, String> taxRateMap = new HashMap<>();
         Map<String, String> tradingMap = new HashMap<>();
@@ -68,7 +69,7 @@ public class KwpLedgerTradeService extends AbsLedger {
         if (!CollectionUtils.isEmpty(tradingDict)) {
             tradingMap = tradingDict.stream().collect(Collectors.toMap(SysDictResDto::getValue, SysDictResDto::getLabel, (a, b) -> a));
         }
-        for (LedgerTradeDto tradeDto : list) {
+        for (ILedger tradeDto : list) {
             Integer trading = tradeDto.getTrading();
             tradeDto.setTradingLabel(tradingMap.get(String.valueOf(trading)));
             Integer taxRate = tradeDto.getTaxRate();
@@ -79,19 +80,42 @@ public class KwpLedgerTradeService extends AbsLedger {
     }
 
     /**
-     * 分页查询对账单列表
+     * 销售方
      *
      * @param tradeReq
      * @return
      */
-    public PageRes<LedgerTradeDto> pageList(TradeReq tradeReq) {
+    public PageRes<ILedger> sellList(TradeReq tradeReq) {
+        tradeReq.setEntId(LoginUserHolder.getEntId());
         PageHelper.startPage(tradeReq.getPage(), tradeReq.getPageSize());
-        List<LedgerTradeDto> ledgerTradeDto = tradeMapper.pageSelect(tradeReq);
+        List<LedgerSellDto> ledgerTradeDto = tradeMapper.sellList(tradeReq);
         //字典转换
         if (!CollectionUtils.isEmpty(ledgerTradeDto)) {
-            changeDict(ledgerTradeDto);
+            List<ILedger> ledgerList = new ArrayList<>(ledgerTradeDto);
+            changeDict(new ArrayList<>(ledgerList));
+            return new PageRes<>(new PageInfo<>(ledgerList));
         }
-        return new PageRes<>(new PageInfo<>(ledgerTradeDto));
+        return new PageRes<>(new PageInfo<>());
+    }
+
+    /**
+     * 采购方
+     *
+     * @param tradeReq
+     * @return
+     */
+    public PageRes<ILedger> purchaseList(TradeReq tradeReq) {
+        tradeReq.setEntId(LoginUserHolder.getEntId());
+
+        PageHelper.startPage(tradeReq.getPage(), tradeReq.getPageSize());
+        List<LedgerPurchaseDto> ledgerTradeDto = tradeMapper.purchaseList(tradeReq);
+        //字典转换
+        if (!CollectionUtils.isEmpty(ledgerTradeDto)) {
+            List<ILedger> ledgerPurchaseDto = new ArrayList<>(ledgerTradeDto);
+            changeDict(ledgerPurchaseDto);
+            return new PageRes<>(new PageInfo<>(ledgerPurchaseDto));
+        }
+        return new PageRes<>(new PageInfo<>());
     }
 
     private void removeDraft(Long id) {
@@ -141,7 +165,7 @@ public class KwpLedgerTradeService extends AbsLedger {
 
         /*保存贸易订单关联数据*/
         List<Long> ids = tradeSendReq.getIds();
-        //todo-xcq dubbo拿取销售订单数据
+        //todo-xcq 校验当前订单是否已存在绑定的对账单
         List<OrderDetailRes> resList = new ArrayList<>();
         for (Long id : ids) {
             OrderDetailRes orderDetailById = tradeOrderInfoService.getOrderDetailById(id);
@@ -168,6 +192,11 @@ public class KwpLedgerTradeService extends AbsLedger {
         /*保存企业单位相关信息*/
         //todo-xcq dubbo拿取采购客户单位的信息
         Long purchaseEntId = tradeSendReq.getPurchaseEntId();
+        Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(Collections.singletonList(purchaseEntId));
+        EntCacheResDto entCacheResDto = entMap.get(purchaseEntId);
+        if (Objects.isNull(entCacheResDto)) {
+            entCacheResDto = new EntCacheResDto();
+        }
         List<KwpLedgerTradeUnit> list = new ArrayList<>();
         KwpLedgerTradeUnit kwpLedgerTradeUnit = new KwpLedgerTradeUnit();
         kwpLedgerTradeUnit.setId(new IdWorker(1).nextId());
@@ -175,10 +204,10 @@ public class KwpLedgerTradeService extends AbsLedger {
         kwpLedgerTradeUnit.setTLedgerNo(kwpLedgerTrade.getTLedgerNo());
         kwpLedgerTradeUnit.setUnitType(TradeUnitType.PURCHASE);
         kwpLedgerTradeUnit.setEntId(purchaseEntId);
-        kwpLedgerTradeUnit.setTopEntId(0L);
-        kwpLedgerTradeUnit.setFirmName("");//todo-xcq
-        kwpLedgerTradeUnit.setContacts("");
-        kwpLedgerTradeUnit.setPhone("");
+        kwpLedgerTradeUnit.setTopEntId(entCacheResDto.getId());
+        kwpLedgerTradeUnit.setFirmName(entCacheResDto.getFirmName());
+        kwpLedgerTradeUnit.setContacts(entCacheResDto.getContacts());
+        kwpLedgerTradeUnit.setPhone(entCacheResDto.getPhone());
         kwpLedgerTradeUnit.setRemark("");
         kwpLedgerTradeUnit.setStatus(0);
         kwpLedgerTradeUnit.setCreateBy(LoginUserHolder.getUserId());
@@ -188,17 +217,23 @@ public class KwpLedgerTradeService extends AbsLedger {
         kwpLedgerTradeUnit.setDelFlag(0);
 
         list.add(kwpLedgerTradeUnit);
+        Long entId = LoginUserHolder.getEntId();
+        Map<Long, EntCacheResDto> entCarrierMap = remoteSystemService.queryEntTreeByIds(Collections.singletonList(entId));
+        EntCacheResDto entCacheResDto1 = entCarrierMap.get(entId);
+        if (Objects.isNull(entCacheResDto1)) {
+            entCacheResDto1 = new EntCacheResDto();
+        }
         //非客户企业方,通过登录用户获取顶级企业
         KwpLedgerTradeUnit sellLedgerTradeUnit = new KwpLedgerTradeUnit();
         sellLedgerTradeUnit.setId(new IdWorker(1).nextId());
         sellLedgerTradeUnit.setTLedgerId(kwpLedgerTrade.getId());
         sellLedgerTradeUnit.setTLedgerNo(kwpLedgerTrade.getTLedgerNo());
         sellLedgerTradeUnit.setUnitType(TradeUnitType.SELL);
-        sellLedgerTradeUnit.setEntId(LoginUserHolder.getEntId());
-        sellLedgerTradeUnit.setTopEntId(0L);
-        sellLedgerTradeUnit.setFirmName("");
-        sellLedgerTradeUnit.setContacts("");
-        sellLedgerTradeUnit.setPhone("");
+        sellLedgerTradeUnit.setEntId(entId);
+        sellLedgerTradeUnit.setTopEntId(entCacheResDto1.getId());
+        sellLedgerTradeUnit.setFirmName(entCacheResDto1.getFirmName());
+        sellLedgerTradeUnit.setContacts(entCacheResDto1.getContacts());
+        sellLedgerTradeUnit.setPhone(entCacheResDto1.getPhone());
         sellLedgerTradeUnit.setRemark("");
         sellLedgerTradeUnit.setStatus(0);
         sellLedgerTradeUnit.setCreateBy(LoginUserHolder.getUserId());
@@ -284,7 +319,7 @@ public class KwpLedgerTradeService extends AbsLedger {
             throw new BusinessException("对账单不存在!");
         }
         revokeCheck(kwpLedgerTrade.getStatus());
-        kwpLedgerTrade.setStatus(LedgerEnum.BACK.getStatus());
+        kwpLedgerTrade.setStatus(LedgerEnum.REVOCATION.getStatus());
         kwpLedgerTrade.setUpdateBy(LoginUserHolder.getUserId());
         kwpLedgerTrade.setUpdateTime(LocalDateTime.now());
         tradeMapper.updateById(kwpLedgerTrade);
@@ -380,7 +415,7 @@ public class KwpLedgerTradeService extends AbsLedger {
         kwpSettlementTrade.setSuccessUser(ledgerReq.getSuccessUser());
         kwpSettlementTrade.setSuccessPhone(ledgerReq.getSuccessPhone());
         kwpSettlementTrade.setReceiptTime(ledgerReq.getReceiptTime());
-        kwpSettlementTrade.setStatus(0);
+        kwpSettlementTrade.setStatus(1);//1-待结算
         kwpSettlementTrade.setCreateBy(LoginUserHolder.getUserId());
         kwpSettlementTrade.setCreateTime(LocalDateTime.now());
         kwpSettlementTrade.setUpdateBy(LoginUserHolder.getUserId());
@@ -392,8 +427,8 @@ public class KwpLedgerTradeService extends AbsLedger {
         return "对账完成";
     }
 
-    public List<LedgerCountVo> orderCount() {
-        Map<String, Long> map = tradeMapper.countOrder(LoginUserHolder.getEntId());
+    public List<LedgerCountVo> orderCount(Integer unitType) {
+        Map<String, Long> map = tradeMapper.countOrder(LoginUserHolder.getEntId(), unitType);
         LedgerCountVo ledgerCountVo;
         List<LedgerCountVo> res = new ArrayList<>();
         for (LedgerEnum value : LedgerEnum.values()) {
@@ -406,10 +441,45 @@ public class KwpLedgerTradeService extends AbsLedger {
         return res;
     }
 
-    public List<LedgerTradeDto> selectList(List<Long> ids) {
-        List<LedgerTradeDto> ledgerTradeDto = tradeMapper.selectIds(ids);
-        changeDict(ledgerTradeDto);
-        return ledgerTradeDto;
+    public List<ILedger> selectSellList(List<Long> ids) {
+        List<LedgerSellDto> ledgerTradeDto = tradeMapper.selectSellIds(ids);
+        List<ILedger> ledgerSellDto = new ArrayList<>(ledgerTradeDto);
+        changeDict(ledgerSellDto);
+        return ledgerSellDto;
     }
 
+    public List<ILedger> selectPurchaseList(List<Long> ids) {
+        List<LedgerPurchaseDto> ledgerTradeDto = tradeMapper.selectPurchaseIds(ids);
+        List<ILedger> ledgerSellDto = new ArrayList<>(ledgerTradeDto);
+        changeDict(ledgerSellDto);
+        return ledgerSellDto;
+    }
+
+    public LedgerTradeDetailVo queryDetail(Long id) {
+        LedgerTradeDto ledgerTradeDto = tradeMapper.selectId(id);
+        orderCheck(ledgerTradeDto);
+        detailCheck(ledgerTradeDto.getStatus());
+        List<KwpLedgerTradeOrder> kwpLedgerTradeOrders = tradeOrderService.queryList(ledgerTradeDto.getId());
+        LedgerTradeDetailVo ledgerTradeDetailVo = new LedgerTradeDetailVo();
+        ledgerTradeDetailVo.setId(ledgerTradeDto.getId());
+        ledgerTradeDetailVo.setTLedgerNo(ledgerTradeDto.getTLedgerNo());
+        ledgerTradeDetailVo.setName(ledgerTradeDto.getName());
+        ledgerTradeDetailVo.setFirmName(ledgerTradeDto.getFirmName());
+        ledgerTradeDetailVo.setTrading(ledgerTradeDto.getTrading());
+        ledgerTradeDetailVo.setTaxRate(ledgerTradeDto.getTaxRate());
+        ledgerTradeDetailVo.setTotalPrice(ledgerTradeDto.getTotalPrice());
+        ledgerTradeDetailVo.setActualPrice(ledgerTradeDto.getActualPrice());
+        ledgerTradeDetailVo.setStartTime(ledgerTradeDto.getStartTime());
+        ledgerTradeDetailVo.setEndTime(ledgerTradeDto.getEndTime());
+        ledgerTradeDetailVo.setRemark(ledgerTradeDto.getRemark());
+        List<Long> collect = kwpLedgerTradeOrders.stream().map(KwpLedgerTradeOrder::getTOrderId).toList();
+        List<OrderDetailRes> detailRes = new ArrayList<>();
+        OrderDetailRes orderDetailById;
+        for (Long aLong : collect) {
+            orderDetailById = tradeOrderInfoService.getOrderDetailById(aLong);
+            detailRes.add(orderDetailById);
+        }
+        ledgerTradeDetailVo.setOrderList(detailRes);
+        return ledgerTradeDetailVo;
+    }
 }

+ 41 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpWalletRelationService.java

@@ -0,0 +1,41 @@
+package com.sckw.payment.service;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.sckw.payment.dao.KwpWalletRelationMapper;
+import com.sckw.payment.model.KwpWalletRelation;
+import jakarta.annotation.Resource;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * @author xucaiqin
+ * @date 2023-07-10 16:38:36
+ */
+@Service
+@Slf4j
+public class KwpWalletRelationService {
+    @Resource
+    private KwpWalletRelationMapper relationMapper;
+    private final ConcurrentHashMap<Long, String> map = new ConcurrentHashMap<>(12);
+
+    public String getRelation(Long entId) {
+        String uid = map.get(entId);
+        if (StringUtils.isNotBlank(uid)) {
+            log.debug("从缓存中加载企业用户关系:{}", JSONObject.toJSONString(map));
+            return uid;
+        }
+        KwpWalletRelation kwpWalletRelation = relationMapper.selectOne(new LambdaQueryWrapper<KwpWalletRelation>().eq(KwpWalletRelation::getEntId, entId).eq(KwpWalletRelation::getDelFlag, 0).last("limit 1"));
+        if (Objects.isNull(kwpWalletRelation)) {
+            return null;
+        }
+        map.put(entId, kwpWalletRelation.getUid());
+        return kwpWalletRelation.getUid();
+    }
+
+
+}

+ 95 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/PayCenterService.java

@@ -0,0 +1,95 @@
+package com.sckw.payment.service;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.alibaba.fastjson2.TypeReference;
+import com.sckw.core.utils.OkHttpUtils;
+import com.sckw.core.utils.StringUtils;
+import com.sckw.payment.api.model.constant.ChannelEnum;
+import com.sckw.payment.api.model.dto.MemberDetail;
+import com.sckw.payment.api.model.dto.R;
+import com.sckw.payment.api.model.dto.WalletDto;
+import com.sckw.payment.model.constant.PayCenterEnum;
+import jakarta.validation.constraints.NotNull;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Objects;
+
+/**
+ * 转发中台接口
+ *
+ * @author xucaiqin
+ * @date 2023-07-21 17:45:51
+ */
+@Service
+@Slf4j
+public class PayCenterService {
+    @Value("${payCenter.address}")
+    private String payCenterAddr;
+
+    private <T> R<List<T>> parseArray(String in, Class<T> t) {
+        R<String> res = JSONObject.parseObject(in, new TypeReference<R<String>>() {
+        });
+        String data = res.getData();
+        List<T> ts = JSONArray.parseArray(data, t);
+        R<List<T>> ok = R.ok(ts);
+        ok.setStatus(res.getStatus());
+        ok.setMsg(res.getMsg());
+        ok.setCode(res.getCode());
+        return ok;
+    }
+
+    /**
+     * 会员详情
+     *
+     * @param uid
+     * @param channel
+     * @return
+     */
+    public R<MemberDetail> memberDetail(String uid, ChannelEnum channel) {
+        log.info("{}入参->uid:{} channel:{}", PayCenterEnum.DETAIL.getDesc(), uid, channel);
+        String sync = OkHttpUtils.builder().url(payCenterAddr + PayCenterEnum.DETAIL.getAddr()).addPara("uid", uid).addPara("channel", channel.getChannel()).get().sync();
+        log.info("{}返回值:{}", PayCenterEnum.DETAIL.getDesc(), sync);
+        return JSONObject.parseObject(sync, new TypeReference<R<MemberDetail>>() {
+        });
+    }
+
+    public R<MemberDetail> withdraw(String uid, String view, String orderNo) {
+        log.info("{}入参->uid:{} view:{} orderNo:{}", PayCenterEnum.WITHDRAW.getDesc(), uid, view, orderNo);
+        String sync = OkHttpUtils.builder().url(payCenterAddr + PayCenterEnum.WITHDRAW.getAddr())
+                .addPara("uid", uid)
+                .addPara("view", view)
+                .addPara("orderNo", orderNo)
+                .get().sync();
+        log.info("{}返回值:{}", PayCenterEnum.WITHDRAW.getDesc(), sync);
+        return JSONObject.parseObject(sync, new TypeReference<R<MemberDetail>>() {
+        });
+    }
+
+    /**
+     * 钱包清单
+     *
+     * @param uid     付款人uid
+     * @param channel 支付渠道
+     * @param filter  收款方uid
+     * @return
+     */
+    public R<List<WalletDto>> wallet(@NotNull String uid, ChannelEnum channel, String filter) {
+        log.info("钱包清单入参->uid:{} channel:{} filter:{}", uid, channel, filter);
+        OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(payCenterAddr + PayCenterEnum.WALLET.getAddr())
+                .addPara("uid", uid);
+        if (Objects.nonNull(channel)) {
+            okHttpUtils.addPara("channel", channel.getChannel());
+        }
+        if (StringUtils.isNotBlank(filter)) {
+            okHttpUtils.addPara("filter", filter);
+        }
+        String sync = okHttpUtils.get().sync();
+        log.info("钱包清单返回值:{}", sync);
+        return parseArray(sync, WalletDto.class);
+    }
+
+}

+ 34 - 11
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/dubbo/PayCenterServiceImpl.java

@@ -1,28 +1,51 @@
 package com.sckw.payment.service.dubbo;
 
-import com.alibaba.fastjson2.JSONObject;
-import com.sckw.core.utils.OkHttpUtils;
+import com.sckw.core.exception.BusinessException;
 import com.sckw.payment.api.dubbo.PayCenterDubboService;
 import com.sckw.payment.api.model.constant.ChannelEnum;
 import com.sckw.payment.api.model.dto.MemberDetail;
+import com.sckw.payment.api.model.dto.R;
+import com.sckw.payment.api.model.dto.WalletDto;
+import com.sckw.payment.service.KwpWalletRelationService;
+import com.sckw.payment.service.PayCenterService;
+import jakarta.annotation.Resource;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.dubbo.config.annotation.DubboService;
-import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 @Service
-@DubboService(group = "design", version = "1.0.0")
+@DubboService(group = "design", version = "2.0.0")
 @Slf4j
 public class PayCenterServiceImpl implements PayCenterDubboService {
-    @Value("${payCenter.address}")
-    private String payCenterAddr;
+    @Resource
+    private PayCenterService payCenterService;
+    @Resource
+    private KwpWalletRelationService kwpWalletRelationService;
+
+    @Override
+    public R<MemberDetail> memberDetail(Long entId, ChannelEnum channel) {
+        String uid = kwpWalletRelationService.getRelation(entId);
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("企业未开通电子钱包");
+        }
+        return payCenterService.memberDetail(uid, channel);
+    }
 
     @Override
-    public MemberDetail memberDetail(String uid, ChannelEnum channel) {
-        log.info("会员详情入参->uid:{} channel:{}", uid, channel);
-        String sync = OkHttpUtils.builder().url(payCenterAddr + "/member/detail").addPara("", "").get().sync();
-        log.info("返回值:{}", sync);
-        return JSONObject.parseObject(sync, MemberDetail.class);
+    public R<List<WalletDto>> wallet(Long payEntId, ChannelEnum channel, Long receiveEntId) {
+        String uid = kwpWalletRelationService.getRelation(payEntId);
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("付款方企业未开通电子钱包");
+        }
+        //todo
+        String filter = kwpWalletRelationService.getRelation(receiveEntId);
+        if (StringUtils.isBlank(uid)) {
+            throw new BusinessException("收款方企业未开通电子钱包");
+        }
+        return payCenterService.wallet(uid, channel, filter);
     }
 
 

+ 2 - 2
sckw-modules/sckw-payment/src/main/resources/bootstrap-dev.yml

@@ -5,7 +5,7 @@ spring:
         # 服务注册地址
         server-addr: 10.10.10.230:8848
         # 命名空间
-        namespace: sckw_zk
+        namespace: sckw-service-platform-dev
         # 共享配置
         group: sckw-service-platform
       config:
@@ -14,7 +14,7 @@ spring:
         # 配置文件格式
         file-extension: yaml
         # 命名空间
-        namespace: sckw_zk
+        namespace: sckw-service-platform-dev
         # 共享配置
         group: sckw-service-platform
         #可以读多个配置文件  需要在同一个命名空间下面可以是不同的组

+ 5 - 1
sckw-modules/sckw-payment/src/main/resources/bootstrap.yml

@@ -8,4 +8,8 @@ spring:
     active: ${DEPLOY_MODE:dev}
   main:
     allow-bean-definition-overriding: true
-    allow-circular-references: true
+    allow-circular-references: true
+
+mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 130 - 12
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml

@@ -59,7 +59,7 @@
         del_flag
     </sql>
 
-    <select id="pageSelect" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
+    <select id="shipperSelect" resultType="com.sckw.payment.model.dto.LedgerShipperDto">
         select kll.id,
                kll.l_ledger_no   lLedgerNo,
                kll.name,
@@ -87,7 +87,56 @@
         <where>
             kll.del_flag = 0
               and kllu.unit_type = 1
-              and kll.ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
+              and kllu.ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
+            <if test="logisticsReq.status != null">
+                and kll.status = #{logisticsReq.status}
+            </if>
+            <if test="logisticsReq.trading != null">
+                and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="logisticsReq.startCreateTime != null and logisticsReq.endCreateTime != null">
+                and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
+                    and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
+                and (
+                            kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+        </where>
+        order by kll.generate_time desc
+    </select>
+    <select id="carrierSelect" resultType="com.sckw.payment.model.dto.LedgerCarrierDto">
+        select kll.id,
+               kll.l_ledger_no   lLedgerNo,
+               kll.name,
+               kll.start_time    startTime,
+               kll.end_time      endTime,
+               kll.tax_rate      taxRate,
+               kll.trading,
+               kll.total_price   totalPrice,
+               kll.ex_tax_price  exTaxPrice,
+               kll.settle_price  settlePrice,
+               kll.actual_price  actualPrice,
+               kll.audit_phone   auditPhone,
+               kll.audit_user    auditUser,
+               kll.url,
+               kll.generate_time generateTime,
+               kll.receipt_time  receiptTime,
+               kll.remark,
+               kll.status,
+               kllu.contacts,
+               kllu.phone,
+               kllu.firm_name    firmName,
+               kll.order_count   orderCount
+        from kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
+        <where>
+            kll.del_flag = 0
+              and kllu.unit_type = 2
+              and kllu.ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
             <if test="logisticsReq.status != null">
                 and kll.status = #{logisticsReq.status}
             </if>
@@ -110,18 +159,56 @@
     </select>
 
     <select id="countOrder" resultType="java.util.Map">
-        SELECT count(1)                         "0",
-               count(IF(`status` = 1, 1, NULL)) "1",
-               count(IF(`status` = 2, 1, NULL)) "2",
-               count(IF(`status` = 3, 1, NULL)) "3",
-               count(IF(`status` = 4, 1, NULL)) "4",
-               count(IF(`status` = 5, 1, NULL)) "5"
-        FROM `kwp_ledger_logistics`
-        WHERE del_flag = 0
-        and ent_id = #{entId,jdbcType=BIGINT}
+        SELECT count(1)                           "0",
+               count(IF(kll.status = 1, 1, NULL)) "1",
+               count(IF(kll.status = 2, 1, NULL)) "2",
+               count(IF(kll.status = 3, 1, NULL)) "3",
+               count(IF(kll.status = 4, 1, NULL)) "4",
+               count(IF(kll.status = 5, 1, NULL)) "5",
+               count(IF(kll.status = 6, 1, NULL)) "6"
+        FROM kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
+        WHERE kll.del_flag = 0
+          and kllu.unit_type = #{unitType,jdbcType=INTEGER}
+          and kllu.ent_id = #{entId,jdbcType=BIGINT}
     </select>
 
-    <select id="selectIds" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
+    <select id="selectCarrierIds" resultType="com.sckw.payment.model.dto.LedgerCarrierDto">
+        select kll.id,
+               kll.l_ledger_no   lLedgerNo,
+               kll.name,
+               kll.start_time    startTime,
+               kll.end_time      endTime,
+               kll.tax_rate      taxRate,
+               kll.trading,
+               kll.total_price   totalPrice,
+               kll.ex_tax_price  exTaxPrice,
+               kll.settle_price  settlePrice,
+               kll.actual_price  actualPrice,
+               kll.audit_phone   auditPhone,
+               kll.audit_user    auditUser,
+               kll.url,
+               kll.generate_time generateTime,
+               kll.receipt_time  receiptTime,
+               kll.remark,
+               kll.status,
+               kllu.contacts,
+               kllu.phone,
+               kllu.firm_name    firmName,
+               kll.order_count   orderCount
+        from kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
+        <where>
+            kll.del_flag = 0
+              and kllu.unit_type = 1
+              and kll.id in
+            <foreach collection="ids" item="id" close=")" open="(" separator=",">
+                #{id,jdbcType=BIGINT}
+            </foreach>
+        </where>
+        order by kll.generate_time desc
+    </select>
+    <select id="selectShipperIds" resultType="com.sckw.payment.model.dto.LedgerShipperDto">
         select kll.id,
                kll.l_ledger_no   lLedgerNo,
                kll.name,
@@ -156,4 +243,35 @@
         </where>
         order by kll.generate_time desc
     </select>
+    <select id="selectId" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
+        select kll.id,
+               kll.l_ledger_no   lLedgerNo,
+               kll.name,
+               kll.start_time    startTime,
+               kll.end_time      endTime,
+               kll.tax_rate      taxRate,
+               kll.trading,
+               kll.total_price   totalPrice,
+               kll.ex_tax_price  exTaxPrice,
+               kll.settle_price  settlePrice,
+               kll.actual_price  actualPrice,
+               kll.audit_phone   auditPhone,
+               kll.audit_user    auditUser,
+               kll.url,
+               kll.generate_time generateTime,
+               kll.receipt_time  receiptTime,
+               kll.remark,
+               kll.status,
+               kllu.contacts,
+               kllu.phone,
+               kllu.firm_name    firmName,
+               kll.order_count   orderCount
+        from kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
+        <where>
+            kll.del_flag = 0
+              and kllu.unit_type = 1
+              and kll.id = #{id}
+        </where>
+    </select>
 </mapper>

+ 209 - 10
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml

@@ -107,17 +107,115 @@
         </where>
         order by klt.generate_time desc
     </select>
-
+    <select id="sellList" resultType="com.sckw.payment.model.dto.LedgerSellDto">
+        select klt.id,
+               klt.t_ledger_no   tLedgerNo,
+               klt.name,
+               klt.start_time    startTime,
+               klt.end_time      endTime,
+               klt.tax_rate      taxRate,
+               klt.trading,
+               klt.total_price   totalPrice,
+               klt.ex_tax_price  exTaxPrice,
+               klt.settle_price  settlePrice,
+               klt.actual_price  actualPrice,
+               klt.audit_phone   auditPhone,
+               klt.audit_user    auditUser,
+               klt.url,
+               klt.generate_time generateTime,
+               klt.receipt_time  receiptTime,
+               klt.remark,
+               klt.status,
+               kltu.contacts,
+               kltu.phone,
+               kltu.firm_name    firmName,
+               klt.order_count   orderCount
+        from kwp_ledger_trade klt
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
+        <where>
+            klt.del_flag = 0
+              and kltu.unit_type = 2
+            <if test="tradeReq.status != null">
+                and klt.status = #{tradeReq.status}
+            </if>
+            <if test="tradeReq.trading != null">
+                and klt.trading = #{tradeReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="tradeReq.startCreateTime != null and tradeReq.endCreateTime != null">
+                and klt.generate_time between #{tradeReq.startCreateTime,jdbcType=TIMESTAMP} and
+                    #{tradeReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="tradeReq.keywords != null and tradeReq.keywords != ''">
+                and (
+                            klt.t_ledger_no like concat('%', #{tradeReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kltu.firm_name like concat('%', #{tradeReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kltu.contacts like concat('%', #{tradeReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+        </where>
+        order by klt.generate_time desc
+    </select>
+    <select id="purchaseList" resultType="com.sckw.payment.model.dto.LedgerPurchaseDto">
+        select klt.id,
+               klt.t_ledger_no   tLedgerNo,
+               klt.name,
+               klt.start_time    startTime,
+               klt.end_time      endTime,
+               klt.tax_rate      taxRate,
+               klt.trading,
+               klt.total_price   totalPrice,
+               klt.ex_tax_price  exTaxPrice,
+               klt.settle_price  settlePrice,
+               klt.actual_price  actualPrice,
+               klt.audit_phone   auditPhone,
+               klt.audit_user    auditUser,
+               klt.url,
+               klt.generate_time generateTime,
+               klt.receipt_time  receiptTime,
+               klt.remark,
+               klt.status,
+               kltu.contacts,
+               kltu.phone,
+               kltu.firm_name    firmName,
+               klt.order_count   orderCount
+        from kwp_ledger_trade klt
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
+        <where>
+            klt.del_flag = 0
+              and kltu.unit_type = 1
+            <if test="tradeReq.status != null">
+                and klt.status = #{tradeReq.status}
+            </if>
+            <if test="tradeReq.trading != null">
+                and klt.trading = #{tradeReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="tradeReq.startCreateTime != null and tradeReq.endCreateTime != null">
+                and klt.generate_time between #{tradeReq.startCreateTime,jdbcType=TIMESTAMP} and
+                    #{tradeReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="tradeReq.keywords != null and tradeReq.keywords != ''">
+                and (
+                            klt.t_ledger_no like concat('%', #{tradeReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kltu.firm_name like concat('%', #{tradeReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kltu.contacts like concat('%', #{tradeReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
+            </if>
+        </where>
+        order by klt.generate_time desc
+    </select>
     <select id="countOrder" resultType="java.util.Map">
-        SELECT count(1)                         "0",
-               count(IF(`status` = 1, 1, NULL)) "1",
-               count(IF(`status` = 2, 1, NULL)) "2",
-               count(IF(`status` = 3, 1, NULL)) "3",
-               count(IF(`status` = 4, 1, NULL)) "4",
-               count(IF(`status` = 5, 1, NULL)) "5"
-        FROM `kwp_ledger_trade`
-        WHERE del_flag = 0
-          and ent_id = #{entId,jdbcType=BIGINT}
+        SELECT count(1)                           "0",
+               count(IF(klt.status = 1, 1, NULL)) "1",
+               count(IF(klt.status = 2, 1, NULL)) "2",
+               count(IF(klt.status = 3, 1, NULL)) "3",
+               count(IF(klt.status = 4, 1, NULL)) "4",
+               count(IF(klt.status = 5, 1, NULL)) "5",
+               count(IF(klt.status = 6, 1, NULL)) "6"
+        FROM kwp_ledger_trade klt
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
+        WHERE klt.del_flag = 0
+          and kltu.unit_type = #{unitType,jdbcType=INTEGER}
+          and kltu.ent_id = #{entId,jdbcType=BIGINT}
     </select>
 
     <select id="selectIds" resultType="com.sckw.payment.model.dto.LedgerTradeDto">
@@ -155,4 +253,105 @@
         </where>
         order by klt.generate_time desc
     </select>
+    <select id="selectSellIds" resultType="com.sckw.payment.model.dto.LedgerSellDto">
+        select klt.id,
+        klt.t_ledger_no   tLedgerNo,
+        klt.name,
+        klt.start_time    startTime,
+        klt.end_time      endTime,
+        klt.tax_rate      taxRate,
+        klt.trading,
+        klt.total_price   totalPrice,
+        klt.ex_tax_price  exTaxPrice,
+        klt.settle_price  settlePrice,
+        klt.actual_price  actualPrice,
+        klt.audit_phone   auditPhone,
+        klt.audit_user    auditUser,
+        klt.url,
+        klt.generate_time generateTime,
+        klt.receipt_time  receiptTime,
+        klt.remark,
+        klt.status,
+        kltu.contacts,
+        kltu.phone,
+        kltu.firm_name    firmName,
+        klt.order_count   orderCount
+        from kwp_ledger_trade klt
+        inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
+        <where>
+            klt.del_flag = 0
+            and kltu.unit_type = 1
+            and klt.id in
+            <foreach collection="ids" item="id" close=")" open="(" separator=",">
+                #{id,jdbcType=BIGINT}
+            </foreach>
+        </where>
+        order by klt.generate_time desc
+    </select>
+    <select id="selectPurchaseIds" resultType="com.sckw.payment.model.dto.LedgerPurchaseDto">
+        select klt.id,
+        klt.t_ledger_no   tLedgerNo,
+        klt.name,
+        klt.start_time    startTime,
+        klt.end_time      endTime,
+        klt.tax_rate      taxRate,
+        klt.trading,
+        klt.total_price   totalPrice,
+        klt.ex_tax_price  exTaxPrice,
+        klt.settle_price  settlePrice,
+        klt.actual_price  actualPrice,
+        klt.audit_phone   auditPhone,
+        klt.audit_user    auditUser,
+        klt.url,
+        klt.generate_time generateTime,
+        klt.receipt_time  receiptTime,
+        klt.remark,
+        klt.status,
+        kltu.contacts,
+        kltu.phone,
+        kltu.firm_name    firmName,
+        klt.order_count   orderCount
+        from kwp_ledger_trade klt
+        inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
+        <where>
+            klt.del_flag = 0
+            and kltu.unit_type = 1
+            and klt.id in
+            <foreach collection="ids" item="id" close=")" open="(" separator=",">
+                #{id,jdbcType=BIGINT}
+            </foreach>
+        </where>
+        order by klt.generate_time desc
+    </select>
+    <select id="selectId" resultType="com.sckw.payment.model.dto.LedgerTradeDto">
+        select klt.id,
+               klt.t_ledger_no   tLedgerNo,
+               klt.name,
+               klt.start_time    startTime,
+               klt.end_time      endTime,
+               klt.tax_rate      taxRate,
+               klt.trading,
+               klt.total_price   totalPrice,
+               klt.ex_tax_price  exTaxPrice,
+               klt.settle_price  settlePrice,
+               klt.actual_price  actualPrice,
+               klt.audit_phone   auditPhone,
+               klt.audit_user    auditUser,
+               klt.url,
+               klt.generate_time generateTime,
+               klt.receipt_time  receiptTime,
+               klt.remark,
+               klt.status,
+               kltu.contacts,
+               kltu.phone,
+               kltu.firm_name    firmName,
+               klt.order_count   orderCount
+        from kwp_ledger_trade klt
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
+        <where>
+            klt.del_flag = 0
+              and kltu.unit_type = 1
+              and klt.id = #{id,jdbcType=BIGINT}
+        </where>
+    </select>
 </mapper>

+ 21 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpWalletRelationMapper.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.sckw.payment.dao.KwpWalletRelationMapper">
+  <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpWalletRelation">
+    <!--@mbg.generated-->
+    <!--@Table kwp_wallet_relation-->
+    <id column="id" jdbcType="BIGINT" property="id" />
+    <result column="ent_id" jdbcType="BIGINT" property="entId" />
+    <result column="uid" jdbcType="VARCHAR" property="uid" />
+    <result column="status" jdbcType="INTEGER" property="status" />
+    <result column="create_by" jdbcType="BIGINT" property="createBy" />
+    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
+    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
+    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
+    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--@mbg.generated-->
+    id, ent_id, `uid`, `status`, create_by, create_time, update_by, update_time, del_flag
+  </sql>
+</mapper>