Browse Source

Merge remote-tracking branch 'origin/dev_ic_data' into dev_ic_data

# Conflicts:
#	epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
#	epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
#	epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
dev_shibei_match
wangxianzhang 4 years ago
parent
commit
3333b47141
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
  2. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java
  3. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java
  4. 42
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CategoryAnalysisFormDTO.java
  5. 19
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDTO.java
  6. 32
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDetail.java
  7. 17
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisResDTO.java
  8. 11
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryDetailDTO.java
  9. 26
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/LegendDTO.java
  10. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  11. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java
  12. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  13. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  14. 130
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  15. 95
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml
  16. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java
  17. 13
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java
  18. 2
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java
  19. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java
  20. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java
  21. 3
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  22. 33
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml
  23. 13
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDistributionAnalysisRightResultDTO.java
  24. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  25. 57
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/IcFormServiceImpl.java
  26. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberListFormDTO.java
  27. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberStatisticsFormDTO.java
  28. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberAgeResultDTO.java
  29. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberEducationResultDTO.java
  30. 53
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  31. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  32. 37
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  33. 117
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  34. 128
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

3
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;

5
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;
}

5
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;
}

42
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;
}

19
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<CategoryAnalysisDetail> detail;
}

32
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;
}

17
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<LegendDTO> legend;
private List<CategoryAnalysisDTO> categoryList;
}

11
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;
}

26
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;
}

14
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<CategoryAnalysisResDTO> categoryAnalysis(@LoginUser TokenDto tokenDto,@RequestBody CategoryAnalysisFormDTO formDTO){
formDTO.setCusotmerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO,CategoryAnalysisFormDTO.AddUserShowGroup.class,CategoryAnalysisFormDTO.AddUserInternalGroup.class);
return new Result<CategoryAnalysisResDTO>().ok(icUserDemandRecService.categoryAnalysis(formDTO));
}
}

20
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<IcUserDemandRecEntity> {
* @return
*/
List<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO);
List<CategoryAnalysisDetail> 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<CategoryAnalysisDTO> selectListCategoryAnalysisDTO(@Param("firstCategoryList") List<OptionDTO> 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);
}

8
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<IcUserDemandRecEntit
* @return
*/
PageData<DemandRecResultDTO> pageListAnalysis(PageListAnalysisFormDTO formDTO);
/**
* 数据分析-服务措施分析-柱状图
*
* @return
*/
CategoryAnalysisResDTO categoryAnalysis(CategoryAnalysisFormDTO formDTO);
}

10
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<IcPartyUnitDao, IcPa
*/
@Override
public List<PartyUnitDistributionResultDTO> distribution(PartyActivityFormDTO formDTO) {
return baseDao.getDistribution(formDTO.getAgencyId());
Result<Map<String, String>> unitTypeMap = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.PARTY_UNIT_TYPE.getCode());
List<PartyUnitDistributionResultDTO> 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<String, String> map, String matter) {

130
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<IcUserDemandRecDao, IcUserDemandRecEntity> implements IcUserDemandRecService {
@Autowired
@ -239,9 +240,9 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl<IcUserDemandRecD
//3、查询志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
Map<String,String> userInfoMap=new HashMap<>();
List<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toList());
Set<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
Result<List<UserBaseInfoResultDTO>> 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<IcUserDemandRecD
//3、查询志愿者
// 服务方类型:志愿者:volunteer;社会组织:social_org;社区自组织:community_org;区域党建单位:party_unit;
Map<String,String> userInfoMap=new HashMap<>();
List<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toList());
Set<String> userIdList=list.stream().filter(item->item.getServiceType().equals(UserDemandConstant.VOLUNTEER)).map(DemandRecResultDTO::getServerId).collect(Collectors.toSet());
if(CollectionUtils.isNotEmpty(userIdList)){
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIdList);
Result<List<UserBaseInfoResultDTO>> 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<IcUserDemandRecD
return new PageData<>(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<OptionDTO> firstCategoryList=demandDictService.querySubCodeList(subCodeFormDTO);
if(CollectionUtils.isEmpty(firstCategoryList)){
return new CategoryAnalysisResDTO(Collections.EMPTY_LIST,Collections.EMPTY_LIST);
}
//2、没有服务类型直接退出
Result<Map<String, String>> 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<LegendDTO> 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<CustomerAgencyDTO> 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<CategoryAnalysisDTO> 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<CategoryAnalysisDTO> 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<String, CategoryAnalysisDTO> 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<CategoryAnalysisDetail> resDetailList=tempDto.getDetail();
Map<String, CategoryAnalysisDetail> 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<CategoryAnalysisDetail> constructDefaultDetail(List<LegendDTO> legend) {
List<CategoryAnalysisDetail> 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;
}
}

