浏览代码

供应商模块

caozj 2 年之前
父节点
当前提交
d3169e2481
共有 33 个文件被更改,包括 1951 次插入0 次删除
  1. 17 0
      bladex-tool/blade-starter-mybatis/src/main/java/org/springblade/core/mp/mapper/sql.xml
  2. 34 0
      hx-common/hx-tool/src/main/java/com/fjhx/base/BasicEntity.java
  3. 39 0
      hx-common/hx-tool/src/main/java/com/fjhx/base/ListPageMap.java
  4. 124 0
      hx-common/hx-tool/src/main/java/com/fjhx/base/Pager.java
  5. 24 0
      hx-common/hx-tool/src/main/java/com/fjhx/utils/CodeUtil.java
  6. 8 0
      hx-service-api/storage-api/pom.xml
  7. 65 0
      hx-service-api/storage-api/src/main/java/com/fjhx/entity/attachment/StockAttachment.java
  8. 64 0
      hx-service-api/storage-api/src/main/java/com/fjhx/entity/attachment/enums/AttachmentTypeEnum.java
  9. 288 0
      hx-service-api/storage-api/src/main/java/com/fjhx/entity/supplier/Supplier.java
  10. 65 0
      hx-service-api/storage-api/src/main/java/com/fjhx/entity/supplier/SupplierProblem.java
  11. 68 0
      hx-service-api/storage-api/src/main/java/com/fjhx/entity/supplier/enums/SupplierProblemEnum.java
  12. 17 0
      hx-service-api/storage-api/src/main/java/com/fjhx/params/stock/StockAttachmentEx.java
  13. 17 0
      hx-service-api/storage-api/src/main/java/com/fjhx/params/stock/StockAttachmentVo.java
  14. 17 0
      hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierEx.java
  15. 17 0
      hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierProblemEx.java
  16. 22 0
      hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierProblemVo.java
  17. 17 0
      hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierVo.java
  18. 4 0
      hx-service/storage/pom.xml
  19. 62 0
      hx-service/storage/src/main/java/com/fjhx/attachment/controller/StockAttachmentController.java
  20. 16 0
      hx-service/storage/src/main/java/com/fjhx/attachment/mapper/StockAttachmentMapper.java
  21. 5 0
      hx-service/storage/src/main/java/com/fjhx/attachment/mapper/StockAttachmentMapper.xml
  22. 35 0
      hx-service/storage/src/main/java/com/fjhx/attachment/service/StockAttachmentService.java
  23. 104 0
      hx-service/storage/src/main/java/com/fjhx/attachment/service/impl/StockAttachmentServiceImpl.java
  24. 128 0
      hx-service/storage/src/main/java/com/fjhx/supplier/controller/SupplierController.java
  25. 79 0
      hx-service/storage/src/main/java/com/fjhx/supplier/controller/SupplierProblemController.java
  26. 66 0
      hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.java
  27. 113 0
      hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.xml
  28. 16 0
      hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierProblemMapper.java
  29. 5 0
      hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierProblemMapper.xml
  30. 30 0
      hx-service/storage/src/main/java/com/fjhx/supplier/service/SupplierProblemService.java
  31. 86 0
      hx-service/storage/src/main/java/com/fjhx/supplier/service/SupplierService.java
  32. 125 0
      hx-service/storage/src/main/java/com/fjhx/supplier/service/impl/SupplierProblemServiceImpl.java
  33. 174 0
      hx-service/storage/src/main/java/com/fjhx/supplier/service/impl/SupplierServiceImpl.java

+ 17 - 0
bladex-tool/blade-starter-mybatis/src/main/java/org/springblade/core/mp/mapper/sql.xml

@@ -0,0 +1,17 @@
+<?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="Sql">
+
+    <sql id="sql_pager">
+        <if test="pager != null">
+            LIMIT #{pager.pageStart},#{pager.pageSize}
+        </if>
+    </sql>
+
+    <sql id="sql_limit">
+        <if test="start != null and end != null">
+            LIMIT #{start},#{end}
+        </if>
+    </sql>
+
+</mapper>

+ 34 - 0
hx-common/hx-tool/src/main/java/com/fjhx/base/BasicEntity.java

@@ -0,0 +1,34 @@
+package com.fjhx.base;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class BasicEntity implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键id
+     */
+    @TableId(value = "id", type = IdType.ASSIGN_ID)
+    private String id;
+
+    /**
+     * 创建时间
+     */
+    @TableField("CreatedTime")
+    private Date CreatedTime;
+
+    /**
+     * 更新时间
+     */
+    @TableField("UpdatedTime")
+    private Date UpdatedTime;
+
+}

+ 39 - 0
hx-common/hx-tool/src/main/java/com/fjhx/base/ListPageMap.java

@@ -0,0 +1,39 @@
+package com.fjhx.base;
+
+import java.util.Map;
+
+/**
+ * @Author:caozj
+ * @DATE:2022/7/12 17:35
+ */
+public class ListPageMap {
+
+
+    private static final String page_num_key = "pageNum";
+    private static final String page_size_key = "pageSize";
+
+    private static final String pager_key = "pager";
+    private static final String start_key = "start";
+    private static final String end_key = "end";
+
+    public static final int pageNum_def = 1;
+    public static final int pageSize_def = 10;
+
+    /**
+     * 获取分页列表请求参数
+     *
+     * @param condition 查询条件
+     * @return
+     */
+    public static void getListPageMap(Map<String, Object> condition) {
+        // 起始页
+        int pageNum = (condition.get(page_num_key) == null || condition.get(page_num_key) == "") ? pageNum_def : Integer.valueOf(String.valueOf(condition.get(page_num_key)));
+        // 每页显示数
+        int pageSize = (condition.get(page_size_key) == null || condition.get(page_size_key) == "") ? pageSize_def : Integer.valueOf(String.valueOf(condition.get(page_size_key)));
+
+        Pager pager = new Pager(pageNum, pageSize);
+        condition.put(pager_key, pager);
+        condition.put(start_key, pager.getPageStart());
+        condition.put(end_key, pager.getPageSize());
+    }
+}

+ 124 - 0
hx-common/hx-tool/src/main/java/com/fjhx/base/Pager.java

