刘光辉
15 小时以前 34981c30a78e8bbd7791131059a9210f9928b62c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package jnpf.limsController;
 
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jnpf.limsEntity.LimsWendingxingChurukuSubmitParam;
import jnpf.limsService.LimsWendingxingChurukuService;
import jnpf.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.Map;
 
@Tag(name = "lims稳定性出入库接口", description = "稳定性样品出入库及结存计算")
@RestController
@RequestMapping("/lims/biz/wendingxing/churuku")
public class LimsWendingxingChurukuController {
 
    @Autowired
    private LimsWendingxingChurukuService churukuService;
 
    /**
     * 稳定性出入库提交:保存主表和子项,并按计划周期计算最新结存量。
     */
    @Operation(summary = "稳定性出入库提交")
    @PostMapping("/submit")
    public R<Map<String, Object>> submit(@RequestBody LimsWendingxingChurukuSubmitParam param) {
        return R.success("提交成功", churukuService.submit(param));
    }
 
    /**
     * 根据流程重新计算稳定性出入库子项的收入量、发出量和结存量。
     */
    @Operation(summary = "按流程同步稳定性出入库结存")
    @PostMapping("/jiecun/tongbu")
    public R<Integer> syncJiecun(@RequestBody Map<String, String> params) {
        String flowId = params == null ? null : params.get("flow_id");
        String flowTaskId = params == null ? null : params.get("flow_task_id");
        if (!StringUtils.hasText(flowId)) {
            return R.error("流程ID(flow_id)不能为空");
        }
        if (!StringUtils.hasText(flowTaskId)) {
            return R.error("流程任务ID(flow_task_id)不能为空");
        }
        int count = churukuService.recalculateByFlow(flowId.trim(), flowTaskId.trim());
        return R.success("同步成功", count);
    }
}