95
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml

@ -261,4 +261,99 @@
</if>
order by r.WANT_SERVICE_TIME desc,r.REPORT_TIME asc
</select>
<resultMap id="CategoryAnalysisDTOMap" type="com.epmet.dto.result.demand.CategoryAnalysisDTO">
<result property="categoryCode" column="category_code"/>
<result property="categoryName" column="category_name"/>
<result property="total" column="TOTAL"/>
<collection property="detail" ofType="com.epmet.dto.result.demand.CategoryAnalysisDetail"
column="{categoryCode=category_code, orgType=org_type,orgId=org_id,gridPids=grid_pids,customerId=customer_id,startDateId=start_date_id,endDateId=end_date_id}"
select="com.epmet.dao.IcUserDemandRecDao.selectDetail">
</collection>
</resultMap>
<select id="selectListCategoryAnalysisDTO" parameterType="map" resultMap="CategoryAnalysisDTOMap">
<foreach collection="firstCategoryList" item="category" separator=" UNION ALL ">
select
#{category.value} as category_code,
#{category.label} as category_name,
count(m.id) as TOTAL,
#{orgType} as org_type,
#{orgId} as org_id,
#{gridPids} as grid_pids,
#{customerId} as customer_id,
#{startDateId} as start_date_id,
#{endDateId} as end_date_id
from ic_user_demand_rec m
where m.DEL_FLAG='0'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y%m%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y%m%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{category.value},'%')
and m.status !='canceled'
</foreach>
</select>
<select id="selectDetail" parameterType="map" resultType="com.epmet.dto.result.demand.CategoryAnalysisDetail">
select
#{categoryCode} as categoryCode,
s.SERVICE_TYPE as legendCode,
(
case when s.SERVICE_TYPE='volunteer' then '志愿者'
when s.SERVICE_TYPE='social_org' then '社会组织'
when s.SERVICE_TYPE='community_org' then '社区自组织'
when s.SERVICE_TYPE='party_unit' then '区域化党建单位'
end
)as legendName,
count(s.DEMAND_REC_ID) as serviceDemandTotal,
count(distinct s.SERVER_ID) as totalService
from ic_user_demand_service s
inner join ic_user_demand_rec m
on(s.DEMAND_REC_ID=m.ID)
where s.DEL_FLAG='0'
and m.DEL_FLAG='0'
and m.`STATUS`='finished'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y%m%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y%m%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%')
group by s.SERVICE_TYPE
union all
select
#{categoryCode} as categoryCode,
'unfinished' as legendCode,
'未完成' as legendName,
count(m.id) as serviceDemandTotal,
'0' as totalService
from ic_user_demand_rec m
where m.DEL_FLAG='0'
and m.`STATUS`!='finished'
and m.STATUS !='canceled'
and m.CUSTOMER_ID=#{customerId}
<if test="null != orgType and orgType == 'grid' ">
and m.GRID_ID=#{orgId}
</if>
<if test="null != orgType and orgType == 'agency' ">
and m.GRID_PIDS like concat(#{gridPids},'%')
</if>
and DATE_FORMAT(m.REPORT_TIME,'%Y%m%d') &gt;= #{startDateId}
and DATE_FORMAT(m.REPORT_TIME,'%Y%m%d') &lt;= #{endDateId}
and m.CATEGORY_CODE like concat(#{categoryCode},'%')
</select>
</mapper>

5
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;
}

13
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<String> 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<String> getDefaultCategoryName(){
List<String> list = new ArrayList<>();
list.add("其他");
return list;
}
}

2
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;
/**

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java

@ -234,7 +234,7 @@ public interface IssueDao extends BaseDao<IssueEntity> {
* @author zxc
* @date 2021/12/8 4:08 下午
*/
List<ResiBuzzDTO> selectIssueLimit50(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("status")String status);
List<ResiBuzzDTO> selectIssueLimit50(@Param("orgId")String orgId,@Param("orgType")String orgType,@Param("status")String status,@Param("length")Integer length);
/**
* @Description 查询客户下1级分类的长度

5
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;
}

3
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<IssueDao, IssueEntity> imp
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(IssueConstant.ISSUE_AGENCY);
}
PageInfo<ResiBuzzDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectIssueLimit50(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStatus()));
Integer length = baseDao.selectOneLevelCategoryLength(tokenDto.getCustomerId());
PageInfo<ResiBuzzDTO> pageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectIssueLimit50(formDTO.getOrgId(), formDTO.getOrgType(), formDTO.getStatus(),length));
List<ResiBuzzDTO> list = pageInfo.getList();
if (CollectionUtils.isEmpty(list)){
return new ResiBuzzResultDTO();

33
epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml

@ -579,22 +579,39 @@
</select>
<!-- 查询表决前50名 -->
<select id="selectIssueLimit50" resultType="com.epmet.dto.result.ResiBuzzDTO">
<resultMap id="selectIssueLimit50" type="com.epmet.dto.result.ResiBuzzDTO">
<result column="issueId" property="issueId"/>
<result column="issueTitle" property="issueTitle"/>
<result column="suggestion" property="suggestion"/>
<result column="createdBy" property="createdBy"/>
<result column="status" property="status"/>
<result column="createdTime" property="createdTime"/>
<result column="supportCount" property="supportCount"/>
<result column="oppositionCount" property="oppositionCount"/>
<result column="voteAccount" property="voteAccount"/>
<collection property="categoryName" ofType="java.lang.String">
<result column="cn"/>
</collection>
</resultMap>
<select id="selectIssueLimit50" resultMap="selectIssueLimit50">
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'
<if test='status != "all" '>
AND i.ISSUE_STATUS = #{status}

13
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<ProjectDistributionAnalysisRightDTO> list;
public ProjectDistributionAnalysisRightResultDTO() {
this.under = "";
this.middle = "";
this.above = "";
this.under = null;
this.above = null;
this.list = new ArrayList<>();
}
}

16
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<ProjectDao, ProjectEntit
* 分段规则
* 组织内所有网格项目数网格内最低项目数向下十位取整数网格内最高项目数向上取整数获得取值范围
*
* 根据
* 根据 采用这个公式
* 最小取值+最大取值-最小取值/3
* 最小取值+最大取值-最小取值*2/3
* 获得两个数值用两个数值确定三个取值范围
@ -2878,21 +2878,19 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
orgList = projectCountByGrid.getData();
}
}
if (CollectionUtils.isNotEmpty(orgList)){
result.setList(orgList);
if (CollectionUtils.isEmpty(orgList)){
return result;
}
result.setList(orgList);
List<Integer> 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;
}

57
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<IcFormDao, IcFormEntity>
private IcFormItemGroupDao icFormItemGroupDao;
@Autowired
private IcFormQueryBuilderDao icFormQueryBuilderDao;
@Autowired
private IcResiCategoryStatsConfigDao icResiCategoryStatsConfigDao;
@Autowired
private IcResiCategoryWarnConfigDao icResiCategoryWarnConfigDao;
/**
* 获取居民信息表单
@ -145,6 +149,10 @@ public class IcFormServiceImpl extends BaseServiceImpl<IcFormDao, IcFormEntity>
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<IcFormDao, IcFormEntity>
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<IcFormDao, IcFormEntity>
}
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<IcFormDao, IcFormEntity>
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<IcFormDao, IcFormEntity>
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<IcFormDao, IcFormEntity>
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<IcResiCategoryStatsConfigEntity> wrapperStats = new LambdaQueryWrapper<>();
wrapperStats.eq(IcResiCategoryStatsConfigEntity::getCustomerId, defaultCustomerId);
List<IcResiCategoryStatsConfigEntity> 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<IcResiCategoryWarnConfigEntity> wrapperWarn = new LambdaQueryWrapper<>();
wrapperWarn.eq(IcResiCategoryWarnConfigEntity::getCustomerId, defaultCustomerId);
List<IcResiCategoryWarnConfigEntity> 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;
}
}

24
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;
}

20
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;
}

19
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;
}

19
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;
}

53
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<List<DemandUserResDTO>>().ok(icResiUserService.queryDemandUsers(formDTO));
}
/**
* 党员年龄范围统计
* @Param formDTO
* @Return {@link Result< List< OptionDataResultDTO >>}
* @Author zhaoqifeng
* @Date 2021/12/10 15:52
*/
@PostMapping("partymemberagestatistics")
public Result<List<OptionDataResultDTO>> partyMemberAgeStatistics(@RequestBody PartyMemberStatisticsFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<OptionDataResultDTO>>().ok(icResiUserService.partyMemberAgeStatistics(formDTO));
}
/**
* 党员年龄列表
* @Param formDTO
* @Return {@link Result< PageData< PartyMemberEducationResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/12/10 17:54
*/
@PostMapping("partymemberagelist")
public Result<PageData<PartyMemberAgeResultDTO>> partyMemberAgelist(@RequestBody PartyMemberListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<PageData<PartyMemberAgeResultDTO>>().ok(icResiUserService.getPartyMemberAgeList(formDTO));
}
/**
* 党员学历统计
* @Param formDTO
* @Return {@link Result< List< OptionDataResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/12/10 17:58
*/
@PostMapping("partymembereducationstatistics")
public Result<List<OptionDataResultDTO>> partyMemberEducationStatistics(@RequestBody PartyMemberStatisticsFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<List<OptionDataResultDTO>>().ok(icResiUserService.partyMemberEducationStatistics(formDTO));
}
/**
* 党员学历列表
* @Param formDTO
* @Return {@link Result< PageData< PartyMemberEducationResultDTO>>}
* @Author zhaoqifeng
* @Date 2021/12/10 17:58
*/
@PostMapping("partymembereducationlist")
public Result<PageData<PartyMemberEducationResultDTO>> partyMemberEducationlist(@RequestBody PartyMemberListFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
return new Result<PageData<PartyMemberEducationResultDTO>>().ok(icResiUserService.getPartyMemberEducationList(formDTO));
}
/**
* 根据居民id查询居民信息简介
* @param resiUserId

47
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<IcResiUserEntity> {
* @return
*/
List<HouseUserDTO> 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<OptionDataResultDTO> 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<PartyMemberAgeResultDTO> 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<OptionDataResultDTO> 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<PartyMemberEducationResultDTO> getPartyMemberEducationList(@Param("orgType") String orgType, @Param("orgId") String orgId,
@Param("code") String code);
}

