Ver Fonte

Merge remote-tracking branch 'refs/remotes/origin/master_feat_warehouse_20250307'

# Conflicts:
#	fs-service-system/pom.xml
xdd há 2 meses atrás
pai
commit
340fe736c5
27 ficheiros alterados com 831 adições e 19 exclusões
  1. 115 0
      fs-admin/src/main/java/com/fs/store/controller/FsWarehousesController.java
  2. 4 0
      fs-service-system/pom.xml
  3. 4 0
      fs-service-system/src/main/java/com/fs/erp/domain/ErpOrderItem.java
  4. 26 0
      fs-service-system/src/main/java/com/fs/store/domain/FsStoreProduct.java
  5. 65 0
      fs-service-system/src/main/java/com/fs/store/domain/FsWarehouses.java
  6. 8 0
      fs-service-system/src/main/java/com/fs/store/dto/FsStoreCartDTO.java
  7. 1 1
      fs-service-system/src/main/java/com/fs/store/mapper/FsStoreCartMapper.java
  8. 62 0
      fs-service-system/src/main/java/com/fs/store/mapper/FsWarehousesMapper.java
  9. 11 1
      fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAddEditParam.java
  10. 62 0
      fs-service-system/src/main/java/com/fs/store/service/IFsWarehousesService.java
  11. 14 0
      fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreOrderServiceImpl.java
  12. 112 0
      fs-service-system/src/main/java/com/fs/store/service/impl/FsWarehousesServiceImpl.java
  13. 8 0
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreCartQueryVO.java
  14. 10 2
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductActivityListVO.java
  15. 5 0
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductExportVO.java
  16. 9 1
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductListQueryVO.java
  17. 10 1
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductListVO.java
  18. 9 1
      fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductQueryVO.java
  19. 11 0
      fs-service-system/src/main/java/com/fs/system/cache/ISysDictDataCacheService.java
  20. 85 0
      fs-service-system/src/main/java/com/fs/system/cache/impl/SysDictDataCacheServiceImpl.java
  21. 1 1
      fs-service-system/src/main/resources/application-config.yml
  22. 16 9
      fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml
  23. 96 0
      fs-service-system/src/main/resources/mapper/store/FsWarehousesMapper.xml
  24. 7 0
      fs-user-app/pom.xml
  25. 3 2
      fs-user-app/src/main/java/com/fs/core/security/SecurityUtils.java
  26. 61 0
      fs-user-app/src/test/java/com/fs/core/security/BaseSpringBootTest.java
  27. 16 0
      fs-user-app/src/test/java/com/fs/core/security/SecurityUtilsTest.java

+ 115 - 0
fs-admin/src/main/java/com/fs/store/controller/FsWarehousesController.java

@@ -0,0 +1,115 @@
+package com.fs.store.controller;
+
+import java.util.List;
+
+import com.fs.store.domain.FsWarehouses;
+import com.fs.store.service.IFsWarehousesService;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.fs.common.annotation.Log;
+import com.fs.common.core.controller.BaseController;
+import com.fs.common.core.domain.AjaxResult;
+import com.fs.common.enums.BusinessType;
+import com.fs.common.utils.poi.ExcelUtil;
+import com.fs.common.core.page.TableDataInfo;
+
+/**
+ * 仓库Controller
+ *
+ * @author fs
+ * @date 2025-03-07
+ */
+@RestController
+@RequestMapping("/system/warehouses")
+public class FsWarehousesController extends BaseController
+{
+    @Autowired
+    private IFsWarehousesService fsWarehousesService;
+
+    /**
+     * 查询仓库列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:warehouses:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(FsWarehouses fsWarehouses)
+    {
+        startPage();
+        List<FsWarehouses> list = fsWarehousesService.selectFsWarehousesList(fsWarehouses);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询仓库列表-不分页
+     */
+    @PreAuthorize("@ss.hasPermi('system:warehouses:list')")
+    @GetMapping("/listAll")
+    public AjaxResult listAll(FsWarehouses fsWarehouses)
+    {
+        List<FsWarehouses> list = fsWarehousesService.selectFsWarehousesList(fsWarehouses);
+        return AjaxResult.success(list);
+    }
+
+    /**
+     * 导出仓库列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:warehouses:export')")
+    @Log(title = "仓库", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(FsWarehouses fsWarehouses)
+    {
+        List<FsWarehouses> list = fsWarehousesService.selectFsWarehousesList(fsWarehouses);
+        ExcelUtil<FsWarehouses> util = new ExcelUtil<FsWarehouses>(FsWarehouses.class);
+        return util.exportExcel(list, "warehouses");
+    }
+
+    /**
+     * 获取仓库详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:warehouses:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return AjaxResult.success(fsWarehousesService.selectFsWarehousesById(id));
+    }
+
+    /**
+     * 新增仓库
+     */
+    @PreAuthorize("@ss.hasPermi('system:warehouses:add')")
+    @Log(title = "仓库", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody FsWarehouses fsWarehouses)
+    {
+        return toAjax(fsWarehousesService.insertFsWarehouses(fsWarehouses));
+    }
+
+    /**
+     * 修改仓库
+     */
+    @PreAuthorize("@ss.hasPermi('system:warehouses:edit')")
+    @Log(title = "仓库", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody FsWarehouses fsWarehouses)
+    {
+        return toAjax(fsWarehousesService.updateFsWarehouses(fsWarehouses));
+    }
+
+    /**
+     * 删除仓库
+     */
+    @PreAuthorize("@ss.hasPermi('system:warehouses:remove')")
+    @Log(title = "仓库", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable List<Long> ids)
+    {
+        return toAjax(fsWarehousesService.deleteFsWarehousesByIds(ids));
+    }
+}

+ 4 - 0
fs-service-system/pom.xml

@@ -170,5 +170,9 @@
         </dependency>
 
 
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+        </dependency>
     </dependencies>
 </project>

+ 4 - 0
fs-service-system/src/main/java/com/fs/erp/domain/ErpOrderItem.java

@@ -13,5 +13,9 @@ public class ErpOrderItem {
     Integer qty;
     Integer refund;
     String oid;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
 
 }

+ 26 - 0
fs-service-system/src/main/java/com/fs/store/domain/FsStoreProduct.java

@@ -170,6 +170,32 @@ public class FsStoreProduct extends BaseEntity
 
     private Integer tuiCateId;
 
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    @Excel(name = "仓库代码")
+    private String warehouseCode;
+
+    public Long getWarehouseId() {
+        return warehouseId;
+    }
+
+    public void setWarehouseId(Long warehouseId) {
+        this.warehouseId = warehouseId;
+    }
+
+    public String getWarehouseCode() {
+        return warehouseCode;
+    }
+
+    public void setWarehouseCode(String warehouseCode) {
+        this.warehouseCode = warehouseCode;
+    }
+
     public Integer getTuiCateId() {
         return tuiCateId;
     }

+ 65 - 0
fs-service-system/src/main/java/com/fs/store/domain/FsWarehouses.java

