Browse Source

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

master
yinzuomei 4 years ago
parent
commit
8b8c912c51
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/enums/DictTypeEnum.java
  2. 15
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/heart/result/DemandServiceCountResultDTO.java
  3. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/issue/IssueProjectCategoryDictDTO.java
  4. 38
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemandController.java
  5. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/IcUserDemandServiceDao.java
  6. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/VolunteerInfoDao.java
  7. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactVolunteerServiceDailyDao.java
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  9. 75
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/IcUserDemandServiceEntity.java
  10. 71
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/VolunteerInfoEntity.java
  11. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/issue/IssueProjectCategoryDictEntity.java
  12. 86
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactVolunteerServiceDailyEntity.java
  13. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DemandService.java
  14. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartDemandService.java
  15. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartVolunteerService.java
  16. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartDemandServiceImpl.java
  17. 40
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartVolunteerServiceImpl.java
  18. 184
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java
  19. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DemandStatsService.java
  20. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DemandStatsServiceImpl.java
  21. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  22. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  23. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.26__create_volunteer_service_daily.sql
  24. 33
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/IcUserDemandServiceDao.xml
  25. 23
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/VolunteerInfoDao.xml
  26. 37
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactVolunteerServiceDailyDao.xml
  27. 13
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
  28. 42
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/form/demand/CategoryAnalysisFormDTO.java
  29. 19
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDTO.java
  30. 32
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisDetail.java
  31. 17
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryAnalysisResDTO.java
  32. 11
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/CategoryDetailDTO.java
  33. 26
      epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/result/demand/LegendDTO.java
  34. 14
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcUserDemandRecController.java
  35. 20
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/IcUserDemandRecDao.java
  36. 8
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcUserDemandRecService.java
  37. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
  38. 103
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
  39. 95
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/IcUserDemandRecDao.xml
  40. 5
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueProjectCategoryDictDTO.java
  41. 13
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzDTO.java
  42. 2
      epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/result/ResiBuzzLeftPieChartResultDTO.java
  43. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/dao/IssueDao.java
  44. 5
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueProjectCategoryDictEntity.java
  45. 3
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java
  46. 33
      epmet-module/gov-issue/gov-issue-server/src/main/resources/mapper/IssueDao.xml
  47. 13
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/result/ProjectDistributionAnalysisRightResultDTO.java
  48. 16
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  49. 24
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberListFormDTO.java
  50. 20
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/PartyMemberStatisticsFormDTO.java
  51. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberAgeResultDTO.java
  52. 19
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/PartyMemberEducationResultDTO.java
  53. 53
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  54. 47
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserDao.java
  55. 37
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  56. 117
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  57. 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;

15
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/heart/result/DemandServiceCountResultDTO.java

@ -0,0 +1,15 @@
package com.epmet.dto.heart.result;
import lombok.Data;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 4:39 下午
* @Version 1.0
*/
@Data
public class DemandServiceCountResultDTO {
private String serverId;
private String serviceType;
}

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

38
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemandController.java

@ -0,0 +1,38 @@
package com.epmet.controller;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.DemandService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 10:44 上午
* @Version 1.0
*/
@RestController
@RequestMapping("demand")
public class DemandController {
@Autowired
private DemandService demandStatsService;
/**
* wangxianzhang
*
* 计算客户下志愿者服务相关数据
*
* @param customerId 客户ID可以为空为空则计算所有客户
* @return
*/
@PostMapping("volunteer/daily")
public Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId) {
demandStatsService.statsVolunteerDemandServicesDaily(customerId);
return new Result();
}
}

44
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/IcUserDemandServiceDao.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.heart;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import com.epmet.entity.heart.IcUserDemandServiceEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
/**
* 居民需求服务记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-19
*/
@Mapper
public interface IcUserDemandServiceDao extends BaseDao<IcUserDemandServiceEntity> {
/**
* 需求服务次数查询
* @param customerId 客户id
* @param serviceType 服务者类型
*/
List<DemandServiceCountResultDTO> listDemandServiceCountPage(@Param("customerId") String customerId, @Param("endTime") Date endTime, @Param("serviceType") String serviceType);
}

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/VolunteerInfoDao.java

@ -0,0 +1,33 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.heart;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.heart.VolunteerInfoEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 志愿者信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Mapper
public interface VolunteerInfoDao extends BaseDao<VolunteerInfoEntity> {
}

