Browse Source

Merge remote-tracking branch 'origin/dev_bugfix_ljj' into dev_bugfix_ljj

master
yinzuomei 4 years ago
parent
commit
17d694630d
  1. 4
      epmet-admin/epmet-admin-server/pom.xml
  2. 58
      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. 8
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  11. 6
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  12. 4
      epmet-module/data-statistical/data-statistical-server/pom.xml
  13. 43
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsGroupController.java
  14. 22
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java
  15. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java
  16. 58
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  17. 35
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java
  18. 54
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java
  19. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java
  20. 17
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  21. 29
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
  22. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java
  23. 36
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java
  24. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml
  25. 47
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml
  26. 20
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml
  27. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java
  28. 10
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  29. 40
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/GroupAndHotTopicTask.java
  30. 7
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java
  31. 4
      epmet-module/gov-issue/gov-issue-server/pom.xml
  32. 51
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  33. 1
      epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml
  34. 4
      epmet-module/gov-org/gov-org-server/pom.xml
  35. 79
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  36. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/mq/listener/InitCustomerOrgRolesListener.java
  37. 4
      epmet-module/gov-org/gov-org-server/src/main/resources/bootstrap.yml
  38. 2
      epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/LatestListFormDTO.java
  39. 3
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java
  40. 9
      epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml
  41. 4
      epmet-module/oper-customize/oper-customize-server/pom.xml
  42. 53
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  43. 1
      epmet-module/oper-customize/oper-customize-server/src/main/resources/bootstrap.yml
  44. 2
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml
  45. 4
      epmet-module/resi-group/resi-group-server/pom.xml
  46. 57
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
  47. 1
      epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml
  48. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java
  49. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java
  50. 10
      epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml
  51. 4
      epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml

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

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

58
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.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants; 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.commons.tools.enums.EnvEnum;
import com.epmet.mq.listener.listener.AuthOperationLogListener; import com.epmet.mq.listener.listener.AuthOperationLogListener;
import com.epmet.mq.listener.listener.PointOperationLogListener; import com.epmet.mq.listener.listener.PointOperationLogListener;
@ -16,55 +18,15 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@Component @Component
public class RocketMQConsumerRegister { public class RocketMQConsumerRegister extends MQAbstractRegister {
@Value("${spring.profiles.active}")
private String env;
@Value("${rocketmq.name-server}")
private String nameServer;
/** @Override
* @return public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
* @Description 注册监听器 // 客户初始化监听器注册
* @author wxz register(consumerProperties, ConsomerGroupConstants.AUTH_OPERATION_LOG_GROUP, MessageModel.CLUSTERING, TopicConstants.AUTH, "*", new AuthOperationLogListener());
* @date 2021.03.03 16:09 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());
@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 + "");
}
return instanceName; // ...其他监听器类似
} }
} }

1
epmet-admin/epmet-admin-server/src/main/resources/bootstrap.yml

@ -136,4 +136,5 @@ shutdown:
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
rocketmq: rocketmq:
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@ name-server: @rocketmq.nameserver@

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

@ -26,5 +26,10 @@
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.epmet</groupId>
<artifactId>epmet-commons-tools</artifactId>
<version>2.0.0</version>
</dependency>
</dependencies> </dependencies>
</project> </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("监听器注册动作执行完毕");
}
}

8
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO; import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.form.*;
import com.epmet.dto.group.form.GroupStatsFormDTO; 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.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBack;
@ -266,4 +267,11 @@ public interface DataStatisticalOpenFeignClient {
*/ */
@PostMapping("/data/stats/bizData/stats/daily") @PostMapping("/data/stats/bizData/stats/daily")
Result exeStatsDaily(@RequestBody BizDataFormDTO formDTO); Result exeStatsDaily(@RequestBody BizDataFormDTO formDTO);
/**
* @dscription 小组总数日统计和热议话题日统计任务
* @author sun
*/
@PostMapping("/data/stats/statsgroup/groupandhottopic")
Result groupAndHotTopicTask(@RequestBody GroupTotalFormDTO formDTO);
} }

6
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.StatsFormDTO;
import com.epmet.dto.extract.form.*; import com.epmet.dto.extract.form.*;
import com.epmet.dto.group.form.GroupStatsFormDTO; 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.screen.form.InitCustomerIndexForm;
import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO; import com.epmet.dto.stats.form.CustomerIdAndDateIdFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.feign.DataStatisticalOpenFeignClient;
@ -259,4 +260,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result exeStatsDaily(BizDataFormDTO formDTO) { public Result exeStatsDaily(BizDataFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "exeStatsDaily", 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);
}
} }

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

@ -256,6 +256,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> <dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties> </properties>
</profile> </profile>
@ -375,6 +376,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> <dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>local</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
</properties> </properties>
</profile> </profile>
@ -493,6 +495,7 @@
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret> <dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
</properties> </properties>
</profile> </profile>
@ -609,6 +612,7 @@
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret> <dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
</properties> </properties>
</profile> </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; package com.epmet.controller;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.StatsFormDTO; import com.epmet.dto.StatsFormDTO;
import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO; import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.dto.stats.topic.form.TopicStatusFormDTO;
import com.epmet.service.StatsGroupService; 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.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -18,9 +23,11 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("statsgroup") @RequestMapping("statsgroup")
public class StatsGroupController { public class StatsGroupController {
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired @Autowired
private StatsGroupService statsGroupService; private StatsGroupService statsGroupService;
@Autowired
private StatsTopicService statsTopicService;
/** /**
* 网格数小组数网格下所有组内人数不去重 * 网格数小组数网格下所有组内人数不去重
@ -81,5 +88,39 @@ public class StatsGroupController {
return new Result(); 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();
}
} }

22
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/issue/StatsIssueDao.java

@ -26,7 +26,8 @@ public interface StatsIssueDao extends BaseDao<IssueEntity> {
* @author zhaoqifeng * @author zhaoqifeng
* @date 2020/6/17 14:13 * @date 2020/6/17 14:13
*/ */
List<IssueAgencyDTO> selectAgencyIssueTotal(@Param("customerId") String customerId, @Param("date") String date); List<IssueAgencyDTO> selectAgencyIssueTotal(@Param("customerId") String customerId, @Param("date") String date,
@Param("gridList") List<String> gridList);
/** /**
* 获取当前日期组织下议题增量 * 获取当前日期组织下议题增量
@ -37,7 +38,8 @@ public interface StatsIssueDao extends BaseDao<IssueEntity> {
* @author zhaoqifeng * @author zhaoqifeng
* @date 2020/6/18 9:55 * @date 2020/6/18 9:55
*/ */
List<IssueAgencyDTO> selectAgencyIssueInc(@Param("customerId") String customerId, @Param("date") String date); List<IssueAgencyDTO> selectAgencyIssueInc(@Param("customerId") String customerId, @Param("date") String date,
@Param("gridList") List<String> gridList);
/** /**
* 已关闭议题统计 * 已关闭议题统计
@ -48,7 +50,8 @@ public interface StatsIssueDao extends BaseDao<IssueEntity> {
* @author zhaoqifeng * @author zhaoqifeng
* @date 2020/6/18 14:41 * @date 2020/6/18 14:41
*/ */
List<IssueAgencyDTO> selectAgencyClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date); List<IssueAgencyDTO> selectAgencyClosedIssueTotal(@Param("customerId") String customerId, @Param("date") String date,
@Param("gridList") List<String> gridList);
/** /**
* 已关闭议题增量 * 已关闭议题增量
@ -59,7 +62,8 @@ public interface StatsIssueDao extends BaseDao<IssueEntity> {
* @author zhaoqifeng * @author zhaoqifeng
* @date 2020/6/18 14:41 * @date 2020/6/18 14:41
*/ */
List<IssueAgencyDTO> selectAgencyClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date); List<IssueAgencyDTO> selectAgencyClosedIssueInc(@Param("customerId") String customerId, @Param("date") String date,
@Param("gridList") List<String> gridList);
/** /**
* @param issueEntity * @param issueEntity
@ -181,4 +185,14 @@ public interface StatsIssueDao extends BaseDao<IssueEntity> {
List<IssueVoteStatisticalResultDTO> selectIssueVoteStatis(@Param("customerId") String customerId, @Param("dateId") String dateId); List<IssueVoteStatisticalResultDTO> selectIssueVoteStatis(@Param("customerId") String customerId, @Param("dateId") String dateId);
List<IssueProjectCategoryDictDTO> selectCategory(@Param("customerId") String customerId, @Param("ids") Set<String> set); List<IssueProjectCategoryDictDTO> selectCategory(@Param("customerId") String customerId, @Param("ids") Set<String> set);
List<IssueDTO> getIssueTotalList(@Param("customerId") String customerId, @Param("date") String date);
/**
* @Author sun
* @Description 查询议题库已删除网格下可能存在的项目Id集合
**/
List<String> selectProjectByGrids(@Param("gridIds") List<String> gridIds);
} }

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/org/CustomerGridDao.java

@ -87,4 +87,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
* @return java.util.List<com.epmet.dto.org.CustomerStaffGridDTO> * @return java.util.List<com.epmet.dto.org.CustomerStaffGridDTO>
*/ */
List<CustomerStaffGridDTO> getCustomerStaffGridList(@Param("customerId") String customerId); List<CustomerStaffGridDTO> getCustomerStaffGridList(@Param("customerId") String customerId);
List<String> getDelGridList(@Param("customerId") String customerId);
/**
* @Author sun
* @Description 查询客户已删除网格列表
**/
List<String> selectDelGridList(@Param("customerId") String customerId);
} }

58
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.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants; 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.constant.NumConstant;
import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.enums.EnvEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -14,57 +16,13 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@Slf4j
@Component @Component
public class RocketMQConsumerRegister { public class RocketMQConsumerRegister extends MQAbstractRegister {
@Value("${spring.profiles.active}")
private String env;
@Value("${rocketmq.name-server}")
private String nameServer;
/** @Override
* @return public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
* @Description 注册监听器 // 客户初始化监听器注册
* @author wxz register(consumerProperties, ConsomerGroupConstants.PROJECT_CHANGED_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.PROJECT_CHANGED, "*", new ProjectChangedCustomListener());
* @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);
}
} }
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;
}
} }

35
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/IssueService.java

@ -28,7 +28,7 @@ public interface IssueService {
* @param date * @param date
* @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO> * @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO>
*/ */
List<IssueAgencyDTO> getAgencyIssueTotal(String customerId, String date); List<IssueAgencyDTO> getAgencyIssueTotal(String customerId, String date, List<String> gridList);
/** /**
* 获取当前日期组织下议题增量 * 获取当前日期组织下议题增量
@ -38,7 +38,7 @@ public interface IssueService {
* @param date * @param date
* @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO> * @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO>
*/ */
List<IssueAgencyDTO> getAgencyIssueInc(String customerId, String date); List<IssueAgencyDTO> getAgencyIssueInc(String customerId, String date, List<String> gridList);
/** /**
* 获取截止当前日期组织下已关闭议题统计 * 获取截止当前日期组织下已关闭议题统计
@ -48,7 +48,7 @@ public interface IssueService {
* @param date * @param date
* @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO> * @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO>
*/ */
List<IssueAgencyDTO> getAgencyClosedIssueTotal(String customerId, String date); List<IssueAgencyDTO> getAgencyClosedIssueTotal(String customerId, String date, List<String> gridList);
/** /**
* 获取当前日期组织下已关闭议题增量 * 获取当前日期组织下已关闭议题增量
@ -58,7 +58,7 @@ public interface IssueService {
* @param date * @param date
* @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO> * @return java.util.List<com.epmet.dto.issue.IssueAgencyDTO>
*/ */
List<IssueAgencyDTO> getAgencyClosedIssueInc(String customerId, String date); List<IssueAgencyDTO> getAgencyClosedIssueInc(String customerId, String date, List<String> gridList);
/** /**
* @param issueEntity * @param issueEntity
@ -183,4 +183,31 @@ public interface IssueService {
* @date 2021.03.09 00:23 * @date 2021.03.09 00:23
*/ */
Map<String,String> getIntegratedProjectCategory(Map<String, Set<String>> param,String customerId); Map<String,String> getIntegratedProjectCategory(Map<String, Set<String>> param,String customerId);
/**
* 获取议题总数
* @author zhaoqifeng
* @date 2021/7/20 16:20
* @param customerId
* @param date
* @return java.util.List<com.epmet.dto.issue.IssueDTO>
*/
List<IssueDTO> getIssueTotalList(String customerId, String date);
/**
* 获取议题增量
* @author zhaoqifeng
* @date 2021/7/20 16:20
* @param customerId
* @param date
* @return java.util.List<com.epmet.dto.issue.IssueDTO>
*/
List<IssueDTO> getIssueIncrList(String customerId, String date);
/**
* @Author sun
* @Description 查询议题库已删除网格下可能存在的项目Id集合
**/
List<String> getProjectByGrids(List<String> gridIds);
} }

