feat:getStoreListByMobile

This commit is contained in:
苏竹红
2025-09-05 15:51:21 +08:00
parent 8465432264
commit 910efd055d
2 changed files with 66 additions and 37 deletions

View File

@@ -89,9 +89,9 @@
<select id="listByMobile" resultMap="BaseResultMap"> <select id="listByMobile" resultMap="BaseResultMap">
select * select *
from store_${enterpriseId} from store_${enterpriseId} a left join store_master_signer_info_5558ce7a3aa84e3590392fcaa8697ffb b on a.store_id = b.store_id
<where> <where>
and is_delete = 'effective' and a.is_delete = 'effective'
<if test="mobile!=null and mobile !=''"> <if test="mobile!=null and mobile !=''">
and `extend_field` like concat('%', #{mobile}, '%') and `extend_field` like concat('%', #{mobile}, '%')
</if> </if>
@@ -99,34 +99,57 @@
</select> </select>
<select id="getSubStoreByRegionIdsAndMobile" resultType="com.cool.store.response.MiniShopsResponse"> <select id="getSubStoreByRegionIdsAndMobile" resultType="com.cool.store.response.MiniShopsResponse">
select store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress <choose>
from store_${enterpriseId} <!-- 情况1regionIdList不为空使用UNION优化 -->
where is_delete = 'effective' <when test="regionIdList != null and regionIdList.size > 0">
<if test="storeName!=null and storeName!=''"> SELECT store_id as storeId, store_name as shopName, store_num as shopCode, store_address as detailAddress
and store_name like concat('%', #{storeName}, '%') FROM store_${enterpriseId} a
</if> WHERE a.is_delete = 'effective'
<if test="storeNum!=null and storeNum!=''"> <if test="storeName!=null and storeName!=''">
and store_num = #{storeNum} AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
</if> </if>
and ( <if test="storeNum!=null and storeNum!=''">
<if test="regionIdList != null and regionIdList.size >0 "> AND a.store_num = #{storeNum}
<foreach collection="regionIdList" item="regionId" separator=" or " open=" (" close=" )"> </if>
region_path like concat('%/', #{regionId}, '/%') AND (
</foreach> <foreach collection="regionIdList" item="regionId" separator=" OR ">
</if> a.region_path LIKE CONCAT('%/', #{regionId}, '/%')
<if test="mobile!=null and mobile !=''"> </foreach>
<choose> )
<when test="regionIdList != null and regionIdList.size >0 ">
or `extend_field` like concat('%', #{mobile}, '%') UNION
</when>
<otherwise> SELECT a.store_id as storeId, a.store_name as shopName, a.store_num as shopCode, a.store_address as detailAddress
`extend_field` like concat('%', #{mobile}, '%') FROM store_${enterpriseId} a
</otherwise> INNER JOIN store_master_signer_info_${enterpriseId} b ON a.store_id = b.store_id
</choose> WHERE a.is_delete = 'effective'
</if> <if test="storeName!=null and storeName!=''">
) AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
</if>
<if test="storeNum!=null and storeNum!=''">
AND a.store_num = #{storeNum}
</if>
AND (b.signer1_mobile = #{mobile} OR b.signer2_mobile = #{mobile})
</when>
<!-- 情况2regionIdList为空直接查询关联表 -->
<otherwise>
SELECT a.store_id as storeId, a.store_name as shopName, a.store_num as shopCode, a.store_address as detailAddress
FROM store_${enterpriseId} a
INNER JOIN store_master_signer_info_${enterpriseId} b ON a.store_id = b.store_id
WHERE a.is_delete = 'effective'
<if test="storeName!=null and storeName!=''">
AND a.store_name LIKE CONCAT('%', #{storeName}, '%')
</if>
<if test="storeNum!=null and storeNum!=''">
AND a.store_num = #{storeNum}
</if>
AND (b.signer1_mobile = #{mobile} OR b.signer2_mobile = #{mobile})
</otherwise>
</choose>
</select> </select>
<select id="list" resultMap="BaseResultMap"> <select id="list" resultMap="BaseResultMap">
select * select *
from store_${enterpriseId} where is_delete = 'effective' order by id asc from store_${enterpriseId} where is_delete = 'effective' order by id asc

View File

@@ -1,6 +1,7 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.constants.CommonConstants; import com.cool.store.constants.CommonConstants;
import com.cool.store.dao.*; import com.cool.store.dao.*;
import com.cool.store.entity.*; import com.cool.store.entity.*;
@@ -20,7 +21,7 @@ import com.cool.store.service.UserAuthMappingService;
import com.cool.store.utils.RedisConstantUtil; import com.cool.store.utils.RedisConstantUtil;
import com.cool.store.utils.RedisUtilPool; import com.cool.store.utils.RedisUtilPool;
import com.cool.store.utils.poi.StringUtils; import com.cool.store.utils.poi.StringUtils;
import io.lettuce.core.ZAddArgs; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@@ -38,6 +39,7 @@ import java.util.stream.Stream;
* @createDate 2024-10-09 14:05:52 * @createDate 2024-10-09 14:05:52
*/ */
@Service @Service
@Slf4j
public class BuildInformationServiceImpl implements BuildInformationService { public class BuildInformationServiceImpl implements BuildInformationService {
@Resource @Resource
private PlatformBuildDAO platformBuildDAO; private PlatformBuildDAO platformBuildDAO;
@@ -195,6 +197,7 @@ public class BuildInformationServiceImpl implements BuildInformationService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Integer submitOrUpdate(BuildInformationRequest request) { public Integer submitOrUpdate(BuildInformationRequest request) {
log.info("提交/修改建店资料开始,shopId:{}", JSONObject.toJSONString(request));
String lockKey = redisConstantUtil.submitBuildKey(request.getShopId()); String lockKey = redisConstantUtil.submitBuildKey(request.getShopId());
String lockValue = UUID.randomUUID().toString(); String lockValue = UUID.randomUUID().toString();
boolean acquired = false; boolean acquired = false;
@@ -202,14 +205,17 @@ public class BuildInformationServiceImpl implements BuildInformationService {
acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS); acquired = redisUtilPool.setNxExpire(lockKey, lockValue, CommonConstants.TEN_SECONDS);
if (Boolean.TRUE.equals(acquired)) { if (Boolean.TRUE.equals(acquired)) {
ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId()); ShopInfoDO shopInfoDO = shopInfoDAO.getShopInfo(request.getShopId());
// if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){ if (JoinModeEnum.FLAGSHIP_STORE.getCode()!=shopInfoDO.getJoinMode()){
// //校验结算人非空 log.info("FLAGSHIP_STORE{}{}{}{}{}{}{}",request.getSettlerName(),request.getSettlerIdCardFront(),
// if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(), request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
// request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(), request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName());
// request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) { //校验结算人非空
// throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR); if (StringUtils.isAnyBlank(request.getSettlerName(),request.getSettlerIdCardFront(),
// } request.getSettlerInHandFrontPicture(),request.getSettlerBankBackPhotoUrl(),
// } request.getSettlerBankNumber(),request.getSettlerBankMobile(),request.getSettlerBankName())) {
throw new ServiceException(ErrorCodeEnum.PARAMS_VALIDATE_ERROR);
}
}
BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(request.getShopId()); BuildInformationDO informationDO = buildInformationDAO.selectOneByShopId(request.getShopId());
BuildInformationDO buildInformationDO = request.toDO(); BuildInformationDO buildInformationDO = request.toDO();