Explorar el Código

统一表头统计字段参数

xucaiqin hace 2 años
padre
commit
367fab9be2

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

@@ -5,12 +5,12 @@ import com.sckw.payment.model.KwpSettlementTrade;
 import com.sckw.payment.model.dto.LedgerUnitDto;
 import com.sckw.payment.model.dto.SettlementTradeDto;
 import com.sckw.payment.model.vo.req.SettlementTradeReq;
-import com.sckw.payment.model.vo.res.SettlementLogisticsStatusCountVo;
 import com.sckw.payment.model.vo.res.SettlementSumVo;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author xucaiqin
@@ -23,7 +23,7 @@ public interface KwpSettlementTradeMapper extends BaseMapper<KwpSettlementTrade>
 
     SettlementSumVo sumMoney(@Param("settlementReq") SettlementTradeReq settlementReq);
 
-    SettlementLogisticsStatusCountVo countOrder(@Param("settlementReq") SettlementTradeReq settlementReq);
+    Map<String, Long> countOrder(@Param("settlementReq") SettlementTradeReq settlementReq);
 
     List<SettlementTradeDto> selectByIds(@Param("ids") List<Long> ids, @Param("unitType") Integer unitType);
 

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

@@ -10,19 +10,21 @@ import java.util.Objects;
  * @date 2023-07-11 12:00:52
  */
 public enum LedgerEnum {
-    ALL(0, "全部"),
-    SAVE(1, "已保存"),
-    TO_LEDGER(2, "待对账"),
-    LEDGERED(3, "已对账"),
-    SUCCESS(4, "已完成"),
-    BACK(5, "已退回"),
-    REVOCATION(6, "已撤回");
-
-    private int status;
-    private String desc;
-
-    LedgerEnum(int status, String desc) {
+    ALL(0, "全部", "0"),
+    SAVE(1, "已保存", "1"),
+    TO_LEDGER(2, "待对账", "2"),
+    LEDGERED(3, "已对账", "3"),
+    SUCCESS(4, "已完成", "4"),
+    BACK(5, "已退回", "5"),
+    REVOCATION(6, "已撤回", "6");
+
+    private final int status;
+    private final String desc;
+    private final String label;
+
+    LedgerEnum(int status, String desc, String label) {
         this.status = status;
+        this.label = label;
         this.desc = desc;
     }
 
@@ -38,19 +40,17 @@ public enum LedgerEnum {
         return "";
     }
 
+    public String getLabel() {
+        return label;
+    }
+
     public int getStatus() {
         return status;
     }
 
-    public void setStatus(int status) {
-        this.status = status;
-    }
 
     public String getDesc() {
         return desc;
     }
 
-    public void setDesc(String desc) {
-        this.desc = desc;
-    }
 }

+ 13 - 14
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/constant/SettlementEnum.java

@@ -8,35 +8,34 @@ package com.sckw.payment.model.constant;
  * @date 2023-07-11 12:00:52
  */
 public enum SettlementEnum {
-    ALL(0, "全部"),
-    WAITING_PAYMENT(1, "待结算"),
-    PARTIAL_PAYMENT(2, "部分结算"),
-    ALL_PAYMENT(3, "全部结算");
+    ALL(0, "全部", "0"),
+    WAITING_PAYMENT(1, "待结算", "1"),
+    PARTIAL_PAYMENT(2, "部分结算", "2"),
+    ALL_PAYMENT(3, "全部结算", "3");
 
-    private int status;
-    private String desc;
+    private final int status;
+    private final String desc;
+    private final String label;
 
-    SettlementEnum(int status, String desc) {
+    SettlementEnum(int status, String desc, String label) {
         this.status = status;
         this.desc = desc;
+        this.label = label;
+    }
+
+    public String getLabel() {
+        return label;
     }
 
     public int getStatus() {
         return status;
     }
 
-    public void setStatus(int status) {
-        this.status = status;
-    }
 
     public String getDesc() {
         return desc;
     }
 
-    public void setDesc(String desc) {
-        this.desc = desc;
-    }
-
     // 添加静态方法,根据 status 获取对应的 desc
     public static String getStatusDesc(int status) {
         for (SettlementEnum settlementEnum : values()) {

+ 9 - 12
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -5,16 +5,13 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.page.PageRes;
+import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.OrderGenerateUtils;
 import com.sckw.core.utils.StringTimeUtil;
-import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
-import com.sckw.payment.model.KwpLedgerLogistics;
-import com.sckw.payment.model.KwpLedgerLogisticsTrack;
-import com.sckw.payment.model.KwpLedgerLogisticsUnit;
-import com.sckw.payment.model.KwpSettlementLogistics;
 import com.sckw.core.web.context.LoginUserHolder;
+import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
 import com.sckw.payment.model.*;
 import com.sckw.payment.model.constant.LedgerEnum;
 import com.sckw.payment.model.constant.LedgerTrackEnum;
@@ -439,16 +436,16 @@ public class KwpLedgerLogisticsService extends AbsLedger {
      * @param unitType 1-托运方 2-承运方
      * @return
      */
-    public List<LedgerCountVo> orderCount(LogisticsReq logisticsReq, Integer unitType) {
+    public List<TableTop> orderCount(LogisticsReq logisticsReq, Integer unitType) {
         logisticsReq.setEntId(LoginUserHolder.getEntId());
         Map<String, Long> map = logisticsMapper.countOrder(logisticsReq, unitType);
-        LedgerCountVo ledgerCountVo;
-        List<LedgerCountVo> res = new ArrayList<>();
+        TableTop ledgerCountVo;
+        List<TableTop> res = new ArrayList<>();
         for (LedgerEnum value : LedgerEnum.values()) {
-            ledgerCountVo = new LedgerCountVo();
-            ledgerCountVo.setCount(map.get(String.valueOf(value.getStatus())));
-            ledgerCountVo.setLabel(value.getDesc());
-            ledgerCountVo.setStatus(value.getStatus());
+            ledgerCountVo = new TableTop();
+            ledgerCountVo.setTotal(Math.toIntExact(map.get(value.getLabel())));
+            ledgerCountVo.setName(value.getDesc());
+            ledgerCountVo.setValue(value.getStatus());
             res.add(ledgerCountVo);
         }
         return res;

+ 8 - 7
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java

@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.exception.BusinessException;
 import com.sckw.core.model.page.PageRes;
+import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.IdWorker;
 import com.sckw.core.utils.OrderGenerateUtils;
@@ -444,16 +445,16 @@ public class KwpLedgerTradeService extends AbsLedger {
         return "对账完成";
     }
 
-    public List<LedgerCountVo> orderCount(TradeReq tradeReq) {
+    public List<TableTop> orderCount(TradeReq tradeReq) {
         tradeReq.setEntId(LoginUserHolder.getEntId());
         Map<String, Long> map = tradeMapper.countOrder(tradeReq);
-        LedgerCountVo ledgerCountVo;
-        List<LedgerCountVo> res = new ArrayList<>();
+        TableTop ledgerCountVo;
+        List<TableTop> res = new ArrayList<>();
         for (LedgerEnum value : LedgerEnum.values()) {
-            ledgerCountVo = new LedgerCountVo();
-            ledgerCountVo.setCount(map.get(String.valueOf(value.getStatus())));
-            ledgerCountVo.setLabel(value.getDesc());
-            ledgerCountVo.setStatus(value.getStatus());
+            ledgerCountVo = new TableTop();
+            ledgerCountVo.setTotal(Math.toIntExact(map.get(String.valueOf(value.getLabel()))));
+            ledgerCountVo.setName(value.getDesc());
+            ledgerCountVo.setValue(value.getStatus());
             res.add(ledgerCountVo);
         }
         return res;

+ 16 - 5
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpSettlementTradeService.java

@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.page.PageRes;
+import com.sckw.core.model.vo.TableTop;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.web.context.LoginUserHolder;
@@ -38,9 +39,10 @@ public class KwpSettlementTradeService {
     @DubboReference(version = "2.0.0", group = "design", check = false)
     private RemoteSystemService remoteSystemService;
 
-    public SettlementTradeDto getById(Long id,Integer unitType) {
-        return settlementTradeMapper.getById(id,unitType);
+    public SettlementTradeDto getById(Long id, Integer unitType) {
+        return settlementTradeMapper.getById(id, unitType);
     }
+
     public List<LedgerUnitDto> getListById(Long id) {
         return settlementTradeMapper.getListById(id);
     }
@@ -98,8 +100,17 @@ public class KwpSettlementTradeService {
         return new PageRes<>(new PageInfo<>());
     }
 
-    public SettlementLogisticsStatusCountVo getCount(SettlementTradeReq settlementReq) {
-        return settlementTradeMapper.countOrder(settlementReq);
+    public List<TableTop> getCount(SettlementTradeReq settlementReq) {
+        Map<String, Long> stringIntegerMap = settlementTradeMapper.countOrder(settlementReq);
+        List<TableTop> res = new ArrayList<>(4);
+        for (SettlementEnum value : SettlementEnum.values()) {
+            TableTop tableTop = new TableTop();
+            tableTop.setName(value.getDesc());
+            tableTop.setValue(value.getStatus());
+            tableTop.setTotal(Math.toIntExact(stringIntegerMap.get(value.getLabel())));
+            res.add(tableTop);
+        }
+        return res;
     }
 
     /**
@@ -114,7 +125,7 @@ public class KwpSettlementTradeService {
 
 
     public List<ISettlement> selectList(List<Long> ids, int unitType) {
-        List<SettlementTradeDto> kwpSettlementTrades = settlementTradeMapper.selectByIds(ids,unitType);
+        List<SettlementTradeDto> kwpSettlementTrades = settlementTradeMapper.selectByIds(ids, unitType);
         if (!CollectionUtils.isEmpty(kwpSettlementTrades)) {
             //根据企业类型进行对应的数据
             if (unitType == TradeUnitType.PURCHASE) {

+ 5 - 5
sckw-modules/sckw-payment/src/main/resources/mapper/KwpSettlementTradeMapper.xml

@@ -101,11 +101,11 @@
                  inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
         <include refid="query"/>
     </select>
-    <select id="countOrder" resultType="com.sckw.payment.model.vo.res.SettlementLogisticsStatusCountVo">
-        select count(1)                           allCount,
-               count(if(kst.status = 3, 1, null)) allPaymentCount,
-               count(if(kst.status = 2, 1, null)) partialPaymentCount,
-               count(if(kst.status = 1, 1, null)) waitingPaymentCount
+    <select id="countOrder" resultType="java.util.Map">
+        select count(1)                           "0",
+               count(if(kst.status = 3, 1, null)) "3",
+               count(if(kst.status = 2, 1, null)) "2",
+               count(if(kst.status = 1, 1, null)) "1"
         from kwp_settlement_trade kst
                  inner join kwp_ledger_trade klt on kst.t_ledger_id = klt.id and klt.del_flag = 0
                  inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0