anderx лет назад: 3
Родитель
Сommit
838dd414c0

+ 7 - 11
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -146,8 +146,8 @@ public class AdminSuperviserApiController extends CertifyApiController {
 				res.getError().add(buildError(ErrorConstants.USER_ALREADY_EXIST, "当前用户已注册!"));
 				return res;
 			}
-			Admin a = newAdminService.selectByPrimaryKey(admin.getId());
-			if (null == a) {
+			Admin useAdmin = newAdminService.selectByPrimaryKey(admin.getId());
+			if (null == useAdmin) {
 				res.getError().add(buildError(ErrorConstants.PARAM_ERROR, "", "用户id"));
 				return res;
 			}
@@ -157,22 +157,18 @@ public class AdminSuperviserApiController extends CertifyApiController {
 			}
 			Admin ad = new Admin();
 			BeanUtils.copyProperties(admin, ad);
-			ad.setNumber(a.getNumber());
-			ad.setPassword(a.getPassword());
-			ad.setCreateTime(a.getCreateTime());
+			ad.setNumber(useAdmin.getNumber());
+			ad.setPassword(useAdmin.getPassword());
+			ad.setCreateTime(useAdmin.getCreateTime());
 			res = disposeAdminLocationList(res, jo, ad);
 			if (!res.getError().isEmpty()) {
 				return res;
 			}
 			//如果锁定,清楚登陆者的token
-			if (!a.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("0")){
+			if (!useAdmin.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("0")){
 				redisUtil.deleteAid(aa.getId());
 			}
-			boolean updateName=false;
-			if (!a.getName().equals(ad.getName())){
-				updateName=true;
-			}
-			res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles,updateName));
+			res.setData(newAdminService.updateByPrimaryKeySelective(ad,useAdmin, roles));
 		}
 		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,boolean updateName);
+	int updateByPrimaryKeySelective(Admin ad,Admin useAdmin, List<String> roleIds );
 
 	int updateByPrimaryKey(Admin a);
 

+ 3 - 83
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,boolean updateName) {
+	public int updateByPrimaryKeySelective(Admin ad,Admin useAdmin, List<String> roleIds) {
 		Map<String, Object> params = new HashMap<>();
 		params.put("uid", ad.getId());
 		params.put("roles", roleIds);
@@ -107,8 +107,8 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 		ad.setType(sumType(roleIds));
 		int count=adminMapper.updateByPrimaryKey(ad);
+		//
 		pushAmbRole(ad);
-		pushAdminRole(ad,roleIds,useRole,updateName);
 		if (count>0&&ad.getAmbId()!=null){
 			//进行巴人数计算
 //			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
@@ -124,79 +124,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 
 
-	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) {
-				if (AFTConstants.SALESMAN_ADMIN.equals(s)){
-					flag=1;
-					roleType=AFTConstants.SALESMAN_ADMIN;
-					break;
-				}else if (AFTConstants.COMPANY_MANAGER.equals(s)){
-					flag=2;
-					roleType=AFTConstants.COMPANY_MANAGER;
-					break;
-				}else if (AFTConstants.FINANCE_ADMIN.equals(s)){
-					flag=3;
-					roleType=AFTConstants.FINANCE_ADMIN;
-					break;
-				}else if (AFTConstants.TECH_ADMIN.equals(s)){
-					flag=4;
-					roleType=AFTConstants.TECH_ADMIN;
-					break;
-				}else if (AFTConstants.TECH.equals(s)){
-					flag=5;
-					roleType=AFTConstants.TECH;
-					break;
-				}else if (AFTConstants.TECH_MANAGER.equals(s)){
-					flag=6;
-					roleType=AFTConstants.TECH_MANAGER;
-					break;
-				}
-			}
-		}
-
-		if (roleList!=null){
-			for (Role role : roleList) {
-				if (AFTConstants.SALESMAN_ADMIN.equals(role.getRoleType().toString())){
-					flag=1;
-					roleType=AFTConstants.SALESMAN_ADMIN;
-					break;
-				}else if (AFTConstants.COMPANY_MANAGER.equals(role.getRoleType().toString())){
-					flag=2;
-					roleType=AFTConstants.COMPANY_MANAGER;
-					break;
-				}else if (AFTConstants.FINANCE_ADMIN.equals(role.getRoleType().toString())){
-					flag=3;
-					roleType=AFTConstants.FINANCE_ADMIN;
-					break;
-				}else if (AFTConstants.TECH_ADMIN.equals(role.getRoleType().toString())){
-					flag=4;
-					roleType=AFTConstants.TECH_ADMIN;
-					break;
-				}else if (AFTConstants.TECH.equals(role.getRoleType().toString())){
-					flag=5;
-					roleType=AFTConstants.TECH;
-					break;
-				}else if (AFTConstants.TECH_MANAGER.equals(role.getRoleType().toString())){
-					flag=6;
-					roleType=AFTConstants.TECH_MANAGER;
-					break;
-				}
-			}
-		}
-		if (flag!=0){
-
-			asyncUtils.updateListExamineName(flag,ad.getId(),roleType);
-		}
-
 
-	}
 
 
 	private int sumType(List<String > roleIds) {
@@ -330,18 +258,10 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		}
 		if(ad.getAmbId()!=null)pushAmbRole(ad);
 		adminMapper.insert(ad);
