cc 4 months ago
parent
commit
5b08172e29

+ 6 - 0
src/main/java/com/qingjian/common/model/trans/query/TransContinuousQuery.java

@@ -37,4 +37,10 @@ public class TransContinuousQuery extends Query {
      * 用于筛选特定交易的交易对方
      */
     private String otherName;
+    /**
+     * 交易对方电话
+     * 用于筛选特定交易的交易对方
+     */
+    private String otherPhone;
+
 }

+ 9 - 2
src/main/resources/mappers/call/CallContinuousMapper.xml

@@ -20,7 +20,7 @@
         personName,
         personPhone,
         COALESCE(otherName, '未知对手') AS otherName,
-        otherPhone,
+        COALESCE(otherPhone, '未知对手号码') AS otherPhone,
         DATE_TRUNC('month', callDate) AS call_month
         FROM ${query.tableName}
         <where>
@@ -41,7 +41,14 @@
                 </choose>
             </if>
             <if test="query.otherPhone != null and query.otherPhone != ''">
-                AND otherPhone = #{query.otherPhone}
+                <choose>
+                    <when test="query.otherPhone == '未知对手号码'">
+                        AND otherPhone IS NULL
+                    </when>
+                    <otherwise>
+                        AND otherPhone = #{query.otherPhone}
+                    </otherwise>
+                </choose>
             </if>
             <if test="query.startDate != null">
                 AND callDate >= #{query.startDate}

+ 30 - 3
src/main/resources/mappers/call/CallNightMapper.xml

@@ -7,7 +7,7 @@
         SELECT
         personName,
         COALESCE(otherName, '未知对手') AS otherName,
-        otherPhone,
+        COALESCE(otherPhone, '未知对手号码') AS otherPhone,
         DATE_TRUNC('month', callDate) AS call_month
         FROM ${query.tableName}
         <where>
@@ -22,6 +22,26 @@
                     #{name}
                 </foreach>
             </if>
+            <if test="query.otherName != null and query.otherName != ''">
+                <choose>
+                    <when test="query.otherName == '未知对手'">
+                        AND otherName IS NULL
+                    </when>
+                    <otherwise>
+                        AND otherName = #{query.otherName}
+                    </otherwise>
+                </choose>
+            </if>
+            <if test="query.otherPhone != null and query.otherPhone != ''">
+                <choose>
+                    <when test="query.otherPhone == '未知对手号码'">
+                        AND otherPhone IS NULL
+                    </when>
+                    <otherwise>
+                        AND otherPhone = #{query.otherPhone}
+                    </otherwise>
+                </choose>
+            </if>
             <if test="query.startDate != null">
                 AND callDate >= #{query.startDate}
             </if>
@@ -70,8 +90,15 @@
                     </otherwise>
                 </choose>
             </if>
-            <if test="query.otherPhone != null">
-                and otherPhone = #{query.otherPhone}
+            <if test="query.otherPhone != null and query.otherPhone != ''">
+                <choose>
+                    <when test="query.otherPhone == '未知对手号码'">
+                        AND otherPhone IS NULL
+                    </when>
+                    <otherwise>
+                        AND otherPhone = #{query.otherPhone}
+                    </otherwise>
+                </choose>
             </if>
             <if test="query.startDate != null">
                 AND callDate >= #{query.startDate}

+ 11 - 1
src/main/resources/mappers/trans/TransBigMapper.xml

@@ -12,7 +12,7 @@
 
         SELECT
         personName,
-        COALESCE(otherName, '未知对手') as otherName,
+        COALESCE(otherName,otherCardNo, '未知对手') as otherName,
         COUNT(*) AS transCount ,
         SUM(transAmount) AS totalTransAmount
         FROM ${query.tableName}
@@ -23,6 +23,16 @@
                     #{name}
                 </foreach>
             </if>
+            <if test="query.otherName != null and query.otherName != ''">
+                <choose>
+                    <when test="query.otherName == '未知对手'">
+                        AND otherName IS NULL
+                    </when>
+                    <otherwise>
+                        AND otherName = #{query.otherName}
+                    </otherwise>
+                </choose>
+            </if>
             <if test="query.startDate != null">
                 AND transDate >= #{query.startDate}
             </if>

+ 13 - 2
src/main/resources/mappers/trans/TransContinuousMapper.xml

@@ -21,7 +21,8 @@
         personName,
         personCardNo,
         COALESCE(otherName, '未知对手') AS otherName,
-        otherCardNo,
+        COALESCE(otherCardNo, '未知对手卡号') AS otherName,
+        ,
         DATE_TRUNC('month', transDate) AS trans_month,
         transAmount
         FROM ${query.tableName}
@@ -42,6 +43,16 @@
                     </otherwise>
                 </choose>
             </if>
+            <if test="query.otherCardNo != null and query.otherCardNo != ''">
+                <choose>
+                    <when test="query.otherCardNo == '未知对手卡号'">
+                        AND otherCardNo IS NULL
+                    </when>
+                    <otherwise>
+                        AND otherCardNo = #{query.otherCardNo}
+                    </otherwise>
+                </choose>
+            </if>
             <if test="query.minTransMoney != null">
                 AND transAmount >= #{query.minTransMoney}
             </if>
@@ -152,7 +163,7 @@
         SELECT
         personName,
         otherName,
-        STRING_AGG(DISTINCT otherCardNo, ',') AS otherCardNos,
+        otherCardNo,
         SUM(pair_total_trans) AS pairTotalTrans,
         SUM(pair_total_amount) AS pairTotalAmount,
         SUM(pair_cont_month_count) AS pairContMonthCount