feat:成功开店

This commit is contained in:
苏竹红
2025-07-02 17:12:16 +08:00
parent 02d8adb069
commit 8b94e49334
6 changed files with 33 additions and 10 deletions

View File

@@ -63,6 +63,14 @@ public class StoreDao {
return storeMapper.listByMobile(mobile);
}
public List<StoreDO> getSubStoreByRegionIds(List<String> regionIdList) {
if(CollectionUtils.isEmpty(regionIdList)) {
return new ArrayList<>();
}
return storeMapper.getSubStoreByRegionIds(regionIdList);
}
public List<StoreDO> list() {
return storeMapper.list();
}

View File

@@ -31,6 +31,7 @@ public interface StoreMapper {
*/
List<StoreDO> listByMobile(@Param("mobile") String mobile);
List<StoreDO> getSubStoreByRegionIds(@Param("regionIdList") List<String> regionIdList);
/**
* 分页查询门店数据
* @return

View File

@@ -90,6 +90,17 @@
</where>
</select>
<select id="getSubStoreByRegionIds" resultMap="BaseResultMap">
select *
from store_${enterpriseId}
where is_delete = 'effective'
<if test="regionIdList != null and regionIdList.size >0 ">
<foreach collection="regionIdList" item="regionId" separator=" or " open="and (" close=" )">
region_path like concat('%/', #{regionId}, '/%')
</foreach>
</if>
</select>
<select id="list" resultMap="BaseResultMap">
select *
from store_${enterpriseId} where is_delete = 'effective' order by id asc

View File

@@ -1,6 +1,7 @@
package com.cool.store.service;
import com.cool.store.dto.StoreDTO;
import com.cool.store.entity.StoreDO;
import com.cool.store.response.MiniShopsResponse;
import com.github.pagehelper.PageInfo;
@@ -22,6 +23,6 @@ public interface StoreService {
*/
PageInfo<StoreDTO> getStoreExtendFieldInfo(Integer pageSize,Integer pageNum);
List<MiniShopsResponse> getStoreListByMobile(String mobile);
List<StoreDO> getStoreListByMobile(String mobile);
}

View File

@@ -108,6 +108,8 @@ public class ShopServiceImpl implements ShopService {
DecorationMeasureDAO decorationMeasureDAO;
@Resource
DecorationDesignInfoDAO decorationDesignInfoDAO;
@Resource
StoreService storeService;
@Override
@@ -601,9 +603,11 @@ public class ShopServiceImpl implements ShopService {
public List<MiniShopsResponse> getShopListSuccessOpen(Long lineId) {
LineInfoDO lineInfoDO = lineInfoDAO.getLineInfo(lineId);
List<StoreDO> storeDOS = storeDao.listByMobile(lineInfoDO.getMobile());
if (CollectionUtils.isEmpty(storeDOS)){
List<StoreDO> storeListByMobile = storeService.getStoreListByMobile(lineInfoDO.getMobile());
if (CollectionUtils.isEmpty(storeDOS)&&CollectionUtils.isEmpty(storeListByMobile)){
return new ArrayList<>();
}
storeDOS.addAll(storeListByMobile);
List<MiniShopsResponse> responses = new ArrayList<>();
for (StoreDO storeDO : storeDOS){
MiniShopsResponse response = new MiniShopsResponse();
@@ -613,6 +617,8 @@ public class ShopServiceImpl implements ShopService {
response.setDetailAddress(storeDO.getStoreAddress());
responses.add(response);
}
//对shopCode 去重
responses = responses.stream().filter(x -> x.getShopCode() != null).distinct().collect(Collectors.toList());
return responses;
}

View File

@@ -72,11 +72,11 @@ public class StoreServiceImpl implements StoreService {
}
@Override
public List<MiniShopsResponse> getStoreListByMobile(String mobile) {
public List<StoreDO> getStoreListByMobile(String mobile) {
//根据手机号查询 标品userId
EnterpriseUserDO enterpriseUserDO = enterpriseUserDAO.selectByMobile(mobile);
if (enterpriseUserDO == null){
throw new ServiceException(ErrorCodeEnum.USER_NOT_EXIST);
return Collections.emptyList();
}
//获取用户职位
List<Long> userRoleIds = enterpriseUserRoleDao.getUserRoleIds(enterpriseUserDO.getUserId());
@@ -95,12 +95,8 @@ public class StoreServiceImpl implements StoreService {
return Collections.emptyList();
}
List<String> regionIds = userAuthMapping.stream().map(UserAuthMappingDO::getMappingId).collect(Collectors.toList());
List<String> subRegionIds = regionMapper.getStoreIdsByRegionIds(regionIds);
if (CollectionUtils.isNotEmpty(subRegionIds)) {
regionIds.addAll(subRegionIds);
}
return Collections.emptyList();
List<StoreDO> list = storeDao.getSubStoreByRegionIds(regionIds);
return list;
}