caozj 2 жил өмнө
parent
commit
d1ecfef2fc
45 өөрчлөгдсөн 1915 нэмэгдсэн , 397 устгасан
  1. 14 0
      bladex/blade-common/src/main/java/org/springblade/common/utils/CodeUtil.java
  2. 16 0
      bladex/blade-common/src/main/java/org/springblade/common/utils/DateUtil.java
  3. 69 0
      bladex/blade-common/src/main/java/org/springblade/common/utils/HmacUtil.java
  4. 70 0
      hx-common/hx-tool/src/main/java/com/fjhx/utils/HmacUtil.java
  5. 207 0
      hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/entity/PurchaseContract.java
  6. 73 0
      hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/entity/PurchaseContractMaterial.java
  7. 69 0
      hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/enums/ApproveStateEnum.java
  8. 67 0
      hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/enums/PurchaseContractStatusEnum.java
  9. 11 0
      hx-saas-project/saas-entity/src/main/java/com/fjhx/flow/entity/FlowParam.java
  10. 68 0
      hx-saas-project/saas-entity/src/main/java/com/fjhx/flow/enums/FlowTypeEnum.java
  11. 7 0
      hx-saas-project/saas-entity/src/main/java/com/fjhx/material/entity/Material.java
  12. 3 0
      hx-saas-project/saas-flow/src/main/java/com/fjhx/flow/service/impl/FlowEngineServiceImpl.java
  13. 87 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/controller/PurchaseContractController.java
  14. 81 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/controller/PurchaseContractFlowController.java
  15. 81 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/controller/PurchaseContractMaterialController.java
  16. 59 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMapper.java
  17. 101 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMapper.xml
  18. 30 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMaterialMapper.java
  19. 21 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMaterialMapper.xml
  20. 52 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/IPurchaseContractFlowService.java
  21. 30 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/IPurchaseContractMaterialService.java
  22. 62 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/IPurchaseContractService.java
  23. 144 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/impl/PurchaseContractFlowServiceImpl.java
  24. 36 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/impl/PurchaseContractMaterialServiceImpl.java
  25. 114 0
      hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/impl/PurchaseContractServiceImpl.java
  26. 22 1
      hx-saas-project/saas-storage/src/main/java/com/fjhx/subscribe/service/impl/ApplyPurchaseFlowServiceImpl.java
  27. 0 183
      hx-service-api/a-api/src/main/java/com/fjhx/entity/material/Material.java
  28. 0 17
      hx-service-api/a-api/src/main/java/com/fjhx/params/material/MaterialEx.java
  29. 0 17
      hx-service-api/a-api/src/main/java/com/fjhx/params/material/MaterialVo.java
  30. 111 0
      hx-service-api/storage-api/src/main/java/com/fjhx/entity/scheduling/entity/Scheduling.java
  31. 0 56
      hx-service/a/src/main/java/com/fjhx/material/controller/MaterialController.java
  32. 0 16
      hx-service/a/src/main/java/com/fjhx/material/mapper/MaterialMapper.java
  33. 0 5
      hx-service/a/src/main/java/com/fjhx/material/mapper/MaterialMapper.xml
  34. 0 28
      hx-service/a/src/main/java/com/fjhx/material/service/MaterialService.java
  35. 0 55
      hx-service/a/src/main/java/com/fjhx/material/service/impl/MaterialServiceImpl.java
  36. 57 0
      hx-service/storage/src/main/java/com/fjhx/scheduling/controller/SchedulingController.java
  37. 32 0
      hx-service/storage/src/main/java/com/fjhx/scheduling/mapper/SchedulingMapper.java
  38. 22 0
      hx-service/storage/src/main/java/com/fjhx/scheduling/mapper/SchedulingMapper.xml
  39. 29 0
      hx-service/storage/src/main/java/com/fjhx/scheduling/service/ISchedulingService.java
  40. 35 0
      hx-service/storage/src/main/java/com/fjhx/scheduling/service/impl/SchedulingServiceImpl.java
  41. 3 2
      hx-service/storage/src/main/java/com/fjhx/supplier/controller/SupplierController.java
  42. 1 1
      hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.java
  43. 22 9
      hx-service/storage/src/main/java/com/fjhx/supplier/mapper/SupplierMapper.xml
  44. 1 1
      hx-service/storage/src/main/java/com/fjhx/supplier/service/SupplierService.java
  45. 8 6
      hx-service/storage/src/main/java/com/fjhx/supplier/service/impl/SupplierServiceImpl.java

+ 14 - 0
bladex/blade-common/src/main/java/org/springblade/common/utils/CodeUtil.java

@@ -39,4 +39,18 @@ public class CodeUtil {
         String k=decimalFormat.format(i);
         return "PR-"+date+"-"+k;
     }
+
+    /**
+     * 生成合同编码
+     * @param code
+     * @return
+     */
+    public static String generateContractCode(String code){
+        String date = new SimpleDateFormat("yyyyMMdd").format(new Date());
+        DecimalFormat decimalFormat=new DecimalFormat("0000");
+        String codenew=code.substring(1);
+        int i=Integer.parseInt(codenew)+1;
+        String k=decimalFormat.format(i);
+        return "PO-"+date+"-"+k;
+    }
 }

+ 16 - 0
bladex/blade-common/src/main/java/org/springblade/common/utils/DateUtil.java

@@ -49,6 +49,22 @@ public class DateUtil {
         return String.valueOf(Difference/1000/60/60/24);
     }
 
+    /**
+     * 日期加减运算
+     *
+     * @param date
+     * @param day
+     * @return
+     */
+    public static Date dateAddASub(Date date, int day) {
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.DATE, day);
+        Date targetDate = calendar.getTime();
+        return targetDate;
+    }
+
     public static void main(String[] args) throws ParseException {
 
     }

+ 69 - 0
bladex/blade-common/src/main/java/org/springblade/common/utils/HmacUtil.java

@@ -0,0 +1,69 @@
+package org.springblade.common.utils;
+
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * hmac签名
+ * @Author:caozj
+ * @DATE:2022/7/27 19:51
+ */
+public class HmacUtil {
+    //加密算法
+    public static final String HMAC_SHA256 = "HmacSHA256";
+
+
+    /**
+     * HmacSHA256加密
+     *
+     * @param input 需要加密得参数
+     * @param key 密钥
+     * @param algorithm HmacSHA256
+     * @return 加密后的值
+     **/
+    public static String encrypt(String input, String key) {
+        String cipher = "";
+        try {
+            byte[] data = key.getBytes(StandardCharsets.UTF_8);
+            //根据给定的字节数组构造一个密钥,第二个参数指定一个密钥的算法名称,生成HmacSHA1专属密钥
+            SecretKey secretKey = new SecretKeySpec(data, HMAC_SHA256);
+            //生成一个指定Mac算法的Mac对象
+            Mac mac = Mac.getInstance(HMAC_SHA256);
+            //用给定密钥初始化Mac对象
+            mac.init(secretKey);
+            byte[] text = input.getBytes(StandardCharsets.UTF_8);
+            byte[] encryptByte = mac.doFinal(text);
+            cipher = bytesToHexStr(encryptByte);
+        } catch (NoSuchAlgorithmException | InvalidKeyException e) {
+            e.printStackTrace();
+        }
+        return cipher;
+    }
+
+
+    /**
+     * byte数组转16进制字符串
+     *
+     * @param  bytes byte数组
+     * @return hex字符串
+     */
+    public static String bytesToHexStr(byte[] bytes) {
+        StringBuilder hexStr = new StringBuilder();
+        for (byte b : bytes) {
+            String hex = Integer.toHexString(b & 0xFF);
+            if (hex.length() == 1) {
+                hex = '0' + hex;
+            }
+            hexStr.append(hex);
+        }
+        return hexStr.toString();
+    }
+    public static void main(String[] args) {
+        String valSha256 = HmacUtil.encrypt("fjhx", "fjhx@2012");
+        System.out.println(valSha256);
+    }
+}

+ 70 - 0
hx-common/hx-tool/src/main/java/com/fjhx/utils/HmacUtil.java

@@ -0,0 +1,70 @@
+package com.fjhx.utils;
+
+
+import javax.crypto.Mac;
+import javax.crypto.SecretKey;
+import javax.crypto.spec.SecretKeySpec;
+import java.nio.charset.StandardCharsets;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * hmac签名
+ * @Author:caozj
+ * @DATE:2022/7/27 19:51
+ */
+public class HmacUtil {
+    //加密算法
+    public static final String HMAC_SHA256 = "HmacSHA256";
+
+
+    /**
+     * HmacSHA256加密
+     *
+     * @param input 需要加密得参数
+     * @param key 密钥
+     * @return 加密后的值
+     **/
+    public static String encrypt(String input, String key) {
+        String cipher = "";
+        try {
+            byte[] data = key.getBytes(StandardCharsets.UTF_8);
+            //根据给定的字节数组构造一个密钥,第二个参数指定一个密钥的算法名称,生成HmacSHA1专属密钥
+            SecretKey secretKey = new SecretKeySpec(data, HMAC_SHA256);
+            //生成一个指定Mac算法的Mac对象
+            Mac mac = Mac.getInstance(HMAC_SHA256);
+            //用给定密钥初始化Mac对象
+            mac.init(secretKey);
+            byte[] text = input.getBytes(StandardCharsets.UTF_8);
+            byte[] encryptByte = mac.doFinal(text);
+            cipher = bytesToHexStr(encryptByte);
+        } catch (NoSuchAlgorithmException | InvalidKeyException e) {
+            e.printStackTrace();
+        }
+        return cipher;
+    }
+
+
+    /**
+     * byte数组转16进制字符串
+     *
+     * @param  bytes byte数组
+     * @return hex字符串
+     */
+    public static String bytesToHexStr(byte[] bytes) {
+        StringBuilder hexStr = new StringBuilder();
+        for (byte b : bytes) {
+            String hex = Integer.toHexString(b & 0xFF);
+            if (hex.length() == 1) {
+                hex = '0' + hex;
+            }
+            hexStr.append(hex);
+        }
+        return hexStr.toString();
+    }
+    public static void main(String[] args) {
+        System.out.println(System.currentTimeMillis());
+        String valSha256 = HmacUtil.encrypt("fjhx"+ System.currentTimeMillis(), "fjhx@2012");
+        System.out.println(valSha256);
+    }
+}

+ 207 - 0
hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/entity/PurchaseContract.java

@@ -0,0 +1,207 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.entity;
+
+import java.math.BigDecimal;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.fjhx.base.BaseStockEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 采购合同实体类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@Data
+@TableName("stock_purchase_contract")
+@ApiModel(value = "PurchaseContract对象", description = "采购合同")
+public class PurchaseContract extends BaseStockEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 申购单ID
+	*/
+	@ApiModelProperty(value = "申购单ID")
+	private String applyPurchaseId;
+	/**
+	* 采购合同单号
+	*/
+	@ApiModelProperty(value = "采购合同单号")
+	private String purchaseBillNo;
+	/**
+	* 供应商ID(对应表ord_factory的ID)
+	*/
+	@ApiModelProperty(value = "供应商ID(对应表ord_factory的ID)")
+	private String supplierId;
+	/**
+	* 交付日期
+	*/
+	@ApiModelProperty(value = "交付日期")
+	private Date deliverTime;
+	/**
+	* 账期
+	*/
+	@ApiModelProperty(value = "账期")
+	private Integer accountPeriod;
+	/**
+	* 增值税
+	*/
+	@ApiModelProperty(value = "增值税")
+	private BigDecimal taxValue;
+	/**
+	* 发票类型 (枚举定义:0=专用,1=普通)
+	*/
+	@ApiModelProperty(value = "发票类型 (枚举定义:0=专用,1=普通)")
+	private Integer invoiceType;
+	/**
+	* 签约时间
+	*/
+	@ApiModelProperty(value = "签约时间")
+	private LocalDateTime signTime;
+	/**
+	* 采购合同状态 (枚举定义:0=待确认,1=审批中,2=进行中,3=已完成)
+	*/
+	@ApiModelProperty(value = "采购合同状态 (枚举定义:0=待确认,1=审批中,2=进行中,3=已完成)")
+	private Integer purContractState;
+	/**
+	* 合同付款状态 (枚举定义:0=审批中,1=进行中,2=已完成)
+	*/
+	@ApiModelProperty(value = "合同付款状态 (枚举定义:0=审批中,1=进行中,2=已完成)")
+	private Integer contractPayState;
+	/**
+	* 供应商出货状态 (枚举定义:0=进行中,1=已完成)
+	*/
+	@ApiModelProperty(value = "供应商出货状态 (枚举定义:0=进行中,1=已完成)")
+	private Integer supplierShipState;
+	/**
+	* 审批状态 (枚举定义:0=待审批,1=审批中,2=已审批,3=已驳回,4=已撤回)
+	*/
+	@ApiModelProperty(value = "审批状态 (枚举定义:0=待审批,1=审批中,2=已审批,3=已驳回,4=已撤回)")
+	private Integer approveBillState;
+	/**
+	* 审核时间
+	*/
+	@ApiModelProperty(value = "审核时间")
+	private Date approvalTime;
+	/**
+	* 备注
+	*/
+	@ApiModelProperty(value = "备注")
+	private String remark;
+	/**
+	* 质检修正金额
+	*/
+	@ApiModelProperty(value = "质检修正金额")
+	private BigDecimal adjustAmount;
+	/**
+	* 质检修正数量
+	*/
+	@ApiModelProperty(value = "质检修正数量")
+	private BigDecimal adjustQty;
+	/**
+	* 已付金额
+	*/
+	@ApiModelProperty(value = "已付金额")
+	private BigDecimal hadPayAmount;
+	/**
+	* 申请付款金额
+	*/
+	@ApiModelProperty(value = "申请付款金额")
+	private BigDecimal applyPayAmount;
+	/**
+	* 退货数量
+	*/
+	@ApiModelProperty(value = "退货数量")
+	private BigDecimal retBackQty;
+
+	/**
+	 * 合同物料列表
+	 */
+	@TableField(exist = false)
+	private List<PurchaseContractMaterial> materialList;
+
+
+	/**
+	 * 采购数量
+	 */
+	@TableField(exist = false)
+	private Integer purchaseQty;
+
+	/**
+	 * 采购价格
+	 */
+	@TableField(exist = false)
+	private BigDecimal purchasePrice;
+
+	/**
+	 * 采购小计
+	 */
+	@TableField(exist = false)
+	private BigDecimal purchaseTotalAmount;
+	/**
+	 * 物料名称
+	 */
+	@TableField(exist = false)
+	private String materialName;
+
+	/**
+	 * 物料单位
+	 */
+	@TableField(exist = false)
+	private String materialUnit;
+
+	/**
+	 * 物料备注
+	 */
+	@TableField(exist = false)
+	private String materialRemark;
+	/**
+	 * 物料规格
+	 */
+	@TableField(exist = false)
+	private String materialSpec;
+
+	/**
+	 * 物料编码
+	 */
+	@TableField(exist = false)
+	private String materialCode;
+
+	/**
+	 * 申购单号
+	 */
+	@TableField(exist = false)
+	private String applyBillNo;
+
+	/**
+	 * 供应商名称
+	 */
+	@TableField(exist = false)
+	private String supplierName;
+}

+ 73 - 0
hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/entity/PurchaseContractMaterial.java

@@ -0,0 +1,73 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+
+import com.fjhx.base.BaseStockEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 供应商收款账户实体类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@Data
+@TableName("stock_purchase_contract_material")
+@ApiModel(value = "PurchaseContractMaterial对象", description = "供应商收款账户")
+public class PurchaseContractMaterial extends BaseStockEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 采购合同ID
+	*/
+	@ApiModelProperty(value = "采购合同ID")
+	private String purchaseContractId;
+	/**
+	* 物料ID
+	*/
+	@ApiModelProperty(value = "物料ID")
+	private String materialId;
+	/**
+	* 采购数量
+	*/
+	@ApiModelProperty(value = "采购数量")
+	private BigDecimal purchaseQty;
+	/**
+	* 单价
+	*/
+	@ApiModelProperty(value = "单价")
+	private BigDecimal price;
+	/**
+	* 账号
+	*/
+	@ApiModelProperty(value = "账号")
+	private String bankAccout;
+	/**
+	* 金额
+	*/
+	@ApiModelProperty(value = "金额")
+	private BigDecimal totalAmount;
+}

+ 69 - 0
hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/enums/ApproveStateEnum.java

@@ -0,0 +1,69 @@
+package com.fjhx.contract.enums;
+
+import org.apache.commons.collections4.MapUtils;
+import org.springblade.core.tool.utils.StringPool;
+
+import java.util.LinkedHashMap;
+
+/**
+ * 合同审批状态
+ * 枚举定义:0=待审批,1=审批中,2=已审批,3=已驳回,4=已撤回)
+ */
+public enum ApproveStateEnum {
+
+    APPLY_PURCHASE_STATUS_0(0, "待审批"),
+    APPLY_PURCHASE_STATUS_1(1, "审批中"),
+    APPLY_PURCHASE_STATUS_2(2, "已审批"),
+    APPLY_PURCHASE_STATUS_3(3, "已驳回"),
+    APPLY_PURCHASE_STATUS_4(4, "已撤回"),
+    ;
+
+    private int key;
+
+    private String value;
+
+    private static LinkedHashMap<Integer, String> map = new LinkedHashMap<>();
+
+    ApproveStateEnum(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 (ApproveStateEnum 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 "";
+        }
+        LinkedHashMap<Integer, String> map = getMap();
+        return map.getOrDefault(key, StringPool.EMPTY);
+    }
+
+    public int getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+}

+ 67 - 0
hx-saas-project/saas-entity/src/main/java/com/fjhx/contract/enums/PurchaseContractStatusEnum.java

@@ -0,0 +1,67 @@
+package com.fjhx.contract.enums;
+
+import org.apache.commons.collections4.MapUtils;
+import org.springblade.core.tool.utils.StringPool;
+
+import java.util.LinkedHashMap;
+
+/**
+ * 合同状态
+ */
+public enum PurchaseContractStatusEnum {
+
+    APPLY_PURCHASE_STATUS_0(0, "待确认"),
+    APPLY_PURCHASE_STATUS_1(1, "审批中"),
+    APPLY_PURCHASE_STATUS_2(2, "进行中"),
+    APPLY_PURCHASE_STATUS_3(3, "已完成"),
+    ;
+
+    private int key;
+
+    private String value;
+
+    private static LinkedHashMap<Integer, String> map = new LinkedHashMap<>();
+
+    PurchaseContractStatusEnum(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 (PurchaseContractStatusEnum 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 "";
+        }
+        LinkedHashMap<Integer, String> map = getMap();
+        return map.getOrDefault(key, StringPool.EMPTY);
+    }
+
+    public int getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+}

+ 11 - 0
hx-saas-project/saas-entity/src/main/java/com/fjhx/flow/entity/FlowParam.java

@@ -33,4 +33,15 @@ public class FlowParam {
      * 流程ID
      */
     private String proInstantsId;
+
+    public FlowParam(){
+
+    }
+    public FlowParam(String title,String common,String proInstantsId,String flowIdentifying,String businessId){
+        this.title = title;
+        this.common = common;
+        this.proInstantsId = proInstantsId;
+        this.flowIdentifying = flowIdentifying;
+        this.businessId = businessId;
+    }
 }

+ 68 - 0
hx-saas-project/saas-entity/src/main/java/com/fjhx/flow/enums/FlowTypeEnum.java

@@ -0,0 +1,68 @@
+package com.fjhx.flow.enums;
+
+import org.apache.commons.collections4.MapUtils;
+import org.springblade.core.tool.utils.StringPool;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 流程标识
+ * 待办类型 (枚举定义:
+ * 0=物料申购,1=合同管理,2=付款管理,3=出库管理,4=其他出库(退货、报损),5=质检数量修正申请,6=物料修改申请,7=物料价格调整,8=库存盘点,9=归还入库,10=合同删除,11=免检申请,12=供应商出货申请)
+ */
+public enum FlowTypeEnum {
+
+    type_1(0, "subscribe"),
+    type_2(1, "contract")
+    ;
+
+    private int key;
+
+    private String value;
+
+    private static Map<Integer, String> map = new HashMap<>();
+
+    FlowTypeEnum(int key, String value) {
+        this.key = key;
+        this.value = value;
+    }
+
+    /**
+     * 获取枚举map
+     *
+     * @return
+     */
+    public static Map<Integer, String> getMap() {
+        if (MapUtils.isNotEmpty(map)) {
+            return map;
+        }
+        for (FlowTypeEnum 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;
+        }
+        Map<Integer, String> map = getMap();
+        return map.getOrDefault(key, StringPool.EMPTY);
+    }
+
+    public int getKey() {
+        return key;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+}

+ 7 - 0
hx-saas-project/saas-entity/src/main/java/com/fjhx/material/entity/Material.java

@@ -73,6 +73,13 @@ public class Material extends BaseStockEntity {
 	*/
 	@ApiModelProperty(value = "安全预警天数/采购周期")
 	private Integer safetyWarnDay;
+
+	/**
+	 * 单位
+	 */
+	@ApiModelProperty(value = "单位")
+	private Integer unit;
+
 	/**
 	* 规格
 	*/

+ 3 - 0
hx-saas-project/saas-flow/src/main/java/com/fjhx/flow/service/impl/FlowEngineServiceImpl.java

@@ -103,6 +103,9 @@ public class FlowEngineServiceImpl extends ServiceImpl<FlowMapper, Flow> impleme
         }
         //通过流程ID查询出走向数据
         FlowApplycheck flowApplycheck = iFlowApplycheckService.getById(param.getProInstantsId());
+        if(flowApplycheck.getCheckState()!=1){
+            throw new ServiceException("该流程已处理完毕");
+        }
         updateApplyCheck(param,2);
         //如果下一个节点是空的,流程已结束
         if(StringUtil.isEmpty(flowApplycheck.getNextNodeId())){

+ 87 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/controller/PurchaseContractController.java

@@ -0,0 +1,87 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.controller;
+
+import com.fjhx.contract.entity.PurchaseContract;
+import com.fjhx.contract.service.IPurchaseContractService;
+import com.fjhx.supplier.entity.Supplier;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.common.constant.ApiConstant;
+import org.springblade.common.utils.ListPageMap;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 采购合同 控制器
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping(ApiConstant.Project.SAAS_STORAGE_REQUEST_PREFIX+"/purchasecontract")
+@Api(value = "采购合同", tags = "采购合同接口")
+public class PurchaseContractController extends BladeController {
+
+	private final IPurchaseContractService purchaseContractService;
+
+	/**
+	 * 列表
+	 * @param condition
+	 * @return
+	 */
+	@PostMapping("/list")
+	public R list(@RequestBody Map<String, Object> condition){
+		ListPageMap.getListPageMap(condition);
+		List<PurchaseContract> result = purchaseContractService.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 = purchaseContractService.getListCount(condition);
+		return R.success(count);
+	}
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	public R<PurchaseContract> detail(@RequestParam("id")String id) {
+		PurchaseContract detail = purchaseContractService.getDetail(id);
+		return R.data(detail);
+	}
+
+
+	
+}

+ 81 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/controller/PurchaseContractFlowController.java

@@ -0,0 +1,81 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.controller;
+
+import com.fjhx.flow.entity.FlowParam;
+import com.fjhx.subscribe.entity.ApplyPurchase;
+import com.fjhx.subscribe.service.IApplyPurchaseFlowService;
+import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import org.springblade.common.constant.ApiConstant;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.tool.api.R;
+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;
+
+/**
+ * 合同流程 控制器
+ *
+ * @author BladeX
+ * @since 2022-07-26
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping(ApiConstant.Project.SAAS_STORAGE_REQUEST_PREFIX+"/purchasecontract/flow")
+public class PurchaseContractFlowController extends BladeController {
+
+	private final IApplyPurchaseFlowService flowService;
+
+
+	/**
+	 * 开始流程
+	 *
+	 * @param applyPurchase
+	 * @return
+	 */
+	@PostMapping(value = "/start")
+	public R start(@RequestBody ApplyPurchase applyPurchase) {
+		flowService.start(applyPurchase);
+		return R.success();
+	}
+
+	/**
+	 * 审核
+	 *
+	 * @param condition
+	 * @return
+	 */
+	@PostMapping(value = "/examine")
+	public R examine(@RequestBody FlowParam condition) {
+		flowService.examine(condition);
+		return R.success();
+	}
+
+	/**
+	 * 回退
+	 *
+	 * @param condition
+	 * @return
+	 */
+	@PostMapping(value = "/reject")
+	public R reject(@RequestBody FlowParam condition) {
+		flowService.reject(condition);
+		return R.success();
+	}
+}

+ 81 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/controller/PurchaseContractMaterialController.java

@@ -0,0 +1,81 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.controller;
+
+import com.fjhx.contract.entity.PurchaseContractMaterial;
+import com.fjhx.contract.service.IPurchaseContractMaterialService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.common.constant.ApiConstant;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ * 供应商收款账户 控制器
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping(ApiConstant.Project.SAAS_STORAGE_REQUEST_PREFIX+"/purchasecontractmaterial")
+@Api(value = "供应商收款账户", tags = "供应商收款账户接口")
+public class PurchaseContractMaterialController extends BladeController {
+
+	private final IPurchaseContractMaterialService purchaseContractMaterialService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	public R<PurchaseContractMaterial> detail(PurchaseContractMaterial purchaseContractMaterial) {
+		PurchaseContractMaterial detail = purchaseContractMaterialService.getOne(Condition.getQueryWrapper(purchaseContractMaterial));
+		return R.data(detail);
+	}
+
+	/**
+	 * 新增 供应商收款账户
+	 */
+	@PostMapping("/save")
+	public R save(@Valid @RequestBody PurchaseContractMaterial purchaseContractMaterial) {
+		return R.status(purchaseContractMaterialService.save(purchaseContractMaterial));
+	}
+
+	/**
+	 * 修改 供应商收款账户
+	 */
+	@PostMapping("/update")
+	public R update(@Valid @RequestBody PurchaseContractMaterial purchaseContractMaterial) {
+		return R.status(purchaseContractMaterialService.updateById(purchaseContractMaterial));
+	}
+
+	/**
+	 * 删除 供应商收款账户
+	 */
+	@PostMapping("/remove")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(purchaseContractMaterialService.removeByIds(Func.toLongList(ids)));
+	}
+
+	
+}

+ 59 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMapper.java

@@ -0,0 +1,59 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.mapper;
+
+import com.fjhx.contract.entity.PurchaseContract;
+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;
+
+/**
+ * 采购合同 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+public interface PurchaseContractMapper extends BaseMapper<PurchaseContract> {
+    /**
+     * 列表
+     *
+     * @param condition
+     * @return
+     */
+    @TenantIgnore
+    List<PurchaseContract> getList(Map<String, Object> condition);
+
+    /**
+     * 列表-总条数
+     *
+     * @param condition
+     * @return
+     */
+    @TenantIgnore
+    Integer getListCount(Map<String, Object> condition);
+
+    /**
+     * 获取详情
+     * @param id
+     * @return
+     */
+    @TenantIgnore
+    PurchaseContract getDetailById(@Param("id") String id);
+}

+ 101 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMapper.xml

@@ -0,0 +1,101 @@
+<?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.contract.mapper.PurchaseContractMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="purchaseContractResultMap" type="com.fjhx.contract.entity.PurchaseContract">
+        <id column="id" property="id"/>
+        <result column="is_delete" property="isDelete"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="create_user" property="createUser"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="apply_purchase_id" property="applyPurchaseId"/>
+        <result column="purchase_bill_no" property="purchaseBillNo"/>
+        <result column="supplier_id" property="supplierId"/>
+        <result column="deliver_time" property="deliverTime"/>
+        <result column="account_period" property="accountPeriod"/>
+        <result column="tax_value" property="taxValue"/>
+        <result column="invoice_type" property="invoiceType"/>
+        <result column="sign_time" property="signTime"/>
+        <result column="pur_contract_state" property="purContractState"/>
+        <result column="contract_pay_state" property="contractPayState"/>
+        <result column="supplier_ship_state" property="supplierShipState"/>
+        <result column="approve_bill_state" property="approveBillState"/>
+        <result column="approval_time" property="approvalTime"/>
+        <result column="remark" property="remark"/>
+        <result column="adjust_amount" property="adjustAmount"/>
+        <result column="adjust_qty" property="adjustQty"/>
+        <result column="had_pay_amount" property="hadPayAmount"/>
+        <result column="apply_pay_amount" property="applyPayAmount"/>
+        <result column="ret_back_qty" property="retBackQty"/>
+    </resultMap>
+
+    <select id="getList" resultType="com.fjhx.contract.entity.PurchaseContract">
+        SELECT
+            t1.*,
+            t2.purchase_qty AS purchaseQty,
+            t2.price AS purchasePrice,
+            t3.`name` AS materialName,
+            t3.spec AS materialSpec,
+            t3.`code` AS materialCode,
+            t3.technology_type AS technologyType,
+            t4.apply_bill_no AS applyBillNo,
+            t5.`name` AS supplierName
+        FROM
+            stock_purchase_contract t1
+        LEFT JOIN stock_purchase_contract_material t2 ON t1.id = t2.purchase_contract_id
+        LEFT JOIN stock_material t3 ON t2.material_id = t3.id
+        LEFT JOIN stock_apply_purchase t4 ON t1.apply_purchase_id = t4.id
+        LEFT JOIN stock_supplier t5 ON t1.supplier_id = t5.id
+        <include refid="list_condition"/>
+        ORDER BY t1.create_time DESC
+        <include refid="com.fjhx.house.mapper.HouseMapper.sql_limit"/>
+    </select>
+    <select id="getListCount" resultType="java.lang.Integer">
+        SELECT
+            count(1)
+        FROM
+            stock_purchase_contract t1
+        LEFT JOIN stock_purchase_contract_material t2 ON t1.id = t2.purchase_contract_id
+        LEFT JOIN stock_material t3 ON t2.material_id = t3.id
+        LEFT JOIN stock_apply_purchase t4 ON t1.apply_purchase_id = t4.id
+        LEFT JOIN stock_supplier t5 ON t1.supplier_id = t5.id
+        <include refid="list_condition"/>
+        ORDER BY t1.create_time DESC
+        <include refid="com.fjhx.house.mapper.HouseMapper.sql_limit"/>
+    </select>
+    <select id="getDetailById" resultType="com.fjhx.contract.entity.PurchaseContract">
+        SELECT
+            t1.*,
+            t2.purchase_qty AS purchaseQty,
+            t2.price AS purchasePrice,
+            t2.total_amount AS purchaseTotalAmount,
+            t3.unit AS materialUnit,
+            t3.`name` AS materialName,
+            t3.spec AS materialSpec,
+            t3.`code` AS materialCode,
+            t3.remark AS materialRemark,
+            t4.`name` AS supplierName
+        FROM
+            stock_purchase_contract t1
+        LEFT JOIN stock_purchase_contract_material t2 ON t1.id = t2.purchase_contract_id
+        LEFT JOIN stock_material t3 ON t2.material_id = t3.id
+        LEFT JOIN stock_supplier t4 ON t1.supplier_id = t4.id
+        WHERE
+        t1.id = #{id}
+        AND t1.is_delete = 0
+    </select>
+    <sql id="list_condition">
+        t1.is_delete = 0
+        <if test="search neq null and search neq '' ">
+            AND ((INSTR(t1.purchase_bill_no, #{search}) > 0) OR (INSTR(t3.`name`, #{search}) > 0) )
+        </if>
+        <if test="purContractState neq null and purContractState neq '' ">
+            AND t1.pur_contract_state = #{purContractState}
+        </if>
+        <if test="technologyType neq null and technologyType neq ''">
+            AND t3.technology_type = #{technologyType}
+        </if>
+    </sql>
+</mapper>

+ 30 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMaterialMapper.java

@@ -0,0 +1,30 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.mapper;
+
+import com.fjhx.contract.entity.PurchaseContractMaterial;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 供应商收款账户 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+public interface PurchaseContractMaterialMapper extends BaseMapper<PurchaseContractMaterial> {
+}

+ 21 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/mapper/PurchaseContractMaterialMapper.xml

@@ -0,0 +1,21 @@
+<?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.contract.mapper.PurchaseContractMaterialMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="purchaseContractMaterialResultMap" type="com.fjhx.contract.entity.PurchaseContractMaterial">
+        <id column="id" property="id"/>
+        <result column="purchase_contract_id" property="purchaseContractId"/>
+        <result column="material_id" property="materialId"/>
+        <result column="purchase_qty" property="purchaseQty"/>
+        <result column="price" property="price"/>
+        <result column="bank_accout" property="bankAccout"/>
+        <result column="total_amount" property="totalAmount"/>
+        <result column="is_delete" property="isDelete"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="create_user" property="createUser"/>
+        <result column="update_user" property="updateUser"/>
+    </resultMap>
+
+</mapper>

+ 52 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/IPurchaseContractFlowService.java

@@ -0,0 +1,52 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fjhx.contract.entity.PurchaseContract;
+import com.fjhx.flow.entity.FlowParam;
+import com.fjhx.subscribe.entity.ApplyPurchase;
+
+/**
+ * 合同流程 服务类
+ *
+ * @author BladeX
+ * @since 2022-07-26
+ */
+public interface IPurchaseContractFlowService extends IService<PurchaseContract> {
+
+    /**
+     * 开始流程
+     *
+     * @param purchaseContract
+     */
+    void start(PurchaseContract purchaseContract);
+
+    /**
+     * 审核
+     *
+     * @param condition
+     */
+    void examine(FlowParam condition);
+
+    /**
+     * 驳回
+     *
+     * @param condition
+     */
+    void reject(FlowParam condition);
+}

+ 30 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/IPurchaseContractMaterialService.java

@@ -0,0 +1,30 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.service;
+
+import com.fjhx.contract.entity.PurchaseContractMaterial;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 供应商收款账户 服务类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+public interface IPurchaseContractMaterialService extends IService<PurchaseContractMaterial> {
+
+}

+ 62 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/IPurchaseContractService.java

@@ -0,0 +1,62 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.service;
+
+import com.fjhx.contract.entity.PurchaseContract;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.fjhx.supplier.entity.Supplier;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 采购合同 服务类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+public interface IPurchaseContractService extends IService<PurchaseContract> {
+
+    /**
+     * 添加合同
+     * @param purchaseContract
+     * @return
+     */
+    Boolean savePurchaseContract(PurchaseContract purchaseContract);
+
+    /**
+     * 列表
+     *
+     * @param condition
+     * @return
+     */
+    List<PurchaseContract> getList(Map<String, Object> condition);
+
+    /**
+     * 列表-总条数
+     *
+     * @param condition
+     * @return
+     */
+    Integer getListCount(Map<String, Object> condition);
+
+    /**
+     * 详情
+     * @return
+     */
+    PurchaseContract getDetail(String id);
+}

+ 144 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/impl/PurchaseContractFlowServiceImpl.java

@@ -0,0 +1,144 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.contract.entity.PurchaseContract;
+import com.fjhx.contract.enums.PurchaseContractStatusEnum;
+import com.fjhx.contract.mapper.PurchaseContractMapper;
+import com.fjhx.contract.service.IPurchaseContractFlowService;
+import com.fjhx.contract.service.IPurchaseContractMaterialService;
+import com.fjhx.flow.entity.FlowParam;
+import com.fjhx.flow.enums.FlowTypeEnum;
+import com.fjhx.myapp.application.feign.IFlowApi;
+import com.fjhx.subscribe.enums.ApplyPurchaseStatusEnum;
+import com.fjhx.supplier.entity.Supplier;
+import com.fjhx.supplier.service.ISupplierService;
+import org.apache.commons.lang3.StringUtils;
+import org.springblade.common.utils.DateUtil;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.system.user.entity.User;
+import org.springblade.system.user.feign.IUserClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import java.time.LocalDate;
+import java.util.Date;
+
+/**
+ * 采购合同 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@Service
+public class PurchaseContractFlowServiceImpl extends ServiceImpl<PurchaseContractMapper, PurchaseContract> implements IPurchaseContractFlowService {
+
+    @Autowired
+    private IPurchaseContractMaterialService iPurchaseContractMaterialService;
+
+    @Autowired
+    private ISupplierService iSupplierService;
+
+    @Autowired
+    private IUserClient userClient;
+
+    @Autowired
+    private IFlowApi flowApi;
+    /**
+     * 发起
+     * @param purchaseContract
+     */
+    @Override
+    public void start(PurchaseContract purchaseContract) {
+        if(StringUtil.isEmpty(purchaseContract.getSupplierId())){
+            throw new ServiceException("请选择供应商");
+        }
+        User user = userClient.infoUser(AuthUtil.getUserIdStr());
+        Supplier supplier = iSupplierService.getById(purchaseContract.getSupplierId());
+        //计算交货日期  当前时间+供应商账期
+        if(ObjectUtil.isEmpty(supplier.getAccountDate())){
+            purchaseContract.setDeliverTime(new Date());
+        }else{
+            purchaseContract.setDeliverTime(DateUtil.dateAddASub(new Date(),supplier.getAccountDate()));
+        }
+        purchaseContract.setApproveBillState(ApplyPurchaseStatusEnum.APPLY_PURCHASE_STATUS_1.getKey());
+        purchaseContract.setPurContractState(PurchaseContractStatusEnum.APPLY_PURCHASE_STATUS_1.getKey());
+        updateById(purchaseContract);
+        String title = "caozj" + " 在" + LocalDate.now() + "日发起了 合同审批流程(单号" + purchaseContract.getPurchaseBillNo() + ")";
+        //发起流程
+        FlowParam param = new FlowParam(title,null,purchaseContract.getId(), FlowTypeEnum.type_2.getValue(),null);
+        try {
+            flowApi.startFlow(param);
+        }catch (Exception e){
+            throw new ServiceException("流程异常");
+        }
+    }
+
+    /**
+     * 审批
+     * @param condition
+     */
+    @Override
+    public void examine(FlowParam condition) {
+        if (StringUtils.isAnyBlank(condition.getBusinessId(), condition.getProInstantsId())) {
+            throw new ServiceException("参数缺失");
+        }
+        //查询合同信息
+        PurchaseContract purchaseContract = getById(condition.getBusinessId());
+        if(ObjectUtil.isEmpty(purchaseContract)){
+            throw new ServiceException("合同不存在");
+        }
+        try {
+            Boolean flowResult = flowApi.examineFlow(condition);
+            if(flowResult){//流程结束
+                PurchaseContract update = new PurchaseContract();
+                update.setId(condition.getBusinessId());
+                update.setApprovalTime(new Date());
+                update.setPurContractState(PurchaseContractStatusEnum.APPLY_PURCHASE_STATUS_2.getKey());
+                update.setApproveBillState(ApplyPurchaseStatusEnum.APPLY_PURCHASE_STATUS_2.getKey());
+                this.updateById(update);
+            }
+        }catch (Exception e){
+            throw new ServiceException("流程异常");
+        }
+    }
+
+    /**
+     * 驳回
+     * @param condition
+     */
+    @Override
+    public void reject(FlowParam condition) {
+        if (StringUtils.isAnyBlank(condition.getBusinessId(), condition.getProInstantsId())) {
+            throw new ServiceException("参数缺失");
+        }
+        try {
+            Boolean flowResult = flowApi.rejectFlow(condition);//驳回完后判断流程是否结束。还是转交到上一个节点
+            if(flowResult){//流程结束
+                PurchaseContract update = new PurchaseContract();
+                update.setId(condition.getBusinessId());
+                update.setApproveBillState(ApplyPurchaseStatusEnum.APPLY_PURCHASE_STATUS_3.getKey());
+                this.updateById(update);
+            }
+        }catch (Exception e){
+            throw new ServiceException("流程异常");
+        }
+    }
+}

+ 36 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/impl/PurchaseContractMaterialServiceImpl.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.service.impl;
+
+import com.fjhx.contract.entity.PurchaseContractMaterial;
+import com.fjhx.contract.mapper.PurchaseContractMaterialMapper;
+import com.fjhx.contract.service.IPurchaseContractMaterialService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 供应商收款账户 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@Service
+public class PurchaseContractMaterialServiceImpl extends ServiceImpl<PurchaseContractMaterialMapper, PurchaseContractMaterial> implements IPurchaseContractMaterialService {
+
+
+}

+ 114 - 0
hx-saas-project/saas-storage/src/main/java/com/fjhx/contract/service/impl/PurchaseContractServiceImpl.java

@@ -0,0 +1,114 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.contract.service.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.fjhx.contract.entity.PurchaseContract;
+import com.fjhx.contract.entity.PurchaseContractMaterial;
+import com.fjhx.contract.mapper.PurchaseContractMapper;
+import com.fjhx.contract.service.IPurchaseContractMaterialService;
+import com.fjhx.contract.service.IPurchaseContractService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springblade.common.utils.CodeUtil;
+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.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 采购合同 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@Service
+public class PurchaseContractServiceImpl extends ServiceImpl<PurchaseContractMapper, PurchaseContract> implements IPurchaseContractService {
+
+    @Autowired
+    private IPurchaseContractMaterialService iPurchaseContractMaterialService;
+    /**
+     * 列表
+     * @param condition
+     * @return
+     * @throws ParseException
+     */
+    @Override
+    public List<PurchaseContract> 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 id
+     * @return
+     */
+    @Override
+    public PurchaseContract getDetail(String id) {
+        return baseMapper.getDetailById(id);
+    }
+
+
+    /**
+     * 保存合同
+     * @param purchaseContract
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean savePurchaseContract(PurchaseContract purchaseContract) {
+        purchaseContract.setCreate();
+        if(StringUtil.isEmpty(purchaseContract.getPurchaseBillNo())){
+            //生成code
+            PurchaseContract sCode = getOne(Wrappers.<PurchaseContract>query().lambda().orderByDesc(PurchaseContract::getPurchaseBillNo).last("limit 1"));
+            String date = new SimpleDateFormat("yyyyMMdd").format(new Date());
+            String code = "PO-"+date+"-0001";
+            if(ObjectUtil.isEmpty(sCode)){
+                purchaseContract.setPurchaseBillNo(code);
+            }else{
+                purchaseContract.setPurchaseBillNo(sCode.getPurchaseBillNo()==null?code: CodeUtil.generateContractCode(sCode.getPurchaseBillNo()));
+            }
+        }
+        save(purchaseContract);
+        if(CollectionUtils.isNotEmpty(purchaseContract.getMaterialList())){
+            for(PurchaseContractMaterial p:purchaseContract.getMaterialList()){
+                p.setPurchaseContractId(purchaseContract.getId());
+                p.setCreate();
+            }
+            //保存明细
+            iPurchaseContractMaterialService.saveBatch(purchaseContract.getMaterialList());
+        }
+        return true;
+    }
+}

+ 22 - 1
hx-saas-project/saas-storage/src/main/java/com/fjhx/subscribe/service/impl/ApplyPurchaseFlowServiceImpl.java

@@ -18,8 +18,12 @@ package com.fjhx.subscribe.service.impl;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.contract.entity.PurchaseContract;
+import com.fjhx.contract.entity.PurchaseContractMaterial;
+import com.fjhx.contract.service.IPurchaseContractService;
 import com.fjhx.flow.entity.Flow;
 import com.fjhx.flow.entity.FlowParam;
+import com.fjhx.flow.enums.FlowTypeEnum;
 import com.fjhx.myapp.application.feign.IFlowApi;
 import com.fjhx.subscribe.entity.ApplyPurchase;
 import com.fjhx.subscribe.entity.ApplyPurchasedetail;
@@ -63,6 +67,8 @@ public class ApplyPurchaseFlowServiceImpl extends ServiceImpl<ApplyPurchaseMappe
     private IUserClient userClient;
     @Autowired
     private IApplyPurchasedetailService iApplyPurchasedetailService;
+    @Autowired
+    private IPurchaseContractService iPurchaseContractService;
     /**
      * 发起流程
      * @param applyPurchase
@@ -91,7 +97,7 @@ public class ApplyPurchaseFlowServiceImpl extends ServiceImpl<ApplyPurchaseMappe
             updateApplyPurchase(applyPurchase);
         }
         //发起流程
-        FlowParam param = setValue(title,null,applyPurchase.getId(),"subscribe",null);
+        FlowParam param = setValue(title,null,applyPurchase.getId(), FlowTypeEnum.type_1.getValue(),null);
         try {
             flowApi.startFlow(param);
         }catch (Exception e){
@@ -113,6 +119,9 @@ public class ApplyPurchaseFlowServiceImpl extends ServiceImpl<ApplyPurchaseMappe
         if (applyPurchase == null) {
             throw new ServiceException("申购单不存在");
         }
+        //查询申购明细
+        List<ApplyPurchasedetail> purchasedetailList = iApplyPurchasedetailService.list(Wrappers.<ApplyPurchasedetail>query().lambda().
+                eq(ApplyPurchasedetail::getApplyPurchaseId,applyPurchase.getId()));
         try {
             Boolean flowResult = flowApi.examineFlow(condition);
             if(flowResult){//流程结束
@@ -121,6 +130,18 @@ public class ApplyPurchaseFlowServiceImpl extends ServiceImpl<ApplyPurchaseMappe
                 update.setApprovalTime(new Date());
                 update.setApproveBillState(ApplyPurchaseStatusEnum.APPLY_PURCHASE_STATUS_2.getKey());
                 this.updateById(update);
+                //生成合同
+                PurchaseContract contract = new PurchaseContract();
+                contract.setApplyPurchaseId(condition.getBusinessId());
+                List<PurchaseContractMaterial> materialList = new ArrayList<>();
+                PurchaseContractMaterial material = new PurchaseContractMaterial();
+                for(ApplyPurchasedetail d:purchasedetailList){
+                    material.setMaterialId(d.getMaterialId());
+                    material.setPurchaseQty(d.getPurchaseQty());
+                    materialList.add(material);
+                }
+                contract.setMaterialList(materialList);
+                iPurchaseContractService.savePurchaseContract(contract);
             }
         }catch (Exception e){
             throw new ServiceException("流程异常");

+ 0 - 183
hx-service-api/a-api/src/main/java/com/fjhx/entity/material/Material.java

@@ -1,183 +0,0 @@
-package com.fjhx.entity.material;
-
-import java.math.BigDecimal;
-import com.baomidou.mybatisplus.annotation.IdType;
-import java.util.Date;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.fjhx.base.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * <p>
- * 物料
- * </p>
- *
- * @author ${author}
- * @since 2022-07-20
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class Material extends BaseEntity {
-
-
-    /**
-     * 软删除
-     */
-    @TableField("IsDelete")
-    private Boolean isdelete;
-
-    /**
-     * 创建时间
-     */
-    @TableField("CreatedTime")
-    private Date createdtime;
-
-    /**
-     * 修改时间
-     */
-    @TableField("UpdatedTime")
-    private Date updatedtime;
-
-    /**
-     * 物料名称
-     */
-    @TableField("Name")
-    private String name;
-
-    /**
-     * 编码
-     */
-    @TableField("Code")
-    private String code;
-
-    /**
-     * 克重
-     */
-    @TableField("UnitWeight")
-    private Float unitweight;
-
-    /**
-     * 单位编号
-     */
-    @TableField("MaterialUnitID")
-    private String materialunitid;
-
-    /**
-     * 库存单位id
-     */
-    @TableField("StockUnitID")
-    private String stockunitid;
-
-    /**
-     * 门幅
-     */
-    @TableField("Width")
-    private Float width;
-
-    /**
-     * 分类
-     */
-    @TableField("CategoryCode")
-    private String categorycode;
-
-    /**
-     * 安全库存
-     */
-    @TableField("SafetyStock")
-    private Integer safetystock;
-
-    /**
-     * 定时任务自动生成申购单时间
-     */
-    @TableField("AutoTaskTime")
-    private Date autotasktime;
-
-    /**
-     * 抽检⽐例
-     */
-    @TableField("CheckRate")
-    private BigDecimal checkrate;
-
-    /**
-     * 安全预警天数/采购周期
-     */
-    @TableField("SafetyWarnDay")
-    private Integer safetywarnday;
-
-    /**
-     * 规格
-     */
-    @TableField("Spec")
-    private String spec;
-
-    /**
-     * 放置区域
-     */
-    @TableField("PlaceAreaIds")
-    private String placeareaids;
-
-    /**
-     * 滞留周期(天)
-     */
-    @TableField("DelayPeriod")
-    private Integer delayperiod;
-
-    /**
-     * 维护人员
-     */
-    @TableField("CreateUser")
-    private String createuser;
-
-    /**
-     * 组织架构
-     */
-    @TableField("OR_ID")
-    private String orId;
-
-    /**
-     * 物料其他编码(模糊搜索使用)
-     */
-    @TableField("OtherCode")
-    private String othercode;
-
-    /**
-     * 备注
-     */
-    @TableField("Remark")
-    private String remark;
-
-    /**
-     * 标准价格
-     */
-    @TableField("Price")
-    private BigDecimal price;
-
-    /**
-     * 标准库存
-     */
-    @TableField("StockStandard")
-    private BigDecimal stockstandard;
-
-    /**
-     * 单位数量
-     */
-    @TableField("UnitNum")
-    private BigDecimal unitnum;
-
-    /**
-     * 用途
-     */
-    @TableField("Purpose")
-    private String purpose;
-
-    /**
-     * 工艺类型 (枚举定义:0=直喷,1=热转,2=打纸,3=墨水,4=其他)
-     */
-    @TableField("TechnologyType")
-    private Integer technologytype;
-
-
-}

+ 0 - 17
hx-service-api/a-api/src/main/java/com/fjhx/params/material/MaterialEx.java

@@ -1,17 +0,0 @@
-package com.fjhx.params.material;
-
-import com.fjhx.entity.material.Material;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 物料
- *
- * @author ${author}
- * @since 2022-07-20
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class MaterialEx extends Material {
-
-}

+ 0 - 17
hx-service-api/a-api/src/main/java/com/fjhx/params/material/MaterialVo.java

@@ -1,17 +0,0 @@
-package com.fjhx.params.material;
-
-import com.fjhx.entity.material.Material;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-
-/**
- * 物料
- *
- * @author ${author}
- * @since 2022-07-20
- */
-@Data
-@EqualsAndHashCode(callSuper = true)
-public class MaterialVo extends Material {
-
-}

+ 111 - 0
hx-service-api/storage-api/src/main/java/com/fjhx/entity/scheduling/entity/Scheduling.java

@@ -0,0 +1,111 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.entity.scheduling.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.time.LocalDateTime;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.fjhx.base.BasicEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 仓库实体类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@Data
+@TableName("stock_scheduling")
+@ApiModel(value = "Scheduling对象", description = "仓库")
+public class Scheduling {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 主键ID
+	*/
+	@ApiModelProperty(value = "主键ID")
+	private String id;
+	/**
+	* 是否删除
+	*/
+	@ApiModelProperty(value = "是否删除")
+	private Integer isDelete;
+	/**
+	* 排班日期
+	*/
+	@ApiModelProperty(value = "排班日期")
+	private Date planDate;
+	/**
+	* 喷印人员工号
+	*/
+	@ApiModelProperty(value = "喷印人员工号")
+	private String printer;
+	/**
+	* 打纸人员工号
+	*/
+	@ApiModelProperty(value = "打纸人员工号")
+	private String paperMan;
+	/**
+	* 物料编码
+	*/
+	@ApiModelProperty(value = "物料编码")
+	private String materialCode;
+	/**
+	* 物料长度
+	*/
+	@ApiModelProperty(value = "物料长度")
+	private BigDecimal materialQuantity;
+	/**
+	* 转印纸编码
+	*/
+	@ApiModelProperty(value = "转印纸编码")
+	private String paperCode;
+	/**
+	* 转印纸长度
+	*/
+	@ApiModelProperty(value = "转印纸长度")
+	private BigDecimal paperQuantity;
+	/**
+	* 创建时间
+	*/
+	@ApiModelProperty(value = "创建时间")
+	private Date createTime;
+	/**
+	* 修改时间
+	*/
+	@ApiModelProperty(value = "修改时间")
+	private Date updateTime;
+	/**
+	* 创建人
+	*/
+	@ApiModelProperty(value = "创建人")
+	private String createUser;
+	/**
+	* 修改人
+	*/
+	@ApiModelProperty(value = "修改人")
+	private String updateUser;
+
+
+}

+ 0 - 56
hx-service/a/src/main/java/com/fjhx/material/controller/MaterialController.java

@@ -1,56 +0,0 @@
-package com.fjhx.material.controller;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.springblade.core.tool.api.R;
-import com.fjhx.entity.material.Material;
-import com.fjhx.params.material.MaterialVo;
-import com.fjhx.material.service.MaterialService;
-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;
-
-import java.util.Map;
-
-/**
- * <p>
- * 物料 前端控制器
- * </p>
- *
- * @author ${author}
- * @since 2022-07-20
- */
-@RestController
-@RequestMapping("/material")
-public class MaterialController {
-
-    @Autowired
-    private MaterialService materialService;
-
-    @PostMapping("/page")
-    public R page(@RequestBody Map<String, String> condition){
-        Page<Material> result = materialService.getPage(condition);
-        return R.success(result);
-    }
-
-    @PostMapping("/add")
-    public R add(@RequestBody MaterialVo materialVo){
-        materialService.add(materialVo);
-        return R.success();
-    }
-
-    @PostMapping("/edit")
-    public R edit(@RequestBody MaterialVo materialVo){
-        materialService.edit(materialVo);
-        return R.success();
-    }
-
-    @PostMapping("/delete")
-    public R delete(@RequestBody MaterialVo materialVo){
-        materialService.delete(materialVo);
-        return R.success();
-    }
-
-}
-

+ 0 - 16
hx-service/a/src/main/java/com/fjhx/material/mapper/MaterialMapper.java

@@ -1,16 +0,0 @@
-package com.fjhx.material.mapper;
-
-import com.fjhx.entity.material.Material;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * <p>
- * 物料 Mapper 接口
- * </p>
- *
- * @author ${author}
- * @since 2022-07-20
- */
-public interface MaterialMapper extends BaseMapper<Material> {
-
-}

+ 0 - 5
hx-service/a/src/main/java/com/fjhx/material/mapper/MaterialMapper.xml

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

+ 0 - 28
hx-service/a/src/main/java/com/fjhx/material/service/MaterialService.java

@@ -1,28 +0,0 @@
-package com.fjhx.material.service;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.entity.material.Material;
-import com.fjhx.params.material.MaterialVo;
-import com.fjhx.base.BaseService;
-
-import java.util.Map;
-
-/**
- * <p>
- * 物料 服务类
- * </p>
- *
- * @author ${author}
- * @since 2022-07-20
- */
-public interface MaterialService extends BaseService<Material> {
-
-    Page<Material> getPage(Map<String, String> condition);
-
-    void add(MaterialVo materialVo);
-
-    void edit(MaterialVo materialVo);
-
-    void delete(MaterialVo materialVo);
-
-}

+ 0 - 55
hx-service/a/src/main/java/com/fjhx/material/service/impl/MaterialServiceImpl.java

@@ -1,55 +0,0 @@
-package com.fjhx.material.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.utils.WrapperUtil;
-import com.fjhx.entity.material.Material;
-import com.fjhx.params.material.MaterialVo;
-import com.fjhx.material.mapper.MaterialMapper;
-import com.fjhx.material.service.MaterialService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.springframework.stereotype.Service;
-
-import java.util.Map;
-
-/**
- * <p>
- * 物料 服务实现类
- * </p>
- *
- * @author ${author}
- * @since 2022-07-20
- */
-@Service
-public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> implements MaterialService {
-
-    @Override
-    public Page<Material> getPage(Map<String, String> condition) {
-
-        QueryWrapper<Material> wrapper = Wrappers.query();
-
-        WrapperUtil.init(condition, wrapper)
-                .eqTenantId()
-                .createTimeDesc();
-
-        Page<Material> page = page(condition, wrapper);
-        return page;
-    }
-
-    @Override
-    public void add(MaterialVo materialVo) {
-        save(materialVo);
-    }
-
-    @Override
-    public void edit(MaterialVo materialVo) {
-        updateById(materialVo);
-    }
-
-    @Override
-    public void delete(MaterialVo materialVo) {
-        removeById(materialVo.getId());
-    }
-
-}

+ 57 - 0
hx-service/storage/src/main/java/com/fjhx/scheduling/controller/SchedulingController.java

@@ -0,0 +1,57 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.scheduling.controller;
+
+import com.fjhx.entity.scheduling.entity.Scheduling;
+import com.fjhx.scheduling.service.ISchedulingService;
+import com.fjhx.utils.HmacUtil;
+import io.swagger.annotations.Api;
+import lombok.AllArgsConstructor;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.StringUtil;
+import org.springframework.web.bind.annotation.*;
+import org.springblade.core.boot.ctrl.BladeController;
+
+import java.util.Date;
+
+/**
+ * 排班
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("/hx/storage/open/api/scheduling")
+@Api(value = "仓库", tags = "仓库接口")
+public class SchedulingController extends BladeController {
+
+	private final ISchedulingService schedulingService;
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	public R save(@RequestBody Scheduling scheduling,@RequestHeader("Authority")String authority,@RequestHeader("date")String date) {
+		if(!StringUtil.equals(HmacUtil.encrypt("fjhx"+date, "fjhx@2012"),authority)){
+			return R.fail("无权限");
+		}
+		scheduling.setCreateTime(new Date());
+		return R.status(schedulingService.save(scheduling));
+	}
+	
+}

+ 32 - 0
hx-service/storage/src/main/java/com/fjhx/scheduling/mapper/SchedulingMapper.java

@@ -0,0 +1,32 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.scheduling.mapper;
+
+import com.fjhx.entity.scheduling.entity.Scheduling;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ * 仓库 Mapper 接口
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+public interface SchedulingMapper extends BaseMapper<Scheduling> {
+
+
+}

+ 22 - 0
hx-service/storage/src/main/java/com/fjhx/scheduling/mapper/SchedulingMapper.xml

@@ -0,0 +1,22 @@
+<?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.scheduling.mapper.SchedulingMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="schedulingResultMap" type="com.fjhx.entity.scheduling.entity.Scheduling">
+        <id column="id" property="id"/>
+        <result column="is_delete" property="isDelete"/>
+        <result column="plan_date" property="planDate"/>
+        <result column="printer" property="printer"/>
+        <result column="paper_man" property="paperMan"/>
+        <result column="material_code" property="materialCode"/>
+        <result column="material_quantity" property="materialQuantity"/>
+        <result column="paper_code" property="paperCode"/>
+        <result column="paper_quantity" property="paperQuantity"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="create_user" property="createUser"/>
+        <result column="update_user" property="updateUser"/>
+    </resultMap>
+
+</mapper>

+ 29 - 0
hx-service/storage/src/main/java/com/fjhx/scheduling/service/ISchedulingService.java

@@ -0,0 +1,29 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.scheduling.service;
+
+import com.fjhx.entity.scheduling.entity.Scheduling;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * 仓库 服务类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+public interface ISchedulingService extends IService<Scheduling> {
+}

+ 35 - 0
hx-service/storage/src/main/java/com/fjhx/scheduling/service/impl/SchedulingServiceImpl.java

@@ -0,0 +1,35 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package com.fjhx.scheduling.service.impl;
+
+import com.fjhx.entity.scheduling.entity.Scheduling;
+import com.fjhx.scheduling.mapper.SchedulingMapper;
+import com.fjhx.scheduling.service.ISchedulingService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 仓库 服务实现类
+ *
+ * @author BladeX
+ * @since 2022-07-27
+ */
+@Service
+public class SchedulingServiceImpl extends ServiceImpl<SchedulingMapper, Scheduling> implements ISchedulingService {
+
+
+}

+ 3 - 2
hx-service/storage/src/main/java/com/fjhx/supplier/controller/SupplierController.java

@@ -77,8 +77,9 @@ public class SupplierController {
      * @return
      */
     @GetMapping("/statisticsClassify")
-    public R statisticsClassify(){
-        List<Supplier> list = supplierService.statisticsClassify();
+    public R statisticsClassify(@RequestParam(required = false)String Purpose ,
+                                @RequestParam(required = false)String search){
+        List<Supplier> list = supplierService.statisticsClassify(Purpose,search);
         return R.success(list);
     }
 

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

@@ -80,7 +80,7 @@ public interface SupplierMapper extends BaseMapper<Supplier> {
      * @return
      */
     @TenantIgnore
-    List<Supplier> getGroupByCategory();
+    List<Supplier> getGroupByCategory(@Param("Purpose")String Purpose,@Param("search")String search);
 
     /**
      * 供应商详情

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

@@ -14,7 +14,6 @@
         LEFT JOIN supplier_price sp ON t1.ID = sp.FactoryId
         LEFT JOIN material t3 ON t3.`Code` = sp.MaterialCode
         <include refid="list_condition"/>
-        AND t3.IsDelete = 0
         GROUP BY t1.ID
         ORDER BY t1.CreatedTime DESC
         <include refid="sql_limit"/>
@@ -48,7 +47,8 @@
         LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
         <include refid="list_condition"/>
         AND t3.IsDelete = 0
-        GROUP BY t1.ID
+        GROUP BY t1.ID,
+        t3.TechnologyType
         ORDER BY t3.TechnologyType
         <include refid="sql_limit"/>
     </select>
@@ -65,7 +65,8 @@
             LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
             <include refid="list_condition"/>
             AND t3.IsDelete = 0
-            GROUP BY t1.ID
+            GROUP BY t1.ID,
+            t3.TechnologyType
         )AS a
     </select>
     <select id="getPurList" resultType="com.fjhx.entity.supplier.Supplier">
@@ -86,7 +87,9 @@
         LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
         LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
         <include refid="list_condition"/>
-        GROUP BY t1.ID
+        AND t3.IsDelete = 0
+        GROUP BY t1.ID,
+        t3.TechnologyType
         ORDER BY t3.TechnologyType
         <include refid="sql_limit"/>
     </select>
@@ -102,7 +105,9 @@
             LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
             LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
             <include refid="list_condition"/>
-            GROUP BY t1.ID
+            AND t3.IsDelete = 0
+            GROUP BY t1.ID,
+            t3.TechnologyType
         ) AS a
     </select>
     <select id="getGroupByCategory" resultType="com.fjhx.entity.supplier.Supplier">
@@ -119,9 +124,17 @@
                     material t3
                 LEFT JOIN supplier_price sp ON t3.`Code` = sp.MaterialCode
                 LEFT JOIN supplier t1 ON sp.FactoryId = t1.ID
-                <include refid="list_condition"/>
-                AND t3.IsDelete = 0
-                GROUP BY t1.ID
+                <where>
+                    t1.IsDelete = 0
+                    AND t3.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="Purpose neq null and Purpose neq '' ">
+                        AND INSTR( t3.Purpose, #{Purpose} ) > 0
+                    </if>
+                </where>
+                GROUP BY t1.ID,t3.TechnologyType
                     ) detail
         GROUP BY
             TechnologyType
@@ -306,7 +319,7 @@
             <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 ''">
+            <if test="TechnologyType neq null">
                 AND t3.TechnologyType = #{TechnologyType}
             </if>
             <if test="Purpose neq null and Purpose neq '' ">

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

@@ -56,7 +56,7 @@ public interface SupplierService extends BaseService<Supplier> {
      * 统计物料分类
      * @return
      */
-    List<Supplier> statisticsClassify();
+    List<Supplier> statisticsClassify(String Purpose,String search);
 
     /**
      * 添加

+ 8 - 6
hx-service/storage/src/main/java/com/fjhx/supplier/service/impl/SupplierServiceImpl.java

@@ -98,8 +98,14 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
      * @return
      */
     @Override
-    public List<Supplier> statisticsClassify() {
-        return baseMapper.getGroupByCategory();
+    public List<Supplier> statisticsClassify(String Purpose,String search) {
+        if(StringUtil.equals("null",Purpose)){
+            Purpose = null;
+        }
+        if(StringUtil.equals("null",search)){
+            search = null;
+        }
+        return baseMapper.getGroupByCategory(Purpose,search);
     }
 
     /**
@@ -288,8 +294,4 @@ public class SupplierServiceImpl extends ServiceImpl<SupplierMapper, Supplier> i
     public List<Supplier> selectList(Map<String, Object> condition) {
         return baseMapper.selectList(condition);
     }
-
-    public static void main(String[] args) {
-        System.out.println(new BigDecimal("170,850.00"));
-    }
 }