## 同步产品库存失败添加日志;
This commit is contained in:
parent
e653baee75
commit
b25411fe8a
|
@ -93,6 +93,8 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
|
||||||
private ISaOrderWaresLimitService iSaOrderWaresLimitService;
|
private ISaOrderWaresLimitService iSaOrderWaresLimitService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private IBdProductService iBdProductService;
|
private IBdProductService iBdProductService;
|
||||||
|
@Autowired
|
||||||
|
private ISaOrderSyncService iSaOrderSyncService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private RedisService redisService;
|
private RedisService redisService;
|
||||||
|
@ -1087,19 +1089,24 @@ public class RetailOrderServiceImpl implements IRetailOrderService {
|
||||||
httpRequest.header("authorization", header);
|
httpRequest.header("authorization", header);
|
||||||
httpRequest.body(JSONUtil.toJsonStr(bodyMap));
|
httpRequest.body(JSONUtil.toJsonStr(bodyMap));
|
||||||
httpRequest.setReadTimeout(5000);
|
httpRequest.setReadTimeout(5000);
|
||||||
String resultStr;
|
|
||||||
try {
|
try {
|
||||||
resultStr = httpRequest.execute().body();
|
// 同步产品接口返回
|
||||||
|
String resultStr = httpRequest.execute().body();
|
||||||
AjaxResult ajaxResult = JSONUtil.toBean(resultStr, AjaxResult.class);
|
AjaxResult ajaxResult = JSONUtil.toBean(resultStr, AjaxResult.class);
|
||||||
log.info("同步产品,resultStr: {}", resultStr);
|
log.info("同步产品,resultStr: {}", resultStr);
|
||||||
if (!ajaxResult.isSuccess()) {
|
if (!ajaxResult.isSuccess()) {
|
||||||
|
// 同步产品失败,250毫秒后重试
|
||||||
|
Thread.sleep(250);
|
||||||
resultStr = httpRequest.execute().body();
|
resultStr = httpRequest.execute().body();
|
||||||
log.info("同步产品失败重试,resultStr: {}", resultStr);
|
log.info("同步产品失败重试,resultStr: {}", resultStr);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("同步产品库存失败", e);
|
log.error("同步产品库存异常", e);
|
||||||
resultStr = httpRequest.execute().body();
|
// 保存订单产品同步记录
|
||||||
log.info("同步产品异常重试,resultStr: {}", resultStr);
|
iSaOrderSyncService.save(SaOrderSync.builder()
|
||||||
|
.orderCode(saOrderExt.getOrderCode())
|
||||||
|
.bodyDetail(JSONUtil.toJsonStr(bodyDetailList))
|
||||||
|
.build());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.hzs.sale.order.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.hzs.common.domain.sale.order.SaOrderSync;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单产品同步记录 Mapper 接口
|
||||||
|
*/
|
||||||
|
public interface SaOrderSyncMapper extends BaseMapper<SaOrderSync> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.hzs.sale.order.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.hzs.common.domain.sale.order.SaOrderSync;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单产品同步记录 服务类
|
||||||
|
*/
|
||||||
|
public interface ISaOrderSyncService extends IService<SaOrderSync> {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.hzs.sale.order.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.hzs.common.domain.sale.order.SaOrderSync;
|
||||||
|
import com.hzs.sale.order.mapper.SaOrderSyncMapper;
|
||||||
|
import com.hzs.sale.order.service.ISaOrderSyncService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单产品同步记录 服务实现类
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SaOrderSyncServiceImpl extends ServiceImpl<SaOrderSyncMapper, SaOrderSync> implements ISaOrderSyncService {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.hzs.sale.order.mapper.SaOrderSyncMapper">
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,57 @@
|
||||||
|
package com.hzs.common.domain.sale.order;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单产品同步记录
|
||||||
|
*/
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@TableName("SA_ORDER_SYNC")
|
||||||
|
public class SaOrderSync implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键ID
|
||||||
|
*/
|
||||||
|
@TableId("PK_ID")
|
||||||
|
private Long pkId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单编号
|
||||||
|
*/
|
||||||
|
@TableField("ORDER_CODE")
|
||||||
|
private String orderCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品明细列表
|
||||||
|
*/
|
||||||
|
@TableField("BODY_DETAIL")
|
||||||
|
private String bodyDetail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@TableField("CREATION_TIME")
|
||||||
|
private Date creationTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步状态(1=失败)
|
||||||
|
*/
|
||||||
|
@TableField("STATUS")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue