ソースを参照

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

anderx 3 年 前
コミット
7d5aee297b
共有2 個のファイルを変更した23 個の追加20 個の削除を含む
  1. 14 14
      src/main/java/com/goafanti/common/mapper/UserMidMapper.xml
  2. 9 6
      src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

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

@@ -566,20 +566,6 @@
     sum(if(a.sales_type=3,1,0 ))channelSignNumber,sum(if(a.sales_type > 5,1,0 ))repeatSignNumber
     from t_order_new a left join user b on b.id=a.buyer_id
     where a.process_status >4 and b.share_type =2 and a.delete_sign in(0,2)
-    <if test="amountType != null">
-      <if test="amountType == 1">
-        and  a.total_amount &lt; 10
-      </if>
-      <if test="amountType == 2">
-        and  a.total_amount BETWEEN 10 and 20
-      </if>
-      <if test="amountType == 3">
-        and  a.total_amount BETWEEN 20 and 30
-      </if>
-      <if test="amountType == 4">
-        and  a.total_amount &gt; 30
-      </if>
-    </if>
     <if test="signTimeStart != null and signTimeEnd!=null">
       and a.sign_time BETWEEN #{signTimeStart} and #{signTimeEnd}
     </if>
@@ -591,6 +577,20 @@
     <if test="depId != null">
       and a.department_id = #{depId}
     </if>
+    <if test="amountType != null">
+      <if test="amountType == 1">
+        and  totalAmount &lt; 10
+      </if>
+      <if test="amountType == 2">
+        and  totalAmount BETWEEN 10 and 20
+      </if>
+      <if test="amountType == 3">
+        and  totalAmount BETWEEN 20 and 30
+      </if>
+      <if test="amountType == 4">
+        and  totalAmount &gt; 30
+      </if>
+    </if>
     <if test="page_sql!=null">
       ${page_sql}
     </if>

+ 9 - 6
src/main/java/com/goafanti/order/service/impl/OrderNewServiceImpl.java

@@ -421,10 +421,12 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 		//判断订单是否为会员订单
 		int i =tOrderMidMapper.judgeProjectType(t.getOrderNo());
 		UserMid um=new UserMid();
+		boolean flag=false;
 		um.setUid(t.getBuyerId());
 		if (i>0){
 			tm.setProjectType(1);
 			um.setMember(1);
+			flag=true;
 		}else{
 			tm.setProjectType(0);
 		}
@@ -433,14 +435,15 @@ public class OrderNewServiceImpl extends BaseMybatisDao<TOrderNewMapper> impleme
 			um.setUid(t.getBuyerId());
 			um.setAid(t.getSalesmanId());
 			um.setBigCustomer(1);
-
+			flag=true;
 		}
-		int x=userMidMapper.updateByUid(um);
-		if (x==0) {
-			um.setAid(t.getSalesmanId());
-			userMidMapper.insertSelective(um);
+		if (flag){
+			int x=userMidMapper.updateByUid(um);
+			if (x==0) {
+				um.setAid(t.getSalesmanId());
+				userMidMapper.insertSelective(um);
+			}
 		}
-		userMidMapper.updateByUid(um);
 		tm.setDepName(tOrderMidMapper.selectDepNameByDepid(t.getOrderDep()));
 		if (tm.getId()!=null) {
 			tOrderMidMapper.updateByPrimaryKeySelective(tm);