Jelajahi Sumber

report服务相关字典映射走字典查询接口

yzc 2 tahun lalu
induk
melakukan
3dd01545f8

+ 47 - 0
sckw-modules/sckw-report/src/main/java/com/sckw/report/enums/TOrderStatusEnum.java

@@ -0,0 +1,47 @@
+package com.sckw.report.enums;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @desc: 订单状态枚举
+ * @author: yzc
+ * @date: 2023-09-18 15:32
+ */
+@Getter
+@AllArgsConstructor
+public enum TOrderStatusEnum {
+
+    /**
+     * 订单状态枚举
+     */
+    SAVED(0, "已保存"),
+    WAIT_ACCEPTED(1, "待受理"),
+    RETURNED(2, "已退回"),
+    WAIT_SIGNED(3, "待签约"),
+    EXECUTING(4, "执行中"),
+    FINISHED(5, "已完结"),
+    RECONCILED(6, "已对账"),
+    SETTLED(7, "已结算");
+
+    private final Integer code;
+    private final String msg;
+
+    public static String getMsg(Integer code) {
+        for (TOrderStatusEnum ele : TOrderStatusEnum.values()) {
+            if (ele.getCode().equals(code)) {
+                return ele.getMsg();
+            }
+        }
+        return null;
+    }
+    public static List<TOrderStatusEnum> getSortList() {
+        TOrderStatusEnum[] enums = TOrderStatusEnum.values();
+        return Arrays.stream(enums).sorted(Comparator.comparingInt(TOrderStatusEnum::getCode)).collect(Collectors.toList());
+    }
+}

+ 80 - 64
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderService.java

@@ -1,6 +1,5 @@
 package com.sckw.report.service;
 
-import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.model.vo.TableBottom;
@@ -12,11 +11,14 @@ import com.sckw.core.utils.StringUtils;
 import com.sckw.core.web.context.LoginUserHolder;
 import com.sckw.excel.utils.DateUtil;
 import com.sckw.mongo.model.SckwTradeOrder;
+import com.sckw.report.enums.TOrderStatusEnum;
 import com.sckw.report.service.param.*;
 import com.sckw.report.service.vo.OrderListRes;
 import com.sckw.report.service.vo.TradeOrderAppStatisticVO;
