Commit feae305c authored by zhangqingle's avatar zhangqingle

修改BUG

parent c8f5245a
...@@ -6,6 +6,8 @@ import org.rcisoft.business.bdiscuss.dto.BDiscussDto; ...@@ -6,6 +6,8 @@ import org.rcisoft.business.bdiscuss.dto.BDiscussDto;
import org.rcisoft.business.blesson.dao.BLessonRepository; import org.rcisoft.business.blesson.dao.BLessonRepository;
import org.rcisoft.business.blesson.entity.BLesson; import org.rcisoft.business.blesson.entity.BLesson;
import org.rcisoft.business.blesson.service.BLessonService; import org.rcisoft.business.blesson.service.BLessonService;
import org.rcisoft.business.bmessage.dao.BMessageRepository;
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.common.model.InfoTypeEnum;
...@@ -15,6 +17,7 @@ import org.rcisoft.common.util.outClient.MTCotactApiRequestClient; ...@@ -15,6 +17,7 @@ import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
import org.rcisoft.common.util.outClient.MTMicroappApiRequestClient; import org.rcisoft.common.util.outClient.MTMicroappApiRequestClient;
import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient; import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient;
import org.rcisoft.core.enums.MessageEnum; import org.rcisoft.core.enums.MessageEnum;
import org.rcisoft.core.enums.UrlTypeEnum;
import org.rcisoft.core.util.IdGen; import org.rcisoft.core.util.IdGen;
import org.rcisoft.core.util.UserUtil; import org.rcisoft.core.util.UserUtil;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
...@@ -66,6 +69,9 @@ public class BDiscussServiceImpl implements BDiscussService { ...@@ -66,6 +69,9 @@ public class BDiscussServiceImpl implements BDiscussService {
@Autowired @Autowired
MTNotificationApiRequestClient client; MTNotificationApiRequestClient client;
@Autowired
BMessageRepository bMessageRepository;
/** /**
* 保存 bDiscuss * 保存 bDiscuss
...@@ -75,16 +81,50 @@ public class BDiscussServiceImpl implements BDiscussService { ...@@ -75,16 +81,50 @@ public class BDiscussServiceImpl implements BDiscussService {
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT) @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override @Override
public PersistModel save(CurUser curUser,BDiscuss bDiscuss){ public PersistModel save(CurUser curUser,BDiscuss bDiscuss){
if (StringUtils.isNotBlank(bDiscuss.getReplyId())){ //评论评论
List<BMessage> bMessageList = bMessageRepository.queryByNameAndCorp("HFPL",curUser.getCorpId());
BMessage message = new BMessage();
if (bMessageList != null && bMessageList.size() > 0){
message = bMessageList.get(0);
}
if (StringUtils.isBlank(bDiscuss.getLevel()) && "2".equals(bDiscuss.getLevel()) && "1".equals(message.getFlag())){
BNotice bNotice = new BNotice(); BNotice bNotice = new BNotice();
bNotice.setRecipientIds(new ArrayList<>(Arrays.asList(bDiscuss.getReplyId()))); if (StringUtils.isNotEmpty(bDiscuss.getReplyId())){
BDiscuss bDiscussStu = bDiscussRepository.selectByPrimaryKey(bDiscuss.getReplyId());
bNotice.setRecipientIds(new ArrayList<>(Arrays.asList(bDiscussStu.getStudentId())));
}else {
BDiscuss bDiscussStu = bDiscussRepository.selectByPrimaryKey(bDiscuss.getPid());
bNotice.setRecipientIds(new ArrayList<>(Arrays.asList(bDiscussStu.getStudentId())));
}
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue()); bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
bNotice.setLessonId(bDiscuss.getLessonId());
// 获取课程信息 // 获取课程信息
BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId()); BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId());
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训"; String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
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()); client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.HFPL.getName(),urlType);
}
//评论课程
List<BMessage> bMessageListFBPL = bMessageRepository.queryByNameAndCorp("FBPL",curUser.getCorpId());
BMessage messageFBPL = new BMessage();
if (bMessageListFBPL != null && bMessageListFBPL.size() > 0){
messageFBPL = bMessageListFBPL.get(0);
}
if (StringUtils.isBlank(bDiscuss.getLevel()) && "1".equals(bDiscuss.getLevel()) && "1".equals(messageFBPL.getFlag())){
BNotice bNotice = new BNotice();
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
bNotice.setLessonId(bDiscuss.getLessonId());
// 获取课程信息
BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId());
bNotice.setRecipientIds(new ArrayList<>(Arrays.asList(bLesson.getLecturerId())));
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
String urlType = "0".equals(bLesson.getLessonType()) ? UrlTypeEnum.LESSON.getName() : UrlTypeEnum.TRAIN.getName();
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "评论了您主讲的" + lessonType +"\"" + bLesson.getLessonName()+"\"" );
// 发消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(), MessageEnum.FBPL.getName(),urlType);
} }
//增加操作 //增加操作
UserUtil.setCurrentPersistOperation(bDiscuss); UserUtil.setCurrentPersistOperation(bDiscuss);
......
...@@ -1051,7 +1051,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> { ...@@ -1051,7 +1051,7 @@ public interface BLessonRepository extends BaseMapper<BLesson> {
@Select("<script>select distinct bl.*, " + @Select("<script>select distinct bl.*, " +
" blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate,blp.business_id lessonPersonId, " + " blp.is_apply isApply,blp.is_appoint isAppoint,blp.train_is_sign trainIsSign,blp.sign_date signDate,blp.business_id lessonPersonId,blp.apply_date applyDate, " +
"CONCAT( " + "CONCAT( " +
"IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " + "IFNULL(CONCAT(b3.c_name,\" / \"),\"\"), " +
"IFNULL(CONCAT(b2.c_name,\" / \"),\"\"), " + "IFNULL(CONCAT(b2.c_name,\" / \"),\"\"), " +
......
...@@ -51,7 +51,6 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -51,7 +51,6 @@ public class BLesson extends IdEntity<BLesson> {
private String defaultUrl; private String defaultUrl;
@ApiModelProperty(value = "课时") @ApiModelProperty(value = "课时")
// @Length(min = 1,max = 8,message = "长度最小为1,最大为5")
private String classHour; private String classHour;
@ApiModelProperty(value = "讲师id") @ApiModelProperty(value = "讲师id")
...@@ -83,11 +82,9 @@ public class BLesson extends IdEntity<BLesson> { ...@@ -83,11 +82,9 @@ public class BLesson extends IdEntity<BLesson> {
private String viewRange; private String viewRange;
@ApiModelProperty(value = "发布时间") @ApiModelProperty(value = "发布时间")
//@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private Date releaseDate; private Date releaseDate;
@ApiModelProperty(value = "关闭时间") @ApiModelProperty(value = "关闭时间")
//@Length(min = 1,max = 1,message = "长度最小为1,最大为1")
private Date closeDate; private Date closeDate;
@ApiModelProperty(value = "课程类型(0:课程 1:培训)") @ApiModelProperty(value = "课程类型(0:课程 1:培训)")
......
...@@ -34,6 +34,7 @@ import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient; ...@@ -34,6 +34,7 @@ import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient;
import org.rcisoft.core.aop.PageUtil; import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant; import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.enums.MessageEnum; import org.rcisoft.core.enums.MessageEnum;
import org.rcisoft.core.enums.UrlTypeEnum;
import org.rcisoft.core.exception.ServiceException; import org.rcisoft.core.exception.ServiceException;
import org.rcisoft.core.model.PersistModel; import org.rcisoft.core.model.PersistModel;
import org.rcisoft.core.result.ResultServiceEnums; import org.rcisoft.core.result.ResultServiceEnums;
...@@ -762,11 +763,13 @@ public class BLessonServiceImpl implements BLessonService { ...@@ -762,11 +763,13 @@ public class BLessonServiceImpl implements BLessonService {
BNotice bNotice = new BNotice(); BNotice bNotice = new BNotice();
bNotice.setRecipientIds(userIds); bNotice.setRecipientIds(userIds);
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue()); bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
bNotice.setLessonId(bLesson.getBusinessId());
// 获取课程信息 // 获取课程信息
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训"; String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
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); client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),type,urlType);
} }
BAppoint bAppoint; BAppoint bAppoint;
......
...@@ -26,6 +26,9 @@ public class BNotice extends IdEntity<BNotice> { ...@@ -26,6 +26,9 @@ public class BNotice extends IdEntity<BNotice> {
@Transient @Transient
private List<String> recipientIds; private List<String> recipientIds;
@Transient
private String lessonId;
private String readFlag; private String readFlag;
......
...@@ -40,8 +40,14 @@ import java.util.stream.Collectors; ...@@ -40,8 +40,14 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class MTNotificationApiRequestClient { public class MTNotificationApiRequestClient {
@Value("${notice.properties.url}") @Value("${notice.properties.urlCourse}")
public String noticePropertiesUrl; public String noticeUrlCourse;
@Value("${notice.properties.urlTrain}")
public String noticeUrlTrain;
@Value("${notice.properties.urlExam}")
public String noticeUrlExam;
@Value("${server.type}") @Value("${server.type}")
private String serverType; private String serverType;
...@@ -70,7 +76,7 @@ public class MTNotificationApiRequestClient { ...@@ -70,7 +76,7 @@ public class MTNotificationApiRequestClient {
* @param * @param
* @return * @return
*/ */
public boolean send(BNotice message, String noticeTitle, String type) { public boolean send(BNotice message, String noticeTitle, String type, String urlType) {
if("dev".equalsIgnoreCase(serverType)) { if("dev".equalsIgnoreCase(serverType)) {
return true; return true;
} }
...@@ -99,8 +105,17 @@ public class MTNotificationApiRequestClient { ...@@ -99,8 +105,17 @@ public class MTNotificationApiRequestClient {
mtNotificationSendReqDTO.setCategoryCodes(Arrays.asList(new String[]{"EDUCATION"})); mtNotificationSendReqDTO.setCategoryCodes(Arrays.asList(new String[]{"EDUCATION"}));
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
String url = this.noticePropertiesUrl + "noticeType=" + dealWithTitle(noticeTitle) + "&id=" + sysUser.getBusinessId() + "&infoText=" + UrlUtil.Utf8URLencode(message.getInfoText()) String noticePropertiesUrl = "";
+ "&messageId=" + message.getBusinessId() + "&createDate=" + UrlUtil.Utf8URLencodeTime(df.format(message.getCreateDate())) + "&from=zx"; if ("LESSON".equals(urlType)){
noticePropertiesUrl = this.noticeUrlCourse + "id=" + message.getLessonId();
}else if ("TRAIN".equals(urlType)){
noticePropertiesUrl = this.noticeUrlTrain + "id=" + message.getLessonId();
}else if ("EXAM".equals(urlType)){
noticePropertiesUrl = this.noticeUrlExam;
}
String url = noticePropertiesUrl + "&from=zx";
// 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";
mtNotificationSendReqDTO.setProperties(new HashMap<String, String>() {{ mtNotificationSendReqDTO.setProperties(new HashMap<String, String>() {{
put("url", url); put("url", url);
......
package org.rcisoft.core.enums;
public enum UrlTypeEnum {
LESSON("LESSON","课程"),
TRAIN("TRAIN","培训"),
EXAM("EXAM","考试"),
;
UrlTypeEnum(String name, String remarks) {
this.name = name;
this.remarks = remarks;
}
private String name;
private String remarks;
public String getName() {
return name;
}
public String getRemarks() {
return remarks;
}
}
...@@ -14,6 +14,7 @@ import org.rcisoft.common.model.InfoTypeEnum; ...@@ -14,6 +14,7 @@ import org.rcisoft.common.model.InfoTypeEnum;
import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO; import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO;
import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient; import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient;
import org.rcisoft.core.enums.MessageEnum; import org.rcisoft.core.enums.MessageEnum;
import org.rcisoft.core.enums.UrlTypeEnum;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -64,10 +65,11 @@ public class messageTask { ...@@ -64,10 +65,11 @@ public class messageTask {
BNotice bNotice = new BNotice(); BNotice bNotice = new BNotice();
bNotice.setRecipientIds(bLesson.getPersonList()); bNotice.setRecipientIds(bLesson.getPersonList());
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue()); bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
bNotice.setLessonId(bLesson.getBusinessId());
// 通知信息 // 通知信息
bNotice.setInfoText("“"+bLesson.getLessonName()+"”线下培训即将开始" ); bNotice.setInfoText("“"+bLesson.getLessonName()+"”线下培训即将开始" );
// 往智信平台发啊消息 // 往智信平台发啊消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),MessageEnum.PXJJKS.getName()); client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable(),MessageEnum.PXJJKS.getName(),UrlTypeEnum.TRAIN.getName());
}); });
} }
} }
......
...@@ -122,4 +122,6 @@ ribbon: ...@@ -122,4 +122,6 @@ ribbon:
notice: notice:
properties: properties:
url: http://192.168.5.54/schedule-app/#/noticeDetail/:noticeType? urlCourse: http://192.168.9.39:8001/#/courseDetail?
\ No newline at end of file urlTrain: http://192.168.9.39:8001/#/trainDetail?
urlExam: http://192.168.9.39:8001/#/onlineExamination?
\ No newline at end of file
...@@ -112,4 +112,6 @@ ribbon: ...@@ -112,4 +112,6 @@ ribbon:
notice: notice:
properties: properties:
url: http://192.168.5.54/schedule-app/#/noticeDetail/:noticeType? urlCourse: http://192.168.9.39:8001/#/courseDetail?
\ No newline at end of file urlTrain: http://192.168.9.39:8001/#/trainDetail?
urlExam: http://192.168.9.39:8001/#/onlineExamination?
\ No newline at end of file
...@@ -122,4 +122,6 @@ ribbon: ...@@ -122,4 +122,6 @@ ribbon:
notice: notice:
properties: properties:
url: http://192.168.5.54/schedule-app/#/noticeDetail/:noticeType? urlCourse: http://192.168.9.39:8001/#/courseDetail?
\ No newline at end of file urlTrain: http://192.168.9.39:8001/#/trainDetail?
urlExam: http://192.168.9.39:8001/#/onlineExamination?
\ No newline at end of file
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