Преглед изворни кода

结算-贸易(销售采购)相关接口init定义

sptkw пре 2 година
родитељ
комит
24844f9395

+ 8 - 20
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementOfflineController.java

@@ -40,27 +40,15 @@ public class KwpSettlementOfflineController {
 
 
     //  =========  销售收款  =========
-//
-//    @PostMapping(name = "交易-线下付款(销售收款)记录-列表", path = "pageListTradeCollection")
-//    public HttpResult pageListTradeCollection(@RequestBody @Valid SettlementReq settlementReq) {
-//        return HttpResult.ok(kwpSettlementOfflineService.pageList(settlementReq));
-//    }
-//
-//    @GetMapping(name = "交易-线下付款(销售收款)记录-新增",path = "tradeOfflineConfirm")
-//    public HttpResult tradeOfflineConfirm(@RequestParam("id") Long id,@RequestParam("price") Float price){
-//        return HttpResult.ok(kwpSettlementOfflineService.confirm(id,price));
-//    }
 
+    @PostMapping(name = "交易-线下付款(销售收款)记录-列表", path = "pageListTradeCollection")
+    public HttpResult pageListTradeCollection(@RequestBody @Valid SettlementOfflineReq settlementOfflineReq) {
+        return HttpResult.ok(kwpSettlementOfflineService.pageListTradeCollection(settlementOfflineReq));
+    }
 
-//    @PostMapping(name = "交易-预付款记录列表", path = "tradePageList")
-//    public HttpResult tradePageList(@RequestBody @Valid SettlementReq settlementReq) {
-//        return HttpResult.ok(kwpSettlementOfflineService.pageList(settlementReq));
-//    }
-//
-//    @GetMapping(name = "交易-新增预付款记录",path = "tradeConfirm")
-//    public HttpResult tradeConfirm(@RequestParam("id") Long id,@RequestParam("price") Float price){
-//        return HttpResult.ok(kwpSettlementOfflineService.confirm(id,price));
-//    }
-
+    @GetMapping(name = "交易-线下付款(销售收款)记录-新增",path = "confirmTradeCollection")
+    public HttpResult confirmTradeCollection(@RequestParam("id") Long id,@RequestParam("price") Float price){
+        return HttpResult.ok(kwpSettlementOfflineService.confirmTradeCollection(id,price));
+    }
 
 }

+ 91 - 14
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementTradeController.java

@@ -1,32 +1,109 @@
 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.SettlementTradeDto;
 import com.sckw.payment.model.vo.req.SettlementReq;
+import com.sckw.payment.model.vo.res.SettlementLogisticsVo;
 import com.sckw.payment.service.KwpSettlementTradeService;
 import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.Valid;
+import org.springframework.beans.BeanUtils;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+import java.util.stream.Collectors;
+
 /**
-* 结算-交易订单
-*
-* @author xucaiqin
-*/
+ * 结算-交易订单
+ *
+ * @author xucaiqin
+ */
 @RestController