37
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<IcResiUserEntity> {
IcResiUserBriefDTO findFamilyMem(String icResiUserId);
/**
* 党员年龄范围统计
* @Param formDTO
* @Return {@link List< OptionDataResultDTO >}
* @Author zhaoqifeng
* @Date 2021/12/10 15:54
*/
List<OptionDataResultDTO> partyMemberAgeStatistics(PartyMemberStatisticsFormDTO formDTO);
/**
* 获取年龄范围内党员列表
* @Param formDTO
* @Return {@link PageData< PartyMemberAgeResultDTO>}
* @Author zhaoqifeng
* @Date 2021/12/10 17:40
*/
PageData<PartyMemberAgeResultDTO> getPartyMemberAgeList(PartyMemberListFormDTO formDTO);
/**
* 党员文化程度统计
* @Param formDTO
* @Return {@link List< OptionDataResultDTO>}
* @Author zhaoqifeng
* @Date 2021/12/10 17:40
*/
List<OptionDataResultDTO> partyMemberEducationStatistics(PartyMemberStatisticsFormDTO formDTO);
/**
* 按教育程度获取党员列表
* @Param formDTO
* @Return {@link PageData< PartyMemberEducationResultDTO>}
* @Author zhaoqifeng
* @Date 2021/12/10 17:40
*/
PageData<PartyMemberEducationResultDTO> getPartyMemberEducationList(PartyMemberListFormDTO formDTO);
IcResiUserBriefDTO getResiBrief(String resiUserId, String customerId);
}

117
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<IcResiUserDao, IcResi
@Autowired
private UserService userService;
@Autowired
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient;
@Autowired
private IcResiUserDao icResiUserDao;
private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params){
@ -956,4 +955,106 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
.collect(Collectors.toMap(IcFormItemOptionsDTO::getOptionValue, IcFormItemOptionsDTO::getOptionLabel));
}
/**
* 党员年龄范围统计
*
* @param formDTO
* @Param formDTO
* @Return {@link List< OptionDataResultDTO >}
* @Author zhaoqifeng
* @Date 2021/12/10 15:54
*/
@Override
public List<OptionDataResultDTO> partyMemberAgeStatistics(PartyMemberStatisticsFormDTO formDTO) {
//获取年龄范围字典
DictListFormDTO dictFormDTO = new DictListFormDTO();
dictFormDTO.setDictType(DictTypeEnum.AGE_GROUP.getCode());
Result<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO);
Map<String, String> map = new HashMap<>();
//统计组织下各年龄范围人数
List<OptionDataResultDTO> list = baseDao.getPartyMemberAgeStatistics(formDTO.getOrgType(), formDTO.getOrgId());
if (CollectionUtils.isNotEmpty(list)) {
map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue));
}
Map<String, String> 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<PartyMemberAgeResultDTO> getPartyMemberAgeList(PartyMemberListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<PartyMemberAgeResultDTO> list = baseDao.getPartyMemberAgeList(formDTO.getOrgType(), formDTO.getOrgId(), formDTO.getCode());
PageInfo<PartyMemberAgeResultDTO> 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<OptionDataResultDTO> partyMemberEducationStatistics(PartyMemberStatisticsFormDTO formDTO) {
//获取文化程度字典
DictListFormDTO dictFormDTO = new DictListFormDTO();
dictFormDTO.setDictType(DictTypeEnum.EDUCATION.getCode());
Result<List<DictListResultDTO>> dictResult = epmetAdminOpenFeignClient.dictList(dictFormDTO);
Map<String, String> map = new HashMap<>();
//统计组织下文化程度党员人数
List<OptionDataResultDTO> list = baseDao.getPartyMemberEducationStatistics(formDTO.getOrgType(), formDTO.getOrgId());
if (CollectionUtils.isNotEmpty(list)) {
map = list.stream().collect(Collectors.toMap(OptionDataResultDTO::getCode, OptionDataResultDTO::getValue));
}
Map<String, String> 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<PartyMemberEducationResultDTO> getPartyMemberEducationList(PartyMemberListFormDTO formDTO) {
PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize());
List<PartyMemberEducationResultDTO> list = baseDao.getPartyMemberEducationList(formDTO.getOrgType(), formDTO.getOrgId(), formDTO.getCode());
Result<Map<String, String>> mapResult = epmetAdminOpenFeignClient.dictMap(DictTypeEnum.EDUCATION.getCode());
PageInfo<PartyMemberEducationResultDTO> 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());
}
}

128
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
</select>
<select id="getPartyMemberAgeStatistics" resultType="com.epmet.commons.tools.dto.result.OptionDataResultDTO">
SELECT
ageGroup AS "code",
COUNT(ID) AS "value"
FROM
(
SELECT
ID,
CASE
WHEN age &lt; 50 THEN '0'
WHEN age &gt;= 50 AND age &lt;= 59 THEN '1'
WHEN age &gt;= 60 AND age &lt;= 69 THEN '2'
WHEN age &gt;= 70 AND age &lt;= 79 THEN '3'
ELSE '4'
END AS ageGroup
FROM
(
SELECT
ID,
YEAR (FROM_DAYS(DATEDIFF(NOW(),SUBSTRING( ID_CARD, 7, 8 )))) AS age
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
<choose>
<when test='orgType == "grid"'>
AND GRID_ID = #{orgId}
</when>
<otherwise>
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
</otherwise>
</choose>
) a
) a
GROUP BY ageGroup
</select>
<select id="getPartyMemberAgeList" resultType="com.epmet.dto.result.PartyMemberAgeResultDTO">
SELECT
ID AS "userId",
NAME,
MOBILE,
age
FROM
(
SELECT
ID,
NAME,
MOBILE,
age,
CASE
WHEN age &lt; 50 THEN '0'
WHEN age &gt;= 50 AND age &lt;= 59 THEN '1'
WHEN age &gt;= 60 AND age &lt;= 69 THEN '2'
WHEN age &gt;= 70 AND age &lt;= 79 THEN '3'
ELSE '4'
END AS ageGroup
FROM
(
SELECT
ID,
NAME,
MOBILE,
YEAR (FROM_DAYS(DATEDIFF(NOW(),SUBSTRING( ID_CARD, 7, 8 )))) AS age
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
<choose>
<when test='orgType == "grid"'>
AND GRID_ID = #{orgId}
</when>
<otherwise>
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
</otherwise>
</choose>
) a
) a
<if test="null != code and '' != code">
WHERE ageGroup = #{code}
</if>
</select>
<select id="getPartyMemberEducationList" resultType="com.epmet.dto.result.PartyMemberEducationResultDTO">
SELECT
ID AS "userId",
NAME,
MOBILE,
CULTURE AS education
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
AND CULTURE IS NOT NULL
<if test="null != code and '' != code">
AND CULTURE = #{code}
</if>
<choose>
<when test='orgType == "grid"'>
AND GRID_ID = #{orgId}
</when>
<otherwise>
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
</otherwise>
</choose>
</select>
<select id="getPartyMemberEducationStatistics" resultType="com.epmet.commons.tools.dto.result.OptionDataResultDTO">
SELECT
CULTURE AS "code",
count(ID) AS "value"
FROM
ic_resi_user
WHERE
DEL_FLAG = '0'
AND IS_PARTY = '1'
AND CULTURE IS NOT NULL
<choose>
<when test='orgType == "grid"'>
AND GRID_ID = #{orgId}
</when>
<otherwise>
AND (AGENCY_ID = #{orgId} OR PIDS LIKE CONCAT('%',#{orgId},'%'))
</otherwise>
</choose>
GROUP BY CULTURE
</select>
</mapper>

Loading…
Cancel
Save