diff --git a/epmet-admin/epmet-admin-server/pom.xml b/epmet-admin/epmet-admin-server/pom.xml
index b2421ae3b5..43cf8ecd31 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-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-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 3064252ce7..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,22 +25,16 @@ public class ExceptionUtils {
* @return 返回异常信息
*/
public static String getErrorStackTrace(Exception ex){
- return getErrorStackTraceOfThrowable(ex);
+ return getThrowableErrorStackTrace(ex);
}
- /**
- * @Description Throwable级别的错误信息
- * @return
- * @author wxz
- * @date 2021.07.07 14:37
- */
- public static String getErrorStackTraceOfThrowable(Throwable t) {
+ public static String getThrowableErrorStackTrace(Throwable ex) {
StringWriter sw = null;
PrintWriter pw = null;
try {
sw = new StringWriter();
pw = new PrintWriter(sw, true);
- t.printStackTrace(pw);
+ ex.printStackTrace(pw);
}finally {
try {
if(pw != null) {
diff --git a/epmet-gateway/src/main/resources/bootstrap.yml b/epmet-gateway/src/main/resources/bootstrap.yml
index b0212d95d7..5bfb3abed9 100644
--- a/epmet-gateway/src/main/resources/bootstrap.yml
+++ b/epmet-gateway/src/main/resources/bootstrap.yml
@@ -479,14 +479,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-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-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..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,9 +5,11 @@ 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;
+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 +22,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 {
/**
@@ -264,4 +267,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(@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 4846a3e557..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;
@@ -19,7 +20,7 @@ import org.springframework.stereotype.Component;
* @author: jianjun liu
* email:liujianjun@git.elinkit.com.cn
*/
-@Component
+//@Component
public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOpenFeignClient {
/**
@@ -259,4 +260,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result exeStatsDaily(BizDataFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "exeStatsDaily", formDTO);
}
+
+ @Override
+ public Result groupAndHotTopicTask(GroupTotalFormDTO formDTO) {
+ return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "groupAndHotTopic", formDTO);
+ }
}
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/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/controller/StatsGroupController.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java
index 9896ae6290..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,10 +1,15 @@
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;
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 +23,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 +88,39 @@ public class StatsGroupController {
return new Result();
}
+ /**
+ * @dscription 小组总数日统计和热议话题日统计任务
+ * @author sun
+ */
+ @PostMapping("/groupandhottopic")
+ public Result groupAndHotTopic(GroupTotalFormDTO formDTO) {
+ try {
+ statsGroupService.gridGroupTotal(formDTO);
+ logger.info("小组总数-网格日统计任务成功");
+ } catch (Exception e) {
+ logger.error("小组总数-网格日统计任务:", e);
+ }
+ try {
+ statsGroupService.agencyGroupTotal(formDTO);
+ logger.info("小组总数-机关日统计任务成功");
+ } catch (Exception e) {
+ logger.error("小组总数-机关日统计任务失败:", e);
+ }
+ TopicStatusFormDTO topic = ConvertUtils.sourceToTarget(formDTO, TopicStatusFormDTO.class);
+ try {
+ statsTopicService.gridTopicStatus(topic);
+ logger.info("热议中话题-网格日统计任务成功");
+ } catch (Exception e) {
+ logger.error("热议中话题-网格日统计任务失败:", e);
+ }
+ try {
+ statsTopicService.agencyTopicStatus(topic);
+ logger.info("热议中话题-机关日统计任务成功");
+ } catch (Exception e) {
+ logger.error("热议中话题-机关日统计任务失败:", e);
+ }
+ return new Result();
+ }
+
}
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
*/
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/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());
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/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);
}
}
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..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
@@ -29,4 +30,9 @@ public interface StatsGroupService {
*/
Result groupAgencyMonthly(String date);
+ /**
+ * @dscription 小组总数日统计和热议话题日统计任务
+ * @author sun
+ */
+ 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 669a97a60c..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;
@@ -37,4 +38,13 @@ public class StatsGroupServiceImpl implements StatsGroupService {
formDTO.setDate(date);
return statsPublicityFeignClient.groupAgencyMonthly(formDTO);
}
+
+ /**
+ * @dscription 小组总数日统计和热议话题日统计任务
+ * @author sun
+ */
+ @Override
+ 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
new file mode 100644
index 0000000000..cfba46d52f
--- /dev/null
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java
@@ -0,0 +1,40 @@
+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;
+
+/**
+ * @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);
+ 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 {
+ log.debug("groupAndHotTopicTask定时任务正在执行定时任务执行失败:" + result.getMsg());
+ }
+ }
+}
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;
+ }
+}
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 71340e5e10..f7955aa749 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
@@ -138,4 +138,5 @@ shutdown:
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
rocketmq:
+ enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@
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 bfe0f9f00f..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
@@ -2,65 +2,36 @@ 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();
+public class RocketMQConsumerRegister extends MQAbstractRegister {
+
+ @Override
+ public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
+ //判断逻辑,放到了了Pom.xml中,local不开启即可
+ //if (!EnvEnum.LOCAL.getCode().equals(env)) {
+ //...
+ //}
+
+ // 客户初始化监听器注册
+ register(consumerProperties,
+ ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP,
+ MessageModel.CLUSTERING,
+ TopicConstants.INIT_CUSTOMER,
+ "*",
+ new InitCustomerOrgRolesListener());
+
+ // ...其他监听器类似
}
-
- 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/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..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
@@ -145,4 +145,8 @@ shutdown:
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
rocketmq:
+ # 是否开启mq
+ enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@
+# consume-thread-min: 2
+# consume-thread-max: 2
diff --git a/epmet-module/oper-customize/oper-customize-server/pom.xml b/epmet-module/oper-customize/oper-customize-server/pom.xml
index 7a3fe23f8b..077a110233 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 84a0aaa422..1b218b4e54 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
@@ -168,4 +168,5 @@ shutdown:
waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志
rocketmq:
+ enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@