修改请求参数

master
ninftao 2 years ago
parent bbd9e4ba18
commit 86cc5d1bdb

@ -91,6 +91,12 @@ public interface CacheKey {
String USER_DETAILS = "user_details";
/**
*
*/
String UPLOAD_BATCH = "upload::batch::";
/**
* oauth
*/

@ -1,6 +1,7 @@
package com.baiye.modules.platform.rest;
import com.baiye.annotation.Inner;
import com.baiye.modules.platform.service.DownRecordService;
import com.baiye.modules.platform.service.dto.DownRecordQueryCriteria;
import io.swagger.annotations.Api;
@ -46,6 +47,7 @@ public class DownRecordController {
return new ResponseEntity<>(downRecordService.uploadFile(files, taskName), HttpStatus.OK);
}
@Inner
@ApiOperation("修改下载链接")
@GetMapping("/update/path")
public ResponseEntity<Void> updatePath(String path, Long recordId) {

@ -131,7 +131,7 @@ public class TaskImeiServiceImpl implements TaskImeiService {
(DefaultNumberConstants.ZERO_NUMBER, ResponseCode.SEND_MAIL_MAX_NUM_FRIEND.getDesc());
}
if (redisUtils.get(taskImeiDTO.getBatchNo()) != null) {
if (redisUtils.get(CacheKey.UPLOAD_BATCH.concat(taskImeiDTO.getBatchNo())) != null) {
DeliveryRecord byBatchNo = deliveryRecordService.findByBatchNo(taskImeiDTO.getBatchNo());
if (ObjectUtil.isNotNull(byBatchNo) && ObjectUtil.isNotNull(byBatchNo.getId())) {
return CommonResponse.createByErrorCodeMessage
@ -158,7 +158,7 @@ public class TaskImeiServiceImpl implements TaskImeiService {
Long recordId = deliveryRecordService.saveDeliveryRecord(zipPath, taskImeiDTO.getBatchNo(), dtoList.size(),
null, (long) DefaultNumberConstants.ONE_NUMBER, DefaultNumberConstants.THREE_NUMBER);
// 缓存三天
redisUtils.set(taskImeiDTO.getBatchNo(), recordId, DefaultNumberConstants.ONE_NUMBER, TimeUnit.DAYS);
redisUtils.set(CacheKey.UPLOAD_BATCH.concat(taskImeiDTO.getBatchNo()), recordId, DefaultNumberConstants.ONE_NUMBER, TimeUnit.DAYS);
}
return CommonResponse.createBySuccess(DefaultNumberConstants.TWO_HUNDRED);
}

@ -1,10 +1,12 @@
package com.baiye.feign;
import com.baiye.constant.SecurityConstants;
import com.baiye.feign.fallback.OrganizeClientFallback;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
/**
@ -20,11 +22,12 @@ public interface DownRecordClient {
*
* @param path
* @param recordId
* @param from
* @return
*/
@ApiOperation("修改下载链接")
@GetMapping(PAY_PREFIX + "/update/path")
ResponseEntity<Void> updatePath(@RequestParam("path") String path, @RequestParam("recordId") Long recordId);
ResponseEntity<Void> updatePath(@RequestParam("path") String path, @RequestParam("recordId") Long recordId, @RequestHeader(SecurityConstants.FROM) String from);
}

@ -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);
}
}
}

Loading…
Cancel
Save