home 2 rokov pred
rodič
commit
688b5c3517
35 zmenil súbory, kde vykonal 950 pridanie a 40 odobranie
  1. 0 23
      hx-service-api/service-flow-api/src/main/java/com/fjhx/params/FlowVo.java
  2. 9 0
      hx-service-api/service-flow-api/src/main/java/com/fjhx/utils/ExampleAbstract.java
  3. 6 3
      hx-service-api/service-flow-api/src/main/java/com/fjhx/utils/FlowConstructor.java
  4. 61 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/Apply.java
  5. 57 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/ApplyDetails.java
  6. 64 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/supplier/SupplierPriceChange.java
  7. 49 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/enums/FlowStatusEnum.java
  8. 17 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyDetailsEx.java
  9. 17 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyDetailsVo.java
  10. 17 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyEx.java
  11. 25 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyVo.java
  12. 17 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/supplier/SupplierPriceChangeEx.java
  13. 17 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/supplier/SupplierPriceChangeVo.java
  14. 1 0
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/supplier/SupplierPriceVo.java
  15. 57 0
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyController.java
  16. 56 0
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyDetailsController.java
  17. 3 3
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/material/MaterialController.java
  18. 32 0
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/supplier/SupplierPriceChangeController.java
  19. 6 3
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/supplier/SupplierPriceController.java
  20. 16 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyDetailsMapper.java
  21. 5 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyDetailsMapper.xml
  22. 16 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyMapper.java
  23. 5 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyMapper.xml
  24. 16 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/supplier/SupplierPriceChangeMapper.java
  25. 5 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/supplier/SupplierPriceChangeMapper.xml
  26. 28 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyDetailsService.java
  27. 33 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyService.java
  28. 54 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyDetailsServiceImpl.java
  29. 61 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyServiceImpl.java
  30. 83 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/flow/InitiateApplyFlowService.java
  31. 3 3
      hx-service/storage-restructure/src/main/java/com/fjhx/service/flow/MaterialUpdateFlowService.java
  32. 24 5
      hx-service/storage-restructure/src/main/java/com/fjhx/service/flow/SupplierPriceUpdateFlow.java
  33. 28 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/SupplierPriceChangeService.java
  34. 54 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/impl/SupplierPriceChangeServiceImpl.java
  35. 8 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/impl/SupplierPriceServiceImpl.java

+ 0 - 23
hx-service-api/service-flow-api/src/main/java/com/fjhx/params/FlowVo.java

@@ -1,23 +0,0 @@
-package com.fjhx.params;
-
-import lombok.Data;
-
-@Data
-public class FlowVo {
-
-    /**
-     * 流程关联编号
-     */
-    Long flowLinkNo;
-
-    /**
-     * 按钮id
-     */
-    Long buttonId;
-
-    /**
-     * 审批意见
-     */
-    String remarks;
-
-}

+ 9 - 0
hx-service-api/service-flow-api/src/main/java/com/fjhx/utils/ExampleAbstract.java

