|
@ -11,6 +11,7 @@ import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
|
|
import com.epmet.enums.OrgLevelEnums; |
|
|
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; |
|
|
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; |
|
|
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; |
|
|
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; |
|
|
import com.epmet.modules.partyOrg.service.IcPartyOrgService; |
|
|
import com.epmet.modules.partyOrg.service.IcPartyOrgService; |
|
@ -88,6 +89,20 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart |
|
|
return new Result().error("行政组织编码不可重复!"); |
|
|
return new Result().error("行政组织编码不可重复!"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
IcPartyOrgEntity parentOrg = baseDao.selectById(dto.getOrgPid()); |
|
|
|
|
|
//判断当前党组织的类型是否是所选上级党组织类型的直接下级
|
|
|
|
|
|
if("0".equals(dto.getOrgPid())){ |
|
|
|
|
|
if(PartyOrgTypeEnum.BRANCH.getCode().equals(dto.getPartyOrgType())){ |
|
|
|
|
|
return new Result().error("支部不可设为一级组织!"); |
|
|
|
|
|
} |
|
|
|
|
|
//一个客户下只能有一个一级组织
|
|
|
|
|
|
IcPartyOrgEntity levelOneOrg = baseDao.selectLevelOneOrgByCustomerId(dto.getCustomerId()); |
|
|
|
|
|
if(null != levelOneOrg){ |
|
|
|
|
|
return new Result().error("当前客户下已存在一级组织,不可重复添加!"); |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
checkOrgType(parentOrg.getPartyOrgType(),dto.getPartyOrgType()); |
|
|
|
|
|
} |
|
|
//如果不是支部,需要判断行政组织是否重复
|
|
|
//如果不是支部,需要判断行政组织是否重复
|
|
|
if(!PartyOrgTypeEnum.BRANCH.getCode().equals(dto.getPartyOrgType())){ |
|
|
if(!PartyOrgTypeEnum.BRANCH.getCode().equals(dto.getPartyOrgType())){ |
|
|
IcPartyOrgEntity isAgency = baseDao.selectByAgencyId(dto.getAgencyId(),PartyOrgTypeEnum.BRANCH.getCode()); |
|
|
IcPartyOrgEntity isAgency = baseDao.selectByAgencyId(dto.getAgencyId(),PartyOrgTypeEnum.BRANCH.getCode()); |
|
@ -95,10 +110,11 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart |
|
|
return new Result().error("该行政组织已被关联!"); |
|
|
return new Result().error("该行政组织已被关联!"); |
|
|
} |
|
|
} |
|
|
AgencyInfoCache agency = CustomerOrgRedis.getAgencyInfo(dto.getAgencyId()); |
|
|
AgencyInfoCache agency = CustomerOrgRedis.getAgencyInfo(dto.getAgencyId()); |
|
|
|
|
|
//判断该所选的行政组织类型是否与当前党组织的类型一致
|
|
|
|
|
|
checnAgencyLevel(agency.getLevel(),dto.getPartyOrgType()); |
|
|
dto.setAgencyPids(agency.getPids()); |
|
|
dto.setAgencyPids(agency.getPids()); |
|
|
}else{ |
|
|
}else{ |
|
|
//类型为支部时,行政组织信息与上级党组织一致
|
|
|
//类型为支部时,行政组织信息与上级党组织一致
|
|
|
IcPartyOrgEntity parentOrg = baseDao.selectById(dto.getOrgPid()); |
|
|
|
|
|
dto.setAgencyId(parentOrg.getAgencyId()); |
|
|
dto.setAgencyId(parentOrg.getAgencyId()); |
|
|
dto.setAgencyPids(parentOrg.getAgencyPids()); |
|
|
dto.setAgencyPids(parentOrg.getAgencyPids()); |
|
|
} |
|
|
} |
|
@ -111,6 +127,48 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart |
|
|
return new Result(); |
|
|
return new Result(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @describe: 判断当前党组织的类型是否是所选上级党组织类型的直接下级 |
|
|
|
|
|
* @author wangtong |
|
|
|
|
|
* @date 2022/5/25 10:09 |
|
|
|
|
|
* @params [parentOrg, partyOrgType] |
|
|
|
|
|
* @return void |
|
|
|
|
|
*/ |
|
|
|
|
|
private void checkOrgType(String parentOrgType, String partyOrgType) { |
|
|
|
|
|
if(PartyOrgTypeEnum.BRANCH.getCode().equals(partyOrgType) && !PartyOrgTypeEnum.PARTY.getCode().equals(parentOrgType)){ |
|
|
|
|
|
throw new EpmetException("请保持上级党组织的类型与当前党组织类型为直接的上下级关系,选择党委作为上级组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.PARTY.getCode().equals(partyOrgType) && !PartyOrgTypeEnum.WORKING.getCode().equals(parentOrgType)){ |
|
|
|
|
|
throw new EpmetException("请保持上级党组织的类型与当前党组织类型为直接的上下级关系,选择党工委作为上级组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.WORKING.getCode().equals(partyOrgType) && !PartyOrgTypeEnum.DISTRICT.getCode().equals(parentOrgType)){ |
|
|
|
|
|
throw new EpmetException("请保持上级党组织的类型与当前党组织类型为直接的上下级关系,选择区委作为上级组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.DISTRICT.getCode().equals(partyOrgType) && !PartyOrgTypeEnum.MUNICIPAL.getCode().equals(parentOrgType)){ |
|
|
|
|
|
throw new EpmetException("请保持上级党组织的类型与当前党组织类型为直接的上下级关系,选择市委作为上级组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.MUNICIPAL.getCode().equals(partyOrgType) && !PartyOrgTypeEnum.PROVINCIAL.getCode().equals(parentOrgType)){ |
|
|
|
|
|
throw new EpmetException("请保持上级党组织的类型与当前党组织类型为直接的上下级关系,选择省委作为上级组织!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @describe: 判断该所选的行政组织类型是否与当前党组织的类型一致 |
|
|
|
|
|
* @author wangtong |
|
|
|
|
|
* @date 2022/5/25 9:45 |
|
|
|
|
|
* @params [agencyLevel, partyOrgType] |
|
|
|
|
|
* @return void |
|
|
|
|
|
*/ |
|
|
|
|
|
private void checnAgencyLevel(String agencyLevel, String partyOrgType) { |
|
|
|
|
|
if(PartyOrgTypeEnum.PROVINCIAL.getCode().equals(partyOrgType) && !OrgLevelEnums.PROVINCE.getLevel().equals(agencyLevel)){ |
|
|
|
|
|
throw new EpmetException("请保持党组织类型与行政组织类型一致,选择省级的行政组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.PROVINCIAL.getCode().equals(partyOrgType) && !OrgLevelEnums.CITY.getLevel().equals(agencyLevel)){ |
|
|
|
|
|
throw new EpmetException("请保持党组织类型与行政组织类型一致,选择市级的行政组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.PROVINCIAL.getCode().equals(partyOrgType) && !OrgLevelEnums.DISTRICT.getLevel().equals(agencyLevel)){ |
|
|
|
|
|
throw new EpmetException("请保持党组织类型与行政组织类型一致,选择区级的行政组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.PROVINCIAL.getCode().equals(partyOrgType) && !OrgLevelEnums.STREET.getLevel().equals(agencyLevel)){ |
|
|
|
|
|
throw new EpmetException("请保持党组织类型与行政组织类型一致,选择街道级的行政组织!"); |
|
|
|
|
|
}else if(PartyOrgTypeEnum.PROVINCIAL.getCode().equals(partyOrgType) && !OrgLevelEnums.COMMUNITY.getLevel().equals(agencyLevel)){ |
|
|
|
|
|
throw new EpmetException("请保持党组织类型与行政组织类型一致,选择社区级的行政组织!"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void update(IcPartyOrgDTO dto) { |
|
|
public void update(IcPartyOrgDTO dto) { |
|
|