Bläddra i källkod

优化成本计算接口

wangqiong 1 år sedan
förälder
incheckning
1a2dee14e4

+ 18
- 3
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/controller/AppSceneCostCountController.java Visa fil

@@ -4,7 +4,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
6 6
 import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
7
+import com.zzsmart.qomo.kn.cost.manage.enums.CostCountStatusEnum;
7 8
 import com.zzsmart.qomo.kn.cost.manage.service.IAppSceneCostCountService;
9
+import com.zzsmart.qomo.kn.cost.manage.vo.AppSceneCostCountVO;
8 10
 import com.zzsmart.qomo.kn.cost.manage.vo.MissingComponentVO;
9 11
 import io.swagger.annotations.Api;
10 12
 import io.swagger.annotations.ApiOperation;
@@ -14,12 +16,14 @@ import org.jeecg.common.api.vo.Result;
14 16
 import org.jeecg.common.aspect.annotation.AutoLog;
15 17
 import org.jeecg.common.system.base.controller.JeecgController;
16 18
 import org.jeecg.common.system.query.QueryGenerator;
19
+import org.springframework.beans.BeanUtils;
17 20
 import org.springframework.beans.factory.annotation.Autowired;
18 21
 import org.springframework.web.bind.annotation.*;
19 22
 import org.springframework.web.servlet.ModelAndView;
20 23
 
21 24
 import javax.servlet.http.HttpServletRequest;
22 25
 import javax.servlet.http.HttpServletResponse;
26
+import java.util.ArrayList;
23 27
 import java.util.Arrays;
24 28
 import java.util.List;
25 29
 
@@ -49,11 +53,22 @@ public class AppSceneCostCountController extends JeecgController<AppSceneCostCou
49 53
     //@AutoLog(value = "app_scene_cost_count-分页列表查询")
50 54
     @ApiOperation(value = "标准成本计算-分页列表查询", notes = "标准成本计算-分页列表查询")
51 55
     @GetMapping(value = "/list")
52
-    public Result<IPage<AppSceneCostCount>> queryPageList(AppSceneCostCount appSceneCostCount, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
56
+    public Result<IPage<AppSceneCostCountVO>> queryPageList(AppSceneCostCount appSceneCostCount, @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) {
53 57
         QueryWrapper<AppSceneCostCount> queryWrapper = QueryGenerator.initQueryWrapper(appSceneCostCount, req.getParameterMap());
54 58
         Page<AppSceneCostCount> page = new Page<AppSceneCostCount>(pageNo, pageSize);
55 59
         IPage<AppSceneCostCount> pageList = appSceneCostCountService.page(page, queryWrapper);
56
-        return Result.OK(pageList);
60
+        IPage<AppSceneCostCountVO> pageList1 = new Page<>();
61
+        BeanUtils.copyProperties(pageList, pageList1);
62
+        List<AppSceneCostCountVO>list=new ArrayList<>();
63
+        for(int i=0;i<pageList.getRecords().size();i++){
64
+            AppSceneCostCount appSceneCostCount1 = pageList.getRecords().get(i);
65
+            AppSceneCostCountVO appSceneCostCountVO = new AppSceneCostCountVO();
66
+            BeanUtils.copyProperties(appSceneCostCount1, appSceneCostCountVO);
67
+            appSceneCostCountVO.setStatusName(CostCountStatusEnum.getTextByValue(appSceneCostCount1.getStatus()));
68
+            list.add(appSceneCostCountVO);
69
+        }
70
+        pageList1.setRecords(list);
71
+        return Result.OK(pageList1);
57 72
     }
58 73
 
59 74
     /**
@@ -64,7 +79,7 @@ public class AppSceneCostCountController extends JeecgController<AppSceneCostCou
64 79
      */
65 80
     @AutoLog(value = "app_scene_cost_count-添加")
66 81
     @ApiOperation(value = "添加标准成本计算任务", notes = "添加标准成本计算任务")
67
-    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_count:addCostCountTask")
82
+//    @RequiresPermissions("com.zzsmart.qomo.kn.cost.manage:app_scene_cost_count:addCostCountTask")
68 83
     @PostMapping(value = "/addCostCountTask")
69 84
     public Result<String> addCostCountTask(@RequestBody AppSceneCostCount appSceneCostCount) {
70 85
         appSceneCostCountService.addCostCountTask(appSceneCostCount);

+ 58
- 37
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostCount.java Visa fil

@@ -1,85 +1,106 @@
1 1
 package com.zzsmart.qomo.kn.cost.manage.entity;
2 2
 
3
-import java.io.Serializable;
4
-import java.io.UnsupportedEncodingException;
5
-import java.util.Date;
6
-import java.math.BigDecimal;
7 3
 import com.baomidou.mybatisplus.annotation.IdType;
8 4
 import com.baomidou.mybatisplus.annotation.TableId;
9 5
 import com.baomidou.mybatisplus.annotation.TableName;
10
-import com.baomidou.mybatisplus.annotation.TableLogic;
11
-import lombok.Builder;
12
-import lombok.Data;
13 6
 import com.fasterxml.jackson.annotation.JsonFormat;
14
-import org.springframework.format.annotation.DateTimeFormat;
15
-import org.jeecgframework.poi.excel.annotation.Excel;
16
-import org.jeecg.common.aspect.annotation.Dict;
17 7
 import io.swagger.annotations.ApiModel;
18 8
 import io.swagger.annotations.ApiModelProperty;
19
-import lombok.EqualsAndHashCode;
9
+import lombok.*;
20 10
 import lombok.experimental.Accessors;
11
+import org.jeecgframework.poi.excel.annotation.Excel;
12
+import org.springframework.format.annotation.DateTimeFormat;
13
+
14
+import java.io.Serializable;
15
+import java.util.Date;
21 16
 
22 17
 /**
23 18
  * @Description: app_scene_cost_count
24 19
  * @Author: jeecg-boot
25
- * @Date:   2024-07-29
20
+ * @Date: 2024-07-29
26 21
  * @Version: V1.0
27 22
  */
28 23
 @Data
29 24
 @TableName("app_scene_cost_count")
30 25
 @Builder
26
+@NoArgsConstructor
27
+@AllArgsConstructor
31 28
 @Accessors(chain = true)
32 29
 @EqualsAndHashCode(callSuper = false)
33
-@ApiModel(value="app_scene_cost_count对象", description="app_scene_cost_count")
30
+@ApiModel(value = "app_scene_cost_count对象", description = "app_scene_cost_count")
34 31
 public class AppSceneCostCount implements Serializable {
35 32
     private static final long serialVersionUID = 1L;
36 33
 
37
-	/**主键*/
38
-	@TableId(type = IdType.ASSIGN_ID)
34
+    /**
35
+     * 主键
36
+     */
37
+    @TableId(type = IdType.ASSIGN_ID)
39 38
     @ApiModelProperty(value = "主键")
40 39
     private Integer id;
41
-	/**物料编号*/
42
-	@Excel(name = "物料编号", width = 15)
40
+    /**
41
+     * 物料编号
42
+     */
43
+    @Excel(name = "物料编号", width = 15)
43 44
     @ApiModelProperty(value = "物料编号")
44 45
     private String materialNo;
45
-	/**图号*/
46
-	@Excel(name = "图号", width = 15)
46
+    /**
47
+     * 图号
48
+     */
49
+    @Excel(name = "图号", width = 15)
47 50
     @ApiModelProperty(value = "图号")
48 51
     private String drawingNo;
49
-	/**stage*/
50
-	@Excel(name = "stage", width = 15)
52
+    /**
53
+     * stage
54
+     */
55
+    @Excel(name = "阶段", width = 15)
51 56
     @ApiModelProperty(value = "stage")
52 57
     private String stage;
53
-	/**标准成本计算流程id*/
54
-	@Excel(name = "标准成本计算流程id", width = 15)
58
+    /**
59
+     * 标准成本计算流程id
60
+     */
61
+    @Excel(name = "标准成本计算流程id", width = 15)
55 62
     @ApiModelProperty(value = "标准成本计算流程id")
56 63
     private Integer flowDefinitionId;
57
-	/**year*/
58
-	@Excel(name = "year", width = 15)
64
+    /**
65
+     * year
66
+     */
67
+    @Excel(name = "年份", width = 15)
59 68
     @ApiModelProperty(value = "year")
60 69
     private String year;
61
-	/**状态*/
62
-	@Excel(name = "状态", width = 15)
70
+    /**
71
+     * 状态
72
+     */
73
+    @Excel(name = "状态", width = 15)
63 74
     @ApiModelProperty(value = "状态")
64 75
     private Integer status;
65
-	/**模型版本*/
66
-	@Excel(name = "标准成本版本", width = 15)
76
+    /**
77
+     * 模型版本
78
+     */
79
+    @Excel(name = "标准成本版本", width = 15)
67 80
     @ApiModelProperty(value = "标准成本版本")
68 81
     private String costVersion;
69
-	/**创建人*/
82
+    /**
83
+     * 创建人
84
+     */
70 85
     @ApiModelProperty(value = "创建人")
71 86
     private Integer createBy;
72
-	/**创建时间*/
73
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
74
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
87
+    /**
88
+     * 创建时间
89
+     */
90
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
91
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
75 92
     @ApiModelProperty(value = "创建时间")
76 93
     private Date createTime;
77
-	/**更新人*/
94
+    /**
95
+     * 更新人
96
+     */
78 97
     @ApiModelProperty(value = "更新人")
79 98
     private Integer updateBy;
80
-	/**更新时间*/
81
-	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
82
-    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
99
+    /**
100
+     * 更新时间
101
+     */
102
+    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
103
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
83 104
     @ApiModelProperty(value = "更新时间")
84 105
     private Date updateTime;
85 106
 }

+ 1
- 1
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostResultValue.java Visa fil

@@ -35,7 +35,7 @@ public class AppSceneCostResultValue implements Serializable {
35 35
     /**
36 36
      * 主键
37 37
      */
38
-    @TableId(type = IdType.ASSIGN_ID)
38
+    @TableId(type = IdType.AUTO)
39 39
     @ApiModelProperty(value = "主键")
40 40
     private Integer id;
41 41
     /**

+ 17
- 17
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/entity/AppSceneCostStandardDetail.java Visa fil

@@ -77,8 +77,8 @@ public class AppSceneCostStandardDetail implements Serializable {
77 77
     @ApiModelProperty(value = "本阶材料费")
78 78
     private BigDecimal materialCost;
79 79
     /**本阶人工费*/
80
-    @Excel(name = "本阶人工", width = 15)
81
-    @ApiModelProperty(value = "本阶人工")
80
+    @Excel(name = "本阶人工陈本", width = 15)
81
+    @ApiModelProperty(value = "本阶人工成本")
82 82
     private BigDecimal laborCost;
83 83
     /**本阶辅料费*/
84 84
     @Excel(name = "本阶辅料费", width = 15)
@@ -93,32 +93,32 @@ public class AppSceneCostStandardDetail implements Serializable {
93 93
     @ApiModelProperty(value = "本阶水电费(燃动费)")
94 94
     private BigDecimal driveCost;
95 95
     /**本阶其他制造费*/
96
-    @Excel(name = "本阶其他制造费", width = 15)
97
-    @ApiModelProperty(value = "本阶其他制造费")
96
+    @Excel(name = "本阶其他费", width = 15)
97
+    @ApiModelProperty(value = "本阶其他费")
98 98
     private BigDecimal otherCost;
99 99
     /**本阶物流费*/
100 100
     @Excel(name = "本阶物流费", width = 15)
101 101
     @ApiModelProperty(value = "本阶物流费")
102 102
     private BigDecimal logisticsCost;
103
-    /**累计人工费*/
104
-    @Excel(name = "累计人工费", width = 15)
105
-    @ApiModelProperty(value = "累计人工费")
103
+    /**累计物料成本*/
104
+    @Excel(name = "累计物料成本", width = 15)
105
+    @ApiModelProperty(value = "累计物料成本")
106 106
     private BigDecimal totalMaterialCost;
107
-    /**累计机器消耗费*/
108
-    @Excel(name = "累计机器消耗费", width = 15)
109
-    @ApiModelProperty(value = "累计机器消耗费")
107
+    /**累计人工成本*/
108
+    @Excel(name = "累计人工成本", width = 15)
109
+    @ApiModelProperty(value = "累计人工成本")
110 110
     private BigDecimal totalLaborCost;
111
+    /**累计辅料费*/
112
+    @Excel(name = "累计辅料费", width = 15)
113
+    @ApiModelProperty(value = "累计辅料费")
114
+    private BigDecimal totalSupplyMaterialCost;
111 115
     /**累计机器折旧费*/
112 116
     @Excel(name = "累计机器折旧费", width = 15)
113 117
     @ApiModelProperty(value = "累计机器折旧费")
114
-    private BigDecimal totalSupplyMaterialCost;
115
-    /**累计水电费*/
116
-    @Excel(name = "累计水电费", width = 15)
117
-    @ApiModelProperty(value = "累计水电费")
118 118
     private BigDecimal totalEquipmentCost;
119
-    /**累计其它费用*/
120
-    @Excel(name = "累计其它费用", width = 15)
121
-    @ApiModelProperty(value = "累计其它费用")
119
+    /**累计水电费(燃动费)*/
120
+    @Excel(name = "累计水电费(燃动费)", width = 15)
121
+    @ApiModelProperty(value = "累计水电费(燃动费)")
122 122
     private BigDecimal totalDriveCost;
123 123
     /**累计其他费用*/
124 124
     @Excel(name = "累计其他费用", width = 15)

+ 73
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/enums/CostCountStatusEnum.java Visa fil

@@ -0,0 +1,73 @@
1
+package com.zzsmart.qomo.kn.cost.manage.enums;
2
+
3
+/**
4
+ * @Classname StandardStageEnum
5
+ * @Description 阶段枚举
6
+ * @Version 1.0.0
7
+ * @Date 2024/6/18 9:51
8
+ * @Created wangqiong
9
+ */
10
+public enum CostCountStatusEnum {
11
+
12
+    NotExecute("NotExecute", "未执行", 0), Executing("Executing", "计算中", 1), ExecutedFinished("ExecutedFinished", "计算完成", 2), ExecutedError("ExecutedError", "出错中止", 3);
13
+    private final String code;
14
+    private final String name;
15
+    private final Integer value;
16
+
17
+    CostCountStatusEnum(String code, String name, Integer value) {
18
+        this.code = code;
19
+        this.name = name;
20
+        this.value = value;
21
+    }
22
+
23
+    public String getCode() {
24
+        return code;
25
+    }
26
+
27
+    public String getName() {
28
+        return name;
29
+    }
30
+
31
+    public Integer getValue() {
32
+        return value;
33
+    }
34
+
35
+    /**
36
+     * 根据code获取text
37
+     *
38
+     * @param codeNo
39
+     * @return
40
+     */
41
+    public static String getTextByCode(String codeNo) {
42
+        for (CostCountStatusEnum value : CostCountStatusEnum.values()) {
43
+            if (value.getCode().equals(codeNo)) {
44
+                return value.name();
45
+            }
46
+        }
47
+        return codeNo.toString();
48
+    }
49
+
50
+    public static String getTextByValue(Integer indexNo) {
51
+        for (CostCountStatusEnum value : CostCountStatusEnum.values()) {
52
+            if (value.getValue().equals(indexNo)) {
53
+                return value.name();
54
+            }
55
+        }
56
+        return indexNo.toString();
57
+    }
58
+
59
+    /**
60
+     * 根据text获取code
61
+     *
62
+     * @param name
63
+     * @return
64
+     */
65
+    public static String getCodeByName(String name) {
66
+        for (CostCountStatusEnum value : CostCountStatusEnum.values()) {
67
+            if (value.name().equals(name)) {
68
+                return value.name();
69
+            }
70
+        }
71
+        return name;
72
+    }
73
+}

+ 182
- 171
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/plugin/StandardCostService.java Visa fil

@@ -14,16 +14,19 @@ import com.zzsmart.qomo.plugin.task.api.TaskExecutionContext;
14 14
 import lombok.extern.slf4j.Slf4j;
15 15
 import org.springframework.beans.factory.annotation.Autowired;
16 16
 import org.springframework.stereotype.Service;
17
+import org.springframework.transaction.annotation.Transactional;
17 18
 
18 19
 import javax.annotation.PostConstruct;
19 20
 import java.math.BigDecimal;
20 21
 import java.util.ArrayList;
22
+import java.util.Date;
21 23
 import java.util.List;
22 24
 import java.util.Map;
23 25
 import java.util.stream.Collectors;
24 26
 
25 27
 @Service
26 28
 @Slf4j
29
+@Transactional
27 30
 public class StandardCostService {
28 31
     /**
29 32
      * 物料BOM信息
@@ -469,145 +472,150 @@ public class StandardCostService {
469 472
      * 5.标准成本计算任务
470 473
      */
471 474
     public static void standardCostTask(TaskExecutionContext parameters) {
472
-        //获取任务流程相关信息
473
-        FlowTaskInfoVO flowTaskInfoVO = analysisFlowTaskInfo(parameters);
474
-        //获取最上层的物料号
475
-        String topMaterialCode = flowTaskInfoVO.getTopMaterialCode();
476
-        //获取任务类型
477
-        String taskType = parameters.getTaskType();
478
-        //获取任务代码
479
-        String taskCode = flowTaskInfoVO.getTaskCode();
480
-        //获取流程id
481
-        String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
482
-        String costType = FeeTypeEnum.StandardCost.getCode();
483
-        //1.查询出根物料编号对应的下所有的BOM信息结果值
484
-        List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, flowInstanceId);
485
-        //2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
486
-        //按照物料编号进行分组
487
-        Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
488
-        //遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
489
-        for (String key : materialNoMap.keySet()) {
490
-            List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
491
-            //按照费用类别进行分组
492
-            Map<String, List<AppSceneCostResultValue>> costTypeMap = appSceneCostResultValues.stream().filter(s -> s.getCostType() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getCostType));
493
-            //【本阶标准成本】
494
-            BigDecimal currentCost = new BigDecimal("0.0");
495
-            //1.本阶物料成本
496
-            BigDecimal materialCost = new BigDecimal("0.0");
497
-            //2.本阶人工成本
498
-            BigDecimal laborCost = new BigDecimal("0.0");
499
-            //3.本阶制造费(设备费)
500
-            BigDecimal equipmentCost = new BigDecimal("0.0");
501
-            //4.本阶制造费(辅料费用)
502
-            BigDecimal supplyMaterialCost = new BigDecimal("0.0");
503
-            //5.本阶制造费(水电费、燃动费)
504
-            BigDecimal driveCost = new BigDecimal("0.0");
505
-            //6.本阶制造费(其他制造费用)
506
-            BigDecimal otherCost = new BigDecimal("0.0");
507
-            //7.本阶制造费(物流费)
508
-            BigDecimal logisticsCost = new BigDecimal("0.0");
509
-            //物料单价
510
-            BigDecimal materialUnitPrice = new BigDecimal("0.0");
511
-            //人员工时、小时费率
512
-            BigDecimal laborHour = new BigDecimal("0.0");
513
-            BigDecimal laborHourRate = new BigDecimal("0.0");
514
-            //设备工时、小时费率
515
-            BigDecimal equipmentHour = new BigDecimal("0.0");
516
-            BigDecimal equipmentHourRate = new BigDecimal("0.0");
517
-            //辅料工时、小时费率
518
-            BigDecimal supplyMaterialHour = new BigDecimal("0.0");
519
-            BigDecimal supplyMaterialHourRate = new BigDecimal("0.0");
520
-            //燃动工时、小时费率
521
-            BigDecimal driveHour = new BigDecimal("0.0");
522
-            BigDecimal driveHourRate = new BigDecimal("0.0");
523
-            //其他工时、小时费率
524
-            BigDecimal otherHour = new BigDecimal("0.0");
525
-            BigDecimal otherHourRate = new BigDecimal("0.0");
526
-            AppSceneCostResultValue currentMaterialCost = null;
527
-            //遍历所有费用类别计算本阶标准成本
528
-            for (int j = 0; j < appSceneCostResultValues.size(); j++) {
529
-                if (j == 0) {
530
-                    currentMaterialCost = appSceneCostResultValues.get(0);
531
-                }
532
-                AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
533
-                String countValue = appSceneCostResultValue.getCountValue();
534
-                if (countValue != null) {
535
-                    currentCost = currentCost.add(new BigDecimal(countValue));
475
+        try {
476
+            //获取任务流程相关信息
477
+            FlowTaskInfoVO flowTaskInfoVO = analysisFlowTaskInfo(parameters);
478
+            //获取最上层的物料号
479
+            String topMaterialCode = flowTaskInfoVO.getTopMaterialCode();
480
+            //获取任务类型
481
+            String taskType = parameters.getTaskType();
482
+            //获取任务代码
483
+            String taskCode = flowTaskInfoVO.getTaskCode();
484
+            //获取流程id
485
+            String flowInstanceId = flowTaskInfoVO.getFlowInstanceId();
486
+            String costType = FeeTypeEnum.StandardCost.getCode();
487
+            //1.查询出根物料编号对应的下所有的BOM信息结果值
488
+            List<AppSceneCostResultValue> list = standardCostService.iAppSceneCostResultValueService.getAllResultValueByTopMaterialNo(topMaterialCode, flowInstanceId);
489
+            //2.计算出所有的单个物料的本阶的标准成本(标准成本=物料成本+人工成本+制造费用)
490
+            //按照物料编号进行分组
491
+            Map<String, List<AppSceneCostResultValue>> materialNoMap = list.stream().collect(Collectors.groupingBy(AppSceneCostResultValue::getMarterialNo));
492
+            //遍历根物料下所有的物料进行该物料本阶成本和费用类别的统计
493
+            for (String key : materialNoMap.keySet()) {
494
+                List<AppSceneCostResultValue> appSceneCostResultValues = materialNoMap.get(key);
495
+                //按照费用类别进行分组
496
+                Map<String, List<AppSceneCostResultValue>> costTypeMap = appSceneCostResultValues.stream().filter(s -> s.getCostType() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getCostType));
497
+                //【本阶标准成本】
498
+                BigDecimal currentCost = new BigDecimal("0.0");
499
+                //1.本阶物料成本
500
+                BigDecimal materialCost = new BigDecimal("0.0");
501
+                //2.本阶人工成本
502
+                BigDecimal laborCost = new BigDecimal("0.0");
503
+                //3.本阶制造费(设备费)
504
+                BigDecimal equipmentCost = new BigDecimal("0.0");
505
+                //4.本阶制造费(辅料费用)
506
+                BigDecimal supplyMaterialCost = new BigDecimal("0.0");
507
+                //5.本阶制造费(水电费、燃动费)
508
+                BigDecimal driveCost = new BigDecimal("0.0");
509
+                //6.本阶制造费(其他制造费用)
510
+                BigDecimal otherCost = new BigDecimal("0.0");
511
+                //7.本阶制造费(物流费)
512
+                BigDecimal logisticsCost = new BigDecimal("0.0");
513
+                //物料单价
514
+                BigDecimal materialUnitPrice = new BigDecimal("0.0");
515
+                //人员工时、小时费率
516
+                BigDecimal laborHour = new BigDecimal("0.0");
517
+                BigDecimal laborHourRate = new BigDecimal("0.0");
518
+                //设备工时、小时费率
519
+                BigDecimal equipmentHour = new BigDecimal("0.0");
520
+                BigDecimal equipmentHourRate = new BigDecimal("0.0");
521
+                //辅料工时、小时费率
522
+                BigDecimal supplyMaterialHour = new BigDecimal("0.0");
523
+                BigDecimal supplyMaterialHourRate = new BigDecimal("0.0");
524
+                //燃动工时、小时费率
525
+                BigDecimal driveHour = new BigDecimal("0.0");
526
+                BigDecimal driveHourRate = new BigDecimal("0.0");
527
+                //其他工时、小时费率
528
+                BigDecimal otherHour = new BigDecimal("0.0");
529
+                BigDecimal otherHourRate = new BigDecimal("0.0");
530
+                AppSceneCostResultValue currentMaterialCost = null;
531
+                //遍历所有费用类别计算本阶标准成本
532
+                for (int j = 0; j < appSceneCostResultValues.size(); j++) {
533
+                    if (j == 0) {
534
+                        currentMaterialCost = appSceneCostResultValues.get(0);
535
+                    }
536
+                    AppSceneCostResultValue appSceneCostResultValue = appSceneCostResultValues.get(j);
537
+                    String countValue = appSceneCostResultValue.getCountValue();
538
+                    if (countValue != null) {
539
+                        currentCost = currentCost.add(new BigDecimal(countValue));
540
+                    }
536 541
                 }
537
-            }
538
-            //计算本阶各个费用类别费用以及记录本阶物料的工时和小时费率
539
-            for (String feeType : costTypeMap.keySet()) {
540
-                List<AppSceneCostResultValue> appSceneCostResultValues1 = costTypeMap.get(feeType);
541
-                for (int m = 0; m < appSceneCostResultValues1.size(); m++) {
542
-                    if (FeeTypeEnum.MaterialCost.getCode().equals(feeType)) {
543
-                        //物料成本
544
-                        materialCost = materialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
545
-                        //物料单价
546
-                        materialUnitPrice = appSceneCostResultValues1.get(m).getPriceOrRate();
547
-                    } else if (FeeTypeEnum.LaborCost.getCode().equals(feeType)) {
548
-                        //人工成本
549
-                        laborCost = laborCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
550
-                        //人工工时、小时费率
551
-                        laborHour = laborHour.add(appSceneCostResultValues1.get(m).getHour());
552
-                        laborHourRate = laborHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
553
-                    } else if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
554
-                        //设备费用
555
-                        equipmentCost = equipmentCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
556
-                        //设备工时、小时费率
557
-                        equipmentHour = equipmentHour.add(appSceneCostResultValues1.get(m).getHour());
558
-                        equipmentHourRate = equipmentHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
559
-                    } else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
560
-                        //辅料费用
561
-                        supplyMaterialCost = supplyMaterialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
562
-                        //辅料工时、小时费率
563
-                        supplyMaterialHour = supplyMaterialHour.add(appSceneCostResultValues1.get(m).getHour());
564
-                        supplyMaterialHourRate = supplyMaterialHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
565
-                    } else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
566
-                        //燃动费用
567
-                        driveCost = driveCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
568
-                        //燃动工时、小时费率
569
-                        driveHour = driveHour.add(appSceneCostResultValues1.get(m).getHour());
570
-                        driveHourRate = driveHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
571
-                    } else if (FeeTypeEnum.LogisticsFee.getCode().equals(feeType)) {
572
-                        //物流费用
573
-                        logisticsCost = logisticsCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
574
-                    } else if (FeeTypeEnum.OtherFee.getCode().equals(feeType)) {
575
-                        //其他费用
576
-                        otherCost = otherCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
577
-                        //其他工时、小时费率
578
-                        otherHour = otherHour.add(appSceneCostResultValues1.get(m).getHour());
579
-                        otherHourRate = otherHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
542
+                //计算本阶各个费用类别费用以及记录本阶物料的工时和小时费率
543
+                for (String feeType : costTypeMap.keySet()) {
544
+                    List<AppSceneCostResultValue> appSceneCostResultValues1 = costTypeMap.get(feeType);
545
+                    for (int m = 0; m < appSceneCostResultValues1.size(); m++) {
546
+                        if (FeeTypeEnum.MaterialCost.getCode().equals(feeType)) {
547
+                            //物料成本
548
+                            materialCost = materialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
549
+                            //物料单价
550
+                            materialUnitPrice = appSceneCostResultValues1.get(m).getPriceOrRate();
551
+                        } else if (FeeTypeEnum.LaborCost.getCode().equals(feeType)) {
552
+                            //人工成本
553
+                            laborCost = laborCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
554
+                            //人工工时、小时费率
555
+                            laborHour = laborHour.add(appSceneCostResultValues1.get(m).getHour());
556
+                            laborHourRate = laborHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
557
+                        } else if (FeeTypeEnum.EquipmentFee.getCode().equals(feeType)) {
558
+                            //设备费用
559
+                            equipmentCost = equipmentCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
560
+                            //设备工时、小时费率
561
+                            equipmentHour = equipmentHour.add(appSceneCostResultValues1.get(m).getHour());
562
+                            equipmentHourRate = equipmentHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
563
+                        } else if (FeeTypeEnum.SupplyMaterialFee.getCode().equals(feeType)) {
564
+                            //辅料费用
565
+                            supplyMaterialCost = supplyMaterialCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
566
+                            //辅料工时、小时费率
567
+                            supplyMaterialHour = supplyMaterialHour.add(appSceneCostResultValues1.get(m).getHour());
568
+                            supplyMaterialHourRate = supplyMaterialHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
569
+                        } else if (FeeTypeEnum.DriverFee.getCode().equals(feeType)) {
570
+                            //燃动费用
571
+                            driveCost = driveCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
572
+                            //燃动工时、小时费率
573
+                            driveHour = driveHour.add(appSceneCostResultValues1.get(m).getHour());
574
+                            driveHourRate = driveHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
575
+                        } else if (FeeTypeEnum.LogisticsFee.getCode().equals(feeType)) {
576
+                            //物流费用
577
+                            logisticsCost = logisticsCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
578
+                        } else if (FeeTypeEnum.OtherFee.getCode().equals(feeType)) {
579
+                            //其他费用
580
+                            otherCost = otherCost.add(new BigDecimal(appSceneCostResultValues1.get(m).getCountValue()));
581
+                            //其他工时、小时费率
582
+                            otherHour = otherHour.add(appSceneCostResultValues1.get(m).getHour());
583
+                            otherHourRate = otherHourRate.add(appSceneCostResultValues1.get(m).getPriceOrRate());
584
+                        }
580 585
                     }
581 586
                 }
587
+                //本阶不同费用类别成本统计
588
+                JSONObject currentLevelCostTypeDetail = new JSONObject();
589
+                currentLevelCostTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost);
590
+                currentLevelCostTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost);
591
+                currentLevelCostTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost);
592
+                currentLevelCostTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost);
593
+                currentLevelCostTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost);
594
+                currentLevelCostTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost);
595
+                currentLevelCostTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost);
596
+                //统计本阶不同费用类别工时、小时费率
597
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.MaterialUnitPrice.getCode(), materialUnitPrice);
598
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHour.getCode(), laborHour);
599
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHourRate.getCode(), laborHourRate);
600
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHour.getCode(), equipmentHour);
601
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHourRate.getCode(), equipmentHourRate);
602
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHour.getCode(), supplyMaterialHour);
603
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHourRate.getCode(), supplyMaterialHourRate);
604
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHour.getCode(), driveHour);
605
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHourRate.getCode(), driveHourRate);
606
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHour.getCode(), otherHour);
607
+                currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHourRate.getCode(), otherHourRate);
608
+                AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(currentMaterialCost.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(currentCost.toString()).costDetail(JSON.toJSONString(currentLevelCostTypeDetail)).costType(costType).build();
609
+                standardCostService.iAppSceneCostResultValueService.save(resultValue);
582 610
             }
