|
|
|
@ -15,12 +15,13 @@ import cn.hutool.http.HttpUtil;
|
|
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
|
|
import com.baiye.config.properties.DeliveryProperties;
|
|
|
|
|
import com.baiye.constant.DefaultNumberConstants;
|
|
|
|
|
import com.baiye.constant.SecurityConstants;
|
|
|
|
|
import com.baiye.exception.BadRequestException;
|
|
|
|
|
import com.baiye.feign.DownRecordClient;
|
|
|
|
|
import com.baiye.feign.TaskClient;
|
|
|
|
|
import com.baiye.http.DmpDataDTO;
|
|
|
|
|
import com.baiye.http.DmpResponse;
|
|
|
|
|
import com.baiye.http.ResponseCode;
|
|
|
|
|
import com.baiye.http.DmpDataDTO;
|
|
|
|
|
import com.baiye.module.dao.ClueTalkRepository;
|
|
|
|
|
import com.baiye.module.entity.DeliveryRecord;
|
|
|
|
|
import com.baiye.module.entity.Task;
|
|
|
|
@ -72,7 +73,6 @@ public class MailSourceTask {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 十分钟获取邮件内容
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
@Scheduled(cron = "0 0/10 * * * ? ")
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
@ -87,8 +87,8 @@ public class MailSourceTask {
|
|
|
|
|
if (deliveryProperties.getToEmailAddress().equalsIgnoreCase
|
|
|
|
|
(MailUtil.getFrom((MimeMessage) message))) {
|
|
|
|
|
String taskName = message.getSubject();
|
|
|
|
|
String str = (String) redisUtils.get(taskName);
|
|
|
|
|
if (StringUtils.isNotBlank(str)) {
|
|
|
|
|
Object objCache = redisUtils.get(taskName);
|
|
|
|
|
if (ObjectUtil.isNotNull(objCache)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
// 设置十分钟缓存
|
|
|
|
@ -134,7 +134,7 @@ public class MailSourceTask {
|
|
|
|
|
// 批量解析号码
|
|
|
|
|
SecretResponseBean responseBean = DecryptPnoUtil.batchDecryptPno
|
|
|
|
|
(Base64.encode(StringUtils.substringBeforeLast(join, StrPool.COMMA)));
|
|
|
|
|
if (Objects.nonNull(responseBean)) {
|
|
|
|
|
if (ObjectUtil.isNotNull(responseBean) && ObjectUtil.isNotNull(responseBean.getTels())) {
|
|
|
|
|
String decodeStr = Base64.decodeStr(responseBean.getTels());
|
|
|
|
|
String[] split = decodeStr.split(StrPool.COMMA);
|
|
|
|
|
if (split.length > DefaultNumberConstants.ZERO_NUMBER) {
|
|
|
|
@ -157,7 +157,7 @@ public class MailSourceTask {
|
|
|
|
|
FileUtil.del(path);
|
|
|
|
|
FileUtil.del(unzipPath);
|
|
|
|
|
taskClient.updateTask(task);
|
|
|
|
|
deliveryRecordService.updateStatusByTaskName(DefaultNumberConstants.ONE_NUMBER,decryptList.size(), taskName);
|
|
|
|
|
deliveryRecordService.updateStatusByTaskName(DefaultNumberConstants.ONE_NUMBER, decryptList.size(), taskName);
|
|
|
|
|
}
|
|
|
|
|
log.info("============== message parsing succeeded file path as {} unzip path as {} ===============", path, unzipPath);
|
|
|
|
|
}
|
|
|
|
@ -175,11 +175,10 @@ public class MailSourceTask {
|
|
|
|
|
}
|
|
|
|
|
dmpResponse.setBatchNo(taskName);
|
|
|
|
|
dmpResponse.setDecryptList(arrayList);
|
|
|
|
|
map.put("status",DefaultNumberConstants.TWO_HUNDRED);
|
|
|
|
|
map.put("status", DefaultNumberConstants.TWO_HUNDRED);
|
|
|
|
|
map.put("msg", ResponseCode.SUCCESS.getDesc());
|
|
|
|
|
map.put("data",dmpResponse);
|
|
|
|
|
String post = HttpUtil.post("https://api.xiaolanben.com/blue-touch/api/v1/open/ad/dmp/exchange", JSONUtil.toJsonStr(map));
|
|
|
|
|
log.info("=============== the send request result as {} =============",JSONUtil.toJsonStr(post));
|
|
|
|
|
map.put("data", dmpResponse);
|
|
|
|
|
HttpUtil.post("https://api.xiaolanben.com/blue-touch/api/v1/open/ad/dmp/exchange", JSONUtil.toJsonStr(map));
|
|
|
|
|
deliveryRecordService.updateStatusByTaskName(DefaultNumberConstants.ONE_NUMBER, decryptList.size(), taskName);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -187,7 +186,7 @@ public class MailSourceTask {
|
|
|
|
|
log.info("========================= the path as {} =========================", path);
|
|
|
|
|
String filePath = path.substring(path.lastIndexOf(StrPool.SLASH) + DefaultNumberConstants.ONE_NUMBER);
|
|
|
|
|
deliveryRecordService.updateStatusByTaskName(DefaultNumberConstants.ONE_NUMBER, decryptList.size(), taskName);
|
|
|
|
|
downRecordClient.updatePath(deliveryProperties.getDmpDownPath().concat(filePath), byTaskName.getId());
|
|
|
|
|
downRecordClient.updatePath(deliveryProperties.getDmpDownPath().concat(filePath), byTaskName.getId(), SecurityConstants.FROM_IN);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|