Przeglądaj źródła

统计接口返回值

xucaiqin 2 lat temu
rodzic
commit
28169099c7

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

@@ -8,10 +8,11 @@ import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * @author xucaiqin
- * @date 2023-07-14 09:08:11
+ * @date 2023-07-17 15:34:39
  */
 
 @Mapper
@@ -22,4 +23,7 @@ public interface KwpLedgerLogisticsMapper extends BaseMapper<KwpLedgerLogistics>
      * @return
      */
     List<LedgerLogisticsDto> pageSelect(@Param("logisticsReq") LogisticsReq logisticsReq, @Param("ids") List<Long> ids);
+
+    Map<String, Long> countOrder();
+
 }

+ 21 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerCountDto.java

@@ -0,0 +1,21 @@
+package com.sckw.payment.model.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 物流/贸易对账单统计
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 18:11:24
+ */
+@Getter
+@Setter
+public class LedgerCountDto {
+    private Long saveCount;
+    private Long toLedgerCount;
+    private Long ledgeredCount;
+    private Long successCount;
+    private Long backCount;
+
+}

+ 28 - 0
sckw-modules/sckw-payment/src/main/java/com/sckw/payment/model/dto/LedgerCountVo.java

@@ -0,0 +1,28 @@
+package com.sckw.payment.model.dto;
+
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 物流/贸易对账单统计
+ *
+ * @author xucaiqin
+ * @date 2023-07-10 18:11:24
+ */
+@Getter
+@Setter
+public class LedgerCountVo {
+    /**
+     * 主键
+     */
+    private Long count;
+    /**
+     * 对账单状态
+     */
+    private Integer status;
+    /**
+     * 对账单状态文本
+     */
+    private String label;
+
+}

+ 102 - 96
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerLogisticsMapper.xml

@@ -1,113 +1,119 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.payment.dao.KwpLedgerLogisticsMapper">
-  <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpLedgerLogistics">
-    <!--@mbg.generated-->
-    <!--@Table kwp_ledger_logistics-->
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="ent_id" jdbcType="BIGINT" property="entId" />
-    <result column="l_ledger_no" jdbcType="VARCHAR" property="lLedgerNo" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
-    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
-    <result column="tax_rate" jdbcType="INTEGER" property="taxRate" />
-    <result column="trading" jdbcType="INTEGER" property="trading" />
-    <result column="unload_amount" jdbcType="DECIMAL" property="unloadAmount" />
-    <result column="load_amount" jdbcType="DECIMAL" property="loadAmount" />
-    <result column="deficit_amount" jdbcType="DECIMAL" property="deficitAmount" />
-    <result column="lose_amount" jdbcType="DECIMAL" property="loseAmount" />
-    <result column="total_price" jdbcType="DECIMAL" property="totalPrice" />
-    <result column="settle_price" jdbcType="DECIMAL" property="settlePrice" />
-    <result column="actual_price" jdbcType="DECIMAL" property="actualPrice" />
-    <result column="audit_user" jdbcType="VARCHAR" property="auditUser" />
-    <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone" />
-    <result column="url" jdbcType="VARCHAR" property="url" />
-    <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime" />
-    <result column="remark" jdbcType="VARCHAR" property="remark" />
-    <result column="status" jdbcType="INTEGER" property="status" />
-    <result column="create_by" jdbcType="BIGINT" property="createBy" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    <!--@mbg.generated-->
-    id, ent_id, l_ledger_no, `name`, start_time, end_time, tax_rate, trading, unload_amount, 
-    load_amount, deficit_amount, lose_amount, total_price, settle_price, actual_price, 
-    audit_user, audit_phone, url, generate_time, remark, `status`, create_by, create_time, 
-    update_by, update_time, del_flag
-  </sql>
+    <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpLedgerLogistics">
+        <!--@mbg.generated-->
+        <!--@Table kwp_ledger_logistics-->
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="ent_id" jdbcType="BIGINT" property="entId"/>
+        <result column="l_ledger_no" jdbcType="VARCHAR" property="lLedgerNo"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
+        <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
+        <result column="tax_rate" jdbcType="INTEGER" property="taxRate"/>
+        <result column="trading" jdbcType="INTEGER" property="trading"/>
+        <result column="total_price" jdbcType="DECIMAL" property="totalPrice"/>
+        <result column="ex_tax_price" jdbcType="DECIMAL" property="exTaxPrice"/>
+        <result column="settle_price" jdbcType="DECIMAL" property="settlePrice"/>
+        <result column="actual_price" jdbcType="DECIMAL" property="actualPrice"/>
+        <result column="audit_user" jdbcType="VARCHAR" property="auditUser"/>
+        <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone"/>
+        <result column="url" jdbcType="VARCHAR" property="url"/>
+        <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime"/>
+        <result column="receipt_time" jdbcType="TIMESTAMP" property="receiptTime"/>
+        <result column="order_count" jdbcType="INTEGER" property="orderCount"/>
+        <result column="remark" jdbcType="VARCHAR" property="remark"/>
+        <result column="status" jdbcType="INTEGER" property="status"/>
+        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <!--@mbg.generated-->
+        id,
+        ent_id,
+        l_ledger_no,
+        `name`,
+        start_time,
+        end_time,
+        tax_rate,
+        trading,
+        total_price,
+        ex_tax_price,
+        settle_price,
+        actual_price,
+        audit_user,
+        audit_phone,
+        url,
+        generate_time,
+        receipt_time,
+        order_count,
+        remark,
+        `status`,
+        create_by,
+        create_time,
+        update_by,
+        update_time,
+        del_flag
+    </sql>
 
     <select id="pageSelect" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
         select kll.id,
-               kll.l_ledger_no    lLedgerNo,
+               kll.l_ledger_no   lLedgerNo,
                kll.name,
-               kll.start_time     startTime,
-               kll.end_time       endTime,
-               kll.tax_rate       taxRate,
+               kll.start_time    startTime,
+               kll.end_time      endTime,
+               kll.tax_rate      taxRate,
                kll.trading,
-               kll.unload_amount  unloadAmount,
-               kll.load_amount    loadAmount,
-               kll.deficit_amount deficitAmount,
-               kll.lose_amount    loseAmount,
-               kll.total_price    totalPrice,
-               kll.settle_price   settlePrice,
-               kll.actual_price   actualPrice,
+               kll.total_price   totalPrice,
+               kll.ex_tax_price  exTaxPrice,
+               kll.settle_price  settlePrice,
+               kll.actual_price  actualPrice,
                kll.url,
-               kll.generate_time  generateTime,
+               kll.generate_time generateTime,
+               kll.receipt_time  receiptTime,
                kll.remark,
                kll.status,
-               count(kllo.id)     orderCount
+               kllu.contacts,
+               kllu.phone,
+               kllu.firm_name    firmName,
+               kll.order_count   orderCount
         from kwp_ledger_logistics kll
-                 inner join kwp_ledger_logistics_order kllo on kll.id = kllo.l_ledger_id
+                 inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
         <where>
-            <choose>
-                <when test="ids != null and ids.size() != 0">
-                    kll.id in
-                    <foreach close=")" collection="ids" item="id" open="" separator=",">
-                        #{id,jdbcType=BIGINT}
-                    </foreach>
-                </when>
-                <otherwise>
-
-                    kll.del_flag = 0
-                      and kllo.del_flag = 0
-
-                    <if test="logisticsReq.status != null">
-
-                        and kll.status = #{logisticsReq.status}
-                    </if>
-                    <if test="logisticsReq.trading != null">
-                        and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
-                    </if>
-                    <if test="logisticsReq.startCreateTime != null and logisticsReq.endCreateTime != null">
-                        and kll.generate_time between #{logisticsReq.startCreateTime,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}
-                          , '%')
-                         or kll.check_user like concat('%'
-                          , #{logisticsReq.keywords}
-                          , '%')
-                        <if test="ids != null and ids.size() != 0">
-                            or kll.check_ent_id in
-                            <foreach close=")" collection="ids" item="item" open="(" separator=",">
-                                #{item,jdbcType=BIGINT}
-                            </foreach>
-                        </if>
-                        )
-                    </if>
-                </otherwise>
-            </choose>
+            kll.del_flag = 0
+              and kllu.unit_type = 1
+            <if test="logisticsReq.status != null">
+                and kll.status = #{logisticsReq.status}
+            </if>
+            <if test="logisticsReq.trading != null">
+                and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
+            </if>
+            <if test="logisticsReq.startCreateTime != null and logisticsReq.endCreateTime != null">
+                and kll.generate_time between #{logisticsReq.startCreateTime,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}, '%')
+                    )
+            </if>
         </where>
