拆单接口

zhc4dev
Gitea 2 years ago
parent 8e75680fc7
commit 2cadbd2c73
  1. 36
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/demo/zyorders/controller/ZyOrdersController.java

@ -245,7 +245,41 @@ public class ZyOrdersController extends JeecgController<ZyOrders, IZyOrdersServi
}
return Result.OK("成功");
List<String> ids = new ArrayList<>();
ZyOrders zos = new ZyOrders();
QueryWrapper<ZyOrders> queryWrapperzos = QueryGenerator.initQueryWrapper(zos, req.getParameterMap());
queryWrapperzos.eq("order_id",zyOrders.getId());
List<ZyOrders> listzos = zyOrdersService.list(queryWrapperzos);
if(listzos.size()>0){
return Result.error("该订单已经拆分,不可以再次拆单!");
}else{
OrderGoods orderGoods = new OrderGoods();
QueryWrapper<OrderGoods> queryWrapperog = QueryGenerator.initQueryWrapper(orderGoods, req.getParameterMap());
queryWrapperog.eq("orders_id",zyOrders.getId());
List<OrderGoods> listog = orderGoodsService.list(queryWrapperog);
if(listog.size()>0){
for (int i = 0 ; i < listog.size() ; i++){
ZyOrders zo = new ZyOrders();
zo = zyOrders;
zo.setId(null);
zo.setOrdersNum(getOrdersNum());
zo.setFreight(Double.parseDouble("0"));
zo.setIschild(1);
zo.setOrderId(zyOrders.getId());
zo.setMoney(listog.get(i).getTotalPrice());
zo.setPromotionPrice(listog.get(i).getPromotionPrice());
zo.setActualPayment(listog.get(i).getPayTotalPrice());
zo.setGoodsQuantity(1);
zyOrdersService.save(zo);
ids.add(zo.getId());
OrderGoods og = new OrderGoods();
og = listog.get(i);
og.setOrdersId(zo.getId());
orderGoodsService.updateById(og);
}
}
}
return Result.OK(ids);
}

Loading…
Cancel
Save