@@ -0,0 +1,65 @@
+package com.fs.store.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fs.common.annotation.Excel;
+import com.fs.common.core.domain.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.Getter;
+import lombok.ToString;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 仓库对象 fs_warehouses
+ *
+ * @author xdd
+ * @date 2025-03-07
+ * @since 1.0.0
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class FsWarehouses extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 仓库ID */
+    private Long id;
+
+    /** 仓库名称 */
+    @Excel(name = "仓库名称")
+    private String warehouseName;
+
+    /** 仓库编码 */
+    @Excel(name = "仓库编码")
+    private String warehouseCode;
+
+    /** 仓库地址 */
+    @Excel(name = "仓库地址")
+    private String warehouseAddress;
+
+    /** 联系人 */
+    @Excel(name = "联系人")
+    private String contactPerson;
+
+    /** 联系电话 */
+    @Excel(name = "联系电话")
+    private String contactPhone;
+
+    /** 是否启用(1:启用,0:停用) */
+    @Excel(name = "是否启用", readConverterExp = "1=:启用,0:停用")
+    private Integer isActive;
+    private String isActiveText;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date createdAt;
+
+    /** 更新时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date updatedAt;
+
+}

+ 8 - 0
fs-service-system/src/main/java/com/fs/store/dto/FsStoreCartDTO.java

@@ -31,4 +31,12 @@ import java.math.BigDecimal;
 
     private BigDecimal brokerageThree;
 
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
 }

+ 1 - 1
fs-service-system/src/main/java/com/fs/store/mapper/FsStoreCartMapper.java

@@ -73,7 +73,7 @@ public interface FsStoreCartMapper
            "<foreach collection='array' item='id' open='(' separator=',' close=')'>#{id}</foreach>"+
             "</script>"})
     int delCart(Long[] ids);
-    @Select("select c.*,p.cate_id,p.product_name,p.image as product_image,p.temp_id,p.product_type,v.price,v.sku as product_attr_name,v.image as product_attr_image,v.stock,v.cost,v.integral,v.weight,v.volume,v.bar_code,v.group_bar_code,v.brokerage,v.brokerage_two,v.brokerage_three from fs_store_cart c left join fs_store_product p on p.product_id=c.product_id left join fs_store_product_attr_value v on v.id=c.product_attr_value_id where find_in_set(c.id,#{ids})")
+    @Select("select c.*,p.cate_id,p.product_name,p.warehouse_id as warehouse_id,p.warehouse_code as warehouse_code,p.image as product_image,p.temp_id,p.product_type,v.price,v.sku as product_attr_name,v.image as product_attr_image,v.stock,v.cost,v.integral,v.weight,v.volume,v.bar_code,v.group_bar_code,v.brokerage,v.brokerage_two,v.brokerage_three from fs_store_cart c left join fs_store_product p on p.product_id=c.product_id left join fs_store_product_attr_value v on v.id=c.product_attr_value_id where find_in_set(c.id,#{ids})")
     List<FsStoreCartQueryVO> selectFsStoreCartListByIds(String ids);
     @Update("update  fs_store_cart set is_pay=1 where find_in_set(id,#{cartIds})")
     void updateIsPay(String cartIds);

+ 62 - 0
fs-service-system/src/main/java/com/fs/store/mapper/FsWarehousesMapper.java

@@ -0,0 +1,62 @@
+package com.fs.store.mapper;
+
+import com.fs.store.domain.FsWarehouses;
+
+import java.util.List;
+
+/**
+ * 仓库Mapper接口
+ *
+ * @author fs
+ * @date 2025-03-07
+ */
+public interface FsWarehousesMapper
+{
+    /**
+     * 查询仓库
+     *
+     * @param id 仓库ID
+     * @return 仓库
+     */
+    public FsWarehouses selectFsWarehousesById(Long id);
+
+    /**
+     * 查询仓库列表
+     *
+     * @param fsWarehouses 仓库
+     * @return 仓库集合
+     */
+    public List<FsWarehouses> selectFsWarehousesList(FsWarehouses fsWarehouses);
+
+    /**
+     * 新增仓库
+     *
+     * @param fsWarehouses 仓库
+     * @return 结果
+     */
+    public int insertFsWarehouses(FsWarehouses fsWarehouses);
+
+    /**
+     * 修改仓库
+     *
+     * @param fsWarehouses 仓库
+     * @return 结果
+     */
+    public int updateFsWarehouses(FsWarehouses fsWarehouses);
+
+    /**
+     * 删除仓库
+     *
+     * @param id 仓库ID
+     * @return 结果
+     */
+    public int deleteFsWarehousesById(Long id);
+
+    /**
+     * 批量删除仓库
+     *
+     * @param ids 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteFsWarehousesByIds(List<Long> ids);
+}

+ 11 - 1
fs-service-system/src/main/java/com/fs/store/param/FsStoreProductAddEditParam.java

@@ -1,5 +1,6 @@
 package com.fs.store.param;
 
+import com.fs.common.annotation.Excel;
 import com.fs.store.domain.FsStoreProductAttrValue;
 import com.fs.store.dto.ProductArrtDTO;
 import lombok.Data;
@@ -10,7 +11,7 @@ import java.util.List;
 
 /**
  * 商品对象 fs_store_product
- * 
+ *
  * @author fs
  * @date 2022-03-15
  */
@@ -136,6 +137,15 @@ public class FsStoreProductAddEditParam implements Serializable
 
     private Integer tuiCateId;
 
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
+
     //属性项目
     private List<ProductArrtDTO> items;
     //sku结果集

+ 62 - 0
fs-service-system/src/main/java/com/fs/store/service/IFsWarehousesService.java

@@ -0,0 +1,62 @@
+package com.fs.store.service;
+
+import com.fs.store.domain.FsWarehouses;
+
+import java.util.List;
+
+/**
+ * 仓库Service接口
+ *
+ * @author fs
+ * @date 2025-03-07
+ */
+public interface IFsWarehousesService
+{
+    /**
+     * 查询仓库
+     *
+     * @param id 仓库ID
+     * @return 仓库
+     */
+    public FsWarehouses selectFsWarehousesById(Long id);
+
+    /**
+     * 查询仓库列表
+     *
+     * @param fsWarehouses 仓库
+     * @return 仓库集合
+     */
+    public List<FsWarehouses> selectFsWarehousesList(FsWarehouses fsWarehouses);
+
+    /**
+     * 新增仓库
+     *
+     * @param fsWarehouses 仓库
+     * @return 结果
+     */
+    public int insertFsWarehouses(FsWarehouses fsWarehouses);
+
+    /**
+     * 修改仓库
+     *
+     * @param fsWarehouses 仓库
+     * @return 结果
+     */
+    public int updateFsWarehouses(FsWarehouses fsWarehouses);
+
+    /**
+     * 批量删除仓库
+     *
+     * @param ids 需要删除的仓库ID
+     * @return 结果
+     */
+    public int deleteFsWarehousesByIds(List<Long> ids);
+
+    /**
+     * 删除仓库信息
+     *
+     * @param id 仓库ID
+     * @return 结果
+     */
+    public int deleteFsWarehousesById(Long id);
+}

+ 14 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsStoreOrderServiceImpl.java

@@ -654,6 +654,9 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
                 fsStoreCartDTO.setBrokerage(vo.getBrokerage());
                 fsStoreCartDTO.setBrokerageTwo(vo.getBrokerageTwo());
                 fsStoreCartDTO.setBrokerageThree(vo.getBrokerageThree());
+                fsStoreCartDTO.setWarehouseCode(vo.getWarehouseCode());
+                fsStoreCartDTO.setWarehouseId(vo.getWarehouseId());
+
                 if(StringUtils.isEmpty(vo.getProductAttrImage())){
                     fsStoreCartDTO.setImage(vo.getProductImage());
                 }
@@ -1678,11 +1681,17 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
                     if(productGroupDTOS!=null){
                         for(StoreProductGroupDTO dto:productGroupDTOS){
                             FsStoreProductAttrValue attrValue=attrValueService.selectFsStoreProductAttrValueById(dto.getId());
+
                             ErpOrderItem item=new ErpOrderItem();
                             item.setItem_code(attrValue.getBarCode());
                             item.setPrice(attrValue.getPrice().toString());
                             item.setQty(dto.getCount()*cartDTO.getNum());
                             item.setRefund(0);
+                            // 查询仓库代码
+                            FsStoreProduct fsStoreProduct = productService.selectFsStoreProductById(dto.getProductId());
+                            if(ObjectUtil.isNotNull(fsStoreProduct)){
+                                item.setWarehouseCode(fsStoreProduct.getWarehouseCode());
+                            }
                             details.add(item);
                         }
                     }
@@ -1693,6 +1702,11 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService
                 item.setItem_code(cartDTO.getBarCode().trim());
                 item.setPrice(cartDTO.getPrice().toString());
                 item.setQty(cartDTO.getNum());
+                // 仓库代码
+                FsStoreProduct fsStoreProduct = productService.selectFsStoreProductById(cartDTO.getProductId());
+                if(ObjectUtil.isNotNull(fsStoreProduct)){
+                    item.setWarehouseCode(cartDTO.getWarehouseCode());
+                }
                 item.setRefund(0);
                 details.add(item);
             }

