Przeglądaj źródła

fix:对账单统计接口,增加参数

xucaiqin 2 lat temu
rodzic
commit
06c4eee5ef

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

@@ -111,8 +111,8 @@ public class KwpLedgerLogisticsController {
      *
      * @return
      */
-    @GetMapping("shipperCount")
-    public HttpResult shipperCount(@Valid LogisticsReq logisticsReq) {
+    @PostMapping("shipperCount")
+    public HttpResult shipperCount(@RequestBody @Valid LogisticsReq logisticsReq) {
         return HttpResult.ok(kwpLedgerLogisticsService.orderCount(logisticsReq, 1));
     }
 
@@ -121,8 +121,8 @@ public class KwpLedgerLogisticsController {
      *
      * @return
      */
-    @GetMapping("carrierCount")
-    public HttpResult carrierCount(@Valid LogisticsReq logisticsReq) {
+    @PostMapping("carrierCount")
+    public HttpResult carrierCount(@RequestBody @Valid LogisticsReq logisticsReq) {
         return HttpResult.ok(kwpLedgerLogisticsService.orderCount(logisticsReq, 2));
     }
 

+ 11 - 7
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/controller/KwpLedgerTradeController.java

@@ -87,6 +87,7 @@ public class KwpLedgerTradeController {
     public HttpResult querySellDetail(@RequestParam("id") String id) {
         return HttpResult.ok(kwpLedgerTradeService.queryDetail(Long.valueOf(id), TradeUnitType.PURCHASE));
     }
+
     /**
      * 采购-查询贸易对账单详情
      *
@@ -95,8 +96,9 @@ public class KwpLedgerTradeController {
      */
     @GetMapping("queryPurchaseDetail")
     public HttpResult queryPurchaseDetail(@RequestParam("id") String id) {
-        return HttpResult.ok(kwpLedgerTradeService.queryDetail(Long.valueOf(id),TradeUnitType.SELL));
+        return HttpResult.ok(kwpLedgerTradeService.queryDetail(Long.valueOf(id), TradeUnitType.SELL));
     }
+
     /**
      * 修改贸易对账单详情(修改物流对账单接口使用)
      *
@@ -113,9 +115,10 @@ public class KwpLedgerTradeController {
      *
      * @return
      */
-    @GetMapping("sellCount")
-    public HttpResult sellCount() {
-        return HttpResult.ok(kwpLedgerTradeService.orderCount(1));
+    @PostMapping("sellCount")
+    public HttpResult sellCount(@RequestBody @Valid TradeReq tradeReq) {
+        tradeReq.setUnitType(TradeUnitType.PURCHASE);
+        return HttpResult.ok(kwpLedgerTradeService.orderCount(tradeReq));
     }
 
     /**
@@ -123,9 +126,10 @@ public class KwpLedgerTradeController {
      *
      * @return
      */
-    @GetMapping("purchaseCount")
-    public HttpResult purchaseCount() {
-        return HttpResult.ok(kwpLedgerTradeService.orderCount(2));
+    @PostMapping("purchaseCount")
+    public HttpResult purchaseCount(@RequestBody @Valid TradeReq tradeReq) {
+        tradeReq.setUnitType(TradeUnitType.SELL);
+        return HttpResult.ok(kwpLedgerTradeService.orderCount(tradeReq));
     }
 
     /**

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

@@ -24,7 +24,7 @@ public interface KwpLedgerTradeMapper extends BaseMapper<KwpLedgerTrade> {
 
     List<LedgerPurchaseDto> purchaseList(@Param("tradeReq") TradeReq tradeReq);
 
-    Map<String, Long> countOrder(@Param("entId") Long entId, @Param("unitType") Integer unitType);
+    Map<String, Long> countOrder(@Param("tradeReq") TradeReq tradeReq);
 
     LedgerTradeDto selectId(@Param("id") Long id, @Param("unitType") Integer unitType);
 

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

@@ -444,8 +444,9 @@ public class KwpLedgerTradeService extends AbsLedger {
         return "对账完成";
     }
 
-    public List<LedgerCountVo> orderCount(Integer unitType) {
-        Map<String, Long> map = tradeMapper.countOrder(LoginUserHolder.getEntId(), unitType);
+    public List<LedgerCountVo> orderCount(TradeReq tradeReq) {
+        tradeReq.setEntId(LoginUserHolder.getEntId());
+        Map<String, Long> map = tradeMapper.countOrder(tradeReq);
         LedgerCountVo ledgerCountVo;
         List<LedgerCountVo> res = new ArrayList<>();
         for (LedgerEnum value : LedgerEnum.values()) {

+ 28 - 3
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml

@@ -188,9 +188,34 @@
                count(IF(klt.status = 6, 1, NULL)) "6"
         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 kltu.unit_type = #{unitType,jdbcType=INTEGER}
-          and kltu.ent_id = #{entId,jdbcType=BIGINT}
+        <where>
+            klt.del_flag = 0
+              and kltu.unit_type = #{tradeReq.unitType,jdbcType=INTEGER}
+              and kltu.top_ent_id = #{tradeReq.entId,jdbcType=BIGINT}
+            <if test="tradeReq.status != null">
+                and klt.status = #{tradeReq.status}
+            </if>
+            <if test="tradeReq.trading != null">
+                and klt.trading = #{tradeReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="tradeReq.endCreateTime != null and tradeReq.endCreateTime != '' and tradeReq.startCreateTime != null and tradeReq.startCreateTime != ''">
+                and klt.generate_time between #{tradeReq.startCreateTime,jdbcType=TIMESTAMP}
+                    and #{tradeReq.endCreateTime,jdbcType=TIMESTAMP}
+            </if>
+            <if test="tradeReq.keywords != null and tradeReq.keywords != ''">
+                and (
+                            klt.t_ledger_no like concat('%'
+                            , #{tradeReq.keywords,jdbcType=VARCHAR}
+                            , '%')
+                        or kltu.firm_name like concat('%'
+                        , #{tradeReq.keywords,jdbcType=VARCHAR}
+                        , '%')
+                        or kltu.contacts like concat('%'
+                        , #{tradeReq.keywords,jdbcType=VARCHAR}
+                        , '%')
+                    )
+            </if>
+        </where>
     </select>
 
     <select id="selectSellIds" resultType="com.sckw.payment.model.dto.LedgerSellDto">