12 changed files with 551 additions and 90 deletions
@ -0,0 +1,40 @@ |
|||
package com.yxt.anrui.scm.api.scmvehicleinbound; |
|||
|
|||
import com.yxt.common.core.domain.BaseEntity; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:23 |
|||
* @Description 车辆入库管理 |
|||
*/ |
|||
@Data |
|||
public class ScmVehicleInbound extends BaseEntity { |
|||
private static final long serialVersionUID = -4365593902000557398L; |
|||
|
|||
@ApiModelProperty(value = "车架号") |
|||
private String vinNo; |
|||
@ApiModelProperty(value = "车型") |
|||
private String modelName; |
|||
@ApiModelProperty(value = "采购订单类型") |
|||
private String orderType; |
|||
@ApiModelProperty(value = "采购订单类型key") |
|||
private String orderTypeKey; |
|||
@ApiModelProperty(value = "发车日期") |
|||
private Date departureDate; |
|||
@ApiModelProperty(value = "验车日期") |
|||
private Date inspectionDate; |
|||
@ApiModelProperty(value = "验车人") |
|||
private String inspection; |
|||
@ApiModelProperty(value = "库位") |
|||
private String warehouseCode; |
|||
@ApiModelProperty(value = "实际入库日期") |
|||
private Date inboundDate; |
|||
@ApiModelProperty(value = "入库人") |
|||
private String inbound; |
|||
@ApiModelProperty(value = "车辆库位照片") |
|||
private String inboundPhoto; |
|||
} |
@ -0,0 +1,18 @@ |
|||
package com.yxt.anrui.scm.api.scmvehicleinbound; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 11:35 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class ScmVehicleInboundDetailsVo implements Vo { |
|||
private static final long serialVersionUID = 6836808201591951508L; |
|||
@ApiModelProperty(value = "入库日期") |
|||
private String inboundDate; |
|||
private String inbound; |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.anrui.scm.api.scmvehicleinbound; |
|||
|
|||
import com.yxt.common.core.dto.Dto; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
import java.util.Date; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 13:44 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class ScmVehicleInboundDto implements Dto { |
|||
private static final long serialVersionUID = 8881859025299917313L; |
|||
@ApiModelProperty(value = "sid") |
|||
private String sid; |
|||
@ApiModelProperty(value = "入库日期") |
|||
private Date inboundDate; |
|||
@ApiModelProperty(value = "入库人") |
|||
private String inbound; |
|||
@ApiModelProperty(value = "库位") |
|||
private String warehouseCode; |
|||
@ApiModelProperty(value = "车辆库位照片") |
|||
private String inboundPhoto; |
|||
@ApiModelProperty(value = "state", example = "0") |
|||
private Integer state; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.yxt.anrui.scm.api.scmvehicleinbound; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import org.springframework.cloud.openfeign.FeignClient; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:38 |
|||
* @Description |
|||
*/ |
|||
@FeignClient( |
|||
contextId = "anrui-scm-ScmVehicleInbound", |
|||
name = "anrui-scm", |
|||
path = "v1/scmvehicleinbound", |
|||
fallback = ScmVehicleInboundFeignFallback.class) |
|||
public interface ScmVehicleInboundFeign { |
|||
|
|||
@ApiOperation("分页列表") |
|||
@PostMapping("/listPage") |
|||
@ResponseBody |
|||
ResultBean<PagerVo<ScmVehicleInboundVo>> listPage(@RequestBody PagerQuery<ScmVehicleInboundQuery> pq); |
|||
|
|||
@ApiOperation("详情") |
|||
@GetMapping("/details/{sid}") |
|||
@ResponseBody |
|||
ResultBean<ScmVehicleInboundDetailsVo> details(@PathVariable(value = "sid") String sid); |
|||
|
|||
@ApiOperation("入库") |
|||
@PutMapping("/update") |
|||
@ResponseBody |
|||
ResultBean update(@RequestBody ScmVehicleInboundDto scmVehicleInboundDto); |
|||
} |
@ -0,0 +1,29 @@ |
|||
package com.yxt.anrui.scm.api.scmvehicleinbound; |
|||
|
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.springframework.stereotype.Component; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:45 |
|||
* @Description |
|||
*/ |
|||
@Component |
|||
public class ScmVehicleInboundFeignFallback implements ScmVehicleInboundFeign{ |
|||
@Override |
|||
public ResultBean<PagerVo<ScmVehicleInboundVo>> listPage(PagerQuery<ScmVehicleInboundQuery> pq) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean<ScmVehicleInboundDetailsVo> details(String sid) { |
|||
return null; |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean update(ScmVehicleInboundDto scmVehicleInboundDto) { |
|||
return null; |
|||
} |
|||
} |
@ -0,0 +1,22 @@ |
|||
package com.yxt.anrui.scm.api.scmvehicleinbound; |
|||
|
|||
import com.yxt.common.core.query.Query; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:46 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class ScmVehicleInboundQuery implements Query { |
|||
private static final long serialVersionUID = 8341302890735507578L; |
|||
|
|||
@ApiModelProperty(value = "车架号") |
|||
private String vinNo; |
|||
@ApiModelProperty(value = "车型") |
|||
private String modelName; |
|||
@ApiModelProperty(value = "采购订单类型key") |
|||
private String orderTypeKey; |
|||
} |
@ -0,0 +1,36 @@ |
|||
package com.yxt.anrui.scm.api.scmvehicleinbound; |
|||
|
|||
import com.yxt.common.core.vo.Vo; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:46 |
|||
* @Description |
|||
*/ |
|||
@Data |
|||
public class ScmVehicleInboundVo implements Vo { |
|||
private static final long serialVersionUID = 4307351025090414758L; |
|||
@ApiModelProperty(value = "sid") |
|||
private String sid; |
|||
@ApiModelProperty(value = "状态") |
|||
private String state; |
|||
@ApiModelProperty(value = "车架号") |
|||
private String vinNo; |
|||
@ApiModelProperty(value = "车型") |
|||
private String modelName; |
|||
@ApiModelProperty(value = "订单类型") |
|||
private String orderType; |
|||
@ApiModelProperty(value = "发车日期") |
|||
private String departureDate; |
|||
@ApiModelProperty(value = "验车日期") |
|||
private String inspection; |
|||
@ApiModelProperty(value = "仓库名称") |
|||
private String warehouseName; |
|||
@ApiModelProperty(value = "仓库负责人") |
|||
private String warehouseContract; |
|||
@ApiModelProperty(value = "实际入库日期") |
|||
private String inboundDate; |
|||
|
|||
} |
@ -0,0 +1,37 @@ |
|||
package com.yxt.anrui.scm.biz.scmvehicleinbound; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.baomidou.mybatisplus.core.toolkit.Constants; |
|||
import com.yxt.anrui.scm.api.scmvehicleinbound.ScmVehicleInbound; |
|||
import com.yxt.anrui.scm.api.scmvehicleinbound.ScmVehicleInboundDetailsVo; |
|||
import com.yxt.anrui.scm.api.scmvehicleinbound.ScmVehicleInboundVo; |
|||
import org.apache.ibatis.annotations.Mapper; |
|||
import org.apache.ibatis.annotations.Param; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:55 |
|||
* @Description |
|||
*/ |
|||
@Mapper |
|||
public interface ScmVehicleInboundMapper extends BaseMapper<ScmVehicleInbound> { |
|||
|
|||
/** |
|||
* 分页列表 |
|||
* |
|||
* @param page 分页 |
|||
* @param qw 查询条件 |
|||
* @return |
|||
*/ |
|||
IPage<ScmVehicleInboundVo> pagerList(IPage<ScmVehicleInboundVo> page, @Param(Constants.WRAPPER) QueryWrapper<ScmVehicleInboundVo> qw); |
|||
|
|||
/** |
|||
* 详情 |
|||
* |
|||
* @param sid 车辆入库管理sid |
|||
* @return |
|||
*/ |
|||
ScmVehicleInboundDetailsVo details(@Param("sid") String sid, @Param("path") String path); |
|||
} |
@ -0,0 +1,29 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
|||
<mapper namespace="com.yxt.anrui.scm.biz.scmvehicleinbound.ScmVehicleInboundMapper"> |
|||
<select id="pagerList" resultType="com.yxt.anrui.scm.api.scmvehicleinbound.ScmVehicleInboundVo"> |
|||
select si.sid, |
|||
case si.state |
|||
when 1 then '待入库' |
|||
when 0 then '已入库' |
|||
end as state, |
|||
si.vinNo, |
|||
si.modelName, |
|||
si.orderType, |
|||
DATE_FORMAT(si.departureDate, '%Y-%m-%d') as departureDate, |
|||
DATE_FORMAT(si.inspectionDate, '%Y-%m-%d') as inspectionDate, |
|||
si.inspection, |
|||
sw.warehouseName, |
|||
sw.warehouseContract, |
|||
DATE_FORMAT(si.inboundDate, '%Y-%m-%d') as inboundDate |
|||
from scm_vehicle_inbound si |
|||
left join scm_warehouse sw on si.warehouseCode = sw.warehouseCode |
|||
${ew.customSqlSegment} |
|||
</select> |
|||
|
|||
<select id="details" resultType="com.yxt.anrui.scm.api.scmvehicleinbound.ScmVehicleInboundDetailsVo"> |
|||
select si.inboundDate, si.inbound, si.vinNo, si.warehouseCode, concat(#{path}, si.inboundPhoto) |
|||
from scm_vehicle_inbound si |
|||
where si.sid = #{sid} |
|||
</select> |
|||
</mapper> |
@ -0,0 +1,39 @@ |
|||
package com.yxt.anrui.scm.biz.scmvehicleinbound; |
|||
|
|||
import com.yxt.anrui.scm.api.scmvehicleinbound.*; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import io.swagger.annotations.Api; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:49 |
|||
* @Description |
|||
*/ |
|||
@Api(tags = "车辆入库管理") |
|||
@RequestMapping("v1/scmvehicleinbound") |
|||
public class ScmVehicleInboundRest implements ScmVehicleInboundFeign { |
|||
|
|||
@Autowired |
|||
private ScmVehicleInboundService scmVehicleInboundService; |
|||
|
|||
@Override |
|||
public ResultBean<PagerVo<ScmVehicleInboundVo>> listPage(PagerQuery<ScmVehicleInboundQuery> pq) { |
|||
ResultBean<PagerVo<ScmVehicleInboundVo>> rb = ResultBean.fireFail(); |
|||
PagerVo<ScmVehicleInboundVo> pv = scmVehicleInboundService.listPage(pq); |
|||
return rb.success().setData(pv); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean<ScmVehicleInboundDetailsVo> details(String sid) { |
|||
return scmVehicleInboundService.details(sid); |
|||
} |
|||
|
|||
@Override |
|||
public ResultBean update(ScmVehicleInboundDto scmVehicleInboundDto) { |
|||
return scmVehicleInboundService.updateScmVehicleInbound(scmVehicleInboundDto); |
|||
} |
|||
} |
@ -0,0 +1,117 @@ |
|||
package com.yxt.anrui.scm.biz.scmvehicleinbound; |
|||
|
|||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|||
import com.yxt.anrui.scm.api.scmvehicleinbound.*; |
|||
import com.yxt.common.base.config.component.FileUploadComponent; |
|||
import com.yxt.common.base.service.MybatisBaseService; |
|||
import com.yxt.common.base.utils.PagerUtil; |
|||
import com.yxt.common.core.query.PagerQuery; |
|||
import com.yxt.common.core.result.ResultBean; |
|||
import com.yxt.common.core.vo.PagerVo; |
|||
import org.apache.commons.lang3.StringUtils; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
/** |
|||
* @Author dimengzhe |
|||
* @Date 2022/4/6 10:55 |
|||
* @Description |
|||
*/ |
|||
@Service |
|||
public class ScmVehicleInboundService extends MybatisBaseService<ScmVehicleInboundMapper, ScmVehicleInbound> { |
|||
|
|||
@Autowired |
|||
private FileUploadComponent fileUploadComponent; |
|||
|
|||
/** |
|||
* 分页列表 |
|||
* |
|||
* @param pq 查询条件 |
|||
* @return 分页列表 |
|||
*/ |
|||
public PagerVo<ScmVehicleInboundVo> listPage(PagerQuery<ScmVehicleInboundQuery> pq) { |
|||
IPage<ScmVehicleInboundVo> page = pagerList(pq); |
|||
PagerVo<ScmVehicleInboundVo> pv = new PagerVo<>(); |
|||
PagerVo<ScmVehicleInboundVo> pv1 = PagerUtil.pageToVo(page, pv); |
|||
return pv1; |
|||
} |
|||
|
|||
/** |
|||
* 分页列表数据获取 |
|||
* |
|||
* @param pq 查询条件 |
|||
* @return 数据获取 |
|||
*/ |
|||
public IPage<ScmVehicleInboundVo> pagerList(PagerQuery<ScmVehicleInboundQuery> pq) { |
|||
IPage<ScmVehicleInboundVo> page = PagerUtil.queryToPage(pq); |
|||
QueryWrapper<ScmVehicleInboundVo> qw = buildQueryWrapper(pq.getParams()); |
|||
return baseMapper.pagerList(page, qw); |
|||
} |
|||
|
|||
/** |
|||
* 封装查询条件 |
|||
* |
|||
* @param params 查询条件参数 |
|||
* @return |
|||
*/ |
|||
private QueryWrapper<ScmVehicleInboundVo> buildQueryWrapper(ScmVehicleInboundQuery params) { |
|||
QueryWrapper<ScmVehicleInboundVo> qw = new QueryWrapper<>(); |
|||
if (params != null) { |
|||
//车架号
|
|||
if (StringUtils.isNotBlank(params.getVinNo())) { |
|||
qw.eq("si.vinNo", params.getVinNo()); |
|||
} |
|||
//车型
|
|||
if (StringUtils.isNotBlank(params.getModelName())) { |
|||
qw.like("si.modelName", params.getModelName()); |
|||
} |
|||
//订单类型
|
|||
if (StringUtils.isNotBlank(params.getOrderTypeKey())) { |
|||
qw.eq("si.orderTypeKey", params.getOrderTypeKey()); |
|||
} |
|||
} |
|||
return qw; |
|||
} |
|||
|
|||
/** |
|||
* 车辆入库详情 |
|||
* |
|||
* @param sid 车辆入库管理sid |
|||
* @return |
|||
*/ |
|||
public ResultBean<ScmVehicleInboundDetailsVo> details(String sid) { |
|||
ResultBean<ScmVehicleInboundDetailsVo> rb = ResultBean.fireFail(); |
|||
ScmVehicleInbound scmVehicleInbound = fetchBySid(sid); |
|||
if (scmVehicleInbound == null) { |
|||
return rb.setMsg("该数据不存在"); |
|||
} |
|||
String path = fileUploadComponent.getUrlPrefix(); |
|||
ScmVehicleInboundDetailsVo vo = baseMapper.details(sid, path); |
|||
return rb.success().setData(vo); |
|||
} |
|||
|
|||
/** |
|||
* 入库 |
|||
* |
|||
* @param scmVehicleInboundDto 数据传输对象 |
|||
* @return 入库成功或已入库 |
|||
*/ |
|||
public ResultBean updateScmVehicleInbound(ScmVehicleInboundDto scmVehicleInboundDto) { |
|||
ResultBean rb = ResultBean.fireFail(); |
|||
String sid = scmVehicleInboundDto.getSid(); |
|||
ScmVehicleInbound scmVehicleInbound = fetchBySid(sid); |
|||
if (scmVehicleInbound == null) { |
|||
return rb.setMsg("该数据不存在"); |
|||
} |
|||
if (scmVehicleInbound.getState() == 0) { |
|||
return rb.setMsg("该数据状态已是入库,请勿重复操作"); |
|||
} |
|||
|
|||
int i = updateBySid(scmVehicleInboundDto, sid); |
|||
if (i == 0) { |
|||
return rb.setMsg("入库失败"); |
|||
} |
|||
return rb.success().setMsg("入库成功"); |
|||
} |
|||
} |
Loading…
Reference in new issue