Browse Source

审核接口开发

anderx 3 years ago
parent
commit
ad8a4e47ab

+ 1 - 2
src/main/java/com/goafanti/common/bo/EmailBo.java

@@ -121,8 +121,7 @@ public class EmailBo {
 		this.content = setGeneralFormat();
 	}
 
-	public  EmailBo(String subject, String address, String deptname, String sender,
-			 String orderNo,String adminName) {
+	public  EmailBo(String subject, String address, String deptname, String sender) {
 		this.subject = subject;
 		this.address = address;
 		this.addressee = "";

+ 6 - 3
src/main/java/com/goafanti/common/enums/NoticeStatus.java

@@ -69,9 +69,12 @@ public enum NoticeStatus {
 	MENBER_START(60,"会员项目发起"),
 	MENBER_YES(61,"会员项目通过"),
 	MENBER_NO(62,"会员项目拒绝"),
-	PROJECT_START(63,"项目暂停流程发起"),
-	PROJECT_YES(64,"项目暂停流程通过"),
-	PROJECT_NO(65,"项目暂停流程拒绝"),
+	PROJECT_SOPT_START(63,"项目暂停流程发起"),
+	PROJECT_SOPT_YES(64,"项目暂停流程通过"),
+	PROJECT_SOPT_NO(65,"项目暂停流程拒绝"),
+	PROJECT_RENEW_START(66,"项目重启流程发起"),
+	PROJECT_RENEW_YES(67,"项目重启流程通过"),
+	PROJECT_RENEW_NO(68,"项目重启流程拒绝"),
 	OTHER(0, "其他");
 
 	private NoticeStatus(Integer code, String desc) {

+ 1 - 1
src/main/java/com/goafanti/common/mapper/TOrderTaskMapper.xml

@@ -1757,7 +1757,7 @@
     select a.id tid,b.order_no orderNo ,b.salesman_id salesmanId,b.finance_id financeId ,a.task_receiver techId,
     b.salesman_name salesmanName ,b.finance_name financeName ,d.name techName,b.buyer_name buyerName
     from t_order_task a left join t_order_mid b on a.order_no=b.order_no
-    left join t_task_mid c on a.id =c.tid left join admin d on a.task_receiver=d.id
+    left join admin d on a.task_receiver=d.id
     where 1=1
     <if test="tid !=null">
       and a.id= #{tid}

+ 3 - 3
src/main/java/com/goafanti/common/model/TaskLog.java

@@ -33,7 +33,7 @@ public class TaskLog implements Serializable {
     /**
      * 发起暂停编号
      */
-    private Integer sotpId;
+    private Long sotpId;
 
     private static final long serialVersionUID = 1L;
 
@@ -77,11 +77,11 @@ public class TaskLog implements Serializable {
         this.aid = aid;
     }
 
-    public Integer getSotpId() {
+    public Long getSotpId() {
         return sotpId;
     }
 
-    public void setSotpId(Integer sotpId) {
+    public void setSotpId(Long sotpId) {
         this.sotpId = sotpId;
     }
 

+ 52 - 10
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -9,12 +9,11 @@ import java.util.UUID;
 import javax.mail.MessagingException;
 
 import com.goafanti.admin.bo.AdminListBo;
+import com.goafanti.common.bo.OrderOperator;
 import com.goafanti.common.constant.AFTConstants;
 import com.goafanti.common.dao.*;
 import com.goafanti.common.enums.NoticeStatus;
-import com.goafanti.common.model.Admin;
-import com.goafanti.common.model.TChangeTask;
-import com.goafanti.common.model.TOrderNew;
+import com.goafanti.common.model.*;
 import com.goafanti.core.shiro.token.TokenManager;
 import com.goafanti.order.bo.NewOrderChangeBo;
 import com.goafanti.order.enums.OrderChangeProcess;
@@ -26,7 +25,6 @@ import org.springframework.stereotype.Component;
 
 import com.goafanti.common.bo.EmailBo;
 import com.goafanti.common.enums.NoticeTypes;
-import com.goafanti.common.model.Notice;
 
 @Component
 @Async
@@ -41,6 +39,8 @@ public class AsyncUtils {
 	private NewOrderChangeMapper newOrderChangeMapper;
 	@Autowired
 	private TOrderInvoiceMapper tOrderInvoiceMapper;
+	@Autowired
+	private TOrderTaskMapper tOrderTaskMapper;
 
 
 
@@ -174,16 +174,58 @@ public class AsyncUtils {
 
 	/**
 	 *
-	 * @param orderNo 订单编号
-	 * @param type  发送对象 0营销管理员
+	 * @param type  发送对象 0营销管理员 1 通知所有人
+	 *  @param sotpType  发送对象 类型 0=项目暂停,1=项目重启
+	 *
 	 */
-	public void addProjectSotpNotic(String orderNo, Integer type,String ids) {
+	public void addProjectSotpNotic(Integer type,  Integer sotpType, String ids, TOrderTask task) {
+		Integer noticeType=0;
 		if (type==0){
-			String str=String.format("订单编号[%s]项目编号[%s],请及时审核",orderNo,ids);
-			TOrderNew tOrderNew = tOrderNewMapper.selectByPrimaryKey(orderNo);
+			noticeType=sotpType==0?NoticeStatus.PROJECT_SOPT_START.getCode() :NoticeStatus.PROJECT_RENEW_START.getCode();
+			String[] split = ids.split(",");
+			task = tOrderTaskMapper.selectByPrimaryKey(Integer.valueOf(split[0]));
+
+			String str=String.format("订单编号[%s]项目编号[%s],请及时审核",task.getOrderNo(),ids);
+			TOrderNew tOrderNew = tOrderNewMapper.selectByPrimaryKey(task.getOrderNo());
 			List<Admin> admins = adminMapper.listAdminBydepIdAndRoleType(tOrderNew.getOrderDep(),AFTConstants.SALESMAN_ADMIN);
 			for (Admin admin : admins) {
-				addNotic(NoticeStatus.PROJECT_START.getCode(),admin.getId(), str);
+				addNotic( noticeType,admin.getId(), str);
+			}
+		}else if(type==1){
+			String str=String.format("订单编号[%s]项目编号[%s],已%s请悉知。",task.getOrderNo(),task.getId(),type==1?"恢复":"暂停");
+			noticeType=sotpType==0?NoticeStatus.PROJECT_SOPT_YES.getCode() :NoticeStatus.PROJECT_RENEW_YES.getCode();
+			List<String> list = new ArrayList<>();
+			if (task.getConsultantId()!=null)list.add(task.getConsultantId());
+			if (task.getManagerId()!=null)list.add(task.getManagerId());
+			OrderOperator orderOperator = tOrderTaskMapper.selectAidByParam(task.getId());
+			if (orderOperator.getFinanceId()!=null)list.add(orderOperator.getFinanceId());
+			if (orderOperator.getSalesmanId()!=null)list.add(orderOperator.getSalesmanName());
+			List<Admin> cwgly = adminMapper.selectAdminByRoleType(AFTConstants.FINANCE_ADMIN);
+			for (Admin admin : cwgly) {
+				list.add(admin.getId());
+			}
+			List<Admin> zxsgly = adminMapper.selectAdminByRoleType(AFTConstants.TECH_ADMIN);
+			for (Admin admin : zxsgly) {
+				list.add(admin.getId());
+			}
+			List<Admin> zc = adminMapper.selectAdminByRoleType(AFTConstants.CED);
+			for (Admin admin : zc) {
+				list.add(admin.getId());
+			}
+			List<Admin> dsz = adminMapper.selectAdminByRoleType(AFTConstants.APPROVAL_DECISION);
+			for (Admin admin : dsz) {
+				list.add(admin.getId());
+			}
+			if (!list.isEmpty()){
+				List<Notice> notes=new ArrayList<>();
+
+				for (String s : list) {
+					notes.add(new Notice(UUID.randomUUID().toString(), new Date(), 0, s,
+									noticeType, str));
+
+				}
+			noticeMapper.insertBatch(notes);
+
 			}
 		}
 

+ 10 - 5
src/main/java/com/goafanti/order/bo/InputProjectSotp.java

@@ -10,6 +10,9 @@ public class InputProjectSotp {
     @Param(name="编号")
     @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private String ids;
+    @Param(name="类型")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private Integer type;
     @Param(name="原因")
     @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private String reason;
@@ -17,16 +20,18 @@ public class InputProjectSotp {
     @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
     private String annexUrl;
 
-    private String orderNo;
 
-    public String getOrderNo() {
-        return orderNo;
+
+    public Integer getType() {
+        return type;
     }
 
-    public void setOrderNo(String orderNo) {
-        this.orderNo = orderNo;
+    public void setType(Integer type) {
+        this.type = type;
     }
 
+
+
     public String getIds() {
         return ids;
     }

+ 38 - 0
src/main/java/com/goafanti/order/controller/InputTaskSoptLog.java

@@ -1,4 +1,42 @@
 package com.goafanti.order.controller;
 
+import com.goafanti.common.constant.ErrorConstants;
+import com.goafanti.common.utils.Param;
+
+import javax.validation.constraints.NotNull;
+
 public class InputTaskSoptLog {
+
+    @Param(name="编号")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private Long taskSoptId;
+    @Param(name="原因")
+    @NotNull(message = "{"+ ErrorConstants.PARAM_EMPTY_ERROR+"}")
+    private String reason;
+
+    private Integer status;
+
+    public Integer getStatus() {
+        return status;
+    }
+
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+
+    public Long getTaskSoptId() {
+        return taskSoptId;
+    }
+
+    public void setTaskSoptId(Long taskSoptId) {
+        this.taskSoptId = taskSoptId;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
 }

+ 1 - 1
src/main/java/com/goafanti/order/controller/OrderProjectApiController.java

@@ -651,7 +651,7 @@ public class OrderProjectApiController extends CertifyApiController {
 	}
 
 	/**
-	 * 项目暂停
+	 * 项目暂停审核
 	 *
 	 */
 	@RequestMapping(value = "/examineProjectSotp" ,method = RequestMethod.POST)

+ 37 - 2
src/main/java/com/goafanti/order/service/impl/OrderProjectServiceImpl.java

@@ -17,6 +17,7 @@ import com.goafanti.common.model.*;
 import com.goafanti.common.utils.*;
 import com.goafanti.common.utils.excel.NewExcelUtil;
 import com.goafanti.order.bo.*;
+import com.goafanti.order.controller.InputTaskSoptLog;
 import com.goafanti.order.enums.*;
 import org.apache.commons.collections4.map.HashedMap;
 import org.apache.commons.lang3.StringUtils;
@@ -1468,7 +1469,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			}
 			TaskSopt taskSopt = new TaskSopt();
 			taskSopt.setTid(Integer.valueOf(s));
-			taskSopt.setType(0);
+			taskSopt.setType(in.getType());
 			taskSopt.setStatus(0);
 			taskSopt.setReason(in.getReason());
 			taskSopt.setAnnexUrl(in.getAnnexUrl());
@@ -1482,7 +1483,7 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 			log.setCreateTime(date);
 			taskSoptLogMapper.insertSelective(log);
 		}
-		asyncUtils.addProjectSotpNotic(in.getOrderNo(),0,in.getIds());
+		asyncUtils.addProjectSotpNotic(0, in.getType(),in.getIds(),null);
 		return 1;
 	}
 
@@ -1518,5 +1519,39 @@ public class OrderProjectServiceImpl extends BaseMybatisDao<TOrderTaskMapper> im
 		return null;
 	}
 
+	@Override
+	public Object examineProjectSotp(InputTaskSoptLog in) {
+		TaskSopt use = taskSoptMapper.selectByPrimaryKey(in.getTaskSoptId());
+		TaskSopt t=new TaskSopt();
+		t.setId(use.getId());
+		if (in.getStatus()==1){
+			t.setStatus(1);
+			TOrderTask task = tOrderTaskMapper.selectByPrimaryKey(use.getTid());
+			StringBuffer str =new StringBuffer();
+			str.append("项目状态修改为:");
+			if (use.getType()==0){
+				task.setProjectStatus(2);
+				str=str.append("已暂停");
+				examineProjectSotpAddNotice(task,1,use.getType());
+			}else {
+				task.setProcessStatus(1);
+				str=str.append("进行中");
+				examineProjectSotpAddNotice(task,1,use.getType());
+			}
+			TaskLog taskLog = new TaskLog();
+			taskLog.setSotpId(in.getTaskSoptId());
+			taskLog.setContent(str.toString());
+			taskLog.setAid(use.getCreateBy());
+			taskLogMapper.insertSelective(taskLog);
+		}else if(in.getStatus()==2) {
+			t.setStatus(2);
+		}
+		return taskSoptMapper.updateByPrimaryKeySelective(t);
+	}
+
+	private void examineProjectSotpAddNotice(TOrderTask task,Integer status,Integer sotpType) {
+		asyncUtils.addProjectSotpNotic(status,sotpType,null,task);
+	}
+
 
 }