54
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/Issue/impl/IssueServiceImpl.java

@ -34,23 +34,23 @@ public class IssueServiceImpl implements IssueService {
private StatsIssueDao statsIssueDao; private StatsIssueDao statsIssueDao;
@Override @Override
public List<IssueAgencyDTO> getAgencyIssueTotal(String customerId, String date) { public List<IssueAgencyDTO> getAgencyIssueTotal(String customerId, String date, List<String> gridList) {
return statsIssueDao.selectAgencyIssueTotal(customerId, date); return statsIssueDao.selectAgencyIssueTotal(customerId, date, gridList);
} }
@Override @Override
public List<IssueAgencyDTO> getAgencyIssueInc(String customerId, String date) { public List<IssueAgencyDTO> getAgencyIssueInc(String customerId, String date, List<String> gridList) {
return statsIssueDao.selectAgencyIssueInc(customerId, date); return statsIssueDao.selectAgencyIssueInc(customerId, date, gridList);
} }
@Override @Override
public List<IssueAgencyDTO> getAgencyClosedIssueTotal(String customerId, String date) { public List<IssueAgencyDTO> getAgencyClosedIssueTotal(String customerId, String date, List<String> gridList) {
return statsIssueDao.selectAgencyClosedIssueTotal(customerId, date); return statsIssueDao.selectAgencyClosedIssueTotal(customerId, date, gridList);
} }
@Override @Override
public List<IssueAgencyDTO> getAgencyClosedIssueInc(String customerId, String date) { public List<IssueAgencyDTO> getAgencyClosedIssueInc(String customerId, String date, List<String> gridList) {
return statsIssueDao.selectAgencyClosedIssueInc(customerId, date); return statsIssueDao.selectAgencyClosedIssueInc(customerId, date, gridList);
} }
/** /**
@ -169,4 +169,42 @@ public class IssueServiceImpl implements IssueService {
return map; return map;
} }
/**
* 获取议题总数
*
* @param customerId
* @param date
* @return java.util.List<com.epmet.dto.issue.IssueDTO>
* @author zhaoqifeng
* @date 2021/7/20 16:20
*/
@Override
public List<IssueDTO> getIssueTotalList(String customerId, String date) {
return null;
}
/**
* 获取议题增量
*
* @param customerId
* @param date
* @return java.util.List<com.epmet.dto.issue.IssueDTO>
* @author zhaoqifeng
* @date 2021/7/20 16:20
*/
@Override
public List<IssueDTO> getIssueIncrList(String customerId, String date) {
return null;
}
/**
* @Author sun
* @Description 查询议题库已删除网格下可能存在的项目Id集合
**/
@Override
public List<String> getProjectByGrids(List<String> gridIds) {
return statsIssueDao.selectProjectByGrids(gridIds);
}
} }

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/todata/impl/FactOriginExtractServiceImpl.java

@ -237,7 +237,7 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
} }
}); });
//网格、组织小组总数日统计 /* //网格、组织小组总数日统计
threadPool.submit(() -> { threadPool.submit(() -> {
GroupTotalFormDTO formDTO = new GroupTotalFormDTO(); GroupTotalFormDTO formDTO = new GroupTotalFormDTO();
formDTO.setCustomerId(param.getCustomerId()); formDTO.setCustomerId(param.getCustomerId());
@ -295,7 +295,7 @@ public class FactOriginExtractServiceImpl implements FactOriginExtractService {
log.error("热议中话题-机关日统计计算错误,参数:" + JSON.toJSONString(formDTO), e); log.error("热议中话题-机关日统计计算错误,参数:" + JSON.toJSONString(formDTO), e);
} }
} }
}); });*/
submitProjectRelationData(param, finalDaysBetween); submitProjectRelationData(param, finalDaysBetween);
} }

17
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -17,6 +17,7 @@ import com.epmet.dto.stats.FactIssueGridMonthlyDTO;
import com.epmet.entity.stats.*; import com.epmet.entity.stats.*;
import com.epmet.service.Issue.IssueService; import com.epmet.service.Issue.IssueService;
import com.epmet.service.StatsIssueService; import com.epmet.service.StatsIssueService;
import com.epmet.service.org.CustomerGridService;
import com.epmet.service.project.ProjectService; import com.epmet.service.project.ProjectService;
import com.epmet.service.stats.*; import com.epmet.service.stats.*;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
@ -57,6 +58,8 @@ public class StatsIssueServiceImpl implements StatsIssueService {
private FactIssueGridDailyService factIssueGridDailyService; private FactIssueGridDailyService factIssueGridDailyService;
@Autowired @Autowired
private FactIssueGridMonthlyService factIssueGridMonthlyService; private FactIssueGridMonthlyService factIssueGridMonthlyService;
@Autowired
private CustomerGridService customerGridService;
@Override @Override
public void agencyGridIssueStats(StatsFormDTO formDTO) { public void agencyGridIssueStats(StatsFormDTO formDTO) {
@ -119,16 +122,17 @@ public class StatsIssueServiceImpl implements StatsIssueService {
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
//清空数据 //清空数据
factIssueAgencyDailyService.deleteByCustomerId(customerId, dimId.getDateId()); factIssueAgencyDailyService.deleteByCustomerId(customerId, dimId.getDateId());
List<String> gridList = customerGridService.getDelGridList(customerId);
//获取当前客户下所有机关 //获取当前客户下所有机关
List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO);
//获取机关下议题各种状态的数目统计 //获取机关下议题各种状态的数目统计
List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString, gridList);
//获取机关下议题各种状态的数目增量 //获取机关下议题各种状态的数目增量
List<IssueAgencyDTO> issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString); List<IssueAgencyDTO> issueAgencyIncList = issueService.getAgencyIssueInc(customerId, dateString, gridList);
//获取机关下已关闭议题统计 //获取机关下已关闭议题统计
List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString, gridList);
//获取机关下已关闭议题增量 //获取机关下已关闭议题增量
List<IssueAgencyDTO> issueAgencyClosedIncList = issueService.getAgencyClosedIssueInc(customerId, dateString); List<IssueAgencyDTO> issueAgencyClosedIncList = issueService.getAgencyClosedIssueInc(customerId, dateString, gridList);
//已结案项目统计 //已结案项目统计
List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString);
//已结案项目增量 //已结案项目增量
@ -180,14 +184,15 @@ public class StatsIssueServiceImpl implements StatsIssueService {
dimAgencyDTO.setCustomerId(customerId); dimAgencyDTO.setCustomerId(customerId);
//获取日期相关维度 //获取日期相关维度
DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date); DimIdGenerator.DimIdBean dimId = DimIdGenerator.getDimIdBean(date);
List<String> gridList = customerGridService.getDelGridList(customerId);
//清空数据 //清空数据
factIssueAgencyMonthlyService.deleteByCustomerId(customerId, dimId.getMonthId()); factIssueAgencyMonthlyService.deleteByCustomerId(customerId, dimId.getMonthId());
//获取当前客户下所有机关 //获取当前客户下所有机关
List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO); List<DimAgencyDTO> agencyList = dimAgencyService.getDimAgencyList(dimAgencyDTO);
//获取机关下议题各种状态的数目统计 //获取机关下议题各种状态的数目统计
List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString); List<IssueAgencyDTO> issueAgencyTotalList = issueService.getAgencyIssueTotal(customerId, dateString, gridList);
//获取机关下已关闭议题统计 //获取机关下已关闭议题统计
List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString); List<IssueAgencyDTO> issueAgencyClosedTotalList = issueService.getAgencyClosedIssueTotal(customerId, dateString, gridList);
//已结案项目统计 //已结案项目统计
List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString); List<ProjectAgencyDTO> projectAgencyClosedTotalList = projectService.getAgencyClosedProjectTotal(customerId, dateString);
//统计机关下议题各个指标月度增量 //统计机关下议题各个指标月度增量

29
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java

@ -12,6 +12,7 @@ import com.epmet.entity.project.ProjectProcessEntity;
import com.epmet.entity.stats.*; import com.epmet.entity.stats.*;
import com.epmet.service.Issue.IssueService; import com.epmet.service.Issue.IssueService;
import com.epmet.service.StatsProjectService; import com.epmet.service.StatsProjectService;
import com.epmet.service.org.CustomerGridService;
import com.epmet.service.project.ProjectProcessService; import com.epmet.service.project.ProjectProcessService;
import com.epmet.service.project.ProjectService; import com.epmet.service.project.ProjectService;
import com.epmet.service.stats.*; import com.epmet.service.stats.*;
@ -29,6 +30,7 @@ import java.text.NumberFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/** /**
* 数据统计-项目独立于任何具体数据源外层的service * 数据统计-项目独立于任何具体数据源外层的service
@ -59,6 +61,8 @@ public class StatsProjectServiceImpl implements StatsProjectService {
private FactGridProjectDailyService factGridProjectDailyService; private FactGridProjectDailyService factGridProjectDailyService;
@Autowired @Autowired
private FactGridProjectMonthlyService factGridProjectMonthlyService; private FactGridProjectMonthlyService factGridProjectMonthlyService;
@Autowired
private CustomerGridService customerGridService;
/** /**
* @Author sun * @Author sun
@ -123,6 +127,31 @@ public class StatsProjectServiceImpl implements StatsProjectService {
log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId); log.info("StatsProjectServiceImpl.customerAgencyStats-根据客户Id查询项目进展表业务数据,对应客户Id:" + customerId);
List<ProjectProcessEntity> processList = projectProcessService.getProcessList(projectEntity); List<ProjectProcessEntity> processList = projectProcessService.getProcessList(projectEntity);
//20210721 sun 业务逻辑调整,网格删除,组织没有删除情况,相应的组织层级数据统计应舍弃以删除网格数据 start
//处理逻辑:查询已删除网格下项目Id,将已查询的项目、节点数据中的脏数据剔除【项目库有张表有网格Id,可以查出每个项目所属网格,但是关联该表后sql查询效率极低固舍弃此方案】
//4-1.查询客户下已删除网格列表下存在的项目Id集合
List<String> list = customerGridService.getdelGridProjectIdList(customerId);
if (list.size() > NumConstant.ZERO) {
Map<String, String> map = list.stream().collect(Collectors.toMap(String::toString, v -> v, (c1, c2) -> c1));
//4-2.遍历删除项目主表查询的无效数据
Iterator<ProjectEntity> proiter = projectList.iterator();
while (proiter.hasNext()) {
ProjectEntity next = proiter.next();
if (map.containsKey(next.getId())) {
proiter.remove();
}
}
//4-3.遍历删除项目节点表查询的无效数据
Iterator<ProjectProcessEntity> iterator = processList.iterator();
while (iterator.hasNext()) {
ProjectProcessEntity next = iterator.next();
if (map.containsKey(next.getProjectId())) {
iterator.remove();
}
}
}
//20210721 sun end
//5:机关层级日月统计 //5:机关层级日月统计
if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) { if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) {
//5.1:执行机关日数据统计 //5.1:执行机关日数据统计

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/CustomerGridService.java

@ -61,4 +61,20 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @return java.util.List<com.epmet.dto.org.CustomerStaffGridDTO> * @return java.util.List<com.epmet.dto.org.CustomerStaffGridDTO>
*/ */
List<CustomerStaffGridDTO> getCustomerStaffGridList(String customerId); List<CustomerStaffGridDTO> getCustomerStaffGridList(String customerId);
/**
* 获取已删除的grid
* @author zhaoqifeng
* @date 2021/7/20 16:33
* @param customerId
* @return java.util.List<java.lang.String>
*/
List<String> getDelGridList(String customerId);
/**
* @Author sun
* @Description 查询客户下已删除网格列表下存在的项目Id集合
**/
List<String> getdelGridProjectIdList(String customerId);
} }

