Browse Source

车辆入库优化入库接口及验证

master
dimengzhe 3 years ago
parent
commit
9d4d258a84
  1. 8
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehicleinbound/ScmVehicleInboundDto.java
  2. 4
      anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehicleinbound/ScmVehicleInboundFeign.java
  3. 7
      anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehicleinbound/ScmVehicleInboundService.java

8
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehicleinbound/ScmVehicleInboundDto.java

@ -1,9 +1,12 @@
package com.yxt.anrui.scm.api.scmvehicleinbound;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yxt.common.core.dto.Dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.Date;
/**
@ -15,12 +18,17 @@ import java.util.Date;
public class ScmVehicleInboundDto implements Dto {
private static final long serialVersionUID = 8881859025299917313L;
@ApiModelProperty(value = "sid")
@NotBlank(message = "请选择要入库的数据")
private String sid;
@ApiModelProperty(value = "入库日期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@NotNull(message = "入库日期不能为空")
private Date inboundDate;
@ApiModelProperty(value = "入库人")
@NotBlank(message = "入库人不能为空")
private String inbound;
@ApiModelProperty(value = "库位")
@NotBlank(message = "库位不能为空")
private String warehouseCode;
@ApiModelProperty(value = "车辆库位照片")
private String inboundPhoto;

4
anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmvehicleinbound/ScmVehicleInboundFeign.java

@ -7,6 +7,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
* @Author dimengzhe
* @Date 2022/4/6 10:38
@ -32,5 +34,5 @@ public interface ScmVehicleInboundFeign {
@ApiOperation("入库")
@PutMapping("/update")
@ResponseBody
ResultBean update(@RequestBody ScmVehicleInboundDto scmVehicleInboundDto);
ResultBean update(@Valid @RequestBody ScmVehicleInboundDto scmVehicleInboundDto);
}

7
anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmvehicleinbound/ScmVehicleInboundService.java

@ -13,6 +13,8 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
/**
* @Author dimengzhe
* @Date 2022/4/6 10:55
@ -114,7 +116,10 @@ public class ScmVehicleInboundService extends MybatisBaseService<ScmVehicleInbou
if (scmVehicleInbound.getState() == 0) {
return rb.setMsg("该数据状态已是入库,请勿重复操作");
}
Date date = new Date();
if (date.before(scmVehicleInboundDto.getInboundDate())) {
return rb.setMsg("入库日期不能大于当天日期");
}
int i = updateBySid(scmVehicleInboundDto, sid);
if (i == 0) {
return rb.setMsg("入库失败");

Loading…
Cancel
Save