Commit 22f57e5e authored by zhangqingle's avatar zhangqingle

修改通知路径

parent 14488d02
This diff is collapsed.
...@@ -104,9 +104,9 @@ public interface BBannerRepository extends BaseMapper<BBanner> { ...@@ -104,9 +104,9 @@ public interface BBannerRepository extends BaseMapper<BBanner> {
" <if test='bannerSort != null'>banner_sort=#{bannerSort},</if>", " <if test='bannerSort != null'>banner_sort=#{bannerSort},</if>",
" external_url=#{externalUrl},", " external_url=#{externalUrl},",
" line_type=#{lineType},", " line_type=#{lineType},",
" course_id=#{courseId}", " course_id=#{courseId} ",
" </set>", " </set>",
"where business_id=#{businessId}", " where business_id=#{businessId}",
"</script>"}) "</script>"})
int updateById(BBanner model); int updateById(BBanner model);
......
...@@ -107,7 +107,11 @@ public class BDiscussServiceImpl implements BDiscussService { ...@@ -107,7 +107,11 @@ public class BDiscussServiceImpl implements BDiscussService {
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName(); String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "回复了您在" + lessonType +"[" + bLesson.getLessonName() +"]的评论" ); bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "回复了您在" + lessonType +"[" + bLesson.getLessonName() +"]的评论" );
// 发消息 // 发消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.HFPL.getName(),urlType); try{
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.HFPL.getName(),urlType);
}catch (Exception e){
log.info("发送通知失败,"+e);
}
} }
//评论课程 //评论课程
List<BMessage> bMessageListFBPL = bMessageRepository.queryByNameAndCorp("FBPL",curUser.getCorpId()); List<BMessage> bMessageListFBPL = bMessageRepository.queryByNameAndCorp("FBPL",curUser.getCorpId());
...@@ -128,7 +132,11 @@ public class BDiscussServiceImpl implements BDiscussService { ...@@ -128,7 +132,11 @@ public class BDiscussServiceImpl implements BDiscussService {
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName(); String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "评论了您主讲的" + lessonType +"\"" + bLesson.getLessonName()+"\"" ); bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "评论了您主讲的" + lessonType +"\"" + bLesson.getLessonName()+"\"" );
// 发消息 // 发消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.FBPL.getName(),urlType); try {
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.FBPL.getName(),urlType);
}catch (Exception e){
log.info("发送通知失败,"+e);
}
} }
//增加操作 //增加操作
UserUtil.setCurrentPersistOperation(bDiscuss); UserUtil.setCurrentPersistOperation(bDiscuss);
......
...@@ -773,7 +773,11 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -773,7 +773,11 @@ public class BLessonServiceImpl implements BLessonService {
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName(); String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(appointLessonDTO.getUserId()).getName() + "给您指派了" + lessonType +"“" + bLesson.getLessonName() +"”,请及时学习" ); bNotice.setInfoText(sysUserServiceImpl.getNameById(appointLessonDTO.getUserId()).getName() + "给您指派了" + lessonType +"“" + bLesson.getLessonName() +"”,请及时学习" );
// 往智信平台发啊消息 // 往智信平台发啊消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),type,urlType); try{
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),type,urlType);
}catch (Exception e){
log.info("发送通知失败,"+e);
}
} }
BAppoint bAppoint; BAppoint bAppoint;
......
...@@ -2,11 +2,14 @@ package org.rcisoft.business.bnotice.controller; ...@@ -2,11 +2,14 @@ package org.rcisoft.business.bnotice.controller;
/*固定导入*/ /*固定导入*/
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.rcisoft.business.bnotice.dto.ReadDTO;
import org.rcisoft.common.controller.PaginationController; import org.rcisoft.common.controller.PaginationController;
import org.rcisoft.common.model.GridModel; import org.rcisoft.common.model.GridModel;
import org.rcisoft.sys.user.bean.CurUser;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -28,6 +31,7 @@ import java.util.List; ...@@ -28,6 +31,7 @@ import java.util.List;
/** /**
* Created by on 2019-11-28 11:18:34. * Created by on 2019-11-28 11:18:34.
*/ */
@Api(tags = "18 通知")
@RestController @RestController
@RequestMapping("bnotice") @RequestMapping("bnotice")
public class BNoticeController extends PaginationController<BNotice> { public class BNoticeController extends PaginationController<BNotice> {
...@@ -47,32 +51,42 @@ public class BNoticeController extends PaginationController<BNotice> { ...@@ -47,32 +51,42 @@ public class BNoticeController extends PaginationController<BNotice> {
// bNotice); // bNotice);
// } // }
@ApiOperation(value="逻辑删除", notes="逻辑删除") // @ApiOperation(value="逻辑删除", notes="逻辑删除")
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")}) // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "id", required = false, dataType = "varchar")})
@DeleteMapping("/delete/{id:\\w+}") // @PostMapping("/delete/{id:\\w+}")
public Result delete(@PathVariable String id) { // public Result delete(@PathVariable String id) {
BNotice bNotice = new BNotice(); // BNotice bNotice = new BNotice();
bNotice.setBusinessId(id); // bNotice.setBusinessId(id);
PersistModel data = bNoticeServiceImpl.remove(bNotice); // PersistModel data = bNoticeServiceImpl.remove(bNotice);
return Result.builder(data, // return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS, // MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, // MessageConstant.MESSAGE_ALERT_ERROR,
id); // id);
} // }
//
@ApiOperation(value="查看单 ", notes="查看单 ") // @ApiOperation(value="查看单 ", notes="查看单 ")
@GetMapping("/detail/{id:\\w+}") // @GetMapping("/detail/{id:\\w+}")
public Result detail(@PathVariable String id) { // public Result detail(@PathVariable String id) {
return Result.builder(new PersistModel(1), // return Result.builder(new PersistModel(1),
MessageConstant.MESSAGE_ALERT_SUCCESS, // MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR, // MessageConstant.MESSAGE_ALERT_ERROR,
bNoticeServiceImpl.findById(id)); // bNoticeServiceImpl.findById(id));
} // }
@ApiOperation(value="查看 集合", notes="查看 集合") @ApiOperation(value="1801条件分页查询集合", notes="条件分页查询集合")
@GetMapping(value = "/queryBNoticeByPagination") @GetMapping(value = "/queryBNoticeByPagination")
public GridModel listByPagination(BNotice bNotice) { public GridModel listByPagination(BNotice bNotice) {
bNoticeServiceImpl.findAllByPagination(getPaginationUtility(), bNotice); bNoticeServiceImpl.findAllByPagination(getPaginationUtility(), bNotice);
return getGridModelResponse(); return getGridModelResponse();
} }
@ApiOperation(value="1802批量设置为已读", notes="批量设置为已读")
@PostMapping("/setRead")
public Result delete(CurUser curUser, @Valid ReadDTO readDTO, BindingResult bindingResult) {
PersistModel data = bNoticeServiceImpl.setRead(readDTO);
return Result.builder(data,
MessageConstant.MESSAGE_ALERT_SUCCESS,
MessageConstant.MESSAGE_ALERT_ERROR,
readDTO);
}
} }
package org.rcisoft.business.bnotice.dao; package org.rcisoft.business.bnotice.dao;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.*;
import org.rcisoft.business.bnotice.dto.ReadDTO;
import org.rcisoft.core.base.BaseMapper; import org.rcisoft.core.base.BaseMapper;
import org.rcisoft.business.bnotice.entity.BNotice; import org.rcisoft.business.bnotice.entity.BNotice;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
...@@ -37,7 +36,7 @@ public interface BNoticeRepository extends BaseMapper<BNotice> { ...@@ -37,7 +36,7 @@ public interface BNoticeRepository extends BaseMapper<BNotice> {
List<BNotice> queryBNotices(BNotice bNotice); List<BNotice> queryBNotices(BNotice bNotice);
/** /**
* 分页查询 bNotice * 插入 bNotice
* *
*/ */
@Insert("<script>insert into b_notice(business_id,info_type,info_text,create_date,update_date,del_flag,recipient_id,read_flag,flag,update_by,create_by,sender_id,corp_id) values\n" + @Insert("<script>insert into b_notice(business_id,info_type,info_text,create_date,update_date,del_flag,recipient_id,read_flag,flag,update_by,create_by,sender_id,corp_id) values\n" +
...@@ -47,5 +46,28 @@ public interface BNoticeRepository extends BaseMapper<BNotice> { ...@@ -47,5 +46,28 @@ public interface BNoticeRepository extends BaseMapper<BNotice> {
" </foreach>\n" + " </foreach>\n" +
"</script>") "</script>")
int insertBach(List<BNotice> list); int insertBach(List<BNotice> list);
@Update({"<script>",
"update b_notice",
" <set>",
" <if test=\"bNotice.updateBy !=null and bNotice.updateBy !=''\">update_by=#{bNotice.updateBy}, </if> ",
" <if test=\"bNotice.updateDate !=null \">update_date=#{bNotice.updateDate}, </if> ",
" <if test=\"bNotice.delFlag !=null and bNotice.delFlag !=''\">del_flag=#{bNotice.delFlag}, </if> ",
" <if test=\"bNotice.flag !=null and bNotice.flag !=''\">flag=#{bNotice.flag}, </if> ",
" <if test=\"bNotice.readFlag !=null and bNotice.readFlag !=''\">read_flag=#{bNotice.readFlag}, </if> ",
// " <if test='updateBy != null'>update_by=#{updateBy},</if>",
// " <if test='updateDate != null'>update_date=#{updateDate},</if>",
// " <if test='delFlag != null'>del_flag=#{delFlag},</if>",
// " <if test='flag != null'>flag=#{flag},</if>",
// " <if test='flag != null'>flag=#{flag},</if>",
// " course_id=#{courseId} ",
" </set>",
"where recipient_id=#{readDTO.userId} " ,
"<if test= \" readDTO.idList != null and readDTO.idList.size()>0 \">and business_id in ",
" <foreach item='item' index='index' collection='readDTO.idList' open='(' separator=',' close=')'> #{item} </foreach> ",
"</if> ",
"</script>"})
int setRead(@Param("readDTO") ReadDTO readDTO,@Param("bNotice")BNotice bNotice);
} }
package org.rcisoft.business.bnotice.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
public class ReadDTO {
@ApiModelProperty(value = "主键id 逗号分隔")
private String ids;
private List<String> idList;
private String userId;
private String corpId;
}
...@@ -30,6 +30,12 @@ public class BNotice extends IdEntity<BNotice> { ...@@ -30,6 +30,12 @@ public class BNotice extends IdEntity<BNotice> {
@ApiModelProperty(value = "发送人id") @ApiModelProperty(value = "发送人id")
private String senderId; private String senderId;
@ApiModelProperty(value = "是否已读,0未读,1已读")
private String readFlag;
@ApiModelProperty(value = "查询参数")
private String queryParam;
@Transient @Transient
@ApiModelProperty(value = "接收人集合(不传)") @ApiModelProperty(value = "接收人集合(不传)")
private List<String> recipientIds; private List<String> recipientIds;
...@@ -38,11 +44,13 @@ public class BNotice extends IdEntity<BNotice> { ...@@ -38,11 +44,13 @@ public class BNotice extends IdEntity<BNotice> {
@ApiModelProperty(value = "课程Id") @ApiModelProperty(value = "课程Id")
private String lessonId; private String lessonId;
@ApiModelProperty(value = "是否已读,0未读,1已读") @Transient
private String readFlag; @ApiModelProperty(value = "头像")
private String headPic;
@ApiModelProperty(value = "查询参数") @Transient
private String queryParam; @ApiModelProperty(value = "发送人名称")
private String senderName;
@Transient @Transient
private String userId; private String userId;
......
package org.rcisoft.business.bnotice.service; package org.rcisoft.business.bnotice.service;
import org.rcisoft.business.bnotice.dto.ReadDTO;
import org.rcisoft.business.bnotice.entity.BNotice; import org.rcisoft.business.bnotice.entity.BNotice;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
...@@ -48,6 +49,6 @@ public interface BNoticeService { ...@@ -48,6 +49,6 @@ public interface BNoticeService {
BNotice bNotice); BNotice bNotice);
PersistModel setRead(ReadDTO readDTO);
} }
package org.rcisoft.business.bnotice.service.impl; package org.rcisoft.business.bnotice.service.impl;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bnotice.dto.ReadDTO;
import org.rcisoft.common.util.feignDto.MTUserGetsReqDTO;
import org.rcisoft.common.util.feignDto.MTUserInfoRspDTO;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
...@@ -15,8 +20,8 @@ import org.springframework.transaction.annotation.Propagation; ...@@ -15,8 +20,8 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList; import java.util.*;
import java.util.List;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
/** /**
...@@ -30,6 +35,8 @@ public class BNoticeServiceImpl implements BNoticeService { ...@@ -30,6 +35,8 @@ public class BNoticeServiceImpl implements BNoticeService {
@Autowired @Autowired
private BNoticeRepository bNoticeRepository; private BNoticeRepository bNoticeRepository;
@Autowired
MTCotactApiRequestClient mtCotactApiRequestClient;
/** /**
* 保存 bNotice * 保存 bNotice
...@@ -102,7 +109,54 @@ public class BNoticeServiceImpl implements BNoticeService { ...@@ -102,7 +109,54 @@ public class BNoticeServiceImpl implements BNoticeService {
*/ */
public List<BNotice> findAllByPagination(PageUtil<BNotice> paginationUtility, public List<BNotice> findAllByPagination(PageUtil<BNotice> paginationUtility,
BNotice bNotice){ BNotice bNotice){
return bNoticeRepository.queryBNotices(bNotice); List<BNotice> noticeList = bNoticeRepository.queryBNotices(bNotice);
if (noticeList == null || noticeList.size() < 1){
return new ArrayList<>();
}
Set<String> ids = new HashSet<>();
noticeList.forEach(bNotice1 -> {
if (StringUtils.isNotEmpty(bNotice1.getSenderId())){
ids.add(bNotice1.getSenderId());
}
});
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(bNotice.getCorpId());
mtUserGetsReqDTO.setIds(new ArrayList<>(ids));
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
if (StringUtils.isNotEmpty(mtUserInfoRspDTO.getId())){
noticeList.forEach(bNotice1 -> {
if (mtUserInfoRspDTO.getId().equals(bNotice1.getSenderId())){
bNotice1.setHeadPic(mtUserInfoRspDTO.getAvatar());
bNotice1.setSenderName(mtUserInfoRspDTO.getName());
}
});
}
});
}
return noticeList;
}
@Override
public PersistModel setRead(ReadDTO readDTO) {
List<String> idList = Arrays.asList(readDTO.getIds().split(","));
readDTO.setIdList(idList);
BNotice bNotice = new BNotice();
UserUtil.setCurrentMergeOperation(bNotice);
bNotice.setReadFlag("1");
bNoticeRepository.setRead(readDTO,bNotice);
return new PersistModel(1);
} }
} }
...@@ -4,10 +4,12 @@ package org.rcisoft.common.util.outClient; ...@@ -4,10 +4,12 @@ package org.rcisoft.common.util.outClient;
//import com.zgiot.zx.schedule.service.INotificationService; //import com.zgiot.zx.schedule.service.INotificationService;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bmessage.dao.BMessageRepository; import org.rcisoft.business.bmessage.dao.BMessageRepository;
import org.rcisoft.business.bmessage.entity.BMessage; import org.rcisoft.business.bmessage.entity.BMessage;
import org.rcisoft.business.bnotice.entity.BNotice; import org.rcisoft.business.bnotice.entity.BNotice;
import org.rcisoft.business.bnotice.service.BNoticeService; import org.rcisoft.business.bnotice.service.BNoticeService;
import org.rcisoft.common.model.InfoTypeEnum;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.ResultCode; import org.rcisoft.core.result.ResultCode;
import org.rcisoft.core.result.Ret; import org.rcisoft.core.result.Ret;
...@@ -19,6 +21,7 @@ import org.rcisoft.core.util.UrlUtil; ...@@ -19,6 +21,7 @@ import org.rcisoft.core.util.UrlUtil;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.sys.dept.dao.SysDeptRepository; import org.rcisoft.sys.dept.dao.SysDeptRepository;
import org.rcisoft.sys.user.dao.SysUserMapper; import org.rcisoft.sys.user.dao.SysUserMapper;
import org.rcisoft.sys.user.dto.MyInfoDTO;
import org.rcisoft.sys.user.entity.SysUser; import org.rcisoft.sys.user.entity.SysUser;
import org.rcisoft.sys.user.service.SysUserService; import org.rcisoft.sys.user.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -84,6 +87,40 @@ public class MTNotificationApiRequestClient { ...@@ -84,6 +87,40 @@ public class MTNotificationApiRequestClient {
Ret ret = new Ret(); Ret ret = new Ret();
List<BNotice> bNoticeList = new ArrayList<>(); List<BNotice> bNoticeList = new ArrayList<>();
String noticeType = "考试";
if (InfoTypeEnum.REPLY_DISCUSS.getValue().equals(message.getInfoType())){
noticeType = InfoTypeEnum.REPLY_DISCUSS.getLable();
}
if (InfoTypeEnum.OFFLINE_TRAIN.getValue().equals(message.getInfoType())){
noticeType = InfoTypeEnum.OFFLINE_TRAIN.getLable();
}
if (InfoTypeEnum.ONLINE_LESSON.getValue().equals(message.getInfoType())){
noticeType = InfoTypeEnum.ONLINE_LESSON.getLable();
}
SysUser senderUser = new SysUser();
if (StringUtils.isNotEmpty(message.getSenderId())){
List<String> ids = new ArrayList<>();
ids.add(message.getSenderId());
MTUserGetsReqDTO mtUserGetsReqDTO = new MTUserGetsReqDTO();
mtUserGetsReqDTO.setCorpId(message.getCorpId());
mtUserGetsReqDTO.setIds(ids);
List<MTUserInfoRspDTO> mtUserInfoRspDTOList = mtCotactApiRequestClient.userGets(mtUserGetsReqDTO);
if (mtUserInfoRspDTOList != null && mtUserInfoRspDTOList.size() > 0){
mtUserInfoRspDTOList.forEach(mtUserInfoRspDTO -> {
if (mtUserInfoRspDTO.getId().equals(message.getSenderId())) {
senderUser.setName(mtUserInfoRspDTO.getName());
senderUser.setHeadPic(mtUserInfoRspDTO.getAvatar());
senderUser.setAccountId(mtUserInfoRspDTO.getAccountId());
}
});
}
}else {
senderUser.setName("智学");
senderUser.setHeadPic("http://zx-zgiot-002.oss-cn-qingdao.aliyuncs.com/image/2d60950fefa14041b4d9715a70a7d389.png");
}
List<String> reciIds = new ArrayList<>(); List<String> reciIds = new ArrayList<>();
List<SysUser> personnelsList = sysUserMapper.selectByIds(message.getRecipientIds()); List<SysUser> personnelsList = sysUserMapper.selectByIds(message.getRecipientIds());
if (null !=personnelsList && personnelsList.size() >0) { if (null !=personnelsList && personnelsList.size() >0) {
...@@ -100,6 +137,7 @@ public class MTNotificationApiRequestClient { ...@@ -100,6 +137,7 @@ public class MTNotificationApiRequestClient {
UserUtil.setCurrentPersistOperation(bNotice1); UserUtil.setCurrentPersistOperation(bNotice1);
bNotice1.setInfoType(message.getInfoType()); bNotice1.setInfoType(message.getInfoType());
bNotice1.setInfoText(message.getInfoText()); bNotice1.setInfoText(message.getInfoText());
bNotice1.setSenderId(message.getSenderId());
bNotice1.setRecipientIds(message.getRecipientIds()); bNotice1.setRecipientIds(message.getRecipientIds());
bNotice1.setLessonId(message.getLessonId()); bNotice1.setLessonId(message.getLessonId());
bNotice1.setRecipientId(sysUser.getBusinessId()); bNotice1.setRecipientId(sysUser.getBusinessId());
...@@ -109,12 +147,16 @@ public class MTNotificationApiRequestClient { ...@@ -109,12 +147,16 @@ public class MTNotificationApiRequestClient {
if (microappApiRequestClient.isHaveApps(Long.parseLong(sysUser.getBusinessId()), Long.parseLong(sysUser.getCorpId()))) { if (microappApiRequestClient.isHaveApps(Long.parseLong(sysUser.getBusinessId()), Long.parseLong(sysUser.getCorpId()))) {
reciIds.add(sysUser.getBusinessId()); reciIds.add(sysUser.getBusinessId());
// 发送智信通知 // 发送智信通知
MTNotificationSendReqDTO mtNotificationSendReqDTO = MTNotificationSendReqDTO.builder().title(noticeTitle).content(message.getInfoText()) MTNotificationSendReqDTO mtNotificationSendReqDTO = MTNotificationSendReqDTO.builder().content(message.getInfoText())
.channels("ALL").targetId(bNotice1.getBusinessId()).receiverIds(Arrays.asList(new String[]{sysUser.getBusinessId()})).build(); .channels("ALL").targetId(bNotice1.getBusinessId()).receiverIds(Arrays.asList(new String[]{sysUser.getBusinessId()})).build();
mtNotificationSendReqDTO.setSenderName("智学"); mtNotificationSendReqDTO.setSenderName("智学");
mtNotificationSendReqDTO.setChannels("ALL"); mtNotificationSendReqDTO.setChannels("ALL");
mtNotificationSendReqDTO.setCategoryCodes(Arrays.asList(new String[]{"EDUCATION"})); mtNotificationSendReqDTO.setCategoryCodes(Arrays.asList(new String[]{"EDUCATION"}));
mtNotificationSendReqDTO.setSenderId(senderUser.getAccountId());
mtNotificationSendReqDTO.setSenderName(senderUser.getName());
mtNotificationSendReqDTO.setCorpId(message.getCorpId());
mtNotificationSendReqDTO.setTitle(senderUser.getName());
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String noticePropertiesUrl = ""; String noticePropertiesUrl = "";
...@@ -128,9 +170,12 @@ public class MTNotificationApiRequestClient { ...@@ -128,9 +170,12 @@ public class MTNotificationApiRequestClient {
String url = noticePropertiesUrl + "&from=zx"; String url = noticePropertiesUrl + "&from=zx";
// String url = noticePropertiesUrl + "noticeType=" + dealWithTitle(noticeTitle) + "&id=" + sysUser.getBusinessId() + "&infoText=" + UrlUtil.Utf8URLencode(message.getInfoText()) // String url = noticePropertiesUrl + "noticeType=" + dealWithTitle(noticeTitle) + "&id=" + sysUser.getBusinessId() + "&infoText=" + UrlUtil.Utf8URLencode(message.getInfoText())
// + "&messageId=" + message.getBusinessId() + "&createDate=" + UrlUtil.Utf8URLencodeTime(df.format(message.getCreateDate())) + "&from=zx"; // + "&messageId=" + message.getBusinessId() + "&createDate=" + UrlUtil.Utf8URLencodeTime(df.format(message.getCreateDate())) + "&from=zx";
final String finalNoticeType = noticeType;
mtNotificationSendReqDTO.setProperties(new HashMap<String, String>() {{ mtNotificationSendReqDTO.setProperties(new HashMap<String, String>() {{
put("url", url); put("url", url);
put("createUrl",senderUser.getHeadPic());
put("createName",senderUser.getName());
put("type",finalNoticeType);
}}); }});
try { try {
ret = notificationFeignClient.sendMessage(mtNotificationSendReqDTO, "app", (long) 1); ret = notificationFeignClient.sendMessage(mtNotificationSendReqDTO, "app", (long) 1);
...@@ -138,11 +183,12 @@ public class MTNotificationApiRequestClient { ...@@ -138,11 +183,12 @@ public class MTNotificationApiRequestClient {
log.error("----------------------------------------------------调用智信通知失败!----------------------------------------------------------"); log.error("----------------------------------------------------调用智信通知失败!----------------------------------------------------------");
return false; return false;
} }
bNoticeServiceImpl.save(bNoticeList);
} }
} }
} }
bNoticeServiceImpl.save(bNoticeList);
if(ret != null && "M0000".equals(ret.getCode())){ if(ret != null && "M0000".equals(ret.getCode())){
return true; return true;
......
...@@ -76,7 +76,11 @@ public class messageTask { ...@@ -76,7 +76,11 @@ public class messageTask {
// 通知信息 // 通知信息
bNotice.setInfoText("“"+bLesson.getLessonName()+"”线下培训即将开始" ); bNotice.setInfoText("“"+bLesson.getLessonName()+"”线下培训即将开始" );
// 往智信平台发啊消息 // 往智信平台发啊消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),MessageEnum.PXJJKS.getName(),UrlTypeEnum.TRAIN.getName()); try {
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),MessageEnum.PXJJKS.getName(),UrlTypeEnum.TRAIN.getName());
}catch (Exception e){
log.info("发送通知失败,"+e);
}
}); });
} }
} }
......
...@@ -221,7 +221,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> { ...@@ -221,7 +221,7 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
@ResultMap(value = "BaseResultMap") @ResultMap(value = "BaseResultMap")
SysUser queryUserState(@Param("userId")String userId); SysUser queryUserState(@Param("userId")String userId);
@Select("<script>select business_id id, `name` name from s_user where business_id = #{userId}" + @Select("<script>select business_id id, `name` name,`value` value from s_user where business_id = #{userId}" +
"</script>") "</script>")
MyInfoDTO queryMyInfo(CurUser curUser); MyInfoDTO queryMyInfo(CurUser curUser);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment