Browse Source
# Conflicts: # epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/GovOrgOpenFeignClient.java # epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/feign/fallback/GovOrgOpenFeignClientFallback.javamaster
25 changed files with 644 additions and 24 deletions
@ -0,0 +1,17 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 灵山,联建单位 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 2:38 PM |
|||
*/ |
|||
@Data |
|||
public class LingShanPartyUnitRstDTO { |
|||
|
|||
private String orgName; |
|||
private String longitude; |
|||
private String latitude; |
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class LingShanPartyServiceCenterQtyRstDTO { |
|||
|
|||
/** |
|||
* 名称 |
|||
*/ |
|||
// private String orgId;
|
|||
|
|||
/** |
|||
* 组织类型 |
|||
*/ |
|||
private String orgType; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private Integer qty; |
|||
|
|||
} |
@ -0,0 +1,12 @@ |
|||
package com.epmet.dto.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
@Data |
|||
public class LingShanScreenPartyObjectByTypeRstDTO { |
|||
|
|||
private String orgName; |
|||
private String longitude; |
|||
private String latitude; |
|||
|
|||
} |
@ -0,0 +1,10 @@ |
|||
package com.epmet.resi.partymember.dto.partyOrg.result; |
|||
|
|||
/** |
|||
* @Description 地图中的党员数量分布 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 3:25 PM |
|||
*/ |
|||
public class LingShanPartyMemQtyStatsInOrgRstDTO { |
|||
private String name; |
|||
} |
@ -0,0 +1,25 @@ |
|||
package com.epmet.resi.partymember.dto.partyOrg.result; |
|||
|
|||
import lombok.AllArgsConstructor; |
|||
import lombok.Data; |
|||
import lombok.NoArgsConstructor; |
|||
|
|||
@Data |
|||
@AllArgsConstructor |
|||
@NoArgsConstructor |
|||
public class LingShanPartyOrgAndOtherObjQtyRstDTO { |
|||
/** |
|||
* 党建相关对象类型code |
|||
*/ |
|||
private String partyObjectTypeCode; |
|||
/** |
|||
* 名称 |
|||
*/ |
|||
private String name; |
|||
|
|||
/** |
|||
* 数量 |
|||
*/ |
|||
private Integer value; |
|||
|
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.epmet.resi.partymember.dto.partyOrg.result; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Description 灵山街道:按照党类型查询党相关对象 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 1:16 PM |
|||
*/ |
|||
@Data |
|||
public class LingShanScreenPartyObjectByTypeRstDTO { |
|||
|
|||
private String name; |
|||
private String longitude; |
|||
private String latitude; |
|||
|
|||
private Integer partymemberQty; |
|||
|
|||
} |
@ -0,0 +1,30 @@ |
|||
package com.epmet.resi.partymember.enums; |
|||
|
|||
/** |
|||
* @Description 灵山党建相关对象枚举 |
|||
* @Author wangxianzhang |
|||
* @Time 2023/5/12 1:26 PM |
|||
*/ |
|||
public enum LingShanPartyObjEnums { |
|||
DW("dw", "党委"), |
|||
BRANCH("branch", "支部"), |
|||
PARTY_SERVICE_CENTER("party_service_center", "党群服务中心"), |
|||
PARTY_SERVICE_STATION("party_service_station", "党群服务站"), |
|||
PARTY_UNIT("party_unit", "联建单位"); |
|||
|
|||
private String code; |
|||
private String name; |
|||
|
|||
LingShanPartyObjEnums(String code, String name) { |
|||
this.code = code; |
|||
this.name = name; |
|||
} |
|||
|
|||
public String getCode() { |
|||
return code; |
|||
} |
|||
|
|||
public String getName() { |
|||
return name; |
|||
} |
|||
} |
@ -0,0 +1,13 @@ |
|||
package com.epmet.modules.partyOrg.service; |
|||
|
|||
import com.epmet.commons.tools.utils.Result; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanPartyOrgAndOtherObjQtyRstDTO; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface LingShanPartyOrgService { |
|||
List<LingShanPartyOrgAndOtherObjQtyRstDTO> partyOrgAndOtherObjectQtyStats(String agencyId); |
|||
|
|||
List<LingShanScreenPartyObjectByTypeRstDTO> partyObjsByType(String objType, String orgId, String orgType); |
|||
} |
@ -0,0 +1,189 @@ |
|||
package com.epmet.modules.partyOrg.service.impl; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.epmet.commons.tools.constant.ServiceConstant; |
|||
import com.epmet.commons.tools.enums.OrgLevelEnum; |
|||
import com.epmet.commons.tools.enums.PartyOrgTypeEnum; |
|||
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|||
import com.epmet.commons.tools.exception.EpmetException; |
|||
import com.epmet.commons.tools.feign.ResultDataResolver; |
|||
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; |
|||
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; |
|||
import com.epmet.commons.tools.utils.ConvertUtils; |
|||
import com.epmet.commons.tools.utils.PidUtils; |
|||
import com.epmet.constant.OrgInfoConstant; |
|||
import com.epmet.dto.result.LingShanPartyServiceCenterQtyRstDTO; |
|||
import com.epmet.dto.result.LingShanPartyUnitRstDTO; |
|||
import com.epmet.feign.EpmetHeartOpenFeignClient; |
|||
import com.epmet.feign.GovOrgOpenFeignClient; |
|||
import com.epmet.modules.partyOrg.dao.IcPartyOrgDao; |
|||
import com.epmet.modules.partyOrg.entity.IcPartyOrgEntity; |
|||
import com.epmet.modules.partyOrg.service.LingShanPartyOrgService; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanPartyOrgAndOtherObjQtyRstDTO; |
|||
import com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO; |
|||
import com.epmet.resi.partymember.enums.LingShanPartyObjEnums; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import java.util.ArrayList; |
|||
import java.util.LinkedList; |
|||
import java.util.List; |
|||
import java.util.Map; |
|||
import java.util.function.Function; |
|||
import java.util.stream.Collectors; |
|||
|
|||
@Service |
|||
public class LingShanPartyOrgServiceImpl implements LingShanPartyOrgService, ResultDataResolver { |
|||
|
|||
@Autowired |
|||
private IcPartyOrgDao partyOrgDao; |
|||
|
|||
@Autowired |
|||
private GovOrgOpenFeignClient govOrgOpenFeignClient; |
|||
@Autowired |
|||
private EpmetHeartOpenFeignClient heartOpenFeignClient; |
|||
|
|||
@Override |
|||
public List<LingShanPartyOrgAndOtherObjQtyRstDTO> partyOrgAndOtherObjectQtyStats(String agencyId) { |
|||
|
|||
ArrayList<LingShanPartyOrgAndOtherObjQtyRstDTO> tl = new ArrayList<>(); |
|||
|
|||
// 1.党组织
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(agencyId); |
|||
String orgIdPath = PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids()); |
|||
|
|||
String level = agencyInfo.getLevel(); |
|||
|
|||
LambdaQueryWrapper<IcPartyOrgEntity> q; |
|||
if (OrgLevelEnum.COMMUNITY.getCode().equals(level)) { |
|||
// 社区级别,那直接用agencyId查,因为它下面就只有党支部一级了
|
|||
q = new QueryWrapper<IcPartyOrgEntity>().select(" party_org_type, count(*) childrenQty").lambda() |
|||
// 本组织下级的所有子级
|
|||
.eq(IcPartyOrgEntity::getAgencyId, agencyId) |
|||
.eq(IcPartyOrgEntity::getPartyOrgType, PartyOrgTypeEnum.BRANCH.getCode()) // 是社区,就只能查询支部了。这里要控制,因为支部的行政组织也是对应到社区,所以这里必须限制一下
|
|||
.groupBy(IcPartyOrgEntity::getPartyOrgType); |
|||
} else { |
|||
// 街道及以上级别,用pids,因为要从社区开始查,本级及下级
|
|||
q = new QueryWrapper<IcPartyOrgEntity>().select(" party_org_type, count(*) childrenQty").lambda() |
|||
// 本组织下级的所有子级,不含本级
|
|||
.like(IcPartyOrgEntity::getAgencyPids, orgIdPath) |
|||
.groupBy(IcPartyOrgEntity::getPartyOrgType); |
|||
} |
|||
|
|||
List<IcPartyOrgEntity> es = partyOrgDao.selectList(q); |
|||
List<LingShanPartyOrgAndOtherObjQtyRstDTO> l1 = es.stream().map(e -> { |
|||
LingShanPartyOrgAndOtherObjQtyRstDTO d = new LingShanPartyOrgAndOtherObjQtyRstDTO(); |
|||
d.setPartyObjectTypeCode(e.getPartyOrgType().equals("5") ? LingShanPartyObjEnums.BRANCH.getCode() : LingShanPartyObjEnums.DW.getCode()); |
|||
d.setName(PartyOrgTypeEnum.getEnumByCode(e.getPartyOrgType()).getName()); |
|||
d.setValue(e.getChildrenQty()); |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
|
|||
tl.addAll(l1); |
|||
|
|||
// 2.党群服务中心/站
|
|||
List<LingShanPartyServiceCenterQtyRstDTO> serviceCenters = getResultDataOrReturnNull(govOrgOpenFeignClient.partyServiceCenterQtyStats(agencyId, OrgInfoConstant.AGENCY), ServiceConstant.GOV_ORG_SERVER); |
|||
if (serviceCenters == null) { |
|||
logger.error("【灵山大屏-党组织数量统计】查询党群服务中心失败,返回空"); |
|||
} else { |
|||
List<LingShanPartyOrgAndOtherObjQtyRstDTO> temp = serviceCenters.stream().map(e -> { |
|||
LingShanPartyOrgAndOtherObjQtyRstDTO d = new LingShanPartyOrgAndOtherObjQtyRstDTO(); |
|||
d.setPartyObjectTypeCode(e.getOrgType().equals(OrgInfoConstant.AGENCY) ? LingShanPartyObjEnums.PARTY_SERVICE_CENTER.getCode() : LingShanPartyObjEnums.PARTY_SERVICE_STATION.getCode()); |
|||
d.setName(e.getOrgType().equals(OrgInfoConstant.AGENCY) ? "党群服务中心" : "党群服务站"); |
|||
d.setValue(e.getQty()); |
|||
return d; |
|||
}).collect(Collectors.toList()); |
|||
temp.addAll(temp); |
|||
} |
|||
|
|||
// 3.联建单位
|
|||
Integer partyUnitQty = getResultDataOrReturnNull(heartOpenFeignClient.qtyInAgency(agencyId), ServiceConstant.EPMET_HEART_SERVER); |
|||
tl.add(new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_UNIT.getCode(), "联建单位", partyUnitQty)); |
|||
|
|||
// 4.检查缺项(党委, 支部, 党群服务中心, 党群服务站, 联建单位几项都要有,没有数据则显示0。党代表工作室目前还没开发,开发了也要有)
|
|||
Map<String, LingShanPartyOrgAndOtherObjQtyRstDTO> map = tl.stream().collect(Collectors.toMap(LingShanPartyOrgAndOtherObjQtyRstDTO::getName, Function.identity())); |
|||
|
|||
LinkedList rl = new LinkedList<LingShanPartyOrgAndOtherObjQtyRstDTO>(); |
|||
LingShanPartyOrgAndOtherObjQtyRstDTO dw = map.get("党委"); |
|||
rl.add(dw != null ? dw : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.DW.getCode(), "党委", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO zb = map.get("支部"); |
|||
rl.add(zb != null ? zb : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.BRANCH.getCode(), "支部", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO dqfwzx = map.get("党群服务中心"); |
|||
rl.add(dqfwzx != null ? dqfwzx : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_SERVICE_CENTER.getCode(), "党群服务中心", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO dqfwz = map.get("党群服务站"); |
|||
rl.add(dqfwz != null ? dqfwz : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_SERVICE_STATION.getCode(), "党群服务站", 0)); |
|||
|
|||
LingShanPartyOrgAndOtherObjQtyRstDTO ljdz = map.get("联建单位"); |
|||
rl.add(ljdz != null ? ljdz : new LingShanPartyOrgAndOtherObjQtyRstDTO(LingShanPartyObjEnums.PARTY_UNIT.getCode(), "联建单位", 0)); |
|||
|
|||
return rl; |
|||
} |
|||
|
|||
@Override |
|||
public List<LingShanScreenPartyObjectByTypeRstDTO> partyObjsByType(String objType, String orgId, String orgType) { |
|||
if (LingShanPartyObjEnums.DW.getCode().equals(objType)) { |
|||
// 党委
|
|||
return listDw(orgId, orgType); |
|||
} else if (LingShanPartyObjEnums.BRANCH.getCode().equals(objType)) { |
|||
// 支部
|
|||
return listBranch(orgId, orgType); |
|||
} else if (LingShanPartyObjEnums.PARTY_SERVICE_CENTER.getCode().equals(objType) |
|||
|| LingShanPartyObjEnums.PARTY_SERVICE_STATION.getCode().equals(objType)) { |
|||
// 党群服务中心
|
|||
List<com.epmet.dto.result.LingShanScreenPartyObjectByTypeRstDTO> rsts = |
|||
getResultDataOrReturnNull(govOrgOpenFeignClient.lingshanPartyServiceCenterList(objType, orgId), ServiceConstant.GOV_ORG_SERVER); |
|||
return ConvertUtils.sourceToTarget(rsts, LingShanScreenPartyObjectByTypeRstDTO.class); |
|||
} else if (LingShanPartyObjEnums.PARTY_UNIT.getCode().equals(objType)) { |
|||
// 联建单位
|
|||
List<LingShanPartyUnitRstDTO> rsts = getResultDataOrReturnNull(heartOpenFeignClient.lingshanPartyUnitList(orgId), ServiceConstant.EPMET_HEART_SERVER); |
|||
if (rsts == null) { |
|||
logger.error("【灵山大屏-党建相关对象列表查询】出错,"); |
|||
} |
|||
return ConvertUtils.sourceToTarget(rsts, LingShanScreenPartyObjectByTypeRstDTO.class); |
|||
} else { |
|||
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未知的数据类型"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @Description: 查询党委列表 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @Return java.util.List<com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/12 1:42 PM |
|||
*/ |
|||
List<LingShanScreenPartyObjectByTypeRstDTO> listDw(String orgId, String orgType) { |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
// 是行政组织,就要查询组织的下一级。查询下一级只能用AGENCY_PIDS
|
|||
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId); |
|||
return partyOrgDao.lingshanListDw(PidUtils.convertPid2OrgIdPath(agencyInfo.getId(), agencyInfo.getPids())); |
|||
} else { |
|||
// 是网格,哪里来的党委?
|
|||
return new ArrayList<>(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* @Description: 查询支部。支部是直属的 |
|||
* @param orgId: |
|||
* @param orgType: |
|||
* @Return java.util.List<com.epmet.resi.partymember.dto.partyOrg.result.LingShanScreenPartyObjectByTypeRstDTO> |
|||
* @Author: wangxianzhang |
|||
* @Date: 2023/5/12 1:52 PM |
|||
*/ |
|||
List<LingShanScreenPartyObjectByTypeRstDTO> listBranch(String orgId, String orgType) { |
|||
if (OrgInfoConstant.AGENCY.equals(orgType)) { |
|||
// 是行政组织
|
|||
// AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(orgId);
|
|||
return partyOrgDao.lingshanListZsBranchs(orgId); |
|||
} else { |
|||
// 是网格
|
|||
// 这里应该是有问题。因为查询支部,只能用社区id查,不能用网格id查,party_org里面没有网格相关字段去关联
|
|||
return new ArrayList<>(); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue