添加发送日志

master
bynt 1 year ago
parent cf02373de9
commit 8001cbb26b

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

@ -74,7 +74,6 @@ public class DownRecordServiceImpl implements DownRecordService {
downRecord.setCompanyName(componentName); downRecord.setCompanyName(componentName);
downRecord.setId(IdUtil.getSnowflake().nextId()); downRecord.setId(IdUtil.getSnowflake().nextId());
downRecord.setStatus(DefaultNumberConstants.ZERO_NUMBER); downRecord.setStatus(DefaultNumberConstants.ZERO_NUMBER);
return downRecordRepository.save(downRecord).getId(); return downRecordRepository.save(downRecord).getId();
} }
@ -123,8 +122,8 @@ public class DownRecordServiceImpl implements DownRecordService {
String uuid = IdUtil.fastSimpleUUID(); String uuid = IdUtil.fastSimpleUUID();
String file = deliveryProperties.getFileUrl().concat(StrPool.SLASH).concat(uuid); String file = deliveryProperties.getFileUrl().concat(StrPool.SLASH).concat(uuid);
String filePath = deliveryProperties.getDmpDownPath().concat(uuid).concat(FileConstant.ZIP_FILE_SUB_NAME); 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); Long downId = this.createRecord(dtoArrayList.size(), "超级管理员", taskName, zipPath, filePath, DefaultNumberConstants.TWO_NUMBER);
for (List<ImeiDTO> list : partition) { for (List<ImeiDTO> list : partition) {
String taskImeiName = redisUtils.acquisitionBatch(MailRequestEnum.MM.getCacheName()); 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.text.StrPool;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baiye.common.CommonLog;
import com.baiye.config.properties.DeliveryProperties; import com.baiye.config.properties.DeliveryProperties;
import com.baiye.constant.DefaultNumberConstants; import com.baiye.constant.DefaultNumberConstants;
import com.baiye.constant.FileConstant; import com.baiye.constant.FileConstant;
@ -186,6 +187,7 @@ public class DeliveryBalanceTask {
return; return;
} }
String file = fileUrl.concat(StrPool.SLASH).concat(taskImeiName); 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); String zipPath = FileAndMailUtil.zipFileAndSendDMPMail(toList, file, taskImeiName, deliveryProperties, DefaultNumberConstants.ONE_NUMBER);
// 保存发送记录 // 保存发送记录
deliveryRecordService.saveDeliveryRecord(zipPath, taskImeiName, deliveryRecordService.saveDeliveryRecord(zipPath, taskImeiName,

@ -46,4 +46,15 @@ public class FileAndMailUtil {
return zipPath; 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.text.csv.*;
import cn.hutool.core.util.CharsetUtil; import cn.hutool.core.util.CharsetUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import com.baiye.common.CommonLog;
import com.baiye.config.properties.DeliveryProperties; import com.baiye.config.properties.DeliveryProperties;
import com.baiye.constant.AdPlatFormConstants; import com.baiye.constant.AdPlatFormConstants;
import com.baiye.constant.DefaultNumberConstants; import com.baiye.constant.DefaultNumberConstants;
@ -126,14 +127,15 @@ public class MailSourceTask {
if (CollUtil.isNotEmpty(decryptList)) { if (CollUtil.isNotEmpty(decryptList)) {
log.info("=================== the decryptList size as {} =====================", decryptList.size()); log.info("=================== the decryptList size as {} =====================", decryptList.size());
if (byTaskName.getType() == DefaultNumberConstants.ONE_NUMBER) { if (byTaskName.getType() == DefaultNumberConstants.ONE_NUMBER) {
CommonLog.info("接收邮件,当前tag值为".concat(tagList.get(DefaultNumberConstants.ZERO_NUMBER)));
saveClue(taskName, byTaskName, task, taskId, tagList, decryptList, path, unzipPath); 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) { if (byTaskName.getType() == DefaultNumberConstants.TWO_NUMBER) {
downResource(taskName, byTaskName, decryptList, path, data.getRows(), parseFile); downResource(taskName, byTaskName, decryptList, path, data.getRows(), parseFile);
} }
if (byTaskName.getType() == DefaultNumberConstants.THREE_NUMBER) {
sendRequest(taskName, tagList, decryptList, path, unzipPath);
}
} }
} }
} }
@ -172,7 +174,7 @@ public class MailSourceTask {
Integer saveNumer = clueService.saveClue Integer saveNumer = clueService.saveClue
(tagList, isNotblackList, (tagList, isNotblackList,
byTaskName.getTaskId(), byTaskName.getTaskId(),
byTaskName.getUserId(), DefaultNumberConstants.FOUR_NUMBER); byTaskName.getUserId(), DefaultNumberConstants.FOUR_NUMBER);
// 修改任务总条数 // 修改任务总条数
Integer taskNum = clueTalkRepository.findTaskNum(taskId); Integer taskNum = clueTalkRepository.findTaskNum(taskId);
task.setId(taskId); task.setId(taskId);

Loading…
Cancel
Save