ソースを参照

托运付款。列表结算比例没有展示 SAS-1477

xucaiqin 2 年 前
コミット
07b2803e56

+ 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());
         }
     }