-		pushAdminRole(ad,roleIds);
+
 		return 1;
 	}
 
-	/**
-	 * 新增无需判断权限与名称
-	 * @param ad
-	 * @param roleIds
-	 */
-	private void pushAdminRole(Admin ad,List<String>roleIds){
-		pushAdminRole(ad,roleIds,null,false);
-	}
 
 
 	/**

+ 0 - 17
src/main/java/com/goafanti/common/dao/TOrderInvoiceMapper.java

@@ -34,21 +34,4 @@ public interface TOrderInvoiceMapper {
     TOrderInvoiceDetails getInvoiceDetails(String orderNo);
 
     List<OutInvoiceLog>  selectInvoiceLog(Integer id);
-
-    /**
-     * 切换审核人员
-     * @param type 0财务  1营销管理员 3公司管理
-     * @param depId 部门编号
-     * @param aid 切换后审核人
-     * @return
-     */
-    int updateExamineName(@Param("type")Integer type, @Param("depId")String depId, @Param("aid")String aid
-        ,@Param("names")String names);
-
-    /**
-     * @param roleType
-     * @param depId
-     * @return
-     */
-    int updateListExamineName(@Param("type")Integer type, @Param("depId")String depId,@Param("roleType")String roleType);
 }

+ 0 - 60
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -593,64 +593,4 @@ where a.status=2 and a.order_no=  #{orderNo,jdbcType=VARCHAR}
     where a.invoice_id =#{id} order by a.create_time
   </select>
 
