Commit e09a6220 authored by lining's avatar lining

fix: order接口小bug修复

parent f51e2893
...@@ -15,7 +15,7 @@ public enum BizCodeEnum { ...@@ -15,7 +15,7 @@ public enum BizCodeEnum {
* 订单分组 * 订单分组
*/ */
SERVICE_ORDER_NOT_EXIST("订单不存在"), SERVICE_ORDER_NOT_EXIST("订单不存在"),
SERVICE_ORDER_CANNOT_VALUATION("订单未提交,不能派估价员"), SERVICE_ORDER_CANNOT_VALUATION("处于非预约状态的订单不能派估价员"),
SERVICE_ORDER_CANNOT_REVALUATION("订单未指派估价员,不能修改"), SERVICE_ORDER_CANNOT_REVALUATION("订单未指派估价员,不能修改"),
SERVICE_ORDER_CANNOT_SEND("订单未受理,不能发送给客户"), SERVICE_ORDER_CANNOT_SEND("订单未受理,不能发送给客户"),
SERVICE_ORDER_CANNOT_PAY("订单未受理,暂不能支付"), SERVICE_ORDER_CANNOT_PAY("订单未受理,暂不能支付"),
......
...@@ -26,7 +26,7 @@ public enum ServiceOrderStatusEnum { ...@@ -26,7 +26,7 @@ public enum ServiceOrderStatusEnum {
/** /**
* 已发送 * 已发送
*/ */
SEND(3, "%s: %s 已发送订单信息"), SEND(3, "%s 已发送订单信息"),
/** /**
* 已支付 * 已支付
......
...@@ -10,6 +10,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -10,6 +10,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive; import javax.validation.constraints.Positive;
import java.util.List; import java.util.List;
...@@ -33,14 +34,14 @@ public class ServiceValuatorController { ...@@ -33,14 +34,14 @@ public class ServiceValuatorController {
@ApiOperation(value = "查询全部估价员") @ApiOperation(value = "查询全部估价员")
@PostMapping("all") @GetMapping("all")
public Result<List<ServiceValuatorVO>> all() { public Result<List<ServiceValuatorVO>> all() {
return success(serviceValuatorService.all()); return success(serviceValuatorService.all());
} }
@ApiOperation(value = "根据id查询") @ApiOperation(value = "根据姓名查询")
@GetMapping("get/{name}") @GetMapping("get/{name}")
public Result<List<ServiceValuatorVO>> getDetails(@ApiParam(name = "name", value = "估价员姓名") @PathVariable @Positive String name) { public Result<List<ServiceValuatorVO>> getDetails(@ApiParam(name = "name", value = "估价员姓名") @PathVariable @NotBlank String name) {
return success(serviceValuatorService.selectByName(name)); return success(serviceValuatorService.selectByName(name));
} }
......
...@@ -15,6 +15,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -15,6 +15,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Positive; import javax.validation.constraints.Positive;
import java.util.List; import java.util.List;
...@@ -40,14 +41,14 @@ public class ServiceWorkerController { ...@@ -40,14 +41,14 @@ public class ServiceWorkerController {
@ApiOperation(value = "查询全部维修工") @ApiOperation(value = "查询全部维修工")
@PostMapping("all") @GetMapping("all")
public Result<List<ServiceWorkerVO>> all() { public Result<List<ServiceWorkerVO>> all() {
return success(serviceWorkerService.all()); return success(serviceWorkerService.all());
} }
@ApiOperation(value = "根据id查询") @ApiOperation(value = "根据姓名查询")
@GetMapping("get/{id}") @GetMapping("get/{name}")
public Result<List<ServiceWorkerVO>> getDetails(@ApiParam(name = "name", value = "维修工姓名") @PathVariable @Positive String name) { public Result<List<ServiceWorkerVO>> getDetails(@ApiParam(name = "name", value = "维修工姓名") @PathVariable @NotBlank String name) {
return success(serviceWorkerService.selectByName(name)); return success(serviceWorkerService.selectByName(name));
} }
......
...@@ -232,7 +232,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -232,7 +232,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw new ServiceException(BizCodeEnum.SERVICE_ORDER_CANNOT_SEND); throw new ServiceException(BizCodeEnum.SERVICE_ORDER_CANNOT_SEND);
} }
disableServiceValuatorAssign(serviceOrder, userId, true); disableServiceValuatorAssign(serviceOrder, userId, null);
// 估价价格 // 估价价格
serviceOrder.setPrice(dto.getPrice()); serviceOrder.setPrice(dto.getPrice());
...@@ -327,7 +327,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -327,7 +327,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
User user = checkAuth(userId, BizCodeEnum.NO_AUTH_REDISPATCH_ORDER); User user = checkAuth(userId, BizCodeEnum.NO_AUTH_REDISPATCH_ORDER);
ServiceOrder serviceOrder = checkOrder(dto.getId(), null); ServiceOrder serviceOrder = checkOrder(dto.getId(), null);
if (!serviceOrder.getOrderStatus().equals(ServiceOrderStatusEnum.PAY.getStatus())) { if (!serviceOrder.getOrderStatus().equals(ServiceOrderStatusEnum.DISPATCH.getStatus())) {
throw new ServiceException(BizCodeEnum.SERVICE_ORDER_CANNOT_REDISPATCH); throw new ServiceException(BizCodeEnum.SERVICE_ORDER_CANNOT_REDISPATCH);
} }
...@@ -372,7 +372,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -372,7 +372,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw new ServiceException(BizCodeEnum.NO_AUTH_FINISH_ORDER); throw new ServiceException(BizCodeEnum.NO_AUTH_FINISH_ORDER);
} }
disableServiceWorkerAssign(serviceOrder, userId, true); disableServiceWorkerAssign(serviceOrder, userId, null);
serviceOrder.setOrderStatus(ServiceOrderStatusEnum.FINISH.getStatus()); serviceOrder.setOrderStatus(ServiceOrderStatusEnum.FINISH.getStatus());
serviceOrder.setModifyBy(userId); serviceOrder.setModifyBy(userId);
...@@ -396,7 +396,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -396,7 +396,7 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
throw new ServiceException(BizCodeEnum.SERVICE_ORDER_CANNOT_CANCEL); throw new ServiceException(BizCodeEnum.SERVICE_ORDER_CANNOT_CANCEL);
} }
disableServiceValuatorAssign(serviceOrder, userId, true); disableServiceValuatorAssign(serviceOrder, userId, null);
serviceOrder.setOrderStatus(ServiceOrderStatusEnum.CANCEL.getStatus()); serviceOrder.setOrderStatus(ServiceOrderStatusEnum.CANCEL.getStatus());
serviceOrder.setModifyBy(userId); serviceOrder.setModifyBy(userId);
...@@ -498,11 +498,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -498,11 +498,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
* @param userId 用户id * @param userId 用户id
* @param finalExecuted 逻辑上谁最有可能是最终的上门人员 * @param finalExecuted 逻辑上谁最有可能是最终的上门人员
*/ */
public void disableServiceValuatorAssign(ServiceOrder serviceOrder, Long userId, boolean finalExecuted) { public void disableServiceValuatorAssign(ServiceOrder serviceOrder, Long userId, Boolean finalExecuted) {
ServiceValuatorAssign serviceValuatorAssign = new ServiceValuatorAssign(); ServiceValuatorAssign serviceValuatorAssign = new ServiceValuatorAssign();
serviceValuatorAssign.setModifyBy(userId); serviceValuatorAssign.setModifyBy(userId);
serviceValuatorAssign.setDeleted(true); serviceValuatorAssign.setDeleted(true);
if (finalExecuted != null) {
serviceValuatorAssign.setFinalExecuted(finalExecuted); serviceValuatorAssign.setFinalExecuted(finalExecuted);
}
Condition c = new Condition(ServiceValuatorAssign.class); Condition c = new Condition(ServiceValuatorAssign.class);
c.createCriteria().andEqualTo(BizConstants.OrderConstants.ORDER_ID, serviceOrder.getId()); c.createCriteria().andEqualTo(BizConstants.OrderConstants.ORDER_ID, serviceOrder.getId());
...@@ -532,11 +534,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> { ...@@ -532,11 +534,13 @@ public class ServiceOrderService extends AbstractMapper<ServiceOrder> {
* @param serviceOrder 订单 * @param serviceOrder 订单
* @param userId 用户id * @param userId 用户id
*/ */
public void disableServiceWorkerAssign(ServiceOrder serviceOrder, Long userId, boolean finalExecuted) { public void disableServiceWorkerAssign(ServiceOrder serviceOrder, Long userId, Boolean finalExecuted) {
ServiceWorkerAssign serviceWorkerAssign = new ServiceWorkerAssign(); ServiceWorkerAssign serviceWorkerAssign = new ServiceWorkerAssign();
serviceWorkerAssign.setModifyBy(userId); serviceWorkerAssign.setModifyBy(userId);
serviceWorkerAssign.setDeleted(true); serviceWorkerAssign.setDeleted(true);
if (finalExecuted != null) {
serviceWorkerAssign.setFinalExecuted(finalExecuted); serviceWorkerAssign.setFinalExecuted(finalExecuted);
}
Condition c = new Condition(ServiceWorkerAssign.class); Condition c = new Condition(ServiceWorkerAssign.class);
c.createCriteria().andEqualTo(BizConstants.OrderConstants.ORDER_ID, serviceOrder.getId()); c.createCriteria().andEqualTo(BizConstants.OrderConstants.ORDER_ID, serviceOrder.getId());
......
...@@ -74,7 +74,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> { ...@@ -74,7 +74,7 @@ public class ServiceValuatorService extends AbstractMapper<ServiceValuator> {
serviceValuatorVO.setAssignTime(assignTimes); serviceValuatorVO.setAssignTime(assignTimes);
return new ServiceValuatorVO(); return serviceValuatorVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
......
...@@ -70,7 +70,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> { ...@@ -70,7 +70,7 @@ public class ServiceWorkerService extends AbstractMapper<ServiceWorker> {
serviceWorkerVO.setAssignTime(assignTimes); serviceWorkerVO.setAssignTime(assignTimes);
return new ServiceWorkerVO(); return serviceWorkerVO;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
......
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