WangHan
2025-04-02 a8ba678a3fe5a39da2c732014cebbb66e408e97c
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
52
53
54
55
56
57
58
59
60
61
62
package com.consum.base.controller;
 
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
 
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.consum.base.BaseController;
import com.consum.base.core.utils.CommonUtil;
import com.consum.base.pojo.query.LWhProcureModelQry;
import com.consum.base.service.LWhProcureModelService;
import com.walker.infrastructure.utils.CollectionUtils;
import com.walker.web.ResponseValue;
 
// @Api(value = "物品型号", tags = "物品型号")
@RestController
@RequestMapping("/pc/warehouse/procureModel")
public class LWhProcureModelController extends BaseController {
    @Resource
    private LWhProcureModelService lWhProcureModelService;
 
    @GetMapping("getFfOrderByGoodsIdAndDept")
    /**
     * 根据部门、物品查询调拨单
     */
    public ResponseValue getFfOrderByGoodsIdAndDept() {
        LWhProcureModelQry param = CommonUtil.getObjFromReq(LWhProcureModelQry.class);
        LWhProcureModelQry param2 = new LWhProcureModelQry();
        CommonUtil.copyProperties(param, param2);
        param = param2;
        List<Map<String, Object>> ffOrderByGoodsIdAndDept =
            lWhProcureModelService.getFfOrderByGoodsIdAndDept(param.getBaseGoodsTemplateId(), param.getDepartmentId());
        if (CollectionUtils.isEmpty(ffOrderByGoodsIdAndDept)) {
            return ResponseValue.success();
        }
        return ResponseValue.success(ffOrderByGoodsIdAndDept);
    }
 
    @GetMapping("getGoodsUseInfoByFfOrderAndGoodId")
    /**
     * 根据分发单id、物品ID查询在用数量 以及使用人信息
     */
    public ResponseValue getGoodsUseInfoByFfOrderAndGoodId() {
        LWhProcureModelQry param = CommonUtil.getObjFromReq(LWhProcureModelQry.class);
        LWhProcureModelQry param2 = new LWhProcureModelQry();
        CommonUtil.copyProperties(param, param2);
        param = param2;
        List<Map<String, Object>> ffOrderByGoodsIdAndDept = lWhProcureModelService
            .getGoodsUseInfoByFfOrderAndGoodId(param.getBaseGoodsTemplateId(), param.getTransBusinessId());
        if (CollectionUtils.isEmpty(ffOrderByGoodsIdAndDept)) {
            return ResponseValue.success();
        }
        // 按型号分组返回
        return ResponseValue.success(
            ffOrderByGoodsIdAndDept.stream().collect(Collectors.groupingBy(map -> map.get("baseGoodsModelsId"))));
    }
 
}