无关风月
2024-12-20 bc8d7d4bb290ed84441942d50a0399f3cc034a0c
代码
4个文件已修改
1个文件已添加
147 ■■■■ 已修改文件
manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java 109 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/dto/GetCurrentByParam.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/model/TInventory.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/vo/TInventoryInfoVO.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java
@@ -4,27 +4,26 @@
import com.jilongda.common.basic.ApiResult;
import com.jilongda.common.basic.PageInfo;
import com.jilongda.manage.dto.FrameInventoryDTO;
import com.jilongda.manage.model.TInventory;
import com.jilongda.manage.model.TInventoryFrameDetail;
import com.jilongda.manage.dto.GetCurrentByParam;
import com.jilongda.manage.dto.GetCurrentByParamLens;
import com.jilongda.manage.model.*;
import com.jilongda.manage.query.TFrameGoodsQuery;
import com.jilongda.manage.query.TInventoryQuery;
import com.jilongda.manage.service.TInventoryFrameDetailService;
import com.jilongda.manage.service.TInventoryLensDetailService;
import com.jilongda.manage.service.TInventoryService;
import com.jilongda.manage.service.*;
import com.jilongda.manage.utils.LoginInfoUtil;
import com.jilongda.manage.vo.TFrameGoodsVO;
import com.jilongda.manage.vo.TInventoryInfoVO;
import com.jilongda.manage.vo.TInventoryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.models.auth.In;
import org.springframework.beans.BeanUtils;
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 org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -47,6 +46,16 @@
    private TInventoryLensDetailService inventoryLensDetailService;
    @Resource
    private LoginInfoUtil loginInfoUtil;
    @Resource
    private TFrameGoodsService frameGoodsService;
    @Resource
    private TLensGoodsService lensGoodsService;
    @Resource
    private TLensSeriesService lensSeriesService;
    @Resource
    private TModelService modelService;
    @Resource
    private TStoreService storeService;
    @ApiOperation(value = "盘点分页列表")
    @PostMapping(value = "/pageList")
    public ApiResult<PageInfo<TInventoryVO>> pageList(@RequestBody TInventoryQuery query) {
@@ -77,5 +86,85 @@
        inventoryFrameDetailService.saveBatch(query.getList());
        return ApiResult.success();
    }
    @ApiOperation(value = "镜架-根据品牌id查询对应库存")
    @PostMapping(value = "/getCountByBrandId")
    public ApiResult getCountByBrandId(Integer id) {
        List<Integer> collect = modelService.lambdaQuery().eq(TModel::getBrandId, id)
                .list().stream().map(TModel::getId).distinct().collect(Collectors.toList());
        if (collect.isEmpty())collect.add(-1);
        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).list();
        if (list.isEmpty())return ApiResult.success("0");
        int i = 0;
        for (TFrameGoods tFrameGoods : list) {
            i+=tFrameGoods.getTotal();
        }
        return ApiResult.success(i);
    }
    @ApiOperation(value = "镜架-根据材质id查询对应库存")
    @PostMapping(value = "/getCountByMaterialId")
    public ApiResult getCountByMaterialId(Integer id) {
        List<Integer> collect = modelService.lambdaQuery().eq(TModel::getMaterialId, id)
                .list().stream().map(TModel::getId).distinct().collect(Collectors.toList());
        if (collect.isEmpty())collect.add(-1);
        List<TFrameGoods> list = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect).list();
        if (list.isEmpty())return ApiResult.success("0");
        int i = 0;
        for (TFrameGoods tFrameGoods : list) {
            i+=tFrameGoods.getTotal();
        }
        return ApiResult.success(i);
    }
    @ApiOperation(value = "镜架-根据品牌id、型号名称、色号名称、材质id查询当前库存")
    @PostMapping(value = "/getCurrentByParamFrame")
    public ApiResult<Integer> getCurrentByParamFrame(@RequestBody GetCurrentByParam getCurrentByParam) {
        // 根据型号名称 查询型号列表ids
        List<Integer> collect = modelService.lambdaQuery().eq(TModel::getName, getCurrentByParam.getModel())
                .eq(TModel::getColor,getCurrentByParam.getColor())
                .eq(TModel::getMaterialId,getCurrentByParam.getMaterialId())
                .eq(TModel::getBrandId,getCurrentByParam.getBrandId())
                .list().stream().map(TModel::getId).collect(Collectors.toList());
        TFrameGoods one = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect)
                .eq(TFrameGoods::getColor, getCurrentByParam.getColor()).one();
        if (one!=null){
            return ApiResult.success(one.getTotal());
        }
        return ApiResult.success(0);
    }
    @ApiOperation(value = "镜片-根据品牌id、型号名称、色号名称、材质id查询当前库存")
    @PostMapping(value = "/getCurrentByParamLens")
    public ApiResult<Integer> getCurrentByParamLens(@RequestBody GetCurrentByParamLens dto) {
        TLensGoods one = lensGoodsService.lambdaQuery().in(TLensGoods::getSeriesId, dto.getSeriesId())
                .eq(dto.getLensType()!=null,TLensGoods::getLensType, dto.getLensType())
                .eq(dto.getRefractiveIndex()!=null,TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
                .eq(dto.getBallMirror()!=null,TLensGoods::getBallMirror, dto.getBallMirror())
                .eq(dto.getColumnMirror()!=null,TLensGoods::getColumnMirror, dto.getColumnMirror())
                .one();
        if (one!=null){
            return ApiResult.success(one.getTotal());
        }
        return ApiResult.success(0);
    }
    @ApiOperation(value = "查看详情")
    @GetMapping(value = "/getDetailById")
    public ApiResult<TInventoryInfoVO> getDetailById(Integer id) {
        TInventoryInfoVO tInventoryInfoVO = new TInventoryInfoVO();
        TInventory byId = inventoryService.getById(id);
        switch (byId.getType()){
            case 1:
                List<TInventoryFrameDetail> list = inventoryFrameDetailService.lambdaQuery().eq(TInventoryFrameDetail::getInventoryId, id).list();
                tInventoryInfoVO.setFrameList(list);
                break;
            case 2:
                List<TInventoryLensDetail> list2 = inventoryLensDetailService.lambdaQuery().eq(TInventoryLensDetail::getInventoryId, id).list();
                tInventoryInfoVO.setLensList(list2);
                break;
        }
        TStore byId1 = storeService.getById(byId.getStoreId());
        if (byId1!=null)tInventoryInfoVO.setStore(byId1.getName());
        return ApiResult.success(tInventoryInfoVO);
    }
}
manage/src/main/java/com/jilongda/manage/controller/TWarehousingController.java
@@ -70,25 +70,26 @@
    public ApiResult<Integer> getCurrentByParamFrame(@RequestBody GetCurrentByParam getCurrentByParam) {
        // 根据型号名称 查询型号列表ids
        List<Integer> collect = modelService.lambdaQuery().eq(TModel::getName, getCurrentByParam.getModel())
                .eq(TModel::getMaterialId,getCurrentByParam.getMaterialId())
                .eq(TModel::getColor,getCurrentByParam.getColor())
                .eq(TModel::getBrandId,getCurrentByParam.getBrandId())
                .list().stream().map(TModel::getId).collect(Collectors.toList());
        TFrameGoods one = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect)
                .eq(TFrameGoods::getColor, getCurrentByParam).one();
                .eq(TFrameGoods::getColor, getCurrentByParam.getColor()).one();
        if (one!=null){
            return ApiResult.success(one.getTotal());
        }
        return ApiResult.success(0);
    }
    @ApiOperation(value = "镜片-根据品牌id、系列id、球/非球、折射率、球镜、柱镜查询当前库存")
    @ApiOperation(value = "镜片-根据品牌id、型号名称、色号名称、材质id查询当前库存")
    @PostMapping(value = "/getCurrentByParamLens")
    public ApiResult<Integer> getCurrentByParamLens(@RequestBody GetCurrentByParamLens dto) {
        TLensGoods one = lensGoodsService.lambdaQuery().in(TLensGoods::getSeriesId, dto.getSeriesId())
                .eq(TLensGoods::getLensType, dto.getLensType())
                .eq(TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
                .eq(TLensGoods::getBallMirror, dto.getBallMirror())
                .eq(TLensGoods::getColumnMirror, dto.getColumnMirror())
                .eq(dto.getLensType()!=null,TLensGoods::getLensType, dto.getLensType())
                .eq(dto.getRefractiveIndex()!=null,TLensGoods::getRefractiveIndex, dto.getRefractiveIndex())
                .eq(dto.getBallMirror()!=null,TLensGoods::getBallMirror, dto.getBallMirror())
                .eq(dto.getColumnMirror()!=null,TLensGoods::getColumnMirror, dto.getColumnMirror())
                .one();
        if (one!=null){
            return ApiResult.success(one.getTotal());
manage/src/main/java/com/jilongda/manage/dto/GetCurrentByParam.java
@@ -17,5 +17,7 @@
    private String color;
    @ApiModelProperty(value = "品牌id")
    private Integer brandId;
    @ApiModelProperty(value = "材质id")
    private Integer materialId;
}
manage/src/main/java/com/jilongda/manage/model/TInventory.java
@@ -33,7 +33,7 @@
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @ApiModelProperty(value = "1型号2品牌3材质4球/柱镜5折射率6系列")
    @ApiModelProperty(value = "盘点类型1型号2品牌3材质4球/柱镜5折射率6系列")
    @TableField("status")
    private Integer status;
manage/src/main/java/com/jilongda/manage/vo/TInventoryInfoVO.java
New file
@@ -0,0 +1,21 @@
package com.jilongda.manage.vo;
import com.jilongda.manage.model.TInventory;
import com.jilongda.manage.model.TInventoryFrameDetail;
import com.jilongda.manage.model.TInventoryLensDetail;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
@Data
@ApiModel(value = "盘点详情VO")
public class TInventoryInfoVO extends TInventory {
    @ApiModelProperty(value = "店铺名称")
    private String store;
    @ApiModelProperty(value = "镜片盘点明细")
    private List<TInventoryLensDetail> lensList;
    @ApiModelProperty(value = "镜片盘点明细")
    private List<TInventoryFrameDetail> frameList;
}