|
|
@@ -42,6 +42,7 @@ import com.goafanti.common.dao.TOrderTaskMapper;
|
|
|
import com.goafanti.common.dao.TTaskHoursMapper;
|
|
|
import com.goafanti.common.dao.TTaskLogMapper;
|
|
|
import com.goafanti.common.dao.TTaskMidMapper;
|
|
|
+import com.goafanti.common.dao.TaskAttributionLogMapper;
|
|
|
import com.goafanti.common.dao.TaskHoursCountMapper;
|
|
|
import com.goafanti.common.dao.TaskLogMapper;
|
|
|
import com.goafanti.common.dao.TaskProgressLogMapper;
|
|
|
@@ -68,11 +69,11 @@ import com.goafanti.common.model.TOrderTask;
|
|
|
import com.goafanti.common.model.TTaskHours;
|
|
|
import com.goafanti.common.model.TTaskLog;
|
|
|
import com.goafanti.common.model.TTaskMid;
|
|
|
+import com.goafanti.common.model.TaskAttributionLog;
|
|
|
import com.goafanti.common.model.TaskHoursCount;
|
|
|
import com.goafanti.common.model.TaskLog;
|
|
|
import com.goafanti.common.model.TaskProgress;
|
|
|
import com.goafanti.common.model.TaskProgressLog;
|
|
|
-import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.model.UserBusiness;
|
|
|
import com.goafanti.common.model.UserChannel;
|
|
|
import com.goafanti.common.model.UserLockRelease;
|
|
|
@@ -93,6 +94,7 @@ import com.goafanti.order.bo.UpdateProjectStatusBo;
|
|
|
import com.goafanti.order.bo.inuptTaskHoursListBo;
|
|
|
import com.goafanti.order.bo.inuptTaskListBo;
|
|
|
import com.goafanti.order.bo.managerListBo;
|
|
|
+import com.goafanti.order.bo.taskAttributionLogBo;
|
|
|
import com.goafanti.order.enums.BonusSubject;
|
|
|
import com.goafanti.order.enums.NewOrderDunType;
|
|
|
import com.goafanti.order.enums.NewProjectStatus;
|
|
|
@@ -102,7 +104,7 @@ import com.goafanti.order.service.OrderNewService;
|
|
|
import com.goafanti.order.service.OrderProjectService;
|
|
|
import com.goafanti.organization.bo.OutPaymentNode;
|
|
|
import com.goafanti.techproject.enums.TaskState;
|
|
|
-import com.mysql.fabric.xmlrpc.base.Data;
|
|
|
+
|
|
|
@Service
|
|
|
public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> implements OrderProjectService {
|
|
|
@Autowired
|
|
|
@@ -155,13 +157,15 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
|
|
|
private UserBusinessMapper userBusinessMapper;
|
|
|
@Autowired
|
|
|
private UserChannelMapper userChannelMapper;
|
|
|
+ @Autowired
|
|
|
+ private TaskAttributionLogMapper taskAttributionLogMapper;
|
|
|
@Value(value = "${upload.path}")
|
|
|
private String uploadPath = null;
|
|
|
|
|
|
Logger logger = LoggerFactory.getLogger(OrderProjectServiceImpl.class);
|
|
|
|
|
|
@Override
|
|
|
- public int updateProjectDistribution(Integer taskId, String taskReceiverId,Integer specially,String remarks) {
|
|
|
+ public int updateProjectDistribution(Integer taskId, String taskReceiverId,String remarks,Integer type) {
|
|
|
TOrderTask t=tOrderTaskMapper.selectByPrimaryKey(taskId);
|
|
|
TOrderNew tn=checkDeleteSign(t.getOrderNo());
|
|
|
Date date=new Date();
|
|
|
@@ -170,58 +174,26 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
|
|
|
t.setTaskReceiver(taskReceiverId);
|
|
|
t.setTaskDistributionTime(date);
|
|
|
Admin a=adminMapper.selectByPrimaryKey(taskReceiverId);
|
|
|
+ insetLog(taskId, taskReceiverId);
|
|
|
+ addtaskAttributionLog(taskId,taskReceiverId,remarks,type,date);
|
|
|
if (a==null||a.getId()==null) {
|
|
|
throw new BusinessException(new Error("分配人员不存在!","分配人员不存在!"));
|
|
|
}
|
|
|
- insetLog(taskId, taskReceiverId);
|
|
|
- //0-经理 (经理分派会创建子项目)1 管理员或经理转交
|
|
|
- if (specially==1) {
|
|
|
+ if (type==0) {
|
|
|
addOrderLog(t.getOrderNo(), OrderLogProcess.XMDDPD.getCode(),remarks);
|
|
|
t.setManagerId(taskReceiverId);
|
|
|
t.setConsultantId(null);
|
|
|
//设置催款触发
|
|
|
- TOrderNew b=tOrderNewMapper.selectByPrimaryKey(t.getOrderNo());
|
|
|
- if(b.getApproval()==0)orderNewService.pushOrderDun(t.getOrderNo());
|
|
|
+ orderNewService.pushOrderDun(t.getOrderNo());
|
|
|
//未锁定客户就锁定客户
|
|
|
- if (userMapper.checkLock(tn.getBuyerId())<1) {
|
|
|
- userLockReleaseMapper.updateByAidAndUid(tn.getSalesmanId(),tn.getBuyerId());
|
|
|
- userMapper.updateShareType(tn.getBuyerId(),tn.getSalesmanId());
|
|
|
- }
|
|
|
- //未锁定业务就锁定业务
|
|
|
- if (userLockReleaseMapper.checkLock(tn.getSalesmanId(),tn.getBuyerId(),t.getCommodityId())<1) {
|
|
|
- UserLockRelease ulr=new UserLockRelease();
|
|
|
- ulr.setId(UUID.randomUUID().toString());
|
|
|
- ulr.setBusinessProjectId(t.getCommodityId());
|
|
|
- ulr.setType(1);
|
|
|
- ulr.setUid(tn.getBuyerId());
|
|
|
- ulr.setAid(tn.getSalesmanId());
|
|
|
- ulr.setStatus(0);
|
|
|
- ulr.setLockTime(date);
|
|
|
- userLockReleaseMapper.insertSelective(ulr);
|
|
|
- }
|
|
|
- UserBusiness ub=new UserBusiness();
|
|
|
- ub.setId(UUID.randomUUID().toString());
|
|
|
- ub.setUid(tn.getBuyerId());
|
|
|
- ub.setAid(tn.getSalesmanId());
|
|
|
- ub.setFollowSituation(5);
|
|
|
- ub.setCustomerStatus(4);
|
|
|
- ub.setCreateTime(date);
|
|
|
- ub.setUpdateTime(date);
|
|
|
- ub.setRemarks("派单自动锁定客户");
|
|
|
- ub.setBusinessProjectId(t.getCommodityId());
|
|
|
- userBusinessMapper.insertSelective(ub);
|
|
|
-
|
|
|
- //如果是渠道客户更新渠道表
|
|
|
- UserChannel uc=new UserChannel();
|
|
|
- uc.setUid(tn.getBuyerId());
|
|
|
- uc.setStatus(ChannelStatus.YQD.getCode());
|
|
|
- uc.setSignTime(date);
|
|
|
- userChannelMapper.updateByUid(uc);
|
|
|
- }else if (specially==0) {
|
|
|
- addOrderLog(t.getOrderNo(), OrderLogProcess.XMPD.getCode(),remarks);
|
|
|
+ pushUser(t, tn, date);
|
|
|
+ }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(specially==2) {
|
|
|
+ }else if(type==4) {
|
|
|
t.setConsultantId(null);
|
|
|
}
|
|
|
t.setReceiverName(a.getName());
|
|
|
@@ -229,13 +201,64 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
|
|
|
List<String> aids = new ArrayList<>();
|
|
|
aids.add(taskReceiverId);
|
|
|
orderNewService.pushGeneralSendNoticeAndEmail(aids, NoticeStatus.ORDER_TASK_TO.getCode(),t.getOrderNo(), TokenManager.getAdminId(),0);
|
|
|
-
|
|
|
checkProjiectAllocation(t.getOrderNo());
|
|
|
return 1;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 推动客户、业务渠道的锁定
|
|
|
+ * @param t
|
|
|
+ * @param tn
|
|
|
+ * @param date
|
|
|
+ */
|
|
|
+ private void pushUser(TOrderTask t, TOrderNew tn, Date date) {
|
|
|
+ if (userMapper.checkLock(tn.getBuyerId())<1) {
|
|
|
+ userLockReleaseMapper.updateByAidAndUid(tn.getSalesmanId(),tn.getBuyerId());
|
|
|
+ userMapper.updateShareType(tn.getBuyerId(),tn.getSalesmanId());
|
|
|
+ }
|
|
|
+ //未锁定业务就锁定业务
|
|
|
+ if (userLockReleaseMapper.checkLock(tn.getSalesmanId(),tn.getBuyerId(),t.getCommodityId())<1) {
|
|
|
+ UserLockRelease ulr=new UserLockRelease();
|
|
|
+ ulr.setId(UUID.randomUUID().toString());
|
|
|
+ ulr.setBusinessProjectId(t.getCommodityId());
|
|
|
+ ulr.setType(1);
|
|
|
+ ulr.setUid(tn.getBuyerId());
|
|
|
+ ulr.setAid(tn.getSalesmanId());
|
|
|
+ ulr.setStatus(0);
|
|
|
+ ulr.setLockTime(date);
|
|
|
+ userLockReleaseMapper.insertSelective(ulr);
|
|
|
+ }
|
|
|
+ UserBusiness ub=new UserBusiness();
|
|
|
+ ub.setId(UUID.randomUUID().toString());
|
|
|
+ ub.setUid(tn.getBuyerId());
|
|
|
+ ub.setAid(tn.getSalesmanId());
|
|
|
+ ub.setFollowSituation(5);
|
|
|
+ ub.setCustomerStatus(4);
|
|
|
+ ub.setCreateTime(date);
|
|
|
+ ub.setUpdateTime(date);
|
|
|
+ ub.setRemarks("派单自动锁定客户");
|
|
|
+ ub.setBusinessProjectId(t.getCommodityId());
|
|
|
+ userBusinessMapper.insertSelective(ub);
|
|
|
+
|
|
|
+ //如果是渠道客户更新渠道表
|
|
|
+ UserChannel uc=new UserChannel();
|
|
|
+ uc.setUid(tn.getBuyerId());
|
|
|
+ uc.setStatus(ChannelStatus.YQD.getCode());
|
|
|
+ uc.setSignTime(date);
|
|
|
+ userChannelMapper.updateByUid(uc);
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
+ private void addtaskAttributionLog(Integer taskId, String taskReceiverId, String remarks, Integer type, Date date) {
|
|
|
+ TaskAttributionLog log=new TaskAttributionLog(taskId,TokenManager.getAdminId(),taskReceiverId,remarks,type,date);
|
|
|
+ taskAttributionLogMapper.insertSelective(log);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public TOrderNew checkDeleteSign(String orderNo) {
|
|
|
TOrderNew t=tOrderNewMapper.selectByPrimaryKey(orderNo);
|
|
|
if(t.getDeleteSign()==2||t.getDeleteSign()==3) throw new BusinessException(new Error(ErrorConstants.ORDER_ALREADY_REVOKE, t.getOrderNo(),""));
|
|
|
@@ -949,5 +972,12 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
|
|
|
Pagination<managerListBo> p = (Pagination<managerListBo>)findPage("managerSelectByPage", "managerSelectCount", params, pageNo, pageSize);
|
|
|
return p;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<taskAttributionLogBo> taskAttributionLog(Integer tid) {
|
|
|
+
|
|
|
+ return taskAttributionLogMapper.selectByTid(tid);
|
|
|
+ }
|
|
|
|
|
|
}
|