update 标准分享发送消息

This commit is contained in:
liao
2023-11-10 18:59:43 +08:00
parent d5e731555d
commit afb74e9835
2 changed files with 28 additions and 0 deletions
@@ -1,7 +1,9 @@
package com.jero.modules.personal.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jero.common.api.dto.message.SendMessageDTO;
import com.jero.common.api.vo.Result;
import com.jero.common.api.vo.SendMessageAPI;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.CommonConstant;
import com.jero.common.exception.JeroBootException;
@@ -9,6 +11,8 @@ import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.MessageUtils;
import com.jero.common.api.vo.ResultCommon;
import com.jero.modules.laws.common.constant.MessageTemplateCodeCommon;
import com.jero.modules.laws.common.util.CurrentUserUtil;
import com.jero.modules.laws.standard.entity.LawsDomesticStandard;
import com.jero.modules.laws.standard.entity.LawsEnterpriseStandard;
import com.jero.modules.laws.standard.entity.LawsNewsFeed;
@@ -33,6 +37,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@@ -61,6 +66,8 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
private ILawsEnterpriseStandardService ILawsEnterpriseStandardService; //企业标准
@Autowired
private ILawsNewsFeedService lawsNewsFeedService;
@Resource
private SendMessageAPI sendMessageAPI;
/**
* 分页列表查询
@@ -106,6 +113,8 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
@ApiOperation(value = "标准分享-国内分享", notes = "标准分享-国内分享")
@PostMapping(value = "/domestic/add")
public Result<T> domesticAdd(@Validated @RequestBody LawsStandardSharing lawsStandardSharing) {
// 发送消息
sendMsg(lawsStandardSharing);
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
SysUser user = sysUserService.getById(sysUser.getId());
String recipientId = lawsStandardSharing.getRecipientId();
@@ -134,6 +143,23 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
}
/**
* @Author: liao
* @Date: 2023/11/10 18:50
* @Description: 发送消息
**/
private void sendMsg(LawsStandardSharing lawsStandardSharing) {
SendMessageDTO sendMessageDTO = new SendMessageDTO();
sendMessageDTO.setTemplateCode(MessageTemplateCodeCommon.LAWS_STANDARD_SHARING);
sendMessageDTO.setToUserId(lawsStandardSharing.getRecipientId());
Map<String, String> map = new HashMap<>();
map.put("standardNumber", lawsStandardSharing.getStandardNumber());
map.put("standardName", lawsStandardSharing.getStandardName());
map.put("sender", CurrentUserUtil.getRealName());
sendMessageDTO.setMap(map);
sendMessageAPI.sendMessage(sendMessageDTO);
}
/**
* 添加
*/
@@ -141,6 +167,7 @@ public class LawsStandardSharingController extends JeroController<LawsStandardSh
@ApiOperation(value = "标准分享-海外分享", notes = "标准分享-海外分享")
@PostMapping(value = "/overseas/add")
public Result<T> overseasAdd(@Validated @RequestBody LawsStandardSharing lawsStandardSharing) {
// 发送消息
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
SysUser user = sysUserService.getById(sysUser.getId());
String recipientId = lawsStandardSharing.getRecipientId();