+ 112 - 0
fs-service-system/src/main/java/com/fs/store/service/impl/FsWarehousesServiceImpl.java

@@ -0,0 +1,112 @@
+package com.fs.store.service.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.fs.store.domain.FsWarehouses;
+import com.fs.store.mapper.FsWarehousesMapper;
+import com.fs.store.service.IFsWarehousesService;
+import com.fs.system.cache.ISysDictDataCacheService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+/**
+ * 仓库Service业务层处理
+ *
+ * @author fs
+ * @date 2025-03-07
+ */
+@RequiredArgsConstructor
+@Service
+public class FsWarehousesServiceImpl implements IFsWarehousesService
+{
+    private final FsWarehousesMapper fsWarehousesMapper;
+    private final ISysDictDataCacheService sysDictDataCacheService;
+
+    /**
+     * 查询仓库
+     *
+     * @param id 仓库ID
+     * @return 仓库
+     */
+    @Override
+    public FsWarehouses selectFsWarehousesById(Long id)
+    {
+        return fsWarehousesMapper.selectFsWarehousesById(id);
+    }
+
+    /**
+     * 查询仓库列表
+     *
+     * @param fsWarehouses 仓库
+     * @return 仓库
+     */
+    @Override
+    public List<FsWarehouses> selectFsWarehousesList(FsWarehouses fsWarehouses)
+    {
+        List<FsWarehouses> warehouses = fsWarehousesMapper.selectFsWarehousesList(fsWarehouses);
+        for (FsWarehouses warehouse : warehouses) {
+            Integer isActive = warehouse.getIsActive();
+
+            if(ObjectUtils.isEmpty(isActive)){
+                isActive = 0;
+            }
+            String isActiveText = sysDictDataCacheService
+                    .selectDictLabel("enable_options", String.valueOf(isActive));
+            warehouse.setIsActiveText(isActiveText);
+        }
+
+        return warehouses;
+    }
+
+    /**
+     * 新增仓库
+     *
+     * @param fsWarehouses 仓库
+     * @return 结果
+     */
+    @Override
+    public int insertFsWarehouses(FsWarehouses fsWarehouses)
+    {
+        return fsWarehousesMapper.insertFsWarehouses(fsWarehouses);
+    }
+
+    /**
+     * 修改仓库
+     *
+     * @param fsWarehouses 仓库
+     * @return 结果
+     */
+    @Override
+    public int updateFsWarehouses(FsWarehouses fsWarehouses)
+    {
+        return fsWarehousesMapper.updateFsWarehouses(fsWarehouses);
+    }
+
+    /**
+     * 批量删除仓库
+     *
+     * @param ids 需要删除的仓库ID
+     * @return 结果
+     */
+    @Override
+    public int deleteFsWarehousesByIds(List<Long> ids)
+    {
+        return fsWarehousesMapper.deleteFsWarehousesByIds(ids);
+    }
+
+    /**
+     * 删除仓库信息
+     *
+     * @param id 仓库ID
+     * @return 结果
+     */
+    @Override
+    public int deleteFsWarehousesById(Long id)
+    {
+        return fsWarehousesMapper.deleteFsWarehousesById(id);
+    }
+}

