24282 2 anni fa
parent
commit
d84828dc29
29 ha cambiato i file con 1021 aggiunte e 3 eliminazioni
  1. 5 0
      hx-admin/pom.xml
  2. 7 3
      hx-admin/src/main/resources/application-dev.yml
  3. 3 0
      hx-common/src/main/java/com/fjhx/common/constant/SourceConstant.java
  4. 7 0
      hx-item/pom.xml
  5. 4 0
      hx-item/src/main/java/com/fjhx/item/controller/product/ProductClassifyController.java
  6. 4 0
      hx-item/src/main/java/com/fjhx/item/controller/product/ProductInfoController.java
  7. 2 0
      hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java
  8. 19 0
      hx-supply/pom.xml
  9. 74 0
      hx-supply/src/main/java/com/fjhx/supply/controller/supplier/SupplierInfoController.java
  10. 70 0
      hx-supply/src/main/java/com/fjhx/supply/controller/supplier/SupplierPriceController.java
  11. 17 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierInfoDto.java
  12. 22 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierInfoSelectDto.java
  13. 29 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierPriceDto.java
  14. 27 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierPriceSelectDto.java
  15. 71 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/po/SupplierInfo.java
  16. 40 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/po/SupplierPrice.java
  17. 24 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierInfoVo.java
  18. 23 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierPriceAddVo.java
  19. 68 0
      hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierPriceVo.java
  20. 26 0
      hx-supply/src/main/java/com/fjhx/supply/mapper/supplier/SupplierInfoMapper.java
  21. 26 0
      hx-supply/src/main/java/com/fjhx/supply/mapper/supplier/SupplierPriceMapper.java
  22. 46 0
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/SupplierInfoService.java
  23. 44 0
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/SupplierPriceService.java
  24. 76 0
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierInfoServiceImpl.java
  25. 142 0
      hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierPriceServiceImpl.java
  26. 99 0
      hx-supply/src/main/java/com/fjhx/supply/utils/CodeEnum.java
  27. 25 0
      hx-supply/src/main/resources/mapper/supplier/SupplierInfoMapper.xml
  28. 16 0
      hx-supply/src/main/resources/mapper/supplier/SupplierPriceMapper.xml
  29. 5 0
      pom.xml

+ 5 - 0
hx-admin/pom.xml

@@ -24,6 +24,11 @@
             <artifactId>hx-item</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>hx-supply</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 7 - 3
hx-admin/src/main/resources/application-dev.yml

@@ -3,10 +3,14 @@ spring:
     datasource:
         dynamic:
             strict: true
+            driver-class-name: com.mysql.cj.jdbc.Driver
             datasource:
-                master:
-                    driver-class-name: com.mysql.cj.jdbc.Driver
-                    url: jdbc:mysql://36.134.91.96:17330/winfaster_master?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                item:
+                    url: jdbc:mysql://36.134.91.96:17330/bytesailing_item?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                    username: fjhx2012mysql
+                    password: 3PN-Mzn#vnP&q6d
+                supply:
+                    url: jdbc:mysql://36.134.91.96:17330/bytesailing_supply?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
                     username: fjhx2012mysql
                     password: 3PN-Mzn#vnP&q6d
                 base:

+ 3 - 0
hx-common/src/main/java/com/fjhx/common/constant/SourceConstant.java

@@ -2,5 +2,8 @@ package com.fjhx.common.constant;
 
 public interface SourceConstant {
 
+    String ITEM = "item";
+
+    String SUPPLY = "supply";
 
 }

+ 7 - 0
hx-item/pom.xml

@@ -13,10 +13,17 @@
     <artifactId>hx-item</artifactId>
 
     <dependencies>
+
         <dependency>
             <groupId>com.fjhx</groupId>
             <artifactId>hx-base</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>hx-common</artifactId>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 4 - 0
hx-item/src/main/java/com/fjhx/item/controller/product/ProductClassifyController.java

