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

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

zk 2 лет назад
Родитель
Сommit
786be5547e

+ 1 - 0
sckw-common/sckw-common-excel/src/main/java/com/sckw/excel/utils/ExcelUtil.java

@@ -104,6 +104,7 @@ public class ExcelUtil {
         fileName = URLEncoder.encode(fileName + "-" + DateUtil.dateToStr(LocalDate.now()), "UTF-8").replaceAll("\\+", "%20");
         response.setContentType("application/vnd.ms-excel");
         response.setCharacterEncoding("UTF-8");
+        response.setHeader("Access-Control-Expose-Headers", "Content-disposition");
         response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx");
     }
 

+ 1 - 1
sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/dubbo/TradeOrderInfoService.java

@@ -29,7 +29,7 @@ public interface TradeOrderInfoService {
     HttpResult updateOrderStatus(UpdateOrderStatusParam param);
 
     /**
-     * @desc: 废弃,请用orderAmountUpdate
+     * @desc: 废弃
      * @desc: 更新订单委托量、已履约量
      * @author: yzc
      * @date: 2023-07-18 18:34

+ 2 - 7
sckw-modules-api/sckw-order-api/src/main/java/com/sckw/order/api/model/CompleteLogisticsOrderParam.java

@@ -28,17 +28,12 @@ public class CompleteLogisticsOrderParam implements Serializable {
     private Long tOrderId;
 
     /**
-     * 任务量  传负数
-     */
-    private BigDecimal entrustAmount;
-
-    /**
-     * 实装量 传正数
+     * 实装总量 传正数
      */
     private BigDecimal actualLoadAmount;
 
     /**
-     * 实卸量  传正数
+     * 实卸总量  传正数
      */
     private BigDecimal actualUnloadAmount;
 

+ 10 - 17
sckw-modules/sckw-order/src/main/java/com/sckw/order/dubbo/TradeOrderInfoServiceImpl.java

@@ -148,20 +148,19 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
     public HttpResult completeLogisticsOrder(CompleteLogisticsOrderParam param) {
         log.info("物流订单完结入参:{}", JSON.toJSONString(param));
         Long id = param.getTOrderId();
-        BigDecimal entrustAmount = param.getEntrustAmount();
         BigDecimal actualLoadAmount = param.getActualLoadAmount();
         BigDecimal actualUnloadAmount = param.getActualUnloadAmount();
         Long updateBy = param.getUpdateBy();
         String updateByName = param.getUpdateByName();
-        if (Objects.isNull(updateBy) || StringUtils.isBlank(updateByName)) {
-            return HttpResult.error("操作人信息不能为空!");
-        }
-        if (Objects.isNull(entrustAmount) || Objects.isNull(actualLoadAmount) || Objects.isNull(actualUnloadAmount)) {
-            return HttpResult.error("任务量或装卸量不能为空!");
+        if (Objects.isNull(actualLoadAmount) || Objects.isNull(actualUnloadAmount)) {
+            return HttpResult.error("装卸总量不能为空!");
         }
         if (Objects.isNull(param.getIsAllComplete())) {
             return HttpResult.error("物流订单是否已全部完结不能为空!");
         }
+        if (Objects.isNull(updateBy) || StringUtils.isBlank(updateByName)) {
+            return HttpResult.error("操作人信息不能为空!");
+        }
         String lockKey = String.format(RedisConstant.TORDER_UPDATE_AMOUNT_KEY, id);
         if (Boolean.FALSE.equals(RedissonUtils.tryLock(lockKey, 5L, 10L))) {
             return HttpResult.error("业务繁忙,请稍后再试!");
@@ -174,15 +173,9 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
             if (!Objects.equals(String.valueOf(order.getStatus()), DictEnum.TORDER_STATUS_4.getValue())) {
                 return HttpResult.error("执行中的订单才可物流托运!");
             }
-            BigDecimal totalEntrustAmount = Objects.isNull(order.getEntrustAmount()) ? entrustAmount : order.getEntrustAmount().add(entrustAmount);
-            BigDecimal totalActualAmount;
-            if (Objects.equals(order.getDeliveryType(), DictEnum.DELIVERY_TYPE_0.getValue())) {
-                totalActualAmount = Objects.isNull(order.getActualAmount()) ? actualLoadAmount : order.getActualAmount().add(actualLoadAmount);
-            } else {
-                totalActualAmount = Objects.isNull(order.getActualAmount()) ? actualUnloadAmount : order.getActualAmount().add(actualUnloadAmount);
-            }
-            order.setEntrustAmount(totalEntrustAmount).setActualAmount(totalActualAmount).setUpdateBy(param.getUpdateBy());
-            if (param.getIsAllComplete() && totalActualAmount.compareTo(order.getAmount()) >= 0) {
+            BigDecimal actualAmount = Objects.equals(order.getDeliveryType(), DictEnum.DELIVERY_TYPE_0.getValue()) ? actualLoadAmount : actualUnloadAmount;
+            order.setActualAmount(actualAmount).setUpdateBy(param.getUpdateBy());
+            if (param.getIsAllComplete() && actualAmount.compareTo(order.getAmount()) >= 0) {
                 order.setStatus(Integer.valueOf(DictEnum.TORDER_STATUS_5.getValue()));
                 KwoTradeOrderTrack track = new KwoTradeOrderTrack();
                 track.setTOrderId(order.getId()).setTOrderNo(order.getTOrderNo()).setStatus(order.getStatus())
@@ -192,8 +185,8 @@ public class TradeOrderInfoServiceImpl implements TradeOrderInfoService {
             kwoTradeOrderService.updateById(order);
             //更新mongodb
             SckwTradeOrder updateParam = new SckwTradeOrder();
-            updateParam.setTOrderId(order.getId()).setEntrustAmount(totalEntrustAmount).setActualAmount(totalActualAmount)
-                    .setStatus(order.getStatus()).setUpdateBy(param.getUpdateBy()).setUpdateByName(param.getUpdateByName()).setUpdateTime(new Date());
+            updateParam.setTOrderId(order.getId()).setActualAmount(actualAmount).setStatus(order.getStatus())
+                    .setUpdateBy(param.getUpdateBy()).setUpdateByName(param.getUpdateByName()).setUpdateTime(new Date());
             saveMongoDb(updateParam);
         } finally {
             RedissonUtils.unlock(lockKey);

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

@@ -143,16 +143,32 @@ public class KwpSettlementLogisticsService {
         settlementReq.setEntId(LoginUserHolder.getEntId());
     }
 
+    /**
+     * 分页查询结算物流(运费)相关订单数据,并查询出对应合计
+     *
+     * @author Aick Spt
+     * @date 2023-08-03 10:29
+     */
     private PageMoreRes<SettlementLogisticsDto> pageSelect(SettlementReq settlementReq) {
+        //验证相关参数
         validSettlementReq(settlementReq);
+        //添加默认分页数据
         PageHelper.startPage(settlementReq.getPage(), settlementReq.getPageSize());
+        //查询分页数据
         List<SettlementLogisticsDto> kwpLedgerLogisticsList = settlementLogisticsMapper.pageSelect(settlementReq);
+        //查询同样条件下的合计
         SettlementLogisticsSumVo settlementLogisticsSum = settlementLogisticsMapper.selectSum(settlementReq);
 
-        // 对查询结果进行处理,转换 status 到 desc
+        // 对查询结果进行处理,转换 status 等状态值为对应中文描述
         return new PageMoreRes<>(getSettlementLogisticsDtoPageRes(kwpLedgerLogisticsList), settlementLogisticsSum);
     }
 
+    /**
+     * 对查询结果进行处理,转换 status 等状态值为对应中文描述
+     *
+     * @author Aick Spt
+     * @date 2023-08-03 10:44
+     */
     private PageInfo<SettlementLogisticsDto> getSettlementLogisticsDtoPageRes(List<SettlementLogisticsDto> kwpLedgerLogisticsList) {
         for (SettlementLogisticsDto entity : kwpLedgerLogisticsList) {
             setDetailDesc(entity);
@@ -160,6 +176,12 @@ public class KwpSettlementLogisticsService {
         return new PageInfo<>(kwpLedgerLogisticsList);
     }
 
+    /**
+     * 根据条件获取列表头部汇总数据
+     *
+     * @author Aick Spt
+     * @date 2023-08-03 10:44
+     */
     public List<TableTop> getCountList(SettlementReq settlementReq) {
         validSettlementReq(settlementReq);
         SettlementLogisticsStatusCountVo settlementLogisticsStatusCountVos = new SettlementLogisticsStatusCountVo();
@@ -201,6 +223,12 @@ public class KwpSettlementLogisticsService {
         return tableTops;
     }
 
+    /**
+     * 运费-物流订单详情
+     *
+     * @author Aick Spt
+     * @date 2023-08-07 10:14
+     */
     private SettlementLogisticsDto detail(Long id, Integer unitType) {
         SettlementLogisticsDto settlementLogisticsDto = settlementLogisticsMapper.detail(id, unitType);
         if (settlementLogisticsDto == null) {
@@ -210,6 +238,12 @@ public class KwpSettlementLogisticsService {
         return settlementLogisticsDto;
     }
 
+    /**
+     * 增加 创建、更新人名称及字段
+     *
+     * @author Aick Spt
+     * @date 2023-08-07 10:14
+     */
     private void setDetailDesc(SettlementLogisticsDto settlementLogisticsDto) {
         settlementLogisticsDto.setStatusText(SettlementEnum.getStatusDesc(settlementLogisticsDto.getStatus()));
         if (settlementLogisticsDto.getLedgerSettlePrice() != null) {
@@ -229,18 +263,22 @@ public class KwpSettlementLogisticsService {
         Long updateBy = settlementLogisticsDto.getUpdateBy();
         UserCacheResDto userCacheResDto = map.get(createBy);
         if (Objects.isNull(userCacheResDto)) {
+            //通过缓存拿对应数据
             userCacheResDto = remoteSystemService.queryUserCacheById(createBy);
             map.put(createBy, userCacheResDto);
         }
         if (Objects.nonNull(userCacheResDto)) {
+            //写入对应数据
             settlementLogisticsDto.setCreateByText(userCacheResDto.getName());
         }
         userCacheResDto = map.get(updateBy);
         if (Objects.isNull(userCacheResDto)) {
+            //通过缓存拿对应数据
             userCacheResDto = remoteSystemService.queryUserCacheById(updateBy);
             map.put(updateBy, userCacheResDto);
         }
         if (Objects.nonNull(userCacheResDto)) {
+            //写入对应数据
             settlementLogisticsDto.setUpdateByText(userCacheResDto.getName());
         }
     }

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

@@ -72,13 +72,13 @@ public class KwpSettlementOfflineService {
      */
     public PageRes<SettlementOfflineVo> pageListLogisticsCollection(SettlementOfflineReq settlementOfflineReq) {
         PageHelper.startPage(settlementOfflineReq.getPage(), settlementOfflineReq.getPageSize());
-
+        //查询对应数据
         List<SettlementOfflineDto> settlementOfflineLogisticsList = settlementOfflineMapper.pageListLogisticsCollection(settlementOfflineReq);
 
         if (CollectionUtils.isEmpty(settlementOfflineLogisticsList)) {
             return new PageRes<>(new PageInfo<>());
         }
-
+        //增加对应创建人和更新人名称
         for (SettlementOfflineDto entity : settlementOfflineLogisticsList) {
             entity.setCreateByText("创建人名称");
             entity.setUpdateByText("更新人名称");

+ 2 - 1
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementWalletService.java

@@ -88,7 +88,7 @@ public class KwpSettlementWalletService {
         if (CollectionUtils.isEmpty(settlementWalletLogisticsList)) {
             return new PageRes<>();
         }
-
+        //增加对应创建人和更新人名称
         for (SettlementWalletDto entity : settlementWalletLogisticsList) {
             entity.setCreateByText("创建人名称");
             entity.setUpdateByText("更新人名称");
@@ -374,6 +374,7 @@ public class KwpSettlementWalletService {
         if (CollectionUtils.isEmpty(settlementWalletDto)) {
             return new PageRes<>();
         }
+        //增加对应创建人和更新人名称
         Map<Long, UserCacheResDto> map = new HashMap<>();
         PageInfo<SettlementWalletDto> pageInfo = new PageInfo<>(settlementWalletDto);
         //指定返回值

+ 12 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/utils/CommonValidator.java

@@ -1,9 +1,19 @@
 package com.sckw.payment.utils;
 
 import com.sckw.core.exception.BusinessException;
+import com.sckw.payment.model.constant.SettlementEnum;
+import com.sckw.payment.model.dto.SettlementLogisticsDto;
+import com.sckw.system.api.RemoteSystemService;
+import com.sckw.system.api.model.dto.res.UserCacheResDto;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.dubbo.config.annotation.DubboReference;
+import org.apache.poi.ss.formula.functions.T;
 
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
 
@@ -15,6 +25,8 @@ public class CommonValidator {
 
     // 时间格式的正则表达式
     private static final String TIME_PATTERN = "\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}";
+    @DubboReference(version = "2.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
 
     /**
      * 判断时间段的开始时间和结束时间是否同时存在或同时不存在,且格式为 yyyy-MM-dd HH:mm:ss

+ 1 - 1
sckw-modules/sckw-product/src/main/java/com/sckw/product/controller/KwpGoodsController.java

@@ -50,7 +50,7 @@ public class KwpGoodsController {
      * @Param addGoodsParam:
      * @return: com.sckw.core.web.response.HttpResult
      */
-    @Log(description = "添加上架草稿")
+    @Log(description = "添加上架商品")
     @PostMapping(value = "/addShelves", produces = MediaType.APPLICATION_JSON_VALUE)
     public HttpResult addShelves(@RequestBody @Validated AddGoodsParam addGoodsParam) {
         kwpGoodsService.addShelves(addGoodsParam);

+ 6 - 2
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java

@@ -89,12 +89,16 @@ public class KwOrderService {
         List<OrderListRes> result = new ArrayList<>();
         list.forEach(e -> {
             OrderListRes order = BeanUtils.copyProperties(e, OrderListRes.class);
+            String loadCityName = Objects.isNull(e.getLoadCityName()) ? "" : e.getLoadCityName();
+            String unloadCityName = Objects.isNull(e.getUnloadCityName()) ? "" : e.getUnloadCityName();
+            String loadDetailAddress = Objects.isNull(e.getLoadDetailAddress()) ? "" : e.getLoadDetailAddress();
+            String unloadDetailAddress = Objects.isNull(e.getUnloadDetailAddress()) ? "" : e.getUnloadDetailAddress();
             order.setStatusLabel(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
                     .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
                     .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
                     .setPickupTypeLabel(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
-                    .setLoadDetailAddressInfo(e.getLoadCityName() + e.getUnloadDetailAddress())
-                    .setUnloadDetailAddressInfo(e.getUnloadCityName() + e.getUnloadDetailAddress())
+                    .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
+                    .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
                     .setConsignmentStatus(Objects.isNull(e.getEntrustAmount()) || e.getEntrustAmount().compareTo(e.getAmount()) < 0 ? "待托运" : "已托运")
                     .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()));
             result.add(order);