@@ -51,6 +51,14 @@ public abstract class ExampleAbstract {
     }
 
     /**
+     * 审批通过方法(跳转下一节点)
+     * 需要时重写即可
+     */
+    public void adopt() {
+
+    }
+
+    /**
      * 控制流程流转
      * 存在分支时需要重写此方法,流转向指定分支
      *
@@ -61,4 +69,5 @@ public abstract class ExampleAbstract {
     }
 
 
+
 }

+ 6 - 3
hx-service-api/service-flow-api/src/main/java/com/fjhx/utils/FlowConstructor.java

@@ -7,7 +7,6 @@ import com.fjhx.constants.FlowExplainConstant;
 import com.fjhx.enums.ButtonNameEnum;
 import com.fjhx.feign.IFlowClient;
 import com.fjhx.params.ExampleResult;
-import com.fjhx.params.FlowVo;
 import com.fjhx.params.JumpVo;
 import org.springblade.core.tool.api.R;
 
@@ -96,8 +95,8 @@ public class FlowConstructor {
         return result;
     }
 
-    public ExampleResult jump(FlowVo flowVo) {
-        return jump(flowVo.getFlowLinkNo(), flowVo.getButtonId(), flowVo.getRemarks(), null);
+    public ExampleResult jump(JumpVo jumpVo) {
+        return jump(jumpVo.getFlowLinkNo(), jumpVo.getButtonId(), jumpVo.getRemarks(), null);
     }
 
     public ExampleResult jump(Long flowLinkNo, Long buttonId, String remarks) {
@@ -154,6 +153,10 @@ public class FlowConstructor {
                 case FAIL:
                     exampleAbstract.fail();
                     break;
+
+                case ADOPT:
+                    exampleAbstract.adopt();
+                    break;
             }
         } catch (Exception e) {
             rollBack(result);

+ 61 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/Apply.java

@@ -0,0 +1,61 @@
+package com.fjhx.entity.apply;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.fjhx.base.StorageBaseEntity;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 物料申购
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class Apply extends StorageBaseEntity {
+
+
+    /**
+     * 申购单号
+     */
+    private String code;
+
+    /**
+     * 申购类型 (0物料,1行政)
+     */
+    private Integer type;
+
+    /**
+     * 审批状态(0待审批,1审批中,2已审批,3已驳回,4已撤回)
+     */
+    private Integer flowStatus;
+
+    /**
+     * 安全库存自动生成(1是,0否)
+     */
+    private Integer safetyStockCreate;
+
+    /**
+     * 申购说明
+     */
+    private String remark;
+
+    /**
+     * 逻辑删除 0未删除 1已删除
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer delFlag;
+
+    private String oldId;
+
+
+}

+ 57 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/ApplyDetails.java

@@ -0,0 +1,57 @@
+package com.fjhx.entity.apply;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.fjhx.base.StorageBaseEntity;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 物料申购明细
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ApplyDetails extends StorageBaseEntity {
+
+
+    /**
+     * 申购id
+     */
+    private Long applyId;
+
+    /**
+     * 物料id
+     */
+    private Long materialId;
+
+    /**
+     * 申购数量
+     */
+    private BigDecimal quantity;
+
+    /**
+     * 用途
+     */
+    private String purpose;
+
+    /**
+     * 逻辑删除 0未删除 1已删除
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer delFlag;
+
+    private String oldId;
+
+
+}

+ 64 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/supplier/SupplierPriceChange.java

@@ -0,0 +1,64 @@
+package com.fjhx.entity.supplier;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.Version;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.fjhx.base.StorageBaseEntity;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableField;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 供应商价格维护变更记录
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierPriceChange extends StorageBaseEntity {
+
+    /**
+     * 价格维护id
+     */
+    private Long supplierPriceId;
+
+    /**
+     * 供应商id
+     */
+    private Long supplierId;
+
+    /**
+     * 物料id
+     */
+    private Long materialId;
+
+    /**
+     * 采购单价
+     */
+    private BigDecimal oldPrice;
+
+    /**
+     * 采购单价
+     */
+    private BigDecimal newPrice;
+
+    /**
+     * 备注
+     */
+    private String remark;
+
+    /**
+     * 逻辑删除 0未删除 1已删除
+     */
+    @TableField(fill = FieldFill.INSERT)
+    @TableLogic
+    private Integer delFlag;
+
+
+}

+ 49 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/enums/FlowStatusEnum.java

@@ -0,0 +1,49 @@
+package com.fjhx.enums;
+
+import lombok.Getter;
+
+import java.util.HashMap;
+
+/**
+ * 物料属性
+ */
+@Getter
+public enum FlowStatusEnum {
+
+    WAIT(0, "待审批"),
+    UNDER_WAY(1, "审批中"),
+    ADOPT(2, "已审批"),
+    REJECT(3, "已驳回"),
+    WITHDRAW(4, "已撤回");
+
+    private final Integer type;
+    private final String name;
+
+    private static final HashMap<Integer, FlowStatusEnum> map = new HashMap<>();
+
+    FlowStatusEnum(Integer type, String name) {
+        this.type = type;
+        this.name = name;
+    }
+
+    static {
+        for (FlowStatusEnum value : FlowStatusEnum.values()) {
+            map.put(value.getType(), value);
+        }
+    }
+
+    /**
+     * 根据type获取枚举
+     */
+    public static FlowStatusEnum get(Integer type) {
+        return map.get(type);
+    }
+
+    /**
+     * 根据type值获取枚举
+     */
+    public static String getName(Integer type) {
+        return map.get(type).getName();
+    }
+
+}

+ 17 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyDetailsEx.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.apply;
+
+import com.fjhx.entity.apply.ApplyDetails;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 物料申购明细
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ApplyDetailsEx extends ApplyDetails {
+
+}

+ 17 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyDetailsVo.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.apply;
+
+import com.fjhx.entity.apply.ApplyDetails;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 物料申购明细
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ApplyDetailsVo extends ApplyDetails {
+
+}

+ 17 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyEx.java

@@ -0,0 +1,17 @@
+package com.fjhx.params.apply;
+
+import com.fjhx.entity.apply.Apply;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 物料申购
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ApplyEx extends Apply {
+
+}

+ 25 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyVo.java

@@ -0,0 +1,25 @@
+package com.fjhx.params.apply;
+
+import com.fjhx.entity.apply.Apply;
+import com.fjhx.entity.apply.ApplyDetails;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.List;
+
+/**
+ * 物料申购
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ApplyVo extends Apply {
+
+    /**
+     * 申购详情列表
+     */
+    private List<ApplyDetails> applyDetailsList;
+
+}

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

@@ -0,0 +1,17 @@
+package com.fjhx.params.supplier;
+
+import com.fjhx.entity.supplier.SupplierPriceChange;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 供应商价格维护变更记录
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierPriceChangeEx extends SupplierPriceChange {
+
+}

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

@@ -0,0 +1,17 @@
+package com.fjhx.params.supplier;
+
+import com.fjhx.entity.supplier.SupplierPriceChange;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 供应商价格维护变更记录
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class SupplierPriceChangeVo extends SupplierPriceChange {
+
+}

+ 1 - 0
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/supplier/SupplierPriceVo.java

@@ -1,6 +1,7 @@
 package com.fjhx.params.supplier;
 
 import com.fjhx.entity.supplier.SupplierPrice;
+import com.fjhx.entity.supplier.SupplierPriceChange;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 

+ 57 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyController.java

@@ -0,0 +1,57 @@
+package com.fjhx.controller.apply;
+
+import com.fjhx.params.JumpVo;
+import com.fjhx.params.apply.ApplyVo;
+import com.fjhx.service.apply.ApplyService;
+import com.fjhx.service.flow.InitiateApplyFlowService;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 物料申购 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@RestController
+@RequestMapping("/apply")
+public class ApplyController {
+
+    @Autowired
+    private ApplyService applyService;
+
+    @Autowired
+    private InitiateApplyFlowService initiateApplyFlowService;
+
+//    @PostMapping("/page")
+//    public R page(@RequestBody Map<String, String> condition){
+//        Page<Apply> result = applyService.getPage(condition);
+//        return R.success(result);
+//    }
+
+    @PostMapping("/addFlowCreate")
+    public R addFlowCreate(@RequestBody ApplyVo applyVo) {
+        initiateApplyFlowService.create(applyVo);
+        return R.success();
+    }
+
+    @PostMapping("/addFlowJump")
+    public R addFlowJump(@RequestBody JumpVo jumpVo) {
+        initiateApplyFlowService.jump(jumpVo);
+        return R.success();
+    }
+
+//    @PostMapping("/edit")
+//    public R edit(@RequestBody ApplyVo applyVo){
+//        applyService.edit(applyVo);
+//        return R.success();
+//    }
+
+}
+

