diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java index 478e7d4376..e1fa6b1456 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java @@ -18,7 +18,8 @@ public enum DictTypeEnum { GENDER("gender", "性别", 8), USER_DEMAND_STATUS("user_demand_status", "居民需求状态",8), USER_DEMAND_REPORT_TYPE("user_demand_report_type","居民需求上报类型",9), - USER_DEMAND_SERVICE_TYPE("user_demand_service_type","居民需求服务方类型",10) + USER_DEMAND_SERVICE_TYPE("user_demand_service_type","居民需求服务方类型",10), + AGE_GROUP("age_group", "年龄范围", 11), ; private final String code; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java index c07037ee92..d99c772f8b 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java @@ -113,4 +113,9 @@ public class IssueProjectCategoryDictDTO implements Serializable { */ private Date updatedTime; + /** + * 颜色 + */ + private String colour; + } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java index 67c82fee00..a029bb6f00 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java @@ -80,4 +80,9 @@ public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { */ private String isDisable; + /** + * 颜色 + */ + private String colour; + } diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CategoryAnalysisFormDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CategoryAnalysisFormDTO.java new file mode 100644 index 0000000000..f4e792f75e --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CategoryAnalysisFormDTO.java @@ -0,0 +1,42 @@ +package com.epmet.dto.form.demand; + +import com.epmet.commons.tools.validator.group.CustomerClientShowGroup; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + + + +/** + * 服务措施分析-柱状图入参 + */ +@Data +public class CategoryAnalysisFormDTO implements Serializable { + + public interface AddUserInternalGroup { + } + + public interface AddUserShowGroup extends CustomerClientShowGroup { + } + + @NotBlank(message = "先选择组织或网格", groups = AddUserShowGroup.class) + private String orgId; + @NotBlank(message = "组织或网格的上级", groups = PageListAnalysisFormDTO.AddUserShowGroup.class) + private String pid; + @NotBlank(message = "组织:agency,网格:grid", groups = AddUserShowGroup.class) + private String orgType; + @NotBlank(message = "起止日期不能为空,格式yyyyMMdd", groups = AddUserShowGroup.class) + private String startDateId; + @NotBlank(message = "截止日期不能为空,格式yyyyMMdd", groups = AddUserShowGroup.class) + private String endDateId; + + @NotBlank(message = "先选择组织或网格", groups = AddUserInternalGroup.class) + private String cusotmerId; + + + /** + * orgType=agency时pid拼接上orgId + */ + private String gridPids; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDTO.java new file mode 100644 index 0000000000..fc7a8eaad8 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result.demand; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CategoryAnalysisDTO implements Serializable { + private static final long serialVersionUID = 3007202497989446585L; + private String categoryCode; + private String categoryName; + private Integer total; + private List detail; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDetail.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDetail.java new file mode 100644 index 0000000000..c082d11074 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDetail.java @@ -0,0 +1,32 @@ +package com.epmet.dto.result.demand; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CategoryAnalysisDetail implements Serializable { + private static final long serialVersionUID = -4606305611297470078L; + /** + * 区域党建单位:party_unit; + * 社会组织:social_org; + * 社区自组织:community_org; + * 志愿者:volunteer; + * 未完成:unfinished + */ + private String legendCode; + + /** + * 服务方类型名称 + */ + private String legendName; + + /** + * 服务方的个数 + */ + private Integer totalService; + /** + * 需求个数 + */ + private Integer serviceDemandTotal; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisResDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisResDTO.java new file mode 100644 index 0000000000..1b39a2befd --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisResDTO.java @@ -0,0 +1,17 @@ +package com.epmet.dto.result.demand; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +@Data +@AllArgsConstructor +@NoArgsConstructor +public class CategoryAnalysisResDTO implements Serializable { + private static final long serialVersionUID = -3112952115061180189L; + private List legend; + private List categoryList; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryDetailDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryDetailDTO.java new file mode 100644 index 0000000000..9e2802362a --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryDetailDTO.java @@ -0,0 +1,11 @@ +package com.epmet.dto.result.demand; + +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CategoryDetailDTO extends CategoryAnalysisDetail implements Serializable { + private static final long serialVersionUID = 4459219163308113201L; + private String categoryCode; +} diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/LegendDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/LegendDTO.java new file mode 100644 index 0000000000..e1f6c9b282 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/LegendDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.result.demand; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * 服务措施分析-柱状图 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +public class LegendDTO implements Serializable { + private static final long serialVersionUID = 7205666632591639499L; + /** + * 区域党建单位:party_unit; + * 社会组织:social_org; + * 社区自组织:community_org; + * 志愿者:volunteer; + * 未完成:unfinished + */ + private String legendCode; + private String legendName; +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java index 666243eee0..08a28e2f25 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java @@ -257,4 +257,18 @@ public class IcUserDemandRecController { } return new Result(); } + + /** + * 数据分析-服务措施分析-柱状图 + * + * @return + */ + @PostMapping("category-analysis") + public Result categoryAnalysis(@LoginUser TokenDto tokenDto,@RequestBody CategoryAnalysisFormDTO formDTO){ + formDTO.setCusotmerId(tokenDto.getCustomerId()); + ValidatorUtils.validateEntity(formDTO,CategoryAnalysisFormDTO.AddUserShowGroup.class,CategoryAnalysisFormDTO.AddUserInternalGroup.class); + return new Result().ok(icUserDemandRecService.categoryAnalysis(formDTO)); + } + + } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java index aa7c3c68c1..1dfaf2cb85 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java @@ -21,8 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.demand.IcResiUserDemandFromDTO; import com.epmet.dto.form.demand.PageListAnalysisFormDTO; import com.epmet.dto.form.demand.UserDemandPageFormDTO; -import com.epmet.dto.result.demand.DemandRecResultDTO; -import com.epmet.dto.result.demand.IcResiUserReportDemandRes; +import com.epmet.dto.result.demand.*; import com.epmet.entity.IcUserDemandRecEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -65,4 +64,21 @@ public interface IcUserDemandRecDao extends BaseDao { * @return */ List pageListAnalysis(PageListAnalysisFormDTO formDTO); + + + List selectDetail(@Param("categoryCode") String categoryCode, + @Param("orgType") String orgType, + @Param("orgId") String orgId, + @Param("gridPids") String gridPids, + @Param("customerId") String customerId, + @Param("startDateId") String startDateId, + @Param("endDateId") String endDateId); + + List selectListCategoryAnalysisDTO(@Param("firstCategoryList") List firstCategoryList, + @Param("customerId") String customerId, + @Param("orgId") String orgId, + @Param("orgType") String orgType, + @Param("gridPids") String gridPids, + @Param("startDateId") String startDateId, + @Param("endDateId") String endDateId); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java index 685261ec33..1ffeca3931 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.service.BaseService; import com.epmet.commons.tools.page.PageData; import com.epmet.dto.IcUserDemandRecDTO; import com.epmet.dto.form.demand.*; +import com.epmet.dto.result.demand.CategoryAnalysisResDTO; import com.epmet.dto.result.demand.DemandRecResultDTO; import com.epmet.dto.result.demand.DemandResearchAnalysisResultDTO; import com.epmet.dto.result.demand.IcResiUserReportDemandRes; @@ -161,4 +162,11 @@ public interface IcUserDemandRecService extends BaseService pageListAnalysis(PageListAnalysisFormDTO formDTO); + + /** + * 数据分析-服务措施分析-柱状图 + * + * @return + */ + CategoryAnalysisResDTO categoryAnalysis(CategoryAnalysisFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java index 336c60f7be..10aa4239a9 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java @@ -415,7 +415,15 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl distribution(PartyActivityFormDTO formDTO) { - return baseDao.getDistribution(formDTO.getAgencyId()); + Result> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode()); + List list = baseDao.getDistribution(formDTO.getAgencyId()); + if (CollectionUtils.isEmpty(list)) { + return Collections.emptyList(); + } + list.forEach(item -> { + item.setType(unitTypeMap.getData().get(item.getType())); + }); + return list; } private String getServiceMatter(Map map, String matter) { diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java index 51bc5fc35c..8446c84103 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java @@ -17,6 +17,7 @@ package com.epmet.service.impl; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; @@ -45,9 +46,7 @@ import com.epmet.dto.form.demand.*; import com.epmet.dto.result.AllGridsByUserIdResultDTO; import com.epmet.dto.result.IcResiUserBriefDTO; import com.epmet.dto.result.UserBaseInfoResultDTO; -import com.epmet.dto.result.demand.DemandRecResultDTO; -import com.epmet.dto.result.demand.DemandResearchAnalysisResultDTO; -import com.epmet.dto.result.demand.IcResiUserReportDemandRes; +import com.epmet.dto.result.demand.*; import com.epmet.entity.*; import com.epmet.feign.EpmetAdminOpenFeignClient; import com.epmet.feign.EpmetUserOpenFeignClient; @@ -56,6 +55,7 @@ import com.epmet.service.IcResiDemandDictService; import com.epmet.service.IcUserDemandRecService; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -73,6 +73,7 @@ import java.util.stream.Collectors; * @author generator generator@elink-cn.com * @since v1.0.0 2021-11-19 */ +@Slf4j @Service public class IcUserDemandRecServiceImpl extends BaseServiceImpl implements IcUserDemandRecService { @Autowired @@ -239,9 +240,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl userInfoMap=new HashMap<>(); - List userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toList()); + Set userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); if(CollectionUtils.isNotEmpty(userIdList)){ - Result> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + Result> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ throw new RenException("查询志愿者信息异常"); } @@ -654,9 +655,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl userInfoMap=new HashMap<>(); - List userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toList()); + Set userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet()); if(CollectionUtils.isNotEmpty(userIdList)){ - Result> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList); + Result> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(userIdList)); if(!userInfoRes.success()||CollectionUtils.isEmpty(userInfoRes.getData())){ throw new RenException("查询志愿者信息异常"); } @@ -696,6 +697,121 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl(list, total); } + /** + * 数据分析-服务措施分析-柱状图 + * + * @param formDTO + * @return + */ + @Override + public CategoryAnalysisResDTO categoryAnalysis(CategoryAnalysisFormDTO formDTO) { + //1、一级分类字典,没有分类直接退出 + SubCodeFormDTO subCodeFormDTO=new SubCodeFormDTO(); + subCodeFormDTO.setCustomerId(formDTO.getCusotmerId()); + subCodeFormDTO.setParentCategoryCode(NumConstant.ZERO_STR); + List firstCategoryList=demandDictService.querySubCodeList(subCodeFormDTO); + if(CollectionUtils.isEmpty(firstCategoryList)){ + return new CategoryAnalysisResDTO(Collections.EMPTY_LIST,Collections.EMPTY_LIST); + } + //2、没有服务类型直接退出 + Result> serviceTypeRes=adminOpenFeignClient.dictMap(DictTypeEnum.USER_DEMAND_SERVICE_TYPE.getCode()); + if(!serviceTypeRes.success()||MapUtils.isEmpty(serviceTypeRes.getData())){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"查询服务方类型异常,请检查是否已经配置字典信息"); + } + List legend=new ArrayList<>(); + serviceTypeRes.getData().forEach((code,name)->{ + LegendDTO legendDTO=new LegendDTO(code,name); + legend.add(legendDTO); + }); + LegendDTO unfinishLegend = new LegendDTO("unfinished", "未完成"); + legend.add(unfinishLegend); + + log.info("阶段性胜利1:"+ JSON.toJSONString(legend)); + // 3、传进来的是组织id的话,查询出全路径 + if("agency".equals(formDTO.getOrgType())){ + if(NumConstant.ZERO_STR.equals(formDTO.getPid())){ + //当前传入的组织id=客户的根组织 + formDTO.setGridPids(formDTO.getOrgId()); + }else{ + //找到当前组织的所有上级,再拼接上自己 + Result customerAgencyDTOResult=govOrgOpenFeignClient.getAgencyById(formDTO.getOrgId()); + if(!customerAgencyDTOResult.success()||null==customerAgencyDTOResult.getData()){ + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取组织信息异常govOrgOpenFeignClient.getAgencyById"); + } + formDTO.setGridPids(customerAgencyDTOResult.getData().getPids().concat(StrConstant.COLON).concat(formDTO.getOrgId())); + } + } + + //4、构造最后的反参 + List list=new ArrayList<>(); + // firstCategoryList是所有的一级分类字典 + firstCategoryList.forEach(firstCategory->{ + CategoryAnalysisDTO categoryAnalysisDTO=new CategoryAnalysisDTO(firstCategory.getValue(),firstCategory.getLabel(),NumConstant.ZERO,Collections.EMPTY_LIST); + categoryAnalysisDTO.setDetail(constructDefaultDetail(legend)); + list.add(categoryAnalysisDTO); + }); + + log.info("阶段性胜利2:"+ JSON.toJSONString(list)); + + // 5、查询出有数据的一级分类,sql计算出detail + List haveDemandList=baseDao.selectListCategoryAnalysisDTO(firstCategoryList, + formDTO.getCusotmerId(), + formDTO.getOrgId(), + formDTO.getOrgType(), + formDTO.getGridPids(), + formDTO.getStartDateId(), + formDTO.getEndDateId()); + if(!CollectionUtils.isEmpty(haveDemandList)){ + log.info("阶段性胜利3:"+ JSON.toJSONString(haveDemandList)); + Map map = haveDemandList.stream().filter(temp -> CollectionUtils.isNotEmpty(temp.getDetail())).collect(Collectors.toMap(CategoryAnalysisDTO::getCategoryCode, dto -> dto)); + if(MapUtils.isNotEmpty(map)){ + log.info("阶段性胜利4:"+ JSON.toJSONString(map)); + for(CategoryAnalysisDTO result:list){ + if (map.containsKey(result.getCategoryCode()) && null != map.get(result.getCategoryCode())) { + //如果当前分类下有上报的需求,将原来的0改为实际的需求数量 + CategoryAnalysisDTO tempDto=map.get(result.getCategoryCode()); + result.setTotal(tempDto.getTotal()); + + //当前分类有居民的明细:未完成多少个,xxx个志愿者完成xxx个需求 + if(CollectionUtils.isNotEmpty(tempDto.getDetail())){ + List resDetailList=tempDto.getDetail(); + Map detailMap = resDetailList.stream().collect(Collectors.toMap(CategoryAnalysisDetail::getLegendCode, dto -> dto)); + + //遍历之前构造好的图例 + for(CategoryAnalysisDetail resultDetail:result.getDetail()){ + if(detailMap.containsKey(resultDetail.getLegendCode())&&null!=detailMap.get(resultDetail.getLegendCode())){ + resultDetail.setTotalService(detailMap.get(resultDetail.getLegendCode()).getTotalService()); + resultDetail.setServiceDemandTotal(detailMap.get(resultDetail.getLegendCode()).getServiceDemandTotal()); + } + } + + } + + } + + } + + } + + } + + //返回结果,也不知道对不对 + CategoryAnalysisResDTO result=new CategoryAnalysisResDTO(); + result.setLegend(legend); + result.setCategoryList(list); + return result; + } + + private List constructDefaultDetail(List legend) { + List l = new ArrayList<>(); + legend.forEach(legendDTO -> { + CategoryAnalysisDetail d = ConvertUtils.sourceToTarget(legendDTO, CategoryAnalysisDetail.class); + d.setServiceDemandTotal(NumConstant.ZERO); + d.setTotalService(NumConstant.ZERO); + l.add(d); + }); + return l; + } } \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml index 804ddac6d6..eff843c279 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml @@ -261,4 +261,99 @@ order by r.WANT_SERVICE_TIME desc,r.REPORT_TIME asc + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java index a93a616cbf..83920372a1 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java @@ -113,4 +113,9 @@ public class IssueProjectCategoryDictDTO implements Serializable { */ private Date updatedTime; + /** + * 颜色 + */ + private String colour; + } \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java index 72da12a996..c2c0960c0a 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java @@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; /** * @Author zxc @@ -72,7 +74,7 @@ public class ResiBuzzDTO implements Serializable { /** * 分类名字 */ - private String categoryName; + private List categoryName; public ResiBuzzDTO() { this.createdBy = ""; @@ -86,6 +88,13 @@ public class ResiBuzzDTO implements Serializable { this.oppositionCount = NumConstant.ZERO; this.voteAccount = ""; this.issueOriginator = ""; - this.categoryName = "其他"; + this.categoryName = getDefaultCategoryName(); + } + + @JsonIgnore + public List getDefaultCategoryName(){ + List list = new ArrayList<>(); + list.add("其他"); + return list; } } diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java index 7349b7967b..c55641f333 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java @@ -1,6 +1,7 @@ package com.epmet.dto.result; import com.epmet.commons.tools.constant.NumConstant; +import com.fasterxml.jackson.annotation.JsonIgnore; import lombok.Data; import java.io.Serializable; @@ -23,6 +24,7 @@ public class ResiBuzzLeftPieChartResultDTO implements Serializable { /** * 分类编码 */ + @JsonIgnore private String categoryCode; /** diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java index d81143c74c..a853364839 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java @@ -234,7 +234,7 @@ public interface IssueDao extends BaseDao { * @author zxc * @date 2021/12/8 4:08 下午 */ - List selectIssueLimit50(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("status")String status); + List selectIssueLimit50(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("status")String status,@Param("length")Integer length); /** * @Description 查询客户下1级分类的长度 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java index b99f37a2bf..7481f4f4ed 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java @@ -83,4 +83,9 @@ public class IssueProjectCategoryDictEntity extends BaseEpmetEntity { */ private String isDisable; + /** + * 颜色 + */ + private String colour; + } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 3111b567b0..4e7a09fd26 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -1586,7 +1586,8 @@ public class IssueServiceImpl extends BaseServiceImpl imp formDTO.setOrgId(staffInfo.getAgencyId()); formDTO.setOrgType(IssueConstant.ISSUE_AGENCY); } - PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectIssueLimit50(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStatus())); + Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId()); + PageInfo pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectIssueLimit50(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStatus(),length)); List list = pageInfo.getList(); if (CollectionUtils.isEmpty(list)){ return new ResiBuzzResultDTO(); diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml index 827f52b774..8a81f0ab47 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml @@ -579,22 +579,39 @@ - SELECT i.ID AS issueId, - i.ISSUE_TITLE, - i.SUGGESTION, - i.CREATED_BY, + i.ISSUE_TITLE AS issueTitle, + i.SUGGESTION AS suggestion, + i.CREATED_BY AS createdBy, (CASE WHEN i.ISSUE_STATUS = 'shift_project' THEN '已转项目' WHEN i.ISSUE_STATUS = 'voting' THEN '表决中' WHEN i.ISSUE_STATUS = 'closed' THEN '已关闭' ELSE '表决中' END ) AS `status`, - i.CREATED_TIME, - s.SUPPORT_COUNT, - s.OPPOSITION_COUNT, - CONCAT(s.SUPPORT_COUNT + s.OPPOSITION_COUNT,'/',s.VOTABLE_COUNT) AS voteAccount + i.CREATED_TIME AS createdTime, + s.SUPPORT_COUNT AS supportCount, + s.OPPOSITION_COUNT AS oppositionCount, + CONCAT(s.SUPPORT_COUNT + s.OPPOSITION_COUNT,'/',s.VOTABLE_COUNT) AS voteAccount, + cd.CATEGORY_NAME as cn FROM issue i LEFT JOIN issue_vote_statistical s ON (s.ISSUE_ID = i.ID AND s.DEL_FLAG = '0') + LEFT JOIN issue_category ic ON (ic.ISSUE_ID = i.ID AND ic.DEL_FLAG = '0' AND ic.CUSTOMER_ID = i.CUSTOMER_ID) + LEFT JOIN issue_project_category_dict cd ON (cd.CATEGORY_CODE = LEFT(ic.CATEGORY_CODE,#{length}) AND cd.DEL_FLAG = '0' AND cd.CUSTOMER_ID = ic.CUSTOMER_ID) WHERE i.DEL_FLAG = '0' AND i.ISSUE_STATUS = #{status} diff --git a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDistributionAnalysisRightResultDTO.java b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDistributionAnalysisRightResultDTO.java index 5b52084e9d..fb56a9f178 100644 --- a/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDistributionAnalysisRightResultDTO.java +++ b/epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDistributionAnalysisRightResultDTO.java @@ -19,23 +19,18 @@ public class ProjectDistributionAnalysisRightResultDTO implements Serializable { /** * ..以上 */ - private String under; + private Integer under; - /** - * 中间区间 - */ - private String middle; /** * ..以下 */ - private String above; + private Integer above; private List list; public ProjectDistributionAnalysisRightResultDTO() { - this.under = ""; - this.middle = ""; - this.above = ""; + this.under = null; + this.above = null; this.list = new ArrayList<>(); } } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 59e08ee55a..13b710ec7f 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -2830,7 +2830,7 @@ public class ProjectServiceImpl extends BaseServiceImpl allCount = orgList.stream().map(m -> m.getCount()).collect(Collectors.toList()); Integer max = Collections.max(allCount); Integer min = Collections.min(allCount); if (orgList.size() == NumConstant.ONE || max.compareTo(min) == NumConstant.ZERO){ - result.setUnder(orgList.get(NumConstant.ZERO).getCount().toString()); + result.setUnder(orgList.get(NumConstant.ZERO).getCount()); return result; } - Integer minRange = min + ((max - min) / NumConstant.THREE); - Integer maxRange = min + ((max - min) * NumConstant.TWO / NumConstant.THREE); - result.setUnder(minRange.toString().concat("以下")); - result.setMiddle(minRange.toString().concat("-").concat(maxRange.toString())); - result.setAbove(maxRange.toString().concat("以上")); + result.setUnder(min + ((max - min) / NumConstant.THREE)); + result.setAbove(min + ((max - min) * NumConstant.TWO / NumConstant.THREE)); return result; } diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java index c3b2805d9c..3d453ea38c 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java @@ -68,6 +68,10 @@ public class IcFormServiceImpl extends BaseServiceImpl private IcFormItemGroupDao icFormItemGroupDao; @Autowired private IcFormQueryBuilderDao icFormQueryBuilderDao; + @Autowired + private IcResiCategoryStatsConfigDao icResiCategoryStatsConfigDao; + @Autowired + private IcResiCategoryWarnConfigDao icResiCategoryWarnConfigDao; /** * 获取居民信息表单 @@ -145,6 +149,10 @@ public class IcFormServiceImpl extends BaseServiceImpl defaultIcForm.setId(newFormId); defaultIcForm.setCustomerId(customerId); defaultIcForm.setAreaCode(areaCode); + defaultIcForm.setCreatedBy("init_user"); + defaultIcForm.setCreatedTime(new Date()); + defaultIcForm.setUpdatedBy("init_user"); + defaultIcForm.setUpdatedTime(new Date()); int insert = baseDao.insert(defaultIcForm); log.info("insert icForm:" + insert); @@ -163,7 +171,10 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setFormId(newFormId); item.setAreaCode(areaCode); item.setParentItemId(newPrefixed + item.getParentItemId()); - item.setItemGroupId(newPrefixed + item.getItemGroupId()); + //分组Id 为0 说明不村子分组 则直接不设置 仍然为0 + if (!NumConstant.ZERO_STR.equals(item.getItemGroupId())){ + item.setItemGroupId(newPrefixed + item.getItemGroupId()); + } String optionSourceValue = item.getOptionSourceValue(); if (StringUtils.isNotBlank(optionSourceValue) && optionSourceValue.contains(StrConstant.QUESTION_MARK)){ //多个参数 @@ -173,6 +184,10 @@ public class IcFormServiceImpl extends BaseServiceImpl } item.setOptionSourceValue(optionSourceValue); } + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("item:"+ JSON.toJSONString(item)); icFormItemDao.insert(item); }); @@ -186,6 +201,10 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setCustomerId(customerId); item.setFormId(newFormId); item.setItemId(newPrefixed + item.getItemId()); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("option:"+ JSON.toJSONString(item)); icFormItemOptionsDao.insert(item); }); @@ -198,6 +217,10 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setId(newPrefixed + item.getId()); item.setCustomerId(customerId); item.setFormId(newFormId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("group:"+ JSON.toJSONString(item)); icFormItemGroupDao.insert(item); }); @@ -210,10 +233,42 @@ public class IcFormServiceImpl extends BaseServiceImpl item.setId(newPrefixed + item.getId()); item.setCustomerId(customerId); item.setFormItemId(newPrefixed + item.getFormItemId()); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); log.debug("query:"+ JSON.toJSONString(item)); icFormQueryBuilderDao.insert(item); }); + LambdaQueryWrapper wrapperStats = new LambdaQueryWrapper<>(); + wrapperStats.eq(IcResiCategoryStatsConfigEntity::getCustomerId, defaultCustomerId); + List statsConfigList = icResiCategoryStatsConfigDao.selectList(wrapperStats); + statsConfigList.forEach(item -> { + item.setId(newPrefixed + item.getId()); + item.setCustomerId(customerId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); + log.debug("stats:"+ JSON.toJSONString(item)); + icResiCategoryStatsConfigDao.insert(item); + }); + + LambdaQueryWrapper wrapperWarn = new LambdaQueryWrapper<>(); + wrapperWarn.eq(IcResiCategoryWarnConfigEntity::getCustomerId, defaultCustomerId); + List warnConfigList = icResiCategoryWarnConfigDao.selectList(wrapperWarn); + warnConfigList.forEach(item -> { + item.setId(newPrefixed + item.getId()); + item.setCustomerId(customerId); + item.setCreatedBy("init_user"); + item.setCreatedTime(new Date()); + item.setUpdatedBy("init_user"); + item.setUpdatedTime(new Date()); + log.debug("stats:"+ JSON.toJSONString(item)); + icResiCategoryWarnConfigDao.insert(item); + }); + return "初始化成功!客户ID:" + customerId + " formCode:" + formCode; } } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberListFormDTO.java new file mode 100644 index 0000000000..a6ffad6477 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberListFormDTO.java @@ -0,0 +1,24 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/12/10 15:49 + */ +@Data +public class PartyMemberListFormDTO implements Serializable { + + private static final long serialVersionUID = -6085134769034337175L; + @NotBlank(message = "组织类型不能为空") + private String orgType; + @NotBlank(message = "组织ID不能为空") + private String orgId; + private String code; + private Integer pageNo = 1; + private Integer pageSize = 20; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberStatisticsFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberStatisticsFormDTO.java new file mode 100644 index 0000000000..a5bb86915f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberStatisticsFormDTO.java @@ -0,0 +1,20 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/12/10 15:46 + */ +@Data +public class PartyMemberStatisticsFormDTO implements Serializable { + private static final long serialVersionUID = 1027174449735636944L; + @NotBlank(message = "组织类型不能为空") + private String orgType; + @NotBlank(message = "组织ID不能为空") + private String orgId; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberAgeResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberAgeResultDTO.java new file mode 100644 index 0000000000..85b0ced524 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberAgeResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/12/10 17:05 + */ +@Data +public class PartyMemberAgeResultDTO implements Serializable { + private static final long serialVersionUID = 3421162784157903637L; + private String userId; + private String name; + private String age; + private String mobile; +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberEducationResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberEducationResultDTO.java new file mode 100644 index 0000000000..421d0139a3 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberEducationResultDTO.java @@ -0,0 +1,19 @@ +package com.epmet.dto.result; + +import lombok.Data; + +import java.io.Serializable; + +/** + * @Description + * @Author zhaoqifeng + * @Date 2021/12/10 17:07 + */ +@Data +public class PartyMemberEducationResultDTO implements Serializable { + private static final long serialVersionUID = -5042362121277863249L; + private String userId; + private String name; + private String education; + private String mobile; +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java index d89449515e..0ccc740ea1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java @@ -27,6 +27,7 @@ import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.RenException; @@ -506,6 +507,58 @@ public class IcResiUserController { return new Result>().ok(icResiUserService.queryDemandUsers(formDTO)); } + /** + * 党员年龄范围统计 + * @Param formDTO + * @Return {@link Result< List< OptionDataResultDTO >>} + * @Author zhaoqifeng + * @Date 2021/12/10 15:52 + */ + @PostMapping("partymemberagestatistics") + public Result> partyMemberAgeStatistics(@RequestBody PartyMemberStatisticsFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(icResiUserService.partyMemberAgeStatistics(formDTO)); + } + + /** + * 党员年龄列表 + * @Param formDTO + * @Return {@link Result< PageData< PartyMemberEducationResultDTO>>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:54 + */ + @PostMapping("partymemberagelist") + public Result> partyMemberAgelist(@RequestBody PartyMemberListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(icResiUserService.getPartyMemberAgeList(formDTO)); + } + + /** + * 党员学历统计 + * @Param formDTO + * @Return {@link Result< List< OptionDataResultDTO>>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:58 + */ + @PostMapping("partymembereducationstatistics") + public Result> partyMemberEducationStatistics(@RequestBody PartyMemberStatisticsFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(icResiUserService.partyMemberEducationStatistics(formDTO)); + } + + /** + * 党员学历列表 + * @Param formDTO + * @Return {@link Result< PageData< PartyMemberEducationResultDTO>>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:58 + */ + @PostMapping("partymembereducationlist") + public Result> partyMemberEducationlist(@RequestBody PartyMemberListFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO); + return new Result>().ok(icResiUserService.getPartyMemberEducationList(formDTO)); + } + /** * 根据居民id查询居民信息简介 * @param resiUserId diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java index 09f467f6bf..c3f1da8654 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java @@ -18,6 +18,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.form.ResiUserQueryValueDTO; import com.epmet.dto.result.*; @@ -179,4 +180,50 @@ public interface IcResiUserDao extends BaseDao { * @return */ List selectListFamilyMember(@Param("currentIcResiUserId") String currentIcResiUserId, @Param("homeId") String homeId); + + /** + * 组织内党员年龄范围统计 + * @Param orgType + * @Param orgId + * @Return {@link List< OptionDataResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:11 + */ + List getPartyMemberAgeStatistics(@Param("orgType") String orgType, @Param("orgId") String orgId); + + /** + * 获取年龄范围内党员列表 + * @Param orgType + * @Param orgId + * @Param min + * @Param max + * @Return {@link List< PartyMemberAgeResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:11 + */ + List getPartyMemberAgeList(@Param("orgType") String orgType, @Param("orgId") String orgId, + @Param("code") String code); + + + /** + * 党员文化程度统计 + * @Param orgType + * @Param orgId + * @Return {@link List< OptionDataResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:29 + */ + List getPartyMemberEducationStatistics(@Param("orgType") String orgType, @Param("orgId") String orgId); + + /** + * 按教育程度获取党员列表 + * @Param orgType + * @Param orgId + * @Param code + * @Return {@link List< PartyMemberAgeResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:24 + */ + List getPartyMemberEducationList(@Param("orgType") String orgType, @Param("orgId") String orgId, + @Param("code") String code); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java index ee16cd596a..787c54bdc3 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java @@ -18,6 +18,7 @@ package com.epmet.service; import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.dto.IcResiUserDTO; @@ -154,5 +155,41 @@ public interface IcResiUserService extends BaseService { IcResiUserBriefDTO findFamilyMem(String icResiUserId); + /** + * 党员年龄范围统计 + * @Param formDTO + * @Return {@link List< OptionDataResultDTO >} + * @Author zhaoqifeng + * @Date 2021/12/10 15:54 + */ + List partyMemberAgeStatistics(PartyMemberStatisticsFormDTO formDTO); + + /** + * 获取年龄范围内党员列表 + * @Param formDTO + * @Return {@link PageData< PartyMemberAgeResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:40 + */ + PageData getPartyMemberAgeList(PartyMemberListFormDTO formDTO); + + /** + * 党员文化程度统计 + * @Param formDTO + * @Return {@link List< OptionDataResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:40 + */ + List partyMemberEducationStatistics(PartyMemberStatisticsFormDTO formDTO); + + /** + * 按教育程度获取党员列表 + * @Param formDTO + * @Return {@link PageData< PartyMemberEducationResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:40 + */ + PageData getPartyMemberEducationList(PartyMemberListFormDTO formDTO); + IcResiUserBriefDTO getResiBrief(String resiUserId, String customerId); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java index 6fe81d27aa..cf10024449 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java @@ -26,11 +26,11 @@ import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.StrConstant; +import com.epmet.commons.tools.dto.form.DictListFormDTO; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; -import com.epmet.commons.tools.enums.FormItemTypeEnum; -import com.epmet.commons.tools.enums.GenderEnum; -import com.epmet.commons.tools.enums.HouseTypeEnum; -import com.epmet.commons.tools.enums.RelationshipEnum; +import com.epmet.commons.tools.dto.result.DictListResultDTO; +import com.epmet.commons.tools.dto.result.OptionDataResultDTO; +import com.epmet.commons.tools.enums.*; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.RenException; @@ -55,10 +55,7 @@ import com.epmet.dto.form.demand.UserDemandNameQueryFormDTO; import com.epmet.dto.result.*; import com.epmet.entity.IcResiUserEntity; import com.epmet.excel.support.ExportResiUserItemDTO; -import com.epmet.feign.EpmetHeartOpenFeignClient; -import com.epmet.feign.EpmetMessageOpenFeignClient; -import com.epmet.feign.GovOrgOpenFeignClient; -import com.epmet.feign.OperCustomizeOpenFeignClient; +import com.epmet.feign.*; import com.epmet.service.IcResiUserService; import com.epmet.service.UserService; import com.github.pagehelper.Page; @@ -104,6 +101,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl getWrapper(Map params){ @@ -956,4 +955,106 @@ public class IcResiUserServiceImpl extends BaseServiceImpl} + * @Author zhaoqifeng + * @Date 2021/12/10 15:54 + */ + @Override + public List partyMemberAgeStatistics(PartyMemberStatisticsFormDTO formDTO) { + //获取年龄范围字典 + DictListFormDTO dictFormDTO = new DictListFormDTO(); + dictFormDTO.setDictType(DictTypeEnum.AGE_GROUP.getCode()); + Result> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); + Map map = new HashMap<>(); + //统计组织下各年龄范围人数 + List list = baseDao.getPartyMemberAgeStatistics(formDTO.getOrgType(), formDTO.getOrgId()); + if (CollectionUtils.isNotEmpty(list)) { + map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue)); + } + Map finalMap = map; + return dictResult.getData().stream().map(item -> { + OptionDataResultDTO dto = new OptionDataResultDTO(); + dto.setCode(item.getValue()); + dto.setLabel(item.getLabel()); + dto.setValue(null == finalMap.get(item.getValue())?NumConstant.ZERO_STR:finalMap.get(item.getValue())); + return dto; + }).collect(Collectors.toList()); + } + + /** + * 获取年龄范围内党员列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link List< PartyMemberAgeResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:40 + */ + @Override + public PageData getPartyMemberAgeList(PartyMemberListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = baseDao.getPartyMemberAgeList(formDTO.getOrgType(), formDTO.getOrgId(), formDTO.getCode()); + PageInfo pageInfo = new PageInfo<>(list); + return new PageData<>(list, pageInfo.getTotal()); + } + + /** + * 党员文化程度统计 + * + * @param formDTO + * @Param formDTO + * @Return {@link List< OptionDataResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:40 + */ + @Override + public List partyMemberEducationStatistics(PartyMemberStatisticsFormDTO formDTO) { + //获取文化程度字典 + DictListFormDTO dictFormDTO = new DictListFormDTO(); + dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode()); + Result> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO); + Map map = new HashMap<>(); + //统计组织下文化程度党员人数 + List list = baseDao.getPartyMemberEducationStatistics(formDTO.getOrgType(), formDTO.getOrgId()); + if (CollectionUtils.isNotEmpty(list)) { + map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue)); + } + Map finalMap = map; + return dictResult.getData().stream().map(item -> { + OptionDataResultDTO dto = new OptionDataResultDTO(); + dto.setCode(item.getValue()); + dto.setLabel(item.getLabel()); + dto.setValue(null == finalMap.get(item.getValue())?NumConstant.ZERO_STR:finalMap.get(item.getValue())); + return dto; + }).collect(Collectors.toList()); + } + + /** + * 按教育程度获取党员列表 + * + * @param formDTO + * @Param formDTO + * @Return {@link List< PartyMemberEducationResultDTO>} + * @Author zhaoqifeng + * @Date 2021/12/10 17:40 + */ + @Override + public PageData getPartyMemberEducationList(PartyMemberListFormDTO formDTO) { + PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()); + List list = baseDao.getPartyMemberEducationList(formDTO.getOrgType(), formDTO.getOrgId(), formDTO.getCode()); + Result> mapResult = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.EDUCATION.getCode()); + PageInfo pageInfo = new PageInfo<>(list); + if (CollectionUtils.isNotEmpty(list)) { + list.forEach(item -> { + item.setEducation(null == mapResult.getData().get(item.getEducation()) ? "" : mapResult.getData().get(item.getEducation())); + }); + } + return new PageData<>(list, pageInfo.getTotal()); + } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml index 8414cf5e4b..b10e6e259f 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml @@ -361,4 +361,132 @@ and m.HOME_ID=#{homeId} order by m.CREATED_TIME asc + + + + +