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"))));
|
}
|
|
}
|