home há 2 anos atrás
pai
commit
183b8cf688
27 ficheiros alterados com 640 adições e 319 exclusões
  1. 72 0
      hx-common/common-tool/src/main/java/com/fjhx/base/Condition.java
  2. 1 0
      hx-common/service-flow/src/main/java/com/fjhx/service/example/impl/ExampleInfoServiceImpl.java
  3. 2 2
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/ApplyPurchase.java
  4. 7 9
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/ApplyPurchaseDetails.java
  5. 3 3
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseDetailsEx.java
  6. 3 3
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseDetailsVo.java
  7. 3 3
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseEx.java
  8. 5 5
      hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseVo.java
  9. 0 57
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyController.java
  10. 80 0
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyPurchaseController.java
  11. 14 14
      hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyPurchaseDetailsController.java
  12. 0 16
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyMapper.java
  13. 0 5
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyMapper.xml
  14. 3 3
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseDetailsMapper.java
  15. 1 1
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseDetailsMapper.xml
  16. 25 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseMapper.java
  17. 24 0
      hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseMapper.xml
  18. 0 28
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyDetailsService.java
  19. 28 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyPurchaseDetailsService.java
  20. 30 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyPurchaseService.java
  21. 0 33
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyService.java
  22. 0 54
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyDetailsServiceImpl.java
  23. 54 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyPurchaseDetailsServiceImpl.java
  24. 262 0
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyPurchaseServiceImpl.java
  25. 0 61
      hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/impl/ApplyServiceImpl.java
  26. 22 22
      hx-service/storage-restructure/src/main/java/com/fjhx/service/flow/InitiateApplyFlowService.java
  27. 1 0
      hx-service/storage/src/main/java/com/fjhx/stock/service/impl/StockTransferServiceImpl.java

+ 72 - 0
hx-common/common-tool/src/main/java/com/fjhx/base/Condition.java

@@ -0,0 +1,72 @@
+package com.fjhx.base;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.fjhx.utils.Assert;
+import org.springblade.core.log.exception.ServiceException;
+
+import java.util.Date;
+import java.util.HashMap;
+
+/**
+ * 条件实体
+ */
+public class Condition extends HashMap<String, Object> {
+
+    /**
+     * 开始时间
+     */
+    public Date getBeginTime() {
+        Object beginTimeObj = this.get("beginTime");
+        Assert.notEmpty(beginTimeObj, "开始时间不能为空");
+        Date beginTime;
+        try {
+            beginTime = DateUtil.beginOfDay(DateUtil.parse(beginTimeObj.toString()));
+        } catch (Exception e) {
+            throw new ServiceException("开始时间格式错误");
+        }
+        return beginTime;
+    }
+
+    /**
+     * 结束时间
+     */
+    public Date getEndTime() {
+        Object endTimeObj = this.get("endTime");
+        Assert.notEmpty(endTimeObj, "结束时间不能为空");
+        Date endTime;
+        try {
+            endTime = DateUtil.endOfDay(DateUtil.parse(endTimeObj.toString()));
+        } catch (Exception e) {
+            throw new ServiceException("结束时间格式错误");
+        }
+        return endTime;
+    }
+
+    /**
+     * 关键字
+     */
+    public String getKeyword() {
+        return getStr("keyword");
+    }
+
+    /**
+     * 获取字符串
+     */
+    public String getStr(String str) {
+        Object value = super.get(str);
+        if (ObjectUtil.isEmpty(value)) {
+            return null;
+        }
+        return value.toString();
+    }
+
+    /**
+     * 获取int
+     */
+    public Integer getInt(String str) {
+        return Convert.toInt(get(str));
+    }
+
+}

+ 1 - 0
hx-common/service-flow/src/main/java/com/fjhx/service/example/impl/ExampleInfoServiceImpl.java

@@ -114,6 +114,7 @@ public class ExampleInfoServiceImpl extends ServiceImpl<ExampleInfoMapper, Examp
                 List<HashMap<Object, Object>> collect = list.stream().map(ProcessNodeButtonItem -> {
                     HashMap<Object, Object> itemResult = new HashMap<>();
                     itemResult.put("id", ProcessNodeButtonItem.getId());
+                    itemResult.put("type", ProcessNodeButtonItem.getNameType());
                     itemResult.put("typeName", ButtonNameEnum.getName(ProcessNodeButtonItem.getNameType()));
                     return itemResult;
                 }).collect(Collectors.toList());

+ 2 - 2
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/Apply.java → hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/ApplyPurchase.java

@@ -16,11 +16,11 @@ import lombok.EqualsAndHashCode;
  * </p>
  *
  * @author ${author}
- * @since 2022-09-13
+ * @since 2022-09-14
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class Apply extends StorageBaseEntity {
+public class ApplyPurchase extends StorageBaseEntity {
 
 
     /**

+ 7 - 9
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/ApplyDetails.java → hx-service-api/storage-restructure-api/src/main/java/com/fjhx/entity/apply/ApplyPurchaseDetails.java

@@ -1,33 +1,31 @@
 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 com.baomidou.mybatisplus.annotation.TableLogic;
+import com.fjhx.base.StorageBaseEntity;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
+import java.math.BigDecimal;
+
 /**
  * <p>
  * 物料申购明细
  * </p>
  *
  * @author ${author}
- * @since 2022-09-13
+ * @since 2022-09-14
  */
 @Data
 @EqualsAndHashCode(callSuper = true)
-public class ApplyDetails extends StorageBaseEntity {
+public class ApplyPurchaseDetails extends StorageBaseEntity {
 
 
     /**
      * 申购id
      */
-    private Long applyId;
+    private Long applyPurchaseId;
 
     /**
      * 物料id

+ 3 - 3
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyDetailsEx.java → hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseDetailsEx.java

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

+ 3 - 3
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyDetailsVo.java → hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseDetailsVo.java

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

+ 3 - 3
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyEx.java → hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseEx.java

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

+ 5 - 5
hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyVo.java → hx-service-api/storage-restructure-api/src/main/java/com/fjhx/params/apply/ApplyPurchaseVo.java

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

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

@@ -1,57 +0,0 @@
-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();
-//    }
-
-}
-

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

@@ -0,0 +1,80 @@
+package com.fjhx.controller.apply;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.base.Condition;
+import com.fjhx.params.JumpVo;
+import com.fjhx.params.apply.ApplyPurchaseVo;
+import com.fjhx.service.flow.InitiateApplyFlowService;
+import org.springblade.core.tool.api.R;
+import com.fjhx.service.apply.ApplyPurchaseService;
+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.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 物料申购 前端控制器
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-14
+ */
+@RestController
+@RequestMapping("/applyPurchase")
+public class ApplyPurchaseController {
+
+    @Autowired
+    private ApplyPurchaseService applyPurchaseService;
+
+    @Autowired
+    private InitiateApplyFlowService initiateApplyFlowService;
+
+    /**
+     * 发起申购流程
+     */
+    @PostMapping("/addFlowCreate")
+    public R addFlowCreate(@RequestBody ApplyPurchaseVo applyPurchaseVo) {
+        initiateApplyFlowService.create(applyPurchaseVo);
+        return R.success();
+    }
+
+    /**
+     * 发起申购跳转
+     */
+    @PostMapping("/addFlowJump")
+    public R addFlowJump(@RequestBody JumpVo jumpVo) {
+        initiateApplyFlowService.jump(jumpVo);
+        return R.success();
+    }
+
+    /**
+     * 物料类型统计
+     */
+    @PostMapping("typeStatistics")
+    public R getTypeStatistics(@RequestBody Condition condition) {
+        Map<Integer, Map<String, Object>> result = applyPurchaseService.typeStatistics(condition);
+        return R.success(result);
+    }
+
+    /**
+     * 按审批状态统计
+     */
+    @PostMapping("/flowStatistics")
+    public R flowStatistics(@RequestBody Condition condition) {
+        List<Map<String, Object>> result = applyPurchaseService.flowStatistics(condition);
+        return R.success(result);
+    }
+
+    @PostMapping("/page")
+    public R page(@RequestBody Condition condition) {
+        Page<Map<String, Object>> result = applyPurchaseService.getPage(condition);
+        return R.success(result);
+    }
+
+}
+

+ 14 - 14
hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyDetailsController.java → hx-service/storage-restructure/src/main/java/com/fjhx/controller/apply/ApplyPurchaseDetailsController.java

@@ -2,9 +2,9 @@ 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 com.fjhx.entity.apply.ApplyPurchaseDetails;
+import com.fjhx.params.apply.ApplyPurchaseDetailsVo;
+import com.fjhx.service.apply.ApplyPurchaseDetailsService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -19,36 +19,36 @@ import java.util.Map;
  * </p>
  *
  * @author ${author}
- * @since 2022-09-13
+ * @since 2022-09-14
  */
 @RestController
-@RequestMapping("/applyDetails")
-public class ApplyDetailsController {
+@RequestMapping("/applyPurchaseDetails")
+public class ApplyPurchaseDetailsController {
 
     @Autowired
-    private ApplyDetailsService applyDetailsService;
+    private ApplyPurchaseDetailsService applyPurchaseDetailsService;
 
     @PostMapping("/page")
     public R page(@RequestBody Map<String, String> condition){
-        Page<ApplyDetails> result = applyDetailsService.getPage(condition);
+        Page<ApplyPurchaseDetails> result = applyPurchaseDetailsService.getPage(condition);
         return R.success(result);
     }
 
     @PostMapping("/add")
-    public R add(@RequestBody ApplyDetailsVo applyDetailsVo){
-        applyDetailsService.add(applyDetailsVo);
+    public R add(@RequestBody ApplyPurchaseDetailsVo applyPurchaseDetailsVo){
+        applyPurchaseDetailsService.add(applyPurchaseDetailsVo);
         return R.success();
     }
 
     @PostMapping("/edit")
-    public R edit(@RequestBody ApplyDetailsVo applyDetailsVo){
-        applyDetailsService.edit(applyDetailsVo);
+    public R edit(@RequestBody ApplyPurchaseDetailsVo applyPurchaseDetailsVo){
+        applyPurchaseDetailsService.edit(applyPurchaseDetailsVo);
         return R.success();
     }
 
     @PostMapping("/delete")
-    public R delete(@RequestBody ApplyDetailsVo applyDetailsVo){
-        applyDetailsService.delete(applyDetailsVo);
+    public R delete(@RequestBody ApplyPurchaseDetailsVo applyPurchaseDetailsVo){
+        applyPurchaseDetailsService.delete(applyPurchaseDetailsVo);
         return R.success();
     }
 

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

@@ -1,16 +0,0 @@
-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> {
-
-}

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

+ 3 - 3
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyDetailsMapper.java → hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseDetailsMapper.java

@@ -1,6 +1,6 @@
 package com.fjhx.mapper.apply;
 
-import com.fjhx.entity.apply.ApplyDetails;
+import com.fjhx.entity.apply.ApplyPurchaseDetails;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
 /**
@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * </p>
  *
  * @author ${author}
- * @since 2022-09-13
+ * @since 2022-09-14
  */
-public interface ApplyDetailsMapper extends BaseMapper<ApplyDetails> {
+public interface ApplyPurchaseDetailsMapper extends BaseMapper<ApplyPurchaseDetails> {
 
 }

+ 1 - 1
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyDetailsMapper.xml → hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseDetailsMapper.xml

@@ -1,5 +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 namespace="com.fjhx.mapper.apply.ApplyPurchaseDetailsMapper">
 
 </mapper>

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

@@ -0,0 +1,25 @@
+package com.fjhx.mapper.apply;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fjhx.entity.apply.ApplyPurchase;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 物料申购 Mapper 接口
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-14
+ */
+public interface ApplyPurchaseMapper extends BaseMapper<ApplyPurchase> {
+
+    List<Map<String, Object>> getTypeStatisticsList(@Param("ew") QueryWrapper<Object> wrapper);
+
+    List<Map<String, Object>> flowStatistics(@Param("ew") QueryWrapper<Object> wrapper);
+
+}

+ 24 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/mapper/apply/ApplyPurchaseMapper.xml

@@ -0,0 +1,24 @@
+<?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.ApplyPurchaseMapper">
+
+    <select id="getTypeStatisticsList" resultType="java.util.Map">
+        select ap.flow_status,
+               m.technology_type type,
+               m.width,
+               apd.quantity
+        from apply_purchase ap
+                 left join apply_purchase_details apd on ap.id = apd.apply_purchase_id
+                 left join material m on m.id = apd.material_id
+            ${ew.customSqlSegment}
+    </select>
+
+    <select id="flowStatistics" resultType="java.util.Map">
+        select count(0) count, ap.flow_status
+        from apply_purchase ap
+                 inner join apply_purchase_details apd on ap.id = apd.apply_purchase_id
+                 left join material m on apd.material_id = m.id
+            ${ew.customSqlSegment}
+    </select>
+
+</mapper>

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

@@ -1,28 +0,0 @@
-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);
-
-}

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

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

+ 30 - 0
hx-service/storage-restructure/src/main/java/com/fjhx/service/apply/ApplyPurchaseService.java

@@ -0,0 +1,30 @@
+package com.fjhx.service.apply;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.base.Condition;
+import com.fjhx.entity.apply.ApplyPurchase;
+import com.fjhx.params.apply.ApplyPurchaseVo;
+import com.fjhx.base.StorageBaseService;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 物料申购 服务类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-14
+ */
+public interface ApplyPurchaseService extends StorageBaseService<ApplyPurchase> {
+
+    String getCode();
+
+    Map<Integer, Map<String, Object>> typeStatistics(Condition condition);
+
+    List<Map<String, Object>> flowStatistics(Condition condition);
+
+    Page<Map<String, Object>> getPage(Condition condition);
+
+}

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

@@ -1,33 +0,0 @@
-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();
-
-}

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

@@ -1,54 +0,0 @@
-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());
-    }
-
-}

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

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

@@ -0,0 +1,262 @@
+package com.fjhx.service.apply.impl;
+
+import cn.hutool.core.convert.Convert;
+import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.ObjectUtil;
+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.base.Condition;
+import com.fjhx.entity.apply.ApplyPurchase;
+import com.fjhx.mapper.apply.ApplyPurchaseMapper;
+import com.fjhx.service.apply.ApplyPurchaseService;
+import com.fjhx.utils.BigDecimalUtil;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * <p>
+ * 物料申购 服务实现类
+ * </p>
+ *
+ * @author ${author}
+ * @since 2022-09-14
+ */
+@Service
+public class ApplyPurchaseServiceImpl extends ServiceImpl<ApplyPurchaseMapper, ApplyPurchase> implements ApplyPurchaseService {
+
+    @Override
+    public String getCode() {
+        return "PB-" + DateUtil.format(new Date(), "yyMMdd-HHmmss-SSS");
+    }
+
+    @Override
+    public Map<Integer, Map<String, Object>> typeStatistics(Condition condition) {
+
+        Map<Integer, Map<String, Object>> result = new HashMap<>();
+
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        String keyword = condition.getKeyword();
+
+        // 查询条件
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ap.create_time", beginTime, endTime)
+                .and(ObjectUtil.isNotEmpty(keyword), q -> q.like("m.name", keyword).or().like("m.code", keyword))
+                .orderByDesc("apd.id");
+
+        List<Map<String, Object>> list = baseMapper.getTypeStatisticsList(wrapper);
+
+        Map<Integer, List<Map<String, Object>>> mapByType = list.stream()
+                .collect(Collectors.groupingBy(item -> Convert.toInt(item.get("type"))));
+
+        // 面料申购统计(0直喷 + 1热转 + 2打纸 + 4其他)
+        Map<String, Object> fabricMap = null;
+
+        for (int i = 0; i < 5; i++) {
+            Map<String, Object> typeStatistics = getTypeStatistics(i, mapByType.get(i));
+            result.put(i, typeStatistics);
+
+            if (i != 3) {
+                if (fabricMap == null) {
+                    fabricMap = ObjectUtil.clone(typeStatistics);
+                    fabricMap.put("technologyType", 5);
+                } else {
+                    fabricMap.put("num", Convert.toInt(fabricMap.get("num")) + Convert.toInt(typeStatistics.get("num")));
+                    fabricMap.put("purchaseQty", BigDecimalUtil.add(fabricMap.get("purchaseQty"), typeStatistics.get("purchaseQty")));
+                    fabricMap.put("area", BigDecimalUtil.add(fabricMap.get("area"), typeStatistics.get("area")));
+                }
+            }
+        }
+        result.put(5, fabricMap);
+
+        return result;
+    }
+
+    @Override
+    public List<Map<String, Object>> flowStatistics(Condition condition) {
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        String keyword = condition.getKeyword();
+        Integer technologyType = condition.getInt("technologyType");
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ap.create_time", beginTime, endTime)
+                .and(ObjectUtil.isNotEmpty(keyword), q -> q.like("m.Code", keyword).or().like("m.Name", keyword))
+                .func(ObjectUtil.isNotEmpty(technologyType), q -> {
+                    if (technologyType.equals(5)) {
+                        q.in("m.technology_type", 0, 1, 2, 4);
+                    } else {
+                        q.eq("m.technology_type", technologyType);
+                    }
+                })
+                .groupBy("ap.flow_status");
+
+        List<Map<String, Object>> list = baseMapper.flowStatistics(wrapper);
+
+        Map<Integer, Long> collect = list.stream().collect(Collectors.toMap(
+                item -> (Integer) item.get("flowStatus"),
+                item -> (Long) item.get("count")
+        ));
+
+        Map<String, Object> approvedMap = new HashMap<>();
+        approvedMap.put("key", "审批中");
+        approvedMap.put("value", 1);
+        approvedMap.put("count", (collect.get(0) == null ? 0 : collect.get(0)) + (collect.get(1) == null ? 0 : collect.get(1)));
+
+        Map<String, Object> passedMap = new HashMap<>();
+        passedMap.put("key", "已通过");
+        passedMap.put("value", 2);
+        passedMap.put("count", collect.get(2) == null ? 0 : collect.get(2));
+
+        Map<String, Object> rejectedMap = new HashMap<>();
+        rejectedMap.put("key", "已驳回");
+        rejectedMap.put("value", 3);
+        rejectedMap.put("count", collect.get(3) == null ? 0 : collect.get(3));
+
+        Map<String, Object> wholeMap = new HashMap<>();
+        wholeMap.put("key", "全部");
+        wholeMap.put("count", (Long) approvedMap.get("count") + (Long) passedMap.get("count") + (Long) rejectedMap.get("count"));
+
+        return Arrays.asList(wholeMap, approvedMap, rejectedMap, passedMap);
+    }
+
+    @Override
+    public Page<Map<String, Object>> getPage(Condition condition) {
+        String keyword = condition.getKeyword();
+        Date beginTime = condition.getBeginTime();
+        Date endTime = condition.getEndTime();
+        Integer technologyType = condition.getInt("technologyType");
+        Integer status = condition.getInt("status");
+
+        QueryWrapper<Object> wrapper = Wrappers.query()
+                .between("ap.create_time", beginTime, endTime)
+                .and(ObjectUtil.isNotEmpty(keyword), q -> q.like("m.Code", keyword).or().like("m.Name", keyword))
+                .func(ObjectUtil.isNotEmpty(technologyType), q -> {
+                    if (technologyType.equals(5)) {
+                        q.in("m.technology_type", 0, 1, 2, 4);
+                    } else {
+                        q.eq("m.technology_type", technologyType);
+                    }
+                })
+                .func(ObjectUtil.isNotEmpty(status), q -> {
+                    if (status.equals(1)) {
+                        q.in("ap.flow_status", 0, 1);
+                    } else {
+                        q.eq("ap.flow_status", status);
+                    }
+                })
+                .orderByAsc("pc.PurContractState")
+                .orderByDesc("ap.CreatedTime");
+
+//        Page<Map<String, Object>> page = baseMapper.getPage(createPage(condition), wrapper);
+//
+//        List<Map<String, Object>> records = page.getRecords();
+//        if (records.size() == 0) {
+//            return page;
+//        }
+
+//        // 获取物料编码集合
+//        List<String> materialCodeList = records.stream()
+//                .map(item -> item.get("materialCode").toString()).collect(Collectors.toList());
+//
+//        // 查询库存,最长滞留时间和滞留超过30天数量
+//        Date date = new Date();
+//        DateTime dateTime = DateUtil.offsetDay(date, -30);
+//        Map<String, Map<String, Object>> delayMap = baseMapper.selectDelay(
+//                dateTime,
+//                Wrappers.query().in("sd.MaterialCode", materialCodeList).groupBy("sd.MaterialCode")
+//        );
+//
+//        // 近30天消耗量
+//        Map<String, Object> consumeMap = stockWaterService.listMaps(
+//                Wrappers.<StockWater>query().select("sum(TotalQty) overUseQty", "MaterialCode materialCode")
+//                        .lambda()
+//                        .in(StockWater::getStockchangetype, 20, 23)
+//                        .gt(StockWater::getCreatedtime, dateTime)
+//                        .groupBy(StockWater::getMaterialcode)
+//        ).stream().collect(Collectors.toMap(
+//                item -> item.get("materialCode").toString(),
+//                item -> item.get("overUseQty")
+//        ));
+//
+//        for (Map<String, Object> record : records) {
+//            String materialCode = record.get("materialCode").toString();
+//            Map<String, Object> map = delayMap.get(materialCode);
+//
+//            if (map != null) {
+//                record.putAll(map);
+//                record.put("maxDelayTime", DateUtil.betweenDay(date, (Date) map.get("maxDelayTime"), true));
+//            }
+//
+//            record.putIfAbsent("stockQty", 0);
+//            record.putIfAbsent("maxDelayTime", 0);
+//            record.putIfAbsent("delayQuantity", 0);
+//
+//            Object overUseQty = consumeMap.get(materialCode);
+//            record.put("overUseQty", overUseQty == null ? BigDecimal.ZERO : overUseQty);
+//
+//            record.put("purchaseQty", BigDecimalUtil.keepDecimals(record.get("purchaseQty")));
+//            record.put("onWayQuantity", BigDecimalUtil.keepDecimals(record.get("onWayQuantity")));
+//
+//            int purContractState = Integer.parseInt(record.get("purContractState").toString());
+//            switch (purContractState) {
+//                case 0:
+//                    record.put("purContractState", "待确认");
+//                    break;
+//                case 1:
+//                    record.put("purContractState", "审批中");
+//                    break;
+//                case 2:
+//                    record.put("purContractState", "进行中");
+//                    break;
+//                case 3:
+//                    record.put("purContractState", "已完成");
+//            }
+//        }
+
+        return null;
+    }
+
+    /**
+     * 根据类型统计物料采购情况
+     */
+    private Map<String, Object> getTypeStatistics(int technologyType, List<Map<String, Object>> list) {
+
+        HashMap<String, Object> map = new HashMap<>();
+
+        int num = 0;
+        BigDecimal purchaseQty = BigDecimal.ZERO;
+        BigDecimal area = BigDecimal.ZERO;
+
+        if (ObjectUtil.isNotEmpty(list)) {
+            for (Map<String, Object> item : list) {
+
+                BigDecimal quantity = Convert.toBigDecimal(item.get("quantity"));
+                BigDecimal width = Convert.toBigDecimal(item.get("width"));
+
+                num++;
+                purchaseQty = purchaseQty.add(BigDecimalUtil.keepDecimals(quantity, 1));
+                if (technologyType != 3) {
+                    area = area.add(BigDecimalUtil.init(quantity).multiply(width).divide(100, 1).getValue());
+                }
+
+            }
+        }
+
+        // 统计
+        map.put("technologyType", technologyType);
+        map.put("num", num);
+        map.put("purchaseQty", purchaseQty);
+        if (technologyType != 3) {
+            map.put("area", area);
+        }
+
+        return map;
+    }
+
+}

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

@@ -1,61 +0,0 @@
-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");
-    }
-
-}

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

@@ -1,12 +1,12 @@
 package com.fjhx.service.flow;
 
 import com.fjhx.constants.StatusConstant;
-import com.fjhx.entity.apply.ApplyDetails;
+import com.fjhx.entity.apply.ApplyPurchaseDetails;
 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.params.apply.ApplyPurchaseVo;
+import com.fjhx.service.apply.ApplyPurchaseDetailsService;
+import com.fjhx.service.apply.ApplyPurchaseService;
 import com.fjhx.utils.ExampleAbstract;
 import com.fjhx.utils.FlowConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -21,10 +21,10 @@ import java.util.List;
 public class InitiateApplyFlowService {
 
     @Autowired
-    private ApplyService applyService;
+    private ApplyPurchaseService applyPurchaseService;
 
     @Autowired
-    private ApplyDetailsService applyDetailsService;
+    private ApplyPurchaseDetailsService applyPurchaseDetailsService;
 
     private FlowConstructor getFlowConstructor() {
         return FlowConstructor.init(new ExampleAbstract() {
@@ -36,44 +36,44 @@ public class InitiateApplyFlowService {
 
             @Override
             public void end() {
-                ApplyVo applyVo = getCacheData(ApplyVo.class);
+                ApplyPurchaseVo applyVo = getCacheData(ApplyPurchaseVo.class);
                 applyVo.setFlowStatus(FlowStatusEnum.ADOPT.getType());
-                applyService.updateById(applyVo);
+                applyPurchaseService.updateById(applyVo);
             }
 
             @Override
             public void adopt() {
-                ApplyVo applyVo = getCacheData(ApplyVo.class);
+                ApplyPurchaseVo applyVo = getCacheData(ApplyPurchaseVo.class);
                 applyVo.setFlowStatus(FlowStatusEnum.UNDER_WAY.getType());
-                applyService.updateById(applyVo);
+                applyPurchaseService.updateById(applyVo);
             }
 
             @Override
             public void reject() {
-                ApplyVo applyVo = getCacheData(ApplyVo.class);
+                ApplyPurchaseVo applyVo = getCacheData(ApplyPurchaseVo.class);
                 applyVo.setFlowStatus(FlowStatusEnum.REJECT.getType());
-                applyService.updateById(applyVo);
+                applyPurchaseService.updateById(applyVo);
             }
 
         });
     }
 
-    public void create(ApplyVo applyVo) {
+    public void create(ApplyPurchaseVo applyPurchaseVo) {
 
         // 添加申购
-        applyVo.setFlowStatus(FlowStatusEnum.WAIT.getType());
-        applyVo.setSafetyStockCreate(StatusConstant.NO);
-        applyVo.setCode(applyService.getCode());
-        applyService.save(applyVo);
+        applyPurchaseVo.setFlowStatus(FlowStatusEnum.WAIT.getType());
+        applyPurchaseVo.setSafetyStockCreate(StatusConstant.NO);
+        applyPurchaseVo.setCode(applyPurchaseService.getCode());
+        applyPurchaseService.save(applyPurchaseVo);
 
-        Long id = applyVo.getId();
+        Long id = applyPurchaseVo.getId();
 
         // 添加申购明细
-        List<ApplyDetails> applyDetailsList = applyVo.getApplyDetailsList();
-        applyDetailsList.forEach(item -> item.setApplyId(id));
-        applyDetailsService.saveBatch(applyDetailsList);
+        List<ApplyPurchaseDetails> applyDetailsList = applyPurchaseVo.getApplyDetailsList();
+        applyDetailsList.forEach(item -> item.setApplyPurchaseId(id));
+        applyPurchaseDetailsService.saveBatch(applyDetailsList);
 
-        getFlowConstructor().create(id, "发起申购", applyVo.getRemark(), applyVo);
+        getFlowConstructor().create(id, "发起申购", applyPurchaseVo.getRemark(), applyPurchaseVo);
     }
 
     public void jump(JumpVo jumpVo) {

+ 1 - 0
hx-service/storage/src/main/java/com/fjhx/stock/service/impl/StockTransferServiceImpl.java

@@ -112,6 +112,7 @@ public class StockTransferServiceImpl extends ServiceImpl<StockTransferMapper, S
     public void check(StockTransferVo stockTransferVo) {
         Assert.notEmpty(stockTransferVo.getCheckUser(), "复核人账号不能为空");
         stockTransferVo.setCheckTime(new Date());
+        stockTransferVo.setStatus(StatusConstant.YES);
         updateById(stockTransferVo);
 
         List<StockTransferDetails> stockTransferDetailsList = stockTransferVo.getStockTransferDetailsList();