|
|
@ -235,124 +235,14 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
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<>(); |
|
|
|
BaseMessageDto.MessageUser messageUser; |
|
|
|
HashSet<Long> userIdSet = new HashSet<>(); |
|
|
|
HashSet<String> userIdStr = new HashSet<>(); |
|
|
|
if (CollectionUtil.isNotEmpty(uploadDeliver.getCheckerIdList())) { |
|
|
|
for (Long postLogCheckerId : uploadDeliver.getCheckerIdList()) { |
|
|
|
userIdSet.addAll(userService.selectUserIdByRoleId(postLogCheckerId)); |
|
|
@ -362,6 +252,7 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
messageUser = new BaseMessageDto.MessageUser(); |
|
|
|
messageUser.setUserId(userId); |
|
|
|
messageUserList.add(messageUser); |
|
|
|
userIdStr.add(userId.toString()); |
|
|
|
} |
|
|
|
Long roleId; |
|
|
|
if (role.getName().equals(WebConstant.ROLE_NAME.AllMember.phase)) { |
|
|
@ -375,9 +266,20 @@ public class TaskDeliverService implements ITaskDeliverService { |
|
|
|
log.info("上传交付物:{}",JacksonUtil.beanToJson(uploadMessage)); |
|
|
|
rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME, |
|
|
|
JacksonUtil.beanToJson(uploadMessage)); |
|
|
|
//用智能助手发送消息
|
|
|
|
SysProject project = sysProjectDao.selectByPrimaryKey(taskDetail.getProjectId()); |
|
|
|
robotService.addDeliverRobotSend(currentUserId,taskDeliver.getName(),subTimeId, project); |
|
|
|
// DeliverMessageWithUploadDto.Data data = new DeliverMessageWithUploadDto.Data();
|
|
|
|
// data.setProjectId(taskDetail.getProjectId());
|
|
|
|
// log.info("上传交付物Data消息:{}",JacksonUtil.beanToJson(uploadMessage.getData()));
|
|
|
|
// InMessage inMessage = new InMessage();
|
|
|
|
// inMessage.setData(JacksonUtil.beanToJson(data));
|
|
|
|
// inMessage.setToDomain(MessageConstant.DomainType.User);
|
|
|
|
// inMessage.setTos(userIdStr);
|
|
|
|
// log.info("上传交付物发送消息:{}",JacksonUtil.beanToJson(inMessage));
|
|
|
|
// rabbitTemplate.convertAndSend(RabbitMQConfig.RabbitMQ_QUEUE_NAME,
|
|
|
|
// JacksonUtil.beanToJson(inMessage));
|
|
|
|
//-----------------------------------------------------------------
|
|
|
|
// //用智能助手发送消息
|
|
|
|
// SysProject project = sysProjectDao.selectByPrimaryKey(taskDetail.getProjectId());
|
|
|
|
// robotService.addDeliverRobotSend(currentUserId,taskDeliver.getName(),subTimeId, project);
|
|
|
|
//返回
|
|
|
|
List<ProjectVo.DeliverInfo> deliverInfoList = taskDeliverDao.selectByDeliverId(uploadDeliver.getDeliverId()); |
|
|
|
if (CollectionUtil.isNotEmpty(deliverInfoList)) { |
|
|
|