@@ -0,0 +1,124 @@
+package com.fjhx.base;
+
+import java.io.Serializable;
+
+/**
+ * 分页
+ * @Author:caozj
+ * @DATE:2022/7/12 17:36
+ */
+public class Pager implements Serializable {
+
+    private static final long serialVersionUID = -4781129496475920388L;
+
+    // 当前页
+    private int pageNum;
+
+    // 显示数
+    private int pageSize;
+
+    // 总条数
+    private int totalCount;
+
+    // 开始
+    private int pageStart;
+
+    // 结束
+    private int pageEnd;
+
+    // 总页数
+    private int totalPage;
+
+    public Pager() {
+
+    }
+
+    /**
+     * 分页
+     *
+     * @param pageNum 当前页
+     * @param pageSize    显示数
+     */
+    public Pager(int pageNum, int pageSize) {
+        if (pageNum <= 0) {
+            pageNum = 1;
+        }
+        if (pageSize <= 0) {
+            pageSize = 10;
+        }
+
+        this.pageNum = pageNum;
+        this.pageSize = pageSize;
+    }
+
+    public int getpageNum() {
+        return pageNum;
+    }
+
+    public void setpageNum(int pageNum) {
+        this.pageNum = pageNum;
+    }
+
+    public int getPageSize() {
+        return pageSize;
+    }
+
+    public void setPageSize(int pageSize) {
+        this.pageSize = pageSize;
+    }
+
+    public int getTotalCount() {
+        return totalCount;
+    }
+
+    public void setTotalCount(int totalCount) {
+        this.totalCount = totalCount;
+    }
+
+    public int getPageStart() {
+        // 分页起始
+        if (pageNum > 0) {
+            this.pageStart = (pageNum - 1) * pageSize;
+        }
+        return pageStart;
+    }
+
+    public void setPageStart(int pageStart) {
+        this.pageStart = pageStart;
+    }
+
+    public int getPageEnd() {
+        // 分页结束
+        this.pageEnd = pageNum * pageSize;
+        return pageEnd;
+    }
+
+    public void setPageEnd(int pageEnd) {
+        this.pageEnd = pageEnd;
+    }
+
+    public int getTotalPage() {
+        if (pageSize <= 0) {
+            return 0;
+        }
+        // 总页数
+        this.totalPage = (totalCount + pageSize - 1) / pageSize;
+        return this.totalPage;
+    }
+
+    public void setTotalPage(int totalPage) {
+
+    }
+
+    @Override
+    public String toString() {
+        return "Pager{" +
+                "pageNum=" + pageNum +
+                ", pageSize=" + pageSize +
+                ", totalCount=" + totalCount +
+                ", pageStart=" + pageStart +
+                ", pageEnd=" + pageEnd +
+                ", totalPage=" + totalPage +
+                '}';
+    }
+}

+ 24 - 0
hx-common/hx-tool/src/main/java/com/fjhx/utils/CodeUtil.java

@@ -0,0 +1,24 @@
+package com.fjhx.utils;
+
+import java.text.DecimalFormat;
+
+/**
+ * 编码生成工具类
+ * @Author:caozj
+ * @DATE:2022/7/13 11:17
+ */
+public class CodeUtil {
+
+    /**
+     * 生成供应商编码
+     * @param code
+     * @return
+     */
+    public static String generateWmsCode(String code){
+        DecimalFormat decimalFormat=new DecimalFormat("0000");
+        String codenew=code.substring(1);
+        int i=Integer.parseInt(codenew)+1;
+        String k=decimalFormat.format(i);
+        return "C"+k;
+    }
+}

+ 8 - 0
hx-service-api/storage-api/pom.xml

@@ -10,6 +10,14 @@
     <modelVersion>4.0.0</modelVersion>
 
     <artifactId>storage-api</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-collections4</artifactId>
+            <version>4.1</version>
+            <scope>compile</scope>
+        </dependency>
+    </dependencies>
 
     <properties>
         <maven.compiler.source>8</maven.compiler.source>

+ 65 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/entity/attachment/StockAttachment.java

@@ -0,0 +1,65 @@
+package com.fjhx.entity.attachment;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fjhx.base.BaseEntity;
+import com.fjhx.base.BasicEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * <p>
+ * 业务附件表
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class StockAttachment extends BasicEntity {
+
+
+    /**
+     * 业务表id,0表示空
+     */
+    @TableField("busiId")
+    private String busiId;
+
+    /**
+     * 业务类型:(1、面料问题反馈图片)
+     */
+    @TableField("busiType")
+    private Integer busiType;
+
+    /**
+     * 附件的真实名称
+     */
+    @TableField("realName")
+    private String realName;
+
+    /**
+     * 附件的临时名称
+     */
+    @TableField("temName")
+    private String temName;
+
+    /**
+     * 路径
+     */
+    private String path;
+
+    /**
+     * 文件后缀
+     */
+    private String format;
+
+    /**
+     * 大小
+     */
+    private Long size;
+}

+ 64 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/entity/attachment/enums/AttachmentTypeEnum.java

