Commit 38f8acf6 by 程裕兵

feat:bind appId

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