This commit is contained in:
seesaw
2024-11-21 15:38:04 +08:00
parent 6f9672baa8
commit badcecd0e8
4 changed files with 40 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.member.controller.admin.storegoodsinventory;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
@ -89,7 +90,7 @@ public class StoreGoodsInventoryController {
StoreGoodsInventoryDO storeGoodsInventory = storeGoodsInventoryService.getStoreGoodsInventory(id);
StoreGoodsInventoryRespVO bean = BeanUtils.toBean(storeGoodsInventory, StoreGoodsInventoryRespVO.class);
StoreGoodsDO storeGoods = storeGoodsService.getStoreGoods(storeGoodsInventory.getGoodsId());
bean.setGoodsInfo(storeGoods);
BeanUtil.copyProperties(storeGoods, bean);
return success(bean);
}
@ -105,7 +106,7 @@ public class StoreGoodsInventoryController {
List<StoreGoodsDO> all = storeGoodsService.getAll(goodsList);
Map<Integer, StoreGoodsDO> collect = all.stream().collect(Collectors.toMap(StoreGoodsDO::getGoodsId, a -> a));
for (StoreGoodsInventoryRespVO vo:list){
vo.setGoodsInfo(collect.get(vo.getGoodsId()));
BeanUtil.copyProperties(collect.get(vo.getGoodsId()), vo);
}
}

View File

@ -38,8 +38,37 @@ public class StoreGoodsInventoryRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "商品ID", example = "16735")
/**
* 类别Id
*/
@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;
}

View File

@ -125,7 +125,7 @@ public class StoreOrderController {
}
@PostMapping("/customize")
@Operation(summary = "自定义")
@Operation(summary = "自定义扣款")
public CommonResult<Boolean> customize(@RequestBody StoreOrderDto dto){
storeOrderService.customize(dto);
return CommonResult.success(true);

View File

@ -61,11 +61,12 @@ public class StoreGoodsInventoryServiceImpl implements StoreGoodsInventoryServic
storeGoodsInventoryDO.setWeight(storeGoodsInventoryDO.getWeight() + vo.getWeight());
storeGoodsInventoryMapper.updateById(storeGoodsInventoryDO);
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 {// 出库
if (CollectionUtil.isEmpty(storeGoodsInventoryDOS)) {
throw exception(STORE_GOODS_INVENTORY_NOT_EXISTS);