Merge branch 'ww' into test

# Conflicts:
#	eladmin-system/src/main/java/cn/ysk/cashier/service/impl/shopimpl/TbShopTableServiceImpl.java
This commit is contained in:
2024-10-08 13:41:18 +08:00
3 changed files with 5 additions and 31 deletions

View File

@@ -415,13 +415,6 @@ public class TbProductServiceImpl implements TbProductService {
if (resources.getCategoryId() == null) { if (resources.getCategoryId() == null) {
throw new BadRequestException("必填内容未填写"); throw new BadRequestException("必填内容未填写");
} }
// if (resources.getIsShowMall() == 1) {
// for (TbProductSku sku : resources.getSkuList()) {
// if (sku.getStockNumber() <= 0) {
// throw new BadRequestException("上架区域包括小程序时,库存数量必须大于0。");
// }
// }
// }
product.setCategoryId(String.valueOf(resources.getCategoryId())); product.setCategoryId(String.valueOf(resources.getCategoryId()));
} }
if (product.getUnitId() == null) { if (product.getUnitId() == null) {
@@ -465,16 +458,6 @@ public class TbProductServiceImpl implements TbProductService {
tbProductRepository.save(save); tbProductRepository.save(save);
//sku //sku
if (resources.getSkuList() != null) { if (resources.getSkuList() != null) {
Integer warnLine = 0;
List<TbProduct> productList = tbProductRepository.selectByShopId(resources.getShopId());
if (!productList.isEmpty()) {
TbProduct p = productList.get(0);
List<TbProductSku> productSkus = tbProductSkuRepository.searchSku(p.getId().toString());
if (!productSkus.isEmpty()) {
warnLine = productSkus.get(0).getWarnLine();
}
}
List<TbProductSku> skuList = new ArrayList<>(); List<TbProductSku> skuList = new ArrayList<>();
for (TbProductSku sku : resources.getSkuList()) { for (TbProductSku sku : resources.getSkuList()) {
sku.setProductId(String.valueOf(save.getId())); sku.setProductId(String.valueOf(save.getId()));
@@ -482,13 +465,8 @@ public class TbProductServiceImpl implements TbProductService {
sku.setCreatedAt(Instant.now().toEpochMilli()); sku.setCreatedAt(Instant.now().toEpochMilli());
sku.setUpdatedAt(Instant.now().toEpochMilli()); sku.setUpdatedAt(Instant.now().toEpochMilli());
sku.setIsGrounding(1); sku.setIsGrounding(1);
sku.setWarnLine(warnLine);
skuList.add(sku); skuList.add(sku);
} }
List<TbProductSku> tbProductSkus = tbProductSkuRepository.saveAll(skuList);
Map<Integer, Double> idStockMap = tbProductSkus.stream()
.collect(Collectors.toMap(TbProductSku::getId, TbProductSku::getStockNumber));
redisUtils.redisUp(1, save.getShopId(), idStockMap);
} }
//保存到sku_result //保存到sku_result
if ("sku".equals(resources.getTypeEnum())) { if ("sku".equals(resources.getTypeEnum())) {

View File

@@ -19,9 +19,9 @@ import cn.ysk.cashier.system.domain.Dept;
import cn.ysk.cashier.system.domain.Job; import cn.ysk.cashier.system.domain.Job;
import cn.ysk.cashier.system.domain.Role; import cn.ysk.cashier.system.domain.Role;
import cn.ysk.cashier.system.domain.User; import cn.ysk.cashier.system.domain.User;
import cn.ysk.cashier.system.enums.ParamsEnum; //import cn.ysk.cashier.system.enums.ParamsEnum;
import cn.ysk.cashier.system.repository.UserRepository; import cn.ysk.cashier.system.repository.UserRepository;
import cn.ysk.cashier.system.service.ParamsService; //import cn.ysk.cashier.system.service.ParamsService;
import cn.ysk.cashier.system.service.UserService; import cn.ysk.cashier.system.service.UserService;
import cn.ysk.cashier.utils.*; import cn.ysk.cashier.utils.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@@ -62,7 +62,7 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
private final UserCacheManager userCacheManager; private final UserCacheManager userCacheManager;
private final TokenProvider tokenProvider; private final TokenProvider tokenProvider;
private final ParamsService paramsService; // private final ParamsService paramsService;
private final TbMerchantRegisterRepository merchantRegisterRepository; private final TbMerchantRegisterRepository merchantRegisterRepository;
@@ -97,8 +97,8 @@ public class TbShopInfoServiceImpl implements TbShopInfoService {
tbShopInfo.setSmallQrcode(smallQrcode); tbShopInfo.setSmallQrcode(smallQrcode);
tbShopInfoRepository.save(tbShopInfo); tbShopInfoRepository.save(tbShopInfo);
} }
String baseUrl = paramsService.getValue(ParamsEnum.SHOP_ORDER_PAY_BASE_URL.name()); // String baseUrl = paramsService.getValue(ParamsEnum.SHOP_ORDER_PAY_BASE_URL.name());
tbShopInfo.setPaymentQrcode(baseUrl+"?shopId="+id); // tbShopInfo.setPaymentQrcode(baseUrl+"?shopId="+id);
ValidationUtil.isNull(tbShopInfo.getId(),"TbShopInfo","id",id); ValidationUtil.isNull(tbShopInfo.getId(),"TbShopInfo","id",id);
return tbShopInfoMapper.toDto(tbShopInfo); return tbShopInfoMapper.toDto(tbShopInfo);
} }

View File

@@ -90,10 +90,6 @@ public interface TbProductService {
*/ */
void download(List<TbProductDto> all, HttpServletResponse response) throws IOException; void download(List<TbProductDto> all, HttpServletResponse response) throws IOException;
void updateIsHot(Integer id,Integer isStock);
void updateIsStock(Integer proId, String shopId, Integer isStock);
/** /**
* 增加库存 * 增加库存
* *