是否自动生产
This commit is contained in:
parent
ce0f11691e
commit
44d3eb78f0
|
|
@ -71,17 +71,17 @@ public class HaokaUpdateOrderSchedule {
|
||||||
int pageSize = 100;
|
int pageSize = 100;
|
||||||
Long total = 100L;
|
Long total = 100L;
|
||||||
|
|
||||||
|
// 需要更新的订单过滤 todo:从本地查询出需要从上游同步状态的订单
|
||||||
|
// pageReqVO.setStatus(Lists.asList(1)); // 已经完成/取消/删除的订单,不需要再从上游同步,这里过滤掉
|
||||||
|
|
||||||
while ((long) pageNo * pageSize < total) {
|
while ((long) pageNo * pageSize < total) {
|
||||||
pageNo += 1;
|
pageNo += 1;
|
||||||
pageReqVO.setPageNo(pageNo);
|
pageReqVO.setPageNo(pageNo);
|
||||||
pageReqVO.setPageSize(pageSize);
|
pageReqVO.setPageSize(pageSize);
|
||||||
|
|
||||||
// 需要更新的订单过滤 todo
|
|
||||||
// pageReqVO.setStatus(Lists.asList(1));
|
|
||||||
|
|
||||||
PageResult<OrdersDO> ordersPage = ordersService.getOrdersPage(pageReqVO);
|
PageResult<OrdersDO> ordersPage = ordersService.getOrdersPage(pageReqVO);
|
||||||
total = ordersPage.getTotal();
|
total = ordersPage.getTotal();
|
||||||
for (OrdersDO ordersDO : ordersPage.getList()) {
|
for (OrdersDO ordersDO : ordersPage.getList()) {
|
||||||
|
// 开始从上游同步订单状态,解析,并且更新本地订单状态
|
||||||
updateOrderInfo(ordersDO);
|
updateOrderInfo(ordersDO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -104,9 +104,34 @@ public class HaokaUpdateOrderSchedule {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 开始从上游同步订单状态,解析,并且更新本地订单状态
|
||||||
private void updateOrderInfo(final OrdersDO ordersDO) {
|
private void updateOrderInfo(final OrdersDO ordersDO) {
|
||||||
log.info("更新前--:{}", JSON.toJSONString(ordersDO));
|
log.info("更新前--:{}", JSON.toJSONString(ordersDO));
|
||||||
|
// 查询上游的订单结果
|
||||||
ApiDealResp<OrderApiQueryResp> updateOrderInfo = apiDealStrategyService.getUpdateOrderInfo(ordersDO);
|
ApiDealResp<OrderApiQueryResp> updateOrderInfo = apiDealStrategyService.getUpdateOrderInfo(ordersDO);
|
||||||
|
// 上游是否支持查询接口 :比如联通不支持查询接口,走消息队列
|
||||||
|
if (updateOrderInfo.getIsSupport()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// 上游黑名单
|
||||||
|
if (updateOrderInfo.getIsBlack()){
|
||||||
|
|
||||||
|
}
|
||||||
|
// 查询成功?
|
||||||
|
if (!updateOrderInfo.getSuccess()){
|
||||||
|
// 不成功原因
|
||||||
|
String msg = updateOrderInfo.getMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询结果
|
||||||
|
OrderApiQueryResp data = updateOrderInfo.getData();
|
||||||
|
|
||||||
|
// 订单状态
|
||||||
|
String orderStatusCode = data.getOrderStatusCode();
|
||||||
|
|
||||||
|
// 订单状态描述
|
||||||
|
String orderStatusDesc = data.getSupplierOrderStatusDesc();
|
||||||
|
|
||||||
// todo 上游更新
|
// todo 上游更新
|
||||||
ordersService.updateById(ordersDO);
|
ordersService.updateById(ordersDO);
|
||||||
log.info("更新后--:{}", JSON.toJSONString(ordersDO));
|
log.info("更新后--:{}", JSON.toJSONString(ordersDO));
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
|
||||||
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
||||||
try {
|
try {
|
||||||
lock.lock(1, TimeUnit.SECONDS);
|
lock.lock(1, TimeUnit.SECONDS);
|
||||||
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (onSaleProductPreOrder == null) {
|
if (onSaleProductPreOrder == null) {
|
||||||
String msg = "关联上级产品不存在";
|
String msg = "关联上级产品不存在";
|
||||||
logVO.setSuccess(false);
|
logVO.setSuccess(false);
|
||||||
|
|
@ -97,7 +97,7 @@ public class ApiDealServiceImpl implements ApiDealStrategyService {
|
||||||
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
||||||
Boolean isSupport = true;
|
Boolean isSupport = true;
|
||||||
try {
|
try {
|
||||||
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO onSaleProductPreOrder = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (onSaleProductPreOrder == null) {
|
if (onSaleProductPreOrder == null) {
|
||||||
String msg = "关联上级产品不存在";
|
String msg = "关联上级产品不存在";
|
||||||
logVO.setSuccess(false);
|
logVO.setSuccess(false);
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,9 @@ public class OrderApiQueryResp extends BaseDO {
|
||||||
*/
|
*/
|
||||||
private String supplierOrderStatusDesc;
|
private String supplierOrderStatusDesc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单状态
|
||||||
|
*/
|
||||||
private String orderStatusCode;
|
private String orderStatusCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) throws Exception {
|
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) throws Exception {
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +114,7 @@ public class GuangZhouDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) throws Exception {
|
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) throws Exception {
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
|
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -130,7 +130,7 @@ public class HaiNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) throws Exception {
|
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) throws Exception {
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -219,7 +219,7 @@ public class HuNanDxApiDealStrategy implements ApiDealStrategy {
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
||||||
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
logVO.setHaokaSuperiorApiId(param.getSuperiorApiId());
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
|
public ApiDealResp<OrderApiCreateResp> createOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiCreateParam param) {
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
@ -244,7 +244,7 @@ public class LianTongApiDealStrategy implements ApiDealStrategy {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
public ApiDealResp<OrderApiQueryResp> queryOrder(final SuperiorApiLogSaveReqVO logVO, OrderApiQueryParam param) {
|
||||||
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getProductId());
|
OnSaleProductPreOrderRespVO preProduct = onSaleProductService.getOnSaleProductPreOrder(param.getOnSaleProductId());
|
||||||
if (preProduct == null) {
|
if (preProduct == null) {
|
||||||
return ApiDealResp.failed("商品下架或者不存在");
|
return ApiDealResp.failed("商品下架或者不存在");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,21 +114,19 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersMapper, OrdersDO> imple
|
||||||
orders.setSuperiorApiId(onSaleProductPreOrder.getSuperiorApiRespVO().getId());
|
orders.setSuperiorApiId(onSaleProductPreOrder.getSuperiorApiRespVO().getId());
|
||||||
|
|
||||||
ordersMapper.insert(orders);
|
ordersMapper.insert(orders);
|
||||||
OrderApiCreateParam param = new OrderApiCreateParam();
|
|
||||||
BeanUtils.copyProperties(orders, param);
|
|
||||||
// apiDealStrategyService.createOrder(param);
|
|
||||||
|
|
||||||
// 创建后需要发送短信
|
// 创建后需要发送短信
|
||||||
OrdersDO ordersDO = ordersMapper.selectById(orders.getId());
|
// OrdersDO ordersDO = ordersMapper.selectById(orders.getId());
|
||||||
smsTaskService.sendSMS(
|
smsTaskService.sendSMS(
|
||||||
ordersDO.getStatus(),
|
orders.getStatus(),
|
||||||
ordersDO.getId(),
|
orders.getId(),
|
||||||
ordersDO.getSource(),
|
orders.getSource(),
|
||||||
ordersDO.getOnSaleProductId(),
|
orders.getOnSaleProductId(),
|
||||||
ordersDO.getRefundStatus(),
|
orders.getRefundStatus(),
|
||||||
ordersDO.getCallStatus(),
|
orders.getCallStatus(),
|
||||||
ordersDO.getAddressMobile(),
|
orders.getAddressMobile(),
|
||||||
ordersDO
|
orders
|
||||||
);
|
);
|
||||||
// 返回
|
// 返回
|
||||||
return orders.getId();
|
return orders.getId();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue