Browse Source

Merge remote-tracking branch 'origin/dev_screen_data_2.0' into dev_screen_data_2.0

master
yinzuomei 5 years ago
parent
commit
f31a9b18fc
  1. 30
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java
  2. 16
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java
  3. 49
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java
  4. 96
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java
  5. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml
  6. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml
  7. 4
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml
  8. 31
      epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml
  9. 3
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java
  10. 27
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CpcScoreResultDTO.java
  11. 10
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java
  12. 26
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/point/UserPointDTO.java
  13. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java
  14. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  15. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java
  16. 30
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyBranchDataDao.java
  17. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java
  18. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java
  19. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java
  20. 27
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/point/PointDao.java
  21. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java
  22. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java
  23. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/user/UserDao.java
  24. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexDictEntity.java
  25. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPartyUserRankDataEntity.java
  26. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java
  27. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java
  28. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java
  29. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java
  30. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java
  31. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java
  32. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java
  33. 120
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java
  34. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java
  35. 119
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java
  36. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/CpcIndexCalculateService.java
  37. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  38. 30
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyBranchDataService.java
  39. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyLinkMassesDataService.java
  40. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java
  41. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  42. 50
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyBranchDataServiceImpl.java
  43. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyLinkMassesDataServiceImpl.java
  44. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java
  45. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java
  46. 53
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java
  47. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java
  48. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java
  49. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/UserPointService.java
  50. 46
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/impl/UserPointServiceImpl.java
  51. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java
  52. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/UserService.java
  53. 50
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/user/impl/UserServiceImpl.java
  54. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml
  55. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  56. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  57. 59
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml
  58. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml
  59. 59
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml
  60. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml
  61. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  62. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml
  63. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml
  64. 37
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactParticipationUserGridDailyDao.xml
  65. 43
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml
  66. 24
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/user/UserDao.xml
  67. BIN
      epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx

30
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/IndexDictResultDTO.java

@ -0,0 +1,30 @@
package com.epmet.evaluationindex.screen.dto.result;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 评价指标字典表数据--接口返参
* @Author sun
*/
@Data
public class IndexDictResultDTO implements Serializable {
private static final long serialVersionUID = 3860268744336541373L;
/**
* 指标名
*/
private String indexName;
/**
* 指标code
*/
private String indexCode;
/**
* 指标值类型 百分比percent
*/
private String valueType;
}

16
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/constant/FactConstant.java

@ -45,4 +45,20 @@ public interface FactConstant {
* 网格相关
*/
String WANG_GE_XIANG_GUAN = "wanggexiangguan";
/**
* 评价指标类型-
*/
String NONE = "none";
/**
* 评价指标类型-整数
*/
String INTEGER = "integer";
/**
* 评价指标类型-小数
*/
String DECIMAL = "decimal";
/**
* 评价指标类型-百分比
*/
String PERCENT = "percent";
}

49
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/fact/IndexDictDao.java

@ -0,0 +1,49 @@
/**
* 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.datareport.dao.fact;
import com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 评价指标字典
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
*/
@Mapper
public interface IndexDictDao {
/**
* @param
* @Description 查询指标字典表是百分比类型的数据
* @author sun
*/
List<IndexDictResultDTO> selectList();
/**
* @param
* @Description 根据indexCode查询指标字典表具体数据
* @author sun
*/
IndexDictResultDTO selectIndexDict(@Param("indexCode") String indexCode);
}

96
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/fact/impl/FactIndexServiceImpl.java

@ -15,12 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
/**
* 数据改版api
@ -47,6 +45,8 @@ public class FactIndexServiceImpl implements FactIndexService {
private FactIndexGridScoreDao factIndexGridScoreDao;
@Autowired
private FactIndexGridSubScoreDao factIndexGridSubScoreDao;
@Autowired
private IndexDictDao indexDictDao;
/**
* @param formDTO
@ -125,19 +125,27 @@ public class FactIndexServiceImpl implements FactIndexService {
AblityIndexResultDTO nl = new AblityIndexResultDTO();
nl.setIndexCode(FactConstant.NLZB);
nl.setScoreList(nlList);
if(null != nlList){resultList.add(nl);}
if (null != nlList) {
resultList.add(nl);
}
AblityIndexResultDTO dj = new AblityIndexResultDTO();
dj.setIndexCode(FactConstant.DJNL);
dj.setScoreList(djList);
if(null != djList){resultList.add(dj);}
if (null != djList) {
resultList.add(dj);
}
AblityIndexResultDTO zl = new AblityIndexResultDTO();
zl.setIndexCode(FactConstant.ZLNL);
zl.setScoreList(zlList);
if(null != zlList){resultList.add(zl);}
if (null != zlList) {
resultList.add(zl);
}
AblityIndexResultDTO fw = new AblityIndexResultDTO();
fw.setIndexCode(FactConstant.FWNL);
fw.setScoreList(fwList);
if(null != fwList){resultList.add(fw);}
if (null != fwList) {
resultList.add(fw);
}
return resultList;
}
@ -203,9 +211,15 @@ public class FactIndexServiceImpl implements FactIndexService {
throw new RenException(String.format("按月份查询各项能力分数,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
//5.封装数据并返回
if(null != dj){resultList.add(dj);}
if(null != zl){resultList.add(zl);}
if(null != fw){resultList.add(fw);}
if (null != dj) {
resultList.add(dj);
}
if (null != zl) {
resultList.add(zl);
}
if (null != fw) {
resultList.add(fw);
}
return resultList;
}
@ -278,15 +292,21 @@ public class FactIndexServiceImpl implements FactIndexService {
MonthScoreListResultDTO dj = new MonthScoreListResultDTO();
dj.setIndexCode(FactConstant.DJNL);
dj.setScoreList(djList);
if(null != djList){resultList.add(dj);}
if (null != djList) {
resultList.add(dj);
}
MonthScoreListResultDTO zl = new MonthScoreListResultDTO();
zl.setIndexCode(FactConstant.ZLNL);
zl.setScoreList(zlList);
if(null != zlList){resultList.add(zl);}
if (null != zlList) {
resultList.add(zl);
}
MonthScoreListResultDTO fw = new MonthScoreListResultDTO();
fw.setIndexCode(FactConstant.FWNL);
fw.setScoreList(fwList);
if(null != fwList){resultList.add(fw);}
if (null != fwList) {
resultList.add(fw);
}
return resultList;
}
@ -333,7 +353,28 @@ public class FactIndexServiceImpl implements FactIndexService {
throw new RenException(String.format("按月查询各项指标数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
//4.调用方法判断各项指标是数字指标还是百分比指标 //TODO 记得value值保留一位小数 是数的保留零位小数 是百分比的保留一位小数
//4.查询指标字典表数据
List<IndexDictResultDTO> list = indexDictDao.selectList();
//5.遍历数据,判断数据类型并处理
/*NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1);*/
resultList.forEach(result -> {
list.forEach(l -> {
if (result.getKey().equals(l.getIndexCode())) {
//小数类型,四舍五入保留小数点后一位
if (FactConstant.DECIMAL.equals(l.getValueType())) {
BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP);
result.setValue(num.toString());
}
//百分数类型,四舍五入保留小数点后一位并转成百分比
if (FactConstant.PERCENT.equals(l.getValueType())) {
BigDecimal num = new BigDecimal(result.getValue()).setScale(1, BigDecimal.ROUND_HALF_UP);
result.setValue(num+"%");
}
}
});
});
return resultList;
}
@ -373,7 +414,30 @@ public class FactIndexServiceImpl implements FactIndexService {
throw new RenException(String.format("按月查询各项指标最近12个月数据,orgType类型错误,组织Id:%s,类型Type:%s", formDTO.getOrgId(), formDTO.getOrgType()));
}
//6.调用方法判断各项指标是数字指标还是百分比指标//TODO 记得value值保留一位小数 是数的保留零位小数 是百分比的保留一位小数
//6.查询指标字典表具体数据
IndexDictResultDTO dictDTO = indexDictDao.selectIndexDict(formDTO.getKey());
if (null == dictDTO) {
throw new RenException(String.format("根据评价指标indexCode未查询到字典表数据,indexCode值:%s", formDTO.getKey()));
}
//7.遍历数据,判断数据类型并处理
/*NumberFormat nf = NumberFormat.getPercentInstance();
nf.setMaximumFractionDigits(1);*/
//小数类型,四舍五入保留小数点后一位
if (FactConstant.DECIMAL.equals(dictDTO.getValueType())) {
resultList.forEach(result -> {
BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP);
result.setAblity(num.toString());
});
}
//百分数类型,四舍五入保留小数点后一位并转成百分比
if (FactConstant.PERCENT.equals(dictDTO.getValueType())) {
resultList.forEach(result -> {
BigDecimal num = new BigDecimal(result.getAblity()).setScale(1, BigDecimal.ROUND_HALF_UP);
result.setAblity(num+"%");
});
}
return resultList;
}

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexAgencySubScoreDao.xml

@ -6,7 +6,7 @@
<select id="selectAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO">
SELECT
fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "value",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
dict.index_name AS "name"
FROM
fact_index_agency_sub_score fact
@ -23,7 +23,7 @@
<select id="selectMonthAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO">
SELECT
fact.month_id AS "monthId",
IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity"
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity"
FROM
fact_index_agency_sub_score fact
LEFT JOIN index_dict dict ON fact.index_code = dict.index_code

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexCommunitySubScoreDao.xml

@ -6,7 +6,7 @@
<select id="selectCommunityAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO">
SELECT
fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "value",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
dict.index_name AS "name"
FROM
fact_index_community_sub_score fact
@ -23,7 +23,7 @@
<select id="selectCommunityMonthAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO">
SELECT
fact.month_id AS "monthId",
IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity"
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity"
FROM
fact_index_community_sub_score fact
LEFT JOIN index_dict dict ON fact.index_code = dict.index_code

4
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/FactIndexGridSubScoreDao.xml

@ -6,7 +6,7 @@
<select id="selectGridAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.AblityListResultDTO">
SELECT
fact.index_code AS "key",
IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "value",
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "value",
dict.index_name AS "name"
FROM
fact_index_grid_sub_score fact
@ -23,7 +23,7 @@
<select id="selectGridMonthAblityList" resultType="com.epmet.evaluationindex.screen.dto.result.MonthAblityListResultDTO">
SELECT
fact.month_id AS "monthId",
IF(fact.origin_value='',0,IFNULL(ROUND(fact.origin_value,1),0)) AS "ablity"
IF(fact.origin_value='',0,IFNULL(fact.origin_value,0)) AS "ablity"
FROM
fact_index_grid_sub_score fact
LEFT JOIN index_dict dict ON fact.index_code = dict.index_code

31
epmet-module/data-report/data-report-server/src/main/resources/mapper/fact/IndexDictDao.xml

@ -0,0 +1,31 @@
<?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.datareport.dao.fact.IndexDictDao">
<select id="selectList" resultType="com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO">
SELECT
index_name AS "indexName",
index_code AS "indexCode",
value_type AS "valueType"
FROM
index_dict
WHERE
del_flag = '0'
AND value_type != 'none'
</select>
<select id="selectIndexDict" resultType="com.epmet.evaluationindex.screen.dto.result.IndexDictResultDTO">
SELECT
index_name AS "indexName",
index_code AS "indexCode",
value_type AS "valueType"
FROM
index_dict
WHERE
del_flag = '0'
AND index_code = #{indexCode}
LIMIT 1
</select>
</mapper>

3
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/form/ScreenPartyBranchDataFormDTO.java

@ -88,6 +88,9 @@ public class ScreenPartyBranchDataFormDTO implements Serializable {
private String updatedBy;
public ScreenPartyBranchDataFormDTO() {
this.organizeCount = NumConstant.ZERO;
this.joinUserCount = NumConstant.ZERO;
this.averageJoinUserCount = NumConstant.ZERO;
this.delFlag = NumConstant.ZERO_STR;
this.revision = NumConstant.ZERO;
this.createdBy = "APP_USER";

27
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CpcScoreResultDTO.java

@ -0,0 +1,27 @@
package com.epmet.dto.indexcal;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Description 党员指标得分查询DTO
* @ClassName CpcScoreResultDTO
* @Auth wangc
* @Date 2020-09-25 16:52
*/
@Data
public class CpcScoreResultDTO implements Serializable {
private static final long serialVersionUID = -7129757727997430029L;
/**
* 用户Id
* */
private String userId;
/**
* 党员指标得分
* */
private BigDecimal score;
}

10
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/org/GridInfoDTO.java

@ -38,4 +38,14 @@ public class GridInfoDTO implements Serializable {
* agencyId的pids
*/
private String pids;
/**
* 网格名称
* */
private String gridName;
/**
* 机关名称
* */
private String orgName;
}

26
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/point/UserPointDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.point;
import lombok.Data;
import java.io.Serializable;
/**
* @Description 用户积分DTO
* @ClassName UserPointDTO
* @Auth wangc
* @Date 2020-09-25 15:42
*/
@Data
public class UserPointDTO implements Serializable {
private static final long serialVersionUID = 6976982699085437418L;
/**
* 用户Id
* */
private String userId;
/**
* 用户累计积分
* */
private Integer pointTotal;
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/UserJoinFormDTO.java

@ -3,6 +3,7 @@ package com.epmet.dto.screencoll.form;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 11基层治理-公众参与 入参
@ -47,7 +48,7 @@ public class UserJoinFormDTO implements Serializable {
/**
* 人均议题
*/
private Integer avgIssue;
private BigDecimal avgIssue;
/**
* 总的参与次数
@ -57,5 +58,5 @@ public class UserJoinFormDTO implements Serializable {
/**
* 平均参与度
*/
private Integer avgJoin;
private BigDecimal avgJoin;
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -17,6 +17,7 @@ import com.epmet.dao.stats.DimDateDao;
import com.epmet.dao.stats.DimMonthDao;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ScreenExtractFormDTO;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
@ -651,8 +652,8 @@ public class DemoController {
private PartyGuideService partyGuideService;
@PostMapping("zxczxc")
public Result getZxcZxc(@RequestBody CustomerIdAndDateIdFormDTO formDTO){
// partyGuideService.partyGuideExtract(formDTO.getCustomerId(),formDTO.getDateId());
public Result getZxcZxc(@RequestBody ScreenExtractFormDTO formDTO){
partyGuideService.partyGuideExtract(formDTO);
return new Result();
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CpcScoreDao.java

@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.CpcScoreResultDTO;
import com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -83,4 +84,13 @@ public interface CpcScoreDao extends BaseDao<CpcScoreEntity> {
List<CpcScoreEntity> getPartScore(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allParentCode") String allParentCode, @Param("offset") int offset, @Param("pageSize") int pageSize);
int insertBatch(@Param("list") Collection<CpcScoreEntity> values);
/**
* @Description 查询客户下的党员指标得分
* @param customerId
* @return
* @author wangc
* @date 2020.09.25 17:13
**/
List<CpcScoreResultDTO> selectCpcScore(@Param("customerId") String customerId,@Param("monthId") String monthId);
}

30
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyBranchDataDao.java

@ -65,4 +65,34 @@ public interface ScreenPartyBranchDataDao extends BaseDao<ScreenPartyBranchDataE
* @date 2020/9/25 9:16 上午
*/
void insertScreenPartyBranchData(@Param("lists") List<ScreenPartyBranchDataFormDTO> lists);
/**
* @Description 删除旧的建设情况数据
* @Param customerId
* @Param monthId
* @Param orgIds
* @author zxc
* @date 2020/9/27 9:04 上午
*/
Integer deleteOldScreenPartyBranchData(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("orgIds") List<String> orgIds);
/**
* @Description 根据orgId查询建设情况数据
* @Param customerId
* @Param monthId
* @Param orgIds
* @author zxc
* @date 2020/9/27 9:38 上午
*/
List<ScreenPartyBranchDataFormDTO> selectScreenPartyBranchDataByOrgId(@Param("customerId") String customerId, @Param("monthId") String monthId,@Param("orgIds") List<String> orgIds);
/**
* @Description 根据parentId查询建设情况数据
* @Param customerId
* @Param monthId
* @Param parentId
* @author zxc
* @date 2020/9/27 9:38 上午
*/
List<ScreenPartyBranchDataFormDTO> selectScreenPartyBranchDataByParentId(@Param("customerId")String customerId,@Param("monthId") String monthId,@Param("parentId") String parentId);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyLinkMassesDataDao.java

@ -68,12 +68,11 @@ public interface ScreenPartyLinkMassesDataDao extends BaseDao<ScreenPartyLinkMas
/**
* @Description 删除旧的党员联系群众
* @param customerId
* @param monthId
* @param orgIds
* @author zxc
* @date 2020/9/22 3:28 下午
*/
Integer deleteOldPartyLinkInfo(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("orgIds") List<String> orgIds);
Integer deleteOldPartyLinkInfo(@Param("customerId") String customerId, @Param("orgIds") List<String> orgIds);
/**
* @Description 查询党员联系群众信息

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenPartyUserRankDataDao.java

@ -45,6 +45,15 @@ public interface ScreenPartyUserRankDataDao extends BaseDao<ScreenPartyUserRankD
**/
Integer deletePartyUserRankData(@Param("customerId") String customerId);
/**
* @Description 按照客户月份删除
* @param
* @return java.lang.Integer
* @author wangc
* @date 2020.09.27 11:19
*/
Integer deleteBatchByCustomerIdAndDateId(@Param("customerId") String customerId,@Param("dateId") String dateId);
/**
* 9党建引领|基层治理-居民党员积分排行榜
* 2) 在批量新增
@ -55,4 +64,13 @@ public interface ScreenPartyUserRankDataDao extends BaseDao<ScreenPartyUserRankD
* @Date 10:52 2020-08-18
**/
void batchInsertPartyUserRankData(@Param("list") List<PartyUserRankDataFormDTO> list,@Param("customerId")String customerId);
/**
* @Description 批量插入
* @param list
* @return void
* @author wangc
* @date 2020.09.27 10:06
*/
void insertBatch(List<ScreenPartyUserRankDataEntity> list);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActUserRelationDao.java

@ -20,6 +20,6 @@ public interface ActUserRelationDao {
* @author zxc
* @date 2020/9/25 5:19 下午
*/
List<JoinUserCountResultDTO> selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId);
List<JoinUserCountResultDTO> selectJoinUserCount(@Param("customerId") String customerId,@Param("monthId") String monthId,@Param("orgType") String orgType);
}

27
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/point/PointDao.java

@ -0,0 +1,27 @@
package com.epmet.dao.point;
import com.epmet.dto.point.UserPointDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 积分查询DAO
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-16
*/
@Mapper
public interface PointDao {
/**
* @Description 查询客户下的用户积分
* @param customerId
* @return
* @author wangc
* @date 2020.09.25 15:51
**/
List<UserPointDTO> selectUserPointByCustomerId(@Param("customerId") String customerId);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactParticipationUserGridDailyDao.java

@ -48,13 +48,4 @@ public interface FactParticipationUserGridDailyDao extends BaseDao<FactParticipa
* @date 2020/9/23 9:57 上午
*/
List<UserCountResultDTO> selectUserCount(String customerId, String dateId);
/**
* @Description 根据机构级别查询用户数与党员数
* @param orgLevel
* @return
* @author wangc
* @date 2020.09.24 14:59
**/
List<ScreenUserTotalDataEntity> selectUserAndPartymemberByOrgLevel(@Param("orgLevel") String orgLevel,@Param("customerId") String customerId, @Param("dateId")String dateId);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/user/FactRegUserGridDailyDao.java

@ -19,6 +19,7 @@ package com.epmet.dao.stats.user;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.stats.user.FactRegUserGridDailyDTO;
import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity;
import com.epmet.entity.stats.user.FactRegUserGridDailyEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -38,4 +39,12 @@ public interface FactRegUserGridDailyDao extends BaseDao<FactRegUserGridDailyEnt
void deleteByParams(@Param("dateId")String dateId,@Param("customerId")String customerId);
/**
* @Description 根据机构级别查询用户数与党员数
* @param orgLevel
* @return
* @author wangc
* @date 2020.09.24 14:59
**/
List<ScreenUserTotalDataEntity> selectUserAndPartymemberByOrgLevel(@Param("orgLevel") String orgLevel, @Param("customerId") String customerId, @Param("dateId")String dateId);
}

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

@ -3,6 +3,7 @@ package com.epmet.dao.user;
import com.epmet.dto.extract.form.GridHeartedFormDTO;
import com.epmet.dto.extract.result.UserPartyResultDTO;
import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -121,4 +122,13 @@ public interface UserDao {
* @Date 2020/9/21 13:46
**/
List<String> selectGridRegUserIds(@Param("customerId") String customerId, @Param("gridId") String gridId);
/**
* @Description 获取客户下的网格注册居民
* @param customerId
* @return
* @author wangc
* @date 2020.09.25 13:54
**/
List<ScreenPartyUserRankDataEntity> selectRegisteredUserByCustomerId(@Param("customerId") String customerId);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/IndexDictEntity.java

@ -59,4 +59,9 @@ public class IndexDictEntity extends BaseEpmetEntity {
* 正相关positive负相关negative
*/
private String correlation;
/**
* 指标值类型 none整数integer小数: decimal;百分比percent
*/
private String valueType;
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenPartyUserRankDataEntity.java

@ -22,6 +22,8 @@ import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 党建引领基层治理-市民党员积分排行榜
*
@ -90,6 +92,10 @@ public class ScreenPartyUserRankDataEntity extends BaseEpmetEntity {
*/
private Integer pointTotal;
/**
* 党员指标得分
* */
private BigDecimal indexScore;
/**
* 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增)
*/

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenUserJoinEntity.java

@ -90,7 +90,7 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity {
/**
* 人均议题
*/
private Integer avgIssue;
private BigDecimal avgIssue;
/**
* 人均议题较上月增长率(采集的时候后台自己计算)
@ -105,7 +105,7 @@ public class ScreenUserJoinEntity extends BaseEpmetEntity {
/**
* 平均参与度
*/
private Integer avgJoin;
private BigDecimal avgJoin;
/**
* 平均参与度较上月增长率(采集的时候后台自己计算)

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexExcelDataListener.java

@ -42,7 +42,6 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
List<IndexModel> indexModelList = new ArrayList<>();
private String preWheight;
private Integer wheightSum = 0;
/**
* 假设这个是一个DAO当然有业务逻辑这个也可以是一个service当然如果不用存储这个对象没用
*/
@ -104,6 +103,17 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
}
}
//指标值类型 无:none;整数:integer;小数: decimal;百分比:percent
if (StringUtils.isNotBlank(data.getValueType())) {
if ("整数".equals(data.getValueType())) {
data.setValueType("integer");
} else if ("小数".equals(data.getValueType())) {
data.setValueType("decimal");
} else if ("百分比".equals(data.getValueType())) {
data.setValueType("percent");
}
}
IndexDictEntity entity = new IndexDictEntity();
IndexDictEntity entity2 = new IndexDictEntity();
IndexDictEntity entity3 = new IndexDictEntity();
@ -306,6 +316,7 @@ public class IndexExcelDataListener extends AnalysisEventListener<IndexModel> {
entity5.setCorrelation(data.getCorrelation());
entity5.setLevel("5");
entity5.setIndexCode(Pinyin4jUtil.getSpellPinYin(data.getLevel5Index(), false, 4));
entity.setValueType(data.getValueType());
indexDicMap.put(data.getLevel5Index(), entity5);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/model/IndexModel.java

@ -26,6 +26,11 @@ public class IndexModel {
//没有阈值:无,有就是百分数
@ExcelProperty(value = "阈值")
private String threshold;
/**
* 指标值类型 none整数integer小数: decimal;百分比percent
*/
@ExcelProperty(value = "五级指标值类型")
private String valueType;
/**
* 正相关positive负相关negative
*/

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/CalCpcIndexService.java

@ -1,5 +1,7 @@
package com.epmet.service.evaluationindex.extract.dataToIndex;
import java.util.Map;
/**
* 党员相关
*

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/CalCpcIndexServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.extract.dataToIndex.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.indexcal.CpcScoreResultDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import com.epmet.service.evaluationindex.extract.dataToIndex.CalCpcIndexService;
import com.epmet.service.evaluationindex.extract.todata.*;
@ -126,7 +127,6 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
factIndexPartyAblityCpcMonthlyService.delAndSavePartyAblityCpcMonthly(customerId,monthId,indexPartyAblityCpcList);
}
/**
* @param customerId
* @param partyMemberList
@ -400,4 +400,6 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
}

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexCollCommunityServiceImpl.java

@ -134,18 +134,18 @@ public class IndexCollCommunityServiceImpl implements IndexCollCommunityService
BigDecimal element = new BigDecimal(entity.getClosedProjectCount());
//分母,即机关参与过的项目数(去重)
Integer denominator = agencyParticipatedCount.get(entity.getAgencyId());
if (agencyParticipatedCount.get(entity.getAgencyId()) != NumConstant.ZERO) {
if (null != denominator && denominator != NumConstant.ZERO) {
//办结率
entity.setClosedProjectRatio(
element.divide(new BigDecimal(denominator), NumConstant.SIX, RoundingMode.HALF_UP)
);
}else{
entity.setClosedProjectRatio(BigDecimal.ZERO);
}
//办结效率
entity.setHandleProjectRatio(efficiencyMap.get(entity.getAgencyId()));
});
factIndexGovrnAblityOrgMonthlyService.deleteByCustomer(customerId, dimId.getMonthId(), OrgTypeConstant.COMMUNITY);
factIndexGovrnAblityOrgMonthlyService.saveList(list);

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/ScreenGrassrootsGovernDataAbsorptionService.java

@ -0,0 +1,29 @@
package com.epmet.service.evaluationindex.extract.toscreen;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
/**
* 基层治理
* 热心市民积分 党员能力值
* 难点赌点
* */
public interface ScreenGrassrootsGovernDataAbsorptionService {
/**
* @Description 用户积分党员分值数据中转站
* @param param
* @return
* @author wangc
* @date 2020.09.25 09:53
**/
void userScoreDataHub(ScreenCentralZoneDataFormDTO param);
/**
* @Description 难点赌点数据中转站
* @param param
* @return
* @author wangc
* @date 2020.09.25 10:00
**/
void difficultyDataHub(ScreenCentralZoneDataFormDTO param);
}

120
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyGuideServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.ScreenConstant;
import com.epmet.dto.extract.form.ScreenExtractFormDTO;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
@ -75,7 +76,7 @@ public class PartyGuideServiceImpl implements PartyGuideService {
}
String monthId = screenExtractFormDTO.getMonthId();
if (StringUtils.isEmpty(monthId)){
monthId = LocalDate.now().toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX);
monthId = LocalDate.now().minusMonths(NumConstant.ONE).toString().replace("-","").substring(NumConstant.ZERO,NumConstant.SIX);
}
if (!CollectionUtils.isEmpty(customerIds)){
String finalMonthId = monthId;
@ -272,8 +273,10 @@ public class PartyGuideServiceImpl implements PartyGuideService {
if (!CollectionUtils.isEmpty(agencyIdList)){
List<ScreenPartyBranchDataFormDTO> result = new ArrayList<>();
List<String> orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList());
List<JoinUserCountResultDTO> joinUserCountByAgencyList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.AGENCY);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataByAgencyList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.AGENCY, orgIds);
if (isGrid == true){
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId);
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID);
agencyIdList.forEach(agency -> {
String agencyId = agency.getAgencyId();
Map<String, Object> agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId);
@ -285,14 +288,14 @@ public class PartyGuideServiceImpl implements PartyGuideService {
joinUserCountList.forEach(join -> {
if (party.getOrgId().equals(join.getOrgId())){
party.setAverageJoinUserCount(join.getJoinUserCount());
party.setAverageJoinUserCount(party.getJoinUserCount() / party.getOrganizeCount());
party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount());
party.setYearId(DateUtils.getYearId(monthId));
}
});
});
}
result.addAll(screenPartyBranchDataList);
});
// 社区级别的
Map<String, List<ScreenPartyBranchDataFormDTO>> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyBranchDataFormDTO::getParentId));
List<OrgNameResultDTO> orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds);
@ -309,18 +312,94 @@ public class PartyGuideServiceImpl implements PartyGuideService {
form.setOrgId(agencyId);
form.setCustomerId(customerId);
form.setOrgType(ScreenConstant.AGENCY);
form.setMonthId(monthId);
form.setYearId(DateUtils.getYearId(monthId));
form.setOrganizeCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)));
form.setJoinUserCount(actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)));
form.setAverageJoinUserCount(form.getJoinUserCount() / form.getOrganizeCount());
screenPartyBranchDataByAgencyList.forEach(organize -> {
if (organize.getOrgId().equals(agencyId)){
form.setOrganizeCount(calAdd(organize.getOrganizeCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))));
}
});
joinUserCountByAgencyList.forEach(join -> {
if (join.getOrgId().equals(agencyId)){
form.setJoinUserCount(calAdd(join.getJoinUserCount(),actList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))));
}
});
form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount()));
result.add(form);
});
delAndInsertOrganize(result,customerId,monthId,orgIds);
}else {
List<GridInfoResultDTO> directGridIds = gridService.selectDirectGrid(orgIds);
agencyIdList.forEach(agency -> {
String agencyId = agency.getAgencyId();
List<String> disGridIds = new ArrayList<>();
directGridIds.forEach(grid -> {
if (agencyId.equals(grid.getAgencyId())){
disGridIds.add(grid.getGridId());
}
});
// 存在直属网格
if (!CollectionUtils.isEmpty(disGridIds)){
orgIds.addAll(disGridIds);
List<ScreenPartyBranchDataFormDTO> gridResult = new ArrayList<>();
List<JoinUserCountResultDTO> joinUserCountList = actUserRelationService.selectJoinUserCount(customerId, monthId, ScreenConstant.GRID);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = actInfoService.selectActInfo(customerId, monthId, ScreenConstant.GRID, disGridIds);
if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){
screenPartyBranchDataList.forEach(party -> {
joinUserCountList.forEach(join -> {
if (party.getOrgId().equals(join.getOrgId())){
party.setAverageJoinUserCount(join.getJoinUserCount());
party.setAverageJoinUserCount(party.getOrganizeCount()==NumConstant.ZERO ? NumConstant.ZERO : party.getJoinUserCount() / party.getOrganizeCount());
party.setYearId(DateUtils.getYearId(monthId));
}
});
ScreenPartyBranchDataFormDTO copyParty = ConvertUtils.sourceToTarget(party, ScreenPartyBranchDataFormDTO.class);
gridResult.add(copyParty);
});
}
}
List<ScreenPartyBranchDataFormDTO> disPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByOrgId(customerId, monthId, disGridIds);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = partyBranchDataService.selectScreenPartyBranchDataByParentId(customerId, monthId, agencyId);
screenPartyBranchDataList.addAll(disPartyBranchDataList);
if (!CollectionUtils.isEmpty(screenPartyBranchDataList)){
ScreenPartyBranchDataFormDTO form = new ScreenPartyBranchDataFormDTO();
form.setOrgId(agencyId);
form.setOrgType(ScreenConstant.AGENCY);
form.setOrgName(screenPartyBranchDataList.get(NumConstant.ZERO).getOrgName());
form.setCustomerId(customerId);
form.setMonthId(monthId);
form.setYearId(DateUtils.getYearId(monthId));
form.setParentId(screenPartyBranchDataList.get(NumConstant.ZERO).getParentId());
form.setJoinUserCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount)));
form.setOrganizeCount(screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount)));
screenPartyBranchDataByAgencyList.forEach(organize -> {
if (organize.getOrgId().equals(agencyId)){
form.setOrganizeCount(calAdd(organize.getOrganizeCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getOrganizeCount))));
}
});
joinUserCountByAgencyList.forEach(join -> {
if (join.getOrgId().equals(agencyId)){
form.setJoinUserCount(calAdd(join.getJoinUserCount(),screenPartyBranchDataList.stream().collect(Collectors.summingInt(ScreenPartyBranchDataFormDTO::getJoinUserCount))));
}
});
form.setAverageJoinUserCount(form.getOrganizeCount()==NumConstant.ZERO?NumConstant.ZERO : (form.getJoinUserCount() / form.getOrganizeCount()));
result.add(form);
}
});
delAndInsertOrganize(result,customerId,monthId,orgIds);
}
}
}
public Integer calAdd(Integer a, Integer b){
if (null != a && null != b){
return a + b;
}
return NumConstant.ZERO;
}
/**
* @Description 社区级别的处理
* @Param customerId
@ -381,7 +460,7 @@ public class PartyGuideServiceImpl implements PartyGuideService {
}
Integer delNum;
do {
delNum = linkMassesDataService.deleteOldPartyLinkInfo(customerId, monthId, orgIds);
delNum = linkMassesDataService.deleteOldPartyLinkInfo(customerId, orgIds);
}while (delNum > NumConstant.ZERO);
List<List<ScreenPartyLinkMassesDataFormDTO>> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
@ -403,6 +482,31 @@ public class PartyGuideServiceImpl implements PartyGuideService {
List<ScreenPartyBranchDataFormDTO> screenPartyBranchData = agencyService.selectAllAgencyIdToOrganize(customerId, monthId);
List<ScreenPartyBranchDataFormDTO> screenPartyBranchDataList = gridService.selectAllGridIdToOrganize(customerId, monthId);
screenPartyBranchDataList.addAll(screenPartyBranchData);
List<ScreenPartyBranchDataFormDTO> finalResult = new ArrayList<>();
screenPartyBranchDataList.forEach(rl -> {
orgIds.forEach(orgId -> {
if (rl.getOrgId().equals(orgId)){
finalResult.add(rl);
}
});
});
if (!CollectionUtils.isEmpty(result)){
finalResult.forEach(fr -> {
result.forEach(r -> {
if (fr.getOrgId().equals(r.getOrgId())){
BeanUtils.copyProperties(r,fr);
}
});
});
}
Integer delNum;
do {
delNum = partyBranchDataService.deleteOldScreenPartyBranchData(customerId, monthId, orgIds);
}while (delNum > NumConstant.ZERO);
List<List<ScreenPartyBranchDataFormDTO>> partition = ListUtils.partition(finalResult, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
partyBranchDataService.insertScreenPartyBranchData(p);
});
}
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PublicPartExtractServiceImpl.java

@ -53,7 +53,7 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
/**
* desc: 抽取公众参与 人均议题 总次数和平均参与度
* targetscreen_user_join
* 总参与统计周期内议题表决的人数
* 总参与统计周期内议题表决(虽然可以评价 但是只有表决的人可以评价 所以按表决人数算)的人数
* 百人人均议题统计周期内总的议题数/注册用户数/100
* 百人平均参与度每个议题的实际参与数/应参与数 的平均值每个议题的实际参与数/应参与数的和/被表决的议题数
* 不考虑市北人均议题统计周期内议题总数/发过议题的人数 参与度各个行为(表决)的总数/发生行为的人数
@ -102,7 +102,12 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
//百人人均议题:统计周期内总的议题数/(注册用户数/100)
BigDecimal avgIssueCount = new BigDecimal(issue.getIssueIncr()).divide(new BigDecimal(user.getUserCount()).divide(new BigDecimal(NumConstant.ONE_HUNDRED)));
// 需要修改字段类型
//entity.setAvgIssue(avgIssueCount);
entity.setAvgIssue(avgIssueCount);
//百人平均参与度:每个议题的实际参与数/应参与数 的平均值:(每个议题的实际参与数/应参与数)的和)/被表决的议题数
entity.setAvgJoin(new BigDecimal(0));
});
@ -144,10 +149,10 @@ public class PublicPartExtractServiceImpl implements PublicPartExtractService {
entity.setJoinTotal(0);
entity.setJoinTotalUpRate(new BigDecimal("0"));
entity.setJoinTotalUpFlag("");
entity.setAvgIssue(0);
entity.setAvgIssue(new BigDecimal(0));
entity.setAvgIssueUpRate(new BigDecimal("0"));
entity.setAvgIssueUpFlag("");
entity.setAvgJoin(0);
entity.setAvgJoin(new BigDecimal(0));
entity.setAgvgJoinUpRate(new BigDecimal("0"));
entity.setAgvgJoinUpFlag("");
result.put(entity.getOrgId(), entity);

119
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenGrassrootsGovernDataAbsorptionServiceImpl.java

@ -0,0 +1,119 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.dto.org.GridInfoDTO;
import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovernDataAbsorptionService;
import com.epmet.service.evaluationindex.indexcal.CpcIndexCalculateService;
import com.epmet.service.evaluationindex.screen.ScreenPartyUserRankDataService;
import com.epmet.service.org.CustomerGridService;
import com.epmet.service.point.UserPointService;
import com.epmet.service.user.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description 基层治理数据
* @ClassName ScreenGrassrootsGovernDataAbsorptionServiceImpl
* @Auth wangc
* @Date 2020-09-25 09:48
*/
@Service
@Slf4j
public class ScreenGrassrootsGovernDataAbsorptionServiceImpl implements ScreenGrassrootsGovernDataAbsorptionService {
@Autowired
private UserService userService;
@Autowired
private CustomerGridService customerGridService;
@Autowired
private UserPointService userPointService;
@Autowired
private CpcIndexCalculateService cpcIndexCalculateService;
@Autowired
private ScreenPartyUserRankDataService screenPartyUserRankDataService;
/**
* @Description 用户积分党员分值数据中转站
* @param param
* @return
* @author wangc
* @date 2020.09.25 09:53
**/
@Override
public void userScoreDataHub(ScreenCentralZoneDataFormDTO param) {
//1.查询出客户下的网格注册用户
List<ScreenPartyUserRankDataEntity> registeredUsers = userService.getRegisteredUserList(param.getCustomerId());
//2.查询出客户下网格的相关信息
List<GridInfoDTO> gridList = customerGridService.queryGridInfoList(param.getCustomerId());
Map<String,GridInfoDTO> gridMap = new HashMap<>();
gridList.forEach(grid -> {gridMap.put(grid.getGridId(),grid);});
//3.查询出客户下用户的累计积分(累计值,没有时间概念,否则需要查询积分明细计算出评价周期末的得分)
Map<String,Integer> pointMap = userPointService.getUserPointMap(param.getCustomerId());
//4.查询出客户下党员的分值
String dateId = param.getDateId();
if(StringUtils.isEmpty(dateId)){
//如果没有传月份,则使用当前时间的上一个月
dateId = DateUtils.getBeforeNMonth(NumConstant.ONE);
}else{
String dateType = DateUtils.identifyTimeDimension(dateId);
if(StringUtils.isEmpty(dateType) || !org.apache.commons.lang3.StringUtils.equalsAny(dateType,"date","month")){
dateId = DateUtils.getBeforeNMonth(NumConstant.ONE);
}else if(org.apache.commons.lang3.StringUtils.equals(dateType,"date")){
dateId = dateId.substring(NumConstant.ZERO,dateId.length() - NumConstant.TWO);
}
}
final String finalDateId = dateId;
Map<String, BigDecimal> scoreMap = cpcIndexCalculateService.getCpcScore(param.getCustomerId(),dateId);
//5.整合数据
if(!CollectionUtils.isEmpty(registeredUsers)){
registeredUsers.forEach(user -> {
GridInfoDTO gridInfo = gridMap.get(user.getGridId());
if(null != gridInfo){
user.setGridName(gridInfo.getGridName());
user.setOrgId(gridInfo.getAgencyId());
user.setOrgName(gridInfo.getOrgName());
user.setAllParentIds(gridInfo.getPids());
}
Integer point = pointMap.get(user.getUserId());
BigDecimal score = scoreMap.get(user.getUserId());
user.setPointTotal(null == point ? NumConstant.ZERO : point);
user.setIndexScore(null == score ? new BigDecimal(NumConstant.ZERO) : score);
user.setDataEndTime(finalDateId);
});
}
//6.存入数据库
screenPartyUserRankDataService.dataClean(registeredUsers,param.getCustomerId(),dateId);
}
/**
* @Description 难点赌点数据中转站
* @param param
* @return
* @author wangc
* @date 2020.09.25 10:00
**/
@Override
public void difficultyDataHub(ScreenCentralZoneDataFormDTO param) {
}
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/CpcIndexCalculateService.java

@ -2,6 +2,9 @@ package com.epmet.service.evaluationindex.indexcal;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import java.math.BigDecimal;
import java.util.Map;
/**
* 党员指标计算service
*
@ -15,4 +18,14 @@ public interface CpcIndexCalculateService {
* @return
*/
Boolean cpcIndexCalculate(CalculateCommonFormDTO formDTO);
/**
* @Description 获取党员指标得分
* @param customerId
* @param monthId
* @return
* @author wangc
* @date 2020.09.25 16:48
**/
Map<String, BigDecimal> getCpcScore(String customerId, String monthId);
}

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.dao.evaluationindex.indexcal.CpcScoreDao;
import com.epmet.dao.evaluationindex.indexcal.CpcSubScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.CpcScoreResultDTO;
import com.epmet.entity.evaluationindex.indexcal.CpcScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.CpcSubScoreEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
@ -66,6 +67,24 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
return true;
}
/**
* @Description 获取党员指标得分
* @param customerId
* @param monthId
* @return
* @author wangc
* @date 2020.09.25 16:48
**/
@Override
public Map<String, BigDecimal> getCpcScore(String customerId, String monthId) {
List<CpcScoreResultDTO> scores = cpcScoreDao.selectCpcScore(customerId,monthId);
Map<String,BigDecimal> map = new HashMap<>();
if(!CollectionUtils.isEmpty(scores)){
scores.forEach(score -> {map.put(score.getUserId(),score.getScore());});
}
return map;
}
/**
* desc: 计算总分
*

30
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyBranchDataService.java

@ -39,4 +39,34 @@ public interface ScreenPartyBranchDataService extends BaseService<ScreenPartyBra
*/
void insertScreenPartyBranchData(List<ScreenPartyBranchDataFormDTO> lists);
/**
* @Description 删除旧的建设情况数据
* @Param customerId
* @Param monthId
* @Param orgIds
* @author zxc
* @date 2020/9/27 9:04 上午
*/
Integer deleteOldScreenPartyBranchData(String customerId, String monthId, List<String> orgIds);
/**
* @Description 根据orgId查询建设情况数据
* @Param customerId
* @Param monthId
* @Param orgIds
* @author zxc
* @date 2020/9/27 9:38 上午
*/
List<ScreenPartyBranchDataFormDTO> selectScreenPartyBranchDataByOrgId(String customerId, String monthId, List<String> orgIds);
/**
* @Description 根据parentId查询建设情况数据
* @Param customerId
* @Param monthId
* @Param parentId
* @author zxc
* @date 2020/9/27 9:38 上午
*/
List<ScreenPartyBranchDataFormDTO> selectScreenPartyBranchDataByParentId(String customerId, String monthId, String parentId);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyLinkMassesDataService.java

@ -42,12 +42,11 @@ public interface ScreenPartyLinkMassesDataService extends BaseService<ScreenPart
/**
* @Description 删除旧的党员联系群众
* @param customerId
* @param monthId
* @param orgIds
* @author zxc
* @date 2020/9/22 3:28 下午
*/
Integer deleteOldPartyLinkInfo(String customerId, String monthId, List<String> orgIds);
Integer deleteOldPartyLinkInfo(String customerId, List<String> orgIds);
/**
* @Description 查询党员联系群众信息

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenPartyUserRankDataService.java

@ -20,6 +20,8 @@ package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import java.util.List;
/**
* 党建引领基层治理-市民党员积分排行榜
*
@ -28,4 +30,15 @@ import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
*/
public interface ScreenPartyUserRankDataService extends BaseService<ScreenPartyUserRankDataEntity> {
/**
* @Description 用户参与排行数据清洗
* @param dataList
* @param customerId
* @return
* @author wangc
* @date 2020.09.27 09:44
**/
void dataClean(List<ScreenPartyUserRankDataEntity> dataList,String customerId,String dateId);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java

@ -175,7 +175,7 @@ public class ScreenCustomerAgencyServiceImpl implements ScreenCustomerAgencyServ
@Override
public List<ScreenPartyBranchDataFormDTO> selectAllAgencyIdToOrganize(String customerId, String monthId) {
return null;
return screenCustomerAgencyDao.selectAllAgencyIdToOrganize(customerId, monthId);
}
/**

50
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyBranchDataServiceImpl.java

@ -18,7 +18,10 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenPartyBranchDataDao;
import com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenPartyBranchDataEntity;
@ -26,6 +29,7 @@ import com.epmet.service.evaluationindex.screen.ScreenPartyBranchDataService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
@ -35,6 +39,7 @@ import java.util.List;
* @since v1.0.0 2020-09-22
*/
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenPartyBranchDataServiceImpl extends BaseServiceImpl<ScreenPartyBranchDataDao, ScreenPartyBranchDataEntity> implements ScreenPartyBranchDataService {
/**
@ -49,4 +54,49 @@ public class ScreenPartyBranchDataServiceImpl extends BaseServiceImpl<ScreenPart
baseDao.insertScreenPartyBranchData(lists);
}
}
/**
* @Description 删除旧的建设情况数据
* @Param customerId
* @Param monthId
* @Param orgIds
* @author zxc
* @date 2020/9/27 9:04 上午
*/
@Override
public Integer deleteOldScreenPartyBranchData(String customerId, String monthId, List<String> orgIds) {
if (!CollectionUtils.isEmpty(orgIds)){
return baseDao.deleteOldScreenPartyBranchData(customerId, monthId, orgIds);
}
return NumConstant.ZERO;
}
/**
* @Description 根据orgId查询建设情况数据
* @Param customerId
* @Param monthId
* @Param orgIds
* @author zxc
* @date 2020/9/27 9:38 上午
*/
@Override
public List<ScreenPartyBranchDataFormDTO> selectScreenPartyBranchDataByOrgId(String customerId, String monthId, List<String> orgIds) {
if (!CollectionUtils.isEmpty(orgIds)){
return baseDao.selectScreenPartyBranchDataByOrgId(customerId, monthId, orgIds);
}
return new ArrayList<>();
}
/**
* @Description 根据parentId查询建设情况数据
* @Param customerId
* @Param monthId
* @Param parentId
* @author zxc
* @date 2020/9/27 9:38 上午
*/
@Override
public List<ScreenPartyBranchDataFormDTO> selectScreenPartyBranchDataByParentId(String customerId, String monthId, String parentId) {
return baseDao.selectScreenPartyBranchDataByParentId(customerId, monthId, parentId);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyLinkMassesDataServiceImpl.java

@ -57,14 +57,13 @@ public class ScreenPartyLinkMassesDataServiceImpl extends BaseServiceImpl<Screen
/**
* @Description 删除旧的党员联系群众
* @param customerId
* @param monthId
* @param orgIds
* @author zxc
* @date 2020/9/22 3:28 下午
*/
@Override
public Integer deleteOldPartyLinkInfo(String customerId, String monthId, List<String> orgIds) {
return baseDao.deleteOldPartyLinkInfo(customerId, monthId, orgIds);
public Integer deleteOldPartyLinkInfo(String customerId, List<String> orgIds) {
return baseDao.deleteOldPartyLinkInfo(customerId, orgIds);
}
/**

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenPartyUserRankDataServiceImpl.java

@ -19,11 +19,15 @@ package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.dao.evaluationindex.screen.ScreenPartyUserRankDataDao;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.service.evaluationindex.screen.ScreenPartyUserRankDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 党建引领基层治理-市民党员积分排行榜
*
@ -33,5 +37,23 @@ import org.springframework.stereotype.Service;
@Service
public class ScreenPartyUserRankDataServiceImpl extends BaseServiceImpl<ScreenPartyUserRankDataDao, ScreenPartyUserRankDataEntity> implements ScreenPartyUserRankDataService {
@Autowired
ScreenPartyUserRankDataDao screenPartyUserRankDataDao;
/**
* @Description 用户参与排行数据清洗
* @param dataList
* @param customerId
* @return
* @author wangc
* @date 2020.09.27 09:44
**/
@Override
public void dataClean(List<ScreenPartyUserRankDataEntity> dataList, String customerId, String dateId) {
int affectedRows;
do{
affectedRows = baseDao.deleteBatchByCustomerIdAndDateId(customerId,dateId);
}while (affectedRows > NumConstant.ZERO);
baseDao.insertBatch(dataList);
}
}

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenUserTotalDataServiceImpl.java

@ -18,12 +18,15 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenUserTotalDataDao;
import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity;
import com.epmet.service.evaluationindex.screen.ScreenUserTotalDataService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.List;
@ -35,6 +38,7 @@ import java.util.List;
* @since v1.0.0 2020-09-22
*/
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenUserTotalDataServiceImpl extends BaseServiceImpl<ScreenUserTotalDataDao, ScreenUserTotalDataEntity> implements ScreenUserTotalDataService {
/**
@ -45,11 +49,12 @@ public class ScreenUserTotalDataServiceImpl extends BaseServiceImpl<ScreenUserTo
* @date 2020.09.24 17:59
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void dataClean(List<ScreenUserTotalDataEntity> list,String customerId) {
int deleteNum;
do {
deleteNum = baseDao.deleteUserTotalData(customerId);
} while (deleteNum <= NumConstant.ZERO);
} while (deleteNum > NumConstant.ZERO);
if(!CollectionUtils.isEmpty(list)){
baseDao.insertBatch(list);

53
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java

@ -413,15 +413,35 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
* @Author zhangyong
* @Date 15:38 2020-08-21
**/
private BigDecimal calculateGrowthRateNumber(Integer old, Integer now){
if (NumConstant.ZERO == old){
private BigDecimal calculateGrowthRateNumber(Integer old, Integer now) {
if (NumConstant.ZERO == old) {
return new BigDecimal(now * NumConstant.ONE_HUNDRED);
}
BigDecimal bignum1 = new BigDecimal((now - old) * NumConstant.ONE_HUNDRED);
BigDecimal bignum2 = bignum1.divide(new BigDecimal(old),2,BigDecimal.ROUND_HALF_UP);
BigDecimal bignum2 = bignum1.divide(new BigDecimal(old), 2, BigDecimal.ROUND_HALF_UP);
return bignum2;
}
/**
* 计算 本月数值 相较于 上月数值的增长率
*
* @param old 上月数值
* @param now 本月数值
* @return java.math.BigDecimal
* @Author zhangyong
* @Date 15:38 2020-08-21
**/
private BigDecimal calculateGrowthRateNumber(BigDecimal old, BigDecimal now) {
BigDecimal oneHundred = new BigDecimal(NumConstant.ONE_HUNDRED);
if (old.compareTo(new BigDecimal(NumConstant.ZERO)) == NumConstant.ZERO) {
return now.multiply(oneHundred);
}
BigDecimal bignum1 = now.subtract(old).multiply(oneHundred);
BigDecimal bignum2 = bignum1.divide(old, 2, BigDecimal.ROUND_HALF_UP);
return bignum2;
}
/**
* 计算 本月数值 相较于 上月数值的增长率 得出标识
*
@ -431,10 +451,29 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
* @Author zhangyong
* @Date 15:38 2020-08-21
**/
private String calculateGrowthRateFlag(Integer old, Integer now){
if (old > now){
private String calculateGrowthRateFlag(Integer old, Integer now) {
if (old > now) {
return CompareConstant.DECR_STR;
} else if (old < now) {
return CompareConstant.INCR_STR;
} else {
return CompareConstant.EQ_STR;
}
}
/**
* 计算 本月数值 相较于 上月数值的增长率 得出标识
*
* @param old 上月数值
* @param now 本月数值
* @return java.util.String
* @Author zhangyong
* @Date 15:38 2020-08-21
**/
private String calculateGrowthRateFlag(BigDecimal old, BigDecimal now) {
if (old.compareTo(now) == 1) {
return CompareConstant.DECR_STR;
} else if (old < now){
} else if (old.compareTo(now) == -1) {
return CompareConstant.INCR_STR;
} else {
return CompareConstant.EQ_STR;
@ -448,7 +487,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
if (formDTO.getIsFirst()) {
int deleteNum;
do {
deleteNum = screenPioneerDataDao.deletePioneerDataByCustomerId(customerId,IndexCalConstant.DELETE_SIZE);
deleteNum = screenPioneerDataDao.deletePioneerDataByCustomerId(customerId, IndexCalConstant.DELETE_SIZE);
} while (deleteNum != NumConstant.ZERO);
}
if (!CollectionUtils.isEmpty(formDTO.getDataList())) {

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/ActUserRelationService.java

@ -17,6 +17,6 @@ public interface ActUserRelationService {
* @author zxc
* @date 2020/9/25 5:19 下午
*/
List<JoinUserCountResultDTO> selectJoinUserCount(String customerId,String monthId);
List<JoinUserCountResultDTO> selectJoinUserCount(String customerId,String monthId, String orgType);
}

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/heart/impl/ActUserRelationServiceImpl.java

@ -29,7 +29,7 @@ public class ActUserRelationServiceImpl implements ActUserRelationService {
* @date 2020/9/25 5:19 下午
*/
@Override
public List<JoinUserCountResultDTO> selectJoinUserCount(String customerId, String monthId) {
return actUserRelationDao.selectJoinUserCount(customerId, monthId);
public List<JoinUserCountResultDTO> selectJoinUserCount(String customerId, String monthId, String orgType) {
return actUserRelationDao.selectJoinUserCount(customerId, monthId, orgType);
}
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/UserPointService.java

@ -0,0 +1,18 @@
package com.epmet.service.point;
import java.util.Map;
/**
* 用户积分库
* */
public interface UserPointService {
/**
* @Description 根据客户Id查询用户积分Map
* @param customerId
* @return
* @author wangc
* @date 2020.09.25 16:00
**/
Map<String,Integer> getUserPointMap(String customerId);
}

46
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/point/impl/UserPointServiceImpl.java

@ -0,0 +1,46 @@
package com.epmet.service.point.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.point.PointDao;
import com.epmet.dto.point.UserPointDTO;
import com.epmet.service.point.UserPointService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description
* @ClassName UserPointServiceImpl
* @Auth wangc
* @Date 2020-09-25 15:54
*/
@Service
@Slf4j
@DataSource(DataSourceConstant.EPMET_POINT)
public class UserPointServiceImpl implements UserPointService {
@Autowired
private PointDao pointDao;
/**
* @Description 根据客户Id查询用户积分Map
* @param customerId
* @return
* @author wangc
* @date 2020.09.25 16:00
**/
@Override
public Map<String, Integer> getUserPointMap(String customerId) {
List<UserPointDTO> points = pointDao.selectUserPointByCustomerId(customerId);
Map<String,Integer> map = new HashMap<>();
if(!CollectionUtils.isEmpty(points)){
points.forEach(point -> {map.put(point.getUserId(),point.getPointTotal());});
}
return map;
}
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/ScreenCentralZoneDataExtractServiceImpl.java

@ -5,12 +5,11 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.stats.*;
import com.epmet.dao.stats.topic.FactTopicTotalAgencyDailyDao;
import com.epmet.dao.stats.topic.FactTopicTotalGridDailyDao;
import com.epmet.dao.stats.user.FactParticipationUserGridDailyDao;
import com.epmet.dao.stats.user.FactRegUserGridDailyDao;
import com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity;
import com.epmet.service.stats.ScreenCentralZoneDataExtractService;
import lombok.extern.slf4j.Slf4j;
@ -35,7 +34,7 @@ import java.util.stream.Collectors;
public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZoneDataExtractService {
@Autowired
private FactParticipationUserGridDailyDao factParticipationUserGridDailyDao;
private FactRegUserGridDailyDao factRegUserGridDailyDao;
@Autowired
private FactGroupGridDailyDao factGroupGridDailyDao;
@Autowired
@ -63,20 +62,22 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
//1.查询用户与党员数据,判断dimId是否为昨天,如果根据这个dimId没有查询出结果,则取前天的数据
//如果还是查不出数据,继续向下执行,这部分数据设置默认值
//注册用户数
List<ScreenUserTotalDataEntity> result =
factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId);
factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,dimId);
if(CollectionUtils.isEmpty(result)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
result = factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
result = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_AGENCY,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
}
if(null == result) result = new LinkedList<>();
}
List<ScreenUserTotalDataEntity> gridUserResult =
factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId);
factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,dimId);
if(CollectionUtils.isEmpty(gridUserResult)){
if(DateUtils.getBeforeNDay(NumConstant.ONE).equals(dimId)){
gridUserResult = factParticipationUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
gridUserResult = factRegUserGridDailyDao.selectUserAndPartymemberByOrgLevel(ORG_LEVEL_GRID,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
}
}
if(!CollectionUtils.isEmpty(gridUserResult)){
@ -145,15 +146,22 @@ public class ScreenCentralZoneDataExtractServiceImpl implements ScreenCentralZon
gridProject = factAgencyProjectDailyDao.selectProjectCountByOrgLevel(ORG_LEVEL_GRID,customerId,DateUtils.getBeforeNDay(NumConstant.TWO));
}
}
Map<String,Integer> projectMap = agencyProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal));
projectMap.putAll(gridProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getIssueTotal)));
Map<String,Integer> projectMap = agencyProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal));
projectMap.putAll(gridProject.stream().collect(Collectors.toMap(ScreenUserTotalDataEntity::getOrgId,ScreenUserTotalDataEntity::getProjectTotal)));
result.forEach(o -> {
String orgId = o.getOrgId();
o.setGroupTotal(groupMap.get(orgId));
o.setTopicTotal(topicMap.get(orgId));
o.setIssueTotal(issueMap.get(orgId));
o.setProjectTotal(projectMap.get(orgId));
Integer count = groupMap.get(orgId);
o.setGroupTotal(null == count ? NumConstant.ZERO : count);
count = topicMap.get(orgId);
o.setTopicTotal(null == count ? NumConstant.ZERO : count);
count = issueMap.get(orgId);
o.setIssueTotal(null == count ? NumConstant.ZERO : count);
count = projectMap.get(orgId);
o.setProjectTotal(null == count ? NumConstant.ZERO : count);
o.setDataEndTime(dimId);
});

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

@ -3,6 +3,7 @@ package com.epmet.service.user;
import com.epmet.dto.AgencySubTreeDto;
import com.epmet.dto.extract.form.GridHeartedFormDTO;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.util.DimIdGenerator;
import org.apache.ibatis.annotations.Param;
@ -65,4 +66,13 @@ public interface UserService {
* @Date 2020/9/21 16:44
**/
List<String> getGridRegUserIds(String customerId, String gridId);
/**
* @Description 获取客户下的网格注册居民
* @param customerId
* @return
* @author wangc
* @date 2020.09.25 13:54
**/
List<ScreenPartyUserRankDataEntity> getRegisteredUserList(String customerId);
}

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

@ -11,6 +11,7 @@ import com.epmet.dto.extract.result.UserPartyResultDTO;
import com.epmet.dto.stats.user.*;
import com.epmet.dto.stats.user.result.UserStatisticalData;
import com.epmet.dto.user.result.CommonTotalAndIncCountResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity;
import com.epmet.service.user.UserService;
import com.epmet.util.DimIdGenerator;
import com.epmet.util.ModuleConstant;
@ -23,7 +24,6 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@ -357,10 +357,6 @@ public class UserServiceImpl implements UserService {
dataPacket.setPartiAgencyDailyList(list);
}
FactRegUserAgencyMonthlyDTO regAgencyM = new FactRegUserAgencyMonthlyDTO();
regAgencyM.setCustomerId(customerId);
regAgencyM.setAgencyId(agencyId);
@ -695,32 +691,9 @@ public class UserServiceImpl implements UserService {
}
}
public static void main(String[] args) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
//calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
System.out.println(format.format(calendar.getTime()));
calendar.setTime(calendar.getTime());
calendar.add(Calendar.DATE, -1);
System.out.println(calendar.getTime());
System.out.println(format.format(calendar.getTime()));
System.out.println(format2.format(calendar.getTime()));
}
/**
* @return java.util.List<java.lang.String>
* @param customerId
@ -735,4 +708,25 @@ public class UserServiceImpl implements UserService {
return userDao.selectGridRegUserIds(customerId,gridId);
}
/**
* @Description 获取客户下的网格注册居民
* @param customerId
* @return
* @author wangc
* @date 2020.09.25 13:54
**/
@Override
public List<ScreenPartyUserRankDataEntity> getRegisteredUserList(String customerId) {
List<ScreenPartyUserRankDataEntity> userList = userDao.selectRegisteredUserByCustomerId(customerId);
List<String> partyList = userDao.selectPartymembersByCustomerId(customerId);
if(!CollectionUtils.isEmpty(userList)){
userList.forEach(user -> {
if(partyList.contains(user.getUserId())){
user.setPartyFlag(NumConstant.ONE);
}
});
}
return userList;
}
}

14
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CpcScoreDao.xml

@ -148,4 +148,18 @@
)
</foreach>
</insert>
<!-- 查询客户下的党员指标得分 -->
<select id="selectCpcScore" resultType="com.epmet.dto.indexcal.CpcScoreResultDTO">
SELECT
USER_ID,
SCORE
FROM
fact_index_cpc_score
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND IS_TOTAL = '1'
AND MONTH_ID = #{monthId}
</select>
</mapper>

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -328,7 +328,8 @@
AGENCY_NAME AS orgName,
CUSTOMER_ID AS customerId,
PID AS parentId,
#{monthId} AS dataEndTime
#{monthId} AS monthId,
SUBSTR(#{monthId},1,4) AS yearId
FROM
screen_customer_agency
WHERE

3
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml

@ -319,7 +319,8 @@
grid_name AS orgName,
CUSTOMER_ID AS customerId,
PARENT_AGENCY_ID AS parentId,
#{monthId} AS dataEndTime
#{monthId} AS monthId,
SUBSTR(#{monthId},1,4) AS yearId
FROM
screen_customer_grid
WHERE

59
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyBranchDataDao.xml

@ -109,4 +109,63 @@
)
</foreach>
</insert>
<!-- 删除旧的建设情况数据 -->
<delete id="deleteOldScreenPartyBranchData">
delete from screen_party_branch_data
where CUSTOMER_ID = #{customerId}
and MONTH_ID = #{monthId}
and
(
<foreach collection="orgIds" item="orgId" separator=" OR ">
org_id = #{orgId}
</foreach>
)
LIMIT 1000
</delete>
<!-- 根据orgId查询建设情况数据 -->
<select id="selectScreenPartyBranchDataByOrgId" resultType="com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO">
SELECT
ORG_ID,
ORGANIZE_COUNT AS organizeCount,
JOIN_USER_COUNT AS joinUserCount
FROM
screen_party_branch_data
WHERE
DEL_FLAG = '0'
AND TYPE = 'voluntaryservice'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND
(
<foreach collection="orgIds" item="gridId" separator=" or ">
ORG_ID = #{gridId}
</foreach>
)
</select>
<!-- 根据parentId查询建设情况数据 -->
<select id="selectScreenPartyBranchDataByParentId" resultType="com.epmet.dto.extract.form.ScreenPartyBranchDataFormDTO">
SELECT
spbd.CUSTOMER_ID,
spbd.YEAR_ID,
spbd.MONTH_ID,
spbd.PARENT_ID AS orgId,
spbd.ORG_TYPE,
sca.AGENCY_NAME AS orgName,
IFNULL(spbd.ORGANIZE_COUNT,0) AS organizeCount,
IFNULL(spbd.JOIN_USER_COUNT,0) AS joinUserCount
FROM
screen_party_branch_data spbd
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = spbd.PARENT_ID
WHERE
spbd.DEL_FLAG = '0'
AND sca.DEL_FLAG = 0
AND spbd.TYPE = 'voluntaryservice'
AND spbd.ORG_TYPE = 'agency'
AND spbd.CUSTOMER_ID = #{customerId}
AND spbd.MONTH_ID = #{monthId}
AND spbd.ORG_ID = #{parentId}
</select>
</mapper>

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyLinkMassesDataDao.xml

@ -13,7 +13,6 @@
<delete id="deleteOldPartyLinkInfo">
delete from screen_party_link_masses_data
where CUSTOMER_ID = #{customerId}
and DATA_END_TIME = #{monthId}
and
(
<foreach collection="orgIds" item="orgId" separator=" OR ">

59
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenPartyUserRankDataDao.xml

@ -9,6 +9,13 @@
limit 1000;
</delete>
<delete id="deleteBatchByCustomerIdAndDateId">
delete from screen_party_user_rank_data
where CUSTOMER_ID = #{customerId}
AND DATA_END_TIME = #{dateId}
limit 1000;
</delete>
<insert id="batchInsertPartyUserRankData" parameterType="map">
insert into screen_party_user_rank_data
(
@ -59,4 +66,56 @@
</foreach>
</insert>
<insert id="insertBatch" parameterType="java.util.List">
insert into screen_party_user_rank_data
(
ID,
CUSTOMER_ID,
GRID_ID,
GRID_NAME,
ORG_ID,
ORG_NAME,
PARTY_FLAG,
USER_ID,
SURNAME,
`NAME`,
USER_NAME,
POINT_TOTAL,
INDEX_SCORE,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME,
DATA_END_TIME,
ALL_PARENT_IDS
) values
<foreach collection="list" item="item" index="index" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{customerId},
#{item.gridId},
#{item.gridName},
#{item.orgId},
#{item.orgName},
#{item.partyFlag},
#{item.userId},
#{item.surname},
#{item.name},
#{item.userName},
#{item.pointTotal},
#{item.indexScore},
'0',
0,
'CRAWLER_ROBOT',
now(),
'CRAWLER_ROBOT',
now(),
#{item.dataEndTime},
#{item.allParentIds}
)
</foreach>
</insert>
</mapper>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActUserRelation.xml

@ -18,7 +18,7 @@
AND asr.REWARD_FLAG = 'agree'
AND ai.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT( ai.ACTUAL_END_TIME, '%Y%m' ) = #{monthId}
AND ai.SPONSOR_TYPE = 'agency'
AND ai.SPONSOR_TYPE = #{orgType}
GROUP BY ai.SPONSOR_ID
</select>
</mapper>

6
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -74,8 +74,10 @@
cg.ID as GRID_ID,
cg.PID as AGENCY_ID,
ca.PID AS PID,
CG.CUSTOMER_ID,
cg.PIDS as PIDS
cg.CUSTOMER_ID,
cg.PIDS as PIDS,
cg.GRID_NAME,
ca.ORGANIZATION_NAME as ORG_NAME
FROM
customer_grid cg
LEFT JOIN customer_agency ca ON ( cg.PID = CA.ID )

19
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/point/UserPointDao.xml

@ -0,0 +1,19 @@
<?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.point.PointDao">
<select id="selectUserPointByCustomerId" resultType="com.epmet.dto.point.UserPointDTO">
SELECT
USER_ID,
TOTAL_POINT
FROM
USER_POINT_TOTAL point
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
</select>
</mapper>

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/FactGroupGridDailyDao.xml

@ -80,11 +80,10 @@
<select id="selectGroupCountByOrgLevel" resultType="com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity">
SELECT
<choose>
<when test='"grid" == orgLevel'>GRID_ID AS orgId,</when>
<otherwise>AGENCY_ID AS orgId,</otherwise>
<when test='"grid" == orgLevel'>GRID_ID AS orgId,GROUP_TOTAL AS groupTotal</when>
<otherwise>AGENCY_ID AS orgId,GROUP_TOTAL_COUNT AS groupTotal</otherwise>
</choose>
GROUP_TOTAL_COUNT AS groupTotal
FROM
<choose>
<when test='"grid" == orgLevel'>fact_group_grid_daily</when>

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

@ -121,42 +121,5 @@
AND DATE_ID = #{dateId}
</select>
<!-- 根据机构级别查询用户数与党员数 -->
<select id="selectUserAndPartymemberByOrgLevel" resultType="com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity">
SELECT
fact.CUSTOMER_ID,
<choose>
<when test='"grid" == orgLevel'>
fact.GRID_ID as orgId,
'grid' as orgType,
dim.GRID_NAME as orgName,
dim.AGENCY_ID as parentId,
</when>
<otherwise>
fact.AGENCY_ID AS orgId,
'agency' AS orgType,dim.AGENCY_NAME AS orgName,
dim.PID AS parentId,
</otherwise>
</choose>
fact.REG_TOTAL as userTotal,
fact.PARTYMEMBER_TOTAL as partyTotal
FROM
<choose>
<when test='"grid" == orgLevel'>fact_participation_user_grid_daily</when>
<otherwise>fact_participation_user_agency_daily</otherwise>
</choose>
fact
LEFT JOIN
<choose>
<when test='"grid" == orgLevel'>dim_grid dim ON fact.GRID_ID = dim.ID </when>
<otherwise>dim_agency dim ON fact.AGENCY_ID = dim.ID </otherwise>
</choose>
AND dim.DEL_FLAG = '0'
AND dim.CUSTOMER_ID = #{customerId}
WHERE
fact.DEL_FLAG = '0'
AND fact.CUSTOMER_ID = #{customerId}
AND fact.DATE_ID = #{dateId}
</select>
</mapper>

43
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/user/FactRegUserGridDailyDao.xml

@ -106,4 +106,47 @@
</if>
</delete>
<!-- 根据机构级别查询用户数与党员数 -->
<select id="selectUserAndPartymemberByOrgLevel" resultType="com.epmet.entity.evaluationindex.screen.ScreenUserTotalDataEntity">
SELECT
fact.CUSTOMER_ID,
<choose>
<when test='"grid" == orgLevel'>
fact.GRID_ID as orgId,
'grid' as orgType,
dim.GRID_NAME as orgName,
dim.AGENCY_ID as parentId,
</when>
<otherwise>
fact.AGENCY_ID AS orgId,
'agency' AS orgType,dim.AGENCY_NAME AS orgName,
dim.PID AS parentId,
</otherwise>
</choose>
fact.REG_TOTAL as userTotal,
fact.PARTYMEMBER_TOTAL as partyTotal
FROM
<choose>
<when test='"grid" == orgLevel'>fact_reg_user_grid_daily</when>
<otherwise>fact_reg_user_agency_daily</otherwise>
</choose>
fact
LEFT JOIN
<choose>
<when test='"grid" == orgLevel'>dim_grid dim ON fact.GRID_ID = dim.ID </when>
<otherwise>dim_agency dim ON fact.AGENCY_ID = dim.ID </otherwise>
</choose>
AND dim.DEL_FLAG = '0'
AND dim.CUSTOMER_ID = #{customerId}
WHERE
fact.DEL_FLAG = '0'
AND fact.CUSTOMER_ID = #{customerId}
AND fact.DATE_ID = #{dateId}
</select>
</mapper>

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

@ -459,6 +459,8 @@
</select>
<!-- 查询当前网格下,首次注册的用户ids -->
<select id="selectGridRegUserIds" parameterType="map" resultType="java.lang.String">
SELECT DISTINCT
USER_ID
@ -470,4 +472,26 @@
and rr.GRID_ID=#{gridId}
AND rr.FIRST_REGISTER = '1'
</select>
<!-- 获取客户下的网格注册居民 -->
<select id="selectRegisteredUserByCustomerId" resultType="com.epmet.entity.evaluationindex.screen.ScreenPartyUserRankDataEntity">
SELECT
register.CUSTOMER_ID,
register.GRID_ID,
register.USER_ID,
base.SURNAME,
base.NAME,
base.REAl_NAME AS userName,
0 AS partyFlag,
0 AS POINT_TOTAL,
0 AS INDEX_SCORE
FROM
REGISTER_RELATION register
LEFT JOIN USER_BASE_INFO base ON register.USER_ID = base.USER_ID
AND base.DEL_FLAG = '0'
WHERE
register.DEL_FLAG = '0'
AND register.CUSTOMER_ID = #{customerId}
AND register.FIRST_REGISTER = '1'
</select>
</mapper>

BIN
epmet-module/data-statistical/data-statistical-server/src/test/java/resources/评价指标体系算法需求-备注.xlsx

Binary file not shown.
Loading…
Cancel
Save