Commit ddfa163d authored by lining's avatar lining

feat: 订单状态接口

parent 55900ee5
package com.onsiteservice.constant.constant;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Lists;
import java.util.List;
import java.util.Map;
/**
* 业务常量
*/
......@@ -14,6 +20,19 @@ public class BizConstants {
public static final String ORDER_ID = "orderId";
public static final String ORDER_STATUS = "orderStatus";
public static final long TIMEOUT_CANCEL_LIMIT = 1000 * 60 * 30;
/**
* 前后端订单状态映射
*/
public static final Map<Integer, List<Integer>> FRONT_BACK_ORDER_STATUS_MAP = ImmutableMap.<Integer, List<Integer>>builder()
.put(0, Lists.newArrayList(1, 2, 3, 4, 5, 6, 7)) // 全部
.put(1, Lists.newArrayList(1, 2)) // 待受理
.put(3, Lists.newArrayList(3)) // 待支付
.put(4, Lists.newArrayList(4)) // 待派单
.put(5, Lists.newArrayList(5)) // 服务中
.put(6, Lists.newArrayList(6)) // 已完成
.build();
}
public static class FormatConstants {
......
......@@ -32,6 +32,8 @@ public enum BizCodeEnum {
SERVICE_ORDER_CANNOT_REDISPATCH("订单未指派维修工,不能修改"),
SERVICE_ORDER_TIMEOUT_CANNOT_DISPATCH("已过上门维修时间,不能派维修工"),
SERVICE_ORDER_CANNOT_FINISH("订单未派单,不能完成本次服务"),
SERVICE_ORDER_STATUS_ERROR("请选择正确的订单状态"),
/**
* 权限相关
......
......@@ -8,6 +8,6 @@ import java.util.List;
public interface ServiceOrderMapper extends Mapper<ServiceOrder> {
List<ServiceOrder> selectServiceOrderPage(@Param("orderStatus") Integer orderStatus, String month, String keyWord, Integer roleType, Long userId);
List<ServiceOrder> selectServiceOrderPage(List<Integer> list, String month, String keyWord, Integer roleType, Long userId);
}
\ No newline at end of file
......@@ -6,10 +6,10 @@
select *
from service_order
where
1=1
<if test="orderStatus != 0">
and order_status = #{orderStatus,jdbcType=INTEGER}
</if>
order_status in
<foreach collection="list" item="orderStatus" open="(" separator="," close=")">
#{orderStatus}
</foreach>
<choose>
<when test="roleType == 0"> <!-- 普通用户 -->
and account_no = #{userId}
......
......@@ -5,8 +5,10 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NonNull;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
/**
......@@ -21,7 +23,8 @@ import javax.validation.constraints.Size;
@ApiModel("分页查询订单请求模型")
public class PageServiceOrderDTO extends PageParams {
@ApiModelProperty(value = "订单状态: 0表示全部,1表示...", required = true)
@ApiModelProperty(value = "订单状态: 0全部,1待受理,3待支付,4待派单,5服务中,6已完成", required = true)
@NotNull(message = "请选择订单状态")
private Integer orderStatus;
@ApiModelProperty(value = "月份")
......
......@@ -130,7 +130,16 @@ public class ServiceOrderBizService extends AbstractMapper<ServiceOrder> {
throw new ServiceException(BizCodeEnum.NO_AUTH);
}
List<ServiceOrder> serviceOrderList = serviceOrderMapper.selectServiceOrderPage(dto.getOrderStatus(), dto.getMonth(), dto.getKeyWord(), user.getRoleType(), userId);
if (!BizConstants.OrderConstants.FRONT_BACK_ORDER_STATUS_MAP.containsKey(dto.getOrderStatus())) {
throw new ServiceException(BizCodeEnum.SERVICE_ORDER_STATUS_ERROR);
}
List<ServiceOrder> serviceOrderList = serviceOrderMapper.selectServiceOrderPage(
BizConstants.OrderConstants.FRONT_BACK_ORDER_STATUS_MAP.get(dto.getOrderStatus()),
dto.getMonth(),
dto.getKeyWord(),
user.getRoleType(),
userId);
return ResultGenerator.success(new PageInfoVO<>(buildServiceOrderVO(serviceOrderList)));
}
......
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