Jelajahi Sumber

fix 修改一些查询排序

chenchen 5 bulan lalu
induk
melakukan
d87beb3ce8

+ 12 - 3
application-webadmin/src/main/java/com/tourism/webadmin/app/wechat/controller/WechatDeliveryOrderController.java

@@ -27,6 +27,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -78,7 +79,7 @@ public class WechatDeliveryOrderController {
         deliveryOrderFilter.setCreateUserId(userId);
 //        String orderBy = MyOrderParam.buildOrderBy(orderParam, DeliveryOrder.class);
         List<DeliveryOrder> deliveryOrderList =
-                deliveryOrderService.getDeliveryOrderListWithRelation(deliveryOrderFilter, "create_time");
+                deliveryOrderService.getDeliveryOrderListWithRelation(deliveryOrderFilter, "create_time desc");
         deliveryOrderService.maskFieldDataList(deliveryOrderList, null);
 
         //查询订单详情
@@ -91,6 +92,15 @@ public class WechatDeliveryOrderController {
         pageData.getDataList().forEach(e->{
             e.setItemList(collect1.get(e.getId()));
         });
+        List<DeliveryOrderVo> dataList = pageData.getDataList();
+        dataList.sort(new Comparator<DeliveryOrderVo>() {
+            @Override
+            public int compare(DeliveryOrderVo o1, DeliveryOrderVo o2) {
+                int compareTo = o2.getCreateTime().compareTo(o1.getCreateTime());
+                return compareTo;
+            }
+        });
+        pageData.setDataList(dataList);
         return ResponseResult.success(pageData);
     }
 
@@ -123,6 +133,7 @@ public class WechatDeliveryOrderController {
      * @throws Exception
      */
     @RequestMapping("/getCalculatedDistance")
+    @SaIgnore
     public ResponseResult<String> getCalculatedDistance(@RequestParam("initLongitude") String initLongitude,
                                                         @RequestParam("initLatitude") String initLatitude,
                                                         @RequestParam("lastLongitude") String lastLongitude,
@@ -134,8 +145,6 @@ public class WechatDeliveryOrderController {
        Double v = MathCalculateUtils.calculateDistance(Double.parseDouble(initLongitude), Double.parseDouble(initLatitude), Double.parseDouble(lastLongitude), Double.parseDouble(lastLatitude));
         return ResponseResult.success(v.toString());
     }
-
-
     private ResponseResult<Tuple2<DeliveryOrder, JSONObject>> doBusinessDataVerifyAndConvert(
             DeliveryOrderDto deliveryOrderDto,
             boolean forUpdate,

+ 14 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/wechat/controller/WechatFoodIndexController.java

@@ -31,6 +31,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.List;
 
 /**
@@ -189,6 +190,12 @@ public class WechatFoodIndexController {
             List<String> strings1 = UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), o.getUrl());
             o.setUrlAfterConvert(strings1);
         });
+        foodVos.sort(new Comparator<SelectShopFoodVo>() {
+            @Override
+            public int compare(SelectShopFoodVo o1, SelectShopFoodVo o2) {
+                return o2.getSales().compareTo(o1.getSales());
+            }
+        });
         shopVo.setFoodList(foodVos);
         return ResponseResult.success(shopVo);
     }
@@ -218,6 +225,13 @@ public class WechatFoodIndexController {
             List<String> strings = UrlConvertUtils.urlConvert(applicationConfig.getHostIpPort(), o.getUrl());
             o.setUrlAfterConvert(strings);
         });
+        shopVos.sort(new Comparator<WechatBestNewShopVo>() {
+
+            @Override
+            public int compare(WechatBestNewShopVo o1, WechatBestNewShopVo o2) {
+                return o2.getTotalSales().compareTo(o1.getTotalSales());
+            }
+        });
         return ResponseResult.success(shopVos);
     }
 

+ 2 - 1
application-webadmin/src/main/java/com/tourism/webadmin/app/wechat/vo/shopfood/SelectShopFoodVo.java

@@ -52,5 +52,6 @@ public class SelectShopFoodVo {
      */
     @Schema(description = "价格单位")
     private String priceUnit;
-
+    @Schema(description = "销量")
+    private Integer sales;
 }

+ 5 - 0
application-webadmin/src/main/java/com/tourism/webadmin/app/wechat/vo/shopfood/WechatBestNewShopVo.java

@@ -63,5 +63,10 @@ public class WechatBestNewShopVo {
      */
     @TableField(value = "latitude")
     private BigDecimal latitude;
+    /**
+     * 销量。
+     */
+    @TableField(value = "total_sales")
+    private Long totalSales;
 
 }