Browse Source

Merge branch 'dev' of http://git.elinkit.com.cn:7070/r/epmet-cloud into dev_grid_platform

dev
zhaoqifeng 4 years ago
parent
commit
3fe1d719c3
  1. 4
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java
  2. 4
      epmet-auth/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java
  3. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java
  4. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java
  5. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java
  6. 21
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java
  7. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java
  8. 10
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java
  9. 93
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java
  10. 142
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java
  11. 116
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java
  12. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java
  13. 6
      epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
  14. 4
      epmet-gateway/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java
  15. 10
      epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java
  16. 4
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/config/NacosServiceListListenerRegisterer.java
  17. 31
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java
  18. 8
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java
  19. 21
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java
  20. 18
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java
  21. 23
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java
  22. 43
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml
  23. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml
  24. 12
      epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml
  25. 49
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/CategoryProjectListFormDTO.java
  26. 44
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java
  27. 86
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java
  28. 28
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/PageCategoryProjectListResultDTO.java
  29. 80
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java
  30. 56
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategorySonResultDTO.java
  31. 4
      epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml
  32. 16
      epmet-module/data-report/data-report-server/pom.xml
  33. 4
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/config/NacosServiceListListenerRegisterer.java
  34. 153
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java
  35. 31
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  36. 13
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java
  37. 6
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java
  38. 26
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java
  39. 191
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java
  40. BIN
      epmet-module/data-report/data-report-server/src/main/resources/excel/project_category_temp.xlsx
  41. BIN
      epmet-module/data-report/data-report-server/src/main/resources/excel/project_temp.xlsx
  42. BIN
      epmet-module/data-report/data-report-server/src/main/resources/excel/project_temp_easy_excel.xlsx
  43. 3
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml
  44. 54
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml
  45. 34
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml
  46. 26
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml
  47. 31
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ClosedProjectTotalResultDTO.java
  48. 102
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryDTO.java
  49. 2
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java
  50. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java
  51. 76
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java
  52. 6
      epmet-module/data-statistical/data-statistical-server/pom.xml
  53. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java
  54. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/PingYinConstant.java
  55. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java
  56. 69
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  57. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java
  58. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java
  59. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  60. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryDao.java
  61. 30
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java
  62. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
  63. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java
  64. 68
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryEntity.java
  65. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryGridDailyEntity.java
  66. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryOrgDailyEntity.java
  67. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java
  68. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java
  69. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimAgencyEntity.java
  70. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimGridEntity.java
  71. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectCategoryDailyService.java
  72. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java
  73. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java
  74. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java
  75. 46
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/OrgRankExtractServiceImpl.java
  76. 297
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  77. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenProjectSettleServiceImpl.java
  78. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java
  79. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java
  80. 105
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryService.java
  81. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java
  82. 15
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerAgencyServiceImpl.java
  83. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCustomerGridServiceImpl.java
  84. 229
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryGridAndOrgDailyServiceImpl.java
  85. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryOrgDailyServiceImpl.java
  86. 119
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectCategoryServiceImpl.java
  87. 244
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectDataServiceImpl.java
  88. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenProjectOrgDailyServiceImpl.java
  89. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/BaseReportServiceImpl.java
  90. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java
  91. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java
  92. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.25__add_closedProjectTotal.sql
  93. 48
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml
  94. 76
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml
  95. 38
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  96. 6
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  97. 30
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryDao.xml
  98. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryGridDailyDao.xml
  99. 84
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml
  100. 116
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

4
epmet-admin/epmet-admin-server/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java

