Commit 38f8acf6 by 程裕兵

feat:bind appId

parent 16ded966
...@@ -8,6 +8,7 @@ import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyReq ...@@ -8,6 +8,7 @@ import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyReq
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -42,6 +43,10 @@ public interface BrandMerchantApi { ...@@ -42,6 +43,10 @@ public interface BrandMerchantApi {
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG}) @ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/bindXcxAppId") @PostMapping(value = "/private/brandMerchant/bindXcxAppId")
JsonResult<Void> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request); JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request);
@ApiOperation(value = "校验微信小程序appId绑定结果", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/checkBindXcxAppId")
JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId(BindBrandMerchantXcxAppIdRequest request);
} }
...@@ -8,6 +8,7 @@ import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyReq ...@@ -8,6 +8,7 @@ import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyReq
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -43,7 +44,13 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp ...@@ -43,7 +44,13 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp
} }
@Override @Override
public JsonResult<Void> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request) { public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId(
BindBrandMerchantXcxAppIdRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
}; };
......
...@@ -10,6 +10,7 @@ import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyReq ...@@ -10,6 +10,7 @@ import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyReq
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest; import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest; import com.jiejing.fitness.finance.api.merchant.request.PageBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.service.merchant.BrandMerchantService; import com.jiejing.fitness.finance.service.merchant.BrandMerchantService;
import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams; import com.jiejing.fitness.finance.service.merchant.params.ApplyBrandMerchantParams;
...@@ -66,9 +67,18 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -66,9 +67,18 @@ public class BrandMerchantController implements BrandMerchantApi {
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG}) @ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/bindXcxAppId") @PostMapping(value = "/private/brandMerchant/bindXcxAppId")
@Override @Override
public JsonResult<Void> bindXcxAppId(@RequestBody @Valid BindBrandMerchantXcxAppIdRequest request) { public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(
brandMerchantService.bindXcxAppId(request.getBrandId(), request.getAppId()); @RequestBody @Valid BindBrandMerchantXcxAppIdRequest request) {
return JsonResult.success(); return JsonResult.success(brandMerchantService.bindXcxAppId(request.getBrandId(), request.getAppId()));
}
@ApiOperation(value = "校验微信小程序appId绑定结果", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/checkBindXcxAppId")
@Override
public JsonResult<BrandMerchantBindXcxAppIdVO> checkBindXcxAppId(
@RequestBody @Valid BindBrandMerchantXcxAppIdRequest request) {
return JsonResult.success(
brandMerchantService.checkBindXcxAppId(request.getBrandId(), request.getAppId()));
} }
} }
...@@ -60,8 +60,9 @@ public interface BrandMerchantService { ...@@ -60,8 +60,9 @@ public interface BrandMerchantService {
* *
* @param brandId 品牌Id * @param brandId 品牌Id
* @param appId appId * @param appId appId
* @return 结果
*/ */
void bindXcxAppId(Long brandId, String appId); BrandMerchantBindXcxAppIdVO bindXcxAppId(Long brandId, String appId);
/** /**
* 绑定小程序AppId结果 * 绑定小程序AppId结果
......
...@@ -158,7 +158,7 @@ public class BrandMerchantServiceImpl implements BrandMerchantService { ...@@ -158,7 +158,7 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
} }
@Override @Override
public void bindXcxAppId(Long brandId, String appId) { public BrandMerchantBindXcxAppIdVO bindXcxAppId(Long brandId, String appId) {
BrandToMerchant relation = brandToMerchantRpService.getByBrandId(brandId); BrandToMerchant relation = brandToMerchantRpService.getByBrandId(brandId);
BrandBindWxAppIdApply latest = brandBindWxAppIdApplyRpService.getLatestSuccessByMerchantIdAndAppId( BrandBindWxAppIdApply latest = brandBindWxAppIdApplyRpService.getLatestSuccessByMerchantIdAndAppId(
relation.getMerchantId(), appId); relation.getMerchantId(), appId);
...@@ -174,6 +174,9 @@ public class BrandMerchantServiceImpl implements BrandMerchantService { ...@@ -174,6 +174,9 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
BrandBindWxAppIdApply toModify = MerchantConvert.convertBrandBindWxAppIdApply(apply, vo.getState(), BrandBindWxAppIdApply toModify = MerchantConvert.convertBrandBindWxAppIdApply(apply, vo.getState(),
vo.getFailMessage()); vo.getFailMessage());
brandBindWxAppIdApplyRpService.updateById(toModify); brandBindWxAppIdApplyRpService.updateById(toModify);
return BrandMerchantBindXcxAppIdVO.builder().state(vo.getState()).failMessage(vo.getFailMessage())
.build();
} }
@Override @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