This commit is contained in:
Cauchy
2023-10-25 10:36:02 +08:00
parent 0ae9d88639
commit 621ba4c105
3 changed files with 23 additions and 3 deletions

View File

@@ -26,6 +26,10 @@ public class Constants {
* 订单状态 - 交易失败
*/
public static final String ORDER_STATUS_FAIL = "4";
/**
* 订单状态 - 已部分发货
*/
public static final String ORDER_STATUS_PART_SHIPPED = "5";
/**
* 订单状态 - 全部
*/

View File

@@ -60,7 +60,6 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
@Autowired
private CityService cityService;
protected Logger logger = LoggerFactory.getLogger(BuyOrderServiceImpl.class);
// TODO 新版本上线后删除
@@ -347,7 +346,9 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
List<BuyOrderProduct> buyOrderProductList = buyOrderProductService.list(queryWrapper);
BigDecimal totalWeight = new BigDecimal(0);
List<ExpressCommodity> commodityList = new ArrayList<>();
List<Integer> buyOrderIdList = new ArrayList<>();
for (BuyOrderProduct buyOrderProduct : buyOrderProductList) {
buyOrderIdList.add(buyOrderProduct.getOrderId());
int productId = buyOrderProduct.getProductId();
ShopProduct product = shopProductService.getById(productId);
ExpressCommodity commodity = new ExpressCommodity();
@@ -394,6 +395,22 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> impl
buyOrderProduct.setExpressOrderId(expressOrderId);
}
buyOrderProductService.updateBatchById(buyOrderProductList);
QueryWrapper<BuyOrder> buyOrderQueryWrapper = new QueryWrapper<>();
buyOrderQueryWrapper.in("order_id", buyOrderIdList);
List<BuyOrder> buyOrderList = list(buyOrderQueryWrapper);
for (BuyOrder buyorder : buyOrderList) {
QueryWrapper<BuyOrderProduct> buyOrderProductQueryWrapper = new QueryWrapper<>();
buyOrderProductQueryWrapper.eq("order_id", buyorder.getOrderId());
buyOrderProductQueryWrapper.eq("express_order_id", 0);
int count = buyOrderProductService.count(buyOrderProductQueryWrapper);
if (count == 0) {
buyorder.setOrderStatus(Constants.ORDER_STATUS_SHIPPED);
} else {
buyorder.setOrderStatus(Constants.ORDER_STATUS_PART_SHIPPED);
}
}
updateBatchById(buyOrderList);
}
@Override

View File

@@ -92,8 +92,7 @@ public class ExpressOrderServiceImpl extends ServiceImpl<ExpressOrderDao, Expres
}
params.put("DataType", "2");
String response = HttpClientUtils.kdSendPost(Constants.EXPRESS_PLACE_ORDER_URL, params);
ExpressOrderResponseVo responseVo = JSONObject.parseObject(response, ExpressOrderResponseVo.class);
return responseVo;
return JSONObject.parseObject(response, ExpressOrderResponseVo.class);
}