|
|
@@ -1,6 +1,7 @@
|
|
|
package com.ruoyi.app.order;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
@@ -19,6 +20,7 @@ import com.ruoyi.common.utils.MessageUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.framework.manager.AsyncManager;
|
|
|
import com.ruoyi.system.domain.*;
|
|
|
+import com.ruoyi.system.mapper.PosOrderPromotionMapper;
|
|
|
import com.ruoyi.system.service.*;
|
|
|
import com.ruoyi.system.utils.Auth;
|
|
|
import com.ruoyi.system.utils.GetArea;
|
|
|
@@ -65,6 +67,8 @@ public class UserOrderController extends BaseController {
|
|
|
private OrderLogHelper orderLogHelper;
|
|
|
@Autowired
|
|
|
private OrderPromotionHelper orderPromotionHelper;
|
|
|
+ @Autowired
|
|
|
+ private PosOrderPromotionMapper posOrderPromotionMapper;
|
|
|
|
|
|
/**
|
|
|
* 创建订单
|
|
|
@@ -347,7 +351,18 @@ public class UserOrderController extends BaseController {
|
|
|
OrderParent result = orderParentService.getOne(new LambdaQueryWrapper<OrderParent>().eq(OrderParent::getDdId,ddId));
|
|
|
List<PosOrder> posOrders = posOrderService.list(new LambdaQueryWrapper<PosOrder>().eq(PosOrder::getParentDdId,ddId).orderBy(true,true,PosOrder::getCretim));
|
|
|
result.setItems(posOrders);
|
|
|
- return super.success(result);
|
|
|
+ // 转为JSONObject以追加非实体字段(promotions)
|
|
|
+ JSONObject org = JSON.parseObject(JSON.toJSONStringWithDateFormat(result, "yyyy-MM-dd HH:mm:ss"));
|
|
|
+ JSONArray items = org.getJSONArray("items");
|
|
|
+ if (items != null) {
|
|
|
+ for (int i = 0; i < items.size(); i++) {
|
|
|
+ JSONObject item = items.getJSONObject(i);
|
|
|
+ Long orderId = item.getLong("id");
|
|
|
+ List<PosOrderPromotion> promotions = posOrderPromotionMapper.selectByOrderId(orderId);
|
|
|
+ item.put("promotions", promotions);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return super.success(org);
|
|
|
}
|
|
|
|
|
|
/**
|