From d65cc6cea2d8753f603a358887c04557af2657b8 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 3 Sep 2020 09:56:15 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=A4=96?= =?UTF-8?q?=E9=83=A8=E5=BA=94=E7=94=A8=E7=A7=98=E9=92=A5=E9=87=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commons/tools/exception/EpmetErrorCode.java | 1 + .../com/epmet/dto/form/ExternalAppFormDTO.java | 3 ++- .../epmet/controller/ExternalAppController.java | 17 +++++++++++++++++ .../com/epmet/dao/ExternalAppSecretDao.java | 1 + .../com/epmet/service/ExternalAppService.java | 2 ++ .../service/impl/ExternalAppServiceImpl.java | 9 +++++++++ .../resources/mapper/ExternalAppSecretDao.xml | 7 +++++++ 7 files changed, 39 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java index 24e795fd1a..b16ad96bc0 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/EpmetErrorCode.java @@ -102,6 +102,7 @@ public enum EpmetErrorCode { OPER_EXTERNAL_APP_AUTH_ERROR(8709, "外部应用认证失败"), OPER_EXTERNAL_CUSTOMER_NOT_EXISTS(8710, "该客户不存在"), OPER_EXTERNAL_APP_EXISTS(8711, "应用已存在"), + OPER_EXT_APP_SECRET_RESET_FAIL(8712, "秘钥更新失败"), // 党建声音 前端提示 88段 DRAFT_CONTENT_IS_NULL(8801, "至少需要添加一个段落"), diff --git a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java index 36a504a135..00b99a500e 100644 --- a/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java +++ b/epmet-module/epmet-common-service/common-service-client/src/main/java/com/epmet/dto/form/ExternalAppFormDTO.java @@ -9,8 +9,9 @@ public class ExternalAppFormDTO { public interface AddExternalApp {} public interface UpdateExternalApp {} + public interface UpdateAppSecret {} - @NotBlank(message = "缺少应用ID", groups = { UpdateExternalApp.class }) + @NotBlank(message = "缺少应用ID", groups = { UpdateExternalApp.class, UpdateAppSecret.class }) private String appId; @NotBlank(message = "缺少应用名称", groups = { AddExternalApp.class, UpdateExternalApp.class }) diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java index 50e9a7b891..45bdb8bef6 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/controller/ExternalAppController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.utils.Result; @@ -97,4 +98,20 @@ public class ExternalAppController { return new Result>().ok(page); } + /** + * 重置应用秘钥 + * @param formDTO + * @return + */ + @PostMapping("/resetsecret") + public Result resetSecret(@RequestBody ExternalAppFormDTO formDTO) { + ValidatorUtils.validateEntity(formDTO, ExternalAppFormDTO.UpdateAppSecret.class); + String newSecret = externalAppService.resetSecret(formDTO.getAppId()); + if (StringUtils.isBlank(newSecret)) { + return new Result().error(EpmetErrorCode.OPER_EXT_APP_SECRET_RESET_FAIL.getCode(), + EpmetErrorCode.OPER_EXT_APP_SECRET_RESET_FAIL.getMsg()); + } + return new Result().ok(newSecret); + } + } diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java index f56aa08cb0..fd2342c7c6 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/dao/ExternalAppSecretDao.java @@ -40,4 +40,5 @@ public interface ExternalAppSecretDao extends BaseDao { */ ExternalAppSecretEntity getSecretsByAppId(@Param("appId") String appId); + int updateSecret(@Param("appId") String appId, @Param("secret") String secret); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java index dff718695f..8f38fa2a83 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/ExternalAppService.java @@ -32,4 +32,6 @@ public interface ExternalAppService { ExternalAppResultDTO updateById(String appId, String appName, String customerId); PageData listPage(Integer pageNo, Integer pageSize, String customerId); + + String resetSecret(String appId); } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java index 5f92de268e..dcfc930aad 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java +++ b/epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/service/impl/ExternalAppServiceImpl.java @@ -130,4 +130,13 @@ public class ExternalAppServiceImpl implements ExternalAppService { return new PageData<>(list, pageInfo.getTotal()); } + @Override + public String resetSecret(String appId) { + String secret = genSecret(); + if (externalAppSecretDao.updateSecret(appId, secret) > 0) { + return secret; + } + return null; + } + } \ No newline at end of file diff --git a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml index e207a36013..995dbd0270 100644 --- a/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml +++ b/epmet-module/epmet-common-service/common-service-server/src/main/resources/mapper/ExternalAppSecretDao.xml @@ -15,6 +15,13 @@ + + + update external_app_secret + set SECRET=#{secret} + where ID = #{appId} + + select CUSTOMER_ID,AGENCY_ID,GRID_ID,YEAR_ID,MONTH_ID,USER_ID,SCORE,INDEX_CODE FROM fact_index_cpc_score From e65c6581ed610705d0280a678efdbb9b5c4a3143 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 3 Sep 2020 23:53:02 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E7=9A=84=E5=BA=94=E7=94=A8=E5=90=AF=E5=8A=A8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../aspect/CustomerApplicationRunner.java | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java new file mode 100644 index 0000000000..0b708b57c7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.commons.tools.aspect; + +import com.epmet.commons.tools.dto.form.DingTalkTextMsg; +import com.epmet.commons.tools.enums.EnvEnum; +import com.epmet.commons.tools.utils.HttpClientManager; +import com.epmet.commons.tools.utils.Result; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +/** + * 应用 启动健康检查 通知类 + * CustomerApplicationRunner + * + * @author Mark sunlightcs@gmail.com + * @since 1.0.0 + */ +@Component +@Order(value = 99) +public class CustomerApplicationRunner implements ApplicationRunner { + private static Logger logger = LogManager.getLogger(CustomerApplicationRunner.class); + @Value("${spring.application.name}") + private String appName; + + @Override + public void run(ApplicationArguments args) { + //发送启动成功消息 + EnvEnum currentEnv = EnvEnum.getCurrentEnv(); + if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode())) { + //开发小组 群机器人地址 + String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"; + StringBuilder stringBuilder = new StringBuilder(EnvEnum.getCurrentEnv().getName()); + stringBuilder.append(" 应用:【") + .append(appName) + .append("】 ") + .append("started!"); + DingTalkTextMsg msg = new DingTalkTextMsg(); + msg.setWebHook(url); + msg.setAtAll(true); + msg.setContent(stringBuilder.toString()); + Result stringResult = HttpClientManager.getInstance().sendPostByJSON(url, msg.getMsgContent()); + logger.info(stringResult); + } + } + +} From e073922dc15986e7a18a74c3dd835a563d8ec539 Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 4 Sep 2020 00:06:04 +0800 Subject: [PATCH 04/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=9F=E4=B8=80?= =?UTF-8?q?=E7=9A=84=E5=BA=94=E7=94=A8=E5=90=AF=E5=8A=A8=E6=A3=80=E6=9F=A5?= =?UTF-8?q?=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/aspect/CustomerApplicationRunner.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java index 0b708b57c7..b1bfe5d08e 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/CustomerApplicationRunner.java @@ -12,11 +12,13 @@ import com.epmet.commons.tools.dto.form.DingTalkTextMsg; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.utils.SpringContextUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; +import org.springframework.cloud.commons.util.InetUtils; import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; @@ -39,13 +41,19 @@ public class CustomerApplicationRunner implements ApplicationRunner { //发送启动成功消息 EnvEnum currentEnv = EnvEnum.getCurrentEnv(); if (!EnvEnum.DEV.getCode().equals(currentEnv.getCode())) { + InetUtils inetUtils = SpringContextUtils.getBean(InetUtils.class); + String serverIp = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress(); + //开发小组 群机器人地址 String url = "https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"; - StringBuilder stringBuilder = new StringBuilder(EnvEnum.getCurrentEnv().getName()); - stringBuilder.append(" 应用:【") + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append(EnvEnum.getCurrentEnv().getName()) + .append("【") .append(appName) - .append("】 ") - .append("started!"); + .append("】") + .append("ip地址: ") + .append(serverIp) + .append("部署完毕!"); DingTalkTextMsg msg = new DingTalkTextMsg(); msg.setWebHook(url); msg.setAtAll(true); From 95d8c395cb3e5ebe8aa4f230c2d0e9af2bd55a76 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 4 Sep 2020 09:37:37 +0800 Subject: [PATCH 05/13] =?UTF-8?q?Merge=20branch=20'dev=5Fscreen=5Fdata'=20?= =?UTF-8?q?of=20C:\Users\Administrator\Desktop\=E5=85=9A=E7=BE=A4e?= =?UTF-8?q?=E4=BA=8B=E9=80=9A=E5=90=8E=E7=AB=AF=20with=20conflicts.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 4 +- .../dto/screen/FactIndexGridScoreDTO.java | 18 +- .../data-statistical-server/pom.xml | 4 +- .../com/epmet/constant/OrgTypeConstant.java | 33 ++ .../FactIndexCollectController.java | 24 +- .../indexcal/AgencyScoreDao.java | 13 +- .../indexcal/DeptScoreDao.java | 18 +- .../screen/FactIndexCommunityScoreDao.java | 13 +- .../screen/FactIndexGridScoreDao.java | 32 +- .../screen/ScreenCustomerAgencyDao.java | 11 + .../screen/ScreenCustomerDeptDao.java | 10 + .../screen/ScreenCustomerGridDao.java | 10 + .../indexcoll/FactIndexCollectService.java | 10 + .../impl/FactIndexCollectServiceImpl.java | 332 ++++++++++++++++++ .../indexcal/AgencyScoreDao.xml | 21 +- .../evaluationindex/indexcal/DeptScoreDao.xml | 20 +- .../screen/FactIndexCommunityScoreDao.xml | 20 +- .../screen/FactIndexGridScoreDao.xml | 21 +- .../screen/ScreenCustomerAgencyDao.xml | 10 + .../screen/ScreenCustomerDeptDao.xml | 11 + .../screen/ScreenCustomerGridDao.xml | 12 + 21 files changed, 619 insertions(+), 28 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 66279bb8ad..796a1e9880 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -181,8 +181,8 @@ lb://data-report-server - lb://data-statistical-server - + + http://localhost:8108 lb://epmet-openapi-scan diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java index 6590da34cb..4d26f40f48 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java @@ -60,24 +60,24 @@ public class FactIndexGridScoreDTO implements Serializable { private String monthId; /** - * 总指数分值 + * 年维度Id: yyyy */ - private BigDecimal totalScore; + private String yearId; /** - * 党建能力分值 + * 1:总分;0不是;默认0 */ - private BigDecimal partyAblityScore; + private String isTotal; /** - * 治理能力分值 + * 分值 */ - private BigDecimal govrnAblityScore; + private BigDecimal score; /** - * 服务能力分值 + * 党建能力:dangjiannengli;治理能力:zhilinengli;服务能力:fuwunengli;网格相关(前三者之和):wanggexiangguan */ - private BigDecimal serviceAblityScore; + private String indexCode; /** * 删除标识 0未删除;1已删除 @@ -109,4 +109,4 @@ public class FactIndexGridScoreDTO implements Serializable { */ private Date updatedTime; -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 8a76d00116..3746a65446 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -201,7 +201,7 @@ 6379 123456 - true + false 192.168.1.130:8848 6ceab336-d004-4acf-89c6-e121d06f4988 @@ -416,4 +416,4 @@ - \ No newline at end of file + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java new file mode 100644 index 0000000000..95919792d9 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java @@ -0,0 +1,33 @@ +/** + * Copyright (c) 2018 人人开源 All rights reserved. + *

+ * https://www.renren.io + *

+ * 版权所有,侵权必究! + */ + +package com.epmet.constant; + +/** + * 组织类别 常量 + * + * @author sun + * @since 1.0.0 + */ +public interface OrgTypeConstant { + + /** + * 部门 + */ + String DEPARTMENT = "department"; + + /** + * 网格 + */ + String GRID = "grid"; + + /** + * 组织 + */ + String AGENCY = "agency"; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java index eaa7c921b1..21a81701ac 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java @@ -4,12 +4,10 @@ import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth; import com.epmet.commons.extappauth.bean.ExternalAppRequestParam; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.indexcollect.form.*; +import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import org.springframework.beans.factory.annotation.Autowired; -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.List; @@ -153,4 +151,22 @@ public class FactIndexCollectController { factIndexCollectService.insertDeptGovrnAbility(formDTO, externalAppRequestParam.getCustomerId()); return new Result(); } + + public static void main(String[] args) { + String a = "202009"; + System.out.println(a.substring(0,4)); + System.out.println(a.substring(4,6)); + + int[] aa = new int[2]; + System.out.println(aa[0]); + System.out.println(aa == null); + IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); + System.out.println(monthlyFormDTO.getIndexTotal()); + } + + @GetMapping("hahaha") + public Result hahaha(String monthId, String customerId) { + factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(monthId, customerId); + return new Result(); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java index 5c6a90ad02..219d617a0d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java @@ -27,7 +27,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 区/街道相关分数表 + * 区/街道相关分数表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-09-02 @@ -62,4 +62,13 @@ public interface AgencyScoreDao extends BaseDao { */ List selectStreetInfo(@Param("customerId") String customerId, @Param("monthId")String monthId,@Param("dataType")String dataType); -} \ No newline at end of file + /** + * 根据入参查询 区/街道相关分数表 记录 + * @param customerId + * @param monthId + * @return java.util.List + * @Author zhangyong + * @Date 10:43 2020-09-03 + **/ + List selectListAgencyScore(@Param("customerId")String customerId, @Param("monthId")String monthId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java index 4f670bbfe2..0718e44771 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java @@ -18,8 +18,12 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcal.DeptScoreDTO; import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 区直部门分值表 @@ -29,5 +33,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface DeptScoreDao extends BaseDao { - -} \ No newline at end of file + + /** + * 根据入参查询 区直部门分值表 记录 + * @param customerId + * @param monthId + * @return java.util.List + * @Author zhangyong + * @Date 10:43 2020-09-03 + **/ + List selectListDeptScore(@Param("customerId")String customerId, @Param("monthId")String monthId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java index 1df4f962b5..a6060a2bf7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java @@ -29,7 +29,7 @@ import org.apache.ibatis.annotations.Param; import java.util.List; /** - * 社区相关分数表 + * 社区相关分数表 * * @author generator generator@elink-cn.com * @since v1.0.0 2020-08-31 @@ -64,6 +64,15 @@ public interface FactIndexCommunityScoreDao extends BaseDao selectCommunityInfo(@Param("customerId") String customerId,@Param("monthId")String monthId); + /** + * 根据入参查询 查询社区相关信息 + * @param customerId + * @param monthId + * @return java.util.List + * @Author zhangyong + * @Date 10:43 2020-09-03 + **/ + List selectListCommunityScore(@Param("customerId")String customerId, @Param("monthId")String monthId); /** * @Description 街道下级所有社区得分平均值 * @param customerId @@ -73,4 +82,4 @@ public interface FactIndexCommunityScoreDao extends BaseDao selectSubCommAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java index b1271f13f1..1736cb88fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screen.FactIndexGridScoreDTO; import com.epmet.dto.screen.result.SubGridGovernAvgResultDTO; import com.epmet.dto.screen.result.SubGridAvgResultDTO; import com.epmet.dto.screen.result.SubGridServiceAvgResultDTO; @@ -44,4 +45,33 @@ public interface FactIndexGridScoreDao extends BaseDao * @date 2020/8/28 3:20 下午 */ List selectSubGridAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); -} \ No newline at end of file + List selectSubGridPartyAvgScore(@Param("customerId")String customerId,@Param("monthId")String monthId); + + /** + * @Description 社区下属所有网格治理能力汇总平均值 + * @param customerId + * @param monthId + * @author zxc + * @date 2020/8/31 9:19 上午 + */ + List selectSubGridGovernAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId); + + /** + * @Description 社区下级所有网格服务能力得分平均值 + * @param customerId + * @param monthId + * @author zxc + * @date 2020/8/31 1:51 下午 + */ + List selectSubGridServiceAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId); + + /** + * 根据入参查询 网格相关分值记录 + * @param customerId + * @param monthId + * @return java.util.List + * @Author zhangyong + * @Date 10:43 2020-09-03 + **/ + List selectListGridScore(@Param("customerId")String customerId, @Param("monthId")String monthId); +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index f0d189f7ea..20147e0f82 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -55,4 +55,15 @@ public interface ScreenCustomerAgencyDao extends BaseDao list, @Param("customerId")String customerId); + + /** + * 根据客户id、组织id,查询区/街道 组织名称 + * + * @param customerId 客户id + * @param agencyId 组织id + * @return java.util.String + * @Author zhangyong + * @Date 16:57 2020-09-03 + **/ + String selectParentAgencyInfo(@Param("customerId")String customerId, @Param("agencyId")String agencyId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java index aedd720c25..7cfb17110c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java @@ -58,6 +58,16 @@ public interface ScreenCustomerDeptDao extends BaseDao **/ void batchInsertCustomerDept(@Param("list") List list, @Param("customerId")String customerId); + /** + * 根据客户id、部门id,查询部门父级 信息 + * @param customerId 客户id + * @param deptId 部门id + * @return com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity + * @Author zhangyong + * @Date 16:57 2020-09-03 + **/ + ScreenCustomerDeptEntity selectParentDeptInfo(@Param("customerId")String customerId, @Param("deptId")String deptId); + /** * @param customerId * @param deptId diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java index 4254712cbf..0d9a6420f9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java @@ -94,4 +94,14 @@ public interface ScreenCustomerGridDao extends BaseDao * @Date 2020/8/31 12:35 **/ ScreenCustomerGridDTO selectParentAgencyId(@Param("customerId") String customerId, @Param("gridId") String gridId); + + /** + * 根据客户id、网格id,查询网格(党支部)父级信息 + * @param customerId + * @param gridId + * @return com.epmet.dto.screen.FactIndexGridScoreDTO + * @Author zhangyong + * @Date 16:57 2020-09-03 + **/ + ScreenCustomerGridDTO selectParentGridInfo(@Param("customerId")String customerId, @Param("gridId")String gridId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java index 3e29d51f57..8f6197ffcd 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java @@ -107,4 +107,14 @@ public interface FactIndexCollectService { * @Date 10:52 2020-08-20 **/ void insertDeptGovrnAbility(List formDTO, String customerId); + + /** + * 将网格、社区、区直部门、区/街道分支记录表中的数据,抽取到 指数-指数数据(每月数值) 指数-指数数据(按年统计) + * @param monthId 2020-8 + * @param customerId + * @return void + * @Author zhangyong + * @Date 10:29 2020-09-03 + **/ + void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index e8ec5f9342..26c725cf4d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -3,14 +3,31 @@ package com.epmet.service.evaluationindex.indexcoll.impl; import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.OrgTypeConstant; +import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao; +import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; import com.epmet.dao.evaluationindex.indexcoll.*; +import com.epmet.dao.evaluationindex.screen.*; +import com.epmet.dto.ScreenCustomerGridDTO; +import com.epmet.dto.indexcal.AgencyScoreDTO; +import com.epmet.dto.indexcal.DeptScoreDTO; import com.epmet.dto.indexcollect.form.*; +import com.epmet.dto.screen.FactIndexCommunityScoreDTO; +import com.epmet.dto.screen.FactIndexGridScoreDTO; +import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO; +import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; +import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity; +import com.epmet.eum.IndexCodeEnum; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; +import java.util.ArrayList; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; /** * @Auther: zhangyong @@ -36,6 +53,24 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { private FactIndexGovrnAblityOrgMonthlyDao factIndexGovrnAblityOrgMonthlyDao; @Autowired private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao; + @Autowired + private FactIndexGridScoreDao factIndexGridScoreDao; + @Autowired + private FactIndexCommunityScoreDao factIndexCommunityScoreDao; + @Autowired + private DeptScoreDao deptScoreDao; + @Autowired + private AgencyScoreDao agencyScoreDaol; + @Autowired + private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao; + @Autowired + private ScreenIndexDataYearlyDao screenIndexDataYearlyDao; + @Autowired + private ScreenCustomerGridDao screenCustomerGridDao; + @Autowired + private ScreenCustomerDeptDao screenCustomerDeptDao; + @Autowired + private ScreenCustomerAgencyDao screenCustomerAgencyDao; @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @@ -160,4 +195,301 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(formDTO, customerId); } } + + @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) + @Override + @Transactional(rollbackFor = Exception.class) + public void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId) { + if (NumConstant.SIX != monthId.length()){ + throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId); + } + String year = monthId.substring(NumConstant.ZERO, NumConstant.FOUR); + String month = monthId.substring(NumConstant.FOUR, NumConstant.SIX); + + // fact_index_grid_score 网格相关分值记录表 grid + List gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId); + if (null != gridScoreDTOS && gridScoreDTOS.size() > NumConstant.ZERO){ + this.insertIndexDataMonthlyByGridScore(month, year, customerId, gridScoreDTOS); + } + + // fact_index_community_score 社区相关分数表 agency + List communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId); + if (null != communityScoreDTOS && communityScoreDTOS.size() > NumConstant.ZERO){ + this.insertIndexDataMonthlyByCommunityScore(month, year, customerId, communityScoreDTOS); + } + + // fact_index_dept_score 区直部门分值表 department + List deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId); + if (null != deptScoreDTOS && deptScoreDTOS.size() > NumConstant.ZERO){ + this.insertIndexDataMonthlyByDeptScore(month, year, customerId, deptScoreDTOS); + } + + // fact_index_agency_score 区/街道相关分数表 agency + List agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId); + if (null != agencyScoreDTOS && agencyScoreDTOS.size() > NumConstant.ZERO) { + this.insertIndexDataMonthlyByAgencyScore(month, year, customerId, agencyScoreDTOS); + } + + // 插入年表 screen_index_data_yearly + } + + /** + * 将网格相关分值记录表 数据 插入月表 screenIndexDataMonthlyDao + * + * @param month 08 + * @param year 2020 + * @param customerId 客户id + * @param gridScoreDTOS 网格相关分值记录表 当前客户所属月份数据集 + * @return void + * @Author zhangyong + * @Date 14:17 2020-09-03 + **/ + private void insertIndexDataMonthlyByGridScore(String month, String year, String customerId, List gridScoreDTOS){ + List monthlyFormDTOList = new ArrayList<>(); + // 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据 + Map> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId)); + String[] orgIds = new String[collect.size()]; + int j = 0; + for(Map.Entry> gridScore : collect.entrySet()){ + IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); + // 网格id + orgIds[j] = gridScore.getKey(); + j++; + for ( int i = 0; i < gridScore.getValue().size(); i++){ + if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())){ + // 是总分 + if (IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode().equals(gridScore.getValue().get(i).getIndexCode())){ + // 总指数 = 网格相关 + monthlyFormDTO.setIndexTotal(gridScore.getValue().get(i).getScore()); + } + } else { + // 赋值 党建能力、治理能力、服务能力 + monthlyFormDTO = this.setValueAblityMonthlyFor(gridScore.getValue().get(i).getIndexCode(), + gridScore.getValue().get(i).getScore(), + monthlyFormDTO); + } + } + // 查询网格的 上级组织id 和 组织名称 + ScreenCustomerGridDTO parentGridInfo = screenCustomerGridDao.selectParentGridInfo(customerId, gridScore.getKey()); + if (null == parentGridInfo){ + throw new RuntimeException("在screen_customer_grid表中未查询到该客户下的网格信息:customerId =" + customerId + ", gridId = " + gridScore.getKey()); + } + // 补充表中其他字段 + monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, gridScore.getKey(), + parentGridInfo.getParentAgencyId(), parentGridInfo.getGridName(), monthlyFormDTO); + monthlyFormDTOList.add(monthlyFormDTO); + } + screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); + screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); + } + + /** + * 社区相关分数表 数据 插入月表 screenIndexDataMonthlyDao + * + * @param month 08 + * @param year 2020 + * @param customerId 客户id + * @param communityScoreDTOS 社区相关分数表 当前客户所属月份数据集 + * @return void + * @Author zhangyong + * @Date 14:17 2020-09-03 + **/ + private void insertIndexDataMonthlyByCommunityScore(String month, String year, String customerId, List communityScoreDTOS){ + List monthlyFormDTOList = new ArrayList<>(); + // 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据 + Map> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId)); + String[] orgIds = new String[collect.size()]; + int j = 0; + for(Map.Entry> communityScore : collect.entrySet()){ + IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); + // 组织id + orgIds[j] = communityScore.getKey(); + j++; + for ( int i = 0; i < communityScore.getValue().size(); i++){ + if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())){ + // 是总分 + if (IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode().equals(communityScore.getValue().get(i).getIndexCode())){ + // 总指数 = 社区相关 + monthlyFormDTO.setIndexTotal(communityScore.getValue().get(i).getScore()); + } + } else { + // 赋值 党建能力、治理能力、服务能力 + monthlyFormDTO = this.setValueAblityMonthlyFor(communityScore.getValue().get(i).getIndexCode(), + communityScore.getValue().get(i).getScore(), + monthlyFormDTO); + } + } + + // 当前组织 的上级组织id + String parentAgencyId = communityScore.getValue().get(NumConstant.ZERO).getParentAgencyId(); + // 查询 组织名称 + String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, communityScore.getKey()); + if (null == agencyName){ + throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + communityScore.getKey()); + } + // 补充表中其他字段 + monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, communityScore.getKey(), + parentAgencyId, agencyName, monthlyFormDTO); + // 补充表中其他字段 + monthlyFormDTOList.add(monthlyFormDTO); + } + screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); + screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); + } + + /** + * 将区直部门分值表 数据 插入月表 screenIndexDataMonthlyDao + * + * @param month 08 + * @param year 2020 + * @param customerId 客户id + * @param deptScoreDTOS 区直部门分值表 当前客户所属月份数据集 + * @return void + * @Author zhangyong + * @Date 14:17 2020-09-03 + **/ + private void insertIndexDataMonthlyByDeptScore(String month, String year, String customerId, List deptScoreDTOS){ + List monthlyFormDTOList = new ArrayList<>(); + // 根据部门id 进行分组,最后组装一条数据 一个部门id 对应 4条数据 + Map> collect = deptScoreDTOS.stream().collect(Collectors.groupingBy(DeptScoreDTO::getDeptId)); + String[] orgIds = new String[collect.size()]; + int j = 0; + for(Map.Entry> deptScore : collect.entrySet()){ + IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); + // 部门id + orgIds[j] = deptScore.getKey(); + j++; + for ( int i = 0; i < deptScore.getValue().size(); i++){ + if (NumConstant.ONE_STR.equals(deptScore.getValue().get(i).getIsTotal())){ + // 是总分 总指数 = IS_TOTAL = 1 + monthlyFormDTO.setIndexTotal(deptScore.getValue().get(i).getScore()); + } else { + // 赋值 党建能力、治理能力、服务能力 + monthlyFormDTO = this.setValueAblityMonthlyFor(deptScore.getValue().get(i).getIndexCode(), + deptScore.getValue().get(i).getScore(), + monthlyFormDTO); + } + } + // 查询网格的 上级组织id 和 组织名称 + ScreenCustomerDeptEntity parentDeptInfo = screenCustomerDeptDao.selectParentDeptInfo(customerId, deptScore.getKey()); + if (null == parentDeptInfo){ + throw new RuntimeException("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey()); + } + // 补充表中其他字段 + monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, deptScore.getKey(), + parentDeptInfo.getParentAgencyId(), parentDeptInfo.getDeptName(), monthlyFormDTO); + monthlyFormDTOList.add(monthlyFormDTO); + } + screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); + screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); + } + + /** + * 将区/街道相关分数表 数据 插入月表 screenIndexDataMonthlyDao + * + * @param month 08 + * @param year 2020 + * @param customerId 客户id + * @param agencyScoreDTOS 区/街道相关分数表 当前客户所属月份数据集 + * @return void + * @Author zhangyong + * @Date 14:17 2020-09-03 + **/ + private void insertIndexDataMonthlyByAgencyScore(String month, String year, String customerId, List agencyScoreDTOS){ + List monthlyFormDTOList = new ArrayList<>(); + // 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据 + Map> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId)); + String[] orgIds = new String[collect.size()]; + int j = 0; + for(Map.Entry> agencyScore : collect.entrySet()){ + IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); + // 组织id(eg:社区或者街道id) + orgIds[j] = agencyScore.getKey(); + j++; + for ( int i = 0; i < agencyScore.getValue().size(); i++){ + if (NumConstant.ONE_STR.equals(agencyScore.getValue().get(i).getIsTotal())){ + // 是总分 总指数 = IS_TOTAL = 1 + monthlyFormDTO.setIndexTotal(agencyScore.getValue().get(i).getScore()); + } else { + // 赋值 党建能力、治理能力、服务能力 + monthlyFormDTO = this.setValueAblityMonthlyFor(agencyScore.getValue().get(i).getIndexCode(), + agencyScore.getValue().get(i).getScore(), + monthlyFormDTO); + } + } + // 当前组织 的上级组织id + String parentAgencyId = agencyScore.getValue().get(NumConstant.ZERO).getParentAgencyId(); + // 查询 组织名称 + String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, agencyScore.getKey()); + if (null == agencyName){ + throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey()); + } + // 补充表中其他字段 + monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, agencyScore.getKey(), + parentAgencyId, agencyName, monthlyFormDTO); + monthlyFormDTOList.add(monthlyFormDTO); + } + screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds); + screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId); + } + + /** + * 指数-指数数据(每月数值) 表 字段补全,待新增 + * @param year 2020 + * @param month 08 + * @param orgType 组织类别 agency:组织;部门:department;网格:grid + * @param orgId 组织Id 可以为网格,机关id + * @param parentId 上级组织id + * @param orgName 组织名称 + * @param monthlyFormDTO 待新增的DTO + * @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO + * @Author zhangyong + * @Date 15:29 2020-09-03 + **/ + private IndexDataMonthlyFormDTO supplementIndexDataMonthlyTable(String year, String month, String orgType, String orgId, String parentId, + String orgName, IndexDataMonthlyFormDTO monthlyFormDTO){ + monthlyFormDTO.setYearId(year); + monthlyFormDTO.setMonthId(year + month); + monthlyFormDTO.setOrgType(orgType); + monthlyFormDTO.setOrgId(orgId); + // 根据网格id,查询其上级组织id、组织名称 + monthlyFormDTO.setParentId(parentId); + monthlyFormDTO.setOrgName(orgName); + return monthlyFormDTO; + } + + /** + * 赋值 党建能力、治理能力、服务能力 + * (总指数 赋默认值) + * @param IndexCode 组织类别 + * @param Score 分数 + * @param monthlyFormDTO 待保存的数据 + * @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO + * @Author zhangyong + * @Date 09:26 2020-09-04 + **/ + private IndexDataMonthlyFormDTO setValueAblityMonthlyFor(String IndexCode, BigDecimal Score, + IndexDataMonthlyFormDTO monthlyFormDTO){ + // 赋默认值 + if (null == monthlyFormDTO.getIndexTotal() && null == monthlyFormDTO.getPartyDevAblity() + && null == monthlyFormDTO.getGovernAblity() && null == monthlyFormDTO.getServiceAblity()){ + BigDecimal zero = new BigDecimal(NumConstant.ZERO); + monthlyFormDTO.setIndexTotal(zero); + monthlyFormDTO.setPartyDevAblity(zero); + monthlyFormDTO.setGovernAblity(zero); + monthlyFormDTO.setServiceAblity(zero); + } + // 赋实际值 + if (IndexCodeEnum.DANG_JIAN_NENG_LI.getCode().equals(IndexCode)){ + // 党建能力 + monthlyFormDTO.setPartyDevAblity(Score); + } else if (IndexCodeEnum.ZHI_LI_NENG_LI.getCode().equals(IndexCode)){ + // 治理能力 + monthlyFormDTO.setGovernAblity(Score); + } else if (IndexCodeEnum.FU_WU_NENG_LI.getCode().equals(IndexCode)){ + // 服务能力 + monthlyFormDTO.setServiceAblity(Score); + } + return monthlyFormDTO; + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index cd0c93b654..b472801ad9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -43,6 +43,25 @@ AND data_type = #{dataType} + + - \ No newline at end of file + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml index a5a7972279..a528c94f95 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml @@ -3,4 +3,22 @@ - \ No newline at end of file + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml index c3da270827..07e3b05b94 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml @@ -84,4 +84,22 @@ GROUP BY fics.agency_id - \ No newline at end of file + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml index 9d2176f678..b6eed400a2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml @@ -24,4 +24,23 @@ AND figc.index_code = #{indexCode} GROUP BY figc.agency_id - \ No newline at end of file + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 4d16660ed3..dda779d7b9 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -60,4 +60,14 @@ + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml index d014071995..8937212e71 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml @@ -64,4 +64,15 @@ AND m.CUSTOMER_ID =#{customerId} AND m.DEPT_ID =#{deptId} + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml index fdb4f2407c..7a8c216fea 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml @@ -105,4 +105,16 @@ AND m.CUSTOMER_ID =#{customerId} AND m.GRID_ID = #{gridId} + + From 6847c957e2a403525c39c8dac0791092494f75e7 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 4 Sep 2020 09:46:54 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-gateway/pom.xml | 4 ++-- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- .../dao/evaluationindex/screen/FactIndexGridScoreDao.java | 1 - 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/epmet-gateway/pom.xml b/epmet-gateway/pom.xml index 796a1e9880..97fd3b3851 100644 --- a/epmet-gateway/pom.xml +++ b/epmet-gateway/pom.xml @@ -181,8 +181,8 @@ lb://data-report-server - - http://localhost:8108 + lb://data-statistical-server + lb://epmet-openapi-scan diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 3746a65446..8a32ee8d75 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -201,7 +201,7 @@ 6379 123456 - false + true 192.168.1.130:8848 6ceab336-d004-4acf-89c6-e121d06f4988 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java index 1736cb88fe..8a8a1f8a38 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java @@ -45,7 +45,6 @@ public interface FactIndexGridScoreDao extends BaseDao * @date 2020/8/28 3:20 下午 */ List selectSubGridAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); - List selectSubGridPartyAvgScore(@Param("customerId")String customerId,@Param("monthId")String monthId); /** * @Description 社区下属所有网格治理能力汇总平均值 From f7282c4f00af6686f55cf8f4e0d61bb1089ce831 Mon Sep 17 00:00:00 2001 From: zhangyongzhangyong <2012005003@qq.coom> Date: Fri, 4 Sep 2020 09:49:57 +0800 Subject: [PATCH 07/13] =?UTF-8?q?control=E4=BB=A3=E7=A0=81=E6=81=A2?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/FactIndexCollectController.java | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java index 21a81701ac..82966dbe82 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java @@ -151,22 +151,4 @@ public class FactIndexCollectController { factIndexCollectService.insertDeptGovrnAbility(formDTO, externalAppRequestParam.getCustomerId()); return new Result(); } - - public static void main(String[] args) { - String a = "202009"; - System.out.println(a.substring(0,4)); - System.out.println(a.substring(4,6)); - - int[] aa = new int[2]; - System.out.println(aa[0]); - System.out.println(aa == null); - IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO(); - System.out.println(monthlyFormDTO.getIndexTotal()); - } - - @GetMapping("hahaha") - public Result hahaha(String monthId, String customerId) { - factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(monthId, customerId); - return new Result(); - } } From 8d0e923f77f9cf02a6c4db1dc58c68d9c594f4b7 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 4 Sep 2020 10:41:38 +0800 Subject: [PATCH 08/13] =?UTF-8?q?getAgencyListByCustomerId=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E6=95=B0=E6=8D=AE=E6=BA=90=E6=94=B9=E5=9B=9E=E5=8E=9F?= =?UTF-8?q?=E6=9D=A5=E7=9A=84=20STATS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java index 7f21b81ee0..d24fec3ee8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimAgencyServiceImpl.java @@ -210,7 +210,7 @@ public class DimAgencyServiceImpl extends BaseServiceImpl getAgencyListByCustomerId(String customerId) { if (StringUtils.isBlank(customerId)){ From 281b69b4f29096b364d35ecd2da7218bea1bf35f Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Fri, 4 Sep 2020 15:10:58 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E5=85=A8=E5=8C=BA=E7=9B=B8=E5=85=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/constant/IndexCalConstant.java | 4 + .../indexcal/SubAgencyScoreAvgResultDTO.java | 51 +++ .../com/epmet/controller/DemoController.java | 14 +- .../indexcal/AgencyScoreDao.java | 16 +- .../indexcal/DeptScoreDao.java | 12 + .../FactIndexGovrnAblityDeptMonthlyDao.java | 1 + .../java/com/epmet/eum/IndexCodeEnum.java | 4 + .../IndexCalculateDistrictService.java | 18 + .../IndexCalculateDistrictServiceImpl.java | 406 ++++++++++++++++++ .../impl/IndexCalculateStreetServiceImpl.java | 2 +- .../indexcal/AgencyScoreDao.xml | 21 +- .../evaluationindex/indexcal/DeptScoreDao.xml | 22 + 12 files changed, 562 insertions(+), 9 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubAgencyScoreAvgResultDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateDistrictService.java create mode 100644 epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java index bc7295ccda..f02185071f 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/IndexCalConstant.java @@ -31,6 +31,8 @@ public interface IndexCalConstant { String STREET_LEVEL = "street"; + String DISTRICT_LEVEL = "district"; + String COMMUNITY_RELATE = "shequxiangguan"; @@ -55,7 +57,9 @@ public interface IndexCalConstant { String INDEX_DETAIL_LIST_NULL = "指标明细查询集合为空"; String COMMUNITY_PARTY_AVG_NULL = "查询下属所有【社区】的党建能力平均值集合为空"; String GRID_PARTY_AVG_NULL = "查询下属所有【网格】的党建能力平均值集合为空"; + String DISTRICT_PARTY_AVG_NULL = "查询【区县】的党建能力平均值集合为空"; String STREET_PUBLISH_ARTICLE_LIST_NULL = "查询【街道】名义发文数量集合为空"; + String DISTRICT_PUBLISH_ARTICLE_LIST_NULL = "查询【区/县】名义发文数量集合为空"; String COMMUNITY_PUBLISH_ARTICLE_LIST_NULL = "查询【社区】名义发文数量集合为空"; String INDEX_CODE_NULL = "指标Code未查询出对应字段 【 %s 】"; String STREET_GOVERN_ABILITY_NULL = "查询【街道】治理能力的六个五级指标集合为空"; diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubAgencyScoreAvgResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubAgencyScoreAvgResultDTO.java new file mode 100644 index 0000000000..f88e035b7b --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/SubAgencyScoreAvgResultDTO.java @@ -0,0 +1,51 @@ +package com.epmet.dto.indexcal; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * @Author zxc + * @DateTime 2020/9/4 9:32 上午 + */ +@Data +public class SubAgencyScoreAvgResultDTO implements Serializable { + + private static final long serialVersionUID = 6913351504675726385L; + + /** + * + */ + private String customerId; + + /** + * 机关ID + */ + private String agencyId; + + /** + * 上级组织ID + */ + private String parentId; + + /** + * 月度ID + */ + private String monthId; + + /** + * 季度ID + */ + private String quarterId; + + /** + * 年度ID + */ + private String yearId; + + /** + * 分数 + */ + private BigDecimal score; +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java index 380b2f3b86..397d99df7a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java @@ -17,10 +17,7 @@ import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMont import com.epmet.entity.evaluationindex.screen.ScreenCustomerGridEntity; import com.epmet.entity.stats.DimAgencyEntity; import com.epmet.service.StatsDemoService; -import com.epmet.service.evaluationindex.indexcal.DeptScoreService; -import com.epmet.service.evaluationindex.indexcal.GridCorreLationService; -import com.epmet.service.evaluationindex.indexcal.IndexCalculateCommunityService; -import com.epmet.service.evaluationindex.indexcal.IndexCalculateStreetService; +import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.stats.DimAgencyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -56,6 +53,8 @@ public class DemoController { private IndexCalculateStreetService indexCalculateStreetService; @Autowired private DeptScoreService deptScoreService; + @Autowired + private IndexCalculateDistrictService indexCalculateDistrictService; @GetMapping("testAlarm") public void testAlarm() { @@ -456,4 +455,11 @@ public class DemoController { String monthId = "202008"; indexCalculateStreetService.calStreetAll(customerId,monthId); } + + @PostMapping("districtZxc") + public void getDistrict(){ + String customerId = "b09527201c4409e19d1dbc5e3c3429a1"; + String monthId = "202008"; + indexCalculateDistrictService.calDistrictAll(customerId,monthId); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java index 219d617a0d..b30d2751d1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java @@ -19,7 +19,7 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.indexcal.AgencyScoreDTO; -import com.epmet.dto.screen.FactIndexCommunityScoreDTO; +import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; import com.epmet.entity.evaluationindex.indexcal.AgencyScoreEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -54,13 +54,23 @@ public interface AgencyScoreDao extends BaseDao { void deleteOldRecord(@Param("customerId") String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType); /** - * @Description 查询街道相关信息 + * @Description 查询【fact_index_agency_score】相关信息 * @param customerId * @param monthId * @author zxc * @date 2020/9/1 9:41 上午 */ - List selectStreetInfo(@Param("customerId") String customerId, @Param("monthId")String monthId,@Param("dataType")String dataType); + List selectAgencyScoreInfo(@Param("customerId") String customerId, @Param("monthId")String monthId, @Param("dataType")String dataType); + + /** + * @Description 区下级街道得分平均值 + * @param customerId + * @param monthId + * @author zxc + * @date 2020/8/31 1:51 下午 + */ + List selectAgencyScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); + /** * 根据入参查询 区/街道相关分数表 记录 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java index 0718e44771..b77849a5d5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java @@ -19,6 +19,7 @@ package com.epmet.dao.evaluationindex.indexcal; import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.indexcal.DeptScoreDTO; +import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -44,4 +45,15 @@ public interface DeptScoreDao extends BaseDao { **/ List selectListDeptScore(@Param("customerId")String customerId, @Param("monthId")String monthId); + + /** + * @Description 所有直属部门治理能力平均值 + * @param customerId + * @param monthId + * @param indexCode + * @author zxc + * @date 2020/9/4 10:53 上午 + */ + List selectGovernDeptScoreAvg(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java index abdabd7465..5a9350a63e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.indexcoll; /** import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.indexcal.CalculateCommonFormDTO; +import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; import com.epmet.dto.indexcollect.form.DeptGovrnAbilityFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity; import org.apache.ibatis.annotations.Mapper; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java index 5ebaab6f74..cc29f12a95 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/eum/IndexCodeEnum.java @@ -31,6 +31,10 @@ public enum IndexCodeEnum { JIE_DAO_XIA_SHU_SYSQDJNLHZPJZ("jiedaoxiashusysqdjnlhzpjz","街道下属所有社区党建能力汇总(平均值)",5), JIE_DAO_XIA_SHU_SYSQZLNLHZ("jiedaoxiashusysqzlnlhz","街道下属所有社区治理能力汇总 (平均值) ",5), JIE_DAO_XIA_SHU_SQFWNLDFPYZ("jiedaoxiashusqfwnldfpjz","街道下属社区服务能力得分 (平均值) ",5), + QU_XIA_SHU_JIE_DFWNLHZPJZ("quxiashujiedfwnlhzpjz","区下属街道服务能力汇总(平均值)",5), + QU_XIA_JI_JIE_DDJNLHZPJZ("quxiajijieddjnlhzpjz","区下级街道党建能力汇总(平均值)",5), + SUO_YOU_JIE_DAO_ZLNLPJZ("suoyoujiedaozlnlpjz","所有街道治理能力(平均值)",5), + SUO_YOU_ZHI_SHU_BMZLNLPJZ("suoyouzhishubmzlnlpjz","所有直属部门治理能力(平均值)",5), ; private String code; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateDistrictService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateDistrictService.java new file mode 100644 index 0000000000..0e8ce09ccf --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/IndexCalculateDistrictService.java @@ -0,0 +1,18 @@ +package com.epmet.service.evaluationindex.indexcal; + +/** + * @Author zxc + * @DateTime 2020/9/4 9:03 上午 + */ +public interface IndexCalculateDistrictService { + + /** + * @Description 计算全区相关总分 + * @param customerId + * @param monthId + * @author zxc + * @date 2020/9/2 3:12 下午 + */ + Boolean calDistrictAll(String customerId, String monthId); + +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java new file mode 100644 index 0000000000..4fd50137bd --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -0,0 +1,406 @@ +package com.epmet.service.evaluationindex.indexcal.impl; + +import com.alibaba.druid.util.StringUtils; +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.utils.DateUtils; +import com.epmet.constant.DataSourceConstant; +import com.epmet.constant.IndexCalConstant; +import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao; +import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; +import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao; +import com.epmet.dao.evaluationindex.indexcoll.FactIndexPartyAblityOrgMonthlyDao; +import com.epmet.dto.indexcal.AgencyScoreDTO; +import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; +import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; +import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity; +import com.epmet.eum.IndexCodeEnum; +import com.epmet.service.evaluationindex.indexcal.IndexCalculateDistrictService; +import com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService; +import com.epmet.service.evaluationindex.screen.IndexGroupDetailService; +import com.epmet.support.normalizing.BigDecimalScoreCalculator; +import com.epmet.support.normalizing.Correlation; +import com.epmet.support.normalizing.ScoreCalculator; +import com.epmet.support.normalizing.ScoreConstants; +import com.epmet.support.normalizing.batch.BatchScoreCalculator; +import com.epmet.support.normalizing.batch.IndexInputVO; +import com.epmet.support.normalizing.batch.SampleValue; +import lombok.extern.slf4j.Slf4j; +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 org.springframework.util.CollectionUtils; + +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Author zxc + * @DateTime 2020/9/4 9:03 上午 + */ +@Service +@Slf4j +@DataSource(DataSourceConstant.EVALUATION_INDEX) +public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrictService { + + @Autowired + private FactIndexPartyAblityOrgMonthlyDao factIndexPartyAblityOrgMonthlyDao; + @Autowired + private IndexCodeFieldReService indexCodeFieldReService; + @Autowired + private IndexGroupDetailService indexGroupDetailService; + @Autowired + private AgencyScoreDao agencyScoreDao; + @Autowired + private DeptScoreDao deptScoreDao; + + /** + * @Description 计算全区相关总分 + * @param customerId + * @param monthId + * @author zxc + * @date 2020/9/2 3:12 下午 + */ + @Override + public Boolean calDistrictAll(String customerId, String monthId) { + Boolean aBoolean = districtPartyCalculate(customerId, monthId);//党建能力 + if (!aBoolean.equals(true)) { + throw new RenException("calculate district-party-ability failure ......"); + } + Boolean bBoolean = districtGovernAbilityCalculate(customerId, monthId);// 治理能力 + if (!bBoolean.equals(true)) { + throw new RenException("calculate district-govern-ability failure ......"); + } + Boolean cBoolean = districtServiceAbilityCalculate(customerId, monthId);// 服务能力 + if (!cBoolean.equals(true)) { + throw new RenException("calculate district-service-ability failure ......"); + } + Boolean dBoolean = districtRelate(customerId, monthId); + if (!dBoolean.equals(true)) { + throw new RenException("calculate district-all insert failure ......"); + } + return true; + } + + /** + * @param customerId + * @Description 全区名义发文数量计算【党建能力】 + * @author zxc + * @date 2020/8/26 10:46 上午 + */ + public Boolean districtPartyCalculate(String customerId, String monthId) { + // 党建能力 + // 根据all_parent_index_code 获取指标明细 + List indexDetailList = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); + if (CollectionUtils.isEmpty(indexDetailList)) { + log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); + return false; + } + List indexInputVOS = new ArrayList<>(); + Map pid = new HashMap<>(); + //党建能力平均值 + indexDetailList.forEach(detail -> { + if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { + List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode()); + if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { + log.error(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); + return; + }else if (subGridPartyAvgScore.size() == NumConstant.ONE){ + pid.put(subGridPartyAvgScore.get(NumConstant.ZERO).getAgencyId(),subGridPartyAvgScore.get(NumConstant.ZERO).getParentId()); + sizeOne(subGridPartyAvgScore.get(NumConstant.ZERO).getAgencyId(),customerId,monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),pid); + return; + }else if (subGridPartyAvgScore.size() > NumConstant.ONE) { + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subGridPartyAvgScore.stream().map(o -> o.getScore()).collect(Collectors.toList())); + List> subPartyAvgList = ListUtils.partition(subGridPartyAvgScore, IndexCalConstant.PAGE_SIZE); + subPartyAvgList.forEach( party -> { + List index1SampleValues = new ArrayList<>(); + party.forEach(c -> { + pid.put(c.getAgencyId(),c.getParentId()); + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); + }); + BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); + IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); + indexInputVOS.add(index1VO); + }); + } + } else { + // 区名义发文数量 + List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMap(customerId, monthId,IndexCalConstant.DISTRICT_LEVEL); + if (CollectionUtils.isEmpty(publishArticleCountList)) { + log.error(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); + return; + } + String fieldNameByIndexCode = indexCodeFieldReService.getFieldNameByIndexCode(detail.getIndexCode()); + if (StringUtils.isEmpty(fieldNameByIndexCode)) { + log.error(String.format(IndexCalConstant.INDEX_CODE_NULL,detail.getIndexCode())); + return; + }else if (publishArticleCountList.size() == NumConstant.ONE){ + pid.put(publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(),publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.PARENT_ID).toString()); + sizeOne(publishArticleCountList.get(NumConstant.ZERO).get(IndexCalConstant.AGENCY_ID).toString(),customerId,monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),pid); + return; + }else if (publishArticleCountList.size() > NumConstant.ONE) { + List decimalList = publishArticleCountList.stream().map(m -> new BigDecimal(m.get(fieldNameByIndexCode).toString())).collect(Collectors.toList()); + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(decimalList); + List>> publishArticleList = ListUtils.partition(publishArticleCountList, IndexCalConstant.PAGE_SIZE); + publishArticleList.forEach( publish -> { + ScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); + List index1SampleValues = new ArrayList<>(); + publish.forEach(c -> { + pid.put(c.get(IndexCalConstant.AGENCY_ID).toString(),c.get(IndexCalConstant.PARENT_ID).toString()); + SampleValue s = new SampleValue((String) c.get(IndexCalConstant.AGENCY_ID), new BigDecimal(String.valueOf(c.get(fieldNameByIndexCode)))); + index1SampleValues.add(s); + }); + IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); + indexInputVOS.add(index1VO); + }); + } + } + }); + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + List result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), pid); + deleteAndInsert(customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), result); + return true; + } + + /** + * @param customerId + * @param monthId + * @Description 全区治理能力 + * @author zxc + * @date 2020/8/26 1:40 下午 + */ + public Boolean districtGovernAbilityCalculate(String customerId, String monthId) { + List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); + if (CollectionUtils.isEmpty(detailListByParentCode)) { + log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); + return false; + } + List indexInputVOS = new ArrayList<>(); + Map pid = new HashMap<>(); + detailListByParentCode.forEach(detail -> { + if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { + List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); + if (districtGovernAvgList.size() == NumConstant.ONE) { + pid.put(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(),districtGovernAvgList.get(NumConstant.ZERO).getParentId()); + sizeOne(districtGovernAvgList.get(NumConstant.ZERO).getAgencyId(),customerId,monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),pid); + return; + } else if (districtGovernAvgList.size() > NumConstant.ONE) { + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(districtGovernAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); + List> governAvg = ListUtils.partition(districtGovernAvgList, IndexCalConstant.PAGE_SIZE); + governAvg.forEach(avg -> { + List index1SampleValues = new ArrayList<>(); + avg.forEach(c -> { + pid.put(c.getAgencyId(),c.getParentId()); + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); + }); + BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); + IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); + indexInputVOS.add(index1VO); + }); + } + } else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){ + List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvg(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode()); + if (deptScoreAvgList.size() == NumConstant.ONE) { + pid.put(deptScoreAvgList.get(NumConstant.ZERO).getAgencyId(),deptScoreAvgList.get(NumConstant.ZERO).getParentId()); + sizeOne(deptScoreAvgList.get(NumConstant.ZERO).getAgencyId(),customerId,monthId,IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),pid); + return; + } else if (deptScoreAvgList.size() > NumConstant.ONE) { + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(deptScoreAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); + List> governAvg = ListUtils.partition(deptScoreAvgList, IndexCalConstant.PAGE_SIZE); + governAvg.forEach(avg -> { + List index1SampleValues = new ArrayList<>(); + avg.forEach(c -> { + pid.put(c.getAgencyId(),c.getParentId()); + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); + }); + BigDecimalScoreCalculator sc = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.getCorrelation(detail.getCorrelation())); + IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc); + indexInputVOS.add(index1VO); + }); + } + }else{ + // TODO 治理能力暂无自身级别 + } + }); + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + List result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), pid); + deleteAndInsert(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), result); + return true; + } + + /** + * @param customerId + * @param monthId + * @Description 全区服务能力 + * @author zxc + * @date 2020/8/31 1:38 下午 + */ + public Boolean districtServiceAbilityCalculate(String customerId, String monthId) { + List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), IndexCodeEnum.FU_WU_NENG_LI.getCode()); + if (CollectionUtils.isEmpty(detailListByParentCode)) { + log.error(IndexCalConstant.INDEX_DETAIL_LIST_NULL); + return false; + } + List indexInputVOS = new ArrayList<>(); + Map pid = new HashMap<>(); + detailListByParentCode.forEach(detail -> { + String indexCode = detail.getIndexCode(); + if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { + List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvg(customerId, monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode()); + if (subStreetAvgList.size() == NumConstant.ONE) { + pid.put(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(),subStreetAvgList.get(NumConstant.ZERO).getParentId()); + sizeOne(subStreetAvgList.get(NumConstant.ZERO).getAgencyId(),customerId,monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),pid); + return; + } else if (subStreetAvgList.size() > NumConstant.ONE) { + MaxAndMinBigDecimalResultDTO maxAndMinBigDecimal = this.getMaxAndMinBigDecimal(subStreetAvgList.stream().map(o -> o.getScore()).collect(Collectors.toList())); + List> serviceAvgList = ListUtils.partition(subStreetAvgList, IndexCalConstant.PAGE_SIZE); + serviceAvgList.forEach(serviceAvg -> { + BigDecimalScoreCalculator sc1 = new BigDecimalScoreCalculator(maxAndMinBigDecimal.getMin(), maxAndMinBigDecimal.getMax(), ScoreConstants.MIN_SCORE, ScoreConstants.MAX_SCORE, Correlation.POSITIVE); + List index1SampleValues = new ArrayList<>(); + serviceAvg.forEach(c -> { + pid.put(c.getAgencyId(),c.getParentId()); + SampleValue s = new SampleValue(c.getAgencyId(), c.getScore()); + index1SampleValues.add(s); + }); + IndexInputVO index1VO = new IndexInputVO(detail.getIndexId(), index1SampleValues, detail.getThreshold(), detail.getWeight(), sc1); + indexInputVOS.add(index1VO); + }); + } + } else { + // todo 暂时没有自身级别 + } + }); + BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + List result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(),pid); + deleteAndInsert(customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), result); + return true; + } + + /** + * @param customerId + * @param monthId + * @Description 区相关计算 + * @author zxc + * @date 2020/9/1 9:21 上午 + */ + public Boolean districtRelate(String customerId, String monthId) { + List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); + List agencyScoreList = agencyScoreDao.selectAgencyScoreInfo(customerId, monthId, IndexCalConstant.DISTRICT_LEVEL); + detailListByParentCode.forEach(detail -> { + agencyScoreList.forEach(community -> { + if (detail.getIndexCode().equals(community.getIndexCode())) { + community.setScore(community.getScore().multiply(detail.getWeight())); + } + }); + }); + Map> collect = agencyScoreList.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId)); + List result = new ArrayList<>(); + collect.forEach((key, value) -> { + AgencyScoreDTO score = new AgencyScoreDTO(); + score.setIsTotal(NumConstant.ONE_STR); + score.setCustomerId(customerId); + score.setAgencyId(key); + score.setMonthId(monthId); + score.setYearId(DateUtils.getYearId(monthId)); + score.setQuarterId(DateUtils.getQuarterId(monthId)); + score.setIndexCode(IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode()); + value.forEach(community -> { + score.setScore(score.getScore().add(community.getScore())); + score.setParentAgencyId(community.getParentAgencyId()); + }); + result.add(score); + }); + deleteAndInsert(customerId, monthId, IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode(), result); + return true; + } + + /** + * @param list + * @Description BigDecimal类型获取最大数和最小数 + * @author zxc + * @date 2020/8/27 1:30 下午 + */ + public MaxAndMinBigDecimalResultDTO getMaxAndMinBigDecimal(List list) { + BigDecimal max = Collections.max(list); + BigDecimal min = Collections.min(list); + MaxAndMinBigDecimalResultDTO result = new MaxAndMinBigDecimalResultDTO(); + result.setMax(max); + result.setMin(min); + return result; + } + + /** + * @param customerId + * @param monthId + * @param indexCode + * @param subAllDistrict + * @Description 先删除记录,在插入 + * @author zxc + * @date 2020/9/1 4:24 下午 + */ + @Transactional(rollbackFor = Exception.class) + public void deleteAndInsert(String customerId, String monthId, String indexCode, List subAllDistrict) { + if (!CollectionUtils.isEmpty(subAllDistrict)) { + agencyScoreDao.deleteOldRecord(customerId, monthId, indexCode,IndexCalConstant.DISTRICT_LEVEL); + System.err.println(subAllDistrict.size()); + agencyScoreDao.insertStreetRecord(subAllDistrict); + } + } + + /** + * @Description + * @param scoreCountOfSampleId 指标计算结果 + * @param customerId 客户ID + * @param monthId 月份ID + * @param isTotal 是否 总分【党建+治理+服务】 + * @param indexCode 党建能力:dangjiannengli,治理能力:zhilinengli,服务能力:fuwunengli,xx相关:xx相关 + * @author zxc + * @date 2020/9/2 2:37 下午 + */ + public List getResult(HashMap scoreCountOfSampleId, String customerId, String monthId, String isTotal, String indexCode,Map pid) { + List result = new ArrayList<>(); + scoreCountOfSampleId.forEach((k, v) -> { + AgencyScoreDTO score = new AgencyScoreDTO(); + score.setCustomerId(customerId); + score.setAgencyId(k); + score.setMonthId(monthId); + score.setQuarterId(DateUtils.getQuarterId(monthId)); + score.setYearId(DateUtils.getYearId(monthId)); + score.setIsTotal(isTotal); + score.setIndexCode(indexCode); + score.setScore(v); + score.setDataType(IndexCalConstant.DISTRICT_LEVEL); + pid.forEach((agency,parentAgency) -> { + if (k.equals(agency)){ + score.setParentAgencyId(parentAgency); + } + }); + result.add(score); + }); + return result; + } + + /** + * @Description 当查询结果为一条时,调用此方法 + * @param agencyId + * @param customerId + * @param monthId + * @author zxc + * @date 2020/9/2 2:40 下午 + */ + public void sizeOne(String agencyId,String customerId,String monthId,String indexCode,Map pid){ + HashMap scoreCountOfSampleId = new HashMap<>(); + scoreCountOfSampleId.put(agencyId,new BigDecimal(NumConstant.FIFTY)); + List result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, indexCode,pid); + deleteAndInsert(customerId, monthId, indexCode, result); + } +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java index e3890fa9b2..473b7c7ccb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java @@ -338,7 +338,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ */ public Boolean streetRelate(String customerId, String monthId) { List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); - List agencyScoreList = agencyScoreDao.selectStreetInfo(customerId, monthId, IndexCalConstant.STREET_LEVEL); + List agencyScoreList = agencyScoreDao.selectAgencyScoreInfo(customerId, monthId, IndexCalConstant.STREET_LEVEL); detailListByParentCode.forEach(detail -> { agencyScoreList.forEach(community -> { if (detail.getIndexCode().equals(community.getIndexCode())) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index b472801ad9..179fd5c9eb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -63,7 +63,7 @@ - SELECT CUSTOMER_ID, AGENCY_ID, @@ -83,4 +83,23 @@ AND INDEX_CODE != "jiedaoxiangguan" AND data_type = #{dataType} + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml index a528c94f95..8e01fb1e52 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml @@ -21,4 +21,26 @@ ORDER BY DEPT_ID + + + From a48974578407c130a4f448219dc43d4c0ad07e13 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 4 Sep 2020 15:18:25 +0800 Subject: [PATCH 10/13] =?UTF-8?q?=E5=8C=BA=E7=9B=B4=E9=83=A8=E9=97=A8?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evaluationindex/indexcal/impl/DeptScoreServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java index 59b6127b77..52ea21e80a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java @@ -18,11 +18,13 @@ package com.epmet.service.evaluationindex.indexcal.impl; import com.alibaba.fastjson.JSON; +import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.utils.DateUtils; +import com.epmet.constant.DataSourceConstant; import com.epmet.constant.IndexCalConstant; import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao; @@ -63,6 +65,7 @@ import java.util.Map; * @author generator generator@elink-cn.com * @since v1.0.0 2020-09-02 */ +@DataSource(DataSourceConstant.EVALUATION_INDEX) @Slf4j @Service public class DeptScoreServiceImpl extends BaseServiceImpl implements DeptScoreService { From b9ece9bf470e5116f0c90e9feca1759fe5d5942d Mon Sep 17 00:00:00 2001 From: jianjun Date: Fri, 4 Sep 2020 16:11:25 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcal/impl/IndexCalculateCommunityServiceImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java index 1d7b37a78d..349167c112 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateCommunityServiceImpl.java @@ -1,6 +1,7 @@ package com.epmet.service.evaluationindex.indexcal.impl; import com.alibaba.druid.util.StringUtils; +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.exception.RenException; @@ -139,7 +140,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni } }); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + log.info("communityPartyCalculate getScoreCountOfSampleId param:{}", JSON.toJSONString(indexInputVOS)); HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + log.info("communityPartyCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreCountOfSampleId)); List result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),pid); deleteAndInsert(customerId, monthId, IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(), result); return true; @@ -216,7 +219,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni } }); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + log.info("communityGovernAbilityCalculate getScoreCountOfSampleId param:{}", JSON.toJSONString(indexInputVOS)); HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + log.info("communityGovernAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreCountOfSampleId)); List result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),pid); deleteAndInsert(customerId, monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(), result); return true; @@ -293,7 +298,9 @@ public class IndexCalculateCommunityServiceImpl implements IndexCalculateCommuni } }); BatchScoreCalculator batchScoreCalculator = new BatchScoreCalculator(); + log.info("communityServiceAbilityCalculate getScoreCountOfSampleId param:{}", JSON.toJSONString(indexInputVOS)); HashMap scoreCountOfSampleId = batchScoreCalculator.getScoreCountOfSampleId(indexInputVOS); + log.info("communityServiceAbilityCalculate getScoreCountOfSampleId result:{}", JSON.toJSONString(scoreCountOfSampleId)); List result = getResult(scoreCountOfSampleId, customerId, monthId, NumConstant.ZERO_STR, IndexCodeEnum.FU_WU_NENG_LI.getCode(),pid); deleteAndInsert(customerId, monthId, IndexCodeEnum.FU_WU_NENG_LI.getCode(), result); return true; From 8269770456ae2a77b099dbd416d222d080a3cb9e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 4 Sep 2020 16:51:52 +0800 Subject: [PATCH 12/13] =?UTF-8?q?=E9=9A=BE=E7=82=B9=E5=A0=B5=E7=82=B9?= =?UTF-8?q?=E3=80=81=E5=85=9A=E5=BB=BA=E8=83=BD=E5=8A=9B=E3=80=81=E5=85=9A?= =?UTF-8?q?=E5=91=98=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GridPartyMemberDataDetailFormDTO.java | 96 ++++++++++++++++ .../form/GridPartyMemberDataFormDTO.java | 77 +------------ .../form/DifficultyDataDetailFormDTO.java | 105 ++++++++++++++++++ .../form/DifficultyDataFormDTO.java | 90 +-------------- .../FactIndexCollectController.java | 7 +- .../controller/ScreenCollController.java | 4 +- .../FactIndexPartyAblityCpcMonthlyDao.java | 17 +-- .../screen/ScreenDifficultyDataDao.java | 9 +- .../indexcoll/FactIndexCollectService.java | 2 +- .../impl/FactIndexCollectServiceImpl.java | 19 ++-- .../screen/ScreenCollService.java | 2 +- .../screen/impl/ScreenCollServiceImpl.java | 15 +-- .../FactIndexPartyAblityCpcMonthlyDao.xml | 7 +- .../screen/ScreenDifficultyDataDao.xml | 2 +- 14 files changed, 251 insertions(+), 201 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataDetailFormDTO.java create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataDetailFormDTO.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataDetailFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataDetailFormDTO.java new file mode 100644 index 0000000000..364b19c34f --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataDetailFormDTO.java @@ -0,0 +1,96 @@ +package com.epmet.dto.indexcollect.form; + +import lombok.Data; + +import java.io.Serializable; +import java.math.BigDecimal; + +/** + * 1、党建能力-党员相关指标上报(按照月份) 入参 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/4 16:04 + */ +@Data +public class GridPartyMemberDataDetailFormDTO implements Serializable { + private static final long serialVersionUID = 2923515319015973995L; + /** + * 机关id:网格所属的组织id + */ + private String agencyId; + + /** + * 网格id + */ + private String gridId; + + /** + * yyyyMM + */ + private String monthId; + + /** + * yyyyQ1, yyyyQ2, yyyyQ3, yyyyQ4 + */ + private String quarterId; + + /** + * yyyy + */ + private String yearId; + + /** + * 党员提出的话题数 + */ + private Integer createTopicCount; + + /** + * 党员参与话题数(支持,反对,评论,浏览) + */ + private Integer joinTopicCount; + + /** + * 话题转议题数 + */ + private Integer shiftIssueCount; + + /** + * 议题转项目数 + */ + private Integer shiftProjectCount; + + /** + * 参加三会一课次数 + */ + private Integer joinThreeMeetsCount; + + /** + * 自建群群众人数 + */ + private Integer groupUserCount; + + /** + * 自建群活跃度-话题数 + */ + private Integer groupTopicCount; + + /** + * 议题转项目率 + */ + private BigDecimal topicToIssueRatio; + + /** + * 上级组织Id + */ + private String parentId; + + /** + * 党员自建群活跃群众人数(08-24) + */ + private Integer groupActiveUserCount; + + /** + * 用户id + */ + private String userId; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java index 3c7c7a5141..5a0a9fb3c8 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/form/GridPartyMemberDataFormDTO.java @@ -3,8 +3,11 @@ package com.epmet.dto.indexcollect.form; import lombok.Data; import org.apache.poi.hpsf.Decimal; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; /** * 1、党建能力-党员相关指标上报(按照月份) 入参 @@ -17,82 +20,14 @@ public class GridPartyMemberDataFormDTO implements Serializable { private static final long serialVersionUID = 1L; /** - * 机关id:网格所属的组织id + * 当为true时后台将删除本月数据 */ - private String agencyId; - - /** - * 网格id - */ - private String gridId; + private Boolean isFirst; /** * yyyyMM */ private String monthId; - /** - * yyyyQ1, yyyyQ2, yyyyQ3, yyyyQ4 - */ - private String quarterId; - - /** - * yyyy - */ - private String yearId; - - /** - * 党员提出的话题数 - */ - private Integer createTopicCount; - - /** - * 党员参与话题数(支持,反对,评论,浏览) - */ - private Integer joinTopicCount; - - /** - * 话题转议题数 - */ - private Integer shiftIssueCount; - - /** - * 议题转项目数 - */ - private Integer shiftProjectCount; - - /** - * 参加三会一课次数 - */ - private Integer joinThreeMeetsCount; - - /** - * 自建群群众人数 - */ - private Integer groupUserCount; - - /** - * 自建群活跃度-话题数 - */ - private Integer groupTopicCount; - - /** - * 议题转项目率 - */ - private BigDecimal topicToIssueRatio; - - /** - * 上级组织Id - */ - private String parentId; - - /** - * 党员自建群活跃群众人数(08-24) - */ - private Integer groupActiveUserCount; - - /** - * 用户id - */ - private String userId; + private List partyMemberDataList; } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataDetailFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataDetailFormDTO.java new file mode 100644 index 0000000000..ab77a2363c --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataDetailFormDTO.java @@ -0,0 +1,105 @@ +package com.epmet.dto.screencoll.form; + +import lombok.Data; + +import java.io.Serializable; + +/** + * 描述一下 + * + * @author yinzuomei@elink-cn.com + * @date 2020/9/4 15:43 + */ +@Data +public class DifficultyDataDetailFormDTO implements Serializable { + private static final long serialVersionUID = 4893795146396420078L; + /** + * 组织类别 agency:组织;部门:department;网格:grid + */ + private String orgType; + + /** + * 组织Id 可以为网格,机关id + */ + private String orgId; + + /** + * 上级组织Id + */ + private String parentId; + + /** + * 组织名称 + */ + private String orgName; + + /** + * 事件原Id + */ + private String eventId; + + /** + * 事件图片 URL + */ + private String eventImgUrl; + + /** + * 事件来源 eg: XXX街道-xx社区-网格 + */ + private String eventSource; + + /** + * 事件内容 + */ + private String eventContent; + + /** + * 事件耗时单位:分钟 + */ + private Integer eventCostTime; + + /** + * 事件设计部门数 + */ + private Integer eventReOrg; + + /** + * 事件类别编码 + */ + private String eventCategoryCode; + + /** + * 事件状态编码 + */ + private String eventStatusCode; + + /** + * 事件类别名称 + */ + private String eventCategoryName; + + /** + * 事件状态描述 + */ + private String eventStatusDesc; + + /** + * 最近一次操作说明 eg: 转项目,结案,流转 + */ + private String latestOperateDesc; + + /** + * 事件被处理次数(08-21新增) + */ + private Integer eventHandledCount; + + /** + * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) + */ + private String dataEndTime; + + /** + * 所有上级ID,用英文逗号分开(8.26新增) + */ + private String allParentIds; +} diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java index e446e073a3..a0de181acb 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screencoll/form/DifficultyDataFormDTO.java @@ -3,6 +3,7 @@ package com.epmet.dto.screencoll.form; import lombok.Data; import java.io.Serializable; +import java.util.List; /** * 3、难点赌点 入参 @@ -11,96 +12,15 @@ import java.io.Serializable; */ @Data public class DifficultyDataFormDTO implements Serializable { - private static final long serialVersionUID = 1L; - /** - * 组织类别 agency:组织;部门:department;网格:grid + * 当为true时后台将删除本月数据 */ - private String orgType; + private Boolean isFirst; /** - * 组织Id 可以为网格,机关id + * 难点堵点数据 */ - private String orgId; + private List diffcultyDataList; - /** - * 上级组织Id - */ - private String parentId; - - /** - * 组织名称 - */ - private String orgName; - - /** - * 事件原Id - */ - private String eventId; - - /** - * 事件图片 URL - */ - private String eventImgUrl; - - /** - * 事件来源 eg: XXX街道-xx社区-网格 - */ - private String eventSource; - - /** - * 事件内容 - */ - private String eventContent; - - /** - * 事件耗时单位:分钟 - */ - private Integer eventCostTime; - - /** - * 事件设计部门数 - */ - private Integer eventReOrg; - - /** - * 事件类别编码 - */ - private String eventCategoryCode; - - /** - * 事件状态编码 - */ - private String eventStatusCode; - - /** - * 事件类别名称 - */ - private String eventCategoryName; - - /** - * 事件状态描述 - */ - private String eventStatusDesc; - - /** - * 最近一次操作说明 eg: 转项目,结案,流转 - */ - private String latestOperateDesc; - - /** - * 事件被处理次数(08-21新增) - */ - private Integer eventHandledCount; - - /** - * 数据更新至: yyyy|yyyyMM|yyyyMMdd(08-21新增) - */ - private String dataEndTime; - - /** - * 所有上级ID,用英文逗号分开(8.26新增) - */ - private String allParentIds; } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java index 82966dbe82..9dbe0a82fb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java @@ -33,10 +33,11 @@ public class FactIndexCollectController { * @Author zhangyong * @Date 10:52 2020-08-20 **/ - @ExternalAppRequestAuth +// @ExternalAppRequestAuth @PostMapping("gridpartymemberdata") - public Result gridPartyMemberData(ExternalAppRequestParam externalAppRequestParam, @RequestBody List formDTO) { - factIndexCollectService.insertGridPartyMemberData(formDTO, externalAppRequestParam.getCustomerId()); + public Result gridPartyMemberData(ExternalAppRequestParam externalAppRequestParam, @RequestBody GridPartyMemberDataFormDTO formDTO) { + + factIndexCollectService.insertGridPartyMemberData(formDTO,"b09527201c4409e19d1dbc5e3c3429a1" );//externalAppRequestParam.getCustomerId() return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java index 99ba483433..b3b482269d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java @@ -133,8 +133,8 @@ public class ScreenCollController { **/ @ExternalAppRequestAuth @PostMapping("difficultydata") - public Result difficultyData(ExternalAppRequestParam externalAppRequestParam, @RequestBody List formDTO) { - screenCollService.insertDifficultyData(formDTO, externalAppRequestParam.getCustomerId()); + public Result difficultyData(ExternalAppRequestParam externalAppRequestParam, @RequestBody DifficultyDataFormDTO formDTO) { + screenCollService.insertDifficultyData(formDTO, "b09527201c4409e19d1dbc5e3c3429a1");//externalAppRequestParam.getCustomerId() return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java index c23bf91b4c..ffdc533581 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.indexcoll; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcollect.form.GridPartyMemberDataDetailFormDTO; import com.epmet.dto.indexcollect.form.GridPartyMemberDataFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import org.apache.ibatis.annotations.Mapper; @@ -40,22 +41,12 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao list, + int batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List list, @Param("customerId") String customerId); List> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java index 21eaa80280..412ab70225 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenDifficultyDataDao.java @@ -18,6 +18,7 @@ package com.epmet.dao.evaluationindex.screen; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.screencoll.form.DifficultyDataDetailFormDTO; import com.epmet.dto.screencoll.form.DifficultyDataFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenDifficultyDataEntity; import org.apache.ibatis.annotations.Mapper; @@ -38,14 +39,10 @@ public interface ScreenDifficultyDataDao extends BaseDao list, @Param("customerId")String customerId); + void batchInsertDifficultyData(@Param("list") List list, @Param("customerId")String customerId); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java index 8f6197ffcd..e88e5d55a3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java @@ -22,7 +22,7 @@ public interface FactIndexCollectService { * @Author zhangyong * @Date 10:52 2020-08-20 **/ - void insertGridPartyMemberData(List formDTO, String customerId); + void insertGridPartyMemberData(GridPartyMemberDataFormDTO formDTO, String customerId); /** * 2、党建能力-网格相关指标上报(按照月份) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 26c725cf4d..49415544b0 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.ArrayList; @@ -75,14 +76,16 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertGridPartyMemberData(List formDTO, String customerId) { - if (null != formDTO && formDTO.size() > NumConstant.ZERO){ - for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(customerId, - formDTO.get(i).getAgencyId(), formDTO.get(i).getGridId(), formDTO.get(i).getUserId(), - formDTO.get(i).getYearId(), formDTO.get(i).getMonthId(), formDTO.get(i).getQuarterId()); - } - factIndexPartyAblityCpcMonthlyDao.batchInsertFactIndexPartyAblityCpcMonthly(formDTO, customerId); + public void insertGridPartyMemberData(GridPartyMemberDataFormDTO formDTO, String customerId) { + if (formDTO.getIsFirst()) { + //删除这个客户这个月的数据 + int deleteNum; + do { + deleteNum = factIndexPartyAblityCpcMonthlyDao.deleteFactIndexPartyAblityCpcMonthly(customerId, formDTO.getMonthId()); + } while (deleteNum != NumConstant.ZERO); + } + if (null != formDTO && !CollectionUtils.isEmpty(formDTO.getPartyMemberDataList())) { + factIndexPartyAblityCpcMonthlyDao.batchInsertFactIndexPartyAblityCpcMonthly(formDTO.getPartyMemberDataList(), customerId); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCollService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCollService.java index d499b86c08..1e6dca0080 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCollService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ScreenCollService.java @@ -100,7 +100,7 @@ public interface ScreenCollService { * @Author zhangyong * @Date 10:52 2020-08-18 **/ - void insertDifficultyData(List formDTO, String customerId); + void insertDifficultyData(DifficultyDataFormDTO formDTO, String customerId); /** * 2、党员基本情况 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCollServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCollServiceImpl.java index 0b205efb5a..6018622deb 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCollServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ScreenCollServiceImpl.java @@ -30,6 +30,7 @@ import com.epmet.service.evaluationindex.screen.ScreenCollService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.math.BigDecimal; import java.util.ArrayList; @@ -198,13 +199,13 @@ public class ScreenCollServiceImpl implements ScreenCollService { @DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true) @Override @Transactional(rollbackFor = Exception.class) - public void insertDifficultyData(List formDTO, String customerId) { - if (null != formDTO && formDTO.size() > NumConstant.ZERO){ - for (int i = NumConstant.ZERO; i < formDTO.size(); i++){ - screenDifficultyDataDao.deleteDifficultyData(customerId, formDTO.get(i).getEventId(), formDTO.get(i).getOrgId()); - } - - screenDifficultyDataDao.batchInsertDifficultyData(formDTO, customerId); + public void insertDifficultyData(DifficultyDataFormDTO formDTO, String customerId) { + if(formDTO.getIsFirst()){ + //直接删除当前客户下所有的数据 + screenDifficultyDataDao.deleteDifficultyData(customerId); + } + if (null != formDTO && !CollectionUtils.isEmpty(formDTO.getDiffcultyDataList())){ + screenDifficultyDataDao.batchInsertDifficultyData(formDTO.getDiffcultyDataList(), customerId); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml index 05d4b206a3..8336f33e9a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml @@ -3,10 +3,11 @@ - + delete from fact_index_party_ablity_cpc_monthly - where CUSTOMER_ID = #{customerId} AND AGENCY_ID = #{agencyId} AND GRID_ID = #{gridId} AND USER_ID = #{userId} - AND YEAR_ID = #{yearId} AND MONTH_ID = #{monthId} AND QUARTER_ID = #{quarterId} + where CUSTOMER_ID = #{customerId} + AND MONTH_ID = #{monthId} + limit 1000 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml index cfeba4c7b7..051f14cbcf 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenDifficultyDataDao.xml @@ -5,7 +5,7 @@ delete from screen_difficulty_data - where CUSTOMER_ID = #{customerId} AND EVENT_ID = #{eventId} AND ORG_ID = #{orgId} + where CUSTOMER_ID = #{customerId} From da10ffe6b6052e66c402e1867fe6fede67b9c917 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Fri, 4 Sep 2020 17:00:10 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E9=9A=BE=E7=82=B9=E5=A0=B5=E7=82=B9?= =?UTF-8?q?=E3=80=81=E5=85=9A=E5=BB=BA=E8=83=BD=E5=8A=9B=E3=80=81=E5=85=9A?= =?UTF-8?q?=E5=91=98=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= =?UTF-8?q?v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/FactIndexCollectController.java | 5 ++--- .../main/java/com/epmet/controller/ScreenCollController.java | 2 +- .../indexcoll/impl/FactIndexCollectServiceImpl.java | 3 ++- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java index 9dbe0a82fb..138ab5cbb7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java @@ -33,11 +33,10 @@ public class FactIndexCollectController { * @Author zhangyong * @Date 10:52 2020-08-20 **/ -// @ExternalAppRequestAuth + @ExternalAppRequestAuth @PostMapping("gridpartymemberdata") public Result gridPartyMemberData(ExternalAppRequestParam externalAppRequestParam, @RequestBody GridPartyMemberDataFormDTO formDTO) { - - factIndexCollectService.insertGridPartyMemberData(formDTO,"b09527201c4409e19d1dbc5e3c3429a1" );//externalAppRequestParam.getCustomerId() + factIndexCollectService.insertGridPartyMemberData(formDTO,externalAppRequestParam.getCustomerId() ); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java index b3b482269d..d83f8df3c5 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenCollController.java @@ -134,7 +134,7 @@ public class ScreenCollController { @ExternalAppRequestAuth @PostMapping("difficultydata") public Result difficultyData(ExternalAppRequestParam externalAppRequestParam, @RequestBody DifficultyDataFormDTO formDTO) { - screenCollService.insertDifficultyData(formDTO, "b09527201c4409e19d1dbc5e3c3429a1");//externalAppRequestParam.getCustomerId() + screenCollService.insertDifficultyData(formDTO, externalAppRequestParam.getCustomerId()); return new Result(); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java index 49415544b0..715bc56b0f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java @@ -16,9 +16,9 @@ import com.epmet.dto.screen.FactIndexCommunityScoreDTO; import com.epmet.dto.screen.FactIndexGridScoreDTO; import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO; import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity; -import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity; import com.epmet.eum.IndexCodeEnum; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -34,6 +34,7 @@ import java.util.stream.Collectors; * @Auther: zhangyong * @Date: 2020-08-20 10:05 */ +@Slf4j @Service @DataSource(DataSourceConstant.EVALUATION_INDEX) public class FactIndexCollectServiceImpl implements FactIndexCollectService {