-        group by kll.id, kll.check_ent_id, kll.carrier_ent_id, kll.l_ledger_no, kll.name, kll.start_time, kll.end_time,
-            kll.tax_rate, kll.trading, kll.unload_amount, kll.load_amount, kll.deficit_amount, kll.lose_amount,
-            kll.total_price, kll.settle_price, kll.actual_price, kll.check_phone, kll.check_user,
-            kll.carrier_phone, kll.carrier_user, kll.url, kll.generate_time, kll.remark, kll.status
         order by kll.generate_time desc
     </select>
+
+    <select id="countOrder" resultType="java.util.Map">
+        SELECT count(1)                         "0",
+               count(IF(`status` = 1, 1, NULL)) "1",
+               count(IF(`status` = 2, 1, NULL)) "2",
+               count(IF(`status` = 3, 1, NULL)) "3",
+               count(IF(`status` = 4, 1, NULL)) "4",
+               count(IF(`status` = 5, 1, NULL)) "5"
+        FROM `kwp_ledger_logistics`
+        WHERE del_flag = 0;
+    </select>
 </mapper>

+ 116 - 78
sckw-modules/sckw-payment/src/main/resources/mapper/KwpLedgerTradeMapper.xml

@@ -1,83 +1,121 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.sckw.payment.dao.KwpLedgerTradeMapper">
-  <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpLedgerTrade">
-    <!--@mbg.generated-->
-    <!--@Table kwp_ledger_trade-->
-    <id column="id" jdbcType="BIGINT" property="id" />
-    <result column="ent_id" jdbcType="BIGINT" property="entId" />
-    <result column="t_ledger_no" jdbcType="VARCHAR" property="tLedgerNo" />
-    <result column="name" jdbcType="VARCHAR" property="name" />
-    <result column="start_time" jdbcType="TIMESTAMP" property="startTime" />
-    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
-    <result column="tax_rate" jdbcType="INTEGER" property="taxRate" />
-    <result column="trading" jdbcType="BIGINT" property="trading" />
-    <result column="total_price" jdbcType="DECIMAL" property="totalPrice" />
-    <result column="settle_price" jdbcType="DECIMAL" property="settlePrice" />
-    <result column="actual_price" jdbcType="DECIMAL" property="actualPrice" />
-    <result column="audit_user" jdbcType="VARCHAR" property="auditUser" />
-    <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone" />
-    <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime" />
-    <result column="url" jdbcType="VARCHAR" property="url" />
-    <result column="remark" jdbcType="VARCHAR" property="remark" />
-    <result column="status" jdbcType="INTEGER" property="status" />
-    <result column="create_by" jdbcType="BIGINT" property="createBy" />
-    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
-    <result column="update_by" jdbcType="BIGINT" property="updateBy" />
-    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
-    <result column="del_flag" jdbcType="INTEGER" property="delFlag" />
-  </resultMap>
-  <sql id="Base_Column_List">
-    <!--@mbg.generated-->
-    id, ent_id, t_ledger_no, `name`, start_time, end_time, tax_rate, trading, total_price, 
-    settle_price, actual_price, audit_user, audit_phone, generate_time, url, remark, 
-    `status`, create_by, create_time, update_by, update_time, del_flag
-  </sql>
+    <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpLedgerTrade">
+        <!--@mbg.generated-->
+        <!--@Table kwp_ledger_trade-->
+        <id column="id" jdbcType="BIGINT" property="id"/>
+        <result column="ent_id" jdbcType="BIGINT" property="entId"/>
+        <result column="t_ledger_no" jdbcType="VARCHAR" property="tLedgerNo"/>
+        <result column="name" jdbcType="VARCHAR" property="name"/>
+        <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
+        <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
+        <result column="tax_rate" jdbcType="INTEGER" property="taxRate"/>
+        <result column="trading" jdbcType="INTEGER" property="trading"/>
+        <result column="total_price" jdbcType="DECIMAL" property="totalPrice"/>
+        <result column="ex_tax_price" jdbcType="DECIMAL" property="exTaxPrice"/>
+        <result column="settle_price" jdbcType="DECIMAL" property="settlePrice"/>
+        <result column="actual_price" jdbcType="DECIMAL" property="actualPrice"/>
+        <result column="audit_user" jdbcType="VARCHAR" property="auditUser"/>
+        <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone"/>
+        <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime"/>
+        <result column="receipt_time" jdbcType="TIMESTAMP" property="receiptTime"/>
+        <result column="url" jdbcType="VARCHAR" property="url"/>
+        <result column="order_count" jdbcType="INTEGER" property="orderCount"/>
+        <result column="remark" jdbcType="VARCHAR" property="remark"/>
+        <result column="status" jdbcType="INTEGER" property="status"/>
+        <result column="create_by" jdbcType="BIGINT" property="createBy"/>
+        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
+        <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
+        <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
+        <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
+    </resultMap>
+    <sql id="Base_Column_List">
+        <!--@mbg.generated-->
+        id,
+        ent_id,
+        t_ledger_no,
+        `name`,
+        start_time,
+        end_time,
+        tax_rate,
+        trading,
+        total_price,
+        ex_tax_price,
+        settle_price,
+        actual_price,
+        audit_user,
+        audit_phone,
+        generate_time,
+        receipt_time,
+        url,
+        order_count,
+        remark,
+        `status`,
+        create_by,
+        create_time,
+        update_by,
+        update_time,
+        del_flag
+    </sql>
 
