切换店铺统计 √

下单选择会员 √
注册会员 √
完善手机号 √
会员流水信息同步 √
This commit is contained in:
谭凯凯
2025-04-10 15:37:17 +08:00
committed by Tankaikai
parent e17a2ee5d1
commit 63e608a208
26 changed files with 263 additions and 64 deletions

View File

@@ -82,6 +82,7 @@ public class ConsGroupServiceImpl extends ServiceImpl<ConsGroupMapper, ConsGroup
//entity.setStatus(StatusEnum.ENABLED.value());
entity.setShopId(shopId);
super.save(entity);
dto.setId(entity.getId());
}
@Override

View File

@@ -128,6 +128,7 @@ public class ConsInfoServiceImpl extends ServiceImpl<ConsInfoMapper, ConsInfo> i
entity.setIsStock(YesNoEnum.NO.value());
entity.setShopId(shopId);
super.save(entity);
dto.setId(entity.getId());
return true;
}

View File

@@ -31,8 +31,6 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import static com.czg.constant.CacheConstant.ADMIN_CLIENT_PRODUCT_LIST;
/**
* 商品分组
*
@@ -98,6 +96,7 @@ public class ProdGroupServiceImpl extends ServiceImpl<ProdGroupMapper, ProdGroup
ProdGroup entity = BeanUtil.copyProperties(dto, ProdGroup.class);
entity.setShopId(shopId);
super.save(entity);
dto.setId(entity.getId());
Long[] productIds = dto.getProductIds();
if (ArrayUtil.isNotEmpty(productIds)) {
int sort = 0;

View File

@@ -278,6 +278,7 @@ public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> impl
flow.setInOutType(InOutTypeEnum.IN.value());
flow.setInOutItem(InOutItemEnum.WIN_IN.value());
productStockFlowService.saveFlow(flow);
dto.setId(entity.getId());
}
@Override

View File

@@ -74,6 +74,7 @@ public class ShopProdCategoryServiceImpl extends ServiceImpl<ShopProdCategoryMap
entity.setPid(0L);
entity.setShopId(shopId);
super.save(entity);
dto.setId(entity.getId());
}
@Override

View File

@@ -67,7 +67,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
}
@Override
public void addShopProdUnit(ShopProdUnitDTO dto) {
public Long addShopProdUnit(ShopProdUnitDTO dto) {
Long shopId = StpKit.USER.getShopId(0L);
boolean exists = super.exists(query().eq(ShopProdUnit::getName, dto.getName())
.and(q -> {
@@ -88,6 +88,7 @@ public class ShopProdUnitServiceImpl extends ServiceImpl<ShopProdUnitMapper, Sho
entity.setStatus(StatusEnum.ENABLED.value());
entity.setShopId(shopId);
super.save(entity);
return entity.getId();
}
@Override

View File

@@ -17,11 +17,13 @@ import com.czg.utils.PageUtil;
import com.czg.utils.TreeUtils;
import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.DbChain;
import com.mybatisflex.core.update.UpdateChain;
import com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import static com.czg.product.entity.table.ShopProdSpecTableDef.SHOP_PROD_SPEC;
@@ -36,7 +38,6 @@ import static com.czg.product.entity.table.ShopProdSpecTableDef.SHOP_PROD_SPEC;
@Service
public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper, ShopProdSpec> implements ShopProdSpecService {
private QueryWrapper buildQueryWrapper(ShopProdSpecDTO param) {
QueryWrapper queryWrapper = PageUtil.buildSortQueryWrapper();
if (ObjUtil.isNotNull(param.getPid())) {
@@ -110,6 +111,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public void updateShopProdSpec(ShopProdSpecDTO dto) {
List<Long> affectedIdList = new ArrayList<>();
//上级规格不能为自身
if (dto.getId().equals(dto.getPid())) {
throw new CzgException("上级规格不能为自身");
@@ -142,6 +144,10 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
.like(ShopProdSpec::getPids, "," + entity.getId() + ",")
.eq(ShopProdSpec::getShopId, entity.getShopId()).update();
super.updateById(entity);
affectedIdList.add(entity.getId());
List<Long> ids = DbChain.table("tb_shop_prod_spec").select("id").where("pids like concat('%,',?,',%') and shop_id = ?", entity.getId(), entity.getShopId()).listAs(Long.class);
affectedIdList.addAll(ids);
dto.setAffectedIdList(affectedIdList);
}
@Override
@@ -174,6 +180,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public void quickAddShopProdSpec(ShopProdSpecDTO dto) {
List<Long> affectedIdList = new ArrayList<>();
String name = dto.getName();
AssertUtil.isBlank(name, "1级规格名称不能为空");
List<ShopProdSpecDTO> level2List = dto.getChildren();
@@ -201,6 +208,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
dto.setSort(ObjUtil.defaultIfNull(maxId, 0).intValue() + 1);
dto.setPid(GlobalConstant.TREE_ROOT);
addShopProdSpec(dto);
affectedIdList.add(dto.getId());
int xIndex = 0;
for (ShopProdSpecDTO level2Dto : level2List) {
xIndex++;
@@ -208,6 +216,7 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
level2Dto.setSort(xIndex);
level2Dto.setPid(dto.getId());
addShopProdSpec(level2Dto);
affectedIdList.add(level2Dto.getId());
List<ShopProdSpecDTO> level3List = level2Dto.getChildren();
int yIndex = 0;
for (ShopProdSpecDTO level3Dto : level3List) {
@@ -216,8 +225,10 @@ public class ShopProductSpecServiceImpl extends ServiceImpl<ShopProdSpecMapper,
level3Dto.setSort(yIndex);
level3Dto.setPid(level2Dto.getId());
addShopProdSpec(level3Dto);
affectedIdList.add(level3Dto.getId());
}
}
dto.setAffectedIdList(affectedIdList);
}
@Override

View File

@@ -3,7 +3,6 @@ package com.czg.service.product.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
@@ -18,14 +17,12 @@ import com.czg.exception.CzgException;
import com.czg.product.entity.*;
import com.czg.product.service.*;
import com.czg.product.vo.ProductGroupVo;
import com.czg.sa.StpKit;
import com.czg.utils.AssertUtil;
import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;