skyouc
2 天以前 6883e31331af4633d1b7d74ea7deb5f972afa05d
rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/LocController.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vincent.rsf.framework.common.Cools;
import com.vincent.rsf.framework.common.R;
@@ -29,6 +30,7 @@
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.*;
import java.util.stream.Collectors;
@Api(tags = "库位信息")
@@ -43,13 +45,25 @@
    public R page(@RequestBody Map<String, Object> map) {
        BaseParam baseParam = buildParam(map, BaseParam.class);
        PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class);
        return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true)));
        List<String> list = new ArrayList<>();
        list.add("row");
        list.add("col");
        list.add("lev");
        return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true,list)));
    }
    @PreAuthorize("hasAuthority('manager:loc:list')")
    @PostMapping("/loc/list")
    public R list(@RequestBody Map<String, Object> map) {
        return R.ok().add(locService.list());
    }
    @PreAuthorize("hasAuthority('manager:loc:list')")
    @PostMapping("/loc/areaNoUse/list")
    public R areaNoUselist(@RequestBody Map<String, Object> map) {
        List<Loc> list = locService.list();
        List<String> list1 = list.stream().map(obj -> obj.getCode()).collect(Collectors.toList());
        return R.ok(list1);
    }
    @PreAuthorize("hasAuthority('manager:loc:list')")
@@ -100,11 +114,12 @@
        loc.setUpdateBy(getLoginUserId());
        String join = StringUtils.join(loc.getTypeIds(), ",");
        loc.setType(join);
        if (Objects.isNull(loc.getTypeIds())) {
            throw new CoolException("库位类型不能为空!!");
        }
        if (!locService.updateById(loc)) {
            return R.error("Update Fail");
        }
        if (!locService.updateLoc(loc)) {
            throw new CoolException("库位类型关联关系修改失败!@!");
        }
@@ -176,34 +191,36 @@
    @PostMapping("/loc/init")
    public R initLocInfo(@Valid @RequestBody LocMastInitParam param) {
        if (Objects.isNull(param)) {
            throw new CoolException("初始化信息不能为空!!");
            return R.error("初始化信息不能为空!!");
        }
        if (Objects.isNull(param.getTypeIds()) && param.getTypeIds().isEmpty()) {
            return R.error("库位类型不能为空!!");
        }
        if (Objects.isNull(param.getWarehouseId())) {
            throw new CoolException("仓库ID不能为空!!");
            return R.error("仓库ID不能为空!!");
        }
        if (Objects.isNull(param.getAreaId())) {
            throw new CoolException("库区ID不能为空!!");
            return R.error("库区ID不能为空!!");
        }
        if (Objects.isNull(param.getStartRow())) {
            throw new CoolException("起始排不能为空!!");
            return R.error("起始排不能为空!!");
        }
        if (Objects.isNull(param.getEndRow())) {
            throw new CoolException("终止排不能为空!!");
            return R.error("终止排不能为空!!");
        }
        if (Objects.isNull(param.getStartBay())) {
            throw new CoolException("起始列不能为空!!");
            return R.error("起始列不能为空!!");
        }
        if (Objects.isNull(param.getEndBay())) {
            throw new CoolException("终止列不能为空!!");
            return R.error("终止列不能为空!!");
        }
        if (Objects.isNull(param.getStartLev())) {
            throw new CoolException("起始层不能为空!!");
            return R.error("起始层不能为空!!");
        }
        if (Objects.isNull(param.getEndLev())) {
            throw new CoolException("终止层不能为空!!");
            return R.error("终止层不能为空!!");
        }
        return locService.initLocs(param);
        return locService.initLocs(param, getLoginUserId());
    }
}