Browse Source

feat(all): 修改梦天回推时重复推送老系统问题

dist.1.3.0
zhaoqiaobo 6 months ago
parent
commit
d0ae92c012
  1. 21
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java
  2. 5
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtOrderLogFailRetryServiceImpl.java

21
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java

@ -286,7 +286,9 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
@Override
public R handleStatusData(OrderStatusDTO orderStatusDTO) throws CustomerException, JsonProcessingException, NoSuchAlgorithmException {
logger.info("TAG {} #############handleStatusData: orderStatusDTO={}", FactoryConstant.MENGT,orderStatusDTO);
if(!mtFactoryProperties.getSendEnable()){
return R.fail(400, "当前数据不推送");
}
String status = orderStatusDTO.getStatus();
R rd = null;
@ -324,6 +326,9 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
String distributionContactId,
String destinationWarehouse
) throws JsonProcessingException, NoSuchAlgorithmException {
if(!mtFactoryProperties.getSendEnable()){
return R.fail(400, "当前数据不推送");
}
QueryWrapper<MtPackageInfo> packageInfoQueryWrapper = new QueryWrapper<>();
packageInfoQueryWrapper.eq("package_code", orderPackageCode);
MtPackageInfo one = mtPackageInfoService.getOne(packageInfoQueryWrapper);
@ -474,7 +479,9 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
@Override
public R sendReceiveInfoByNewSystem(MtReceiveDTO mtReceiveDTO) throws JsonProcessingException, NoSuchAlgorithmException {
if(!mtFactoryProperties.getSendEnable()){
return R.fail("发送数据已关闭");
}
List<MtReceiveContentDTO> receiveContentList = mtReceiveDTO.getReceiveContentList();
@ -685,6 +692,9 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
* @throws NoSuchAlgorithmException
*/
public String retryPushMtFactoryData(String url, String data) throws NoSuchAlgorithmException {
if(!mtFactoryProperties.getSendEnable()){
return "";
}
return sendMtFactoryDataRequest(url, data);
}
@ -698,7 +708,9 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
* @throws NoSuchAlgorithmException
*/
private R sendMtFactoryData(String url, String data, Integer type,String refCode) throws NoSuchAlgorithmException {
if(!mtFactoryProperties.getSendEnable()){
return R.fail(400, "当前数据不推送");
}
logger.info("##############sendMtFactoryData 发送数据: {}", data);
String result = sendMtFactoryDataRequest(url, data);
@ -747,6 +759,9 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
* @throws NoSuchAlgorithmException
*/
private String sendMtFactoryDataRequest(String url, String data) throws NoSuchAlgorithmException {
if(!mtFactoryProperties.getSendEnable()){
return "";
}
//先获取token
String token = getMtToken();

5
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtOrderLogFailRetryServiceImpl.java

@ -12,7 +12,6 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@ -81,6 +80,8 @@ public class MtOrderLogFailRetryServiceImpl implements MtOrderLogFailRetryServic
*/
protected void executeRetry(MtOrderLogEntity mtOrderLogEntity) {
try {
if(mtFactoryProperties.getSendEnable()){
String requestUrl = getRequestUrl(mtOrderLogEntity);
String result = mtFactoryDataService.retryPushMtFactoryData(requestUrl, mtOrderLogEntity.getReqArgs());
@ -102,7 +103,7 @@ public class MtOrderLogFailRetryServiceImpl implements MtOrderLogFailRetryServic
// 由于要存储每次的响应结果,所以每次请求后都立即保存
mtOrderLogService.updateById(mtOrderLogEntity);
}
} catch (Exception e) {
log.error("梦天重推 error", e);
}

Loading…
Cancel
Save