@ -86,11 +86,11 @@ public class NacosServiceListListenerRegisterer {
serviceListView = namingService.getServicesOfServer(1, 100);
//启动监听
if (serviceListView == null || serviceListView.getCount() == 0) {
log.info("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
log.debug("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
return;
}
List<String> serviceList = serviceListView.getData();
log.info("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
log.debug("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
for (String service : serviceList) {
try {

4
epmet-auth/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java

@ -86,11 +86,11 @@ public class NacosServiceListListenerRegisterer {
serviceListView = namingService.getServicesOfServer(1, 100);
//启动监听
if (serviceListView == null || serviceListView.getCount() == 0) {
log.info("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
log.debug("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
return;
}
List<String> serviceList = serviceListView.getData();
log.info("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
log.debug("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
for (String service : serviceList) {
try {

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/NumConstant.java

@ -64,6 +64,8 @@ public interface NumConstant {
long THREE_L = 3L;
long FOUR_L = 4L;
long MINUS_ONE_L = -1L;
long TEN_L = 10L;
long SIX_HUNDRED_L = 600L;
String ZERO_STR = "0";
String ONE_STR = "1";

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/DistributedLock.java

@ -18,7 +18,7 @@ import java.util.concurrent.TimeUnit;
@Component
public class DistributedLock {
@Autowired
@Autowired(required = false)
private RedissonClient redissonClient;
/**

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/distributedlock/LockConstants.java

@ -9,4 +9,6 @@ public interface LockConstants {
String TEST_LOCK_NAME = "testLock";
String STATS_LOCK_NAME = "stats";
String SCREEN_DAILY = "screenDaily";
}

21
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/CommonAggFeignClient.java

@ -2,11 +2,14 @@ package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.fallback.CommonAggFeignClientFallBackFactory;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
@ -24,4 +27,22 @@ public interface CommonAggFeignClient {
*/
@PostMapping("/data/aggregator/epmetuser/getStaffInfo/{staffId}")
Result<CustomerStaffInfoCache> getStaffInfo(@PathVariable("staffId") String staffId);
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/data/aggregator/org/agency")
Result<AgencyInfoCache> getAgencyInfo(@RequestParam("agencyId")String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("/data/aggregator/org/grid")
Result<GridInfoCache> getGridInfo(@RequestParam("gridId")String gridId);
}

12
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/fallback/CommonAggFeignClientFallback.java

@ -2,7 +2,9 @@ package com.epmet.commons.tools.feign.fallback;
import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.CustomerStaffInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ModuleUtils;
import com.epmet.commons.tools.utils.Result;
import org.springframework.stereotype.Component;
@ -20,4 +22,14 @@ public class CommonAggFeignClientFallback implements CommonAggFeignClient {
public Result<CustomerStaffInfoCache> getStaffInfo(String staffId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getStaffInfo", staffId);
}
@Override
public Result<AgencyInfoCache> getAgencyInfo(String agencyId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getAgencyInfo", agencyId);
}
@Override
public Result<GridInfoCache> getGridInfo(String gridId) {
return ModuleUtils.feignConError(ServiceConstant.DATA_AGGREGATOR_SERVER, "getGridInfo", gridId);
}
}

10
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/RedisKeys.java

@ -12,6 +12,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
/**
* @author Mark sunlightcs@gmail.com
@ -559,4 +560,13 @@ public class RedisKeys {
public static String blockedMqMsgKey(String blockedMsgLabel) {
return rootPrefix.concat("message:mq:blocked:").concat(blockedMsgLabel);
}
/**
* desc:获取执行完毕的 业务 参数结果key
* @param bizMethod
* @return
*/
public static String getBackDoorbizExcuteResult(String bizMethod) {
return rootPrefix.concat("backdoor:").concat(bizMethod);
}
}

93
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/CustomerOrgRedis.java

@ -0,0 +1,93 @@
package com.epmet.commons.tools.redis.common;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.feign.CommonAggFeignClient;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.bean.*;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.PostConstruct;
import java.util.Map;
/**
* @Author zxc
* @DateTime 2021/11/5 2:29 下午
* @DESC
*/
@Slf4j
@Component
public class CustomerOrgRedis {
@Autowired
private RedisUtils redisUtils;
@Autowired
private CommonAggFeignClient commonAggFeignClient;
private static CustomerOrgRedis customerOrgRedis;
private static final String ROLE_MAP_KEY = "roleMap";
@PostConstruct
public void init() {
customerOrgRedis = this;
customerOrgRedis.redisUtils = this.redisUtils;
customerOrgRedis.commonAggFeignClient = this.commonAggFeignClient;
}
/**
* @Description 获取网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 3:12 下午
*/
public static GridInfoCache getGridInfo(String gridId){
String key = RedisKeys.getGridInfoKey(gridId);
Map<String, Object> grid = customerOrgRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(grid)) {
return ConvertUtils.mapToEntity(grid, GridInfoCache.class);
}
Result<GridInfoCache> gridInfoResult = customerOrgRedis.commonAggFeignClient.getGridInfo(gridId);
if (!gridInfoResult.success()){
throw new RenException("查询网格信息失败...");
}
if (null == gridInfoResult.getData()){
throw new RenException("没有此网格信息...");
}
Map<String, Object> map = BeanUtil.beanToMap(gridInfoResult.getData(), false, true);
customerOrgRedis.redisUtils.hMSet(key, map);
return gridInfoResult.getData();
}
/**
* @Description 获取组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 3:12 下午
*/
public static AgencyInfoCache getAgencyInfo(String agencyId){
String key = RedisKeys.getAgencyByIdKey(agencyId);
Map<String, Object> agency = customerOrgRedis.redisUtils.hGetAll(key);
if (!CollectionUtils.isEmpty(agency)) {
return ConvertUtils.mapToEntity(agency, AgencyInfoCache.class);
}
Result<AgencyInfoCache> agencyInfoResult = customerOrgRedis.commonAggFeignClient.getAgencyInfo(agencyId);
if (!agencyInfoResult.success()){
throw new RenException("查询组织信息失败...");
}
if (null == agencyInfoResult.getData()){
throw new RenException("没有此组织信息...");
}
Map<String, Object> map = BeanUtil.beanToMap(agencyInfoResult.getData(), false, true);
customerOrgRedis.redisUtils.hMSet(key, map);
return agencyInfoResult.getData();
}
}

142
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/AgencyInfoCache.java

@ -0,0 +1,142 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2021/11/5 2:45 下午
* @DESC
*/
@Data
public class AgencyInfoCache implements Serializable {
private static final long serialVersionUID = -1332373159954084159L;
/**
* ID
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 上级组织机构ID
*/
private String pid;
/**
* 所有上级组织机构ID(以英文:隔开)
*/
private String pids;
/**
* 所有上级名称,-连接
*/
private String allParentName;
/**
* 组织名称
*/
private String organizationName;
/**
* 机关级别社区级community
街道:street,
区县级: district,
市级: city
省级:province 机关级别社区级community街道:street,区县级: district,市级: city省级:province
*/
private String level;
/**
* 地区编码
*/
private String areaCode;
/**
* 删除标识
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 总人数
*/
private Integer totalUser;
/**
*
*/
private String province;
/**
*
*/
private String city;
/**
* 区县
*/
private String district;
/**
* 当前组织的上级行政地区编码add0204;举例平阴县对应的是济南市3701
*/
private String parentAreaCode;
/**
* 街道
*/
private String street;
/**
* 社区
*/
private String community;
/**
* 坐标区域
*/
private String coordinates;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
}

116
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/redis/common/bean/GridInfoCache.java

@ -0,0 +1,116 @@
package com.epmet.commons.tools.redis.common.bean;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @Author zxc
* @DateTime 2021/11/5 2:24 下午
* @DESC
*/
@Data
public class GridInfoCache implements Serializable {
private static final long serialVersionUID = -6159429894486235267L;
/**
* ID 唯一标识
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 网格名称
*/
private String gridName;
/** 组织-网格 */
private String gridNamePath;
/**
* 中心位置经度
*/
private String longitude;
/**
* 中心位置纬度
*/
private String latitude;
/**
* 所属地区码所属组织地区码
*/
private String areaCode;
/**
* 删除标识:0.未删除 1.已删除
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
/**
* 管辖区域
*/
private String manageDistrict;
/**
* 当前网格总人数
*/
private Integer totalUser;
/**
* 所属组织机构IDcustomer_organization.id
*/
private String pid;
/**
* 所有上级组织ID
*/
private String pids;
/**
* 所属组织机构名
*/
private String agencyName;
/**
* 所有上级组织名
*/
private String allParentName;
/**
* 坐标区域
*/
private String coordinates;
}

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelUtils.java

@ -19,8 +19,8 @@ import org.springframework.util.CollectionUtils;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@ -121,5 +121,14 @@ public class ExcelUtils {
out.flush();
out.close();
}
public static OutputStream getOutputStream(String fileName, HttpServletResponse response) throws Exception {
fileName = URLEncoder.encode(fileName, "UTF-8");
response.setContentType("application/vnd.ms-excel");
response.setCharacterEncoding("utf8");
response.setHeader("Content-Disposition", "attachment;filename=" + fileName);
response.addHeader("Access-Control-Expose-Headers", "Content-disposition");
return response.getOutputStream();
}
}

6
epmet-gateway/src/main/java/com/epmet/GatewayApplication.java

@ -9,9 +9,9 @@
package com.epmet;
import com.epmet.commons.tools.aspect.ServletExceptionHandler;
import com.epmet.commons.tools.config.RedissonConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@ -23,11 +23,11 @@ import org.springframework.context.annotation.FilterType;
* @author Mark sunlightcs@gmail.com
* @since 1.0.0
*/
@SpringBootApplication()
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
//@ServletComponentScan
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {ServletExceptionHandler.class}))
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {RedissonConfig.class, ServletExceptionHandler.class}))
public class GatewayApplication {
public static void main(String[] args) {

4
epmet-gateway/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java

@ -86,11 +86,11 @@ public class NacosServiceListListenerRegisterer {
serviceListView = namingService.getServicesOfServer(1, 100);
//启动监听
if (serviceListView == null || serviceListView.getCount() == 0) {
log.info("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
log.debug("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
return;
}
List<String> serviceList = serviceListView.getData();
log.info("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
log.debug("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
for (String service : serviceList) {
try {

10
epmet-module/data-aggregator/data-aggregator-client/src/main/java/com/epmet/dataaggre/dto/govorg/CustomerGridDTO.java

@ -59,6 +59,11 @@ public class CustomerGridDTO implements Serializable {
*/
private String latitude;
/**
* 坐标区域
*/
private String coordinates;
/**
* 所属地区码所属组织地区码
*/
@ -123,4 +128,9 @@ public class CustomerGridDTO implements Serializable {
* 所有上级组织名
*/
private String allParentName;
/**
* 组织-网格
*/
private String gridNamePath;
}

4
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/config/NacosServiceListListenerRegisterer.java

@ -86,11 +86,11 @@ public class NacosServiceListListenerRegisterer {
serviceListView = namingService.getServicesOfServer(1, 100);
//启动监听
if (serviceListView == null || serviceListView.getCount() == 0) {
log.info("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
log.debug("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
return;
}
List<String> serviceList = serviceListView.getData();
log.info("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
log.debug("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
for (String service : serviceList) {
try {

31
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/controller/GovOrgController.java

@ -9,18 +9,19 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dataaggre.dto.govorg.CustomerAgencyDTO;
import com.epmet.dataaggre.dto.govorg.CustomerGridDTO;
import com.epmet.dataaggre.dto.govorg.form.*;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import com.epmet.dataaggre.enums.GridMemberDataAnalysisEnums;
import com.epmet.dataaggre.service.AggreGridService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
@ -178,4 +179,26 @@ public class GovOrgController {
return new Result<List<OrgTreeResultDTO>>().ok(govOrgService.getAgencyTree(tokenDto, formDTO));
}
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("agency")
public Result<CustomerAgencyEntity> getAgencyInfo(@RequestParam("agencyId")String agencyId){
return new Result<CustomerAgencyEntity>().ok(govOrgService.getAgencyInfo(agencyId));
}
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@PostMapping("grid")
public Result<CustomerGridDTO> getGridInfo(@RequestParam("gridId")String gridId){
return new Result<CustomerGridDTO>().ok(govOrgService.getGridInfo(gridId));
}
}

8
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/dao/govorg/CustomerGridDao.java

@ -76,4 +76,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
**/
List<StaffAgencyGridListResultDTO.GridResultDTO> getGridListByAgencyId(@Param("agencyId") String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 3:39 下午
*/
CustomerGridDTO getGridInfo(@Param("gridId") String gridId);
}

21
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/datastats/impl/DataStatsServiceImpl.java

@ -1231,35 +1231,28 @@ public class DataStatsServiceImpl implements DataStatsService {
}
//1.查询当前组织的直属下级组织信息【机关维度】
List<DimAgencyEntity> subAgencyList = dataStatsDao.getSubAgencyList(formDTO.getAgencyId());
List<ScreenCustomerAgencyDTO> subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), null);
if (subAgencyList.size() < NumConstant.ONE) {
return resultList;
}
List<String> agencyIds = subAgencyList.stream().map(DimAgencyEntity::getId).collect(Collectors.toList());
List<String> agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
ScreenCustomerAgencyDTO agencyDTO = indexService.getAgencyInfo(formDTO.getAgencyId());
if (CollectionUtils.isNotEmpty(customerRelation.haveSubCustomer(agencyDTO.getCustomerId()))) {
List<ScreenCustomerAgencyDTO> subAgencies = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode());
agencyIds = subAgencies.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
subAgencyList = subAgencies.stream().map(item -> {
DimAgencyEntity entity = new DimAgencyEntity();
entity.setId(item.getAgencyId());
entity.setAgencyName(item.getAgencyName());
entity.setLevel(item.getLevel());
return entity;
}).collect(Collectors.toList());
subAgencyList = indexService.getSubAgencyList(formDTO.getAgencyId(), agencyDTO.getAreaCode());
agencyIds = subAgencyList.stream().map(ScreenCustomerAgencyDTO::getAgencyId).collect(Collectors.toList());
}
//2.按日期查询所有下级组织的事件治理指数
List<AgencyGovrnResultDTO> list = dataStatsDao.getAgencyGovern(agencyIds, formDTO.getDateId());
//3.封装数据
for (DimAgencyEntity sub : subAgencyList) {
for (ScreenCustomerAgencyDTO sub : subAgencyList) {
AgencyGovrnResultDTO dto = new AgencyGovrnResultDTO();
dto.setAgencyId(sub.getId());
dto.setAgencyId(sub.getAgencyId());
dto.setAgencyName(sub.getAgencyName());
dto.setLevel(sub.getLevel());
for (AgencyGovrnResultDTO re : list) {
if (sub.getId().equals(re.getAgencyId())) {
if (sub.getAgencyId().equals(re.getAgencyId())) {
dto.setProblemResolvedCount(re.getProblemResolvedCount());
dto.setGroupSelfGovernRatio(re.getGroupSelfGovernRatio());
dto.setGridSelfGovernRatio(re.getGridSelfGovernRatio());

18
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/GovOrgService.java

@ -10,6 +10,8 @@ import com.epmet.dataaggre.dto.govorg.form.StaffDetailV2FormDTO;
import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import java.util.List;
@ -154,4 +156,20 @@ public interface GovOrgService {
* @Date 2021/9/23 10:14
*/
List<String> getStaffOrgList(String staffId);
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
CustomerAgencyEntity getAgencyInfo(String agencyId);
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:57 下午
*/
CustomerGridDTO getGridInfo(String gridId);
}

23
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/dataaggre/service/govorg/impl/GovOrgServiceImpl.java

@ -20,6 +20,7 @@ import com.epmet.dataaggre.dto.govorg.form.SubOrgFormDTO;
import com.epmet.dataaggre.dto.govorg.result.*;
import com.epmet.dataaggre.dto.resigroup.result.OrgInfoCommonDTO;
import com.epmet.dataaggre.entity.govorg.CustomerAgencyEntity;
import com.epmet.dataaggre.entity.govorg.CustomerGridEntity;
import com.epmet.dataaggre.service.commonservice.AreaCodeService;
import com.epmet.dataaggre.service.epmetuser.EpmetUserService;
import com.epmet.dataaggre.service.govorg.GovOrgService;
@ -532,4 +533,26 @@ public class GovOrgServiceImpl implements GovOrgService {
return customerAgencyDao.getOrgList(staffId);
}
/**
* @Description 查询组织信息
* @param agencyId
* @author zxc
* @date 2021/11/5 2:54 下午
*/
@Override
public CustomerAgencyEntity getAgencyInfo(String agencyId) {
return customerAgencyDao.selectById(agencyId);
}
/**
* @Description 查询网格信息
* @param gridId
* @author zxc
* @date 2021/11/5 2:57 下午
*/
@Override
public CustomerGridDTO getGridInfo(String gridId) {
return customerGridDao.getGridInfo(gridId);
}
}

43
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/datastats/DatsStatsDao.xml

@ -769,32 +769,39 @@
<select id="selectGirdMemberPatrol" resultType="com.epmet.dataaggre.dto.epmetuser.result.GridMemberPatrolListResultDTO">
SELECT
staff_id staffId,
staff_name staffName,
date_id dateId,
a.staff_id staffId,
a.staff_name staffName,
a.date_id dateId,
IFNULL(
SUM(
issue_to_project_count + closed_issue_count + project_response_count + project_transfer_count + project_closed_count
)
, 0)eventCount
FROM
fact_grid_member_statistics_daily
WHERE
del_flag = '0'
AND pids LIKE concat('%', #{agencyId}, '%')
AND date_id = (
SELECT MAX(date_id)
FROM fact_grid_member_statistics_daily
WHERE
del_flag = '0'
a.issue_to_project_count + a.closed_issue_count + a.project_response_count + a.project_transfer_count + a.project_closed_count
),
0
) eventCount
FROM
fact_grid_member_statistics_daily a
INNER JOIN (
SELECT
staff_id,
MAX(date_id) date_id
FROM
fact_grid_member_statistics_daily
WHERE del_flag = '0'
AND pids LIKE concat('%', #{agencyId}, '%')
<if test="dimType!= null and dimType == 'month' ">
AND month_id = #{dimId}
</if>
<if test="dimType!= null and dimType == 'year' ">
AND year_id = #{dimId}
</if>
)
GROUP BY staff_id
GROUP BY STAFF_ID
) b ON a.STAFF_ID = b.STAFF_ID AND a.date_id = b.date_id
WHERE
a.del_flag = '0'
AND a.pids LIKE concat('%', #{agencyId}, '%')
GROUP BY a.staff_id
ORDER BY a.date_id DESC
</select>
<select id="regUserList" resultType="com.epmet.dataaggre.dto.datastats.result.CustomerDataManageResultDTO$CustomerDataManage">

2
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/epmetuser/StaffPatrolRecordDao.xml

@ -124,7 +124,7 @@
<select id="gridMemberPatrol" resultType="com.epmet.dataaggre.dto.epmetuser.result.StaffListResultDTO">
SELECT
staff_id staffId,
IFNULL(SUM(patrol_total), 0) reportProjectCount,
IFNULL(SUM(report_project_count), 0) reportProjectCount,
IFNULL(SUM(total_time), 0) timeNum
FROM
stats_staff_patrol_record_daily

12
epmet-module/data-aggregator/data-aggregator-server/src/main/resources/mapper/govorg/CustomerGridDao.xml

@ -163,4 +163,16 @@
AND cg.pid = #{agencyId}
</select>
<!-- 查询网格信息 -->
<select id="getGridInfo" resultType="com.epmet.dataaggre.dto.govorg.CustomerGridDTO">
SELECT
ca.ORGANIZATION_NAME AS agencyName,
CONCAT(ca.ORGANIZATION_NAME,'-',cg.GRID_NAME) AS gridNamePath,
cg.*
FROM customer_grid cg
LEFT JOIN customer_agency ca ON (ca.ID = cg.PID AND ca.DEL_FLAG = '0')
WHERE cg.DEL_FLAG = '0'
AND cg.ID = #{gridId}
</select>
</mapper>

49
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/CategoryProjectListFormDTO.java

@ -0,0 +1,49 @@
package com.epmet.project.dto.form;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:23 下午
* @DESC
*/
@Data
public class CategoryProjectListFormDTO extends ProjectCategoryFormDTO implements Serializable {
private static final long serialVersionUID = -5448734274886241594L;
public interface CategoryProjectListForm{}
@NotNull(message = "pageSize不能为空",groups = CategoryProjectListForm.class)
private Integer pageSize;
@NotNull(message = "pageNo不能为空",groups = CategoryProjectListForm.class)
private Integer pageNo;
/**
* 项目状态closed已结案all全部
*/
@NotNull(message = "status不能为空",groups = {CategoryProjectListForm.class, CategoryProjectExportForm.class})
private String status;
@NotNull(message = "categoryCode不能为空",groups = {CategoryProjectListForm.class, CategoryProjectExportForm.class})
private String categoryCode;
@NotNull(message = "categoryName不能为空",groups = CategoryProjectExportForm.class)
private String categoryName;
private String parentCategoryName;
/**
* 组织ID
*/
private String orgId;
/**
* 是否分页默认truefalse的时候 给导出用
*/
private Boolean isPage = true;
}

44
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/form/ProjectCategoryFormDTO.java

@ -0,0 +1,44 @@
package com.epmet.project.dto.form;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:18 下午
* @DESC
*/
@Data
public class ProjectCategoryFormDTO implements Serializable {
private static final long serialVersionUID = 5047143743629810527L;
public interface ProjectCategoryForm{}
public interface CategoryProjectExportForm {}
/**
* 组织ID
*/
private String orgId;
/**
* 组织类型 组织agency网格grid
*/
private String orgType;
@NotBlank(message = "结束时间不能为空",groups = {ProjectCategoryForm.class,CategoryProjectExportForm.class})
private String endTime;
/**
* 开始时间
*/
private String startTime;
/**
* 组织名称
*/
@NotBlank(message = "组织名称不能为空",groups = CategoryProjectExportForm.class)
private String orgName;
}

86
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/CategoryProjectListResultDTO.java

@ -0,0 +1,86 @@
package com.epmet.project.dto.result;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:31 下午
* @DESC
*/
@Data
public class CategoryProjectListResultDTO implements Serializable {
private static final long serialVersionUID = 8820354423099062062L;
/**
* 分类
*/
private String category;
/**
* 项目状态:待处理 pending结案closed
*/
private String projectStatus;
/**
* 项目状态:待处理 pending结案closed
*/
private String projectStatusDesc;
/**
* 项目标题
*/
private String projectTitle;
/**
* 网格
*/
private String gridName;
/**
* 项目创建时间
*/
private String createTime;
/**
* 项目ID
*/
private String projectId;
/**
* 上报人
*/
private String linkName;
/**
* 上报人电话
*/
private String linkMobile;
/**
* 事件地址
*/
private String projectAddress;
@JsonIgnore
private String orgId;
@JsonIgnore
private String orgType;
public CategoryProjectListResultDTO() {
this.category = "";
this.projectStatus = "";
this.projectStatusDesc = "";
this.projectTitle = "";
this.gridName = "";
this.createTime = "";
}
public String getProjectStatusDesc() {
return "closed".equals(projectStatus)?"已结案":"处理中";
}
}

28
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/PageCategoryProjectListResultDTO.java

@ -0,0 +1,28 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/5 1:51 下午
* @DESC
*/
@Data
public class PageCategoryProjectListResultDTO implements Serializable {
private static final long serialVersionUID = 8822993169364931502L;
private Integer total;
private List<CategoryProjectListResultDTO> list;
public PageCategoryProjectListResultDTO() {
this.total = NumConstant.ZERO;
this.list = new ArrayList<>();
}
}

80
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategoryResultDTO.java

@ -0,0 +1,80 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* @Author zxc
* @DateTime 2021/11/4 3:13 下午
* @DESC
*/
@Data
public class ProjectCategoryResultDTO implements Serializable {
private static final long serialVersionUID = -2662970383306349424L;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类code父级
*/
private String parentCategoryCode;
/**
* 分类名字
*/
private String categoryName;
/**
* 分类名字父级
*/
private String parentCategoryName;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 结案项目数
*/
private Integer closedProjectTotal;
/**
* 所有项目总数
*/
private Integer allProjectTotal;
/**
* 总数占比
*/
private String totalRatio;
/**
* 结案率
*/
private String closedRatio;
private List<ProjectCategoryResultDTO> children;
@JsonIgnore
private int index;
public ProjectCategoryResultDTO() {
this.categoryCode = "";
this.categoryName = "";
this.projectTotal = NumConstant.ZERO;
this.closedProjectTotal = NumConstant.ZERO;
this.totalRatio = "0.00%";
this.closedRatio = "0.00%";
this.children = new ArrayList<>();
this.allProjectTotal = NumConstant.ZERO;
}
}

56
epmet-module/data-report/data-report-client/src/main/java/com/epmet/project/dto/result/ProjectCategorySonResultDTO.java

@ -0,0 +1,56 @@
package com.epmet.project.dto.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 3:13 下午
* @DESC
*/
@Data
public class ProjectCategorySonResultDTO implements Serializable {
private static final long serialVersionUID = -2662970383306349424L;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类名字
*/
private String categoryName;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 结案项目数
*/
private Integer closedProjectTotal;
/**
* 总数占比
*/
private String totalRatio;
/**
* 结案率
*/
private String closedRatio;
public ProjectCategorySonResultDTO() {
this.categoryCode = "";
this.categoryName = "";
this.projectTotal = NumConstant.ZERO;
this.closedProjectTotal = NumConstant.ZERO;
this.totalRatio = "";
this.closedRatio = "";
}
}

4
epmet-module/data-report/data-report-server/deploy/docker-compose-prod.yml

@ -9,10 +9,10 @@ services:
volumes:
- "/opt/epmet-cloud-logs/prod:/logs"
environment:
RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./data-report.jar"
RUN_INSTRUCT: "java -Xms256m -Xmx1024m -jar ./data-report.jar"
restart: "unless-stopped"
deploy:
resources:
limits:
cpus: '0.1'
memory: 600M
memory: 1600M

16
epmet-module/data-report/data-report-server/pom.xml

@ -100,6 +100,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
@ -116,6 +122,16 @@
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xls</nonFilteredFileExtension>
<nonFilteredFileExtension>xlsx</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<resources>

4
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/config/NacosServiceListListenerRegisterer.java

@ -86,11 +86,11 @@ public class NacosServiceListListenerRegisterer {
serviceListView = namingService.getServicesOfServer(1, 100);
//启动监听
if (serviceListView == null || serviceListView.getCount() == 0) {
log.info("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
log.debug("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
return;
}
List<String> serviceList = serviceListView.getData();
log.info("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
log.debug("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
for (String service : serviceList) {
try {

153
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/ScreenProjectController.java

@ -1,5 +1,16 @@
package com.epmet.datareport.controller.screen;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.TemplateExportParams;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectOrgDailyService;
@ -12,13 +23,26 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.PageCategoryProjectListResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 项目
@ -155,4 +179,133 @@ public class ScreenProjectController {
return new Result<List<CategoryTopAppealResultDTO>>().ok(screenProjectService.categoryTopAppeal(formDTO));
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@PostMapping("selectprojectcategory")
public Result<List<ProjectCategoryResultDTO>> selectProjectCategory(@RequestBody ProjectCategoryFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.ProjectCategoryForm.class);
return new Result<List<ProjectCategoryResultDTO>>().ok(screenProjectService.selectProjectCategory(formDTO,tokenDto));
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@PostMapping("selectprojectcategory/export")
public void selectProjectCategoryExport(@RequestBody ProjectCategoryFormDTO formDTO, @LoginUser TokenDto tokenDto, HttpServletResponse response) throws Exception {
//tokenDto.setUserId("36bc0fb38565ecdebf8ab9b476b44548");
//tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc");
ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.CategoryProjectExportForm.class);
List<ProjectCategoryResultDTO> data = screenProjectService.selectProjectCategory(formDTO, tokenDto);
String templatePath = "excel/project_category_temp.xlsx";
List<ProjectCategoryResultDTO> resultDTOList = new ArrayList<>();
data.forEach(e->{
resultDTOList.add(e);
e.setIndex(1);
resultDTOList.addAll(ConvertUtils.sourceToTarget(e.getChildren(),ProjectCategoryResultDTO.class));
});
Map<String,Object> mapData = new HashMap<>();
mapData.put("list",resultDTOList);
mapData.put("orgName", formDTO.getOrgName());
mapData.put("exportDate",getExportDateStr(formDTO.getStartTime(),formDTO.getEndTime()));
Workbook workbook = ExcelExportUtil.exportExcel(new TemplateExportParams(templatePath), mapData);
response.setHeader("content-Type", "application/vnd.ms-excel");
response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("项目分类统计.xls", "UTF-8"));
workbook.write(response.getOutputStream());
}
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
@PostMapping("selectcategoryprojectlist")
public Result<PageCategoryProjectListResultDTO> selectCategoryProjectList(@RequestBody CategoryProjectListFormDTO formDTO, @LoginUser TokenDto tokenDto){
ValidatorUtils.validateEntity(formDTO, CategoryProjectListFormDTO.CategoryProjectListForm.class);
return new Result<PageCategoryProjectListResultDTO>().ok(screenProjectService.selectCategoryProjectList(formDTO,tokenDto));
}
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@PostMapping("selectcategoryprojectlist/export")
public void selectProjectCategoryExport(@RequestBody CategoryProjectListFormDTO formDTO, @LoginUser TokenDto tokenDto, HttpServletResponse response) throws Exception {
ExcelWriter excelWriter = null;
try {
//tokenDto.setUserId("36bc0fb38565ecdebf8ab9b476b44548");
//tokenDto.setCustomerId("45687aa479955f9d06204d415238f7cc");
formDTO.setPageNo(NumConstant.ONE);
formDTO.setPageSize(NumConstant.ONE_THOUSAND);
formDTO.setIsPage(false);
ValidatorUtils.validateEntity(formDTO, ProjectCategoryFormDTO.CategoryProjectExportForm.class);
Map<String, Object> mapData = new HashMap<>();
mapData.put("orgName", formDTO.getOrgName());
mapData.put("exportDate", getExportDateStr(formDTO.getStartTime(), formDTO.getEndTime()));
mapData.put("categoryName", formDTO.getCategoryName());
if (StringUtils.isNotBlank(formDTO.getParentCategoryName())) {
mapData.put("categoryName", formDTO.getParentCategoryName().concat(StrConstant.HYPHEN).concat(formDTO.getCategoryName()));
}
String templatePath = "excel/project_temp_easy_excel.xlsx";
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(templatePath);
//String template = this.getClass().getResource(templatePath).getPath();
String fileName = "项目统计.xlsx";
excelWriter = EasyExcel.write(ExcelUtils.getOutputStream(fileName, response)).withTemplate(inputStream).build();
WriteSheet writeSheet = EasyExcel.writerSheet().build();
excelWriter.fill(mapData, writeSheet);
PageCategoryProjectListResultDTO data = null;
do {
data = screenProjectService.selectCategoryProjectList(formDTO, tokenDto);
if (data.getList().isEmpty()) {
break;
}
formDTO.setPageNo(formDTO.getPageNo() + 1);
excelWriter.fill(data.getList(), writeSheet);
data.getList().clear();
} while (data.getList().size() == formDTO.getPageSize());
// String templatePath = "excel/project_temp.xlsx";
// Workbook workbook = ExcelExportUtil.exportExcel(new TemplateExportParams(templatePath), mapData);
// response.setHeader("content-Type", "application/vnd.ms-excel");
// response.addHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("项目统计.xls", "UTF-8"));
// workbook.write(response.getOutputStream());
} finally {
if (excelWriter != null) {
excelWriter.finish();
}
}
}
@NotNull
private String getExportDateStr(String startTime,String endTime) {
StringBuilder dateBuilder = new StringBuilder();
if (StringUtils.isNotBlank(startTime)) {
dateBuilder.append(startTime).append(StrConstant.HYPHEN);
}
if (StringUtils.isNotBlank(endTime)) {
dateBuilder.append(endTime);
}
return dateBuilder.toString();
}
}

31
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.java

@ -19,7 +19,9 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.CategoryAnalysisResultDTO;
import com.epmet.project.CustomerProjectCategoryDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -52,4 +54,33 @@ public interface ScreenProjectCategoryOrgDailyDao {
* @date 2021/8/18 1:40 下午
*/
List<CategoryTopAppealResultDTO> categoryTopAppeal(@Param("agencyId") String agencyId,@Param("customerId")String customerId,@Param("topCount")Integer topCount);
/**
* @Description 组织查询分类
* @param customerId
* @param time
* @param orgId
* @author zxc
* @date 2021/11/5 8:54 上午
*/
List<ProjectCategoryResultDTO> selectProjectCategoryByAgency(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
/**
* @Description 网格查询分类
* @param customerId
* @param time
* @param orgId
* @author zxc
* @date 2021/11/5 8:55 上午
*/
List<ProjectCategoryResultDTO> selectProjectCategoryByGrid(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
/**
* @Description 查询客户下所有分类
* @param customerId
* @author zxc
* @date 2021/11/4 5:45 下午
*/
List<ProjectCategoryResultDTO> selectCategoryByCustomerId(@Param("customerId")String customerId);
}

13
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -3,6 +3,7 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.ColorProjectTotalResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.result.CategoryProjectListResultDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -45,4 +46,16 @@ public interface ScreenProjectDataDao {
* @date 2021/6/1 3:48 下午
*/
List<ColorProjectTotalResultDTO> selectColorProjectByAreaCode(@Param("areaCode") String areaCode,@Param("monthCount")Integer monthCount);
/**
* @Description 查询分类下的项目列表
* @param customerId
* @param orgId
* @author zxc
* @date 2021/11/5 1:40 下午
*/
List<CategoryProjectListResultDTO> selectCategoryProjectList(@Param("orgId") String orgId,
@Param("categoryCode")String categoryCode,@Param("status")String status,
@Param("startTime")String startTime,@Param("endTime")String endTime);
}

6
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/dao/evaluationindex/screen/ScreenProjectOrgDailyDao.java

@ -19,6 +19,7 @@ package com.epmet.datareport.dao.evaluationindex.screen;
import com.epmet.dto.result.screen.EfficiencyAnalysisResultDTO;
import com.epmet.dto.result.screen.ProjectQuantityResultDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -45,4 +46,9 @@ public interface ScreenProjectOrgDailyDao {
* @description 下级组织的效率解决率列表
**/
List<EfficiencyAnalysisResultDTO> queryEfficiencyAnalysis(@Param("customerId")String customerId,@Param("areaCode") String areaCode);
Integer selectProjectTotalByAgency(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
Integer selectProjectTotalByGrid(@Param("customerId")String customerId,@Param("time")String time,@Param("orgId")String orgId);
}

26
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/ScreenProjectService.java

@ -1,5 +1,6 @@
package com.epmet.datareport.service.evaluationindex.screen;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.screen.CategoryAnalysisFormDTO;
import com.epmet.dto.form.screen.ColorProjectTotalFormDTO;
@ -10,8 +11,13 @@ import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDetailFormDTO;
import com.epmet.evaluationindex.screen.dto.form.ScreenProjectDistributionFormDTO;
import com.epmet.evaluationindex.screen.dto.result.ProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.CategoryProjectListResultDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.result.PageCategoryProjectListResultDTO;
import com.epmet.project.dto.result.ProjectCategoryResultDTO;
import java.util.List;
@ -62,4 +68,24 @@ public interface ScreenProjectService {
*/
List<CategoryTopAppealResultDTO> categoryTopAppeal(CategoryTopAppealFormDTO formDTO);
/**
* @Description 项目分类查询项目分类
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
List<ProjectCategoryResultDTO> selectProjectCategory(ProjectCategoryFormDTO formDTO, TokenDto tokenDto);
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
PageCategoryProjectListResultDTO selectCategoryProjectList(CategoryProjectListFormDTO formDTO, TokenDto tokenDto);
}

191
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/ScreenProjectServiceImpl.java

@ -3,14 +3,19 @@ package com.epmet.datareport.service.evaluationindex.screen.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenEventImgDataDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao;
import com.epmet.datareport.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.datareport.constant.FactConstant;
import com.epmet.datareport.dao.evaluationindex.screen.*;
import com.epmet.datareport.service.evaluationindex.screen.ScreenProjectService;
import com.epmet.dto.UserDTO;
import com.epmet.dto.form.CustomerAgencyUserRoleFormDTO;
@ -26,15 +31,21 @@ import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDetailResultDTO;
import com.epmet.evaluationindex.screen.dto.result.ScreenProjectDistributionResultDTO;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.project.CustomerProjectCategoryDTO;
import com.epmet.project.dto.form.CategoryProjectListFormDTO;
import com.epmet.project.dto.form.CategoryTopAppealFormDTO;
import com.epmet.project.dto.result.CategoryTopAppealResultDTO;
import com.epmet.project.dto.form.ProjectCategoryFormDTO;
import com.epmet.project.dto.result.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -63,6 +74,9 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
@Autowired
private EpmetUserOpenFeignClient userOpenFeignClient;
@Autowired
private ScreenProjectOrgDailyDao screenProjectOrgDailyDao;
/**
* @Description 3项目详情
* @param projectDetailFormDTO
@ -159,7 +173,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
List<CategoryAnalysisResultDTO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(resultDTOList)) {
for (CategoryAnalysisResultDTO dto : resultDTOList) {
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(dto.getCategoryCode(), dto.getCategoryOriginCustomerId());
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(dto.getCategoryCode(), customerId);
if (null == projectCategoryDTO || StringUtils.isBlank(projectCategoryDTO.getCategoryName())) {
log.warn(String.format("查询分类名称失败,当前客户:%s, categoryCode:%s", dto.getCategoryCode(), customerId));
continue;
@ -219,7 +233,7 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
return new ArrayList<>();
}
for (CategoryTopAppealResultDTO r : result) {
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(r.getCategoryId(), r.getCategoryOriginCustomerId());
CustomerProjectCategoryDTO projectCategoryDTO = screenProjectCategoryOrgDailyDao.selectProjectCategory(r.getCategoryId(), customerId);
if (null == projectCategoryDTO || StringUtils.isBlank(projectCategoryDTO.getCategoryName())) {
log.warn(String.format("查询分类名称失败,当前客户:%s, categoryCode:%s", r.getCategoryId(), r.getCategoryOriginCustomerId()));
continue;
@ -228,4 +242,167 @@ public class ScreenProjectServiceImpl implements ScreenProjectService {
}
return result;
}
/**
* @Description 项目分类查询项目分类
* 二级分类总数占比改为 二级分类总数/一级分类总数
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:38 下午
*/
@Override
public List<ProjectCategoryResultDTO> selectProjectCategory(ProjectCategoryFormDTO formDTO, TokenDto tokenDto) {
if (StringUtils.isNotBlank(formDTO.getStartTime())){
formDTO.setStartTime(DateUtils.getBeforeNDay(formDTO.getStartTime(),NumConstant.ONE));
}
if (StringUtils.isBlank(formDTO.getOrgId())){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new RenException("未查询到此工作人员的所属组织信息...");
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(FactConstant.AGENCY);
}
String customerId = tokenDto.getCustomerId();
String endTime = formDTO.getEndTime();
String startTime = formDTO.getStartTime();
String orgId = formDTO.getOrgId();
// 查询客户下的所有分类
List<ProjectCategoryResultDTO> result = screenProjectCategoryOrgDailyDao.selectCategoryByCustomerId(tokenDto.getCustomerId());
List<ProjectCategoryResultDTO> endCategoryList = new ArrayList<>();
if (formDTO.getOrgType().equals(FactConstant.GRID)){
Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, endTime, orgId);
endTotal = null == endTotal ? NumConstant.ZERO : endTotal;
endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,endTime,orgId);
Integer total = endTotal;
if (StringUtils.isNotBlank(startTime)){
Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByGrid(customerId, startTime, orgId);
startTotal = null == startTotal ? NumConstant.ZERO : startTotal;
total = endTotal - startTotal;
List<ProjectCategoryResultDTO> startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByGrid(customerId,startTime,orgId);
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal()))));
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal()))));
}
Integer finalTotal = total;
endCategoryList.forEach(e -> {
e.setTotalRatio(ratio(e.getProjectTotal(), finalTotal));
e.setClosedRatio(ratio(e.getClosedProjectTotal(),e.getProjectTotal()));
e.setAllProjectTotal(finalTotal);
});
}else {
Integer endTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, endTime, orgId);
endTotal = null == endTotal ? NumConstant.ZERO : endTotal;
endCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,endTime,orgId);
Integer total = endTotal;
if (StringUtils.isNotBlank(startTime)){
Integer startTotal = screenProjectOrgDailyDao.selectProjectTotalByAgency(customerId, startTime, orgId);
startTotal = null == startTotal ? NumConstant.ZERO : startTotal;
total = endTotal - startTotal;
List<ProjectCategoryResultDTO> startCategoryList = screenProjectCategoryOrgDailyDao.selectProjectCategoryByAgency(customerId,startTime,orgId);
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setProjectTotal(subtract(e.getProjectTotal(),s.getProjectTotal()))));
endCategoryList.forEach(e -> startCategoryList.stream().filter(s -> e.getCategoryCode().equals(s.getCategoryCode())).forEach(s -> e.setClosedProjectTotal(subtract(e.getClosedProjectTotal(),s.getClosedProjectTotal()))));
}
Integer finalTotal = total;
endCategoryList.forEach(e -> {
e.setTotalRatio(ratio(e.getProjectTotal(), finalTotal));
e.setClosedRatio(ratio(e.getClosedProjectTotal(),e.getProjectTotal()));
e.setAllProjectTotal(finalTotal);
});
}
List<ProjectCategoryResultDTO> finalEndCategoryList = endCategoryList;
result.forEach(r -> {
finalEndCategoryList.stream().filter(e -> r.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
r.setTotalRatio(e.getTotalRatio());r.setClosedRatio(e.getClosedRatio());
r.setProjectTotal(e.getProjectTotal());
r.setClosedProjectTotal(e.getClosedProjectTotal());
r.setAllProjectTotal(e.getAllProjectTotal());
});
r.getChildren().forEach(son -> finalEndCategoryList.stream().filter(e -> son.getCategoryCode().equals(e.getCategoryCode())).forEach(e -> {
son.setTotalRatio(e.getTotalRatio());son.setClosedRatio(e.getClosedRatio());
son.setProjectTotal(e.getProjectTotal());son.setClosedProjectTotal(e.getClosedProjectTotal());
son.setAllProjectTotal(e.getAllProjectTotal());
}));
});
// 排序
List<ProjectCategoryResultDTO> collect = result.stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList());
collect.forEach(c -> {
c.setChildren(c.getChildren().stream().sorted(Comparator.comparing(ProjectCategoryResultDTO::getProjectTotal).reversed()).collect(Collectors.toList()));
});
collect.forEach(p -> {
p.getChildren().forEach(c -> {
c.setTotalRatio(ratio(c.getProjectTotal(), p.getProjectTotal()));
});
});
return collect;
}
/**
* @Description 俩数相减小于0就赋值为0
* @param end
* @param start
* @author zxc
* @date 2021/11/5 9:18 上午
*/
public Integer subtract(Integer end,Integer start){
return end - start < NumConstant.ZERO ? NumConstant.ZERO : end - start;
}
/**
* @Description 返回占比,保留小数点2位
* @param molecule 分子
* @param denominator 分母
* @author zxc
* @date 2021/11/5 9:26 上午
*/
public String ratio(Integer molecule, Integer denominator){
if (denominator == NumConstant.ZERO){
return "0.00%";
}
BigDecimal bigDecimalMolecule = new BigDecimal(molecule * NumConstant.ONE_HUNDRED);
BigDecimal bigDecimalDenominator = new BigDecimal(denominator);
BigDecimal divide = bigDecimalMolecule.divide(bigDecimalDenominator, NumConstant.TWO, BigDecimal.ROUND_HALF_UP);
return divide+"%";
}
/**
* @Description 项目分类查询分类下的项目
* @param formDTO
* @param tokenDto
* @author zxc
* @date 2021/11/4 3:39 下午
*/
@Override
public PageCategoryProjectListResultDTO selectCategoryProjectList(CategoryProjectListFormDTO formDTO, TokenDto tokenDto) {
if (StringUtils.isBlank(formDTO.getOrgId())){
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(tokenDto.getCustomerId(), tokenDto.getUserId());
if (null == staffInfo){
throw new RenException("未查询到此工作人员的所属组织信息...");
}
formDTO.setOrgId(staffInfo.getAgencyId());
formDTO.setOrgType(FactConstant.AGENCY);
}
PageCategoryProjectListResultDTO result = new PageCategoryProjectListResultDTO();
List<CategoryProjectListResultDTO> list;
PageInfo<CategoryProjectListResultDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize(), formDTO.getIsPage())
.doSelectPageInfo(() -> screenProjectDataDao.selectCategoryProjectList(formDTO.getOrgId(), formDTO.getCategoryCode(), formDTO.getStatus(),formDTO.getStartTime(),formDTO.getEndTime()));
list = objectPageInfo.getList();
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));
if (!CollectionUtils.isEmpty(list)){
list.forEach(l -> {
if (l.getOrgType().equals(FactConstant.AGENCY)){
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(l.getOrgId());
l.setGridName(agencyInfo.getOrganizationName());
}else {
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(l.getOrgId());
l.setGridName(gridInfo.getGridNamePath());
}
});
}
result.setList(list);
return result;
}
}

BIN
epmet-module/data-report/data-report-server/src/main/resources/excel/project_category_temp.xlsx

Binary file not shown.

BIN
epmet-module/data-report/data-report-server/src/main/resources/excel/project_temp.xlsx

Binary file not shown.

BIN
epmet-module/data-report/data-report-server/src/main/resources/excel/project_temp_easy_excel.xlsx

Binary file not shown.

3
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenIndexDataMonthlyDao.xml

@ -388,6 +388,9 @@
ROUND((ROUND(sy.govern_ablity,1) * sy.GOVERN_ABLITY_WEIGHT),1) AS governAbility,
ROUND((ROUND(sy.party_dev_ablity,1) * sy.PARTY_DEV_WEIGHT),1) AS partyDevAbility,
ROUND((ROUND(sy.service_ablity,1) * sy.SERVICE_ABLITY_WEIGHT),1) AS serviceAbility,
ROUND(sy.govern_ablity,1) AS originGovernAbility,
ROUND(sy.party_dev_ablity,1) AS originPartyDevAbility,
ROUND(sy.service_ablity,1) AS originServiceAbility,
sy.ORG_ID as orgId,
scg.area_code as areaCode
FROM screen_customer_grid scg

54
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -63,4 +63,58 @@
AND DATE_ID = (select date_id from screen_project_category_org_daily where del_flag = '0' and ORG_ID = #{agencyId} and CUSTOMER_ID= #{customerId} order by date_id desc, created_time desc limit 1)
ORDER BY PROJECT_TOTAL DESC LIMIT #{topCount}
</select>
<!-- 组织查询分类 -->
<select id="selectProjectCategoryByAgency" resultType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
SELECT
co.CATEGORY_CODE,
co.PROJECT_TOTAL,
co.CLOSED_PROJECT_TOTAL
FROM screen_project_category_org_daily co
WHERE co.DEL_FLAG = '0'
AND co.ORG_ID = #{orgId}
AND co.CUSTOMER_ID = #{customerId}
AND co.DATE_ID = #{time}
</select>
<!-- 网格查询分类 -->
<select id="selectProjectCategoryByGrid" resultType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
SELECT
co.CATEGORY_CODE,
co.PROJECT_TOTAL,
co.CLOSED_PROJECT_TOTAL
FROM screen_project_category_grid_daily co
WHERE co.DEL_FLAG = '0'
AND co.GRID_ID = #{orgId}
AND co.CUSTOMER_ID = #{customerId}
AND co.DATE_ID = #{time}
</select>
<!-- 查询客户下所有分类 -->
<resultMap id="selectCategoryByCustomerIdMap" type="com.epmet.project.dto.result.ProjectCategoryResultDTO">
<result column="c" property="categoryCode"/>
<result column="n" property="categoryName"/>
<result column="pc1" property="parentCategoryCode"/>
<collection property="children" ofType="com.epmet.project.dto.result.ProjectCategoryResultDTO">
<result column="c2" property="categoryCode"/>
<result column="n2" property="categoryName"/>
<result column="pc2" property="parentCategoryCode"/>
<result column="n" property="parentCategoryName"/>
</collection>
</resultMap>
<select id="selectCategoryByCustomerId" resultMap="selectCategoryByCustomerIdMap">
SELECT
p1.CATEGORY_CODE AS c,
p2.CATEGORY_CODE AS c2,
p1.CATEGORY_NAME AS n,
p2.CATEGORY_NAME AS n2,
p1.PARENT_CATEGORY_CODE AS pc1,
p2.PARENT_CATEGORY_CODE AS pc2
FROM customer_project_category_dict p1,customer_project_category_dict p2
WHERE p1.DEL_FLAG = '0'
AND p2.DEL_FLAG = '0'
AND p1.CUSTOMER_ID = #{customerId}
AND p2.CUSTOMER_ID = #{customerId}
AND p1.CATEGORY_CODE = p2.PARENT_CATEGORY_CODE
</select>
</mapper>

34
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectDataDao.xml

@ -135,7 +135,7 @@
AND pd.ORG_TYPE = 'agency'
AND pd.PROJECT_LEVEL != 0
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
AND UNIX_TIMESTAMP(pd.PROJECT_CREATE_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
UNION ALL
(SELECT pd.PROJECT_LEVEL
@ -145,7 +145,7 @@
AND pd.ORG_TYPE = 'grid'
AND pd.PROJECT_LEVEL != 0
AND scg.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
AND UNIX_TIMESTAMP(pd.PROJECT_CREATE_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
UNION ALL
(SELECT pd.PROJECT_LEVEL
@ -155,7 +155,35 @@
AND pd.ORG_TYPE = 'department'
AND pd.PROJECT_LEVEL != 0
AND scd.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND UNIX_TIMESTAMP(pd.CREATED_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
AND UNIX_TIMESTAMP(pd.PROJECT_CREATE_TIME) >= UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL #{monthCount} MONTH))
)
</select>
<!-- 查询分类下的项目列表 -->
<select id="selectCategoryProjectList" resultType="com.epmet.project.dto.result.CategoryProjectListResultDTO">
SELECT
DISTINCT pd.PROJECT_ID AS projectId,
pd.ALL_CATEGORY_NAME AS category,
CASE WHEN pd.PROJECT_STATUS_CODE = 'closed_case' THEN 'closed' ELSE pd.PROJECT_STATUS_CODE END AS projectStatus,
IFNULL(pd.PROJECT_TITLE,'') AS projectTitle,
DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y-%m-%d %h:%i:%s') AS createTime,
pd.ORG_ID,
pd.ORG_TYPE,
pd.LINK_NAME,
pd.LINK_MOBILE,
pd.PROJECT_ADDRESS
FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0'
<if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed_case','closed')
</if>
AND CONCAT(pd.ALL_PARENT_IDS,':',pd.ORG_ID) LIKE CONCAT('%',#{orgId},'%')
AND pc.CATEGORY_CODE LIKE CONCAT(#{categoryCode},'%')
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{endTime}
<if test="null != startTime and startTime != '' ">
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') >= #{startTime}
</if>
ORDER BY pd.PROJECT_CREATE_TIME DESC
</select>
</mapper>

26
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenProjectOrgDailyDao.xml

@ -54,4 +54,30 @@
)and m.CUSTOMER_ID=#{customerId}
order by resolvedRatio+0 desc
</select>
<!-- 查询项目总数组织 -->
<select id="selectProjectTotalByAgency" resultType="java.lang.Integer">
SELECT
PROJECT_TOTAL
FROM
screen_project_org_daily
WHERE
del_flag = '0'
AND ORG_ID = #{orgId}
AND DATE_ID = #{time}
AND CUSTOMER_ID = #{customerId}
</select>
<!-- 查询项目总数网格 -->
<select id="selectProjectTotalByGrid" resultType="java.lang.Integer">
SELECT
PROJECT_TOTAL
FROM
screen_project_grid_daily
WHERE
del_flag = '0'
AND grid_id = #{orgId}
AND DATE_ID = #{time}
AND CUSTOMER_ID = #{customerId}
</select>
</mapper>

31
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/project/result/ClosedProjectTotalResultDTO.java

@ -0,0 +1,31 @@
package com.epmet.dto.project.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/4 9:12 上午
* @DESC
*/
@Data
public class ClosedProjectTotalResultDTO implements Serializable {
private static final long serialVersionUID = -3683494871244065806L;
/**
* 组织ID
*/
private String orgId;
/**
* 分类code
*/
private String categoryCode;
/**
* 结案的项目数
*/
private Integer closedProjectTotal = 0;
}

102
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryDTO.java

@ -0,0 +1,102 @@
/**
* 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.dto.screen;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-10
*/
@Data
public class ScreenProjectCategoryDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户id
*/
private String customerId;
/**
* 项目id
*/
private String projectId;
/**
* 分类编码
*/
private String categoryCode;
/**
* 所属父类分类编码
*/
private String parentCategoryCode;
/**
* 原始分类编码
*/
private String originCategoryCode;
/**
* 分类等级12....产品目前只有2级分类
*/
private Integer level;
/**
* 删除标识 0未删除1已删除
*/
private String delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

2
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/ScreenProjectCategoryGridDailyDTO.java

@ -120,4 +120,6 @@ public class ScreenProjectCategoryGridDailyDTO implements Serializable {
*/
private Boolean status = false;
private Integer closedProjectTotal = 0;
}

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/CategoryProjectResultDTO.java

@ -42,6 +42,11 @@ public class CategoryProjectResultDTO implements Serializable {
*/
private Integer projectTotal;
/**
* 结案数
*/
private Integer closedProjectTotal;
/**
* 分类级别
*/

76
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/GridAndOrgCategoryCountResultDTO.java

@ -0,0 +1,76 @@
package com.epmet.dto.screen.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data;
import java.io.Serializable;
/**
* @Author zxc
* @DateTime 2021/11/10 10:36 上午
* @DESC
*/
@Data
public class GridAndOrgCategoryCountResultDTO implements Serializable {
private static final long serialVersionUID = -5167964547464983118L;
/**
* 组织ID
*/
private String orgId;
/**
* 组织类型
*/
private String orgType;
/**
* 网格ID
*/
private String gridId;
/**
* 上级组织ID
*/
private String pid;
/**
* 所有上级组织ID
*/
private String pids;
private String dateId;
private String customerId;
private String categoryOriginCustomerId;
/**
* 分类CODE
*/
private String categoryCode;
/**
* 分类CODE级别
*/
private Integer level;
/**
* 项目总数
*/
private Integer projectTotal;
/**
* 关闭结案项目总数
*/
private Integer closedProjectTotal;
public GridAndOrgCategoryCountResultDTO() {
this.orgId = "";
this.categoryCode = "";
this.level = NumConstant.ZERO;
this.projectTotal = NumConstant.ZERO;
this.closedProjectTotal = NumConstant.ZERO;
}
}

6
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -128,6 +128,12 @@
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>oper-crm-client</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/config/NacosServiceListListenerRegisterer.java

@ -86,11 +86,11 @@ public class NacosServiceListListenerRegisterer {
serviceListView = namingService.getServicesOfServer(1, 100);
//启动监听
if (serviceListView == null || serviceListView.getCount() == 0) {
log.info("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
log.debug("【Nacos服务列表定时刷新】当前无任何可添加监听的服务");
return;
}
List<String> serviceList = serviceListView.getData();
log.info("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
log.debug("【Nacos服务列表定时刷新】Nacos服务端服务列表: {}", serviceList);
for (String service : serviceList) {
try {

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/PingYinConstant.java

@ -15,4 +15,7 @@ public interface PingYinConstant {
String YU_SHAN_AGENCY_ID = "1258587398679126017";
String YU_SHAN_CUSTOMER_ID = "a4bbf298d8e427844038cee466f022ef";
String TEST_PING_YIN_CUSTOMER_ID = "78e2b2227c07de1fe54da14e2b2d9eb6";
String PROD_PING_YIN_CUSTOMER_ID = "6f203e30de1a65aab7e69c058826cd80";
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/ProjectConstant.java

@ -90,4 +90,7 @@ public interface ProjectConstant {
* 上报
*/
String PROJECT_REPORT="02";
String PROJECT_STATUS_CLOSED = "closed";
String PROJECT_STATUS_ALL = "all";
}

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

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
@ -60,9 +62,9 @@ import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@ -74,7 +76,8 @@ import java.util.concurrent.Future;
public class DemoController {
@Autowired
private StatsDemoService demoService;
@Autowired
private RedisUtils redisUtils;
@Autowired
private ExecutorService executorService;
@ -136,6 +139,8 @@ public class DemoController {
private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService;
@Autowired
private DimCustomerService dimCustomerService;
@Autowired
private ScreenProjectDataService screenProjectDataService;
@GetMapping("testAlarm")
public void testAlarm() {
@ -760,6 +765,7 @@ public class DemoController {
orgRankExtractService.extractGridData(formDTO.getCustomerId(), formDTO.getDateId());
orgRankExtractService.extractCommunityData(formDTO.getCustomerId(), formDTO.getDateId());
orgRankExtractService.extractStreetData(formDTO.getCustomerId(), formDTO.getDateId());
orgRankExtractService.extractDistrictData(formDTO.getCustomerId(), formDTO.getDateId());
return new Result();
}
@ -935,7 +941,7 @@ public class DemoController {
paramDTO.setCustomerId(customerId);
paramDTO.setDateId(formDTO.getDateId());
originProjectCategoryDailyService.extractProjectCategory(paramDTO);
log.error(String.format("/data/stats/demo/extractProjectCategory,fact_origin_project_category_daily表抽取完毕,customerId:%s", customerId));
log.warn(String.format("/data/stats/demo/extractProjectCategory,fact_origin_project_category_daily表抽取完毕,customerId:%s", customerId));
}
return new Result();
}
@ -943,9 +949,25 @@ public class DemoController {
@Autowired
private ScreenProjectCategoryOrgDailyService screenProjectCategoryOrgDailyService;
@PostMapping("orgdaily")
public Result orgDaily(@RequestParam("customerId")String customerId,@RequestParam("dateId")String dateId){
screenProjectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,dateId);
@PostMapping("gridandorgdaily")
public Result orgDaily(@RequestParam("customerId")String customerId,@RequestParam("dateId")String dateId,
@RequestParam(name = "startDate",required = false)String startDate,
@RequestParam(name = "endDate",required = false)String endDate
){
long start = System.currentTimeMillis();
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){
List<String> daysBetween = DateUtils.getDaysBetween(startDate, endDate);
daysBetween.forEach(d -> {
projectCategoryGridDailyService.extractProjectCategoryData(customerId,d);
screenProjectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,d);
});
}else {
projectCategoryGridDailyService.extractProjectCategoryData(customerId,dateId);
screenProjectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId,dateId);
}
long end = System.currentTimeMillis();
long l = (end - start) / 1000;
log.info("gridAndOrgDaily耗时" + l+ "s");
return new Result();
}
@ -1052,4 +1074,39 @@ public class DemoController {
customerAgencyService.sysAgencyInfo(formDTO.getFromCustomerId(), formDTO.getToCustomerId());
return new Result();
}
@PostMapping("extractCategory")
public Result extractCategory(@RequestBody StatsFormDTO formDTO) {
screenProjectDataService.extractCategory(formDTO.getCustomerId());
return new Result();
}
@Autowired
private ScreenProjectCategoryGridAndOrgDailyService screenProjectCategoryGridAndOrgDailyService;
@PostMapping("gridandorgdailynew")
public Result<String> gridAndDaily(@RequestParam("customerId")String customerId,@RequestParam("dateId")String dateId,
@RequestParam(name = "startDate",required = false)String startDate,
@RequestParam(name = "endDate",required = false)String endDate
){
long start = System.currentTimeMillis();
Set<String> result = new LinkedHashSet<>();
if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)){
List<String> daysBetween = DateUtils.getDaysBetween(startDate, endDate);
daysBetween.forEach(d -> {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,d);
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,d);
result.add(d);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L);
});
}else {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId,dateId);
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId,dateId);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("gridandorgdailynew"),customerId,result,3*24*60*60L);
}
long end = System.currentTimeMillis();
long l = (end - start) / 1000;
return new Result<String>().ok("gridAndOrgDaily耗时" + l+ "s");
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectCategoryDailyDao.java

@ -42,7 +42,7 @@ public interface FactOriginProjectCategoryDailyDao extends BaseDao<FactOriginPro
* @description 计算当前客户下各个网格内各项目分类下项目数量
* @Date 2021/3/23 9:58
**/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(@Param("customerId") String customerId);
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(@Param("customerId") String customerId,@Param("subCount")Integer subCount,@Param("projectType")String projectType);
/**
* @Description 查询客户下组织直接立项的各项目分类下的项目数量筛选组织创建的项目fact_origin_project_main_daily表gridId为空
@ -50,7 +50,8 @@ public interface FactOriginProjectCategoryDailyDao extends BaseDao<FactOriginPro
* @author zxc
* @date 2021/4/13 下午4:36
*/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(@Param("orgIds")List<String> orgIds,@Param("customerId") String customerId);
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(@Param("orgIds")List<String> orgIds,@Param("customerId") String customerId,
@Param("subCount") Integer subCount,@Param("projectType")String projectType);
int deleteByProjectIds(@Param("list") List<String> list);
}

1
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginProjectLogDailyDao.java

@ -288,6 +288,7 @@ public interface FactOriginProjectLogDailyDao extends BaseDao<FactOriginProjectL
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> selectGridClosed(@Param("customerId") String customerId, @Param("monthId") String monthId);
List<OrgStatisticsResultDTO> selectAgencyClosed(@Param("customerId") String customerId, @Param("monthId") String monthId);
/**
* 网格自治率统计--按天

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java

@ -28,6 +28,7 @@ import com.epmet.dto.extract.result.OrgNameResultDTO;
import com.epmet.dto.indexcal.AgencyAndParentResultDTO;
import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO;
import com.epmet.dto.screen.ScreenProjectOrgDailyDTO;
import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO;
import com.epmet.dto.screen.result.TreeResultDTO;
import com.epmet.dto.screencoll.form.CustomerAgencyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerAgencyEntity;
@ -244,4 +245,15 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
*/
List<CustomerAgencyDTO> selectByCustomerId(@Param("customerId") String customerId);
/**
* @Description 查询父子客户的组织平阴
* @param customerIds 平阴榆山锦水的客户ID
* @param customerId 孔村的客户ID🤬
* @author zxc
* @date 2021/11/10 2:52 下午
*/
List<GridAndOrgCategoryCountResultDTO> selectParentSonAgency(@Param("customerIds") List<String> customerIds ,@Param("customerId") String customerId);
String getParentAgencyId(@Param("agencyId") String agencyId);
}

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectCategoryDao.java

@ -0,0 +1,36 @@
/**
* 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.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity;
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-11-10
*/
@Mapper
public interface ScreenProjectCategoryDao extends BaseDao<ScreenProjectCategoryEntity> {
void deleteByProjectIds(@Param("customerId") String customerId, @Param("projectIds") List<String> projectIds);
}

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

@ -18,6 +18,7 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.project.result.ClosedProjectTotalResultDTO;
import com.epmet.dto.screen.result.CategoryProjectResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity;
import com.sun.org.apache.xpath.internal.operations.Bool;
@ -55,16 +56,28 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao<ScreenProjectC
List<CategoryProjectResultDTO> selectOrgCategoryInfo(@Param("customerId") String customerId, @Param("dateId") String dateId,@Param("level")String level);
/**
* @Description 查询组织分类信息多客户
* @Description 查询组织分类信息多客户父客户存在的分类
* @Param customerId
* @Param dateId
* @Param level
* @Param existsStatus 父客户是否存在
* @author zxc
* @date 2021/3/24 下午2:48
*/
List<CategoryProjectResultDTO> selectOrgCategoryMoreCustomerInfo(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("level")String level, @Param("customerId")String customerId, @Param("existsStatus")Boolean existsStatus);
@Param("level")String level, @Param("customerId")String customerId);
/**
* @Description 查询组织分类信息多客户父客户存在的分类
* @param customerIds
* @param dateId
* @param level
* @param customerId
* @author zxc
* @date 2021/10/21 4:03 下午
*/
List<CategoryProjectResultDTO> selectOrgCategoryMoreCustomerInfoNotExists(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("level")String level, @Param("customerId")String customerId);
/**
* @Description 查询组织分类信息多客户升级版
* @Param customerIds
@ -94,4 +107,15 @@ public interface ScreenProjectCategoryOrgDailyDao extends BaseDao<ScreenProjectC
* @date 2021/8/16 10:36 上午
*/
List<CategoryProjectResultDTO> selectSelfAgencyCategory(@Param("dateId") String dateId,@Param("orgIds")List<String> orgIds);
/**
* @Description 查询父客户 存在 分类的结案项目数
* @param customerIds
* @param dateId
* @author zxc
* @date 2021/11/4 9:26 上午
*/
List<ClosedProjectTotalResultDTO> selectClosedProjectTotal(@Param("customerIds")List<String> customerIds, @Param("dateId") String dateId,
@Param("status")Boolean status);
}

43
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java

@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -68,4 +69,46 @@ public interface ScreenProjectDataDao extends BaseDao<ScreenProjectDataEntity> {
int updateProjectSatisfactionScore(@Param("projectId")String projectId, @Param("score")BigDecimal score);
List<ScreenProjectDataDTO> selectProjectList(@Param("customerId") String customerId, @Param("projectId") String projectId);
/**
* @Description 查询网格下的项目分类
* @param customerIds 父子客户的customerId
* @param dateId 日期ID
* @param status 所有项目all已结案项目closed
* @param customerId 父级客户ID
* @param subCount 分类截取位数
* @author zxc
* @date 2021/11/10 3:12 下午
*/
List<GridAndOrgCategoryCountResultDTO> selectGridCategoryProjectCount(@Param("dateId") String dateId,@Param("parentCustomerId") String parentCustomerId,
@Param("status")String status,@Param("customerId") String customerId,
@Param("subCount")Integer subCount);
/**
* @Description 查询组织下的项目分类
* @param dateId 日期ID
* @param status 所有项目all已结案项目closed
* @param customerId 父级客户ID
* @param subCount 分类截取位数
* @author zxc
* @date 2021/11/10 3:14 下午
*/
List<GridAndOrgCategoryCountResultDTO> selectOrgCategoryProjectCount(@Param("dateId") String dateId, @Param("status")String status,
@Param("customerId") String customerId, @Param("subCount")Integer subCount,
@Param("allAgencies") List<GridAndOrgCategoryCountResultDTO> allAgencies);
/**
* @Description 查询组织下的1级项目分类
* @param dateId
* @param status
* @param customerId
* @param subCount
* @param allAgencies
* @author zxc
* @date 2021/11/11 11:14 上午
*/
List<GridAndOrgCategoryCountResultDTO> selectOrgCategoryOneLevelProjectCount(@Param("dateId") String dateId, @Param("status")String status,
@Param("customerId") String customerId, @Param("subCount")Integer subCount,
@Param("allAgencies") List<GridAndOrgCategoryCountResultDTO> allAgencies);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenCustomerAgencyEntity.java

@ -88,11 +88,12 @@ public class ScreenCustomerAgencyEntity extends BaseEpmetEntity {
*/
private String level;
private String code;
/**
* 行政地区编码
*/
private String areaCode;
private String code;
private String sourceType;
/**

68
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/screen/ScreenProjectCategoryEntity.java

@ -0,0 +1,68 @@
/**
* 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.evaluationindex.screen;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-10
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("screen_project_category")
public class ScreenProjectCategoryEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户id
*/
private String customerId;
/**
* 项目id
*/
private String projectId;
/**
* 分类编码
*/
private String categoryCode;
/**
* 所属父类分类编码
*/
private String parentCategoryCode;
/**
* 原始分类编码
*/
private String originCategoryCode;
/**
* 分类等级12....产品目前只有2级分类
*/
private Integer level;
}

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

@ -74,4 +74,9 @@ public class ScreenProjectCategoryGridDailyEntity extends BaseEpmetEntity {
* 分类等级12....
*/
private Integer level;
/**
* 分类下所有结案的项目
*/
private Integer closedProjectTotal;
}

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

@ -82,6 +82,11 @@ public class ScreenProjectCategoryOrgDailyEntity extends BaseEpmetEntity {
*/
private Integer projectTotal;
/**
* 分类下所有结案项目数
*/
private Integer closedProjectTotal;
/**
* 分类等级12....
*/

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerAgencyEntity.java

@ -69,6 +69,8 @@ public class CustomerAgencyEntity extends BaseEpmetEntity {
*/
private String level;
private String code;
/**
* 地区编码
*/

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/org/CustomerGridEntity.java

@ -55,6 +55,7 @@ public class CustomerGridEntity extends BaseEpmetEntity {
*/
private String latitude;
private String code;
/**
* 所属地区码所属组织地区码
*/
@ -84,4 +85,5 @@ public class CustomerGridEntity extends BaseEpmetEntity {
* 是否同步到统计库和指标库,1同步0不同步
*/
private String syncFlag;
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimAgencyEntity.java

@ -76,4 +76,6 @@ public class DimAgencyEntity extends BaseEpmetEntity {
*/
private String level;
private String code;
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/stats/DimGridEntity.java

@ -57,4 +57,6 @@ public class DimGridEntity extends BaseEpmetEntity {
*/
private String areaCode;
private String code;
}

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

@ -54,5 +54,5 @@ public interface FactOriginProjectCategoryDailyService extends BaseService<FactO
* @author zxc
* @date 2021/4/13 下午4:36
*/
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(List<String> orgIds,String customerId);
List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(List<String> orgIds,String customerId,Integer subCount,String projectType);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginProjectLogDailyService.java

@ -21,7 +21,6 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.extract.FactOriginProjectLogDailyDTO;
import com.epmet.dto.extract.result.*;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.entity.evaluationindex.extract.FactOriginProjectLogDailyEntity;
import java.math.BigDecimal;
@ -310,7 +309,7 @@ public interface FactOriginProjectLogDailyService extends BaseService<FactOrigin
* @return java.util.List<com.epmet.dto.extract.result.OrgStatisticsResultDTO>
*/
List<OrgStatisticsResultDTO> getGridClosed(String customerId, String monthId);
List<OrgStatisticsResultDTO> getAgencyClosed(String customerId, String monthId);
/**
* 网格自制率统计-按天
* @author zhaoqifeng

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectCategoryDailyServiceImpl.java

@ -23,6 +23,8 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.PingYinConstant;
import com.epmet.constant.PingYinConstants;
import com.epmet.dao.evaluationindex.extract.FactOriginProjectCategoryDailyDao;
import com.epmet.dto.ProjectCategoryDTO;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
@ -136,10 +138,22 @@ public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl<F
**/
@Override
public List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryGridDailyDTO(String customerId) {
List<ScreenProjectCategoryGridDailyDTO> list=baseDao.selectListProjectCategoryGridDailyDTO(customerId);
List<ScreenProjectCategoryGridDailyDTO> list=baseDao.selectListProjectCategoryGridDailyDTO(customerId,getSubCount(customerId),"all");
List<ScreenProjectCategoryGridDailyDTO> closedList = baseDao.selectListProjectCategoryGridDailyDTO(customerId,getSubCount(customerId),"closed");
if (!CollectionUtils.isEmpty(closedList)){
list.forEach(l -> closedList.stream().filter(c -> l.getGridId().equals(c.getGridId()) && l.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> l.setClosedProjectTotal(c.getClosedProjectTotal())));
}
return list;
}
public Integer getSubCount(String customerId){
Integer result = NumConstant.FOUR;
if (customerId.equals(PingYinConstant.TEST_PING_YIN_CUSTOMER_ID) || customerId.equals(PingYinConstant.PROD_PING_YIN_CUSTOMER_ID)){
return NumConstant.TWO;
}
return result;
}
/**
* @Description 查询客户下组织直接立项的各项目分类下的项目数量筛选组织创建的项目fact_origin_project_main_daily表gridId为空
* @Param orgIds
@ -147,10 +161,10 @@ public class FactOriginProjectCategoryDailyServiceImpl extends BaseServiceImpl<F
* @date 2021/4/13 下午4:36
*/
@Override
public List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(List<String> orgIds,String customerId) {
public List<ScreenProjectCategoryGridDailyDTO> selectListProjectCategoryByOrg(List<String> orgIds,String customerId,Integer subCount,String projectType) {
if (!CollectionUtils.isEmpty(orgIds)){
return new ArrayList<>();
}
return baseDao.selectListProjectCategoryByOrg(orgIds,customerId);
return baseDao.selectListProjectCategoryByOrg(orgIds,customerId,subCount,projectType);
}
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginProjectLogDailyServiceImpl.java

@ -401,6 +401,11 @@ public class FactOriginProjectLogDailyServiceImpl extends BaseServiceImpl<FactOr
return baseDao.selectGridClosed(customerId, monthId);
}
@Override
public List<OrgStatisticsResultDTO> getAgencyClosed(String customerId, String monthId) {
return baseDao.selectAgencyClosed(customerId, monthId);
}
/**
* 网格自制率统计-按天
*

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

@ -6,8 +6,6 @@ import com.epmet.constant.OrgTypeConstant;
import com.epmet.dto.extract.result.OrgStatisticsResultDTO;
import com.epmet.dto.stats.user.FactRegUserAgencyMonthlyDTO;
import com.epmet.dto.stats.user.FactRegUserGridMonthlyDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityOrgMonthlyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenOrgRankDataEntity;
import com.epmet.service.evaluationindex.extract.todata.*;
import com.epmet.service.evaluationindex.extract.toscreen.OrgRankExtractService;
@ -17,9 +15,9 @@ import com.epmet.service.evaluationindex.screen.ScreenOrgRankDataService;
import com.epmet.service.stats.user.FactRegUserAgencyMonthlyService;
import com.epmet.service.stats.user.FactRegUserGridMonthlyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.apache.commons.collections4.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
@ -184,11 +182,15 @@ public class OrgRankExtractServiceImpl implements OrgRankExtractService {
));
}
//结案率 结案数/项目数
List<FactIndexGovrnAblityOrgMonthlyEntity> abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.COMMUNITY);
if (CollectionUtils.isNotEmpty(abilityList)) {
list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto ->
entity.setCloseProjectRatio(dto.getClosedProjectRatio())
));
List<OrgStatisticsResultDTO> closed = factOriginProjectLogDailyService.getAgencyClosed(customerId, monthId);
if (CollectionUtils.isNotEmpty(closed)) {
list.forEach(entity -> closed.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> {
if (dto.getSum() != NumConstant.ZERO) {
BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount());
entity.setCloseProjectRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
}
}));
}
//满意率 满意和非常满意占比
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.COMMUNITY);
@ -252,11 +254,15 @@ public class OrgRankExtractServiceImpl implements OrgRankExtractService {
));
}
//结案率 结案数/项目数
List<FactIndexGovrnAblityOrgMonthlyEntity> abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.STREET);
if (CollectionUtils.isNotEmpty(abilityList)) {
list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto ->
entity.setCloseProjectRatio(dto.getClosedProjectRatio())
));
List<OrgStatisticsResultDTO> closed = factOriginProjectLogDailyService.getAgencyClosed(customerId, monthId);
if (CollectionUtils.isNotEmpty(closed)) {
list.forEach(entity -> closed.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> {
if (dto.getSum() != NumConstant.ZERO) {
BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount());
entity.setCloseProjectRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
}
}));
}
//满意率 满意和非常满意占比
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.STREET);
@ -320,11 +326,15 @@ public class OrgRankExtractServiceImpl implements OrgRankExtractService {
));
}
//结案率 结案数/项目数
List<FactIndexGovrnAblityOrgMonthlyEntity> abilityList = factIndexGovrnAblityOrgMonthlyService.getOrgByCustomer(customerId, monthId, OrgTypeConstant.DISTRICT);
if (CollectionUtils.isNotEmpty(abilityList)) {
list.forEach(entity -> abilityList.stream().filter(item -> item.getAgencyId().equals(entity.getOrgId())).forEach(dto ->
entity.setCloseProjectRatio(dto.getClosedProjectRatio())
));
List<OrgStatisticsResultDTO> closed = factOriginProjectLogDailyService.getAgencyClosed(customerId, monthId);
if (CollectionUtils.isNotEmpty(closed)) {
list.forEach(entity -> closed.stream().filter(item -> item.getOrgId().equals(entity.getOrgId())).forEach(dto -> {
if (dto.getSum() != NumConstant.ZERO) {
BigDecimal sum = new BigDecimal(dto.getSum());
BigDecimal count = new BigDecimal(dto.getCount());
entity.setCloseProjectRatio(count.multiply(hundred).divide(sum, NumConstant.SIX, RoundingMode.HALF_UP));
}
}));
}
//满意率 满意和非常满意占比
List<OrgStatisticsResultDTO> satisfactionList = factOriginProjectLogDailyService.getOrgSatisfaction(customerId, monthId, OrgTypeConstant.STREET);

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

@ -2,6 +2,8 @@ package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.distributedlock.LockConstants;
import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
@ -20,6 +22,7 @@ import com.epmet.service.stats.DimCustomerService;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -84,6 +87,10 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
private FactAgencyGovernDailyService factAgencyGovernDailyService;
@Autowired
private FactGridMemberStatisticsDailyService factGridMemberStatisticsDailyService;
@Autowired
private ScreenProjectCategoryGridAndOrgDailyService screenProjectCategoryGridAndOrgDailyService;
@Autowired
private DistributedLock distributedLock;
/**
* @param extractOriginFormDTO
@ -161,155 +168,177 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
* @date 2020/9/24 10:16 上午
*/
public void extractDaily(String customerId, String dateId, boolean isLast) {
//等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁
final CountDownLatch latch = new CountDownLatch(NumConstant.FOUR);
threadPool.submit(() -> {
//党员基本情况screen_cpc_base_data
try {
partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId);
} catch (Exception e) {
log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
//先锋模范screen_pioneer_data
if (isLast) {
try {
pioneerDataExtractService.extractGridPioneerData(customerId, dateId);
} catch (Exception e) {
log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId);
} catch (Exception e) {
log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
RLock lock = null;
try {
// 锁持有10分钟,等待10s
lock = distributedLock.getLock(LockConstants.SCREEN_DAILY, NumConstant.SIX_HUNDRED_L, NumConstant.TEN_L, TimeUnit.SECONDS);
//等待3个线程执行完毕后再 继续执行下一个客户的 避免死锁
final CountDownLatch latch = new CountDownLatch(NumConstant.FOUR);
threadPool.submit(() -> {
//党员基本情况screen_cpc_base_data
try {
pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId);
} catch (Exception e) {
log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
try {
partyBaseInfoService.statsPartyMemberBaseInfoToScreen(customerId, dateId);
} catch (Exception e) {
log.error("党员基本情况抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
//先锋模范screen_pioneer_data
if (isLast) {
try {
pioneerDataExtractService.extractGridPioneerData(customerId, dateId);
} catch (Exception e) {
log.error("先锋模范【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId);
} catch (Exception e) {
log.error("先锋模范【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId);
} catch (Exception e) {
log.error("先锋模范【extractExceptCommunityPioneerData】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
}
} finally {
latch.countDown();
log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
}
}
latch.countDown();
log.info("extractDaily 1 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
});
threadPool.submit(() -> {
//公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data
try {
publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId);
} catch (Exception e) {
log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
if (isLast) {
//基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data
});
threadPool.submit(() -> {
//公众参与排行(注册人数、参与人数、话题数、议题数、项目数)screen_public_party_total_data
try {
ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO();
param2.setCustomerId(customerId);
param2.setDateId(null);
log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId());
//screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param);
try {
publicPartiTotalDataExtractService.extractPublicPartiTotalData(customerId, dateId);
} catch (Exception e) {
log.error("公众参与排行抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
if (isLast) {
//基层治理- 难点赌点 screen_difficulty_data | screen_difficulty_img_data
try {
ScreenCentralZoneDataFormDTO param2 = new ScreenCentralZoneDataFormDTO();
param2.setCustomerId(customerId);
param2.setDateId(null);
log.info("【难点赌点数据上报开始------】 当前客户Id{}", param2.getCustomerId());
//screenGrassrootsGovernDataAbsorptionService.difficultyDataHub(param);
screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2);
log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId());
} catch (Exception e) {
log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
screenGrassrootsGovernDataAbsorptionService.difficultyDataExtract(param2);
log.info("【难点赌点数据上报结束------】 当前客户Id{}", param2.getCustomerId());
} catch (Exception e) {
log.error("基层治理-难点赌点抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
}
} finally {
latch.countDown();
log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
}
}
latch.countDown();
log.info("extractDaily 2 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
});
threadPool.submit(() -> {
ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO();
param.setCustomerId(customerId);
param.setDateId(dateId);
//中央区 screen_user_total_data
try {
screenCentralZoneDataAbsorptionService.centralZoneDataHub(param);
} catch (Exception e) {
log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
});
threadPool.submit(() -> {
try {
ScreenCentralZoneDataFormDTO param = new ScreenCentralZoneDataFormDTO();
param.setCustomerId(customerId);
param.setDateId(dateId);
//中央区 screen_user_total_data
try {
screenCentralZoneDataAbsorptionService.centralZoneDataHub(param);
} catch (Exception e) {
log.error("中央区抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
// 项目(事件)分析按网格_按天统计
screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId);
} catch (Exception e) {
log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
// 项目(事件)分析按组织_按天统计
screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId);
} catch (Exception e) {
log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
// 项目(事件)分析按网格_按天统计
screenProjectGridDailyService.extractionProjectGridDaily(customerId, dateId);
} catch (Exception e) {
log.error("项目(事件)分析按网格_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
// 项目(事件)分析按组织_按天统计
screenProjectOrgDailyService.extractionProjectOrgDaily(customerId, dateId);
} catch (Exception e) {
log.error("项目(事件)分析按组织_按天统计失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
//按天统计:网格内各个分类下的项目总数
try {
projectCategoryGridDailyService.extractProjectCategoryData(customerId, dateId);
} catch (Exception e) {
log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e);
}
//按天统计:网格内各个分类下的项目总数
try {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectGridData(customerId, dateId);
} catch (Exception e) {
log.error("按天统计:网格内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e);
}
// 按天统计:组织内各个分类下的项目总数
try {
projectCategoryOrgDailyService.extractProjectCategoryOrgData(customerId, dateId);
} catch (Exception e) {
log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e);
}
latch.countDown();
log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
});
threadPool.submit(() -> {
//治理能力排行screen_govern_rank_data
try {
governRankDataExtractService.extractGridDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
governRankDataExtractService.extractCommunityDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
governRankDataExtractService.extractStreetDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
governRankDataExtractService.extractDistrictDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
// 按天统计:组织内各个分类下的项目总数
try {
screenProjectCategoryGridAndOrgDailyService.extractCategoryProjectOrgData(customerId, dateId);
} catch (Exception e) {
log.error("按天统计:组织内各个分类下的项目总数,customerId为:" + customerId + "dateId为:" + dateId, e);
}
} finally {
latch.countDown();
log.info("extractDaily 3 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
}
});
threadPool.submit(() -> {
//治理能力排行screen_govern_rank_data
try {
try {
governRankDataExtractService.extractGridDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【网格】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
governRankDataExtractService.extractCommunityDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【社区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
governRankDataExtractService.extractStreetDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【街道】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
governRankDataExtractService.extractDistrictDataDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理能力排行【全区】抽取到大屏失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO();
extractFactGridGovernDailyFromDTO.setCustomerId(customerId);
extractFactGridGovernDailyFromDTO.setDateId(dateId);
factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO);
} catch (Exception e) {
log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
ExtractFactGridGovernDailyFromDTO extractFactGridGovernDailyFromDTO = new ExtractFactGridGovernDailyFromDTO();
extractFactGridGovernDailyFromDTO.setCustomerId(customerId);
extractFactGridGovernDailyFromDTO.setDateId(dateId);
factGridGovernDailyService.extractFactGridGovernDaily(extractFactGridGovernDailyFromDTO);
} catch (Exception e) {
log.error("治理指数-网格fact_grid_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
factAgencyGovernDailyService.extractFactAgencyGovernDaily(customerId, dateId);
} catch (Exception e) {
log.error("治理指数-组织fact_agency_govern_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
try {
factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId);
} catch (Exception e) {
log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e);
}
extractPartData(customerId, dateId);
} finally {
latch.countDown();
log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
}
});
try {
factGridMemberStatisticsDailyService.extractGridMemberStatisticsDaily(customerId, dateId);
} catch (Exception e) {
log.error("网格员数据统计fact_grid_member_statistics_daily抽取失败,customerId为:" + customerId + "dateId为:" + dateId, e);
latch.await();
} catch (InterruptedException e) {
log.error("extractDaily run exception", e);
}
extractPartData(customerId, dateId);
latch.countDown();
log.info("extractDaily 4 thread run end ========= dateId:{},customerId:{}", dateId, customerId);
});
try {
latch.await();
} catch (InterruptedException e) {
log.error("extractDaily run exception", e);
log.info("===== extractDaily method end customerId:{}======",customerId);
} catch (Exception e) {
log.error("extractDaily exception msg:{}", e);
} finally {
distributedLock.unLock(lock);
}
log.info("===== extractDaily method end customerId:{}======",customerId);
}
@Override

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

@ -198,7 +198,7 @@ public class ScreenProjectSettleServiceImpl implements ScreenProjectSettleServic
}
}
log.error(String.format("/data/stats/demo/project-test,screen_project_**表抽取完毕,customerId:%s", param.getCustomerId()));
log.warn(String.format("/data/stats/demo/project-test,screen_project_**表抽取完毕,customerId:%s", param.getCustomerId()));
}
/**

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCustomerAgencyService.java

@ -155,4 +155,13 @@ public interface ScreenCustomerAgencyService extends BaseService<ScreenCustomerA
*/
Map<String, ScreenCustomerAgencyEntity> getAgencyList(String customerId);
/**
* @Description 获取父级组织ID外部客户
* @Param agencyId
* @Return {@link String}
* @Author zhaoqifeng
* @Date 2021/11/10 17:00
*/
String getParentAgencyId(String agencyId);
}

34
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryGridAndOrgDailyService.java

@ -0,0 +1,34 @@
package com.epmet.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity;
import java.util.List;
import java.util.Map;
/**
* 项目(事件)分类按 网格组织按天统计
*/
public interface ScreenProjectCategoryGridAndOrgDailyService {
/**
* @Description 分类下的项目数grid
* @param customerId
* @param dateId
* @author zxc
* @date 2021/11/10 10:23 上午
*/
void extractCategoryProjectGridData(String customerId, String dateId);
/**
* @Description 分类下的项目数org
* @param customerId
* @param dateId
* @author zxc
* @date 2021/11/10 10:23 上午
*/
void extractCategoryProjectOrgData(String customerId, String dateId);
}

105
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectCategoryService.java

@ -0,0 +1,105 @@
/**
* 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.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.screen.ScreenProjectCategoryDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity;
import java.util.List;
import java.util.Map;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-10
*/
public interface ScreenProjectCategoryService extends BaseService<ScreenProjectCategoryEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<ScreenProjectCategoryDTO>
* @author generator
* @date 2021-11-10
*/
PageData<ScreenProjectCategoryDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<ScreenProjectCategoryDTO>
* @author generator
* @date 2021-11-10
*/
List<ScreenProjectCategoryDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return ScreenProjectCategoryDTO
* @author generator
* @date 2021-11-10
*/
ScreenProjectCategoryDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2021-11-10
*/
void save(ScreenProjectCategoryDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2021-11-10
*/
void update(ScreenProjectCategoryDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2021-11-10
*/
void delete(String[] ids);
/**
* 删除项目分类
* @Param customerId
* @Param projectIds
* @Return
* @Author zhaoqifeng
* @Date 2021/11/10 11:06
*/
void deleteByProjectId(String customerId, List<String> projectIds);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenProjectDataService.java

@ -148,4 +148,13 @@ public interface ScreenProjectDataService extends BaseService<ScreenProjectDataE
*/
void sendProjectChangeMq(DisputeProcessMQMsg msg);
/**
* @Description 提取项目分类
* @Param customerId
* @Return
* @Author zhaoqifeng
* @Date 2021/11/10 10:24
*/
void extractCategory(String customerId);
}

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

@ -144,6 +144,7 @@ public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl<ScreenCusto
}
exists.setAllParentNames(e.getAllParentName());
exists.setParentAreaCode(e.getParentAreaCode());
exists.setCode(e.getCode());
updateAgency(exists);
}
}
@ -246,6 +247,7 @@ public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl<ScreenCusto
cae.setPids(e.getPids());
cae.setSourceType(OrgSourceTypeConstant.INTERNAL);
cae.setParentAreaCode(e.getParentAreaCode());
cae.setCode(e.getCode());
screenCustomerAgencyDao.insert(cae);
}
@ -333,4 +335,17 @@ public class ScreenCustomerAgencyServiceImpl extends BaseServiceImpl<ScreenCusto
return list.stream().collect(Collectors.toMap(ScreenCustomerAgencyEntity::getAgencyId, Function.identity()));
}
/**
* @param agencyId
* @Description 获取父级组织ID外部客户
* @Param agencyId
* @Return {@link String}
* @Author zhaoqifeng
* @Date 2021/11/10 17:00
*/
@Override
public String getParentAgencyId(String agencyId) {
return baseDao.getParentAgencyId(agencyId);
}
}

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

@ -84,6 +84,7 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
insertOne.setParentAgencyId(grid.getPid());
insertOne.setSourceType(OrgSourceTypeConstant.INTERNAL);
insertOne.setAreaCode(grid.getAreaCode());
insertOne.setCode(grid.getCode());
screenCustomerGridDao.insert(insertOne);
}
}
@ -98,6 +99,7 @@ public class ScreenCustomerGridServiceImpl extends BaseServiceImpl<ScreenCustome
screenGrid.setDataEndTime(dateStr);
screenGrid.setGridName(grid.getGridName());
screenGrid.setAreaCode(grid.getAreaCode());
screenGrid.setCode(grid.getCode());
screenCustomerGridDao.updateById(screenGrid);
if ("1".equals(grid.getDelFlag())) {

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

@ -0,0 +1,229 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.PingYinConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerAgencyDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.dto.screen.ScreenProjectOrgDailyDTO;
import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO;
import com.epmet.entity.crm.CustomerRelationEntity;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryGridDailyEntity;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryOrgDailyEntity;
import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryGridAndOrgDailyService;
import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryGridDailyService;
import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryOrgDailyService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @Author zxc
* @DateTime 2021/11/10 10:25 上午
* @DESC
*/
@Service
@DataSource(DataSourceConstant.EVALUATION_INDEX)
@Slf4j
public class ScreenProjectCategoryGridAndOrgDailyServiceImpl implements ScreenProjectCategoryGridAndOrgDailyService{
@Autowired
private ScreenProjectDataDao screenProjectDataDao;
@Autowired
private CustomerRelationService relationService;
@Autowired
private ScreenProjectCategoryGridDailyDao gridDailyDao;
@Autowired
private ScreenProjectCategoryGridDailyService gridDailyService;
@Autowired
private ScreenProjectCategoryOrgDailyService orgDailyService;
@Autowired
private ScreenProjectCategoryOrgDailyDao orgDailyDao;
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
/**
* @Description 分类下的项目数grid
* @param customerId
* @param dateId
* @author zxc
* @date 2021/11/10 10:23 上午
*/
@Override
public void extractCategoryProjectGridData(String customerId, String dateId) {
log.info("开始执行网格项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>();
customerIds.add(customerId);
List<GridAndOrgCategoryCountResultDTO> allList = new ArrayList<>();
List<GridAndOrgCategoryCountResultDTO> closedList = new ArrayList<>();
if (CollectionUtils.isEmpty(relationInfo)){
// 单客户
allList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL,customerId, NumConstant.FOUR);
closedList = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED,customerId, NumConstant.FOUR);
}else {
// 多客户
List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList());
customerIds.addAll(subCustomerIds);
List<GridAndOrgCategoryCountResultDTO> finalAllList = allList;
List<GridAndOrgCategoryCountResultDTO> finalClosedList1 = closedList;
customerIds.forEach(c -> {
List<GridAndOrgCategoryCountResultDTO> all = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_ALL, c, NumConstant.TWO);
finalAllList.addAll(all);
List<GridAndOrgCategoryCountResultDTO> closed = screenProjectDataDao.selectGridCategoryProjectCount(dateId, customerId, ProjectConstant.PROJECT_STATUS_CLOSED, c, NumConstant.TWO);
finalClosedList1.addAll(closed);
});
}
List<GridAndOrgCategoryCountResultDTO> finalClosedList = closedList;
allList.forEach(a -> finalClosedList.stream().filter(c -> c.getGridId().equals(a.getGridId()) && c.getCategoryCode().equals(a.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
gridDel(customerId,dateId);
log.info("网格-所有项目分类即将插入的集合{}",JSON.toJSONString(allList));
gridInsert(allList);
long end = System.currentTimeMillis();
log.info("网格项目分类统计结束,耗时:"+ (end-start)/1000 + "s");
}
/**
* @Description 项目分类网格删除
* @param customerId
* @param dateId
* @author zxc
* @date 2021/11/10 1:55 下午
*/
@Transactional(rollbackFor = Exception.class)
public void gridDel(String customerId,String dateId){
Integer num = NumConstant.ZERO;
do {
num = gridDailyDao.deleteByDateIdAndCustomerId(customerId, dateId);
}while (num > NumConstant.ZERO && num == NumConstant.ONE_THOUSAND);
}
/**
* @Description 项目分类网格添加
* @param needInsert
* @author zxc
* @date 2021/11/10 1:55 下午
*/
@Transactional(rollbackFor = Exception.class)
public void gridInsert(List<GridAndOrgCategoryCountResultDTO> needInsert){
List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
gridDailyService.insertBatch(ConvertUtils.sourceToTarget(p,ScreenProjectCategoryGridDailyEntity.class));
log.info("插入的网格项目分类为" + JSON.toJSONString(p));
});
}
/**
* @Description 分类下的项目数org
* 项目分类来源
* 本级直接立项 + 下级 + 直属网格
* @param customerId
* @param dateId
* @author zxc
* @date 2021/11/10 10:23 上午
*/
@Override
public void extractCategoryProjectOrgData(String customerId, String dateId) {
log.info("开始执行组织项目分类统计");
long start = System.currentTimeMillis();
List<CustomerRelationEntity> relationInfo = relationService.selectSubCustomer(customerId);
List<String> customerIds = new ArrayList<>();
customerIds.add(customerId);
List<GridAndOrgCategoryCountResultDTO> result = new ArrayList<>();
if (CollectionUtils.isEmpty(relationInfo)){
// one customer
List<ScreenProjectOrgDailyDTO> agencies = screenCustomerAgencyDao.selectAgencyByCustomer(customerId);
if (CollectionUtils.isEmpty(agencies)){
return;
}
List<GridAndOrgCategoryCountResultDTO> allAgencies = ConvertUtils.sourceToTarget(agencies, GridAndOrgCategoryCountResultDTO.class);
result = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
List<GridAndOrgCategoryCountResultDTO> closedList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
result.forEach(r -> closedList.stream().filter(c -> r.getOrgId().equals(c.getOrgId()) && r.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> r.setClosedProjectTotal(c.getClosedProjectTotal())));
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.FOUR, allAgencies);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.FOUR, allAgencies);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
result.addAll(oneLevelList);
}else {
// more customers
// 去除孔村的客户ID,孔村镇的单独查😡
List<String> subCustomerIds = relationInfo.stream().map(CustomerRelationEntity::getCustomerId).collect(Collectors.toList());
for (int i = NumConstant.ZERO; i < subCustomerIds.size(); i++) {
if (subCustomerIds.get(i).equals(PingYinConstant.KONG_CUN_CUSTOMER_ID)){
customerIds.remove(i);
continue;
}
}
subCustomerIds.add(customerId);
List<GridAndOrgCategoryCountResultDTO> allAgencies = screenCustomerAgencyDao.selectParentSonAgency(subCustomerIds, PingYinConstant.KONG_CUN_CUSTOMER_ID);
List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(allAgencies, NumConstant.FIFTY);
List<GridAndOrgCategoryCountResultDTO> allOrgCategoryList = result;
partition.forEach(p -> {
List<GridAndOrgCategoryCountResultDTO> allOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
List<GridAndOrgCategoryCountResultDTO> closedOrgList = screenProjectDataDao.selectOrgCategoryProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
allOrgList.forEach(a -> closedOrgList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
List<GridAndOrgCategoryCountResultDTO> oneLevelList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_ALL, customerId, NumConstant.TWO, p);
List<GridAndOrgCategoryCountResultDTO> oneLevelClosedList = screenProjectDataDao.selectOrgCategoryOneLevelProjectCount(dateId, ProjectConstant.PROJECT_STATUS_CLOSED, customerId, NumConstant.TWO, p);
oneLevelList.forEach(a -> oneLevelClosedList.stream().filter(c -> a.getOrgId().equals(c.getOrgId()) && a.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> a.setClosedProjectTotal(c.getClosedProjectTotal())));
allOrgList.addAll(oneLevelList);
allOrgCategoryList.addAll(allOrgList);
});
}
orgDel(customerId,dateId);
log.info("组织-即将插入的项目分类{}",JSON.toJSONString(result));
orgInsert(result);
long end = System.currentTimeMillis();
log.info("组织项目分类统计结束,耗时:"+ (end-start)/1000 + "s");
}
/**
* @Description 项目分类组织删除
* @param customerId
* @param dateId
* @author zxc
* @date 2021/11/10 4:58 下午
*/
@Transactional(rollbackFor = Exception.class)
public void orgDel(String customerId,String dateId){
Integer num = NumConstant.ZERO;
do {
num = orgDailyDao.deleteByDateIdAndCustomerId(customerId, dateId);
}while (num > NumConstant.ZERO && num == NumConstant.ONE_THOUSAND);
}
/**
* @Description 项目分类组织插入
* @param needInsert
* @author zxc
* @date 2021/11/10 5:03 下午
*/
@Transactional(rollbackFor = Exception.class)
public void orgInsert(List<GridAndOrgCategoryCountResultDTO> needInsert){
List<List<GridAndOrgCategoryCountResultDTO>> partition = ListUtils.partition(needInsert, NumConstant.ONE_HUNDRED);
partition.forEach(p -> {
orgDailyService.insertBatch(ConvertUtils.sourceToTarget(p, ScreenProjectCategoryOrgDailyEntity.class));
log.info("插入的组织项目分类为" + JSON.toJSONString(p));
});
}
}

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

@ -32,6 +32,7 @@ import com.epmet.constant.ScreenConstant;
import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryGridDailyDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryOrgDailyDao;
import com.epmet.dto.extract.result.CustomerAgencyInfoResultDTO;
import com.epmet.dto.project.result.ClosedProjectTotalResultDTO;
import com.epmet.dto.screen.ScreenCustomerGridDTO;
import com.epmet.dto.screen.ScreenProjectCategoryGridDailyDTO;
import com.epmet.dto.screen.ScreenProjectCategoryOrgDailyDTO;
@ -264,6 +265,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
categoryProjectGrid.forEach(grid -> {
if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){
agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal());
agency.setClosedProjectTotal(agency.getClosedProjectTotal() + grid.getClosedProjectTotal());
grid.setStatus(true);
}
});
@ -280,7 +282,11 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
// 组织项目分类 项目数
List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level);
if (!CollectionUtils.isEmpty(levelAgencyInfo)){
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds,customerId);
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds,customerId,NumConstant.FOUR,"all");
List<ScreenProjectCategoryGridDailyDTO> closedScreenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds,customerId,NumConstant.FOUR,"closed");
if (!CollectionUtils.isEmpty(closedScreenProjectCategory)){
screenProjectCategory.forEach(l -> closedScreenProjectCategory.stream().filter(c -> l.getGridId().equals(c.getGridId()) && l.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> l.setClosedProjectTotal(c.getClosedProjectTotal())));
}
if (!CollectionUtils.isEmpty(result)){
if (!CollectionUtils.isEmpty(screenProjectCategory)){
result.forEach(r -> {
@ -288,6 +294,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
if (r.getOrgId().equals(pc.getOrgId()) && r.getCategoryCode().equals(pc.getCategoryCode())){
pc.setStatus(true);
r.setProjectTotal(r.getProjectTotal() + pc.getProjectTotal());
r.setClosedProjectTotal(r.getClosedProjectTotal() + pc.getClosedProjectTotal());
}
});
});
@ -390,6 +397,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
// 组织ID 和 分类标签code一样时,项目数累加
if (agency.getOrgId().equals(grid.getOrgId()) && agency.getCategoryCode().equals(grid.getCategoryCode())){
agency.setProjectTotal(agency.getProjectTotal() + grid.getProjectTotal());
agency.setClosedProjectTotal(agency.getClosedProjectTotal() + grid.getClosedProjectTotal());
grid.setStatus(true);
}
});
@ -415,15 +423,25 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
// 子客户单独存一份【三个街道的】
List<CategoryProjectResultDTO> sonCustomerList = new ArrayList<>();
// 父客户存在的分类
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, true);
List<CategoryProjectResultDTO> categoryProjectExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId);
log.info("父客户存在的分类{}"+ JSON.toJSONString(categoryProjectExists));
// 父客户存在的分类 已结案的项目数
List<ClosedProjectTotalResultDTO> closedProjectTotalExist = baseDao.selectClosedProjectTotal(customerIds, dateId, true);
// 父客户不存在的分类
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfo(customerIds, dateId, level, customerId, false);
List<CategoryProjectResultDTO> categoryProjectNotExists = baseDao.selectOrgCategoryMoreCustomerInfoNotExists(customerIds, dateId, level, customerId);
log.info("父客户不存在的分类{}"+ JSON.toJSONString(categoryProjectNotExists));
// 父客户 不存在 的分类 已结案的项目数
List<ClosedProjectTotalResultDTO> closedProjectTotalNotExist = baseDao.selectClosedProjectTotal(customerIds, dateId, false);
if (!CollectionUtils.isEmpty(categoryProjectExists)){
if (!CollectionUtils.isEmpty(closedProjectTotalExist)){
categoryProjectExists.forEach(l -> closedProjectTotalExist.stream().filter(c -> l.getOrgId().equals(c.getOrgId()) && l.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> l.setClosedProjectTotal(c.getClosedProjectTotal())));
}
sonCustomerList.addAll(categoryProjectExists);
}
if (!CollectionUtils.isEmpty(categoryProjectNotExists)){
if (!CollectionUtils.isEmpty(closedProjectTotalNotExist)){
categoryProjectNotExists.forEach(l -> closedProjectTotalNotExist.stream().filter(c -> l.getOrgId().equals(c.getOrgId()) && l.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> l.setClosedProjectTotal(c.getClosedProjectTotal())));
}
sonCustomerList.addAll(categoryProjectNotExists);
}
if (!CollectionUtils.isEmpty(sonCustomerList)){
@ -443,6 +461,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
categoryProjectExists.forEach(c -> {
if (f.getCategoryCode().equals(c.getCategoryCode())){
f.setProjectTotal(f.getProjectTotal() + c.getProjectTotal());
f.setClosedProjectTotal(f.getClosedProjectTotal() + c.getClosedProjectTotal());
c.setStatus(true);
}
});
@ -481,6 +500,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
e.setCategoryCode(code);
e.setOrgId(entity.getAgencyId());
e.setProjectTotal(CollectionUtils.isEmpty(list2) ? NumConstant.ZERO : list2.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getProjectTotal)));
e.setClosedProjectTotal(CollectionUtils.isEmpty(list2) ? NumConstant.ZERO : list2.stream().collect(Collectors.summingInt(CategoryProjectResultDTO::getClosedProjectTotal)));
e.setPid(entity.getPid());
e.setPids(StringUtils.isEmpty(entity.getPids()) ? NumConstant.ZERO_STR : entity.getPids());
// 因为根据categoryCode分组,所以level都一样,取第一条的
@ -496,7 +516,11 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
List<CustomerAgencyInfoResultDTO> levelAgencyInfo = groupByLevel.get(level);
if (!CollectionUtils.isEmpty(levelAgencyInfo)) {
// 查询客户下,组织直接立项的,各项目分类下的项目数量【筛选组织创建的项目,fact_origin_project_main_daily表gridId为空】
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId);
List<ScreenProjectCategoryGridDailyDTO> screenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId,NumConstant.TWO,"all");
List<ScreenProjectCategoryGridDailyDTO> closedScreenProjectCategory = factOriginProjectCategoryDailyService.selectListProjectCategoryByOrg(orgIds, customerId,NumConstant.TWO,"closed");
if (!CollectionUtils.isEmpty(closedScreenProjectCategory)){
screenProjectCategory.forEach(l -> closedScreenProjectCategory.stream().filter(c -> l.getGridId().equals(c.getGridId()) && l.getCategoryCode().equals(c.getCategoryCode())).forEach(c -> l.setClosedProjectTotal(c.getClosedProjectTotal())));
}
log.info("直接立项的统计:"+screenProjectCategory);
if (!CollectionUtils.isEmpty(result)) {
if (!CollectionUtils.isEmpty(screenProjectCategory)) {
@ -505,6 +529,7 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
if (r.getOrgId().equals(pc.getOrgId()) && r.getCategoryCode().equals(pc.getCategoryCode())) {
pc.setStatus(true);
r.setProjectTotal(r.getProjectTotal() + pc.getProjectTotal());
r.setClosedProjectTotal(r.getClosedProjectTotal() + pc.getClosedProjectTotal());
}
});
});
@ -567,4 +592,4 @@ public class ScreenProjectCategoryOrgDailyServiceImpl extends BaseServiceImpl<Sc
}while (row > NumConstant.ZERO && row == NumConstant.ONE_THOUSAND);
}
}
}

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

@ -0,0 +1,119 @@
/**
* 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.service.evaluationindex.screen.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.evaluationindex.screen.ScreenProjectCategoryDao;
import com.epmet.dto.screen.ScreenProjectCategoryDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity;
import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 项目所属分类表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2021-11-10
*/
@Service
public class ScreenProjectCategoryServiceImpl extends BaseServiceImpl<ScreenProjectCategoryDao, ScreenProjectCategoryEntity> implements ScreenProjectCategoryService {
@Override
public PageData<ScreenProjectCategoryDTO> page(Map<String, Object> params) {
IPage<ScreenProjectCategoryEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, ScreenProjectCategoryDTO.class);
}
@Override
public List<ScreenProjectCategoryDTO> list(Map<String, Object> params) {
List<ScreenProjectCategoryEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, ScreenProjectCategoryDTO.class);
}
private QueryWrapper<ScreenProjectCategoryEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<ScreenProjectCategoryEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public ScreenProjectCategoryDTO get(String id) {
ScreenProjectCategoryEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, ScreenProjectCategoryDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(ScreenProjectCategoryDTO dto) {
ScreenProjectCategoryEntity entity = ConvertUtils.sourceToTarget(dto, ScreenProjectCategoryEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(ScreenProjectCategoryDTO dto) {
ScreenProjectCategoryEntity entity = ConvertUtils.sourceToTarget(dto, ScreenProjectCategoryEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
/**
* 删除项目分类
*
* @param customerId
* @param projectIds
* @Param customerId
* @Param projectIds
* @Return
* @Author zhaoqifeng
* @Date 2021/11/10 11:06
*/
@Override
public void deleteByProjectId(String customerId, List<String> projectIds) {
if (CollectionUtils.isEmpty(projectIds)) {
return;
}
baseDao.deleteByProjectIds(customerId, projectIds);
}
}

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

@ -17,6 +17,7 @@
package com.epmet.service.evaluationindex.screen.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
@ -24,20 +25,29 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.rocketmq.messages.DisputeProcessMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.dao.evaluationindex.screen.ScreenProjectImgDataDao;
import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.ScreenProjectImgDataDTO;
import com.epmet.dto.screen.form.ScreenProjectDataInfoFormDTO;
import com.epmet.dto.screencoll.ScreenCollFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity;
import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity;
import com.epmet.entity.evaluationindex.screen.ScreenProjectImgDataEntity;
import com.epmet.entity.stats.CustomerProjectCategoryDictEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.evaluationindex.screen.ScreenCustomerAgencyService;
import com.epmet.service.evaluationindex.screen.ScreenProjectCategoryService;
import com.epmet.service.evaluationindex.screen.ScreenProjectDataService;
import com.epmet.service.stats.CustomerProjectCategoryDictService;
import com.github.pagehelper.PageHelper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@ -47,11 +57,8 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
* 中央区-项目数据
@ -59,6 +66,7 @@ import java.util.Map;
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-02-23
*/
@Slf4j
@Service
@DataSource(value = DataSourceConstant.EVALUATION_INDEX)
public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectDataDao, ScreenProjectDataEntity> implements ScreenProjectDataService {
@ -67,6 +75,14 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
private ScreenProjectImgDataDao screenProjectImgDataDao;
@Resource
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Resource
private ScreenProjectCategoryService screenProjectCategoryService;
@Resource
private CustomerProjectCategoryDictService customerProjectCategoryDictService;
@Resource
private OperCrmOpenFeignClient operCrmOpenFeignClient;
@Resource
private ScreenCustomerAgencyService screenCustomerAgencyService;
@Override
public PageData<ScreenProjectDataDTO> page(Map<String, Object> params) {
@ -121,95 +137,84 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
}
@Override
@Transactional(rollbackFor = Exception.class)
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
public void collect(ScreenCollFormDTO<ScreenProjectDataInfoFormDTO> param) {
/*if (param.getIsFirst()) {
int affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
while (affectedRows > 0) {
affectedRows = baseDao.deleteByDateIdAndCustomerId(param.getCustomerId(), param.getDateId());
}
}*/
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date today = new Date();
param.getDataList().forEach(item -> {
String projectStatusCode = item.getProjectStatusCode();
//2021.3.8 epmet中,调用方传level,这边不再计算
if(item.getProjectLevel() == null){
//todo 动态获取超时时间
//如果结案 结案时间立项时间;
if ("closed_case".equals(projectStatusCode)) {
Date createTime = item.getProjectCreateTime();
Date closeCaseTime = item.getCloseCaseTime();
if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) {
//如果结案时间-立项时间小于等于4天 未超期 level3
item.setProjectLevel(3);
} else if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) {
//如果结案时间-立项时间大于4天小于5天 即将超期 level2
item.setProjectLevel(2);
} else {
//大于5天 已超期 level1
item.setProjectLevel(1);
}
} else if ("pending".equals(projectStatusCode)) {
//如果处理中 当前时间-立项时间;
Date createTime = item.getProjectCreateTime();
if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4) {
//如果当前时间-立项时间小于等于4天 未超期 level3
item.setProjectLevel(3);
} else if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5) {
//如果当前时间-立项时间大于4天小于5天 即将超期 level2
item.setProjectLevel(2);
} else {
//大于5天 已超期 level1
item.setProjectLevel(1);
}
}
}
//先删除该projectId对应的旧数据
baseDao.deleteByProjectId(param.getCustomerId(), item.getProjectId());
screenProjectImgDataDao.deleteByProjectId(param.getCustomerId(), item.getProjectId());
//如果orgType未知,获取一下
// if ("unknown".equals(item.getOrgType())){
// ScreenCustomerAgencyEntity screenCustomerAgencyEntity = agencyDao.selectById(item.getOrgId());
// if (screenCustomerAgencyEntity != null){
// item.setOrgType("agency");
// }else {
// ScreenCustomerDeptEntity screenCustomerDeptEntity = deptDao.selectById(item.getOrgId());
// if (screenCustomerDeptEntity!=null){
// item.setOrgType("department");
// }else {
// ScreenCustomerGridEntity screenCustomerGridEntity = gridDao.selectById(item.getOrgId());
// if (screenCustomerGridEntity != null){
// item.setOrgType("grid");
// }
// }
// }
// }
setLevelByCreateTime(item, projectStatusCode);
//插入项目表
ScreenProjectDataEntity screenProjectDataEntity = ConvertUtils.sourceToTarget(item, ScreenProjectDataEntity.class);
screenProjectDataEntity.setCustomerId(param.getCustomerId());
screenProjectDataEntity.setDataEndTime(param.getDateId());
baseDao.insert(screenProjectDataEntity);
//插入图片表
String[] projectImgUrl = item.getProjectImgUrl();
if (ArrayUtils.isNotEmpty(projectImgUrl)) {
for (int i = 0; i < projectImgUrl.length; i++) {
ScreenProjectImgDataEntity screenProjectImgDataEntity = new ScreenProjectImgDataEntity();
screenProjectImgDataEntity.setCustomerId(param.getCustomerId());
screenProjectImgDataEntity.setProjectId(item.getProjectId());
screenProjectImgDataEntity.setProjectImgUrl(projectImgUrl[i]);
screenProjectImgDataEntity.setSort(i);
screenProjectImgDataDao.insert(screenProjectImgDataEntity);
}
String agencyId = screenCustomerAgencyService.getParentAgencyId(screenProjectDataEntity.getAllParentIds().split(StrConstant.COMMA)[0]);
if(StringUtils.isNotBlank(agencyId)) {
screenProjectDataEntity.setAllParentIds(agencyId.concat(StrConstant.COMMA).concat(screenProjectDataEntity.getAllParentIds()));
}
//删除 并插入新的项目数据
delAndInsertProjectData(param, item, screenProjectDataEntity);
});
}
@Transactional(rollbackFor = Exception.class)
public void delAndInsertProjectData(ScreenCollFormDTO<ScreenProjectDataInfoFormDTO> param, ScreenProjectDataInfoFormDTO item, ScreenProjectDataEntity screenProjectDataEntity) {
//先删除该projectId对应的旧数据
baseDao.deleteByProjectId(param.getCustomerId(), item.getProjectId());
screenProjectImgDataDao.deleteByProjectId(param.getCustomerId(), item.getProjectId());
baseDao.insert(screenProjectDataEntity);
saveCategory(param.getCustomerId(), Collections.singletonList(screenProjectDataEntity));
//插入该项目图片表
String[] projectImgUrl = item.getProjectImgUrl();
if (ArrayUtils.isNotEmpty(projectImgUrl)) {
List<ScreenProjectImgDataDTO> imgList = new ArrayList<>();
for (int i = 0; i < projectImgUrl.length; i++) {
ScreenProjectImgDataDTO screenProjectImgDataEntity = new ScreenProjectImgDataDTO();
screenProjectImgDataEntity.setCustomerId(param.getCustomerId());
screenProjectImgDataEntity.setProjectId(item.getProjectId());
screenProjectImgDataEntity.setProjectImgUrl(projectImgUrl[i]);
screenProjectImgDataEntity.setSort(i);
imgList.add(screenProjectImgDataEntity);
}
screenProjectImgDataDao.insertBatch(imgList);
}
}
private void setLevelByCreateTime(ScreenProjectDataInfoFormDTO item, String projectStatusCode) {
if(item.getProjectLevel() == null){
//todo 动态获取超时时间
//如果结案 结案时间立项时间;
if ("closed_case".equals(projectStatusCode)) {
Date createTime = item.getProjectCreateTime();
Date closeCaseTime = item.getCloseCaseTime();
if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4L) {
//如果结案时间-立项时间小于等于4天 未超期 level3
item.setProjectLevel(3);
} else if (closeCaseTime.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5L) {
//如果结案时间-立项时间大于4天小于5天 即将超期 level2
item.setProjectLevel(2);
} else {
//大于5天 已超期 level1
item.setProjectLevel(1);
}
} else if ("pending".equals(projectStatusCode)) {
//如果处理中 当前时间-立项时间;
Date createTime = item.getProjectCreateTime();
Date today = new Date();
if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 4L) {
//如果当前时间-立项时间小于等于4天 未超期 level3
item.setProjectLevel(3);
} else if (today.getTime() - createTime.getTime() <= 1000 * 60 * 60 * 24 * 5L) {
//如果当前时间-立项时间大于4天小于5天 即将超期 level2
item.setProjectLevel(2);
} else {
//大于5天 已超期 level1
item.setProjectLevel(1);
}
}
}
}
/**
@ -255,20 +260,24 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
//复采集时数不会重复
if(!CollectionUtils.isEmpty(meta)){
int affectedRows = baseDao.deleteByProjectTimeAndCustomerId(customerId,dateId);
while (affectedRows > 0) {
while (affectedRows > NumConstant.ZERO) {
affectedRows = baseDao.deleteByProjectTimeAndCustomerId(customerId, dateId);
}
List<List<ScreenProjectDataDTO>> partition = ListUtils.partition(meta, NumConstant.ONE_HUNDRED);
partition.forEach(part -> {
List<ScreenProjectDataEntity> list = ConvertUtils.sourceToTarget(part, ScreenProjectDataEntity.class);
insertBatch(list);
saveCategory(customerId, list);
});
}
if(!CollectionUtils.isEmpty(orient)){
List<List<ScreenProjectDataDTO>> partition = ListUtils.partition(orient, NumConstant.ONE_HUNDRED);
partition.forEach(part -> baseDao.updateBatch(part,dateId));
partition.forEach(part -> {
baseDao.updateBatch(part,dateId);
saveCategory(customerId, ConvertUtils.sourceToTarget(part, ScreenProjectDataEntity.class));
});
}
}
@ -306,4 +315,73 @@ public class ScreenProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectD
SendMqMsgUtil.build().openFeignClient(epmetMessageOpenFeignClient).sendProjectMqMsg(msg);
}
/**
* @param customerId
* @Description 提取项目分类
* @Param customerId
* @Return
* @Author zhaoqifeng
* @Date 2021/11/10 10:24
*/
@Override
public void extractCategory(String customerId) {
LambdaQueryWrapper<ScreenProjectDataEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(customerId), ScreenProjectDataEntity::getCustomerId, customerId);
List<ScreenProjectDataEntity> projectList = baseDao.selectList(wrapper);
saveCategory(customerId, projectList);
}
private void saveCategory(String customerId, List<ScreenProjectDataEntity> projectList) {
Result<String> parentCustomer = operCrmOpenFeignClient.getExternalAndParentCustomerId(customerId);
//删除旧分类
List<String> projectIds = projectList.stream().map(ScreenProjectDataEntity::getProjectId).collect(Collectors.toList());
screenProjectCategoryService.deleteByProjectId(customerId, projectIds);
//提取分类信息
List<ScreenProjectCategoryEntity> projectCategoryList = new ArrayList<>();
projectList.forEach(project -> {
//分类为空不作处理
if (StringUtils.isBlank(project.getCategoryCode())) {
return;
}
List<String> categoryList = Arrays.asList(project.getCategoryCode().split(StrConstant.COMMA));
categoryList.forEach(category -> {
ScreenProjectCategoryEntity entity = new ScreenProjectCategoryEntity();
entity.setCustomerId(customerId);
entity.setProjectId(project.getProjectId());
entity.setOriginCategoryCode(category);
CustomerProjectCategoryDictEntity categoryEntity = customerProjectCategoryDictService.getByCategoryCode(customerId, category);
if (null == categoryEntity) {
log.error("customerId:{} categoryCode:{} is not exist in ProjectCategoryDict", customerId, category);
return;
}
if ("external".equals(categoryEntity.getCustomerType())) {
entity.setCategoryCode(categoryEntity.getEpmetCategoryCode());
CustomerProjectCategoryDictEntity parent = customerProjectCategoryDictService.getByCategoryCode(parentCustomer.getData(), categoryEntity.getEpmetCategoryCode());
if (null != parent) {
entity.setParentCategoryCode(parent.getParentCategoryCode());
entity.setLevel(parent.getLevel());
} else {
log.error("未找到对应分类");
}
} else {
entity.setCategoryCode(categoryEntity.getCategoryCode());
entity.setParentCategoryCode(categoryEntity.getParentCategoryCode());
entity.setLevel(categoryEntity.getLevel());
}
projectCategoryList.add(entity);
//如果分类数据已经超过100了 就插入一批
if (projectCategoryList.size() > NumConstant.ONE_HUNDRED){
screenProjectCategoryService.insertBatch(projectCategoryList);
projectCategoryList.clear();
}
});
});
//如果不为空 则插入剩余的那一部分
if (projectCategoryList.size() > NumConstant.ZERO){
screenProjectCategoryService.insertBatch(projectCategoryList);
}
}
}

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

@ -195,7 +195,7 @@ public class ScreenProjectOrgDailyServiceImpl extends BaseServiceImpl<ScreenProj
agencyInfos.forEach(a -> {
a.setDateId(dateId);
projectOrgDaily.forEach(p -> {
if (a.getAreaCode().equals(p.getAreaCode())){
if (a.getOrgId().equals(p.getOrgId())){
a.setBadTotal(p.getBadTotal() + a.getBadTotal());
a.setEvaluateTotal(p.getEvaluateTotal() + a.getEvaluateTotal());
a.setGoodTotal(p.getGoodTotal() + a.getGoodTotal());

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

@ -1,7 +1,6 @@
package com.epmet.service.impl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.BaseReportConstant;
import com.epmet.dao.stats.BaseReportDao;
import com.epmet.dto.basereport.form.*;
import com.epmet.service.BaseReportService;
@ -60,7 +59,8 @@ public class BaseReportServiceImpl implements BaseReportService {
} while (deleteNum > NumConstant.ZERO);
}
if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
baseReportDao.insertBatchAgencyRegUser(formDTO.getDataList());
ListUtils.partition(formDTO.getDataList(),NumConstant.ONE_HUNDRED)
.forEach(part->baseReportDao.insertBatchAgencyRegUser(part));
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsDimServiceImpl.java

@ -106,6 +106,7 @@ public class StatsDimServiceImpl implements StatsDimService {
dimGrid.setGridName(updatedGrid.getGridName());
dimGrid.setUpdatedTime(now);
dimGrid.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
dimGrid.setCode(updatedGrid.getCode());
dimGrids.add(dimGrid);
}
}
@ -134,6 +135,7 @@ public class StatsDimServiceImpl implements StatsDimService {
dimGrid.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
dimGrid.setCreatedTime(initTime);
dimGrid.setUpdatedTime(initTime);
dimGrid.setCode(grid.getCode());
return dimGrid;
}).collect(Collectors.toList());
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java

@ -141,6 +141,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
existsDimAgency.setAgencyName(agency.getOrganizationName());
existsDimAgency.setUpdatedTime(initTime);
existsDimAgency.setUpdatedBy(RobotConstant.DIMENSION_ROBOT);
existsDimAgency.setCode(agency.getCode());
baseDao.updateById(existsDimAgency);
}
}
@ -150,6 +151,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
public void initAgencyAllDim(CustomerAgencyEntity agency, Date initTime) {
DimAgencyEntity dimAgencyEntity = new DimAgencyEntity();
dimAgencyEntity.setCode(agency.getCode());
dimAgencyEntity.setAgencyName(agency.getOrganizationName());
dimAgencyEntity.setAllParentName(agency.getAllParentName());
dimAgencyEntity.setCustomerId(agency.getCustomerId());
@ -172,6 +174,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl<DimAgencyDao, DimAgenc
public void initAgencySelfDim(CustomerAgencyEntity agency, Date initTime) {
DimAgencyEntity dimAgencyEntity = new DimAgencyEntity();
dimAgencyEntity.setAgencyName(agency.getOrganizationName());
dimAgencyEntity.setCode(agency.getCode());
dimAgencyEntity.setAllParentName(agency.getAllParentName());
dimAgencyEntity.setCustomerId(agency.getCustomerId());
dimAgencyEntity.setLevel(agency.getLevel());

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.25__add_closedProjectTotal.sql

@ -0,0 +1,2 @@
alter table screen_project_category_grid_daily add COLUMN CLOSED_PROJECT_TOTAL int(11) NOT NULL DEFAULT 0 comment '该分类下所有结案的项目数' AFTER PROJECT_TOTAL;
alter table screen_project_category_org_daily add COLUMN CLOSED_PROJECT_TOTAL int(11) NOT NULL DEFAULT 0 comment '该分类下所有结案的项目数' AFTER PROJECT_TOTAL;

48
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectCategoryDailyDao.xml

@ -36,13 +36,21 @@
p.GRID_ID,
p.AGENCY_ID AS PID,
P.PIDS,
count(1)as projectTotal
<if test='projectType == "closed" '>
count(1) AS closedProjectTotal
</if>
<if test='projectType == "all" '>
count(1)as projectTotal
</if>
FROM
fact_origin_project_category_daily c
LEFT JOIN fact_origin_project_main_daily p ON ( c.PROJECT_Id = p.id and p.del_flag='0' AND p.GRID_ID != '')
WHERE
c.DEL_FLAG = '0'
AND c.CUSTOMER_ID = #{customerId}
<if test='projectType == "closed" '>
AND p.PROJECT_STATUS = 'closed'
</if>
AND c.`LEVEL` = '2'
AND p.GRID_ID != ''
GROUP BY
@ -55,22 +63,30 @@
union all
SELECT
c.CUSTOMER_ID,
left(c.CATEGORY_CODE, 4) as CATEGORY_CODE,
left(c.CATEGORY_CODE, #{subCount}) as CATEGORY_CODE,
'1'as `LEVEL`,
p.GRID_ID,
p.AGENCY_ID AS PID,
P.PIDS,
count(distinct c.project_id)as projectTotal
<if test='projectType == "closed" '>
count(distinct c.project_id) AS closedProjectTotal
</if>
<if test='projectType == "all" '>
count(distinct c.project_id)as projectTotal
</if>
FROM
fact_origin_project_category_daily c
LEFT JOIN fact_origin_project_main_daily p ON ( c.PROJECT_Id = p.id and p.del_flag='0' AND p.GRID_ID != '')
WHERE
c.DEL_FLAG = '0'
AND p.GRID_ID != ''
<if test='projectType == "closed" '>
AND p.PROJECT_STATUS = 'closed'
</if>
AND c.CUSTOMER_ID = #{customerId}
GROUP BY
c.CUSTOMER_ID,
left(c.CATEGORY_CODE, 4),
left(c.CATEGORY_CODE, #{subCount}),
c.`LEVEL`,
p.GRID_ID,
p.AGENCY_ID,
@ -87,7 +103,12 @@
p.AGENCY_ID AS orgId,
p.PID AS PID,
P.PIDS,
COUNT(DISTINCT p.ID) AS projectTotal
<if test='projectType == "all" '>
COUNT(DISTINCT p.ID) AS projectTotal
</if>
<if test='projectType == "closed" '>
COUNT(DISTINCT p.ID) AS closedProjectTotal
</if>
FROM fact_origin_project_main_daily p
LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID = '')
WHERE c.DEL_FLAG = '0'
@ -99,17 +120,25 @@
)
AND c.`LEVEL` = '2'
AND p.GRID_ID = ''
<if test='projectType == "closed" '>
AND p.PROJECT_STATUS = 'closed'
</if>
GROUP BY c.CUSTOMER_ID, c.CATEGORY_CODE, c.`LEVEL`, p.AGENCY_ID, p.PID, P.PIDS
UNION ALL
SELECT
c.CUSTOMER_ID,
c.CUSTOMER_ID AS categoryOriginCustomerId,
left(c.CATEGORY_CODE, 4) AS CATEGORY_CODE,
left(c.CATEGORY_CODE, #{subCount}) AS CATEGORY_CODE,
'1' AS `LEVEL`,
p.AGENCY_ID AS orgId,
p.PID AS PID,
P.PIDS,
COUNT(distinct p.ID) AS projectTotal
<if test='projectType == "all" '>
COUNT(DISTINCT p.ID) AS projectTotal
</if>
<if test='projectType == "closed" '>
COUNT(DISTINCT p.ID) AS closedProjectTotal
</if>
FROM fact_origin_project_main_daily p
LEFT JOIN fact_origin_project_category_daily c ON ( c.PROJECT_Id = p.id AND p.del_flag='0' AND p.GRID_ID = '')
WHERE c.DEL_FLAG = '0'
@ -120,6 +149,9 @@
</foreach>
)
AND p.GRID_ID = ''
GROUP BY c.CUSTOMER_ID, left(c.CATEGORY_CODE, 4), c.`LEVEL`, p.PID, p.AGENCY_ID, P.PIDS
<if test='projectType == "closed" '>
AND p.PROJECT_STATUS = 'closed'
</if>
GROUP BY c.CUSTOMER_ID, left(c.CATEGORY_CODE, #{subCount}), c.`LEVEL`, p.PID, p.AGENCY_ID, P.PIDS
</select>
</mapper>

76
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginProjectLogDailyDao.xml

@ -488,30 +488,62 @@
</select>
<select id="selectGridClosed" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT
a.ORG_ID,
a.GRID_ID AS "orgId",
a.count AS "sum",
IFNULL(b.count,0)AS "count"
IFNULL( b.count, 0 ) AS "count"
FROM
(SELECT ORG_ID,
COUNT(DISTINCT PROJECT_ID) AS "count"
FROM fact_origin_project_log_daily
WHERE( ACTION_CODE = 'created' OR ACTION_CODE = 'transfer')
AND IS_ACTIVE = 0
AND ORG_TYPE = 'grid'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
GROUP BY ORG_ID) a
LEFT JOIN
(SELECT fl.ORG_ID,
COUNT(DISTINCT fl.PROJECT_ID) AS "count"
FROM fact_origin_project_log_daily fl
INNER JOIN fact_origin_project_main_daily fm ON fl.PROJECT_ID = fm.ID AND fm.PROJECT_STATUS = 'closed'
WHERE( fl.ACTION_CODE = 'created' OR fl.ACTION_CODE = 'transfer')
AND fl.IS_ACTIVE = 0
AND fl.ORG_TYPE = 'grid'
AND fl.CUSTOMER_ID = #{customerId}
AND fl.MONTH_ID = #{monthId}
GROUP BY fl.ORG_ID) b ON a.ORG_ID = b.ORG_ID
( SELECT
GRID_ID,
COUNT( ID ) AS "count"
FROM
fact_origin_project_main_daily
WHERE
CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND GRID_ID != ''
GROUP BY GRID_ID ) a
LEFT JOIN
( SELECT
GRID_ID,
COUNT( ID ) AS "count"
FROM fact_origin_project_main_daily
WHERE
PROJECT_STATUS = 'closed'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND GRID_ID != ''
GROUP BY GRID_ID ) b
ON a.GRID_ID = b.GRID_ID
</select>
<select id="selectAgencyClosed" resultType="com.epmet.dto.extract.result.OrgStatisticsResultDTO">
SELECT
a.AGENCY_ID AS "orgId",
a.count AS "sum",
IFNULL( b.count, 0 ) AS "count"
FROM
( SELECT
AGENCY_ID,
COUNT( ID ) AS "count"
FROM
fact_origin_project_main_daily
WHERE
CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND AGENCY_ID != ''
GROUP BY AGENCY_ID ) a
LEFT JOIN
( SELECT
AGENCY_ID,
COUNT( ID ) AS "count"
FROM fact_origin_project_main_daily
WHERE
PROJECT_STATUS = 'closed'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
AND AGENCY_ID != ''
GROUP BY AGENCY_ID ) b
ON a.AGENCY_ID = b.AGENCY_ID
</select>
<select id="selectNotReturn" resultType="com.epmet.dto.extract.result.TransferRightRatioResultDTO">

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

@ -203,6 +203,7 @@
center_mark,
party_mark,
level,
code,
area_code,
del_flag,
revision,
@ -231,6 +232,7 @@
center_mark,
party_mark,
level,
code,
area_code,
del_flag,
revision,
@ -502,5 +504,41 @@
del_flag = 0
AND customer_id = #{customerId}
</select>
<select id="getParentAgencyId" resultType="java.lang.String">
SELECT
a.AGENCY_ID
FROM
screen_customer_agency a
INNER JOIN screen_customer_agency b ON a.AREA_CODE = b.PARENT_AREA_CODE
AND b.DEL_FLAG = '0'
AND b.AGENCY_ID = #{agencyId}
WHERE
a.DEL_FLAG = '0'
</select>
<!-- 查询父子客户的组织【平阴】 -->
<select id="selectParentSonAgency" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">
SELECT
AGENCY_ID AS orgId,
PID,
REPLACE(PIDS,',',':') AS pids,
`LEVEL` AS orgType
FROM screen_customer_agency
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID IN
<foreach collection="customerIds" item="c" separator="," open="(" close=")">
#{c}
</foreach>
UNION ALL
SELECT
AGENCY_ID AS orgId,
PID,
REPLACE(PIDS,',',':') AS pids,
CASE WHEN `LEVEL` = 'district' THEN 'street' ELSE `LEVEL` END AS orgType
FROM screen_customer_agency
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND `LEVEL` != 'street'
</select>
</mapper>

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

@ -179,7 +179,8 @@
updated_by,
updated_time,
data_end_time,
all_parent_ids
all_parent_ids,
code
from screen_customer_grid
where DEL_FLAG = 0 and SOURCE_TYPE='internal'
order by CREATED_TIME desc
@ -204,7 +205,8 @@
updated_by,
updated_time,
data_end_time,
all_parent_ids
all_parent_ids,
code
from screen_customer_grid
where DEL_FLAG = 0 and SOURCE_TYPE='internal'
order by UPDATED_TIME desc

30
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryDao.xml

@ -0,0 +1,30 @@
<?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.evaluationindex.screen.ScreenProjectCategoryDao">
<resultMap type="com.epmet.entity.evaluationindex.screen.ScreenProjectCategoryEntity" id="screenProjectCategoryMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="projectId" column="PROJECT_ID"/>
<result property="categoryCode" column="CATEGORY_CODE"/>
<result property="parentCategoryCode" column="PARENT_CATEGORY_CODE"/>
<result property="originCategoryCode" column="ORIGIN_CATEGORY_CODE"/>
<result property="level" column="LEVEL"/>
<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="deleteByProjectIds">
delete from screen_project_category
where CUSTOMER_ID = #{customerId}
<foreach collection="projectIds" item="projectId" open="AND (" close=" )" separator=" OR ">
PROJECT_ID = #{projectId}
</foreach>
</delete>
</mapper>

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

@ -20,6 +20,7 @@
sg.CUSTOMER_ID AS categoryOriginCustomerId,
sg.CATEGORY_CODE,
SUM(sg.PROJECT_TOTAL) AS projectTotal,
SUM(sg.CLOSED_PROJECT_TOTAL) AS closedProjectTotal,
sg.level,
sg.DATE_ID,
sca.`LEVEL` AS orgType

84
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectCategoryOrgDailyDao.xml

@ -32,6 +32,7 @@
sa.CATEGORY_ORIGIN_CUSTOMER_ID,
sa.CATEGORY_CODE,
SUM(sa.PROJECT_TOTAL) AS projectTotal,
SUM(sa.CLOSED_PROJECT_TOTAL) AS closedProjectTotal,
sa.level,
sa.DATE_ID,
sca.`LEVEL` AS orgType
@ -44,7 +45,7 @@
GROUP BY sa.CATEGORY_CODE,sca.AGENCY_ID
</select>
<!-- 查询组织分类信息【多客户】 -->
<!-- 查询组织分类信息【多客户】 父客户存在的分类-->
<select id="selectOrgCategoryMoreCustomerInfo" resultType="com.epmet.dto.screen.result.CategoryProjectResultDTO">
SELECT
od.ORG_ID AS orgId,
@ -52,18 +53,13 @@
IFNULL(sca.PIDS,'0') AS pids,
#{customerId} as customerId,
od.CUSTOMER_ID AS categoryOriginCustomerId,
od.level,
<if test="existsStatus == true">
cd.EPMET_CATEGORY_CODE AS categoryCode,
</if>
<if test="existsStatus == false">
od.CATEGORY_CODE AS categoryCode,
</if>
cd.level,
cd.EPMET_CATEGORY_CODE AS categoryCode,
SUM(od.PROJECT_TOTAL) AS projectTotal,
#{level} as orgType,
od.DATE_ID
FROM screen_project_category_org_daily od
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID)
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = #{customerId})
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.ORG_ID
WHERE 1=1
AND od.DEL_FLAG = '0'
@ -72,13 +68,8 @@
od.CUSTOMER_ID = #{id}
</foreach>
)
<if test="existsStatus == true">
AND cd.EPMET_CATEGORY_CODE IS NOT NULL
AND cd.EPMET_CATEGORY_CODE != ''
</if>
<if test="existsStatus == false">
AND (cd.EPMET_CATEGORY_CODE IS NULL OR cd.EPMET_CATEGORY_CODE = '')
</if>
AND cd.EPMET_CATEGORY_CODE IS NOT NULL
AND cd.EPMET_CATEGORY_CODE != ''
AND od.pid = '0'
AND od.date_id = #{dateId}
GROUP BY categoryCode,od.ORG_ID
@ -163,4 +154,65 @@
GROUP BY od.CATEGORY_CODE,od.pid
</select>
<!-- 查询组织分类信息【多客户】 父客户不存在的分类-->
<select id="selectOrgCategoryMoreCustomerInfoNotExists" resultType="com.epmet.dto.screen.result.CategoryProjectResultDTO">
SELECT
od.ORG_ID AS orgId,
IFNULL(sca.PID,'0') AS pid,
IFNULL(sca.PIDS,'0') AS pids,
#{customerId} as customerId,
od.CUSTOMER_ID AS categoryOriginCustomerId,
od.level,
od.CATEGORY_CODE AS categoryCode,
SUM(od.PROJECT_TOTAL) AS projectTotal,
#{level} as orgType,
od.DATE_ID
FROM screen_project_category_org_daily od
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = od.CATEGORY_CODE AND cd.CUSTOMER_ID = od.CUSTOMER_ID)
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = od.ORG_ID
WHERE 1=1
AND od.DEL_FLAG = '0'
AND (
<foreach collection="customerIds" item="id" separator=" OR ">
od.CUSTOMER_ID = #{id}
</foreach>
)
AND (cd.EPMET_CATEGORY_CODE IS NULL OR cd.EPMET_CATEGORY_CODE = '')
AND od.pid = '0'
AND od.date_id = #{dateId}
GROUP BY categoryCode,od.ORG_ID
</select>
<!-- 查询分类的结案项目数 -->
<select id="selectClosedProjectTotal" resultType="com.epmet.dto.project.result.ClosedProjectTotalResultDTO">
<foreach collection="customerIds" item="customerId" separator=" UNION ALL ">
SELECT
(SELECT AGENCY_ID FROM screen_customer_agency WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} AND PID = '0') AS orgId,
<if test="status == true">
cd.EPMET_CATEGORY_CODE AS categoryCode,
</if>
<if test="status == false">
pd.CATEGORY_CODE AS categoryCode,
</if>
count(pd.project_id) AS closedProjectTotal
FROM screen_project_data pd
LEFT JOIN customer_project_category_dict cd ON (cd.CATEGORY_CODE = pd.CATEGORY_CODE AND cd.CUSTOMER_ID = #{customerId})
LEFT JOIN screen_customer_grid scg ON scg.GRID_ID = pd.ORG_ID
WHERE 1=1
AND pd.DEL_FLAG = '0'
AND pd.CUSTOMER_ID = #{customerId}
<if test="status == true">
AND cd.EPMET_CATEGORY_CODE IS NOT NULL
</if>
<if test="status == false">
AND (cd.EPMET_CATEGORY_CODE IS NULL OR cd.EPMET_CATEGORY_CODE = '')
</if>
AND cd.EPMET_CATEGORY_CODE != ''
AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
AND pd.ALL_PARENT_IDS LIKE CONCAT('%',(SELECT AGENCY_ID FROM screen_customer_agency WHERE DEL_FLAG = 0 AND CUSTOMER_ID = #{customerId} AND PID = '0'),'%')
AND DATE_FORMAT(pd.project_create_time,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
GROUP BY categoryCode
</foreach>
</select>
</mapper>

116
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

@ -269,4 +269,120 @@
ORDER BY
a.CREATED_TIME ASC
</select>
<!-- 查询网格下的项目分类 -->
<select id="selectGridCategoryProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">
SELECT
#{dateId} AS dateId,
#{parentCustomerId} AS customerId,
pc.CATEGORY_CODE,
pd.ORG_ID AS gridId,
pd.PARENT_ID AS pid,
pd.ALL_PARENT_IDS AS pids,
pc.`LEVEL`,
<if test=' status == "closed" '>
COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
</if>
<if test=' status == "all" '>
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if>
FROM screen_project_data pd
inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0'
AND pd.CUSTOMER_ID =#{customerId}
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND pd.ORG_TYPE = 'grid'
AND pc.level = 2
<if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
</if>
GROUP BY pd.ORG_ID,pc.CATEGORY_CODE
UNION ALL
SELECT
#{dateId} AS dateId,
#{parentCustomerId} AS customerId,
left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode,
pd.ORG_ID AS gridId,
pd.PARENT_ID AS pid,
pd.ALL_PARENT_IDS AS pids,
1 AS level,
<if test=' status == "closed" '>
COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
</if>
<if test=' status == "all" '>
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if>
FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0'
AND pd.CUSTOMER_ID = #{customerId}
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND pd.ORG_TYPE = 'grid'
<if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
</if>
GROUP BY pd.ORG_ID,categoryCode
</select>
<!-- 查询组织下的项目分类 -->
<select id="selectOrgCategoryProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">
<foreach collection="allAgencies" item="a" separator=" UNION ALL ">
SELECT
#{dateId} AS dateId,
#{customerId} AS customerId,
pd.customer_id AS categoryOriginCustomerId,
pc.CATEGORY_CODE,
#{a.orgId} AS orgId,
#{a.pid} AS pid,
#{a.pids} AS pids,
#{a.orgType} AS orgType,
pc.`LEVEL`,
<if test=' status == "closed" '>
COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
</if>
<if test=' status == "all" '>
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if>
FROM screen_project_data pd
inner JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0'
AND pc.level = 2
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%')
<if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
</if>
GROUP BY pc.CATEGORY_CODE
</foreach>
</select>
<select id="selectOrgCategoryOneLevelProjectCount" resultType="com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO">
<foreach collection="allAgencies" item="a" separator=" UNION ALL ">
SELECT
#{dateId} AS dateId,
#{customerId} AS customerId,
pd.customer_id AS categoryOriginCustomerId,
left(pc.CATEGORY_CODE, #{subCount}) AS categoryCode,
#{a.orgId} AS orgId,
#{a.pid} AS pid,
#{a.pids} AS pids,
#{a.orgType} AS orgType,
1 AS level,
<if test=' status == "closed" '>
COUNT(DISTINCT pc.PROJECT_ID) AS closedProjectTotal
</if>
<if test=' status == "all" '>
COUNT(DISTINCT pc.PROJECT_ID) AS projectTotal
</if>
FROM screen_project_data pd
INNER JOIN screen_project_category pc ON (pc.PROJECT_ID = pd.PROJECT_ID AND pc.DEL_FLAG = '0' AND pc.CATEGORY_CODE IS NOT NULL)
WHERE pd.DEL_FLAG = '0'
AND DATE_FORMAT(pd.PROJECT_CREATE_TIME,'%Y%m%d') <![CDATA[ <= ]]> #{dateId}
AND ALL_PARENT_IDS LIKE CONCAT('%',#{a.orgId},'%')
<if test=' status == "closed" '>
AND pd.PROJECT_STATUS_CODE IN ('closed','closed_case')
</if>
GROUP BY categoryCode
</foreach>
</select>
</mapper>

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save