feat: add manual order status controls
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.ruoyi.web.controller.af;
|
||||
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -10,10 +9,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.system.domain.af.AfDispatchPolicy;
|
||||
import com.ruoyi.system.service.af.IAfDispatchPolicyService;
|
||||
import com.ruoyi.system.service.af.IAfDispatchService;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/af/dispatch")
|
||||
@@ -22,9 +19,6 @@ public class AfDispatchController extends BaseController
|
||||
@Autowired
|
||||
private IAfDispatchPolicyService dispatchPolicyService;
|
||||
|
||||
@Autowired
|
||||
private IAfDispatchService dispatchService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('af:order:dispatch')")
|
||||
@GetMapping("/policy")
|
||||
public AjaxResult getPolicy()
|
||||
@@ -39,15 +33,4 @@ public class AfDispatchController extends BaseController
|
||||
return success(dispatchPolicyService.savePolicy(policy, getUsername()));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('af:order:dispatch')")
|
||||
@PostMapping("/trigger")
|
||||
public AjaxResult trigger(@RequestBody(required = false) Map<String, Object> body)
|
||||
{
|
||||
Integer limit = body == null ? null : Convert.toInt(body.get("limit"));
|
||||
String triggerType = body == null ? null : Convert.toStr(body.get("triggerType"));
|
||||
Map<String, Object> triggerResult = dispatchService.triggerAutoDispatch(limit, triggerType, getUsername());
|
||||
AjaxResult result = success();
|
||||
result.putAll(triggerResult);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,24 +77,6 @@ public class AfOrderController extends BaseController
|
||||
return success(dispatchService.manualDispatch(orderId, deviceId, getUsername()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 手动触发一轮自动分发。
|
||||
*
|
||||
* @param body 请求体
|
||||
* @return 触发结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('af:order:dispatch')")
|
||||
@PostMapping("/dispatch/auto")
|
||||
public AjaxResult autoDispatch(@RequestBody(required = false) Map<String, Object> body)
|
||||
{
|
||||
Integer limit = body == null ? null : Convert.toInt(body.get("limit"));
|
||||
String triggerType = body == null ? null : Convert.toStr(body.get("triggerType"));
|
||||
Map<String, Object> triggerResult = dispatchService.triggerAutoDispatch(limit, triggerType, getUsername());
|
||||
AjaxResult result = success();
|
||||
result.putAll(triggerResult);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订单。
|
||||
*
|
||||
@@ -111,17 +93,31 @@ public class AfOrderController extends BaseController
|
||||
}
|
||||
|
||||
/**
|
||||
* 重试订单。
|
||||
* 人工标记订单完成。
|
||||
*
|
||||
* @param body 请求体
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('af:order:retry')")
|
||||
@PostMapping("/retry")
|
||||
public AjaxResult retry(@RequestBody Map<String, Object> body)
|
||||
@PreAuthorize("@ss.hasPermi('af:order:complete')")
|
||||
@PostMapping("/complete")
|
||||
public AjaxResult complete(@RequestBody Map<String, Object> body)
|
||||
{
|
||||
Long orderId = Convert.toLong(body.get("orderId"));
|
||||
return toAjax(orderService.retryOrder(orderId, getUsername()));
|
||||
return toAjax(orderService.completeOrder(orderId, getUsername()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 人工重置订单状态为待分发。
|
||||
*
|
||||
* @param body 请求体
|
||||
* @return 处理结果
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('af:order:reset')")
|
||||
@PostMapping("/reset")
|
||||
public AjaxResult reset(@RequestBody Map<String, Object> body)
|
||||
{
|
||||
Long orderId = Convert.toLong(body.get("orderId"));
|
||||
return toAjax(orderService.resetOrder(orderId, getUsername()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user