| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -33,6 +33,7 @@ import com.epmet.constant.CustomerAgencyConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.OrgInfoConstant; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.constant.RoleKeyConstants; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.CustomerAgencyDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.CustomerDepartmentDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.CustomerGridDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dao.IcBuildingDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.dto.CustomerAgencyDTO; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -93,7 +94,8 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private IcBuildingDao icBuildingDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Autowired | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private CustomerDepartmentDao customerDepartmentDao; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @param formDTO | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -153,12 +155,16 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        originalEntity.setContacts(formDTO.getContacts()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        originalEntity.setMobile(formDTO.getMobile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //如果修改了areaCode。
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if(StringUtils.isNotBlank(originalEntity.getAreaCode())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //如果原来这个组织有area_code再去更新,没有其实应该按照pids去更新。
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // customerAgencyDao.updateSubAgencyAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId());
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                customerAgencyDao.updateSubAgencyAreaCodeById(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //网格的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                customerGridDao.updateSubGridAreaCode(originalEntity.getCustomerId(), originalEntity.getId(), formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //部门的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                customerDepartmentDao.updateSubDeptAreaCode(originalEntity.getCustomerId(), originalEntity.getAreaCode(), formDTO.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //判断areaCodeSwitch:open: 选择地区编码必填;closed:  无需选择地区编码
 | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -171,6 +177,7 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        throw new RenException(EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getCode(), EpmetErrorCode.AREA_CODE_ALREADY_EXISTS.getMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    originalEntity.setAreaCode(formDTO.getAreaCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    originalEntity.setParentAreaCode(parent.getAreaCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }else{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //如果选择的是other,需要自定义一个编码
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -182,6 +189,7 @@ public class AgencyServiceImpl implements AgencyService { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        throw new RenException("自定义area_code异常" + addAreaCodeResult.getInternalMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    originalEntity.setAreaCode(addAreaCodeResult.getData()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    originalEntity.setParentAreaCode(parent.getAreaCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
				
				 | 
				
					
  |