+ 8 - 0
fs-service-system/src/main/java/com/fs/store/vo/FsStoreCartQueryVO.java

@@ -63,5 +63,13 @@ import java.math.BigDecimal;
 
     private BigDecimal brokerageThree;
 
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
 
 }

+ 10 - 2
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductActivityListVO.java

@@ -1,5 +1,6 @@
 package com.fs.store.vo;
 
+import com.fs.common.annotation.Excel;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -8,7 +9,7 @@ import java.math.BigDecimal;
 @Data
 /**
  * 商品对象 fs_store_product
- * 
+ *
  * @author fs
  * @date 2022-03-15
  */
@@ -46,7 +47,14 @@ public class FsStoreProductActivityListVO implements Serializable
 
     /** 库存 */
     private Long stock;
-
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
 
 
 }

+ 5 - 0
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductExportVO.java

@@ -190,4 +190,9 @@ public class FsStoreProductExportVO implements Serializable {
     @Excel(name = "代理价")
     private BigDecimal agentPrice;
 
+    /**
+     * 仓库代码
+     */
+    @Excel(name = "仓库代码")
+    private String warehouseCode;
 }

+ 9 - 1
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductListQueryVO.java

@@ -1,5 +1,6 @@
 package com.fs.store.vo;
 
+import com.fs.common.annotation.Excel;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -35,7 +36,14 @@ public class FsStoreProductListQueryVO implements Serializable
     private String unitName;
 
 
-
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
 
 
 

+ 10 - 1
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductListVO.java

@@ -7,7 +7,7 @@ import java.math.BigDecimal;
 @Data
 /**
  * 商品对象 fs_store_product
- * 
+ *
  * @author fs
  * @date 2022-03-15
  */
@@ -69,4 +69,13 @@ public class FsStoreProductListVO  implements Serializable
 
     private String cateName;
 
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
+
 }

+ 9 - 1
fs-service-system/src/main/java/com/fs/store/vo/FsStoreProductQueryVO.java

@@ -1,5 +1,6 @@
 package com.fs.store.vo;
 
+import com.fs.common.annotation.Excel;
 import lombok.Data;
 
 import java.io.Serializable;
@@ -114,5 +115,12 @@ public class FsStoreProductQueryVO implements Serializable
     /** 处方名 */
     private String prescribeName;
 
-
+    /**
+     * 仓库id
+     */
+    private Long warehouseId;
+    /**
+     * 仓库代码
+     */
+    private String warehouseCode;
 }

+ 11 - 0
fs-service-system/src/main/java/com/fs/system/cache/ISysDictDataCacheService.java

@@ -0,0 +1,11 @@
+package com.fs.system.cache;
+
+public interface ISysDictDataCacheService {
+    /**
+     * 根据字典类型和字典值查询字典标签
+     * @param dictType 字典类型
+     * @param dictValue 字典值
+     * @return 字典标签
+     */
+    String selectDictLabel(String dictType, String dictValue);
+}

+ 85 - 0
fs-service-system/src/main/java/com/fs/system/cache/impl/SysDictDataCacheServiceImpl.java

