Browse Source

Merge remote-tracking branch 'origin/dev' into dev

lengfaqiang 2 years ago
parent
commit
3cadd8a7f8

+ 1 - 1
sckw-common/sckw-common-core/src/main/java/com/sckw/core/model/enums/CarWaybillEnum.java

@@ -52,7 +52,7 @@ public enum CarWaybillEnum {
     /**
      * 已撤销
      */
-    REVOKED(11, "revoked", "11", "单趟撤回"),
+    REVOKED(11, "revoked", "11", "撤回"),
     /**
      * 已核单-不通过[审核不通过]
      */

+ 3 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerLogisticsController.java

@@ -1,5 +1,6 @@
 package com.sckw.payment.controller;
 
+import com.sckw.core.annotation.RepeatSubmit;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
@@ -40,6 +41,7 @@ public class KwpLedgerLogisticsController {
      * @param logisticsReq 保存物流对账单参数
      * @return
      */
+    @RepeatSubmit(interval = 3000,message ="两次请求间隔未超过3秒")
     @PostMapping("sendDraft")
     public HttpResult sendDraft(@RequestBody @Valid LogisticsSendReq logisticsReq) {
         return HttpResult.ok(kwpLedgerLogisticsService.sendLedgerDraft(logisticsReq));
@@ -52,6 +54,7 @@ public class KwpLedgerLogisticsController {
      * @return
      */
     @PostMapping("send")
+    @RepeatSubmit(interval = 3000,message ="两次请求间隔未超过3秒")
     public HttpResult send(@RequestBody @Valid LogisticsSendReq logisticsReq) {
         return HttpResult.ok(kwpLedgerLogisticsService.sendLedger(logisticsReq));
     }

+ 3 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerTradeController.java

@@ -1,5 +1,6 @@
 package com.sckw.payment.controller;
 
+import com.sckw.core.annotation.RepeatSubmit;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.web.response.HttpResult;
 import com.sckw.excel.utils.ExcelUtil;
@@ -41,6 +42,7 @@ public class KwpLedgerTradeController {
      * @param tradeSendReq
      * @return
      */
+    @RepeatSubmit(interval = 3000,message ="两次请求间隔未超过3秒")
     @PostMapping("sendDraft")
     public HttpResult sendDraft(@RequestBody @Valid TradeSendReq tradeSendReq) {
         return HttpResult.ok(kwpLedgerTradeService.sendLedgerDraft(tradeSendReq));
@@ -52,6 +54,7 @@ public class KwpLedgerTradeController {
      * @param tradeSendReq
      * @return
      */
+    @RepeatSubmit(interval = 3000,message ="两次请求间隔未超过3秒")
     @PostMapping("send")
     public HttpResult send(@RequestBody @Valid TradeSendReq tradeSendReq) {
         return HttpResult.ok(kwpLedgerTradeService.sendLedger(tradeSendReq));

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

@@ -4,7 +4,6 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
-import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.StringTimeUtil;
 import com.sckw.core.web.context.LoginUserHolder;
@@ -33,7 +32,10 @@ import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
 import java.time.LocalDateTime;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
 
 /**
  * @author Aick Spt
@@ -234,22 +236,18 @@ public class KwpSettlementLogisticsService {
         List<SettlementLogisticsDto> kwpLedgerLogisticsList = settlementLogisticsMapper.pageSelect(settlementReq);
         //查询同样条件下的合计
         SettlementLogisticsSumVo settlementLogisticsSum = settlementLogisticsMapper.selectSum(settlementReq);
+        PageInfo<SettlementLogisticsDto> pageInfo = new PageInfo<>(kwpLedgerLogisticsList);
 
-        // 对查询结果进行处理,转换 status 等状态值为对应中文描述
-        return new PageMoreRes<>(getSettlementLogisticsDtoPageRes(kwpLedgerLogisticsList), settlementLogisticsSum);
-    }
-
-    /**
-     * 对查询结果进行处理,转换 status 等状态值为对应中文描述
-     *
-     * @author Aick Spt
-     * @date 2023-08-03 10:44
-     */
-    private PageInfo<SettlementLogisticsDto> getSettlementLogisticsDtoPageRes(List<SettlementLogisticsDto> kwpLedgerLogisticsList) {
+        Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.TRADE_TYPE.getType());
         for (SettlementLogisticsDto entity : kwpLedgerLogisticsList) {
+            SysDictResDto sysDictResDto = dictResDtoMap.get(entity.getTrading());
+            if (Objects.nonNull(sysDictResDto)) {
+                entity.setTradingLabel(sysDictResDto.getLabel());
+            }
             setDetailDesc(entity);
         }
-        return new PageInfo<>(kwpLedgerLogisticsList);
+
+        return new PageMoreRes<>(pageInfo, settlementLogisticsSum);
     }
 
     /**
@@ -310,6 +308,12 @@ public class KwpSettlementLogisticsService {
         if (settlementLogisticsDto == null) {
             throw new BusinessException("查无数据");
         }
+        //
+        Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.TRADE_TYPE.getType());
+        SysDictResDto sysDictResDto = dictResDtoMap.get(settlementLogisticsDto.getTrading());
+        if (Objects.nonNull(sysDictResDto)) {
+            settlementLogisticsDto.setTradingLabel(sysDictResDto.getLabel());
+        }
         setDetailDesc(settlementLogisticsDto);
         return settlementLogisticsDto;
     }
@@ -325,17 +329,6 @@ public class KwpSettlementLogisticsService {
     }
 
 
-    private String changeDict(String trading) {
-        //字典等数据转换
-        String tradingLabel = "";
-        Map<String, SysDictResDto> dictResDtoMap = remoteSystemService.queryDictMapByType(DictTypeEnum.TRADE_TYPE.getType());
-        SysDictResDto sysDictResDto = dictResDtoMap.get(trading);
-        if (Objects.nonNull(sysDictResDto)) {
-            tradingLabel = sysDictResDto.getLabel();
-        }
-        return tradingLabel;
-    }
-
     /**
      * 增加 创建、更新人名称及字段
      *
@@ -343,8 +336,8 @@ public class KwpSettlementLogisticsService {
      * @date 2023-08-07 10:14
      */
     private void setDetailDesc(SettlementLogisticsDto settlementLogisticsDto) {
-        //更改支付方式 TradingEnum
-        settlementLogisticsDto.setTradingLabel(changeDict(settlementLogisticsDto.getTrading()));
+        //结算比例
+        settlementLogisticsDto.setPercentage(settlementLogisticsDto.changePercentage(settlementLogisticsDto.getActualPrice(), settlementLogisticsDto.getTotalPrice()));
 
         //更改创建、更新人名称及字段
         settlementLogisticsDto.setStatusLabel(SettlementEnum.getStatusDesc(settlementLogisticsDto.getStatus()));
@@ -362,28 +355,16 @@ public class KwpSettlementLogisticsService {
         //"更新人名称"
         settlementLogisticsDto.setUpdateByLabel("更新人名称");
 
-        Map<Long, UserCacheResDto> map = new HashMap<>(Global.NUMERICAL_SIXTEEN);
         Long createBy = settlementLogisticsDto.getCreateBy();
         Long updateBy = settlementLogisticsDto.getUpdateBy();
-        UserCacheResDto userCacheResDto = map.get(createBy);
-        if (Objects.isNull(userCacheResDto)) {
-            //通过缓存拿对应数据
-            userCacheResDto = remoteSystemService.queryUserCacheById(createBy);
-            map.put(createBy, userCacheResDto);
-        }
+        UserCacheResDto userCacheResDto = remoteSystemService.queryUserCacheById(createBy);
         if (Objects.nonNull(userCacheResDto)) {
-            //写入对应数据
             settlementLogisticsDto.setCreateByLabel(userCacheResDto.getName());
         }
-        userCacheResDto = map.get(updateBy);
-        if (Objects.isNull(userCacheResDto)) {
-            //通过缓存拿对应数据
-            userCacheResDto = remoteSystemService.queryUserCacheById(updateBy);
-            map.put(updateBy, userCacheResDto);
-        }
-        if (Objects.nonNull(userCacheResDto)) {
+        UserCacheResDto userCacheResDto2 = remoteSystemService.queryUserCacheById(updateBy);
+        if (Objects.nonNull(userCacheResDto2)) {
             //写入对应数据
-            settlementLogisticsDto.setUpdateByLabel(userCacheResDto.getName());
+            settlementLogisticsDto.setUpdateByLabel(userCacheResDto2.getName());
         }
     }
 

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

@@ -809,6 +809,27 @@ public class PayCenterService {
         });
     }
 
+    /**
+     * 转出,在提现
+     *
+     * @param uid
+     * @param filter
+     * @param channel
+     * @param money
+     * @return
+     */
+    public R<Order> withdrawTransfer(String uid, String filter, ChannelEnum channel, Long money) {
+        String sync = postHttp(PayCenterEnum.WITHDRAW_TRANSFER, new HashMap<>() {{
+            put("uid", uid);
+            put("filter", filter);
+            put("channel", channel);
+            put("money", money);
+        }});
+
+        return JSONObject.parseObject(sync, new TypeReference<>() {
+        });
+    }
+
     /**
      * 冻结资金
      * 中台逻辑:

+ 38 - 31
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/WalletService.java

@@ -556,19 +556,11 @@ public class WalletService {
         if (Objects.isNull(byChannel)) {
             throw new BusinessException("支付通道不存在");
         }
-        //余额转出
-        R<Object> transfer = payCenterService.transfer(cashWalletReq.getUid(), cashWalletReq.getFilter(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()));
-        log.info("提现-余额转出:{}", JSONObject.toJSONString(transfer));
-        if (!transfer.getStatus()) {
-            throw new BusinessException(StringUtils.isNotBlank(transfer.getMsg()) ? transfer.getMsg() : "提现异常");
-        }
-        //申请提现
-        R<Order> orderR = payCenterService.withdrawTake(cashWalletReq.getUid(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()), cashWalletReq.getRemark());
-        log.info("提现-申请提现:{}", JSONObject.toJSONString(orderR));
-        if (!orderR.getStatus()) {
-            throw new BusinessException(StringUtils.isNotBlank(orderR.getMsg()) ? orderR.getMsg() : "申请提现异常");
+        R<Order> payIndexR = payCenterService.withdrawTransfer(cashWalletReq.getUid(), cashWalletReq.getFilter(), byChannel, cashWalletReq.bigMoney(cashWalletReq.getMoney()));
+        if (!payIndexR.getStatus()) {
+            throw new BusinessException(StringUtils.isNotBlank(payIndexR.getMsg()) ? payIndexR.getMsg() : "申请提现异常");
         }
-        return orderR.getData();
+        return payIndexR.getData();
     }
 
     /**
@@ -1621,25 +1613,40 @@ public class WalletService {
      * @return
      */
     public PageRes<PrePayDetailVo> preReceiveOrder(MoneyPage moneyPage) {
-        PrePayDetailVo chargeDetailVo = new PrePayDetailVo();
-        chargeDetailVo.setOrderNo("123");
-        chargeDetailVo.setChannel("huifu");
-        chargeDetailVo.setChannelDict("1");
-        chargeDetailVo.setChannelLabel("汇付天下");
-        chargeDetailVo.setUid("kll_001");
-        chargeDetailVo.setUidName("uid名称");
-        chargeDetailVo.setFilter("kll_002");
-        chargeDetailVo.setFilterName("filterName");
-        chargeDetailVo.setStatus(0);
-        chargeDetailVo.setStatusLabel("测试");
-        chargeDetailVo.setMoney(new BigDecimal("12"));
-        chargeDetailVo.setRemark("测试");
-        chargeDetailVo.setCreateTime(DateTimeUtil.format(LocalDateTime.now()));
-        List<PrePayDetailVo> objects = new ArrayList<>() {{
-            add(chargeDetailVo);
-        }};
-        PageInfo<PrePayDetailVo> objectPageInfo = new PageInfo<>();
-        return new PageRes<>(objectPageInfo, objects);
+        ChannelEnum byChannel = ChannelEnum.getByChannel(moneyPage.getChannel());
+        if (Objects.isNull(byChannel)) {
+            throw new BusinessException("支付通道异常");
+        }
+        R<Page<PrePayIndex2>> pageR = payCenterService.advancePayIndex2(moneyPage.getFilter(), byChannel, moneyPage.getUid(), moneyPage.getPage(), moneyPage.getPageSize());
+        if (!pageR.getStatus()) {
+            return new PageRes<>(moneyPage.getPage(), moneyPage.getPageSize(), 0, 0, new ArrayList<>());
+        }
+        Page<PrePayIndex2> data = pageR.getData();
+        if (Objects.nonNull(data)) {
+            List<PrePayIndex2> rows = data.getRows();
+            if (!CollectionUtils.isEmpty(rows)) {
+                List<PrePayDetailVo> collect = rows.stream().map(a -> {
+                    PrePayDetailVo prePayDetailVo = new PrePayDetailVo();
+                    prePayDetailVo.setBalance(prePayDetailVo.smallMoney(a.getApBalance()));
+                    prePayDetailVo.setOrderNo(a.getOrderNo());
+                    prePayDetailVo.setChannel(a.getChannel());
+                    prePayDetailVo.setChannelDict(ChannelEnum.getDict(a.getChannel()));
+                    prePayDetailVo.setChannelLabel(ChannelEnum.getDesc(a.getChannel()));
+                    prePayDetailVo.setUid(moneyPage.getUid());
+                    prePayDetailVo.setUidName(getFirmName(moneyPage.getUid()));
+                    prePayDetailVo.setFilter(moneyPage.getFilter());
+                    prePayDetailVo.setFilterName(getFirmName(moneyPage.getFilter()));
+                    prePayDetailVo.setStatus(a.getStatus());
+                    prePayDetailVo.setStatusLabel(a.getStatusLabel());
+                    prePayDetailVo.setMoney(prePayDetailVo.smallMoney(a.getMoney()));
+                    prePayDetailVo.setRemark(a.getRemarks());
+                    prePayDetailVo.setCreateTime(a.getCreateTime());
+                    return prePayDetailVo;
+                }).collect(Collectors.toList());
+                return new PageRes<>(moneyPage.getPage(), moneyPage.getPageSize(), data.getTotal(), (int) (data.getTotal() / data.getPageSize() + 1), collect);
+            }
+        }
+        return new PageRes<>(moneyPage.getPage(), moneyPage.getPageSize(), 0, 0, new ArrayList<>());
     }
 
     /**

+ 5 - 9
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/KwtWaybillOrderService.java

@@ -416,15 +416,7 @@ public class KwtWaybillOrderService {
         /**Mongodb数据存储**/
         //1车辆订单
         for (SckwWaybillOrder waybillOrder : sckwWaybillOrders) {
-            //rabbitMq业务汇总数据发送/消费对象
-            SckwBusSum busSum = new SckwBusSum();
-            //业务汇总类型
-            busSum.setBusSumType(BusinessTypeEnum.WAYBILL_ORDER_TYPE.getName());
-            //操作对象(1新增/2修改/3替换数据)
-            busSum.setMethod(1);
-            //业务汇总数据对象
-            busSum.setObject(waybillOrder);
-            streamBridge.send("sckw-busSum", busSum);
+            editSckwWaybillOrder(waybillOrder, null, Global.NUMERICAL_ONE);
         }
 
         //2承运订单
@@ -533,6 +525,7 @@ public class KwtWaybillOrderService {
                     SckwWaybillOrder mongoOrder = setSckwWaybillOrder(sendCarDto, waybillOrder, logisticsOrder, loadAddress,
                             unloadAddress, checkEnt, carrierEnt, goods);
                     mongoOrder.set_id(circulate.getId());
+                    mongoOrder.setWOrderId(null);
                     mongoOrder.setWOrderNo(null);
                     sckwWaybillOrders.add(mongoOrder);
                 }
@@ -1108,6 +1101,8 @@ public class KwtWaybillOrderService {
             waybillOrder.setStatus(CarWaybillEnum.REVOKED.getCode());
             waybillOrderDao.updateById(waybillOrder);
 
+            setWaybillOrderTrack(waybillOrder.getId(), waybillOrder.getUpdateTime(), waybillOrder.getStatus(), "完结物流订单时撤回车辆运单!");
+
             //车辆订单-Mongodb数据更新
             SckwWaybillOrder wOrder = new SckwWaybillOrder();
             wOrder.set_id(waybillOrder.getId());
@@ -1118,6 +1113,7 @@ public class KwtWaybillOrderService {
         List<KwtLogisticsOrderCirculate> circulates = logisticsOrderCirculateDao.findCirculateList(lorderId, null, null, 0);
         for (KwtLogisticsOrderCirculate circulate : circulates) {
             circulate.setStatus(Global.NUMERICAL_ONE);
+            circulate.setRemark("完结物流订单时撤回车辆运单!");
             logisticsOrderCirculateDao.updateById(circulate);
 
             //车辆订单-Mongodb数据更新