Browse Source

各接口操作数据同步到客户统计表

anderx 3 years ago
parent
commit
d4a3307804

+ 8 - 6
src/main/java/com/goafanti/common/mapper/UserMidMapper.xml

@@ -540,7 +540,9 @@
   </select>
 
   <select id="selectsignStatisticsList" resultType="com.goafanti.order.bo.OutSignStatistics">
-    select a.id,a.name ,sum(x.counts)counts ,sum(x.totalAmount)totalAmount,sum(x.newSignNumber)newSignNumber,
+    select x.id, name, counts, totalAmount, newSignNumber, repeatSignNumber, channelSignNumber,
+    (newSignNumber/counts)newRatio,(repeatSignNumber/counts)repeatRatio,(newSignNumber/counts)channelRatio
+    from( select a.id,a.name ,sum(x.counts)counts ,sum(x.totalAmount)totalAmount,sum(x.newSignNumber)newSignNumber,
     sum(x.repeatSignNumber)repeatSignNumber,sum(x.channelSignNumber)channelSignNumber
     from  admin a
     left join user_role ur on ur.uid =a.id left join `role` r on r.id=ur.rid
@@ -550,16 +552,16 @@
     from t_order_new a left join user b on b.id=a.buyer_id
     where a.process_status &lt;4 and b.share_type =2
   <if test="amountType != null">
-    <if test="amountType = 1">
+    <if test="amountType == 1">
       and  a.total_amount &lt; 10
     </if>
-    <if test="amountType = 2">
+    <if test="amountType == 2">
       and  a.total_amount BETWEEN 10 and 20
     </if>
-    <if test="amountType = 3">
+    <if test="amountType == 3">
       and  a.total_amount BETWEEN 20 and 30
     </if>
-    <if test="amountType = 4">
+    <if test="amountType == 4">
       and  a.total_amount &gt; 30
     </if>
   </if>
@@ -574,7 +576,7 @@
     <if test="depId != null">
     and a.department_id = #{depId}
     </if>
-    group by a.id,a.name
+    group by a.id,a.name)x
     <if test="page_sql!=null">
       ${page_sql}
     </if>

+ 27 - 0
src/main/java/com/goafanti/order/bo/OutSignStatistics.java

@@ -11,6 +11,33 @@ public class OutSignStatistics {
     private Integer newSignNumber;
     private Integer repeatSignNumber;
     private Integer channelSignNumber;
+    private BigDecimal newRatio;
+    private BigDecimal repeatRatio;
+    private BigDecimal channelRatio;
+
+    public BigDecimal getNewRatio() {
+        return newRatio;
+    }
+
+    public void setNewRatio(BigDecimal newRatio) {
+        this.newRatio = newRatio;
+    }
+
+    public BigDecimal getRepeatRatio() {
+        return repeatRatio;
+    }
+
+    public void setRepeatRatio(BigDecimal repeatRatio) {
+        this.repeatRatio = repeatRatio;
+    }
+
+    public BigDecimal getChannelRatio() {
+        return channelRatio;
+    }
+
+    public void setChannelRatio(BigDecimal channelRatio) {
+        this.channelRatio = channelRatio;
+    }
 
     public String getId() {
         return id;