From 60839d72da5e217abf4134be97f49b69891e0db8 Mon Sep 17 00:00:00 2001 From: "mula.liu" Date: Fri, 11 Apr 2025 15:26:42 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=95=B0=E6=8D=AE=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-druid.yml | 4 +-- .../resources/templates/manage/order/add.html | 33 ++--------------- .../templates/manage/order/edit.html | 36 ++----------------- .../templates/manage/order/order.html | 2 +- .../templates/system/product/add.html | 4 +-- .../templates/system/product/edit.html | 4 +-- .../templates/system/product/product.html | 8 ++--- .../java/com/ruoyi/sip/domain/OrderInfo.java | 2 +- .../java/com/ruoyi/sip/domain/OrderList.java | 14 ++++---- .../mapper/manage/OrderInfoMapper.xml | 10 +++--- 10 files changed, 29 insertions(+), 88 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-druid.yml b/ruoyi-admin/src/main/resources/application-druid.yml index 1f967466..ae606d78 100644 --- a/ruoyi-admin/src/main/resources/application-druid.yml +++ b/ruoyi-admin/src/main/resources/application-druid.yml @@ -6,9 +6,9 @@ spring: druid: # 主库数据源 master: - url: jdbc:mysql://localhost:3306/unis_pms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://121.199.168.157:3306/unis_pms?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: sagacity + password: unis@db # 从库数据源 slave: # 从数据源开关/默认关闭 diff --git a/ruoyi-admin/src/main/resources/templates/manage/order/add.html b/ruoyi-admin/src/main/resources/templates/manage/order/add.html index 7cb986b4..c635d66d 100644 --- a/ruoyi-admin/src/main/resources/templates/manage/order/add.html +++ b/ruoyi-admin/src/main/resources/templates/manage/order/add.html @@ -170,11 +170,11 @@ } }, { - field: 'productId', + field: 'productCode', align: 'center', - title: '产品编码', + title: 'BOM编码', formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); + var html = $.common.sprintf("", index, value); return html; } }, @@ -214,33 +214,6 @@ return html; } }, - { - field: 'createdAt', - align: 'center', - title: '创建时间', - formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); - return html; - } - }, - { - field: 'updatedAt', - align: 'center', - title: '更新时间', - formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); - return html; - } - }, - { - field: 'deletedAt', - align: 'center', - title: '删除时间', - formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); - return html; - } - }, { title: '操作', align: 'center', diff --git a/ruoyi-admin/src/main/resources/templates/manage/order/edit.html b/ruoyi-admin/src/main/resources/templates/manage/order/edit.html index cd28b573..2b4a5d91 100644 --- a/ruoyi-admin/src/main/resources/templates/manage/order/edit.html +++ b/ruoyi-admin/src/main/resources/templates/manage/order/edit.html @@ -172,11 +172,11 @@ } }, { - field: 'productId', + field: 'productCode', align: 'center', - title: '产品编码', + title: 'BOM编码', formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); + var html = $.common.sprintf("", index, value); return html; } }, @@ -221,36 +221,6 @@ } }, - { - field: 'createdAt', - align: 'center', - title: '创建时间', - formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); - return html; - } - }, - - { - field: 'updatedAt', - align: 'center', - title: '更新时间', - formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); - return html; - } - }, - - { - field: 'deletedAt', - align: 'center', - title: '删除时间', - formatter: function(value, row, index) { - var html = $.common.sprintf("", index, value); - return html; - } - }, - { title: '操作', align: 'center', diff --git a/ruoyi-admin/src/main/resources/templates/manage/order/order.html b/ruoyi-admin/src/main/resources/templates/manage/order/order.html index 1fe2ab9f..3251cd91 100644 --- a/ruoyi-admin/src/main/resources/templates/manage/order/order.html +++ b/ruoyi-admin/src/main/resources/templates/manage/order/order.html @@ -82,7 +82,7 @@ }, { field: 'orderCode', - title: '合同编号,唯一' + title: '合同编号' }, { field: 'versionCode', diff --git a/ruoyi-admin/src/main/resources/templates/system/product/add.html b/ruoyi-admin/src/main/resources/templates/system/product/add.html index ffd60041..5a0795c9 100644 --- a/ruoyi-admin/src/main/resources/templates/system/product/add.html +++ b/ruoyi-admin/src/main/resources/templates/system/product/add.html @@ -9,7 +9,7 @@
- +
@@ -25,7 +25,7 @@
- +
diff --git a/ruoyi-admin/src/main/resources/templates/system/product/edit.html b/ruoyi-admin/src/main/resources/templates/system/product/edit.html index 36269754..7437e84e 100644 --- a/ruoyi-admin/src/main/resources/templates/system/product/edit.html +++ b/ruoyi-admin/src/main/resources/templates/system/product/edit.html @@ -9,7 +9,7 @@
- +
@@ -25,7 +25,7 @@
- +
diff --git a/ruoyi-admin/src/main/resources/templates/system/product/product.html b/ruoyi-admin/src/main/resources/templates/system/product/product.html index cc02df4c..bbf773cb 100644 --- a/ruoyi-admin/src/main/resources/templates/system/product/product.html +++ b/ruoyi-admin/src/main/resources/templates/system/product/product.html @@ -11,7 +11,7 @@
  • - +
  • @@ -19,7 +19,7 @@
  • - +
  • @@ -74,7 +74,7 @@ }, { field: 'productCode', - title: '产品编码' + title: 'BOM编码' }, { field: 'productName', @@ -82,7 +82,7 @@ }, { field: 'model', - title: '产品代码' + title: '产品型号' }, { field: 'description', diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderInfo.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderInfo.java index 1f022a56..74cb4525 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderInfo.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderInfo.java @@ -25,7 +25,7 @@ public class OrderInfo extends BaseEntity private String projectCode; /** 合同编号,唯一 */ - @Excel(name = "合同编号,唯一") + @Excel(name = "合同编号") private String orderCode; /** 版本号 */ diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderList.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderList.java index 9db2f958..a5123273 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderList.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderList.java @@ -27,7 +27,7 @@ public class OrderList extends BaseEntity /** 产品编码,关联产品编码表 */ @Excel(name = "产品编码,关联产品编码表") - private Long productId; + private String productCode; /** 数量 */ @Excel(name = "数量") @@ -53,7 +53,7 @@ public class OrderList extends BaseEntity /** 删除时间,软删除 */ @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") - @Excel(name = "删除时间,软删除", width = 30, dateFormat = "yyyy-MM-dd") + @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd") private Date deletedAt; public void setId(Long id) @@ -74,14 +74,14 @@ public class OrderList extends BaseEntity { return orderId; } - public void setProductId(Long productId) + public void setProductCode(String productCode) { - this.productId = productId; + this.productCode = productCode; } - public Long getProductId() + public String getProductCode() { - return productId; + return productCode; } public void setQuantity(Long quantity) { @@ -143,7 +143,7 @@ public class OrderList extends BaseEntity return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) .append("id", getId()) .append("orderId", getOrderId()) - .append("productId", getProductId()) + .append("productCode", getProductCode()) .append("quantity", getQuantity()) .append("price", getPrice()) .append("amount", getAmount()) diff --git a/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml index 787afc66..cc963880 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml @@ -32,14 +32,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + - - @@ -64,7 +62,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -152,9 +150,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into order_list( id, order_id, product_id, quantity, price, amount, remark, created_at, updated_at, deleted_at) values + insert into order_list( id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at, deleted_at) values - ( #{item.id}, #{item.orderId}, #{item.productId}, #{item.quantity}, #{item.price}, #{item.amount}, #{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt}) + ( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount}, #{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt}) From 64770439b01d5845600ff7ffce56ef74ed7a16b6 Mon Sep 17 00:00:00 2001 From: chenhao <852066789@qq.com> Date: Fri, 11 Apr 2025 15:51:14 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat(sip):=20=E6=B7=BB=E5=8A=A0=E5=8F=91?= =?UTF-8?q?=E8=B4=A7=E6=B8=85=E5=8D=95=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 DeliveryList域对象、Mapper、Service 及控制器 - 实现发货清单的增删查改功能 - 添加发货清单的导入功能 -优化订单列表查询,增加按发货单 ID 查询的功能 - 产品信息 Mapper 增加按产品编码列表查询的功能 --- .../main/resources/mybatis/mybatis-config.xml | 2 +- .../controller/DeliveryListController.java | 136 +++++++++++++++ .../com/ruoyi/sip/domain/DeliveryList.java | 158 ++++++++++++++++++ .../ruoyi/sip/mapper/DeliveryListMapper.java | 62 +++++++ .../com/ruoyi/sip/mapper/OrderInfoMapper.java | 2 + .../ruoyi/sip/mapper/ProductInfoMapper.java | 5 + .../sip/service/IDeliveryListService.java | 63 +++++++ .../service/impl/DeliveryListServiceImpl.java | 130 ++++++++++++++ .../mapper/manage/DeliveryListMapper.xml | 102 +++++++++++ .../mapper/manage/OrderInfoMapper.xml | 37 +++- .../mapper/system/ProductInfoMapper.xml | 9 + 11 files changed, 700 insertions(+), 6 deletions(-) create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/controller/DeliveryListController.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/IDeliveryListService.java create mode 100644 ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java create mode 100644 ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml diff --git a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml index ac47c038..10cf6b0b 100644 --- a/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml +++ b/ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml @@ -14,7 +14,7 @@ PUBLIC "-//mybatis.org//DTD Config 3.0//EN" - + diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/DeliveryListController.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/DeliveryListController.java new file mode 100644 index 00000000..b06bad62 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/controller/DeliveryListController.java @@ -0,0 +1,136 @@ +package com.ruoyi.sip.controller; + +import java.util.List; + +import org.apache.shiro.authz.annotation.RequiresPermissions; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.sip.domain.DeliveryList; +import com.ruoyi.sip.service.IDeliveryListService; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.web.multipart.MultipartFile; + +/** + * 发货清单Controller + * + * @author ruoyi + * @date 2025-04-11 + */ +@Controller +@RequestMapping("/sip/list") +public class DeliveryListController extends BaseController { + private String prefix = "sip/list"; + + @Autowired + private IDeliveryListService deliveryListService; + + @RequiresPermissions("sip:list:view") + @GetMapping() + public String list() { + return prefix + "/list"; + } + + /** + * 查询发货清单列表 + */ + @RequiresPermissions("sip:list:list") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(DeliveryList deliveryList) { + startPage(); + List list = deliveryListService.selectDeliveryListList(deliveryList); + return getDataTable(list); + } + + /** + * 导入数据 + */ + + @PostMapping("/importData") + @ResponseBody + public AjaxResult importData(MultipartFile file, Long deliveryId) throws Exception + { + ExcelUtil util = new ExcelUtil(DeliveryList.class); + List deliveryList = util.importExcel(file.getInputStream()); + + deliveryListService.importData(deliveryList, deliveryId); + return AjaxResult.success("导入成功"); + } + + /** + * 导出发货清单列表 + */ + @RequiresPermissions("sip:list:export") + @Log(title = "发货清单", businessType = BusinessType.EXPORT) + @PostMapping("/export") + @ResponseBody + public AjaxResult export(DeliveryList deliveryList) { + List list = deliveryListService.selectDeliveryListList(deliveryList); + ExcelUtil util = new ExcelUtil(DeliveryList.class); + return util.exportExcel(list, "发货清单数据"); + } + + /** + * 新增发货清单 + */ + @RequiresPermissions("sip:list:add") + @GetMapping("/add") + public String add() { + return prefix + "/add"; + } + + /** + * 新增保存发货清单 + */ + @RequiresPermissions("sip:list:add") + @Log(title = "发货清单", businessType = BusinessType.INSERT) + @PostMapping("/add") + @ResponseBody + public AjaxResult addSave(DeliveryList deliveryList) { + return toAjax(deliveryListService.insertDeliveryList(deliveryList)); + } + + /** + * 修改发货清单 + */ + @RequiresPermissions("sip:list:edit") + @GetMapping("/edit/{id}") + public String edit(@PathVariable("id") Long id, ModelMap mmap) { + DeliveryList deliveryList = deliveryListService.selectDeliveryListById(id); + mmap.put("deliveryList", deliveryList); + return prefix + "/edit"; + } + + /** + * 修改保存发货清单 + */ + @RequiresPermissions("sip:list:edit") + @Log(title = "发货清单", businessType = BusinessType.UPDATE) + @PostMapping("/edit") + @ResponseBody + public AjaxResult editSave(DeliveryList deliveryList) { + return toAjax(deliveryListService.updateDeliveryList(deliveryList)); + } + + /** + * 删除发货清单 + */ + @RequiresPermissions("sip:list:remove") + @Log(title = "发货清单", businessType = BusinessType.DELETE) + @PostMapping("/remove") + @ResponseBody + public AjaxResult remove(String ids) { + return toAjax(deliveryListService.deleteDeliveryListByIds(ids)); + } +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java new file mode 100644 index 00000000..67e00e5e --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/DeliveryList.java @@ -0,0 +1,158 @@ +package com.ruoyi.sip.domain; + +import java.util.Date; +import java.util.StringJoiner; + +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 发货清单对象 delivery_list + * + * @author ruoyi + * @date 2025-04-11 + */ +public class DeliveryList extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 主键,自增 */ + private Long id; + + /** 关联发货单id */ +// @Excel(name = "关联发货单id") + private Long deliveryId; +// @Excel(name = "合同编号") + private String orderCode; + /** 产品编码id */ + + @Excel(name = "产品编码") + private String productCode; + + /** 产品序列号 */ + @Excel(name = "产品序列号") + private String serialNumber; + @Excel(name = "备注") + private String remark; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") +// @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date createdAt; + + /** 更新时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") +// @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date updatedAt; + + /** 删除时间 */ + @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") +// @Excel(name = "删除时间", width = 30, dateFormat = "yyyy-MM-dd") + private Date deletedAt; + + + + public String getOrderCode() { + return orderCode; + } + + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public String getProductCode() { + return productCode; + } + + public void setProductCode(String productCode) { + this.productCode = productCode; + } + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public void setDeliveryId(Long deliveryId) + { + this.deliveryId = deliveryId; + } + + public Long getDeliveryId() + { + return deliveryId; + } + + @Override + public String getRemark() { + return remark; + } + + @Override + public void setRemark(String remark) { + this.remark = remark; + } + + public void setSerialNumber(String serialNumber) + { + this.serialNumber = serialNumber; + } + + public String getSerialNumber() + { + return serialNumber; + } + + public void setCreatedAt(Date createdAt) + { + this.createdAt = createdAt; + } + + public Date getCreatedAt() + { + return createdAt; + } + + public void setUpdatedAt(Date updatedAt) + { + this.updatedAt = updatedAt; + } + + public Date getUpdatedAt() + { + return updatedAt; + } + + public void setDeletedAt(Date deletedAt) + { + this.deletedAt = deletedAt; + } + + public Date getDeletedAt() + { + return deletedAt; + } + + @Override + public String toString() { + return new StringJoiner(", ", DeliveryList.class.getSimpleName() + "[", "]") + .add("id=" + id) + .add("deliveryId=" + deliveryId) + .add("orderCode='" + orderCode + "'") + .add("productCode='" + productCode + "'") + .add("serialNumber='" + serialNumber + "'") + .add("remark='" + remark + "'") + .add("createdAt=" + createdAt) + .add("updatedAt=" + updatedAt) + .add("deletedAt=" + deletedAt) + .toString(); + } +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java new file mode 100644 index 00000000..25116644 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/DeliveryListMapper.java @@ -0,0 +1,62 @@ +package com.ruoyi.sip.mapper; + +import java.util.List; +import com.ruoyi.sip.domain.DeliveryList; + +/** + * 发货清单Mapper接口 + * + * @author ruoyi + * @date 2025-04-11 + */ +public interface DeliveryListMapper +{ + /** + * 查询发货清单 + * + * @param id 发货清单主键 + * @return 发货清单 + */ + public DeliveryList selectDeliveryListById(Long id); + + /** + * 查询发货清单列表 + * + * @param deliveryList 发货清单 + * @return 发货清单集合 + */ + public List selectDeliveryListList(DeliveryList deliveryList); + + /** + * 新增发货清单 + * + * @param deliveryList 发货清单 + * @return 结果 + */ + public int insertDeliveryList(DeliveryList deliveryList); + public int insertBatch(List deliveryList); + + /** + * 修改发货清单 + * + * @param deliveryList 发货清单 + * @return 结果 + */ + public int updateDeliveryList(DeliveryList deliveryList); + + /** + * 删除发货清单 + * + * @param id 发货清单主键 + * @return 结果 + */ + public int deleteDeliveryListById(Long id); + + /** + * 批量删除发货清单 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deleteDeliveryListByIds(String[] ids); +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java index ab8d1f40..7647004e 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/OrderInfoMapper.java @@ -97,4 +97,6 @@ public interface OrderInfoMapper * @param orderListList */ void updateListBatch(List orderListList); + + List listOrderListByDeliveryId(Long deliveryId); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java index 3322f7f9..661908dc 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/mapper/ProductInfoMapper.java @@ -2,6 +2,7 @@ package com.ruoyi.sip.mapper; import java.util.List; import com.ruoyi.sip.domain.ProductInfo; +import org.apache.ibatis.annotations.Param; /** * 产品管理Mapper接口 @@ -58,4 +59,8 @@ public interface ProductInfoMapper * @return 结果 */ public int deleteProductInfoByIds(String[] ids); + + + + List listByProductCodeList(@Param("list") List productCodeList); } diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IDeliveryListService.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IDeliveryListService.java new file mode 100644 index 00000000..1f74900f --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/IDeliveryListService.java @@ -0,0 +1,63 @@ +package com.ruoyi.sip.service; + +import java.util.List; +import com.ruoyi.sip.domain.DeliveryList; + +/** + * 发货清单Service接口 + * + * @author ruoyi + * @date 2025-04-11 + */ +public interface IDeliveryListService +{ + /** + * 查询发货清单 + * + * @param id 发货清单主键 + * @return 发货清单 + */ + public DeliveryList selectDeliveryListById(Long id); + + /** + * 查询发货清单列表 + * + * @param deliveryList 发货清单 + * @return 发货清单集合 + */ + public List selectDeliveryListList(DeliveryList deliveryList); + + /** + * 新增发货清单 + * + * @param deliveryList 发货清单 + * @return 结果 + */ + public int insertDeliveryList(DeliveryList deliveryList); + + /** + * 修改发货清单 + * + * @param deliveryList 发货清单 + * @return 结果 + */ + public int updateDeliveryList(DeliveryList deliveryList); + + /** + * 批量删除发货清单 + * + * @param ids 需要删除的发货清单主键集合 + * @return 结果 + */ + public int deleteDeliveryListByIds(String ids); + + /** + * 删除发货清单信息 + * + * @param id 发货清单主键 + * @return 结果 + */ + public int deleteDeliveryListById(Long id); + + void importData(List deliveryList, Long deliveryId); +} diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java new file mode 100644 index 00000000..18fa2b09 --- /dev/null +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/service/impl/DeliveryListServiceImpl.java @@ -0,0 +1,130 @@ +package com.ruoyi.sip.service.impl; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; + +import com.ruoyi.common.exception.ServiceException; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.sip.domain.OrderList; +import com.ruoyi.sip.domain.ProductInfo; +import com.ruoyi.sip.mapper.OrderInfoMapper; +import com.ruoyi.sip.mapper.ProductInfoMapper; +import org.springframework.stereotype.Service; +import com.ruoyi.sip.mapper.DeliveryListMapper; +import com.ruoyi.sip.domain.DeliveryList; +import com.ruoyi.sip.service.IDeliveryListService; +import com.ruoyi.common.core.text.Convert; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +/** + * 发货清单Service业务层处理 + * + * @author ruoyi + * @date 2025-04-11 + */ +@Service +@Transactional(rollbackFor = Exception.class) +public class DeliveryListServiceImpl implements IDeliveryListService { + @Resource + private DeliveryListMapper deliveryListMapper; + + @Resource + private ProductInfoMapper productInfoMapper; + + @Resource + private OrderInfoMapper infoMapper; + + /** + * 查询发货清单 + * + * @param id 发货清单主键 + * @return 发货清单 + */ + @Override + public DeliveryList selectDeliveryListById(Long id) { + return deliveryListMapper.selectDeliveryListById(id); + } + + /** + * 查询发货清单列表 + * + * @param deliveryList 发货清单 + * @return 发货清单 + */ + @Override + public List selectDeliveryListList(DeliveryList deliveryList) { + return deliveryListMapper.selectDeliveryListList(deliveryList); + } + + /** + * 新增发货清单 + * + * @param deliveryList 发货清单 + * @return 结果 + */ + @Override + public int insertDeliveryList(DeliveryList deliveryList) { + return deliveryListMapper.insertDeliveryList(deliveryList); + } + + /** + * 修改发货清单 + * + * @param deliveryList 发货清单 + * @return 结果 + */ + @Override + public int updateDeliveryList(DeliveryList deliveryList) { + return deliveryListMapper.updateDeliveryList(deliveryList); + } + + /** + * 批量删除发货清单 + * + * @param ids 需要删除的发货清单主键 + * @return 结果 + */ + @Override + public int deleteDeliveryListByIds(String ids) { + return deliveryListMapper.deleteDeliveryListByIds(Convert.toStrArray(ids)); + } + + /** + * 删除发货清单信息 + * + * @param id 发货清单主键 + * @return 结果 + */ + @Override + public int deleteDeliveryListById(Long id) { + return deliveryListMapper.deleteDeliveryListById(id); + } + + @Override + public void importData(List deliveryList, Long deliveryId) { + List productCodeList = deliveryList.stream().map(DeliveryList::getProductCode).collect(Collectors.toList()); + if (productCodeList.isEmpty()) { + throw new ServiceException("产品编码为空"); + } + List orderLists = infoMapper.listOrderListByDeliveryId(deliveryId); + if (orderLists.isEmpty()) { + throw new ServiceException("发货单中没有产品"); + } + List existsProductCodeList = orderLists.stream().map(OrderList::getProductCode).collect(Collectors.toList()); + List notExistsProductCodeList = productCodeList.stream().filter(productCode -> !existsProductCodeList.contains(productCode)).collect(Collectors.toList()); + if (!notExistsProductCodeList.isEmpty()) { + throw new ServiceException(StringUtils.format("产品编码为[{}]的产品在发货单中未找到,请确认后重试;", String.join(",", notExistsProductCodeList))); + } + + for (DeliveryList list : deliveryList) { + list.setDeliveryId(deliveryId); + } + + deliveryListMapper.insertBatch(deliveryList); + } +} diff --git a/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml new file mode 100644 index 00000000..dd9283a2 --- /dev/null +++ b/ruoyi-sip/src/main/resources/mapper/manage/DeliveryListMapper.xml @@ -0,0 +1,102 @@ + + + + + + + + + + + + + + + + + select id, delivery_id, product_code, serial_number, remark, created_at, updated_at, deleted_at from delivery_list + + + + + + + + insert into delivery_list + + delivery_id, + product_code, + serial_number, + remark, + created_at, + updated_at, + deleted_at, + + + #{deliveryId}, + #{productCode}, + #{serialNumber}, + #{remark}, + #{createdAt}, + #{updatedAt}, + #{deletedAt}, + + + + insert into delivery_list (delivery_id, product_code, serial_number, remark, created_at, updated_at) + values + + (#{item.deliveryId}, #{item.productCode}, #{item.serialNumber}, #{item.remark}, now(),now()) + + + + + update delivery_list + + delivery_id = #{deliveryId}, + product_code = #{productCode}, + serial_number = #{serialNumber}, + remark = #{remark}, + created_at = #{createdAt}, + updated_at = #{updatedAt}, + deleted_at = #{deletedAt}, + + where id = #{id} + + + + delete from delivery_list where id = #{id} + + + + delete from delivery_list where id in + + #{id} + + + + \ No newline at end of file diff --git a/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml index 5d06858f..f58f1e01 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/OrderInfoMapper.xml @@ -101,9 +101,34 @@ + @@ -176,7 +201,7 @@ update order_list - product_id = #{productId}, + product_code = #{productCode}, quantity = #{quantity}, price = #{price}, amount = #{amount}, @@ -203,7 +228,7 @@ - delete from order_list where order_id in + update order_list set status=1,delete_at=now() where order_id in #{orderId} @@ -216,9 +241,11 @@ - insert into order_list( id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at, deleted_at) values + insert into order_list( id, order_id, product_code, quantity, price, amount, remark, created_at, updated_at, + deleted_at) values - ( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount}, #{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt}) + ( #{item.id}, #{item.orderId}, #{item.productCode}, #{item.quantity}, #{item.price}, #{item.amount}, + #{item.remark}, #{item.createdAt}, #{item.updatedAt}, #{item.deletedAt}) diff --git a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml index 34de38d6..a3f2f474 100644 --- a/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/system/ProductInfoMapper.xml @@ -34,6 +34,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + insert into product_info From 8c0391b7f1de524474627057a6ca9a41e4dd26fd Mon Sep 17 00:00:00 2001 From: chenhao <852066789@qq.com> Date: Fri, 11 Apr 2025 16:01:43 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat(sip):=20=E5=A2=9E=E5=8A=A0=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=BF=A1=E6=81=AF=E5=85=B3=E8=81=94=E5=B9=B6=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8F=91=E8=B4=A7=E5=8D=95=E7=9B=B8=E5=85=B3=E6=93=8D?= =?UTF-8?q?=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 OrderDelivery 模型中添加 orderCode 和 orderName 字段 - 修改 OrderDeliveryMapper.xml 以关联订单信息 - 更新删除操作,使用软删除标记 --- .../com/ruoyi/sip/domain/OrderDelivery.java | 21 ++++++++++++++- .../mapper/manage/OrderDeliveryMapper.xml | 27 +++++++++++-------- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderDelivery.java b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderDelivery.java index 8149a56f..21c6700d 100644 --- a/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderDelivery.java +++ b/ruoyi-sip/src/main/java/com/ruoyi/sip/domain/OrderDelivery.java @@ -24,6 +24,9 @@ public class OrderDelivery extends BaseEntity @Excel(name = "关联合同id") private Long orderId; + private String orderCode; + private String orderName; + /** 发货单号 */ @Excel(name = "发货单号") private String deliveryCode; @@ -68,7 +71,23 @@ public class OrderDelivery extends BaseEntity /** 删除时间 */ private Date deletedAt; - public void setId(Long id) + public String getOrderCode() { + return orderCode; + } + + public void setOrderCode(String orderCode) { + this.orderCode = orderCode; + } + + public String getOrderName() { + return orderName; + } + + public void setOrderName(String orderName) { + this.orderName = orderName; + } + + public void setId(Long id) { this.id = id; } diff --git a/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml b/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml index 9c131480..fe1bd48d 100644 --- a/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml +++ b/ruoyi-sip/src/main/resources/mapper/manage/OrderDeliveryMapper.xml @@ -28,14 +28,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -101,15 +106,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" updated_at = #{updatedAt}, deleted_at = #{deletedAt}, - where id = #{id} + where id = #{id} and status=0 - delete from order_delivery where id = #{id} + update order_delivery set status =1, deleted_at=now() where id = #{id} - delete from order_delivery where id in + update order_delivery set status =1, deleted_at=now() where id in #{id}