@@ -0,0 +1,64 @@
+package com.fjhx.entity.attachment.enums;
+
+import org.apache.commons.collections4.MapUtils;
+import org.springblade.core.tool.utils.StringPool;
+
+import java.util.LinkedHashMap;
+
+/**
+ * 文件类型枚举
+ */
+public enum AttachmentTypeEnum {
+    TYPE_ONE (1, "面料问题反馈图片"),
+    TYPE_TWO (2, "供应商其他资质"),
+    ;
+
+    private int key;
+
+    private String value;
+
+    private static LinkedHashMap<Integer, String> map = new LinkedHashMap<>();
+
+    AttachmentTypeEnum(int key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    /**
+     * 获取枚举map
+     *
+     * @return
+     */
+    public static LinkedHashMap<Integer, String> getMap() {
+        if (MapUtils.isNotEmpty(map)) {
+            return map;
+        }
+        for (AttachmentTypeEnum ms : values()) {
+            map.put(ms.key, ms.value);
+        }
+        return map;
+    }
+
+    /**
+     * 通过key获取名称
+     *
+     * @param key
+     * @return
+     */
+    public static String getNameByKey(Integer key) {
+        if (key == null || key < 0) {
+            return StringPool.EMPTY;
+        }
+        LinkedHashMap<Integer, String> map = getMap();
+        return map.getOrDefault(key, StringPool.EMPTY);
+    }
+
+    public int getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+}

+ 288 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/entity/supplier/Supplier.java

@@ -0,0 +1,288 @@
+package com.fjhx.entity.supplier;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fjhx.base.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fjhx.base.BasicEntity;
+import com.fjhx.entity.attachment.StockAttachment;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 供应商
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Supplier extends BasicEntity {
+
+
+    /**
+     * 软删除
+     */
+    @TableField("IsDelete")
+    private Boolean isDelete;
+
+    /**
+     * 编码
+     */
+    @TableField("Code")
+    private String code;
+
+    /**
+     * 绑定用户
+     */
+    @TableField("BingdUserID")
+    private String bingdUserId;
+
+    /**
+     * 供应商名称
+     */
+    @TableField("Name")
+    private String name;
+
+    /**
+     * 帐期
+     */
+    @TableField("AccountDate")
+    private Integer accountDate;
+
+    /**
+     * 账期说明
+     */
+    @TableField("AccountDateRemark")
+    private String accountDateRemark;
+
+    /**
+     * 备注
+     */
+    @TableField("Remark")
+    private String remark;
+
+    /**
+     * 社会信用代码
+     */
+    @TableField("SocietyCreditCode")
+    private String societyCreditCode;
+
+    /**
+     * 法人
+     */
+    @TableField("LegalPerson")
+    private String legalPerson;
+
+    /**
+     * 注册地址
+     */
+    @TableField("RegisteredAddress")
+    private String registeredAddress;
+
+    /**
+     * 创建日期
+     */
+    @TableField("EstablishDate")
+    private Date establishDate;
+
+    /**
+     * 注册资本
+     */
+    @TableField("RegisteredCapital")
+    private String registeredCapital;
+
+    /**
+     * 企业类型
+     */
+    @TableField("EnterpriseType")
+    private String enterpriseType;
+
+    /**
+     * 运营期限
+     */
+    @TableField("BusinessTerm")
+    private String businessTerm;
+
+    /**
+     * 运营范围
+     */
+    @TableField("BusinessScope")
+    private String businessScope;
+
+    /**
+     * 联系人
+     */
+    @TableField("LinkMen")
+    private String linkMen;
+
+    /**
+     * 手机
+     */
+    @TableField("Mobile")
+    private String mobile;
+
+    /**
+     * 电话
+     */
+    @TableField("Telephone")
+    private String telephone;
+
+    /**
+     * 邮箱
+     */
+    @TableField("Email")
+    private String email;
+
+    /**
+     * 传真
+     */
+    @TableField("Fax")
+    private String fax;
+
+    /**
+     * 开户行
+     */
+    @TableField("OpenBank")
+    private String openBank;
+
+    /**
+     * 账户名称
+     */
+    @TableField("BankAccoutName")
+    private String bankAccoutName;
+
+    /**
+     * 银联号
+     */
+    @TableField("BankAccout")
+    private String bankAccout;
+
+    /**
+     * 对私银行
+     */
+    @TableField("PriOpenBank")
+    private String priOpenBank;
+
+    /**
+     * 对私账户名称
+     */
+    @TableField("PriBankAccoutName")
+    private String priBankAccoutName;
+
+    /**
+     * 对私账户
+     */
+    @TableField("PriBankAccout")
+    private String priBankAccout;
+
+    /**
+     * 物料类型
+     */
+    @TableField("CategoryCode")
+    private String categoryCode;
+
+    /**
+     * 备注
+     */
+    @TableField("Representative")
+    private String representative;
+
+    /**
+     * 加州65号法令合规测试证书
+     */
+    @TableField("Certificate")
+    private String certificate;
+
+    /**
+     * 营业执照
+     */
+    @TableField("BusinessLicense")
+    private String businessLicense;
+
+    /**
+     * 问题反馈条数
+     */
+    @TableField(exist = false)
+    private Integer warningCount;
+
+    /**
+     * 物料类型名称
+     */
+    @TableField(exist = false)
+    private String categoryName;
+
+    /**
+     * 物料分类名称
+     */
+    @TableField(exist = false)
+    private String materialCategoryName;
+
+    /**
+     * 分类条数
+     */
+    @TableField(exist = false)
+    private Integer CategoryCount;
+
+    /**
+     * 物料分类ID
+     */
+    @TableField(exist = false)
+    private String materialCategoryId;
+
+    /**
+     * 工艺类型 (枚举定义:0=直喷,1=热转,2=打纸,3=墨水,4=其他)
+     */
+    @TableField(exist = false)
+    private Integer TechnologyType;
+
+    /**
+     * 物料用途
+     */
+    @TableField(exist = false)
+    private String purpose;
+
+    /**
+     * 文件
+     */
+    @TableField(exist = false)
+    private List<StockAttachment> attr;
+
+    /**
+     * 总金额
+     */
+    @TableField(exist = false)
+    private String sumMoney;
+
+    /**
+     * 去年金额
+     */
+    @TableField(exist = false)
+    private String lastYearMoney;
+
+    /**
+     * 今年金额
+     */
+    @TableField(exist = false)
+    private String yearMoney;
+
+    /**
+     * 上个月金额
+     */
+    @TableField(exist = false)
+    private String lastMonthMoney;
+
+    /**
+     * 本月金额
+     */
+    @TableField(exist = false)
+    private String monthMoney;
+}

+ 65 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/entity/supplier/SupplierProblem.java

@@ -0,0 +1,65 @@
+package com.fjhx.entity.supplier;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import java.util.Date;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.fjhx.base.BaseEntity;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fjhx.base.BasicEntity;
+import com.fjhx.entity.attachment.StockAttachment;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 供应商面料问题反馈表
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierProblem extends BasicEntity {
+
+
+    /**
+     * 软删除
+     */
+    @TableField("IsDelete")
+    private Boolean isDelete;
+
+    /**
+     * 供应商ID
+     */
+    @TableField("SupplierId")
+    private String supplierId;
+
+    /**
+     * 物料ID
+     */
+    @TableField("MaterialId")
+    private String materialId;
+
+    /**
+     * 问题类型  逗号分隔
+     */
+    @TableField("ProblemType")
+    private String problemType;
+
+    /**
+     * 备注信息
+     */
+    @TableField("Remark")
+    private String remark;
+
+    /**
+     * 文件合集
+     */
+    @TableField(exist = false)
+    private List<StockAttachment> attr;
+
+}

+ 68 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/entity/supplier/enums/SupplierProblemEnum.java

@@ -0,0 +1,68 @@
+package com.fjhx.entity.supplier.enums;
+
+import org.apache.commons.collections4.MapUtils;
+import org.springblade.core.tool.utils.StringPool;
+
+import java.util.LinkedHashMap;
+
+/**
+ * 面料问题反馈类型
+ */
+public enum SupplierProblemEnum {
+    SHORTAGE (1, "短少"),
+    DRAWN_WORK(2, "抽纱"),
+    WRINKLE(3, "褶皱"),
+    SMUDGINESS(4, "脏污"),
+    HOLE(5, "破洞"),
+    SHRINK(6, "缩水"),
+    ;
+
+    private int key;
+
+    private String value;
+
+    private static LinkedHashMap<Integer, String> map = new LinkedHashMap<>();
+
+    SupplierProblemEnum(int key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    /**
+     * 获取枚举map
+     *
+     * @return
+     */
+    public static LinkedHashMap<Integer, String> getMap() {
+        if (MapUtils.isNotEmpty(map)) {
+            return map;
+        }
+        for (SupplierProblemEnum ms : values()) {
+            map.put(ms.key, ms.value);
+        }
+        return map;
+    }
+
+    /**
+     * 通过key获取名称
+     *
+     * @param key
+     * @return
+     */
+    public static String getNameByKey(Integer key) {
+        if (key == null || key < 0) {
+            return StringPool.EMPTY;
+        }
+        LinkedHashMap<Integer, String> map = getMap();
+        return map.getOrDefault(key, StringPool.EMPTY);
+    }
+
+    public int getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+}

+ 17 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/params/stock/StockAttachmentEx.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.stock;
+
+import com.fjhx.entity.attachment.StockAttachment;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 业务附件表
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class StockAttachmentEx extends StockAttachment {
+
+}

+ 17 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/params/stock/StockAttachmentVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.stock;
+
+import com.fjhx.entity.attachment.StockAttachment;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 业务附件表
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class StockAttachmentVo extends StockAttachment {
+
+}

+ 17 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierEx.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.supplier;
+
+import com.fjhx.entity.supplier.Supplier;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 供应商
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierEx extends Supplier {
+
+}

+ 17 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierProblemEx.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.supplier;
+
+import com.fjhx.entity.supplier.SupplierProblem;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 供应商面料问题反馈表
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierProblemEx extends SupplierProblem {
+
+}

+ 22 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierProblemVo.java

@@ -0,0 +1,22 @@
+package com.fjhx.params.supplier;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fjhx.entity.attachment.StockAttachment;
+import com.fjhx.entity.supplier.SupplierProblem;
+import com.fjhx.params.stock.StockAttachmentVo;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 供应商面料问题反馈表
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierProblemVo extends SupplierProblem {
+
+}

+ 17 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/params/supplier/SupplierVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.supplier;
+
+import com.fjhx.entity.supplier.Supplier;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 供应商
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierVo extends Supplier {
+
+}

+ 4 - 0
hx-service/storage/pom.xml

@@ -27,6 +27,10 @@
             <groupId>com.fjhx</groupId>
             <artifactId>storage-api</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-starter-tenant</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 62 - 0
hx-service/storage/src/main/java/com/fjhx/attachment/controller/StockAttachmentController.java

@@ -0,0 +1,62 @@
+package com.fjhx.attachment.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.attachment.service.StockAttachmentService;
+import com.fjhx.entity.attachment.StockAttachment;
+import com.fjhx.params.stock.StockAttachmentVo;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 业务附件表 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@RestController
+@RequestMapping("/stockAttachment")
+public class StockAttachmentController {
+
+    @Autowired
+    private StockAttachmentService stockAttachmentService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition){
+        Page<StockAttachment> result = stockAttachmentService.getPage(condition);
+        return R.success(result);
+    }
+
+    @PostMapping("/add")
+    public R add(@RequestBody StockAttachmentVo stockAttachmentVo){
+        stockAttachmentService.add(stockAttachmentVo);
+        return R.success();
+    }
+
+    @PostMapping("/edit")
+    public R edit(@RequestBody StockAttachmentVo stockAttachmentVo){
+        stockAttachmentService.edit(stockAttachmentVo);
+        return R.success();
+    }
+
+    @PostMapping("/delete")
+    public R delete(@RequestBody StockAttachmentVo stockAttachmentVo){
+        stockAttachmentService.delete(stockAttachmentVo);
+        return R.success();
+    }
+
+    /**
+     * 根据业务ID查询文件列表
+     * @param busi
+     * @return
+     */
+    @GetMapping("/getListByBusi")
+    public R getListByBusi(@RequestParam("busi")String busi){
+        return R.success(stockAttachmentService.getListByBusi(busi));
+    }
+}
+

+ 16 - 0
hx-service/storage/src/main/java/com/fjhx/attachment/mapper/StockAttachmentMapper.java

@@ -0,0 +1,16 @@
+package com.fjhx.attachment.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.entity.attachment.StockAttachment;
+
+/**
+ * <p>
+ * 业务附件表 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+public interface StockAttachmentMapper extends BaseMapper<StockAttachment> {
+
+}

+ 5 - 0
hx-service/storage/src/main/java/com/fjhx/attachment/mapper/StockAttachmentMapper.xml

@@ -0,0 +1,5 @@
+<?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.attachment.mapper.StockAttachmentMapper">
+
+</mapper>

+ 35 - 0
hx-service/storage/src/main/java/com/fjhx/attachment/service/StockAttachmentService.java

@@ -0,0 +1,35 @@
+package com.fjhx.attachment.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.base.BaseService;
+import com.fjhx.entity.attachment.StockAttachment;
+import com.fjhx.params.stock.StockAttachmentVo;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 业务附件表 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+public interface StockAttachmentService extends BaseService<StockAttachment> {
+
+    Page<StockAttachment> getPage(Map<String, String> condition);
+
+    void add(StockAttachmentVo stockAttachmentVo);
+
+    void edit(StockAttachmentVo stockAttachmentVo);
+
+    void delete(StockAttachmentVo stockAttachmentVo);
+
+    /**
+     * 根据业务ID查询文件
+     * @param busi
+     * @return
+     */
+    List<StockAttachment> getListByBusi(String busi);
+}

