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

统计对账数量 工作台首页统计

xucaiqin 2 лет назад
Родитель
Сommit
dc200bdd20

+ 9 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerLogisticsMapper.java

@@ -5,6 +5,7 @@ import com.sckw.payment.model.KwpLedgerLogistics;
 import com.sckw.payment.model.dto.LedgerCarrierDto;
 import com.sckw.payment.model.dto.LedgerLogisticsDto;
 import com.sckw.payment.model.dto.LedgerShipperDto;
+import com.sckw.payment.model.dto.LedgerSize;
 import com.sckw.payment.model.vo.req.LogisticsReq;
 import com.sckw.payment.model.vo.res.LedgerCountSumVo;
 import org.apache.ibatis.annotations.Mapper;
@@ -74,4 +75,12 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @return
      */
     List<String> selectJoin(@Param("entId") Long entId, @Param("entTarget") Long entTarget);
+
+    /**
+     * 根据顶级企业id统计对账单数量,仅不包含已保存
+     *
+     * @param entId 顶级企业id
+     * @return
+     */
+    LedgerSize countSize(@Param("entId") Long entId);
 }

+ 3 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/dao/KwpLedgerTradeMapper.java

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.sckw.payment.model.KwpLedgerTrade;
 import com.sckw.payment.model.dto.LedgerPurchaseDto;
 import com.sckw.payment.model.dto.LedgerSellDto;
+import com.sckw.payment.model.dto.LedgerSize;
 import com.sckw.payment.model.dto.LedgerTradeDto;
 import com.sckw.payment.model.vo.req.TradeReq;
 import com.sckw.payment.model.vo.res.LedgerCountSumVo;
@@ -52,4 +53,6 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
      * @return
      */
     List<String> selectJoin(@Param("entId")Long entId, @Param("entTarget")Long entTarget);
+
+    LedgerSize countSize(@Param("entId")Long entId);
 }

+ 9 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerSize.java

@@ -0,0 +1,9 @@
+package com.sckw.payment.model.dto;
+
+
+/**
+ * @param send    对账发起方
+ * @param receive 对账接收方
+ */
+public record LedgerSize(Integer send, Integer receive) {
+}

+ 4 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerLogisticsService.java

@@ -787,4 +787,8 @@ public class KwpLedgerLogisticsService extends AbsLedger {
     public List<String> checkOrder(Long entId, Long entTarget) {
         return logisticsMapper.selectJoin(entId, entTarget);
     }
+
+    public LedgerSize count(Long entId) {
+        return logisticsMapper.countSize(entId);
+    }
 }

+ 4 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/KwpLedgerTradeService.java

@@ -880,4 +880,8 @@ public class KwpLedgerTradeService extends AbsLedger {
     public void updateActualPrice(Long id, BigDecimal totalPrice) {
         tradeMapper.updatePrice(id, totalPrice);
     }
+
+    public LedgerSize count(Long entId) {
+        return tradeMapper.countSize(entId);
+    }
 }

+ 4 - 2
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/service/dubbo/PaymentDubboServiceImpl.java

@@ -4,6 +4,7 @@ import com.sckw.core.exception.BusinessException;
 import com.sckw.payment.api.dubbo.PaymentDubboService;
 import com.sckw.payment.api.model.constant.OrderEnum;
 import com.sckw.payment.api.model.dto.LedgerCount;
+import com.sckw.payment.model.dto.LedgerSize;
 import com.sckw.payment.service.KwpLedgerLogisticsService;
 import com.sckw.payment.service.KwpLedgerTradeService;
 import com.sckw.payment.service.KwpSettlementLogisticsService;
@@ -60,8 +61,9 @@ public class PaymentDubboServiceImpl implements PaymentDubboService {
 
     @Override
     public LedgerCount countLedger(Long entId) {
-        //todo-xcq
-        return new LedgerCount(1, 1, 1, 1);
+        LedgerSize count = ledgerLogisticsService.count(entId);
+        LedgerSize ledgerSize = ledgerTradeService.count(entId);
+        return new LedgerCount(ledgerSize.send(), ledgerSize.receive(), count.send(), count.receive());
     }
 }
 

+ 19 - 7
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml

@@ -83,7 +83,7 @@
         kll.receipt_time  receiptTime,
         kll.remark,
         kll.status,
-        kll.create_by createBy,
+        kll.create_by     createBy,
         kllu.top_ent_id   checkEntId,
         kllu.contacts,
         kllu.phone,
@@ -234,7 +234,7 @@
                                kllu2.unit_type = #{logisticsReq.unitTypeTwo,jdbcType=INTEGER}
         <where>
             kll.del_flag = 0
-            and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
+              and kllu2.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
             <if test="logisticsReq.unitType != null and logisticsReq.unitType == 2">
                 and kll.status not in (1, 6)
             </if>
@@ -243,14 +243,14 @@
             </if>
             <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
                 and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
-                and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
+                    and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
             </if>
             <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
                 and (
-                kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
-                or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
-                or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
-                )
+                            kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                        or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
+                    )
             </if>
         </where>
     </select>
@@ -313,4 +313,16 @@
               and kllu2.top_ent_id = #{entTarget,jdbcType=BIGINT}
         </where>
     </select>
+
+    <select id="countSize" resultType="com.sckw.payment.model.dto.LedgerSize">
+        select count(distinct if(kllu.unit_type = 2, kll.id, null)) send,
+               count(distinct if(kllu.unit_type = 1, kll.id, null)) receive
+        from kwp_ledger_logistics kll
+                 inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
+        <where>
+            kll.del_flag = 0
+              and kll.status != 1
+              and kllu.top_ent_id = #{entId,jdbcType=BIGINT}
+        </where>
+    </select>
 </mapper>

+ 12 - 0
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml

@@ -403,4 +403,16 @@
               and kltu2.top_ent_id = #{entTarget,jdbcType=BIGINT}
         </where>
     </select>
+
+    <select id="countSize" resultType="com.sckw.payment.model.dto.LedgerSize">
+        select count(distinct if(kltu.unit_type = 2, klt.id, null)) send,
+               count(distinct if(kltu.unit_type = 1, klt.id, null)) receive
+        from kwp_ledger_trade klt
+                 inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
+        <where>
+            klt.del_flag = 0
+              and klt.status != 1
+              and kltu.top_ent_id = #{entId,jdbcType=BIGINT}
+        </where>
+    </select>
 </mapper>