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