fix bug 41138 我的消息--会议文件上传后--收不到系统通知 、邮件

This commit is contained in:
lijiarao
2021-10-21 11:19:10 +08:00
parent 1dd84eddac
commit 0c5b93b1fb
8 changed files with 126 additions and 138 deletions
@@ -319,28 +319,7 @@ public class CommitteeMeetingController extends JeroController<PayMeeting, IPayM
@ApiOperation(value = "上传资料", notes = "上传资料")
@PostMapping(value = "/uploadFile")
public Result<?> uploadFile(@RequestBody UploadFileVO uploadFileVO) {
String fileIds = uploadFileVO.getFileIds();
String id = uploadFileVO.getId();
LambdaUpdateWrapper<PayMeeting> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PayMeeting::getId, id);
wrapper.set(PayMeeting::getMeetingData, fileIds);
payMeetingService.update(wrapper);
PayMeeting payMeeting = payMeetingService.getById(id);
if (payMeeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
List<String> idList = Arrays.asList(fileIds.split(","));
List<OSSFile> ossFiles = iossFileService.listByIds(idList);
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
String[] fileUrl = url.split("/");
int length = fileUrl.length;
ossFile.setFileName(fileUrl[length - 1]);
}
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/addStandardsFile", null, ossFiles);
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setId(id);
stableCrossTraining.setMeetingFiles(fileIds);
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/updateStandardsFile", null, stableCrossTraining);
}
payMeetingService.uploadFileSendMsg(uploadFileVO,MeetingCommon.COMMITTEE_MEETING_INT);
return Result.OK("上传资料成功!");
}
@@ -319,28 +319,8 @@ public class InternalMeetingController extends JeroController<PayMeeting, IPayMe
@ApiOperation(value = "上传资料", notes = "上传资料")
@PostMapping(value = "/uploadFile")
public Result<?> uploadFile(@RequestBody UploadFileVO uploadFileVO) {
String fileIds = uploadFileVO.getFileIds();
String id = uploadFileVO.getId();
LambdaUpdateWrapper<PayMeeting> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PayMeeting::getId, id);
wrapper.set(PayMeeting::getMeetingData, fileIds);
payMeetingService.update(wrapper);
PayMeeting payMeeting = payMeetingService.getById(id);
if (payMeeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
List<String> idList = Arrays.asList(fileIds.split(","));
List<OSSFile> ossFiles = iossFileService.listByIds(idList);
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
String[] fileUrl = url.split("/");
int length = fileUrl.length;
ossFile.setFileName(fileUrl[length - 1]);
}
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/addStandardsFile", null, ossFiles);
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setId(id);
stableCrossTraining.setMeetingFiles(fileIds);
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/updateStandardsFile", null, stableCrossTraining);
}
payMeetingService.uploadFileSendMsg(uploadFileVO,MeetingCommon.INTERNATIONAL_MEETING_INT);
return Result.OK("上传资料成功!");
}
@@ -319,28 +319,7 @@ public class OtherMeetingController extends JeroController<PayMeeting, IPayMeeti
@ApiOperation(value = "上传资料", notes = "上传资料")
@PostMapping(value = "/uploadFile")
public Result<?> uploadFile(@RequestBody UploadFileVO uploadFileVO) {
String fileIds = uploadFileVO.getFileIds();
String id = uploadFileVO.getId();
LambdaUpdateWrapper<PayMeeting> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PayMeeting::getId, id);
wrapper.set(PayMeeting::getMeetingData, fileIds);
payMeetingService.update(wrapper);
PayMeeting payMeeting = payMeetingService.getById(id);
if (payMeeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
List<String> idList = Arrays.asList(fileIds.split(","));
List<OSSFile> ossFiles = iossFileService.listByIds(idList);
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
String[] fileUrl = url.split("/");
int length = fileUrl.length;
ossFile.setFileName(fileUrl[length - 1]);
}
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/addStandardsFile", null, ossFiles);
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setId(id);
stableCrossTraining.setMeetingFiles(fileIds);
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/updateStandardsFile", null, stableCrossTraining);
}
payMeetingService.uploadFileSendMsg(uploadFileVO,MeetingCommon.OTHER_MEETING_INT);
return Result.OK("上传资料成功!");
}
@@ -1,5 +1,6 @@
package com.jero.meeting.controller;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
import javax.annotation.Resource;
@@ -8,10 +9,14 @@ import javax.servlet.http.HttpServletRequest;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.dto.SendMessageDTO;
import com.jero.common.enums.CompanyMessageEnums;
import com.jero.common.exception.JeroBootException;
import com.jero.common.service.SendMessageService;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
@@ -24,6 +29,7 @@ import com.jero.company.service.IPayContactsManagementService;
import com.jero.data.entity.PayCaseCommittee;
import com.jero.data.service.IPayCaseCommitteeService;
import com.jero.meeting.common.MeetingCommon;
import com.jero.meeting.common.MeetingSubitemCommon;
import com.jero.meeting.entity.PayMeeting;
import com.jero.meeting.entity.PayMeetingHotelContacts;
import com.jero.meeting.entity.PayMeetingSituation;
@@ -40,6 +46,7 @@ import com.jero.meeting.vo.excel.*;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.system.volid.group.UpdateGroup;
import com.jero.project.common.PayProjectCommon;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
@@ -51,6 +58,8 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.core.env.Environment;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
@@ -87,6 +96,10 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
private IPayContactsManagementService payContactsManagementService;
@Resource
private IPayMeetingSituationService payMeetingSituationService;
@Resource
private Environment env;
@Resource
private SendMessageService sendMessageService;
/**
* 分页列表查询
@@ -401,35 +414,15 @@ public class PayMeetingController extends JeroController<PayMeeting, IPayMeeting
}
/**
* 上传资料
* 上传资料文件
*/
@AutoLog(value = "上传资料")
@RequiresPermissions("meeting:upload")
@ApiOperation(value = "上传资料", notes = "上传资料")
@PostMapping(value = "/uploadFile")
@Transactional
public Result<?> uploadFile(@RequestBody UploadFileVO uploadFileVO) {
String fileIds = uploadFileVO.getFileIds();
String id = uploadFileVO.getId();
LambdaUpdateWrapper<PayMeeting> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PayMeeting::getId, id);
wrapper.set(PayMeeting::getMeetingData, fileIds);
payMeetingService.update(wrapper);
PayMeeting payMeeting = payMeetingService.getById(id);
if (payMeeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
List<String> idList = Arrays.asList(fileIds.split(","));
List<OSSFile> ossFiles = iossFileService.listByIds(idList);
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
String[] fileUrl = url.split("/");
int length = fileUrl.length;
ossFile.setFileName(fileUrl[length - 1]);
}
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/addStandardsFile", null, ossFiles);
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setId(id);
stableCrossTraining.setMeetingFiles(fileIds);
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/updateStandardsFile", null, stableCrossTraining);
}
payMeetingService.uploadFileSendMsg(uploadFileVO,MeetingCommon.INTERNATIONAL_MEETING_INT);
return Result.OK("上传资料成功!");
}
@@ -319,28 +319,7 @@ public class StandardsMeetingController extends JeroController<PayMeeting, IPayM
@ApiOperation(value = "上传资料", notes = "上传资料")
@PostMapping(value = "/uploadFile")
public Result<?> uploadFile(@RequestBody UploadFileVO uploadFileVO) {
String fileIds = uploadFileVO.getFileIds();
String id = uploadFileVO.getId();
LambdaUpdateWrapper<PayMeeting> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PayMeeting::getId, id);
wrapper.set(PayMeeting::getMeetingData, fileIds);
payMeetingService.update(wrapper);
PayMeeting payMeeting = payMeetingService.getById(id);
if (payMeeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
List<String> idList = Arrays.asList(fileIds.split(","));
List<OSSFile> ossFiles = iossFileService.listByIds(idList);
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
String[] fileUrl = url.split("/");
int length = fileUrl.length;
ossFile.setFileName(fileUrl[length - 1]);
}
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/addStandardsFile", null, ossFiles);
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setId(id);
stableCrossTraining.setMeetingFiles(fileIds);
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/updateStandardsFile", null, stableCrossTraining);
}
payMeetingService.uploadFileSendMsg(uploadFileVO,MeetingCommon.STANDARD_MEETING_INT);
return Result.OK("上传资料成功!");
}
@@ -320,28 +320,7 @@ public class WorkGroupMeetingController extends JeroController<PayMeeting, IPayM
@ApiOperation(value = "上传资料", notes = "上传资料")
@PostMapping(value = "/uploadFile")
public Result<?> uploadFile(@RequestBody UploadFileVO uploadFileVO) {
String fileIds = uploadFileVO.getFileIds();
String id = uploadFileVO.getId();
LambdaUpdateWrapper<PayMeeting> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PayMeeting::getId, id);
wrapper.set(PayMeeting::getMeetingData, fileIds);
payMeetingService.update(wrapper);
PayMeeting payMeeting = payMeetingService.getById(id);
if (payMeeting.getMeetingType().equals(Integer.parseInt(MeetingCommon.STANDARD_MEETING))) {
List<String> idList = Arrays.asList(fileIds.split(","));
List<OSSFile> ossFiles = iossFileService.listByIds(idList);
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
String[] fileUrl = url.split("/");
int length = fileUrl.length;
ossFile.setFileName(fileUrl[length - 1]);
}
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/addStandardsFile", null, ossFiles);
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setId(id);
stableCrossTraining.setMeetingFiles(fileIds);
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/updateStandardsFile", null, stableCrossTraining);
}
payMeetingService.uploadFileSendMsg(uploadFileVO,MeetingCommon.WORKING_GROUP_MEETING_INT);
return Result.OK("上传资料成功!");
}
@@ -7,6 +7,7 @@ import com.jero.meeting.entity.PayMeeting;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.meeting.vo.PayMeetingVO;
import com.jero.meeting.vo.PublishReminderVO;
import com.jero.meeting.vo.UploadFileVO;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
@@ -68,4 +69,6 @@ public interface IPayMeetingService extends IService<PayMeeting> {
IPage<PayMeeting> pageListContract(Page<PayMeeting> page, QueryWrapper<PayMeeting> queryWrapper, String now);
IPage<PayMeeting> queryPageList(PayMeeting payMeeting, Integer pageNo, Integer pageSize, HttpServletRequest req);
void uploadFileSendMsg(UploadFileVO uploadFileVO, Integer meetingCommon);
}
@@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.common.RoleCommon;
@@ -15,6 +16,7 @@ import com.jero.common.service.SendMessageService;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
import com.jero.common.util.AuthenticationUtils;
import com.jero.common.util.PasswordUtil;
import com.jero.common.util.ValidUtil;
import com.jero.company.entity.PayContactsManagement;
@@ -25,9 +27,11 @@ import com.jero.data.entity.PayCaseCommitteeSubitem;
import com.jero.data.service.IPayCaseCommitteeService;
import com.jero.data.service.IPayCaseCommitteeSubitemService;
import com.jero.meeting.common.MeetingCommon;
import com.jero.meeting.common.MeetingSubitemCommon;
import com.jero.meeting.entity.PayMeeting;
import com.jero.meeting.entity.PayMeetingHotelContacts;
import com.jero.meeting.entity.PayMeetingRemindRecord;
import com.jero.meeting.entity.PayMeetingSituation;
import com.jero.meeting.mapper.PayMeetingMapper;
import com.jero.meeting.service.IPayMeetingHotelContactsService;
import com.jero.meeting.service.IPayMeetingRemindRecordService;
@@ -39,23 +43,27 @@ import com.jero.meeting.valid.group.StandardMeeting;
import com.jero.meeting.valid.group.WorkingGroupMeeting;
import com.jero.meeting.vo.PayMeetingVO;
import com.jero.meeting.vo.PublishReminderVO;
import com.jero.meeting.vo.UploadFileVO;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.project.entity.PayWorkingGroup;
import com.jero.project.entity.PayWorkingGroupSubItem;
import com.jero.project.service.IPayWorkingGroupService;
import com.jero.project.service.IPayWorkingGroupSubItemService;
import com.jero.standards.xuanguan.stablecrosstraining.entity.StableCrossTraining;
import com.jero.standards.xuanguan.stablecrosstraining.service.IStableCrossTrainingService;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.util.CollectionUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Service;
import java.io.File;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -97,7 +105,10 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
private IPayMeetingRemindRecordService payMeetingRemindRecordService;
@Resource
private SendMessageService sendMessageService;
@Resource
private IOSSFileService iossFileService;
@Resource
private Environment env;
/**
* 新增会议
*/
@@ -534,4 +545,89 @@ public class PayMeetingServiceImpl extends ServiceImpl<PayMeetingMapper, PayMeet
}
return pageList;
}
@Override
@Transactional
public void uploadFileSendMsg(UploadFileVO uploadFileVO, Integer meetingCommon) {
String id = uploadFileVO.getId();
PayMeeting payMeeting = getOne(
new LambdaQueryWrapper<PayMeeting>()
.eq(PayMeeting::getId,id)
.eq(PayMeeting::getMeetingType,meetingCommon)
);
if (Objects.isNull(payMeeting)){
throw new JeroBootException("会议不存在");
}
String fileIds = uploadFileVO.getFileIds();
LambdaUpdateWrapper<PayMeeting> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(PayMeeting::getId, id);
wrapper.set(PayMeeting::getMeetingData, fileIds);
update(wrapper);
List<String> meetingFileIdList = Arrays.asList(fileIds.split(","));
//如果过滤后为空则不发邮件
if (meetingFileIdList.isEmpty()) {
return;
}
//如果是标协会议就同步文件
if (meetingCommon.equals(MeetingCommon.STANDARD_MEETING_INT)) {
List<OSSFile> ossFiles = iossFileService.listByIds(meetingFileIdList);
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
String[] fileUrl = url.split("/");
int length = fileUrl.length;
ossFile.setFileName(fileUrl[length - 1]);
}
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/addStandardsFile", null, ossFiles);
StableCrossTraining stableCrossTraining = new StableCrossTraining();
stableCrossTraining.setId(id);
stableCrossTraining.setMeetingFiles(fileIds);
AuthenticationUtils.post("/stablecrosstraining/stableCrossTraining/updateStandardsFile", null, stableCrossTraining);
}
//发送邮件
List<OSSFile> ossFiles = iossFileService.listByIds(meetingFileIdList);
String path = env.getProperty("jero.path.upload") + File.separator;
//获取文件路径
List<String> listFile = new ArrayList<>();
for (OSSFile ossFile : ossFiles) {
String url = ossFile.getUrl();
listFile.add(path + url);
}
//获得审核通过的参会人
List<PayMeetingSituation> payMeetingSituations = payMeetingSituationService.list(
new LambdaQueryWrapper<PayMeetingSituation>()
.select(PayMeetingSituation::getCompanyContactId)
.eq(PayMeetingSituation::getMeetingId, id)
.eq(PayMeetingSituation::getCheckResult, MeetingSubitemCommon.SIGNUP_STATUS_1)
);
if (payMeetingSituations.isEmpty()) {
return;
}
//当前登录人
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//获得参会人
List<String> companyContactIdList = payMeetingSituations.stream().map(PayMeetingSituation::getCompanyContactId).collect(Collectors.toList());
for (String contactId : companyContactIdList) {
PayContactsManagement payContactsManagement = payContactsManagementService.getById(contactId);
// 发送消息
SendMessageDTO sendMessageDTO = new SendMessageDTO();
if(!StringUtils.isBlank(payContactsManagement.getEmail())){
sendMessageDTO.setEmail(PasswordUtil.decrypt(payContactsManagement.getEmail()));
}
if(!StringUtils.isEmpty(payContactsManagement.getPhone())){
sendMessageDTO.setToUser(PasswordUtil.decrypt(payContactsManagement.getPhone()));
sendMessageDTO.setPhone(PasswordUtil.decrypt(payContactsManagement.getPhone()));
}
HashMap<String,String> map = new HashMap<>();
map.put("meetingName", payMeeting.getMeetingName());
sendMessageDTO.setFromUser(loginUser.getUsername());
sendMessageDTO.setTemplateCode(CompanyMessageEnums.MSG7.getCode());
sendMessageDTO.setTemplateParam(map);
sendMessageDTO.setListFile(listFile);
sendMessageDTO.setBusType("C_OPEN_TYPE7");
JSONObject json = new JSONObject();
json.put("id",payMeeting.getId());
sendMessageDTO.setBusId(json.toJSONString());
sendMessageService.SendMessageService(sendMessageDTO);
}
}
}