|
|
@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil; |
|
|
|
import cn.hutool.core.lang.Snowflake; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ccsens.tall.bean.dto.DeliverDto; |
|
|
|
import com.ccsens.tall.bean.dto.WpsDto; |
|
|
|
import com.ccsens.tall.bean.dto.message.BaseMessageDto; |
|
|
@ -235,121 +234,8 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
deliver.setId(uploadDeliver.getDeliverId()); |
|
|
|
deliver.setIsUpload(1); |
|
|
|
taskDeliverDao.updateByPrimaryKeySelective(deliver); |
|
|
|
|
|
|
|
} |
|
|
|
// if (role.getName().equalsIgnoreCase(WebConstant.ROLE_NAME.AllMember.phase) || isBelongRole) {
|
|
|
|
// //发送信息
|
|
|
|
// List<BaseMessageDto.MessageUser> messageUserList = new ArrayList<>();
|
|
|
|
// BaseMessageDto.MessageUser messageUser;
|
|
|
|
// List<Long> userIdList = new ArrayList<>();
|
|
|
|
// //查找以前的交付物。如果有,改为历史信息
|
|
|
|
// ProTaskDeliverPostLogExample logExample = new ProTaskDeliverPostLogExample();
|
|
|
|
// logExample.createCriteria().andTaskSubTimeIdEqualTo(subTimeId)
|
|
|
|
// .andDeliverIdEqualTo(uploadDeliver.getDeliverId()).andUserIdEqualTo(currentUserId);
|
|
|
|
// List<ProTaskDeliverPostLog> deliverPostLogList = deliverPostLogDao.selectByExample(logExample);
|
|
|
|
// if (CollectionUtil.isNotEmpty(deliverPostLogList)) {
|
|
|
|
// for (ProTaskDeliverPostLog deliverPostLog : deliverPostLogList) {
|
|
|
|
// if (deliverPostLog.getIsHistory() == 0) {
|
|
|
|
// deliverPostLog.setIsHistory(1);
|
|
|
|
// deliverPostLogDao.updateByPrimaryKeySelective(deliverPostLog);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// //添加PostLog
|
|
|
|
// ProTaskDeliverPostLog deliverPostLog = new ProTaskDeliverPostLog();
|
|
|
|
// deliverPostLog.setId(snowflake.nextId());
|
|
|
|
// deliverPostLog.setDeliverId(uploadDeliver.getDeliverId());
|
|
|
|
// deliverPostLog.setTaskSubTimeId(subTimeId);
|
|
|
|
// //如果有文件则添加,没有不添加
|
|
|
|
// if (CollectionUtil.isNotEmpty(uploadDeliver.getFileInfo())) {
|
|
|
|
// for (DeliverDto.FileInfo fileInfo : uploadDeliver.getFileInfo()) {
|
|
|
|
// SysCommitedFile file = commitedFileDao.selectByPrimaryKey(fileInfo.getId());
|
|
|
|
// if(ObjectUtil.isNotNull(file)){
|
|
|
|
// deliverPostLog.setFileId(file.getId());
|
|
|
|
// }else {
|
|
|
|
// throw new BaseException(CodeEnum.NOT_DELIVER_FILE);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// deliverPostLog.setUserId(currentUserId);
|
|
|
|
// deliverPostLog.setDescription(uploadDeliver.getDescription());
|
|
|
|
// deliverPostLog.setTime(now);
|
|
|
|
// deliverPostLog.setIsHistory(0);
|
|
|
|
// deliverPostLogDao.insertSelective(deliverPostLog);
|
|
|
|
// //添加交付物检查人表
|
|
|
|
// if (CollectionUtil.isNotEmpty(uploadDeliver.getCheckerIdList())) {
|
|
|
|
// ProTaskDeliverPostLogChecker postLogChecker;
|
|
|
|
// for (Long checkerId : uploadDeliver.getCheckerIdList()) {
|
|
|
|
// postLogChecker = new ProTaskDeliverPostLogChecker();
|
|
|
|
// postLogChecker.setId(snowflake.nextId());
|
|
|
|
// postLogChecker.setDeliverPostLogId(deliverPostLog.getId());
|
|
|
|
// postLogChecker.setCheckerId(checkerId);
|
|
|
|
// postLogCheckerDao.insertSelective(postLogChecker);
|
|
|
|
// }
|
|
|
|
// } else {
|
|
|
|
// throw new BaseException(CodeEnum.NOT_CHECKER);
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// //修改交付物状态
|
|
|
|
// ProTaskDeliver deliver = new ProTaskDeliver();
|
|
|
|
// deliver.setId(uploadDeliver.getDeliverId());
|
|
|
|
// deliver.setIsUpload(1);
|
|
|
|
// taskDeliverDao.updateByPrimaryKeySelective(deliver);
|
|
|
|
|
|
|
|
// //返回
|
|
|
|
// List<ProjectVo.DeliverInfo> deliverInfoList = taskDeliverDao.selectByDeliverId(uploadDeliver.getDeliverId());
|
|
|
|
// if (CollectionUtil.isNotEmpty(deliverInfoList)) {
|
|
|
|
// deliverInfo = deliverInfoList.get(0);
|
|
|
|
// deliverInfo.setUrl(WebConstant.TEST_URL_BASE + deliverInfo.getUrl());
|
|
|
|
// }
|
|
|
|
|
|
|
|
// //消息的内容
|
|
|
|
// if (CollectionUtil.isNotEmpty(uploadDeliver.getCheckerIdList())) {
|
|
|
|
// for (Long postLogCheckerId : uploadDeliver.getCheckerIdList()) {
|
|
|
|
// userIdList.addAll(userService.selectUserIdByRoleId(postLogCheckerId));
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//// Set<String> userIdSet = new HashSet<>();
|
|
|
|
// if (CollectionUtil.isNotEmpty(userIdList)) {
|
|
|
|
// HashSet<Long> h = new HashSet<>(userIdList);
|
|
|
|
// userIdList.clear();
|
|
|
|
// userIdList.addAll(h);
|
|
|
|
// for (Long userId : userIdList) {
|
|
|
|
//// userIdSet.add(userId.toString());
|
|
|
|
// messageUser = new BaseMessageDto.MessageUser();
|
|
|
|
// messageUser.setUserId(userId);
|
|
|
|
// messageUserList.add(messageUser);
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// DeliverMessageWithUploadDto uploadMessage = new DeliverMessageWithUploadDto();
|
|
|
|
// DeliverMessageWithUploadDto.Data uploadMessageData = new DeliverMessageWithUploadDto.Data();
|
|
|
|
// uploadMessageData.setProjectId(taskDetail.getProjectId());
|
|
|
|
// Long roleId;
|
|
|
|
// if (role.getName().equals(WebConstant.ROLE_NAME.AllMember.phase)) {
|
|
|
|
// List<ProRole> roleList = proMemberService.selectRolesByUserIdAndProjectId(currentUserId, taskDetail.getProjectId());
|
|
|
|
// roleId = roleList.get(0).getId();
|
|
|
|
// } else {
|
|
|
|
// roleId = taskDetail.getExecutorRole();
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// DeliverMessageWithUploadDto uploadMessage = new DeliverMessageWithUploadDto(taskDetail.getProjectId(),roleId,taskDetail.getId(),
|
|
|
|
// taskDeliver.getId(),taskDeliver.getName(),currentUserId,now,uploadDeliver.getFileInfo(),messageUserList);
|
|
|
|
|
|
|
|
|
|
|
|
// uploadMessageData.setTaskId(taskDetail.getId());
|
|
|
|
// uploadMessageData.setDeliverId(taskDeliver.getId());
|
|
|
|
// uploadMessageData.setDeliverName(taskDeliver.getName());
|
|
|
|
// uploadMessageData.setUploadTime(System.currentTimeMillis());
|
|
|
|
// uploadMessageData.setFile(uploadDeliver.getFileInfo());
|
|
|
|
// uploadMessage.setData(uploadMessageData);
|
|
|
|
// uploadMessage.setReceivers(messageUserList);
|
|
|
|
// log.info("检查交付物:{}",JacksonUtil.beanToJson(uploadMessage));
|
|
|
|
// rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME,
|
|
|
|
// JacksonUtil.beanToJson(uploadMessage));
|
|
|
|
//
|
|
|
|
// } else {
|
|
|
|
// throw new BaseException(CodeEnum.IS_NOT_EXECUTOR);
|
|
|
|
// }
|
|
|
|
//发送WS信息
|
|
|
|
//获取所有接收者的id
|
|
|
|
List<BaseMessageDto.MessageUser> messageUserList = new ArrayList<>(); |
|
|
@ -360,10 +246,13 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
userIdSet.addAll(userService.selectUserIdByRoleId(postLogCheckerId)); |
|
|
|
} |
|
|
|
} |
|
|
|
// ws 发送消息
|
|
|
|
Set<String> userIds = new HashSet<>(); |
|
|
|
for (Long userId : userIdSet) { |
|
|
|
messageUser = new BaseMessageDto.MessageUser(); |
|
|
|
messageUser.setUserId(userId); |
|
|
|
messageUserList.add(messageUser); |
|
|
|
userIds.add(userId.toString()); |
|
|
|
} |
|
|
|
Long roleId; |
|
|
|
if (role.getName().equals(WebConstant.ROLE_NAME.AllMember.phase)) { |
|
|
@ -375,8 +264,11 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
DeliverMessageWithUploadDto uploadMessage = new DeliverMessageWithUploadDto(taskDetail.getProjectId(),roleId,taskDetail.getId(), |
|
|
|
taskDeliver.getId(),taskDeliver.getName(),currentUserId,now,uploadDeliver.getFileInfo(),messageUserList); |
|
|
|
log.info("上传交付物:{}",JacksonUtil.beanToJson(uploadMessage)); |
|
|
|
InMessage inMessage = new InMessage(); |
|
|
|
inMessage.setTos(userIds); |
|
|
|
inMessage.setData(JacksonUtil.beanToJson(uploadMessage)); |
|
|
|
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, |
|
|
|
JacksonUtil.beanToJson(uploadMessage)); |
|
|
|
JacksonUtil.beanToJson(inMessage) ); |
|
|
|
//用智能助手发送消息
|
|
|
|
SysProject project = sysProjectDao.selectByPrimaryKey(taskDetail.getProjectId()); |
|
|
|
robotService.addDeliverRobotSend(currentUserId,taskDeliver.getName(),subTimeId, project); |
|
|
@ -694,8 +586,6 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
} |
|
|
|
checkerDto.setReceivers(messageUserList); |
|
|
|
log.info("检查交付物:{}",JacksonUtil.beanToJson(checkerDto)); |
|
|
|
// rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME,
|
|
|
|
// JacksonUtil.beanToJson(checkerDto));
|
|
|
|
MessageRule messageRule = MessageRule.defaultRule(MessageConstant.DomainType.User); |
|
|
|
String s = JacksonUtil.beanToJson(checkerDto); |
|
|
|
InMessage inMessage = InMessage.newToUserMessage(currentUserId.toString(),userIdSet,null,messageRule,s); |
|
|
@ -893,9 +783,11 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
deleteMessage.setData(deleteMessageData); |
|
|
|
deleteMessage.setReceivers(messageUserList); |
|
|
|
|
|
|
|
InMessage inMessage = new InMessage(); |
|
|
|
inMessage.setTos(userIdSet); |
|
|
|
inMessage.setData(JacksonUtil.beanToJson(deleteMessage)); |
|
|
|
rabbitTemplate.convertAndSend(RabbitMQConfig.MESSAGE_QUEUE_NAME, |
|
|
|
JacksonUtil.beanToJson(deleteMessage)); |
|
|
|
|
|
|
|
JacksonUtil.beanToJson(inMessage)); |
|
|
|
|
|
|
|
//用智能助手发送消息
|
|
|
|
robotService.deleteDeliverRobotSend(currentUserId,deliver.getName(),subTimeId); |
|
|
|