Browse Source

志愿者审批消息推送

feature/dangjian
zhangyongzhangyong 6 years ago
parent
commit
5f862eefe9
  1. 2
      esua-epdc/epdc-module/epdc-news/epdc-news-client/src/main/java/com/elink/esua/epdc/dto/epdc/form/EpdcInformationFormDTO.java
  2. 22
      esua-epdc/epdc-module/epdc-user/epdc-user-client/src/main/java/com/elink/esua/epdc/constant/VolunteerInfoConsant.java
  3. 6
      esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml
  4. 33
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/async/NewsTask.java
  5. 32
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/NewsFeignClient.java
  6. 23
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/feign/fallback/NewsFeignClientFallback.java
  7. 22
      esua-epdc/epdc-module/epdc-user/epdc-user-server/src/main/java/com/elink/esua/epdc/service/impl/VolunteerInfoServiceImpl.java

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

22
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";
}

6
esua-epdc/epdc-module/epdc-user/epdc-user-server/pom.xml

@ -50,6 +50,12 @@
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>${spring.boot.admin.version}</version>
</dependency>
<dependency>
<groupId>com.esua.epdc</groupId>
<artifactId>epdc-news-client</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

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

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

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

22
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<VolunteerInfoDao,
@Autowired
private UserService userService;
@Autowired
private NewsTask newsTask;
/**
* 根据查询条件返回首页 志愿者信息列表
* @param params
@ -115,6 +121,22 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
@Override
public void updateVolunteerInfo(VolunteerInfoDTO dto) {
volunteerInfoDao.updateVolunteerInfo(dto);
//审核状态(0-未审核,1-审核通过,2-审核不通过,3-拉黑),当审核状态为2,3时推送消息
if (dto.getAuditStatus().equals("2") || dto.getAuditStatus().equals("3")){
EpdcInformationFormDTO informationFormDTO = new EpdcInformationFormDTO();
informationFormDTO.setUserId(dto.getUserId());
if (dto.getAuditStatus().equals("2")){
informationFormDTO.setTitle(VolunteerInfoConsant.NOTICE_TITLE_VOLUNTEER_NOT_PASSED);
}else if (dto.getAuditStatus().equals("3")){
informationFormDTO.setTitle(VolunteerInfoConsant.NOTICE_TITLE_VOLUNTEER_BLACKLIST);
}
informationFormDTO.setContent(dto.getFailureReason());//审核不通过原因
informationFormDTO.setType("0"); //消息类型:0审核通知
informationFormDTO.setBusinessType(VolunteerInfoConsant.NOTICE_BUSINESSTYPE_VOLUNTEER_CHECK);//消息所属业务类型
informationFormDTO.setBusinessId(dto.getId());//消息所属业务ID:主键id
//消息推送
newsTask.insertUserInformation(informationFormDTO);
}
}
@Override

Loading…
Cancel
Save