36
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/org/impl/CustomerGridServiceImpl.java

@ -2,6 +2,7 @@ package com.epmet.service.org.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.org.CustomerGridDao; import com.epmet.dao.org.CustomerGridDao;
import com.epmet.dto.group.AgencyDTO; import com.epmet.dto.group.AgencyDTO;
@ -10,10 +11,12 @@ import com.epmet.dto.group.result.GridIdListByCustomerResultDTO;
import com.epmet.dto.org.CustomerStaffGridDTO; import com.epmet.dto.org.CustomerStaffGridDTO;
import com.epmet.dto.org.GridInfoDTO; import com.epmet.dto.org.GridInfoDTO;
import com.epmet.entity.org.CustomerGridEntity; import com.epmet.entity.org.CustomerGridEntity;
import com.epmet.service.Issue.IssueService;
import com.epmet.service.org.CustomerGridService; import com.epmet.service.org.CustomerGridService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -23,6 +26,8 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
@Autowired @Autowired
private CustomerGridDao customerGridDao; private CustomerGridDao customerGridDao;
@Autowired
private IssueService issueService;
@Override @Override
public List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end) { public List<CustomerGridEntity> listGridsByCreateTime(Date start, Date end) {
@ -79,4 +84,35 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
public List<CustomerStaffGridDTO> getCustomerStaffGridList(String customerId) { public List<CustomerStaffGridDTO> getCustomerStaffGridList(String customerId) {
return customerGridDao.getCustomerStaffGridList(customerId); return customerGridDao.getCustomerStaffGridList(customerId);
} }
/**
* 获取已删除的grid
*
* @param customerId
* @return java.util.List<java.lang.String>
* @author zhaoqifeng
* @date 2021/7/20 16:33
*/
@Override
public List<String> getDelGridList(String customerId) {
return null;
}
/**
* @Author sun
* @Description 查询客户下已删除网格列表下存在的项目Id集合
**/
@Override
public List<String> getdelGridProjectIdList(String customerId) {
List<String> resultList = new ArrayList<>();
//1.查询客户已删除网格列表
List<String> gridIds = customerGridDao.selectDelGridList(customerId);
if (gridIds.size() < NumConstant.ONE) {
return resultList;
}
//2.查询议题库已删除网格下可能存在的项目Id集合
resultList = issueService.getProjectByGrids(gridIds);
return resultList;
}
} }

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml

@ -207,4 +207,5 @@ shutdown:
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
rocketmq: rocketmq:
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@ name-server: @rocketmq.nameserver@

47
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/issue/StatsIssueDao.xml

@ -13,6 +13,11 @@
DEL_FLAG = '0' DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
AND DATE(UPDATED_TIME) <![CDATA[ <= ]]> #{date} AND DATE(UPDATED_TIME) <![CDATA[ <= ]]> #{date}
<if test="gridList != null and gridList.size() > 0">
<foreach collection="gridList" item="gridId" index="index">
AND GRID_ID != #{gridId}
</foreach>
</if>
GROUP BY GROUP BY
ORG_ID, ISSUE_STATUS ORG_ID, ISSUE_STATUS
</select> </select>
@ -34,6 +39,11 @@
i.DEL_FLAG = '0' i.DEL_FLAG = '0'
AND i.CUSTOMER_ID = #{customerId} AND i.CUSTOMER_ID = #{customerId}
AND DATE(ip.CREATED_TIME) = #{date} AND DATE(ip.CREATED_TIME) = #{date}
<if test="gridList != null and gridList.size() > 0">
<foreach collection="gridList" item="gridId" index="index">
AND i.GRID_ID != #{gridId}
</foreach>
</if>
GROUP BY GROUP BY
i.ORG_ID, i.ORG_ID,
ip.ISSUE_STATUS ip.ISSUE_STATUS
@ -55,6 +65,11 @@
AND ISSUE_STATUS = 'closed' AND ISSUE_STATUS = 'closed'
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
AND DATE(UPDATED_TIME) <![CDATA[ <= ]]> #{date} AND DATE(UPDATED_TIME) <![CDATA[ <= ]]> #{date}
<if test="gridList != null and gridList.size() > 0">
<foreach collection="gridList" item="gridId" index="index">
AND GRID_ID != #{gridId}
</foreach>
</if>
GROUP BY GROUP BY
ORG_ID, ORG_ID,
RESOLVE_TYPE RESOLVE_TYPE
@ -72,6 +87,11 @@
AND ISSUE_STATUS = 'closed' AND ISSUE_STATUS = 'closed'
AND CUSTOMER_ID = #{customerId} AND CUSTOMER_ID = #{customerId}
AND DATE(UPDATED_TIME) = #{date} AND DATE(UPDATED_TIME) = #{date}
<if test="gridList != null and gridList.size() > 0">
<foreach collection="gridList" item="gridId" index="index">
AND GRID_ID != #{gridId}
</foreach>
</if>
GROUP BY GROUP BY
ORG_ID, ORG_ID,
RESOLVE_TYPE RESOLVE_TYPE
@ -301,4 +321,31 @@
</foreach> </foreach>
order by a.category_type,a.sort order by a.category_type,a.sort
</select> </select>
<select id="getIssueTotalList" resultType="com.epmet.dto.issue.IssueDTO">
SELECT ORG_ID AS "agencyId",
ORG_ID_PATH AS "pIds",
ISSUE_STATUS AS "status",
COUNT(ID) AS "count"
FROM
issue
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND DATE(UPDATED_TIME) <![CDATA[ <= ]]> #{date}
GROUP BY
ORG_ID, ISSUE_STATUS
</select>
<select id="selectProjectByGrids" resultType="java.lang.String">
SELECT DISTINCT
ipr.project_id
FROM
issue_project_relation ipr
INNER JOIN issue i ON ipr.issue_id = i.id
WHERE 1=1
<foreach collection="gridIds" item="id" open="AND (" separator=" OR " close=")">
i.grid_id = #{id}
</foreach>
</select>
</mapper> </mapper>

