|
|
@@ -13,6 +13,9 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
@@ -80,11 +83,27 @@ public class WorkOrderController {
|
|
|
|
|
|
@ApiOperation(value = "根据id中止运单(运单分页列表PC端)", notes = "必传参数:id,orderStatus=60")
|
|
|
@PostMapping("/stop")
|
|
|
- public Result stop(@RequestBody WorkOrder param) {
|
|
|
- log.info("根据id中止运单(运单分页列表PC端),调用/tms/work_order/stop,参数:{}", JSON.toJSONString(param));
|
|
|
+ public Result stop(@RequestHeader(value = "userId") Long userId,
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
+ @RequestBody WorkOrder param) {
|
|
|
if (param == null || param.getId() == null || param.getOrderStatus() != 60) {
|
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ if (param == null || param.getSpotId() == null) {
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
+ }
|
|
|
+ String utf8Name = userName;
|
|
|
+ try {
|
|
|
+ utf8Name = URLDecoder.decode(userName, "UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException ignored) {
|
|
|
+ }
|
|
|
+ param.setUpdater(userId);
|
|
|
+ param.setUpdaterName(utf8Name);
|
|
|
+ param.setUpdateDate(LocalDateTime.now());
|
|
|
+
|
|
|
+ log.info("根据id中止运单(运单分页列表PC端),调用/tms/work_order/stop,参数:{}", JSON.toJSONString(param));
|
|
|
+
|
|
|
WorkOrder workOrder = workOrderService.getById(param);
|
|
|
if (workOrder.getOrderStatus() != 0 && workOrder.getOrderStatus() != 10 && workOrder.getOrderStatus() != 20) {
|
|
|
return new Result<>(ErrCodeEnum.NO_STOP.getCode(), ErrCodeEnum.NO_STOP.getMessage());
|
|
|
@@ -94,11 +113,27 @@ public class WorkOrderController {
|
|
|
|
|
|
@ApiOperation(value = "根据id关闭运单(运单分页列表PC端)", notes = "必传参数:id,orderStatus=50")
|
|
|
@PostMapping("/close")
|
|
|
- public Result close(@RequestBody WorkOrder param) {
|
|
|
- log.info("根据id中止运单(运单分页列表PC端),调用/tms/work_order/close,参数:{}", JSON.toJSONString(param));
|
|
|
+ public Result close(@RequestHeader(value = "userId") Long userId,
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
+ @RequestBody WorkOrder param) {
|
|
|
if (param == null || param.getId() == null || param.getOrderStatus() != 50) {
|
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ if (param == null || param.getSpotId() == null) {
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
+ }
|
|
|
+ String utf8Name = userName;
|
|
|
+ try {
|
|
|
+ utf8Name = URLDecoder.decode(userName, "UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException ignored) {
|
|
|
+ }
|
|
|
+ param.setUpdater(userId);
|
|
|
+ param.setUpdaterName(utf8Name);
|
|
|
+ param.setUpdateDate(LocalDateTime.now());
|
|
|
+
|
|
|
+ log.info("根据id中止运单(运单分页列表PC端),调用/tms/work_order/close,参数:{}", JSON.toJSONString(param));
|
|
|
+
|
|
|
WorkOrder workOrder = workOrderService.getById(param);
|
|
|
if (workOrder.getOrderStatus() != 40) {
|
|
|
return new Result<>(ErrCodeEnum.NO_CLOSE.getCode(), ErrCodeEnum.NO_CLOSE.getMessage());
|
|
|
@@ -106,15 +141,30 @@ public class WorkOrderController {
|
|
|
return new Result<>(workOrderService.saveOrUpdate(param));
|
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "根据id修改运单(运单分页列表PC端,已完成40已关闭50运单可改)", notes = "必传参数:id,orderStatus=60")
|
|
|
+ @ApiOperation(value = "根据id修改运单(运单分页列表PC端,待执行0已完成40已关闭50运单可改)", notes = "必传参数:id,orderStatus=60")
|
|
|
@PostMapping("/pc_update")
|
|
|
- public Result pcUpdate(@RequestBody WorkOrder param) {
|
|
|
- log.info("根据id修改运单(运单分页列表PC端,已完成已关闭运单可改),调用/tms/work_order/pc_update,参数:{}", JSON.toJSONString(param));
|
|
|
+ public Result pcUpdate(@RequestHeader(value = "userId") Long userId,
|
|
|
+ @RequestHeader(value = "userName") String userName,
|
|
|
+ @RequestBody WorkOrder param) {
|
|
|
if (param == null || param.getId() == null || param.getOrderStatus() != 50) {
|
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
}
|
|
|
+
|
|
|
+ if (param == null || param.getSpotId() == null) {
|
|
|
+ return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
+ }
|
|
|
+ String utf8Name = userName;
|
|
|
+ try {
|
|
|
+ utf8Name = URLDecoder.decode(userName, "UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException ignored) {
|
|
|
+ }
|
|
|
+ param.setUpdater(userId);
|
|
|
+ param.setUpdaterName(utf8Name);
|
|
|
+ param.setUpdateDate(LocalDateTime.now());
|
|
|
+ log.info("根据id修改运单(运单分页列表PC端,已完成已关闭运单可改),调用/tms/work_order/pc_update,参数:{}", JSON.toJSONString(param));
|
|
|
+
|
|
|
WorkOrder workOrder = workOrderService.getById(param);
|
|
|
- if (workOrder.getOrderStatus() != 40 && workOrder.getOrderStatus() != 50) {
|
|
|
+ if (workOrder.getOrderStatus() != 0 || workOrder.getOrderStatus() != 40 && workOrder.getOrderStatus() != 50) {
|
|
|
return new Result<>(ErrCodeEnum.NO_UPDATE.getCode(), ErrCodeEnum.NO_UPDATE.getMessage());
|
|
|
}
|
|
|
return new Result<>(workOrderService.saveOrUpdate(param));
|