Commit 6fa41c62 authored by zhangqingle's avatar zhangqingle

修改BUG

parent 029b1241
......@@ -32,10 +32,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import lombok.extern.slf4j.Slf4j;
......@@ -82,16 +79,15 @@ public class BDiscussServiceImpl implements BDiscussService {
@Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT)
@Override
public PersistModel save(CurUser curUser,BDiscuss bDiscuss){
if (StringUtils.isNotBlank(bDiscuss.getReplyId()) && microappApiRequestClient.isHaveApps(Long.parseLong(curUser.getUserId()),Long.parseLong(curUser.getCorpId()))){
if (StringUtils.isNotBlank(bDiscuss.getReplyId())){
BNotice bNotice = new BNotice();
// UserUtil.setCurrentPersistOperation(bNotice);
bNotice.setRecipientId(bDiscuss.getReplyId());
bNotice.setRecipientId(new ArrayList<>(Arrays.asList(bDiscuss.getReplyId())));
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
// 获取课程信息
BLesson bLesson = lessonRepository.selectByPrimaryKey(bDiscuss.getLessonId());
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
bNotice.setInfoText(sysUserServiceImpl.getNameById(bDiscuss.getStudentId()).getName() + "回复了您在" + lessonType +"[" + bLesson.getLessonName() +"]的评论" );
bNoticeServiceImpl.save(bNotice);
// 往智信平台发啊消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable());
}
......
......@@ -18,12 +18,19 @@ import org.rcisoft.business.blesson.util.Recursion;
import org.rcisoft.business.blesson.dao.BViewrangeRepository;
import org.rcisoft.business.bmaterial.dao.BMaterialRepository;
import org.rcisoft.business.bmaterial.entity.BMaterial;
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.service.BNoticeService;
import org.rcisoft.business.bpersonvalue.dao.BPersonValueRepository;
import org.rcisoft.business.bpersonvalue.entity.BPersonValue;
import org.rcisoft.business.breleasevalue.dao.BReleaseValueRepository;
import org.rcisoft.business.breleasevalue.entity.BReleaseValue;
import org.rcisoft.common.model.InfoTypeEnum;
import org.rcisoft.common.util.feignDto.*;
import org.rcisoft.common.util.outClient.MTCotactApiRequestClient;
import org.rcisoft.common.util.outClient.MTMicroappApiRequestClient;
import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient;
import org.rcisoft.core.aop.PageUtil;
import org.rcisoft.core.constant.MessageConstant;
import org.rcisoft.core.exception.ServiceException;
......@@ -35,6 +42,7 @@ import org.rcisoft.sys.user.bean.CurUser;
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.service.SysUserService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -100,6 +108,21 @@ public class BLessonServiceImpl implements BLessonService {
@Autowired
BPersonValueRepository bPersonValueRepository;
@Autowired
MTNotificationApiRequestClient client;
@Autowired
MTMicroappApiRequestClient microappApiRequestClient;
@Autowired
SysUserService sysUserServiceImpl;
@Autowired
BNoticeService bNoticeServiceImpl;
@Autowired
BMessageRepository bMessageRepository;
@Override
@Transactional(propagation = Propagation.REQUIRED,readOnly = false)
public BLesson selectOne(CurUser curUser,String lessonId) {
......@@ -726,6 +749,25 @@ public class BLessonServiceImpl implements BLessonService {
//去重后放入List
userIds.addAll(new ArrayList<>(userIdSet));
//发送通知
//是否去掉已在切已指派的人员
String type = "0".equals(bLesson.getLessonType()) ? "ZPKC" : "ZPPX";
List<BMessage> bMessageList = bMessageRepository.queryByNameAndCorp(type,appointLessonDTO.getCorpId());
BMessage message = new BMessage();
if (bMessageList != null && bMessageList.size() > 0){
message = bMessageList.get(0);
}
if (userIds != null && userIds.size() > 0 && message != null && "1".equals(message.getFlag())){
BNotice bNotice = new BNotice();
bNotice.setRecipientId(userIds);
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
// 获取课程信息
String lessonType = "0".equals(bLesson.getLessonType()) ? "线上课程" : "线下培训";
bNotice.setInfoText(sysUserServiceImpl.getNameById(appointLessonDTO.getUserId()).getName() + "给您指派了" + lessonType +"“" + bLesson.getLessonName() +"”,请及时学习" );
// 往智信平台发啊消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable());
}
BAppoint bAppoint;
//拼接人员和部门中人员
String userAllString = StringUtils.join(userIdSet , ",");
......@@ -760,6 +802,7 @@ public class BLessonServiceImpl implements BLessonService {
UserUtil.setCurrentMergeOperation(bLessonPerson);
bLessonPersonRepository.cancelAppointByPersons(bLessonPerson);
}
//如果为空删除指派表记录
if (userIds == null || userIds.size() < 1){
int line = bAppointRepository.deleteByPrimaryKey(bAppoint);
bLessonRepository.personNumberReCount(bLesson.getBusinessId(),bLesson.getLessonType());
......
......@@ -49,8 +49,9 @@ public interface BMessageRepository extends BaseMapper<BMessage> {
@Select("<script>select * from b_message where 1=1 "
+ " and del_flag = 0 "
+ " and name = #{name} "
+ " <if test=\"corpId !=null and corpId != ''\">and corp_id=#{corpId}</if>"
+ "</script>")
@ResultMap(value = "BaseResultMap" )
List<BMessage> queryByNameAndCorp(@Param("name") String name);
List<BMessage> queryByNameAndCorp(@Param("name") String name, @Param("corpId") String corpId);
}
......@@ -5,6 +5,7 @@ import lombok.*;
import org.rcisoft.core.entity.IdEntity;
import javax.persistence.*;
import java.util.Date;
import java.util.List;
/**
* Created with on 2019-11-28 11:18:34.
......@@ -20,7 +21,7 @@ public class BNotice extends IdEntity<BNotice> {
private String infoText;
private String recipientId;
private List<String> recipientId;
private String readFlag;
......
......@@ -66,10 +66,11 @@ public class MTNotificationApiRequestClient {
List<String> receiIdListtake = new ArrayList<>();
String receive = "";
String corpId = "";
List<SysUser> personnelsList = sysUserMapper.selectByIds(Arrays.asList(message.getRecipientId().split(","))
.stream()
.map(s -> s.trim())
.collect(Collectors.toList()));
// List<SysUser> personnelsList = sysUserMapper.selectByIds(Arrays.asList(message.getRecipientId().split(","))
// .stream()
// .map(s -> s.trim())
// .collect(Collectors.toList()));
List<SysUser> personnelsList = sysUserMapper.selectByIds(message.getRecipientId());
if (null !=personnelsList && personnelsList.size() >0) {
for (SysUser personnels: personnelsList){
if (null != personnels && null != personnels.getAccountId()) {
......
......@@ -8,6 +8,9 @@ import org.rcisoft.business.blesson.dto.FindLessonAtMessageTaskDTO;
import org.rcisoft.business.blesson.entity.BLesson;
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.service.BNoticeService;
import org.rcisoft.common.model.InfoTypeEnum;
import org.rcisoft.common.util.feignDto.MTNotificationSendReqDTO;
import org.rcisoft.common.util.outClient.MTNotificationApiRequestClient;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -30,14 +33,17 @@ public class messageTask {
BLessonRepository bLessonRepository;
@Autowired
MTNotificationApiRequestClient mtNotificationApiRequestClient;
MTNotificationApiRequestClient client;
// @Scheduled(cron = "0/20 * * * * ?")
@Autowired
BNoticeService bNoticeServiceImpl;
// @Scheduled(cron = "0 0/1 * * * ?")
@Transactional(propagation = Propagation.REQUIRED, readOnly = false)
public void work() throws Exception {
Date nowDate = new Date();
//判断是否开启
List<BMessage> bMessagePXJJKSList = bMessageRepository.queryByNameAndCorp("PXJJKS");
List<BMessage> bMessagePXJJKSList = bMessageRepository.queryByNameAndCorp("PXJJKS",null);
//判断是否在设定时间内
if (bMessagePXJJKSList != null && bMessagePXJJKSList.size() > 0){
bMessagePXJJKSList.forEach(bMessage -> {
......@@ -50,16 +56,23 @@ public class messageTask {
valueTypeStr = "DAY";
}
FindLessonAtMessageTaskDTO param = new FindLessonAtMessageTaskDTO(bMessage.getCorpId(),bMessage.getTimeValue(),valueTypeStr,nowDate);
//在时间内发送通知
List<BLesson> bLessonList = bLessonRepository.selectLessonAtMessageTask(param);
if (bLessonList != null && bLessonList.size() > 0){
bLessonList.forEach(bLesson -> {
// MTNotificationSendReqDTO mtNotificationSendReqDTO = new MTNotificationSendReqDTO();
BNotice bNotice = new BNotice();
bNotice.setRecipientId(bLesson.getPersonList());
bNotice.setInfoType(InfoTypeEnum.REPLY_DISCUSS.getValue());
// 通知信息
bNotice.setInfoText("“"+bLesson.getLessonName()+"”线下培训即将开始" );
bNoticeServiceImpl.save(bNotice);
// 往智信平台发啊消息
client.send(bNotice,InfoTypeEnum.REPLY_DISCUSS.getLable());
});
}
}
});
}
//在时间内发送通知
}
}
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