20
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/org/CustomerGridDao.xml

@ -106,4 +106,24 @@
csg.DEL_FLAG = '0' csg.DEL_FLAG = '0'
AND csg.CUSTOMER_ID = #{customerId} AND csg.CUSTOMER_ID = #{customerId}
</select> </select>
<select id="getDelGridList" resultType="java.lang.String">
select
ID
from
customer_grid
where
DEL_FLAG = '1'
and customer_id = #{customerId}
</select>
<select id="selectDelGridList" resultType="java.lang.String">
SELECT
id
FROM
customer_grid
WHERE
del_flag != '0'
AND customer_id = #{customerId}
</select>
</mapper> </mapper>

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsGroupService.java

@ -1,6 +1,7 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.group.form.GroupTotalFormDTO;
/** /**
* @Author zxc * @Author zxc
@ -29,4 +30,9 @@ public interface StatsGroupService {
*/ */
Result groupAgencyMonthly(String date); 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.commons.tools.utils.Result;
import com.epmet.dto.group.form.GroupStatsFormDTO; import com.epmet.dto.group.form.GroupStatsFormDTO;
import com.epmet.dto.group.form.GroupTotalFormDTO;
import com.epmet.service.StatsGroupService; import com.epmet.service.StatsGroupService;
import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.feign.DataStatisticalOpenFeignClient;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -37,4 +38,13 @@ public class StatsGroupServiceImpl implements StatsGroupService {
formDTO.setDate(date); formDTO.setDate(date);
return statsPublicityFeignClient.groupAgencyMonthly(formDTO); 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());
}
}
}

7
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/service/impl/AccessServiceImpl.java

