Browse Source

派单逻辑调整

anderx 10 months ago
parent
commit
3a360c5e80

+ 19 - 1
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -169,7 +169,25 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		if (a==null||a.getId()==null) {
 			throw  new BusinessException(new Error("分配人员不存在!","分配人员不存在!"));
 		}
-		projectDistributionAsyncService.pushProjectDistribution(taskId, taskReceiverId, remarks, type, t, tn, date, a);
+		if (type ==0) {
+			addOrderLog(t.getOrderNo(), OrderLogProcess.XMZJPD.getCode(), remarks);
+			t.setManagerId(taskReceiverId);
+			t.setConsultantId(null);
+		}else if(type ==1) {
+			t.setManagerId(taskReceiverId);
+			t.setConsultantId(null);
+		}else if(type ==2) {
+			addOrderLog(t.getOrderNo(), OrderLogProcess.XMJLPD.getCode(), remarks);
+			t.setConsultantId(taskReceiverId);
+		}else if(type ==3) {
+			t.setConsultantId(taskReceiverId);
+		}else if(type ==4) {
+			t.setConsultantId(null);
+			t.setManagerId(taskReceiverId);
+		}
+		t.setReceiverName(a.getName());
+		tOrderTaskMapper.update(t);
+		projectDistributionAsyncService.pushProjectDistribution(taskId, taskReceiverId, type, t, tn, date, a);
 		return 1;
 	}
 

+ 10 - 28
src/main/java/com/goafanti/order/service/impl/ProjectDistributionAsyncService.java

@@ -4,7 +4,6 @@ import com.goafanti.business.bo.InputRestrictProject;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.ChannelStatus;
 import com.goafanti.common.enums.NoticeStatus;
-import com.goafanti.common.enums.OrderLogProcess;
 import com.goafanti.common.model.*;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.TOrderNewBo;
@@ -14,6 +13,7 @@ import com.goafanti.order.enums.OrderChangeProcess;
 import com.goafanti.order.enums.ProcessStatus;
 import com.goafanti.order.service.OrderNewService;
 import com.goafanti.techproject.enums.TaskState;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -21,7 +21,7 @@ import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.util.*;
-
+@Async
 @Service
 public class ProjectDistributionAsyncService {
 
@@ -66,11 +66,14 @@ public class ProjectDistributionAsyncService {
 
 
     @Transactional
-    public void pushProjectDistribution(Integer taskId, String taskReceiverId, String remarks, Integer type, TOrderTask t, TOrderNew tn, Date date, Admin a) {
-        if (type ==0) {
-            addOrderLog(t.getOrderNo(), OrderLogProcess.XMZJPD.getCode(), remarks);
-            t.setManagerId(taskReceiverId);
-            t.setConsultantId(null);
+    public void pushProjectDistribution(Integer taskId, String taskReceiverId,  Integer type, TOrderTask t, TOrderNew tn, Date date, Admin a) {
+        List<String> aids = new ArrayList<>();
+        aids.add(taskReceiverId);
+        TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t.getOrderNo());
+        orderNewService.pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_TASK_TO.getCode(),order, TokenManager.getAdminId(),0, taskId);
+        //处理项目统计表
+        TTaskMid dtails = tTaskMidMapper.getDtails(taskId);
+        if (type ==0){
             //设置催款触发
             orderNewService.pushOrderDun(tn);
             //未锁定客户就锁定客户
@@ -107,27 +110,6 @@ public class ProjectDistributionAsyncService {
                     restrictProjectMapper.insertSelective(newRP);
                 }
             }
-        }else if(type ==1) {
-            t.setManagerId(taskReceiverId);
-            t.setConsultantId(null);
-        }else if(type ==2) {
-            addOrderLog(t.getOrderNo(), OrderLogProcess.XMJLPD.getCode(), remarks);
-            t.setConsultantId(taskReceiverId);
-        }else if(type ==3) {
-            t.setConsultantId(taskReceiverId);
-        }else if(type ==4) {
-            t.setConsultantId(null);
-            t.setManagerId(taskReceiverId);
-        }
-        t.setReceiverName(a.getName());
-        tOrderTaskMapper.update(t);
-        List<String> aids = new ArrayList<>();
-        aids.add(taskReceiverId);
-        TOrderNewBo order = tOrderNewMapper.getSaleIdByOno(t.getOrderNo());
-        orderNewService.pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_TASK_TO.getCode(),order, TokenManager.getAdminId(),0, taskId);
-        //处理项目统计表
-        TTaskMid dtails = tTaskMidMapper.getDtails(taskId);
-        if (type ==0){
             dtails.setDispatchCount(t.getCommodityQuantity());
             dtails.setStockCount(t.getCommodityQuantity());
         }