@@ -0,0 +1,85 @@
+package com.fs.system.cache.impl;
+
+import com.fs.system.cache.ISysDictDataCacheService;
+import com.fs.system.service.ISysDictDataService;
+import com.github.benmanes.caffeine.cache.Cache;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import org.apache.http.util.Asserts;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * 系统字典数据缓存服务实现类
+ *
+ * @author xdd
+ * @version 1.0
+ * @since 2024-03-07
+ */
+@Service
+public class SysDictDataCacheServiceImpl implements ISysDictDataCacheService {
+    /**
+     * 使用Caffeine本地缓存
+     * maximumSize: 最大缓存条数
+     * expireAfterWrite: 写入后多久过期(分钟)
+     */
+    private static final Cache<CompositeKey, String> CACHE = Caffeine.newBuilder()
+            .maximumSize(1000)
+            .expireAfterWrite(10, TimeUnit.MINUTES)
+            .build();
+
+    /**
+     * 注入ISysDictDataService,用于缓存未命中时查询数据
+     */
+    @Autowired
+    private ISysDictDataService sysDictDataService;
+
+    /**
+     * 根据字典类型和字典值查询字典标签
+     *
+     * @param dictType  字典类型
+     * @param dictValue 字典值
+     * @return 字典标签
+     */
+    @Override
+    public String selectDictLabel(String dictType, String dictValue) {
+        Asserts.notBlank(dictType,"字典类型不能为空!");
+        Asserts.notBlank(dictValue,"字典默认值不能为空!");
+
+        return CACHE.get(new CompositeKey(dictType, dictValue),
+                e-> sysDictDataService.selectDictLabel(dictType,dictValue));
+    }
+    /**
+     * 组合键,用于缓存的键
+     */
+    static class CompositeKey{
+        /**
+         * 字典类型
+         */
+        private final String dictType;
+        /**
+         * 字典值
+         */
+        private final String dictValue;
+
+        public CompositeKey(String dictType, String dictValue) {
+            this.dictType = dictType;
+            this.dictValue = dictValue;
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (this == o) return true;
+            if (o == null || getClass() != o.getClass()) return false;
+            CompositeKey that = (CompositeKey) o;
+            return Objects.equals(dictType, that.dictType) && Objects.equals(dictValue, that.dictValue);
+        }
+
+        @Override
+        public int hashCode() {
+            return Objects.hash(dictType, dictValue);
+        }
+    }
+}

+ 1 - 1
fs-service-system/src/main/resources/application-config.yml

@@ -12,7 +12,7 @@ fsConfig:
   erpSessionKey: 9caae15474cb443ea22235e7bb86016b
   erpSecret: 96f774dbd60847b59a16f92fd963a0c8
   erpUrl: http://v2.api.guanyierp.com/rest/erp_open
-  erpShopCode: test
+  erpShopCode: 0080
   #第三方支付配置
   payOpen: 1
   payPartnerId: 22051909542647100020

+ 16 - 9
fs-service-system/src/main/resources/mapper/store/FsStoreProductMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fs.store.mapper.FsStoreProductMapper">
-    
+
     <resultMap type="FsStoreProduct" id="FsStoreProductResult">
         <result property="productId"    column="product_id"    />
         <result property="image"    column="image"    />
@@ -50,12 +50,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectFsStoreProductVo">
-        select product_id, image, slider_image, product_name, product_info, keyword, bar_code, cate_id, price, vip_price, ot_price, postage, unit_name, sort, sales, stock, is_show, is_hot, is_benefit, is_best, is_new, description, create_time, update_time, is_postage, is_del, give_integral, cost, is_good, browse, code_path, temp_id, spec_type, is_integral, integral, product_type, prescribe_code, prescribe_spec, prescribe_factory, prescribe_name,is_display,tui_cate_id from fs_store_product
+        select product_id, image, slider_image, product_name, product_info, keyword, bar_code, cate_id, price, vip_price, ot_price, postage, unit_name, sort, sales, stock, is_show, is_hot, is_benefit, is_best, is_new, description, create_time, update_time, is_postage, is_del, give_integral, cost, is_good, browse, code_path, temp_id, spec_type, is_integral, integral, product_type, prescribe_code, prescribe_spec, prescribe_factory, prescribe_name,is_display,tui_cate_id,warehouse_id,warehouse_code from fs_store_product
     </sql>
 
     <select id="selectFsStoreProductList" parameterType="FsStoreProduct" resultMap="FsStoreProductResult">
         <include refid="selectFsStoreProductVo"/>
-        <where>  
+        <where>
             <if test="image != null  and image != ''"> and image = #{image}</if>
             <if test="sliderImage != null  and sliderImage != ''"> and slider_image = #{sliderImage}</if>
             <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
