From 4e7fc38f9459a0d89bc23deaeaeb7cd19d4d2b78 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Sun, 12 Dec 2021 18:23:19 +0800
Subject: [PATCH 1/9] CalPartyUnitSatisfactionFormDTO
---
.../messages/CalPartyUnitSatisfactionFormDTO.java | 15 +++++++++++++++
1 file changed, 15 insertions(+)
create mode 100644 epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
new file mode 100644
index 0000000000..f852b2285a
--- /dev/null
+++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
@@ -0,0 +1,15 @@
+package com.epmet.commons.rocketmq.messages;
+
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度,或者直接计算整个客户
+ */
+@Data
+public class CalPartyUnitSatisfactionFormDTO implements Serializable {
+ private String customerId;
+ private String partyUnitId;
+}
From 87f1cbdd37ac68f35ffab7390a20329df51dd586 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Sun, 12 Dec 2021 18:34:48 +0800
Subject: [PATCH 2/9] cal_party_unit_satisfaction
---
.../commons/rocketmq/constants/ConsomerGroupConstants.java | 4 ++++
.../com/epmet/commons/rocketmq/constants/TopicConstants.java | 5 +++++
2 files changed, 9 insertions(+)
diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
index 93894c0bdb..400eca1d51 100644
--- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
+++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/ConsomerGroupConstants.java
@@ -70,4 +70,8 @@ public interface ConsomerGroupConstants {
*/
String IC_WARN_STATS_EVENT_LISTENER_GROUP = "ic_warn_stats_event_listener_group";
+ /**
+ * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度
+ */
+ String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}
diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
index 13217da550..e11400fef3 100644
--- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
+++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/constants/TopicConstants.java
@@ -53,4 +53,9 @@ public interface TopicConstants {
* 项目
*/
String IC_RESI_USER = "ic_resi_user";
+
+ /**
+ * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度
+ */
+ String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}
From cd43854e7bb7092eddfbf3e31b03198cfaf78c6c Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Sun, 12 Dec 2021 18:38:39 +0800
Subject: [PATCH 3/9] SystemMessageType.CAL_PARTY_UNIT_SATISFACTION
---
.../src/main/java/com/epmet/constant/SystemMessageType.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
index 5d6cd6190c..284be1cb95 100644
--- a/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
+++ b/epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
@@ -100,4 +100,8 @@ public interface SystemMessageType {
*/
String IC_RESI_USER_DEL = "ic_resi_user_del";
+ /**
+ * 需求完成,如果服务方是区域化党建单位,重新计算这个单位的满意度
+ */
+ String CAL_PARTY_UNIT_SATISFACTION = "cal_party_unit_satisfaction";
}
From 8fcd4a2a7282c86e9744f0b5aa3492ddf4c58cee Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Sun, 12 Dec 2021 19:04:16 +0800
Subject: [PATCH 4/9] SystemMessageType.CAL_PARTY_UNIT_SATISFACTION
---
.../java/com/epmet/service/impl/SystemMessageServiceImpl.java | 3 +++
1 file changed, 3 insertions(+)
diff --git a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
index c57bd798f6..ca4f862049 100644
--- a/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
+++ b/epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
@@ -192,6 +192,9 @@ public class SystemMessageServiceImpl implements SystemMessageService {
case SystemMessageType.IC_RESI_USER_DEL:
topic = TopicConstants.IC_RESI_USER;
break;
+ case SystemMessageType.CAL_PARTY_UNIT_SATISFACTION:
+ topic=TopicConstants.CAL_PARTY_UNIT_SATISFACTION;
+ break;
}
return topic;
}
From eb4e4df5e0d200adac13b822f21ce60f37e02c08 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 13 Dec 2021 08:35:22 +0800
Subject: [PATCH 5/9] =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=BE=A4=E4=BC=97?=
=?UTF-8?q?=E6=BB=A1=E6=84=8F=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../CalPartyUnitSatisfactionFormDTO.java | 4 +
.../epmet-heart/epmet-heart-server/pom.xml | 22 ++++
.../controller/IcPartyUnitController.java | 15 +++
.../epmet/mq/RocketMQConsumerRegister.java | 31 ++++++
...PartyUnitSatisfactionCalEventListener.java | 104 ++++++++++++++++++
.../com/epmet/service/IcPartyUnitService.java | 7 ++
.../service/impl/IcPartyUnitServiceImpl.java | 15 +++
.../impl/IcUserDemandRecServiceImpl.java | 18 +++
.../src/main/resources/bootstrap.yml | 5 +-
9 files changed, 220 insertions(+), 1 deletion(-)
create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
create mode 100644 epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java
diff --git a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
index f852b2285a..bfaf63703a 100644
--- a/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
+++ b/epmet-commons/epmet-commons-rocketmq/src/main/java/com/epmet/commons/rocketmq/messages/CalPartyUnitSatisfactionFormDTO.java
@@ -3,6 +3,7 @@ package com.epmet.commons.rocketmq.messages;
import lombok.Data;
+import javax.validation.constraints.NotBlank;
import java.io.Serializable;
/**
@@ -10,6 +11,9 @@ import java.io.Serializable;
*/
@Data
public class CalPartyUnitSatisfactionFormDTO implements Serializable {
+ public interface AddUserInternalGroup {
+ }
+ @NotBlank(message = "客户id不能为空",groups = AddUserInternalGroup.class)
private String customerId;
private String partyUnitId;
}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/pom.xml b/epmet-module/epmet-heart/epmet-heart-server/pom.xml
index 648896a0c9..05ff205836 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/pom.xml
+++ b/epmet-module/epmet-heart/epmet-heart-server/pom.xml
@@ -88,6 +88,12 @@
2.0.0
compile
+
+
+ com.epmet
+ epmet-commons-rocketmq
+ 2.0.0
+
@@ -152,6 +158,10 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 192.168.1.140:9876;192.168.1.141:9876
@@ -195,6 +205,10 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ false
+ 192.168.1.140:9876;192.168.1.141:9876
@@ -238,6 +252,10 @@
https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4
SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd
+
+
+ true
+ 192.168.10.161:9876
@@ -281,6 +299,10 @@
https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c
SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1
+
+
+ true
+ 192.168.11.187:9876;192.168.11.184:9876
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
index ec06c3bf5f..90c500b87d 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcPartyUnitController.java
@@ -17,6 +17,7 @@
package com.epmet.controller;
+import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
@@ -150,4 +151,18 @@ public class IcPartyUnitController {
public Result importData(@LoginUser TokenDto tokenDto, HttpServletResponse response, @RequestPart("file") MultipartFile file) throws IOException {
return icPartyUnitService.importData(tokenDto, response, file);
}
+
+
+ /**
+ * 计算区域化党建单位的群众满意度
+ *
+ * @param formDTO
+ * @return
+ */
+ @PostMapping("cal-partyunit-satisfation")
+ public Result calPartyUnitSatisfation(@RequestBody CalPartyUnitSatisfactionFormDTO formDTO){
+ ValidatorUtils.validateEntity(formDTO,CalPartyUnitSatisfactionFormDTO.AddUserInternalGroup.class);
+ icPartyUnitService.calPartyUnitSatisfation(formDTO);
+ return new Result();
+ }
}
\ No newline at end of file
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
new file mode 100644
index 0000000000..3f599eefc0
--- /dev/null
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/RocketMQConsumerRegister.java
@@ -0,0 +1,31 @@
+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.PartyUnitSatisfactionCalEventListener;
+import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description 如果rocketmq.enable=true,这里必须实现,且 实例化
+ * @author wxz
+ * @date 2021.07.14 17:13:41
+*/
+@Component
+public class RocketMQConsumerRegister extends MQAbstractRegister {
+
+ @Override
+ public void registerAllListeners(String env, MQConsumerProperties consumerProperties) {
+ // 客户初始化监听器注册
+ register(consumerProperties,
+ ConsomerGroupConstants.CAL_PARTY_UNIT_SATISFACTION,
+ MessageModel.CLUSTERING,
+ TopicConstants.CAL_PARTY_UNIT_SATISFACTION,
+ "*",
+ new PartyUnitSatisfactionCalEventListener());
+
+ // ...其他监听器类似
+ }
+}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java
new file mode 100644
index 0000000000..b7c3abc938
--- /dev/null
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/mq/listener/PartyUnitSatisfactionCalEventListener.java
@@ -0,0 +1,104 @@
+package com.epmet.mq.listener;
+
+import com.alibaba.fastjson.JSON;
+import com.epmet.commons.rocketmq.constants.MQUserPropertys;
+import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
+import com.epmet.commons.tools.distributedlock.DistributedLock;
+import com.epmet.commons.tools.exception.ExceptionUtils;
+import com.epmet.commons.tools.exception.RenException;
+import com.epmet.commons.tools.redis.RedisKeys;
+import com.epmet.commons.tools.redis.RedisUtils;
+import com.epmet.commons.tools.utils.SpringContextUtils;
+import com.epmet.service.IcPartyUnitService;
+import org.apache.commons.lang.StringUtils;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
+import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
+import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
+import org.apache.rocketmq.common.message.MessageExt;
+import org.redisson.api.RLock;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @Description 计算区域化党建单位,群众满意度=分数相加➗ 需求的总个数。
+ * @author wxz
+ * @date 2021.10.13 15:21:48
+*/
+public class PartyUnitSatisfactionCalEventListener implements MessageListenerConcurrently {
+
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ private RedisUtils redisUtils;
+
+ @Override
+ public ConsumeConcurrentlyStatus consumeMessage(List msgs, ConsumeConcurrentlyContext context) {
+
+ if (redisUtils == null) {
+ redisUtils = SpringContextUtils.getBean(RedisUtils.class);
+ }
+
+ try {
+ msgs.forEach(msg -> consumeMessage(msg));
+ } catch (Exception e) {
+ logger.error(ExceptionUtils.getErrorStackTrace(e));
+ return ConsumeConcurrentlyStatus.RECONSUME_LATER;
+ }
+ return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
+ }
+
+ private void consumeMessage(MessageExt messageExt) {
+ // msg即为消息体
+ // tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可
+ String msg = new String(messageExt.getBody());
+ String topic = messageExt.getTopic();
+ String tags = messageExt.getTags();
+ String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL);
+
+ logger.info("【计算区域化党建单位群众满意度事件监听器】-需求完成-收到消息内容:{},操作:{}", msg, tags);
+ CalPartyUnitSatisfactionFormDTO obj = JSON.parseObject(msg, CalPartyUnitSatisfactionFormDTO.class);
+
+ DistributedLock distributedLock = null;
+ RLock lock = null;
+ try {
+ distributedLock = SpringContextUtils.getBean(DistributedLock.class);
+ lock = distributedLock.getLock(String.format("lock:ic_warn_stats:%s", obj.getCustomerId()),
+ 30L, 30L, TimeUnit.SECONDS);
+ //待执行方法
+ SpringContextUtils.getBean(IcPartyUnitService.class).calPartyUnitSatisfation(obj);
+ } catch (RenException e) {
+ // 如果是我们手动抛出的异常,说明在业务可控范围内。目前不需要MQ重试
+ logger.error("【计算区域化党建单位群众满意度事件监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
+ } catch (Exception e) {
+ // 不是我们自己抛出的异常,可以让MQ重试
+ logger.error("【计算区域化党建单位群众满意度监听器】-MQ失败:".concat(ExceptionUtils.getErrorStackTrace(e)));
+ throw e;
+ } finally {
+ distributedLock.unLock(lock);
+ }
+
+ if (StringUtils.isNotBlank(pendingMsgLabel)) {
+ try {
+ removePendingMqMsgCache(pendingMsgLabel);
+ } catch (Exception e) {
+ logger.error("【计算区域化党建单位群众满意度监听器】-删除mq阻塞消息缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
+ }
+ }
+ }
+
+ /**
+ * @description
+ *
+ * @param pendingMsgLabel
+ * @return
+ * @author wxz
+ * @date 2021.10.14 16:32:32
+ */
+ private void removePendingMqMsgCache(String pendingMsgLabel) {
+ String key = RedisKeys.blockedMqMsgKey(pendingMsgLabel);
+ redisUtils.delete(key);
+ //logger.info("【开放数据事件监听器】删除mq阻塞消息缓存成功,blockedMsgLabel:{}", pendingMsgLabel);
+ }
+}
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
index 8106d724fe..b303cab184 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcPartyUnitService.java
@@ -18,6 +18,7 @@
package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
+import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
@@ -120,4 +121,10 @@ public interface IcPartyUnitService extends BaseService {
* @Date 2021/11/29 11:01
*/
Result importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file) throws IOException;
+
+ /**
+ * 计算区域化党建单位的群众满意度
+ * @param formDTO
+ */
+ void calPartyUnitSatisfation(CalPartyUnitSatisfactionFormDTO formDTO);
}
\ No newline at end of file
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
index 4931389ae0..78625590df 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcPartyUnitServiceImpl.java
@@ -18,9 +18,11 @@
package com.epmet.service.impl;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
+import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@@ -370,6 +372,19 @@ public class IcPartyUnitServiceImpl extends BaseServiceImpl map, String matter) {
List matters = Arrays.asList(matter.split(StrConstant.COLON));
List list = matters.stream().map(map::get).collect(Collectors.toList());
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
index cc318638b6..eec0f484eb 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
@@ -20,6 +20,7 @@ package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
+import com.epmet.commons.rocketmq.messages.CalPartyUnitSatisfactionFormDTO;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@@ -32,6 +33,7 @@ import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
+import com.epmet.constant.SystemMessageType;
import com.epmet.constant.UserDemandConstant;
import com.epmet.dao.IcUserDemandOperateLogDao;
import com.epmet.dao.IcUserDemandRecDao;
@@ -40,6 +42,7 @@ import com.epmet.dao.IcUserDemandServiceDao;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.IcUserDemandRecDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
+import com.epmet.dto.form.SystemMsgFormDTO;
import com.epmet.dto.form.demand.*;
import com.epmet.dto.result.AllGridsByUserIdResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
@@ -47,6 +50,7 @@ import com.epmet.dto.result.demand.DemandRecResultDTO;
import com.epmet.dto.result.demand.IcResiUserReportDemandRes;
import com.epmet.entity.*;
import com.epmet.feign.EpmetAdminOpenFeignClient;
+import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.IcResiDemandDictService;
@@ -86,6 +90,8 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl page(Map params) {
@@ -455,6 +461,18 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl
Date: Mon, 13 Dec 2021 09:29:15 +0800
Subject: [PATCH 6/9] =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=E7=BD=91?=
=?UTF-8?q?=E6=A0=BC=E5=88=97=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../com/epmet/dto/result/AgencyGridList.java | 12 +++++++++
.../com/epmet/dto/result/AgencyResultDTO.java | 21 +++++++--------
.../controller/CustomerGridController.java | 10 +++++++
.../epmet/service/CustomerGridService.java | 6 +++++
.../service/impl/CustomerGridServiceImpl.java | 12 +++++++--
.../resources/mapper/CustomerAgencyDao.xml | 26 +++++++++++++++----
.../main/resources/mapper/CustomerGridDao.xml | 22 ++++++++++++++--
7 files changed, 89 insertions(+), 20 deletions(-)
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java
index ad2c907fd5..ce787e045d 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyGridList.java
@@ -40,5 +40,17 @@ public class AgencyGridList implements Serializable {
* 机关-网格名称
*/
private String agencyGridName = "";
+ /**
+ * 网格名称
+ */
+ private String gridName = "";
+ /**
+ * 网格经度【网格没有经纬度时获取客户根组织下的】
+ */
+ private String longitude = "";
+ /**
+ * 网格维度【网格没有经纬度时获取客户根组织下的】
+ */
+ private String latitude = "";
}
\ No newline at end of file
diff --git a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java
index 808e25d791..a7aec4fa28 100644
--- a/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java
+++ b/epmet-module/gov-org/gov-org-client/src/main/java/com/epmet/dto/result/AgencyResultDTO.java
@@ -30,23 +30,22 @@ import java.io.Serializable;
*/
@Data
public class AgencyResultDTO implements Serializable {
-
private static final long serialVersionUID = 1L;
- /**
- * 机关组织Id
- */
+ //机关组织Id
private String agencyId = "";
- /**
- * 机关组织名称
- */
+ //机关组织名称
private String agencyName = "";
-
+ //上级组织id
private String pid;
+ //组织级别
private String level;
- /**
- * 所有上级组织机构ID(以英文:隔开)
- */
+ //所有上级组织机构ID(以英文:隔开)
@JsonIgnore
private String pids = "";
+ //经度【没值则取跟客户的值】
+ private String longitude;
+ //维度【没值则取跟客户的值】
+ private String latitude;
+
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
index 0b58b4d6f0..9528ff6704 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
@@ -309,4 +309,14 @@ public class CustomerGridController {
List resultDTOS = customerGridService.getGridIListByAgency(agencyId);
return new Result>().ok(resultDTOS);
}
+
+ /**
+ * @Author sun
+ * @Description 查询组织直属网格列表
+ **/
+ @PostMapping("getGridIListByAgency/{agencyId}")
+ public Result> gridListByAgencyId(@PathVariable("agencyId") String agencyId) {
+ return new Result>().ok(customerGridService.gridListByAgencyId(agencyId));
+ }
+
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
index d6ac66d201..2b2624ac54 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
@@ -348,4 +348,10 @@ public interface CustomerGridService extends BaseService {
* @Date 2021/11/29 17:00
*/
List getGridIListByAgency(String agencyId);
+
+ /**
+ * @Author sun
+ * @Description 查询组织直属网格列表
+ **/
+ List gridListByAgencyId(String agencyId);
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
index 9b6f41daad..b09d46e52b 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
+++ b/epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
@@ -22,7 +22,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
-import com.epmet.commons.rocketmq.messages.OrgOrStaffMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
@@ -47,7 +46,6 @@ import com.epmet.entity.CustomerGridEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserFeignClient;
import com.epmet.feign.OperCrmOpenFeignClient;
-import com.epmet.send.SendMqMsgUtil;
import com.epmet.service.CustomerAgencyService;
import com.epmet.service.CustomerGridService;
import com.epmet.util.ModuleConstant;
@@ -866,4 +864,14 @@ public class CustomerGridServiceImpl extends BaseServiceImpl gridListByAgencyId(String agencyId) {
+ List result = baseDao.selectAgencyGridMsgList(agencyId);
+ return result;
+ }
+
}
diff --git a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
index f35fe34fed..88ad6386d6 100644
--- a/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
+++ b/epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerAgencyDao.xml
@@ -340,11 +340,27 @@
+
+
+
+ SELECT
+ S.SERVER_ID AS serverId,
+ SUM( M.SCORE ) AS totalScore,
+ count( DISTINCT m.DEMAND_REC_ID ) AS demandCount
+ FROM
+ ic_user_demand_satisfaction m
+ INNER JOIN ic_user_demand_rec r ON ( m.DEMAND_REC_ID = r.id )
+ INNER JOIN ic_user_demand_service s ON ( R.ID = s.DEMAND_REC_ID )
+ WHERE
+ m.DEL_FLAG = '0'
+ AND r.DEL_FLAG = '0'
+ AND m.CUSTOMER_ID = #{customerId}
+ AND r.`STATUS` = 'finished'
+ and s.SERVICE_TYPE ='party_unit'
+
+ and s.server_id=#{partyUnitId}
+
+ group by s.SERVER_ID
+
\ No newline at end of file
From 4cbfd6f1a765f801ccd514ff603a3c479c0f39f0 Mon Sep 17 00:00:00 2001
From: yinzuomei <576302893@qq.com>
Date: Mon, 13 Dec 2021 09:35:37 +0800
Subject: [PATCH 8/9] wangle fuzhi
---
.../java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
index 152f147f5f..9e1dcdd59d 100644
--- a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
+++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcUserDemandRecServiceImpl.java
@@ -615,6 +615,7 @@ public class IcUserDemandRecServiceImpl extends BaseServiceImpl
Date: Mon, 13 Dec 2021 09:45:09 +0800
Subject: [PATCH 9/9] =?UTF-8?q?=E6=96=B0=E5=A2=9E=EF=BC=9A=201.=E5=BF=97?=
=?UTF-8?q?=E6=84=BF=E8=80=85=E5=9D=90=E6=A0=87=E5=88=86=E5=B8=83=E7=BB=9F?=
=?UTF-8?q?=E8=AE=A1=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../feign/DataStatisticalOpenFeignClient.java | 12 ++++++++++
...ataStatisticalOpenFeignClientFallBack.java | 5 ++++
.../java/com/epmet/task/StatsDemandTask.java | 23 +++++++++++++++++++
3 files changed, 40 insertions(+)
create mode 100644 epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsDemandTask.java
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
index 047a16e87b..dab2edf301 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
@@ -25,6 +25,7 @@ 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;
+import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@@ -341,4 +342,15 @@ public interface DataStatisticalOpenFeignClient {
*/
@PostMapping("/data/stats/datareporting/eventinfo")
Result> getEventInfo(@RequestBody EventInfoFormDTO formDTO);
+
+ /**
+ * wangxianzhang
+ *
+ * 计算客户下志愿者服务相关数据
+ *
+ * @param customerId 客户ID,可以为空,为空则计算所有客户
+ * @return
+ */
+ @PostMapping("/data/stats/demand/volunteer/daily")
+ Result statsVolunteerDemandServicesDaily(@RequestParam(value = "customer-id", required = false) String customerId);
}
diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
index 43638c894e..56fea9c03f 100644
--- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
+++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
@@ -334,4 +334,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result> getEventInfo(EventInfoFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "getEventInfo", formDTO);
}
+
+ @Override
+ public Result statsVolunteerDemandServicesDaily(String customerId) {
+ return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statsVolunteerDemandServicesDaily", customerId);
+ }
}
diff --git a/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsDemandTask.java b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsDemandTask.java
new file mode 100644
index 0000000000..81c0be1c3b
--- /dev/null
+++ b/epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsDemandTask.java
@@ -0,0 +1,23 @@
+package com.epmet.task;
+
+import com.epmet.feign.DataStatisticalOpenFeignClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * @Description
+ * @Author wangxianzhang
+ * @Date 2021/12/13 9:40 上午
+ * @Version 1.0
+ */
+@Component("statsDemandTask")
+public class StatsDemandTask implements ITask {
+
+ @Autowired
+ private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
+
+ @Override
+ public void run(String params) {
+ dataStatisticalOpenFeignClient.statsVolunteerDemandServicesDaily(null);
+ }
+}