From 3a896ec408dede1ebed687bdc75475103cf29703 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期二, 07 一月 2025 10:20:32 +0800 Subject: [PATCH] bug --- manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java | 26 ++++++++++++++++---------- 1 files changed, 16 insertions(+), 10 deletions(-) diff --git a/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java b/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java index c845d9e..1a34c04 100644 --- a/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java +++ b/manage/src/main/java/com/jilongda/manage/controller/TInventoryController.java @@ -19,6 +19,7 @@ import io.swagger.annotations.ApiOperation; import io.swagger.models.auth.In; import org.springframework.beans.BeanUtils; +import org.springframework.context.annotation.Bean; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.*; @@ -68,12 +69,15 @@ } @ApiOperation(value = "镜架添加盘点") @PostMapping(value = "/addFrameInventory") - public ApiResult<PageInfo<TInventoryVO>> addFrameInventory(@RequestBody TInventoryQuery query) { - if (StringUtils.hasLength(query.getStartTime())){ - query.setStartTime(query.getStartTime()+" 00:00:00"); - query.setEndTime(query.getEndTime()+" 23:59:59"); + public ApiResult addFrameInventory(@RequestBody FrameInventoryDTO query) { + TInventory tInventory = new TInventory(); + BeanUtils.copyProperties(query, tInventory); + inventoryService.save(tInventory); + for (TInventoryFrameDetail tInventoryFrameDetail : query.getList()) { + tInventoryFrameDetail.setInventoryId(tInventory.getId()); } - return ApiResult.success(inventoryService.pageList(query)); + inventoryFrameDetailService.saveBatch(query.getList()); + return ApiResult.success(tInventory.getId()); } @ApiOperation(value = "镜片添加盘点") @PostMapping(value = "/addLensInventory") @@ -85,7 +89,7 @@ tInventoryFrameDetail.setInventoryId(tInventory.getId()); } inventoryLensDetailService.saveBatch(query.getList()); - return ApiResult.success(); + return ApiResult.success(tInventory.getId()); } @ApiOperation(value = "镜架-根据品牌id查询对应库存") @@ -120,11 +124,12 @@ @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<Integer> collect = modelService.lambdaQuery().eq(StringUtils.hasLength(getCurrentByParam.getModel()),TModel::getName, getCurrentByParam.getModel()) + .eq(StringUtils.hasLength(getCurrentByParam.getColor()),TModel::getColor,getCurrentByParam.getColor()) + .eq(getCurrentByParam.getMaterialId()!=null,TModel::getMaterialId,getCurrentByParam.getMaterialId()) + .eq(getCurrentByParam.getBrandId()!=null,TModel::getBrandId,getCurrentByParam.getBrandId()) .list().stream().map(TModel::getId).collect(Collectors.toList()); + if (collect.isEmpty())collect.add(-1); TFrameGoods one = frameGoodsService.lambdaQuery().in(TFrameGoods::getModelId, collect) .eq(TFrameGoods::getColor, getCurrentByParam.getColor()).one(); if (one!=null){ @@ -153,6 +158,7 @@ TInventoryInfoVO tInventoryInfoVO = new TInventoryInfoVO(); TInventory byId = inventoryService.getById(id); + BeanUtils.copyProperties(byId, tInventoryInfoVO); switch (byId.getType()){ case 1: List<TInventoryFrameDetail> list = inventoryFrameDetailService.lambdaQuery().eq(TInventoryFrameDetail::getInventoryId, id).list(); -- Gitblit v1.7.1