From e39495a062aecd088d516d646ca937340f01b364 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 23 Jun 2020 22:10:40 +0800 Subject: [PATCH 01/14] =?UTF-8?q?message=E3=80=81auth=E3=80=81resipartymem?= =?UTF-8?q?ber?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-test.yml | 2 +- .../epmet-message-server/deploy/docker-compose-test.yml | 2 +- .../resi-partymember-server/deploy/docker-compose-test.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-test.yml b/epmet-auth/deploy/docker-compose-test.yml index e177ec9944..20871fd0c7 100644 --- a/epmet-auth/deploy/docker-compose-test.yml +++ b/epmet-auth/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.21 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-auth:0.3.22 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-test.yml b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-test.yml index 104ba801e6..50d2127545 100644 --- a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-test.yml +++ b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-message-server: container_name: epmet-message-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-message-server:0.3.19 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/epmet-message-server:0.3.21 ports: - "8085:8085" network_mode: host # 使用现有网络 diff --git a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml index 344f01b1f1..b8368d410e 100644 --- a/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml +++ b/epmet-module/resi-partymember/resi-partymember-server/deploy/docker-compose-test.yml @@ -2,7 +2,7 @@ version: "3.7" services: resi-partymember-server: container_name: resi-partymember-server-test - image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-partymember-server:0.3.51 + image: registry-vpc.cn-qingdao.aliyuncs.com/epmet-cloud-release/resi-partymember-server:0.3.52 ports: - "8096:8096" network_mode: host # 使用现有网络 From d18ec7d003f1a73fe0f8d41a2799d593f0c563e3 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Sun, 28 Jun 2020 16:40:00 +0800 Subject: [PATCH 02/14] =?UTF-8?q?=E5=9B=A0=E8=AE=AE=E9=A2=98=E4=B8=BB?= =?UTF-8?q?=E8=A1=A8DB=E8=AE=BE=E8=AE=A1=E5=AD=97=E6=AE=B5key=E5=80=BC?= =?UTF-8?q?=E5=8D=95=E8=AF=8D=E9=94=99=E8=AF=AF=E5=BC=95=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=8F=98=E5=8A=A8(resloved-resolved)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/IssueDTO.java | 2 +- .../main/java/com/epmet/constant/IssueConstant.java | 4 ++-- .../java/com/epmet/constant/UserMessageConstant.java | 6 +++--- .../src/main/java/com/epmet/entity/IssueEntity.java | 2 +- .../src/main/java/com/epmet/excel/IssueExcel.java | 2 +- .../java/com/epmet/service/impl/IssueServiceImpl.java | 10 +++++----- .../main/resources/db.migration/epmet_gov_issue.sql | 2 +- .../src/main/java/com/epmet/dto/IssueDTO.java | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java index fe12ca4a76..457a165fd6 100644 --- a/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java +++ b/epmet-module/gov-issue/gov-issue-client/src/main/java/com/epmet/dto/IssueDTO.java @@ -59,7 +59,7 @@ public class IssueDTO implements Serializable { private String closeReason; /** - * 解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 + * 解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 */ private String resolveType; diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java index 632d72b70e..7fd12ac37d 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/IssueConstant.java @@ -29,11 +29,11 @@ public interface IssueConstant { /** * 议题解决类型-已解决 */ - String ISSUE_RESLOVED = "resloved"; + String ISSUE_RESOLVED = "resolved"; /** * 议题解决类型-未解决 */ - String ISSUE_UNRESLOVED = "unresloved"; + String ISSUE_UNRESOLVED = "unresolved"; String SELECT_EXCEPTION = "获取议题详情数据失败"; String UPPDATE_EXCEPTION = "议题详情表数据更新失败"; diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java index 3d3fde4b30..5bea3d3a3a 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/constant/UserMessageConstant.java @@ -18,12 +18,12 @@ public interface UserMessageConstant { /** * 议题关闭时,选择已解决 */ - String ISSUE_RESLOVED_MSG = "您好,您发表的话题\"%s\"问题已解决,解决方案是:%s"; + String ISSUE_RESOLVED_MSG = "您好,您发表的话题\"%s\"问题已解决,解决方案是:%s"; /** * 议题关闭时,选择无需解决 */ - String ISSUE_UNRESLOVED_MSG = "您好,您发表的话题\"%s\"问题无需解决,原因:%s"; + String ISSUE_UNRESOLVED_MSG = "您好,您发表的话题\"%s\"问题无需解决,原因:%s"; /** * 议题转项目消息模板 @@ -33,6 +33,6 @@ public interface UserMessageConstant { /** * 议题转项目消息模板 */ - String PROJECT_RESLOVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; + String PROJECT_RESOLVED_MSG = "您好。您收到一条【%s】的新信息,请您尽快处理。"; } diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java index cfa9b8c046..4c94cbd18d 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/entity/IssueEntity.java @@ -59,7 +59,7 @@ public class IssueEntity extends BaseEpmetEntity { private String closeReason; /** - * 解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 + * 解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 */ private String resolveType; diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java index e012192a3f..7cfa0507da 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/excel/IssueExcel.java @@ -46,7 +46,7 @@ public class IssueExcel { @Excel(name = "关闭理由 【未关闭时可以为空】关闭议题时必填的理由,转项目后而且已经结案,这个字段不回写") private String closeReason; - @Excel(name = "解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写") + @Excel(name = "解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写") private String resolveType; @Excel(name = "议题名称 最多20字") diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index b97e5e51d7..4ba36d235d 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -398,10 +398,10 @@ public class IssueServiceImpl extends BaseServiceImpl imp ResiTopicDTO topicDTO = resultTopicDTO.getData(); //4.2:创建消息模板 String messageContent = ""; - if (IssueConstant.ISSUE_RESLOVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_RESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); - } else if (IssueConstant.ISSUE_UNRESLOVED.equals(formDTO.getResolveType())) { - messageContent = String.format(UserMessageConstant.ISSUE_UNRESLOVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); + if (IssueConstant.ISSUE_RESOLVED.equals(formDTO.getResolveType())) { + messageContent = String.format(UserMessageConstant.ISSUE_RESOLVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); + } else if (IssueConstant.ISSUE_UNRESOLVED.equals(formDTO.getResolveType())) { + messageContent = String.format(UserMessageConstant.ISSUE_UNRESOLVED_MSG, topicDTO.getTopicContent(), formDTO.getCloseReason()); } //4.3:调用服务,发送消息 if (!saveUserMessageList(topicDTO, messageContent, entity).success()) { @@ -563,7 +563,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp msgList.add(msgIssue); } //2:创建项目工作人员消息对象 - String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESLOVED_MSG, entity.getIssueTitle()); + String projectStaffMessage = String.format(UserMessageConstant.PROJECT_RESOLVED_MSG, entity.getIssueTitle()); //所选人员如果即在部门下又在网格下则只发一条消息 Map map = new HashMap<>(); formDTO.getStaffList().forEach(staff->{ diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db.migration/epmet_gov_issue.sql b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db.migration/epmet_gov_issue.sql index 978b6ee246..6194b95cbe 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/db.migration/epmet_gov_issue.sql +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/db.migration/epmet_gov_issue.sql @@ -30,7 +30,7 @@ CREATE TABLE `issue` ( `SOURCE_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源类型 eg:resi_topic', `SOURCE_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源ID eg:2223232(当SOURCE_TYPE为\"resi_topic\"时,这里指话题的ID)', `CLOSE_REASON` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '关闭理由 【未关闭时可以为空】关闭议题时必填的理由,转项目后而且已经结案,这个字段不回写', - `RESOLVE_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写', + `RESOLVE_TYPE` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写', `ISSUE_TITLE` varchar(128) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '议题名称 最多20字', `SUGGESTION` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '建议 最多1000字', `CUSTOMER_ID` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '客户ID', diff --git a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java index d92ea44b9d..89a557de68 100644 --- a/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java +++ b/epmet-module/resi-hall/resi-hall-client/src/main/java/com/epmet/dto/IssueDTO.java @@ -59,7 +59,7 @@ public class IssueDTO implements Serializable { private String closeReason; /** - * 解决类型 【未关闭时可以为空】已解决resloved、未解决unresloved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 + * 解决类型 【未关闭时可以为空】已解决resolved、未解决unresolved,对应在关闭议题时所选的checkbox,转项目后而且已经结案,这个字段不回写 */ private String resolveType; From 65525692be4f8049b79a75f35810c60dbf677670 Mon Sep 17 00:00:00 2001 From: jiangyuying Date: Sun, 28 Jun 2020 17:09:42 +0800 Subject: [PATCH 03/14] =?UTF-8?q?=E7=9F=AD=E4=BF=A1--=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/commons/tools/constant/Constant.java | 4 ++++ .../main/java/com/epmet/service/impl/SysSmsServiceImpl.java | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java index c2aaddf70c..67aced6dbe 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/Constant.java @@ -127,4 +127,8 @@ public interface Constant { */ String UNREAD = "unread"; + /** + * 创建时间字段名 + */ + String CREATED_TIME = "created_time"; } diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java index 2f8600641e..7f6d02fa40 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SysSmsServiceImpl.java @@ -51,7 +51,7 @@ public class SysSmsServiceImpl extends BaseServiceImpl @Override public PageData page(Map params) { IPage page = baseDao.selectPage( - getPage(params, Constant.CREATE_DATE, false), + getPage(params, Constant.CREATED_TIME, false), getWrapper(params) ); return getPageData(page, SysSmsDTO.class); From 3216935822001b37feea94d868f0462d087467c7 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Sun, 28 Jun 2020 18:20:44 +0800 Subject: [PATCH 04/14] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9=EF=BC=8C=E7=BB=9F?= =?UTF-8?q?=E4=B8=80=E6=9B=B4=E6=96=B0=E6=9C=8D=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-report-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-report/data-report-server/pom.xml | 2 +- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- .../epmet-job/epmet-job-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-job/epmet-job-server/pom.xml | 2 +- .../epmet-message-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-message/epmet-message-server/pom.xml | 2 +- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml index 2258dd43cf..21ee831dcc 100644 --- a/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-report/data-report-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-report-server: container_name: data-report-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.8 + image: 192.168.1.130:10080/epmet-cloud-dev/data-report-server:0.3.9 ports: - "8109:8109" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-report/data-report-server/pom.xml b/epmet-module/data-report/data-report-server/pom.xml index a03e16e222..8c2ac84759 100644 --- a/epmet-module/data-report/data-report-server/pom.xml +++ b/epmet-module/data-report/data-report-server/pom.xml @@ -3,7 +3,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - 0.3.8 + 0.3.9 data-report-server diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 9f622320e1..2478d1b203 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.7 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.8 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 3cb1ed3e57..702c4a4194 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.7 + 0.3.8 data-statistical com.epmet diff --git a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml index e20714082d..1aa3f41622 100644 --- a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-job-server: container_name: epmet-job-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-job-server:0.3.11 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-job-server:0.3.12 ports: - "8084:8084" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-job/epmet-job-server/pom.xml b/epmet-module/epmet-job/epmet-job-server/pom.xml index 6301d4acec..a7130ca254 100644 --- a/epmet-module/epmet-job/epmet-job-server/pom.xml +++ b/epmet-module/epmet-job/epmet-job-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.11 + 0.3.12 com.epmet epmet-job diff --git a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml index c5e1c7579d..9aa157cd04 100644 --- a/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-message/epmet-message-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-message-server: container_name: epmet-message-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.22 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-message-server:0.3.23 ports: - "8085:8085" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-message/epmet-message-server/pom.xml b/epmet-module/epmet-message/epmet-message-server/pom.xml index cf6938d147..bf543a83f3 100644 --- a/epmet-module/epmet-message/epmet-message-server/pom.xml +++ b/epmet-module/epmet-message/epmet-message-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.22 + 0.3.23 com.epmet epmet-message diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index 06fc27b887..e5f9b0eb87 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.42 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.44 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index 2dd11868f2..ad883bcc23 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.43 + 0.3.44 gov-issue com.epmet diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index 48cd31c6f1..28f015a3c5 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.27 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.29 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index 382580cd85..a3db2f67a8 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.28 + 0.3.29 gov-project com.epmet From d5afc43c74f5f48490387b482ea25e1799b31f63 Mon Sep 17 00:00:00 2001 From: wxz Date: Sun, 28 Jun 2020 18:51:46 +0800 Subject: [PATCH 05/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E6=97=B6=E5=80=99=EF=BC=8C=E6=9B=B4=E6=96=B0=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=9A=84=E7=BC=93=E5=AD=98=E4=BF=A1=E6=81=AFbug=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/GovLoginServiceImpl.java | 20 +++++++++++++- .../epmet/dto/form/GovStaffRoleFormDTO.java | 12 +++++++++ .../epmet/feign/EpmetUserOpenFeignClient.java | 14 +++++++--- .../EpmetUserOpenFeignClientFallback.java | 11 +++++--- .../controller/GovStaffRoleController.java | 27 ++++++++++++++++--- .../java/com/epmet/dao/GovStaffRoleDao.java | 2 ++ .../java/com/epmet/feign/AuthFeignClient.java | 4 +-- .../epmet/service/GovStaffRoleService.java | 2 ++ .../service/impl/GovStaffRoleServiceImpl.java | 5 ++++ .../main/resources/mapper/GovStaffRoleDao.xml | 9 +++++++ 10 files changed, 91 insertions(+), 15 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GovStaffRoleFormDTO.java diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java index bbb71f448b..5c8f90e81e 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/GovLoginServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.dto.form.*; import com.epmet.dto.result.*; import com.epmet.feign.EpmetMessageOpenFeignClient; import com.epmet.feign.EpmetUserFeignClient; +import com.epmet.feign.EpmetUserOpenFeignClient; import com.epmet.feign.GovOrgFeignClient; import com.epmet.jwt.JwtTokenProperties; import com.epmet.jwt.JwtTokenUtils; @@ -62,6 +63,8 @@ public class GovLoginServiceImpl implements GovLoginService { private GovOrgFeignClient govOrgFeignClient; @Autowired private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; + @Autowired + private EpmetUserOpenFeignClient userOpenFeignClient; /** * @param formDTO @@ -297,7 +300,22 @@ public class GovLoginServiceImpl implements GovLoginService { if (userDetails == null) { return; } - List roles = queryGovStaffRoles(staffId, orgId); + + GovStaffRoleFormDTO form = new GovStaffRoleFormDTO(); + form.setRoleIdList(roleIds); + Result> result = userOpenFeignClient.getByIds(form); + if (!result.success()) { + throw new RenException("更新缓存中的角色列表失败:" + result.getInternalMsg()); + } + + List roles = result.getData().stream().map(roleDto -> { + GovTokenDto.Role role = new GovTokenDto.Role(); + role.setRoleName(roleDto.getRoleName()); + role.setRoleKey(roleDto.getRoleKey()); + role.setId(roleDto.getRoleId()); + return role; + }).collect(Collectors.toList()); + userDetails.setRoleList(roles); cpUserDetailRedis.set(userDetails, jwtTokenProperties.getExpire()); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GovStaffRoleFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GovStaffRoleFormDTO.java new file mode 100644 index 0000000000..9d5ae26351 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/GovStaffRoleFormDTO.java @@ -0,0 +1,12 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import java.util.List; + +@Data +public class GovStaffRoleFormDTO { + + private List roleIdList; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java index c8c1848738..d4a09e63cc 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/EpmetUserOpenFeignClient.java @@ -4,12 +4,10 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; +import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.TagCustomerFormDTO; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; -import com.epmet.dto.result.LoginUserDetailsResultDTO; -import com.epmet.dto.result.TagCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.fallback.EpmetUserOpenFeignClientFallback; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PathVariable; @@ -24,6 +22,7 @@ import java.util.List; * @author yinzuomei@elink-cn.com * @date 2020/6/4 13:09 */ +//@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserOpenFeignClientFallback.class, url = "localhost:8087") @FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserOpenFeignClientFallback.class) public interface EpmetUserOpenFeignClient { @@ -72,4 +71,11 @@ public interface EpmetUserOpenFeignClient { @PostMapping("/epmetuser/user/getcustomeridbyuserid") Result getCustomerIdByUserId(@RequestBody TagCustomerFormDTO formDTO); + /** + * 根据角色id列表批量查询角色信息 + * @param form + * @return + */ + @PostMapping("/epmetuser/govstaffrole/getbyids") + Result> getByIds(@RequestBody GovStaffRoleFormDTO form); } diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java index 54c904449e..9f87d6f530 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/feign/fallback/EpmetUserOpenFeignClientFallback.java @@ -5,12 +5,10 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.CustomerStaffDTO; import com.epmet.dto.form.CustomerStaffRoleListFormDTO; +import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.form.LoginUserDetailsFormDTO; import com.epmet.dto.form.TagCustomerFormDTO; -import com.epmet.dto.result.CustomerStaffRoleListResultDTO; -import com.epmet.dto.result.CustomerStaffRoleResultDTO; -import com.epmet.dto.result.LoginUserDetailsResultDTO; -import com.epmet.dto.result.TagCustomerResultDTO; +import com.epmet.dto.result.*; import com.epmet.feign.EpmetUserOpenFeignClient; import org.springframework.stereotype.Component; @@ -50,4 +48,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getCustomerIdByUserId", formDTO); } + @Override + public Result> getByIds(GovStaffRoleFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "getById", form); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java index 8b8ccd1048..38081f88cd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GovStaffRoleController.java @@ -1,17 +1,20 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.RoleDTO; +import com.epmet.dto.form.GovStaffRoleFormDTO; import com.epmet.dto.result.GovStaffRoleResultDTO; import com.epmet.dto.result.GovStaffRoleTemplateDTO; +import com.epmet.entity.GovStaffRoleEntity; import com.epmet.service.GovStaffRoleService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.util.CollectionUtils; +import org.springframework.web.bind.annotation.*; +import java.util.ArrayList; import java.util.List; +import java.util.stream.Collectors; @RequestMapping("govstaffrole") @RestController @@ -40,4 +43,20 @@ public class GovStaffRoleController { List roleTemplates = govStaffRoleService.listRoleTemplates(); return new Result().ok(roleTemplates); } + + /** + * 使用id列表查询角色列表 + * @param form + * @return + */ + @PostMapping("getbyids") + public Result> getByIds(@RequestBody GovStaffRoleFormDTO form) { + List roleDTOS = new ArrayList<>(); + List roleIdList = form.getRoleIdList(); + if (!CollectionUtils.isEmpty(roleIdList)) { + roleDTOS = roleIdList.stream().map(roleId -> govStaffRoleService.getDTOById(roleId)).collect(Collectors.toList()); + } + + return new Result>().ok(roleDTOS); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java index d7562fafad..275a2e9742 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GovStaffRoleDao.java @@ -59,4 +59,6 @@ public interface GovStaffRoleDao extends BaseDao { GovStaffRoleDTO getRoleByCustomerIdAndRoleKey(@Param("customerId") String customerId, @Param("roleKey") String roleKey); List listRolesByCustomer(@Param("customerId") String customerId); + + GovStaffRoleResultDTO getDTOById(@Param("roleId") String roleId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/AuthFeignClient.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/AuthFeignClient.java index dd1ed9ec46..cba4210ee7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/AuthFeignClient.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/feign/AuthFeignClient.java @@ -8,8 +8,8 @@ import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; -@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallback = AuthFeignClientCallback.class, url = "localhost:8081") -//@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallback = AuthFeignClientCallback.class) +//@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallback = AuthFeignClientCallback.class, url = "localhost:8081") +@FeignClient(name = ServiceConstant.EPMET_AUTH_SERVER, fallback = AuthFeignClientCallback.class) public interface AuthFeignClient { /** diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java index 25d6fe495b..1322bf06d1 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GovStaffRoleService.java @@ -125,4 +125,6 @@ public interface GovStaffRoleService extends BaseService { List listRolesByCustomer(String customerId); List listRoleTemplates(); + + GovStaffRoleResultDTO getDTOById(String roleId); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java index 000ea2cd40..6da54b7c69 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GovStaffRoleServiceImpl.java @@ -176,4 +176,9 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl listRoleTemplates() { return govStaffRoleTemplateDao.listValidateRoles(); } + + @Override + public GovStaffRoleResultDTO getDTOById(String roleId) { + return govStaffRoleDao.getDTOById(roleId); + } } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml index aa495b89f5..22f47ce8bc 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml @@ -59,4 +59,13 @@ FROM gov_staff_role r WHERE r.CUSTOMER_ID = #{customerId} + + \ No newline at end of file From 40d3a28be31b13fa2e9152c9f161c49984e97fc8 Mon Sep 17 00:00:00 2001 From: wxz Date: Sun, 28 Jun 2020 18:52:47 +0800 Subject: [PATCH 06/14] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-auth/deploy/docker-compose-dev.yml | 2 +- epmet-auth/pom.xml | 2 +- epmet-user/epmet-user-server/deploy/docker-compose-dev.yml | 2 +- epmet-user/epmet-user-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-auth/deploy/docker-compose-dev.yml b/epmet-auth/deploy/docker-compose-dev.yml index 568dbc652d..3431acda04 100644 --- a/epmet-auth/deploy/docker-compose-dev.yml +++ b/epmet-auth/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-auth-server: container_name: epmet-auth-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.25 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-auth:0.3.26 ports: - "8081:8081" network_mode: host # 使用现有网络 diff --git a/epmet-auth/pom.xml b/epmet-auth/pom.xml index 3c591c3076..4ef8116c0e 100644 --- a/epmet-auth/pom.xml +++ b/epmet-auth/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.25 + 0.3.26 com.epmet epmet-cloud diff --git a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml index 26c2930a6a..62e0f89277 100644 --- a/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml +++ b/epmet-user/epmet-user-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-user-server: container_name: epmet-user-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.64 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-user-server:0.3.65 ports: - "8087:8087" network_mode: host # 不会创建新的网络 diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index 549e4b72db..84957941b8 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.64 + 0.3.65 com.epmet epmet-user From 28bbc622854f2374d18f3f785613e6da0481832e Mon Sep 17 00:00:00 2001 From: jianjun Date: Sun, 28 Jun 2020 19:12:55 +0800 Subject: [PATCH 07/14] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 2478d1b203..3b575eab88 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.8 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.9 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 702c4a4194..880f67c044 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.8 + 0.3.9 data-statistical com.epmet From 0009ef4b8dc4b40cdafa94a568fe9e4e22a62378 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 29 Jun 2020 08:39:54 +0800 Subject: [PATCH 08/14] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 3b575eab88..50cf60444e 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.9 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.10 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 880f67c044..280b7e7c58 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.9 + 0.3.10 data-statistical com.epmet From 4686aafc9e032cf5b4dd928a21d441fe574ef2ce Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 29 Jun 2020 10:42:47 +0800 Subject: [PATCH 09/14] =?UTF-8?q?=E5=9B=A0=E5=88=86=E5=B8=83=E5=BC=8F?= =?UTF-8?q?=E4=BA=8B=E5=8A=A1=E9=97=AE=E9=A2=98=EF=BC=8C=E8=AE=AE=E9=A2=98?= =?UTF-8?q?=E8=BD=AC=E9=A1=B9=E7=9B=AE=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/service/impl/IssueServiceImpl.java | 1 + .../com/epmet/constant/ProjectConstant.java | 5 +++++ .../main/java/com/epmet/dao/ProjectDao.java | 8 ++++++++ .../epmet/service/impl/ProjectServiceImpl.java | 11 +++++++++++ .../src/main/resources/mapper/ProjectDao.xml | 18 ++++++++++++++++++ 5 files changed, 43 insertions(+) diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java index 4ba36d235d..2730d87941 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/service/impl/IssueServiceImpl.java @@ -504,6 +504,7 @@ public class IssueServiceImpl extends BaseServiceImpl imp //3:调用gov-project服务,新增项目各业务表初始数据 Result resultDTO = govProjectFeignClient.issueShiftProject(formDTO); if (!resultDTO.success() || null == resultDTO.getData()) { + logger.error(resultDTO.getInternalMsg()); throw new RenException(IssueConstant.GOV_PRJECT_EXCEPTION); } IssueProjectResultDTO issueProjectResultDTO = resultDTO.getData(); diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java index a2d77e8446..fd8934060a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/constant/ProjectConstant.java @@ -113,4 +113,9 @@ public interface ProjectConstant { * 获取项目节点数据失败 */ String SELECT_process_EXCEPTION = "获取项目节点数据失败"; + /** + * 议题转项目已存在项目数据,不能重复转 + * 议题转项目 项目服务数据入库成功,议题数据更新或发送消息失败导致议题数据可以回滚,项目服务数据不能回滚 + */ + String SAVE_PROJECT_EXCEPTION = "已存在项目数据,不能重复转项目"; } diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java index 3b58c435b7..a45b46bb0a 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/dao/ProjectDao.java @@ -103,4 +103,12 @@ public interface ProjectDao extends BaseDao { * @Description 获取客户下已结案项目列表,按结案时间倒序 **/ List selectClosedProjectList(LatestListFormDTO formDTO); + + /** + * @param projectDTO + * @return + * @Author sun + * @Description 根据客户Id、机关Id、议题Id查询项目数据是否存在 + **/ + List selectProjectList(ProjectDTO projectDTO); } \ No newline at end of file diff --git a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java index 29a964851f..4ec3eacda5 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java +++ b/epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java @@ -467,6 +467,17 @@ public class ProjectServiceImpl extends BaseServiceImpl staffList = formDTO.getStaffList(); IssueDTO issueDTO = formDTO.getIssueDTO(); + //0.因项目还未添加分布式事务,议题转项目,如果项目数据入库成功议题数据也修改成功但是消息发送失败时则议题数据可以回滚但项目服务的数据不能回滚 + //先根据客户Id机关Id议题Id查询项目表是否已存在,存在则说明之前转过切失败了,这样的数据不能再操作了,只能操作数据库,将项目表和项目进展表数据清除 + ProjectDTO projectDTO = new ProjectDTO(); + projectDTO.setCustomerId(issueDTO.getCustomerId()); + projectDTO.setAgencyId(issueDTO.getOrgId()); + projectDTO.setOrigin(ProjectConstant.ISSUE); + projectDTO.setOriginId(issueDTO.getId()); + List listProject = baseDao.selectProjectList(projectDTO); + if (null != listProject && listProject.size() > NumConstant.ZERO) { + throw new RenException(ProjectConstant.SAVE_PROJECT_EXCEPTION); + } //1:调用gov-org服务,获取所有勾选人员以及议题数据对应的组织信息、部门信息、网格信息用于对处理部门和ORG_ID_PATH字段的赋值使用 List agencyIdList = staffList.stream().map(TickStaffFormDTO::getAgencyId).collect(Collectors.toList()); agencyIdList.add(issueDTO.getOrgId()); diff --git a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml index 0dad21111b..548eb53128 100644 --- a/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml +++ b/epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml @@ -165,4 +165,22 @@ ORDER BY p.created_time DESC + + \ No newline at end of file From d28a0813befa05fd3ae8f67a9ae7242f7fe56e79 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 29 Jun 2020 10:49:34 +0800 Subject: [PATCH 10/14] =?UTF-8?q?=E8=AE=AE=E9=A2=98=E3=80=81=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E6=9C=8D=E5=8A=A1=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gov-issue/gov-issue-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-issue/gov-issue-server/pom.xml | 2 +- .../gov-project-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/gov-project/gov-project-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml index e5f9b0eb87..6dcdb4ec76 100644 --- a/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-issue/gov-issue-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-issue-server: container_name: gov-issue-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.44 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-issue-server:0.3.45 ports: - "8101:8101" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index ad883bcc23..c0d4f4e42d 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.44 + 0.3.45 gov-issue com.epmet diff --git a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml index 28f015a3c5..78ebd86001 100644 --- a/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml +++ b/epmet-module/gov-project/gov-project-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: gov-project-server: container_name: gov-project-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.29 + image: 192.168.1.130:10080/epmet-cloud-dev/gov-project-server:0.3.30 ports: - "8102:8102" network_mode: host # 使用现有网络 diff --git a/epmet-module/gov-project/gov-project-server/pom.xml b/epmet-module/gov-project/gov-project-server/pom.xml index a3db2f67a8..3b5472c3e1 100644 --- a/epmet-module/gov-project/gov-project-server/pom.xml +++ b/epmet-module/gov-project/gov-project-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.29 + 0.3.30 gov-project com.epmet From 00ec8e0a0e3fae50534f2cc4af371eefcbd8754b Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 29 Jun 2020 10:59:54 +0800 Subject: [PATCH 11/14] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 50cf60444e..95c949f0f6 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.10 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.11 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 280b7e7c58..81d02ae79b 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.10 + 0.3.11 data-statistical com.epmet From 0f4a434bddc5264f2326f2afb7f59f34d3ada1d6 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 29 Jun 2020 12:25:27 +0800 Subject: [PATCH 12/14] =?UTF-8?q?=E9=99=90=E5=88=B6=E9=92=89=E9=92=89?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=8F=91=E9=80=81=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/dto/form/DingTalkTextMsg.java | 37 ++-- .../tools/filter/LogMsgSendFilter.java | 151 +++++++------- .../tools/utils/DingdingMsgSender.java | 185 ++++++++++++++++++ .../com/epmet/controller/DemoController.java | 12 +- .../src/main/resources/logback-spring.xml | 2 + 5 files changed, 308 insertions(+), 79 deletions(-) create mode 100644 epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingTalkTextMsg.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingTalkTextMsg.java index b548bad87f..4a77d9b7cc 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingTalkTextMsg.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/dto/form/DingTalkTextMsg.java @@ -1,25 +1,32 @@ package com.epmet.commons.tools.dto.form; import com.alibaba.fastjson.JSON; -import lombok.Data; import org.springframework.util.CollectionUtils; +import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; -/** - * desc: 钉钉文本消息参数 实体类 - * date: 2019/2/20 11:00 +/** + * desc: 钉钉文本消息参数 实体类 + * + * @date: 2020/6/29 9:06 * @author: jianjun liu - * email:liujianjun@yunzongnet.com + * email:liujianjun@git.elinkit.com.cn */ -public class DingTalkTextMsg { +public class DingTalkTextMsg implements Serializable { + private static final long serialVersionUID = -3611771312188821915L; /** * 消息接收者 */ - private String receiver; + private String webHook; + + /** + * 密钥 + */ + private String secret; /** * 发送内容 */ @@ -35,12 +42,12 @@ public class DingTalkTextMsg { */ private boolean isAtAll; - public String getReceiver() { - return receiver; + public String getWebHook() { + return webHook; } - public void setReceiver(String receiver) { - this.receiver = receiver; + public void setWebHook(String webHook) { + this.webHook = webHook; } public String getContent() { @@ -67,6 +74,14 @@ public class DingTalkTextMsg { isAtAll = atAll; } + public String getSecret() { + return secret; + } + + public void setSecret(String secret) { + this.secret = secret; + } + public String getMsgContent() { Map items = new HashMap<>(); items.put("msgtype", "text"); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index 826bb05905..4f24fa70d2 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -6,8 +6,9 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.StackTraceElementProxy; import ch.qos.logback.core.spi.FilterReply; -import com.epmet.commons.tools.utils.HttpClientManager; -import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.dto.form.DingTalkTextMsg; +import com.epmet.commons.tools.utils.DingdingMsgSender; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -20,78 +21,96 @@ import java.text.SimpleDateFormat; * @author: jianjun liu */ public class LogMsgSendFilter extends LevelFilter { - private static final Logger logger = LoggerFactory.getLogger(LogMsgSendFilter.class); - @Override - public FilterReply decide(ILoggingEvent event) { - //如果日志级别等于设置的日志级别 则发送消息 - if (event.getLevel().isGreaterOrEqual(Level.ERROR)) { - try { - StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append("【日志告警】\n"); + private static final Logger logger = LoggerFactory.getLogger(LogMsgSendFilter.class); + private DingdingMsgSender msgSender = new DingdingMsgSender(); + private String webHook; + private String secret; - stringBuilder.append("\n"); + @Override + public FilterReply decide(ILoggingEvent event) { + //如果日志级别等于设置的日志级别 则发送消息 + if (event.getLevel().isGreaterOrEqual(Level.ERROR)) { + try { + StringBuilder stringBuilder = new StringBuilder(); + stringBuilder.append("【日志告警】\n"); - stringBuilder.append("告警级别:" + event.getLevel()); - stringBuilder.append("\n"); - stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp())); - stringBuilder.append("\n"); - stringBuilder.append("TraceId:" + Thread.currentThread().getName()); - stringBuilder.append("\n"); - stringBuilder.append("告警信息:" + event.getFormattedMessage()); - stringBuilder.append("\n"); + stringBuilder.append("\n"); - IThrowableProxy throwableProxy = event.getThrowableProxy(); - //异常信息处理 暂时处理一级的5行数据 - apendStackInfo(stringBuilder, throwableProxy); + stringBuilder.append("告警级别:" + event.getLevel()); + stringBuilder.append("\n"); + stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp())); + stringBuilder.append("\n"); + stringBuilder.append("TraceId:" + Thread.currentThread().getName()); + stringBuilder.append("\n"); + stringBuilder.append("告警信息:" + event.getFormattedMessage()); + stringBuilder.append("\n"); - Result flag = HttpClientManager.getInstance().sendAlarmMsg(stringBuilder.toString()); - if (!flag.success()) { - logger.warn("msgSender.sendMsg fail,param:{}", stringBuilder.toString()); - } - } catch (Exception e) { - logger.warn("decide exception", e); - } - } - //交给其他filter继续向下处理 - return super.decide(event); - } + IThrowableProxy throwableProxy = event.getThrowableProxy(); + //异常信息处理 暂时处理一级的5行数据 + apendStackInfo(stringBuilder, throwableProxy); + DingTalkTextMsg msg = new DingTalkTextMsg(); + msg.setContent(stringBuilder.toString()); + if (StringUtils.isNotBlank(webHook)) { + msg.setWebHook(webHook); + } + if (StringUtils.isNotBlank(secret)) { + msg.setSecret(secret); + } + boolean flag = msgSender.sendMsgAsync(msg); + if (!flag) { + logger.warn("msgSender.sendMsg fail,param:{}", stringBuilder.toString()); + } + } catch (Exception e) { + logger.warn("decide exception", e); + } + } + //交给其他filter继续向下处理 + return super.decide(event); + } - private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) { - int defaultRowLine = 5; - if (throwableProxy != null) { - stringBuilder.append("异常信息:") - .append(throwableProxy.getClassName()) - .append(" : ") - .append(throwableProxy.getMessage()) - .append("\n"); + private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) { + int defaultRowLine = 5; + if (throwableProxy != null) { + stringBuilder.append("异常信息:") + .append(throwableProxy.getClassName()) + .append(" : ") + .append(throwableProxy.getMessage()) + .append("\n"); - StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray(); - StackTraceElementProxy stackTraceElementProxy = null; + StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray(); + StackTraceElementProxy stackTraceElementProxy = null; - if (stackTraceElementProxyArray.length < defaultRowLine) { - defaultRowLine = stackTraceElementProxyArray.length; - } - for (int i = 0; i < defaultRowLine; i++) { - stackTraceElementProxy = stackTraceElementProxyArray[i]; - StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement(); - stringBuilder.append("\t\tat "); - stringBuilder.append(stackTraceElement.getClassName()); - stringBuilder.append("."); - stringBuilder.append(stackTraceElement.getMethodName()); - stringBuilder.append("("); - stringBuilder.append(stackTraceElement.getFileName()); - stringBuilder.append(":"); - stringBuilder.append(stackTraceElement.getLineNumber()); - stringBuilder.append(")"); - stringBuilder.append("\n"); - } - } - } + if (stackTraceElementProxyArray.length < defaultRowLine) { + defaultRowLine = stackTraceElementProxyArray.length; + } + for (int i = 0; i < defaultRowLine; i++) { + stackTraceElementProxy = stackTraceElementProxyArray[i]; + StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement(); + stringBuilder.append("\t\tat "); + stringBuilder.append(stackTraceElement.getClassName()); + stringBuilder.append("."); + stringBuilder.append(stackTraceElement.getMethodName()); + stringBuilder.append("("); + stringBuilder.append(stackTraceElement.getFileName()); + stringBuilder.append(":"); + stringBuilder.append(stackTraceElement.getLineNumber()); + stringBuilder.append(")"); + stringBuilder.append("\n"); + } + } + } - private String formatLongTime2Str(long timestamp) { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); - return dateFormat.format(timestamp); - } + private String formatLongTime2Str(long timestamp) { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + return dateFormat.format(timestamp); + } + public void setWebHook(String webHook) { + this.webHook = webHook; + } + + public void setSecret(String secret) { + this.secret = secret; + } } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java new file mode 100644 index 0000000000..40420d1be7 --- /dev/null +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/DingdingMsgSender.java @@ -0,0 +1,185 @@ +package com.epmet.commons.tools.utils; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.tools.dto.form.DingTalkTextMsg; +import com.google.common.cache.Cache; +import com.google.common.cache.CacheBuilder; +import com.google.common.collect.Lists; +import org.apache.commons.codec.binary.Base64; +import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +import javax.annotation.PreDestroy; +import javax.crypto.Mac; +import javax.crypto.spec.SecretKeySpec; +import java.io.IOException; +import java.net.URLEncoder; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; + +/** + * desc: 发送消息工具类 + * + * @date: 2020/6/29 8:43 + * @author: jianjun liu + */ +@Component +public class DingdingMsgSender { + + private final Logger logger = LoggerFactory.getLogger(DingdingMsgSender.class); + //如果不设置则为 开发环境机器人地址 + private static final String webHook = "https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c"; + private static final String secret = "SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19"; + /** + * 默认10 + */ + private static Integer maxQueueSize = 10; + + /** + * 有序队列 + */ + private ArrayBlockingQueue msgQueue = new ArrayBlockingQueue<>(maxQueueSize); + + + private volatile boolean running = false; + + private Cache limitCache = CacheBuilder.newBuilder().expireAfterWrite(1, TimeUnit.MINUTES).maximumSize(1000).build(); + + public DingdingMsgSender() { + + } + + + private void handleMsg() { + DingTalkTextMsg msg = null; + try { + //阻塞取元素 + msg = msgQueue.take(); + if (msg != null) { + AtomicInteger limitCount = limitCache.getIfPresent(msg.getWebHook()); + if (limitCount == null) { + limitCount = new AtomicInteger(1); + limitCache.put(msg.getWebHook(), limitCount); + } + if (limitCount.intValue() > maxQueueSize) { + msgQueue.offer(msg); + Thread.sleep(1000); + } else { + sendPostByJSON(msg); + limitCount.addAndGet(1); + } + } else { + Thread.sleep(1000); + } + } catch (Exception e) { + logger.warn("handleMsg exception,serverUrl:" + msg.getWebHook() + ",msg:" + JSON.toJSONString(msg), e); + } + } + + + /** + * desc:异步发送消息 + * + * @param messageParam + * @return + * @throws IOException + */ + public boolean sendMsgAsync(DingTalkTextMsg messageParam) { + if (!running) { + running = true; + getThread().start(); + } + boolean flag = false; + int currentQueueSize = msgQueue.size(); + //非阻塞 添加/删除元素 + if (currentQueueSize < maxQueueSize) { + flag = msgQueue.offer(messageParam); + } else { + msgQueue.poll(); + + DingTalkTextMsg param = new DingTalkTextMsg(); + param.setContent("待发送消息队列已满,当前队列个数" + msgQueue.size() + "\n" + "最新消息内容:" + JSON.toJSONString(messageParam)); + param.setWebHook(messageParam.getWebHook()); + sendPostByJSON(param); + } + return flag; + } + + /** + * 同步发送报警 + * + * @param messageParam + * @return + * @throws IOException + */ + public Result sendMsgSync(DingTalkTextMsg messageParam) { + return sendPostByJSON(messageParam); + } + + private Thread getThread() { + Thread sendMsgThread = new Thread("MsgSender-Thread") { + @Override + public void run() { + while (running) { + handleMsg(); + } + } + }; + return sendMsgThread; + } + + + @PreDestroy + public void destroy() { + running = false; + } + + /** + * 发送POST 请求 + * + * @param param 请求参数,JSON格式 + * @return + */ + private Result sendPostByJSON(DingTalkTextMsg param) { + if (StringUtils.isBlank(param.getWebHook())) { + param.setWebHook(webHook); + } + if (StringUtils.isBlank(param.getSecret())) { + param.setSecret(secret); + } + Result result = new Result().error(); + Long timestamp = System.currentTimeMillis(); + try { + String stringToSign = timestamp + "\n" + param.getSecret(); + Mac mac = Mac.getInstance("HmacSHA256"); + mac.init(new SecretKeySpec(param.getSecret().getBytes("UTF-8"), "HmacSHA256")); + byte[] signData = mac.doFinal(stringToSign.getBytes("UTF-8")); + String sign = URLEncoder.encode(new String(Base64.encodeBase64(signData)), "UTF-8"); + String url = param.getWebHook(); + url = url.concat("×tamp=" + timestamp + "&sign=" + sign); + String jsonStrParam = param.getMsgContent(); + result = HttpClientManager.getInstance().sendPostByJSON(url, jsonStrParam); + } catch (Exception e) { + logger.warn("sendPostByJSON error", e); + } + return result; + } + + + public static void main(String[] args) { + for (int i = 0; i < 50; i++) { + + DingTalkTextMsg dingTalkTextMsg = new DingTalkTextMsg(); + dingTalkTextMsg.setWebHook(""); + dingTalkTextMsg.setContent("测试消息" + i); + dingTalkTextMsg.setAtMobiles(Lists.newArrayList()); + dingTalkTextMsg.setAtAll(false); + dingTalkTextMsg.setSecret(""); + DingdingMsgSender msgSender = new DingdingMsgSender(); + msgSender.sendMsgAsync(dingTalkTextMsg); + } + } +} 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 2f6e7ac226..5f562630dc 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 @@ -2,20 +2,21 @@ package com.epmet.controller; import com.epmet.dto.AgencySubTreeDto; import com.epmet.service.StatsDemoService; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.time.LocalDateTime; +import java.util.List; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; -import java.util.List; - @RequestMapping("demo") @RestController +@Slf4j public class DemoController { @Autowired @@ -24,6 +25,13 @@ public class DemoController { @Autowired private ExecutorService executorService; + @GetMapping("testAlarm") + public void testAlarm() { + for (int i = 0; i < 20; i++) { + log.error("测试消息"+i); + } + } + @GetMapping("testtx") public void testTx() { demoService.testTx(); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml index 148588bffb..fb3deaefb1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml @@ -130,6 +130,8 @@ ERROR ACCEPT DENY + https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c + SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19 From 7d44e82efcf6b9190ae87ec719b6fd865214f173 Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 29 Jun 2020 12:58:39 +0800 Subject: [PATCH 13/14] =?UTF-8?q?job=E6=9C=8D=E5=8A=A1=E3=80=81=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=9C=8D=E5=8A=A1=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- .../epmet-job/epmet-job-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/epmet-job/epmet-job-server/pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index 95c949f0f6..fb1cd42576 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.11 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.12 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 81d02ae79b..756bb24d61 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.11 + 0.3.12 data-statistical com.epmet diff --git a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml index 1aa3f41622..9f45cdc9e8 100644 --- a/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml +++ b/epmet-module/epmet-job/epmet-job-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: epmet-job-server: container_name: epmet-job-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/epmet-job-server:0.3.12 + image: 192.168.1.130:10080/epmet-cloud-dev/epmet-job-server:0.3.13 ports: - "8084:8084" network_mode: host # 使用现有网络 diff --git a/epmet-module/epmet-job/epmet-job-server/pom.xml b/epmet-module/epmet-job/epmet-job-server/pom.xml index a7130ca254..d08f27704a 100644 --- a/epmet-module/epmet-job/epmet-job-server/pom.xml +++ b/epmet-module/epmet-job/epmet-job-server/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - 0.3.12 + 0.3.13 com.epmet epmet-job From 7defc80549052eb4f74113e6a9a68b18f46e1b1a Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 29 Jun 2020 14:32:15 +0800 Subject: [PATCH 14/14] =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=8F=B7+1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data-statistical-server/deploy/docker-compose-dev.yml | 2 +- epmet-module/data-statistical/data-statistical-server/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml index fb1cd42576..8f836f39b1 100644 --- a/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml +++ b/epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-dev.yml @@ -2,7 +2,7 @@ version: "3.7" services: data-statistical-server: container_name: data-statistical-server-dev - image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.12 + image: 192.168.1.130:10080/epmet-cloud-dev/data-statistical-server:0.3.13 ports: - "8108:8108" network_mode: host # 使用现有网络 diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index 756bb24d61..3c2cbaf611 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -2,7 +2,7 @@ - 0.3.12 + 0.3.13 data-statistical com.epmet