Browse Source

Merge branch 'develop' of http://git.elinkit.com.cn:7070/r/epmet-cloud into release_temp

master
jianjun 4 years ago
parent
commit
1364c78d37
  1. 4
      epmet-admin/epmet-admin-server/pom.xml
  2. 60
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/mq/listener/RocketMQConsumerRegister.java
  3. 1
      epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml
  4. 5
      epmet-commons/epmet-commons-rocketmq/pom.xml
  5. 43
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java
  6. 77
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQAbstractRegister.java
  7. 29
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerProperties.java
  8. 79
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java
  9. 35
      epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQRegisterConfiguration.java
  10. 12
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/exception/ExceptionUtils.java
  11. 12
      epmet-gateway/src/main/resources/bootstrap.yml
  12. 14
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java
  13. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml
  14. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml
  15. 12
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  16. 8
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  17. 20
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBackFactory.java
  18. 4
      epmet-module/data-statistical/data-statistical-server/pom.xml
  19. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java
  20. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/AnScreenCollController.java
  21. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/BaseReportController.java
  22. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/FactIndexCollectController.java
  23. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/GovernanceDataReportController.java
  24. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/IndexCalculateController.java
  25. 78
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/KcScreenCollController.java
  26. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ScreenProjectDataCollController.java
  27. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/ShiBeiScreenCollController.java
  28. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/StatsUserController.java
  29. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/OfsController.java
  30. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/external/plugins/WorkRecordColController.java
  31. 60
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  32. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenCustomerWorkRecordDictServiceImpl.java
  33. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgDailyServiceImpl.java
  34. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/plugins/impl/ScreenWorkRecordOrgMonthlyServiceImpl.java
  35. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml
  36. 7
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/controller/DemoController.java
  37. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java
  38. 10
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  39. 40
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java
  40. 5
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/GovAccessFeignClient.java
  41. 2
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBack.java
  42. 28
      epmet-module/gov-access/gov-access-client/src/main/java/com/epmet/feign/fallback/GovAccessFeignClientFallBackFactory.java
  43. 4
      epmet-module/gov-issue/gov-issue-server/pom.xml
  44. 53
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  45. 1
      epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml
  46. 4
      epmet-module/gov-org/gov-org-server/pom.xml
  47. 79
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  48. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java
  49. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml
  50. 4
      epmet-module/oper-customize/oper-customize-server/pom.xml
  51. 53
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  52. 1
      epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml
  53. 4
      epmet-module/resi-group/resi-group-server/pom.xml
  54. 59
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  55. 1
      epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml

4
epmet-admin/epmet-admin-server/pom.xml

@ -136,6 +136,7 @@
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -172,6 +173,7 @@
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -205,6 +207,7 @@
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -238,6 +241,7 @@
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>

60
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;
// ...其他监听器类似
}
}
}

1
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@

5
epmet-commons/epmet-commons-rocketmq/pom.xml

@ -26,5 +26,10 @@
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies>
</project>

43
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/ConsumerConfigProperties.java

@ -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;
}

77
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;
}
}

29
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;
}

79
epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/register/MQConsumerRegister.java

@ -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;
}
}

35
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("监听器注册动作执行完毕");
}
}

12
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) {

12
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:

14
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<ScreenW
}
returnDto.setParticipateTotal(participateTotal);
returnDto.setParticipateUserTotal(participateUserTotal);
returnDto.setSubRankList(CollectionUtils.isNotEmpty(returnDto.getSubRankList()) && returnDto.getSubRankList().size() >= formDTO.getTopRow() ?
returnDto.getSubRankList().subList(NumConstant.ZERO, formDTO.getTopRow()) : returnDto.getSubRankList());
//按照组织次数降序排列
if(CollectionUtils.isNotEmpty(returnDto.getSubRankList())){
Collections.sort(returnDto.getSubRankList(), new Comparator<WorkRecordSubRank>() {
@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;
}

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerAgencyDao.xml

@ -321,6 +321,7 @@
and sca.PID=#{agencyId}
</otherwise>
</choose>
order by CONVERT ( sca.AGENCY_NAME USING gbk ) ASC
</select>
<!-- 根据agencyId查询网格 -->

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/screen/ScreenCustomerGridDao.xml

@ -137,5 +137,6 @@
and m.PARENT_AGENCY_ID=#{agencyId}
</otherwise>
</choose>
order by CONVERT ( m.grid_name USING gbk ) ASC
</select>
</mapper>

12
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);
}

