|
@@ -126,6 +126,63 @@ private KcGoodsServiceImpl kcGoodsService;
|
|
|
return Result.OK(map);
|
|
return Result.OK(map);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 查询商品列表
|
|
|
|
|
+ * @param dto
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public Result queryList(CesGoodsSearchDto dto) {
|
|
|
|
|
+ QueryWrapper<CesGoods> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
+ if (!StringUtils.isBlank(dto.getSearch())) {
|
|
|
|
|
+ String search = CommonUtils.escapeChar(dto.getSearch());
|
|
|
|
|
+ queryWrapper.or().like(CesGoods.BAR_CODE, search);
|
|
|
|
|
+ queryWrapper.or().like(CesGoods.NAME, search);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!StringUtils.isBlank(dto.getTypeId())) {
|
|
|
|
|
+ String typeId = CommonUtils.escapeChar(dto.getTypeId());
|
|
|
|
|
+ queryWrapper.like(CesGoods.GOOD_TYPE, typeId);
|
|
|
|
|
+ }
|
|
|
|
|
+ queryWrapper.eq(CesGoods.HOTEL_ID, dto.getHotelId());
|
|
|
|
|
+ queryWrapper.eq(CesGoods.INVALID, false);
|
|
|
|
|
+ queryWrapper.orderByDesc(CesGoods.CREATAT);
|
|
|
|
|
+
|
|
|
|
|
+ List<CesGoods> result = goodsMapper.selectList(queryWrapper);
|
|
|
|
|
+ List<String> hotelIds = result.stream().map(v -> v.getHotelId()).collect(Collectors.toList());
|
|
|
|
|
+ List<BusHotel> hotels = busHotelService.findHotelsByIds(hotelIds);
|
|
|
|
|
+ List<String> typeIds = result.stream().map(v -> v.getGoodType()).collect(Collectors.toList());
|
|
|
|
|
+ List<CesStockType> typeList = stockTypeService.fetchByIds(typeIds);
|
|
|
|
|
+ List<String> unitIds = result.stream().map(v -> v.getGoodUnit()).collect(Collectors.toList());
|
|
|
|
|
+ List<CesGoodsUnit> unitList = goodsUnitService.fetchByIds(unitIds);
|
|
|
|
|
+ List<CesGoodsVo> voList = new ArrayList<>();
|
|
|
|
|
+ result.forEach(v -> {
|
|
|
|
|
+ CesGoodsVo vo = new CesGoodsVo();
|
|
|
|
|
+ BeanUtil.copyProperties(v, vo);
|
|
|
|
|
+ Optional<BusHotel> busHotelOptional = hotels.stream().filter(c -> c.getId().equals(v.getHotelId())).findFirst();
|
|
|
|
|
+ if (busHotelOptional.isPresent()) {
|
|
|
|
|
+ vo.setHotelName(busHotelOptional.get().getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ Optional<CesStockType> typeOptional = typeList.stream().filter(c -> c.getId().equals(v.getGoodType())).findFirst();
|
|
|
|
|
+ if (typeOptional.isPresent()) {
|
|
|
|
|
+ vo.setTypeName(typeOptional.get().getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ Optional<CesGoodsUnit> unitOptional = unitList.stream().filter(c -> c.getId().equals(v.getGoodUnit())).findFirst();
|
|
|
|
|
+ if (unitOptional.isPresent()) {
|
|
|
|
|
+ vo.setUnitName(unitOptional.get().getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (v.getIsStock() && ObjectUtils.isNotEmpty(v.getDepositoryInGoodsId())) {
|
|
|
|
|
+ KcDepositoryInGoods kcDepositoryInGoods = kcDepositoryInGoodsService.getById(v.getDepositoryInGoodsId());
|
|
|
|
|
+ if (kcDepositoryInGoods != null) {
|
|
|
|
|
+ KcGoods kcGoods = kcGoodsService.getById(kcDepositoryInGoods.getGoodsId());
|
|
|
|
|
+ if (kcGoods != null) {
|
|
|
|
|
+ vo.setStockGoodsName(kcGoods.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ vo.setNumber(Double.valueOf(0));
|
|
|
|
|
+ voList.add(vo);
|
|
|
|
|
+ });
|
|
|
|
|
+ return Result.OK(voList);
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 创建商品
|
|
* 创建商品
|