42
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/FactVolunteerServiceDailyDao.java

@ -0,0 +1,42 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.stats;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 志愿者服务情况统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Mapper
public interface FactVolunteerServiceDailyDao extends BaseDao<FactVolunteerServiceDailyEntity> {
/**
* 删除指定客户指定dateId的志愿者服务统计记录
* @param customerIds
* @param dateDimId
*/
void clearVolunteerDemandServiceDailyStats(@Param("customerIds") List<String> customerIds, @Param("dateDimId") String dateDimId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java

@ -264,5 +264,7 @@ public interface UserDao {
List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO);
List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO);
List<String> filterUserIds(@Param("userIds") List<String> userIds, @Param("roleKey") String roleKey);
}

75
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/IcUserDemandServiceEntity.java

@ -0,0 +1,75 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.heart;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 居民需求服务记录表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-19
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("ic_user_demand_service")
public class IcUserDemandServiceEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 需求id
*/
private String demandRecId;
/**
* 服务方类型志愿者volunteer社会组织social_org社区自组织community_org区域党建单位party_unit
*/
private String serviceType;
/**
* 志愿者居民端爱心互助的志愿者userId
*/
private String serverId;
/**
* 实际服务开始时间
*/
private Date serviceStartTime;
/**
* 实际服务结束时间
*/
private Date serviceEndTime;
/**
* 完成情况
*/
private String finishDesc;
}

71
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/heart/VolunteerInfoEntity.java

@ -0,0 +1,71 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.heart;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 志愿者信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("volunteer_info")
public class VolunteerInfoEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 用户id
*/
private String userId;
/**
* 客户id
*/
private String customerId;
/**
* 志愿者自我介绍
*/
private String volunteerIntroduce;
/**
* 志愿者签名
*/
private String volunteerSignature;
/**
* 网格id
*/
private String gridId;
/**
* 网格名称
*/
private String gridName;
}

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

86
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/FactVolunteerServiceDailyEntity.java

@ -0,0 +1,86 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.stats;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 志愿者服务情况统计
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-12-08
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("fact_volunteer_service_daily")
public class FactVolunteerServiceDailyEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* yyyyMMdd
*/
private String dateId;
/**
* yyyyMM
*/
private String monthId;
/**
* 截止到当前dateId当前客户下共有多少个爱心互助的志愿者
*/
private Integer volunteerTotal;
/**
* 截止到当前dateId当前客户下XX个爱心互助志愿者中党员有多少个
*/
private Integer partyTotal;
/**
* 截止到当前dateId当前客户下XX个爱心互助志愿者中居民有多少个
*/
private Integer resiTotal;
/**
* 服务总次数
*/
private Integer serviceTotal;
/**
* 党员服务总次数
*/
private Integer partyServiceTotal;
/**
* 居民服务总次数
*/
private Integer resiServiceTotal;
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/DemandService.java

@ -0,0 +1,20 @@
package com.epmet.service;
/**
* @Description 需求service
* @Author wangxianzhang
* @Date 2021/12/8 12:14 下午
* @Version 1.0
*/
public interface DemandService {
/**
* wangxianzhang
*
* 按日统计
*
* @param customerId 客户ID可为空为空计算所有
*/
void statsVolunteerDemandServicesDaily(String customerId);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartDemandService.java

@ -0,0 +1,15 @@
package com.epmet.service.heart;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import java.util.Date;
import java.util.List;
/**
*@Description 爱心互助需求service
*@Author wangxianzhang
*@Date 2021/12/8
*/
public interface HeartDemandService {
List<DemandServiceCountResultDTO> listDemandServiceCountPage(String customerId, Date endTime, int serviceCountPageNo, int serviceCountPageSize);
}

15
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/HeartVolunteerService.java

@ -0,0 +1,15 @@
package com.epmet.service.heart;
import com.epmet.entity.heart.VolunteerInfoEntity;
import java.util.Date;
import java.util.List;
/**
*@Description heart 志愿者service
*@Author wangxianzhang
*@Date 2021/12/8
*/
public interface HeartVolunteerService {
List<VolunteerInfoEntity> listVolunteersPage(String customerId, Date endCreateTime, Integer pageNum, Integer pageSize);
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartDemandServiceImpl.java

@ -0,0 +1,40 @@
package com.epmet.service.heart.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.heart.IcUserDemandServiceDao;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import com.epmet.service.heart.HeartDemandService;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @Description 爱心互助需求service
* @Author wangxianzhang
* @Date 2021/12/8 12:33 下午
* @Version 1.0
*/
@Service
@DataSource(DataSourceConstant.EPMET_HEART)
public class HeartDemandServiceImpl implements HeartDemandService {
@Autowired
private IcUserDemandServiceDao demandServiceDao;
@Override
public List<DemandServiceCountResultDTO> listDemandServiceCountPage(String customerId, Date endTime, int serviceCountPageNo, int serviceCountPageSize) {
return PageHelper.startPage(serviceCountPageNo, serviceCountPageSize).doSelectPage(new ISelect() {
@Override
public void doSelect() {
demandServiceDao.listDemandServiceCountPage(customerId, endTime, "volunteer");
}
});
}
}

40
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/HeartVolunteerServiceImpl.java

@ -0,0 +1,40 @@
package com.epmet.service.heart.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.heart.VolunteerInfoDao;
import com.epmet.entity.heart.VolunteerInfoEntity;
import com.epmet.service.heart.HeartVolunteerService;
import com.github.pagehelper.ISelect;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 1:35 下午
* @Version 1.0
*/
@Service
@DataSource(DataSourceConstant.EPMET_HEART)
public class HeartVolunteerServiceImpl implements HeartVolunteerService {
@Autowired
private VolunteerInfoDao volunteerInfoDao;
@Override
public List<VolunteerInfoEntity> listVolunteersPage(String customerId, Date endCreateTime, Integer pageNum, Integer pageSize) {
return PageHelper.startPage(pageNum, pageSize).doSelectPage(() -> {
LambdaQueryWrapper<VolunteerInfoEntity> query = new LambdaQueryWrapper<>();
query.eq(VolunteerInfoEntity::getCustomerId, customerId);
query.lt(VolunteerInfoEntity::getCreatedTime, endCreateTime);
volunteerInfoDao.selectList(query);
});
}
}

184
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/DemandServiceImpl.java

@ -0,0 +1,184 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.EpmetRoleKeyConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.heart.result.DemandServiceCountResultDTO;
import com.epmet.entity.crm.CustomerEntity;
import com.epmet.entity.heart.VolunteerInfoEntity;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import com.epmet.service.DemandService;
import com.epmet.service.crm.CustomerService;
import com.epmet.service.heart.HeartDemandService;
import com.epmet.service.heart.HeartVolunteerService;
import com.epmet.service.stats.DemandStatsService;
import com.epmet.service.user.UserService;
import com.epmet.util.DimIdGenerator;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description 需求service
* @Author wangxianzhang
* @Date 2021/12/8 12:14 下午
* @Version 1.0
*/
@Service
public class DemandServiceImpl implements DemandService {
@Autowired
private HeartDemandService heartDemandService;
@Autowired
private HeartVolunteerService heartVolunteerService;
@Autowired
private UserService userService;
@Autowired
private DemandStatsService demandStatsService;
@Autowired
private CustomerService customerService;
@Override
public void statsVolunteerDemandServicesDaily(String customerId) {
Date now = new Date();
Date today = DateUtils.integrate(now, "yyyy-MM-dd");
Date yestoday = DateUtils.addDateDays(today, -1);
if (StringUtils.isNotBlank(customerId)) {
// 只计算单个客户
clearOldDatas(Arrays.asList(customerId), yestoday);
statsVolunteerDemandServicesDaily4Customer(customerId, today, yestoday);
} else {
// 查询所有客户ID
List<String> customerIds = customerService.listValidCustomersByCreateTime(null, null).stream().map(c -> c.getId()).collect(Collectors.toList());
clearOldDatas(customerIds, yestoday);
customerIds.stream().forEach(cId -> {
statsVolunteerDemandServicesDaily4Customer(cId, today, yestoday);
});
}
}
/**
* 清理旧数据
* @param yestoday
*/
private void clearOldDatas(List<String> customerIds, Date yestoday) {
String dateDimId = DimIdGenerator.getDateDimId(yestoday);
demandStatsService.clearVolunteerDemandServiceDailyStats(customerIds, dateDimId);
}
/**
* 统计单个客户的志愿者服务情况
* @param customerId 客户ID
* @param endTime 统计截止时间(<endTime)
*/
private void statsVolunteerDemandServicesDaily4Customer(String customerId, Date endTime, Date belongTime) {
// 1.志愿者分流为党员志愿者&普通居民志愿者
Integer volunteerTotalCount = 0;
// 党员志愿者数量
Integer partymemberVolunteerCount = 0;
// 居民志愿者数量
Integer resiVolunteerCount = 0;
List<String> partymemberVolunteerUserIds = new ArrayList<>(16);
int pageNum = 1;
int volunteerPageSize = 5;
while (true) {
int shardingStartIndex = 0;
int shardingSize = 2;
List<VolunteerInfoEntity> volunteersPage = heartVolunteerService.listVolunteersPage(customerId, endTime, pageNum, volunteerPageSize);
// 如果查询结果为0,说明没有更多的志愿者了
if (volunteersPage.size() == 0) {
break;
}
volunteerTotalCount += volunteersPage.size();
// 分片去确定党员身份
while (true) {
int realShardingSize = Math.min(shardingSize, volunteersPage.size() - shardingStartIndex);
if (realShardingSize == 0) {
break;
}
int shardingEndIndex = shardingStartIndex + realShardingSize;
List<String> volunteerUserIds = volunteersPage.subList(shardingStartIndex, shardingEndIndex)
.stream()
.map((volunteerInfoEntity) -> volunteerInfoEntity.getUserId())
.collect(Collectors.toList());
List<String> tempPartymemberUserIds = userService.filterUserIds(volunteerUserIds, EpmetRoleKeyConstant.PARTYMEMBER);
partymemberVolunteerUserIds.addAll(tempPartymemberUserIds);
shardingStartIndex = shardingEndIndex;
}
pageNum++;
}
partymemberVolunteerCount += partymemberVolunteerUserIds.size();
resiVolunteerCount = volunteerTotalCount - partymemberVolunteerCount;
//2. 查询志愿者服务次数
// 总服务次数
int totalDemandServiceCount = 0;
// 党员服务次数
int partymemberDemandServiceCount = 0;
// 居民服务次数
int resiDemandServiceCount = 0;
int serviceCountPageNo = 0;
int serviceCountPageSize = 1000;
while (true) {
List<DemandServiceCountResultDTO> damendServiceCounts = heartDemandService.listDemandServiceCountPage(customerId, endTime, serviceCountPageNo, serviceCountPageSize);
for (DemandServiceCountResultDTO damendServiceCount : damendServiceCounts) {
String serverId = damendServiceCount.getServerId();
if (partymemberVolunteerUserIds.contains(serverId)) {
partymemberDemandServiceCount++;
} else {
resiDemandServiceCount++;
}
}
totalDemandServiceCount += damendServiceCounts.size();
if (damendServiceCounts.size() <= serviceCountPageSize) {
break;
}
}
// 3.持久化
FactVolunteerServiceDailyEntity insert = new FactVolunteerServiceDailyEntity();
insert.setDateId(DimIdGenerator.getDateDimId(belongTime));
insert.setCustomerId(customerId);
insert.setMonthId(DimIdGenerator.getMonthDimId(belongTime));
insert.setPartyServiceTotal(partymemberDemandServiceCount);
insert.setServiceTotal(totalDemandServiceCount);
insert.setPartyTotal(partymemberVolunteerCount);
insert.setResiServiceTotal(resiDemandServiceCount);
insert.setResiTotal(resiVolunteerCount);
insert.setVolunteerTotal(volunteerTotalCount);
demandStatsService.addVolunteerServiceDaily(insert);
}
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/DemandStatsService.java

@ -0,0 +1,18 @@
package com.epmet.service.stats;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import java.util.List;
/**
*@Description 统计客户下的志愿者需求服务数据
*@Author wangxianzhang
*@Date 2021/12/8
*/
public interface DemandStatsService {
void addVolunteerServiceDaily(FactVolunteerServiceDailyEntity entity);
void clearVolunteerDemandServiceDailyStats(List<String> customerIds, String dateDimId);
}

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DemandStatsServiceImpl.java

@ -0,0 +1,36 @@
package com.epmet.service.stats.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.stats.FactVolunteerServiceDailyDao;
import com.epmet.entity.stats.FactVolunteerServiceDailyEntity;
import com.epmet.service.stats.DemandStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description 描述
* @Author wangxianzhang
* @Date 2021/12/8 10:54 上午
* @Version 1.0
*/
@Service
@DataSource(DataSourceConstant.STATS)
public class DemandStatsServiceImpl implements DemandStatsService {
@Autowired
private FactVolunteerServiceDailyDao factVolunteerServiceDailyDao;
@Override
public void addVolunteerServiceDaily(FactVolunteerServiceDailyEntity entity) {
factVolunteerServiceDailyDao.insert(entity);
}
@Override
public void clearVolunteerDemandServiceDailyStats(List<String> customerIds, String dateDimId) {
factVolunteerServiceDailyDao.clearVolunteerDemandServiceDailyStats(customerIds, dateDimId);
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java

@ -146,4 +146,6 @@ public interface UserService {
List<MidPatrolRecordResult> getPatrolRecordList(MidPatrolFormDTO formDTO);
List<MidPatrolDetailResult> getPatrolDetailList(MidPatrolFormDTO formDTO);
List<String> filterUserIds(List<String> userIds, String roleKey);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java

@ -1109,4 +1109,8 @@ public class UserServiceImpl implements UserService {
return userDao.getPatrolDetailList(formDTO);
}
@Override
public List<String> filterUserIds(List<String> userIds, String roleKey) {
return userDao.filterUserIds(userIds, roleKey);
}
}

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.26__create_volunteer_service_daily.sql

@ -0,0 +1,21 @@
CREATE TABLE epmet_data_statistical.`fact_volunteer_service_daily`
(
`ID` varchar(64) NOT NULL COMMENT '主键',
`CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id',
`DATE_ID` varchar(8) NOT NULL COMMENT 'yyyyMMdd',
`MONTH_ID` varchar(6) NOT NULL COMMENT 'yyyyMM',
`VOLUNTEER_TOTAL` int(11) NOT NULL COMMENT '截止到当前dateId,当前客户下,共有多少个爱心互助的志愿者',
`PARTY_TOTAL` int(11) NOT NULL COMMENT '截止到当前dateId,当前客户下,XX个爱心互助志愿者中,党员有多少个',
`RESI_TOTAL` int(11) NOT NULL COMMENT '截止到当前dateId,当前客户下,XX个爱心互助志愿者中,居民有多少个',
`SERVICE_TOTAL` int(11) NOT NULL COMMENT '服务总次数',
`PARTY_SERVICE_TOTAL` int(11) NOT NULL COMMENT '党员服务总次数',
`RESI_SERVICE_TOTAL` int(11) NOT NULL COMMENT '居民服务总次数',
`DEL_FLAG` int(11) NOT NULL COMMENT '删除标识:0.未删除 1.已删除',
`REVISION` int(11) NOT NULL COMMENT '乐观锁',
`CREATED_BY` varchar(32) NOT NULL COMMENT '创建人',
`CREATED_TIME` datetime NOT NULL COMMENT '创建时间',
`UPDATED_BY` varchar(32) NOT NULL COMMENT '更新人',
`UPDATED_TIME` datetime NOT NULL COMMENT '更新时间',
PRIMARY KEY (`ID`),
UNIQUE KEY `uni_vsd` (`CUSTOMER_ID`,`DATE_ID`,`DEL_FLAG`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='志愿者服务情况统计'

33
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/IcUserDemandServiceDao.xml

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.heart.IcUserDemandServiceDao">
<resultMap type="com.epmet.entity.heart.IcUserDemandServiceEntity" id="icUserDemandServiceMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="demandRecId" column="DEMAND_REC_ID"/>
<result property="serviceType" column="SERVICE_TYPE"/>
<result property="serverId" column="SERVER_ID"/>
<result property="serviceStartTime" column="SERVICE_START_TIME"/>
<result property="serviceEndTime" column="SERVICE_END_TIME"/>
<result property="finishDesc" column="FINISH_DESC"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<select id="listDemandServiceCountPage" resultType="com.epmet.dto.heart.result.DemandServiceCountResultDTO">
select service.SERVER_ID, SERVICE_TYPE
from ic_user_demand_rec damend
inner join ic_user_demand_service service on (damend.ID = service.DEMAND_REC_ID and service.DEL_FLAG = 0)
where damend.DEL_FLAG = 0
and damend.STATUS = 'finished'
and damend.REPORT_TIME <![CDATA[<]]> #{endTime}
and damend.CUSTOMER_ID = #{customerId}
and service.SERVICE_TYPE = #{serviceType}
</select>
</mapper>

23
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/VolunteerInfoDao.xml

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.VolunteerInfoDao">
<resultMap type="com.epmet.entity.heart.VolunteerInfoEntity" id="volunteerInfoMap">
<result property="id" column="ID"/>
<result property="userId" column="USER_ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="volunteerIntroduce" column="VOLUNTEER_INTRODUCE"/>
<result property="volunteerSignature" column="VOLUNTEER_SIGNATURE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
<result property="gridId" column="GRID_ID"/>
<result property="gridName" column="GRID_NAME"/>
</resultMap>
</mapper>

37
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactVolunteerServiceDailyDao.xml

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.stats.FactVolunteerServiceDailyDao">
<resultMap type="com.epmet.entity.stats.FactVolunteerServiceDailyEntity" id="factVolunteerServiceDailyMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="dateId" column="DATE_ID"/>
<result property="monthId" column="MONTH_ID"/>
<result property="volunteerTotal" column="VOLUNTEER_TOTAL"/>
<result property="partyTotal" column="PARTY_TOTAL"/>
<result property="resiTotal" column="RESI_TOTAL"/>
<result property="serviceTotal" column="SERVICE_TOTAL"/>
<result property="partyServiceTotal" column="PARTY_SERVICE_TOTAL"/>
<result property="resiServiceTotal" column="RESI_SERVICE_TOTAL"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<delete id="clearVolunteerDemandServiceDailyStats">
delete
from fact_volunteer_service_daily
where DATE_ID=#{dateDimId}
and CUSTOMER_ID in
<foreach collection="customerIds" open="(" separator="," close=")" item="customerId">
#{customerId}
</foreach>
</delete>
</mapper>

13
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml

@ -1052,5 +1052,18 @@
order by created_time
LIMIT #{offset},#{pageSize}
</select>
<!-- 从UserId列表中过滤符合条件的UserId列表出来 -->
<select id="filterUserIds" resultType="java.lang.String">
select distinct ur.USER_ID
from user_role ur
inner join epmet_role er on (ur.ROLE_ID = er.ID)
where ur.DEL_FLAG = 0
and ur.USER_ID in
<foreach collection="userIds" open="(" item="userId" separator="," close=")">
#{userId}
</foreach>
and er.ROLE_KEY = #{roleKey}
</select>
</mapper>

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) {

103
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
@ -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,98 @@ 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)){
for(CategoryAnalysisDTO result:list){
if (map.containsKey(result.getCategoryCode()) && null != map.get(result.getCategoryCode())) {
result.setDetail(map.get(result.getCategoryCode()).getDetail());
}
}
}
}
//返回结果,也不知道对不对
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);
});
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

@ -2885,7 +2885,7 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
* 分段规则
* 组织内所有网格项目数网格内最低项目数向下十位取整数网格内最高项目数向上取整数获得取值范围
*
* 根据
* 根据 采用这个公式
* 最小取值+最大取值-最小取值/3
* 最小取值+最大取值-最小取值*2/3
* 获得两个数值用两个数值确定三个取值范围
@ -2933,21 +2933,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;
}

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;
@ -505,4 +506,56 @@ public class IcResiUserController {
ValidatorUtils.validateEntity(formDTO, DemandUserFormDTO.InternalGroup.class);
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));
}
}

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;
@ -153,4 +154,40 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
IcResiUserDTO getByIdCard(String customerId, String idNum,String icResiUserId);
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);
}

117
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -25,11 +25,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;
@ -54,10 +54,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;
@ -102,6 +99,8 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
private RedisUtils redisUtils;
@Autowired
private UserService userService;
@Autowired
private EpmetAdminOpenFeignClient epmetAdminOpenFeignClient;
private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
@ -883,4 +882,106 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
public IcResiUserBriefDTO findFamilyMem(String icResiUserId) {
return baseDao.selectIcResuUser(icResiUserId);
}
/**
* 党员年龄范围统计
*
* @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