|
|
@@ -1,10 +1,7 @@
|
|
|
package com.goafanti.common.utils;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.UUID;
|
|
|
+import java.util.*;
|
|
|
|
|
|
import javax.mail.MessagingException;
|
|
|
|
|
|
@@ -55,6 +52,8 @@ public class AsyncUtils {
|
|
|
private OrderChangeLogMapper orderChangeLogMapper;
|
|
|
@Autowired
|
|
|
private TChangeTaskMapper tChangeTaskMapper;
|
|
|
+ @Autowired
|
|
|
+ private RoleMapper roleMapper;
|
|
|
|
|
|
|
|
|
|
|
|
@@ -447,4 +446,90 @@ public class AsyncUtils {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理修改角色对于订单、变更审核人员的修改
|
|
|
+ * @param ad
|
|
|
+ * @param usead
|
|
|
+ * @param roleIds
|
|
|
+ */
|
|
|
+ public void pushRoleUpdateExamine(Admin ad, Admin usead, List<String> roleIds, List<Role> useRole) {
|
|
|
+ List<Role> roles = roleMapper.selectByIdList(roleIds);
|
|
|
+ updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN_MANAGER);
|
|
|
+ updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN_ADMIN);
|
|
|
+ updateExamineByRole(ad, usead, useRole, roles,AFTConstants.TECH_ADMIN);
|
|
|
+ updateExamineByRole(ad, usead, useRole, roles,AFTConstants.FINANCE);
|
|
|
+ updateExamineByRole(ad, usead, useRole, roles,AFTConstants.FINANCE_ADMIN);
|
|
|
+ updateExamineByRole(ad, usead, useRole, roles,AFTConstants.SALESMAN_ADMIN);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateExamineByRole(Admin ad, Admin usead, List<Role> useRole, List<Role> roles, String roleType) {
|
|
|
+ boolean updateParam=false;
|
|
|
+ int updatedep =0;
|
|
|
+ if (!ad.getName().equals(usead.getName())){
|
|
|
+ updateParam=true;
|
|
|
+ }
|
|
|
+ boolean newDEP=Rolescontains(roles,roleType);
|
|
|
+ boolean useDep=Rolescontains(useRole,roleType);
|
|
|
+ if (roleType.equals(AFTConstants.SALESMAN_ADMIN)){
|
|
|
+ if (ad.getDepartmentId().equals(usead.getDepartmentId())){
|
|
|
+ updatedep=1;
|
|
|
+ }else{
|
|
|
+ updatedep=2;
|
|
|
+ }
|
|
|
+ if (newDEP&&useDep){
|
|
|
+ //新旧为同一个,修改当前就可以了
|
|
|
+ if (updatedep ==1&& updateParam){
|
|
|
+ updateOrderAndChangeExamine(ad, roleType);
|
|
|
+ //新旧不是同一个,俩个都要修改
|
|
|
+ }else if (updatedep ==2){
|
|
|
+ updateOrderAndChangeExamine(ad, roleType);
|
|
|
+ updateOrderAndChangeExamine(usead, roleType);
|
|
|
+ }
|
|
|
+ }else if (newDEP&&!useDep){
|
|
|
+ updateOrderAndChangeExamine(ad, roleType);
|
|
|
+ }else if (!newDEP&&useDep){
|
|
|
+ updateOrderAndChangeExamine(usead, roleType);
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ if (updateParam){
|
|
|
+ updateOrderAndChangeExamine(ad, roleType);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private boolean Rolescontains(List<Role> roles, String roleType) {
|
|
|
+ for (Role role : roles) {
|
|
|
+ if (role.getRoleType().equals(roleType)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param ad
|
|
|
+ * @param roleType
|
|
|
+ */
|
|
|
+ public void updateOrderAndChangeExamine(Admin ad, String roleType) {
|
|
|
+ if (roleType.equals(AFTConstants.SALESMAN_ADMIN)){
|
|
|
+ tOrderNewMapper.updateExamine(ad.getDepartmentId());
|
|
|
+ newOrderChangeMapper.updateExamineName(ad.getDepartmentId());
|
|
|
+ }else if (roleType.equals(AFTConstants.SALESMAN_MANAGER)){
|
|
|
+// 订单 0=营销员,1=经理,2=营销管理员,3=财务专员,4=总裁,5=技术总监,6部分分配,7全部分配
|
|
|
+// 变更 流程状态 0=营销员,1=营销经理,2=营销管理员,3=技术员,4=技术经理,5=技术总监,6=财务专员,7=财务总监,8=总裁,9=董事长
|
|
|
+ tOrderNewMapper.updateExamineById(ad.getId(),1);
|
|
|
+ newOrderChangeMapper.updateExamineById(ad.getId(),1);
|
|
|
+ }else if (roleType.equals(AFTConstants.FINANCE)){
|
|
|
+ tOrderNewMapper.updateExamineById(ad.getId(),3);
|
|
|
+ newOrderChangeMapper.updateExamineById(ad.getId(),3);
|
|
|
+ }else if (roleType.equals(AFTConstants.TECH_ADMIN)) {
|
|
|
+ tOrderNewMapper.updateExamineById(null, 5);
|
|
|
+ newOrderChangeMapper.updateExamineById(null, 5);
|
|
|
+ }else if (roleType.equals(AFTConstants.FINANCE_ADMIN)) {
|
|
|
+ newOrderChangeMapper.updateExamineById(null, 7);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|