583
-            //本阶不同费用类别成本统计
584
-            JSONObject currentLevelCostTypeDetail = new JSONObject();
585
-            currentLevelCostTypeDetail.put(FeeTypeEnum.MaterialCost.getCode(), materialCost);
586
-            currentLevelCostTypeDetail.put(FeeTypeEnum.LaborCost.getCode(), laborCost);
587
-            currentLevelCostTypeDetail.put(FeeTypeEnum.EquipmentFee.getCode(), equipmentCost);
588
-            currentLevelCostTypeDetail.put(FeeTypeEnum.SupplyMaterialFee.getCode(), supplyMaterialCost);
589
-            currentLevelCostTypeDetail.put(FeeTypeEnum.DriverFee.getCode(), driveCost);
590
-            currentLevelCostTypeDetail.put(FeeTypeEnum.LogisticsFee.getCode(), logisticsCost);
591
-            currentLevelCostTypeDetail.put(FeeTypeEnum.OtherFee.getCode(), otherCost);
592
-            //统计本阶不同费用类别工时、小时费率
593
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.MaterialUnitPrice.getCode(), materialUnitPrice);
594
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHour.getCode(), laborHour);
595
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.LaborHourRate.getCode(), laborHourRate);
596
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHour.getCode(), equipmentHour);
597
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.EquipmentHourRate.getCode(), equipmentHourRate);
598
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHour.getCode(), supplyMaterialHour);
599
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.SupplyMaterialHourRate.getCode(), supplyMaterialHourRate);
600
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHour.getCode(), driveHour);
601
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.DriverHourRate.getCode(), driveHourRate);
602
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHour.getCode(), otherHour);
603
-            currentLevelCostTypeDetail.put(HourOrRateTypeEnum.OtherHourRate.getCode(), otherHourRate);
604
-            AppSceneCostResultValue resultValue = AppSceneCostResultValue.builder().belongTopMaterialNo(topMaterialCode).marterialNo(key).parentMarterialNo(currentMaterialCost.getParentMarterialNo()).taskType(taskType).taskCode(taskCode).flowInstanceId(flowInstanceId).countValue(currentCost.toString()).costDetail(JSON.toJSONString(currentLevelCostTypeDetail)).costType(costType).build();
605
-            standardCostService.iAppSceneCostResultValueService.save(resultValue);
611
+            //3.计算出所有的单个物料的累计标准成本
612
+            List<AppSceneCostResultValue> standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, flowInstanceId);
613
+            //【累计成本】的计算
614
+            totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, flowInstanceId);
615
+        } catch (Exception e) {
616
+            e.printStackTrace();
617
+            throw new RuntimeException("计算成本失败");
606 618
         }