@@ -1,9 +1,12 @@
 package com.fjhx.item.controller.product;
 
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.item.entity.product.dto.ProductClassifyDto;
 import com.fjhx.item.entity.product.po.ProductClassify;
 import com.fjhx.item.service.product.ProductClassifyService;
+import com.ruoyi.common.constant.DatasourceConstant;
 import com.ruoyi.common.core.domain.BaseSelectDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
@@ -23,6 +26,7 @@ import java.util.List;
  * @author zlj
  * @since 2023-03-15
  */
+@DS(SourceConstant.ITEM)
 @RestController
 @RequestMapping("/productClassify")
 public class ProductClassifyController {

+ 4 - 0
hx-item/src/main/java/com/fjhx/item/controller/product/ProductInfoController.java

@@ -1,10 +1,13 @@
 package com.fjhx.item.controller.product;
 
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.item.entity.product.dto.ProductInfoDto;
 import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;
 import com.fjhx.item.entity.product.vo.ProductInfoVo;
 import com.fjhx.item.service.product.ProductInfoService;
+import com.ruoyi.common.constant.DatasourceConstant;
 import com.ruoyi.common.core.domain.BaseSelectDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -21,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
  * @author zlj
  * @since 2023-03-17
  */
+@DS(SourceConstant.ITEM)
 @RestController
 @RequestMapping("/productInfo")
 public class ProductInfoController {

+ 2 - 0
hx-item/src/main/java/com/fjhx/item/service/product/impl/ProductInfoServiceImpl.java

@@ -1,8 +1,10 @@
 package com.fjhx.item.service.product.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.constant.SourceConstant;
 import com.fjhx.file.utils.ObsFileUtil;
 import com.fjhx.item.entity.product.dto.ProductInfoDto;
 import com.fjhx.item.entity.product.dto.ProductInfoSelectDto;

+ 19 - 0
hx-supply/pom.xml

@@ -12,4 +12,23 @@
 
     <artifactId>hx-supply</artifactId>
 
+    <dependencies>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>hx-base</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>hx-common</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>hx-item</artifactId>
+        </dependency>
+
+    </dependencies>
+
 </project>

+ 74 - 0
hx-supply/src/main/java/com/fjhx/supply/controller/supplier/SupplierInfoController.java

@@ -0,0 +1,74 @@
+package com.fjhx.supply.controller.supplier;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.common.constant.SourceConstant;
+import com.fjhx.supply.entity.supplier.dto.SupplierInfoDto;
+import com.fjhx.supply.entity.supplier.dto.SupplierInfoSelectDto;
+import com.fjhx.supply.entity.supplier.vo.SupplierInfoVo;
+import com.fjhx.supply.service.supplier.SupplierInfoService;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 供应商 前端控制器
+ * </p>
+ *
+ * @author
+ * @since 2023-03-17
+ */
+@DS(SourceConstant.SUPPLY)
+@RestController
+@RequestMapping("/supplierInfo")
+public class SupplierInfoController {
+
+    @Autowired
+    private SupplierInfoService supplierInfoService;
+
+    /**
+     * 供应商分页
+     */
+    @PostMapping("/page")
+    public Page<SupplierInfoVo> page(@RequestBody SupplierInfoSelectDto dto) {
+        return supplierInfoService.getPage(dto);
+    }
+
+    /**
+     * 供应商明细
+     */
+    @PostMapping("/detail")
+    public SupplierInfoVo detail(@RequestBody BaseSelectDto dto) {
+        return supplierInfoService.detail(dto.getId());
+    }
+
+    /**
+     * 供应商新增
+     */
+    @PostMapping("/add")
+    public void add(@RequestBody SupplierInfoDto supplierInfoDto) {
+        supplierInfoService.add(supplierInfoDto);
+    }
+
+    /**
+     * 供应商编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody SupplierInfoDto supplierInfoDto) {
+        supplierInfoService.edit(supplierInfoDto);
+    }
+
+    /**
+     * 供应商删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        supplierInfoService.delete(dto.getId());
+    }
+
+}

+ 70 - 0
hx-supply/src/main/java/com/fjhx/supply/controller/supplier/SupplierPriceController.java

@@ -0,0 +1,70 @@
+package com.fjhx.supply.controller.supplier;
+
+import com.baomidou.dynamic.datasource.annotation.DS;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.common.constant.SourceConstant;
+import com.fjhx.supply.entity.supplier.dto.SupplierPriceDto;
+import com.fjhx.supply.entity.supplier.dto.SupplierPriceSelectDto;
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceAddVo;
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
+import com.fjhx.supply.service.supplier.SupplierPriceService;
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ * <p>
+ * 供应商价格 前端控制器
+ * </p>
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+@DS(SourceConstant.SUPPLY)
+@RestController
+@RequestMapping("/supplierPrice")
+public class SupplierPriceController {
+
+    @Autowired
+    private SupplierPriceService supplierPriceService;
+
+    /**
+     * 供应商价格分页
+     */
+    @PostMapping("/page")
+    public Page<SupplierPriceVo> page(@RequestBody SupplierPriceSelectDto dto) {
+        return supplierPriceService.getPage(dto);
+    }
+
+    /**
+     * 供应商价格新增
+     *
+     * @return
+     */
+    @PostMapping("/add")
+    public SupplierPriceAddVo add(@Validated @RequestBody SupplierPriceDto supplierPriceDto) {
+        return supplierPriceService.add(supplierPriceDto);
+    }
+
+    /**
+     * 供应商价格编辑
+     */
+    @PostMapping("/edit")
+    public void edit(@RequestBody SupplierPriceDto supplierPriceDto) {
+        supplierPriceService.edit(supplierPriceDto);
+    }
+
+    /**
+     * 供应商价格删除
+     */
+    @PostMapping("/delete")
+    public void delete(@RequestBody BaseSelectDto dto) {
+        supplierPriceService.delete(dto.getId());
+    }
+
+}

+ 17 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierInfoDto.java

@@ -0,0 +1,17 @@
+package com.fjhx.supply.entity.supplier.dto;
+
+import com.fjhx.supply.entity.supplier.po.SupplierInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 供应商新增编辑入参实体
+ *
+ * @author 
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+public class SupplierInfoDto extends SupplierInfo {
+
+}

+ 22 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierInfoSelectDto.java

@@ -0,0 +1,22 @@
+package com.fjhx.supply.entity.supplier.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 供应商列表查询入参实体
+ *
+ * @author 
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+public class SupplierInfoSelectDto extends BaseSelectDto {
+
+    /**
+     * 供应商类型 1贸易商 2工厂
+     */
+    private Integer type;
+
+}

+ 29 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierPriceDto.java

@@ -0,0 +1,29 @@
+package com.fjhx.supply.entity.supplier.dto;
+
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 供应商价格新增编辑入参实体
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+public class SupplierPriceDto extends SupplierPrice {
+
+    /**
+     * 供应商价格列表
+     */
+    private List<SupplierPrice> supplierPriceList;
+
+    /**
+     * 存在重复是否修改
+     */
+    private boolean renewWhileItExists;
+
+}

+ 27 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/dto/SupplierPriceSelectDto.java

@@ -0,0 +1,27 @@
+package com.fjhx.supply.entity.supplier.dto;
+
+import com.ruoyi.common.core.domain.BaseSelectDto;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 供应商价格列表查询入参实体
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+public class SupplierPriceSelectDto extends BaseSelectDto {
+
+    /**
+     * 供应商类型 1贸易商 2工厂
+     */
+    private Integer supplierType;
+
+    /**
+     * 定义 1产品 2物料
+     */
+    private Integer definition;
+
+}

+ 71 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/po/SupplierInfo.java

@@ -0,0 +1,71 @@
+package com.fjhx.supply.entity.supplier.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 供应商
+ * </p>
+ *
+ * @author
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+@TableName("supplier_info")
+public class SupplierInfo extends BasePo {
+
+    /**
+     * 供应商编码
+     */
+    private String code;
+
+    /**
+     * 供应商类型 1贸易商 2工厂
+     */
+    private Integer type;
+
+    /**
+     * 供应商名称
+     */
+    private String name;
+
+    /**
+     * 国家id
+     */
+    private String countryId;
+
+    /**
+     * 省id
+     */
+    private String provinceId;
+
+    /**
+     * 市id
+     */
+    private String cityId;
+
+    /**
+     * 地区明细
+     */
+    private String areaDetail;
+
+    /**
+     * 联系人
+     */
+    private String contactPerson;
+
+    /**
+     * 联系电话
+     */
+    private String contactNumber;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+}

+ 40 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/po/SupplierPrice.java

@@ -0,0 +1,40 @@
+package com.fjhx.supply.entity.supplier.po;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.ruoyi.common.core.domain.BasePo;
+import lombok.Getter;
+import lombok.Setter;
+
+import javax.validation.constraints.NotNull;
+import java.math.BigDecimal;
+
+/**
+ * <p>
+ * 供应商价格
+ * </p>
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+@TableName("supplier_price")
+public class SupplierPrice extends BasePo {
+
+    /**
+     * 供应商id
+     */
+    @NotNull(message = "供应商id不能为空")
+    private Long supplierInfoId;
+
+    /**
+     * 产品id
+     */
+    private Long productInfoId;
+
+    /**
+     * 价格
+     */
+    private BigDecimal price;
+
+}

+ 24 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierInfoVo.java

@@ -0,0 +1,24 @@
+package com.fjhx.supply.entity.supplier.vo;
+
+import com.fjhx.area.service.ISetAreaName;
+import com.fjhx.supply.entity.supplier.po.SupplierInfo;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 供应商列表查询返回值实体
+ *
+ * @author
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+public class SupplierInfoVo extends SupplierInfo implements ISetAreaName {
+
+    private String countryName;
+
+    private String provinceName;
+
+    private String cityName;
+
+}

+ 23 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierPriceAddVo.java

@@ -0,0 +1,23 @@
+package com.fjhx.supply.entity.supplier.vo;
+
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+@Getter
+@Setter
+public class SupplierPriceAddVo {
+
+    /**
+     * 是否添加成功
+     */
+    private boolean addSuccess;
+
+    /**
+     * 失败说明列表
+     */
+    private List<SupplierPrice> existSupplierPriceList;
+
+}

+ 68 - 0
hx-supply/src/main/java/com/fjhx/supply/entity/supplier/vo/SupplierPriceVo.java

@@ -0,0 +1,68 @@
+package com.fjhx.supply.entity.supplier.vo;
+
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 供应商价格列表查询返回值实体
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+@Getter
+@Setter
+public class SupplierPriceVo extends SupplierPrice {
+
+
+    /**
+     * 货品类型 1产品 2物料
+     */
+    private Integer definition;
+
+    /**
+     * 所属分类id
+     */
+    private Long productClassifyId;
+
+    /**
+     * 所属分类
+     */
+    private String productClassifyName;
+
+    /**
+     * 所属类型
+     */
+    private Integer productType;
+
+    /**
+     * 货品编码
+     */
+    private String productCode;
+
+    /**
+     * 货品名称
+     */
+    private String productName;
+
+    /**
+     * 规格型号
+     */
+    private String productSpec;
+
+    /**
+     * 单位
+     */
+    private String productUnit;
+
+    /**
+     * 供应商类型 1贸易商 2工厂
+     */
+    private Integer supplierType;
+
+    /**
+     * 供应商名称
+     */
+    private String supplierName;
+
+}

+ 26 - 0
hx-supply/src/main/java/com/fjhx/supply/mapper/supplier/SupplierInfoMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.supply.mapper.supplier;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.supply.entity.supplier.po.SupplierInfo;
+import com.fjhx.supply.entity.supplier.vo.SupplierInfoVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 供应商 Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-17
+ */
+public interface SupplierInfoMapper extends BaseMapper<SupplierInfo> {
+
+    /**
+     * 供应商分页
+     */
+    Page<SupplierInfoVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<SupplierInfo> wrapper);
+
+}

+ 26 - 0
hx-supply/src/main/java/com/fjhx/supply/mapper/supplier/SupplierPriceMapper.java

@@ -0,0 +1,26 @@
+package com.fjhx.supply.mapper.supplier;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import org.apache.ibatis.annotations.Param;
+
+
+/**
+ * <p>
+ * 供应商价格 Mapper 接口
+ * </p>
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+public interface SupplierPriceMapper extends BaseMapper<SupplierPrice> {
+
+    /**
+     * 供应商价格分页
+     */
+    Page<SupplierPriceVo> getPage(@Param("page") Page<Object> page, @Param("ew") IWrapper<SupplierPrice> wrapper);
+
+}

+ 46 - 0
hx-supply/src/main/java/com/fjhx/supply/service/supplier/SupplierInfoService.java

@@ -0,0 +1,46 @@
+package com.fjhx.supply.service.supplier;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.supply.entity.supplier.dto.SupplierInfoDto;
+import com.fjhx.supply.entity.supplier.dto.SupplierInfoSelectDto;
+import com.fjhx.supply.entity.supplier.po.SupplierInfo;
+import com.fjhx.supply.entity.supplier.vo.SupplierInfoVo;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 供应商 服务类
+ * </p>
+ *
+ * @author 
+ * @since 2023-03-17
+ */
+public interface SupplierInfoService extends BaseService<SupplierInfo> {
+
+    /**
+     * 供应商分页
+     */
+    Page<SupplierInfoVo> getPage(SupplierInfoSelectDto dto);
+
+    /**
+     * 供应商明细
+     */
+    SupplierInfoVo detail(Long id);
+
+    /**
+     * 供应商新增
+     */
+    void add(SupplierInfoDto supplierInfoDto);
+
+    /**
+     * 供应商编辑
+     */
+    void edit(SupplierInfoDto supplierInfoDto);
+
+    /**
+     * 供应商删除
+     */
+    void delete(Long id);
+
+}

