|  |  |  | @ -14,6 +14,7 @@ import com.glxp.api.entity.auth.AuthAdmin; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.auth.DeptEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.auth.DeptUserEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.auth.InvWarehouseEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.purchase.PurDeliveryDetailEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.entity.system.SystemParamConfigEntity; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.auth.FilterDeptUserReqeust; | 
			
		
	
		
			
				
					|  |  |  |  | import com.glxp.api.req.auth.FilterInvWarehouseRequest; | 
			
		
	
	
		
			
				
					|  |  |  | @ -30,6 +31,7 @@ import org.springframework.web.bind.annotation.*; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.annotation.Resource; | 
			
		
	
		
			
				
					|  |  |  |  | import javax.validation.Valid; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.*; | 
			
		
	
		
			
				
					|  |  |  |  | import java.util.stream.Collectors; | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | @RestController | 
			
		
	
		
			
				
					|  |  |  |  | public class DeptController extends BaseController { | 
			
		
	
	
		
			
				
					|  |  |  | @ -246,6 +248,21 @@ public class DeptController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         //判断状态
 | 
			
		
	
		
			
				
					|  |  |  |  |         String msg=isCheckStatus(deptEntity.getStatus(),deptEntity); | 
			
		
	
		
			
				
					|  |  |  |  |         if(msg!=""){ | 
			
		
	
		
			
				
					|  |  |  |  |             return ResultVOUtils.error(999,msg); | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         //判断供应商状态
 | 
			
		
	
		
			
				
					|  |  |  |  |         if(deptEntity.isSpUse()==false){ | 
			
		
	
		
			
				
					|  |  |  |  |             FilterDeptUserReqeust filterDeptUserReqeust = new FilterDeptUserReqeust(); | 
			
		
	
		
			
				
					|  |  |  |  |             filterDeptUserReqeust.setDeptId(deptEntity.getId().longValue()); | 
			
		
	
		
			
				
					|  |  |  |  |             List<DeptUserEntity> deptUserEntities = deptUserService.selectDeptUser(filterDeptUserReqeust); | 
			
		
	
		
			
				
					|  |  |  |  |             if (CollUtil.isNotEmpty(deptUserEntities)) { | 
			
		
	
		
			
				
					|  |  |  |  |                 return ResultVOUtils.error(500, "修改失败,请先移除该部门关联供应商信息!"); | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |         List<DeptEntity> deptEntityList = deptService.selectByNameList(deptEntity.getName()); | 
			
		
	
		
			
				
					|  |  |  |  |         if (deptEntityList != null && deptEntityList.size() > 0) { | 
			
		
	
		
			
				
					|  |  |  |  |             for (DeptEntity obj : deptEntityList) { | 
			
		
	
	
		
			
				
					|  |  |  | @ -348,4 +365,25 @@ public class DeptController extends BaseController { | 
			
		
	
		
			
				
					|  |  |  |  |         return ResultVOUtils.success(list); | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  |     public  String isCheckStatus(Integer status,DeptEntity deptEntity){ | 
			
		
	
		
			
				
					|  |  |  |  |         //启用的时候需要判断上级是不是被禁用
 | 
			
		
	
		
			
				
					|  |  |  |  |         if(status==1){ | 
			
		
	
		
			
				
					|  |  |  |  |             //查询所有的上级
 | 
			
		
	
		
			
				
					|  |  |  |  |             List<DeptEntity> deptEntityList= deptService.selectupDeptAll(deptEntity.getPcode()); | 
			
		
	
		
			
				
					|  |  |  |  |             for(DeptEntity obj:deptEntityList){ | 
			
		
	
		
			
				
					|  |  |  |  |                 if(obj.getStatus()==0){ | 
			
		
	
		
			
				
					|  |  |  |  |                     return "上级存在禁用的部门修改失败!"; | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         }else{ | 
			
		
	
		
			
				
					|  |  |  |  |             List<DeptEntity> deptEntityList= deptService.selectLowDeptAll(deptEntity.getCode()); | 
			
		
	
		
			
				
					|  |  |  |  |             for(DeptEntity obj:deptEntityList){ | 
			
		
	
		
			
				
					|  |  |  |  |                 if(obj.getStatus()==1){ | 
			
		
	
		
			
				
					|  |  |  |  |                     return "下级存在启用的部门修改失败!"; | 
			
		
	
		
			
				
					|  |  |  |  |                 } | 
			
		
	
		
			
				
					|  |  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  |  |         return ""; | 
			
		
	
		
			
				
					|  |  |  |  |     } | 
			
		
	
		
			
				
					|  |  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |  | } | 
			
		
	
	
		
			
				
					|  |  |  | 
 |