|
|
@ -23,6 +23,7 @@ import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
@ -154,6 +155,12 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
originalEntity.setCode(formDTO.getCode()); |
|
|
|
originalEntity.setContacts(formDTO.getContacts()); |
|
|
|
originalEntity.setMobile(formDTO.getMobile()); |
|
|
|
if (StringUtils.isNotBlank(originalEntity.getAreaCode()) |
|
|
|
&& originalEntity.getAreaCode().contains("UD") |
|
|
|
&& StringUtils.isNotBlank(formDTO.getAreaCode()) |
|
|
|
&& "other".equals(formDTO.getAreaCode())) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "自定义编码不允许修改", "自定义组织区划代码不允许修改"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalEntity.getAreaCode())) { |
|
|
|
CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); |
|
|
|
//如果修改了areaCode。
|
|
|
@ -182,7 +189,7 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
//如果选择的是other,需要自定义一个编码
|
|
|
|
AddAreaCodeFormDTO addAreaCodeFormDTO = new AddAreaCodeFormDTO(); |
|
|
|
addAreaCodeFormDTO.setCurrentAreaLevel(formDTO.getLevel()); |
|
|
|
addAreaCodeFormDTO.setParentAreaCode(formDTO.getAreaCode()); |
|
|
|
addAreaCodeFormDTO.setParentAreaCode(parent.getAreaCode()); |
|
|
|
addAreaCodeFormDTO.setName(formDTO.getAgencyName()); |
|
|
|
Result<String> addAreaCodeResult = epmetCommonServiceOpenFeignClient.addAreaCode(addAreaCodeFormDTO); |
|
|
|
if (!addAreaCodeResult.success() || StringUtils.isBlank(addAreaCodeResult.getData())) { |
|
|
@ -192,8 +199,9 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
originalEntity.setParentAreaCode(parent.getAreaCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode()); |
|
|
|
customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode()); |
|
|
|
//更新直属部门和直属网格的areaCode
|
|
|
|
customerGridDao.updateGridAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); |
|
|
|
customerDepartmentDao.updateDeptAreaCode(originalEntity.getId(),formDTO.getAreaCode(),formDTO.getUserId()); |
|
|
|
} |
|
|
|
|
|
|
|
//1:更新当前组织信息
|
|
|
|