添加发送日志

master
bynt 1 year ago
parent cf02373de9
commit 8001cbb26b

@ -1,7 +1,8 @@
package com.baiye.constant;
/**
*
* @author Yqy
* @date 2023-5-23
*/
public class LogType {

@ -74,7 +74,6 @@ public class DownRecordServiceImpl implements DownRecordService {
downRecord.setCompanyName(componentName);
downRecord.setId(IdUtil.getSnowflake().nextId());
downRecord.setStatus(DefaultNumberConstants.ZERO_NUMBER);
return downRecordRepository.save(downRecord).getId();
}
@ -123,8 +122,8 @@ public class DownRecordServiceImpl implements DownRecordService {
String uuid = IdUtil.fastSimpleUUID();
String file = deliveryProperties.getFileUrl().concat(StrPool.SLASH).concat(uuid);
String filePath = deliveryProperties.getDmpDownPath().concat(uuid).concat(FileConstant.ZIP_FILE_SUB_NAME);
// 只保存文件地址
String zipPath = FileAndMailUtil.zipFileAndSendDMPMail(dtoArrayList, file, null, deliveryProperties, DefaultNumberConstants.THREE_NUMBER);
// 只保存文件地址不发送邮件
String zipPath = FileAndMailUtil.zipFile(dtoArrayList, file, deliveryProperties);
Long downId = this.createRecord(dtoArrayList.size(), "超级管理员", taskName, zipPath, filePath, DefaultNumberConstants.TWO_NUMBER);
for (List<ImeiDTO> list : partition) {
String taskImeiName = redisUtils.acquisitionBatch(MailRequestEnum.MM.getCacheName());

@ -7,6 +7,7 @@ import cn.hutool.core.text.CharSequenceUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baiye.common.CommonLog;
import com.baiye.config.properties.DeliveryProperties;
import com.baiye.constant.DefaultNumberConstants;
import com.baiye.constant.FileConstant;
@ -186,6 +187,7 @@ public class DeliveryBalanceTask {
return;
}
String file = fileUrl.concat(StrPool.SLASH).concat(taskImeiName);
CommonLog.info("发送邮件,当前tag值为".concat(toList.get(DefaultNumberConstants.ZERO_NUMBER).getTag()));
String zipPath = FileAndMailUtil.zipFileAndSendDMPMail(toList, file, taskImeiName, deliveryProperties, DefaultNumberConstants.ONE_NUMBER);
// 保存发送记录
deliveryRecordService.saveDeliveryRecord(zipPath, taskImeiName,

@ -46,4 +46,15 @@ public class FileAndMailUtil {
return zipPath;
}
public static String zipFile(List<ImeiDTO> list, String file, DeliveryProperties deliveryProperties) {
String csvPath = file.concat(StrPool.DOT).concat(FileConstant.CSV_FILE_SUB_NAME);
CSVFileUtil.createCsvFile(list, csvPath);
String zipPath = file.concat(FileConstant.ZIP_FILE_SUB_NAME);
// 设置压缩文件
CompressUtil.decryptionCompression
(zipPath, csvPath, deliveryProperties.getZipPassword());
return zipPath;
}
}

@ -8,6 +8,7 @@ import cn.hutool.core.text.StrPool;
import cn.hutool.core.text.csv.*;
import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baiye.common.CommonLog;
import com.baiye.config.properties.DeliveryProperties;
import com.baiye.constant.AdPlatFormConstants;
import com.baiye.constant.DefaultNumberConstants;
@ -126,14 +127,15 @@ public class MailSourceTask {
if (CollUtil.isNotEmpty(decryptList)) {
log.info("=================== the decryptList size as {} =====================", decryptList.size());
if (byTaskName.getType() == DefaultNumberConstants.ONE_NUMBER) {
CommonLog.info("接收邮件,当前tag值为".concat(tagList.get(DefaultNumberConstants.ZERO_NUMBER)));
saveClue(taskName, byTaskName, task, taskId, tagList, decryptList, path, unzipPath);
}
if (byTaskName.getType() == DefaultNumberConstants.THREE_NUMBER) {
sendRequest(taskName, tagList, decryptList, path, unzipPath);
}
if (byTaskName.getType() == DefaultNumberConstants.TWO_NUMBER) {
downResource(taskName, byTaskName, decryptList, path, data.getRows(), parseFile);
}
if (byTaskName.getType() == DefaultNumberConstants.THREE_NUMBER) {
sendRequest(taskName, tagList, decryptList, path, unzipPath);
}
}
}
}

Loading…
Cancel
Save