Commit b88ed7d9 by 程裕兵

feat:latest success apply

parent 26220be3
......@@ -48,7 +48,7 @@ public interface StudioMerchantApi {
@ApiOperation(value = "解绑前置校验请求", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/checkUnbind")
JsonResult<Boolean> checkUnbind(CheckUnbindStudioMerchantRequest request);
JsonResult<List<String>> checkUnbind(CheckUnbindStudioMerchantRequest request);
@ApiOperation(value = "场馆解绑商户", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/unbind")
......
......@@ -50,7 +50,7 @@ public class StudioMerchantApiFallback implements FallbackFactory<StudioMerchant
}
@Override
public JsonResult<Boolean> checkUnbind(CheckUnbindStudioMerchantRequest request) {
public JsonResult<List<String>> checkUnbind(CheckUnbindStudioMerchantRequest request) {
return JsonResult.rpcError();
}
......
......@@ -74,7 +74,7 @@ public class StudioMerchantController implements StudioMerchantApi {
@ApiOperation(value = "解绑前置校验请求", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/checkUnbind")
@Override
public JsonResult<Boolean> checkUnbind(@RequestBody @Valid CheckUnbindStudioMerchantRequest request) {
public JsonResult<List<String>> checkUnbind(@RequestBody @Valid CheckUnbindStudioMerchantRequest request) {
return JsonResult.success(
studioMerchantService.checkUnbind(request.getStudioId(), request.getMerchantId()));
}
......
......@@ -134,7 +134,7 @@ public interface StudioMerchantService {
* @param merchantId 商户ID
* @return true:绑定过其他场馆;false-没有绑定过
*/
Boolean checkUnbind(Long studioId, Long merchantId);
List<String> checkUnbind(Long studioId, Long merchantId);
/**
* 获取最后一条成功的申请记录
......
......@@ -2,6 +2,7 @@ package com.jiejing.fitness.finance.service.merchant.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.google.common.collect.Lists;
import com.jiejing.common.exception.BizException;
import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.collection.CollectionUtil;
......@@ -274,12 +275,18 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
}
@Override
public Boolean checkUnbind(Long studioId, Long merchantId) {
List<PartyToMerchant> merchants = partyToMerchantRpService.listByMerchantIdAndPartyType(merchantId, PartyTypeEnum.STUDIO);
return Optional.ofNullable(merchants)
.orElse(new ArrayList<>(1))
public List<String> checkUnbind(Long studioId, Long merchantId) {
List<PartyToMerchant> merchants = partyToMerchantRpService.listByMerchantIdAndPartyType(merchantId,
PartyTypeEnum.STUDIO);
if (CollectionUtil.isEmpty(merchants)) {
return Lists.newArrayList();
}
return studioRpcService.listStudio(
merchants.stream().map(PartyToMerchant::getPartyId).collect(Collectors.toList()))
.stream()
.anyMatch(e -> !e.getPartyId().equals(studioId));
.filter(e -> !e.getId().equals(studioId))
.map(StudioVO::getName)
.collect(Collectors.toList());
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment