|
|
@@ -14,10 +14,7 @@ import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.model.vo.TableBottom;
|
|
|
import com.sckw.core.model.vo.TableStatisticRes;
|
|
|
import com.sckw.core.model.vo.TableTop;
|
|
|
-import com.sckw.core.utils.BeanUtils;
|
|
|
-import com.sckw.core.utils.CollectionUtils;
|
|
|
-import com.sckw.core.utils.NumberUtils;
|
|
|
-import com.sckw.core.utils.StringUtils;
|
|
|
+import com.sckw.core.utils.*;
|
|
|
import com.sckw.core.web.constant.HttpStatus;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.excel.utils.DateUtil;
|
|
|
@@ -105,7 +102,8 @@ public class KwpGoodsService {
|
|
|
if (Objects.nonNull(address)) {
|
|
|
goods.setAreaCode(address.getCityCode()).setAddressName(address.getName());
|
|
|
}
|
|
|
- goods.setEntId(LoginUserHolder.getEntId()).setStatus(GoodsStatusEnum.SAVED.getCode());
|
|
|
+ goods.setEntId(LoginUserHolder.getEntId()).setThumb(FileUtils.replaceAll(goods.getThumb()))
|
|
|
+ .setStatus(GoodsStatusEnum.SAVED.getCode());
|
|
|
kwpGoodsMapper.insert(goods);
|
|
|
//添加商品其他信息
|
|
|
addGoodsOtherInfo(goods.getId(), BeanUtils.copyProperties(param, AddGoodsParam.class));
|
|
|
@@ -130,7 +128,8 @@ public class KwpGoodsService {
|
|
|
KwpGoods goods = BeanUtils.copyProperties(param, KwpGoods.class);
|
|
|
AddressInfo address = param.getAddressInfo();
|
|
|
goods.setCode(NumberUtils.createRandomVcode()).setAreaCode(address.getCityCode()).setAddressName(address.getName())
|
|
|
- .setEntId(LoginUserHolder.getEntId()).setAddedTime(new Date()).setStatus(GoodsStatusEnum.PUT_ON_SHELVES.getCode());
|
|
|
+ .setThumb(FileUtils.replaceAll(goods.getThumb())).setEntId(LoginUserHolder.getEntId())
|
|
|
+ .setAddedTime(new Date()).setStatus(GoodsStatusEnum.PUT_ON_SHELVES.getCode());
|
|
|
kwpGoodsMapper.insert(goods);
|
|
|
//添加商品其他信息
|
|
|
addGoodsOtherInfo(goods.getId(), param);
|
|
|
@@ -168,6 +167,7 @@ public class KwpGoodsService {
|
|
|
List<KwpGoodsImage> list = new ArrayList<>(images.size());
|
|
|
images.forEach(e -> {
|
|
|
KwpGoodsImage image = BeanUtils.copyProperties(e, KwpGoodsImage.class);
|
|
|
+ image.setImage(FileUtils.replaceAll(e.getImage()));
|
|
|
image.setGoodsId(goodsId);
|
|
|
list.add(image);
|
|
|
});
|
|
|
@@ -217,7 +217,8 @@ public class KwpGoodsService {
|
|
|
RecommendGoods recommendGoods = BeanUtils.copyProperties(e, RecommendGoods.class);
|
|
|
List<KwpGoodsPriceRange> prices = map.get(recommendGoods.getId());
|
|
|
recommendGoods.setUnitLabel(CollectionUtils.isNotEmpty(unitMap) ? unitMap.get(recommendGoods.getUnit()) : null)
|
|
|
- .setPrice(CollectionUtils.isNotEmpty(prices) ? prices.get(0).getPrice() : null);
|
|
|
+ .setPrice(CollectionUtils.isNotEmpty(prices) ? prices.get(0).getPrice() : null)
|
|
|
+ .setThumb(FileUtils.splice(e.getThumb()));
|
|
|
recommendGoodsList.add(recommendGoods);
|
|
|
});
|
|
|
detail.setRecommendGoodsList(recommendGoodsList);
|
|
|
@@ -271,7 +272,13 @@ public class KwpGoodsService {
|
|
|
.setStatusLabel(CollectionUtils.isNotEmpty(goodsStatusMap) ? goodsStatusMap.get(String.valueOf(detail.getStatus())) : null)
|
|
|
.setPrepaidLimitLabel(Objects.equals(detail.getPrepaidLimit(), 1) ? "是" : "否");
|
|
|
//商品图片信息
|
|
|
+ if (Objects.nonNull(goods.getThumb())) {
|
|
|
+ detail.setThumb(FileUtils.splice(goods.getThumb()));
|
|
|
+ }
|
|
|
List<KwpGoodsImage> goodsImages = kwpGoodsImageService.getByGoodsId(id);
|
|
|
+ goodsImages.forEach(e -> {
|
|
|
+ e.setImage(FileUtils.splice(e.getImage()));
|
|
|
+ });
|
|
|
List<GoodsImagesDetail> images = BeanUtils.copyToList(goodsImages, GoodsImagesDetail.class);
|
|
|
//商品价格段信息
|
|
|
List<KwpGoodsPriceRange> priceRanges = kwpGoodsPriceRangeService.getByGoodsId(id);
|
|
|
@@ -337,7 +344,7 @@ public class KwpGoodsService {
|
|
|
.set(KwpGoods::getSupplyEntId, param.getSupplyEntId())
|
|
|
.set(KwpGoods::getManager, param.getManager())
|
|
|
.set(KwpGoods::getRemark, param.getRemark())
|
|
|
- .set(KwpGoods::getThumb, param.getThumb())
|
|
|
+ .set(KwpGoods::getThumb, FileUtils.replaceAll(param.getThumb()))
|
|
|
.set(KwpGoods::getAreaCode, areaCode)
|
|
|
.set(KwpGoods::getAddressName, addressName)
|
|
|
.eq(KwpGoods::getId, param.getId());
|
|
|
@@ -380,7 +387,7 @@ public class KwpGoodsService {
|
|
|
List<KwpGoodsImage> list = new ArrayList<>(param.getImages().size());
|
|
|
param.getImages().forEach(e -> {
|
|
|
KwpGoodsImage image = BeanUtils.copyProperties(e, KwpGoodsImage.class);
|
|
|
- image.setGoodsId(goodsId);
|
|
|
+ image.setGoodsId(goodsId).setImage(FileUtils.replaceAll(image.getImage()));
|
|
|
list.add(image);
|
|
|
});
|
|
|
kwpGoodsImageService.insertBatch(list);
|
|
|
@@ -705,6 +712,7 @@ public class KwpGoodsService {
|
|
|
.setAddress(addressMap.get(id)).setSupplyEnt(entMap.get(e.getSupplyEntId()))
|
|
|
.setManageName(Objects.nonNull(manager) ? manager.getName() : null)
|
|
|
.setPhone(Objects.nonNull(manager) ? manager.getPhone() : null)
|
|
|
+ .setThumb(FileUtils.splice(e.getThumb()))
|
|
|
.setCreateByName(Objects.nonNull(createUser) ? createUser.getName() : null);
|
|
|
List<KwpGoodsPriceRange> priceRanges = priceRangeMap.get(id);
|
|
|
if (CollectionUtils.isNotEmpty(priceRanges)) {
|
|
|
@@ -912,6 +920,7 @@ public class KwpGoodsService {
|
|
|
.setAddressName(Objects.isNull(address) ? null : address.getCityName())
|
|
|
.setDetailAddress(Objects.isNull(address) ? null : address.getDetailAddress())
|
|
|
.setPrice(CollectionUtils.isEmpty(priceRanges) ? null : priceRanges.get(0).getPrice())
|
|
|
+ .setThumb(FileUtils.splice(e.getThumb()))
|
|
|
.setSupplyEnt(entMap.get(e.getSupplyEntId()));
|
|
|
result.add(materials);
|
|
|
});
|
|
|
@@ -989,7 +998,11 @@ public class KwpGoodsService {
|
|
|
* @return: java.util.List<com.sckw.product.model.KwpGoods>
|
|
|
*/
|
|
|
public KwpGoods selectById(Long id) {
|
|
|
- return kwpGoodsMapper.selectById(id);
|
|
|
+ KwpGoods goods = kwpGoodsMapper.selectById(id);
|
|
|
+ if (Objects.nonNull(goods)) {
|
|
|
+ goods.setThumb(FileUtils.splice(goods.getThumb()));
|
|
|
+ }
|
|
|
+ return goods;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -1002,6 +1015,11 @@ public class KwpGoodsService {
|
|
|
*/
|
|
|
public List<KwpGoods> selectByIds(List<Long> ids) {
|
|
|
List<KwpGoods> list = kwpGoodsMapper.selectBatchIds(ids);
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ list.forEach(e -> {
|
|
|
+ e.setThumb(FileUtils.splice(e.getThumb()));
|
|
|
+ });
|
|
|
+ }
|
|
|
return CollectionUtils.emptyIfNull(list);
|
|
|
}
|
|
|
|