futian.liu
2023-12-05 3836720e3b0fc9ab884d178e0ac27e942b175da2
consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java
@@ -1,5 +1,18 @@
package com.consum.base.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.core.utils.MapUtils;
@@ -18,20 +31,10 @@
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.web.ResponseValue;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @Description 物品模板
@@ -73,8 +76,9 @@
        if (StringUtils.isEmpty(param.getGoodsName())) {
            return ResponseValue.error("物品名称为空");
        }
        //判断同一分类下的物品名称是否重复
        BaseGoodsTemplate goodsTemplate = this.baseGoodsTemplateService.getByGoodsNameAndCategoryId(param.getGoodsName(), param.getCategoryId());
        // 判断同一分类下的物品名称是否重复
        BaseGoodsTemplate goodsTemplate =
            this.baseGoodsTemplateService.getByGoodsNameAndCategoryId(param.getGoodsName(), param.getCategoryId());
        if (goodsTemplate != null) {
            return ResponseValue.error("物品名称已存在");
        }
@@ -155,7 +159,7 @@
     * @author 卢庆阳
     * @date 2023/10/25
     */
    //TODO 物品的禁用或删除,不影响已经采购入过库的物品信息。
    // TODO 物品的禁用或删除,不影响已经采购入过库的物品信息。
    @PostMapping("/updStatus")
    public ResponseValue updateStatus() {
        BaseGoodsTemplate goodsTemplate = CommonUtil.getObjFromReqBody(BaseGoodsTemplate.class);
@@ -176,7 +180,7 @@
     * @Author 卢庆阳
     * @Date 2023/10/25
     */
    //TODO 物品的禁用或删除,不影响已经采购入过库的物品信息。
    // TODO 物品的禁用或删除,不影响已经采购入过库的物品信息。
    @DeleteMapping("/del")
    public ResponseValue updateById() {
        BaseGoodsTemplate goodsTemplate = CommonUtil.getObjFromReqBody(BaseGoodsTemplate.class);
@@ -216,19 +220,20 @@
    @GetMapping("/query/goodsTemplate")
    public ResponseValue queryGoodsTemplateByCategoryId(Long agencyId, Long categoryId) {
        List<BaseGoodsTemplate> list = this.baseGoodsTemplateService.queryGoodsTemplateByCategoryId(agencyId, categoryId, null, null);
        List<BaseGoodsTemplate> list =
            this.baseGoodsTemplateService.queryGoodsTemplateByCategoryId(agencyId, categoryId, null, null);
        if (list == null) {
            return ResponseValue.error("查询失败!");
        }
        return ResponseValue.success("查询成功!", list);
    }
    @ApiOperation(value = "查询机构下默认仓库下的分类模板信息", notes = "查询机构下默认仓库下的分类模板信息")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "agencyId", value = "父级机构id", required = true, dataType = "java.lang.Long", paramType = "query"),
        @ApiImplicitParam(name = "categoryId", value = "分类id", required = true, dataType = "Long", paramType = "query")
    })
        @ApiImplicitParam(name = "agencyId", value = "父级机构id", required = true, dataType = "java.lang.Long",
            paramType = "query"),
        @ApiImplicitParam(name = "categoryId", value = "分类id", required = true, dataType = "Long",
            paramType = "query")})
    @GetMapping("/query/warehouse/goods")
    public ResponseValue queryWarehouseGoods(Long agencyId, Long categoryId) {
@@ -236,7 +241,7 @@
        Map<String, Object> map = new HashMap<>();
        map.put("categoryId", categoryId);
        List<BaseWarehouse> baseWarehouseList = baseWarehouseService.getByAgencyId(agencyId, (short) 1, (short) 1);
        List<BaseWarehouse> baseWarehouseList = baseWarehouseService.getByAgencyId(agencyId, (short)1, (short)1);
        if (CollectionUtils.isEmpty(baseWarehouseList)) {
            return ResponseValue.error("机构无默认仓库!");
@@ -245,9 +250,7 @@
        String sql =
            "SELECT DISTINCT bgt.id,bgt.GOODS_NAME, CLASSIFICATION type FROM l_wh_goods g LEFT JOIN base_goods_template bgt ON g.BASE_GOODS_TEMPLATE_ID = bgt.id "
                + "WHERE WAREHOUSE_TYPE = 0 "
                + "AND WAREHOUSE_ID = :warehouseId "
                + "AND CATEGORY_ID = :categoryId "
                + "WHERE WAREHOUSE_TYPE = 0 " + "AND WAREHOUSE_ID = :warehouseId " + "AND CATEGORY_ID = :categoryId "
                // 1:集采,2:自采
                + "AND BUY_TYPE =1";
@@ -260,6 +263,4 @@
        return ResponseValue.success("查询成功!", resultList);
    }
}