-@RequestMapping("/kwpSettlementTrade")
+@RequestMapping(name = "结算-销售采购订单", path = "/kwpSettlementTrade")
 public class KwpSettlementTradeController {
- 
+
     @Resource
     private KwpSettlementTradeService kwpSettlementTradeService;
 
-    @PostMapping(name = "交易订单列表", path = "pageList")
-    public HttpResult pageList(@RequestBody @Valid SettlementReq settlementReq) {
-        return HttpResult.ok(kwpSettlementTradeService.pageList(settlementReq));
+    //   ========= 收款 销售 =========
+    @PostMapping(name = "收款-销售结算单列表", path = "pageListCollection")
+    public HttpResult pageListCollection(@RequestBody @Valid SettlementReq settlementReq) {
+        return HttpResult.ok(kwpSettlementTradeService.pageListCollection(settlementReq));
+    }
+
+    @GetMapping(name = "收款-销售结算单列表头部汇总数量", path = "getCountListCollection")
+    public HttpResult getCountListCollection(@RequestBody @Valid SettlementReq settlementReq) {
+        return HttpResult.ok(kwpSettlementTradeService.getCountListCollection(settlementReq));
+    }
+
+    @PostMapping(name = "收款-根据ids导出销售结算单列表", path = "exportCollection")
+    public HttpResult exportCollection(HttpServletResponse response, @RequestBody @Valid SettlementReq settlementReq) {
+        List<SettlementTradeDto> list;
+        if (CollectionUtils.isEmpty(settlementReq.getIds())) {
+            PageRes<SettlementTradeDto> pageResult = kwpSettlementTradeService.pageListCollection(settlementReq);
+            list = pageResult.getList();
+        } else {
+            list = kwpSettlementTradeService.selectList(settlementReq.getIds());
+        }
+        return this.export(response, list);
+    }
+
+    @GetMapping(name = "收款-销售结算订单详情", path = "detailCollection")
+    public HttpResult detailCollection(@RequestParam("id") Long id) {
+        return HttpResult.ok(kwpSettlementTradeService.detailCollection(id));
+    }
+
+
+    //   ========= 付款 采购 =========
+    @PostMapping(name = "付款-采购结算单列表", path = "pageListPayment")
+    public HttpResult pageListPayment(@RequestBody @Valid SettlementReq settlementReq) {
+        return HttpResult.ok(kwpSettlementTradeService.pageListPayment(settlementReq));
+    }
+
+    @GetMapping(name = "收款-物流结算订单列表头部汇总数量", path = "getCountListPayment")
+    public HttpResult getCountListPayment(@RequestBody @Valid SettlementReq settlementReq) {
+        return HttpResult.ok(kwpSettlementTradeService.getCountListPayment(settlementReq));
+    }
+
+    @PostMapping(name = "付款-根据ids导出采购结算单列表", path = "exportPayment")
+    public HttpResult exportPayment(HttpServletResponse response, @RequestBody @Valid SettlementReq settlementReq) {
+        List<SettlementTradeDto> list;
+        if (CollectionUtils.isEmpty(settlementReq.getIds())) {
+            PageRes<SettlementTradeDto> pageResult = kwpSettlementTradeService.pageListPayment(settlementReq);
+            list = pageResult.getList();
+        } else {
+            list = kwpSettlementTradeService.selectList(settlementReq.getIds());
+        }
+        return this.export(response, list);
+    }
+
+    @GetMapping(name = "付款-采购结算订单详情", path = "detailPayment")
+    public HttpResult detailPayment(@RequestParam("id") Long id) {
+        return HttpResult.ok(kwpSettlementTradeService.detailPayment(id));
     }
 
-    @GetMapping(name = "交易订单详情",path = "detail")
-    public HttpResult detail(@RequestParam("id") Long id){
-        return HttpResult.ok(kwpSettlementTradeService.detail(id));
+    /**
+     * 导出
+     *
+     * @author Aick Spt
+     * @date 2023-07-24 15:49
+     */
+    private HttpResult export(HttpServletResponse response, List<SettlementTradeDto> list) {
+        if (CollectionUtils.isEmpty(list)) {
+            return HttpResult.error("没有可导出的数据");
+        }
+        List<SettlementLogisticsVo> collect = list.stream().map(a -> {
+            SettlementLogisticsVo settlementLogisticsVo = new SettlementLogisticsVo();
+            BeanUtils.copyProperties(a, settlementLogisticsVo);
+            return settlementLogisticsVo;
+        }).collect(Collectors.toList());
+        ExcelUtil.downData(response, SettlementLogisticsVo.class, collect);
+        return null;
     }
-    
-    
+
+
 }

+ 38 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpSettlementWalletController.java

@@ -18,6 +18,8 @@ import org.springframework.web.bind.annotation.*;
 @RequestMapping(name = "结算-电子钱包结算记录", path = "/kwpSettlementWallet")
 public class KwpSettlementWalletController {
 
+    //  =========  物流付款  =========
+
     @Resource
     private KwpSettlementWalletService kwpSettlementWalletService;
 
@@ -42,4 +44,40 @@ public class KwpSettlementWalletController {
         return HttpResult.ok(kwpSettlementWalletService.confirmLogisticsPayment(id, price));
     }
 
+
+
+    //  =========  销售收付款  =========
+    @PostMapping(name = "销售-付款记录列表(采购电子钱包结算记录)", path = "pageListTradePayment")
+    public HttpResult pageListTradePayment(SettlementWalletReq settlementWalletReq) {
+        return HttpResult.ok(kwpSettlementWalletService.pageListTradePayment(settlementWalletReq));
+    }
+
+    /**
+     * @param id    结算单id
+     * @param price 本次付款金额
+     * @author Aick Spt
+     * @date 2023-07-25 09:55
+     */
+    @GetMapping(name = "销售-付款确认-(新增电子钱包记录-采购货到付款)", path = "confirmTradePayment")
+    public HttpResult confirmTradePayment(@RequestParam("id") Long id, @RequestParam("price") Float price) {
+        return HttpResult.ok(kwpSettlementWalletService.confirmTradePayment(id, price));
+    }
+
+    @PostMapping(name = "销售-收款记录列表-预付款(电子钱包)", path = "pageListTradeCollection")
+    public HttpResult pageListTradeCollection(SettlementWalletReq settlementWalletReq) {
+        return HttpResult.ok(kwpSettlementWalletService.pageListTradeCollection(settlementWalletReq));
+    }
+
+    /**
+     * @param id    结算单id
+     * @param price 本次付款金额
+     * @author Aick Spt
+     * @date 2023-07-25 09:55
+     */
+    @GetMapping(name = "销售-收款确认-预付款(电子钱包)", path = "confirmTradeCollection")
+    public HttpResult confirmTradeCollection(@RequestParam("id") Long id, @RequestParam("price") Float price) {
+        return HttpResult.ok(kwpSettlementWalletService.confirmTradeCollection(id, price));
+    }
+
+
 }

+ 48 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementOfflineService.java

@@ -8,6 +8,7 @@ import com.sckw.payment.dao.KwpSettlementOfflineMapper;
 import com.sckw.payment.model.KwpSettlementOffline;
 import com.sckw.payment.model.dto.SettlementOfflineDto;
 import com.sckw.payment.model.vo.req.SettlementOfflineReq;
+import com.sckw.payment.model.vo.req.SettlementReq;
 import com.sckw.payment.model.vo.res.SettlementOfflineVo;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -98,4 +99,51 @@ public class KwpSettlementOfflineService {
         return settlementOfflineMapper.confirmLogisticsCollection(id, price);
     }
 
+    public PageRes<SettlementOfflineVo> pageListTradeCollection(SettlementOfflineReq settlementOfflineReq) {
+        //        //todo 查询缓存,获取客户企业id
+//        String keywords = settlementReq.getKeywords();
+//        if (StringUtils.isNotBlank(keywords)) {
+//            System.out.println("关键之:" + keywords);
+//        }
+        PageHelper.startPage(settlementOfflineReq.getPage(), settlementOfflineReq.getPageSize());
+
+        List<SettlementOfflineDto> settlementOfflineLogisticsList = settlementOfflineMapper.pageListLogisticsCollection(settlementOfflineReq);
+        for (SettlementOfflineDto entity : settlementOfflineLogisticsList) {
+            entity.setCreateByText("创建人名称");
+            entity.setUpdateByText("更新人名称");
+        }
+
+        if (CollectionUtils.isEmpty(settlementOfflineLogisticsList)) {
+            return new PageRes<>(new PageInfo<>());
+        }
+
+        //指定返回值
+        List<SettlementOfflineVo> collect = settlementOfflineLogisticsList.stream().map(a -> {
+            SettlementOfflineVo settlementOfflineVo = new SettlementOfflineVo();
+            BeanUtils.copyProperties(a, settlementOfflineVo);
+            return settlementOfflineVo;
+        }).collect(Collectors.toList());
+
+        return new PageRes<>(new PageInfo<>(collect));
+    }
+
+    public Integer confirmTradeCollection(Long id, Float price) {
+        log.info("接收到数据,开始物流-物流-线下付款(销售收款)记录-新增,待完善");
+        //todo 待完善
+        //先查询出结算单情况
+
+        //检查结算单状态和所差金额
+
+        //对比金额
+
+        //累加入库结算单
+
+        //新增电子钱包结算记录
+        KwpSettlementOffline kwpSettlementOffline = new KwpSettlementOffline();
+        kwpSettlementOffline.setId(new IdWorker(1).nextId());
+
+        //todo 待完善
+        settlementOfflineMapper.insert(kwpSettlementOffline);
+        return settlementOfflineMapper.confirmLogisticsCollection(id, price);
+    }
 }

+ 53 - 4
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementTradeService.java

@@ -4,12 +4,17 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.model.page.PageRes;
 import com.sckw.payment.dao.KwpSettlementTradeMapper;
 import com.sckw.payment.model.KwpSettlementTrade;
+import com.sckw.payment.model.constant.SettlementEnum;
 import com.sckw.payment.model.dto.SettlementLogisticsDto;
+import com.sckw.payment.model.dto.SettlementTradeDto;
 import com.sckw.payment.model.dto.SettlementWalletDto;
 import com.sckw.payment.model.vo.req.SettlementReq;
+import com.sckw.payment.model.vo.res.SettlementLogisticsStatusCountVo;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 
+import java.util.List;
+
 /**
  * @author xucaiqin
  * @date 2023-07-10 16:38:36
@@ -23,7 +28,7 @@ public class KwpSettlementTradeService {
         settlementTradeMapper.insert(kwpSettlementTrade);
     }
 
-    public PageRes<SettlementWalletDto> pageList(SettlementReq settlementReq) {
+    public PageRes<SettlementTradeDto> pageListCollection(SettlementReq settlementReq) {
 //        //todo 查询缓存,获取客户企业id
 //        String keywords = settlementReq.getKeywords();
 //        if (StringUtils.isNotBlank(keywords)) {
@@ -37,6 +42,31 @@ public class KwpSettlementTradeService {
         return new PageRes<>(new PageInfo<>());
     }
 
+    public SettlementLogisticsStatusCountVo getCountListCollection(SettlementReq settlementReq) {
+        SettlementLogisticsStatusCountVo settlementLogisticsStatusCountVos = new SettlementLogisticsStatusCountVo();
+        //总
+//        settlementReq.setStatus(null);
+//        settlementLogisticsStatusCountVos.setAllCount(settlementLogisticsMapper.getCountListCollection(settlementReq));
+//
+//        //待结算
+//        settlementReq.setStatus(SettlementEnum.WAITING_PAYMENT.getStatus());
+//        settlementLogisticsStatusCountVos.setWaitingPaymentCount(settlementLogisticsMapper.getCountListCollection(settlementReq));
+//
+//        //部分结算
+//        settlementReq.setStatus(SettlementEnum.PARTIAL_PAYMENT.getStatus());
+//        settlementLogisticsStatusCountVos.setPartialPaymentCount(settlementLogisticsMapper.getCountListCollection(settlementReq));
+//
+//        //全部结算
+//        settlementReq.setStatus(SettlementEnum.ALL_PAYMENT.getStatus());
+//        settlementLogisticsStatusCountVos.setAllPaymentCount(settlementLogisticsMapper.getCountListCollection(settlementReq));
+
+        return settlementLogisticsStatusCountVos;
+    }
+
+
+    public List<SettlementTradeDto> selectList(List<Long> ids) {
+        return null;
+    }
 
     /**
      * 结算-物流订单详情
@@ -45,10 +75,29 @@ public class KwpSettlementTradeService {
      * @author Aick Spt
      * @date 2023-07-19 09:11
      */
-    public SettlementLogisticsDto detail(Long id) {
-//        return settlementOfflineMapper.detail(id);
-        return new SettlementLogisticsDto();
+    public SettlementTradeDto detailCollection(Long id) {
+        return null;
+    }
+
+    public PageRes<SettlementTradeDto> pageListPayment(SettlementReq settlementReq) {
+//        //todo 查询缓存,获取客户企业id
+//        String keywords = settlementReq.getKeywords();
+//        if (StringUtils.isNotBlank(keywords)) {
+//            System.out.println("关键之:" + keywords);
+//        }
+//        PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
+//
+//        List<SettlementLogisticsDto> kwpLedgerLogisticsList = settlementOfflineMapper.pageSelect(settlementReq);
+//
+//        return new PageRes<>(new PageInfo<>(kwpLedgerLogisticsList));
+        return new PageRes<>(new PageInfo<>());
     }
 
+    public SettlementLogisticsStatusCountVo getCountListPayment(SettlementReq settlementReq) {
+        return null;
+    }
 
+    public SettlementTradeDto detailPayment(Long id) {
+        return null;
+    }
 }

+ 99 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementWalletService.java

@@ -101,5 +101,104 @@ public class KwpSettlementWalletService {
         return settlementWalletMapper.confirmLogisticsPayment(id, price);
     }
 
+    public PageRes<SettlementWalletVo> pageListTradePayment(SettlementWalletReq settlementWalletReq) {
+//        //todo 查询缓存,获取客户企业id
+//        String keywords = settlementReq.getKeywords();
+//        if (StringUtils.isNotBlank(keywords)) {
+//            System.out.println("关键之:" + keywords);
+//        }
+        PageHelper.startPage(settlementWalletReq.getPage(), settlementWalletReq.getPageSize());
+
+        List<SettlementWalletDto> settlementWalletLogisticsList = settlementWalletMapper.pageListLogisticsPayment(settlementWalletReq);
+        for (SettlementWalletDto entity : settlementWalletLogisticsList) {
+            entity.setCreateByText("创建人名称");
+            entity.setUpdateByText("更新人名称");
+        }
+
+        if (CollectionUtils.isEmpty(settlementWalletLogisticsList)) {
+            return new PageRes<>(new PageInfo<>());
+        }
+
+        //指定返回值
+        List<SettlementWalletVo> collect = settlementWalletLogisticsList.stream().map(a -> {
+            SettlementWalletVo settlementWalletVo = new SettlementWalletVo();
+            BeanUtils.copyProperties(a, settlementWalletVo);
+            return settlementWalletVo;
+        }).collect(Collectors.toList());
+
+        return new PageRes<>(new PageInfo<>(collect));
+    }
+
+
+    public Integer confirmTradePayment(Long id, Float price) {
+        log.info("接收到数据,开始物流-销售-付款确认-(新增电子钱包记录-采购货到付款)-新增,待完善");
+        //todo 待完善
+        //先查询出结算单情况
+
+        //检查结算单状态和所差金额
+
+        //对比金额
+
+        //累加入库结算单
+
+        //扣费电子钱包
+
+        //新增电子钱包结算记录
+        KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
+        kwpSettlementWallet.setId(new IdWorker(1).nextId());
+        //todo 待完善
+        settlementWalletMapper.insert(kwpSettlementWallet);
+        return settlementWalletMapper.confirmLogisticsPayment(id, price);
+    }
+
+    public PageRes<SettlementWalletVo> pageListTradeCollection(SettlementWalletReq settlementWalletReq) {
+//        //todo 查询缓存,获取客户企业id
+//        String keywords = settlementReq.getKeywords();
+//        if (StringUtils.isNotBlank(keywords)) {
+//            System.out.println("关键之:" + keywords);
+//        }
+        PageHelper.startPage(settlementWalletReq.getPage(), settlementWalletReq.getPageSize());
+
+        List<SettlementWalletDto> settlementWalletLogisticsList = settlementWalletMapper.pageListLogisticsPayment(settlementWalletReq);
+        for (SettlementWalletDto entity : settlementWalletLogisticsList) {
+            entity.setCreateByText("创建人名称");
+            entity.setUpdateByText("更新人名称");
+        }
+
+        if (CollectionUtils.isEmpty(settlementWalletLogisticsList)) {
+            return new PageRes<>(new PageInfo<>());
+        }
+
+        //指定返回值
+        List<SettlementWalletVo> collect = settlementWalletLogisticsList.stream().map(a -> {
+            SettlementWalletVo settlementWalletVo = new SettlementWalletVo();
+            BeanUtils.copyProperties(a, settlementWalletVo);
+            return settlementWalletVo;
+        }).collect(Collectors.toList());
+
+        return new PageRes<>(new PageInfo<>(collect));
+    }
+
+
+    public Integer confirmTradeCollection(Long id, Float price) {
+        log.info("接收到数据,开始物流-销售-收款确认-预付款(电子钱包)-新增,待完善");
+        //todo 待完善
+        //先查询出结算单情况
+
+        //检查结算单状态和所差金额
+
+        //对比金额
+
+        //累加入库结算单
+
+        //扣费电子钱包
+
+        //新增电子钱包结算记录
+        KwpSettlementWallet kwpSettlementWallet = new KwpSettlementWallet();
+        kwpSettlementWallet.setId(new IdWorker(1).nextId());
+        //todo 待完善
+        settlementWalletMapper.insert(kwpSettlementWallet);
+        return settlementWalletMapper.confirmLogisticsPayment(id, price);
+    }
 }