From 4f979b5c919a861912b11b66f3331952caaf7d2e Mon Sep 17 00:00:00 2001 From: yinzuomei <576302893@qq.com> Date: Wed, 14 Jul 2021 14:06:23 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E6=97=A5=E5=BF=97=E7=BB=84=E7=BB=87=E6=AC=A1=E6=95=B0=E3=80=81?= =?UTF-8?q?=E6=80=BB=E5=8F=82=E4=B8=8E=E4=BA=BA=E6=AC=A1=EF=BC=8C=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E6=8C=89=E7=85=A7=E7=BB=84=E7=BB=87=E6=AC=A1=E6=95=B0?= =?UTF-8?q?=E9=99=8D=E5=BA=8F=E6=8E=92=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ScreenWorkRecordOrgDailyServiceImpl.java | 14 ++++++++++++-- .../mapper/screen/ScreenCustomerAgencyDao.xml | 1 + .../mapper/screen/ScreenCustomerGridDao.xml | 1 + .../ScreenCustomerWorkRecordDictServiceImpl.java | 3 ++- .../impl/ScreenWorkRecordOrgDailyServiceImpl.java | 3 ++- .../ScreenWorkRecordOrgMonthlyServiceImpl.java | 3 ++- 6 files changed, 20 insertions(+), 5 deletions(-) diff --git a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index 52de467168..313d7008b6 100644 --- a/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -167,8 +167,18 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl= formDTO.getTopRow() ? - returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()) : returnDto.getSubRankList()); + //按照组织次数降序排列 + if(CollectionUtils.isNotEmpty(returnDto.getSubRankList())){ + Collections.sort(returnDto.getSubRankList(), new Comparator() { + @Override + public int compare(WorkRecordSubRank o1, WorkRecordSubRank o2) { + return o2.getParticipateTotal().compareTo(o1.getParticipateTotal()); + } + }); + if(returnDto.getSubRankList().size() >= formDTO.getTopRow()){ + returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()); + } + } return returnDto; } diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml index 183e74bb02..6f83783845 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml @@ -321,6 +321,7 @@ and sca.PID=#{agencyId} + order by CONVERT ( sca.AGENCY_NAME USING gbk ) ASC diff --git a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml index a700e40792..ac5f466642 100644 --- a/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml +++ b/epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml @@ -137,5 +137,6 @@ and m.PARENT_AGENCY_ID=#{agencyId} + order by CONVERT ( m.grid_name USING gbk ) ASC \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java index 7a6291717a..e082a9af8c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java @@ -35,6 +35,7 @@ import com.google.common.collect.Lists; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; import java.util.Arrays; import java.util.List; @@ -108,7 +109,7 @@ public class ScreenCustomerWorkRecordDictServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if (data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())) { int affectedRows = baseDao.deleteBatch(data.getCustomerId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java index 8f4d4f7c84..504a948c50 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java @@ -28,6 +28,7 @@ import com.epmet.entity.plugins.ScreenWorkRecordOrgDailyEntity; import com.epmet.service.plugins.ScreenWorkRecordOrgDailyService; import com.google.common.collect.Lists; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; /** * 工作日志-组织按日统计(累计值) @@ -42,7 +43,7 @@ public class ScreenWorkRecordOrgDailyServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if (data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())) { int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getDateId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java index 7ecd3c4eb6..a153cbac9e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java @@ -29,6 +29,7 @@ import com.epmet.service.plugins.ScreenWorkRecordOrgMonthlyService; import com.google.common.collect.Lists; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.CollectionUtils; /** * 工作日志-组织按月统计 @@ -51,7 +52,7 @@ public class ScreenWorkRecordOrgMonthlyServiceImpl extends BaseServiceImpl data) { - if(data.getIsFirst()){ + if(data.getIsFirst() && !CollectionUtils.isEmpty(data.getDataList())){ int affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); while(affectedRows > 0){ affectedRows = baseDao.deleteBatch(data.getCustomerId(),data.getMonthId()); From c5aa48918abd3bce7ccc98b38476f0c22c6604c7 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 14 Jul 2021 17:16:09 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=8A=BD?= =?UTF-8?q?=E5=8F=96rocketmq=E4=B8=BB=E8=A6=81=E6=B3=A8=E5=86=8C=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=88=B0rocketmq=E9=80=9A=E7=94=A8=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E5=90=84=E6=9C=8D=E5=8A=A1=E5=8F=AA=E5=81=9A=E6=9C=80?= =?UTF-8?q?=E7=AE=80=E5=8D=95=E7=9A=84=E8=B0=83=E7=94=A8=E5=8D=B3=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-commons/epmet-commons-rocketmq/pom.xml | 5 ++ .../register/ConsumerConfigProperties.java | 43 ---------- .../rocketmq/register/MQAbstractRegister.java | 77 ++++++++++++++++++ .../register/MQConsumerProperties.java | 29 +++++++ .../rocketmq/register/MQConsumerRegister.java | 79 ------------------- .../register/MQRegisterConfiguration.java | 35 ++++++++ .../epmet/mq/RocketMQConsumerRegister.java | 74 +++++------------ .../InitCustomerOrgRolesListener.java | 1 - .../src/main/resources/bootstrap.yml | 4 + 9 files changed, 171 insertions(+), 176 deletions(-) delete mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java create mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java create mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java delete mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java create mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java diff --git a/epmet-commons/epmet-commons-rocketmq/pom.xml b/epmet-commons/epmet-commons-rocketmq/pom.xml index 346f055ccc..75b7a9d1a5 100644 --- a/epmet-commons/epmet-commons-rocketmq/pom.xml +++ b/epmet-commons/epmet-commons-rocketmq/pom.xml @@ -26,5 +26,10 @@ org.projectlombok lombok + + com.epmet + epmet-commons-tools + 2.0.0 + diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java deleted file mode 100644 index 71a8fea41c..0000000000 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.epmet.commons.rocketmq.register; - -import lombok.Data; -import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently; - -import java.io.Serializable; - -/** - * desc:mq 消费配置类 - * - * @author: LiuJanJun - * @date: 2021/4/30 2:39 下午 - * @version: 1.0 - */ -@Data -public class ConsumerConfigProperties implements Serializable { - - private static final long serialVersionUID = 2069676324708473773L; - /** - * 消费者组 - */ - private String consumerGroup; - /** - * 主题 - */ - private String topic; - /** - * 标签 - */ - private String tag = "*"; - /** - * 最小消费的线程数 - */ - private int consumeThreadMin = 2; - /** - * 最大消费的线程数 - */ - private int consumeThreadMax = 4; - /** - * 消费监听器 - */ - private MessageListenerConcurrently consumerListener; -} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java new file mode 100644 index 0000000000..b1ca887c59 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java @@ -0,0 +1,77 @@ +package com.epmet.commons.rocketmq.register; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; +import org.apache.rocketmq.client.consumer.listener.MessageListener; +import org.apache.rocketmq.client.exception.MQClientException; +import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; + +/** + * @author wxz + * @Description 父类抽象注册器 + * @date 2021.07.14 15:38:21 + */ +@Slf4j +public abstract class MQAbstractRegister { + + /** + * @Description 注册所有监听器,由子类实现,做具体监听器的注册 + * @return + * @author wxz + * @date 2021.07.14 15:48 + */ + public abstract void registerAllListeners(String env, MQConsumerProperties consumerProperties); + + /** + * @Description 真正执行注册的方法,供子类直接调用,子类也可以覆盖该方法 + * @return + * @author wxz + * @date 2021.07.14 15:56 + */ + public void register(MQConsumerProperties consumerProperties, String group, MessageModel messageModel, String topic, String subExpression, MessageListener listener) { + try { + String nameServer = consumerProperties.getNameServer(); + Integer consumeThreadMin = consumerProperties.getConsumeThreadMin(); + Integer consumeThreadMax = consumerProperties.getConsumeThreadMax(); + String instanceName = buildInstanceName(); + // 实例化消费者 + DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); + + // 设置NameServer的地址 + consumer.setNamesrvAddr(nameServer); + consumer.setMessageModel(messageModel); + consumer.setInstanceName(instanceName); + // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 + consumer.subscribe(topic, subExpression); + // 注册回调实现类来处理从broker拉取回来的消息 + consumer.registerMessageListener(listener); + if (consumeThreadMin != null) { + consumer.setConsumeThreadMin(consumeThreadMin); + } + if (consumeThreadMax != null) { + consumer.setConsumeThreadMax(consumeThreadMax); + } + // 启动消费者实例 + consumer.start(); + log.info(String.format("监听器注册完成,消费者组:%s,Topic:%s,Tag:%s,实例名称:%s", group, topic, subExpression, instanceName)); + } catch (Exception e) { + log.error(String.format("监听器注册失败,消费者组:%s,Topic:%s,Tag:%s。详细信息:%s", group, topic, subExpression, ExceptionUtils.getErrorStackTrace(e))); + } + } + + /** + * @Description 构造实例名称 + * @return + * @author wxz + * @date 2021.07.14 15:56 + */ + private String buildInstanceName() { + String instanceName = ""; + for (int i = 0; i < 4; i++) { + int t = (int) (Math.random() * 10); + instanceName = instanceName.concat(t + ""); + } + return instanceName; + } +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java new file mode 100644 index 0000000000..76af70e0e2 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java @@ -0,0 +1,29 @@ +package com.epmet.commons.rocketmq.register; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * @Description 注册属性 + * @author wxz + * @date 2021.07.14 15:33:16 +*/ +@Data +@ConfigurationProperties(prefix = "rocketmq") +public class MQConsumerProperties { + + /** + * nameServer + */ + private String nameServer; + + /** + * 最小消费线程数 + */ + private Integer consumeThreadMin; + /** + * 最大消费线程数 + */ + private Integer consumeThreadMax; + +} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java deleted file mode 100644 index 3387b55931..0000000000 --- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java +++ /dev/null @@ -1,79 +0,0 @@ -package com.epmet.commons.rocketmq.register; - -import lombok.extern.slf4j.Slf4j; -import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; -import org.apache.rocketmq.client.exception.MQClientException; -import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; -import org.springframework.beans.factory.annotation.Value; - -import javax.annotation.PostConstruct; - -/** - * desc:注册mq监听器 - * - * @author liujianjun - */ -@Slf4j -public abstract class MQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String namesrvAddr; - - public abstract ConsumerConfigProperties getConsumerProperty(); - - - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerMQListener() { - ConsumerConfigProperties consumerProperty = getConsumerProperty(); - log.info("registerAllListeners consumers:{} success", consumerProperty); - //本地环境不注册 - //if (!"local".equals(env)) { - try { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(consumerProperty.getConsumerGroup()); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(namesrvAddr); - consumer.setMessageModel(MessageModel.CLUSTERING); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(consumer.getConsumerGroup(), consumerProperty.getTag()); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(consumerProperty.getConsumerListener()); - consumer.setConsumeThreadMin(consumerProperty.getConsumeThreadMin()); - consumer.setConsumeThreadMax(consumerProperty.getConsumeThreadMax()); - // 启动消费者实例 - consumer.start(); - } catch (MQClientException e) { - log.info("registerMQListener exception", e); - } - - //} - - } - - /** - * desc: 因为docker-compose部署有问题 所有自己命名 - * - * @param - * @return java.lang.String - * @author LiuJanJun - * @date 2021/4/30 5:00 下午 - */ - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } -} diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java new file mode 100644 index 0000000000..77e3d178f7 --- /dev/null +++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java @@ -0,0 +1,35 @@ +package com.epmet.commons.rocketmq.register; + +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; + +/** + * @author wxz + * @Description MQ注册配置类 + * @date 2021.07.14 15:36:24 + */ +@Configuration +@ConditionalOnProperty(prefix = "rocketmq", name = "enable", havingValue = "true", matchIfMissing = false) +@EnableConfigurationProperties(MQConsumerProperties.class) +@Slf4j +public class MQRegisterConfiguration { + + @Value("${spring.profiles.active}") + private String env; + @Autowired + private MQConsumerProperties consumerProperties; + @Autowired + private MQAbstractRegister mqRegister; + + @PostConstruct + public void register() { + mqRegister.registerAllListeners(env, consumerProperties); + log.info("监听器注册动作执行完毕"); + } +} diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index bfe0f9f00f..c607cf5929 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,65 +2,33 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.mq.listener.InitCustomerOrgRolesListener; -import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; -import org.apache.rocketmq.client.consumer.listener.MessageListener; -import org.apache.rocketmq.client.exception.MQClientException; import org.apache.rocketmq.common.protocol.heartbeat.MessageModel; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; -import javax.annotation.PostConstruct; - +/** + * @Description 如果rocketmq.enable=true,这里必须实现,且 实例化 + * @author wxz + * @date 2021.07.14 17:13:41 +*/ @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; - - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerOrgRolesListener()); - } - } catch (MQClientException e) { - e.printStackTrace(); - } - } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); +public class RocketMQConsumerRegister extends MQAbstractRegister { + + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + if (!EnvEnum.LOCAL.getCode().equals(env)) { + // 客户初始化监听器注册 + register(consumerProperties, + ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, + MessageModel.CLUSTERING, + TopicConstants.INIT_CUSTOMER, + "*", + new InitCustomerOrgRolesListener()); + + // ...其他监听器类似 } - - return instanceName; } - } diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java index 010e2044a3..7224ea757a 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java @@ -28,7 +28,6 @@ import java.util.concurrent.TimeUnit; * @return * @date 2021.03.03 16:10 */ -//@Component public class InitCustomerOrgRolesListener implements MessageListenerConcurrently { private Logger logger = LoggerFactory.getLogger(getClass()); 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 8baed16dd6..e7b5020a88 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 @@ -145,4 +145,8 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + # 是否开启mq + enable: true name-server: @rocketmq.nameserver@ +# consume-thread-min: 2 +# consume-thread-max: 2 From c06fa4cff9dcf5c52cebd777a9934a4787e7bd50 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 14 Jul 2021 17:33:26 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E4=BF=AE=E6=94=B9=EF=BC=9A=E6=8A=BD?= =?UTF-8?q?=E5=8F=96rocketmq=E4=B8=BB=E8=A6=81=E6=B3=A8=E5=86=8C=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E5=88=B0rocketmq=E9=80=9A=E7=94=A8=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E5=90=84=E6=9C=8D=E5=8A=A1=E5=8F=AA=E5=81=9A=E6=9C=80?= =?UTF-8?q?=E7=AE=80=E5=8D=95=E7=9A=84=E8=B0=83=E7=94=A8=E5=8D=B3=E5=8F=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-module/gov-org/gov-org-server/pom.xml | 4 ++++ .../epmet/mq/RocketMQConsumerRegister.java | 23 +++++++++++-------- .../src/main/resources/bootstrap.yml | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/epmet-module/gov-org/gov-org-server/pom.xml b/epmet-module/gov-org/gov-org-server/pom.xml index 9c353b0f90..180922a33d 100644 --- a/epmet-module/gov-org/gov-org-server/pom.xml +++ b/epmet-module/gov-org/gov-org-server/pom.xml @@ -170,6 +170,7 @@ + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -212,6 +213,7 @@ + false 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -255,6 +257,7 @@ + true 192.168.10.161:9876 epmet_message @@ -295,6 +298,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 epmet_message diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index c607cf5929..ea2474714b 100644 --- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -19,16 +19,19 @@ public class RocketMQConsumerRegister extends MQAbstractRegister { @Override public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - // 客户初始化监听器注册 - register(consumerProperties, - ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, - MessageModel.CLUSTERING, - TopicConstants.INIT_CUSTOMER, - "*", - new InitCustomerOrgRolesListener()); + //判断逻辑,放到了了Pom.xml中,local不开启即可 + //if (!EnvEnum.LOCAL.getCode().equals(env)) { + //... + //} - // ...其他监听器类似 - } + // 客户初始化监听器注册 + register(consumerProperties, + ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, + MessageModel.CLUSTERING, + TopicConstants.INIT_CUSTOMER, + "*", + new InitCustomerOrgRolesListener()); + + // ...其他监听器类似 } } 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 e7b5020a88..324ed0a5ca 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 @@ -146,7 +146,7 @@ shutdown: rocketmq: # 是否开启mq - enable: true + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ # consume-thread-min: 2 # consume-thread-max: 2 From 5250dba0c9c137a183b8b2f5a27772ec0a9eff59 Mon Sep 17 00:00:00 2001 From: wxz Date: Wed, 14 Jul 2021 17:49:17 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E7=BB=99=E5=BD=93=E5=89=8D=E7=94=A8?= =?UTF-8?q?=E5=88=B0mq=E7=9A=84=E6=9C=8D=E5=8A=A1=20=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9mq=E6=B3=A8=E5=86=8C=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- epmet-admin/epmet-admin-server/pom.xml | 4 ++ .../mq/listener/RocketMQConsumerRegister.java | 60 ++++--------------- .../src/main/resources/bootstrap.yml | 1 + .../data-statistical-server/pom.xml | 4 ++ .../epmet/mq/RocketMQConsumerRegister.java | 60 +++---------------- .../src/main/resources/bootstrap.yml | 1 + .../gov-issue/gov-issue-server/pom.xml | 4 ++ .../epmet/mq/RocketMQConsumerRegister.java | 53 +++------------- .../src/main/resources/bootstrap.yml | 1 + .../oper-customize-server/pom.xml | 4 ++ .../epmet/mq/RocketMQConsumerRegister.java | 53 +++------------- .../src/main/resources/bootstrap.yml | 1 + .../resi-group/resi-group-server/pom.xml | 4 ++ .../epmet/mq/RocketMQConsumerRegister.java | 59 +++--------------- .../src/main/resources/bootstrap.yml | 1 + 15 files changed, 72 insertions(+), 238 deletions(-) diff --git a/epmet-admin/epmet-admin-server/pom.xml b/epmet-admin/epmet-admin-server/pom.xml index c9903ba390..1bd83b7e49 100644 --- a/epmet-admin/epmet-admin-server/pom.xml +++ b/epmet-admin/epmet-admin-server/pom.xml @@ -136,6 +136,7 @@ false + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -172,6 +173,7 @@ false + false 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -205,6 +207,7 @@ true + true 192.168.10.161:9876 epmet_message @@ -238,6 +241,7 @@ true + true 192.168.11.187:9876;192.168.11.184:9876 epmet_message diff --git a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java index 1399fe6a13..8c07d1279d 100644 --- a/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java +++ b/epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq.listener; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.mq.listener.listener.AuthOperationLogListener; import com.epmet.mq.listener.listener.PointOperationLogListener; @@ -16,55 +18,15 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; +public class RocketMQConsumerRegister extends MQAbstractRegister { - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(nameServer, ConsomerGroupConstants.AUTH_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.AUTH, "*", new AuthOperationLogListener()); - register(nameServer, ConsomerGroupConstants.PROJECT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectOperationLogListener()); - register(nameServer, ConsomerGroupConstants.POINT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.POINT, "*", new PointOperationLogListener()); - } - } catch (MQClientException e) { - e.printStackTrace(); - } - } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListenerConcurrently listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.AUTH_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.AUTH, "*", new AuthOperationLogListener()); + register(consumerProperties, ConsomerGroupConstants.PROJECT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectOperationLogListener()); + register(consumerProperties, ConsomerGroupConstants.POINT_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.POINT, "*", new PointOperationLogListener()); - return instanceName; + // ...其他监听器类似 } - -} +} \ No newline at end of file diff --git a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml index 0d9082cec3..74c6bc2567 100644 --- a/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml +++ b/epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml @@ -136,4 +136,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/pom.xml b/epmet-module/data-statistical/data-statistical-server/pom.xml index d1b4c185c8..97f6c5eb85 100644 --- a/epmet-module/data-statistical/data-statistical-server/pom.xml +++ b/epmet-module/data-statistical/data-statistical-server/pom.xml @@ -256,6 +256,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.1.140:9876;192.168.1.141:9876 @@ -375,6 +376,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + local 192.168.1.140:9876;192.168.1.141:9876 @@ -493,6 +495,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.10.161:9876 @@ -609,6 +612,7 @@ SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1 + true 192.168.11.187:9876;192.168.11.184:9876 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index c383ae1b41..33ee4218e3 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.enums.EnvEnum; import lombok.extern.slf4j.Slf4j; @@ -14,57 +16,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; -@Slf4j @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; +public class RocketMQConsumerRegister extends MQAbstractRegister { - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectChangedCustomListener()); - } - } catch (MQClientException e) { - log.error("registerAllListeners exception", e); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectChangedCustomListener()); + // ...其他监听器类似 } - - public void register(String group, MessageModel messageModel, String topic, String subException, MessageListenerConcurrently listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - //一次批量拉去10条消息 - consumer.setConsumeMessageBatchMaxSize(NumConstant.TEN); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - -} +} \ No newline at end of file diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml index c0479d72a3..7723414608 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml @@ -207,4 +207,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ diff --git a/epmet-module/gov-issue/gov-issue-server/pom.xml b/epmet-module/gov-issue/gov-issue-server/pom.xml index b266f10c0c..04eb309484 100644 --- a/epmet-module/gov-issue/gov-issue-server/pom.xml +++ b/epmet-module/gov-issue/gov-issue-server/pom.xml @@ -175,6 +175,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.1.140:9876;192.168.1.141:9876 @@ -215,6 +216,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + false 192.168.1.140:9876;192.168.1.141:9876 @@ -254,6 +256,7 @@ https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4 SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + true 192.168.10.161:9876 @@ -294,6 +297,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index 1674e82553..ff16d20238 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.mq.listener.IssueProjectCategoryTagInitListener; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.MessageListener; @@ -13,50 +15,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @Component -public class RocketMQConsumerRegister { +public class RocketMQConsumerRegister extends MQAbstractRegister { - @Value("${rocketmq.name-server}") - private String nameServer; + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.ISSUE_PROJECT_CATEGORY_TAG, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new IssueProjectCategoryTagInitListener()); - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - register(nameServer, ConsomerGroupConstants.ISSUE_PROJECT_CATEGORY_TAG, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new IssueProjectCategoryTagInitListener()); - } catch (MQClientException e) { - e.printStackTrace(); - } + // ...其他监听器类似 } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - -} +} \ No newline at end of file diff --git a/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml b/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml index 9e787eb546..09823befef 100644 --- a/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml +++ b/epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml @@ -129,4 +129,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml index ae5cc37dbb..13ac2c8615 100644 --- a/epmet-module/oper-customize/oper-customize-server/pom.xml +++ b/epmet-module/oper-customize/oper-customize-server/pom.xml @@ -144,6 +144,7 @@ + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -186,6 +187,7 @@ + false 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -228,6 +230,7 @@ + true 192.168.10.161:9876 epmet_message @@ -268,6 +271,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 epmet_message diff --git a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index 057cf3c501..3a7120eba2 100644 --- a/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.mq.listener.InitCustomerComponentsListener; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.listener.MessageListener; @@ -13,50 +15,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; @Component -public class RocketMQConsumerRegister { +public class RocketMQConsumerRegister extends MQAbstractRegister { - @Value("${rocketmq.name-server}") - private String nameServer; - - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerComponentsListener()); - } catch (MQClientException e) { - e.printStackTrace(); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerComponentsListener()); + // ...其他监听器类似 } - - public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - } + 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 f9ee219699..3cb91d990b 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 @@ -126,6 +126,7 @@ dingTalk: secret: @dingTalk.robot.secret@ rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ # 停机选项 diff --git a/epmet-module/resi-group/resi-group-server/pom.xml b/epmet-module/resi-group/resi-group-server/pom.xml index 856b79afc0..494b7edfb4 100644 --- a/epmet-module/resi-group/resi-group-server/pom.xml +++ b/epmet-module/resi-group/resi-group-server/pom.xml @@ -205,6 +205,7 @@ + true 192.168.1.140:9876;192.168.1.141:9876 epmet_message @@ -260,6 +261,7 @@ SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd + false 192.168.1.140:9876;192.168.1.141:9876 @@ -314,6 +316,7 @@ + true 192.168.10.161:9876 @@ -365,6 +368,7 @@ + true 192.168.11.187:9876;192.168.11.184:9876 diff --git a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java index e219987289..3a28c34a95 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java +++ b/epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java @@ -2,6 +2,8 @@ package com.epmet.mq; import com.epmet.commons.rocketmq.constants.ConsomerGroupConstants; import com.epmet.commons.rocketmq.constants.TopicConstants; +import com.epmet.commons.rocketmq.register.MQAbstractRegister; +import com.epmet.commons.rocketmq.register.MQConsumerProperties; import com.epmet.commons.tools.enums.EnvEnum; import lombok.extern.slf4j.Slf4j; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; @@ -13,56 +15,13 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; -@Slf4j @Component -public class RocketMQConsumerRegister { - @Value("${spring.profiles.active}") - private String env; - @Value("${rocketmq.name-server}") - private String nameServer; +public class RocketMQConsumerRegister extends MQAbstractRegister { - /** - * @return - * @Description 注册监听器 - * @author wxz - * @date 2021.03.03 16:09 - */ - @PostConstruct - public void registerAllListeners() { - try { - if (!EnvEnum.LOCAL.getCode().equals(env)) { - register(ConsomerGroupConstants.GROUP_ACHIEVEMENT_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.GROUP_ACHIEVEMENT, "*", new GroupAchievementCustomListener()); - } - } catch (MQClientException e) { - log.error("registerAllListeners exception", e); - } + @Override + public void registerAllListeners(String env, MQConsumerProperties consumerProperties) { + // 客户初始化监听器注册 + register(consumerProperties, ConsomerGroupConstants.GROUP_ACHIEVEMENT_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.GROUP_ACHIEVEMENT, "*", new GroupAchievementCustomListener()); + // ...其他监听器类似 } - - public void register(String group, MessageModel messageModel, String topic, String subException, MessageListenerConcurrently listener) throws MQClientException { - // 实例化消费者 - DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group); - - // 设置NameServer的地址 - consumer.setNamesrvAddr(nameServer); - consumer.setMessageModel(messageModel); - consumer.setInstanceName(buildInstanceName()); - // 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息 - consumer.subscribe(topic, subException); - consumer.setConsumeMessageBatchMaxSize(10); - // 注册回调实现类来处理从broker拉取回来的消息 - consumer.registerMessageListener(listener); - // 启动消费者实例 - consumer.start(); - } - - private String buildInstanceName() { - String instanceName = ""; - for (int i = 0; i < 4; i++) { - int t = (int) (Math.random() * 10); - instanceName = instanceName.concat(t + ""); - } - - return instanceName; - } - -} +} \ No newline at end of file diff --git a/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml index d3a33a6d2a..b40b72b999 100644 --- a/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml +++ b/epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml @@ -159,4 +159,5 @@ shutdown: waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志 rocketmq: + enable: @rocketmq.enable@ name-server: @rocketmq.nameserver@ From 9eecb70e187407f4237eece7014476a6134a6436 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 15 Jul 2021 09:17:45 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BD=BF=E7=94=A8FeignCL?= =?UTF-8?q?ientFallbackFactory=E6=96=B9=E5=BC=8F=E8=B0=83=E7=94=A8datastat?= =?UTF-8?q?istical?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../tools/exception/ExceptionUtils.java | 4 ++++ .../feign/DataStatisticalOpenFeignClient.java | 4 +++- ...ataStatisticalOpenFeignClientFallBack.java | 2 +- ...isticalOpenFeignClientFallBackFactory.java | 20 +++++++++++++++++++ .../com/epmet/controller/DemoController.java | 7 +++++++ 5 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java index a5e559cbfa..6837104b36 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java @@ -25,6 +25,10 @@ public class ExceptionUtils { * @return 返回异常信息 */ public static String getErrorStackTrace(Exception ex){ + return getThrowableErrorStackTrace(ex); + } + + public static String getThrowableErrorStackTrace(Throwable ex) { StringWriter sw = null; PrintWriter pw = null; try { diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index ee5daf2a47..360cb3c71a 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -8,6 +8,7 @@ import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack; +import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -20,7 +21,8 @@ import org.springframework.web.bind.annotation.RequestBody; * @author: jianjun liu */ //url="http://localhost:8108" -@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class) +//@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class, url = "http://localhost:6666") +@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallbackFactory = DataStatisticalOpenFeignClientFallBackFactory.class) public interface DataStatisticalOpenFeignClient { /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index 4846a3e557..e15214e9d7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -19,7 +19,7 @@ import org.springframework.stereotype.Component; * @author: jianjun liu * email:liujianjun@git.elinkit.com.cn */ -@Component +//@Component public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOpenFeignClient { /** diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java new file mode 100644 index 0000000000..70768329c8 --- /dev/null +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java @@ -0,0 +1,20 @@ +package com.epmet.feign.impl; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.feign.DataStatisticalOpenFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +@Component +@Slf4j +public class DataStatisticalOpenFeignClientFallBackFactory implements FallbackFactory { + + private DataStatisticalOpenFeignClientFallBack fallback = new DataStatisticalOpenFeignClientFallBack(); + + @Override + public DataStatisticalOpenFeignClient create(Throwable cause) { + log.error(ExceptionUtils.getThrowableErrorStackTrace(cause));//自己写的工具类 + return fallback; + } +} diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java index ccb3d23d6a..8745239867 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java @@ -8,8 +8,10 @@ package com.epmet.controller; +import com.epmet.feign.DataStatisticalOpenFeignClient; import io.swagger.annotations.Api; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -24,10 +26,15 @@ import org.springframework.web.bind.annotation.RestController; @RequestMapping("demo") @Api(tags="定时任务") public class DemoController { + + @Autowired + private DataStatisticalOpenFeignClient client; + @GetMapping("testAlarm") public void testAlarm() { //for (int i = 0; i < 20; i++) { log.error("测试消息"); //} + client.agencyGridIssueStats(null); } } From 9d27eca645b0ef9eb38c988a622bc877ec49b6ee Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 15 Jul 2021 10:13:19 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E5=B0=8F=E7=BB=84=E6=80=BB=E6=95=B0?= =?UTF-8?q?=E7=83=AD=E8=AE=AE=E8=AF=9D=E9=A2=98=E5=8D=95=E7=8B=AC=E6=8B=86?= =?UTF-8?q?=E9=99=A4=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1=EF=BC=8C=E5=87=8C?= =?UTF-8?q?=E6=99=A8=E4=B8=89=E7=82=B9=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feign/DataStatisticalOpenFeignClient.java | 7 ++++ ...ataStatisticalOpenFeignClientFallBack.java | 5 +++ .../controller/StatsGroupController.java | 41 ++++++++++++++++++- .../com/epmet/service/StatsGroupService.java | 5 +++ .../service/impl/StatsGroupServiceImpl.java | 9 ++++ .../com/epmet/task/GroupAndHotTopicTask.java | 32 +++++++++++++++ 6 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index 360cb3c71a..acc0d4e162 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -266,4 +266,11 @@ public interface DataStatisticalOpenFeignClient { */ @PostMapping("/data/stats/bizData/stats/daily") Result exeStatsDaily(@RequestBody BizDataFormDTO formDTO); + + /** + * @dscription 小组总数日统计和热议话题日统计任务 + * @author sun + */ + @PostMapping("/data/stats/statsgroup/groupandhottopic") + Result groupAndHotTopicTask(); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index e15214e9d7..78bd498d10 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -259,4 +259,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp public Result exeStatsDaily(BizDataFormDTO formDTO) { return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "exeStatsDaily", formDTO); } + + @Override + public Result groupAndHotTopicTask() { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAndHotTopic"); + } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java index 9896ae6290..1f616385dc 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java @@ -4,7 +4,11 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.group.form.GroupTotalFormDTO; +import com.epmet.dto.stats.topic.form.TopicStatusFormDTO; import com.epmet.service.StatsGroupService; +import com.epmet.service.StatsTopicService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -18,9 +22,11 @@ import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("statsgroup") public class StatsGroupController { - + Logger logger = LoggerFactory.getLogger(getClass()); @Autowired private StatsGroupService statsGroupService; + @Autowired + private StatsTopicService statsTopicService; /** * 网格数、小组数、网格下所有组内人数(不去重) @@ -81,5 +87,38 @@ public class StatsGroupController { return new Result(); } + /** + * @dscription 小组总数日统计和热议话题日统计任务 + * @author sun + */ + @PostMapping("/groupandhottopic") + public Result groupAndHotTopic() { + try { + statsGroupService.gridGroupTotal(new GroupTotalFormDTO()); + logger.info("小组总数-网格日统计任务成功"); + } catch (Exception e) { + logger.error("小组总数-网格日统计任务:", e); + } + try { + statsGroupService.agencyGroupTotal(new GroupTotalFormDTO()); + logger.info("小组总数-机关日统计任务成功"); + } catch (Exception e) { + logger.error("小组总数-机关日统计任务失败:", e); + } + try { + statsTopicService.gridTopicStatus(new TopicStatusFormDTO()); + logger.info("热议中话题-网格日统计任务成功"); + } catch (Exception e) { + logger.error("热议中话题-网格日统计任务失败:", e); + } + try { + statsTopicService.agencyTopicStatus(new TopicStatusFormDTO()); + logger.info("热议中话题-机关日统计任务成功"); + } catch (Exception e) { + logger.error("热议中话题-机关日统计任务失败:", e); + } + return new Result(); + } + } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java index 84013b997d..c729f27863 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java @@ -29,4 +29,9 @@ public interface StatsGroupService { */ Result groupAgencyMonthly(String date); + /** + * @dscription 小组总数日统计和热议话题日统计任务 + * @author sun + */ + Result groupAndHotTopicTask(); } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java index 669a97a60c..49f27fc0b2 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java @@ -37,4 +37,13 @@ public class StatsGroupServiceImpl implements StatsGroupService { formDTO.setDate(date); return statsPublicityFeignClient.groupAgencyMonthly(formDTO); } + + /** + * @dscription 小组总数日统计和热议话题日统计任务 + * @author sun + */ + @Override + public Result groupAndHotTopicTask() { + return statsPublicityFeignClient.groupAndHotTopicTask(); + } } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java new file mode 100644 index 0000000000..d01035338f --- /dev/null +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java @@ -0,0 +1,32 @@ +package com.epmet.task; + +import com.epmet.commons.tools.utils.Result; +import com.epmet.service.DimInitService; +import com.epmet.service.StatsGroupService; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @dscription 小组总数日统计和热议话题日统计任务【因任务中用到了其他日统计表数据,需要在那些日统计任务之后单独执行】 + * 每天凌晨三点执行【0 0 3 * * ?】 + * @author sun + */ +@Slf4j +@Component("groupAndHotTopicTask") +public class GroupAndHotTopicTask implements ITask { + + @Autowired + private StatsGroupService statsGroupService; + + @Override + public void run(String params) { + log.debug("groupAndHotTopicTask定时任务正在执行,参数为:{}", params); + Result result = statsGroupService.groupAndHotTopicTask(); + if (result.success()){ + log.debug("groupAndHotTopicTask定时任务正在执行定时任务执行成功"); + }else { + log.debug("groupAndHotTopicTask定时任务正在执行定时任务执行失败:" + result.getMsg()); + } + } +} From b3cc5c0be83e349be40f12534b1ad266e6878e61 Mon Sep 17 00:00:00 2001 From: wxz Date: Thu, 15 Jul 2021 10:20:05 +0800 Subject: [PATCH 7/9] =?UTF-8?q?gov-access=E5=BC=80=E5=A7=8B=E6=94=B9?= =?UTF-8?q?=E7=94=A8FallbackFactory?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/feign/GovAccessFeignClient.java | 5 ++-- .../GovAccessFeignClientFallBack.java | 2 +- .../GovAccessFeignClientFallBackFactory.java | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBackFactory.java diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/GovAccessFeignClient.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/GovAccessFeignClient.java index c142cdef67..f42a1c3270 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/GovAccessFeignClient.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/GovAccessFeignClient.java @@ -4,7 +4,7 @@ import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.form.InitDefaultOperationsFormDTO; import com.epmet.dto.form.ListOpePermsFormDTO; -import com.epmet.feign.fallback.GovAccessFeignClientFallBack; +import com.epmet.feign.fallback.GovAccessFeignClientFallBackFactory; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -12,7 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody; import java.util.Set; //@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallBack.class, url = "http://localhost:8099") -@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallBack.class) +//@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallback = GovAccessFeignClientFallBack.class) +@FeignClient(name = ServiceConstant.GOV_ACCESS_SERVER, fallbackFactory = GovAccessFeignClientFallBackFactory.class) public interface GovAccessFeignClient { /** diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBack.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBack.java index 30e5d4141c..9f092331ad 100644 --- a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBack.java +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBack.java @@ -14,7 +14,7 @@ import java.util.Set; * @Description * @Author sun */ -@Component +//@Component public class GovAccessFeignClientFallBack implements GovAccessFeignClient { diff --git a/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBackFactory.java b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBackFactory.java new file mode 100644 index 0000000000..1d8be85778 --- /dev/null +++ b/epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBackFactory.java @@ -0,0 +1,28 @@ +package com.epmet.feign.fallback; + +import com.epmet.commons.tools.exception.ExceptionUtils; +import com.epmet.feign.GovAccessFeignClient; +import feign.hystrix.FallbackFactory; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * @Description fallBackFactory,用于抛出异常之后,返回一个Fallback降级处理对象 + * @author wxz + * @date 2021.07.15 09:54:14 +*/ +@Component +@Slf4j +public class GovAccessFeignClientFallBackFactory implements FallbackFactory { + + /** + * 降级处理对象 + */ + private GovAccessFeignClientFallBack fallBack = new GovAccessFeignClientFallBack(); + + @Override + public GovAccessFeignClient create(Throwable cause) { + log.error(ExceptionUtils.getThrowableErrorStackTrace(cause)); + return fallBack; + } +} From 395a2294fe2283498017c5e82ca15f4743684f11 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Thu, 15 Jul 2021 10:31:41 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=A5=E5=8F=82=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../epmet/feign/DataStatisticalOpenFeignClient.java | 3 ++- .../impl/DataStatisticalOpenFeignClientFallBack.java | 5 +++-- .../com/epmet/controller/StatsGroupController.java | 12 +++++++----- .../java/com/epmet/service/StatsGroupService.java | 3 ++- .../epmet/service/impl/StatsGroupServiceImpl.java | 5 +++-- .../java/com/epmet/task/GroupAndHotTopicTask.java | 10 +++++++++- 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java index acc0d4e162..93d81104d5 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java @@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; +import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack; @@ -272,5 +273,5 @@ public interface DataStatisticalOpenFeignClient { * @author sun */ @PostMapping("/data/stats/statsgroup/groupandhottopic") - Result groupAndHotTopicTask(); + Result groupAndHotTopicTask(@RequestBody GroupTotalFormDTO formDTO); } diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java index 78bd498d10..7bf37b9ce7 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java @@ -6,6 +6,7 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; import com.epmet.dto.extract.form.*; import com.epmet.dto.group.form.GroupStatsFormDTO; +import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.dto.screen.form.InitCustomerIndexForm; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.feign.DataStatisticalOpenFeignClient; @@ -261,7 +262,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp } @Override - public Result groupAndHotTopicTask() { - return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAndHotTopic"); + public Result groupAndHotTopicTask(GroupTotalFormDTO formDTO) { + return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAndHotTopic", formDTO); } } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java index 1f616385dc..baa6fb21d2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java @@ -1,5 +1,6 @@ package com.epmet.controller; +import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.StatsFormDTO; import com.epmet.dto.group.form.GroupStatsFormDTO; @@ -92,27 +93,28 @@ public class StatsGroupController { * @author sun */ @PostMapping("/groupandhottopic") - public Result groupAndHotTopic() { + public Result groupAndHotTopic(GroupTotalFormDTO formDTO) { try { - statsGroupService.gridGroupTotal(new GroupTotalFormDTO()); + statsGroupService.gridGroupTotal(formDTO); logger.info("小组总数-网格日统计任务成功"); } catch (Exception e) { logger.error("小组总数-网格日统计任务:", e); } try { - statsGroupService.agencyGroupTotal(new GroupTotalFormDTO()); + statsGroupService.agencyGroupTotal(formDTO); logger.info("小组总数-机关日统计任务成功"); } catch (Exception e) { logger.error("小组总数-机关日统计任务失败:", e); } + TopicStatusFormDTO topic = ConvertUtils.sourceToTarget(formDTO, TopicStatusFormDTO.class); try { - statsTopicService.gridTopicStatus(new TopicStatusFormDTO()); + statsTopicService.gridTopicStatus(topic); logger.info("热议中话题-网格日统计任务成功"); } catch (Exception e) { logger.error("热议中话题-网格日统计任务失败:", e); } try { - statsTopicService.agencyTopicStatus(new TopicStatusFormDTO()); + statsTopicService.agencyTopicStatus(topic); logger.info("热议中话题-机关日统计任务成功"); } catch (Exception e) { logger.error("热议中话题-机关日统计任务失败:", e); diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java index c729f27863..94a2595331 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java @@ -1,6 +1,7 @@ package com.epmet.service; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.group.form.GroupTotalFormDTO; /** * @Author zxc @@ -33,5 +34,5 @@ public interface StatsGroupService { * @dscription 小组总数日统计和热议话题日统计任务 * @author sun */ - Result groupAndHotTopicTask(); + Result groupAndHotTopicTask(GroupTotalFormDTO formDTO); } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java index 49f27fc0b2..290c04733e 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java @@ -2,6 +2,7 @@ package com.epmet.service.impl; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.group.form.GroupStatsFormDTO; +import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.service.StatsGroupService; import com.epmet.feign.DataStatisticalOpenFeignClient; import org.springframework.beans.factory.annotation.Autowired; @@ -43,7 +44,7 @@ public class StatsGroupServiceImpl implements StatsGroupService { * @author sun */ @Override - public Result groupAndHotTopicTask() { - return statsPublicityFeignClient.groupAndHotTopicTask(); + public Result groupAndHotTopicTask(GroupTotalFormDTO formDTO) { + return statsPublicityFeignClient.groupAndHotTopicTask(formDTO); } } diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java index d01035338f..cfba46d52f 100644 --- a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java +++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java @@ -1,9 +1,13 @@ package com.epmet.task; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.utils.Result; +import com.epmet.dto.extract.form.ExtractOriginFormDTO; +import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.service.DimInitService; import com.epmet.service.StatsGroupService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -22,7 +26,11 @@ public class GroupAndHotTopicTask implements ITask { @Override public void run(String params) { log.debug("groupAndHotTopicTask定时任务正在执行,参数为:{}", params); - Result result = statsGroupService.groupAndHotTopicTask(); + GroupTotalFormDTO formDTO = new GroupTotalFormDTO(); + if (StringUtils.isNotBlank(params)) { + formDTO = JSON.parseObject(params, GroupTotalFormDTO.class); + } + Result result = statsGroupService.groupAndHotTopicTask(formDTO); if (result.success()){ log.debug("groupAndHotTopicTask定时任务正在执行定时任务执行成功"); }else { From c46b6043a673f3dc9c910979c85e438d4e147aa2 Mon Sep 17 00:00:00 2001 From: jianjun Date: Thu, 15 Jul 2021 10:41:05 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=A4=96=E9=83=A8=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E9=89=B4=E6=9D=83=20=E5=8A=A0=E5=BC=BA=20=F0=9F=88=B2=EF=B8=8F?= =?UTF-8?q?=E4=B9=B1=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/bootstrap.yml | 12 ++- .../AnScreenCollController.java | 2 +- .../{ => external}/BaseReportController.java | 2 +- .../FactIndexCollectController.java | 2 +- .../GovernanceDataReportController.java | 3 +- .../IndexCalculateController.java | 2 +- .../KcScreenCollController.java | 78 +++++++++---------- .../ScreenProjectDataCollController.java | 2 +- .../ShiBeiScreenCollController.java | 2 +- .../{ => external}/StatsUserController.java | 3 +- .../{ => external}/plugins/OfsController.java | 8 +- .../plugins/WorkRecordColController.java | 4 +- 12 files changed, 65 insertions(+), 55 deletions(-) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/AnScreenCollController.java (99%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/BaseReportController.java (99%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/FactIndexCollectController.java (99%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/GovernanceDataReportController.java (97%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/IndexCalculateController.java (99%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/KcScreenCollController.java (98%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/ScreenProjectDataCollController.java (99%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/ShiBeiScreenCollController.java (99%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/StatsUserController.java (96%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/plugins/OfsController.java (97%) rename epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/{ => external}/plugins/WorkRecordColController.java (96%) diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml index bc6bb866cd..815c660613 100644 --- a/epmet-gateway/src/main/resources/bootstrap.yml +++ b/epmet-gateway/src/main/resources/bootstrap.yml @@ -476,14 +476,24 @@ epmet: # 外部应用认证,使用AccessToken等头进行认证 externalOpenUrls: - /data/report/** - - /data/stats/** - /epmet/ext/** - /epmetuser/customerstaff/customerlist - /message/template/** - /data/aggregator/project/projectdistribution - /data/aggregator/epmetuser/open-staffdetail + #stats external包下 公共的类只外部暴露方法 纯外部使用的 暴漏整个 - /data/stats/statsuser/gm-uploadevent - /data/stats/statsuser/gm-uploaddata + - /data/stats/indexcalculate/all + - /data/stats/kcscreencoll/** + - /data/stats/indexcollect/** + - /data/stats/anscreencoll/** + - /data/stats/plugin/** + - /data/stats/screencoll/** + - /data/stats/project/** + - /data/stats/basereport/** + - /data/stats/governance/** + # 对外开放接口认证白名单 externalAuthUrlsWhiteList: diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/AnScreenCollController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/AnScreenCollController.java index 5b862b66ec..b2b4d55d18 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/AnScreenCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BaseReportController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/BaseReportController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BaseReportController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/BaseReportController.java index f8990a9a8f..47610548ca 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BaseReportController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/BaseReportController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/FactIndexCollectController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/FactIndexCollectController.java index 77f2ce51ec..f9e58a7df2 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/FactIndexCollectController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.indexcollect.form.*; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/GovernanceDataReportController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/GovernanceDataReportController.java similarity index 97% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/GovernanceDataReportController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/GovernanceDataReportController.java index 77913ac0d9..3c94792afa 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/GovernanceDataReportController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/GovernanceDataReportController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.extract.form.AgencyGovernDailyFormDTO; @@ -8,7 +8,6 @@ import com.epmet.service.GovernanceDataReportService; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.sql.ResultSet; /** * 治理能力数据上报 diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/IndexCalculateController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/IndexCalculateController.java index 9add28ae1c..29267ca44e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/IndexCalculateController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.exception.RenException; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/KcScreenCollController.java similarity index 98% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/KcScreenCollController.java index 34269ee507..766a21dfa7 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/KcScreenCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -27,13 +27,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_platform_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("homepage/platformsummary") public Result platFormSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -48,13 +48,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_issue_summary_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("issue/summary") public Result issueSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -69,13 +69,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table: screen_kc_issue_trend_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("issue/trend") public Result issueTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -90,13 +90,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_user_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("user/summary") public Result userSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -111,13 +111,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_volunteer_heat_rank_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("volunteer/heartrank") public Result volunteerHeartRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -132,13 +132,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_user_trend_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("user/userheartrank") public Result userHeartRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -153,13 +153,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_act_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("act/summary") public Result actSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -174,13 +174,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_act_trend_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("act/trend") public Result actTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -195,13 +195,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_volunteer_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("act/volunteersummary") public Result volunteerSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -216,13 +216,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_project_summary_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("project/summary") public Result projectSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -237,13 +237,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_project_category_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("project/categorysummary") public Result categorySummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -258,13 +258,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_project_satis_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("project/satisanalysis") public Result projectSatisanalysis(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -279,13 +279,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_summary_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/summary") public Result newsSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -300,13 +300,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_trend_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/trend") public Result newsTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -321,13 +321,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_rank * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/hotrank") public Result newsHotRank(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -342,13 +342,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_news_category_analysis * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("news/categoryanalysis") public Result newsCategoryAnalysis(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -363,13 +363,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_group_summary_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("group/summary") public Result groupSummary(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -384,13 +384,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_group_detail_grid_daily * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("group/detail") public Result groupDetail(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); @@ -405,13 +405,13 @@ public class KcScreenCollController { * 所以如果项目上是分批上传,第一次为isFirst=true,后面isFirst应为false * table:screen_kc_topic_trend_grid_monthly * - * + * * @param formDTO * @return void * @Author zhangyong * @Date 15:57 2020-09-09 **/ - + @PostMapping("group/topictrend") public Result groupTopicTrend(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO) { formDTO.setCustomerId(customerId); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java index db45cca198..7d4c7e9c71 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ShiBeiScreenCollController.java similarity index 99% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ShiBeiScreenCollController.java index 6cdc9ca44a..f142adbf6d 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ShiBeiScreenCollController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.dto.indexcollect.form.CustomerBizOrgFormDTO; diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/StatsUserController.java similarity index 96% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/StatsUserController.java index c42929f386..47ef13932f 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/StatsUserController.java @@ -1,4 +1,4 @@ -package com.epmet.controller; +package com.epmet.controller.external; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -30,6 +30,7 @@ public class StatsUserController { * @param formDTO * @description 工作端数据一期,用户分析:参与用户、注册用户分析 * @Date 2021/3/26 13:27 + * 自用的方法 不暴漏 **/ @RequestMapping("execute") public Result execute(@RequestBody StatsFormDTO formDTO) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/OfsController.java similarity index 97% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/OfsController.java index 33e7c281aa..02df903121 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/OfsController.java @@ -1,4 +1,4 @@ -package com.epmet.controller.plugins; +package com.epmet.controller.external.plugins; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -19,16 +19,16 @@ import org.springframework.web.bind.annotation.*; @RestController @RequestMapping("plugins/ofs") public class OfsController { - + @Autowired private OfsService ofsService; - + /** * @param customerId * @param formDTO * @author yinzuomei * @description 【146】一张清单 isFirst=true时,根据customerId先删除后增加 - * @Date 2021/1/22 10:19 + * @Date 2021/1/22 10:19 **/ @PostMapping("onelist-daily") public Result collOneList(@RequestHeader("CustomerId") String customerId, @RequestBody ScreenCollFormDTO formDTO){ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/WorkRecordColController.java similarity index 96% rename from epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java rename to epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/WorkRecordColController.java index 8bbce3e324..5ed27c3930 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/WorkRecordColController.java @@ -1,4 +1,4 @@ -package com.epmet.controller.plugins; +package com.epmet.controller.external.plugins; import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.validator.ValidatorUtils; @@ -35,7 +35,7 @@ public class WorkRecordColController { * 按月上传工作日志统计数据时,同步调用此接口上传字典信息 * @param customerId * @param data - * @return com.epmet.commons.tools.utils.Result + * @return com.epmet.commons.tools.utils.Result * @author wangc * @date 2021.02.04 16:16 */