From a7301f120b24fbe8bddaf520893fd8db5cad5865 Mon Sep 17 00:00:00 2001 From: wangpengfei <1928057482@qq.com> Date: Fri, 3 Nov 2023 14:14:16 +0800 Subject: [PATCH] =?UTF-8?q?=E5=96=9C=E7=9B=B8=E9=9A=8F=E5=95=86=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../initial/SupplierController.java | 2 - .../instorehouse/PurchaseController.java | 3 +- .../ProductController.java | 8 +- .../RestrictedCategoryRest.java | 8 +- .../com/wh/mapper/initial/ProductMapper.java | 7 -- .../com/wh/mapper/product/ProductMapper.java | 10 +++ .../RestrictedCategoryMapper.java | 7 ++ .../com/wh/pojo/{ => product}/Product.java | 20 ++++- .../RestrictedCategory.java | 2 + .../instorehouse/InStorehouseMainService.java | 3 +- .../api/prodstock/ProdStockService.java | 4 +- .../service/initial/SupplierServiceImpl.java | 1 - .../service/instorehouse/PurchaseService.java | 2 +- .../instorehouse/PurchaseServiceImpl.java | 3 +- .../instorehouse/PutInServiceImpl.java | 3 +- .../OutStorehouseServiceImpl.java | 2 +- .../{initial => product}/ProductService.java | 7 +- .../ProductServiceImpl.java | 63 ++++++++++++-- .../RestrictedCategoryService.java | 82 +++++++++++++------ .../storehousemanage/RemoveServiceImpl.java | 6 +- .../storehousemanage/ShelvesServiceImpl.java | 2 +- .../mappers/RestrictedBrandMapper.xml | 2 +- 22 files changed, 177 insertions(+), 70 deletions(-) rename warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/{initial => product}/ProductController.java (88%) delete mode 100644 warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/initial/ProductMapper.java create mode 100644 warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/product/ProductMapper.java rename warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/{ => product}/Product.java (57%) rename warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/{initial => product}/ProductService.java (81%) rename warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/{initial => product}/ProductServiceImpl.java (52%) diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/initial/SupplierController.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/initial/SupplierController.java index f6b47141..7dec9110 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/initial/SupplierController.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/initial/SupplierController.java @@ -1,8 +1,6 @@ package com.wh.controller.initial; import com.wh.controller.purchasenewproduct.vo.SysResult; -import com.wh.pojo.Product; -import com.wh.pojo.ProductQuery; import com.wh.pojo.Supplier; import com.wh.pojo.SupplierQuery; import com.wh.service.initial.SupplierService; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/instorehouse/PurchaseController.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/instorehouse/PurchaseController.java index e513b5f9..27880381 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/instorehouse/PurchaseController.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/instorehouse/PurchaseController.java @@ -3,16 +3,15 @@ package com.wh.controller.instorehouse; import com.wh.controller.purchasenewproduct.vo.PageResult; import com.wh.controller.purchasenewproduct.vo.SysResult; -import com.wh.pojo.Product; import com.wh.pojo.Purchase; import com.wh.pojo.Storehouse; import com.wh.pojo.Supplier; +import com.wh.pojo.product.Product; import com.wh.service.instorehouse.PurchaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.List; -import java.util.Map; @RestController @CrossOrigin diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/initial/ProductController.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/product/ProductController.java similarity index 88% rename from warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/initial/ProductController.java rename to warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/product/ProductController.java index 726fab10..76871701 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/initial/ProductController.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/product/ProductController.java @@ -1,12 +1,10 @@ -package com.wh.controller.initial; +package com.wh.controller.product; import com.wh.controller.purchasenewproduct.vo.SysResult; -import com.wh.pojo.Product; import com.wh.pojo.ProductQuery; import com.wh.pojo.Storehouse; -import com.wh.pojo.shstorehouse.ShStorehouseQuery; -import com.wh.pojo.shstorehouse.ShStorehouseVo; -import com.wh.service.initial.ProductService; +import com.wh.pojo.product.Product; +import com.wh.service.product.ProductService; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/restrictedcategory/RestrictedCategoryRest.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/restrictedcategory/RestrictedCategoryRest.java index 0dee8968..7c4f9f2c 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/restrictedcategory/RestrictedCategoryRest.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/controller/restrictedcategory/RestrictedCategoryRest.java @@ -79,7 +79,13 @@ public class RestrictedCategoryRest{ List pv = restrictedCategoryService.categoryList(); return rb.success().setData(pv); } - + @ApiOperation("根据psid查询") + @GetMapping("/categoryListByPsid/{psid}") + public ResultBean> categoryListByPsid(@PathVariable String psid) { + ResultBean rb = ResultBean.fireFail(); + List pv = restrictedCategoryService.categoryListByPsid(psid); + return rb.success().setData(pv); + } @ApiOperation("新增或修改") @PostMapping("/save") public ResultBean save(@RequestBody RestrictedCategoryDto dto) { diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/initial/ProductMapper.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/initial/ProductMapper.java deleted file mode 100644 index 004333da..00000000 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/initial/ProductMapper.java +++ /dev/null @@ -1,7 +0,0 @@ -package com.wh.mapper.initial; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import com.wh.pojo.Product; - -public interface ProductMapper extends BaseMapper { -} diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/product/ProductMapper.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/product/ProductMapper.java new file mode 100644 index 00000000..9a5e5484 --- /dev/null +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/product/ProductMapper.java @@ -0,0 +1,10 @@ +package com.wh.mapper.product; + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.wh.pojo.product.Product; +import org.apache.ibatis.annotations.Select; + +public interface ProductMapper extends BaseMapper { + @Select("select max(code) as code from product where code like CONCAT('%',#{code},'%') ") + Product getMaxCode(String code); +} diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/restrictedcategory/RestrictedCategoryMapper.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/restrictedcategory/RestrictedCategoryMapper.java index 39c4ea1c..fd4aff8a 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/restrictedcategory/RestrictedCategoryMapper.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/mapper/restrictedcategory/RestrictedCategoryMapper.java @@ -74,7 +74,14 @@ public interface RestrictedCategoryMapper extends BaseMapper RestrictedCategory selectByKeyAndSid(@Param("key") String key, @Param("sid") String sid); List categoryList(); + @Select("select * from restricted_category where psid=#{psid}") + List categoryListByPsid(@Param("psid")String psid); List selectFirstCategoryList(); List selectChildernList(String sid); + @Select("select max(category_key) from restricted_category where psid=#{psid}") + String getCategoryByPsid(@Param("psid") String sid); + @Select("select category_key as categoryKey , grade from restricted_category where sid=#{sid}") + RestrictedCategoryVo getCategoryBySid(@Param("sid") String sid); + } \ No newline at end of file diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/Product.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/product/Product.java similarity index 57% rename from warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/Product.java rename to warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/product/Product.java index a34482af..e466d0e6 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/Product.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/product/Product.java @@ -1,6 +1,7 @@ -package com.wh.pojo; +package com.wh.pojo.product; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -23,4 +24,21 @@ public class Product { private Integer effectiveDays; //有效天数 private String warehouse; //所属仓库 private String remarks; //备注 + private String brandSid; //品牌 + private String code;//商品编码 + private String categorySid;//品类三级品类 + + + @TableField(exist = false) + private String categorySidY;//一级品类 + @TableField(exist = false) + private String categorySidR;//二级品类 + @TableField(exist = false) + private String category; + @TableField(exist = false) + private String categoryY; + @TableField(exist = false) + private String categoryR; + @TableField(exist = false) + private String brand; } diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/restrictedcategory/RestrictedCategory.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/restrictedcategory/RestrictedCategory.java index 91ad5c35..fc0dcdf2 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/restrictedcategory/RestrictedCategory.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/pojo/restrictedcategory/RestrictedCategory.java @@ -25,6 +25,7 @@ *********************************************************/ package com.wh.pojo.restrictedcategory; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.yxt.common.core.domain.BaseEntity; @@ -86,6 +87,7 @@ public class RestrictedCategory { @ApiModelProperty("监管品类") private String categorys; + @TableField(value = "category_key") @ApiModelProperty("监管品类Key") private String category_key; private String psid; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java index 3b7288b4..14efbfd8 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/instorehouse/InStorehouseMainService.java @@ -11,6 +11,7 @@ import com.wh.mapper.api.instorehouse.InStorehouseMainMapper; import com.wh.mapper.initial.LocationMapper; import com.wh.pojo.*; import com.wh.pojo.api.*; +import com.wh.pojo.product.Product; import com.wh.pojo.purchasenew.Purchasenew; import com.wh.pojo.purchasenew.PurchasenewDto; import com.wh.pojo.purchasenewproduct.PurchasenewProduct; @@ -18,7 +19,7 @@ import com.wh.pojo.purchasenewproduct.PurchasenewProductDto; import com.wh.pojo.purchasenewproduct.PurchasenewProductVo; import com.wh.service.api.prodstock.ProdStockService; import com.wh.service.initial.LocationService; -import com.wh.service.initial.ProductService; +import com.wh.service.product.ProductService; import com.wh.service.purchasenew.PurchasenewService; import com.wh.service.purchasenewproduct.PurchasenewProductService; import com.yxt.common.base.service.MybatisBaseService; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/prodstock/ProdStockService.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/prodstock/ProdStockService.java index 293724b1..56b820f3 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/prodstock/ProdStockService.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/api/prodstock/ProdStockService.java @@ -4,9 +4,9 @@ package com.wh.service.api.prodstock; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.wh.mapper.api.prodstock.ProdStockMapper; -import com.wh.pojo.Product; import com.wh.pojo.api.*; -import com.wh.service.initial.ProductService; +import com.wh.pojo.product.Product; +import com.wh.service.product.ProductService; import com.yxt.common.base.service.MybatisBaseService; import com.yxt.common.base.utils.PagerUtil; import com.yxt.common.core.query.PagerQuery; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/SupplierServiceImpl.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/SupplierServiceImpl.java index 1b2bfdbe..e7a2aa8a 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/SupplierServiceImpl.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/SupplierServiceImpl.java @@ -4,7 +4,6 @@ import com.wh.controller.purchasenewproduct.vo.PageResult; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.mapper.initial.SupplierMapper; -import com.wh.pojo.Product; import com.wh.pojo.Supplier; import com.wh.pojo.SupplierQuery; import com.yxt.common.core.query.PagerQuery; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseService.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseService.java index c16fbd9f..735f62f2 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseService.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseService.java @@ -1,10 +1,10 @@ package com.wh.service.instorehouse; import com.wh.controller.purchasenewproduct.vo.PageResult; -import com.wh.pojo.Product; import com.wh.pojo.Purchase; import com.wh.pojo.Storehouse; import com.wh.pojo.Supplier; +import com.wh.pojo.product.Product; import java.util.List; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseServiceImpl.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseServiceImpl.java index 84382a72..ee402532 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseServiceImpl.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PurchaseServiceImpl.java @@ -3,11 +3,12 @@ package com.wh.service.instorehouse; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.controller.purchasenewproduct.vo.PageResult; -import com.wh.mapper.initial.ProductMapper; import com.wh.mapper.initial.StorehouseMapper; import com.wh.mapper.initial.SupplierMapper; import com.wh.mapper.instorehouse.PurchaseMapper; +import com.wh.mapper.product.ProductMapper; import com.wh.pojo.*; +import com.wh.pojo.product.Product; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PutInServiceImpl.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PutInServiceImpl.java index da475a9f..c317bb16 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PutInServiceImpl.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/instorehouse/PutInServiceImpl.java @@ -7,14 +7,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.api.Api; import com.wh.controller.purchasenewproduct.vo.PageResult; import com.wh.mapper.initial.LocationMapper; -import com.wh.mapper.initial.ProductMapper; import com.wh.mapper.instorehouse.PurchaseMapper; import com.wh.mapper.instorehouse.PutInMapper; import com.wh.mapper.instorehouse.ReceivingMapper; +import com.wh.mapper.product.ProductMapper; import com.wh.mapper.stock.StockMapper; import com.wh.mapper.storehousemanage.RemoveMapper; import com.wh.pojo.*; +import com.wh.pojo.product.Product; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/outstorehouse/OutStorehouseServiceImpl.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/outstorehouse/OutStorehouseServiceImpl.java index 6b09ca22..903f5c33 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/outstorehouse/OutStorehouseServiceImpl.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/outstorehouse/OutStorehouseServiceImpl.java @@ -4,9 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.api.Api; import com.wh.controller.purchasenewproduct.vo.PageResult; -import com.wh.mapper.initial.ProductMapper; import com.wh.mapper.outstorehouse.OutStorehouseMapper; import com.wh.mapper.outstorehouse.PickingMapper; +import com.wh.mapper.product.ProductMapper; import com.wh.mapper.stock.StockMapper; import com.wh.pojo.*; import org.springframework.beans.factory.annotation.Autowired; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/ProductService.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/product/ProductService.java similarity index 81% rename from warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/ProductService.java rename to warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/product/ProductService.java index 175fdb77..6053022d 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/ProductService.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/product/ProductService.java @@ -1,14 +1,11 @@ -package com.wh.service.initial; +package com.wh.service.product; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.wh.pojo.Product; import com.wh.pojo.ProductQuery; import com.wh.pojo.Storehouse; -import com.wh.pojo.shstorehouse.ShStorehouseVo; +import com.wh.pojo.product.Product; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; -import org.springframework.util.StringUtils; import java.util.List; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/ProductServiceImpl.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/product/ProductServiceImpl.java similarity index 52% rename from warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/ProductServiceImpl.java rename to warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/product/ProductServiceImpl.java index 07163a6c..535ff7b7 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/initial/ProductServiceImpl.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/product/ProductServiceImpl.java @@ -1,13 +1,18 @@ -package com.wh.service.initial; +package com.wh.service.product; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.wh.mapper.initial.ProductMapper; import com.wh.mapper.initial.StorehouseMapper; -import com.wh.pojo.Product; +import com.wh.mapper.product.ProductMapper; +import com.wh.mapper.restrictedbrand.RestrictedBrandMapper; +import com.wh.mapper.restrictedcategory.RestrictedCategoryMapper; import com.wh.pojo.ProductQuery; import com.wh.pojo.Storehouse; -import com.wh.pojo.shstorehouse.ShStorehouseVo; +import com.wh.pojo.product.Product; +import com.wh.pojo.restrictedbrand.RestrictedBrand; +import com.wh.pojo.restrictedcategory.RestrictedCategory; +import com.wh.pojo.restrictedcategory.RestrictedCategoryVo; +import com.wh.service.restrictedcategory.RestrictedCategoryService; import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.vo.PagerVo; @@ -20,13 +25,17 @@ import java.util.List; import java.util.Map; @Service -public class ProductServiceImpl implements ProductService{ +public class ProductServiceImpl implements ProductService { @Autowired private StorehouseMapper storehouseMapper; @Autowired private ProductMapper productMapper; + @Autowired + private RestrictedCategoryMapper restrictedCategoryMapper; + @Autowired + private RestrictedBrandMapper restrictedBrandMapper; @Override public PagerVo getProductList(PagerQuery pq) { @@ -38,6 +47,29 @@ public class ProductServiceImpl implements ProductService{ } productPage = productMapper.selectPage(productPage,queryWrapper); Integer integer = productMapper.selectCount(queryWrapper); + for(Product p:productPage.getRecords()){ + //三级品类 + RestrictedCategory restrictedCategory=restrictedCategoryMapper.selectOne(new QueryWrapper().eq("sid",p.getCategorySid())); + + + RestrictedBrand restrictedBrand=restrictedBrandMapper.selectOne(new QueryWrapper().eq("sid",p.getBrandSid())); + if(null!=restrictedBrand){ + p.setBrand(restrictedBrand.getName()); + } + if(null!=restrictedCategory){ + //二级品类 + RestrictedCategory restrictedCategoryR=restrictedCategoryMapper.selectOne(new QueryWrapper().eq("sid",restrictedCategory.getPsid())); + //一级品类 + RestrictedCategory restrictedCategoryY=restrictedCategoryMapper.selectOne(new QueryWrapper().eq("sid",restrictedCategoryR.getPsid())); + p.setCategory(restrictedCategory.getCategorys()); + + p.setCategoryR(restrictedCategoryR.getCategorys()); + p.setCategorySidR(restrictedCategoryR.getSid()); + + p.setCategoryY(restrictedCategoryY.getCategorys()); + p.setCategorySidY(restrictedCategoryY.getSid()); + } + } // PageResult pageResult=new PageResult(); // pageResult.setTotal((long) productPage.getRecords().size()).setRows(productPage.getRecords()); PagerVo pv=new PagerVo<>(); @@ -70,10 +102,27 @@ public class ProductServiceImpl implements ProductService{ return getProductListByNameAndCode(null,code); } @Override - public void addProduct(Product product) { + public synchronized void addProduct(Product product) { + String code =this.code(product.getCategorySid()); + product.setCode(code); productMapper.insert(product); } - + public String code (String categorySid) { + String code=""; + RestrictedCategoryVo restrictedCategory=restrictedCategoryMapper.getCategoryBySid(categorySid); + Product product=productMapper.getMaxCode(restrictedCategory.getCategoryKey()); + if(null==product){ + code=restrictedCategory.getCategoryKey()+"0001"; + }else{ + //0101010001 + String key=""; + for(int i=String.valueOf(Integer.valueOf(product.getCode().substring(6))+1).length();i<4;i++){ + key=key+"0"; + } + code=restrictedCategory.getCategoryKey()+key+String.valueOf(Integer.valueOf(product.getCode().substring(6))+1); + } + return code; + } @Override public void updataProduct(Product product) { productMapper.updateById(product); diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/restrictedcategory/RestrictedCategoryService.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/restrictedcategory/RestrictedCategoryService.java index 9292cdf5..0e09b63b 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/restrictedcategory/RestrictedCategoryService.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/restrictedcategory/RestrictedCategoryService.java @@ -31,6 +31,7 @@ import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.wh.mapper.restrictedcategory.RestrictedCategoryMapper; +import com.wh.pojo.product.Product; import com.wh.pojo.restrictedcategory.*; import com.wh.service.restrictedbrand.RestrictedBrandService; import com.yxt.common.base.service.MybatisBaseService; @@ -107,45 +108,74 @@ public class RestrictedCategoryService extends MybatisBaseService categoryListByPsid(String psid) { + List pagging = baseMapper.categoryListByPsid(psid); + return pagging; + } + public ResultBean saveOrUpdateDto(RestrictedCategoryDto dto) { ResultBean rb = ResultBean.fireFail(); String sid = dto.getSid(); - String id = dto.getId(); - String key = dto.getCategory_key(); if (StringUtils.isBlank(sid)) { - RestrictedCategory restrictedCategory = baseMapper.selectByKey(key); - //查询key是否重复 - if (restrictedCategory != null) { - return rb.setMsg("该类别编码已存在"); - } - RestrictedCategory restrictedCategory1 =new RestrictedCategory(); - if(StringUtils.isNotBlank(dto.getPsid())){ - if(dto.getPsid().equals("0")){ + RestrictedCategory restrictedCategory1 = new RestrictedCategory(); + if (StringUtils.isNotBlank(dto.getPsid())) { + if (dto.getPsid().equals("0")) { dto.setGrade(String.valueOf(1)); - }else { - restrictedCategory1= baseMapper.selectOne(new QueryWrapper().eq("sid",dto.getPsid())); - dto.setGrade(String.valueOf(Integer.valueOf(restrictedCategory1.getGrade())+1)); + } else { + restrictedCategory1 = baseMapper.selectOne(new QueryWrapper().eq("sid", dto.getPsid())); + dto.setGrade(String.valueOf(Integer.valueOf(restrictedCategory1.getGrade()) + 1)); } } - restrictedCategory = new RestrictedCategory(); + RestrictedCategory restrictedCategory = new RestrictedCategory(); BeanUtil.copyProperties(dto, restrictedCategory, "sid"); + String code = code(dto); + restrictedCategory.setCategory_key(code); baseMapper.insert(restrictedCategory); } else { RestrictedCategory restrictedCategory = fetchByCode(sid); -// if (restrictedCategory == null) { -// return rb.setMsg("该类别不存在"); -// } - //查询该key是否存在 -// RestrictedCategory restrictedCategorys = baseMapper.selectByKeyAndSid(key, sid); -// if (restrictedCategorys != null) { -// return rb.setMsg("该类别编码已存在"); -// } BeanUtil.copyProperties(dto, restrictedCategory, "sid"); - baseMapper.update(restrictedCategory,new QueryWrapper().eq("sid",dto.getSid())); + baseMapper.update(restrictedCategory, new QueryWrapper().eq("sid", dto.getSid())); } return rb.success(); } + public String code(RestrictedCategoryDto dto) { + String code = ""; + String key = baseMapper.getCategoryByPsid(dto.getPsid()); + RestrictedCategoryVo restrictedCategory1 = baseMapper.getCategoryBySid(dto.getPsid()); + if (StringUtils.isBlank(key)) { + + key = restrictedCategory1.getCategoryKey(); + } + + //上级品类 +// RestrictedCategory restrictedCategory1= baseMapper.selectOne(new QueryWrapper().eq("sid",dto.getPsid())); + if (restrictedCategory1.getGrade().equals("0")) { + //010000 + if (String.valueOf(Integer.valueOf(key.substring(0, 2)) + 1).length() == 1) { + code = "0" + String.valueOf(Integer.valueOf(key.substring(0, 2)) + 1) + "0000"; + } else { + code = String.valueOf(Integer.valueOf(key.substring(0, 2)) + 1) + "0000"; + } + } else if (restrictedCategory1.getGrade().equals("1")) { + //010100 + if (String.valueOf(Integer.valueOf(key.substring(2, 4)) + 1).length() == 1) { + code = key.substring(0, 2) + "0" + String.valueOf(Integer.valueOf(key.substring(2, 4)) + 1) + "00"; + } else { + code = key.substring(0, 2) + String.valueOf(Integer.valueOf(key.substring(2, 4)) + 1) + "00"; + } + } else if (restrictedCategory1.getGrade().equals("2")) { + //010101 +// code=String.valueOf(Integer.valueOf(key.substring(4,6))+1); + if (String.valueOf(Integer.valueOf(key.substring(4, 6)) + 1).length() == 1) { + code = key.substring(0, 4) + "0" + String.valueOf(Integer.valueOf(key.substring(4, 6)) + 1); + } else { + code = key.substring(0, 4) + String.valueOf(Integer.valueOf(key.substring(4, 6)) + 1); + } + } + return code; + } + public RestrictedCategoryDetailsVo fetchDetailsVoBySid(String id) { RestrictedCategory entity = getRestById(id); RestrictedCategoryDetailsVo vo = new RestrictedCategoryDetailsVo(); @@ -270,11 +300,11 @@ public class RestrictedCategoryService extends MybatisBaseService list) { list.forEach(str -> { String sid = str.getSid(); - String pName=str.getCategorys(); + String pName = str.getCategorys(); List listChildren = baseMapper.selectChildernList(sid); - listChildren.forEach(i->{ + listChildren.forEach(i -> { i.setPName(pName); - if(i.getGrade().equals("3")){ + if (i.getGrade().equals("3")) { i.setIsEnd("1"); } }); diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/RemoveServiceImpl.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/RemoveServiceImpl.java index fe593ea7..e005436a 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/RemoveServiceImpl.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/RemoveServiceImpl.java @@ -5,14 +5,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.wh.api.Api; import com.wh.controller.purchasenewproduct.vo.PageResult; import com.wh.mapper.initial.LocationMapper; -import com.wh.mapper.initial.ProductMapper; +import com.wh.mapper.product.ProductMapper; import com.wh.mapper.stock.StockMapper; import com.wh.mapper.storehousemanage.RemoveMapper; -import com.wh.pojo.Location; -import com.wh.pojo.Product; import com.wh.pojo.Remove; import com.wh.pojo.Stock; -import net.sf.jsqlparser.statement.select.Select; +import com.wh.pojo.product.Product; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.StringUtils; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/ShelvesServiceImpl.java b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/ShelvesServiceImpl.java index 8a7a48d8..15e0ec5b 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/ShelvesServiceImpl.java +++ b/warehousing-system/project/wh-manage-xxs/src/main/java/com/wh/service/storehousemanage/ShelvesServiceImpl.java @@ -6,10 +6,10 @@ import com.wh.api.Api; import com.wh.controller.purchasenewproduct.vo.PageResult; import com.wh.controller.purchasenewproduct.vo.QueryInfo; import com.wh.mapper.initial.LocationMapper; -import com.wh.mapper.initial.ProductMapper; import com.wh.mapper.instorehouse.PurchaseMapper; import com.wh.mapper.instorehouse.PutInMapper; import com.wh.mapper.instorehouse.ReceivingMapper; +import com.wh.mapper.product.ProductMapper; import com.wh.mapper.stock.StockMapper; import com.wh.mapper.storehousemanage.ShelvesMapper; import com.wh.pojo.*; diff --git a/warehousing-system/project/wh-manage-xxs/src/main/resources/mappers/RestrictedBrandMapper.xml b/warehousing-system/project/wh-manage-xxs/src/main/resources/mappers/RestrictedBrandMapper.xml index 3312ea1a..2ed4c899 100644 --- a/warehousing-system/project/wh-manage-xxs/src/main/resources/mappers/RestrictedBrandMapper.xml +++ b/warehousing-system/project/wh-manage-xxs/src/main/resources/mappers/RestrictedBrandMapper.xml @@ -32,7 +32,7 @@ where code = #{code}