From 5f862eefe9bdba73ce475af2059aa6e37b2bf892 Mon Sep 17 00:00:00 2001
From: zhangyongzhangyong <2012005003@qq.coom>
Date: Mon, 16 Dec 2019 17:25:16 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BF=97=E6=84=BF=E8=80=85=E5=AE=A1=E6=89=B9?=
=?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8E=A8=E9=80=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../dto/epdc/form/EpdcInformationFormDTO.java | 2 +-
.../epdc/constant/VolunteerInfoConsant.java | 22 +++++++++++++
.../epdc-user/epdc-user-server/pom.xml | 6 ++++
.../com/elink/esua/epdc/async/NewsTask.java | 33 +++++++++++++++++++
.../esua/epdc/feign/NewsFeignClient.java | 32 ++++++++++++++++++
.../fallback/NewsFeignClientFallback.java | 23 +++++++++++++
.../impl/VolunteerInfoServiceImpl.java | 22 +++++++++++++
7 files changed, 139 insertions(+), 1 deletion(-)
create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/constant/VolunteerInfoConsant.java
create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/async/NewsTask.java
create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
create mode 100644 esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
diff --git a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcInformationFormDTO.java b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcInformationFormDTO.java
index 17428cd70..95351d979 100644
--- a/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcInformationFormDTO.java
+++ b/esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcInformationFormDTO.java
@@ -64,7 +64,7 @@ public class EpdcInformationFormDTO implements Serializable {
* 消息所属业务类型:event事件审核;issueComment议题评论;issueReply议题评论回复;itemComment项目评论;itemReply项目评论回复;
* issueApprove支持议题;itemApprove支持项目;issueCommentApprove议题评论支持;issueCommentOppose议题评论反对;
* itemCommentApprove项目评论支持;itemCommentOppose项目评论反对;issue议题处理;
- * item项目处理;groupInvited社群邀请等
+ * item项目处理;groupInvited社群邀请等; volunteerCheck志愿者审核
*/
@NotBlank(message = "消息所属业务类型不能为空")
private String businessType;
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/constant/VolunteerInfoConsant.java b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/constant/VolunteerInfoConsant.java
new file mode 100644
index 000000000..2e013c085
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/constant/VolunteerInfoConsant.java
@@ -0,0 +1,22 @@
+package com.elink.esua.epdc.constant;
+
+/**
+ * 志愿者审批结果 推送信息常量
+ */
+public interface VolunteerInfoConsant {
+
+ /**
+ * 标题:志愿者审批被拉入黑名单
+ */
+ String NOTICE_TITLE_VOLUNTEER_BLACKLIST = "您已被解除志愿者身份";
+
+ /**
+ * 标题:志愿者审批不通过
+ */
+ String NOTICE_TITLE_VOLUNTEER_NOT_PASSED = "您志愿者身份审核未通过";
+
+ /**
+ * 消息所属业务类型 : 志愿者审核
+ */
+ String NOTICE_BUSINESSTYPE_VOLUNTEER_CHECK = "volunteerCheck";
+}
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml b/esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml
index 3083936eb..3125a55c5 100644
--- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml
@@ -50,6 +50,12 @@
spring-boot-admin-starter-client
${spring.boot.admin.version}
+
+ com.esua.epdc
+ epdc-news-client
+ 1.0.0
+ compile
+
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/async/NewsTask.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/async/NewsTask.java
new file mode 100644
index 000000000..256bb52f9
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/async/NewsTask.java
@@ -0,0 +1,33 @@
+package com.elink.esua.epdc.async;
+
+import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO;
+import com.elink.esua.epdc.feign.NewsFeignClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+
+/**
+ * 志愿者审核结果通知消息模块 线程任务
+ *
+ * @author zy
+ * @date 2019/12/16 15:39
+ */
+@Component
+public class NewsTask {
+
+ @Autowired
+ private NewsFeignClient newsFeignClient;
+
+ /**
+ * 志愿者审核结果,消息推送到app
+ *
+ * @param informationDto
+ * @return void
+ * @author zy
+ * @date 2019/12/16 15:39
+ */
+ @Async
+ public void insertUserInformation(EpdcInformationFormDTO informationDto) {
+ newsFeignClient.saveInformation(informationDto);
+ }
+}
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
new file mode 100644
index 000000000..437288959
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
@@ -0,0 +1,32 @@
+package com.elink.esua.epdc.feign;
+
+import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO;
+import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.feign.fallback.NewsFeignClientFallback;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.http.MediaType;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * 志愿者审核结果通知消息模块 线程任务
+ *
+ * @author zy
+ * @date 2019/12/16 15:39
+ */
+@FeignClient(name = ServiceConstant.EPDC_NEWS_SERVER, fallback = NewsFeignClientFallback.class)
+public interface NewsFeignClient {
+
+ /**
+ * 志愿者审核结果,消息推送到app
+ *
+ * @param formDto
+ * @return void
+ * @author zy
+ * @date 2019/12/16 15:39
+ */
+ @PostMapping(value = "news/epdc-app/information/save", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
+ Result saveInformation(@RequestBody EpdcInformationFormDTO formDto);
+
+}
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
new file mode 100644
index 000000000..9965e8667
--- /dev/null
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
@@ -0,0 +1,23 @@
+package com.elink.esua.epdc.feign.fallback;
+
+import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO;
+import com.elink.esua.epdc.commons.tools.constant.ServiceConstant;
+import com.elink.esua.epdc.commons.tools.utils.ModuleUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.feign.NewsFeignClient;
+import org.springframework.stereotype.Component;
+
+/**
+ * 志愿者审核结果通知消息模块 线程任务
+ *
+ * @author zy
+ * @date 2019/12/16 15:39
+ */
+@Component
+public class NewsFeignClientFallback implements NewsFeignClient {
+
+ @Override
+ public Result saveInformation(EpdcInformationFormDTO formDto) {
+ return ModuleUtils.feignConError(ServiceConstant.EPDC_NEWS_SERVER, "saveInformation", formDto);
+ }
+}
diff --git a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java
index d227ec07d..8a7be312c 100644
--- a/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java
+++ b/esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java
@@ -19,15 +19,18 @@ package com.elink.esua.epdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.elink.esua.epdc.async.NewsTask;
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
import com.elink.esua.epdc.commons.tools.page.PageData;
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.constant.VolunteerInfoConsant;
import com.elink.esua.epdc.dao.VolunteerInfoDao;
import com.elink.esua.epdc.dto.UserTagDTO;
import com.elink.esua.epdc.dto.VolunteerInfoDTO;
import com.elink.esua.epdc.dto.epdc.form.EpdcCompleteVolunteerInfoFormDTO;
+import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO;
import com.elink.esua.epdc.entity.VolunteerInfoEntity;
import com.elink.esua.epdc.redis.VolunteerInfoRedis;
import com.elink.esua.epdc.service.UserService;
@@ -59,6 +62,9 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl