Commit 0957bc7b authored by lining's avatar lining

refactor: 通用逻辑提到common模块

parent d64070fd
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 15:20
*/
@Data
@ApiModel("取消订单请求模型")
public class CancelServiceOrderDTO {
@ApiModelProperty(value = "订单id", required = true)
@NotNull(message = "请选择要取消的订单")
private Long id;
}
package com.onsiteservice.miniapp.controller.order.dto;
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
......
package com.onsiteservice.miniapp.controller.order.dto;
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.onsiteservice.common.order.dto;
import com.onsiteservice.dao.common.page.PageParams;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* <P></P>
*
* @author 李宁
* @version v1.0
* @since 2022/7/7 14:38
*/
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel("分页查询订单请求模型")
public class PageServiceOrderDTO extends PageParams {
@ApiModelProperty(value = "订单状态: 0表示全部,1表示...", required = true)
private Integer orderStatus;
}
package com.onsiteservice.miniapp.controller.order.dto;
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* <P></P>
......
package com.onsiteservice.miniapp.controller.order.dto;
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;
@Data
@ApiModel("订单预约请求模型")
public class ReserveServiceOrderDTO {
@ApiModelProperty(value = "服务子类id", required = true)
@NotNull(message = "请选择服务类型")
private Integer subclassId;
/**
* 服务地址id
*/
@ApiModelProperty(value = "服务地址id", required = true)
@NotNull(message = "请选择服务地址")
private Long addressId;
/**
* 期望上门时间
*/
@ApiModelProperty(value = "期望上门时间", required = true)
@NotNull(message = "请选择上门时间")
@Future(message = "上门时间必须为将来的某个时间点")
private Date expectArrivalTime;
/**
* 服务数量
*/
@ApiModelProperty(value = "服务数量", required = true)
@NotNull(message = "请选择服务数量")
@Min(value = 1, message = "服务数量最低为1")
private Integer num;
/**
* 服务需求图片
*/
@ApiModelProperty("服务需求图片")
private String demandImg;
/**
* 服务需求说明
*/
@ApiModelProperty("服务需求说明")
private String demandDesc;
/**
* 是否阅读协议:1已阅读,0未阅读
*/
@ApiModelProperty("是否阅读协议:1已阅读,0未阅读")
@NotNull(message = "请确认是否阅读协议")
private Boolean readAgreement;
@ApiModelProperty("服务图片数组")
@Size(max = 8, message = "最多上传8张图片")
private List<String> urls;
}
\ No newline at end of file
package com.onsiteservice.miniapp.controller.order.dto;
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.onsiteservice.miniapp.controller.order.dto;
package com.onsiteservice.common.order.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.extern.log4j.Log4j2;
import org.checkerframework.checker.units.qual.A;
import javax.validation.constraints.Future;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
......
package com.onsiteservice.miniapp.controller.order.vo;
package com.onsiteservice.common.order.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
......
package com.onsiteservice.miniapp.controller.order;
import com.onsiteservice.common.annotation.user.CurrentUserId;
import com.onsiteservice.common.order.dto.*;
import com.onsiteservice.common.order.vo.ServiceOrderLogVO;
import com.onsiteservice.common.order.vo.ServiceOrderVO;
import com.onsiteservice.core.result.Result;
import com.onsiteservice.dao.common.page.PageInfoVO;
import com.onsiteservice.miniapp.controller.order.dto.*;
import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderLogVO;
import com.onsiteservice.miniapp.controller.order.vo.ServiceOrderVO;
import com.onsiteservice.miniapp.service.order.ServiceOrderService;
import com.onsiteservice.miniapp.controller.order.dto.CancelServiceOrderDTO;
import com.onsiteservice.miniapp.controller.order.dto.PageServiceOrderDTO;
import com.onsiteservice.miniapp.controller.order.dto.ReserveServiceOrderDTO;
import com.onsiteservice.miniapp.service.order.ServiceOrderBizService;
import com.onsiteservice.service.ServiceOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
......@@ -16,7 +20,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.constraints.Positive;
import java.util.List;
import static com.onsiteservice.core.result.ResultGenerator.fail;
......@@ -36,6 +39,9 @@ import static com.onsiteservice.core.result.ResultGenerator.success;
public class ServiceOrderController {
@Resource
private ServiceOrderBizService serviceOrderBizService;
@Resource
private ServiceOrderService serviceOrderService;
......@@ -43,19 +49,19 @@ public class ServiceOrderController {
@ApiOperation(value = "根据id查询订单详情")
@GetMapping("get/{id}")
public Result<ServiceOrderVO> getDetail(@ApiParam(name = "id", value = "订单id") @PathVariable @Positive Long id, @CurrentUserId Long userId) {
return success(serviceOrderService.selectById(id, userId));
return success(serviceOrderBizService.selectById(id, userId));
}
@ApiOperation(value = "分页查询订单")
@PostMapping("page")
public Result<PageInfoVO<ServiceOrderVO>> getPage(@RequestBody @NonNull @Validated PageServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.getPage(dto, userId);
return serviceOrderBizService.getPage(dto, userId);
}
@ApiOperation(value = "订单预约")
@PostMapping("reserve")
public Result reserve(@RequestBody @NonNull @Validated ReserveServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.reserve(dto, userId) == 1 ? success() : fail("已预约");
return serviceOrderBizService.reserve(dto, userId) == 1 ? success() : fail("已预约");
}
@ApiOperation(value = "订单估价")
......@@ -82,7 +88,7 @@ public class ServiceOrderController {
@ApiOperation(value = "支付订单")
@PostMapping("pay")
public Result pay(@RequestBody @NonNull @Validated PayServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.pay(dto, userId) == 1 ? success() : fail("支付失败");
return serviceOrderBizService.pay(dto, userId) == 1 ? success() : fail("支付失败");
}
@ApiOperation(value = "派单")
......@@ -121,19 +127,14 @@ public class ServiceOrderController {
@ApiOperation(value = "取消订单")
@PostMapping("cancel")
public Result cancel(@RequestBody @NonNull @Validated CancelServiceOrderDTO dto, @CurrentUserId Long userId) {
return serviceOrderService.cancelOrder(dto, userId) == 1 ? success() : fail("取消失败");
return serviceOrderBizService.cancelOrder(dto, userId) == 1 ? success() : fail("取消失败");
}
@ApiOperation(value = "订单流程图")
@GetMapping("process/{id}")
public Result<List<ServiceOrderLogVO>> process(@ApiParam(name = "id", value = "订单id") @PathVariable @Positive Long id, @CurrentUserId Long userId) {
return success(serviceOrderService.process(id, userId));
return success(serviceOrderBizService.process(id, userId));
}
}
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