提交 ce313a71 authored 作者: 邓砥奕's avatar 邓砥奕

[参数检验]添加了接口的参数检验

上级 bd425e6f
...@@ -28,6 +28,7 @@ import org.springframework.beans.BeanUtils; ...@@ -28,6 +28,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -77,7 +78,7 @@ public class AllotBackBillController { ...@@ -77,7 +78,7 @@ public class AllotBackBillController {
@ApiOperation(value = "发起配发退回业务", notes = "可以通过这个接口发起配发退回任务") @ApiOperation(value = "发起配发退回业务", notes = "可以通过这个接口发起配发退回任务")
@PostMapping(value = "/back") @PostMapping(value = "/back")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity allotBack(@RequestBody AllotBackBillSaveVo allotBackBillSaveVo) { public ResponseEntity allotBack(@RequestBody @Validated AllotBackBillSaveVo allotBackBillSaveVo) {
//获取当前配发退回task //获取当前配发退回task
TaskBto taskBto = taskService.get(allotBackBillSaveVo.getTaskId()); TaskBto taskBto = taskService.get(allotBackBillSaveVo.getTaskId());
//获取父配发业务 //获取父配发业务
...@@ -141,7 +142,7 @@ public class AllotBackBillController { ...@@ -141,7 +142,7 @@ public class AllotBackBillController {
@ApiOperation(value = "配发退回接收", notes = "可以通过这个接口配发退回接收") @ApiOperation(value = "配发退回接收", notes = "可以通过这个接口配发退回接收")
@PostMapping(value = "/back/receive") @PostMapping(value = "/back/receive")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity allotBackReceive(@RequestBody AllotBackReceiveVo allotBackReceiveVo) { public ResponseEntity allotBackReceive(@RequestBody @Validated AllotBackReceiveVo allotBackReceiveVo) {
//获取当前任务和账单 //获取当前任务和账单
TaskBto taskBto = taskService.get(allotBackReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(allotBackReceiveVo.getTaskId());
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId()); AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
...@@ -193,7 +194,7 @@ public class AllotBackBillController { ...@@ -193,7 +194,7 @@ public class AllotBackBillController {
@ApiOperation(value = "配发退回接收审核", notes = "可以通过这个接口配发退回接收审核") @ApiOperation(value = "配发退回接收审核", notes = "可以通过这个接口配发退回接收审核")
@PostMapping(value = "/back/receive/confirm") @PostMapping(value = "/back/receive/confirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity backReceiveConfirm(@RequestBody AllotReceiveConfirmVo allotReceiveConfirmVo) { public ResponseEntity backReceiveConfirm(@RequestBody @Validated AllotReceiveConfirmVo allotReceiveConfirmVo) {
//获取当前的账单和任务 //获取当前的账单和任务
TaskBto taskBto = taskService.get(allotReceiveConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(allotReceiveConfirmVo.getTaskId());
AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId()); AllotBackBill allotBackBill = allotBackBillService.getOne(taskBto.getBillId());
......
...@@ -30,6 +30,7 @@ import org.springframework.beans.BeanUtils; ...@@ -30,6 +30,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -79,7 +80,7 @@ public class AllotBillController { ...@@ -79,7 +80,7 @@ public class AllotBillController {
@ApiOperation(value = "发起配发业务", notes = "可以通过这个接口发起配发任务") @ApiOperation(value = "发起配发业务", notes = "可以通过这个接口发起配发任务")
@PostMapping(value = "/addAllotBill") @PostMapping(value = "/addAllotBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addAllotBill(@RequestBody AllotBillSaveVo allotBillSaveVo) { public ResponseEntity addAllotBill(@RequestBody @Validated AllotBillSaveVo allotBillSaveVo) {
//1.添加配发单 //1.添加配发单
AllotBill a = allotBillSaveVo.toDo(); AllotBill a = allotBillSaveVo.toDo();
a.setSendUseraId(userUtils.getCurrentUserId()); a.setSendUseraId(userUtils.getCurrentUserId());
...@@ -118,7 +119,7 @@ public class AllotBillController { ...@@ -118,7 +119,7 @@ public class AllotBillController {
@ApiOperation(value = "配发审核", notes = "可以通过这个接口对配发审核") @ApiOperation(value = "配发审核", notes = "可以通过这个接口对配发审核")
@PostMapping(value = "/allotConfirm") @PostMapping(value = "/allotConfirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity allotConfirm(@RequestBody AllotBillConfirmVo allotBillConfirmVo) { public ResponseEntity allotConfirm(@RequestBody @Validated AllotBillConfirmVo allotBillConfirmVo) {
TaskBto taskBto = taskService.get(allotBillConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(allotBillConfirmVo.getTaskId());
//1.审核通过,改变装备状态,审核任务完成,发起新的配发接收任务 //1.审核通过,改变装备状态,审核任务完成,发起新的配发接收任务
if (allotBillConfirmVo.getStatus() == 0) { if (allotBillConfirmVo.getStatus() == 0) {
...@@ -183,7 +184,7 @@ public class AllotBillController { ...@@ -183,7 +184,7 @@ public class AllotBillController {
@ApiOperation(value = "接收配发装备", notes = "可以通过这个接口接收配发装备") @ApiOperation(value = "接收配发装备", notes = "可以通过这个接口接收配发装备")
@PostMapping(value = "/receiveDevice") @PostMapping(value = "/receiveDevice")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity receiveDevice(@RequestBody AllotReceiveVo allotReceiveVo) { public ResponseEntity receiveDevice(@RequestBody @Validated AllotReceiveVo allotReceiveVo) {
//获取当前任务 //获取当前任务
TaskBto taskBto = taskService.get(allotReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(allotReceiveVo.getTaskId());
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
...@@ -235,7 +236,7 @@ public class AllotBillController { ...@@ -235,7 +236,7 @@ public class AllotBillController {
@ApiOperation(value = "接收配发装备审核", notes = "可以通过这个接口对接收配发装备审核") @ApiOperation(value = "接收配发装备审核", notes = "可以通过这个接口对接收配发装备审核")
@PostMapping(value = "/receiveConfirm") @PostMapping(value = "/receiveConfirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity receiveConfirm(@RequestBody AllotReceiveConfirmVo allotReceiveConfirmVo) { public ResponseEntity receiveConfirm(@RequestBody @Validated AllotReceiveConfirmVo allotReceiveConfirmVo) {
//获取任务和账单 //获取任务和账单
TaskBto taskBto = taskService.get(allotReceiveConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(allotReceiveConfirmVo.getTaskId());
AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId()); AllotBill allotBillEntity = allotBillService.getOne(taskBto.getBillId());
......
...@@ -6,6 +6,10 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,10 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -13,39 +17,53 @@ import org.springframework.beans.BeanUtils; ...@@ -13,39 +17,53 @@ import org.springframework.beans.BeanUtils;
@ApiModel("配发退回单存储类") @ApiModel("配发退回单存储类")
public class AllotBackBillSaveVo { public class AllotBackBillSaveVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(name = "配发退回业务主键id") @ApiModelProperty(name = "配发退回业务主键id")
private Integer taskId; private Integer taskId;
@NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号") @ApiModelProperty(value = "申请文号")
private String applyNumber; private String applyNumber;
@NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号") @ApiModelProperty(value = "批复文号")
private String replayNumber; private String replayNumber;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发件单位") @ApiModelProperty(value = "发件单位")
private String sendUnit; private String sendUnit;
@NotNull(message = "receiveUnit不能为空")
@ApiModelProperty(value = "接收单位") @ApiModelProperty(value = "接收单位")
private String receiveUnit; private String receiveUnit;
@NotNull(message = "receiveUseraId不能为空")
@Min(value = 1,message = "receiveUseraId不能小于1")
@ApiModelProperty(value = "收件方(A岗位)") @ApiModelProperty(value = "收件方(A岗位)")
private Integer receiveUseraId; private Integer receiveUseraId;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "账单文件名") @ApiModelProperty(value = "账单文件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "账单文件地址URL") @ApiModelProperty(value = "账单文件地址URL")
private String fileUrl; private String fileUrl;
@NotNull(message = "backCount不能为空")
@ApiModelProperty(value = "退回设备数量") @ApiModelProperty(value = "退回设备数量")
private Integer backCount; private Integer backCount;
@NotNull(message = "backedCount不能为空")
@ApiModelProperty(value = "已退回设备数量") @ApiModelProperty(value = "已退回设备数量")
private Integer backedCount; private Integer backedCount;
@NotBlank(message = "backCheckDetail不能为空")
@ApiModelProperty(value = "退回出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)") @ApiModelProperty(value = "退回出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)")
private String backCheckDetail; private String backCheckDetail;
@NotBlank(message = "backCheckResult不能为空")
@ApiModelProperty(value = "退回出库检查结果") @ApiModelProperty(value = "退回出库检查结果")
private String backCheckResult; private String backCheckResult;
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,30 +14,41 @@ import lombok.Data; ...@@ -11,30 +14,41 @@ import lombok.Data;
@ApiModel("配发接收类") @ApiModel("配发接收类")
public class AllotBackReceiveVo { public class AllotBackReceiveVo {
@NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字") @ApiModelProperty(value = "配发单附件名字")
private String billFileName; private String billFileName;
@NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL") @ApiModelProperty(value = "配发单附件URL")
private String billFileUrl; private String billFileUrl;
@NotNull(message = "receiveFileName不能为空")
@ApiModelProperty(value = "入库附件名字") @ApiModelProperty(value = "入库附件名字")
private String receiveFileName; private String receiveFileName;
@NotNull(message = "receiveFileUrl不能为空")
@ApiModelProperty(value = "入库附件URL") @ApiModelProperty(value = "入库附件URL")
private String receiveFileUrl; private String receiveFileUrl;
@NotNull(message = "receiveCount不能为空")
@ApiModelProperty(value = "接收入库数量") @ApiModelProperty(value = "接收入库数量")
private Integer receiveCount; private Integer receiveCount;
@NotNull(message = "receiveCheckDetail不能为空")
@ApiModelProperty(value = "接收入库检查详情") @ApiModelProperty(value = "接收入库检查详情")
private String receiveCheckDetail; private String receiveCheckDetail;
@NotNull(message = "receiveCheckResult不能为空")
@ApiModelProperty(value = "接收入库检查结果") @ApiModelProperty(value = "接收入库检查结果")
private String receiveCheckResult; private String receiveCheckResult;
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,9 +14,13 @@ import lombok.Data; ...@@ -11,9 +14,13 @@ import lombok.Data;
@ApiModel("配发审核类") @ApiModel("配发审核类")
public class AllotBillConfirmVo { public class AllotBillConfirmVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@Min(value = 1,message = "status不能小于1")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
} }
...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -16,45 +19,60 @@ public class AllotBillSaveVo { ...@@ -16,45 +19,60 @@ public class AllotBillSaveVo {
@ApiModelProperty(value = "配发标题") @ApiModelProperty(value = "配发标题")
private String title; private String title;
@NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号") @ApiModelProperty(value = "申请文号")
private String applyNumber; private String applyNumber;
@NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号") @ApiModelProperty(value = "批复文号")
private String replayNumber; private String replayNumber;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "配发单位") @ApiModelProperty(value = "配发单位")
private String sendUnit; private String sendUnit;
@NotNull(message = "receiveUnit不能为空")
@ApiModelProperty(value = "接收单位") @ApiModelProperty(value = "接收单位")
private String receiveUnit; private String receiveUnit;
@NotNull(message = "sendUserbId不能为空")
@Min(value = 1,message = "sendUserbId不能小于1")
@ApiModelProperty(value = "发件方(B岗位)") @ApiModelProperty(value = "发件方(B岗位)")
private Integer sendUserbId; private Integer sendUserbId;
@NotNull(message = "receiveUseraId不能为空")
@Min(value = 1,message = "receiveUseraId不能小于1")
@ApiModelProperty(value = "收件方(A岗位)") @ApiModelProperty(value = "收件方(A岗位)")
private Integer receiveUseraId; private Integer receiveUseraId;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "账单文件名") @ApiModelProperty(value = "账单文件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "账单文件地址URL") @ApiModelProperty(value = "账单文件地址URL")
private String fileUrl; private String fileUrl;
@NotNull(message = "allotCount不能为空")
@ApiModelProperty(value = "配发设备数量") @ApiModelProperty(value = "配发设备数量")
private Integer allotCount; private Integer allotCount;
@NotNull(message = "allotedCount不能为空")
@ApiModelProperty(value = "已配发设备数量") @ApiModelProperty(value = "已配发设备数量")
private Integer allotedCount; private Integer allotedCount;
@NotNull(message = "allotCheckDetail不能为空")
@ApiModelProperty(value = "配发出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)") @ApiModelProperty(value = "配发出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)")
private String allotCheckDetail; private String allotCheckDetail;
@NotNull(message = "allotCheckResult不能为空")
@ApiModelProperty(value = "配发出库检查结果") @ApiModelProperty(value = "配发出库检查结果")
private String allotCheckResult; private String allotCheckResult;
@ApiModelProperty(value = "签发人") @ApiModelProperty(value = "签发人")
private String agent; private String agent;
@NotNull(message = "allotType不能为空")
@ApiModelProperty(value = "入库类型") @ApiModelProperty(value = "入库类型")
private Integer allotType; private Integer allotType;
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,9 +14,13 @@ import lombok.Data; ...@@ -11,9 +14,13 @@ import lombok.Data;
@ApiModel("配发接收审核类") @ApiModel("配发接收审核类")
public class AllotReceiveConfirmVo { public class AllotReceiveConfirmVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@Min(value = 1,message = "status不能小于1")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
} }
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,30 +14,41 @@ import lombok.Data; ...@@ -11,30 +14,41 @@ import lombok.Data;
@ApiModel("配发接收类") @ApiModel("配发接收类")
public class AllotReceiveVo { public class AllotReceiveVo {
@NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字") @ApiModelProperty(value = "配发单附件名字")
private String billFileName; private String billFileName;
@NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL") @ApiModelProperty(value = "配发单附件URL")
private String billFileUrl; private String billFileUrl;
@NotNull(message = "receiveFileName不能为空")
@ApiModelProperty(value = "入库附件名字") @ApiModelProperty(value = "入库附件名字")
private String receiveFileName; private String receiveFileName;
@NotNull(message = "receiveFileUrl不能为空")
@ApiModelProperty(value = "入库附件URL") @ApiModelProperty(value = "入库附件URL")
private String receiveFileUrl; private String receiveFileUrl;
@NotNull(message = "receiveCount不能为空")
@ApiModelProperty(value = "接收入库数量") @ApiModelProperty(value = "接收入库数量")
private Integer receiveCount; private Integer receiveCount;
@NotNull(message = "receiveCheckDetail不能为空")
@ApiModelProperty(value = "接收入库检查详情") @ApiModelProperty(value = "接收入库检查详情")
private String receiveCheckDetail; private String receiveCheckDetail;
@NotNull(message = "receiveCheckResult不能为空")
@ApiModelProperty(value = "接收入库检查结果") @ApiModelProperty(value = "接收入库检查结果")
private String receiveCheckResult; private String receiveCheckResult;
......
...@@ -38,6 +38,7 @@ import org.springframework.beans.BeanUtils; ...@@ -38,6 +38,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
...@@ -89,7 +90,7 @@ public class DeviceApplyController { ...@@ -89,7 +90,7 @@ public class DeviceApplyController {
@ApiOperation(value = "发起装备申请", notes = "可以通过这个接口发起装备申请") @ApiOperation(value = "发起装备申请", notes = "可以通过这个接口发起装备申请")
@PostMapping("/addDeviceApplyBill") @PostMapping("/addDeviceApplyBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addDeviceApplyBill(@RequestBody DeviceApplySaveVo deviceApplySaveVo) { public ResponseEntity addDeviceApplyBill(@RequestBody @Validated DeviceApplySaveVo deviceApplySaveVo) {
//添加申请单 //添加申请单
DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(deviceApplySaveVo.toDo()); DeviceApplyBill deviceApplyBillEntity = deviceApplyBillService.addEntity(deviceApplySaveVo.toDo());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
...@@ -118,7 +119,7 @@ public class DeviceApplyController { ...@@ -118,7 +119,7 @@ public class DeviceApplyController {
@ApiOperation(value = "装备申请批复", notes = "可以通过这个接口批复") @ApiOperation(value = "装备申请批复", notes = "可以通过这个接口批复")
@PostMapping("/replay") @PostMapping("/replay")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addDeviceApplyBillReplay(@RequestBody DeviceApplyConfirmVo deviceApplyConfirmVo) { public ResponseEntity addDeviceApplyBillReplay(@RequestBody @Validated DeviceApplyConfirmVo deviceApplyConfirmVo) {
TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(deviceApplyConfirmVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId()); DeviceApplyBill applyBillEntity = deviceApplyBillService.getOne(taskBto.getBillId());
...@@ -156,7 +157,7 @@ public class DeviceApplyController { ...@@ -156,7 +157,7 @@ public class DeviceApplyController {
@ApiOperation(value = "装备申请后发起配发", notes = "可以通过这个接口装备申请后发起配发") @ApiOperation(value = "装备申请后发起配发", notes = "可以通过这个接口装备申请后发起配发")
@PostMapping("/allot") @PostMapping("/allot")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity allot(@RequestBody DeviceApplyAllotSaveVo deviceApplyAllotSaveVo) { public ResponseEntity allot(@RequestBody @Validated DeviceApplyAllotSaveVo deviceApplyAllotSaveVo) {
//获取配发的业务 //获取配发的业务
TaskBto taskBto = taskService.get(deviceApplyAllotSaveVo.getTaskId()); TaskBto taskBto = taskService.get(deviceApplyAllotSaveVo.getTaskId());
//获取申请的业务 //获取申请的业务
......
...@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -15,8 +17,14 @@ public class ApplyBillDetailVo { ...@@ -15,8 +17,14 @@ public class ApplyBillDetailVo {
@ApiModelProperty(value = "配件列表") @ApiModelProperty(value = "配件列表")
List<ApplyBillDetailVo> list; List<ApplyBillDetailVo> list;
@NotNull(message = "packingId不能为空")
@Min(value = 1,message = "packingId不能小于1")
@ApiModelProperty(value = "列装id") @ApiModelProperty(value = "列装id")
private Integer packingId; private Integer packingId;
@NotNull(message = "storageCount不能为空")
@Min(value = 1,message = "storageCount不能小于1")
@ApiModelProperty(value = "申请数量") @ApiModelProperty(value = "申请数量")
private Integer storageCount; private Integer storageCount;
} }
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,27 +14,37 @@ import lombok.Data; ...@@ -11,27 +14,37 @@ import lombok.Data;
@ApiModel("申请后配发类") @ApiModel("申请后配发类")
public class DeviceApplyAllotSaveVo { public class DeviceApplyAllotSaveVo {
@NotNull(message = "sendUserbId不能为空")
@Min(value = 1,message = "sendUserbId不能小于1")
@ApiModelProperty(value = "发件方(B岗位)") @ApiModelProperty(value = "发件方(B岗位)")
private Integer sendUserbId; private Integer sendUserbId;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "账单文件名") @ApiModelProperty(value = "账单文件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "账单文件地址URL") @ApiModelProperty(value = "账单文件地址URL")
private String fileUrl; private String fileUrl;
@NotNull(message = "allotCount不能为空")
@ApiModelProperty(value = "配发设备数量") @ApiModelProperty(value = "配发设备数量")
private Integer allotCount; private Integer allotCount;
@NotNull(message = "allotedCount不能为空")
@ApiModelProperty(value = "已配发设备数量") @ApiModelProperty(value = "已配发设备数量")
private Integer allotedCount; private Integer allotedCount;
@NotNull(message = "allotCheckDetail不能为空")
@ApiModelProperty(value = "配发出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)") @ApiModelProperty(value = "配发出库检查详情(装备主键id+核对结果(0缺失1无误3不匹配,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的不匹配)")
private String allotCheckDetail; private String allotCheckDetail;
@NotNull(message = "allotCheckResult不能为空")
@ApiModelProperty(value = "配发出库检查结果") @ApiModelProperty(value = "配发出库检查结果")
private String allotCheckResult; private String allotCheckResult;
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "对应任务ID", example = "1") @ApiModelProperty(value = "对应任务ID", example = "1")
private Integer taskId; private Integer taskId;
......
...@@ -4,15 +4,22 @@ import io.swagger.annotations.ApiModel; ...@@ -4,15 +4,22 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
@Data @Data
@ApiModel("申请审核类") @ApiModel("申请审核类")
public class DeviceApplyConfirmVo { public class DeviceApplyConfirmVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "对应任务ID", example = "1") @ApiModelProperty(value = "对应任务ID", example = "1")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@Min(value = 1,message = "status不能小于1")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
......
...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -15,27 +18,35 @@ import java.util.List; ...@@ -15,27 +18,35 @@ import java.util.List;
@ApiModel("装备申请存储类") @ApiModel("装备申请存储类")
public class DeviceApplySaveVo { public class DeviceApplySaveVo {
@NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号") @ApiModelProperty(value = "申请文号")
private String applyNumber; private String applyNumber;
@NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号") @ApiModelProperty(value = "批复文号")
private String replayNumber; private String replayNumber;
@NotNull(message = "applyUnit不能为空")
@ApiModelProperty(value = "申请单位") @ApiModelProperty(value = "申请单位")
private String applyUnit; private String applyUnit;
@NotNull(message = "replyUnit不能为空")
@ApiModelProperty(value = "批复单位") @ApiModelProperty(value = "批复单位")
private String replyUnit; private String replyUnit;
@ApiModelProperty(value = "经办人") @ApiModelProperty(value = "经办人")
private String agent; private String agent;
@NotNull(message = "applyUseraId不能为空")
@Min(value = 1,message = "applyUseraId不能小于1")
@ApiModelProperty(value = "申请人id") @ApiModelProperty(value = "申请人id")
private Integer applyUseraId; private Integer applyUseraId;
@Min(value = 1,message = "replyUseraId不能小于1")
@ApiModelProperty(value = "批复人id") @ApiModelProperty(value = "批复人id")
private Integer replyUseraId; private Integer replyUseraId;
@NotEmpty(message = "storageBillDetailVoList不能为空")
@ApiModelProperty(value = "入库列装数量详情") @ApiModelProperty(value = "入库列装数量详情")
private List<ApplyBillDetailVo> storageBillDetailVoList; private List<ApplyBillDetailVo> storageBillDetailVoList;
......
...@@ -192,7 +192,7 @@ public class DeviceDestroyController { ...@@ -192,7 +192,7 @@ public class DeviceDestroyController {
@ApiOperation(value = "上传销毁单", notes = "可以通过这个上传销毁单") @ApiOperation(value = "上传销毁单", notes = "可以通过这个上传销毁单")
@PostMapping(value = "/upload") @PostMapping(value = "/upload")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity uploadDestroyFile(@RequestBody UploadDestroyFileVo uploadDestroyFileVo) { public ResponseEntity uploadDestroyFile(@RequestBody @Validated UploadDestroyFileVo uploadDestroyFileVo) {
//获取当前task //获取当前task
TaskBto taskBto = taskService.get(uploadDestroyFileVo.getTaskId()); TaskBto taskBto = taskService.get(uploadDestroyFileVo.getTaskId());
//获取销毁单 //获取销毁单
......
...@@ -3,6 +3,7 @@ package com.tykj.dev.device.destroy.entity.vo; ...@@ -3,6 +3,7 @@ package com.tykj.dev.device.destroy.entity.vo;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
...@@ -15,17 +16,19 @@ import java.util.List; ...@@ -15,17 +16,19 @@ import java.util.List;
@Data @Data
public class DeviceDestroyFormVo { public class DeviceDestroyFormVo {
@NotNull @NotNull(message = "confirmUserId不能为空")
@ApiModelProperty(value = "待审核人ID", example = "1") @ApiModelProperty(value = "待审核人ID", example = "1")
private Integer confirmUserId; private Integer confirmUserId;
@NotNull @NotEmpty(message = "devices不能为空")
@ApiModelProperty(value = "装备列表") @ApiModelProperty(value = "装备列表")
private List<Integer> devices; private List<Integer> devices;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "文件名称", example = "文件X") @ApiModelProperty(value = "文件名称", example = "文件X")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "文件URL", example = "/images/xxxxx") @ApiModelProperty(value = "文件URL", example = "/images/xxxxx")
private String fileUrl; private String fileUrl;
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,12 +14,16 @@ import lombok.Data; ...@@ -11,12 +14,16 @@ import lombok.Data;
@Data @Data
public class UploadDestroyFileVo { public class UploadDestroyFileVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(name = "业务id") @ApiModelProperty(name = "业务id")
private Integer taskId; private Integer taskId;
@NotNull(message = "destroyFileName不能为空")
@ApiModelProperty(value = "销毁附件文件名") @ApiModelProperty(value = "销毁附件文件名")
private String destroyFileName; private String destroyFileName;
@NotNull(message = "destroyFileUrl不能为空")
@ApiModelProperty(value = "销毁附件文件地址URL") @ApiModelProperty(value = "销毁附件文件地址URL")
private String destroyFileUrl; private String destroyFileUrl;
} }
...@@ -18,8 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,8 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Min;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
...@@ -32,6 +34,7 @@ import java.util.stream.Collectors; ...@@ -32,6 +34,7 @@ import java.util.stream.Collectors;
@RequestMapping(value = "/device") @RequestMapping(value = "/device")
@AutoDocument @AutoDocument
@Api(tags = "装备管理模块", description = "装备管理接口") @Api(tags = "装备管理模块", description = "装备管理接口")
@Validated
public class DeviceLibraryController { public class DeviceLibraryController {
@Autowired @Autowired
private DeviceLibraryService deviceLibraryService; private DeviceLibraryService deviceLibraryService;
...@@ -118,7 +121,7 @@ public class DeviceLibraryController { ...@@ -118,7 +121,7 @@ public class DeviceLibraryController {
@ApiOperation(value = "查询核心装备详情的详情", notes = "可以通过这个接口查询核心装备详情的详情") @ApiOperation(value = "查询核心装备详情的详情", notes = "可以通过这个接口查询核心装备详情的详情")
@GetMapping("/core/feature/detail/{id}") @GetMapping("/core/feature/detail/{id}")
public ResponseEntity getDeviceDetail(@PathVariable("id") int id) { public ResponseEntity getDeviceDetail(@PathVariable("id") @Min(value = 1,message = "id不能小于1") int id) {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(id);
DeviceDetailVo deviceDetailVo = new DeviceDetailVo(); DeviceDetailVo deviceDetailVo = new DeviceDetailVo();
List<DeviceLibrary> libraryEntities = new ArrayList<>(); List<DeviceLibrary> libraryEntities = new ArrayList<>();
...@@ -164,7 +167,7 @@ public class DeviceLibraryController { ...@@ -164,7 +167,7 @@ public class DeviceLibraryController {
@ApiOperation(value = "更新装备库", notes = "可以通过这个接口更新装备库") @ApiOperation(value = "更新装备库", notes = "可以通过这个接口更新装备库")
@PostMapping("/updateDeviceLibrary") @PostMapping("/updateDeviceLibrary")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity updateDeviceLibrary(@RequestBody DeviceEditVo deviceEditVo) { public ResponseEntity updateDeviceLibrary(@RequestBody @Validated DeviceEditVo deviceEditVo) {
DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(deviceEditVo.getDeviceId()); DeviceLibrary deviceLibraryEntity = deviceLibraryService.getOne(deviceEditVo.getDeviceId());
//更新装备信息 //更新装备信息
if (deviceEditVo.getUpdateVoList() != null) { if (deviceEditVo.getUpdateVoList() != null) {
...@@ -322,7 +325,7 @@ public class DeviceLibraryController { ...@@ -322,7 +325,7 @@ public class DeviceLibraryController {
@ApiOperation(value = "查询维修报废换新装备", notes = "查询装备") @ApiOperation(value = "查询维修报废换新装备", notes = "查询装备")
@GetMapping("/select/newChange/{id}") @GetMapping("/select/newChange/{id}")
public ResponseEntity selectNewChangeDevice(@PathVariable("id") int id) { public ResponseEntity selectNewChangeDevice(@PathVariable("id") @Min(value = 1,message = "id不能小于1") int id) {
DeviceLibrary deviceLibrary = deviceLibraryService.getOne(id); DeviceLibrary deviceLibrary = deviceLibraryService.getOne(id);
List<DeviceLibrary> deviceLibraries = deviceLibraryDao.getAllByTypeAndNameAndModel(deviceLibrary.getType(), deviceLibrary.getName(), deviceLibrary.getModel()); List<DeviceLibrary> deviceLibraries = deviceLibraryDao.getAllByTypeAndNameAndModel(deviceLibrary.getType(), deviceLibrary.getName(), deviceLibrary.getModel());
return ResultUtil.success(deviceLibraries.stream().filter(deviceLibrary1 -> !deviceLibrary1.getId().equals(id) && deviceLibrary1.getLifeStatus() == 2).collect(Collectors.toList())); return ResultUtil.success(deviceLibraries.stream().filter(deviceLibrary1 -> !deviceLibrary1.getId().equals(id) && deviceLibrary1.getLifeStatus() == 2).collect(Collectors.toList()));
......
...@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -24,6 +26,8 @@ public class DeviceEditVo { ...@@ -24,6 +26,8 @@ public class DeviceEditVo {
@ApiModelProperty(value = "删除相关配件id") @ApiModelProperty(value = "删除相关配件id")
private List<Integer> partIdDeleteList; private List<Integer> partIdDeleteList;
@NotNull(message = "deviceId不能为空")
@Min(value = 1,message = "deviceId不能小于1")
@ApiModelProperty(value = "装备id", example = "1") @ApiModelProperty(value = "装备id", example = "1")
private Integer deviceId; private Integer deviceId;
} }
...@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -13,24 +16,32 @@ import org.springframework.stereotype.Repository; ...@@ -13,24 +16,32 @@ import org.springframework.stereotype.Repository;
@Repository @Repository
public class DeviceLibrarySaveVo { public class DeviceLibrarySaveVo {
@NotNull(message = "packingId不能为空")
@Min(value = 1,message = "packingId不能小于1")
@ApiModelProperty(value = "列装id", example = "0") @ApiModelProperty(value = "列装id", example = "0")
private Integer packingId; private Integer packingId;
@NotNull(message = "seqNumber不能为空")
@ApiModelProperty(value = "装备序列号") @ApiModelProperty(value = "装备序列号")
private String seqNumber; private String seqNumber;
@NotNull(message = "prodNumber不能为空")
@ApiModelProperty(value = "生产序列号") @ApiModelProperty(value = "生产序列号")
private String prodNumber; private String prodNumber;
@NotNull(message = "rfidSurfaceId不能为空")
@ApiModelProperty(value = "rfid表面号") @ApiModelProperty(value = "rfid表面号")
private String rfidSurfaceId; private String rfidSurfaceId;
@NotNull(message = "rfidCardId不能为空")
@ApiModelProperty(value = "rfid卡号") @ApiModelProperty(value = "rfid卡号")
private String rfidCardId; private String rfidCardId;
@NotNull(message = "storageType不能为空")
@ApiModelProperty(value = "入库类型,1-横向,2-纵向") @ApiModelProperty(value = "入库类型,1-横向,2-纵向")
private Integer storageType; private Integer storageType;
@NotNull(message = "manageStatus不能为空")
@ApiModelProperty(value = "管理状态,0-不再所属单位,1-在所属单位") @ApiModelProperty(value = "管理状态,0-不再所属单位,1-在所属单位")
private Integer manageStatus; private Integer manageStatus;
......
...@@ -29,8 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -29,8 +29,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Min;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
...@@ -43,6 +45,7 @@ import java.util.stream.Collectors; ...@@ -43,6 +45,7 @@ import java.util.stream.Collectors;
@RequestMapping(value = "/matchingDevice") @RequestMapping(value = "/matchingDevice")
@AutoDocument @AutoDocument
@Api(tags = "配套设备模块", description = "配套设备模块") @Api(tags = "配套设备模块", description = "配套设备模块")
@Validated
public class MatchingDeviceController { public class MatchingDeviceController {
@Autowired @Autowired
...@@ -75,7 +78,7 @@ public class MatchingDeviceController { ...@@ -75,7 +78,7 @@ public class MatchingDeviceController {
@ApiOperation(value = "添加配套设备", notes = "可以通过这个接口添加配套设备") @ApiOperation(value = "添加配套设备", notes = "可以通过这个接口添加配套设备")
@PostMapping(value = "/add") @PostMapping(value = "/add")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addStorageBill(@RequestBody MatchingDeviceBillSaveVo matchingDeviceBillSaveVo) { public ResponseEntity addStorageBill(@RequestBody @Validated MatchingDeviceBillSaveVo matchingDeviceBillSaveVo) {
//添加账单 //添加账单
MatchingDeviceBill matchingDeviceBillEntity = matchingDeviceBillSaveVo.toDo(); MatchingDeviceBill matchingDeviceBillEntity = matchingDeviceBillSaveVo.toDo();
MatchingDeviceBill m = matchingDeviceBillService.addEntity(matchingDeviceBillEntity); MatchingDeviceBill m = matchingDeviceBillService.addEntity(matchingDeviceBillEntity);
...@@ -110,7 +113,7 @@ public class MatchingDeviceController { ...@@ -110,7 +113,7 @@ public class MatchingDeviceController {
@ApiOperation(value = "添加配套设备审核", notes = "可以通过这个接口添加配套设备审核") @ApiOperation(value = "添加配套设备审核", notes = "可以通过这个接口添加配套设备审核")
@PostMapping(value = "/confirm") @PostMapping(value = "/confirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity confirm(@RequestBody MatchingDeviceBillConfirmVo matchingDeviceBillConfirmVo) { public ResponseEntity confirm(@RequestBody @Validated MatchingDeviceBillConfirmVo matchingDeviceBillConfirmVo) {
TaskBto taskBto = taskService.get(matchingDeviceBillConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(matchingDeviceBillConfirmVo.getTaskId());
//1.审核成功,入库任务结束,改变装备状态 //1.审核成功,入库任务结束,改变装备状态
if (matchingDeviceBillConfirmVo.getStatus() == 0) { if (matchingDeviceBillConfirmVo.getStatus() == 0) {
...@@ -173,7 +176,7 @@ public class MatchingDeviceController { ...@@ -173,7 +176,7 @@ public class MatchingDeviceController {
@ApiOperation(value = "查询配套装备详情", notes = "可以通过这个接口查询配套装备详情") @ApiOperation(value = "查询配套装备详情", notes = "可以通过这个接口查询配套装备详情")
@GetMapping("/feature/detail/{id}") @GetMapping("/feature/detail/{id}")
public ResponseEntity getDetail(@PathVariable("id") int id) { public ResponseEntity getDetail(@PathVariable("id") @Min(value = 1,message = "id不能小于1") int id) {
List<Object> list = new ArrayList<>(); List<Object> list = new ArrayList<>();
//添加配套设备详情 //添加配套设备详情
MatchingDeviceLibrary m = matchingDeviceLibraryService.getOne(id); MatchingDeviceLibrary m = matchingDeviceLibraryService.getOne(id);
...@@ -197,7 +200,7 @@ public class MatchingDeviceController { ...@@ -197,7 +200,7 @@ public class MatchingDeviceController {
@ApiOperation(value = "更新配套设备", notes = "可以通过这个接口更新配套设备") @ApiOperation(value = "更新配套设备", notes = "可以通过这个接口更新配套设备")
@PostMapping("/update") @PostMapping("/update")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity update(@RequestBody MatchingDeviceEditVo matchingDeviceEditVo) { public ResponseEntity update(@RequestBody @Validated MatchingDeviceEditVo matchingDeviceEditVo) {
MatchingDeviceLibrary m = matchingDeviceLibraryService.getOne(matchingDeviceEditVo.getMatchingDeviceId()); MatchingDeviceLibrary m = matchingDeviceLibraryService.getOne(matchingDeviceEditVo.getMatchingDeviceId());
if (matchingDeviceEditVo.getCreateUnit() != null && !m.getCreateUnit().equals(matchingDeviceEditVo.getCreateUnit())) { if (matchingDeviceEditVo.getCreateUnit() != null && !m.getCreateUnit().equals(matchingDeviceEditVo.getCreateUnit())) {
//添加设备日志 //添加设备日志
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,9 +14,13 @@ import lombok.Data; ...@@ -11,9 +14,13 @@ import lombok.Data;
@ApiModel("新增配套审核类") @ApiModel("新增配套审核类")
public class MatchingDeviceBillConfirmVo { public class MatchingDeviceBillConfirmVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@Min(value = 0,message = "status不能小于0")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
} }
...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -15,18 +18,25 @@ import java.util.List; ...@@ -15,18 +18,25 @@ import java.util.List;
@ApiModel("配套设备账单存储类") @ApiModel("配套设备账单存储类")
public class MatchingDeviceBillSaveVo { public class MatchingDeviceBillSaveVo {
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "确认单附件名") @ApiModelProperty(value = "确认单附件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "确认单附件url") @ApiModelProperty(value = "确认单附件url")
private String fileUrl; private String fileUrl;
@NotNull(message = "useraId不能为空")
@Min(value = 1,message = "useraId不能小于1")
@ApiModelProperty(value = "发起人id") @ApiModelProperty(value = "发起人id")
private Integer useraId; private Integer useraId;
@NotNull(message = "userbId不能为空")
@Min(value = 1,message = "userbId不能小于1")
@ApiModelProperty(value = "审核人id") @ApiModelProperty(value = "审核人id")
private Integer userbId; private Integer userbId;
@NotEmpty(message = "matchingDeviceSaveVoList不能为空")
@ApiModelProperty(value = "配套设备列表") @ApiModelProperty(value = "配套设备列表")
private List<MatchingDeviceSaveVo> matchingDeviceSaveVoList; private List<MatchingDeviceSaveVo> matchingDeviceSaveVoList;
......
...@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -13,6 +16,8 @@ import org.springframework.stereotype.Repository; ...@@ -13,6 +16,8 @@ import org.springframework.stereotype.Repository;
@ApiModel("配套设备编辑类") @ApiModel("配套设备编辑类")
public class MatchingDeviceEditVo { public class MatchingDeviceEditVo {
@NotNull(message = "matchingDeviceId不能为空")
@Min(value = 1,message = "matchingDeviceId不能小于1")
@ApiModelProperty(value = "配套设备的id", example = "1") @ApiModelProperty(value = "配套设备的id", example = "1")
private Integer matchingDeviceId; private Integer matchingDeviceId;
......
...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -6,6 +6,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -13,24 +15,31 @@ import org.springframework.beans.BeanUtils; ...@@ -13,24 +15,31 @@ import org.springframework.beans.BeanUtils;
@ApiModel("配套设备存储类") @ApiModel("配套设备存储类")
public class MatchingDeviceSaveVo { public class MatchingDeviceSaveVo {
@NotNull(message = "type不能为空")
@ApiModelProperty(value = "设备类型") @ApiModelProperty(value = "设备类型")
private String type; private String type;
@NotNull(message = "model不能为空")
@ApiModelProperty(value = "型号") @ApiModelProperty(value = "型号")
private String model; private String model;
@NotNull(message = "name不能为空")
@ApiModelProperty(value = "设备名称") @ApiModelProperty(value = "设备名称")
private String name; private String name;
@NotNull(message = "createUnit不能为空")
@ApiModelProperty(value = "创建单位") @ApiModelProperty(value = "创建单位")
private String createUnit; private String createUnit;
@NotNull(message = "seqNumber不能为空")
@ApiModelProperty(value = "设备序列号") @ApiModelProperty(value = "设备序列号")
private String seqNumber; private String seqNumber;
@NotNull(message = "rfidSurfaceId不能为空")
@ApiModelProperty(value = "rfid表面号") @ApiModelProperty(value = "rfid表面号")
private String rfidSurfaceId; private String rfidSurfaceId;
@NotNull(message = "rfidCardId不能为空")
@ApiModelProperty(value = "rfid卡号") @ApiModelProperty(value = "rfid卡号")
private String rfidCardId; private String rfidCardId;
......
...@@ -4,15 +4,20 @@ package com.tykj.dev.misc.exception; ...@@ -4,15 +4,20 @@ package com.tykj.dev.misc.exception;
import com.tykj.dev.misc.base.ResultObj; import com.tykj.dev.misc.base.ResultObj;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.security.access.AccessDeniedException; import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.AuthenticationException;
import org.springframework.validation.BindException; import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult; import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError; import org.springframework.validation.FieldError;
import org.springframework.web.bind.MethodArgumentNotValidException;
import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
import javax.validation.ConstraintViolationException;
/** /**
...@@ -35,7 +40,25 @@ public class GlobalExceptionHandler { ...@@ -35,7 +40,25 @@ public class GlobalExceptionHandler {
public ResponseEntity errorMessage(Exception e) { public ResponseEntity errorMessage(Exception e) {
log.error("[其他异常] {}", e.toString()); log.error("[其他异常] {}", e.toString());
e.printStackTrace(); e.printStackTrace();
return ResultUtil.failed(); return ResultUtil.failed(e.getMessage());
}
/**
* 参数校验错误
* @param e 报错信息
*/
@ResponseBody
@ExceptionHandler(MethodArgumentNotValidException.class)
@ResponseStatus(HttpStatus.BAD_REQUEST)
public ResponseEntity errorMessage(MethodArgumentNotValidException e) {
BindingResult bindingResult = e.getBindingResult();
String errorMesssage = "参数校验失败:";
for (FieldError fieldError : bindingResult.getFieldErrors()) {
errorMesssage += fieldError.getDefaultMessage() + ", ";
}
log.error("[参数校验异常] {}", errorMesssage);
e.printStackTrace();
return ResultUtil.failed(errorMesssage);
} }
/** /**
...@@ -50,7 +73,7 @@ public class GlobalExceptionHandler { ...@@ -50,7 +73,7 @@ public class GlobalExceptionHandler {
if (e.getResponseEntity() != null) { if (e.getResponseEntity() != null) {
return e.getResponseEntity(); return e.getResponseEntity();
} }
return ResultUtil.failed(); return ResultUtil.failed(e.getMessage());
} }
/** /**
......
...@@ -41,7 +41,12 @@ public class StringSplitUtil { ...@@ -41,7 +41,12 @@ public class StringSplitUtil {
if (strings.length != 0) { if (strings.length != 0) {
for (String str : strings) { for (String str : strings) {
if (str.length() > 0) { if (str.length() > 0) {
list.add(Integer.valueOf(str)); if ("null".equals(str)){
list.add(-100);
}
else {
list.add(Integer.valueOf(str));
}
} }
} }
} }
......
...@@ -24,8 +24,12 @@ import org.springframework.beans.BeanUtils; ...@@ -24,8 +24,12 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -33,6 +37,7 @@ import java.util.List; ...@@ -33,6 +37,7 @@ import java.util.List;
@Api(tags = "列装管理模块", description = "列装管理接口") @Api(tags = "列装管理模块", description = "列装管理接口")
@AutoDocument @AutoDocument
@RequestMapping("/packing") @RequestMapping("/packing")
@Validated
public class PackingController { public class PackingController {
@Autowired @Autowired
...@@ -56,7 +61,7 @@ public class PackingController { ...@@ -56,7 +61,7 @@ public class PackingController {
@ApiOperation(value = "新增列装", notes = "可以通过这个接口发起列装") @ApiOperation(value = "新增列装", notes = "可以通过这个接口发起列装")
@PostMapping("/addPackingLibrary") @PostMapping("/addPackingLibrary")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addPackingLibrary(@RequestBody PackingLibrarySaveVo packingLibrarySaveVo) { public ResponseEntity addPackingLibrary(@RequestBody @Validated PackingLibrarySaveVo packingLibrarySaveVo) {
//添加列装装备信息 //添加列装装备信息
PackingLibrary p = packingLibrarySaveVo.toDo(); PackingLibrary p = packingLibrarySaveVo.toDo();
p.setUseraId(userUtils.getCurrentUserId()); p.setUseraId(userUtils.getCurrentUserId());
...@@ -85,7 +90,7 @@ public class PackingController { ...@@ -85,7 +90,7 @@ public class PackingController {
@ApiOperation(value = "列装审核", notes = "可以通过这个接口进行列装审核") @ApiOperation(value = "列装审核", notes = "可以通过这个接口进行列装审核")
@PostMapping("/confirmPackingLibrary") @PostMapping("/confirmPackingLibrary")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity confirmPackingLibrary(@RequestBody PackingLibraryConfirmVo packingLibraryConfirmVo) { public ResponseEntity confirmPackingLibrary(@RequestBody @Validated PackingLibraryConfirmVo packingLibraryConfirmVo) {
TaskBto taskBto = taskService.get(packingLibraryConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(packingLibraryConfirmVo.getTaskId());
//审核通过 //审核通过
if (packingLibraryConfirmVo.getStatus() == 0) { if (packingLibraryConfirmVo.getStatus() == 0) {
...@@ -123,7 +128,7 @@ public class PackingController { ...@@ -123,7 +128,7 @@ public class PackingController {
@ApiOperation(value = "查询列装详情", notes = "可以通过这个接口查询列装详情") @ApiOperation(value = "查询列装详情", notes = "可以通过这个接口查询列装详情")
@GetMapping(value = "/detail/{billId}") @GetMapping(value = "/detail/{billId}")
public ResponseEntity selectDetail(@PathVariable("billId") int billId) { public ResponseEntity selectDetail(@PathVariable("billId") @Min(value = 1,message = "billId不能小于1") int billId) {
PackingDetailVo packingDetailVo = new PackingDetailVo(); PackingDetailVo packingDetailVo = new PackingDetailVo();
//获取taskBto //获取taskBto
TaskBto taskBto = taskService.get(billId, BusinessEnum.PACKING.id); TaskBto taskBto = taskService.get(billId, BusinessEnum.PACKING.id);
......
...@@ -18,8 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,8 +18,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.Min;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
...@@ -30,6 +32,7 @@ import java.util.List; ...@@ -30,6 +32,7 @@ import java.util.List;
@Api(tags = "列装管理模块", description = "列装管理接口") @Api(tags = "列装管理模块", description = "列装管理接口")
@AutoDocument @AutoDocument
@RequestMapping("/packing") @RequestMapping("/packing")
@Validated
public class PackingLibraryController { public class PackingLibraryController {
@Autowired @Autowired
...@@ -75,7 +78,7 @@ public class PackingLibraryController { ...@@ -75,7 +78,7 @@ public class PackingLibraryController {
@ApiOperation(value = "更新列装库", notes = "可以通过这个接口更新列装") @ApiOperation(value = "更新列装库", notes = "可以通过这个接口更新列装")
@PostMapping("/updatePackingLibrary") @PostMapping("/updatePackingLibrary")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity updatePackingLibrary(@RequestBody PackingEditVo packingEditVo) { public ResponseEntity updatePackingLibrary(@RequestBody @Validated PackingEditVo packingEditVo) {
//更新列装信息 //更新列装信息
if (packingEditVo.getUpdateVoList() != null) { if (packingEditVo.getUpdateVoList() != null) {
PackingLibrary packingLibraryEntity = packingLibraryService.getOne(packingEditVo.getPackingId()); PackingLibrary packingLibraryEntity = packingLibraryService.getOne(packingEditVo.getPackingId());
...@@ -231,13 +234,13 @@ public class PackingLibraryController { ...@@ -231,13 +234,13 @@ public class PackingLibraryController {
@ApiOperation(value = "查询列装库详情页", notes = "可以通过这个接口查询存在的类型") @ApiOperation(value = "查询列装库详情页", notes = "可以通过这个接口查询存在的类型")
@GetMapping("/serve/detail/{id}") @GetMapping("/serve/detail/{id}")
public ResponseEntity selectPackingDetail(@PathVariable("id") int id) { public ResponseEntity selectPackingDetail(@PathVariable("id") @Min(value = 1,message = "id不能小于1") int id) {
return ResultUtil.success(packingLibraryService.getPackingDetail(id)); return ResultUtil.success(packingLibraryService.getPackingDetail(id));
} }
@ApiOperation(value = "查询退装详情页", notes = "可以通过这个接口查询存在的类型") @ApiOperation(value = "查询退装详情页", notes = "可以通过这个接口查询存在的类型")
@GetMapping("/retired/detail/{id}") @GetMapping("/retired/detail/{id}")
public ResponseEntity selectInvalidDetail(@PathVariable("id") int id) { public ResponseEntity selectInvalidDetail(@PathVariable("id") @Min(value = 1,message = "id不能小于1") int id) {
return ResultUtil.success(packingLibraryService.getInvalidDetail(id)); return ResultUtil.success(packingLibraryService.getInvalidDetail(id));
} }
} }
...@@ -4,7 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,7 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -28,5 +30,6 @@ public class PackingEditVo { ...@@ -28,5 +30,6 @@ public class PackingEditVo {
private List<Integer> partIdDeleteList; private List<Integer> partIdDeleteList;
@ApiModelProperty(value = "列装装备id", example = "1") @ApiModelProperty(value = "列装装备id", example = "1")
@NotNull(message = "packingId不能为空")
private Integer packingId; private Integer packingId;
} }
...@@ -4,15 +4,19 @@ import io.swagger.annotations.ApiModel; ...@@ -4,15 +4,19 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
@Data @Data
@ApiModel("列装审核类") @ApiModel("列装审核类")
public class PackingLibraryConfirmVo { public class PackingLibraryConfirmVo {
@NotNull(message = "taskId不能为空")
@ApiModelProperty(value = "对应任务ID", example = "1") @ApiModelProperty(value = "对应任务ID", example = "1")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
} }
...@@ -7,6 +7,8 @@ import lombok.Data; ...@@ -7,6 +7,8 @@ import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -16,31 +18,39 @@ import java.util.List; ...@@ -16,31 +18,39 @@ import java.util.List;
@ApiModel("列装存储类") @ApiModel("列装存储类")
@Repository @Repository
public class PackingLibrarySaveVo { public class PackingLibrarySaveVo {
@NotNull(message = "model不能为空")
@ApiModelProperty(value = "型号", example = "测试型号") @ApiModelProperty(value = "型号", example = "测试型号")
private String model; private String model;
@NotNull(message = "name不能为空")
@ApiModelProperty(value = "名称", example = "测试名称") @ApiModelProperty(value = "名称", example = "测试名称")
private String name; private String name;
@NotNull(message = "applyType不能为空")
@ApiModelProperty(value = "应用类型", example = "1") @ApiModelProperty(value = "应用类型", example = "1")
private Integer applyType; private Integer applyType;
@NotNull(message = "matchingRange不能为空")
@ApiModelProperty(value = "配用范围", example = "1") @ApiModelProperty(value = "配用范围", example = "1")
private Integer matchingRange; private Integer matchingRange;
@NotNull(message = "invisibleRange不能为空")
@ApiModelProperty(value = "可见范围", example = "1") @ApiModelProperty(value = "可见范围", example = "1")
private Integer invisibleRange; private Integer invisibleRange;
@NotNull(message = "type不能为空")
@ApiModelProperty(value = "类型", example = "1") @ApiModelProperty(value = "类型", example = "1")
private Integer type; private Integer type;
@NotNull(message = "secretLevel不能为空")
@ApiModelProperty(value = "密级(0:绝密,1:机密,2:秘密)", example = "1") @ApiModelProperty(value = "密级(0:绝密,1:机密,2:秘密)", example = "1")
private Integer secretLevel; private Integer secretLevel;
@NotNull(message = "nature不能为空")
@ApiModelProperty(value = "列装性质", example = "1") @ApiModelProperty(value = "列装性质", example = "1")
private Integer nature; private Integer nature;
@NotNull(message = "status不能为空")
@ApiModelProperty(value = "列装状态", example = "1") @ApiModelProperty(value = "列装状态", example = "1")
private Integer status; private Integer status;
...@@ -65,6 +75,8 @@ public class PackingLibrarySaveVo { ...@@ -65,6 +75,8 @@ public class PackingLibrarySaveVo {
@ApiModelProperty(value = "附件路径", example = "没有先填一个空格") @ApiModelProperty(value = "附件路径", example = "没有先填一个空格")
private String fileUrl; private String fileUrl;
@NotNull(message = "userbId不能为空")
@Min(value = 1,message = "userbId不能小于1")
@ApiModelProperty(value = "B岗用户ID", example = "2") @ApiModelProperty(value = "B岗用户ID", example = "2")
private Integer userbId; private Integer userbId;
......
...@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,12 +13,15 @@ import lombok.Data; ...@@ -11,12 +13,15 @@ import lombok.Data;
@ApiModel("配件存储类") @ApiModel("配件存储类")
public class PartSaveVo { public class PartSaveVo {
@NotNull(message = "配件model不能为空")
@ApiModelProperty(value = "型号", example = "测试型号") @ApiModelProperty(value = "型号", example = "测试型号")
private String model; private String model;
@NotNull(message = "配件name不能为空")
@ApiModelProperty(value = "名称", example = "测试名称") @ApiModelProperty(value = "名称", example = "测试名称")
private String name; private String name;
@NotNull(message = "配件type不能为空")
@ApiModelProperty(value = "类型", example = "1") @ApiModelProperty(value = "类型", example = "1")
private Integer type; private Integer type;
......
...@@ -41,6 +41,7 @@ import org.springframework.beans.BeanUtils; ...@@ -41,6 +41,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
...@@ -106,7 +107,7 @@ public class RepairController { ...@@ -106,7 +107,7 @@ public class RepairController {
@ApiOperation(value = "发起维修", notes = "可以通过这个接口发起维修") @ApiOperation(value = "发起维修", notes = "可以通过这个接口发起维修")
@PostMapping(value = "/form") @PostMapping(value = "/form")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity createRepair(@RequestBody RepairBillSaveVo repairBillSaveVo) { public ResponseEntity createRepair(@RequestBody @Validated RepairBillSaveVo repairBillSaveVo) {
//添加维修单和送修单 //添加维修单和送修单
RepairBill repairBill = new RepairBill(); RepairBill repairBill = new RepairBill();
RepairSendBill deviceRepairSendBillEntity = new RepairSendBill(); RepairSendBill deviceRepairSendBillEntity = new RepairSendBill();
...@@ -175,7 +176,7 @@ public class RepairController { ...@@ -175,7 +176,7 @@ public class RepairController {
@ApiOperation(value = "继续向上发起维修", notes = "可以通过这个接口继续向上发起维修") @ApiOperation(value = "继续向上发起维修", notes = "可以通过这个接口继续向上发起维修")
@PostMapping(value = "/continue/form") @PostMapping(value = "/continue/form")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity continueCreateRepair(@RequestBody RepairBillSaveVo deviceRepairBillSaveVo) { public ResponseEntity continueCreateRepair(@RequestBody @Validated RepairBillSaveVo deviceRepairBillSaveVo) {
ResponseEntity responseEntity = createRepair(deviceRepairBillSaveVo); ResponseEntity responseEntity = createRepair(deviceRepairBillSaveVo);
ResultObj resultObj = (ResultObj) responseEntity.getBody(); ResultObj resultObj = (ResultObj) responseEntity.getBody();
TaskBto taskBto = (TaskBto) Objects.requireNonNull(resultObj).getData(); TaskBto taskBto = (TaskBto) Objects.requireNonNull(resultObj).getData();
...@@ -189,7 +190,7 @@ public class RepairController { ...@@ -189,7 +190,7 @@ public class RepairController {
@ApiOperation(value = "发起维修审核", notes = "可以通过这个接口发起维修审核") @ApiOperation(value = "发起维修审核", notes = "可以通过这个接口发起维修审核")
@PostMapping(value = "/sendConfirm") @PostMapping(value = "/sendConfirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity sendConfirm(@RequestBody RepairConfirmVo deviceRepairConfirmVo) { public ResponseEntity sendConfirm(@RequestBody @Validated RepairConfirmVo deviceRepairConfirmVo) {
Integer level = userUtils.getCurrentUnitLevel(); Integer level = userUtils.getCurrentUnitLevel();
TaskBto taskBto = taskService.get(deviceRepairConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(deviceRepairConfirmVo.getTaskId());
//获取维修单,送修单,装备详情 //获取维修单,送修单,装备详情
...@@ -299,7 +300,7 @@ public class RepairController { ...@@ -299,7 +300,7 @@ public class RepairController {
@ApiOperation(value = "接收维修装备", notes = "可以通过这个接口接收维修装备") @ApiOperation(value = "接收维修装备", notes = "可以通过这个接口接收维修装备")
@PostMapping(value = "/receive") @PostMapping(value = "/receive")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity receiveDevice(@RequestBody RepairReceiveVo repairReceiveVo) { public ResponseEntity receiveDevice(@RequestBody @Validated RepairReceiveVo repairReceiveVo) {
//获取当前任务 //获取当前任务
TaskBto taskBto = taskService.get(repairReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(repairReceiveVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
...@@ -390,7 +391,7 @@ public class RepairController { ...@@ -390,7 +391,7 @@ public class RepairController {
@ApiOperation(value = "接收维修装备审核", notes = "可以通过这个接口对接收维修装备审核") @ApiOperation(value = "接收维修装备审核", notes = "可以通过这个接口对接收维修装备审核")
@PostMapping(value = "/receiveConfirm") @PostMapping(value = "/receiveConfirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity receiveConfirm(@RequestBody RepairConfirmVo repairConfirmVo) { public ResponseEntity receiveConfirm(@RequestBody @Validated RepairConfirmVo repairConfirmVo) {
//获取任务 //获取任务
TaskBto taskBto = taskService.get(repairConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(repairConfirmVo.getTaskId());
//获取维修单,送修单,装备详情,维修详情单 //获取维修单,送修单,装备详情,维修详情单
...@@ -512,7 +513,7 @@ public class RepairController { ...@@ -512,7 +513,7 @@ public class RepairController {
@ApiOperation(value = "修好装备出库", notes = "可以通过这个接口修好装备出库") @ApiOperation(value = "修好装备出库", notes = "可以通过这个接口修好装备出库")
@PostMapping(value = "/back") @PostMapping(value = "/back")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity repairBack(@RequestBody RepairBackBillSaveVo repairBackBillSaveVo) { public ResponseEntity repairBack(@RequestBody @Validated RepairBackBillSaveVo repairBackBillSaveVo) {
//获取当前维修业务,维修单 //获取当前维修业务,维修单
TaskBto taskBto = taskService.get(repairBackBillSaveVo.getTaskId()); TaskBto taskBto = taskService.get(repairBackBillSaveVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
...@@ -572,7 +573,7 @@ public class RepairController { ...@@ -572,7 +573,7 @@ public class RepairController {
@ApiOperation(value = "修好装备出库审核", notes = "可以通过这个接口修好装备出库审核") @ApiOperation(value = "修好装备出库审核", notes = "可以通过这个接口修好装备出库审核")
@PostMapping(value = "/back/confirm") @PostMapping(value = "/back/confirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity backConfirm(@RequestBody RepairConfirmVo repairConfirmVo) { public ResponseEntity backConfirm(@RequestBody @Validated RepairConfirmVo repairConfirmVo) {
//获取业务,账单,相关装备Id //获取业务,账单,相关装备Id
TaskBto taskBto = taskService.get(repairConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(repairConfirmVo.getTaskId());
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId()); RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
...@@ -640,7 +641,7 @@ public class RepairController { ...@@ -640,7 +641,7 @@ public class RepairController {
@ApiOperation(value = "修好装备送回接收入库", notes = "可以通过这个接口修好装备送回接收") @ApiOperation(value = "修好装备送回接收入库", notes = "可以通过这个接口修好装备送回接收")
@PostMapping(value = "/back/receive") @PostMapping(value = "/back/receive")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity backReceive(@RequestBody RepairReceiveVo repairReceiveVo) { public ResponseEntity backReceive(@RequestBody @Validated RepairReceiveVo repairReceiveVo) {
//获取当前任务 //获取当前任务
TaskBto taskBto = taskService.get(repairReceiveVo.getTaskId()); TaskBto taskBto = taskService.get(repairReceiveVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
...@@ -749,7 +750,7 @@ public class RepairController { ...@@ -749,7 +750,7 @@ public class RepairController {
@ApiOperation(value = "修好装备送回接收入库审核", notes = "可以通过这个接口修好装备送回接收") @ApiOperation(value = "修好装备送回接收入库审核", notes = "可以通过这个接口修好装备送回接收")
@PostMapping(value = "/back/receive/confirm") @PostMapping(value = "/back/receive/confirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity backReceiveConfirm(@RequestBody RepairConfirmVo repairConfirmVo) { public ResponseEntity backReceiveConfirm(@RequestBody @Validated RepairConfirmVo repairConfirmVo) {
//获取业务,退回单,装备id //获取业务,退回单,装备id
TaskBto taskBto = taskService.get(repairConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(repairConfirmVo.getTaskId());
RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId()); RepairBackBill repairBackBill = deviceRepairBackBillService.getOne(taskBto.getBillId());
...@@ -829,7 +830,7 @@ public class RepairController { ...@@ -829,7 +830,7 @@ public class RepairController {
@ApiOperation(value = "更改维修装备状态", notes = "可以通过这个接口更改维修装备状态") @ApiOperation(value = "更改维修装备状态", notes = "可以通过这个接口更改维修装备状态")
@PostMapping(value = "/change") @PostMapping(value = "/change")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity changeRepairDeviceStatus(@RequestBody RepairStatusChangeVo repairStatusChangeVo) { public ResponseEntity changeRepairDeviceStatus(@RequestBody @Validated RepairStatusChangeVo repairStatusChangeVo) {
//获取当前任务 //获取当前任务
TaskBto taskBto = taskService.get(repairStatusChangeVo.getTaskId()); TaskBto taskBto = taskService.get(repairStatusChangeVo.getTaskId());
//获取所有父任务id //获取所有父任务id
...@@ -882,7 +883,7 @@ public class RepairController { ...@@ -882,7 +883,7 @@ public class RepairController {
@ApiOperation(value = "维修换新设备", notes = "可以通过这个接口维修换新设备") @ApiOperation(value = "维修换新设备", notes = "可以通过这个接口维修换新设备")
@PostMapping(value = "/change/new") @PostMapping(value = "/change/new")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity changeNewDevice(@RequestBody ChangeNewDeviceVo changeNewDeviceVo) { public ResponseEntity changeNewDevice(@RequestBody @Validated ChangeNewDeviceVo changeNewDeviceVo) {
//获取当前任务 //获取当前任务
TaskBto taskBto = taskService.get(changeNewDeviceVo.getTaskId()); TaskBto taskBto = taskService.get(changeNewDeviceVo.getTaskId());
//获取当前单位 //获取当前单位
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,15 +14,23 @@ import lombok.Data; ...@@ -11,15 +14,23 @@ import lombok.Data;
@ApiModel("维修装备换新类") @ApiModel("维修装备换新类")
public class ChangeNewDeviceVo { public class ChangeNewDeviceVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(name = "业务id", value = "1") @ApiModelProperty(name = "业务id", value = "1")
private Integer taskId; private Integer taskId;
@NotNull(message = "id不能为空")
@Min(value = 1,message = "id不能小于1")
@ApiModelProperty(name = "维修详情单主键Id", value = "1") @ApiModelProperty(name = "维修详情单主键Id", value = "1")
private Integer id; private Integer id;
@NotNull(message = "deviceId不能为空")
@Min(value = 1,message = "deviceId不能小于1")
@ApiModelProperty(name = "装备主键id", value = "1") @ApiModelProperty(name = "装备主键id", value = "1")
private Integer deviceId; private Integer deviceId;
@NotNull(message = "type不能为空")
@Min(value = 0,message = "type不能小于0")
@ApiModelProperty(name = "换新类型", value = "0:库存换新(不继承日志),1:新装备换新(继承日志)") @ApiModelProperty(name = "换新类型", value = "0:库存换新(不继承日志),1:新装备换新(继承日志)")
private Integer type; private Integer type;
} }
...@@ -6,6 +6,9 @@ import lombok.AllArgsConstructor; ...@@ -6,6 +6,9 @@ import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -15,6 +18,8 @@ import lombok.NoArgsConstructor; ...@@ -15,6 +18,8 @@ import lombok.NoArgsConstructor;
@ApiModel("维修装备详情类") @ApiModel("维修装备详情类")
public class DeviceDetailVo { public class DeviceDetailVo {
@NotNull(message = "deviceId不能为空")
@Min(value = 1,message = "deviceId不能小于1")
@ApiModelProperty(value = "装备ID", example = "1") @ApiModelProperty(value = "装备ID", example = "1")
private Integer deviceId; private Integer deviceId;
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -13,54 +16,72 @@ import java.util.List; ...@@ -13,54 +16,72 @@ import java.util.List;
@ApiModel("维修返回单存储类") @ApiModel("维修返回单存储类")
public class RepairBackBillSaveVo { public class RepairBackBillSaveVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@ApiModelProperty(value = "工作Id") @NotNull(message = "startUseraId不能为空")
private Integer jobId; @Min(value = 1,message = "startUseraId不能小于1")
@ApiModelProperty(value = "退回发起人", example = "1") @ApiModelProperty(value = "退回发起人", example = "1")
private Integer startUseraId; private Integer startUseraId;
@NotNull(message = "startUserbId不能为空")
@Min(value = 1,message = "startUserbId不能小于1")
@ApiModelProperty(value = "退回确认人", example = "1") @ApiModelProperty(value = "退回确认人", example = "1")
private Integer startUserbId; private Integer startUserbId;
@NotNull(message = "receiveUnit不能为空")
@ApiModelProperty(value = "接收单位", example = "市机要局") @ApiModelProperty(value = "接收单位", example = "市机要局")
private String receiveUnit; private String receiveUnit;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发起单位", example = "市机要局") @ApiModelProperty(value = "发起单位", example = "市机要局")
private String sendUnit; private String sendUnit;
@NotNull(message = "receiveUseraId不能为空")
@Min(value = 1,message = "receiveUseraId不能小于1")
@ApiModelProperty(value = "接收经手人", example = "1") @ApiModelProperty(value = "接收经手人", example = "1")
private Integer receiveUseraId; private Integer receiveUseraId;
@NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号") @ApiModelProperty(value = "申请文号")
private String applyNumber; private String applyNumber;
@NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号") @ApiModelProperty(value = "批复文号")
private String replayNumber; private String replayNumber;
@ApiModelProperty(value = "签发人") @ApiModelProperty(value = "签发人")
private String agent; private String agent;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "出库附件文件名") @ApiModelProperty(value = "出库附件文件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "出库附件文件地址URL") @ApiModelProperty(value = "出库附件文件地址URL")
private String fileUrl; private String fileUrl;
@NotNull(message = "sendingCount不能为空")
@Min(value = 1,message = "sendingCount不能小于1")
@ApiModelProperty(value = "应出库装备数量") @ApiModelProperty(value = "应出库装备数量")
private Integer sendingCount; private Integer sendingCount;
@NotNull(message = "sendedCount不能为空")
@Min(value = 0,message = "sendedCount不能小于0")
@ApiModelProperty(value = "已出库装备数量") @ApiModelProperty(value = "已出库装备数量")
private Integer sendedCount; private Integer sendedCount;
@NotNull(message = "backCheckDetail不能为空")
@ApiModelProperty(value = "退回装备出库详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的新增") @ApiModelProperty(value = "退回装备出库详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的新增")
private String backCheckDetail; private String backCheckDetail;
@NotNull(message = "backCheckResult不能为空")
@ApiModelProperty(value = "退回装备出库检查结果") @ApiModelProperty(value = "退回装备出库检查结果")
private String backCheckResult; private String backCheckResult;
@NotEmpty(message = "deviceList不能为空")
@ApiModelProperty(value = "维修装备详情列表") @ApiModelProperty(value = "维修装备详情列表")
private List<DeviceDetailVo> deviceList; private List<DeviceDetailVo> deviceList;
} }
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -13,54 +16,72 @@ import java.util.List; ...@@ -13,54 +16,72 @@ import java.util.List;
@ApiModel("维修单存储类") @ApiModel("维修单存储类")
public class RepairBillSaveVo { public class RepairBillSaveVo {
@NotNull(message = "startUseraId不能为空")
@Min(value = 1,message = "startUseraId不能小于1")
@ApiModelProperty(value = "发起申请人", example = "1") @ApiModelProperty(value = "发起申请人", example = "1")
private Integer startUseraId; private Integer startUseraId;
@NotNull(message = "startUserbId不能为空")
@Min(value = 1,message = "startUserbId不能小于1")
@ApiModelProperty(value = "发起确认人", example = "1") @ApiModelProperty(value = "发起确认人", example = "1")
private Integer startUserbId; private Integer startUserbId;
@NotNull(message = "receiveUnit不能为空")
@ApiModelProperty(value = "维修单位", example = "市机要局") @ApiModelProperty(value = "维修单位", example = "市机要局")
private String receiveUnit; private String receiveUnit;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "发起单位", example = "市机要局") @ApiModelProperty(value = "发起单位", example = "市机要局")
private String sendUnit; private String sendUnit;
@ApiModelProperty(value = "维修经手人", example = "1") @ApiModelProperty(value = "维修经手人", example = "1")
private Integer repairUseraId; private Integer repairUseraId;
@NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号") @ApiModelProperty(value = "申请文号")
private String applyNumber; private String applyNumber;
@NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号") @ApiModelProperty(value = "批复文号")
private String replayNumber; private String replayNumber;
@ApiModelProperty(value = "签发人") @ApiModelProperty(value = "签发人")
private String agent; private String agent;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "出库附件文件名") @ApiModelProperty(value = "出库附件文件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "出库附件文件地址URL") @ApiModelProperty(value = "出库附件文件地址URL")
private String fileUrl; private String fileUrl;
@ApiModelProperty(value = "维修经手人") @ApiModelProperty(value = "维修经手人")
private String repairUserA; private String repairUserA;
@NotNull(message = "sendingCount不能为空")
@Min(value = 1,message = "sendingCount不能小于1")
@ApiModelProperty(value = "应出库装备数量") @ApiModelProperty(value = "应出库装备数量")
private Integer sendingCount; private Integer sendingCount;
@NotNull(message = "sendedCount不能为空")
@Min(value = 0,message = "sendedCount不能小于0")
@ApiModelProperty(value = "已出库装备数量") @ApiModelProperty(value = "已出库装备数量")
private Integer sendedCount; private Integer sendedCount;
@NotNull(message = "repairDeviceCheckDetail不能为空")
@ApiModelProperty(value = "送修装备出库详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的新增") @ApiModelProperty(value = "送修装备出库详情(装备主键id+核对结果(0缺失1无误3新增,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的新增")
private String repairDeviceCheckDetail; private String repairDeviceCheckDetail;
@NotNull(message = "repairDeviceCheckResult不能为空")
@ApiModelProperty(value = "送修装备出库检查结果") @ApiModelProperty(value = "送修装备出库检查结果")
private String repairDeviceCheckResult; private String repairDeviceCheckResult;
@NotEmpty(message = "deviceList不能为空")
@ApiModelProperty(value = "维修装备详情列表") @ApiModelProperty(value = "维修装备详情列表")
private List<DeviceDetailVo> deviceList; private List<DeviceDetailVo> deviceList;
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
} }
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,9 +14,13 @@ import lombok.Data; ...@@ -11,9 +14,13 @@ import lombok.Data;
@ApiModel("维修审核类") @ApiModel("维修审核类")
public class RepairConfirmVo { public class RepairConfirmVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@Min(value = 0,message = "status不能小于0")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
} }
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,30 +14,42 @@ import lombok.Data; ...@@ -11,30 +14,42 @@ import lombok.Data;
@ApiModel("配发接收类") @ApiModel("配发接收类")
public class RepairReceiveVo { public class RepairReceiveVo {
@NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "billFileName不能为空")
@ApiModelProperty(value = "配发单附件名字") @ApiModelProperty(value = "配发单附件名字")
private String billFileName; private String billFileName;
@NotNull(message = "billFileUrl不能为空")
@ApiModelProperty(value = "配发单附件URL") @ApiModelProperty(value = "配发单附件URL")
private String billFileUrl; private String billFileUrl;
@NotNull(message = "receiveFileName不能为空")
@ApiModelProperty(value = "入库附件名字") @ApiModelProperty(value = "入库附件名字")
private String receiveFileName; private String receiveFileName;
@NotNull(message = "receiveFileUrl不能为空")
@ApiModelProperty(value = "入库附件URL") @ApiModelProperty(value = "入库附件URL")
private String receiveFileUrl; private String receiveFileUrl;
@NotNull(message = "receiveCount不能为空")
@Min(value = 0,message = "receiveCount不能小于0")
@ApiModelProperty(value = "接收入库数量") @ApiModelProperty(value = "接收入库数量")
private Integer receiveCount; private Integer receiveCount;
@NotNull(message = "receiveCheckDetail不能为空")
@ApiModelProperty(value = "接收入库检查详情") @ApiModelProperty(value = "接收入库检查详情")
private String receiveCheckDetail; private String receiveCheckDetail;
@NotNull(message = "receiveCheckResult不能为空")
@ApiModelProperty(value = "接收入库检查结果") @ApiModelProperty(value = "接收入库检查结果")
private String receiveCheckResult; private String receiveCheckResult;
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
/** /**
...@@ -13,18 +16,25 @@ import java.util.List; ...@@ -13,18 +16,25 @@ import java.util.List;
@ApiModel("装备维修状态修改类") @ApiModel("装备维修状态修改类")
public class RepairStatusChangeVo { public class RepairStatusChangeVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(name = "业务id", value = "1") @ApiModelProperty(name = "业务id", value = "1")
private Integer taskId; private Integer taskId;
@NotEmpty(message = "id不能为空")
@ApiModelProperty(name = "维修详情单主键Id列表") @ApiModelProperty(name = "维修详情单主键Id列表")
private List<Integer> id; private List<Integer> id;
@NotNull(message = "newStatus不能为空")
@Min(value = 0,message = "newStatus不能小于0")
@ApiModelProperty(name = "新的维修状态", value = "1") @ApiModelProperty(name = "新的维修状态", value = "1")
private Integer newStatus; private Integer newStatus;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(name = "报废单文件名") @ApiModelProperty(name = "报废单文件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(name = "报废单URL") @ApiModelProperty(name = "报废单URL")
private String fileUrl; private String fileUrl;
} }
...@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -13,6 +13,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.*; import java.util.*;
...@@ -56,7 +57,7 @@ public class DeviceScrapController { ...@@ -56,7 +57,7 @@ public class DeviceScrapController {
@ApiOperation(value = "提交报废单", notes = "提交报废单") @ApiOperation(value = "提交报废单", notes = "提交报废单")
@PostMapping(value = "/form") @PostMapping(value = "/form")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity commitScrap(@RequestBody ScrapSaveVo scrapSaveVo) { public ResponseEntity commitScrap(@RequestBody @Validated ScrapSaveVo scrapSaveVo) {
//转实体类 //转实体类
ScrapBill scrapBill = scrapSaveVo.toDo(); ScrapBill scrapBill = scrapSaveVo.toDo();
//计算所有不同的型号 //计算所有不同的型号
......
...@@ -9,6 +9,9 @@ import lombok.Data; ...@@ -9,6 +9,9 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.modelmapper.ModelMapper; import org.modelmapper.ModelMapper;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -18,12 +21,16 @@ import java.util.List; ...@@ -18,12 +21,16 @@ import java.util.List;
@ApiModel(value = "报废单存储类", description = "报废单存储类") @ApiModel(value = "报废单存储类", description = "报废单存储类")
public class ScrapSaveVo { public class ScrapSaveVo {
@NotNull(message = "repairBillId不能为空")
@Min(value = 1,message = "repairBillId不能小于1")
@ApiModelProperty(value = "维修单id") @ApiModelProperty(value = "维修单id")
private Integer repairBillId; private Integer repairBillId;
@NotNull(message = "scrapUnit不能为空")
@ApiModelProperty(value = "报废单位") @ApiModelProperty(value = "报废单位")
private String scrapUnit; private String scrapUnit;
@NotNull(message = "scrapTime不能为空")
@ApiModelProperty(value = "报废时间") @ApiModelProperty(value = "报废时间")
private Date scrapTime; private Date scrapTime;
...@@ -39,12 +46,15 @@ public class ScrapSaveVo { ...@@ -39,12 +46,15 @@ public class ScrapSaveVo {
@ApiModelProperty(value = "承办人") @ApiModelProperty(value = "承办人")
private String undertaker; private String undertaker;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "报废单文件名") @ApiModelProperty(value = "报废单文件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "报废单文件URL") @ApiModelProperty(value = "报废单文件URL")
private String fileUrl; private String fileUrl;
@NotEmpty(message = "deviceIds不能为空")
@ApiModelProperty(value = "报废装备Id列表") @ApiModelProperty(value = "报废装备Id列表")
private List<Integer> deviceIds; private List<Integer> deviceIds;
......
...@@ -14,42 +14,26 @@ import com.tykj.dev.device.selfcheck.subject.vo.*; ...@@ -14,42 +14,26 @@ import com.tykj.dev.device.selfcheck.subject.vo.*;
import com.tykj.dev.device.task.service.TaskLogService; import com.tykj.dev.device.task.service.TaskLogService;
import com.tykj.dev.device.task.service.TaskService; import com.tykj.dev.device.task.service.TaskService;
import com.tykj.dev.device.task.subject.bto.TaskBto; import com.tykj.dev.device.task.subject.bto.TaskBto;
import com.tykj.dev.device.task.subject.bto.TaskLogBto;
import com.tykj.dev.device.user.subject.dao.UnitsDao;
import com.tykj.dev.device.user.subject.entity.Units;
import com.tykj.dev.device.user.subject.service.UserPublicService; import com.tykj.dev.device.user.subject.service.UserPublicService;
import com.tykj.dev.device.user.util.UserUtils; import com.tykj.dev.device.user.util.UserUtils;
import com.tykj.dev.misc.base.BusinessEnum; import com.tykj.dev.misc.base.BusinessEnum;
import com.tykj.dev.misc.base.StatusEnum; import com.tykj.dev.misc.base.StatusEnum;
import com.tykj.dev.misc.exception.ApiException; import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.ResultUtil; import com.tykj.dev.misc.utils.ResultUtil;
import com.tykj.dev.misc.utils.SpringUtils;
import com.tykj.dev.socket.MyWebSocket; import com.tykj.dev.socket.MyWebSocket;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.time.DateUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.Trigger;
import org.springframework.scheduling.TriggerContext;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;
import org.springframework.scheduling.config.Task;
import org.springframework.scheduling.support.CronTrigger;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledFuture;
/** /**
...@@ -89,9 +73,6 @@ public class SelfCheckController { ...@@ -89,9 +73,6 @@ public class SelfCheckController {
@Autowired @Autowired
private MyWebSocket myWebSocket; private MyWebSocket myWebSocket;
@Autowired
private UnitsDao unitsDao;
@Autowired @Autowired
private SystemVariableService systemVariableService; private SystemVariableService systemVariableService;
...@@ -256,7 +237,7 @@ public class SelfCheckController { ...@@ -256,7 +237,7 @@ public class SelfCheckController {
@ApiOperation(value = "发起自查业务", notes = "可以通过这个接口发起自查业务") @ApiOperation(value = "发起自查业务", notes = "可以通过这个接口发起自查业务")
@PostMapping(value = "/addBill") @PostMapping(value = "/addBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addSelfExaminationBill(@RequestBody SelfCheckSaveVo selfCheckSaveVo) { public ResponseEntity addSelfExaminationBill(@RequestBody @Validated SelfCheckSaveVo selfCheckSaveVo) {
//添加账单 //添加账单
SelfCheckBill selfExaminationBillEntity; SelfCheckBill selfExaminationBillEntity;
if (selfCheckSaveVo.getTaskId()!=null){ if (selfCheckSaveVo.getTaskId()!=null){
...@@ -323,7 +304,7 @@ public class SelfCheckController { ...@@ -323,7 +304,7 @@ public class SelfCheckController {
@ApiOperation(value = "自查审核", notes = "可以通过这个接口自查审核") @ApiOperation(value = "自查审核", notes = "可以通过这个接口自查审核")
@PatchMapping(value = "/selfExaminationConfirm") @PatchMapping(value = "/selfExaminationConfirm")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity selfExaminationConfirm(@RequestBody SelfCheckConfirmVo selfCheckConfirmVo) { public ResponseEntity selfExaminationConfirm(@RequestBody @Validated SelfCheckConfirmVo selfCheckConfirmVo) {
TaskBto taskBto = taskService.get(selfCheckConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(selfCheckConfirmVo.getTaskId());
SelfCheckBill selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId()); SelfCheckBill selfExaminationBillEntity = selfExaminationBillService.getOne(taskBto.getBillId());
String deviceIdDetail = selfExaminationBillEntity.getCheckDetail(); String deviceIdDetail = selfExaminationBillEntity.getCheckDetail();
...@@ -331,8 +312,6 @@ public class SelfCheckController { ...@@ -331,8 +312,6 @@ public class SelfCheckController {
//审核通过,改变账单和任务状态,发起确认的任务 //审核通过,改变账单和任务状态,发起确认的任务
if (selfCheckConfirmVo.getStatus() == 0) { if (selfCheckConfirmVo.getStatus() == 0) {
taskService.update(taskService.moveToEnd(taskBto)); taskService.update(taskService.moveToEnd(taskBto));
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(), "自查审核成功", null);
// taskLogService.addLog(taskLogBto);
selfExaminationBillEntity.setCheckStatus(2); selfExaminationBillEntity.setCheckStatus(2);
selfExaminationBillService.update(selfExaminationBillEntity); selfExaminationBillService.update(selfExaminationBillEntity);
for (String s:strings) { for (String s:strings) {
...@@ -349,8 +328,6 @@ public class SelfCheckController { ...@@ -349,8 +328,6 @@ public class SelfCheckController {
//审核不通过,改变账单和任务状态 //审核不通过,改变账单和任务状态
if (selfCheckConfirmVo.getStatus()==1){ if (selfCheckConfirmVo.getStatus()==1){
taskService.update(taskService.moveToArchive(taskBto)); taskService.update(taskService.moveToArchive(taskBto));
// TaskLogBto taskLogBto = new TaskLogBto(taskBto.getId(),"自查审核失败",null);
// taskLogService.addLog(taskLogBto);
selfExaminationBillEntity.setCheckStatus(1); selfExaminationBillEntity.setCheckStatus(1);
selfExaminationBillService.update(selfExaminationBillEntity); selfExaminationBillService.update(selfExaminationBillEntity);
for (String s:strings) { for (String s:strings) {
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,9 +14,13 @@ import lombok.Data; ...@@ -11,9 +14,13 @@ import lombok.Data;
@ApiModel("自查审核类") @ApiModel("自查审核类")
public class SelfCheckConfirmVo { public class SelfCheckConfirmVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(name = "任务Id") @ApiModelProperty(name = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@Min(value = 0,message = "status不能小于0")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
} }
...@@ -7,6 +7,8 @@ import lombok.Data; ...@@ -7,6 +7,8 @@ import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -18,21 +20,31 @@ import java.util.List; ...@@ -18,21 +20,31 @@ import java.util.List;
@Repository @Repository
public class SelfCheckSaveVo { public class SelfCheckSaveVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(name = "任务id", example = "1") @ApiModelProperty(name = "任务id", example = "1")
private Integer taskId; private Integer taskId;
@NotNull(message = "userbId不能为空")
@Min(value = 1,message = "userbId不能小于1")
@ApiModelProperty(name = "审核人ID", example = "1") @ApiModelProperty(name = "审核人ID", example = "1")
private Integer userbId; private Integer userbId;
@NotNull(message = "checkingCount不能为空")
@Min(value = 0,message = "checkingCount不能小于0")
@ApiModelProperty(name = "应查数量", example = "1") @ApiModelProperty(name = "应查数量", example = "1")
private Integer checkingCount; private Integer checkingCount;
@NotNull(message = "checkedCount不能为空")
@Min(value = 0,message = "checkedCount不能小于0")
@ApiModelProperty(name = "实查数量", example = "1") @ApiModelProperty(name = "实查数量", example = "1")
private Integer checkedCount; private Integer checkedCount;
@NotNull(message = "checkResult不能为空")
@ApiModelProperty(name = "自查结果", example = "通过") @ApiModelProperty(name = "自查结果", example = "通过")
private String checkResult; private String checkResult;
@NotNull(message = "checkDetail不能为空")
@ApiModelProperty(name = "自查详情", example = "10x21x", value = "自查详情(装备主键id+核对结果(0缺失1无误2新增,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的新增") @ApiModelProperty(name = "自查详情", example = "10x21x", value = "自查详情(装备主键id+核对结果(0缺失1无误2新增,字符x作为分隔符)),例如10x21x32,意为主键id为1的装备缺失,为2的无误,为3的新增")
private String checkDetail; private String checkDetail;
......
...@@ -31,6 +31,7 @@ import org.springframework.beans.BeanUtils; ...@@ -31,6 +31,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -113,7 +114,7 @@ public class StorageBillController { ...@@ -113,7 +114,7 @@ public class StorageBillController {
@ApiOperation(value = "添加入库单", notes = "可以通过这个接口发起入库业务") @ApiOperation(value = "添加入库单", notes = "可以通过这个接口发起入库业务")
@PostMapping(value = "/addStorageBill") @PostMapping(value = "/addStorageBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity addStorageBill(@RequestBody StorageBillSaveVo storageBillSaveVo) { public ResponseEntity addStorageBill(@RequestBody @Validated StorageBillSaveVo storageBillSaveVo) {
//1.存入库单 //1.存入库单
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
StorageBill storageBillEntity = storageBillService.addEntity(storageBillSaveVo.toDo()); StorageBill storageBillEntity = storageBillService.addEntity(storageBillSaveVo.toDo());
...@@ -130,8 +131,6 @@ public class StorageBillController { ...@@ -130,8 +131,6 @@ public class StorageBillController {
List<FileVo> fileVoList = new ArrayList<>(); List<FileVo> fileVoList = new ArrayList<>();
fileVoList.add(new FileVo("配发单", storageBillEntity.getFileName(), storageBillEntity.getFileUrl())); fileVoList.add(new FileVo("配发单", storageBillEntity.getFileName(), storageBillEntity.getFileUrl()));
fileVoList.add(new FileVo("入库确认单", storageBillEntity.getReceiveFileName(), storageBillEntity.getReceiveFileUrl())); fileVoList.add(new FileVo("入库确认单", storageBillEntity.getReceiveFileName(), storageBillEntity.getReceiveFileUrl()));
// TaskLogBto taskLogBto = new TaskLogBto(taskEntity1.getId(),"发起入库",fileVoList);
// taskLogService.addLog(taskLogBto);
//3.存装备 //3.存装备
Integer parentId = null; Integer parentId = null;
for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) { for (DeviceLibrarySaveVo d : storageBillSaveVo.getDeviceLibrarySaveVoList()) {
...@@ -175,7 +174,7 @@ public class StorageBillController { ...@@ -175,7 +174,7 @@ public class StorageBillController {
@ApiOperation(value = "入库审核", notes = "可以通过这个接口入库审核") @ApiOperation(value = "入库审核", notes = "可以通过这个接口入库审核")
@PostMapping(value = "/confirmStorageBill") @PostMapping(value = "/confirmStorageBill")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity confirmStorageBill(@RequestBody StorageBillConfirmVo storageBillConfirmVo) { public ResponseEntity confirmStorageBill(@RequestBody @Validated StorageBillConfirmVo storageBillConfirmVo) {
TaskBto taskBto = taskService.get(storageBillConfirmVo.getTaskId()); TaskBto taskBto = taskService.get(storageBillConfirmVo.getTaskId());
//1.审核成功,入库任务结束,发起新的确认任务,改变装备状态 //1.审核成功,入库任务结束,发起新的确认任务,改变装备状态
if (storageBillConfirmVo.getStatus() == 0) { if (storageBillConfirmVo.getStatus() == 0) {
......
...@@ -4,15 +4,22 @@ import io.swagger.annotations.ApiModel; ...@@ -4,15 +4,22 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
@Data @Data
@ApiModel("入库审核类") @ApiModel("入库审核类")
public class StorageBillConfirmVo { public class StorageBillConfirmVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "status不能为空")
@Min(value = 0,message = "status不能小于0")
@ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回") @ApiModelProperty(name = "需要修改的状态", example = "0", value = "0为审核通过,1为驳回")
private Integer status; private Integer status;
} }
...@@ -7,6 +7,9 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -7,6 +7,9 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -16,45 +19,63 @@ import java.util.List; ...@@ -16,45 +19,63 @@ import java.util.List;
@Data @Data
@ApiModel("入库存储类") @ApiModel("入库存储类")
public class StorageBillSaveVo { public class StorageBillSaveVo {
@NotNull(message = "applyNumber不能为空")
@ApiModelProperty(value = "申请文号") @ApiModelProperty(value = "申请文号")
private String applyNumber; private String applyNumber;
@NotNull(message = "replayNumber不能为空")
@ApiModelProperty(value = "批复文号") @ApiModelProperty(value = "批复文号")
private String replayNumber; private String replayNumber;
@NotNull(message = "sendUnit不能为空")
@ApiModelProperty(value = "配送单位") @ApiModelProperty(value = "配送单位")
private String sendUnit; private String sendUnit;
@NotNull(message = "sendUserId不能为空")
@ApiModelProperty(value = "发件方") @ApiModelProperty(value = "发件方")
private String sendUserId; private String sendUserId;
@NotNull(message = "sendTime不能为空")
@ApiModelProperty(value = "配发时间") @ApiModelProperty(value = "配发时间")
private Date sendTime; private Date sendTime;
@NotNull(message = "receiveUseraId不能为空")
@Min(value = 1,message = "receiveUseraId不能小于1")
@ApiModelProperty(value = "接收单位A岗") @ApiModelProperty(value = "接收单位A岗")
private Integer receiveUseraId; private Integer receiveUseraId;
@NotNull(message = "receiveUserbId不能为空")
@Min(value = 1,message = "receiveUserbId不能小于1")
@ApiModelProperty(value = "接收单位B岗") @ApiModelProperty(value = "接收单位B岗")
private Integer receiveUserbId; private Integer receiveUserbId;
@NotNull(message = "fileName不能为空")
@ApiModelProperty(value = "配发单附件名") @ApiModelProperty(value = "配发单附件名")
private String fileName; private String fileName;
@NotNull(message = "fileUrl不能为空")
@ApiModelProperty(value = "配发单附件url") @ApiModelProperty(value = "配发单附件url")
private String fileUrl; private String fileUrl;
@NotNull(message = "receiveFileName不能为空")
@ApiModelProperty(value = "入库单附件名") @ApiModelProperty(value = "入库单附件名")
private String receiveFileName; private String receiveFileName;
@NotNull(message = "receiveFileUrl不能为空")
@ApiModelProperty(value = "入库单附件url") @ApiModelProperty(value = "入库单附件url")
private String receiveFileUrl; private String receiveFileUrl;
@NotNull(message = "storagingCount不能为空")
@Min(value = 1,message = "storagingCount不能小于1")
@ApiModelProperty(value = "待入库数量") @ApiModelProperty(value = "待入库数量")
private Integer storagingCount; private Integer storagingCount;
@NotNull(message = "storagedCount不能为空")
@Min(value = 0,message = "storagedCount不能小于0")
@ApiModelProperty(value = "已入库数量") @ApiModelProperty(value = "已入库数量")
private Integer storagedCount; private Integer storagedCount;
@NotEmpty(message = "deviceLibrarySaveVoList不能为空")
@ApiModelProperty(value = "入库各装备详情") @ApiModelProperty(value = "入库各装备详情")
private List<DeviceLibrarySaveVo> deviceLibrarySaveVoList; private List<DeviceLibrarySaveVo> deviceLibrarySaveVoList;
......
...@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation; ...@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -68,7 +69,7 @@ public class TaskController { ...@@ -68,7 +69,7 @@ public class TaskController {
@ApiOperation(value = "置顶设置", notes = "可以通过这个接口置顶业务") @ApiOperation(value = "置顶设置", notes = "可以通过这个接口置顶业务")
@RequestMapping(method = RequestMethod.PUT, value = "/setTop", produces = MediaType.APPLICATION_JSON_VALUE) @RequestMapping(method = RequestMethod.PUT, value = "/setTop", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity setTop(@RequestBody TaskTopVo taskTopVo) { public ResponseEntity setTop(@RequestBody @Validated TaskTopVo taskTopVo) {
TaskBto taskBto = taskService.get(taskTopVo.getTaskId()); TaskBto taskBto = taskService.get(taskTopVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
List<Integer> userIds = taskBto.getTopFlagDetailList(); List<Integer> userIds = taskBto.getTopFlagDetailList();
...@@ -88,7 +89,7 @@ public class TaskController { ...@@ -88,7 +89,7 @@ public class TaskController {
@ApiOperation(value = "是否已读设置", notes = "可以通过这个接口设置业务的是否已读") @ApiOperation(value = "是否已读设置", notes = "可以通过这个接口设置业务的是否已读")
@PostMapping("/setRead") @PostMapping("/setRead")
public ResponseEntity setRead(@RequestBody TaskTopVo taskTopVo) { public ResponseEntity setRead(@RequestBody @Validated TaskTopVo taskTopVo) {
TaskBto taskBto = taskService.get(taskTopVo.getTaskId()); TaskBto taskBto = taskService.get(taskTopVo.getTaskId());
Integer userId = userUtils.getCurrentUserId(); Integer userId = userUtils.getCurrentUserId();
List<Integer> userIds = taskBto.getUserReadDetailList(); List<Integer> userIds = taskBto.getUserReadDetailList();
......
...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,9 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
/** /**
* @author dengdiyi * @author dengdiyi
*/ */
...@@ -11,9 +14,13 @@ import lombok.Data; ...@@ -11,9 +14,13 @@ import lombok.Data;
@ApiModel("任务置顶类") @ApiModel("任务置顶类")
public class TaskTopVo { public class TaskTopVo {
@NotNull(message = "taskId不能为空")
@Min(value = 1,message = "taskId不能小于1")
@ApiModelProperty(value = "任务Id") @ApiModelProperty(value = "任务Id")
private Integer taskId; private Integer taskId;
@NotNull(message = "topFlag不能为空")
@Min(value = 0,message = "topFlag不能小于0")
@ApiModelProperty(name = "置顶标志", example = "0", value = "0为不置顶,1为置顶") @ApiModelProperty(name = "置顶标志", example = "0", value = "0为不置顶,1为置顶")
private Integer topFlag; private Integer topFlag;
} }
...@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -18,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
...@@ -52,7 +53,7 @@ public class DeviceUseReportController { ...@@ -52,7 +53,7 @@ public class DeviceUseReportController {
@ApiOperation(value = "生成装备使用报告", notes = "可以通过这个接口生成装备使用报告") @ApiOperation(value = "生成装备使用报告", notes = "可以通过这个接口生成装备使用报告")
@PostMapping("/create") @PostMapping("/create")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResponseEntity createDeviceUseReport(@RequestBody DeviceUseReportCreateVo deviceUseReportCreateVo) { public ResponseEntity createDeviceUseReport(@RequestBody @Validated DeviceUseReportCreateVo deviceUseReportCreateVo) {
return ResultUtil.success(deviceUseReportService.createReport(deviceUseReportCreateVo)); return ResultUtil.success(deviceUseReportService.createReport(deviceUseReportCreateVo));
} }
......
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import javax.validation.constraints.NotNull;
import java.util.Date; import java.util.Date;
/** /**
...@@ -15,9 +16,11 @@ import java.util.Date; ...@@ -15,9 +16,11 @@ import java.util.Date;
@Repository @Repository
public class DeviceUseReportCreateVo { public class DeviceUseReportCreateVo {
@NotNull(message = "startTime不能为空")
@ApiModelProperty(value = "开始时间", example = "2020-10-10 01:10:10") @ApiModelProperty(value = "开始时间", example = "2020-10-10 01:10:10")
public Date startTime; public Date startTime;
@NotNull(message = "endTime不能为空")
@ApiModelProperty(value = "结束时间", example = "2020-10-10 01:10:10") @ApiModelProperty(value = "结束时间", example = "2020-10-10 01:10:10")
public Date endTime; public Date endTime;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论