@@ -94,15 +94,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeFactory != null  and prescribeFactory != ''"> and prescribe_factory = #{prescribeFactory}</if>
             <if test="prescribeName != null  and prescribeName != ''"> and prescribe_name like concat('%', #{prescribeName}, '%')</if>
             <if test="isDisplay != null "> and is_display = #{isDisplay}</if>
-
+            <if test="warehouseId != null"> and warehouse_id = #{warehouseId}</if>
+            <if test="warehouseCode != null"> and warehouse_code = #{warehouseCode}</if>
         </where>
     </select>
-    
+
     <select id="selectFsStoreProductById" parameterType="Long" resultMap="FsStoreProductResult">
         <include refid="selectFsStoreProductVo"/>
         where product_id = #{productId}
     </select>
-        
+
     <insert id="insertFsStoreProduct" parameterType="FsStoreProduct" useGeneratedKeys="true" keyProperty="productId">
         insert into fs_store_product
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -147,6 +148,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeName != null">prescribe_name,</if>
             <if test="isDisplay != null">is_display,</if>
             <if test="tuiCateId != null">tui_cate_id,</if>
+            <if test="warehouseId != null">warehouse_id,</if>
+            <if test="warehouseCode != null">warehouse_code,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="image != null and image != ''">#{image},</if>
@@ -190,6 +193,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeName != null">#{prescribeName},</if>
             <if test="isDisplay != null">#{isDisplay},</if>
             <if test="tuiCateId != null">#{tuiCateId},</if>
+            <if test="warehouseId != null">#{warehouseId},</if>
+            <if test="warehouseCode != null">#{warehouseCode},</if>
          </trim>
     </insert>
 
@@ -237,6 +242,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="prescribeName != null">prescribe_name = #{prescribeName},</if>
             <if test="isDisplay != null">is_display = #{isDisplay},</if>
             <if test="tuiCateId != null">tui_cate_id = #{tuiCateId},</if>
+            <if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
+            <if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if>
         </trim>
         where product_id = #{productId}
     </update>
@@ -246,10 +253,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <delete id="deleteFsStoreProductByIds" parameterType="String">
-        delete from fs_store_product where product_id in 
+        delete from fs_store_product where product_id in
         <foreach item="productId" collection="array" open="(" separator="," close=")">
             #{productId}
         </foreach>
     </delete>
-    
-</mapper>
+
+</mapper>

+ 96 - 0
fs-service-system/src/main/resources/mapper/store/FsWarehousesMapper.xml

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.fs.store.mapper.FsWarehousesMapper">
+
+    <resultMap type="FsWarehouses" id="FsWarehousesResult">
+        <result property="id"    column="id"    />
+        <result property="warehouseName"    column="warehouse_name"    />
+        <result property="warehouseCode"    column="warehouse_code"    />
+        <result property="warehouseAddress"    column="warehouse_address"    />
+        <result property="contactPerson"    column="contact_person"    />
+        <result property="contactPhone"    column="contact_phone"    />
+        <result property="isActive"    column="is_active"    />
+        <result property="createdAt"    column="created_at"    />
+        <result property="updatedAt"    column="updated_at"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectFsWarehousesVo">
+        select id, warehouse_name, warehouse_code, warehouse_address, contact_person, contact_phone, is_active, created_at, updated_at, remark from fs_warehouses
+    </sql>
+
+    <select id="selectFsWarehousesList" parameterType="FsWarehouses" resultMap="FsWarehousesResult">
+        <include refid="selectFsWarehousesVo"/>
+        <where>
+            <if test="warehouseName != null  and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
+            <if test="warehouseCode != null  and warehouseCode != ''"> and warehouse_code = #{warehouseCode}</if>
+            <if test="warehouseAddress != null  and warehouseAddress != ''"> and warehouse_address = #{warehouseAddress}</if>
+            <if test="contactPerson != null  and contactPerson != ''"> and contact_person = #{contactPerson}</if>
+            <if test="contactPhone != null  and contactPhone != ''"> and contact_phone = #{contactPhone}</if>
+            <if test="isActive != null "> and is_active = #{isActive}</if>
+            <if test="createdAt != null "> and created_at = #{createdAt}</if>
+            <if test="updatedAt != null "> and updated_at = #{updatedAt}</if>
+        </where>
+    </select>
+
+    <select id="selectFsWarehousesById" parameterType="Long" resultMap="FsWarehousesResult">
+        <include refid="selectFsWarehousesVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertFsWarehouses" parameterType="FsWarehouses" useGeneratedKeys="true" keyProperty="id">
+        insert into fs_warehouses
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="warehouseName != null and warehouseName != ''">warehouse_name,</if>
+            <if test="warehouseCode != null">warehouse_code,</if>
+            <if test="warehouseAddress != null">warehouse_address,</if>
+            <if test="contactPerson != null">contact_person,</if>
+            <if test="contactPhone != null">contact_phone,</if>
+            <if test="isActive != null">is_active,</if>
+            <if test="createdAt != null">created_at,</if>
+            <if test="updatedAt != null">updated_at,</if>
+            <if test="remark != null">remark,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="warehouseName != null and warehouseName != ''">#{warehouseName},</if>
+            <if test="warehouseCode != null">#{warehouseCode},</if>
+            <if test="warehouseAddress != null">#{warehouseAddress},</if>
+            <if test="contactPerson != null">#{contactPerson},</if>
+            <if test="contactPhone != null">#{contactPhone},</if>
+            <if test="isActive != null">#{isActive},</if>
+            <if test="createdAt != null">#{createdAt},</if>
+            <if test="updatedAt != null">#{updatedAt},</if>
+            <if test="remark != null">#{remark},</if>
+         </trim>
+    </insert>
+
+    <update id="updateFsWarehouses" parameterType="FsWarehouses">
+        update fs_warehouses
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="warehouseName != null and warehouseName != ''">warehouse_name = #{warehouseName},</if>
+            <if test="warehouseCode != null">warehouse_code = #{warehouseCode},</if>
+            <if test="warehouseAddress != null">warehouse_address = #{warehouseAddress},</if>
+            <if test="contactPerson != null">contact_person = #{contactPerson},</if>
+            <if test="contactPhone != null">contact_phone = #{contactPhone},</if>
+            <if test="isActive != null">is_active = #{isActive},</if>
+            <if test="createdAt != null">created_at = #{createdAt},</if>
+            <if test="updatedAt != null">updated_at = #{updatedAt},</if>
+            <if test="remark != null">remark = #{remark},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteFsWarehousesById" parameterType="Long">
+        delete from fs_warehouses where id = #{id}
+    </delete>
+
+    <delete id="deleteFsWarehousesByIds" parameterType="String">
+        delete from fs_warehouses where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+</mapper>

+ 7 - 0
fs-user-app/pom.xml

@@ -115,6 +115,13 @@
             <scope>provided</scope>
         </dependency>
 
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-test</artifactId>
+            <scope>test</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 3 - 2
fs-user-app/src/main/java/com/fs/core/security/SecurityUtils.java

@@ -1,5 +1,6 @@
 package com.fs.core.security;
 
+import com.tencentcloudapi.yunjing.v20180228.models.MisAlarmNonlocalLoginPlacesRequest;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
@@ -7,7 +8,7 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
 
 /**
  * 安全服务工具类
- * 
+ *
 
  */
 public class SecurityUtils
@@ -21,7 +22,7 @@ public class SecurityUtils
      */
     public static String encryptPassword(String password)
     {
-        
+
         BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
         return passwordEncoder.encode(password);
     }

+ 61 - 0
fs-user-app/src/test/java/com/fs/core/security/BaseSpringBootTest.java

@@ -0,0 +1,61 @@
+package com.fs.core.security;
+
+import cn.hutool.core.date.DateUtil;
+import com.fs.common.utils.DateUtils;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.util.CollectionUtils;
+
+import java.util.List;
+
+/**
+ * 测试基类
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@SpringBootTest
+public abstract class BaseSpringBootTest {
+
+    protected Logger logger = LoggerFactory.getLogger(this.getClass());
+
+    private long time;
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        this.setTime(System.currentTimeMillis());
+        logger.info("==> 测试开始执行 <==");
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        logger.info("==> 测试执行完成,耗时:{} ms <==",
+                System.currentTimeMillis() - this.getTime());
+    }
+
+    /**
+     * 方法描述:打印list.
+     * 创建时间:2018-10-11 00:23:28
+     */
+    <T> void print(List<T> list) {
+        if (!CollectionUtils.isEmpty(list)) {
+            list.forEach(System.out::println);
+        }
+    }
+
+    void print(Object o) {
+        System.out.println(o.toString());
+    }
+
+}

+ 16 - 0
fs-user-app/src/test/java/com/fs/core/security/SecurityUtilsTest.java

@@ -0,0 +1,16 @@
+package com.fs.core.security;
+
+import org.junit.Test;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+import static com.fs.core.security.SecurityUtils.encryptPassword;
+
+
+public class SecurityUtilsTest extends BaseSpringBootTest{
+
+    @Test
+    public void encryptPasswor() {
+        String s = encryptPassword("123456");
+        System.out.println(s);
+    }
+}