+ 44 - 0
hx-supply/src/main/java/com/fjhx/supply/service/supplier/SupplierPriceService.java

@@ -0,0 +1,44 @@
+package com.fjhx.supply.service.supplier;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.supply.entity.supplier.dto.SupplierPriceDto;
+import com.fjhx.supply.entity.supplier.dto.SupplierPriceSelectDto;
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceAddVo;
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
+import com.ruoyi.common.core.service.BaseService;
+
+
+/**
+ * <p>
+ * 供应商价格 服务类
+ * </p>
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+public interface SupplierPriceService extends BaseService<SupplierPrice> {
+
+    /**
+     * 供应商价格分页
+     */
+    Page<SupplierPriceVo> getPage(SupplierPriceSelectDto dto);
+
+    /**
+     * 供应商价格新增
+     *
+     * @return
+     */
+    SupplierPriceAddVo add(SupplierPriceDto supplierPriceDto);
+
+    /**
+     * 供应商价格编辑
+     */
+    void edit(SupplierPriceDto supplierPriceDto);
+
+    /**
+     * 供应商价格删除
+     */
+    void delete(Long id);
+
+}

+ 76 - 0
hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierInfoServiceImpl.java

@@ -0,0 +1,76 @@
+package com.fjhx.supply.service.supplier.impl;
+
+import cn.hutool.core.bean.BeanUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.area.utils.AreaUtil;
+import com.fjhx.supply.entity.supplier.dto.SupplierInfoDto;
+import com.fjhx.supply.entity.supplier.dto.SupplierInfoSelectDto;
+import com.fjhx.supply.entity.supplier.po.SupplierInfo;
+import com.fjhx.supply.entity.supplier.vo.SupplierInfoVo;
+import com.fjhx.supply.mapper.supplier.SupplierInfoMapper;
+import com.fjhx.supply.service.supplier.SupplierInfoService;
+import com.fjhx.supply.utils.CodeEnum;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.common.utils.wrapper.SqlField;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+
+/**
+ * <p>
+ * 供应商 服务实现类
+ * </p>
+ *
+ * @author
+ * @since 2023-03-17
+ */
+@Service
+public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, SupplierInfo> implements SupplierInfoService {
+
+    @Override
+    public Page<SupplierInfoVo> getPage(SupplierInfoSelectDto dto) {
+        IWrapper<SupplierInfo> wrapper = getWrapper();
+        wrapper.orderByDesc("si", SupplierInfo::getId);
+        wrapper.eq("si", SupplierInfo::getType, dto.getType());
+        wrapper.keyword(dto,
+                new SqlField("si", SupplierInfo::getName),
+                new SqlField("si", SupplierInfo::getCode)
+        );
+        Page<SupplierInfoVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+
+        List<SupplierInfoVo> records = page.getRecords();
+        if (records.size() == 0) {
+            return page;
+        }
+        AreaUtil.setAreaName(records);
+        return page;
+    }
+
+    @Override
+    public SupplierInfoVo detail(Long id) {
+        SupplierInfo SupplierInfo = this.getById(id);
+        SupplierInfoVo result = BeanUtil.toBean(SupplierInfo, SupplierInfoVo.class);
+        AreaUtil.setAreaName(result);
+        return result;
+    }
+
+    @Override
+    public void add(SupplierInfoDto supplierInfoDto) {
+        supplierInfoDto.setCode(CodeEnum.SUPPLIER_INFO.getCode());
+        this.save(supplierInfoDto);
+    }
+
+    @Override
+    public void edit(SupplierInfoDto supplierInfoDto) {
+        supplierInfoDto.setCode(null);
+        this.updateById(supplierInfoDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+}

+ 142 - 0
hx-supply/src/main/java/com/fjhx/supply/service/supplier/impl/SupplierPriceServiceImpl.java

@@ -0,0 +1,142 @@
+package com.fjhx.supply.service.supplier.impl;
+
+import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.common.constant.SourceConstant;
+import com.fjhx.item.service.product.ProductClassifyService;
+import com.fjhx.item.service.product.ProductInfoService;
+import com.fjhx.supply.entity.supplier.dto.SupplierPriceDto;
+import com.fjhx.supply.entity.supplier.dto.SupplierPriceSelectDto;
+import com.fjhx.supply.entity.supplier.po.SupplierInfo;
+import com.fjhx.supply.entity.supplier.po.SupplierPrice;
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceAddVo;
+import com.fjhx.supply.entity.supplier.vo.SupplierPriceVo;
+import com.fjhx.supply.mapper.supplier.SupplierPriceMapper;
+import com.fjhx.supply.service.supplier.SupplierPriceService;
+import com.ruoyi.common.utils.wrapper.IWrapper;
+import com.ruoyi.common.utils.wrapper.SqlField;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+
+/**
+ * <p>
+ * 供应商价格 服务实现类
+ * </p>
+ *
+ * @author zlj
+ * @since 2023-03-17
+ */
+@Service
+public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, SupplierPrice> implements SupplierPriceService {
+
+    @Autowired
+    private ProductInfoService productInfoService;
+
+    @Autowired
+    private ProductClassifyService productClassifyService;
+
+    @Override
+    public Page<SupplierPriceVo> getPage(SupplierPriceSelectDto dto) {
+        IWrapper<SupplierPrice> wrapper = getWrapper();
+        wrapper.orderByDesc("sp", SupplierPrice::getId);
+        wrapper.eq("si", SupplierInfo::getType, dto.getSupplierType());
+        wrapper.keyword(dto,
+                new SqlField("si.name")
+        );
+        Page<SupplierPriceVo> page = this.baseMapper.getPage(dto.getPage(), wrapper);
+        List<SupplierPriceVo> records = page.getRecords();
+
+        if (records.size() == 0) {
+            return page;
+        }
+
+        DynamicDataSourceContextHolder.push(SourceConstant.ITEM);
+        productInfoService.attributeAssign(records, SupplierPrice::getProductInfoId, (item, product) -> {
+            item.setDefinition(product.getDefinition());
+            item.setProductClassifyId(product.getProductClassifyId());
+            item.setProductType(product.getType());
+            item.setProductCode(product.getCode());
+            item.setProductName(product.getName());
+            item.setProductSpec(product.getSpec());
+            item.setProductUnit(product.getUnit());
+        });
+
+        productClassifyService.attributeAssign(records, SupplierPriceVo::getProductClassifyId, (item, productClassify) -> {
+            item.setProductClassifyName(productClassify.getName());
+        });
+
+        DynamicDataSourceContextHolder.clear();
+        return page;
+    }
+
+    @Override
+    public SupplierPriceAddVo add(SupplierPriceDto supplierPriceDto) {
+        SupplierPriceAddVo supplierPriceAddVo = new SupplierPriceAddVo();
+
+        // 添加产品列表
+        List<SupplierPrice> supplierPriceList = supplierPriceDto.getSupplierPriceList();
+        // 添加产品id列表
+        List<Long> productInfoIdList = supplierPriceList.stream().map(SupplierPrice::getProductInfoId).collect(Collectors.toList());
+
+        // 供应商id
+        Long supplierInfoId = supplierPriceDto.getSupplierInfoId();
+
+        // 存在供应商价格列表
+        List<SupplierPrice> existSupplierPriceList = list(q -> q
+                .eq(SupplierPrice::getSupplierInfoId, supplierInfoId)
+                .in(SupplierPrice::getProductInfoId, productInfoIdList));
+
+        if (existSupplierPriceList.size() == 0) {
+            supplierPriceList.forEach(item -> item.setSupplierInfoId(supplierPriceDto.getSupplierInfoId()));
+            saveBatch(supplierPriceList);
+            supplierPriceAddVo.setAddSuccess(true);
+            return supplierPriceAddVo;
+        }
+
+        // 存在价格更新
+        if (supplierPriceDto.isRenewWhileItExists()) {
+
+            // 产品id,明细map
+            Map<Long, SupplierPrice> map = existSupplierPriceList.stream()
+                    .collect(Collectors.toMap(SupplierPrice::getProductInfoId, Function.identity()));
+
+            for (SupplierPrice supplierPrice : supplierPriceList) {
+                supplierPrice.setSupplierInfoId(supplierInfoId);
+
+                SupplierPrice existSupplierPrice = map.get(supplierPrice.getProductInfoId());
+                if (existSupplierPrice != null) {
+                    supplierPrice.setId(existSupplierPrice.getId());
+                    supplierPrice.setPrice(existSupplierPrice.getPrice());
+                }
+            }
+            saveOrUpdateBatch(supplierPriceList);
+            supplierPriceAddVo.setAddSuccess(true);
+            return supplierPriceAddVo;
+        }
+
+        // 存在价格不更新
+        supplierPriceAddVo.setExistSupplierPriceList(existSupplierPriceList);
+        return supplierPriceAddVo;
+    }
+
+    @Override
+    public void edit(SupplierPriceDto supplierPriceDto) {
+        supplierPriceDto.setSupplierInfoId(null);
+        supplierPriceDto.setProductInfoId(null);
+
+        this.updateById(supplierPriceDto);
+    }
+
+    @Override
+    public void delete(Long id) {
+        this.removeById(id);
+    }
+
+}

+ 99 - 0
hx-supply/src/main/java/com/fjhx/supply/utils/CodeEnum.java

@@ -0,0 +1,99 @@
+package com.fjhx.supply.utils;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.text.CharSequenceUtil;
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fjhx.supply.service.supplier.SupplierInfoService;
+import com.ruoyi.common.exception.ServiceException;
+import lombok.Getter;
+
+import java.util.Date;
+import java.util.Map;
+
+@Getter
+public enum CodeEnum {
+
+    // 供应商编码
+    SUPPLIER_INFO("S", null, "code", 5, SupplierInfoService.class),
+    ;
+
+    CodeEnum(String prefix, String dateFormat, String codeFieldName, Integer length, Class<? extends IService<?>> serviceCls) {
+        this.prefix = prefix;
+        this.dateFormat = dateFormat;
+        this.length = length;
+        this.codeFieldName = codeFieldName;
+        this.service = SpringUtil.getBean(serviceCls);
+    }
+
+    // 编码前缀
+    private final String prefix;
+    // 编码加日期规则
+    private final String dateFormat;
+    // 长度
+    private final Integer length;
+    // 编码字段名
+    private final String codeFieldName;
+    // service
+    private final IService<?> service;
+
+    /**
+     * 获取键值对
+     */
+    public String getCode() {
+        String itemPrefix;
+
+        if (ObjectUtil.isNotEmpty(dateFormat)) {
+            Date date = new Date();
+            String format = DateUtil.format(date, dateFormat);
+            itemPrefix = prefix + format;
+        } else {
+            itemPrefix = prefix;
+        }
+
+        Object obj = service.query()
+                .likeRight(codeFieldName, itemPrefix)
+                .orderByDesc(codeFieldName)
+                .last("limit 1")
+                .one();
+
+        if (obj == null) {
+            return itemPrefix + autoGenericCode(length, 0);
+        }
+
+        Map<String, Object> map = Convert.toMap(String.class, Object.class, obj);
+
+        String code = Convert.toStr(map.get(CharSequenceUtil.toCamelCase(codeFieldName)));
+        Integer codeNum = Convert.toInt(code.substring(itemPrefix.length()));
+        if (codeNum == null) {
+            throw new ServiceException("自定义编码与系统编码生成规则冲突,暂时无法生成编码,请联系管理员");
+        }
+
+        return itemPrefix + autoGenericCode(length, codeNum);
+    }
+
+    /**
+     * 获取键值对
+     */
+    public String getCode(String code) {
+        if (ObjectUtil.isNotEmpty(code)) {
+            Long count = service.query().eq(codeFieldName, code).count();
+            if (count != 0) {
+                throw new ServiceException("编码已存在");
+            }
+            return code;
+        } else {
+            return getCode();
+        }
+    }
+
+    /**
+     * 不够位数的在前面补0,保留num的长度位数字
+     */
+    private static String autoGenericCode(int length, Integer codeNum) {
+        return String.format("%0" + length + "d", codeNum + 1);
+    }
+
+}

+ 25 - 0
hx-supply/src/main/resources/mapper/supplier/SupplierInfoMapper.xml

@@ -0,0 +1,25 @@
+<?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.fjhx.supply.mapper.supplier.SupplierInfoMapper">
+    <select id="getPage" resultType="com.fjhx.supply.entity.supplier.vo.SupplierInfoVo">
+        select
+            si.id,
+            si.code,
+            si.type,
+            si.name,
+            si.country_id,
+            si.province_id,
+            si.city_id,
+            si.area_detail,
+            si.contact_person,
+            si.contact_number,
+            si.remark,
+            si.create_user,
+            si.create_time,
+            si.update_user,
+            si.update_time
+        from supplier_info si
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 16 - 0
hx-supply/src/main/resources/mapper/supplier/SupplierPriceMapper.xml

@@ -0,0 +1,16 @@
+<?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.fjhx.supply.mapper.supplier.SupplierPriceMapper">
+    <select id="getPage" resultType="com.fjhx.supply.entity.supplier.vo.SupplierPriceVo">
+        select sp.id,
+               sp.supplier_info_id,
+               sp.product_info_id,
+               sp.price,
+               si.name       supplierName,
+               si.type       supplierType
+        from supplier_price sp
+                 inner join supplier_info si on sp.supplier_info_id = si.id
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

+ 5 - 0
pom.xml

@@ -52,6 +52,11 @@
             </dependency>
             <dependency>
                 <groupId>com.fjhx</groupId>
+                <artifactId>hx-common</artifactId>
+                <version>${hx.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>com.fjhx</groupId>
                 <artifactId>hx-customer</artifactId>
                 <version>${hx.version}</version>
             </dependency>