Browse Source

修改管理员调整

anderx 3 years ago
parent
commit
c52175226c

+ 5 - 1
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -168,7 +168,11 @@ public class AdminSuperviserApiController extends CertifyApiController {
 			if (!a.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("0")){
 				redisUtil.deleteAid(aa.getId());
 			}
-			res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles));
+			boolean updateName=false;
+			if (!a.getName().equals(ad.getName())){
+				updateName=true;
+			}
+			res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles,updateName));
 		}
 		return res;
 	}

+ 1 - 1
src/main/java/com/goafanti/admin/service/NewAdminService.java

@@ -19,7 +19,7 @@ public interface NewAdminService {
 
 	int insert(Admin ad);
 
-	int updateByPrimaryKeySelective(Admin ad, List<String> roleIds);
+	int updateByPrimaryKeySelective(Admin ad, List<String> roleIds,boolean updateName);
 
 	int updateByPrimaryKey(Admin a);
 

+ 19 - 6
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -92,7 +92,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 	@SuppressWarnings("unused")
 	@Override
-	public int updateByPrimaryKeySelective(Admin ad, List<String> roleIds) {
+	public int updateByPrimaryKeySelective(Admin ad, List<String> roleIds,boolean updateName) {
 		Map<String, Object> params = new HashMap<>();
 		params.put("uid", ad.getId());
 		params.put("roles", roleIds);
@@ -108,7 +108,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		ad.setType(sumType(roleIds));
 		int count=adminMapper.updateByPrimaryKey(ad);
 		pushAmbRole(ad);
-		pushAdminRole(ad.getId(),roleIds,useRole);
+		pushAdminRole(ad,roleIds,useRole,updateName);
 		if (count>0&&ad.getAmbId()!=null){
 			//进行巴人数计算
 //			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
@@ -124,9 +124,12 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 
 
-	private void pushAdminRole(String id,List<String>roleIds, Set<String> useRole) {
+	private void pushAdminRole(Admin ad,List<String>roleIds, Set<String> useRole,boolean updateName) {
 		Integer flag=0;
 		String roleType="";
+		//新的计算
+		List<Role> roleList = roleMapper.selectByIdList(roleIds);
+
 		//加入以前有也要重新计算
 		if (useRole!=null){
 			for (String s : useRole) {
@@ -157,7 +160,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 				}
 			}
 		}
-		List<Role> roleList = roleMapper.selectByIdList(roleIds);
+
 		if (roleList!=null){
 			for (Role role : roleList) {
 				if (AFTConstants.SALESMAN_ADMIN.equals(role.getRoleType().toString())){
@@ -189,7 +192,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		}
 		if (flag!=0){
 
-			asyncUtils.updateListExamineName(flag,id,roleType);
+			asyncUtils.updateListExamineName(flag,ad.getId(),roleType);
 		}
 
 
@@ -327,11 +330,21 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		}
 		if(ad.getAmbId()!=null)pushAmbRole(ad);
 		adminMapper.insert(ad);
-		pushAdminRole(ad.getId(),roleIds,null);
+		pushAdminRole(ad,roleIds);
 		return 1;
 	}
 
 	/**
+	 * 新增无需判断权限与名称
+	 * @param ad
+	 * @param roleIds
+	 */
+	private void pushAdminRole(Admin ad,List<String>roleIds){
+		pushAdminRole(ad,roleIds,null,false);
+	}
+
+
+	/**
 	 * 计算巴权限
 	 * @param ad
 	 */

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

@@ -162,18 +162,23 @@ public class AsyncUtils {
 			tOrderNewMapper.updateExamineName(ProcessStatus.YPYXGLY.getCode(),depId,null,names);
 			newOrderChangeMapper.updateExamineName(OrderChangeProcess.YXGLY.getCode(),depId,null,names);
 			tOrderInvoiceMapper.updateExamineName(1,depId,null,names);
-		}else if (type==2){
+		}
+		if (type==2){
 			tOrderInvoiceMapper.updateListExamineName(type,depId,roleType);
-		}else if (type==3){
+		}
+		if (type==3){
 			names=getNames(type,depId, roleType);
 			newOrderChangeMapper.updateExamineName(OrderChangeProcess.CWZJ.getCode(),depId,null,names);
-		}else if (type==4){
+		}
+		if (type==4){
 			names=getNames(type,depId, roleType);
 			tOrderNewMapper.updateExamineName(ProcessStatus.YPZXSGLY.getCode(),depId,null,names);
 			newOrderChangeMapper.updateExamineName(OrderChangeProcess.JSZJ.getCode(),depId,null,names);
-		}else if (type==5){
+		}
+		if (type==5){
 			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),OrderChangeProcess.JSY.getCode());
-		}else if (type==6){
+		}
+		if (type==6){
 			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),OrderChangeProcess.JSJL.getCode());
 		}
 	}