-  <select id="pageSelect" resultType="com.sckw.payment.model.dto.LedgerTradeDto">
-      select klt.id,
-             klt.t_ledger_no   tLedgerNo,
-             klt.name,
-             klt.start_time    startTime,
-             klt.end_time      endTime,
-             klt.tax_rate      taxRate,
-             klt.trading,
-             klt.total_price   totalPrice,
-             klt.settle_price  settlePrice,
-             klt.actual_price  actualPrice,
-             klt.url,
-             klt.generate_time generateTime,
-             klt.remark,
-             klt.status,
-             kltu.contacts,
-             kltu.phone,
-             kltu.firm_name    firmName,
-             count(klto.id)    orderCount
-      from kwp_ledger_trade klt
-               inner join kwp_ledger_trade_order klto on klt.id = klto.t_ledger_id and klto.del_flag = 0
-               inner join kwp_ledger_trade_unit kltu on klt.id = kltu.t_ledger_id and kltu.del_flag = 0
-      <where>
-          klt.del_flag = 0
-          <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.startCreateTime != null and tradeReq.endCreateTime != null">
-              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>
-      group by klt.id, klt.t_ledger_no, klt.name, klt.start_time, klt.end_time, klt.tax_rate, klt.trading,
-               klt.total_price, klt.settle_price, klt.actual_price, klt.url, klt.generate_time, klt.remark, klt.status,
-               kltu.contacts, kltu.phone, kltu.firm_name
-      order by klt.generate_time desc
-  </select>
+    <select id="pageSelect" resultType="com.sckw.payment.model.dto.LedgerTradeDto">
+        select klt.id,
+               klt.t_ledger_no   tLedgerNo,
+               klt.name,
+               klt.start_time    startTime,
+               klt.end_time      endTime,
+               klt.tax_rate      taxRate,
+               klt.trading,
+               klt.total_price   totalPrice,
+               klt.ex_tax_price  exTaxPrice,
+               klt.settle_price  settlePrice,
+               klt.actual_price  actualPrice,
+               klt.audit_phone   auditPhone,
+               klt.audit_user    auditUser,
+               klt.url,
+               klt.generate_time generateTime,
+               klt.receipt_time  receiptTime,
+               klt.remark,
+               klt.status,
+               kltu.contacts,
+               kltu.phone,
+               kltu.firm_name    firmName,
+               klt.order_count   orderCount
+        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 = 1
+            <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.startCreateTime != null and tradeReq.endCreateTime != null">
+                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>
+        order by klt.generate_time desc
+    </select>
+
+    <select id="countOrder" resultType="java.util.Map">
+        SELECT count(1)                         "0",
+               count(IF(`status` = 1, 1, NULL)) "1",
+               count(IF(`status` = 2, 1, NULL)) "2",
+               count(IF(`status` = 3, 1, NULL)) "3",
+               count(IF(`status` = 4, 1, NULL)) "4",
+               count(IF(`status` = 5, 1, NULL)) "5"
+        FROM `kwp_ledger_trade`
+        WHERE del_flag = 0;
+    </select>
 </mapper>