8
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);
}
}

20
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<DataStatisticalOpenFeignClient> {
private DataStatisticalOpenFeignClientFallBack fallback = new DataStatisticalOpenFeignClientFallBack();
@Override
public DataStatisticalOpenFeignClient create(Throwable cause) {
log.error(ExceptionUtils.getThrowableErrorStackTrace(cause));//自己写的工具类
return fallback;
}
}

4
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -256,6 +256,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
@ -375,6 +376,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>local</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
@ -493,6 +495,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
</properties>
</profile>
@ -609,6 +612,7 @@
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
</properties>
</profile>

43
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();
}
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/AnScreenCollController.java → 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;

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/BaseReportController.java → 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;

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java → 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.*;

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/GovernanceDataReportController.java → 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;
/**
* 治理能力数据上报

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexCalculateController.java → 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;

78
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/KcScreenCollController.java → 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<KcHomePageFormDTO> 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<KcIssueSummaryFormDTO> 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<KcIssueTrendFormDTO> 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<KcUserSummaryFormDTO> 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<KcVolunteerHeartRankFormDTO> 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<KcUserHeartRankFormDTO> 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<KcActSummaryFormDTO> 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<KcActTrendFormDTO> 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<KcVolunteerSummaryFormDTO> 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<KcProjectSummaryFormDTO> 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<KcCategorySummaryFormDTO> 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<KcProjectSatisanalysisFormDTO> 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<KcNewsSummaryFormDTO> 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<KcNewsTrendFormDTO> 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<KcNewsHotRankFormDTO> 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<KcNewsCategoryAnalysisFormDTO> 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<KcGroupSummaryFormDTO> 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<KcGroupDetailFormDTO> 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<KcGroupTopicTrendFormDTO> formDTO) {
formDTO.setCustomerId(customerId);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenProjectDataCollController.java → 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;

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiScreenCollController.java → 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;

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsUserController.java → 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) {

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/OfsController.java → 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<OneListFormDTO> formDTO){

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/plugins/WorkRecordColController.java → 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
*/

60
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;
}
}
}

3
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<Scr
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public void collect(ScreenCollFormDTO<ScreenCustomerWorkRecordDictDTO> 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());

3
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<ScreenW
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public void collectOrgDaily(ScreenCollFormDTO<ScreenWorkRecordCommonFormDTO> 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());

3
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<Scree
@DataSource(value = DataSourceConstant.EVALUATION_INDEX,datasourceNameFromArg = true)
@Override
public void collect(ScreenCollFormDTO<ScreenWorkRecordCommonFormDTO> 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());

1
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@

7
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);
}
}

6
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);
}

10
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);
}
}

40
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());
}
}
}

5
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 {
/**

2
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 {

28
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<GovAccessFeignClient> {
/**
* 降级处理对象
*/
private GovAccessFeignClientFallBack fallBack = new GovAccessFeignClientFallBack();
@Override
public GovAccessFeignClient create(Throwable cause) {
log.error(ExceptionUtils.getThrowableErrorStackTrace(cause));
return fallBack;
}
}

4
epmet-module/gov-issue/gov-issue-server/pom.xml

@ -175,6 +175,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
@ -215,6 +216,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
@ -254,6 +256,7 @@
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
</properties>
</profile>
@ -294,6 +297,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
</properties>
</profile>

53
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;
}
}
}

1
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@

4
epmet-module/gov-org/gov-org-server/pom.xml

@ -170,6 +170,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -212,6 +213,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -255,6 +257,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -295,6 +298,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>

79
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;
}
}

1
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());

4
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

4
epmet-module/oper-customize/oper-customize-server/pom.xml

@ -144,6 +144,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -186,6 +187,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -228,6 +230,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -268,6 +271,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>

53
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;
}
}

1
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@
# 停机选项

4
epmet-module/resi-group/resi-group-server/pom.xml

@ -205,6 +205,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties>
@ -260,6 +261,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties>
</profile>
@ -314,6 +316,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
</properties>
</profile>
@ -365,6 +368,7 @@
</dingTalk.robot.secret>
<!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
</properties>
</profile>

59
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;
}
}
}

1
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@

Loading…
Cancel
Save