Commit e04b4344 authored by luzhuang's avatar luzhuang

Merge remote-tracking branch 'origin/meiteng' into meiteng

# Conflicts:
#	src/main/java/org/rcisoft/common/util/outClient/MTNotificationApiRequestClient.java
parents f956ca86 4e51cb2c
......@@ -88,6 +88,7 @@ public class BDiscussServiceImpl implements BDiscussService {
message = bMessageList.get(0);
}
if (StringUtils.isBlank(bDiscuss.getLevel()) && "2".equals(bDiscuss.getLevel()) && "1".equals(message.getFlag())){
try{
BNotice bNotice = new BNotice();
if (StringUtils.isNotEmpty(bDiscuss.getReplyId())){
BDiscuss bDiscussStu = bDiscussRepository.selectByPrimaryKey(bDiscuss.getReplyId());
......@@ -107,7 +108,6 @@ public class BDiscussServiceImpl implements BDiscussService {
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "回复了您在" + lessonType +"[" + bLesson.getLessonName() +"]的评论" );
// 发消息
try{
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.HFPL.getName(),urlType);
}catch (Exception e){
log.info("发送通知失败,"+e);
......@@ -120,6 +120,7 @@ public class BDiscussServiceImpl implements BDiscussService {
messageFBPL = bMessageListFBPL.get(0);
}
if (StringUtils.isBlank(bDiscuss.getLevel()) && "1".equals(bDiscuss.getLevel()) && "1".equals(messageFBPL.getFlag())){
try {
BNotice bNotice = new BNotice();
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
bNotice.setLessonId(bDiscuss.getLessonId());
......@@ -132,7 +133,7 @@ public class BDiscussServiceImpl implements BDiscussService {
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "评论了您主讲的" + lessonType +"\"" + bLesson.getLessonName()+"\"" );
// 发消息
try {
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.FBPL.getName(),urlType);
}catch (Exception e){
log.info("发送通知失败,"+e);
......
......@@ -761,6 +761,7 @@ public class BLessonServiceImpl implements BLessonService {
message = bMessageList.get(0);
}
if (userIds != null && userIds.size() > 0 && message != null && "1".equals(message.getFlag())){
try{
BNotice bNotice = new BNotice();
bNotice.setRecipientIds(userIds);
bNotice.setLessonId(bLesson.getBusinessId());
......@@ -773,8 +774,7 @@ public class BLessonServiceImpl implements BLessonService {
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(appointLessonDTO.getUserId()).getName() + "给您指派了" + lessonType +"“" + bLesson.getLessonName() +"”,请及时学习" );
// 往智信平台发啊消息
try{
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),type,urlType);
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),type,urlType);
}catch (Exception e){
log.info("发送通知失败,"+e);
}
......
package org.rcisoft.common.util.feignClient;
import org.rcisoft.core.result.NotiRet;
import org.rcisoft.core.result.Ret;
import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -21,8 +22,8 @@ public interface NotificationFeignClient {
* @return
*/
@RequestMapping(value = "/notification/send",method = RequestMethod.POST)
Ret sendMessage(@RequestBody MTNotificationSendReqDTO mtNotificationSendReqDTO,
@RequestParam("zxClientType") String zxClientType,
@RequestParam("zxAccountId") Long zxAccountId
NotiRet sendMessage(@RequestBody MTNotificationSendReqDTO mtNotificationSendReqDTO,
@RequestParam("zxClientType") String zxClientType,
@RequestParam("zxAccountId") Long zxAccountId
);
}
......@@ -3,6 +3,7 @@ package org.rcisoft.common.util.outClient;
//import com.zgiot.zx.schedule.service.INotificationService;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.rcisoft.business.bmessage.dao.BMessageRepository;
......@@ -11,6 +12,7 @@ import org.rcisoft.business.bnotice.entity.BNotice;
import org.rcisoft.business.bnotice.service.BNoticeService;
import org.rcisoft.common.model.InfoTypeEnum;
import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.result.NotiRet;
import org.rcisoft.core.result.ResultCode;
import org.rcisoft.core.result.Ret;
import org.rcisoft.common.util.feignClient.NotificationFeignClient;
......@@ -84,7 +86,7 @@ public class MTNotificationApiRequestClient {
if("dev".equalsIgnoreCase(serverType)) {
return true;
}
Ret ret = new Ret();
NotiRet ret = new NotiRet();
List<BNotice> bNoticeList = new ArrayList<>();
String noticeType = "考试";
......@@ -144,11 +146,11 @@ public class MTNotificationApiRequestClient {
bNotice1.setReadFlag("0");
bNoticeList.add(bNotice1);
// 判断智学权限
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());
// 发送智信通知
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[]{"290"})).build();
mtNotificationSendReqDTO.setSenderName("智学");
mtNotificationSendReqDTO.setChannels("ALL");
......@@ -175,17 +177,21 @@ public class MTNotificationApiRequestClient {
put("url", url);
put("createUrl",senderUser.getHeadPic());
put("createName",senderUser.getName());
put("type",finalNoticeType);
// put("area",finalNoticeType);
}});
String json = JSON.toJSONString(mtNotificationSendReqDTO);
log.debug(json);
try {
ret = notificationFeignClient.sendMessage(mtNotificationSendReqDTO, "app", (long) 1);
} catch (Exception ex) {
log.error("----------------------------------------------------调用智信通知失败!----------------------------------------------------------");
log.error("----------------------------------------------------调用智信通知失败!----------------------------------------------------------"+ex);
return false;
}
//bNoticeServiceImpl.save(bNoticeList);
}
bNoticeServiceImpl.save(bNoticeList);
// }
}
}
......
package org.rcisoft.core.result;
import com.google.common.base.MoreObjects;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.rcisoft.core.util.UserUtil;
import org.springframework.core.annotation.Order;
import java.io.Serializable;
/**
* 返回信息
*
* @author David
*/
@ApiModel(value = "通知请求响应")
public class NotiRet<T> implements Serializable {
@Order(1)
@ApiModelProperty(value = "错误码")
private String code;
@Order(2)
@ApiModelProperty(value = "错误描述")
private String message;
@Order(3)
@ApiModelProperty(value = "请求时间")
private Long ctime;
@Order(4)
@ApiModelProperty(value = "请求编号")
private String requestId;
@Order(5)
@ApiModelProperty(value = "响应数据")
private T data;
public NotiRet() {
this(null);
}
public NotiRet(String code) {
this(code, null);
}
public NotiRet(String code, String message) {
this.code = code;
this.message = message;
this.ctime = System.currentTimeMillis();
if (UserUtil.getCurUser() != null) {
this.requestId = String.valueOf(UserUtil.getCurUser().getRequireId());
}
}
//构建成功返回
public static NotiRet ok() {
return new NotiRet(ResultCode.SUCCESS.getCode().toString(), "ok");
}
//构建系统异常返回
public static NotiRet error() {
return new NotiRet(ResultCode.ERROR.getCode().toString(), "false");
}
public String getCode() {
return code;
}
public NotiRet<T> setCode(String code) {
this.code = code;
return this;
}
public String getMessage() {
return message;
}
public NotiRet<T> setMessage(String message) {
this.message = message;
return this;
}
public Long getCtime() {
return ctime;
}
public NotiRet<T> setCtime(Long ctime) {
this.ctime = ctime;
return this;
}
public String getRequestId() {
return requestId;
}
public NotiRet<T> setRequestId(String requestId) {
this.requestId = requestId;
return this;
}
public T getData() {
return data;
}
public NotiRet<T> setData(T data) {
this.data = data;
return this;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("\ncode", code)
.add("\nmessage", message)
.add("\nctime", ctime)
.add("\nrequestId", requestId)
.add("\ndata", data)
.toString();
}
}
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