607
-        //3.计算出所有的单个物料的累计标准成本
608
-        List<AppSceneCostResultValue> standardCostList = standardCostService.iAppSceneCostResultValueService.getResultValueByTopMaterialNo(topMaterialCode, taskType, flowInstanceId);
609
-        //【累计成本】的计算
610
-        totalCountCost(standardCostList, topMaterialCode, taskType, taskCode, flowInstanceId);
611 619
     }
612 620
 
613 621
     /**
@@ -620,48 +628,51 @@ public class StandardCostService {
620 628
      * @param flowInstanceId
621 629
      */
622 630
     private static void totalCountCost(List<AppSceneCostResultValue> standardCostList, String topMaterialCode, String taskType, String taskCode, String flowInstanceId) {
623
-
624
-        List<AppSceneCostStandardDetail> costStandardDetails = new ArrayList<>();
625
-        //父类对应的子节点(除了最上层节点)
626
-        Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo));
627
-        for (int i = 0; i < standardCostList.size(); i++) {
628
-            //当前节点及其对应的本阶成本
629
-            AppSceneCostResultValue oldAppSceneCostResultValue = standardCostList.get(i);
630
-            BigDecimal totalCost = new BigDecimal(oldAppSceneCostResultValue.getCountValue());
631
-            //循环计算出当前节点的累计成本
632
-            String costDetail = oldAppSceneCostResultValue.getCostDetail();
633
-            //查询当前节点各个类型的成本
634
-            BigDecimal totalMaterialCost = new BigDecimal(0);
635
-            BigDecimal totalLabourCost = new BigDecimal(0);
636
-            BigDecimal totalEquipmentCost = new BigDecimal(0);
637
-            BigDecimal totalSupplyMaterialCost = new BigDecimal(0);
638
-            BigDecimal totalDriveCost = new BigDecimal(0);
639
-            BigDecimal totalLogisticsCost = new BigDecimal(0);
640
-            BigDecimal totalOtherCost = new BigDecimal(0);
641
-            JSONObject costDetailJson = JSON.parseObject(costDetail);
642
-            TotalResultValue hourOrRateResultValue = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, totalMaterialCost, totalLabourCost, totalEquipmentCost, totalSupplyMaterialCost, totalDriveCost, totalLogisticsCost, totalOtherCost, totalCost);
643
-            costDetailJson.put(TotalCostEnum.TotalMaterialCost.getCode(), hourOrRateResultValue.getTotalMaterialCost());
644
-            costDetailJson.put(TotalCostEnum.TotalLaborCost.getCode(), hourOrRateResultValue.getTotalLabourCost());
645
-            costDetailJson.put(TotalCostEnum.TotalEquipmentFee.getCode(), hourOrRateResultValue.getTotalEquipmentCost());
646
-            costDetailJson.put(TotalCostEnum.TotalSupplyMaterialFee.getCode(), hourOrRateResultValue.getTotalSupplyMaterialCost());
647
-            costDetailJson.put(TotalCostEnum.TotalDriverFee.getCode(), hourOrRateResultValue.getTotalDriveCost());
648
-            costDetailJson.put(TotalCostEnum.TotalLogisticsFee.getCode(), hourOrRateResultValue.getTotalLogisticsCost());
649
-            costDetailJson.put(TotalCostEnum.TotalOtherFee.getCode(), hourOrRateResultValue.getTotalOtherCost());
650
-            costDetailJson.put(TotalCostEnum.TotalStandardCost.getCode(), hourOrRateResultValue.getTotalCost());
651
-            oldAppSceneCostResultValue.setCostDetail(costDetailJson.toJSONString());
652
-            oldAppSceneCostResultValue.setTotalValue(hourOrRateResultValue.getTotalCost().toString());
653
-            standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
654
-            //构造单行成本查询记录
655
-            AppSceneCostStandardDetail costStandardDetail = AppSceneCostStandardDetail.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).materialName(oldAppSceneCostResultValue.getMarterialNo()).parentMaterialNumber(oldAppSceneCostResultValue.getParentMarterialNo())
631
+        try {
632
+            List<AppSceneCostStandardDetail> costStandardDetails = new ArrayList<>();
633
+            //父类对应的子节点(除了最上层节点)
634
+            Map<String, List<AppSceneCostResultValue>> parentMaterialNoMap = standardCostList.stream().filter(appSceneCostResultValue -> appSceneCostResultValue.getParentMarterialNo() != null).collect(Collectors.groupingBy(AppSceneCostResultValue::getParentMarterialNo));
635
+            for (int i = 0; i < standardCostList.size(); i++) {
636
+                //当前节点及其对应的本阶成本
637
+                AppSceneCostResultValue oldAppSceneCostResultValue = standardCostList.get(i);
638
+                BigDecimal totalCost = new BigDecimal(oldAppSceneCostResultValue.getCountValue());
639
+                //循环计算出当前节点的累计成本
640
+                String costDetail = oldAppSceneCostResultValue.getCostDetail();
641
+                //查询当前节点各个类型的成本
642
+                BigDecimal totalMaterialCost = new BigDecimal(0);
643
+                BigDecimal totalLabourCost = new BigDecimal(0);
644
+                BigDecimal totalEquipmentCost = new BigDecimal(0);
645
+                BigDecimal totalSupplyMaterialCost = new BigDecimal(0);
646
+                BigDecimal totalDriveCost = new BigDecimal(0);
647
+                BigDecimal totalLogisticsCost = new BigDecimal(0);
648
+                BigDecimal totalOtherCost = new BigDecimal(0);
649
+                JSONObject costDetailJson = JSON.parseObject(costDetail);
650
+                TotalResultValue hourOrRateResultValue = loopCount(oldAppSceneCostResultValue, parentMaterialNoMap, totalMaterialCost, totalLabourCost, totalEquipmentCost, totalSupplyMaterialCost, totalDriveCost, totalLogisticsCost, totalOtherCost, totalCost);
651
+                costDetailJson.put(TotalCostEnum.TotalMaterialCost.getCode(), hourOrRateResultValue.getTotalMaterialCost());
652
+                costDetailJson.put(TotalCostEnum.TotalLaborCost.getCode(), hourOrRateResultValue.getTotalLabourCost());
653
+                costDetailJson.put(TotalCostEnum.TotalEquipmentFee.getCode(), hourOrRateResultValue.getTotalEquipmentCost());
654
+                costDetailJson.put(TotalCostEnum.TotalSupplyMaterialFee.getCode(), hourOrRateResultValue.getTotalSupplyMaterialCost());
655
+                costDetailJson.put(TotalCostEnum.TotalDriverFee.getCode(), hourOrRateResultValue.getTotalDriveCost());
656
+                costDetailJson.put(TotalCostEnum.TotalLogisticsFee.getCode(), hourOrRateResultValue.getTotalLogisticsCost());
657
+                costDetailJson.put(TotalCostEnum.TotalOtherFee.getCode(), hourOrRateResultValue.getTotalOtherCost());
658
+                costDetailJson.put(TotalCostEnum.TotalStandardCost.getCode(), hourOrRateResultValue.getTotalCost());
659
+                oldAppSceneCostResultValue.setCostDetail(costDetailJson.toJSONString());
660
+                oldAppSceneCostResultValue.setTotalValue(hourOrRateResultValue.getTotalCost().toString());
661
+                standardCostService.iAppSceneCostResultValueService.updateById(oldAppSceneCostResultValue);
662
+                //构造单行成本查询记录
663
+                AppSceneCostStandardDetail costStandardDetail = AppSceneCostStandardDetail.builder().materialNumber(oldAppSceneCostResultValue.getMarterialNo()).materialName(oldAppSceneCostResultValue.getMarterialNo()).parentMaterialNumber(oldAppSceneCostResultValue.getParentMarterialNo())
656 664
 //                    .versionNumber()
657 665
 //                    .level()
658 666
 //                    .sort()
659 667
 //                    .figureNumber()
660
-                    .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0).unit(oldAppSceneCostResultValue.getUnit()).materialCost(costDetailJson.getBigDecimal(FeeTypeEnum.MaterialCost.getCode())).laborCost(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode())).equipmentCost(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode())).supplyMaterialCost(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode())).driveCost(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode())).logisticsCost(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode())).otherCost(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode())).currentStandardCost(new BigDecimal(oldAppSceneCostResultValue.getCountValue())).totalMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalMaterialCost.getCode())).totalLaborCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLaborCost.getCode())).totalEquipmentCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalEquipmentFee.getCode())).totalSupplyMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalSupplyMaterialFee.getCode())).totalDriveCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalDriverFee.getCode())).totalLogisticsCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLogisticsFee.getCode())).totalOtherCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalOtherFee.getCode())).totalStandardCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalStandardCost.getCode())).build();
661
-            costStandardDetails.add(costStandardDetail);
668
+                        .dosage(oldAppSceneCostResultValue.getNum() != null ? new Double(oldAppSceneCostResultValue.getNum()) : 0).unit(oldAppSceneCostResultValue.getUnit()).materialCost(costDetailJson.getBigDecimal(FeeTypeEnum.MaterialCost.getCode())).laborCost(costDetailJson.getBigDecimal(FeeTypeEnum.LaborCost.getCode())).equipmentCost(costDetailJson.getBigDecimal(FeeTypeEnum.EquipmentFee.getCode())).supplyMaterialCost(costDetailJson.getBigDecimal(FeeTypeEnum.SupplyMaterialFee.getCode())).driveCost(costDetailJson.getBigDecimal(FeeTypeEnum.DriverFee.getCode())).logisticsCost(costDetailJson.getBigDecimal(FeeTypeEnum.LogisticsFee.getCode())).otherCost(costDetailJson.getBigDecimal(FeeTypeEnum.OtherFee.getCode())).currentStandardCost(new BigDecimal(oldAppSceneCostResultValue.getCountValue())).totalMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalMaterialCost.getCode())).totalLaborCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLaborCost.getCode())).totalEquipmentCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalEquipmentFee.getCode())).totalSupplyMaterialCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalSupplyMaterialFee.getCode())).totalDriveCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalDriverFee.getCode())).totalLogisticsCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalLogisticsFee.getCode())).totalOtherCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalOtherFee.getCode())).totalStandardCost(costDetailJson.getBigDecimal(TotalCostEnum.TotalStandardCost.getCode())).createTime(new Date()).build();
669
+                costStandardDetails.add(costStandardDetail);
670
+            }
671
+            //更新结果集到标准成本单行查询中去
672
+            standardCostService.iAppSceneCostStandardDetailService.saveBatch(costStandardDetails);
673
+        } catch (Exception e) {
674
+            e.printStackTrace();
662 675
         }
663
-        //更新结果集到标准成本单行查询中去
664
-        standardCostService.iAppSceneCostStandardDetailService.saveBatch(costStandardDetails);
665 676
     }
666 677
 
667 678
     /**

+ 14
- 0
qomo-kn-cost-manage/src/main/java/com/zzsmart/qomo/kn/cost/manage/vo/AppSceneCostCountVO.java Visa fil

@@ -0,0 +1,14 @@
1
+package com.zzsmart.qomo.kn.cost.manage.vo;
2
+
3
+import com.zzsmart.qomo.kn.cost.manage.entity.AppSceneCostCount;
4
+import lombok.Builder;
5
+import lombok.Data;
6
+
7
+@Data
8
+@Builder
9
+public class AppSceneCostCountVO extends AppSceneCostCount {
10
+    /**
11
+     * 状态名称
12
+     */
13
+    private String statusName;
14
+}