+ 104 - 0
hx-service/storage/src/main/java/com/fjhx/attachment/service/impl/StockAttachmentServiceImpl.java

@@ -0,0 +1,104 @@
+package com.fjhx.attachment.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.attachment.mapper.StockAttachmentMapper;
+import com.fjhx.attachment.service.StockAttachmentService;
+import com.fjhx.entity.attachment.StockAttachment;
+import com.fjhx.params.stock.StockAttachmentVo;
+import com.fjhx.utils.WrapperUtil;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.tenant.annotation.TenantIgnore;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 业务附件表 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Service
+public class StockAttachmentServiceImpl extends ServiceImpl<StockAttachmentMapper, StockAttachment> implements StockAttachmentService {
+
+    @Override
+    public Page<StockAttachment> getPage(Map<String, String> condition) {
+
+        QueryWrapper<StockAttachment> wrapper = Wrappers.query();
+
+        WrapperUtil.init(condition, wrapper)
+                .eqTenantId()
+                .createTimeDesc();
+
+        Page<StockAttachment> page = page(condition, wrapper);
+        return page;
+    }
+
+    /**
+     * 添加
+     * @param stockAttachmentVo
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @TenantIgnore
+    @Override
+    public void add(StockAttachmentVo stockAttachmentVo) {
+        if(StringUtil.isEmpty(stockAttachmentVo.getBusiId())||
+        StringUtil.isEmpty(stockAttachmentVo.getPath())){
+            throw new ServiceException("参数异常");
+        }
+        stockAttachmentVo.setCreatedTime(new Date());
+        save(stockAttachmentVo);
+    }
+
+    /**
+     * 修改
+     * @param stockAttachmentVo
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @TenantIgnore
+    @Override
+    public void edit(StockAttachmentVo stockAttachmentVo) {
+        if(StringUtil.isEmpty(stockAttachmentVo.getId())){
+            throw new ServiceException("参数异常");
+        }
+        updateById(stockAttachmentVo);
+    }
+
+    /**
+     * 删除
+     * @param stockAttachmentVo
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @TenantIgnore
+    @Override
+    public void delete(StockAttachmentVo stockAttachmentVo) {
+        if(StringUtil.isEmpty(stockAttachmentVo.getId())){
+            throw new ServiceException("参数异常");
+        }
+        removeById(stockAttachmentVo.getId());
+    }
+
+    /**
+     * 根据业务ID查询文件
+     * @param busi
+     * @return
+     */
+    @TenantIgnore
+    @Override
+    public List<StockAttachment> getListByBusi(String busi) {
+        if(StringUtil.isEmpty(busi)){
+            throw new ServiceException("参数异常");
+        }
+        return list(Wrappers.<StockAttachment>query().lambda().eq(StockAttachment::getBusiId,busi));
+    }
+
+}

+ 128 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/controller/SupplierController.java

@@ -0,0 +1,128 @@
+package com.fjhx.supplier.controller;
+
+import com.fjhx.base.ListPageMap;
+import org.springblade.core.tool.api.R;
+import com.fjhx.entity.supplier.Supplier;
+import com.fjhx.supplier.service.SupplierService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@RestController
+@RequestMapping("/supplier")
+public class SupplierController {
+
+    @Autowired
+    private SupplierService supplierService;
+
+    /**
+     * 列表
+     * @param condition
+     * @return
+     */
+    @PostMapping("/list")
+    public R list(@RequestBody Map<String, Object> condition){
+        ListPageMap.getListPageMap(condition);
+        List<Supplier> result = supplierService.getList(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 列表条数
+     * @param condition
+     * @return
+     */
+    @PostMapping("/list/count")
+    public R listCount(@RequestBody Map<String, Object> condition){
+        ListPageMap.getListPageMap(condition);
+        Integer count = supplierService.getListCount(condition);
+        return R.success(count);
+    }
+
+    /**
+     * 供应商采购列表
+     * @param condition
+     * @return
+     */
+    @PostMapping("/purchase/list")
+    public R purchaseList(@RequestBody Map<String, Object> condition){
+        ListPageMap.getListPageMap(condition);
+        List<Supplier> result = supplierService.getPurList(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 供应商采购列表条数
+     * @param condition
+     * @return
+     */
+    @PostMapping("/purchase/list/count")
+    public R purchaseListCount(@RequestBody Map<String, Object> condition){
+        ListPageMap.getListPageMap(condition);
+        Integer count = supplierService.getPurListCount(condition);
+        return R.success(count);
+    }
+    /**
+     * 统计物料分类
+     * @return
+     */
+    @GetMapping("/statisticsClassify")
+    public R statisticsClassify(){
+        List<Supplier> list = supplierService.statisticsClassify();
+        return R.success(list);
+    }
+
+    /**
+     * 添加
+     * @param supplier
+     * @return
+     */
+    @PostMapping("/add")
+    public R add(@RequestBody Supplier supplier){
+        supplierService.add(supplier);
+        return R.success();
+    }
+
+    /**
+     * 修改
+     * @param supplier
+     * @return
+     */
+    @PostMapping("/edit")
+    public R edit(@RequestBody Supplier supplier){
+        supplierService.edit(supplier);
+        return R.success();
+    }
+
+    /**
+     * 删除
+     * @param supplier
+     * @return
+     */
+    @PostMapping("/delete")
+    public R delete(@RequestBody Supplier supplier){
+        supplierService.delete(supplier);
+        return R.success();
+    }
+
+    /**
+     * 详情
+     * @param id
+     * @return
+     */
+    @GetMapping("/detail")
+    public R detail(@RequestParam("id")String id){
+        return R.success(supplierService.detail(id));
+    }
+}
+

+ 79 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/controller/SupplierProblemController.java

@@ -0,0 +1,79 @@
+package com.fjhx.supplier.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.supplier.SupplierProblem;
+import com.fjhx.params.supplier.SupplierProblemVo;
+import com.fjhx.supplier.service.SupplierProblemService;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商面料问题反馈表 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@RestController
+@RequestMapping("/supplierProblem")
+public class SupplierProblemController {
+
+    @Autowired
+    private SupplierProblemService supplierProblemService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition){
+        Page<SupplierProblem> result = supplierProblemService.getPage(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 添加
+     * @param supplierProblemVo
+     * @return
+     */
+    @PostMapping("/add")
+    public R add(@RequestBody SupplierProblemVo supplierProblemVo){
+        supplierProblemService.add(supplierProblemVo);
+        return R.success();
+    }
+
+    /**
+     * 修改
+     * @param supplierProblemVo
+     * @return
+     */
+    @PostMapping("/edit")
+    public R edit(@RequestBody SupplierProblemVo supplierProblemVo){
+        supplierProblemService.edit(supplierProblemVo);
+        return R.success();
+    }
+
+    /**
+     * 删除
+     * @param supplierProblemVo
+     * @return
+     */
+    @PostMapping("/delete")
+    public R delete(@RequestBody SupplierProblemVo supplierProblemVo){
+        supplierProblemService.delete(supplierProblemVo);
+        return R.success();
+    }
+
+    /**
+     * 详情
+     * @param id
+     * @return
+     */
+    @GetMapping("/detail")
+    public R detail(@RequestParam("id")String id){
+        SupplierProblem data = supplierProblemService.detail(id);
+        return R.success(data);
+    }
+
+}
+

+ 66 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.java

@@ -0,0 +1,66 @@
+package com.fjhx.supplier.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.stock.StockWater;
+import com.fjhx.entity.supplier.Supplier;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+import org.springblade.core.tenant.annotation.TenantIgnore;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+public interface SupplierMapper extends BaseMapper<Supplier> {
+
+    /**
+     * 列表
+     *
+     * @param condition
+     * @return
+     */
+    @TenantIgnore
+    List<Supplier> getList(Map<String, Object> condition);
+
+    /**
+     * 列表-总条数
+     *
+     * @param condition
+     * @return
+     */
+    @TenantIgnore
+    Integer getListCount(Map<String, Object> condition);
+
+    /**
+     * 供应商采购列表
+     *
+     * @param condition
+     * @return
+     */
+    @TenantIgnore
+    List<Supplier> getPurList(Map<String, Object> condition);
+
+    /**
+     * 供应商采购列表-总条数
+     *
+     * @param condition
+     * @return
+     */
+    @TenantIgnore
+    Integer getPurListCount(Map<String, Object> condition);
+
+    /**
+     * 物料分类分组查询
+     * @return
+     */
+    @TenantIgnore
+    List<Supplier> getGroupByCategory();
+}

+ 113 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.xml

@@ -0,0 +1,113 @@
+<?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.supplier.mapper.SupplierMapper">
+
+    <select id="getList" resultType="com.fjhx.entity.supplier.Supplier">
+        SELECT
+            t1.*,
+            t3.CategoryCode,
+            t3.TechnologyType AS TechnologyType,
+            t3.Purpose AS Purpose,
+            t4.`Name` AS materialCategoryName,
+            t4.ID,
+            ( SELECT count( 1 ) FROM supplier_problem WHERE SupplierId = t1.id ) AS warningCount,
+            (select `Name` from material_category where `Code` = t1.CategoryCode) AS categoryName
+        FROM
+            supplier t1
+        LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
+        LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
+        LEFT JOIN material_category t4 ON t3.CategoryCode = t4.`Code`
+        <include refid="list_condition"/>
+        ORDER BY t1.CreatedTime DESC
+        <include refid="sql_limit"/>
+    </select>
+    <select id="getListCount" resultType="java.lang.Integer">
+        SELECT
+            count(1)
+        FROM
+        supplier t1
+        LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
+        LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
+        LEFT JOIN material_category t4 ON t3.CategoryCode = t4.`Code`
+        <include refid="list_condition"/>
+    </select>
+    <select id="getPurList" resultType="com.fjhx.entity.supplier.Supplier">
+        SELECT
+            t1.ID,
+            t1.`Name`,
+            t3.CategoryCode,
+            t3.TechnologyType AS TechnologyType,
+            t3.Purpose AS purpose,
+            ( SELECT count( 1 ) FROM supplier_problem WHERE SupplierId = t1.id ) AS warningCount,
+            FORMAT(IFNULL((<include refid="sumMoney_filed"/>),0),2)AS sumMoney,
+            FORMAT(IFNULL((<include refid="lastYearMoney_filed"/>),0),2)AS lastYearMoney,
+            FORMAT(IFNULL((<include refid="yearMoney_filed"/>),0),2)AS yearMoney,
+            FORMAT(IFNULL((<include refid="lastMonthMoney_filed"/>),0),2)AS lastMonthMoney,
+            FORMAT(IFNULL((<include refid="monthMoney_filed"/>),0),2)AS monthMoney
+        FROM
+            supplier t1
+        LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
+        LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
+        <include refid="list_condition"/>
+        ORDER BY t1.CreatedTime DESC
+        <include refid="sql_limit"/>
+    </select>
+    <select id="getPurListCount" resultType="java.lang.Integer">
+        SELECT
+            count(1)
+        FROM
+        supplier t1
+        LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
+        LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
+        <include refid="list_condition"/>
+    </select>
+    <select id="getGroupByCategory" resultType="com.fjhx.entity.supplier.Supplier">
+        SELECT
+            count( 1 ) AS CategoryCount,
+            t3.TechnologyType AS TechnologyType
+        FROM
+            supplier t1
+                LEFT JOIN supplier_price t2 ON t1.id = t2.FactoryId
+                LEFT JOIN material t3 ON t2.MaterialCode = t3.`Code`
+        WHERE
+            t3.TechnologyType IS NOT NULL
+            AND t1.IsDelete = 0
+        GROUP BY
+            t3.TechnologyType
+    </select>
+    <sql id="sumMoney_filed">
+        SELECT SUM( TotalAmount ) FROM purchase_contract WHERE IsDelete = 0 AND SupplierId = t1.ID
+    </sql>
+    <sql id="yearMoney_filed">
+        select SUM(TotalAmount) from purchase_contract where IsDelete = 0 AND SupplierId = t1.ID  AND YEAR(CreatedTime)=YEAR(NOW())
+    </sql>
+    <sql id="lastYearMoney_filed">
+        select SUM(TotalAmount) from purchase_contract where IsDelete = 0 AND SupplierId = t1.ID AND YEAR(CreatedTime) = YEAR(DATE_SUB(NOW(),INTERVAL 1 YEAR))
+    </sql>
+    <sql id="monthMoney_filed">
+        select SUM(TotalAmount) from purchase_contract where IsDelete = 0 AND SupplierId = t1.ID AND DATE_FORMAT(CreatedTime,'%Y%m') = DATE_FORMAT(CURDATE(),'%Y%m')
+    </sql>
+    <sql id="lastMonthMoney_filed">
+        select SUM(TotalAmount) from purchase_contract where IsDelete = 0 AND SupplierId = t1.ID AND PERIOD_DIFF(DATE_FORMAT(NOW(),'%Y%m'),DATE_FORMAT(CreatedTime,'%Y%m')) = 1
+    </sql>
+    <sql id="list_condition">
+        <where>
+            t1.IsDelete = 0
+            <if test="search neq null and search neq '' ">
+                AND ((INSTR(t1.`Name`, #{search}) > 0) OR (INSTR(t1.`Code`, #{search}) > 0) )
+            </if>
+            <if test="TechnologyType neq null and TechnologyType neq '' ">
+                AND t3.TechnologyType = #{TechnologyType}
+            </if>
+            <if test="Purpose neq null and Purpose neq '' ">
+                AND INSTR( t3.Purpose, #{Purpose} ) > 0
+            </if>
+
+        </where>
+    </sql>
+    <sql id="sql_limit">
+        <if test="start != null and end != null">
+            LIMIT #{start},#{end}
+        </if>
+    </sql>
+</mapper>

+ 16 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierProblemMapper.java

@@ -0,0 +1,16 @@
+package com.fjhx.supplier.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.fjhx.entity.supplier.SupplierProblem;
+
+/**
+ * <p>
+ * 供应商面料问题反馈表 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+public interface SupplierProblemMapper extends BaseMapper<SupplierProblem> {
+
+}

+ 5 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierProblemMapper.xml

@@ -0,0 +1,5 @@
+<?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.supplier.mapper.SupplierProblemMapper">
+
+</mapper>

+ 30 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/service/SupplierProblemService.java

@@ -0,0 +1,30 @@
+package com.fjhx.supplier.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.base.BaseService;
+import com.fjhx.entity.supplier.SupplierProblem;
+import com.fjhx.params.supplier.SupplierProblemVo;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商面料问题反馈表 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+public interface SupplierProblemService extends BaseService<SupplierProblem> {
+
+    Page<SupplierProblem> getPage(Map<String, String> condition);
+
+    void add(SupplierProblemVo supplierProblemVo);
+
+    void edit(SupplierProblemVo supplierProblemVo);
+
+    void delete(SupplierProblemVo supplierProblemVo);
+
+    SupplierProblem detail(String id);
+
+}

+ 86 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/service/SupplierService.java

@@ -0,0 +1,86 @@
+package com.fjhx.supplier.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.supplier.Supplier;
+import com.fjhx.params.supplier.SupplierVo;
+import com.fjhx.base.BaseService;
+
+import java.text.ParseException;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+public interface SupplierService extends BaseService<Supplier> {
+
+    /**
+     * 列表
+     *
+     * @param condition
+     * @return
+     */
+    List<Supplier> getList(Map<String, Object> condition);
+
+    /**
+     * 列表-总条数
+     *
+     * @param condition
+     * @return
+     */
+    Integer getListCount(Map<String, Object> condition);
+
+
+    /**
+     * 供应商采购列表
+     *
+     * @param condition
+     * @return
+     */
+    List<Supplier> getPurList(Map<String, Object> condition);
+
+    /**
+     * 供应商采购列表-总条数
+     *
+     * @param condition
+     * @return
+     */
+    Integer getPurListCount(Map<String, Object> condition);
+
+    /**
+     * 统计物料分类
+     * @return
+     */
+    List<Supplier> statisticsClassify();
+
+    /**
+     * 添加
+     * @param supplier
+     * @return
+     */
+    String add(Supplier supplier);
+
+    /**
+     * 修改
+     * @param supplier
+     * @return
+     */
+    Boolean edit(Supplier supplier);
+
+    /**
+     * 删除
+     * @param supplier
+     */
+    void delete(Supplier supplier);
+
+    /**
+     * 详情
+     * @param id
+     */
+    Supplier detail(String id);
+}

+ 125 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/service/impl/SupplierProblemServiceImpl.java

@@ -0,0 +1,125 @@
+package com.fjhx.supplier.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.attachment.service.StockAttachmentService;
+import com.fjhx.entity.attachment.StockAttachment;
+import com.fjhx.entity.attachment.enums.AttachmentTypeEnum;
+import com.fjhx.entity.supplier.SupplierProblem;
+import com.fjhx.params.supplier.SupplierProblemVo;
+import com.fjhx.supplier.mapper.SupplierProblemMapper;
+import com.fjhx.supplier.service.SupplierProblemService;
+import com.fjhx.utils.WrapperUtil;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商面料问题反馈表 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Service
+public class SupplierProblemServiceImpl extends ServiceImpl<SupplierProblemMapper, SupplierProblem> implements SupplierProblemService {
+
+    @Autowired
+    private StockAttachmentService stockAttachmentService;
+
+
+    @Override
+    public Page<SupplierProblem> getPage(Map<String, String> condition) {
+
+        QueryWrapper<SupplierProblem> wrapper = Wrappers.query();
+
+        WrapperUtil.init(condition, wrapper)
+                .eqTenantId()
+                .createTimeDesc();
+
+        Page<SupplierProblem> page = page(condition, wrapper);
+        return page;
+    }
+
+    /**
+     * 保存
+     * @param supplierProblemVo
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void add(SupplierProblemVo supplierProblemVo) {
+        //保存数据
+        supplierProblemVo.setCreatedTime(new Date());
+        save(supplierProblemVo);
+        List<StockAttachment> attr = supplierProblemVo.getAttr();
+        if(CollectionUtil.isNotEmpty(attr)){
+            for(StockAttachment s:attr){
+                s.setBusiId(supplierProblemVo.getId());
+                s.setBusiType(AttachmentTypeEnum.TYPE_ONE.getKey());
+                s.setCreatedTime(new Date());
+            }
+        }
+        stockAttachmentService.saveBatch(attr);
+    }
+
+    /**
+     * 修改
+     * @param supplierProblemVo
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void edit(SupplierProblemVo supplierProblemVo) {
+        if(StringUtil.isEmpty(supplierProblemVo.getId())){
+            throw new ServiceException("参数异常");
+        }
+        supplierProblemVo.setUpdatedTime(new Date());
+        updateById(supplierProblemVo);
+        List<StockAttachment> attr = supplierProblemVo.getAttr();
+        if(CollectionUtil.isNotEmpty(attr)){
+            //清空文件重新添加
+            stockAttachmentService.remove(Wrappers.<StockAttachment>query().lambda().eq(StockAttachment::getBusiId,supplierProblemVo.getId()));
+            for(StockAttachment s:attr){
+                s.setBusiId(supplierProblemVo.getId());
+                s.setBusiType(AttachmentTypeEnum.TYPE_ONE.getKey());
+            }
+        }
+        stockAttachmentService.saveBatch(attr);
+    }
+
+    /**
+     * 删除
+     * @param supplierProblemVo
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public void delete(SupplierProblemVo supplierProblemVo) {
+        removeById(supplierProblemVo.getId());
+        stockAttachmentService.remove(Wrappers.<StockAttachment>query().lambda().eq(StockAttachment::getBusiId,supplierProblemVo.getId()));
+    }
+
+    /**
+     * 详情
+     * @param id
+     * @return
+     */
+    @Override
+    public SupplierProblem detail(String id) {
+        SupplierProblem vo = getById(id);
+        if(ObjectUtil.isNotEmpty(vo)){
+            vo.setAttr(stockAttachmentService.getListByBusi(id));
+        }
+        return vo;
+    }
+
+}

+ 174 - 0
hx-service/storage/src/main/java/com/fjhx/supplier/service/impl/SupplierServiceImpl.java

@@ -0,0 +1,174 @@
+package com.fjhx.supplier.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.attachment.service.StockAttachmentService;
+import com.fjhx.entity.attachment.StockAttachment;
+import com.fjhx.entity.attachment.enums.AttachmentTypeEnum;
+import com.fjhx.entity.supplier.SupplierProblem;
+import com.fjhx.utils.CodeUtil;
+import com.fjhx.utils.WrapperUtil;
+import com.fjhx.entity.supplier.Supplier;
+import com.fjhx.params.supplier.SupplierVo;
+import com.fjhx.supplier.mapper.SupplierMapper;
+import com.fjhx.supplier.service.SupplierService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-07-12
+ */
+@Service
+public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> implements SupplierService {
+
+
+    @Autowired
+    private StockAttachmentService stockAttachmentService;
+    /**
+     * 列表
+     * @param condition
+     * @return
+     * @throws ParseException
+     */
+    @Override
+    public List<Supplier> getList(Map<String, Object> condition){
+        return baseMapper.getList(condition);
+    }
+
+    /**
+     * 列表条数
+     * @param condition
+     * @return
+     */
+    @Override
+    public Integer getListCount(Map<String, Object> condition) {
+        return baseMapper.getListCount(condition);
+    }
+
+    /**
+     * 供应商采购列表
+     * @param condition
+     * @return
+     */
+    @Override
+    public List<Supplier> getPurList(Map<String, Object> condition) {
+        return baseMapper.getPurList(condition);
+    }
+
+    /**
+     * 供应商采购列表条数
+     * @param condition
+     * @return
+     */
+    @Override
+    public Integer getPurListCount(Map<String, Object> condition) {
+        return baseMapper.getPurListCount(condition);
+    }
+
+    /**
+     * 统计物料分类
+     * @return
+     */
+    @Override
+    public List<Supplier> statisticsClassify() {
+        return baseMapper.getGroupByCategory();
+    }
+
+    /**
+     * 添加
+     * @param supplier
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public String add(Supplier supplier) {
+        supplier.setCreatedTime(new Date());
+        //生成code
+        if(StringUtil.isEmpty(supplier.getCode())){
+           Supplier sCode = getOne(Wrappers.<Supplier>query().lambda().orderByDesc(Supplier::getCode).last("limit 1"));
+           if(ObjectUtil.isEmpty(sCode)){
+               supplier.setCode("C001");
+           }else{
+               supplier.setCode(sCode.getCode()==null?"c001": CodeUtil.generateWmsCode(sCode.getCode()));
+           }
+        }
+        save(supplier);
+        List<StockAttachment> attr = supplier.getAttr();
+        if(CollectionUtil.isNotEmpty(attr)){
+            for(StockAttachment s:attr){
+                s.setBusiId(supplier.getId());
+                s.setBusiType(AttachmentTypeEnum.TYPE_TWO.getKey());
+                s.setCreatedTime(new Date());
+            }
+        }
+        stockAttachmentService.saveBatch(attr);
+        return supplier.getId();
+    }
+
+    /**
+     * 修改
+     * @param supplier
+     * @return
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public Boolean edit(Supplier supplier) {
+        if(StringUtil.isEmpty(supplier.getId())){
+            throw new ServiceException("参数异常");
+        }
+        supplier.setUpdatedTime(new Date());
+        updateById(supplier);
+        List<StockAttachment> attr = supplier.getAttr();
+        if(CollectionUtil.isNotEmpty(attr)){
+            //清空文件重新添加
+            stockAttachmentService.remove(Wrappers.<StockAttachment>query().lambda().eq(StockAttachment::getBusiId,supplier.getId()));
+            for(StockAttachment s:attr){
+                s.setBusiId(supplier.getId());
+                s.setBusiType(AttachmentTypeEnum.TYPE_TWO.getKey());
+                s.setCreatedTime(new Date());
+            }
+        }
+        stockAttachmentService.saveBatch(attr);
+        return true;
+    }
+
+    /**
+     * 删除
+     * @param supplier
+     */
+    @Override
+    public void delete(Supplier supplier) {
+        removeById(supplier.getId());
+        stockAttachmentService.remove(Wrappers.<StockAttachment>query().lambda().eq(StockAttachment::getBusiId,supplier.getId()));
+    }
+
+    /**
+     * 详情
+     * @param id
+     */
+    @Override
+    public Supplier detail(String id) {
+        Supplier supplier = getById(id);
+        if(ObjectUtil.isNotEmpty(supplier)){
+            supplier.setAttr(stockAttachmentService.getListByBusi(id));
+        }
+        return supplier;
+    }
+
+}