|
|
@@ -1,6 +1,8 @@
|
|
|
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;
|
|
|
import com.ruoyi.app.order.dto.OrderPushBodyDto;
|
|
|
@@ -16,9 +18,11 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.framework.manager.AsyncManager;
|
|
|
import com.ruoyi.system.domain.InfoUser;
|
|
|
import com.ruoyi.system.domain.PosOrder;
|
|
|
+import com.ruoyi.system.domain.PosStore;
|
|
|
import com.ruoyi.system.domain.UserBilling;
|
|
|
import com.ruoyi.system.service.IInfoUserService;
|
|
|
import com.ruoyi.system.service.IPosOrderService;
|
|
|
+import com.ruoyi.system.service.IPosStoreService;
|
|
|
import com.ruoyi.system.service.IUserBillingService;
|
|
|
import com.ruoyi.system.utils.Auth;
|
|
|
import com.ruoyi.system.utils.JwtUtil;
|
|
|
@@ -31,10 +35,9 @@ import org.springframework.transaction.support.TransactionSynchronization;
|
|
|
import org.springframework.transaction.support.TransactionSynchronizationManager;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.TimerTask;
|
|
|
+import java.util.*;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/system/orderQsOprate")
|
|
|
@@ -51,6 +54,8 @@ public class PosOrderQsOprateController extends BaseController {
|
|
|
private UserService userService;
|
|
|
@Autowired
|
|
|
private IUserBillingService userBillingService;
|
|
|
+ @Autowired
|
|
|
+ private IPosStoreService posStoreService;
|
|
|
|
|
|
/**
|
|
|
* 骑手接单:校验 type=0 且 afterSaleStatus=0,设置 deliveryStatus=1
|
|
|
@@ -299,7 +304,25 @@ public class PosOrderQsOprateController extends BaseController {
|
|
|
|
|
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<PosOrder> pageParam = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page, size);
|
|
|
com.baomidou.mybatisplus.extension.plugins.pagination.Page<PosOrder> result = posOrderService.page(pageParam, wrapper);
|
|
|
- return success(result);
|
|
|
+ Set<Long> mdIds = result.getRecords().stream().map(PosOrder::getMdId).filter(Objects::nonNull).collect(Collectors.toSet());
|
|
|
+ Map<Integer, PosStore> storeMap = mdIds.isEmpty() ? Collections.emptyMap() :
|
|
|
+ posStoreService.listByIds(mdIds).stream().collect(Collectors.toMap(PosStore::getId, s -> s));
|
|
|
+ JSONArray arr=new JSONArray();
|
|
|
+ for (PosOrder order : result.getRecords()) {
|
|
|
+ // 自动序列化所有PosOrder字段,新增字段无需手动添加
|
|
|
+ JSONObject org = JSON.parseObject(
|
|
|
+ JSON.toJSONStringWithDateFormat(order, "yyyy-MM-dd HH:mm:ss")
|
|
|
+ );
|
|
|
+ // 以下为非PosOrder字段或需要特殊处理的字段
|
|
|
+
|
|
|
+ org.put("store", storeMap.get(order.getMdId().intValue()));
|
|
|
+ arr.add(org);
|
|
|
+ }
|
|
|
+ JSONObject org=new JSONObject();
|
|
|
+ org.put("records",result.getRecords());
|
|
|
+ org.put("total",result.getTotal());
|
|
|
+ org.put("current",result.getCurrent());
|
|
|
+ return success(org);
|
|
|
}
|
|
|
|
|
|
}
|