-  <update id="updateExamineName">
-    update  t_order_invoice a,t_order_new b
-    <if test="names ==null">
-      ,admin c
-      set a.examine_name=c.name
-      where 1=1
-      <if test="type==0">
-        and a.type=0 and a.status =1 and a.approval in (0,2)
-      </if>
-      <if test="type==1">
-        and a.type=1 and a.status =1 and a.approval in (0,2)
-      </if>
-      <if test="type==2">
-        and  a.`type` =1 and a.status =1 and a.approval =1
-      </if>
-      and a.order_no =b.order_no
-      <if test="type==1">
-        and b.order_dep = #{depId}
-      </if>
-      and c.id= #{aid}
-    </if>
-    <if test="names !=null">
-      set a.examine_name= #{names}
-      where 1=1
-      <if test="type==0">
-        and a.type=0 and a.status =1 and a.approval in (0,2)
-      </if>
-      <if test="type==1">
-        and a.type=1 and a.status =1 and a.approval in (0,2)
-      </if>
-      <if test="type==2">
-        and  a.`type` =1 and a.status =1 and a.approval =1
-      </if>
-      and a.order_no =b.order_no
-      <if test="type==1">
-        and b.order_dep = #{depId}
-      </if>
-    </if>
-  </update>
-  <update id="updateListExamineName">
-    <if test="type==1">
-      update t_order_invoice t0,(select a.id , ifnull(GROUP_CONCAT(x.name) ,'暂无人员')name
-      from t_order_invoice a left join t_order_new b on a.order_no =b.order_no left join (select name ,department_id
-      from admin a left join user_role b on a.id =b.uid left join `role` c on b.rid =c.id where a.status ='0'
-      and c.role_type in (#{roleType}))x on b.order_dep =x.department_id where a.`type` =1
-      and a.status =1 and a.approval =0  and b.order_dep= #{depId}  group by a.id)t1
-      set t0.examine_name =t1.name
-      where t0.id=t1.id
-    </if>
-    <if test="type==2">
-      update t_order_invoice t0,(select a.id , ifnull(GROUP_CONCAT(x.name) ,'暂无人员')name
-      from t_order_invoice a left join t_order_new b on a.order_no =b.order_no left join (select name ,department_id
-      from admin a left join user_role b on a.id =b.uid left join `role` c on b.rid =c.id where a.status ='0'
-      and c.role_type in (#{roleType}))x on b.order_dep =x.department_id where a.`type` =1 and a.status =1
-      and a.approval =1 and b.order_dep= #{depId}  group by a.id)t1
-      set t0.examine_name =t1.name
-      where t0.id=t1.id
-    </if>
-
-  </update>
 </mapper>

+ 3 - 59
src/main/java/com/goafanti/common/utils/AsyncUtils.java

@@ -135,67 +135,11 @@ public class AsyncUtils {
     }
 
 
-	/**
-	 * 切换审核人员
-	 * @param depId 部门编号
-	 * @param aid 切换后审核人
-	 * @return
-	 */
-    public void updateExamineName( String depId, String aid) {
-			tOrderNewMapper.updateExamineName(3,depId,aid,null);
-			newOrderChangeMapper.updateExamineName(OrderChangeProcess.JSZJ.getCode(),depId,aid,null);
-			tOrderInvoiceMapper.updateExamineName(0,depId,aid,null);
-	}
 
-	/**
-	 *
-	 * @param type 1营销管理 2公司管理 3财务管理 4咨询管理 5咨询师更换名称 6咨询师经理更换名称
-	 * @param id 管理员id
-	 * @param roleType
-	 */
-	public void updateListExamineName(Integer type, String id, String roleType) {
-		Admin admin = adminMapper.selectByPrimaryKey(id);
-		String depId=admin.getDepartmentId();
-		String names="";
-		if (type==1){
-			names=getNames(type,depId, roleType);
-			tOrderNewMapper.updateExamineName(ProcessStatus.YPYXGLY.getCode(),depId,null,names);
-			newOrderChangeMapper.updateExamineName(OrderChangeProcess.YXGLY.getCode(),depId,null,names);
-			tOrderInvoiceMapper.updateExamineName(1,depId,null,names);
-		}
-		if (type==2){
-			tOrderInvoiceMapper.updateListExamineName(type,depId,roleType);
-		}
-		if (type==3){
-			names=getNames(type,depId, roleType);
-			newOrderChangeMapper.updateExamineName(OrderChangeProcess.CWZJ.getCode(),depId,null,names);
-		}
-		if (type==4){
-			names=getNames(type,depId, roleType);
-			tOrderNewMapper.updateExamineName(ProcessStatus.YPZXSGLY.getCode(),depId,null,names);
-			newOrderChangeMapper.updateExamineName(OrderChangeProcess.JSZJ.getCode(),depId,null,names);
-		}
-		if (type==5){
-			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),OrderChangeProcess.JSY.getCode());
-		}
-		if (type==6){
-			newOrderChangeMapper.updateTaskExamineName(admin.getId(),admin.getId(),OrderChangeProcess.JSJL.getCode());
-		}
-	}
 
-	private String getNames(Integer type,String depId, String roleType) {
-		StringBuffer str=new StringBuffer();
-		List<Admin> admins = adminMapper.selectAdminByRoleType(roleType);
-		for (Admin admin : admins) {
-			if (type==1&&admin.getDepartmentId().equals(depId)){
-				str = str.append(admin.getName()).append(",");
-			}else if(type!=1){
-				str = str.append(admin.getName()).append(",");
-			}
-		}
-		if (str.length()>1)return str.substring(0,str.length()-1);
-		else return "暂无";
-	}
+
+
+
 
 	/**
 	 *

+ 1 - 5
src/main/java/com/goafanti/organization/service/impl/OrganizationServiceImpl.java

@@ -196,11 +196,7 @@ public class OrganizationServiceImpl extends BaseMybatisDao<DepartmentMapper> im
 		dep.setProvince(province);
 		dep.setHideSign(hideSign);
 		dep.setWorkingHoursType(workingHoursType);
-		Department use = departmentMapper.selectByPrimaryKey(id);
-		if (!use.getFinanceId().equals(financeId)){
-			//切换后更换审核人
-			asyncUtils.updateExamineName(id,financeId);
-		}
+
 		tOrderMidMapper.updateFinanceId(id,financeId);
 		int x=departmentMapper.updateByPrimaryKeySelective(dep);
 		return x;