skyline il y a 1 an
Parent
commit
b0c15365f8

+ 3 - 6
car-wash-miniapp/src/main/java/com/kym/miniapp/controller/WashDeviceController.java

@@ -3,10 +3,7 @@ package com.kym.miniapp.controller;
 import com.kym.common.R;
 import com.kym.common.controller.IController;
 import com.kym.service.miniapp.WashDeviceService;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * <p>
@@ -44,7 +41,7 @@ public class WashDeviceController extends IController {
      * @param shortId
      * @return
      */
-    @GetMapping(value = "/startDevice/{shortId}")
+    @PostMapping(value = "/startDevice/{shortId}")
     R<?> startDevice(@PathVariable("shortId") String shortId) {
         return resp(() -> washDeviceService.startDevice(shortId));
     }
@@ -55,7 +52,7 @@ public class WashDeviceController extends IController {
      * @param shortId
      * @return
      */
-    @GetMapping(value = "/stopDevice/{shortId}")
+    @PostMapping(value = "/stopDevice/{shortId}")
     R<?> stopDevice(@PathVariable("shortId") String shortId) {
         return resp((t) -> washDeviceService.stopDevice(shortId));
     }

+ 2 - 1
car-wash-miniapp/src/main/java/com/kym/miniapp/controller/WashStationController.java

@@ -3,6 +3,7 @@ package com.kym.miniapp.controller;
 import com.kym.common.R;
 import com.kym.entity.miniapp.queryParams.StationQueryParams;
 import com.kym.service.miniapp.WashStationService;
+import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -32,7 +33,7 @@ public class WashStationController {
      * @return
      */
     @PostMapping("/listStation")
-    public R<?> listStationForApp(StationQueryParams params) {
+    public R<?> listStationForApp(@ModelAttribute StationQueryParams params) {
         return R.success(washStationService.listStationForApp(params));
     }
 

+ 1 - 1
car-wash-service/src/main/java/com/kym/service/miniapp/WashDeviceService.java

@@ -16,7 +16,7 @@ public interface WashDeviceService extends MyBaseService<WashDevice> {
 
     WashDevice getDevice(String shortId);
 
-    WashOrder startDevice(String shortId);
+    String startDevice(String shortId);
 
     void stopDevice(String shortId);
 }

+ 1 - 1
car-wash-service/src/main/java/com/kym/service/miniapp/WashOrderService.java

@@ -16,7 +16,7 @@ import com.kym.service.mybatisplus.MyBaseService;
  */
 public interface WashOrderService extends MyBaseService<WashOrder> {
 
-    WashOrder createOrder(DeviceParams params);
+    String createOrder(DeviceParams params);
 
     void closeOrder(DeviceParams params);
 

+ 1 - 1
car-wash-service/src/main/java/com/kym/service/miniapp/impl/WashDeviceServiceImpl.java

@@ -45,7 +45,7 @@ public class WashDeviceServiceImpl extends MyBaseServiceImpl<WashDeviceMapper, W
 
 
     @Override
-    public WashOrder startDevice(String shortId) {
+    public String startDevice(String shortId) {
         var productKeyAndDeviceName = KymCache.INSTANCE.getProductKeyAndDeviceNameByWashShortId(shortId);
         return washOrderService.createOrder(new DeviceParams(shortId, productKeyAndDeviceName[0], productKeyAndDeviceName[1]));
     }

+ 2 - 2
car-wash-service/src/main/java/com/kym/service/miniapp/impl/WashOrderServiceImpl.java

@@ -40,7 +40,7 @@ public class WashOrderServiceImpl extends MyBaseServiceImpl<WashOrderMapper, Was
      * @return
      */
     @Override
-    public WashOrder createOrder(DeviceParams params) {
+    public String createOrder(DeviceParams params) {
         var account = accountService.getAccountByUserId(StpUtil.getLoginIdAsLong());
         var memberName = StpUtil.getSession().getString("mobilePhone");
         var orderId = OrderUtils.getOrderNo();
@@ -64,7 +64,7 @@ public class WashOrderServiceImpl extends MyBaseServiceImpl<WashOrderMapper, Was
                 .setOrderStatus(WashOrder.ORDER_STATUS_开机)
                 .setPayStatus(WashOrder.PAY_STATUS_未支付);
         save(washOrder);
-        return washOrder;
+        return orderId;
     }
 
     @Override