@ -439,6 +439,7 @@ public class AccessServiceImpl implements AccessService {
@Override @Override
public Set<String> listOperationPermissions(String staffId, String currAgencyId) { public Set<String> listOperationPermissions(String staffId, String currAgencyId) {
Set<String> filtedOps = new HashSet<>();
LoginUserDetailsResultDTO userDetails = getLoginUserDetails(loginUserUtil.getLoginUserApp(), loginUserUtil.getLoginUserClient(), loginUserUtil.getLoginUserId()); LoginUserDetailsResultDTO userDetails = getLoginUserDetails(loginUserUtil.getLoginUserApp(), loginUserUtil.getLoginUserClient(), loginUserUtil.getLoginUserId());
if (userDetails == null) { if (userDetails == null) {
@ -476,7 +477,9 @@ public class AccessServiceImpl implements AccessService {
CustomerAgencyDTO currAgencyDto = currAgencyRst.getData(); CustomerAgencyDTO currAgencyDto = currAgencyRst.getData();
if (currAgencyDto == null || currAgencyDto.getId() == null) { if (currAgencyDto == null || currAgencyDto.getId() == null) {
throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode(), "操作权限不足,当前组织信息不存在"); logger.warn(String.format("根据组织ID:{}未找到组织信息,返回空权限列表", currAgencyId));
return filtedOps;
//throw new RenException(EpmetErrorCode.REQUIRE_PERMISSION.getCode(), "操作权限不足,当前组织信息不存在");
} }
// 获取机关单位中的角色 // 获取机关单位中的角色
@ -489,8 +492,6 @@ public class AccessServiceImpl implements AccessService {
String currOrgIdPath = getOrgIdPath(currAgencyDto); String currOrgIdPath = getOrgIdPath(currAgencyDto);
String currOrgRelation = getCurrOrgRelation(belongOrgIdPath, currOrgIdPath); String currOrgRelation = getCurrOrgRelation(belongOrgIdPath, currOrgIdPath);
Set<String> filtedOps = new HashSet<>();
if (!CollectionUtils.isEmpty(roleList)) { if (!CollectionUtils.isEmpty(roleList)) {
roleList.forEach(role -> { roleList.forEach(role -> {
List<RoleOpeScopeResultDTO> opeAndScopeDTO = listAllRoleOperationScopesByRoleId(role.getId()); List<RoleOpeScopeResultDTO> opeAndScopeDTO = listAllRoleOperationScopesByRoleId(role.getId());

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

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

51
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.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants; 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 com.epmet.mq.listener.IssueProjectCategoryTagInitListener;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.MessageListener; import org.apache.rocketmq.client.consumer.listener.MessageListener;
@ -13,50 +15,13 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@Component @Component
public class RocketMQConsumerRegister { public class RocketMQConsumerRegister extends MQAbstractRegister {
@Value("${rocketmq.name-server}") @Override
private String nameServer; 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

@ -129,4 +129,5 @@ shutdown:
waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警 waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
rocketmq: rocketmq:
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@ name-server: @rocketmq.nameserver@

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

@ -170,6 +170,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </properties>
@ -212,6 +213,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </properties>
@ -255,6 +257,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </properties>
@ -295,6 +298,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </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.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants; 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.commons.tools.enums.EnvEnum;
import com.epmet.mq.listener.InitCustomerOrgRolesListener; 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.apache.rocketmq.common.protocol.heartbeat.MessageModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; /**
* @Description 如果rocketmq.enable=true这里必须实现 实例化
* @author wxz
* @date 2021.07.14 17:13:41
*/
@Component @Component
public class RocketMQConsumerRegister { public class RocketMQConsumerRegister extends MQAbstractRegister {
@Value("${spring.profiles.active}")
private String env; @Override
@Value("${rocketmq.name-server}") public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
private String nameServer; //判断逻辑,放到了了Pom.xml中,local不开启即可
//if (!EnvEnum.LOCAL.getCode().equals(env)) {
/** //...
* @return //}
* @Description 注册监听器
* @author wxz // 客户初始化监听器注册
* @date 2021.03.03 16:09 register(consumerProperties,
*/ ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP,
@PostConstruct MessageModel.CLUSTERING,
public void registerAllListeners() { TopicConstants.INIT_CUSTOMER,
try { "*",
if (!EnvEnum.LOCAL.getCode().equals(env)) { new InitCustomerOrgRolesListener());
register(nameServer, ConsomerGroupConstants.INIT_CUSTOMER_ORG_ROLES_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerOrgRolesListener());
} // ...其他监听器类似
} catch (MQClientException e) {
e.printStackTrace();
}
}
public void register(String nameServer, String group, MessageModel messageModel, String topic, String subException, MessageListener listener) throws MQClientException {
// 实例化消费者
DefaultMQPushConsumer consumer = new DefaultMQPushConsumer(group);
// 设置NameServer的地址
consumer.setNamesrvAddr(nameServer);
consumer.setMessageModel(messageModel);
consumer.setInstanceName(buildInstanceName());
// 订阅一个或者多个Topic,以及Tag来过滤需要消费的消息
consumer.subscribe(topic, subException);
// 注册回调实现类来处理从broker拉取回来的消息
consumer.registerMessageListener(listener);
// 启动消费者实例
consumer.start();
} }
private String buildInstanceName() {
String instanceName = "";
for (int i = 0; i < 4; i++) {
int t = (int) (Math.random() * 10);
instanceName = instanceName.concat(t + "");
}
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 * @return
* @date 2021.03.03 16:10 * @date 2021.03.03 16:10
*/ */
//@Component
public class InitCustomerOrgRolesListener implements MessageListenerConcurrently { public class InitCustomerOrgRolesListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass()); 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秒,发出告警 waitTimeSecs: 30 # 优雅停机等待时间,超过30秒,发出告警
rocketmq: rocketmq:
# 是否开启mq
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@ name-server: @rocketmq.nameserver@
# consume-thread-min: 2
# consume-thread-max: 2

2
epmet-module/gov-project/gov-project-client/src/main/java/com/epmet/dto/form/LatestListFormDTO.java

@ -37,5 +37,7 @@ public class LatestListFormDTO implements Serializable {
*/ */
private Integer pageSize = 3; private Integer pageSize = 3;
private Integer num = 0;
} }

3
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/service/impl/ProjectServiceImpl.java

@ -1014,7 +1014,8 @@ public class ProjectServiceImpl extends BaseServiceImpl<ProjectDao, ProjectEntit
**/ **/
@Override @Override
public List<LatestListResultDTO> getClosedProjectList(LatestListFormDTO formDTO) { public List<LatestListResultDTO> getClosedProjectList(LatestListFormDTO formDTO) {
int pageIndex = (formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize();
formDTO.setNum(pageIndex);
return baseDao.selectClosedProjectList(formDTO); return baseDao.selectClosedProjectList(formDTO);
} }

9
epmet-module/gov-project/gov-project-server/src/main/resources/mapper/ProjectDao.xml

@ -155,19 +155,24 @@
</select> </select>
<select id="selectClosedProjectList" resultType="com.epmet.dto.result.LatestListResultDTO"> <select id="selectClosedProjectList" resultType="com.epmet.dto.result.LatestListResultDTO">
SELECT SELECT DISTINCT
p.id AS "projectId", p.id AS "projectId",
pro.public_reply AS "publicReply", pro.public_reply AS "publicReply",
pro.department_name AS "departmentName", pro.department_name AS "departmentName",
UNIX_TIMESTAMP(pro.created_time) AS "closeProjectTime" UNIX_TIMESTAMP(pro.created_time) AS "closeProjectTime"
FROM project p FROM project p
INNER JOIN project_process pro ON p.id = pro.project_id INNER JOIN project_process pro ON p.id = pro.project_id
INNER JOIN project_related_personnel prp ON p.id = prp.project_id
WHERE p.del_flag = '0' WHERE p.del_flag = '0'
AND pro.del_flag = '0' AND pro.del_flag = '0'
AND p.customer_id = #{customerId} AND p.customer_id = #{customerId}
AND p.`status` = 'closed' AND p.`status` = 'closed'
AND pro.operation = 'close' AND pro.operation = 'close'
ORDER BY p.created_time DESC AND p.origin = 'issue'
AND prp.source_type = 'issue'
AND prp.grid_id = #{gridId}
ORDER BY pro.created_time DESC
LIMIT #{num}, #{pageSize}
</select> </select>
<select id="selectProjectList" resultType="com.epmet.dto.ProjectDTO"> <select id="selectProjectList" resultType="com.epmet.dto.ProjectDTO">

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

@ -144,6 +144,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </properties>
@ -186,6 +187,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>false</rocketmq.enable>
<rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.1.140:9876;192.168.1.141:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </properties>
@ -228,6 +230,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.10.161:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </properties>
@ -268,6 +271,7 @@
</dingTalk.robot.secret> </dingTalk.robot.secret>
<!--rocketmq--> <!--rocketmq-->
<rocketmq.enable>true</rocketmq.enable>
<rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver> <rocketmq.nameserver>192.168.11.187:9876;192.168.11.184:9876</rocketmq.nameserver>
<rocketmq.producer.group>epmet_message</rocketmq.producer.group> <rocketmq.producer.group>epmet_message</rocketmq.producer.group>
</properties> </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.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants; 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 com.epmet.mq.listener.InitCustomerComponentsListener;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
import org.apache.rocketmq.client.consumer.listener.MessageListener; import org.apache.rocketmq.client.consumer.listener.MessageListener;
@ -13,50 +15,13 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@Component @Component
public class RocketMQConsumerRegister { public class RocketMQConsumerRegister extends MQAbstractRegister {
@Value("${rocketmq.name-server}") @Override
private String nameServer; public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
// 客户初始化监听器注册
/** register(consumerProperties, ConsomerGroupConstants.INIT_CUSTOMER_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.INIT_CUSTOMER, "*", new InitCustomerComponentsListener());
* @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();
}
} }
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@ secret: @dingTalk.robot.secret@
rocketmq: rocketmq:
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@ name-server: @rocketmq.nameserver@
# 停机选项 # 停机选项

2
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/CustomerHomeDetailDao.xml

@ -38,7 +38,7 @@
hc.CONFIGURATION_DESCRIPTION, hc.CONFIGURATION_DESCRIPTION,
chd.REGION, chd.REGION,
chd.CONFIGURATION, chd.CONFIGURATION,
chd.DEMO_DATA, hc.DEMO_DATA,
chd.DISPLAY_ORDER chd.DISPLAY_ORDER
FROM FROM
( (

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

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

57
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.ConsomerGroupConstants;
import com.epmet.commons.rocketmq.constants.TopicConstants; 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.commons.tools.enums.EnvEnum;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer; import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
@ -13,56 +15,13 @@ import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@Slf4j
@Component @Component
public class RocketMQConsumerRegister { public class RocketMQConsumerRegister extends MQAbstractRegister {
@Value("${spring.profiles.active}")
private String env;
@Value("${rocketmq.name-server}")
private String nameServer;
/** @Override
* @return public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
* @Description 注册监听器 // 客户初始化监听器注册
* @author wxz register(consumerProperties, ConsomerGroupConstants.GROUP_ACHIEVEMENT_COMPONENTS_GROUP, MessageModel.CLUSTERING, TopicConstants.GROUP_ACHIEVEMENT, "*", new GroupAchievementCustomListener());
* @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);
}
} }
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

@ -159,4 +159,5 @@ shutdown:
waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志 waitTimeSecs: 30 # 优雅停机等待时间,每超过30秒,打印一次错误日志
rocketmq: rocketmq:
enable: @rocketmq.enable@
name-server: @rocketmq.nameserver@ name-server: @rocketmq.nameserver@

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/UserWechatDao.java

@ -74,7 +74,7 @@ public interface UserWechatDao extends BaseDao<UserWechatEntity>{
* @author wangc * @author wangc
* @date 2020.07.27 00:58 * @date 2020.07.27 00:58
**/ **/
List<CustomerUser4PointResultDTO> selectResiAndStrangerInfo(@Param("userIds") List<String> userIds, @Param("realName")String realName); List<CustomerUser4PointResultDTO> selectResiAndStrangerInfo(@Param("customerId") String customerId, @Param("realName")String realName);
//临时用下in //临时用下in
List<UserWechatDTO> selectNotInUserBaseInfoTemp(); List<UserWechatDTO> selectNotInUserBaseInfoTemp();

20
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java

@ -49,6 +49,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -190,23 +191,10 @@ public class GridLatestServiceImpl extends BaseServiceImpl<GridLatestDao, GridLa
**/ **/
@Override @Override
public List<CustomerUser4PointResultDTO> getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) { public List<CustomerUser4PointResultDTO> getCustomerUsers(CustomerUserFormDTO customerUserFormDTO) {
List<CustomerUser4PointResultDTO> allData = new LinkedList<>();
List<String> userIds = baseDao.selectAllUserByCustomerId(customerUserFormDTO.getCustomerId());
if(null == userIds) userIds = new LinkedList<>();
CommonCustomerFormDTO customerParam = new CommonCustomerFormDTO();
customerParam.setCustomerId(customerUserFormDTO.getCustomerId());
Result<List<String>> volunteer = epmetHeartOpenFeignClient.volunteerUserIds(customerParam);
if(volunteer.success() && null != volunteer.getData() && !volunteer.getData().isEmpty()){
userIds.addAll(volunteer.getData());
userIds = userIds.stream().distinct().collect(Collectors.toList());
}
if(null == userIds || userIds.isEmpty()){
return allData;
}
PageHelper.startPage(customerUserFormDTO.getPageNo(),customerUserFormDTO.getPageSize()); PageHelper.startPage(customerUserFormDTO.getPageNo(),customerUserFormDTO.getPageSize());
allData = userWechatDao.selectResiAndStrangerInfo(userIds,customerUserFormDTO.getName()); List<CustomerUser4PointResultDTO> allData = userWechatDao.selectResiAndStrangerInfo(customerUserFormDTO.getCustomerId(),customerUserFormDTO.getName());
if(null == allData || allData.isEmpty()){ if (!CollectionUtils.isEmpty(allData)){
return allData; return new ArrayList<>();
} }
allData.forEach(info -> { allData.forEach(info -> {
if(StringUtils.isNotBlank(info.getUserId())){ if(StringUtils.isNotBlank(info.getUserId())){

10
epmet-user/epmet-user-server/src/main/resources/mapper/GovStaffRoleDao.xml

@ -132,11 +132,13 @@
gov_staff_role gov_staff_role
WHERE WHERE
DEL_FLAG = 0 DEL_FLAG = 0
AND ( <if test="roleIds != null and roleIds.size() > 0">
<foreach collection="roleIds" item="roleId" separator=" OR "> AND (
ID = #{roleId} <foreach collection="roleIds" item="roleId" separator=" OR ">
</foreach> ID = #{roleId}
</foreach>
) )
</if>
</select> </select>
<select id="getStaffRoles" resultType="com.epmet.entity.GovStaffRoleEntity"> <select id="getStaffRoles" resultType="com.epmet.entity.GovStaffRoleEntity">
SELECT SELECT

4
epmet-user/epmet-user-server/src/main/resources/mapper/UserWechatDao.xml

@ -125,9 +125,7 @@
wechat.DEL_FLAG = '0' wechat.DEL_FLAG = '0'
AND (wechat.NICKNAME IS NOT NULL OR wechat.NICKNAME <![CDATA[ <> ]]> '') AND (wechat.NICKNAME IS NOT NULL OR wechat.NICKNAME <![CDATA[ <> ]]> '')
AND (base.SURNAME IS NOT NULL OR base.SURNAME <![CDATA[ <> ]]> '') AND (base.SURNAME IS NOT NULL OR base.SURNAME <![CDATA[ <> ]]> '')
<foreach collection="userIds" item="item" open="AND (" separator=" OR " close=" )"> AND wechat.CUSTOMER_ID = #{customerId}
wechat.USER_ID = #{item}
</foreach>
<if test='null != realName and "" != realName'> <if test='null != realName and "" != realName'>
AND (base.REAL_NAME LIKE concat('%',#{realName},'%') OR wechat.NICKNAME LIKE concat('%',#{realName},'%')) AND (base.REAL_NAME LIKE concat('%',#{realName},'%') OR wechat.NICKNAME LIKE concat('%',#{realName},'%'))
</if> </if>

Loading…
Cancel
Save