+import com.sckw.system.api.RemoteSystemService;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.springframework.data.domain.Sort;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.mongodb.core.aggregation.Aggregation;
@@ -43,6 +45,9 @@ public class KwOrderService {
 
     private final MongoTemplate mongoTemplate;
 
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
+
     /**
      * @desc: 贸易订单详情
      * @author: yzc
@@ -69,7 +74,8 @@ public class KwOrderService {
      */
     public PageResult tradeOrderSelect(TradeOrderListSelectParam params) {
         Criteria criteria = buildCriteria(params, false);
-        return getResult(criteria, params.getPage(), params.getPageSize());
+        Sort sort = Sort.by(Sort.Direction.DESC, "createTime");
+        return getResult(criteria, sort, params.getPage(), params.getPageSize());
     }
 
     /**
@@ -77,18 +83,43 @@ public class KwOrderService {
      * @author: yzc
      * @date: 2023-07-20 15:02
      * @Param criteria:
+     * @Param sort:
      * @Param page:
      * @Param pageSize:
      * @return: com.sckw.core.model.page.PageResult
      */
-    public PageResult getResult(Criteria criteria, Integer page, Integer pageSize) {
+    public PageResult getResult(Criteria criteria, Sort sort, Integer page, Integer pageSize) {
         Query query = new Query();
         query.addCriteria(criteria);
         long count = mongoTemplate.count(query, SckwTradeOrder.class);
-        Sort sort = Sort.by(Sort.Direction.DESC, "createTime");
         SpringDataPageAble pageAble = new SpringDataPageAble(page, pageSize, sort);
         query.with(pageAble);
         List<SckwTradeOrder> list = mongoTemplate.find(query, SckwTradeOrder.class);
+        if (CollectionUtils.isEmpty(list)) {
+            return PageResult.build(page, pageSize, count, Collections.emptyList());
+        }
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(
+                DictTypeEnum.TORDER_STATUS.getType(), DictTypeEnum.TRADE_TYPE.getType(), DictTypeEnum.DELIVERY_TYPE.getType(),
+                DictTypeEnum.PICKUP_TYPE.getType(), DictTypeEnum.TORDER_SOURCE.getType()));
+        Map<String, String> statusMap, tradeMap, deliveryMap, pickupMap, sourceMap;
+        if (CollectionUtils.isNotEmpty(dict)) {
+            statusMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TORDER_STATUS.getType())) ?
+                    dict.get(DictTypeEnum.TORDER_STATUS.getType()) : new HashMap<>();
+            tradeMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.TRADE_TYPE.getType()) : new HashMap<>();
+            deliveryMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.DELIVERY_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.DELIVERY_TYPE.getType()) : new HashMap<>();
+            pickupMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.PICKUP_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.PICKUP_TYPE.getType()) : new HashMap<>();
+            sourceMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TORDER_SOURCE.getType())) ?
+                    dict.get(DictTypeEnum.TORDER_SOURCE.getType()) : new HashMap<>();
+        } else {
+            statusMap = new HashMap<>();
+            tradeMap = new HashMap<>();
+            deliveryMap = new HashMap<>();
+            pickupMap = new HashMap<>();
+            sourceMap = new HashMap<>();
+        }
         List<OrderListRes> result = new ArrayList<>();
         list.forEach(e -> {
             BigDecimal actualAmount = Objects.isNull(e.getActualAmount()) ? BigDecimal.ZERO : BigDecimal.valueOf(e.getActualAmount());
@@ -98,14 +129,14 @@ public class KwOrderService {
             String unloadCityName = Objects.isNull(e.getUnloadCityName()) ? "" : e.getUnloadCityName();
             String loadDetailAddress = Objects.isNull(e.getLoadDetailAddress()) ? "" : e.getLoadDetailAddress();
             String unloadDetailAddress = Objects.isNull(e.getUnloadDetailAddress()) ? "" : e.getUnloadDetailAddress();
-            order.setStatusLabel(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
-                    .setTradingLabel(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
-                    .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
-                    .setDeliveryTypeLabel(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
-                    .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
-                    .setPickupTypeLabel(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
-                    .setSourceLabel(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()))
-                    .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()))
+            order.setStatusLabel(statusMap.get(String.valueOf(e.getStatus())))
+                    .setTradingLabel(tradeMap.get(e.getTrading()))
+                    .setTrading(tradeMap.get(e.getTrading()))
+                    .setDeliveryTypeLabel(deliveryMap.get(e.getDeliveryType()))
+                    .setDeliveryType(deliveryMap.get(e.getDeliveryType()))
+                    .setPickupTypeLabel(pickupMap.get(e.getPickupType()))
+                    .setSourceLabel(sourceMap.get(e.getSource()))
+                    .setSource(sourceMap.get(e.getSource()))
                     .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
                     .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
                     .setWaitEntrustAmount(getWaitEntrustAmount(e.getAmount(), e.getEntrustAmount()))
@@ -255,7 +286,7 @@ public class KwOrderService {
      */
     public TableStatisticRes tradeOrderStatistic(TradeOrderListStatisticParam params) {
         Criteria criteria = buildCriteria(params, true);
-        return getTableStatistic(criteria, DictEnum.getEnumsByType(DictTypeEnum.TORDER_STATUS.getType()));
+        return getTableStatistic(criteria, TOrderStatusEnum.getSortList());
     }
 
     /**
@@ -266,7 +297,7 @@ public class KwOrderService {
      * @Param enums:
      * @return: com.sckw.core.model.vo.TableStatisticRes
      */
-    public TableStatisticRes getTableStatistic(Criteria criteria, List<DictEnum> enums) {
+    public TableStatisticRes getTableStatistic(Criteria criteria, List<TOrderStatusEnum> enums) {
         TableStatisticRes res = new TableStatisticRes();
         Aggregation aggregation = Aggregation.newAggregation(
                 Aggregation.match(criteria),
@@ -283,11 +314,11 @@ public class KwOrderService {
         }
         List<TableTop> list = new ArrayList<>();
         int count = 0;
-        for (DictEnum e : enums) {
-            Integer value = Integer.valueOf(e.getValue());
+        for (TOrderStatusEnum e : enums) {
+            Integer value = e.getCode();
             int total = Objects.isNull(map.get(value)) ? 0 : map.get(value);
             TableTop tableTop = new TableTop();
-            tableTop.setName(e.getLabel()).setValue(value).setTotal(total);
+            tableTop.setName(e.getMsg()).setValue(value).setTotal(total);
             list.add(tableTop);
             count = count + total;
         }
@@ -373,6 +404,28 @@ public class KwOrderService {
         if (CollectionUtils.isEmpty(orders)) {
             return Collections.emptyList();
         }
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(
+                DictTypeEnum.TORDER_STATUS.getType(), DictTypeEnum.PICKUP_TYPE.getType(), DictTypeEnum.DELIVERY_TYPE.getType(),
+                DictTypeEnum.TORDER_SOURCE.getType(), DictTypeEnum.TRADE_TYPE.getType()));
+        Map<String, String> statusMap, pickupMap, deliveryMap, sourceMap, tradeMap;
+        if (CollectionUtils.isNotEmpty(dict)) {
+            statusMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TORDER_STATUS.getType())) ?
+                    dict.get(DictTypeEnum.TORDER_STATUS.getType()) : new HashMap<>();
+            pickupMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.PICKUP_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.PICKUP_TYPE.getType()) : new HashMap<>();
+            deliveryMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.DELIVERY_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.DELIVERY_TYPE.getType()) : new HashMap<>();
+            sourceMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TORDER_SOURCE.getType())) ?
+                    dict.get(DictTypeEnum.TORDER_SOURCE.getType()) : new HashMap<>();
+            tradeMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.TRADE_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.TRADE_TYPE.getType()) : new HashMap<>();
+        } else {
+            statusMap = new HashMap<>();
+            pickupMap = new HashMap<>();
+            deliveryMap = new HashMap<>();
+            sourceMap = new HashMap<>();
+            tradeMap = new HashMap<>();
+        }
         List<TradeOrderListExport> list = new ArrayList<>();
         AtomicInteger i = new AtomicInteger(1);
         orders.forEach(e -> {
@@ -383,17 +436,17 @@ public class KwOrderService {
             String unloadDetailAddress = Objects.isNull(e.getUnloadDetailAddress()) ? "" : e.getUnloadDetailAddress();
             TradeOrderListExport export = BeanUtils.copyProperties(e, TradeOrderListExport.class);
             export.setSerialNumber(String.valueOf(i.getAndIncrement()))
-                    .setStatus(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
+                    .setStatus(statusMap.get(String.valueOf(e.getStatus())))
                     .setUnitPrice(Objects.isNull(e.getUnitPrice()) ? "0.00" : String.valueOf(e.getUnitPrice()))
                     .setAmount(Objects.isNull(e.getAmount()) ? "0.00" : String.valueOf(e.getAmount()))
                     .setPrice(Objects.isNull(e.getPrice()) ? "0.00" : String.valueOf(e.getPrice()))
                     .setEntrustAmount(Objects.isNull(e.getEntrustAmount()) ? "0.00" : String.valueOf(e.getEntrustAmount()))
                     .setActualAmount(Objects.isNull(e.getActualAmount()) ? "0.00" : String.valueOf(e.getActualAmount()))
                     .setWaitEntrustAmount(Objects.isNull(waitEntrustAmount) ? "0.00" : String.valueOf(waitEntrustAmount))
-                    .setPickupType(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
-                    .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
-                    .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()))
-                    .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
+                    .setPickupType(pickupMap.get(e.getPickupType()))
+                    .setDeliveryType(deliveryMap.get(e.getDeliveryType()))
+                    .setSource(sourceMap.get(e.getSource()))
+                    .setTrading(tradeMap.get(e.getTrading()))
                     .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
                     .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
                     .setStartTime(Objects.isNull(e.getStartTime()) ? null : DateUtil.dateToStr(e.getStartTime()))
@@ -415,7 +468,7 @@ public class KwOrderService {
         Long entId = LoginUserHolder.getEntId();
         Criteria criteria = new Criteria();
         String topEnt = Objects.equals(params.getOrderType(), 1) ? "procureTopEntId" : "supplyTopEntId";
-        criteria.and(topEnt).is(entId).and("status").is(Integer.valueOf(DictEnum.TORDER_STATUS_5.getValue()))
+        criteria.and(topEnt).is(entId).and("status").is(TOrderStatusEnum.FINISHED.getCode())
                 .and("associateStatement").ne(1).and("delFlag").is(0);
         //排除订单ids
         if (StringUtils.isNotBlank(params.getExcludeIds())) {
@@ -447,7 +500,8 @@ public class KwOrderService {
             Pattern pattern = Pattern.compile("^.*" + params.getGoodsName() + ".*$", Pattern.CASE_INSENSITIVE);
             criteria.and("goodsName").regex(pattern);
         }
-        return getResult(criteria, params.getPage(), params.getPageSize());
+        Sort sort = Sort.by(Sort.Direction.DESC, "createTime");
+        return getResult(criteria, sort, params.getPage(), params.getPageSize());
     }
 
     /**
@@ -463,46 +517,8 @@ public class KwOrderService {
         String topEnt = Objects.equals(params.getOrderType(), 1) ? "procureTopEntId" : "supplyTopEntId";
         List<Long> ids = StringUtils.splitStrToList(params.getContractIds(), ",", Long.class);
         criteria.and("contractId").in(ids).and(topEnt).is(entId).and("delFlag").is(0);
-        return getContractResult(criteria, params.getPage(), params.getPageSize());
-    }
-
-    /**
-     * @desc: 获取关联合同结果
-     * @author: yzc
-     * @date: 2023-09-14 14:58
-     * @Param criteria:
-     * @Param page:
-     * @Param pageSize:
-     * @return: com.sckw.core.model.page.PageResult
-     */
-    public PageResult getContractResult(Criteria criteria, Integer page, Integer pageSize) {
-        Query query = new Query();
-        query.addCriteria(criteria);
-        long count = mongoTemplate.count(query, SckwTradeOrder.class);
         Sort sort = Sort.by(Sort.Direction.DESC, "contractId", "createTime");
-        SpringDataPageAble pageAble = new SpringDataPageAble(page, pageSize, sort);
-        query.with(pageAble);
-        List<SckwTradeOrder> list = mongoTemplate.find(query, SckwTradeOrder.class);
-        List<OrderListRes> result = new ArrayList<>();
-        list.forEach(e -> {
-            String loadCityName = Objects.isNull(e.getLoadCityName()) ? "" : e.getLoadCityName();
-            String loadDetailAddress = Objects.isNull(e.getLoadDetailAddress()) ? "" : e.getLoadDetailAddress();
-            String unloadCityName = Objects.isNull(e.getUnloadCityName()) ? "" : e.getUnloadCityName();
-            String unloadDetailAddress = Objects.isNull(e.getUnloadDetailAddress()) ? "" : e.getUnloadDetailAddress();
-            OrderListRes order = BeanUtils.copyProperties(e, OrderListRes.class);
-            order.setStatusLabel(DictEnum.getLabel(DictTypeEnum.TORDER_STATUS.getType(), String.valueOf(e.getStatus())))
-                    .setTrading(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
-                    .setTradingLabel(DictEnum.getLabel(DictTypeEnum.TRADE_TYPE.getType(), e.getTrading()))
-                    .setDeliveryType(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
-                    .setDeliveryTypeLabel(DictEnum.getLabel(DictTypeEnum.DELIVERY_TYPE.getType(), e.getDeliveryType()))
-                    .setPickupTypeLabel(DictEnum.getLabel(DictTypeEnum.PICKUP_TYPE.getType(), e.getPickupType()))
-                    .setLoadDetailAddressInfo(loadCityName + loadDetailAddress)
-                    .setUnloadDetailAddressInfo(unloadCityName + unloadDetailAddress)
-                    .setWaitEntrustAmount(getWaitEntrustAmount(e.getAmount(), e.getActualAmount()))
-                    .setSource(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()))
-                    .setSourceLabel(DictEnum.getLabel(DictTypeEnum.TORDER_SOURCE.getType(), e.getSource()));
-            result.add(order);
-        });
-        return PageResult.build(page, pageSize, count, result);
+        return getResult(criteria, sort, params.getPage(), params.getPageSize());
     }
+
 }

+ 17 - 3
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/KwOrderStatisticsService.java

@@ -1,7 +1,6 @@
 package com.sckw.report.service;
 
 import com.sckw.core.common.enums.NumberConstant;
-import com.sckw.core.common.enums.enums.DictEnum;
 import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
@@ -18,6 +17,7 @@ import com.sckw.report.model.vo.TOrderDataStsResVO;
 import com.sckw.report.model.vo.WbTOrderDataStsParam;
 import com.sckw.report.model.vo.WbTOrderDataStsResVO;
 import com.sckw.report.model.vo.WorkbenchPurchaseVO;
+import com.sckw.system.api.RemoteSystemService;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
@@ -50,6 +50,8 @@ public class KwOrderStatisticsService {
     private GoodsStatisticsService goodsStatisticsService;
     @DubboReference(version = "1.0.0", group = "design", check = false)
     private PaymentDubboService paymentDubboService;
+    @DubboReference(version = "1.0.0", group = "design", check = false)
+    private RemoteSystemService remoteSystemService;
 
 
     /**
@@ -207,11 +209,23 @@ public class KwOrderStatisticsService {
         if (CollectionUtils.isEmpty(orders)) {
             return Collections.emptyList();
         }
+        Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(
+                DictTypeEnum.UNIT_TYPE.getType(), DictTypeEnum.PRODUCT_NAME_TYPE.getType()));
+        Map<String, String> unitMap, goodsNameMap;
+        if (CollectionUtils.isNotEmpty(dict)) {
+            unitMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.UNIT_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.UNIT_TYPE.getType()) : new HashMap<>();
+            goodsNameMap = CollectionUtils.isNotEmpty(dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType())) ?
+                    dict.get(DictTypeEnum.PRODUCT_NAME_TYPE.getType()) : new HashMap<>();
+        } else {
+            unitMap = new HashMap<>();
+            goodsNameMap = new HashMap<>();
+        }
         List<WorkbenchPurchaseVO> result = new ArrayList<>();
         orders.forEach(e -> {
             WorkbenchPurchaseVO vo = BeanUtils.copyProperties(e, WorkbenchPurchaseVO.class);
-            vo.setUnitLabel(DictEnum.getLabel(DictTypeEnum.UNIT_TYPE.getType(), e.getUnit()))
-                    .setGoodsTypeLabel(DictEnum.getLabel(DictTypeEnum.PRODUCT_NAME_TYPE.getType(), e.getGoodsType()));
+            vo.setUnitLabel(unitMap.get(e.getUnit()))
+                    .setGoodsTypeLabel(goodsNameMap.get(e.getGoodsType()));
             result.add(vo);
         });
         return result;

+ 6 - 5
sckw-modules/sckw-report/src/main/java/com/sckw/report/service/operator/TradeOrderManageService.java

@@ -1,11 +1,10 @@
 package com.sckw.report.service.operator;
 
-import com.sckw.core.common.enums.enums.DictEnum;
-import com.sckw.core.common.enums.enums.DictTypeEnum;
 import com.sckw.core.model.page.PageResult;
 import com.sckw.core.model.vo.TableStatisticRes;
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.StringUtils;
+import com.sckw.report.enums.TOrderStatusEnum;
 import com.sckw.report.model.dto.OperatorTOrderListStsConditionDTO;
 import com.sckw.report.model.vo.OperatorTOrderContractParam;
 import com.sckw.report.model.vo.OperatorTOrderExportQueryVO;
@@ -46,7 +45,8 @@ public class TradeOrderManageService {
      */
     public PageResult listPaging(OperatorTOrderListQueryVO params) {
         Criteria criteria = buildCriteria(BeanUtils.copyProperties(params, OperatorTOrderListStsConditionDTO.class), false);
-        return kwOrderService.getResult(criteria, params.getPage(), params.getPageSize());
+        Sort sort = Sort.by(Sort.Direction.DESC, "createTime");
+        return kwOrderService.getResult(criteria, sort, params.getPage(), params.getPageSize());
     }
 
     /**
@@ -58,7 +58,7 @@ public class TradeOrderManageService {
      */
     public TableStatisticRes listStatistic(OperatorTOrderStsQueryVO params) {
         Criteria criteria = buildCriteria(BeanUtils.copyProperties(params, OperatorTOrderListStsConditionDTO.class), true);
-        List<DictEnum> enums = DictEnum.getEnumsByType(DictTypeEnum.TORDER_STATUS.getType());
+        List<TOrderStatusEnum> enums = TOrderStatusEnum.getSortList();
         enums.remove(0);
         return kwOrderService.getTableStatistic(criteria, enums);
     }
@@ -169,6 +169,7 @@ public class TradeOrderManageService {
         Criteria criteria = new Criteria();
         List<Long> ids = StringUtils.splitStrToList(params.getContractIds(), ",", Long.class);
         criteria.and("contractId").in(ids).and("delFlag").is(0);
-        return kwOrderService.getContractResult(criteria, params.getPage(), params.getPageSize());
+        Sort sort = Sort.by(Sort.Direction.DESC, "contractId", "createTime");
+        return kwOrderService.getResult(criteria, sort, params.getPage(), params.getPageSize());
     }
 }