|
@ -161,22 +161,24 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
|
|
|
|
|
|
//当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码
|
|
|
//当前客户开启了area_code_switch参数:open: 选择地区编码必填;closed: 无需选择地区编码
|
|
|
if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { |
|
|
if (CustomerAgencyConstant.AREA_CODE_SWITCH_OPEN.equals(formDTO.getAreaCodeSwitch())) { |
|
|
//开关开启后,areaCode必填
|
|
|
CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); |
|
|
String originalAreaCode =originalEntity.getAreaCode(); |
|
|
if (null != parent) { |
|
|
checkEditAgencyFormDTO(formDTO,originalEntity); |
|
|
//开关开启后,areaCode必填
|
|
|
// 1、之前当前组织没有编码,本次修改设置了编码
|
|
|
String originalAreaCode = originalEntity.getAreaCode(); |
|
|
// 2、之前已经有编码,本次修改为了其他编码
|
|
|
checkEditAgencyFormDTO(formDTO, originalEntity); |
|
|
if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalAreaCode)) { |
|
|
// 1、之前当前组织没有编码,本次修改设置了编码
|
|
|
CustomerAgencyEntity parent = customerAgencyDao.selectById(originalEntity.getPid()); |
|
|
// 2、之前已经有编码,本次修改为了其他编码
|
|
|
String newAreaCode=getAgencyNewAreaCode(formDTO,parent); |
|
|
if (StringUtils.isNotBlank(formDTO.getAreaCode()) && !formDTO.getAreaCode().equals(originalAreaCode)) { |
|
|
originalEntity.setAreaCode(newAreaCode); |
|
|
String newAreaCode = getAgencyNewAreaCode(formDTO, parent); |
|
|
originalEntity.setParentAreaCode(parent.getAreaCode()); |
|
|
originalEntity.setAreaCode(newAreaCode); |
|
|
formDTO.setAreaCode(newAreaCode); |
|
|
originalEntity.setParentAreaCode(parent.getAreaCode()); |
|
|
} |
|
|
formDTO.setAreaCode(newAreaCode); |
|
|
//什么时候要全部置为空呢?原来没有现在有 || 原来与现在不一致
|
|
|
} |
|
|
if ((StringUtils.isBlank(originalAreaCode) && StringUtils.isNotBlank(formDTO.getAreaCode())) |
|
|
//什么时候要全部置为空呢?原来没有现在有 || 原来与现在不一致
|
|
|
|| (!formDTO.getAreaCode().equals(originalAreaCode))) { |
|
|
if ((StringUtils.isBlank(originalAreaCode) && StringUtils.isNotBlank(formDTO.getAreaCode())) |
|
|
updateSubOrg(originalEntity.getCustomerId(),formDTO,originalAreaCode); |
|
|
|| (!formDTO.getAreaCode().equals(originalAreaCode))) { |
|
|
|
|
|
updateSubOrg(originalEntity.getCustomerId(), formDTO, originalAreaCode); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -387,27 +389,6 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
agencysResultDTO.setCode(entity.getCode()); |
|
|
agencysResultDTO.setCode(entity.getCode()); |
|
|
agencysResultDTO.setContacts(entity.getContacts()); |
|
|
agencysResultDTO.setContacts(entity.getContacts()); |
|
|
agencysResultDTO.setMobile(entity.getMobile()); |
|
|
agencysResultDTO.setMobile(entity.getMobile()); |
|
|
//2021.5.26 sun 添加当前组织对应客户的根组织级别返参 start
|
|
|
|
|
|
if (null != entity) { |
|
|
|
|
|
if (null == entity.getPids() || "".equals(entity.getPids())) { |
|
|
|
|
|
agencysResultDTO.setRootlevel(entity.getLevel()); |
|
|
|
|
|
} else { |
|
|
|
|
|
String id = Arrays.asList(entity.getPids().split(":")).get(0); |
|
|
|
|
|
CustomerAgencyEntity rootEntity = customerAgencyDao.selectById(id); |
|
|
|
|
|
if (null != rootEntity) { |
|
|
|
|
|
agencysResultDTO.setRootlevel(rootEntity.getLevel()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end
|
|
|
|
|
|
//2:查询本机关的所有上级机关,按自上而下层级顺序
|
|
|
|
|
|
if (StringUtils.isBlank(entity.getPids())) { |
|
|
|
|
|
agencysResultDTO.setParentList(parentList); |
|
|
|
|
|
return new Result<AgencysResultDTO>().ok(agencysResultDTO); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> listStr = Arrays.asList(entity.getPids().split(":")); |
|
|
|
|
|
parentList = customerAgencyDao.selectPAgencyById(listStr); |
|
|
|
|
|
agencysResultDTO.setParentList(parentList); |
|
|
|
|
|
agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId())); |
|
|
agencysResultDTO.setAreaCodeSwitch(customerOrgParameterService.getAreaCodeSwitch(entity.getCustomerId())); |
|
|
agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); |
|
|
agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); |
|
|
agencysResultDTO.setAreaCode(StringUtils.isNotBlank(entity.getAreaCode())?entity.getAreaCode():StrConstant.EPMETY_STR); |
|
|
agencysResultDTO.setAreaCode(StringUtils.isNotBlank(entity.getAreaCode())?entity.getAreaCode():StrConstant.EPMETY_STR); |
|
@ -433,13 +414,30 @@ public class AgencyServiceImpl implements AgencyService { |
|
|
agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); |
|
|
agencysResultDTO.setAreaName(StrConstant.EPMETY_STR); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
//2021.5.26 sun 添加当前组织对应客户的根组织级别返参 start
|
|
|
|
|
|
if (null != entity) { |
|
|
|
|
|
if (null == entity.getPids() || "".equals(entity.getPids())) { |
|
|
|
|
|
agencysResultDTO.setRootlevel(entity.getLevel()); |
|
|
|
|
|
} else { |
|
|
|
|
|
String id = Arrays.asList(entity.getPids().split(":")).get(0); |
|
|
|
|
|
CustomerAgencyEntity rootEntity = customerAgencyDao.selectById(id); |
|
|
|
|
|
if (null != rootEntity) { |
|
|
|
|
|
agencysResultDTO.setRootlevel(rootEntity.getLevel()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
//2021.5.26 sun 添加当前组织对应客户的根组织级别返参 end
|
|
|
|
|
|
//2:查询本机关的所有上级机关,按自上而下层级顺序
|
|
|
|
|
|
if (StringUtils.isBlank(entity.getPids())) { |
|
|
|
|
|
agencysResultDTO.setParentList(parentList); |
|
|
|
|
|
return new Result<AgencysResultDTO>().ok(agencysResultDTO); |
|
|
|
|
|
} |
|
|
|
|
|
List<String> listStr = Arrays.asList(entity.getPids().split(":")); |
|
|
|
|
|
parentList = customerAgencyDao.selectPAgencyById(listStr); |
|
|
|
|
|
agencysResultDTO.setParentList(parentList); |
|
|
return new Result<AgencysResultDTO>().ok(agencysResultDTO); |
|
|
return new Result<AgencysResultDTO>().ok(agencysResultDTO); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public static void main(String[] args) { |
|
|
|
|
|
String m="1234"; |
|
|
|
|
|
System.out.println(m.equals("1234") ? "yes" : "no"); |
|
|
|
|
|
} |
|
|
|
|
|
/** |
|
|
/** |
|
|
* @param formDTO |
|
|
* @param formDTO |
|
|
* @return |
|
|
* @return |
|
|