Browse Source

党组织调整

dev
Jackwang 3 years ago
parent
commit
3e0370d7d6
  1. 5
      epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgTreeByUserAndTypeFormDTO.java
  2. 4
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java
  3. 1
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
  4. 26
      epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgTreeListDTO.java
  5. 12
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java
  6. 34
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java
  7. 3
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java
  8. 53
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java
  9. 10
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java
  10. 26
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml
  11. 5
      epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml

5
epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/form/OrgTreeByUserAndTypeFormDTO.java

@ -24,6 +24,11 @@ public class OrgTreeByUserAndTypeFormDTO implements Serializable {
@NotNull(message ="组织类型不可为空")
private String orgType;
/**
* 客户Id (customer.id)
*/
private String customerId;
private List<String> orgTypeList;
}

4
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerAgencyController.java

@ -321,7 +321,9 @@ public class CustomerAgencyController {
* @return com.epmet.commons.tools.utils.Result<java.util.List<com.epmet.dto.result.PartyOrgTreeResultDTO>>
*/
@GetMapping("getOrgTreeByUserAndType")
Result<List<PartyOrgTreeResultDTO>> getOrgTreeByUserAndType(OrgTreeByUserAndTypeFormDTO formDto){
Result<List<PartyOrgTreeResultDTO>> getOrgTreeByUserAndType(@LoginUser TokenDto tokenDTO,OrgTreeByUserAndTypeFormDTO formDto){
ValidatorUtils.validateEntity(formDto);
formDto.setCustomerId(tokenDTO.getCustomerId());
return customerAgencyService.getOrgTreeByUserAndType(formDto);
}

1
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml

@ -765,6 +765,7 @@
FROM `customer_agency`
where
DEL_FLAG='0'
and CUSTOMER_ID=#{customerId}
and (id=#{agencyId}
or PIDS LIKE concat('%',#{agencyId}, '%' ))
<if test="orgTypeList!=null and orgTypeList.size>0">

26
epmet-module/resi-partymember/resi-partymember-client/src/main/java/com/epmet/resi/partymember/dto/partyOrg/form/PartyOrgTreeListDTO.java

@ -0,0 +1,26 @@
package com.epmet.resi.partymember.dto.partyOrg.form;
import lombok.Data;
import java.io.Serializable;
/**
* @program: epmet-cloud
* @description:
* @author: wangtong
* @create: 2022-05-20 14:04
**/
@Data
public class PartyOrgTreeListDTO implements Serializable {
/**
* 行政组织 机关ID
*/
private String agencyId;
/**
* 客户Id (customer.id)
*/
private String customerId;
}

12
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/controller/IcPartyOrgController.java

@ -1,7 +1,9 @@
package com.epmet.modules.partyOrg.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -12,6 +14,7 @@ import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.modules.partyOrg.excel.IcPartyOrgExcel;
import com.epmet.modules.partyOrg.service.IcPartyOrgService;
import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -48,7 +51,8 @@ public class IcPartyOrgController {
@NoRepeatSubmit
@PostMapping
public Result save(@RequestBody IcPartyOrgDTO dto){
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcPartyOrgDTO dto){
dto.setCustomerId(tokenDto.getCustomerId());
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return icPartyOrgService.save(dto);
@ -63,7 +67,7 @@ public class IcPartyOrgController {
return new Result();
}
@PostMapping("delete")
@DeleteMapping("delete")
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
@ -86,8 +90,8 @@ public class IcPartyOrgController {
* @return com.epmet.commons.tools.utils.Result<com.epmet.commons.tools.page.PageData<com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO>>
*/
@GetMapping("getTreelist")
public Result<List<IcPartyOrgTreeDTO>> getTreelist(IcPartyOrgDTO formDTO){
// ValidatorUtils.validateEntity(formDTO,IcPartyOrgDTO.AddUserInternalGroup.class, PageFormDTO.AddUserInternalGroup.class);
public Result<List<IcPartyOrgTreeDTO>> getTreelist(@LoginUser TokenDto tokenDto,PartyOrgTreeListDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
return icPartyOrgService.getTreelist(formDTO);
}

34
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/dao/IcPartyOrgDao.java

@ -2,9 +2,10 @@ package com.epmet.modules.partyOrg.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity;
import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -24,5 +25,34 @@ public interface IcPartyOrgDao extends BaseDao<IcPartyOrgEntity> {
* @params []
* @return java.util.List<com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO>
*/
List<IcPartyOrgTreeDTO> getTreelist(IcPartyOrgDTO formDTO);
List<IcPartyOrgTreeDTO> getTreelist(PartyOrgTreeListDTO formDTO);
/**
* @describe: 查询跟id相关的所有组织id
* @author wangtong
* @date 2022/5/19 16:14
* @params [id]
* @return java.util.List<com.epmet.modules.partyOrg.entity.IcPartyOrgEntity>
*/
List<IcPartyOrgEntity> selectAllByOrgId(@Param("id") String id);
/**
* @describe: 通过名称或者编码查询
* @author wangtong
* @date 2022/5/20 10:35
* @params [partyOrgName, partyOrgCode]
* @return com.epmet.modules.partyOrg.entity.IcPartyOrgEntity
*/
IcPartyOrgEntity selectByCuIdAndNameOrCode(@Param("partyOrgName") String partyOrgName,
@Param("partyOrgCode") String partyOrgCode,
@Param("customerId") String customerId);
/**
* @describe: 通过行政组织id和类型(不等于)筛选
* @author wangtong
* @date 2022/5/20 10:40
* @params [agencyId, partyOrgType]
* @return com.epmet.modules.partyOrg.entity.IcPartyOrgEntity
*/
IcPartyOrgEntity selectByAgencyId(@Param("agencyId") String agencyId,@Param("partyOrgType") String partyOrgType);
}

3
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/IcPartyOrgService.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity;
import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO;
import java.util.List;
@ -85,5 +86,5 @@ public interface IcPartyOrgService extends BaseService<IcPartyOrgEntity> {
* @params [formDTO]
* @return com.epmet.commons.tools.page.PageData<com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO>
*/
Result<List<IcPartyOrgTreeDTO>> getTreelist(IcPartyOrgDTO formDTO);
Result<List<IcPartyOrgTreeDTO>> getTreelist(PartyOrgTreeListDTO formDTO);
}

53
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partyOrg/service/impl/IcPartyOrgServiceImpl.java

@ -14,13 +14,21 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao;
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity;
import com.epmet.modules.partyOrg.service.IcPartyOrgService;
import com.epmet.modules.partymember.dao.IcPartyMemberDao;
import com.epmet.modules.partymember.entity.IcPartyMemberEntity;
import com.epmet.resi.partymember.dto.partyOrg.IcPartyOrgDTO;
import com.epmet.resi.partymember.dto.partyOrg.form.PartyOrgTreeListDTO;
import com.epmet.resi.partymember.dto.partyOrg.result.IcPartyOrgTreeDTO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* 党组织表
@ -31,6 +39,9 @@ import java.util.*;
@Service
public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPartyOrgEntity> implements IcPartyOrgService {
@Autowired
private IcPartyMemberDao icPartyMemberDao;
@Override
public PageData<IcPartyOrgDTO> page(Map<String, Object> params) {
@ -66,19 +77,34 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart
@Override
@Transactional(rollbackFor = Exception.class)
public Result save(IcPartyOrgDTO dto) {
//同一个客户下,名称和编码不可重复
IcPartyOrgEntity repeatName = baseDao.selectByCuIdAndNameOrCode(dto.getPartyOrgName(),null,dto.getCustomerId());
if(null != repeatName){
return new Result().error("行政组织名称不可重复!");
}
IcPartyOrgEntity repeatCode = baseDao.selectByCuIdAndNameOrCode(null,dto.getPartyOrgCode(),dto.getCustomerId());
if(null != repeatCode){
return new Result().error("行政组织编码不可重复!");
}
//如果不是支部,需要判断行政组织是否重复
if(!PartyOrgTypeEnum.BRANCH.getCode().equals(dto.getPartyOrgType())){
if(StringUtils.isBlank(dto.getAgencyId())){
return new Result().error("组织类型不为支部时,行政组织不可为空");
IcPartyOrgEntity isAgency = baseDao.selectByAgencyId(dto.getAgencyId(),PartyOrgTypeEnum.BRANCH.getCode());
if(null != isAgency){
return new Result().error("该行政组织已被关联!");
}
//判断行政组织是否重复
AgencyInfoCache agency = CustomerOrgRedis.getAgencyInfo(dto.getAgencyId());
dto.setAgencyPids(agency.getPids());
}else{
//类型为支部时,行政组织信息与上级党组织一致
IcPartyOrgEntity parentOrg = baseDao.selectById(dto.getOrgPid());
dto.setAgencyId(parentOrg.getAgencyId());
dto.setAgencyPids(parentOrg.getAgencyPids());
}
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(dto.getAgencyId());
if (null == agencyInfo){
throw new EpmetException("组织信息获取失败");
}
IcPartyOrgEntity entity = ConvertUtils.sourceToTarget(dto, IcPartyOrgEntity.class);
entity.setAgencyPids(agencyInfo.getPids().replaceAll(":",","));
insert(entity);
return new Result();
}
@ -100,11 +126,24 @@ public class IcPartyOrgServiceImpl extends BaseServiceImpl<IcPartyOrgDao, IcPart
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
// baseDao.deleteBatchIds(Arrays.asList(ids));
for(String id : ids){
//判断该组织是否有下级党组织
List<IcPartyOrgEntity> orgList = baseDao.selectAllByOrgId(id);
if(!CollectionUtils.isEmpty(orgList)){
throw new EpmetException("请先删除下级党组织!");
}
//判断该组织下是否有党员
List<IcPartyMemberEntity> memberList = icPartyMemberDao.selectAllByOrgId(id);
if(!CollectionUtils.isEmpty(memberList)){
throw new EpmetException("该组织下有党员信息暂时不可删除!");
}
baseDao.deleteById(id);
}
}
@Override
public Result<List<IcPartyOrgTreeDTO>> getTreelist(IcPartyOrgDTO formDTO) {
public Result<List<IcPartyOrgTreeDTO>> getTreelist(PartyOrgTreeListDTO formDTO) {
List<IcPartyOrgTreeDTO> list = baseDao.getTreelist(formDTO);
return new Result<List<IcPartyOrgTreeDTO>>().ok(build(list));
}

10
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/dao/IcPartyMemberDao.java

@ -5,6 +5,7 @@ import com.epmet.modules.partymember.entity.IcPartyMemberEntity;
import com.epmet.resi.partymember.dto.partymember.form.IcPartyMemberFromDTO;
import com.epmet.resi.partymember.dto.partymember.result.IcPartyMemberResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -25,4 +26,13 @@ public interface IcPartyMemberDao extends BaseDao<IcPartyMemberEntity> {
* @Date 2022/5/18 17:01
*/
List<IcPartyMemberResultDTO> selectList(IcPartyMemberFromDTO formDTO);
/**
* @describe: 查询该组织下的党员信息
* @author wangtong
* @date 2022/5/19 16:20
* @params [orgId]
* @return java.util.List<com.epmet.modules.partymember.entity.IcPartyMemberEntity>
*/
List<IcPartyMemberEntity> selectAllByOrgId(@Param("orgId") String orgId);
}

26
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partyOrg/IcPartyOrgDao.xml

@ -44,10 +44,34 @@
UPDATED_TIME
from ic_party_org
where DEL_FLAG=0
and CUSTOMER_ID=#{customerId}
<if test="agencyId != null and agencyId != ''">
AND (AGENCY_ID = #{agencyId} or FIND_IN_SET(#{agencyId},AGENCY_PIDS))
AND (AGENCY_ID = #{agencyId} or AGENCY_PIDS LIKE concat('%',#{agencyId}, '%' ))
</if>
</select>
<select id="selectAllByOrgId" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
select * from ic_party_org
where DEL_FLAG='0'
AND ORG_PIDS LIKE concat('%',#{orgId}, '%' )
</select>
<select id="selectByCuIdAndNameOrCode" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
select * from ic_party_org
where DEL_FLAG='0'
and CUSTOMER_ID=#{customerId}
<if test="partyOrgName != null and partyOrgName != ''">
AND PARTY_ORG_NAME=#{partyOrgName}
</if>
<if test="partyOrgCode != null and partyOrgCode != ''">
AND PARTY_ORG_CODE=#{partyOrgCode}
</if>
</select>
<select id="selectByAgencyId" resultType="com.epmet.modules.partyOrg.entity.IcPartyOrgEntity">
select * from ic_party_org
where DEL_FLAG='0'
and PARTY_ORG_TYPE!=#{partyOrgType}
and AGENCY_ID =#{agencyId}
</select>
</mapper>

5
epmet-module/resi-partymember/resi-partymember-server/src/main/resources/mapper/partymember/IcPartyMemberDao.xml

@ -126,6 +126,11 @@
</if>
</select>
<select id="selectAllByOrgId" resultType="com.epmet.modules.partymember.entity.IcPartyMemberEntity">
SELECT * FROM `ic_party_member`
where DEL_FLAG='0'
AND (SSZB = #{orgId} or ORG_PIDS LIKE concat('%',#{orgId}, '%' ))
</select>
</mapper>
Loading…
Cancel
Save