|
@@ -28,6 +28,9 @@ import shop.alien.store.annotation.TrackEvent;
|
|
|
import shop.alien.store.config.BaseRedisService;
|
|
import shop.alien.store.config.BaseRedisService;
|
|
|
import shop.alien.store.service.StoreInfoService;
|
|
import shop.alien.store.service.StoreInfoService;
|
|
|
import shop.alien.store.service.StoreQualificationService;
|
|
import shop.alien.store.service.StoreQualificationService;
|
|
|
|
|
+import shop.alien.entity.store.UserLoginInfo;
|
|
|
|
|
+import shop.alien.util.common.TokenInfo;
|
|
|
|
|
+import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -212,6 +215,37 @@ public class StoreInfoController {
|
|
|
return R.data(storeInfoService.getDetail(id));
|
|
return R.data(storeInfoService.getDetail(id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "门店详细信息(通过商家手机号)")
|
|
|
|
|
+ @ApiOperationSupport(order = 6)
|
|
|
|
|
+ @ApiImplicitParams({@ApiImplicitParam(name = "phone", value = "商家手机号", dataType = "String", paramType = "query", required = true)})
|
|
|
|
|
+ @GetMapping("/getDetailByPhone")
|
|
|
|
|
+ public R<StoreMainInfoVo> getDetailByPhone(@RequestParam("phone") String phone) {
|
|
|
|
|
+ log.info("StoreInfoController.getDetailByPhone?phone={}", phone);
|
|
|
|
|
+ try {
|
|
|
|
|
+ // 根据手机号查询 store_user
|
|
|
|
|
+ LambdaQueryWrapper<StoreUser> userWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ userWrapper.eq(StoreUser::getPhone, phone)
|
|
|
|
|
+ .eq(StoreUser::getDeleteFlag, 0);
|
|
|
|
|
+ StoreUser storeUser = storeUserMapper.selectOne(userWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if (storeUser == null) {
|
|
|
|
|
+ log.warn("未找到手机号对应的商家用户: phone={}", phone);
|
|
|
|
|
+ return R.fail("未找到该手机号对应的商家");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 如果 store_id 不为空,则使用该 store_id 查询门店详细信息
|
|
|
|
|
+ if (storeUser.getStoreId() != null && storeUser.getStoreId() > 0) {
|
|
|
|
|
+ return R.data(storeInfoService.getDetail(storeUser.getStoreId()));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ log.warn("商家用户的 store_id 为空: phone={}, userId={}", phone, storeUser.getId());
|
|
|
|
|
+ return R.fail("该商家未关联门店");
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("根据手机号查询门店详细信息失败: phone={}", phone, e);
|
|
|
|
|
+ return R.fail("查询失败: " + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@ApiOperation(value = "门店信息-修改后展示")
|
|
@ApiOperation(value = "门店信息-修改后展示")
|
|
|
@ApiOperationSupport(order = 6)
|
|
@ApiOperationSupport(order = 6)
|
|
|
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "门店id", dataType = "Long", paramType = "query", required = true)})
|
|
@ApiImplicitParams({@ApiImplicitParam(name = "id", value = "门店id", dataType = "Long", paramType = "query", required = true)})
|
|
@@ -1481,6 +1515,7 @@ public class StoreInfoController {
|
|
|
})
|
|
})
|
|
|
@GetMapping("/getRandomPage")
|
|
@GetMapping("/getRandomPage")
|
|
|
public R<IPage<StoreInfoWithHeadImg>> getRandomPage(
|
|
public R<IPage<StoreInfoWithHeadImg>> getRandomPage(
|
|
|
|
|
+ @ApiIgnore @TokenInfo UserLoginInfo userLoginInfo,
|
|
|
@RequestParam(defaultValue = "1") int page,
|
|
@RequestParam(defaultValue = "1") int page,
|
|
|
@RequestParam(defaultValue = "10") int size) {
|
|
@RequestParam(defaultValue = "10") int size) {
|
|
|
log.info("StoreInfoController.getRandomPage - page={}, size={}", page, size);
|
|
log.info("StoreInfoController.getRandomPage - page={}, size={}", page, size);
|
|
@@ -1489,20 +1524,32 @@ public class StoreInfoController {
|
|
|
int pageNum = page > 0 ? page : 1;
|
|
int pageNum = page > 0 ? page : 1;
|
|
|
int pageSize = size > 0 ? size : 10;
|
|
int pageSize = size > 0 ? size : 10;
|
|
|
|
|
|
|
|
- // 查询所有被拉黑的店铺ID
|
|
|
|
|
- LambdaQueryWrapper<LifeBlacklist> blacklistWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
- blacklistWrapper.eq(LifeBlacklist::getBlockedType, "1") // 1表示商户
|
|
|
|
|
- .eq(LifeBlacklist::getDeleteFlag, 0);
|
|
|
|
|
- List<LifeBlacklist> blacklist = lifeBlacklistMapper.selectList(blacklistWrapper);
|
|
|
|
|
|
|
+ // 查询当前登录用户拉黑的店铺ID
|
|
|
List<Integer> blacklistedStoreIds = new ArrayList<>();
|
|
List<Integer> blacklistedStoreIds = new ArrayList<>();
|
|
|
- if (!CollectionUtils.isEmpty(blacklist)) {
|
|
|
|
|
- for (LifeBlacklist item : blacklist) {
|
|
|
|
|
- try {
|
|
|
|
|
- if (item.getBlockedId() != null && !item.getBlockedId().trim().isEmpty()) {
|
|
|
|
|
- blacklistedStoreIds.add(Integer.parseInt(item.getBlockedId()));
|
|
|
|
|
|
|
+ if (userLoginInfo != null && userLoginInfo.getUserId() > 0) {
|
|
|
|
|
+ // 获取当前登录用户的类型和ID
|
|
|
|
|
+ String blockerType = userLoginInfo.getType(); // "user" 或 "store"
|
|
|
|
|
+ String blockerId = String.valueOf(userLoginInfo.getUserId());
|
|
|
|
|
+
|
|
|
|
|
+ // 根据用户类型设置拉黑方类型(1:商户,2:用户)
|
|
|
|
|
+ String blockerTypeValue = "user".equals(blockerType) ? "2" : "1";
|
|
|
|
|
+
|
|
|
|
|
+ LambdaQueryWrapper<LifeBlacklist> blacklistWrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
+ blacklistWrapper.eq(LifeBlacklist::getBlockerType, blockerTypeValue) // 拉黑方类型
|
|
|
|
|
+ .eq(LifeBlacklist::getBlockerId, blockerId) // 拉黑方ID(当前登录用户)
|
|
|
|
|
+ .eq(LifeBlacklist::getBlockedType, "1") // 1表示商户
|
|
|
|
|
+ .eq(LifeBlacklist::getDeleteFlag, 0);
|
|
|
|
|
+ List<LifeBlacklist> blacklist = lifeBlacklistMapper.selectList(blacklistWrapper);
|
|
|
|
|
+
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(blacklist)) {
|
|
|
|
|
+ for (LifeBlacklist item : blacklist) {
|
|
|
|
|
+ try {
|
|
|
|
|
+ if (item.getBlockedId() != null && !item.getBlockedId().trim().isEmpty()) {
|
|
|
|
|
+ blacklistedStoreIds.add(Integer.parseInt(item.getBlockedId()));
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ log.warn("拉黑记录中的店铺ID格式错误: {}", item.getBlockedId());
|
|
|
}
|
|
}
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
|
- log.warn("拉黑记录中的店铺ID格式错误: {}", item.getBlockedId());
|
|
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|