+ 56 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyDetailsController.java

@@ -0,0 +1,56 @@
+package com.fjhx.controller.apply;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springblade.core.tool.api.R;
+import com.fjhx.entity.apply.ApplyDetails;
+import com.fjhx.params.apply.ApplyDetailsVo;
+import com.fjhx.service.apply.ApplyDetailsService;
+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-09-13
+ */
+@RestController
+@RequestMapping("/applyDetails")
+public class ApplyDetailsController {
+
+    @Autowired
+    private ApplyDetailsService applyDetailsService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition){
+        Page<ApplyDetails> result = applyDetailsService.getPage(condition);
+        return R.success(result);
+    }
+
+    @PostMapping("/add")
+    public R add(@RequestBody ApplyDetailsVo applyDetailsVo){
+        applyDetailsService.add(applyDetailsVo);
+        return R.success();
+    }
+
+    @PostMapping("/edit")
+    public R edit(@RequestBody ApplyDetailsVo applyDetailsVo){
+        applyDetailsService.edit(applyDetailsVo);
+        return R.success();
+    }
+
+    @PostMapping("/delete")
+    public R delete(@RequestBody ApplyDetailsVo applyDetailsVo){
+        applyDetailsService.delete(applyDetailsVo);
+        return R.success();
+    }
+
+}
+

+ 3 - 3
hx-service/storage-restructure/src/main/java/com/fjhx/controller/material/MaterialController.java

@@ -2,7 +2,7 @@ package com.fjhx.controller.material;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fjhx.entity.material.Material;
-import com.fjhx.params.FlowVo;
+import com.fjhx.params.JumpVo;
 import com.fjhx.service.flow.MaterialUpdateFlowService;
 import com.fjhx.service.material.MaterialService;
 import org.springblade.core.tool.api.R;
@@ -52,8 +52,8 @@ public class MaterialController {
      * 物料修改流程跳转
      */
     @PostMapping("/editFlowJump")
-    public R editFlowJump(@RequestBody FlowVo flowVo) {
-        materialUpdateFlowService.jump(flowVo);
+    public R editFlowJump(@RequestBody JumpVo jumpVo) {
+        materialUpdateFlowService.jump(jumpVo);
         return R.success();
     }
 

+ 32 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/controller/supplier/SupplierPriceChangeController.java

@@ -0,0 +1,32 @@
+package com.fjhx.controller.supplier;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.springblade.core.tool.api.R;
+import com.fjhx.entity.supplier.SupplierPriceChange;
+import com.fjhx.params.supplier.SupplierPriceChangeVo;
+import com.fjhx.service.supplier.SupplierPriceChangeService;
+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-09-13
+ */
+@RestController
+@RequestMapping("/supplierPriceChange")
+public class SupplierPriceChangeController {
+
+    @Autowired
+    private SupplierPriceChangeService supplierPriceChangeService;
+
+}
+

+ 6 - 3
hx-service/storage-restructure/src/main/java/com/fjhx/controller/supplier/SupplierPriceController.java

@@ -1,12 +1,13 @@
 package com.fjhx.controller.supplier;
 
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.fjhx.params.FlowVo;
+import com.fjhx.params.JumpVo;
 import com.fjhx.params.supplier.SupplierPriceVo;
 import com.fjhx.service.flow.SupplierPriceUpdateFlow;
 import com.fjhx.service.supplier.SupplierPriceService;
 import org.springblade.core.tool.api.R;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -51,15 +52,17 @@ public class SupplierPriceController {
         return R.success();
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @PostMapping("/updateFlowCreate")
     public R updateFlowCreate(@RequestBody SupplierPriceVo supplierPriceVo) {
         supplierPriceUpdateFlow.create(supplierPriceVo);
         return R.success();
     }
 
+    @Transactional(rollbackFor = Exception.class)
     @PostMapping("/updateFlowJump")
-    public R updateFlowJump(@RequestBody FlowVo flowVo) {
-        supplierPriceUpdateFlow.jump(flowVo);
+    public R updateFlowJump(@RequestBody JumpVo jumpVo) {
+        supplierPriceUpdateFlow.jump(jumpVo);
         return R.success();
     }
 

+ 16 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyDetailsMapper.java

@@ -0,0 +1,16 @@
+package com.fjhx.mapper.apply;
+
+import com.fjhx.entity.apply.ApplyDetails;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 物料申购明细 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+public interface ApplyDetailsMapper extends BaseMapper<ApplyDetails> {
+
+}

+ 5 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyDetailsMapper.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.mapper.apply.ApplyDetailsMapper">
+
+</mapper>

+ 16 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyMapper.java

@@ -0,0 +1,16 @@
+package com.fjhx.mapper.apply;
+
+import com.fjhx.entity.apply.Apply;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 物料申购 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+public interface ApplyMapper extends BaseMapper<Apply> {
+
+}

+ 5 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyMapper.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.mapper.apply.ApplyMapper">
+
+</mapper>

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

@@ -0,0 +1,16 @@
+package com.fjhx.mapper.supplier;
+
+import com.fjhx.entity.supplier.SupplierPriceChange;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 供应商价格维护变更记录 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+public interface SupplierPriceChangeMapper extends BaseMapper<SupplierPriceChange> {
+
+}

+ 5 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/supplier/SupplierPriceChangeMapper.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.mapper.supplier.SupplierPriceChangeMapper">
+
+</mapper>

+ 28 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyDetailsService.java

@@ -0,0 +1,28 @@
+package com.fjhx.service.apply;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.apply.ApplyDetails;
+import com.fjhx.params.apply.ApplyDetailsVo;
+import com.fjhx.base.StorageBaseService;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 物料申购明细 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+public interface ApplyDetailsService extends StorageBaseService<ApplyDetails> {
+
+    Page<ApplyDetails> getPage(Map<String, String> condition);
+
+    void add(ApplyDetailsVo applyDetailsVo);
+
+    void edit(ApplyDetailsVo applyDetailsVo);
+
+    void delete(ApplyDetailsVo applyDetailsVo);
+
+}

+ 33 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyService.java

@@ -0,0 +1,33 @@
+package com.fjhx.service.apply;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.apply.Apply;
+import com.fjhx.params.apply.ApplyVo;
+import com.fjhx.base.StorageBaseService;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 物料申购 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+public interface ApplyService extends StorageBaseService<Apply> {
+
+    Page<Apply> getPage(Map<String, String> condition);
+
+    void add(ApplyVo applyVo);
+
+    void edit(ApplyVo applyVo);
+
+    void delete(ApplyVo applyVo);
+
+    /**
+     * 获取申购单号
+     */
+    String getCode();
+
+}

+ 54 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyDetailsServiceImpl.java

@@ -0,0 +1,54 @@
+package com.fjhx.service.apply.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.apply.ApplyDetails;
+import com.fjhx.params.apply.ApplyDetailsVo;
+import com.fjhx.mapper.apply.ApplyDetailsMapper;
+import com.fjhx.service.apply.ApplyDetailsService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 物料申购明细 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Service
+public class ApplyDetailsServiceImpl extends ServiceImpl<ApplyDetailsMapper, ApplyDetails> implements ApplyDetailsService {
+
+    @Override
+    public Page<ApplyDetails> getPage(Map<String, String> condition) {
+
+        QueryWrapper<ApplyDetails> wrapper = Wrappers.query();
+
+        WrapperUtil.init(condition, wrapper)
+                .createTimeDesc();
+
+        Page<ApplyDetails> page = page(condition, wrapper);
+        return page;
+    }
+
+    @Override
+    public void add(ApplyDetailsVo applyDetailsVo) {
+        save(applyDetailsVo);
+    }
+
+    @Override
+    public void edit(ApplyDetailsVo applyDetailsVo) {
+        updateById(applyDetailsVo);
+    }
+
+    @Override
+    public void delete(ApplyDetailsVo applyDetailsVo) {
+        removeById(applyDetailsVo.getId());
+    }
+
+}

+ 61 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyServiceImpl.java

@@ -0,0 +1,61 @@
+package com.fjhx.service.apply.impl;
+
+import cn.hutool.core.date.DateUtil;
+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.apply.Apply;
+import com.fjhx.params.apply.ApplyVo;
+import com.fjhx.mapper.apply.ApplyMapper;
+import com.fjhx.service.apply.ApplyService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Date;
+import java.util.Map;
+
+/**
+ * <p>
+ * 物料申购 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Service
+public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements ApplyService {
+
+    @Override
+    public Page<Apply> getPage(Map<String, String> condition) {
+
+        QueryWrapper<Apply> wrapper = Wrappers.query();
+
+        WrapperUtil.init(condition, wrapper)
+                .createTimeDesc();
+
+        Page<Apply> page = page(condition, wrapper);
+        return page;
+    }
+
+    @Override
+    public void add(ApplyVo applyVo) {
+        save(applyVo);
+    }
+
+    @Override
+    public void edit(ApplyVo applyVo) {
+        updateById(applyVo);
+    }
+
+    @Override
+    public void delete(ApplyVo applyVo) {
+        removeById(applyVo.getId());
+    }
+
+    @Override
+    public String getCode() {
+        return "PB-"+ DateUtil.format(new Date(),"yyMMdd-HHmmss-SSS");
+    }
+
+}

+ 83 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/flow/InitiateApplyFlowService.java

@@ -0,0 +1,83 @@
+package com.fjhx.service.flow;
+
+import com.fjhx.constants.StatusConstant;
+import com.fjhx.entity.apply.ApplyDetails;
+import com.fjhx.enums.FlowStatusEnum;
+import com.fjhx.params.JumpVo;
+import com.fjhx.params.apply.ApplyVo;
+import com.fjhx.service.apply.ApplyDetailsService;
+import com.fjhx.service.apply.ApplyService;
+import com.fjhx.utils.ExampleAbstract;
+import com.fjhx.utils.FlowConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 发起申购
+ */
+@Service
+public class InitiateApplyFlowService {
+
+    @Autowired
+    private ApplyService applyService;
+
+    @Autowired
+    private ApplyDetailsService applyDetailsService;
+
+    private FlowConstructor getFlowConstructor() {
+        return FlowConstructor.init(new ExampleAbstract() {
+
+            @Override
+            public String getCode() {
+                return "js_initiateApply";
+            }
+
+            @Override
+            public void end() {
+                ApplyVo applyVo = getCacheData(ApplyVo.class);
+                applyVo.setFlowStatus(FlowStatusEnum.ADOPT.getType());
+                applyService.updateById(applyVo);
+            }
+
+            @Override
+            public void adopt() {
+                ApplyVo applyVo = getCacheData(ApplyVo.class);
+                applyVo.setFlowStatus(FlowStatusEnum.UNDER_WAY.getType());
+                applyService.updateById(applyVo);
+            }
+
+            @Override
+            public void reject() {
+                ApplyVo applyVo = getCacheData(ApplyVo.class);
+                applyVo.setFlowStatus(FlowStatusEnum.REJECT.getType());
+                applyService.updateById(applyVo);
+            }
+
+        });
+    }
+
+    public void create(ApplyVo applyVo) {
+
+        // 添加申购
+        applyVo.setFlowStatus(FlowStatusEnum.WAIT.getType());
+        applyVo.setSafetyStockCreate(StatusConstant.NO);
+        applyVo.setCode(applyService.getCode());
+        applyService.save(applyVo);
+
+        Long id = applyVo.getId();
+
+        // 添加申购明细
+        List<ApplyDetails> applyDetailsList = applyVo.getApplyDetailsList();
+        applyDetailsList.forEach(item -> item.setApplyId(id));
+        applyDetailsService.saveBatch(applyDetailsList);
+
+        getFlowConstructor().create(id, "发起申购", applyVo.getRemark(), applyVo);
+    }
+
+    public void jump(JumpVo jumpVo) {
+        getFlowConstructor().jump(jumpVo);
+    }
+
+}

+ 3 - 3
hx-service/storage-restructure/src/main/java/com/fjhx/service/flow/MaterialUpdateFlowService.java

@@ -1,7 +1,7 @@
 package com.fjhx.service.flow;
 
 import com.fjhx.entity.material.Material;
-import com.fjhx.params.FlowVo;
+import com.fjhx.params.JumpVo;
 import com.fjhx.service.material.MaterialService;
 import com.fjhx.utils.ExampleAbstract;
 import com.fjhx.utils.FlowConstructor;
@@ -38,8 +38,8 @@ public class MaterialUpdateFlowService {
         getFlowConstructor().create(material.getId(), "物料修改", "", material);
     }
 
-    public void jump(FlowVo flowVo) {
-        getFlowConstructor().jump(flowVo);
+    public void jump(JumpVo jumpVo) {
+        getFlowConstructor().jump(jumpVo);
     }
 
 }

+ 24 - 5
hx-service/storage-restructure/src/main/java/com/fjhx/service/flow/SupplierPriceUpdateFlow.java

@@ -1,8 +1,10 @@
 package com.fjhx.service.flow;
 
 import com.fjhx.entity.supplier.SupplierPrice;
-import com.fjhx.params.FlowVo;
+import com.fjhx.entity.supplier.SupplierPriceChange;
+import com.fjhx.params.JumpVo;
 import com.fjhx.params.supplier.SupplierPriceVo;
+import com.fjhx.service.supplier.SupplierPriceChangeService;
 import com.fjhx.service.supplier.SupplierPriceService;
 import com.fjhx.utils.ExampleAbstract;
 import com.fjhx.utils.FlowConstructor;
@@ -18,6 +20,9 @@ public class SupplierPriceUpdateFlow {
     @Autowired
     private SupplierPriceService supplierPriceService;
 
+    @Autowired
+    private SupplierPriceChangeService supplierPriceChangeService;
+
     private FlowConstructor getFlowConstructor() {
         return FlowConstructor.init(new ExampleAbstract() {
 
@@ -28,8 +33,22 @@ public class SupplierPriceUpdateFlow {
 
             @Override
             public void end() {
-                SupplierPrice supplierPrice = getCacheData(SupplierPrice.class);
-                supplierPriceService.updateById(supplierPrice);
+
+                SupplierPriceVo supplierPriceVo = getCacheData(SupplierPriceVo.class);
+
+                // 添加价格变更记录
+                SupplierPrice supplierPrice = supplierPriceService.getById(supplierPriceVo.getId());
+                SupplierPriceChange supplierPriceChange = new SupplierPriceChange();
+                supplierPriceChange.setSupplierPriceId(supplierPrice.getId());
+                supplierPriceChange.setSupplierId(supplierPrice.getSupplierId());
+                supplierPriceChange.setMaterialId(supplierPrice.getMaterialId());
+                supplierPriceChange.setOldPrice(supplierPrice.getPrice());
+                supplierPriceChange.setNewPrice(supplierPriceVo.getPrice());
+                supplierPriceChange.setRemark(supplierPriceVo.getRemarks());
+                supplierPriceChangeService.save(supplierPriceChange);
+
+                // 变更价格
+                supplierPriceService.updateById(supplierPriceVo);
             }
 
         });
@@ -39,8 +58,8 @@ public class SupplierPriceUpdateFlow {
         getFlowConstructor().create(supplierPriceVo.getId(), "价格维护", supplierPriceVo.getRemarks(), supplierPriceVo);
     }
 
-    public void jump(FlowVo flowVo) {
-        getFlowConstructor().jump(flowVo);
+    public void jump(JumpVo jumpVo) {
+        getFlowConstructor().jump(jumpVo);
     }
 
 }

+ 28 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/SupplierPriceChangeService.java

@@ -0,0 +1,28 @@
+package com.fjhx.service.supplier;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.supplier.SupplierPriceChange;
+import com.fjhx.params.supplier.SupplierPriceChangeVo;
+import com.fjhx.base.StorageBaseService;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商价格维护变更记录 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+public interface SupplierPriceChangeService extends StorageBaseService<SupplierPriceChange> {
+
+    Page<SupplierPriceChange> getPage(Map<String, String> condition);
+
+    void add(SupplierPriceChangeVo supplierPriceChangeVo);
+
+    void edit(SupplierPriceChangeVo supplierPriceChangeVo);
+
+    void delete(SupplierPriceChangeVo supplierPriceChangeVo);
+
+}

+ 54 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/impl/SupplierPriceChangeServiceImpl.java

@@ -0,0 +1,54 @@
+package com.fjhx.service.supplier.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.supplier.SupplierPriceChange;
+import com.fjhx.params.supplier.SupplierPriceChangeVo;
+import com.fjhx.mapper.supplier.SupplierPriceChangeMapper;
+import com.fjhx.service.supplier.SupplierPriceChangeService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+import java.util.Map;
+
+/**
+ * <p>
+ * 供应商价格维护变更记录 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-13
+ */
+@Service
+public class SupplierPriceChangeServiceImpl extends ServiceImpl<SupplierPriceChangeMapper, SupplierPriceChange> implements SupplierPriceChangeService {
+
+    @Override
+    public Page<SupplierPriceChange> getPage(Map<String, String> condition) {
+
+        QueryWrapper<SupplierPriceChange> wrapper = Wrappers.query();
+
+        WrapperUtil.init(condition, wrapper)
+                .createTimeDesc();
+
+        Page<SupplierPriceChange> page = page(condition, wrapper);
+        return page;
+    }
+
+    @Override
+    public void add(SupplierPriceChangeVo supplierPriceChangeVo) {
+        save(supplierPriceChangeVo);
+    }
+
+    @Override
+    public void edit(SupplierPriceChangeVo supplierPriceChangeVo) {
+        updateById(supplierPriceChangeVo);
+    }
+
+    @Override
+    public void delete(SupplierPriceChangeVo supplierPriceChangeVo) {
+        removeById(supplierPriceChangeVo.getId());
+    }
+
+}

+ 8 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/supplier/impl/SupplierPriceServiceImpl.java

@@ -1,12 +1,14 @@
 package com.fjhx.service.supplier.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.entity.supplier.SupplierPrice;
 import com.fjhx.mapper.supplier.SupplierPriceMapper;
 import com.fjhx.params.supplier.SupplierPriceVo;
 import com.fjhx.service.supplier.SupplierPriceService;
+import com.fjhx.utils.Assert;
 import com.fjhx.utils.WrapperUtil;
 import org.springframework.stereotype.Service;
 
@@ -38,6 +40,12 @@ public class SupplierPriceServiceImpl extends ServiceImpl<SupplierPriceMapper, S
 
     @Override
     public void add(SupplierPriceVo supplierPriceVo) {
+        int count = count(Wrappers.<SupplierPrice>lambdaQuery()
+                .eq(SupplierPrice::getSupplierId, supplierPriceVo.getSupplierId())
+                .eq(SupplierPrice::getMaterialId, supplierPriceVo.getMaterialId()));
+
+        Assert.eqZero(count, "物料价格维护已存在");
+
         save(supplierPriceVo);
     }