工作组变更
This commit is contained in:
+8
-1
@@ -280,7 +280,6 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* @param content
|
||||
*/
|
||||
void sendEmailMsg(String email,String title,String content);
|
||||
|
||||
/**
|
||||
* 41根据部门id查询部门所有的父级(不包含自己)
|
||||
* @author 马志朝
|
||||
@@ -303,5 +302,13 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
* 根据文件id获取文件名称
|
||||
*/
|
||||
String findFileNameByFileId(String fileId);
|
||||
/**
|
||||
* 43发送邮件 + 附件消息
|
||||
* @param email 接收人
|
||||
* @param title 标题
|
||||
* @param content 内容
|
||||
* @param list 文件集合(路径+文件)
|
||||
*/
|
||||
void sendEmailMsgAndFile(String email, String title, String content,List<String> list);
|
||||
|
||||
}
|
||||
|
||||
+20
-39
@@ -1,15 +1,15 @@
|
||||
package com.jero.project.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import com.jero.common.util.PasswordUtil;
|
||||
import com.jero.company.entity.PayContactsManagement;
|
||||
import com.jero.company.service.IPayContactsManagementService;
|
||||
import com.jero.data.entity.PayCaseCommittee;
|
||||
import com.jero.data.service.IPayCaseCommitteeService;
|
||||
import com.jero.modules.message.handle.ISendMsgHandle;
|
||||
import com.jero.modules.message.handle.impl.EmailSendMsgHandle;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
@@ -26,9 +26,11 @@ import com.jero.temporary.service.IPayContactsManagementTemporaryService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -54,9 +56,12 @@ public class PayWorkingGroupDistributionRecordServiceImpl extends ServiceImpl<Pa
|
||||
private IPayWorkingGroupService payWorkingGroupService;
|
||||
@Autowired
|
||||
private IPayCaseCommitteeService payCaseCommitteeService;
|
||||
|
||||
@Autowired
|
||||
private Environment env;
|
||||
@Resource
|
||||
private IOSSFileService iossFileService;
|
||||
@Autowired
|
||||
private ISysBaseAPI sysBaseAPI;
|
||||
|
||||
@Override
|
||||
public void add(PayWorkingGroupDistributionRecord payWorkingGroupDistributionRecord) {
|
||||
@@ -79,8 +84,9 @@ public class PayWorkingGroupDistributionRecordServiceImpl extends ServiceImpl<Pa
|
||||
OSSFile byId = iossFileService.getById(payWorkingGroupDataFile.getFileId());
|
||||
// 文件名称
|
||||
String fileName = byId.getFileName();
|
||||
String path = env.getProperty("jero.path.upload") + File.separator;
|
||||
List<String> listFile = new ArrayList<>();
|
||||
listFile.add(fileName);
|
||||
listFile.add(path + fileName);
|
||||
List<String> list = new ArrayList<>();
|
||||
String msg = "";
|
||||
if(payWorkingGroupDistributionRecord.getProjectType() == PayProjectCommon.PROJECT_TYPE_FILE1){
|
||||
@@ -113,23 +119,13 @@ public class PayWorkingGroupDistributionRecordServiceImpl extends ServiceImpl<Pa
|
||||
if(CollectionUtils.isEmpty(list) || CollectionUtils.isEmpty(listFile)){
|
||||
throw new JeroBootException("分发失败!");
|
||||
}
|
||||
StringBuilder str = new StringBuilder();
|
||||
List<String> finalList = list;
|
||||
String content = msg + "文件已发送到您的账号和邮箱,可通过手机号登录系统XXX(点击链接可进入系统)或微信小程序搜素XXX进入查看";
|
||||
list.forEach(p->{
|
||||
if(StringUtils.isBlank(p)){
|
||||
return;
|
||||
}
|
||||
str.append(PasswordUtil.decrypt(p));
|
||||
if(finalList.indexOf(p) < finalList.size() - 1){
|
||||
str.append(",");
|
||||
}
|
||||
sysBaseAPI.sendEmailMsgAndFile(PasswordUtil.decrypt(p), "", content, listFile);
|
||||
});
|
||||
if(StringUtils.isBlank(str)){
|
||||
throw new JeroBootException("分发失败!");
|
||||
}
|
||||
String content = msg + "文件已发送到您的账号和邮箱,可通过手机号登录系统XXX(点击链接可进入系统)或微信小程序搜素XXX进入查看";
|
||||
EmailSendMsgHandle emailHandle = new EmailSendMsgHandle();
|
||||
emailHandle.SendMsgAndFile(str.toString(), "", content, listFile);
|
||||
// todo 缺少发送消息
|
||||
}
|
||||
|
||||
@@ -158,12 +154,13 @@ public class PayWorkingGroupDistributionRecordServiceImpl extends ServiceImpl<Pa
|
||||
if(CollectionUtils.isEmpty(listPayWorkingGroupDataFile)){
|
||||
throw new JeroBootException("没有找到文件!");
|
||||
}
|
||||
String path = env.getProperty("jero.path.upload") + File.separator;
|
||||
List<String> listFile = new ArrayList<>();
|
||||
listPayWorkingGroupDataFile.forEach(p->{
|
||||
OSSFile byId = iossFileService.getById(p.getFileId());
|
||||
// 文件名称
|
||||
String fileName = byId.getFileName();
|
||||
listFile.add(fileName);
|
||||
listFile.add(path + fileName);
|
||||
});
|
||||
String msg = "";
|
||||
List<String> list = new ArrayList<>();
|
||||
@@ -197,29 +194,13 @@ public class PayWorkingGroupDistributionRecordServiceImpl extends ServiceImpl<Pa
|
||||
if(CollectionUtils.isEmpty(list) || CollectionUtils.isEmpty(listFile)){
|
||||
throw new JeroBootException("分发失败!");
|
||||
}
|
||||
list.forEach(p->{
|
||||
if(StringUtils.isBlank(p)){
|
||||
return;
|
||||
}
|
||||
p = PasswordUtil.decrypt(p);
|
||||
});
|
||||
StringBuilder str = new StringBuilder();
|
||||
List<String> finalList = list;
|
||||
list.forEach(p->{
|
||||
if(StringUtils.isBlank(p)){
|
||||
return;
|
||||
}
|
||||
str.append(PasswordUtil.decrypt(p));
|
||||
if(finalList.indexOf(p) < finalList.size() - 1){
|
||||
str.append(",");
|
||||
}
|
||||
});
|
||||
if(StringUtils.isBlank(str)){
|
||||
throw new JeroBootException("分发失败!");
|
||||
}
|
||||
String content = msg + "文件已发送到您的账号和邮箱,可通过手机号登录系统XXX(点击链接可进入系统)或微信小程序搜素XXX进入查看";
|
||||
EmailSendMsgHandle emailHandle = new EmailSendMsgHandle();
|
||||
emailHandle.SendMsgAndFile(str.toString(), "", content, listFile);
|
||||
list.forEach(p->{
|
||||
if(StringUtils.isBlank(p)){
|
||||
return;
|
||||
}
|
||||
sysBaseAPI.sendEmailMsgAndFile(PasswordUtil.decrypt(p), "", content, listFile);
|
||||
});
|
||||
// todo 缺少发送消息
|
||||
}
|
||||
}
|
||||
|
||||
+35
-7
@@ -1,16 +1,22 @@
|
||||
package com.jero.modules.message.handle.impl;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.SpringContextUtils;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import com.jero.config.StaticConfig;
|
||||
import com.jero.modules.message.handle.ISendMsgHandle;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.core.io.FileSystemResource;
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -18,6 +24,9 @@ import java.util.List;
|
||||
public class EmailSendMsgHandle implements ISendMsgHandle {
|
||||
static String emailFrom;
|
||||
|
||||
@Autowired
|
||||
private Environment env;
|
||||
|
||||
public static void setEmailFrom(String emailFrom) {
|
||||
EmailSendMsgHandle.emailFrom = emailFrom;
|
||||
}
|
||||
@@ -47,10 +56,17 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
||||
|
||||
}
|
||||
|
||||
|
||||
//带附件发送邮件,多人多邮件;
|
||||
|
||||
public void SendMsgAndFile(String es_receiver, String es_title, String es_content, List<String> fileList ) {
|
||||
/**
|
||||
* @Description 带附件发送邮件,多人多邮件
|
||||
* @Param es_receiver 接收人邮箱
|
||||
* @Param es_title 标题
|
||||
* @Param es_content 内容
|
||||
* @Param fileList 文件集合
|
||||
* @Param path 文件路径
|
||||
* @Return
|
||||
* @Exception
|
||||
*/
|
||||
public void SendMsgAndFile(String es_receiver, String es_title, String es_content, List<String> fileList) {
|
||||
JavaMailSender mailSender = (JavaMailSender) SpringContextUtils.getBean("mailSender");
|
||||
MimeMessage message = mailSender.createMimeMessage();
|
||||
MimeMessageHelper helper = null;
|
||||
@@ -59,6 +75,19 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
||||
StaticConfig staticConfig = SpringContextUtils.getBean(StaticConfig.class);
|
||||
setEmailFrom(staticConfig.getEmailFrom());
|
||||
}
|
||||
if(CollectionUtils.isEmpty(fileList)){
|
||||
throw new JeroBootException("附件不能为空!");
|
||||
}
|
||||
// 验证文件是否存在
|
||||
fileList.forEach(p->{
|
||||
if(StringUtils.isBlank(p)){
|
||||
return;
|
||||
}
|
||||
File file = new File(p);
|
||||
if(!file.exists()){
|
||||
throw new JeroBootException("附件不存在!");
|
||||
}
|
||||
});
|
||||
//update-end-author:taoyan date:20200811 for:配置类数据获取
|
||||
try {
|
||||
ArrayList<String> mailList = new ArrayList<>(Arrays.asList(es_receiver.split(",")));
|
||||
@@ -72,16 +101,15 @@ public class EmailSendMsgHandle implements ISendMsgHandle {
|
||||
helper.setText(es_content, true);
|
||||
for(String file :fileList) {
|
||||
if(!StringUtils.isBlank(file)) {
|
||||
FileSystemResource filePath = new FileSystemResource(new File("D:\\opt\\upFiles" + "\\" + file));
|
||||
FileSystemResource filePath = new FileSystemResource(new File(file));
|
||||
helper.addAttachment(file, filePath);
|
||||
}
|
||||
}
|
||||
mailSender.send(message);
|
||||
}
|
||||
}
|
||||
} catch (MessagingException e) {
|
||||
}catch (MessagingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+14
-2
@@ -999,8 +999,20 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
*/
|
||||
@Override
|
||||
public void sendEmailMsg(String email, String title, String content) {
|
||||
EmailSendMsgHandle emailHandle=new EmailSendMsgHandle();
|
||||
emailHandle.SendMsg(email, title, content);
|
||||
EmailSendMsgHandle emailHandle=new EmailSendMsgHandle();
|
||||
emailHandle.SendMsg(email, title, content);
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送邮件+ 附件消息
|
||||
* @param email
|
||||
* @param title
|
||||
* @param content
|
||||
*/
|
||||
@Override
|
||||
public void sendEmailMsgAndFile(String email, String title, String content,List<String> list) {
|
||||
EmailSendMsgHandle emailHandle=new EmailSendMsgHandle();
|
||||
emailHandle.SendMsgAndFile(email, title, content,list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user