|
|
@@ -1,6 +1,7 @@
|
|
|
package com.goafanti.order.service.impl;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
@@ -10,25 +11,32 @@ import java.util.UUID;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import com.goafanti.admin.bo.AdminListBo;
|
|
|
import com.goafanti.common.bo.Error;
|
|
|
import com.goafanti.common.bo.OrderExamineBo;
|
|
|
+import com.goafanti.common.dao.AdminMapper;
|
|
|
import com.goafanti.common.dao.NewOrderChangeMapper;
|
|
|
+import com.goafanti.common.dao.NoticeMapper;
|
|
|
import com.goafanti.common.dao.OrderChangeLogMapper;
|
|
|
import com.goafanti.common.dao.OrderExamineMapper;
|
|
|
import com.goafanti.common.dao.OrderRefundInvoiceMapper;
|
|
|
+import com.goafanti.common.dao.OrganizationManagementMapper;
|
|
|
import com.goafanti.common.dao.TOrderBillNewMapper;
|
|
|
import com.goafanti.common.dao.TOrderDunMapper;
|
|
|
import com.goafanti.common.dao.TOrderInvoiceMapper;
|
|
|
import com.goafanti.common.dao.TOrderLogMapper;
|
|
|
import com.goafanti.common.dao.TOrderNewMapper;
|
|
|
import com.goafanti.common.dao.TOrderTaskMapper;
|
|
|
+import com.goafanti.common.enums.NoticeStatus;
|
|
|
import com.goafanti.common.error.BusinessException;
|
|
|
import com.goafanti.common.model.OrderChangeLog;
|
|
|
import com.goafanti.common.model.OrderExamine;
|
|
|
import com.goafanti.common.model.OrderRefundInvoice;
|
|
|
import com.goafanti.common.model.TOrderDun;
|
|
|
import com.goafanti.common.model.TOrderNew;
|
|
|
+import com.goafanti.common.model.Admin;
|
|
|
import com.goafanti.common.model.NewOrderChange;
|
|
|
+import com.goafanti.common.model.Notice;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
|
import com.goafanti.core.mybatis.JDBCIdGenerator;
|
|
|
@@ -63,12 +71,17 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
@Autowired
|
|
|
private OrderRefundInvoiceMapper orderRefundInvoiceMapper;
|
|
|
@Autowired
|
|
|
+ private OrganizationManagementMapper organizationManagementMapper;
|
|
|
+ @Autowired
|
|
|
private OrderExamineMapper orderExamineMapper;
|
|
|
@Autowired
|
|
|
private OrderService orderService;
|
|
|
@Autowired
|
|
|
private JDBCIdGenerator idGenerator;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private AdminMapper adminMapper;
|
|
|
+ @Autowired
|
|
|
+ private NoticeMapper noticeMapper;
|
|
|
|
|
|
|
|
|
@Override
|
|
|
@@ -95,6 +108,7 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
ocl.setRemarks(startRemarks);
|
|
|
ocl.setChangeId(ncb.getId());
|
|
|
ocl.setStatus(0);
|
|
|
+ sendNotice(2, t);//设置与通过一样发送信息
|
|
|
orderChangeLogMapper.insertSelective(ocl);
|
|
|
return 1;
|
|
|
}
|
|
|
@@ -224,9 +238,75 @@ public class OrderChangeServiceImpl extends BaseMybatisDao<NewOrderChangeMapper>
|
|
|
ocl.setChangeId(nb.getId());
|
|
|
ocl.setStatus(status);
|
|
|
orderChangeLogMapper.insertSelective(ocl);
|
|
|
+ sendNotice(status,nb);
|
|
|
newOrderChangeMapper.updateByPrimaryKeySelective(nb);
|
|
|
return 1;
|
|
|
}
|
|
|
+ private void sendNotice(Integer status,NewOrderChangeBo nb) {
|
|
|
+ //2通过 3驳回
|
|
|
+ Integer type=status==2?NoticeStatus.ORDER_CHANGE_YES.getCode():NoticeStatus.ORDER_CHANGE_NO.getCode();
|
|
|
+ //获取发起人与发起人部门
|
|
|
+ AdminListBo a = adminMapper.getDeptNameByAid(TokenManager.getAdminId());
|
|
|
+ //获取接收者
|
|
|
+ //流程状态 0营销员 1营销管理员 2技术员 3技术经理 4技术总监 5财务专员(退单) 6财务总监 7总裁 8董事长 9 财务专员(非退单)
|
|
|
+ List<String> alist = new ArrayList<>();
|
|
|
+ TOrderNew o=tOrderNewMapper.selectByPrimaryKey(nb.getOrderNo());
|
|
|
+ switch (nb.getProcessState()) {
|
|
|
+ case 0:
|
|
|
+ alist.add(o.getSalesmanId());
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ alist.addAll(adminMapper.listNameByDepAndName(a.getDepartmentId(), "营销管理员"));
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ alist.addAll(tOrderTaskMapper.listNameByDepAndName(o.getOrderNo(),0));
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ alist.addAll(tOrderTaskMapper.listNameByDepAndName(o.getOrderNo(),1));
|
|
|
+ break;
|
|
|
+ case 4:
|
|
|
+ for (Admin admin : adminMapper.getAdminRoleList("咨询师管理员")) {
|
|
|
+ alist.add(admin.getId());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 5:
|
|
|
+ alist.add(organizationManagementMapper.selectByPrimaryKey(o.getOrderDep()).getFinanceId());
|
|
|
+ break;
|
|
|
+ case 6:
|
|
|
+ for (Admin admin : adminMapper.getAdminRoleList("财务管理员")) {
|
|
|
+ alist.add(admin.getId());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 7:
|
|
|
+ for (Admin admin : adminMapper.getAdminRoleList("总裁")) {
|
|
|
+ alist.add(admin.getId());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 8:
|
|
|
+ for (Admin admin : adminMapper.getAdminRoleList("运营决策者")) {
|
|
|
+ alist.add(admin.getId());
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 9:
|
|
|
+ alist.add(organizationManagementMapper.selectByPrimaryKey(o.getOrderDep()).getFinanceId());
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ String str=NoticeStatus.getValueByCode(type)+": 订单编号 -"+nb.getOrderNo()+", 操作人:"+a.getDepartmentName()+"-"+a.getName()+"。";
|
|
|
+ List<Notice> nlist=new ArrayList<>();
|
|
|
+ for (String string : alist) {
|
|
|
+ Notice n =new Notice();
|
|
|
+ n.setId(UUID.randomUUID().toString());
|
|
|
+ n.setNoticeType(type);
|
|
|
+ n.setContent(str);
|
|
|
+ n.setReaded(0);//未读
|
|
|
+ n.setAid(string);
|
|
|
+ nlist.add(n);
|
|
|
+ }
|
|
|
+ if(!nlist.isEmpty())noticeMapper.insertBatch(nlist);
|
|
|
+ }
|
|
|
+
|
|
|
private void changgeAdopt(NewOrderChangeBo nb) {
|
|
|
TOrderNew t1=tOrderNewMapper.selectByPrimaryKey(nb.getOrderNo());
|
|
|
List<TOrderDun> td1=tOrderDunMapper.selectByOrderNo(nb.getOrderNo());
|