Browse Source

发布文章审核、取消活动添加发送微信订阅消息

dev_shibei_match
sunyuchao 5 years ago
parent
commit
7a0b6ba3cb
  1. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java
  2. 4
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java
  3. 22
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java
  4. 4
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java

16
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActServiceImpl.java

@ -24,6 +24,7 @@ import com.epmet.constant.ReadFlagConstant;
import com.epmet.dao.*;
import com.epmet.dto.*;
import com.epmet.dto.form.UserMessageFormDTO;
import com.epmet.dto.form.WxSubscribeMessageFormDTO;
import com.epmet.dto.form.work.*;
import com.epmet.dto.result.ActSponsorResultDTO;
import com.epmet.dto.result.work.*;
@ -31,6 +32,7 @@ import com.epmet.entity.*;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.*;
import com.epmet.utils.ModuleConstant;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
@ -680,6 +682,7 @@ public class WorkActServiceImpl implements WorkActService {
List<String> userIdList=actUserRelationDao.selectUserIdList(formDTO.getActId(),ActConstant.ACT_USER_STATUS_PASSED);
if(null!=userIdList&&userIdList.size()>0){
List<UserMessageFormDTO> userMessageFormDTOS=new ArrayList<>();
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>();
for(String userId:userIdList){
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(actInfoDTO.getCustomerId());
@ -692,11 +695,24 @@ public class WorkActServiceImpl implements WorkActService {
actInfoDTO.getTitle(),
formDTO.getCancelReason()));
userMessageFormDTOS.add(userMessageFormDTO);
//2020.10.26 添加发送微信订阅消息功能 sun
WxSubscribeMessageFormDTO dto = new WxSubscribeMessageFormDTO();
dto.setCustomerId(actInfoDTO.getCustomerId());
dto.setClientType(AppClientConstant.APP_RESI);
dto.setUserId(userId);
dto.setBehaviorType(ActMessageConstant.WXMP_TITLE);
dto.setMessageContent(String.format(ActMessageConstant.ACT_CANCELED, actInfoDTO.getTitle(), formDTO.getCancelReason()));
dto.setMessageTime(new Date());
msgList.add(dto);
}
Result sendMessageRes= epmetMessageOpenFeignClient.saveUserMessageList(userMessageFormDTOS);
if(sendMessageRes.success()){
logger.info("给审核通过的用户发送消息成功");
}
Result wxmpMsg = epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList);
if (wxmpMsg.success()) {
logger.info("给审核通过的用户推送微信订阅消息成功");
}
}
}

4
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkActUserServiceImpl.java

@ -465,7 +465,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
actUserLogDao.insert(actUserLogEntity);
//给居民发消息
this.saveUserMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_PASSED,actInfo);
//给居民发送微信订阅消息
//给居民发送微信订阅消息 sun
this.saveWxmpMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_PASSED,actInfo);
}
@ -514,7 +514,7 @@ public class WorkActUserServiceImpl implements WorkActUserService {
actUserLogDao.insert(actUserLogEntity);
//给居民发消息
this.saveUserMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_REFUSED,actInfo);
//给居民发送微信订阅消息
//给居民发送微信订阅消息 sun
this.saveWxmpMessage(actUserRelationEntity,ActConstant.ACT_USER_STATUS_REFUSED,actInfo);
}

22
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/service/impl/ArticleServiceImpl.java

@ -970,6 +970,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
if (!isOk) {
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.wxmpMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null);
return null;
}
@ -1047,6 +1048,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
} catch (Exception e) {
log.error("scanContent exception", e);
this.sendMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.wxmpMsg(draftEntity.getCustomerId(), draftEntity.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draftEntity.getTitle()));
this.updateDraftPublishStatus(draftId, DraftConstant.AUDITFAIL, null);
}
log.debug("scanContent result:{}", JSON.toJSONString(result));
@ -1084,6 +1086,7 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
this.wxmpMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
@ -1145,10 +1148,12 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
auditMsg = ModuleConstant.DRAFT_TITLE;
}
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg));
this.wxmpMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_AUDIT_CONTENT, draft.getTitle(), auditMsg));
}
} catch (Exception e) {
log.error("scanAllPassPublishArticle update db exception", e);
this.sendMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
this.wxmpMsg(draft.getCustomerId(), draft.getTitle(), String.format(ModuleConstant.MSG_ARTICLE_PUBLISH_ERROR, draft.getTitle()));
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}
@ -1170,6 +1175,23 @@ public class ArticleServiceImpl extends BaseServiceImpl<ArticleDao, ArticleEntit
formDTO.setReadFlag(ReadFlagConstant.UN_READ);
return epmetMessageOpenFeignClient.saveUserMessage(formDTO);
}
/**
* @param
* @Description 发布文章审核给发布者推送微信订阅消息
* @Author sun
**/
public Result wxmpMsg(String customerId, String title, String content) {
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>();
WxSubscribeMessageFormDTO formDTO = new WxSubscribeMessageFormDTO();
formDTO.setCustomerId(customerId);
formDTO.setClientType(AppClientConstant.APP_RESI);
formDTO.setUserId(loginUserUtil.getLoginUserId());
formDTO.setBehaviorType(String.format(ModuleConstant.WXMP_MSG_TITLE, title));
formDTO.setMessageContent(content);
formDTO.setMessageTime(new Date());
msgList.add(formDTO);
return epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList);
}
@Override
public void updateDraftPublishStatus(String draftId, String statusFlag, String titleAuditStatus) {

4
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/utils/ModuleConstant.java

@ -83,6 +83,10 @@ public interface ModuleConstant {
* 文章站内消息标题
*/
String MSG_TITLE = "您有一条文章【%s】的消息";
/**
* 文章微信订阅消息
*/
String WXMP_MSG_TITLE = "文章【%s】的消息";
/**
* 文章未审核通过 消息内容模版

Loading…
Cancel
Save