From 1ec667b71ad8426475d70e6fec83c350a4582b4e Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 6 Jan 2021 17:36:27 +0800 Subject: [PATCH 01/25] =?UTF-8?q?=E5=BC=95=E5=85=A5Rocketmq=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=AE=A2=E6=88=B7=E5=88=9D=E5=A7=8B=E5=8C=96=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=EF=BC=8C=E4=BD=BF=E7=94=A8rocketmq=E5=8F=91=E9=80=81?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E5=AE=8C=E6=88=90=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-rocketmq/pom.xml | 21 +++ .../constants/ConsomerGroupConstants.java | 21 +++ .../rocketmq/constants/TopicConstants.java | 5 + .../rocketmq/messages/InitCustomerMQMsg.java | 148 ++++++++++++++++++ .../tools/exception/EpmetErrorCode.java | 1 + epmet-commons/pom.xml | 1 + .../constant/SystemMessageSendApproach.java | 7 + .../com/epmet/constant/SystemMessageType.java | 13 ++ .../com/epmet/dto/form/SystemMsgFormDTO.java | 15 ++ .../feign/EpmetMessageOpenFeignClient.java | 10 ++ .../EpmetMessageOpenFeignClientFallback.java | 6 + .../epmet-message-server/pom.xml | 7 + .../controller/SystemMessageController.java | 27 ++++ .../java/com/epmet/dao/SystemMessageDao.java | 33 ++++ .../com/epmet/entity/SystemMessageEntity.java | 57 +++++++ .../epmet/service/SystemMessageService.java | 7 + .../impl/SystemMessageServiceImpl.java | 70 +++++++++ .../src/main/resources/bootstrap.yml | 7 +- .../resources/mapper/SystemMessageDao.xml | 18 +++ epmet-module/gov-org/gov-org-server/pom.xml | 6 + .../mq/listener/InitCustomerOrgListener.java | 76 +++++++++ .../src/main/resources/bootstrap.yml | 5 +- epmet-module/oper-crm/oper-crm-server/pom.xml | 12 ++ .../service/impl/CustomerServiceImpl.java | 124 ++++++++++----- .../oper-customize-server/pom.xml | 7 + .../InitCustomerCustomizeListener.java | 43 +++++ .../src/main/resources/bootstrap.yml | 5 +- epmet-user/epmet-user-server/pom.xml | 6 + .../listener/InitCustomerRolesListener.java | 39 +++++ .../src/main/resources/bootstrap.yml | 5 +- 30 files changed, 756 insertions(+), 46 deletions(-) create mode 100644 epmet-commons/epmet-commons-rocketmq/pom.xml create mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java create mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java create mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/InitCustomerMQMsg.java create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageSendApproach.java create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java create mode 100644 epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SystemMessageController.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/SystemMessageDao.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SystemMessageEntity.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SystemMessageService.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java create mode 100644 epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/SystemMessageDao.xml create mode 100644 epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java create mode 100644 epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java diff --git a/epmet-commons/epmet-commons-rocketmq/pom.xml b/epmet-commons/epmet-commons-rocketmq/pom.xml new file mode 100644 index 0000000000..41ee2e97e1 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/pom.xml @@ -0,0 +1,21 @@ + + + + epmet-commons + com.epmet + 2.0.0 + + 4.0.0 + + epmet-commons-rocketmq + + + + org.apache.rocketmq + rocketmq-spring-boot-starter + 2.1.1 + + + \ No newline at end of file diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java new file mode 100644 index 0000000000..0bcf7d4aa6 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java @@ -0,0 +1,21 @@ +package com.epmet.commons.rocketmq.constants; + +/** + * 消费者组常量 + */ +public interface ConsomerGroupConstants { + + /** + * 初始化客户角色消费者组 + */ + String INIT_CUSTOMER_ROLES_GROUP = "init_customer_roles_group"; + /** + * 初始化客户自定义消费者组 + */ + String INIT_CUSTOMER_CUSTOMIZE_GROUP = "init_customer_customize_group"; + /** + * 初始化客户组织机构信息分组 + */ + String INIT_CUSTOMER_ORG_GROUP = "init_customer_org_group"; + +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java new file mode 100644 index 0000000000..d95a829b8f --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java @@ -0,0 +1,5 @@ +package com.epmet.commons.rocketmq.constants; + +public interface TopicConstants { + String INIT_CUSTOMER = "init_customer_topic"; +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/InitCustomerMQMsg.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/InitCustomerMQMsg.java new file mode 100644 index 0000000000..104d77581c --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/InitCustomerMQMsg.java @@ -0,0 +1,148 @@ +package com.epmet.commons.rocketmq.messages; + +public class InitCustomerMQMsg { + + private String customerId; + + private InitCustomerAgency agency; + + private InitCustomerStaff staff; + + public static class InitCustomerStaff { + private String agencyId; + private Integer gender; + private String mobile; + private String name; + private String workType; + + public String getAgencyId() { + return agencyId; + } + + public void setAgencyId(String agencyId) { + this.agencyId = agencyId; + } + + public Integer getGender() { + return gender; + } + + public void setGender(Integer gender) { + this.gender = gender; + } + + public String getMobile() { + return mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getWorkType() { + return workType; + } + + public void setWorkType(String workType) { + this.workType = workType; + } + } + + public static class InitCustomerAgency { + private String agencyId; + private String organizationName; + private String level; + private String areaCode; + private String province; + private String city; + private String district; + + public String getAgencyId() { + return agencyId; + } + + public void setAgencyId(String agencyId) { + this.agencyId = agencyId; + } + + public String getOrganizationName() { + return organizationName; + } + + public void setOrganizationName(String organizationName) { + this.organizationName = organizationName; + } + + public String getLevel() { + return level; + } + + public void setLevel(String level) { + this.level = level; + } + + public String getAreaCode() { + return areaCode; + } + + public void setAreaCode(String areaCode) { + this.areaCode = areaCode; + } + + public String getProvince() { + return province; + } + + public void setProvince(String province) { + this.province = province; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getDistrict() { + return district; + } + + public void setDistrict(String district) { + this.district = district; + } + } + + public String getCustomerId() { + return customerId; + } + + public void setCustomerId(String customerId) { + this.customerId = customerId; + } + + public InitCustomerAgency getAgency() { + return agency; + } + + public void setAgency(InitCustomerAgency agency) { + this.agency = agency; + } + + public InitCustomerStaff getStaff() { + return staff; + } + + public void setStaff(InitCustomerStaff staff) { + this.staff = staff; + } +} 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 4d3c107de3..e3a02b4696 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 @@ -20,6 +20,7 @@ public enum EpmetErrorCode { ERR10006(10006, "登录超时,请重新登录"), ERR10007(10007, "当前帐号已在别处登录"), ERR10019(10019, "验证码不正确"), + SYSTEM_MQ_MSG_SEND_FAIL(10020, "MQ消息发送失败"), ERR401(401, "未授权"), INTERNAL_VALIDATE_ERROR(7000, "内部数据校验异常"), SERVER_ERROR(8000, "服务器开小差了..."), diff --git a/epmet-commons/pom.xml b/epmet-commons/pom.xml index d4b8e270b4..0bf8dd9c9f 100644 --- a/epmet-commons/pom.xml +++ b/epmet-commons/pom.xml @@ -23,6 +23,7 @@ epmet-commons-tools-wx-mp epmet-commons-service-call epmet-commons-extapp-auth + epmet-commons-rocketmq diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageSendApproach.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageSendApproach.java new file mode 100644 index 0000000000..7406175d87 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageSendApproach.java @@ -0,0 +1,7 @@ +package com.epmet.constant; + +public interface SystemMessageSendApproach { + + String MQ = "mq"; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java new file mode 100644 index 0000000000..382b96e275 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java @@ -0,0 +1,13 @@ +package com.epmet.constant; + +/** + * 系统消息类型 + */ +public interface SystemMessageType { + + /** + * 初始化客户 + */ + String INIT_CUSTOMER = "init_customer"; + +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java new file mode 100644 index 0000000000..c0fc9308b8 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/dto/form/SystemMsgFormDTO.java @@ -0,0 +1,15 @@ +package com.epmet.dto.form; + +import lombok.Data; + +import javax.validation.constraints.NotNull; + +@Data +public class SystemMsgFormDTO { + + @NotNull(message = "消息类型不能为空") + private String messageType; + + @NotNull(message = "消息内容不能为空") + private Object content; +} diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java index 1035ab1552..3a72c53a54 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/EpmetMessageOpenFeignClient.java @@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.SysSmsDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; @@ -77,4 +78,13 @@ public interface EpmetMessageOpenFeignClient { **/ @PostMapping(value = "message/wxmpmessage/sendwxsubscribemessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE) Result sendWxSubscribeMessage(List msgList); + + /** + * @Description 通过mq发送系统消息 + * @return + * @author wxz + * @date 2021.01.06 15:16 + */ + @PostMapping("/message/system/send-by-mq") + Result sendSystemMsgByMQ(@RequestBody SystemMsgFormDTO form); } diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java index 889569147f..915c16ff61 100644 --- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java +++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/feign/fallback/EpmetMessageOpenFeignClientFallback.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.ModuleUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.SysSmsDTO; import com.epmet.dto.form.SendVerificationCodeFormDTO; +import com.epmet.dto.form.SystemMsgFormDTO; import com.epmet.dto.form.UserMessageFormDTO; import com.epmet.dto.form.WxSubscribeMessageFormDTO; import com.epmet.dto.result.SendVerificationCodeResultDTO; @@ -51,4 +52,9 @@ public class EpmetMessageOpenFeignClientFallback implements EpmetMessageOpenFeig public Result sendWxSubscribeMessage(List msgList) { return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendWxSubscribeMessage", msgList); } + + @Override + public Result sendSystemMsgByMQ(SystemMsgFormDTO form) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_MESSAGE_SERVER, "sendSystemMsgByMQ", form); + } } diff --git a/epmet-module/epmet-message/epmet-message-server/pom.xml b/epmet-module/epmet-message/epmet-message-server/pom.xml index 6a10b4724d..43c2cd1311 100644 --- a/epmet-module/epmet-message/epmet-message-server/pom.xml +++ b/epmet-module/epmet-message/epmet-message-server/pom.xml @@ -112,6 +112,13 @@ 2.0.0 compile + + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SystemMessageController.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SystemMessageController.java new file mode 100644 index 0000000000..7a31e91785 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/controller/SystemMessageController.java @@ -0,0 +1,27 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.form.SystemMsgFormDTO; +import com.epmet.service.SystemMessageService; +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; + +@RestController +@RequestMapping("system") +public class SystemMessageController { + + @Autowired + private SystemMessageService systemMessageService; + + @PostMapping("send-by-mq") + public Result sendSystemMsgByMQ(@RequestBody SystemMsgFormDTO form) { + ValidatorUtils.validateEntity(form); + systemMessageService.sendMQMessage(form.getMessageType(), form.getContent()); + return new Result(); + } + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/SystemMessageDao.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/SystemMessageDao.java new file mode 100644 index 0000000000..7770c58547 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/dao/SystemMessageDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.SystemMessageEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 系统消息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-01-06 + */ +@Mapper +public interface SystemMessageDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SystemMessageEntity.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SystemMessageEntity.java new file mode 100644 index 0000000000..effdb2d59b --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/entity/SystemMessageEntity.java @@ -0,0 +1,57 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.omg.CORBA.StringHolder; + +import java.util.Date; + +/** + * 系统消息表 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2021-01-06 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("system_message") +public class SystemMessageEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 消息类型 + */ + private String msgType; + + /** + * 发送途径 + */ + private String sendApproach; + + /** + * 消息内容 + */ + private String content; + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SystemMessageService.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SystemMessageService.java new file mode 100644 index 0000000000..2985b550c9 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/SystemMessageService.java @@ -0,0 +1,7 @@ +package com.epmet.service; + +public interface SystemMessageService { + + void sendMQMessage(String messageType, Object content); + +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java new file mode 100644 index 0000000000..64a067af56 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java @@ -0,0 +1,70 @@ +package com.epmet.service.impl; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.tools.exception.EpmetErrorCode; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; +import com.epmet.constant.SystemMessageSendApproach; +import com.epmet.constant.SystemMessageType; +import com.epmet.dao.SystemMessageDao; +import com.epmet.entity.SystemMessageEntity; +import com.epmet.service.SystemMessageService; +import org.apache.rocketmq.common.message.Message; +import org.apache.rocketmq.remoting.common.RemotingHelper; +import org.apache.rocketmq.spring.core.RocketMQTemplate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +public class SystemMessageServiceImpl implements SystemMessageService { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private SystemMessageDao systemMessageDao; + + @Autowired + private RocketMQTemplate rocketMQTemplate; + + @Transactional(rollbackFor = Exception.class) + @Override + public void sendMQMessage(String messageType, Object content) { + String contentStr = JSON.toJSONString(content); + //存储消息到表 + SystemMessageEntity systemMessageEntity = new SystemMessageEntity(); + systemMessageEntity.setMsgType(messageType); + systemMessageEntity.setSendApproach(SystemMessageSendApproach.MQ); + systemMessageEntity.setContent(contentStr); + systemMessageDao.insert(systemMessageEntity); + + //发送mq消息 + try { + Message meMessage = new Message(getTopicByMsgType(messageType), contentStr.getBytes(RemotingHelper.DEFAULT_CHARSET)); + rocketMQTemplate.getProducer().send(meMessage); + } catch (Exception e) { + String errorStackTrace = ExceptionUtils.getErrorStackTrace(e); + logger.error("发送系统消息失败,堆栈信息:{}", errorStackTrace); + throw new RenException(EpmetErrorCode.SYSTEM_MQ_MSG_SEND_FAIL.getCode()); + } + } + + /** + * @Description 根据消息类型获取topic + * @return + * @author wxz + * @date 2021.01.06 13:42 + */ + private String getTopicByMsgType(String msgType) { + String topic = null; + switch (msgType) { + case SystemMessageType.INIT_CUSTOMER: + topic = TopicConstants.INIT_CUSTOMER; + break; + } + return topic; + } +} diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml index dcdcaab913..bf7f1e23fe 100644 --- a/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/bootstrap.yml @@ -131,4 +131,9 @@ thread: dingTalk: robot: webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ \ No newline at end of file + secret: @dingTalk.robot.secret@ + +rocketmq: + name-server: 192.168.1.130:9876;192.168.1.132:9876 + producer: + group: epmet_message \ No newline at end of file diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/SystemMessageDao.xml b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/SystemMessageDao.xml new file mode 100644 index 0000000000..a5ce6d9da5 --- /dev/null +++ b/epmet-module/epmet-message/epmet-message-server/src/main/resources/mapper/SystemMessageDao.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index aa5fe041a6..9c69a57101 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -95,6 +95,12 @@ 2.0.0 compile + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java new file mode 100644 index 0000000000..47e04307ec --- /dev/null +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java @@ -0,0 +1,76 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.constant.UserWorkType; +import com.epmet.dto.CustomerAgencyDTO; +import com.epmet.dto.form.AddAgencyAndStaffFormDTO; +import com.epmet.dto.form.AdminStaffFromDTO; +import com.epmet.service.AgencyService; +import org.apache.rocketmq.common.message.MessageExt; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 监听初始化客户动作,为客户初始化角色列表 + */ +@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, + consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ORG_GROUP, + messageModel = MessageModel.CLUSTERING, + selectorExpression = "*") +@Component +public class InitCustomerOrgListener implements RocketMQListener { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private AgencyService agencyService; + + @Override + public void onMessage(MessageExt messageExt) { + String msg = new String(messageExt.getBody()); + logger.info("初始化客户-初始化组织信息-收到消息内容:{}", msg); + InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); + agencyService.saveRootAgency(constructRootAndAgencyDTO(msgObj)); + } + + /** + * @Description 构造dto + * @return + * @author wxz + * @date 2021.01.06 15:03 + */ + private AddAgencyAndStaffFormDTO constructRootAndAgencyDTO(InitCustomerMQMsg msgObj) { + AddAgencyAndStaffFormDTO agencyAndStaff = new AddAgencyAndStaffFormDTO(); + //客户组织信息 + CustomerAgencyDTO agencyDTO = new CustomerAgencyDTO(); + agencyDTO.setId(msgObj.getAgency().getAgencyId()); + agencyDTO.setCustomerId(msgObj.getCustomerId()); + agencyDTO.setOrganizationName(msgObj.getAgency().getOrganizationName()); + agencyDTO.setLevel(msgObj.getAgency().getLevel()); + agencyDTO.setAreaCode(msgObj.getAgency().getAreaCode()); + agencyDTO.setProvince(msgObj.getAgency().getProvince()); + agencyDTO.setCity(msgObj.getAgency().getCity()); + agencyDTO.setDistrict(msgObj.getAgency().getDistrict()); + agencyAndStaff.setAgencyDTO(agencyDTO); + + //客户管理员信息 + AdminStaffFromDTO staffSubmitFrom = new AdminStaffFromDTO(); + staffSubmitFrom.setCustomerId(msgObj.getCustomerId()); + staffSubmitFrom.setAgencyId(msgObj.getStaff().getAgencyId()); + staffSubmitFrom.setGender(msgObj.getStaff().getGender()); + staffSubmitFrom.setMobile(msgObj.getStaff().getMobile()); + staffSubmitFrom.setName(msgObj.getStaff().getName()); + staffSubmitFrom.setWorkType(UserWorkType.FULL_TIME); + agencyAndStaff.setStaffDTO(staffSubmitFrom); + + return agencyAndStaff; + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml index 8651e49ce2..c7410e4c71 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml @@ -135,4 +135,7 @@ pagehelper: dingTalk: robot: webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ \ No newline at end of file + secret: @dingTalk.robot.secret@ + +rocketmq: + name-server: 192.168.1.130:9876;192.168.1.132:9876 \ No newline at end of file diff --git a/epmet-module/oper-crm/oper-crm-server/pom.xml b/epmet-module/oper-crm/oper-crm-server/pom.xml index 1ee199269a..610cdd9734 100644 --- a/epmet-module/oper-crm/oper-crm-server/pom.xml +++ b/epmet-module/oper-crm/oper-crm-server/pom.xml @@ -87,6 +87,18 @@ 2.0.0 compile + + + com.epmet + epmet-message-client + 2.0.0 + + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + diff --git a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java index 9857f910c5..9080d1573f 100644 --- a/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java +++ b/epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/service/impl/CustomerServiceImpl.java @@ -22,6 +22,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; import com.epmet.commons.tools.constant.FieldConstant; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.exception.EpmetErrorCode; @@ -32,6 +33,7 @@ import com.epmet.commons.tools.utils.HttpClientManager; import com.epmet.commons.tools.utils.Result; import com.epmet.constant.ModuleConstant; import com.epmet.constant.RoleKeyConstants; +import com.epmet.constant.SystemMessageType; import com.epmet.constant.UserWorkType; import com.epmet.dao.CustomerDao; import com.epmet.dto.*; @@ -80,6 +82,8 @@ public class CustomerServiceImpl extends BaseServiceImpl page(Map params) { @@ -468,48 +472,62 @@ public class CustomerServiceImpl extends BaseServiceImpl getAllList() { List list = baseDao.getAllList(); diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index a36f6d46d1..636e2cc3b3 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -70,6 +70,13 @@ 2.0.0 compile + + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java new file mode 100644 index 0000000000..c4239a7a47 --- /dev/null +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java @@ -0,0 +1,43 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.dto.CustomerHomeDTO; +import com.epmet.service.CustomerHomeService; +import org.apache.rocketmq.common.message.MessageExt; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 监听初始化客户动作,为客户初始化角色列表 + */ +@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, + consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_CUSTOMIZE_GROUP, + messageModel = MessageModel.CLUSTERING, + selectorExpression = "*") +@Component +public class InitCustomerCustomizeListener implements RocketMQListener { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private CustomerHomeService customerHomeService; + + @Override + public void onMessage(MessageExt messageExt) { + String msg = new String(messageExt.getBody()); + logger.info("初始化客户-初始化客户自定义信息-收到消息内容:{}", msg); + InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); + + CustomerHomeDTO customerHomeDTO = new CustomerHomeDTO(); + customerHomeDTO.setCustomerId(msgObj.getCustomerId()); + customerHomeService.init(customerHomeDTO); + } +} \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml index b6cb0ffbb8..093896fc57 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml @@ -122,4 +122,7 @@ pagehelper: dingTalk: robot: webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ \ No newline at end of file + secret: @dingTalk.robot.secret@ + +rocketmq: + name-server: 192.168.1.130:9876;192.168.1.132:9876 \ No newline at end of file diff --git a/epmet-user/epmet-user-server/pom.xml b/epmet-user/epmet-user-server/pom.xml index d3d04f835d..5da0332708 100644 --- a/epmet-user/epmet-user-server/pom.xml +++ b/epmet-user/epmet-user-server/pom.xml @@ -100,6 +100,12 @@ 2.0.0 compile + + + com.epmet + epmet-commons-rocketmq + 2.0.0 + diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java new file mode 100644 index 0000000000..34dd589b80 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java @@ -0,0 +1,39 @@ +package com.epmet.mq.listener; + +import com.alibaba.fastjson.JSON; +import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.service.GovStaffRoleService; +import org.apache.rocketmq.common.message.MessageExt; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 监听初始化客户动作,为客户初始化角色列表 + */ +@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, + consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ROLES_GROUP, + messageModel = MessageModel.CLUSTERING, + selectorExpression = "*") +@Component +public class InitCustomerRolesListener implements RocketMQListener { + + private Logger logger = LoggerFactory.getLogger(getClass()); + + @Autowired + private GovStaffRoleService govStaffRoleService; + + @Override + public void onMessage(MessageExt messageExt) { + String msg = new String(messageExt.getBody()); + logger.info("初始化客户-初始化角色列表-收到消息内容:{}", msg); + InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); + govStaffRoleService.initGovStaffRolesForCustomer(msgObj.getCustomerId()); + } +} diff --git a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml index 380e974475..663515b101 100644 --- a/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml +++ b/epmet-user/epmet-user-server/src/main/resources/bootstrap.yml @@ -144,4 +144,7 @@ openapi: dingTalk: robot: webHook: @dingTalk.robot.webHook@ - secret: @dingTalk.robot.secret@ \ No newline at end of file + secret: @dingTalk.robot.secret@ + +rocketmq: + name-server: 192.168.1.130:9876;192.168.1.132:9876 \ No newline at end of file From 9c17111caae20d17b17e9d6f904e15a8ea14ae6b Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 6 Jan 2021 18:01:52 +0800 Subject: [PATCH 02/25] =?UTF-8?q?=E4=B8=BA=E5=AE=A2=E6=88=B7=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E8=A7=92=E8=89=B2=E4=BF=A1=E6=81=AF=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=B7=B2=E5=AD=98=E5=9C=A8=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dao/GovStaffRoleDao.java | 2 ++ .../epmet/service/impl/GovStaffRoleServiceImpl.java | 11 ++++++++++- .../src/main/resources/mapper/GovStaffRoleDao.xml | 6 ++++++ 3 files changed, 18 insertions(+), 1 deletion(-) 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 f7875d63d5..5992dfb720 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 @@ -77,4 +77,6 @@ public interface GovStaffRoleDao extends BaseDao { int updateSortById(@Param("roleId") String roleId, @Param("sort") int sort); List listRolesByRoleKey(@Param("roleKey") String roleKey); + + Integer countRolesByCustomerId(@Param("customerId") String customerId); } \ 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 726be2370d..16c6a375e2 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 @@ -39,6 +39,8 @@ import com.epmet.feign.GovAccessFeignClient; import com.epmet.redis.GovStaffRoleRedis; import com.epmet.service.GovStaffRoleService; import org.apache.commons.lang3.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -57,6 +59,8 @@ import java.util.Map; @Service public class GovStaffRoleServiceImpl extends BaseServiceImpl implements GovStaffRoleService { + private Logger logger = LoggerFactory.getLogger(getClass()); + @Autowired private GovStaffRoleRedis govStaffRoleRedis; @@ -140,8 +144,13 @@ public class GovStaffRoleServiceImpl extends BaseServiceImpl 0) { + logger.info("为客户初始化角色列表-该客户【客户ID:%s】已存在角色信息,无需再次初始化。", customerId); + return; + } // 增加角色列表 List validRoles = govStaffRoleTemplateDao.listValidateRoles(); 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 40539c565f..87a5fc01e7 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 @@ -111,4 +111,10 @@ where gsr.ROLE_KEY = #{roleKey} and gsr.DEL_FLAG=0 + + \ No newline at end of file From 2bc2167f0bb3b7924939402a79969c3b26fe750e Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 11 Jan 2021 14:04:56 +0800 Subject: [PATCH 03/25] =?UTF-8?q?=E5=A4=84=E7=90=86=E3=80=90=E5=85=9A?= =?UTF-8?q?=E5=91=98=E5=BB=BA=E7=BE=A4=E6=95=B0=EF=BC=8C=E7=BE=A4=E6=88=90?= =?UTF-8?q?=E5=91=98=E6=95=B0=E3=80=91=E4=B8=8D=E7=94=A8=E6=8C=89=E7=85=A7?= =?UTF-8?q?=E6=9C=88=E4=BB=BD=E6=8A=BD=E5=8F=96=20=E8=BF=99=E9=87=8C?= =?UTF-8?q?=E6=8C=87=E7=9A=84=E6=98=AF=E6=80=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/FactOriginGroupMainDailyDao.java | 9 ++-- .../FactOriginGroupMainDailyService.java | 5 +-- .../FactOriginGroupMainDailyServiceImpl.java | 11 +++-- .../toscreen/impl/PartyGuideServiceImpl.java | 43 +++++++++---------- .../extract/FactOriginGroupMainDailyDao.xml | 5 +-- 5 files changed, 32 insertions(+), 41 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java index 12e6151f3f..911d8b7993 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/extract/FactOriginGroupMainDailyDao.java @@ -18,13 +18,11 @@ package com.epmet.dao.evaluationindex.extract; import com.epmet.commons.mybatis.dao.BaseDao; -import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; -import com.epmet.dto.extract.result.OrgStatisticsResultDTO; -import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.GridHeartedFormDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.PartyCreateGroupCountResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; @@ -164,12 +162,11 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("gridIds") List gridIds); + List selectPartyCreateGroupInfo(@Param("customerId") String customerId, @Param("gridIds") List gridIds); /** * desc: 获取所有网格的组中成员人数 去重 @@ -202,4 +199,4 @@ public interface FactOriginGroupMainDailyDao extends BaseDao selectOrgGroupCount(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("level") String level); -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java index c9a74e31b8..730acde2c8 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/FactOriginGroupMainDailyService.java @@ -68,12 +68,11 @@ public interface FactOriginGroupMainDailyService extends BaseService selectPartyCreateGroupInfo(String customerId, String monthId, List gridIds); + List selectPartyCreateGroupInfo(String customerId, List gridIds); /** * desc: 获取客户下每个网格小组内的 去重人数 @@ -106,4 +105,4 @@ public interface FactOriginGroupMainDailyService extends BaseService */ List getOrgGroupCount(String customerId, String monthId, String level); -} \ No newline at end of file +} diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java index ab3efce8b4..83195d9902 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java @@ -21,8 +21,8 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.dao.evaluationindex.extract.FactOriginGroupMainDailyDao; import com.epmet.dto.extract.FactOriginGroupMainDailyDTO; import com.epmet.dto.extract.form.ScreenPartyLinkMassesDataFormDTO; -import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.extract.result.GridGroupUserCountResultDTO; +import com.epmet.dto.extract.result.OrgStatisticsResultDTO; import com.epmet.dto.group.result.ExtractGroupMemberActionRecordResultDTO; import com.epmet.entity.evaluationindex.extract.FactOriginGroupMainDailyEntity; import com.epmet.service.evaluationindex.extract.todata.FactOriginGroupMainDailyService; @@ -106,16 +106,15 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl selectPartyCreateGroupInfo(String customerId, String monthId, List gridIds) { + public List selectPartyCreateGroupInfo(String customerId, List gridIds) { if (!CollectionUtils.isEmpty(gridIds)) { - return baseDao.selectPartyCreateGroupInfo(customerId, monthId, gridIds); + return baseDao.selectPartyCreateGroupInfo(customerId, gridIds); } return new ArrayList<>(); } @@ -135,4 +134,4 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl orgIds = agencyIdList.stream().map(m -> m.getAgencyId()).collect(Collectors.toList()); - if (isGrid == true){ + List orgIds = agencyIdList.stream().map(CustomerAgencyInfoResultDTO::getAgencyId).collect(Collectors.toList()); + if (isGrid) { agencyIdList.forEach(agency -> { // 计算社区级别的下级(实际就是网格) - GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, monthId, agency); + GridPartyGuideDTO gridPartyGuideDTO = communityLevelSubGrid(customerId, agency); orgIds.addAll(gridPartyGuideDTO.getOrgIds()); result.addAll(gridPartyGuideDTO.getResult()); }); // 根据agencyId分组,计算各个社区的 Map> groupByAgency = result.stream().collect(Collectors.groupingBy(ScreenPartyLinkMassesDataFormDTO::getParentId)); - groupByAgency.forEach((agencyId,gridList) -> { + groupByAgency.forEach((agencyId, gridList) -> { ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO(); List orgNameAgencyList = agencyService.selectOrgNameAgency(orgIds); if (!CollectionUtils.isEmpty(orgNameAgencyList)){ orgNameAgencyList.forEach(name -> { - if (agencyId.equals(name.getAgencyId())){ + if (agencyId.equals(name.getAgencyId())) { form.setOrgName(name.getAgencyName()); form.setParentId(name.getParentId()); } @@ -210,8 +208,8 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setCustomerId(customerId); form.setDataEndTime(monthId); form.setOrgType(ScreenConstant.AGENCY); - form.setCreateGroupTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal))); - form.setGroupUserTotal(gridList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal))); + form.setCreateGroupTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum()); + form.setGroupUserTotal(gridList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum()); result.add(form); }); delAndInsertLink(result,customerId,monthId,orgIds); @@ -227,15 +225,15 @@ public class PartyGuideServiceImpl implements PartyGuideService { } }); // 不为空 存在直属网格 - if (!CollectionUtils.isEmpty(disGridIds)){ + if (!CollectionUtils.isEmpty(disGridIds)) { List gridResult = new ArrayList<>(); // 查询党员创建组,组内成员数 - List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds); - List orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList())); - if (!CollectionUtils.isEmpty(partyLinkMassesDataList)){ + List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds); + List orgNameList = agencyService.selectOrgNameGrid(partyLinkMassesDataList.stream().map(ScreenPartyLinkMassesDataFormDTO::getOrgId).collect(Collectors.toList())); + if (!CollectionUtils.isEmpty(partyLinkMassesDataList)) { partyLinkMassesDataList.forEach(party -> { orgNameList.forEach(org -> { - if (party.getOrgId().equals(org.getGridId())){ + if (party.getOrgId().equals(org.getGridId())) { party.setOrgName(org.getGridName()); } }); @@ -246,10 +244,10 @@ public class PartyGuideServiceImpl implements PartyGuideService { delAndInsertLink(gridResult,customerId,monthId,disGridIds); } // 查询直属网格的信息 + 下级机关的信息 = agency的机关信息 - List screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, disGridIds); + List screenPartyLinkMassesDataGrid = groupMainService.selectPartyCreateGroupInfo(customerId, disGridIds); List screenPartyLinkMassesDataList = linkMassesDataService.selectPartyLinkMassesInfo(customerId, monthId, agencyId); screenPartyLinkMassesDataList.addAll(screenPartyLinkMassesDataGrid); - if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)){ + if (!CollectionUtils.isEmpty(screenPartyLinkMassesDataList)) { ScreenPartyLinkMassesDataFormDTO form = new ScreenPartyLinkMassesDataFormDTO(); form.setOrgId(agencyId); form.setOrgType(ScreenConstant.AGENCY); @@ -257,8 +255,8 @@ public class PartyGuideServiceImpl implements PartyGuideService { form.setCustomerId(customerId); form.setDataEndTime(monthId); form.setParentId(screenPartyLinkMassesDataList.get(NumConstant.ZERO).getParentId()); - form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal))); - form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().collect(Collectors.summingInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal))); + form.setGroupUserTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getGroupUserTotal).sum()); + form.setCreateGroupTotal(screenPartyLinkMassesDataList.stream().mapToInt(ScreenPartyLinkMassesDataFormDTO::getCreateGroupTotal).sum()); result.add(form); } }); @@ -431,24 +429,23 @@ public class PartyGuideServiceImpl implements PartyGuideService { } /** - * @Description 社区级别的处理 + * @Description 社区级别的处理 * @Param customerId - * @Param monthId * @Param agency * @author zxc * @date 2020/9/25 10:06 上午 */ - public GridPartyGuideDTO communityLevelSubGrid(String customerId, String monthId, CustomerAgencyInfoResultDTO agency){ + public GridPartyGuideDTO communityLevelSubGrid(String customerId, CustomerAgencyInfoResultDTO agency) { String agencyId = agency.getAgencyId(); // 获取下级所有agencyId【根据agencyMap中的level判断下级orgId是否是gridId】(此处直接作为gridId) Map agencyMap = agencyService.selectAllSubAgencyId(agencyId, customerId); List gridIds = (List) agencyMap.get(agencyId); - List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, monthId, gridIds); + List partyLinkMassesDataList = groupMainService.selectPartyCreateGroupInfo(customerId, gridIds); List orgIds = partyLinkMassesDataList.stream().map(m -> m.getOrgId()).collect(Collectors.toList()); List orgNameList = agencyService.selectOrgNameGrid(orgIds); partyLinkMassesDataList.forEach(party -> { orgNameList.forEach(orgName -> { - if (party.getOrgId().equals(orgName.getGridId())){ + if (party.getOrgId().equals(orgName.getGridId())) { party.setOrgName(orgName.getGridName()); } }); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index 2717a8cb5e..3c7008dc0b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -97,7 +97,7 @@ - + DELETE FROM fact_origin_group_main_daily @@ -287,7 +287,6 @@ WHERE DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} - AND MONTH_ID = #{monthId} AND GROUP_STATE = 'approved' AND ( @@ -338,4 +337,4 @@ AND f.GROUP_STATE = 'approved' GROUP BY f.AGENCY_ID - \ No newline at end of file + From e3d3a16567d71a1e54a5d3869925a5e8950c350c Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 11 Jan 2021 14:21:02 +0800 Subject: [PATCH 04/25] =?UTF-8?q?selectPartymemberAgeDistribution=20sql?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml index 573c7501fa..06e501b713 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCpcBaseDataDao.xml @@ -10,7 +10,8 @@ SUM( AGE_LEVEL_3 ) + SUM( AGE_LEVEL_4 ) AS between31And50Count, SUM( AGE_LEVEL_5 ) AS between51And60Count, SUM( AGE_LEVEL_6 ) AS above61Count, - SUM( PARTY_MEMBER_COUNT) AS partyTotal + SUM( PARTY_MEMBER_COUNT) AS partyMemberCount, + SUM( AGE_LEVEL_1 ) + SUM( AGE_LEVEL_2 )+SUM( AGE_LEVEL_3 ) + SUM( AGE_LEVEL_4 )+SUM( AGE_LEVEL_5 )+SUM( AGE_LEVEL_6 ) as partyTotal FROM screen_cpc_base_data WHERE From ef26bd924cc7c7e80aa9e3c3c811776aafacf465 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 11 Jan 2021 14:30:20 +0800 Subject: [PATCH 05/25] =?UTF-8?q?fact=5Forigin=5Fissue=5Fmain=5Fdaily?= =?UTF-8?q?=E3=80=81fact=5Forigin=5Fissue=5Flog=5Fdaily=E8=A1=A8=E4=B8=ADp?= =?UTF-8?q?ids=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../todata/impl/IssueExtractServiceImpl.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java index 20169ae538..b7b4532f4f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/IssueExtractServiceImpl.java @@ -22,6 +22,7 @@ import com.epmet.service.evaluationindex.extract.todata.IssueExtractService; import com.epmet.service.topic.TopicService; import com.epmet.service.user.UserService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -129,7 +130,11 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(pid -> { if (r.getAgencyId().equals(pid.getAgencyId())){ r.setPid(pid.getPid()); - r.setPids(pid.getPids().concat(":").concat(r.getAgencyId())); + if (StringUtils.isNotBlank(pid.getPids())) { + r.setPids(pid.getPids().concat(":").concat(r.getAgencyId())); + } else { + r.setPids(r.getAgencyId()); + } } }); }); @@ -231,7 +236,11 @@ public class IssueExtractServiceImpl implements IssueExtractService { agencyInfoList.forEach(agency -> { if (r.getAgencyId().equals(agency.getAgencyId())){ r.setPid(agency.getPid()); - r.setPids(agency.getPids().concat(":").concat(r.getAgencyId())); + if(StringUtils.isNotBlank(agency.getPids())){ + r.setPids(agency.getPids().concat(":").concat(r.getAgencyId())); + }else{ + r.setPids(r.getAgencyId()); + } } }); }); From 894ef0d710221947bdc75f2f7fa199a0b7b2354a Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 11 Jan 2021 14:47:36 +0800 Subject: [PATCH 06/25] =?UTF-8?q?=E5=85=9A=E5=BB=BA=E5=BC=95=E9=A2=86-?= =?UTF-8?q?=E5=85=88=E8=BF=9B=E6=8E=92=E8=A1=8C=E6=A6=9C=E6=A6=9C=E5=8D=95?= =?UTF-8?q?=E3=80=81=E5=9F=BA=E5=B1=82=E6=B2=BB=E7=90=86=E7=9A=84=20?= =?UTF-8?q?=E5=85=AC=E4=BC=97=E5=8F=82=E4=B8=8E=E6=8E=92=E8=A1=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E4=B8=8A=E7=BA=A7=E7=BB=84=E7=BB=87=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E8=BF=94=E5=8F=82=EF=BC=8C=E5=85=9A=E5=91=98=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E7=BE=A4=E4=BC=97=E5=8E=BB=E6=8E=89=E7=9B=B4=E5=B1=9E=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../result/AdvanceBranchRankResultDTO.java | 5 +++ .../dto/result/OrgRankDataResultDTO.java | 5 +++ .../dto/result/PublicPartiRankResultDTO.java | 2 + .../mapper/screen/ScreenOrgRankDataDao.xml | 41 ++++++++++--------- .../screen/ScreenPartyLinkMassesDataDao.xml | 1 + .../screen/ScreenPublicPartiTotalDataDao.xml | 35 +++++++++------- 6 files changed, 55 insertions(+), 34 deletions(-) diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AdvanceBranchRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AdvanceBranchRankResultDTO.java index 60545c7fc4..216214d05c 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AdvanceBranchRankResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/AdvanceBranchRankResultDTO.java @@ -50,4 +50,9 @@ public class AdvanceBranchRankResultDTO implements Serializable { * */ private Integer projectNum; + /** + * 当前name的上级组织名称 2021-01-11新增 + */ + private String parentAgencyName; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/OrgRankDataResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/OrgRankDataResultDTO.java index 9aff92593f..a52b035475 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/OrgRankDataResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/OrgRankDataResultDTO.java @@ -51,4 +51,9 @@ public class OrgRankDataResultDTO implements Serializable { * */ private Integer projectNum; + /** + * 当前name的上级组织名称 2021-01-11新增 + */ + private String parentAgencyName; + } diff --git a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiRankResultDTO.java b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiRankResultDTO.java index 6d4eba5f4b..53209c640a 100644 --- a/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiRankResultDTO.java +++ b/epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/result/PublicPartiRankResultDTO.java @@ -25,4 +25,6 @@ public class PublicPartiRankResultDTO implements Serializable { private Integer issueNum; private Integer projectNum; + + private String parentAgencyName; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml index 310320029e..bc1fa8f0aa 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenOrgRankDataDao.xml @@ -6,28 +6,31 @@ diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml index 7a59c7f16d..552923d505 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml @@ -15,5 +15,6 @@ WHERE md.del_flag = '0' AND md.parent_id = #{agencyId} + AND ORG_TYPE = 'agency' \ No newline at end of file diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml index 1a94210725..277e6c17dc 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPublicPartiTotalDataDao.xml @@ -6,24 +6,29 @@ \ No newline at end of file From 153f62014f5ae6099aa1c48a74673666613e69c6 Mon Sep 17 00:00:00 2001 From: wxz Date: Mon, 11 Jan 2021 14:54:36 +0800 Subject: [PATCH 07/25] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E3=80=90=E5=AE=A2?= =?UTF-8?q?=E6=88=B7=E5=88=9D=E5=A7=8B=E5=8C=96=E3=80=91MQ=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=BC=82=E5=B8=B8=E5=A4=84?= =?UTF-8?q?=E7=90=86=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=B9=82=E7=AD=89=E5=88=A4?= =?UTF-8?q?=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mq/listener/InitCustomerOrgListener.java | 13 +++- .../epmet/service/impl/AgencyServiceImpl.java | 10 ++- .../java/com/epmet/dao/CustomerHomeDao.java | 3 + .../InitCustomerCustomizeListener.java | 13 +++- .../service/impl/CustomerHomeServiceImpl.java | 7 ++ .../main/resources/mapper/CustomerHomeDao.xml | 6 ++ .../epmet/feign/EpmetUserOpenFeignClient.java | 8 ++ .../EpmetUserOpenFeignClientFallback.java | 5 ++ .../listener/InitCustomerRolesListener.java | 78 +++++++++---------- 9 files changed, 100 insertions(+), 43 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java index 47e04307ec..1308d09a36 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgListener.java @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; import com.epmet.constant.UserWorkType; import com.epmet.dto.CustomerAgencyDTO; import com.epmet.dto.form.AddAgencyAndStaffFormDTO; @@ -38,7 +40,16 @@ public class InitCustomerOrgListener implements RocketMQListener { String msg = new String(messageExt.getBody()); logger.info("初始化客户-初始化组织信息-收到消息内容:{}", msg); InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); - agencyService.saveRootAgency(constructRootAndAgencyDTO(msgObj)); + try { + agencyService.saveRootAgency(constructRootAndAgencyDTO(msgObj)); + } catch (RenException e) { + // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试 + logger.error("【RocketMQ】初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + } catch (Exception e) { + // 不是我们自己抛出的异常,可以让MQ重试 + logger.error("【RocketMQ】初始化客户组织失败:".concat(ExceptionUtils.getErrorStackTrace(e))); + throw e; + } } /** diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java index cc04700841..f507af7c29 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/AgencyServiceImpl.java @@ -351,7 +351,13 @@ public class AgencyServiceImpl implements AgencyService { throw new RenException(EpmetErrorCode.OPER_ADD_CUSTOMER_ROOT_AGENCY_ERROR.getCode()); } - //3.查询客户具有指定RoleKey的角色信息 + //3.调用epmet-user服务,初始化客户对应的角色;其内部会调用access服务给角色分配权限信息 + Result initResult = epmetUserOpenFeignClient.initGovStaffRolesForCustomer(agencyDTO.getCustomerId()); + if (!initResult.success()) { + throw new RenException("客户新增:调用user服务为客户初始化角色数据失败:".concat(initResult.toString())); + } + + //4.查询客户具有指定RoleKey的角色信息 CustomerRoleFormDTO customerRoleForm = new CustomerRoleFormDTO(); customerRoleForm.setCustomerId(agencyDTO.getCustomerId()); customerRoleForm.setRoleKey(RoleKeyConstants.ROLE_KEY_ROOT_MANAGER); @@ -361,7 +367,7 @@ public class AgencyServiceImpl implements AgencyService { throw new RenException("查询客户具有指定RoleKey的角色信息失败:".concat(getRoleResult.toString())); } - //4.新增客户管理员信息 + //5.新增客户管理员信息 StaffSubmitFromDTO staffSubmitFrom = ConvertUtils.sourceToTarget(staffDTO, StaffSubmitFromDTO.class); staffSubmitFrom.setRoles(Arrays.asList(getRoleResult.getData().getId())); staffSubmitFrom.setApp("gov"); diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java index 42bc2824b4..c804d757ed 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/CustomerHomeDao.java @@ -21,6 +21,7 @@ import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.dto.form.HomeDesignFormDTO; import com.epmet.entity.CustomerHomeEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -43,4 +44,6 @@ public interface CustomerHomeDao extends BaseDao { * @date 2020/3/16 14:02 **/ List selectCustomerHomeList(HomeDesignFormDTO formDTO); + + int countByCustomerId(@Param("customerId") String customerId); } \ No newline at end of file diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java index c4239a7a47..df2fea0902 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/listener/InitCustomerCustomizeListener.java @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSON; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.commons.tools.exception.RenException; import com.epmet.dto.CustomerHomeDTO; import com.epmet.service.CustomerHomeService; import org.apache.rocketmq.common.message.MessageExt; @@ -38,6 +40,15 @@ public class InitCustomerCustomizeListener implements RocketMQListener 0) { + throw new RenException("用户Home组件已存在,请勿重复初始化"); + } + //居民端模板 List resiTempList = customerHomeTemplateService.getTemplateByClient(OperCustomizeConstant.RESIDENT); //居民端草稿 diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml index 3bc7dfdb23..76b5f185ef 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml +++ b/epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDao.xml @@ -29,5 +29,11 @@ AND DEL_FLAG = '0' + + \ No newline at end of file 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 b31f94ddff..494fce4e3f 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 @@ -469,4 +469,12 @@ public interface EpmetUserOpenFeignClient { @PostMapping(value = "epmetuser/staffrole/specificrolesstaffs", consumes = MediaType.APPLICATION_JSON_VALUE) Result> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO); + + /** + * 为客户初始化政府端工作人员角色 + * @param customerId + * @return + */ + @PostMapping("/epmetuser/staffrole/initrolesforcustomer/{customerId}") + Result initGovStaffRolesForCustomer(@PathVariable String customerId); } 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 69371a19cd..7137d3ad1d 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 @@ -331,4 +331,9 @@ public class EpmetUserOpenFeignClientFallback implements EpmetUserOpenFeignClien public Result> specificRolesStaffs(RolesUsersListFormDTO rolesUsersListFormDTO) { return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "specificRolesStaffs", rolesUsersListFormDTO); } + + @Override + public Result initGovStaffRolesForCustomer(String customerId) { + return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "initGovStaffRolesForCustomer", customerId); + } } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java index 34dd589b80..a50da7561e 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/InitCustomerRolesListener.java @@ -1,39 +1,39 @@ -package com.epmet.mq.listener; - -import com.alibaba.fastjson.JSON; -import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; -import com.epmet.commons.rocketmq.constants.TopicConstants; -import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; -import com.epmet.service.GovStaffRoleService; -import org.apache.rocketmq.common.message.MessageExt; -import org.apache.rocketmq.spring.annotation.MessageModel; -import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; -import org.apache.rocketmq.spring.core.RocketMQListener; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -/** - * 监听初始化客户动作,为客户初始化角色列表 - */ -@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, - consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ROLES_GROUP, - messageModel = MessageModel.CLUSTERING, - selectorExpression = "*") -@Component -public class InitCustomerRolesListener implements RocketMQListener { - - private Logger logger = LoggerFactory.getLogger(getClass()); - - @Autowired - private GovStaffRoleService govStaffRoleService; - - @Override - public void onMessage(MessageExt messageExt) { - String msg = new String(messageExt.getBody()); - logger.info("初始化客户-初始化角色列表-收到消息内容:{}", msg); - InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); - govStaffRoleService.initGovStaffRolesForCustomer(msgObj.getCustomerId()); - } -} +//package com.epmet.mq.listener; +// +//import com.alibaba.fastjson.JSON; +//import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; +//import com.epmet.commons.rocketmq.constants.TopicConstants; +//import com.epmet.commons.rocketmq.messages.InitCustomerMQMsg; +//import com.epmet.service.GovStaffRoleService; +//import org.apache.rocketmq.common.message.MessageExt; +//import org.apache.rocketmq.spring.annotation.MessageModel; +//import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +//import org.apache.rocketmq.spring.core.RocketMQListener; +//import org.slf4j.Logger; +//import org.slf4j.LoggerFactory; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.stereotype.Component; +// +///** +// * 监听初始化客户动作,为客户初始化角色列表 +// */ +//@RocketMQMessageListener(topic = TopicConstants.INIT_CUSTOMER, +// consumerGroup = ConsomerGroupConstants.INIT_CUSTOMER_ROLES_GROUP, +// messageModel = MessageModel.CLUSTERING, +// selectorExpression = "*") +//@Component +//public class InitCustomerRolesListener implements RocketMQListener { +// +// private Logger logger = LoggerFactory.getLogger(getClass()); +// +// @Autowired +// private GovStaffRoleService govStaffRoleService; +// +// @Override +// public void onMessage(MessageExt messageExt) { +// String msg = new String(messageExt.getBody()); +// logger.info("初始化客户-初始化角色列表-收到消息内容:{}", msg); +// InitCustomerMQMsg msgObj = JSON.parseObject(msg, InitCustomerMQMsg.class); +// govStaffRoleService.initGovStaffRolesForCustomer(msgObj.getCustomerId()); +// } +//} From b5a9b56b795c41c33aa5d8758861830963a2d22c Mon Sep 17 00:00:00 2001 From: wangchao Date: Mon, 11 Jan 2021 15:06:24 +0800 Subject: [PATCH 08/25] =?UTF-8?q?=E5=85=9A=E5=91=98=E8=81=94=E7=B3=BB?= =?UTF-8?q?=E7=BE=A4=E4=BC=97=EF=BC=8C=E7=A4=BE=E5=8C=BA=E7=BA=A7=E5=88=AB?= =?UTF-8?q?=E6=9C=BA=E5=85=B3=E6=98=BE=E7=A4=BA=E7=9B=B4=E5=B1=9E=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=EF=BC=8C=E5=85=B6=E4=BB=96=E7=BA=A7=E5=88=AB=E6=9C=BA?= =?UTF-8?q?=E5=85=B3=E5=8F=AA=E6=98=BE=E7=A4=BA=E4=B8=8B=E7=BA=A7=E6=9C=BA?= =?UTF-8?q?=E5=85=B3=E4=B8=8D=E6=98=BE=E7=A4=BA=E6=8C=87=E6=95=B0=E7=BD=91?= =?UTF-8?q?=E6=A0=BC=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml index 552923d505..4997380f98 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml @@ -15,6 +15,8 @@ WHERE md.del_flag = '0' AND md.parent_id = #{agencyId} - AND ORG_TYPE = 'agency' + + AND ORG_TYPE = + CASE WHEN sca.LEVEL = 'community' THEN 'grid' ELSE 'agency' END \ No newline at end of file From 67b484e62a5a614710fd5ec99539cef55d35ad79 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 11 Jan 2021 15:41:57 +0800 Subject: [PATCH 09/25] =?UTF-8?q?=E3=80=90=E5=85=9A=E5=91=98=E5=BB=BA?= =?UTF-8?q?=E7=BE=A4=E6=95=B0=E3=80=91=E6=B7=BB=E5=8A=A0=E5=85=9A=E5=91=98?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evaluationindex/extract/FactOriginGroupMainDailyDao.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml index 3c7008dc0b..db5dc8b583 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/extract/FactOriginGroupMainDailyDao.xml @@ -288,6 +288,7 @@ DEL_FLAG = '0' AND CUSTOMER_ID = #{customerId} AND GROUP_STATE = 'approved' + AND IS_OWNER_PARTY = 1 AND ( From 026f230a4a2136c98b403f81d573481d2c579912 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 11 Jan 2021 15:42:36 +0800 Subject: [PATCH 10/25] =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/dto/form/AddTemplateFormDTO.java | 5 + .../dto/form/DelPersonalTempFormDTO.java | 31 ++++ .../com/epmet/dto/form/InitAllFormDTO.java | 26 +++ .../java/com/epmet/dto/form/InitFormDTO.java | 5 + .../com/epmet/dto/result/TemplateDTO.java | 6 +- .../epmet/controller/SubscribeController.java | 26 +++ .../com/epmet/dao/PersonalTemplateDao.java | 2 + .../service/PersonalTemplateService.java | 10 ++ .../com/epmet/service/SubscribeService.java | 18 +++ .../impl/PersonalTemplateServiceImpl.java | 14 ++ .../service/impl/SubscribeServiceImpl.java | 150 +++++++++++++----- .../resources/mapper/PersonalTemplateDao.xml | 5 +- 12 files changed, 260 insertions(+), 38 deletions(-) create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java create mode 100644 epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java index edb391eb73..2e28dfdb84 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java @@ -48,4 +48,9 @@ public class AddTemplateFormDTO implements Serializable { * 关键字名称 */ private List nameList; + + /** + * 是否同步到所有客户 + */ + private Boolean isSync; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java new file mode 100644 index 0000000000..9c49eeeccf --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/DelPersonalTempFormDTO.java @@ -0,0 +1,31 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; +import java.util.List; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/1/11 14:53 + */ +@NoArgsConstructor +@Data +public class DelPersonalTempFormDTO implements Serializable { + + private static final long serialVersionUID = -1445036628319660147L; + /** + * 客户ID + */ + private String customerId; + /** + * 所属端 居民端resi 工作端work + */ + private String clientType; + /** + * 模板id + */ + private List tempIdList; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java new file mode 100644 index 0000000000..ed476cc3b6 --- /dev/null +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitAllFormDTO.java @@ -0,0 +1,26 @@ +package com.epmet.dto.form; + +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.io.Serializable; + +/** + * @author zhaoqifeng + * @dscription + * @date 2021/1/11 14:47 + */ +@NoArgsConstructor +@Data +public class InitAllFormDTO implements Serializable { + + private static final long serialVersionUID = 5198153778356904936L; + /** + * 测试号APPID + */ + private String appId; + /** + * 模板ID + */ + private String tempId; +} diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java index ab154a196a..196128aff2 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/InitFormDTO.java @@ -36,4 +36,9 @@ public class InitFormDTO implements Serializable { * 工作端需要同步的模板id数组 */ private List workTempIdList; + + /** + * 1 已同步,0 未同步 + */ + private String sync; } diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java index 0229316e01..9ccf9963ee 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java @@ -17,9 +17,13 @@ public class TemplateDTO implements Serializable { */ private String id; /** - * 模板ID + * 公共模板ID */ private String tmplId; + /** + * 客户模板ID + */ + private String personalTempId; /** * 标题 */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java index 47d3b6d653..63a31e73b2 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/controller/SubscribeController.java @@ -146,4 +146,30 @@ public class SubscribeController { CustomerTempResultDTO result = subscribeService.getCustomerTemplate(formDTO); return new Result().ok(result); } + + /** + * 同步单一模板到所有客户 + * @author zhaoqifeng + * @date 2021/1/11 14:49 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("initall") + public Result initAll(@RequestBody InitAllFormDTO formDTO) { + subscribeService.initAll(formDTO); + return new Result(); + } + + /** + * 删除客户模板 + * @author zhaoqifeng + * @date 2021/1/11 14:54 + * @param formDTO + * @return com.epmet.commons.tools.utils.Result + */ + @PostMapping("delpersonaltemp") + public Result delPersonalTemp(@RequestBody DelPersonalTempFormDTO formDTO) { + subscribeService.delPersonalTemp(formDTO); + return new Result(); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java index 93fe3d2d95..054712bea0 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/dao/PersonalTemplateDao.java @@ -105,4 +105,6 @@ public interface PersonalTemplateDao extends BaseDao { List selectListByKey(@Param("appId") String appId, @Param("tid") String tid, @Param("keyIds") String keyIds); List selectTemplateListV2(TemplateListV2FormDTO formDTO); + + PersonalTemplateDTO getTempByPid(); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java index 1f3540a90f..a586844667 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/PersonalTemplateService.java @@ -156,4 +156,14 @@ public interface PersonalTemplateService extends BaseService getListByKey(String appId, String tid, String keyIds); List templateListV2(TemplateListV2FormDTO formDTO); + + /** + * 获取个人模板 + * @author zhaoqifeng + * @date 2021/1/11 15:32 + * @param customerId + * @param pid + * @return com.epmet.dto.PersonalTemplateDTO + */ + PersonalTemplateDTO getTempByPid(String customerId, String pid); } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java index c56d17487a..6790a2aa15 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/SubscribeService.java @@ -102,4 +102,22 @@ public interface SubscribeService { */ CustomerTempResultDTO getCustomerTemplate(InitFormDTO formDTO); + /** + * 同步单一模板到所有客户 + * @author zhaoqifeng + * @date 2021/1/11 14:49 + * @param formDTO + * @return void + */ + void initAll(InitAllFormDTO formDTO); + + /** + * 删除客户模板 + * @author zhaoqifeng + * @date 2021/1/11 14:54 + * @param formDTO + * @return void + */ + void delPersonalTemp(DelPersonalTempFormDTO formDTO); + } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java index 65e2f87e51..96e257c141 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/PersonalTemplateServiceImpl.java @@ -165,4 +165,18 @@ public class PersonalTemplateServiceImpl extends BaseServiceImpl templateListV2(TemplateListV2FormDTO formDTO) { return baseDao.selectTemplateListV2(formDTO); } + + /** + * 获取个人模板 + * + * @param customerId + * @param pid + * @return com.epmet.dto.PersonalTemplateDTO + * @author zhaoqifeng + * @date 2021/1/11 15:32 + */ + @Override + public PersonalTemplateDTO getTempByPid(String customerId, String pid) { + return baseDao.selectSetTemp(customerId, pid); + } } diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java index 6d212b75ee..e6b1799e8a 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java @@ -199,44 +199,46 @@ public class SubscribeServiceImpl implements SubscribeService { personalTemplateDTO.setKeyWords(keywords); personalTemplateDTO.setType(formDTO.getType()); personalTemplateService.save(personalTemplateDTO); - //获取客户列表 - List customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId()); - List customerNames = new ArrayList<>(); - if (null != customerList && customerList.size() > NumConstant.ZERO) { - for (PaCustomerDTO paCustomerDTO : customerList) { - //获取小程序调用令牌 - AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType()); - if (null == authDTO) { - log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权"); - customerNames.add(paCustomerDTO.getCustomerName()); - continue; + if (formDTO.getIsSync()) { + //获取客户列表 + List customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId()); + List customerNames = new ArrayList<>(); + if (null != customerList && customerList.size() > NumConstant.ZERO) { + for (PaCustomerDTO paCustomerDTO : customerList) { + //获取小程序调用令牌 + AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType()); + if (null == authDTO) { + log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权"); + customerNames.add(paCustomerDTO.getCustomerName()); + continue; + } + WxResult wxResult1 = wxMaSubscribeService.addTemplate(authDTO.getAuthorizerAccessToken(), request); + if (!wxResult1.success()) { + log.error("客户[" + paCustomerDTO.getCustomerName() + "]添加模板失败,原因:" + wxResult1.getErrorCode() + wxResult1.getErrorMsg()); + customerNames.add(paCustomerDTO.getCustomerName()); + continue; + } + String tmplId = wxResult1.getData(); + PersonalTemplateDTO templateDTO = new PersonalTemplateDTO(); + templateDTO.setCustomerId(paCustomerDTO.getId()); + templateDTO.setClientType(authInfo.getClientType()); + templateDTO.setAppId(authDTO.getAuthorizerAppid()); + templateDTO.setPid(priTmplId); + templateDTO.setPriTmplId(tmplId); + templateDTO.setTid(formDTO.getTid()); + templateDTO.setKeyIds(keyIds); + templateDTO.setTitle(formDTO.getTitle()); + templateDTO.setSceneDesc(formDTO.getSceneDesc()); + templateDTO.setKeyWords(keywords); + templateDTO.setType(formDTO.getType()); + personalTemplateService.save(templateDTO); } - WxResult wxResult1 = wxMaSubscribeService.addTemplate(authDTO.getAuthorizerAccessToken(), request); - if (!wxResult1.success()) { - log.error("客户[" + paCustomerDTO.getCustomerName() + "]添加模板失败,原因:" + wxResult1.getErrorCode() + wxResult1.getErrorMsg()); - customerNames.add(paCustomerDTO.getCustomerName()); - continue; - } - String tmplId = wxResult1.getData(); - PersonalTemplateDTO templateDTO = new PersonalTemplateDTO(); - templateDTO.setCustomerId(paCustomerDTO.getId()); - templateDTO.setClientType(authInfo.getClientType()); - templateDTO.setAppId(authDTO.getAuthorizerAppid()); - templateDTO.setPid(priTmplId); - templateDTO.setPriTmplId(tmplId); - templateDTO.setTid(formDTO.getTid()); - templateDTO.setKeyIds(keyIds); - templateDTO.setTitle(formDTO.getTitle()); - templateDTO.setSceneDesc(formDTO.getSceneDesc()); - templateDTO.setKeyWords(keywords); - templateDTO.setType(formDTO.getType()); - personalTemplateService.save(templateDTO); } - } - if (customerNames.size() > NumConstant.ZERO) { - String names = String.join(",", customerNames); - throw new RenException("客户[" + names + "]添加模板失败"); + if (customerNames.size() > NumConstant.ZERO) { + String names = String.join(",", customerNames); + throw new RenException("客户[" + names + "]添加模板失败"); + } } } @@ -348,7 +350,6 @@ public class SubscribeServiceImpl implements SubscribeService { log.error("居民端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg()); } }); - resultDTO.setResiList(resiList); AuthorizationInfoDTO workAuthDTO = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), "work"); if (null == workAuthDTO) { @@ -371,10 +372,87 @@ public class SubscribeServiceImpl implements SubscribeService { log.error("工作端同步失败:" + wxResult.getErrorCode() + wxResult.getErrorMsg()); } }); + +// resultDTO.setResiList(resiList.stream().filter(item -> formDTO.getSync().equals(item.getState())).collect(Collectors.toList())); +// resultDTO.setWorkList(workList.stream().filter(item -> formDTO.getSync().equals(item.getState())).collect(Collectors.toList())); + resultDTO.setResiList(resiList); resultDTO.setWorkList(workList); return resultDTO; } + /** + * 同步单一模板到所有客户 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2021/1/11 14:49 + */ + @Override + public void initAll(InitAllFormDTO formDTO) { + AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId()); + PersonalTemplateDTO publicDTO = personalTemplateService.get(formDTO.getTempId()); + + //获取客户列表 + List customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId()); + List customerNames = new ArrayList<>(); + if (null != customerList && customerList.size() > NumConstant.ZERO) { + for (PaCustomerDTO paCustomerDTO : customerList) { + PersonalTemplateDTO personalTemplateDTO = personalTemplateService.getTempByPid(paCustomerDTO.getId(), publicDTO.getPriTmplId()); + if (null != personalTemplateDTO) { + //获取小程序调用令牌 + AuthorizationInfoDTO authDTO = authorizationInfoDao.getAuthInfoByCustomer(paCustomerDTO.getId(), authInfo.getClientType()); + + List keyIds = Arrays.asList(publicDTO.getKeyIds().split(",")); + List keyIdList = keyIds.stream().map(Integer::parseInt).collect(Collectors.toList()); + WxAddTemplateReq request = new WxAddTemplateReq(); + request.setTid(publicDTO.getTid()); + request.setKidList(keyIdList); + request.setSceneDesc(publicDTO.getSceneDesc()); + WxResult wxResult = wxMaSubscribeService.addTemplate(authInfo.getAuthorizerAccessToken(), request); + if (null == authDTO) { + log.error("客户[" + paCustomerDTO.getCustomerName() + "]未授权"); + customerNames.add(paCustomerDTO.getCustomerName()); + continue; + } + + String tmplId = wxResult.getData(); + PersonalTemplateDTO templateDTO = new PersonalTemplateDTO(); + templateDTO.setCustomerId(paCustomerDTO.getId()); + templateDTO.setClientType(authInfo.getClientType()); + templateDTO.setAppId(authDTO.getAuthorizerAppid()); + templateDTO.setPid(publicDTO.getPriTmplId()); + templateDTO.setPriTmplId(tmplId); + templateDTO.setTid(publicDTO.getTid()); + templateDTO.setKeyIds(publicDTO.getKeyIds()); + templateDTO.setTitle(publicDTO.getTitle()); + templateDTO.setSceneDesc(publicDTO.getSceneDesc()); + templateDTO.setKeyWords(publicDTO.getKeyWords()); + templateDTO.setType(publicDTO.getType()); + personalTemplateService.save(templateDTO); + } + } + } + + if (customerNames.size() > NumConstant.ZERO) { + String names = String.join(",", customerNames); + log.error("客户[" + names + "]添加模板失败"); + } + } + + /** + * 删除客户模板 + * + * @param formDTO + * @return void + * @author zhaoqifeng + * @date 2021/1/11 14:54 + */ + @Override + public void delPersonalTemp(DelPersonalTempFormDTO formDTO) { + + } + private WxGetCategoryResult getCategoryResult(String accessToken) { WxResult wxResult = wxMaSubscribeService.getCategory(accessToken); diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml index 26c12ac4ec..f049859dcb 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml @@ -49,13 +49,15 @@ SELECT t1.ID AS id, t1.PRI_TMPL_ID AS tmplId, + IFNULL(t2.PRI_TMPL_ID, '') AS personalTempId, t1.TITLE AS title, IF(ISNULL(t2.ID),'0','1') AS state FROM (SELECT ID, TITLE, - PRI_TMPL_ID + PRI_TMPL_ID, + CREATED_TIME FROM personal_template WHERE @@ -74,6 +76,7 @@ AND CUSTOMER_ID = #{customerId} AND CLIENT_TYPE = #{clientType}) t2 ON t1.PRI_TMPL_ID = t2.PID + ORDER BY t1.CREATED_TIME DESC SELECT - ORG_NAME AS agencyName, - RESPONSE_RATIO, - RESOLVED_RATIO, - GOVERN_RATIO, - SATISFACTION_RATIO + rankData.ORG_NAME AS agencyName, + rankData.RESPONSE_RATIO, + rankData.RESOLVED_RATIO, + rankData.GOVERN_RATIO, + rankData.SATISFACTION_RATIO, + agency.AGENCY_NAME AS parentAgencyName FROM - screen_govern_rank_data + screen_govern_rank_data rankData + LEFT JOIN + screen_customer_agency agency + ON rankData.PARENT_ID = agency.AGENCY_ID AND agency.DEL_FLAG = '0' AND agency.AGENCY_ID = #{agencyId} WHERE - DEL_FLAG = '0' - AND PARENT_ID = #{agencyId} - AND MONTH_ID = #{monthId} + rankData.DEL_FLAG = '0' + AND rankData.PARENT_ID = #{agencyId} + AND rankData.MONTH_ID = #{monthId} ORDER BY - (RESPONSE_RATIO + RESOLVED_RATIO + GOVERN_RATIO + SATISFACTION_RATIO) DESC,RESPONSE_RATIO DESC,RESOLVED_RATIO DESC,GOVERN_RATIO DESC,SATISFACTION_RATIO DESC + (rankData.RESPONSE_RATIO + rankData.RESOLVED_RATIO + rankData.GOVERN_RATIO + rankData.SATISFACTION_RATIO) DESC,rankData.RESPONSE_RATIO DESC,rankData.RESOLVED_RATIO DESC,rankData.GOVERN_RATIO DESC,rankData.SATISFACTION_RATIO DESC \ No newline at end of file From 1ff9451da4a4161b98c5af975cc857d43189b990 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 11 Jan 2021 17:02:50 +0800 Subject: [PATCH 12/25] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E6=8A=BD=E5=8F=96?= =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../extract/todata/impl/GroupExtractServiceImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java index dedb5bc3a3..275e8fd4e1 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java @@ -1,5 +1,6 @@ package com.epmet.service.evaluationindex.extract.todata.impl; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.utils.DateUtils; @@ -84,7 +85,7 @@ public class GroupExtractServiceImpl implements GroupExtractService { List originGroupData = groupDataService.extractGroupData( count <= NumConstant.ZERO, param.getCustomerId(), param.getDateId()); - + log.info("extractGroupData extractGroupData:result:{},param:{}", JSON.toJSONString(originGroupData), JSON.toJSONString(param)); List memberList = new LinkedList<>(); if (!CollectionUtils.isEmpty(originGroupData)) { List gridList = dimGridService.getGridAttributes(param.getCustomerId(),originGroupData.stream().map(FactOriginGroupMainDailyDTO::getGridId).distinct().collect(Collectors.toList())); @@ -160,7 +161,7 @@ public class GroupExtractServiceImpl implements GroupExtractService { factOriginGroupMainDailyService.insertExtractedData( - count <= NumConstant.ZERO ? true : false, + count <= NumConstant.ZERO, param.getCustomerId(), param.getDateId(), originGroupData, From 51079b8ae9139e9dd53d5e4d370a12679cc0dfe2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 11 Jan 2021 17:21:17 +0800 Subject: [PATCH 13/25] screen_party_link_masses_data md --- .../resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml index 4997380f98..7f4520f8ff 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenPartyLinkMassesDataDao.xml @@ -16,7 +16,7 @@ md.del_flag = '0' AND md.parent_id = #{agencyId} - AND ORG_TYPE = + AND md.ORG_TYPE = CASE WHEN sca.LEVEL = 'community' THEN 'grid' ELSE 'agency' END \ No newline at end of file From 7dbe156fd8b0d2ab6061315d607897a02674b7b6 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 11 Jan 2021 17:25:56 +0800 Subject: [PATCH 14/25] =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/result/TemplateDTO.java | 1 + .../epmet/service/impl/SubscribeServiceImpl.java | 15 ++++++++++++++- .../main/resources/mapper/PersonalTemplateDao.xml | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java index 9ccf9963ee..1fccf69f2d 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/result/TemplateDTO.java @@ -20,6 +20,7 @@ public class TemplateDTO implements Serializable { * 公共模板ID */ private String tmplId; + private String personalId; /** * 客户模板ID */ diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java index e6b1799e8a..450d747944 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java @@ -450,7 +450,20 @@ public class SubscribeServiceImpl implements SubscribeService { */ @Override public void delPersonalTemp(DelPersonalTempFormDTO formDTO) { - + AuthorizationInfoDTO authInfo = authorizationInfoDao.getAuthInfoByCustomer(formDTO.getCustomerId(), formDTO.getClientType()); + if (null == authInfo) { + throw new RenException("未授权或token已过期"); + } + formDTO.getTempIdList().forEach(tempId -> { + PersonalTemplateDTO dto = personalTemplateService.get(tempId); + WxDelTemplateReq request = new WxDelTemplateReq(); + request.setPriTmplId(dto.getPriTmplId()); + WxResult wxResult = wxMaSubscribeService.delTemplate(authInfo.getAuthorizerAccessToken(), request); + if (!wxResult.success()) { + throw new RenException(wxResult.getErrorCode(), wxResult.getErrorMsg()); + } + personalTemplateService.deleteById(dto.getId()); + }); } private WxGetCategoryResult getCategoryResult(String accessToken) { diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml index f049859dcb..1b73c85569 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml @@ -49,6 +49,7 @@ SELECT t1.ID AS id, t1.PRI_TMPL_ID AS tmplId, + IFNULL(t2.ID, '') AS personalId, IFNULL(t2.PRI_TMPL_ID, '') AS personalTempId, t1.TITLE AS title, IF(ISNULL(t2.ID),'0','1') AS state From 65aadd0d4dfe20f2311c1fbca6fbf733b0673f45 Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Mon, 11 Jan 2021 17:32:35 +0800 Subject: [PATCH 15/25] =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java index 2e28dfdb84..16491eb32e 100644 --- a/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java +++ b/epmet-module/epmet-third/epmet-third-client/src/main/java/com/epmet/dto/form/AddTemplateFormDTO.java @@ -52,5 +52,5 @@ public class AddTemplateFormDTO implements Serializable { /** * 是否同步到所有客户 */ - private Boolean isSync; + private Boolean isSync = true; } From ef720bffc074286366b12ba01dfb13e52ec6fbb2 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Mon, 11 Jan 2021 17:38:15 +0800 Subject: [PATCH 16/25] =?UTF-8?q?=E6=B2=BB=E7=90=86=E8=83=BD=E5=8A=9B?= =?UTF-8?q?=E6=A6=9C=E5=8D=95=EF=BC=8C=E8=BF=94=E5=9B=9EparentAgencyName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java | 1 + 1 file changed, 1 insertion(+) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java index 7afd0f4362..e33e7c9334 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/GrassRootsGovernServiceImpl.java @@ -181,6 +181,7 @@ public class GrassRootsGovernServiceImpl implements GrassRootsGovernService { rank.setResolvedRatio(convertPercentStr(o.getResolvedRatio(),NumConstant.ONE)); rank.setResponseRatio(convertPercentStr(o.getResponseRatio(),NumConstant.ONE)); rank.setSatisfactionRatio(convertPercentStr(o.getSatisfactionRatio(),NumConstant.ONE)); + rank.setParentAgencyName(o.getParentAgencyName()); result.add(rank); }); return result; From 11fcd347b5ba97c817f57f1e6b53d01ddf1c6121 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 12 Jan 2021 10:32:32 +0800 Subject: [PATCH 17/25] =?UTF-8?q?=E5=9F=BA=E5=B1=82=E5=85=9A=E5=BB=BA-?= =?UTF-8?q?=E5=85=9A=E5=91=98=E5=9F=BA=E6=9C=AC=E6=83=85=E5=86=B5=E8=A1=A8?= =?UTF-8?q?=E5=85=9A=E5=91=98=E6=80=BB=E6=95=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../toscreen/impl/PartyBaseInfoServiceImpl.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java index f0999a4605..a7435b914e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PartyBaseInfoServiceImpl.java @@ -129,7 +129,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel4(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel4))); form.setAgeLevel5(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel5))); form.setAgeLevel6(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getAgeLevel6))); - form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount))); +// form.setPartyMemberCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getPartyMemberCount))); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setResiTotal(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getResiTotal))); form.setRegisterUserCount(party.stream().collect(Collectors.summingInt(PartyBaseInfoFormDTO::getRegisterUserCount))); result.add(form); @@ -175,6 +176,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setCustomerId(customerId); form.setDataEndTime(dateId); form.setParentId(partyInfos.get(NumConstant.ZERO).getAgencyId()); @@ -183,7 +185,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { if (gridId.equals(user.getOrgId())){ form.setResiTotal(user.getResiTotal()); form.setRegisterUserCount(user.getRegisterUserCount()); - form.setPartyMemberCount(user.getPartyMemberCount()); +// form.setPartyMemberCount(user.getPartyMemberCount()); } }); } @@ -210,7 +212,8 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel4(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel4))); form.setAgeLevel5(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel5))); form.setAgeLevel6(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getAgeLevel6))); - form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); +// form.setPartyMemberCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getPartyMemberCount))); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setResiTotal(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getResiTotal))); form.setRegisterUserCount(partyInfoList.stream().collect(Collectors.summingInt(PartyInfoResultDTO::getRegisterUserCount))); result.add(form); @@ -361,6 +364,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { form.setAgeLevel3(disposeAgeArea(partyInfos,NumConstant.THIRTY_ONE,NumConstant.FORTY)); form.setAgeLevel4(disposeAgeArea(partyInfos,NumConstant.FORTY_ONE,NumConstant.FIFTY)); form.setAgeLevel5(disposeAgeArea(partyInfos,NumConstant.FIFTY_ONE,NumConstant.SIXTY)); + form.setPartyMemberCount(calPartyMemberCount(form)); form.setAgeLevel6(disposeAge(partyInfos,NumConstant.SIXTY,true)); form.setCustomerId(customerId); form.setDataEndTime(dateId); @@ -370,7 +374,7 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { if (gridId.equals(user.getOrgId())){ form.setResiTotal(user.getResiTotal()); form.setRegisterUserCount(user.getRegisterUserCount()); - form.setPartyMemberCount(user.getPartyMemberCount()); +// form.setPartyMemberCount(user.getPartyMemberCount()); } }); } @@ -379,4 +383,9 @@ public class PartyBaseInfoServiceImpl implements PartyBaseInfoService { } return new GridPartyDTO(orgIds, result); } + + public Integer calPartyMemberCount(PartyBaseInfoFormDTO form){ + Integer result = form.getAgeLevel1() + form.getAgeLevel2() + form.getAgeLevel3() + form.getAgeLevel4() + form.getAgeLevel5() + form.getAgeLevel6(); + return result; + } } From af99db100242ee99dc1d395362c547751c62fa6b Mon Sep 17 00:00:00 2001 From: wangchao Date: Tue, 12 Jan 2021 10:36:24 +0800 Subject: [PATCH 18/25] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=BD=E5=8F=96=20bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FactOriginExtractController.java | 14 ++++++++++- .../FactOriginGroupMainDailyServiceImpl.java | 24 ++++++++++--------- .../todata/impl/GroupExtractServiceImpl.java | 2 +- .../stats/impl/DimGridServiceImpl.java | 2 +- .../resources/mapper/group/GroupDataDao.xml | 2 +- .../resources/mapper/stats/DimGridDao.xml | 15 +++++++----- 6 files changed, 38 insertions(+), 21 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java index 2abcd81edd..9542bdc580 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactOriginExtractController.java @@ -1,5 +1,7 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.dto.extract.form.ExtractOriginFormDTO; @@ -11,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * 原始数据清洗 @@ -114,7 +118,15 @@ public class FactOriginExtractController { **/ @PostMapping("groupdatacleaning") public Result groupDataCleaning(@RequestBody ExtractOriginFormDTO param) { - groupExtractService.extractGroupData(param); + if(StringUtils.isNotBlank(param.getStartDate()) && StringUtils.isNotBlank(param.getEndDate())){ + List finalDaysBetween = DateUtils.getDaysBetween(param.getStartDate(), param.getEndDate()); + ExtractOriginFormDTO paramNew = ConvertUtils.sourceToTarget(param, ExtractOriginFormDTO.class); + for (int i = 0; i < finalDaysBetween.size(); i++) { + String dateDimId = finalDaysBetween.get(i); + paramNew.setDateId(dateDimId); + groupExtractService.extractGroupData(paramNew); + } + }else groupExtractService.extractGroupData(param); return new Result(); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java index 83195d9902..94fadea5fe 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginGroupMainDailyServiceImpl.java @@ -85,19 +85,21 @@ public class FactOriginGroupMainDailyServiceImpl extends BaseServiceImpl originGroupData, List memberList,List missing) { - if (isFirst) { - //isFirst - baseDao.deleteBatchMemberByCustomerId(customerId,null,null); - } else { - if(StringUtils.isNotBlank(dateId)){ - baseDao.deleteBatchMemberByCustomerId(customerId,dateId,"date"); + if(!CollectionUtils.isEmpty(originGroupData)) { + if (isFirst) { + //isFirst + baseDao.deleteBatchMemberByCustomerId(customerId, null, null); + } else { + if (StringUtils.isNotBlank(dateId)) { + baseDao.deleteBatchMemberByCustomerId(customerId, dateId, "date"); + } } - } - //删除要插入的组主表数据 - baseDao.deleteBatchByGroupId(customerId,originGroupData.stream().map(FactOriginGroupMainDailyDTO :: getId).distinct().collect(Collectors.toList())); + //删除要插入的组主表数据 + baseDao.deleteBatchByGroupId(customerId, originGroupData.stream().map(FactOriginGroupMainDailyDTO::getId).distinct().collect(Collectors.toList())); - baseDao.insertBatchMain(originGroupData); - baseDao.insertBatchMembers(memberList); + baseDao.insertBatchMain(originGroupData); + baseDao.insertBatchMembers(memberList); + } if(!CollectionUtils.isEmpty(missing)){ baseDao.deleteBatchByGroupId(customerId,missing); baseDao.deleteMemberByGroupList(customerId,missing); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java index 275e8fd4e1..6f6451114d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/GroupExtractServiceImpl.java @@ -88,7 +88,7 @@ public class GroupExtractServiceImpl implements GroupExtractService { log.info("extractGroupData extractGroupData:result:{},param:{}", JSON.toJSONString(originGroupData), JSON.toJSONString(param)); List memberList = new LinkedList<>(); if (!CollectionUtils.isEmpty(originGroupData)) { - List gridList = dimGridService.getGridAttributes(param.getCustomerId(),originGroupData.stream().map(FactOriginGroupMainDailyDTO::getGridId).distinct().collect(Collectors.toList())); + List gridList = dimGridService.getGridAttributes(param.getCustomerId(),null); if (!CollectionUtils.isEmpty(gridList)) { Map gridMap = diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java index 5062b8e94f..a08e0af4ba 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/DimGridServiceImpl.java @@ -186,7 +186,7 @@ public class DimGridServiceImpl extends BaseServiceImpl getGridAttributes(String customerId,List gridIds) { - if(CollectionUtils.isEmpty(gridIds)) return Collections.EMPTY_LIST; + return baseDao.selectGridAttributes(customerId,gridIds); } } \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml index f47b266eba..9b6da626dc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/group/GroupDataDao.xml @@ -186,7 +186,7 @@ oper.UPDATED_TIME AS joinDate, IF(groupp.CREATED_BY = oper.CUSTOMER_USER_ID,'leader','member') AS leaderFlag, groupp.CREATED_BY AS groupOwnerId, - 'join' AS actionCode + IF(groupp.CREATED_BY = oper.CUSTOMER_USER_ID,'join','create') AS actionCode FROM RESI_GROUP groupp diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml index b83e517441..d7a33deb51 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/DimGridDao.xml @@ -104,11 +104,14 @@ dg.DEL_FLAG = '0' AND da.DEL_FLAG = '0' AND da.CUSTOMER_ID = #{customerId} - AND - ( - - dg.id = #{gridId} - - ) + + AND + ( + + dg.id = #{gridId} + + ) + + \ No newline at end of file From 0c2bc1bbd49be312e55753f75c9de2ed4867e1c4 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 12 Jan 2021 12:15:41 +0800 Subject: [PATCH 19/25] =?UTF-8?q?PioneerDataExtractService=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/controller/DemoController.java | 25 ++++++++----- .../impl/PioneerDataExtractServiceImpl.java | 36 +++++++++++++++++-- 2 files changed, 49 insertions(+), 12 deletions(-) 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 a22a573819..755705a6ce 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 @@ -20,7 +20,6 @@ import com.epmet.dto.AgencySubTreeDto; import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; -import com.epmet.dto.screen.form.ScreenCentralZoneDataFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyEntity; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityGridMonthlyEntity; @@ -47,7 +46,6 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.List; -import java.util.Map; import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutorService; import java.util.concurrent.Future; @@ -664,12 +662,21 @@ public class DemoController { @Autowired private PublicPartiTotalDataExtractService publicPartiTotalDataExtractService; @PostMapping("insertScreenPioneerData") - public Result insertScreenPioneerData(@RequestParam("customerId") String customerId, @RequestParam("dateId") String dateId) { + public Result insertScreenPioneerData(@RequestParam("customerId") String customerId, @RequestParam("dateId") String dateId,@RequestParam("type") String type) { if (StringUtils.isNotBlank(customerId) && StringUtils.isNotBlank(dateId)) { - pioneerDataExtractService.extractGridPioneerData(customerId, dateId); - pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); - pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); - } else { + if ("grid".equals(type)) { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + } else if ("community".equals(type)) { + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + } else if ("exceptcommunity".equals(type)) { + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } else { + pioneerDataExtractService.extractGridPioneerData(customerId, dateId); + pioneerDataExtractService.extractCommunityPioneerData(customerId, dateId); + pioneerDataExtractService.extractExceptCommunityPioneerData(customerId, dateId); + } + } + /*else { QueryWrapper customerEntityQueryWrapper = new QueryWrapper<>(); List customerEntityList = dimCustomerDao.selectList(customerEntityQueryWrapper); for (DimCustomerEntity customerEntity : customerEntityList) { @@ -677,8 +684,8 @@ public class DemoController { pioneerDataExtractService.extractCommunityPioneerData(customerEntity.getId(), "20200926"); pioneerDataExtractService.extractExceptCommunityPioneerData(customerEntity.getId(), "20200926"); } - } - return new Result(); + }*/ + return new Result().ok("调用成功"); } @PostMapping("extractPublicPartiTotalData") diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index f41366eb13..125fdbdc65 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -66,36 +66,44 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //何为参与: 议题的表决行为次数总计 //1、党员参与议事 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,gridId,null,null,NumConstant.ONE_STR)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员参与议事issueTotal="+entity.getIssueTotal()); if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,gridId,null,null,null); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";参与议事总数issueTotal=" + issueTotal); BigDecimal issueRatio=new BigDecimal(entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";issueRatio=" + issueRatio); entity.setIssueRatio(issueRatio.setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: entity.setTopicTotal(getTopicTotal(customerId, gridId, null)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布话题topicTotal"+entity.getTopicTotal()); //4、党员发布话题占比: 网格内注册党员发布的话题总数占 网格内话题总数的 比率 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { //当前网格内所有话题总数 int gridTopicTotal = getGridOrCommunityTopicTotal(customerId, gridId, null); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";当前网格内所有话题总数gridTopicTotal="+gridTopicTotal); if(gridTopicTotal == NumConstant.ZERO){ entity.setTopicRatio(BigDecimal.ZERO); }else{ BigDecimal topicRatio=new BigDecimal(entity.getTopicTotal() / gridTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布话题占比topicRatio="+topicRatio); entity.setTopicRatio(topicRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } } //当前网格内所有议题总数 int gridIssueTotal = getGridOrCommunityIssueTotal(customerId, gridId, null); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";当前网格内所有议题总数=" + gridIssueTotal); if (gridIssueTotal != NumConstant.ZERO) { //5、党员发布议题 entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, gridId, null)); + log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布议题publishIssueTotal"+entity.getPublishIssueTotal()); //6、党员发布议题占比 : 占网格内所有议题的比率 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); @@ -106,6 +114,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //7、议题转项目数 entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, gridId, null)); + log.info("extractGridPioneerData 当前网格id=" + gridId +";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占网格内议题总数的比率 if(entity.getShiftProjectTotal() == NumConstant.ZERO){ entity.setShiftProjectRatio(BigDecimal.ZERO); @@ -115,7 +124,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } }else{ -// log.info("当前网格内所有议题总数="+gridIssueTotal); + log.info("extractGridPioneerData 当前网格id="+gridId+";当前网格内所有议题总数 gridIssueTotal =0 "); entity.setPublishIssueTotal(NumConstant.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setShiftProjectTotal(NumConstant.ZERO); @@ -125,11 +134,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, gridId, null, DimObjectStatusConstant.RESOLVED)); + log.info("extractGridPioneerData 当前网格id="+gridId+";已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { // 10、占总结项目 int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, gridId, null, null); + log.info("extractGridPioneerData 当前网格id="+gridId+";总结项目closedProjectTotal="+closedProjectTotal); if(closedProjectTotal == NumConstant.ZERO){ entity.setResolvedProjectRatio(BigDecimal.ZERO); }else { @@ -172,30 +183,36 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService String communityId = entity.getOrgId(); //1、党员参与议事 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,communityId,null,NumConstant.ONE_STR)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员参与议事issueTotal="+entity.getIssueTotal()); if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,null,communityId,null,null); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";参与议事总数issueTotal="+issueTotal); entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: entity.setTopicTotal(getTopicTotal(customerId, null, communityId)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员发布话题topicTotal="+entity.getTopicTotal()); //4、党员发布话题占比: 社区内注册党员发布的话题总数占 社区内话题总数的 比率 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { //当前社区内所有话题总数 int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null, communityId); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有话题总数communityTopicTotal="+communityTopicTotal); entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / communityTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //当前社区内所有议题总数 int communityIssueTotal = getGridOrCommunityIssueTotal(customerId, null, communityId); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有议题总数communityIssueTotal="+communityIssueTotal); if (communityIssueTotal != NumConstant.ZERO) { //5、党员发布议题 entity.setPublishIssueTotal(getParyPublishIssueTotal(customerId, null, communityId)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";党员发布议题publishIssueTotal="+entity.getPublishIssueTotal()); //6、党员发布议题占比 : 占社区内所有议题的比率 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); @@ -204,10 +221,11 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //7、议题转项目数 entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占社区内议题总数的比率 entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ -// log.info("当前社区内所有议题总数="+communityIssueTotal); + log.info("extractCommunityPioneerData 当前communityId="+communityId+"communityIssueTotal =0"); entity.setPublishIssueTotal(NumConstant.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setShiftProjectTotal(NumConstant.ZERO); @@ -217,11 +235,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 entity.setResolvedProjectTotal(getGridOrCommunityClosedProjectTotal(customerId, null, communityId, DimObjectStatusConstant.RESOLVED)); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { // 10、占总结项目 int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null); + log.info("extractCommunityPioneerData 当前communityId="+communityId+";总结项目closedProjectTotal="+closedProjectTotal); entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); @@ -243,32 +263,39 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService } else { entity.setAgencyPath(entity.getAgencyPids().concat(StrConstant.COLON).concat(entity.getOrgId())); } + log.info("extractExceptCommunityPioneerData 当前orgId="+entity.getOrgId()+";agencyPath="+entity.getAgencyPath()); //1、党员参与议事 entity.setIssueTotal(calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),NumConstant.ONE_STR)); + log.info("extractExceptCommunityPioneerData 党员参与议事issueTotal="+entity.getIssueTotal()); if(entity.getIssueTotal()==0){ entity.setIssueRatio(BigDecimal.ZERO); }else{ //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),null); + log.info("extractExceptCommunityPioneerData 平台参与议事issueTotal="+issueTotal); entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: entity.setTopicTotal(getAgencyTopicTotal(customerId, entity.getAgencyPath(),NumConstant.ONE_STR)); + log.info("extractExceptCommunityPioneerData 党员发布话题topicTotal="+entity.getTopicTotal()); //4、党员发布话题占比: 组织内注册党员发布的话题总数占 组织内话题总数的 比率 if (entity.getTopicTotal() == NumConstant.ZERO) { entity.setTopicRatio(BigDecimal.ZERO); } else { //当前组织内所有话题总数 int agencyTopicTotal = getAgencyTopicTotal(customerId, entity.getAgencyPath(),null); + log.info("extractExceptCommunityPioneerData 当前组织内所有话题总数agencyTopicTotal="+agencyTopicTotal); entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / agencyTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //当前组织内所有议题总数 int agencyIssueTotal = getAgencyIssueTotal(customerId, entity.getAgencyPath()); + log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal="+agencyIssueTotal); if (agencyIssueTotal != NumConstant.ZERO) { //5、党员发布议题 entity.setPublishIssueTotal(getAgencyParyPublishIssueTotal(customerId, entity.getAgencyPath())); + log.info("extractExceptCommunityPioneerData 党员发布议题publishIssueTotal="+entity.getPublishIssueTotal()); //6、党员发布议题占比 : 占社区内所有议题的比率 if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); @@ -277,10 +304,11 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //7、议题转项目数 entity.setShiftProjectTotal(getAgencyShiftProjectTotal(customerId, entity.getAgencyPath())); + log.info("extractExceptCommunityPioneerData 议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占网格内议题总数的比率 entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ -// log.info("当前组织内所有议题总数="+agencyIssueTotal); + log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal=0"); entity.setPublishIssueTotal(NumConstant.ZERO); entity.setPublishIssueRatio(BigDecimal.ZERO); entity.setShiftProjectTotal(NumConstant.ZERO); @@ -290,11 +318,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 9、已解决项目 entity.setResolvedProjectTotal(getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), DimObjectStatusConstant.RESOLVED)); + log.info("extractExceptCommunityPioneerData 已解决项目resolvedProjectTotal="+entity.getResolvedProjectTotal()); if (entity.getResolvedProjectTotal() == NumConstant.ZERO) { entity.setResolvedProjectRatio(BigDecimal.ZERO); } else { // 10、占总结项目 int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null); + log.info("extractExceptCommunityPioneerData 总结项目closedProjectTotal="+closedProjectTotal); entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); From d2a155906a30583f15852b95f8bc321ee899f23a Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 12 Jan 2021 13:00:44 +0800 Subject: [PATCH 20/25] =?UTF-8?q?=E5=85=88=E9=94=8B=E6=A8=A1=E8=8C=83?= =?UTF-8?q?=E6=8A=BD=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PioneerDataExtractServiceImpl.java | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index 125fdbdc65..22eb0f5099 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -73,7 +73,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,gridId,null,null,null); log.info("extractGridPioneerData 当前网格id=" + gridId + ";参与议事总数issueTotal=" + issueTotal); - BigDecimal issueRatio=new BigDecimal(entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal issueRatio = new BigDecimal((double) entity.getIssueTotal() / issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); log.info("extractGridPioneerData 当前网格id=" + gridId + ";issueRatio=" + issueRatio); entity.setIssueRatio(issueRatio.setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } @@ -91,7 +91,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if(gridTopicTotal == NumConstant.ZERO){ entity.setTopicRatio(BigDecimal.ZERO); }else{ - BigDecimal topicRatio=new BigDecimal(entity.getTopicTotal() / gridTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal topicRatio = new BigDecimal((double) entity.getTopicTotal() / gridTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); log.info("extractGridPioneerData 当前网格id=" + gridId + ";党员发布话题占比topicRatio="+topicRatio); entity.setTopicRatio(topicRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } @@ -108,7 +108,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); }else{ - BigDecimal publishIssueRatio=new BigDecimal(entity.getPublishIssueTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal publishIssueRatio=new BigDecimal((double)entity.getPublishIssueTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); entity.setPublishIssueRatio(publishIssueRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } @@ -119,7 +119,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if(entity.getShiftProjectTotal() == NumConstant.ZERO){ entity.setShiftProjectRatio(BigDecimal.ZERO); }else{ - BigDecimal shiftProjectRatio=new BigDecimal(entity.getShiftProjectTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal shiftProjectRatio = new BigDecimal((double) entity.getShiftProjectTotal() / gridIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); entity.setShiftProjectRatio(shiftProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } @@ -144,7 +144,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if(closedProjectTotal == NumConstant.ZERO){ entity.setResolvedProjectRatio(BigDecimal.ZERO); }else { - BigDecimal resolvedProjectRatio=new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); + BigDecimal resolvedProjectRatio = new BigDecimal((double) entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)); entity.setResolvedProjectRatio(resolvedProjectRatio.setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } } @@ -190,7 +190,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,null,communityId,null,null); log.info("extractCommunityPioneerData 当前communityId="+communityId+";参与议事总数issueTotal="+issueTotal); - entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); + entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: @@ -203,7 +203,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //当前社区内所有话题总数 int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null, communityId); log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有话题总数communityTopicTotal="+communityTopicTotal); - entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / communityTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / communityTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //当前社区内所有议题总数 @@ -217,13 +217,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } - entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); //7、议题转项目数 entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId)); log.info("extractCommunityPioneerData 当前communityId="+communityId+";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占社区内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ log.info("extractCommunityPioneerData 当前communityId="+communityId+"communityIssueTotal =0"); entity.setPublishIssueTotal(NumConstant.ZERO); @@ -242,7 +242,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 10、占总结项目 int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null); log.info("extractCommunityPioneerData 当前communityId="+communityId+";总结项目closedProjectTotal="+closedProjectTotal); - entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, communityList); @@ -273,7 +273,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),null); log.info("extractExceptCommunityPioneerData 平台参与议事issueTotal="+issueTotal); - entity.setIssueRatio(new BigDecimal(entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); + entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: @@ -286,7 +286,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //当前组织内所有话题总数 int agencyTopicTotal = getAgencyTopicTotal(customerId, entity.getAgencyPath(),null); log.info("extractExceptCommunityPioneerData 当前组织内所有话题总数agencyTopicTotal="+agencyTopicTotal); - entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getTopicTotal() / agencyTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / agencyTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //当前组织内所有议题总数 @@ -300,13 +300,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } - entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getPublishIssueTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); //7、议题转项目数 entity.setShiftProjectTotal(getAgencyShiftProjectTotal(customerId, entity.getAgencyPath())); log.info("extractExceptCommunityPioneerData 议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占网格内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getShiftProjectTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal=0"); entity.setPublishIssueTotal(NumConstant.ZERO); @@ -325,7 +325,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 10、占总结项目 int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null); log.info("extractExceptCommunityPioneerData 总结项目closedProjectTotal="+closedProjectTotal); - entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal(entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, agencyList); From f03c5e0304600cf46d3e5b66157d2dc6cbc8cf21 Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Tue, 12 Jan 2021 13:16:21 +0800 Subject: [PATCH 21/25] =?UTF-8?q?=E5=85=88=E9=94=8B=E6=A8=A1=E8=8C=83?= =?UTF-8?q?=E6=8A=BD=E5=8F=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/PioneerDataExtractServiceImpl.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java index 22eb0f5099..234e5ed149 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/PioneerDataExtractServiceImpl.java @@ -190,7 +190,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,null,communityId,null,null); log.info("extractCommunityPioneerData 当前communityId="+communityId+";参与议事总数issueTotal="+issueTotal); - entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); + entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: @@ -203,7 +203,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //当前社区内所有话题总数 int communityTopicTotal = getGridOrCommunityTopicTotal(customerId, null, communityId); log.info("extractCommunityPioneerData 当前communityId="+communityId+";当前社区内所有话题总数communityTopicTotal="+communityTopicTotal); - entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / communityTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setTopicRatio(communityTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / communityTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //当前社区内所有议题总数 @@ -217,13 +217,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } - entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setPublishIssueRatio(communityIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / communityIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); //7、议题转项目数 entity.setShiftProjectTotal(getGridOrCommunityShiftProjectTotal(customerId, null, communityId)); log.info("extractCommunityPioneerData 当前communityId="+communityId+";议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占社区内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / communityIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / communityIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ log.info("extractCommunityPioneerData 当前communityId="+communityId+"communityIssueTotal =0"); entity.setPublishIssueTotal(NumConstant.ZERO); @@ -242,7 +242,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 10、占总结项目 int closedProjectTotal = getGridOrCommunityClosedProjectTotal(customerId, null, communityId, null); log.info("extractCommunityPioneerData 当前communityId="+communityId+";总结项目closedProjectTotal="+closedProjectTotal); - entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, communityList); @@ -273,7 +273,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //2、党员参与议事占比 int issueTotal=calPartyPartiIssueTotal(customerId,null,null,entity.getAgencyPath(),null); log.info("extractExceptCommunityPioneerData 平台参与议事issueTotal="+issueTotal); - entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); + entity.setIssueRatio(new BigDecimal((double)entity.getIssueTotal()/issueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX,RoundingMode.HALF_UP)); } //3、党员发布话题: @@ -286,7 +286,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService //当前组织内所有话题总数 int agencyTopicTotal = getAgencyTopicTotal(customerId, entity.getAgencyPath(),null); log.info("extractExceptCommunityPioneerData 当前组织内所有话题总数agencyTopicTotal="+agencyTopicTotal); - entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / agencyTopicTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setTopicRatio(agencyTopicTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getTopicTotal() / agencyTopicTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } //当前组织内所有议题总数 @@ -300,13 +300,13 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService if (entity.getPublishIssueTotal() == NumConstant.ZERO) { entity.setPublishIssueRatio(BigDecimal.ZERO); } - entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setPublishIssueRatio(agencyIssueTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getPublishIssueTotal() / agencyIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); //7、议题转项目数 entity.setShiftProjectTotal(getAgencyShiftProjectTotal(customerId, entity.getAgencyPath())); log.info("extractExceptCommunityPioneerData 议题转项目数shiftProjectTotal="+entity.getShiftProjectTotal()); //8、议题转项目占比 : 占网格内议题总数的比率 - entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / agencyIssueTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setShiftProjectRatio(entity.getShiftProjectTotal() == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getShiftProjectTotal() / agencyIssueTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); }else{ log.info("extractExceptCommunityPioneerData 当前组织内所有议题总数agencyIssueTotal=0"); entity.setPublishIssueTotal(NumConstant.ZERO); @@ -325,7 +325,7 @@ public class PioneerDataExtractServiceImpl implements PioneerDataExtractService // 10、占总结项目 int closedProjectTotal = getAgencyClosedProjectTotal(customerId, entity.getAgencyPath(), null); log.info("extractExceptCommunityPioneerData 总结项目closedProjectTotal="+closedProjectTotal); - entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); + entity.setResolvedProjectRatio(closedProjectTotal == NumConstant.ZERO ? BigDecimal.ZERO : new BigDecimal((double)entity.getResolvedProjectTotal() / closedProjectTotal).multiply(new BigDecimal(NumConstant.ONE_HUNDRED)).setScale(NumConstant.SIX, RoundingMode.HALF_UP)); } }); screenPioneerDataService.delAndSavePioneerData(customerId, OrgTypeConstant.AGENCY, IndexCalConstant.DELETE_SIZE, agencyList); From 230b9f231129cff20771cb0d1970d3121ca61fae Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 12 Jan 2021 13:55:03 +0800 Subject: [PATCH 22/25] =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/epmet/service/impl/SubscribeServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java index 450d747944..27a8497fb6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java +++ b/epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/service/impl/SubscribeServiceImpl.java @@ -391,7 +391,7 @@ public class SubscribeServiceImpl implements SubscribeService { @Override public void initAll(InitAllFormDTO formDTO) { AuthorizationInfoDTO authInfo = authorizationInfoDao.selectInfoByAppId(formDTO.getAppId()); - PersonalTemplateDTO publicDTO = personalTemplateService.get(formDTO.getTempId()); + PersonalTemplateDTO publicDTO = personalTemplateService.getTempByPid(authInfo.getCustomerId(), formDTO.getTempId()); //获取客户列表 List customerList = paCustomerService.getCustomerListByTestId(authInfo.getCustomerId()); From 3d3168829f013b43121a023fd4ad7848674a1d6d Mon Sep 17 00:00:00 2001 From: zhaoqifeng Date: Tue, 12 Jan 2021 14:31:42 +0800 Subject: [PATCH 23/25] =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/resources/mapper/PersonalTemplateDao.xml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml index 1b73c85569..644cda2bc6 100644 --- a/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml +++ b/epmet-module/epmet-third/epmet-third-server/src/main/resources/mapper/PersonalTemplateDao.xml @@ -39,7 +39,17 @@