|
|
@ -101,24 +101,24 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart |
|
|
|
//同一个客户下,名称和编码不可重复
|
|
|
|
IcPartyOrgEntity repeatName = baseDao.selectByCuIdAndNameOrCode(dto.getPartyOrgName(), null, dto.getCustomerId()); |
|
|
|
if (null != repeatName) { |
|
|
|
throw new EpmetException("行政组织名称不可重复!"); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"partyOrgName重复","行政组织名称不可重复!"); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(dto.getPartyOrgCode())) { |
|
|
|
IcPartyOrgEntity repeatCode = baseDao.selectByCuIdAndNameOrCode(null, dto.getPartyOrgCode(), dto.getCustomerId()); |
|
|
|
if (null != repeatCode) { |
|
|
|
throw new EpmetException("行政组织编码不可重复!"); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"partyOrgCode重复","行政组织编码不可重复!"); |
|
|
|
} |
|
|
|
} |
|
|
|
IcPartyOrgEntity parentOrg = baseDao.selectById(dto.getOrgPid()); |
|
|
|
//判断当前党组织的类型是否是所选上级党组织类型的直接下级
|
|
|
|
if ("0".equals(dto.getOrgPid())) { |
|
|
|
if (PartyOrgTypeEnum.BRANCH.getCode().equals(dto.getPartyOrgType())) { |
|
|
|
throw new EpmetException("支部不可设为一级组织!"); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"支部不可设为一级组织!","支部不可设为一级组织!"); |
|
|
|
} |
|
|
|
//一个客户下只能有一个一级组织
|
|
|
|
IcPartyOrgEntity levelOneOrg = baseDao.selectLevelOneOrgByCustomerId(dto.getCustomerId()); |
|
|
|
if (null != levelOneOrg) { |
|
|
|
throw new EpmetException("当前客户下已存在一级组织,不可重复添加!"); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"当前客户下已存在一级组织,不可重复添加!","当前客户下已存在一级组织,不可重复添加!"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
checkOrgType(parentOrg.getPartyOrgType(), dto.getPartyOrgType()); |
|
|
@ -127,7 +127,7 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart |
|
|
|
if (!PartyOrgTypeEnum.BRANCH.getCode().equals(dto.getPartyOrgType())) { |
|
|
|
IcPartyOrgEntity isAgency = baseDao.selectByAgencyId(dto.getAgencyId(), PartyOrgTypeEnum.BRANCH.getCode()); |
|
|
|
if (null != isAgency) { |
|
|
|
throw new EpmetException("该行政组织已被关联!"); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"该行政组织已被关联!","该行政组织已被关联!"); |
|
|
|
} |
|
|
|
AgencyInfoCache agency = CustomerOrgRedis.getAgencyInfo(dto.getAgencyId()); |
|
|
|
//判断该所选的行政组织类型是否与当前党组织的类型一致
|
|
|
@ -140,7 +140,7 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart |
|
|
|
} |
|
|
|
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(dto.getAgencyId()); |
|
|
|
if (null == agencyInfo) { |
|
|
|
throw new EpmetException("组织信息获取失败"); |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"组织信息获取失败","组织信息获取失败"); |
|
|
|
} |
|
|
|
IcPartyOrgEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyOrgEntity.class); |
|
|
|
insert(entity); |
|
|
|