Commit 9a9165e8 authored by lining's avatar lining

fix: 接口幂等处理

parent 148e5e17
......@@ -5,6 +5,7 @@ import com.onsiteservice.admin.controller.order.vo.OrderDetailVO;
import com.onsiteservice.admin.controller.order.vo.OrderPageVO;
import com.onsiteservice.admin.service.order.AdminOrderService;
import com.onsiteservice.common.annotation.dict.Dict;
import com.onsiteservice.common.annotation.idempotent.ApiIdempotent;
import com.onsiteservice.common.annotation.user.CurrentUserId;
import com.onsiteservice.common.order.dto.DispatchServiceOrderDTO;
import com.onsiteservice.common.order.dto.FinishServiceOrderDTO;
......@@ -60,12 +61,14 @@ public class ServiceOrderController {
}
@ApiOperation(value = "订单估价")
@ApiIdempotent(interval = 6000L)
@PostMapping("valuation")
public Result valuation(@RequestBody @NonNull @Validated ValuationServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.valuation(dto, userId, ServiceOrderOpSourceEnum.WEB) == 1 ? success() : fail("估价失败");
}
@ApiOperation(value = "修改估价")
@ApiIdempotent(interval = 60000L)
@PostMapping("revaluation")
public Result revaluation(@RequestBody @NonNull @Validated ValuationServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.revaluation(dto, userId, ServiceOrderOpSourceEnum.WEB) == 1 ? success() : fail("修改估价失败");
......@@ -75,18 +78,21 @@ public class ServiceOrderController {
* 发送订单
*/
@ApiOperation(value = "发送订单")
@ApiIdempotent(interval = 6000L)
@PostMapping("send")
public Result sendPrice(@RequestBody @NonNull @Validated SendServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.sendOrder(dto, userId, ServiceOrderOpSourceEnum.WEB) == 1 ? success() : fail("发送失败");
}
@ApiOperation(value = "派单")
@ApiIdempotent(interval = 6000L)
@PostMapping("dispatch")
public Result dispatch(@RequestBody @NonNull @Validated DispatchServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.dispatch(dto, userId, ServiceOrderOpSourceEnum.WEB) == 1 ? success() : fail("派单失败");
}
@ApiOperation(value = "修改派单")
@ApiIdempotent(interval = 60000L)
@PostMapping("redispatch")
public Result redispatch(@RequestBody @NonNull @Validated DispatchServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.redispatch(dto, userId, ServiceOrderOpSourceEnum.WEB) == 1 ? success() : fail("修改派单失败");
......@@ -97,6 +103,7 @@ public class ServiceOrderController {
*/
@ApiOperation(value = "完成订单")
@PostMapping("finish")
@ApiIdempotent(interval = 6000L)
public Result finish(@RequestBody @NonNull @Validated FinishServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.finishOrder(dto, userId, ServiceOrderOpSourceEnum.WEB) == 1 ? success() : fail("取消失败");
}
......
......@@ -22,16 +22,16 @@ public enum BizCodeEnum {
* 订单分组
*/
SERVICE_ORDER_NOT_EXIST("订单不存在"),
SERVICE_ORDER_CANNOT_VALUATION("处于非预约状态的订单不能派估价员"),
SERVICE_ORDER_CANNOT_REVALUATION("订单未指派估价员,不能修改"),
SERVICE_ORDER_CANNOT_SEND("订单未受理,不能发送给客户"),
SERVICE_ORDER_CANNOT_VALUATION("订单不能派估价员"),
SERVICE_ORDER_CANNOT_REVALUATION("订单未估价,不能修改"),
SERVICE_ORDER_CANNOT_SEND("订单未受理,不能发送或已发送"),
SERVICE_ORDER_CANNOT_PAY("订单未受理,暂不能支付"),
SERVICE_ORDER_CANNOT_CANCEL("订单不能取消"),
SERVICE_ORDER_CANNOT_REFUND("订单不能申请退款"),
SERVICE_ORDER_CANNOT_DISPATCH("订单未支付,不能派维修工"),
SERVICE_ORDER_CANNOT_REDISPATCH("订单未指派维修工,不能修改"),
SERVICE_ORDER_TIMEOUT_CANNOT_DISPATCH("已过上门维修时间,不能派维修工"),
SERVICE_ORDER_CANNOT_FINISH("订单未派单,不能完成本次服务"),
SERVICE_ORDER_CANNOT_DISPATCH("订单未支付,不能派工或已派工"),
SERVICE_ORDER_CANNOT_REDISPATCH("订单未工,不能修改"),
SERVICE_ORDER_TIMEOUT_CANNOT_DISPATCH("已过维修时间,不能派维修工"),
SERVICE_ORDER_CANNOT_FINISH("订单未派单,不能完成服务或已完成"),
SERVICE_ORDER_STATUS_ERROR("请选择正确的订单状态"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment