From bbaa6f94bebe83b1d73dc752a47b1529c2ab59ef Mon Sep 17 00:00:00 2001 From: alllenliufor3 <1009545232@qq.com> Date: Sat, 2 Apr 2022 17:54:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=BD=A6=E8=BE=86=E5=85=A5?= =?UTF-8?q?=E8=B4=A6=E5=8D=95=E7=9A=84=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/scmapplyinbound/ScmApplyInbound.java | 57 +++++++ .../scmapplyinbound/ScmApplyInboundDto.java | 80 +++++++++ .../scmapplyinbound/ScmApplyInboundFeign.java | 50 ++++++ .../ScmApplyInboundFeignFallback.java | 48 ++++++ .../ScmApplyInboundListVo.java | 38 +++++ .../scmapplyinbound/ScmApplyInboundQuery.java | 32 ++++ .../scmapplyinbound/ScmApplyInboundVo.java | 68 ++++++++ .../ScmApplyInboundVehicle.java | 36 ++++ .../ScmApplyInboundVehicleDto.java | 43 +++++ .../ScmApplyInboundVehicleFeign.java | 37 +++++ .../ScmApplyInboundVehicleFeignFallback.java | 31 ++++ .../ScmApplyInboundVehicleQuery.java | 33 ++++ .../ScmApplyInboundVehicleVo.java | 38 +++++ .../ScmApplyInboundMapper.java | 41 +++++ .../scmapplyinbound/ScmApplyInboundMapper.xml | 17 ++ .../scmapplyinbound/ScmApplyInboundRest.java | 58 +++++++ .../ScmApplyInboundService.java | 154 ++++++++++++++++++ .../ScmApplyInboundVehicleMapper.java | 39 +++++ .../ScmApplyInboundVehicleMapper.xml | 20 +++ .../ScmApplyInboundVehicleRest.java | 46 ++++++ .../ScmApplyInboundVehicleService.java | 118 ++++++++++++++ 21 files changed, 1084 insertions(+) create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInbound.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundDto.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeign.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeignFallback.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundListVo.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundQuery.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundVo.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicle.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleDto.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeign.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeignFallback.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleQuery.java create mode 100644 anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleVo.java create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.java create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.xml create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundRest.java create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundService.java create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.java create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.xml create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleRest.java create mode 100644 anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleService.java diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInbound.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInbound.java new file mode 100644 index 0000000000..498dce8670 --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInbound.java @@ -0,0 +1,57 @@ +package com.yxt.anrui.scm.api.scmapplyinbound; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.yxt.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInbound.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInbound
+ * Description: 车辆入账单.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "车辆入账单", description = "车辆入账单") +@TableName("scm_apply_inbound") +@Data +public class ScmApplyInbound extends BaseEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("申请编号") + private String applicationCode; + + @ApiModelProperty("申请人sid") + private String applicationSid; + + @ApiModelProperty("申请人名称") + private String applicationName; + + @ApiModelProperty("申请日期") + private String applicationDate; + + @ApiModelProperty("采购订单sid") + private String vehicleOrderSid; + + @ApiModelProperty("采购订单编号") + private String purchaseOrderNo; + + @ApiModelProperty("车型sid ") + private String modelSid; + + @ApiModelProperty("车型名称 ") + private String modelName; + + @ApiModelProperty("常用配置 ") + private String configName; + + @ApiModelProperty("厂家发车日期") + private String departureDate; +} diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundDto.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundDto.java new file mode 100644 index 0000000000..cd321ffdda --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundDto.java @@ -0,0 +1,80 @@ +package com.yxt.anrui.scm.api.scmapplyinbound; + + +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleDto; +import com.yxt.common.core.dto.Dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Pattern; +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundDto.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundDto
+ * Description: 车辆入账单 数据传输对象.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "车辆入账单 数据传输对象", description = "车辆入账单 数据传输对象") +@Data +public class ScmApplyInboundDto implements Dto { + + @ApiModelProperty("车辆入账单sid") + private String sid; + + @ApiModelProperty("申请编号") + @NotBlank(message = "申请编号不能为空") + private String applicationCode; + + @ApiModelProperty("申请人sid") + @NotBlank(message = "申请人不能为空") + private String applicationSid; + + @ApiModelProperty("申请人名称") + @NotBlank(message = "申请人不能为空") + private String applicationName; + + @ApiModelProperty("申请日期") + @Pattern(regexp = "^(\\s*)|([1-9]\\d{3}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1]))$", message = "申请日期日期格式不正确") + private String applicationDate; + + @ApiModelProperty("采购订单sid") + @NotBlank(message = "采购订单不能为空") + private String vehicleOrderSid; + + @ApiModelProperty("采购订单编号") + @NotBlank(message = "采购订单编号不能为空") + private String purchaseOrderNo; + + @ApiModelProperty("车型sid ") + @NotBlank(message = "车型不能为空") + private String modelSid; + + @ApiModelProperty("车型名称 ") + @NotBlank(message = "车型名称不能为空") + private String modelName; + + @ApiModelProperty("常用配置 ") + @NotBlank(message = "常用配置不能为空") + private String configName; + + @ApiModelProperty("厂家发车日期") + private String departureDate; + + @ApiModelProperty("备注") + private String remarks; + + @ApiModelProperty("车辆列表") + private List vehicleList; +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeign.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeign.java new file mode 100644 index 0000000000..dbbee9ce5d --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeign.java @@ -0,0 +1,50 @@ +package com.yxt.anrui.scm.api.scmapplyinbound; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundFeign.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundFeign
+ * Description: 车辆入账单.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Api(tags = "车辆入账单") +@FeignClient( + contextId = "anrui-scm-ScmApplyInbound", + name = "anrui-scm", + path = "v1/scmapplyinbound", + fallback = ScmApplyInboundFeignFallback.class) +public interface ScmApplyInboundFeign { + + @ApiOperation("根据条件分页查询车辆入账单的列表") + @PostMapping("/listPage") + public ResultBean> listPage(@RequestBody PagerQuery pq); + + @ApiOperation("根据条件查询所有数据列表") + @PostMapping("/listAll") + public ResultBean> listAll(@RequestBody ScmApplyInboundQuery query); + + @ApiOperation("新增和修改车辆入账单") + @PostMapping("/saveOrUpdateApplyInBound") + public ResultBean saveOrUpdateApplyInBound(@RequestBody @Valid ScmApplyInboundDto dto); + + @ApiOperation("根据sid查询车辆入账单详情") + @GetMapping("/fetchSid/{sid}") + public ResultBean fetchSid(@PathVariable("sid") String sid); +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeignFallback.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeignFallback.java new file mode 100644 index 0000000000..c4199dd09b --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundFeignFallback.java @@ -0,0 +1,48 @@ +package com.yxt.anrui.scm.api.scmapplyinbound; + +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; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundFeignFallback.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundFeignFallback
+ * Description: 车辆入账单.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Component +public class ScmApplyInboundFeignFallback implements ScmApplyInboundFeign { + + @Override + public ResultBean listPage(PagerQuery pq){ + ResultBean rb = ResultBean.fireFail(); + return rb.setMsg("接口anrui-scm/scmapplyinbound/listPage无法访问"); + } + + @Override + public ResultBean> listAll(ScmApplyInboundQuery query){ + ResultBean rb = ResultBean.fireFail(); + return rb.setMsg("接口anrui-scm/scmapplyinbound/listAll无法访问"); + } + + @Override + public ResultBean saveOrUpdateApplyInBound(ScmApplyInboundDto dto){ + return ResultBean.fireFail().setMsg("接口anrui-scm/scmapplyinbound/save无法访问"); + } + + @Override + public ResultBean fetchSid(String sid) { + ResultBean rb = ResultBean.fireFail(); + return rb.setMsg("接口anrui-scm/scmapplyinbound/fetchSid无法访问"); + } +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundListVo.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundListVo.java new file mode 100644 index 0000000000..070d2540bc --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundListVo.java @@ -0,0 +1,38 @@ +package com.yxt.anrui.scm.api.scmapplyinbound; + +import com.yxt.common.core.vo.Vo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liuguohui + * @version 1.0 + * @description + * @date 2022/04/02 + */ +@ApiModel("入账申请列表") +@Data +public class ScmApplyInboundListVo implements Vo { + + @ApiModelProperty("车辆入账单sid") + private String sid; + + @ApiModelProperty("申请编号") + private String applicationCode; + + @ApiModelProperty("申请日期") + private String applicationDate; + + @ApiModelProperty("采购订单编号") + private String purchaseOrderNo; + + @ApiModelProperty("车型名称 ") + private String modelName; + + @ApiModelProperty("台数 ") + private String vehicleNum; + + @ApiModelProperty("状态 ") + private String nodeState; +} diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundQuery.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundQuery.java new file mode 100644 index 0000000000..4881acb262 --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundQuery.java @@ -0,0 +1,32 @@ +package com.yxt.anrui.scm.api.scmapplyinbound; + + +import com.yxt.common.core.query.Query; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundQuery.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundQuery
+ * Description: 车辆入账单 查询条件.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "车辆入账单 查询条件", description = "车辆入账单 查询条件") +@Data +public class ScmApplyInboundQuery implements Query { + + @ApiModelProperty("采购订单编号") + private String purchaseOrderNo; + + @ApiModelProperty("车型") + private String modelName; +} diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundVo.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundVo.java new file mode 100644 index 0000000000..37a6ebe97e --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinbound/ScmApplyInboundVo.java @@ -0,0 +1,68 @@ +package com.yxt.anrui.scm.api.scmapplyinbound; + + +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo; +import com.yxt.common.core.vo.Vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVo.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundVo
+ * Description: 车辆入账单 视图数据对象.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "车辆入账单 视图数据对象", description = "车辆入账单 视图数据对象") +@Data +public class ScmApplyInboundVo implements Vo { + + @ApiModelProperty("车辆入账单sid") + private String sid; + + @ApiModelProperty("申请编号") + private String applicationCode; + + @ApiModelProperty("申请人sid") + private String applicationSid; + + @ApiModelProperty("申请人名称") + private String applicationName; + + @ApiModelProperty("申请日期") + private String applicationDate; + + @ApiModelProperty("采购订单sid") + private String vehicleOrderSid; + + @ApiModelProperty("采购订单编号") + private String purchaseOrderNo; + + @ApiModelProperty("车型sid ") + private String modelSid; + + @ApiModelProperty("车型名称 ") + private String modelName; + + @ApiModelProperty("常用配置 ") + private String configName; + + @ApiModelProperty("厂家发车日期") + private String departureDate; + + @ApiModelProperty("备注") + private String remarks; + + @ApiModelProperty("车辆列表") + private List inboundVehicleList; +} diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicle.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicle.java new file mode 100644 index 0000000000..6b66c7c0a2 --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicle.java @@ -0,0 +1,36 @@ +package com.yxt.anrui.scm.api.scmapplyinboundvehicle; + +import com.baomidou.mybatisplus.annotation.TableName; +import com.yxt.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicle.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicle
+ * Description: 入库车辆信息.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "入库车辆信息", description = "入库车辆信息") +@TableName("scm_apply_inbound_vehicle") +@Data +public class ScmApplyInboundVehicle extends BaseEntity { + private static final long serialVersionUID = 1L; + + @ApiModelProperty("车辆入库单sid") + private String applySid; + + @ApiModelProperty("车型sid") + private String modelSid; + + @ApiModelProperty("车架号(VIN)") + private String vinNo; +} diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleDto.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleDto.java new file mode 100644 index 0000000000..2990c9cbd4 --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleDto.java @@ -0,0 +1,43 @@ +package com.yxt.anrui.scm.api.scmapplyinboundvehicle; + + +import com.yxt.common.core.dto.Dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleDto.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleDto
+ * Description: 入库车辆信息 数据传输对象.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "入库车辆信息 数据传输对象", description = "入库车辆信息 数据传输对象") +@Data +public class ScmApplyInboundVehicleDto implements Dto { + + @ApiModelProperty("车辆信息sid") + private String sid; + + @ApiModelProperty("车辆入库单sid") + private String applySid; + + @ApiModelProperty("车型sid") + private String modelSid; + + @ApiModelProperty("车架号(VIN)") + private String vinNo; + + @ApiModelProperty("备注") + private String remarks; +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeign.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeign.java new file mode 100644 index 0000000000..161f65c478 --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeign.java @@ -0,0 +1,37 @@ +package com.yxt.anrui.scm.api.scmapplyinboundvehicle; + +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import com.yxt.common.core.query.PagerQuery; +import com.yxt.common.core.result.ResultBean; +import com.yxt.common.core.vo.PagerVo; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleFeign.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleFeign
+ * Description: 入库车辆信息.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Api(tags = "入库车辆信息") +@FeignClient( + contextId = "anrui-scm-ScmApplyInboundVehicle", + name = "anrui-scm", + path = "v1/scmapplyinboundvehicle", + fallback = ScmApplyInboundVehicleFeignFallback.class) +public interface ScmApplyInboundVehicleFeign { + + @ApiOperation("根据条件分页查询数据的列表") + @PostMapping("/listPage") + public ResultBean> listPage(@RequestBody PagerQuery pq); +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeignFallback.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeignFallback.java new file mode 100644 index 0000000000..0a29cf08de --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleFeignFallback.java @@ -0,0 +1,31 @@ +package com.yxt.anrui.scm.api.scmapplyinboundvehicle; + +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; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleFeignFallback.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleFeignFallback
+ * Description: 入库车辆信息.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Component +public class ScmApplyInboundVehicleFeignFallback implements ScmApplyInboundVehicleFeign { + + @Override + public ResultBean> listPage(PagerQuery pq){ + ResultBean rb = ResultBean.fireFail(); + return rb.setMsg("接口anrui-scm/scmapplyinboundvehicle/listPage无法访问"); + } +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleQuery.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleQuery.java new file mode 100644 index 0000000000..37f5503593 --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleQuery.java @@ -0,0 +1,33 @@ +package com.yxt.anrui.scm.api.scmapplyinboundvehicle; + + +import com.yxt.common.core.query.Query; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleQuery.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleQuery
+ * Description: 入库车辆信息 查询条件.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "入库车辆信息 查询条件", description = "入库车辆信息 查询条件") +@Data +public class ScmApplyInboundVehicleQuery implements Query { + + + @ApiModelProperty("车型sid") + private String modelSid; + + @ApiModelProperty("车架号(VIN)") + private String vinNo; +} diff --git a/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleVo.java b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleVo.java new file mode 100644 index 0000000000..abbf2a76f9 --- /dev/null +++ b/anrui-scm/anrui-scm-api/src/main/java/com/yxt/anrui/scm/api/scmapplyinboundvehicle/ScmApplyInboundVehicleVo.java @@ -0,0 +1,38 @@ +package com.yxt.anrui.scm.api.scmapplyinboundvehicle; + + +import com.yxt.common.core.vo.Vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleVo.java
+ * Class: com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo
+ * Description: 入库车辆信息 视图数据对象.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@ApiModel(value = "入库车辆信息 视图数据对象", description = "入库车辆信息 视图数据对象") +@Data +public class ScmApplyInboundVehicleVo implements Vo { + + @ApiModelProperty("车辆信息sid") + private String sid; + + @ApiModelProperty("车辆入库单sid") + private String applySid; + + @ApiModelProperty("车型sid") + private String modelSid; + + @ApiModelProperty("车架号(VIN)") + private String vinNo; +} diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.java new file mode 100644 index 0000000000..3cb96fcd0c --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.java @@ -0,0 +1,41 @@ +package com.yxt.anrui.scm.biz.scmapplyinbound; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundListVo; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInbound; +import com.yxt.anrui.scm.api.scmapplyinbound.ScmApplyInboundVo; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundMapper.java
+ * Class: com.yxt.anrui.scm.biz.scmapplyinbound.ScmApplyInboundMapper
+ * Description: 车辆入账单.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Mapper +public interface ScmApplyInboundMapper extends BaseMapper { + + //@Update("update scm_apply_inbound set name=#{msg} where id=#{id}") + //IPage voPage(IPage page, @Param(Constants.WRAPPER) QueryWrapper qw); + + IPage selectPageVo(IPage page, @Param(Constants.WRAPPER) Wrapper qw); + + List selectListAllVo(@Param(Constants.WRAPPER) Wrapper qw); + + @Select("select * from scm_apply_inbound") + List selectListVo(); +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.xml b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.xml new file mode 100644 index 0000000000..fdb4f1dc7d --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundMapper.xml @@ -0,0 +1,17 @@ + + + + + + + + + \ No newline at end of file diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundRest.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundRest.java new file mode 100644 index 0000000000..50d309d412 --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundRest.java @@ -0,0 +1,58 @@ +package com.yxt.anrui.scm.biz.scmapplyinbound; + +import cn.hutool.core.bean.BeanUtil; +import com.yxt.anrui.scm.api.scmapplyinbound.*; +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.*; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundFeignFallback.java
+ * Class: com.yxt.anrui.scm.biz.scmapplyinbound.ScmApplyInboundRest
+ * Description: 车辆入账单.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Api(tags = "车辆入账单") +@RestController +@RequestMapping("v1/scmapplyinbound") +public class ScmApplyInboundRest implements ScmApplyInboundFeign { + + @Autowired + private ScmApplyInboundService scmApplyInboundService; + + @Override + public ResultBean> listPage(@RequestBody PagerQuery pq){ + ResultBean rb = ResultBean.fireFail(); + PagerVo pv = scmApplyInboundService.listPageVo(pq); + return rb.success().setData(pv); + } + + @Override + public ResultBean> listAll(@RequestBody ScmApplyInboundQuery query){ + ResultBean rb = ResultBean.fireFail(); + List list = scmApplyInboundService.listAllVo(query); + return rb.success().setData(list); + } + + @Override + public ResultBean saveOrUpdateApplyInBound(ScmApplyInboundDto dto){ + return scmApplyInboundService.saveOrUpdateApplyInBound(dto); + } + + @Override + public ResultBean fetchSid(String sid) { + return new ResultBean().setData(scmApplyInboundService.selectBySid(sid)); + } +} diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundService.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundService.java new file mode 100644 index 0000000000..d2414df03e --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinbound/ScmApplyInboundService.java @@ -0,0 +1,154 @@ +package com.yxt.anrui.scm.biz.scmapplyinbound; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.yxt.anrui.scm.api.scmapplyinbound.*; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicle; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleDto; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo; +import com.yxt.anrui.scm.biz.scmapplyinboundvehicle.ScmApplyInboundVehicleService; +import org.apache.commons.lang3.StringUtils; +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.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundService.java
+ * Class: com.yxt.anrui.scm.biz.scmapplyinbound.ScmApplyInboundService
+ * Description: 车辆入账单 业务逻辑.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 11:54:35
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Service +public class ScmApplyInboundService extends MybatisBaseService { + + @Autowired + private ScmApplyInboundVehicleService scmApplyInboundVehicleService; + + public PagerVo listPage(PagerQuery pq) { + ScmApplyInboundQuery query = pq.getParams(); + QueryWrapper qw = createQueryWrapper(query); + IPage page = PagerUtil.queryToPage(pq); + IPage pagging = baseMapper.selectPage(page, qw); + PagerVo p = PagerUtil.pageToVo(pagging, null); + return p; + } + public List listAll(ScmApplyInboundQuery query) { + QueryWrapper qw = createQueryWrapper(query); + return baseMapper.selectList(qw); + } + private QueryWrapper createQueryWrapper(ScmApplyInboundQuery query) { + // todo: 这里根据具体业务调整查询条件 + // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); + QueryWrapper qw = new QueryWrapper<>(); + + if (StringUtils.isNotBlank(query.getPurchaseOrderNo())) { + qw.like("purchaseOrderNo", query.getPurchaseOrderNo()); + } + + if (StringUtils.isNotBlank(query.getModelName())) { + qw.like("modelName", query.getModelName()); + } + return qw; + } + + public PagerVo listPageVo(PagerQuery pq) { + ScmApplyInboundQuery query = pq.getParams(); + QueryWrapper qw = createQueryWrapper(query); + IPage page = PagerUtil.queryToPage(pq); + IPage pagging = baseMapper.selectPageVo(page, qw); + PagerVo p = PagerUtil.pageToVo(pagging, null); + return p; + } + + public List listAllVo(ScmApplyInboundQuery query) { + QueryWrapper qw = createQueryWrapper(query); + return baseMapper.selectListAllVo(qw); + } + + public List listVo() { + return baseMapper.selectListVo(); + } + + /** + * 新增和修改车辆入账单 + * @param dto + */ + @Transactional(rollbackFor = Exception.class) + public ResultBean saveOrUpdateApplyInBound(ScmApplyInboundDto dto){ + // 验证车架号:不能为空、不能重复 + List vehicleList = dto.getVehicleList(); + List vinNoList = vehicleList.stream().filter(vehicle -> StringUtils.isNotBlank(vehicle.getVinNo())).map(vehicle -> vehicle.getVinNo()).collect(Collectors.toList()); + if (vehicleList.size() != vinNoList.size()) { + return new ResultBean().fail().setMsg("车架号不能为空"); + } + // 去重 + long disCount = vinNoList.stream().distinct().count(); + if (vinNoList.size() != disCount) { + return new ResultBean().fail().setMsg("车架号不能重复"); + } + + if (StringUtils.isBlank(dto.getSid())) { // 新增 + // 验证数据库是否重复 + for (int i = 0; i < vinNoList.size(); i++) { + int count = scmApplyInboundVehicleService.checkVinNo(vinNoList.get(i), ""); + if (count != 0) { + return new ResultBean().setMsg("车架号已经存在"); + } + } + ScmApplyInbound inboundVehicle = new ScmApplyInbound(); + BeanUtil.copyProperties(dto, inboundVehicle); + inboundVehicle.setSid(UUID.randomUUID().toString()); + save(inboundVehicle); + // 保存车辆列表 + scmApplyInboundVehicleService.saveApplyInboundVehicleList(vehicleList, inboundVehicle.getSid(), inboundVehicle.getModelSid()); + return new ResultBean().success().setMsg("保存成功"); + } else { // 修改 + // 采购订单下线日期一旦维护,二次确认,则不能修改 TODO + // 验证数据库是否重复 + for (int i = 0; i < vinNoList.size(); i++) { + int count = scmApplyInboundVehicleService.checkVinNo(vinNoList.get(i), dto.getSid()); + if (count != 0) { + return new ResultBean().setMsg("车架号已经存在"); + } + } + ScmApplyInbound scmApplyInbound = fetchBySid(dto.getSid()); + BeanUtil.copyProperties(dto, scmApplyInbound); + updateById(scmApplyInbound); + // 更新车辆列表信息 + scmApplyInboundVehicleService.updateApplyInboundVehicleList(vehicleList); + return new ResultBean().success().setMsg("修改成功"); + } + } + + /** + * 根据sid查询车辆入账单详情 + * @param sid + * @return + */ + public ScmApplyInboundVo selectBySid(String sid) { + ScmApplyInboundVo vo = new ScmApplyInboundVo(); + ScmApplyInbound scmApplyInbound = fetchBySid(sid); + BeanUtil.copyProperties(scmApplyInbound, vo); + List list = scmApplyInboundVehicleService.selectListByAppSid(sid); + vo.setInboundVehicleList(list); + return vo; + } +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.java new file mode 100644 index 0000000000..cb9922dcd3 --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.java @@ -0,0 +1,39 @@ +package com.yxt.anrui.scm.biz.scmapplyinboundvehicle; + +import com.baomidou.mybatisplus.core.conditions.Wrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.toolkit.Constants; +import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicle; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleMapper.java
+ * Class: com.yxt.anrui.scm.biz.scmapplyinboundvehicle.ScmApplyInboundVehicleMapper
+ * Description: 入库车辆信息.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Mapper +public interface ScmApplyInboundVehicleMapper extends BaseMapper { + + //@Update("update scm_apply_inbound_vehicle set name=#{msg} where id=#{id}") + //IPage voPage(IPage page, @Param(Constants.WRAPPER) QueryWrapper qw); + + IPage selectPageVo(IPage page, @Param(Constants.WRAPPER) Wrapper qw); + + int checkVinNo(@Param("vinNo") String vinNo, @Param("applySid") String applySid); + + List selectListByAppSid(@Param("applySid") String applySid); +} \ No newline at end of file diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.xml b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.xml new file mode 100644 index 0000000000..d1a4f45c52 --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleMapper.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleRest.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleRest.java new file mode 100644 index 0000000000..3d3598cb7c --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleRest.java @@ -0,0 +1,46 @@ +package com.yxt.anrui.scm.biz.scmapplyinboundvehicle; + +import cn.hutool.core.bean.BeanUtil; +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 io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicle; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleQuery; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleDto; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleFeign; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleFeignFallback.java
+ * Class: com.yxt.anrui.scm.biz.scmapplyinboundvehicle.ScmApplyInboundVehicleRest
+ * Description: 入库车辆信息.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Api(tags = "入库车辆信息") +@RestController +@RequestMapping("v1/scmapplyinboundvehicle") +public class ScmApplyInboundVehicleRest implements ScmApplyInboundVehicleFeign { + + @Autowired + private ScmApplyInboundVehicleService scmApplyInboundVehicleService; + + @Override + public ResultBean> listPage(@RequestBody PagerQuery pq){ + ResultBean rb = ResultBean.fireFail(); + PagerVo pv = scmApplyInboundVehicleService.listPageVo(pq); + return rb.success().setData(pv); + } +} diff --git a/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleService.java b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleService.java new file mode 100644 index 0000000000..695f321584 --- /dev/null +++ b/anrui-scm/anrui-scm-biz/src/main/java/com/yxt/anrui/scm/biz/scmapplyinboundvehicle/ScmApplyInboundVehicleService.java @@ -0,0 +1,118 @@ +package com.yxt.anrui.scm.biz.scmapplyinboundvehicle; + +import cn.hutool.core.bean.BeanUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import org.apache.commons.lang3.StringUtils; +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 com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicle; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleQuery; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleVo; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleDto; +import com.yxt.anrui.scm.api.scmapplyinboundvehicle.ScmApplyInboundVehicleFeign; + +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * Project: anrui-scm(进销存)
+ * File: ScmApplyInboundVehicleService.java
+ * Class: com.yxt.anrui.scm.biz.scmapplyinboundvehicle.ScmApplyInboundVehicleService
+ * Description: 入库车辆信息 业务逻辑.
+ * Copyright: Copyright (c) 2011
+ * Company: https://gitee.com/liuzp315
+ * Makedate: 2022-04-02 12:00:53
+ * + * @author liupopo + * @version 1.0 + * @since 1.0 + */ +@Service +public class ScmApplyInboundVehicleService extends MybatisBaseService { + public PagerVo listPage(PagerQuery pq) { + ScmApplyInboundVehicleQuery query = pq.getParams(); + QueryWrapper qw = createQueryWrapper(query); + IPage page = PagerUtil.queryToPage(pq); + IPage pagging = baseMapper.selectPage(page, qw); + PagerVo p = PagerUtil.pageToVo(pagging, null); + return p; + } + public List listAll(ScmApplyInboundVehicleQuery query) { + QueryWrapper qw = createQueryWrapper(query); + return baseMapper.selectList(qw); + } + private QueryWrapper createQueryWrapper(ScmApplyInboundVehicleQuery query) { + // todo: 这里根据具体业务调整查询条件 + // 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName())); + QueryWrapper qw = new QueryWrapper<>(); + + + if (StringUtils.isNotBlank(query.getModelSid())) { + qw.eq("modelSid", query.getModelSid()); + } + + if (StringUtils.isNotBlank(query.getVinNo())) { + qw.eq("vinNo", query.getVinNo()); + } + return qw; + } + + public PagerVo listPageVo(PagerQuery pq) { + ScmApplyInboundVehicleQuery query = pq.getParams(); + QueryWrapper qw = createQueryWrapper(query); + IPage page = PagerUtil.queryToPage(pq); + IPage pagging = baseMapper.selectPageVo(page, qw); + PagerVo p = PagerUtil.pageToVo(pagging, null); + return p; + } + + /** + * 验证车架号是否重复 + * @return + */ + public int checkVinNo(String vinNo, String applySid) { + return baseMapper.checkVinNo(vinNo, applySid); + } + + /** + * 保存车辆列表 + * @param list + * @param applySid + * @param modelSid + */ + public void saveApplyInboundVehicleList(List list, String applySid, String modelSid) { + for (ScmApplyInboundVehicleDto dto : list) { + ScmApplyInboundVehicle inboundVehicle = new ScmApplyInboundVehicle(); + BeanUtil.copyProperties(dto, inboundVehicle); + inboundVehicle.setApplySid(applySid); + inboundVehicle.setModelSid(modelSid); + save(inboundVehicle); + } + } + + /** + * 修改车辆列表 + * @param list + */ + public void updateApplyInboundVehicleList(List list) { + for (ScmApplyInboundVehicleDto dto : list) { + ScmApplyInboundVehicle inboundVehicle = fetchBySid(dto.getSid()); + BeanUtil.copyProperties(dto, inboundVehicle); + updateById(inboundVehicle); + } + } + + /** + * 根据车辆入账单查询车辆信息 + * @param applySid + * @return + */ + public List selectListByAppSid(String applySid) { + return baseMapper.selectListByAppSid(applySid); + } +} \ No newline at end of file