优化
This commit is contained in:
		| @ -1,5 +1,6 @@ | |||||||
| package cn.iocoder.yudao.module.member.controller.admin.storegoodsinventory; | package cn.iocoder.yudao.module.member.controller.admin.storegoodsinventory; | ||||||
|  |  | ||||||
|  | import cn.hutool.core.bean.BeanUtil; | ||||||
| import cn.hutool.core.collection.CollectionUtil; | import cn.hutool.core.collection.CollectionUtil; | ||||||
| import cn.iocoder.yudao.framework.common.pojo.CommonResult; | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||||||
| import cn.iocoder.yudao.framework.common.pojo.PageParam; | import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||||||
| @ -89,7 +90,7 @@ public class StoreGoodsInventoryController { | |||||||
|         StoreGoodsInventoryDO storeGoodsInventory = storeGoodsInventoryService.getStoreGoodsInventory(id); |         StoreGoodsInventoryDO storeGoodsInventory = storeGoodsInventoryService.getStoreGoodsInventory(id); | ||||||
|         StoreGoodsInventoryRespVO bean = BeanUtils.toBean(storeGoodsInventory, StoreGoodsInventoryRespVO.class); |         StoreGoodsInventoryRespVO bean = BeanUtils.toBean(storeGoodsInventory, StoreGoodsInventoryRespVO.class); | ||||||
|         StoreGoodsDO storeGoods = storeGoodsService.getStoreGoods(storeGoodsInventory.getGoodsId()); |         StoreGoodsDO storeGoods = storeGoodsService.getStoreGoods(storeGoodsInventory.getGoodsId()); | ||||||
|         bean.setGoodsInfo(storeGoods); |         BeanUtil.copyProperties(storeGoods, bean); | ||||||
|         return success(bean); |         return success(bean); | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @ -105,7 +106,7 @@ public class StoreGoodsInventoryController { | |||||||
|             List<StoreGoodsDO> all = storeGoodsService.getAll(goodsList); |             List<StoreGoodsDO> all = storeGoodsService.getAll(goodsList); | ||||||
|             Map<Integer, StoreGoodsDO> collect = all.stream().collect(Collectors.toMap(StoreGoodsDO::getGoodsId, a -> a)); |             Map<Integer, StoreGoodsDO> collect = all.stream().collect(Collectors.toMap(StoreGoodsDO::getGoodsId, a -> a)); | ||||||
|             for (StoreGoodsInventoryRespVO vo:list){ |             for (StoreGoodsInventoryRespVO vo:list){ | ||||||
|                 vo.setGoodsInfo(collect.get(vo.getGoodsId())); |                 BeanUtil.copyProperties(collect.get(vo.getGoodsId()), vo); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  | |||||||
| @ -38,8 +38,37 @@ public class StoreGoodsInventoryRespVO { | |||||||
|     @ExcelProperty("创建时间") |     @ExcelProperty("创建时间") | ||||||
|     private LocalDateTime createTime; |     private LocalDateTime createTime; | ||||||
|  |  | ||||||
|     @Schema(description = "商品ID", example = "16735") |     /** | ||||||
|  |      * 类别Id | ||||||
|  |      */ | ||||||
|     @ExcelIgnore |     @ExcelIgnore | ||||||
|     private StoreGoodsDO goodsInfo; |     private Integer categoryId; | ||||||
|  |     /** | ||||||
|  |      * 商品名称 | ||||||
|  |      */ | ||||||
|  |     @ExcelIgnore | ||||||
|  |     private String goodsName; | ||||||
|  |     /** | ||||||
|  |      * 价格 | ||||||
|  |      */ | ||||||
|  |     @ExcelIgnore | ||||||
|  |     private Double price; | ||||||
|  |     /** | ||||||
|  |      * 售卖模式 | ||||||
|  |      */ | ||||||
|  |     @ExcelIgnore | ||||||
|  |     private Integer salesModel; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 库存 | ||||||
|  |      */ | ||||||
|  |     @ExcelIgnore | ||||||
|  |     private Integer inventory; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 图片 | ||||||
|  |      */ | ||||||
|  |     @ExcelIgnore | ||||||
|  |     private String img; | ||||||
| } | } | ||||||
| @ -125,7 +125,7 @@ public class StoreOrderController { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @PostMapping("/customize") |     @PostMapping("/customize") | ||||||
|     @Operation(summary = "自定义") |     @Operation(summary = "自定义扣款") | ||||||
|     public CommonResult<Boolean> customize(@RequestBody StoreOrderDto dto){ |     public CommonResult<Boolean> customize(@RequestBody StoreOrderDto dto){ | ||||||
|         storeOrderService.customize(dto); |         storeOrderService.customize(dto); | ||||||
|         return CommonResult.success(true); |         return CommonResult.success(true); | ||||||
|  | |||||||
| @ -61,11 +61,12 @@ public class StoreGoodsInventoryServiceImpl implements StoreGoodsInventoryServic | |||||||
|                     storeGoodsInventoryDO.setWeight(storeGoodsInventoryDO.getWeight() + vo.getWeight()); |                     storeGoodsInventoryDO.setWeight(storeGoodsInventoryDO.getWeight() + vo.getWeight()); | ||||||
|                     storeGoodsInventoryMapper.updateById(storeGoodsInventoryDO); |                     storeGoodsInventoryMapper.updateById(storeGoodsInventoryDO); | ||||||
|                     id = storeGoodsInventoryDO.getId(); |                     id = storeGoodsInventoryDO.getId(); | ||||||
|                 } else { |  | ||||||
|                     StoreGoodsInventoryDO storeGoodsInventory = BeanUtils.toBean(createReqVO, StoreGoodsInventoryDO.class); |  | ||||||
|                     storeGoodsInventoryMapper.insert(storeGoodsInventory); |  | ||||||
|                     id = storeGoodsInventory.getId(); |  | ||||||
|                 } |                 } | ||||||
|  | //                else { | ||||||
|  | //                    StoreGoodsInventoryDO storeGoodsInventory = BeanUtils.toBean(createReqVO, StoreGoodsInventoryDO.class); | ||||||
|  | //                    storeGoodsInventoryMapper.insert(storeGoodsInventory); | ||||||
|  | //                    id = storeGoodsInventory.getId(); | ||||||
|  | //                } | ||||||
|             } else {// 出库 |             } else {// 出库 | ||||||
|                 if (CollectionUtil.isEmpty(storeGoodsInventoryDOS)) { |                 if (CollectionUtil.isEmpty(storeGoodsInventoryDOS)) { | ||||||
|                     throw exception(STORE_GOODS_INVENTORY_NOT_EXISTS); |                     throw exception(STORE_GOODS_INVENTORY_NOT_EXISTS); | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 seesaw
					seesaw