zelong.shao

task|附件调整

......@@ -40,8 +40,7 @@ public class SendFailedEmailTemplate implements EmailTemplate {
" <p>2.【推送预清关文件】任务,系统启动后每{1}分钟轮巡一次。</p>\n" +
" <p>3.【提醒发件人】任务,系统启动后每{2}分钟轮巡一次。</p>\n" +
" <p>备注:邮件发送机制:</p>\n" +
" <p>该预警邮件任务,系统启动后每30分钟执行一次,当日上述3个定时任务,有任何一个任务的最终判定为失败的记录数量大于5,则自动发送邮件通知FedEX IT,每个接口显示最新10条失败运单号、当日调用总次数、当日调用失败总次数。</p>\n" +
" <p style=\"font-size:10px;\">(注:所有任务相关的数字均可以在系统配置界面调整)</p>";
" <p>该预警邮件任务,系统启动后每30分钟执行一次,当日上述3个定时任务,有任何一个任务的最终判定为失败的记录数量大于5,则自动发送邮件通知FedEX IT,每个接口显示最新10条失败运单号、当日调用总次数、当日调用失败总次数。</p>\n" ;
String TABLE = "<table style=\"width: 100%;table-layout: fixed;padding: 20px;width: 100%;border-collapse: collapse;\">\n" +
"<tr>\n" +
......
......@@ -11,4 +11,5 @@ public class PortFileDto {
private String shipperPhone;
private String shipperAccount;
private String originCountry;
private String fileName;
}
......
package com.fedex.connect.task.data.dto;
import com.fedex.connect.common.annotation.SensitiveEntity;
import com.fedex.connect.common.annotation.SensitiveField;
import lombok.Data;
@Data
@SensitiveEntity
public class PushZipEmailDto {
private String destIataCode;
private String filePath;
@SensitiveField
private String shipperContactName;
private String shipperEmail;
private String shipperPhone;
......
......@@ -67,7 +67,7 @@ public class PushConsignmentFileServiceImpl extends BaseService implements IPush
//获取待发送的文件并打zip包
PortFileDto portFileDto = new PortFileDto();
List<PushZipEmailDto> attachmentDetailsByBizId = attachmentExtRepository.findAttachmentDetailsByBizId(conPushEmail.getBizId());
portFileDto = conFileEmailUtil.getPortZipMap(portFileDto, attachmentDetailsByBizId, tempPath, finalPath, zipUtils);
portFileDto = conFileEmailUtil.getPortZipMap(portFileDto, attachmentDetailsByBizId, tempPath, finalPath, zipUtils,conPushEmail.getBizCode());
//发送邮件
result = conFileEmailUtil.sendEmail(portFileDto, emailUtil,mailMessageReqDto,conPushEmail);
//根据是否成功发送邮件对文件进行备份
......
......@@ -73,7 +73,7 @@ public class ConFileEmailUtil {
* @param zipUtils
* @return void
*/
public PortFileDto getPortZipMap(PortFileDto portFileDto, List<PushZipEmailDto> attachmentDetailsByBizId, String tempPath, String finalPath, ZipUtils zipUtils) throws Exception{
public PortFileDto getPortZipMap(PortFileDto portFileDto, List<PushZipEmailDto> attachmentDetailsByBizId, String tempPath, String finalPath, ZipUtils zipUtils,String consignmentCode) throws Exception{
List<File> filesList = new ArrayList<>();
String portCode = null;
for (PushZipEmailDto pushZipEmailDto : attachmentDetailsByBizId) {
......@@ -92,8 +92,8 @@ public class ConFileEmailUtil {
portFileDto.setOriginCountry(pushZipEmailDto.getOriginCountry());
}
String date = DateUtil.yyyyMMddHHmmss(new Date());
String fileName = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + portCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP;
String fileNameTemp = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + portCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP + BaseConstants.FILE_SUFFIX_KEYS.TEMP;
String fileName = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + consignmentCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP;
String fileNameTemp = date + BaseSeparatorConstants.SEPARATOR_UNDERLINE + consignmentCode + BaseConstants.FILE_SUFFIX_KEYS.ZIP + BaseConstants.FILE_SUFFIX_KEYS.TEMP;
FileOutputStream fos = null;
if (CollectionUtils.isEmpty(filesList)){
return portFileDto;
......@@ -112,6 +112,7 @@ public class ConFileEmailUtil {
portFileDto.setDestIataCode(portCode);
portFileDto.setZipPath(finalPath + fileName);
portFileDto.setFileName(fileName);
} catch (Exception e) {
log.error("生成压缩包错误:{}", e.getMessage(), e);
......@@ -182,7 +183,7 @@ public class ConFileEmailUtil {
if (!StringUtils.isEmpty(portFileDto.getZipPath())){
List<MailAttachmentBo> srcFiles = new ArrayList<>();
File file = new File(portFileDto.getZipPath());
srcFiles.add(new MailAttachmentBo(file, ""));
srcFiles.add(new MailAttachmentBo(file, portFileDto.getFileName()));
mailConfigDto.setFileList(srcFiles);
}
......