Commit b0f5dc59 by 程裕兵

feat:brand -> studio

parent 6388820c
......@@ -6,21 +6,19 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 商户类型
*
* @author raccoon
* @since 2020-11-06 16:44
* @author chengyubing
* @since 2024/3/4 18:22
*/
@Getter
@AllArgsConstructor
public enum MerchantTypeEnums {
public enum PartyTypeEnums {
/**
* 未知
* 业务方类型
*/
UNKNOWN("", ""),
STUDIO("STUDIO", "场馆"),
BRAND("BRAND", "品牌"),
UNKNOWN("UNKNOWN", "未知"),
;
@EnumValue
......@@ -28,9 +26,9 @@ public enum MerchantTypeEnums {
private final String desc;
public static MerchantTypeEnums getByCode(String code) {
return Arrays.stream(MerchantTypeEnums.values()).filter(e -> e.getCode().equals(code)).findFirst()
public static PartyTypeEnums getByCode(String code) {
return Arrays.stream(PartyTypeEnums.values()).filter(e -> e.getCode().equals(code)).findFirst()
.orElse(UNKNOWN);
}
}
package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.AuthBrandMerchantSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetAuthBrandMerchantSubChannelRequest;
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.BrandMerchantPayRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantRefundRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.paycenter.api.pay.vo.PayVO;
import com.jiejing.paycenter.api.pay.vo.RefundVO;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* 品牌商户API
*
* @author chengyubing
* @since 2024/2/22 11:49
*/
@FeignClient(name = "FINANCE", url = "${rpc.url.fit-finance:http://app-fit-finance:7008}", fallbackFactory = BrandMerchantApiFallback.class)
public interface BrandMerchantApi {
String TAG = "金融-品牌商户管理";
@ApiOperation(value = "品牌入驻商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/apply")
JsonResult<Void> apply(ApplyBrandMerchantRequest request);
@ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/get")
JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request);
@ApiOperation(value = "查询品牌进件申请记录", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/getApply")
JsonResult<BrandMerchantApplyVO> getApply(GetBrandMerchantApplyRequest request);
@ApiOperation(value = "分页查询品牌进件申请记录", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/pageApply")
JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(PageBrandMerchantApplyRequest request);
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/bindXcxAppId")
JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request);
@ApiOperation(value = "授权子渠道", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/authSubChannel")
JsonResult<BrandMerchantAuthSubChannelVO> authSubChannel(AuthBrandMerchantSubChannelRequest request);
@ApiOperation(value = "查询授权子渠道结果", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/listAuthSubChannel")
JsonResult<List<BrandMerchantAuthSubChannelVO>> listAuthSubChannel(
GetAuthBrandMerchantSubChannelRequest request);
@ApiOperation(value = "支付", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/pay")
JsonResult<PayVO> pay(BrandMerchantPayRequest request);
@ApiOperation(value = "退款", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/refund")
JsonResult<RefundVO> refund(BrandMerchantRefundRequest request);
}
package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.request.ApplyStudioMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.AuthStudioSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindStudioMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetAuthStudioSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageStudioMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.StudioMerchantPayRequest;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO;
import com.jiejing.paycenter.api.pay.vo.PayVO;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
/**
* @author chengyubing
* @since 2024/3/5 09:41
*/
@FeignClient(name = "FINANCE", url = "${rpc.url.fit-finance:http://app-fit-finance:7008}", fallbackFactory = StudioMerchantApiFallback.class)
public interface StudioMerchantApi {
String TAG = "金融-场馆商户管理";
@ApiOperation(value = "场馆入驻商户", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/getMerchant")
JsonResult<StudioMerchantVO> getMerchant(GetStudioMerchantRequest request);
@ApiOperation(value = "场馆入驻商户", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/apply")
JsonResult<Void> apply(ApplyStudioMerchantRequest request);
@ApiOperation(value = "查询场馆进件申请记录", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/getApply")
JsonResult<StudioMerchantApplyVO> getApply(GetStudioMerchantApplyRequest request);
@ApiOperation(value = "分页查询场馆进件申请记录", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/pageApply")
JsonResult<PageVO<StudioMerchantApplyVO>> pageApply(PageStudioMerchantApplyRequest request);
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/bindXcxAppId")
JsonResult<StudioMerchantBindXcxAppIdVO> bindXcxAppId(BindStudioMerchantXcxAppIdRequest request);
@ApiOperation(value = "授权子渠道", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/authSubChannel")
JsonResult<StudioMerchantAuthSubChannelVO> authSubChannel(AuthStudioSubChannelRequest request);
@ApiOperation(value = "查询授权子渠道结果", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/listAuthSubChannel")
JsonResult<List<StudioMerchantAuthSubChannelVO>> listAuthSubChannel(GetAuthStudioSubChannelRequest request);
@ApiOperation(value = "支付", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/pay")
JsonResult<PayVO> pay(StudioMerchantPayRequest request);
}
\ No newline at end of file
......@@ -2,79 +2,72 @@ package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.AuthBrandMerchantSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetAuthBrandMerchantSubChannelRequest;
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.BrandMerchantPayRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantRefundRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
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.request.ApplyStudioMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.AuthStudioSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindStudioMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetAuthStudioSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageStudioMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.StudioMerchantPayRequest;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO;
import com.jiejing.paycenter.api.pay.vo.PayVO;
import com.jiejing.paycenter.api.pay.vo.RefundVO;
import feign.hystrix.FallbackFactory;
import java.util.List;
import org.springframework.stereotype.Component;
/**
* @author chengyubing
* @since 2024/2/22 11:49
* @since 2024/3/5 09:41
*/
@Component
public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantApi> {
public class StudioMerchantApiFallback implements FallbackFactory<StudioMerchantApi> {
@Override
public BrandMerchantApi create(Throwable throwable) {
return new BrandMerchantApi() {
public StudioMerchantApi create(Throwable throwable) {
return new StudioMerchantApi() {
@Override
public JsonResult<Void> apply(ApplyBrandMerchantRequest request) {
public JsonResult<StudioMerchantVO> getMerchant(GetStudioMerchantRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request) {
public JsonResult<Void> apply(ApplyStudioMerchantRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<BrandMerchantApplyVO> getApply(GetBrandMerchantApplyRequest request) {
public JsonResult<StudioMerchantApplyVO> getApply(GetStudioMerchantApplyRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(PageBrandMerchantApplyRequest request) {
public JsonResult<PageVO<StudioMerchantApplyVO>> pageApply(PageStudioMerchantApplyRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(BindBrandMerchantXcxAppIdRequest request) {
public JsonResult<StudioMerchantBindXcxAppIdVO> bindXcxAppId(
BindStudioMerchantXcxAppIdRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<BrandMerchantAuthSubChannelVO> authSubChannel(
AuthBrandMerchantSubChannelRequest request) {
public JsonResult<StudioMerchantAuthSubChannelVO> authSubChannel(AuthStudioSubChannelRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<List<BrandMerchantAuthSubChannelVO>> listAuthSubChannel(
GetAuthBrandMerchantSubChannelRequest request) {
public JsonResult<List<StudioMerchantAuthSubChannelVO>> listAuthSubChannel(
GetAuthStudioSubChannelRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<PayVO> pay(BrandMerchantPayRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<RefundVO> refund(BrandMerchantRefundRequest request) {
public JsonResult<PayVO> pay(StudioMerchantPayRequest request) {
return JsonResult.rpcError();
}
};
......
......@@ -26,8 +26,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息")
public class ApplyBrandMerchantRequest {
@ApiModel(description = "申请场馆商户请求信息")
public class ApplyStudioMerchantRequest {
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
......
......@@ -18,12 +18,12 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户授权子渠道")
public class AuthBrandMerchantSubChannelRequest {
@ApiModel(description = "场馆商户授权子渠道")
public class AuthStudioSubChannelRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
private Long studioId;
@ApiModelProperty(value = "子渠道", required = true)
@NotNull(message = "子渠道不能为空")
......
......@@ -16,12 +16,12 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户绑定小程序appId")
public class BindBrandMerchantXcxAppIdRequest {
@ApiModel(description = "场馆商户绑定小程序appId")
public class BindStudioMerchantXcxAppIdRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
private Long studioId;
@ApiModelProperty(value = "小程序appId", required = true)
@NotNull(message = "小程序appId不能为空")
......
package com.jiejing.fitness.finance.api.merchant.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author chengyubing
* @since 2024/2/27 10:54
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "品牌商户退款Request")
public class BrandMerchantRefundRequest {
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
private Long studioId;
@ApiModelProperty(name = "支付总金额(元)", required = true)
@NotNull(message = "支付总金额不能为空")
private BigDecimal transAmount;
@ApiModelProperty(name = "上层业务退款单号", required = true)
@NotBlank(message = "上层业务退款单号不能为空")
private String orderNo;
@ApiModelProperty(name = "退款请求对应的支付流水号", required = true)
@NotBlank(message = "退款请求对应的支付流水号不能为空")
private String payTransNo;
@ApiModelProperty(name = "退款原因", required = true)
@NotBlank(message = "退款原因不能为空")
private String refundReason;
}
......@@ -16,11 +16,11 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户查看授权子渠道结果")
public class GetAuthBrandMerchantSubChannelRequest {
@ApiModel(description = "场馆商户查看授权子渠道结果")
public class GetAuthStudioSubChannelRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
private Long studioId;
}
......@@ -18,8 +18,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户记录请求信息")
public class GetBrandMerchantApplyRequest {
@ApiModel(description = "申请场馆商户记录请求信息")
public class GetStudioMerchantApplyRequest {
@ApiModelProperty(value = "申请ID", required = true)
@NotNull(message = "申请ID不能为空")
......
......@@ -18,11 +18,11 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息")
public class GetBrandMerchantRequest {
@ApiModel(description = "申请场馆商户请求信息")
public class GetStudioMerchantRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
private Long studioId;
}
......@@ -19,8 +19,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "分页查询申请品牌商户请求信息Request")
public class PageBrandMerchantApplyRequest {
@ApiModel(description = "分页查询申请场馆商户请求信息Request")
public class PageStudioMerchantApplyRequest {
@ApiModelProperty(value = "商户简称")
private String shortName;
......
......@@ -21,12 +21,12 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "品牌商户支付Request")
public class BrandMerchantPayRequest {
@ApiModel(description = "场馆商户支付Request")
public class StudioMerchantPayRequest {
@ApiModelProperty(value = "品牌ID", required = true)
@NotNull(message = "品牌ID不能为空")
private Long brandId;
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
private Long studioId;
@ApiModelProperty(name = "支付总金额(元)", required = true)
@NotNull(message = "支付总金额不能为空")
......
......@@ -23,8 +23,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户申请VO")
public class BrandMerchantApplyVO {
@ApiModel(description = "场馆商户申请VO")
public class StudioMerchantApplyVO {
@ApiModelProperty("ID")
private Long id;
......
package com.jiejing.fitness.finance.api.merchant.vo;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.AuthPhaseEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -17,8 +16,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户认证子渠道VO")
public class BrandMerchantAuthSubChannelVO {
@ApiModel(description = "场馆商户认证子渠道VO")
public class StudioMerchantAuthSubChannelVO {
@ApiModelProperty(value = "申请单")
private String applyNo;
......
......@@ -16,8 +16,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌商户绑定小程序AppIdVO")
public class BrandMerchantBindXcxAppIdVO {
@ApiModel(description = "场馆商户绑定小程序AppIdVO")
public class StudioMerchantBindXcxAppIdVO {
/**
* @see OpenStateEnums
......
package com.jiejing.fitness.finance.api.merchant.vo;
import com.jiejing.fitness.finance.api.merchant.request.model.BrandBankCardInfo;
import com.jiejing.fitness.finance.api.merchant.request.model.BrandLegalInfo;
import com.jiejing.fitness.finance.api.merchant.request.model.BrandLicenseInfo;
import com.jiejing.fitness.finance.api.merchant.request.model.BrandResourceInfo;
import com.jiejing.paycenter.api.merchant.vo.SubChannelConfigVO;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums;
......@@ -23,11 +19,11 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "品牌当前绑定的商户信息VO")
public class BrandMerchantVO {
@ApiModel(description = "场馆当前绑定的商户信息VO")
public class StudioMerchantVO {
@ApiModelProperty("品牌ID")
private Long brandId;
@ApiModelProperty("场馆ID")
private Long studioId;
@ApiModelProperty("渠道号")
private String channelNo;
......
package com.jiejing.fitness.finance.app.controller.merchant;
import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.fitness.finance.api.merchant.BrandMerchantApi;
import com.jiejing.fitness.finance.api.merchant.request.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.AuthBrandMerchantSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindBrandMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetAuthBrandMerchantSubChannelRequest;
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.BrandMerchantPayRequest;
import com.jiejing.fitness.finance.api.merchant.request.BrandMerchantRefundRequest;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
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;
import com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams;
import com.jiejing.fitness.finance.service.pay.PayService;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantPayParams;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams;
import com.jiejing.paycenter.api.pay.vo.PayVO;
import com.jiejing.paycenter.api.pay.vo.RefundVO;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author chengyubing
* @since 2024/2/22 11:53
*/
@RestController
public class BrandMerchantController implements BrandMerchantApi {
@Resource
private BrandMerchantService brandMerchantService;
@Resource
private PayService payService;
@ApiOperation(value = "品牌入驻商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/apply")
@Override
public JsonResult<Void> apply(@RequestBody @Valid ApplyBrandMerchantRequest request) {
ApplyBrandMerchantParams params = BeanUtil.map(request, ApplyBrandMerchantParams.class);
brandMerchantService.apply(params);
return JsonResult.success();
}
@ApiOperation(value = "查询品牌当前绑定的商户", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/get")
@Override
public JsonResult<BrandMerchantVO> get(@RequestBody @Valid GetBrandMerchantRequest request) {
return JsonResult.success(brandMerchantService.getMerchant(request.getBrandId()));
}
@ApiOperation(value = "查询品牌进件申请记录", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/getApply")
@Override
public JsonResult<BrandMerchantApplyVO> getApply(@RequestBody @Valid GetBrandMerchantApplyRequest request) {
return JsonResult.success(brandMerchantService.getApply(request.getId()));
}
@ApiOperation(value = "分页查询品牌进件申请记录", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/pageApply")
@Override
public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(
@RequestBody @Valid PageBrandMerchantApplyRequest request) {
PageBrandMerchantApplyParams params = BeanUtil.map(request, PageBrandMerchantApplyParams.class);
return JsonResult.success(brandMerchantService.pageApply(params));
}
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/bindXcxAppId")
@Override
public JsonResult<BrandMerchantBindXcxAppIdVO> bindXcxAppId(
@RequestBody @Valid BindBrandMerchantXcxAppIdRequest request) {
return JsonResult.success(brandMerchantService.bindXcxAppId(request.getBrandId(), request.getAppId()));
}
@ApiOperation(value = "授权子渠道", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/authSubChannel")
@Override
public JsonResult<BrandMerchantAuthSubChannelVO> authSubChannel(
@RequestBody @Valid AuthBrandMerchantSubChannelRequest request) {
return JsonResult.success(
brandMerchantService.authSubChannel(request.getBrandId(), request.getSubChannel(),
request.getAuthType()));
}
@ApiOperation(value = "查询授权子渠道结果", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/listAuthSubChannel")
@Override
public JsonResult<List<BrandMerchantAuthSubChannelVO>> listAuthSubChannel(
@RequestBody @Valid GetAuthBrandMerchantSubChannelRequest request) {
return JsonResult.success(brandMerchantService.listAuthSubChannel(request.getBrandId()));
}
@ApiOperation(value = "支付", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/pay")
@Override
public JsonResult<PayVO> pay(@RequestBody @Valid BrandMerchantPayRequest request) {
BrandMerchantPayParams params = BeanUtil.map(request, BrandMerchantPayParams.class);
return JsonResult.success(payService.merchantPay(params));
}
@ApiOperation(value = "退款", tags = {TAG})
@PostMapping(value = "/private/brandMerchant/refund")
@Override
public JsonResult<RefundVO> refund(@RequestBody @Valid BrandMerchantRefundRequest request) {
BrandMerchantRefundParams params = BeanUtil.map(request, BrandMerchantRefundParams.class);
return JsonResult.success(payService.merchantRefund(params));
}
}
package com.jiejing.fitness.finance.app.controller.merchant;
import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.fitness.finance.api.merchant.StudioMerchantApi;
import com.jiejing.fitness.finance.api.merchant.request.ApplyStudioMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.AuthStudioSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.BindStudioMerchantXcxAppIdRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetAuthStudioSubChannelRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetStudioMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.PageStudioMerchantApplyRequest;
import com.jiejing.fitness.finance.api.merchant.request.StudioMerchantPayRequest;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO;
import com.jiejing.fitness.finance.service.merchant.StudioMerchantService;
import com.jiejing.fitness.finance.service.merchant.params.ApplyStudioMerchantParams;
import com.jiejing.fitness.finance.service.merchant.params.PageStudioMerchantApplyParams;
import com.jiejing.fitness.finance.service.pay.PayService;
import com.jiejing.fitness.finance.service.pay.params.StudioMerchantPayParams;
import com.jiejing.paycenter.api.pay.vo.PayVO;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import javax.validation.Valid;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
/**
* @author chengyubing
* @since 2024/3/5 09:56
*/
@RestController
public class StudioMerchantController implements StudioMerchantApi {
@Resource
private StudioMerchantService studioMerchantService;
@Resource
private PayService payService;
@ApiOperation(value = "场馆入驻商户", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/getMerchant")
@Override
public JsonResult<StudioMerchantVO> getMerchant(@RequestBody @Valid GetStudioMerchantRequest request) {
return JsonResult.success(studioMerchantService.getMerchant(request.getStudioId()));
}
@ApiOperation(value = "场馆入驻商户", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/apply")
@Override
public JsonResult<Void> apply(@RequestBody @Valid ApplyStudioMerchantRequest request) {
ApplyStudioMerchantParams params = BeanUtil.map(request, ApplyStudioMerchantParams.class);
studioMerchantService.apply(params);
return JsonResult.success();
}
@ApiOperation(value = "查询场馆进件申请记录", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/getApply")
@Override
public JsonResult<StudioMerchantApplyVO> getApply(
@RequestBody @Valid GetStudioMerchantApplyRequest request) {
return JsonResult.success(studioMerchantService.getApply(request.getId()));
}
@ApiOperation(value = "分页查询场馆进件申请记录", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/pageApply")
@Override
public JsonResult<PageVO<StudioMerchantApplyVO>> pageApply(
@RequestBody @Valid PageStudioMerchantApplyRequest request) {
PageStudioMerchantApplyParams params = BeanUtil.map(request, PageStudioMerchantApplyParams.class);
return JsonResult.success(studioMerchantService.pageApply(params));
}
@ApiOperation(value = "绑定微信小程序appId", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/bindXcxAppId")
@Override
public JsonResult<StudioMerchantBindXcxAppIdVO> bindXcxAppId(
@RequestBody @Valid BindStudioMerchantXcxAppIdRequest request) {
return JsonResult.success(studioMerchantService.bindXcxAppId(request.getStudioId(), request.getAppId()));
}
@ApiOperation(value = "授权子渠道", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/authSubChannel")
@Override
public JsonResult<StudioMerchantAuthSubChannelVO> authSubChannel(
@RequestBody @Valid AuthStudioSubChannelRequest request) {
return JsonResult.success(
studioMerchantService.authSubChannel(request.getStudioId(), request.getSubChannel(),
request.getAuthType()));
}
@ApiOperation(value = "查询授权子渠道结果", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/listAuthSubChannel")
@Override
public JsonResult<List<StudioMerchantAuthSubChannelVO>> listAuthSubChannel(
@RequestBody @Valid GetAuthStudioSubChannelRequest request) {
return JsonResult.success(studioMerchantService.listAuthSubChannel(request.getStudioId()));
}
@ApiOperation(value = "支付", tags = {TAG})
@PostMapping(value = "/private/studioMerchant/pay")
@Override
public JsonResult<PayVO> pay(@RequestBody @Valid StudioMerchantPayRequest request) {
StudioMerchantPayParams params = BeanUtil.map(request, StudioMerchantPayParams.class);
return JsonResult.success(payService.merchantPay(params));
}
}
......@@ -15,6 +15,7 @@
package com.jiejing.fitness.finance.repository.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.jiejing.fitness.finance.api.enums.PartyTypeEnums;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
......@@ -26,19 +27,19 @@ import lombok.NoArgsConstructor;
/**
* <p>
* 品牌商户关联表(1:1)
* 商户关联表
* </p>
*
* @author chengyubing, created on 2024-02-22
* @author chengyubing, created on 2024-03-04
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class BrandToMerchant implements Serializable {
public class PartyToMerchant implements Serializable {
private static final long serialVersionUID = -4973389381018495600L;
private static final long serialVersionUID = 128336673584905078L;
/**
* 备注: ID 是否允许为null: NO
......@@ -47,14 +48,19 @@ public class BrandToMerchant implements Serializable {
private Long id;
/**
* 渠道号
* 备注: 渠道号 是否允许为null: YES
*/
private String channelNo;
/**
* 备注: 品牌ID 是否允许为null: YES
* 备注: 业务方ID 是否允许为null: YES
*/
private Long brandId;
private Long partyId;
/**
* 备注: 业务方类型 是否允许为null: YES
*/
private PartyTypeEnums partyType;
/**
* 备注: paycenter的商户ID 是否允许为null: YES
......@@ -62,7 +68,7 @@ public class BrandToMerchant implements Serializable {
private Long merchantId;
/**
* 备注: 商户号 是否允许为null: YES
* 备注: 商户号(冗余) 是否允许为null: YES
*/
private String merchantNo;
......@@ -81,7 +87,9 @@ public class BrandToMerchant implements Serializable {
public static final String CHANNEL_NO = "channel_no";
public static final String BRAND_ID = "brand_id";
public static final String PARTY_ID = "party_id";
public static final String PARTY_TYPE = "party_type";
public static final String MERCHANT_ID = "merchant_id";
......
......@@ -29,22 +29,22 @@ import lombok.NoArgsConstructor;
/**
* <p>
* 品牌商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表)
* 场馆商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表)
* </p>
*
* @author chengyubing, created on 2024-02-22
* @author chengyubing, created on 2024-03-05
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class BrandMerchantApply implements Serializable {
public class StudioMerchantApply implements Serializable {
private static final long serialVersionUID = -4973389381018495600L;
private static final long serialVersionUID = -5392799333879973205L;
/**
* ID
* 备注: ID 是否允许为null: NO
*/
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
......
......@@ -14,16 +14,16 @@
package com.jiejing.fitness.finance.repository.mapper;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.repository.entity.PartyToMerchant;
import com.jiejing.mbp.inject.XBaseMapper;
/**
* <p>
* 品牌商户关联表(1:1) Mapper 接口
* 商户关联表 Mapper 接口
* </p>
*
* @author chengyubing, created on 2024-02-22
* @author chengyubing, created on 2024-03-04
*/
public interface BrandToMerchantMapper extends XBaseMapper<BrandToMerchant> {
public interface PartyToMerchantMapper extends XBaseMapper<PartyToMerchant> {
}
......@@ -13,11 +13,11 @@
~ 官网: www.xiaomai5.com
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jiejing.fitness.finance.repository.mapper.BrandToMerchantMapper">
<mapper namespace="com.jiejing.fitness.finance.repository.mapper.PartyToMerchantMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, channel_no, brand_id, merchant_id, merchant_no, create_time, update_time
id, channel_no, party_id, party_type, merchant_id, merchant_no, create_time, update_time
</sql>
</mapper>
......@@ -14,19 +14,21 @@
package com.jiejing.fitness.finance.repository.mapper;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.entity.StudioMerchantApply;
import com.jiejing.mbp.inject.XBaseMapper;
import org.apache.ibatis.annotations.Param;
/**
* <p>
* 品牌商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) Mapper 接口
* 场馆商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) Mapper 接口
* </p>
*
* @author chengyubing, created on 2024-02-22
* @author chengyubing, created on 2024-03-05
*/
public interface BrandMerchantApplyMapper extends XBaseMapper<BrandMerchantApply> {
public interface StudioMerchantApplyMapper extends XBaseMapper<StudioMerchantApply> {
BrandMerchantApply getLatestOneSuccessByBrandId(@Param("brandId") Long brandId);
StudioMerchantApply getLatestOneSuccessByMerchantId(@Param("merchantId") Long merchantId);
StudioMerchantApply getLatestOneSuccessByStudioId(@Param("studioId") Long studioId);
}
......@@ -13,18 +13,28 @@
~ 官网: www.xiaomai5.com
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jiejing.fitness.finance.repository.mapper.BrandMerchantApplyMapper">
<mapper namespace="com.jiejing.fitness.finance.repository.mapper.StudioMerchantApplyMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id, brand_id, studio_id, apply_no, apply_type, channel_no, merchant_id, merchant_no, merchant_name, short_name, company_type, open_state, open_fail_message, ali_open_state, ali_auth_state, ali_merchant_no, ali_open_fail_message, wx_offline_open_state, wx_offline_auth_state, wx_offline_merchant_no, wx_offline_open_fail_message, wx_online_open_state, wx_online_auth_state, wx_online_merchant_no, wx_online_open_fail_message, merchant_info, salt, finish_time, create_time, update_time
</sql>
<select id="getLatestOneSuccessByBrandId"
resultType="com.jiejing.fitness.finance.repository.entity.BrandMerchantApply">
<select id="getLatestOneSuccessByMerchantId"
resultType="com.jiejing.fitness.finance.repository.entity.StudioMerchantApply">
select *
from brand_merchant_apply
where brand_id = #{brandId}
from studio_merchant_apply
where merchant_id = #{merchantId}
and open_state = 'S'
order by id desc
limit 1
</select>
<select id="getLatestOneSuccessByStudioId"
resultType="com.jiejing.fitness.finance.repository.entity.StudioMerchantApply">
select *
from studio_merchant_apply
where studio_id = #{studioId}
and open_state = 'S'
order by id desc
limit 1
......
package com.jiejing.fitness.finance.repository.query;
import com.jiejing.fitness.finance.api.enums.ApplyTypeEnums;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums;
import lombok.Data;
/**
* @author chengyubing
* @since 2024/2/22 18:03
*/
@Data
public class PageStudioMerchantApplyQuery {
/**
* 商户简称
*/
private String shortName;
/**
* 操作类型
*/
private ApplyTypeEnums applyType;
/**
* 场馆ID
*/
private Long studioId;
/**
* 申请类型
*/
private CompanyTypeEnums companyType;
/**
* 商户名称
*/
private String merchantName;
/**
* 申请状态
*/
private OpenStateEnums openState;
/**
* 商户号
*/
private String merchantNo;
/**
* 支付宝商户号
*/
private String aliMerchantNo;
/**
* 微信线上商户号
*/
private String wxOnlineMerchantNo;
/**
* 微信线下商户号
*/
private String wxOfflineMerchantNo;
/**
* 页码:0开始
*/
private Integer current;
/**
* 分页大小
*/
private Integer size;
}
......@@ -15,27 +15,64 @@
package com.jiejing.fitness.finance.repository.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.repository.mapper.BrandToMerchantMapper;
import com.jiejing.common.utils.collection.CollectionUtil;
import com.jiejing.fitness.finance.api.enums.PartyTypeEnums;
import com.jiejing.fitness.finance.repository.entity.PartyToMerchant;
import com.jiejing.fitness.finance.repository.mapper.PartyToMerchantMapper;
import com.jiejing.mbp.MapperRepoService;
import java.util.List;
import org.springframework.stereotype.Service;
/**
* <p>
* 品牌商户关联表(1:1) 服务实现类
* 商户关联表 服务实现类
* </p>
*
* @author chengyubing, created on 2024-02-22
* @author chengyubing, created on 2024-03-04
*/
@Service
public class BrandToMerchantRpService extends
MapperRepoService<Long, BrandToMerchant, BrandToMerchantMapper> {
public class PartyToMerchantRpService extends
MapperRepoService<Long, PartyToMerchant, PartyToMerchantMapper> {
public BrandToMerchant getByBrandId(Long brandId, String channelNo) {
QueryWrapper<BrandToMerchant> wrapper = new QueryWrapper<>();
wrapper.eq(BrandToMerchant.BRAND_ID, brandId);
wrapper.eq(BrandToMerchant.CHANNEL_NO, channelNo);
public List<PartyToMerchant> listByParty(Long partyId, PartyTypeEnums partyType, String channelNo) {
QueryWrapper<PartyToMerchant> wrapper = new QueryWrapper<>();
wrapper.eq(PartyToMerchant.PARTY_ID, partyId);
wrapper.eq(PartyToMerchant.PARTY_TYPE, partyType);
wrapper.eq(PartyToMerchant.CHANNEL_NO, channelNo);
return this.baseMapper.selectList(wrapper);
}
public PartyToMerchant getByStudioId(Long studioId, String channelNo) {
QueryWrapper<PartyToMerchant> wrapper = new QueryWrapper<>();
wrapper.eq(PartyToMerchant.PARTY_ID, studioId);
wrapper.eq(PartyToMerchant.PARTY_TYPE, PartyTypeEnums.STUDIO);
wrapper.eq(PartyToMerchant.CHANNEL_NO, channelNo);
List<PartyToMerchant> list = this.baseMapper.selectList(wrapper);
return CollectionUtil.isEmpty(list) ? null : list.get(0);
}
public PartyToMerchant getOneByPartyAndMerchantId(String channelNo, Long partyId, PartyTypeEnums partyType,
Long merchantId) {
QueryWrapper<PartyToMerchant> wrapper = new QueryWrapper<>();
wrapper.eq(PartyToMerchant.PARTY_ID, partyId);
wrapper.eq(PartyToMerchant.MERCHANT_ID, merchantId);
wrapper.eq(PartyToMerchant.PARTY_TYPE, partyType);
wrapper.eq(PartyToMerchant.CHANNEL_NO, channelNo);
return this.baseMapper.selectOne(wrapper);
}
public void deleteByParty(Long partyId, PartyTypeEnums partyType) {
QueryWrapper<PartyToMerchant> wrapper = new QueryWrapper<>();
wrapper.eq(PartyToMerchant.PARTY_ID, partyId);
wrapper.eq(PartyToMerchant.PARTY_TYPE, partyType);
this.baseMapper.delete(wrapper);
}
public void deleteByPartyAndMerchantId(Long partyId, PartyTypeEnums partyType, Long merchantId) {
QueryWrapper<PartyToMerchant> wrapper = new QueryWrapper<>();
wrapper.eq(PartyToMerchant.PARTY_ID, partyId);
wrapper.eq(PartyToMerchant.PARTY_TYPE, partyType);
wrapper.eq(PartyToMerchant.MERCHANT_ID, merchantId);
this.baseMapper.delete(wrapper);
}
}
......@@ -16,61 +16,69 @@ package com.jiejing.fitness.finance.repository.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jiejing.common.utils.text.StringUtil;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.mapper.BrandMerchantApplyMapper;
import com.jiejing.fitness.finance.repository.query.PageBrandMerchantApplyQuery;
import com.jiejing.fitness.finance.repository.entity.StudioMerchantApply;
import com.jiejing.fitness.finance.repository.mapper.StudioMerchantApplyMapper;
import com.jiejing.fitness.finance.repository.query.PageStudioMerchantApplyQuery;
import com.jiejing.mbp.MapperRepoService;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
/**
* <p>
* 品牌商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) 服务实现类
* 场馆商户申请表(M端以及B端数据回显用,支付以及各状态判断、商户号不使用此表) 服务实现类
* </p>
*
* @author chengyubing, created on 2024-02-22
* @author chengyubing, created on 2024-03-05
*/
@Service
public class BrandMerchantApplyRpService extends
MapperRepoService<Long, BrandMerchantApply, BrandMerchantApplyMapper> {
public class StudioMerchantApplyRpService extends
MapperRepoService<Long, StudioMerchantApply, StudioMerchantApplyMapper> {
public BrandMerchantApply getLatestOneSuccessByBrandId(Long brandId) {
return this.baseMapper.getLatestOneSuccessByBrandId(brandId);
}
public Page<BrandMerchantApply> page(PageBrandMerchantApplyQuery params) {
QueryWrapper<BrandMerchantApply> wrapper = new QueryWrapper<>();
public Page<StudioMerchantApply> page(PageStudioMerchantApplyQuery params) {
QueryWrapper<StudioMerchantApply> wrapper = new QueryWrapper<>();
if (StringUtil.isNotBlank(params.getShortName())) {
wrapper.like(BrandMerchantApply.SHORT_NAME, params.getShortName());
wrapper.like(StudioMerchantApply.SHORT_NAME, params.getShortName());
}
if (null != params.getApplyType()) {
wrapper.eq(BrandMerchantApply.APPLY_TYPE, params.getApplyType());
wrapper.eq(StudioMerchantApply.APPLY_TYPE, params.getApplyType());
}
if (null != params.getStudioId()) {
wrapper.eq(BrandMerchantApply.STUDIO_ID, params.getStudioId());
wrapper.eq(StudioMerchantApply.STUDIO_ID, params.getStudioId());
}
if (null != params.getCompanyType()) {
wrapper.eq(BrandMerchantApply.COMPANY_TYPE, params.getCompanyType());
wrapper.eq(StudioMerchantApply.COMPANY_TYPE, params.getCompanyType());
}
if (StringUtil.isNotBlank(params.getMerchantName())) {
wrapper.like(BrandMerchantApply.MERCHANT_NAME, params.getMerchantName());
wrapper.like(StudioMerchantApply.MERCHANT_NAME, params.getMerchantName());
}
if (null != params.getOpenState()) {
wrapper.eq(BrandMerchantApply.OPEN_STATE, params.getOpenState());
wrapper.eq(StudioMerchantApply.OPEN_STATE, params.getOpenState());
}
if (StringUtil.isNotBlank(params.getMerchantNo())) {
wrapper.eq(BrandMerchantApply.MERCHANT_NO, params.getMerchantNo());
wrapper.eq(StudioMerchantApply.MERCHANT_NO, params.getMerchantNo());
}
if (StringUtil.isNotBlank(params.getAliMerchantNo())) {
wrapper.eq(BrandMerchantApply.ALI_MERCHANT_NO, params.getAliMerchantNo());
wrapper.eq(StudioMerchantApply.ALI_MERCHANT_NO, params.getAliMerchantNo());
}
if (StringUtil.isNotBlank(params.getWxOnlineMerchantNo())) {
wrapper.eq(BrandMerchantApply.WX_ONLINE_MERCHANT_NO, params.getWxOnlineMerchantNo());
wrapper.eq(StudioMerchantApply.WX_ONLINE_MERCHANT_NO, params.getWxOnlineMerchantNo());
}
if (StringUtil.isNotBlank(params.getWxOfflineMerchantNo())) {
wrapper.eq(BrandMerchantApply.WX_OFFLINE_MERCHANT_NO, params.getWxOfflineMerchantNo());
wrapper.eq(StudioMerchantApply.WX_OFFLINE_MERCHANT_NO, params.getWxOfflineMerchantNo());
}
return this.findByWrapperPage(wrapper, params.getCurrent(), params.getSize());
}
public StudioMerchantApply getLatestOneSuccessByMerchantId(Long merchantId) {
return this.baseMapper.getLatestOneSuccessByMerchantId(merchantId);
}
public StudioMerchantApply getLatestOneSuccessByStudioId(Long studioId) {
QueryWrapper<StudioMerchantApply> wrapper = new QueryWrapper<>();
wrapper.eq(StudioMerchantApply.STUDIO_ID, studioId);
return this.baseMapper.getLatestOneSuccessByStudioId(studioId);
}
}
......@@ -52,10 +52,9 @@ public class GeneratorServiceEntity {
private String author = "chengyubing";
private String[] tableNames = {
// "global_config",
// "brand_merchant_apply",
// "brand_to_merchant",
// "brand_bind_wx_app_id_apply",
"brand_cashier_record"
// "studio_merchant_apply",
// "party_to_merchant",
// "brand_cashier_record"
};
/**
......
......@@ -3,8 +3,8 @@ package com.jiejing.fitness.finance.service.event;
import static org.springframework.integration.IntegrationMessageHeaderAccessor.DELIVERY_ATTEMPT;
import com.alibaba.fastjson.JSON;
import com.jiejing.fitness.finance.api.enums.MerchantTypeEnums;
import com.jiejing.fitness.finance.service.merchant.BrandMerchantService;
import com.jiejing.fitness.finance.api.enums.PartyTypeEnums;
import com.jiejing.fitness.finance.service.merchant.StudioMerchantService;
import com.jiejing.fitness.finance.service.pay.PayService;
import com.jiejing.paycenter.common.event.MerchantEvent;
import com.jiejing.paycenter.common.event.PayEvent;
......@@ -28,7 +28,7 @@ public class ListenerService {
private static final int MAX_RETRY = 3;
@Resource
private BrandMerchantService brandMerchantService;
private StudioMerchantService studioMerchantService;
@Resource
private PayService payService;
......@@ -42,10 +42,10 @@ public class ListenerService {
event.setSubChannels(Optional.ofNullable(event.getSubChannels()).orElse(new ArrayList<>(1)));
event.setSubChannelAuths(Optional.ofNullable(event.getSubChannelAuths()).orElse(new ArrayList<>(1)));
MerchantTypeEnums merchantType = MerchantTypeEnums.getByCode(event.getBizCode());
switch (merchantType) {
case BRAND:
brandMerchantService.callback(event);
PartyTypeEnums type = PartyTypeEnums.getByCode(event.getBizCode());
switch (type) {
case STUDIO:
studioMerchantService.callback(event);
break;
default:
break;
......
package com.jiejing.fitness.finance.service.merchant;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantAuthSubChannelVO;
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.params.ApplyBrandMerchantParams;
import com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams;
import com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
import com.jiejing.paycenter.common.event.MerchantEvent;
import java.util.List;
/**
* 品牌商户服务
*
......@@ -21,69 +9,19 @@ import java.util.List;
public interface BrandMerchantService {
/**
* 进件申请
*
* @param params 请求参数
*/
void apply(ApplyBrandMerchantParams params);
/**
* 进件申请回调
*
* @param event 事件
*/
void callback(MerchantEvent event);
/**
* 获取品牌当前绑定的商户信息
*
* @param brandId 品牌ID
* @return 商户
*/
BrandMerchantVO getMerchant(Long brandId);
/**
* 获取申请记录详情
*
* @param id ID
* @return 结果
*/
BrandMerchantApplyVO getApply(Long id);
/**
* 分页查询品牌商户申请记录
*
* @param params 请求
* @return 响应
*/
PageVO<BrandMerchantApplyVO> pageApply(PageBrandMerchantApplyParams params);
/**
* 绑定小程序AppId
*
* @param brandId 品牌Id
* @param appId appId
* @return 结果
*/
BrandMerchantBindXcxAppIdVO bindXcxAppId(Long brandId, String appId);
/**
* 授权子渠道
* 绑定
*
* @param brandId 品牌ID
* @param subChannel 子渠道
* @param authType 授权类型
* @return 结果
* @param merchantId 商户ID
*/
BrandMerchantAuthSubChannelVO authSubChannel(Long brandId, SubChannelEnums subChannel,
SubChannelAuthTypeEnums authType);
void bind(Long brandId, Long merchantId);
/**
* 查询授权子渠道结果
* 解绑
*
* @param brandId 品牌ID
* @return 结果
* @param merchantId 商户ID
*/
List<BrandMerchantAuthSubChannelVO> listAuthSubChannel(Long brandId);
void unbind(Long brandId, Long merchantId);
}
package com.jiejing.fitness.finance.service.merchant;
import com.jiejing.common.model.PageVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantAuthSubChannelVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantBindXcxAppIdVO;
import com.jiejing.fitness.finance.api.merchant.vo.StudioMerchantVO;
import com.jiejing.fitness.finance.service.merchant.params.ApplyStudioMerchantParams;
import com.jiejing.fitness.finance.service.merchant.params.PageStudioMerchantApplyParams;
import com.jiejing.paycenter.common.enums.merchant.SubChannelAuthTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.SubChannelEnums;
import com.jiejing.paycenter.common.event.MerchantEvent;
import java.util.List;
/**
* @author chengyubing
* @since 2024/3/5 09:58
*/
public interface StudioMerchantService {
/**
* 进件申请
*
* @param params 请求参数
*/
void apply(ApplyStudioMerchantParams params);
/**
* 绑定
*
* @param studioId 场馆ID
* @param merchantId 商户ID
*/
void bind(Long studioId, Long merchantId);
/**
* 解绑
*
* @param studioId 场馆ID
* @param merchantId 商户ID
*/
void unbind(Long studioId, Long merchantId);
/**
* 解绑所有
*
* @param studioId 场馆ID
*/
void unbindAll(Long studioId);
/**
* 进件申请回调
*
* @param event 事件
*/
void callback(MerchantEvent event);
/**
* 获取场馆当前绑定的商户信息
*
* @param studioId 场馆ID
* @return 商户
*/
StudioMerchantVO getMerchant(Long studioId);
/**
* 获取申请记录详情
*
* @param id ID
* @return 结果
*/
StudioMerchantApplyVO getApply(Long id);
/**
* 分页查询场馆商户申请记录
*
* @param params 请求
* @return 响应
*/
PageVO<StudioMerchantApplyVO> pageApply(PageStudioMerchantApplyParams params);
/**
* 绑定小程序AppId
*
* @param studioId 场馆ID
* @param appId appId
* @return 结果
*/
StudioMerchantBindXcxAppIdVO bindXcxAppId(Long studioId, String appId);
/**
* 授权子渠道
*
* @param studioId 场馆ID
* @param subChannel 子渠道
* @param authType 授权类型
* @return 结果
*/
StudioMerchantAuthSubChannelVO authSubChannel(Long studioId, SubChannelEnums subChannel,
SubChannelAuthTypeEnums authType);
/**
* 查询授权子渠道结果
*
* @param studioId 场馆ID
* @return 结果
*/
List<StudioMerchantAuthSubChannelVO> listAuthSubChannel(Long studioId);
}
......@@ -28,8 +28,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息")
public class ApplyBrandMerchantParams {
@ApiModel(description = "申请场馆商户请求信息")
public class ApplyStudioMerchantParams {
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
......@@ -69,8 +69,8 @@ public class ApplyBrandMerchantParams {
@Valid
private BrandResourceInfo resource;
public ApplyBrandMerchantParams encrypt(String salt) {
ApplyBrandMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyBrandMerchantParams.class);
public ApplyStudioMerchantParams encrypt(String salt) {
ApplyStudioMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyStudioMerchantParams.class);
if (null != copy.getBankCard()) {
copy.getBankCard().setCardNo(AesUtil.encrypt(salt, copy.getBankCard().getCardNo()));
copy.getBankCard().setCertNo(AesUtil.encrypt(salt, copy.getBankCard().getCertNo()));
......@@ -85,8 +85,8 @@ public class ApplyBrandMerchantParams {
return copy;
}
public ApplyBrandMerchantParams decrypt(String salt) {
ApplyBrandMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyBrandMerchantParams.class);
public ApplyStudioMerchantParams decrypt(String salt) {
ApplyStudioMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyStudioMerchantParams.class);
if (null != copy.getBankCard()) {
copy.getBankCard().setCardNo(AesUtil.decrypt(salt, copy.getBankCard().getCardNo()));
copy.getBankCard().setCertNo(AesUtil.decrypt(salt, copy.getBankCard().getCertNo()));
......
......@@ -5,7 +5,6 @@ import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -20,8 +19,8 @@ import lombok.NoArgsConstructor;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息")
public class PageBrandMerchantApplyParams {
@ApiModel(description = "申请场馆商户请求信息")
public class PageStudioMerchantApplyParams {
@ApiModelProperty(value = "商户简称")
private String shortName;
......
package com.jiejing.fitness.finance.service.pay;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantPayParams;
import com.jiejing.fitness.finance.service.pay.params.StudioMerchantPayParams;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams;
import com.jiejing.paycenter.api.pay.vo.PayVO;
import com.jiejing.paycenter.api.pay.vo.RefundVO;
......@@ -19,7 +19,7 @@ public interface PayService {
* @param params 请求参数
* @return 结果
*/
PayVO merchantPay(BrandMerchantPayParams params);
PayVO merchantPay(StudioMerchantPayParams params);
/**
* 支付回调
......
......@@ -9,10 +9,9 @@ import com.jiejing.common.utils.text.StringUtil;
import com.jiejing.fitness.finance.api.enums.BrandCashierTransStateEnums;
import com.jiejing.fitness.finance.api.enums.BrandCashierTransTypeEnums;
import com.jiejing.fitness.finance.repository.entity.BrandCashierRecord;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.service.enums.FinanceErrorEnums;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantPayParams;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams;
import com.jiejing.fitness.finance.service.pay.params.StudioMerchantPayParams;
import com.jiejing.fitness.finance.service.utils.FeeUtil;
import com.jiejing.fitness.finance.service.utils.MoneyUtil;
import com.jiejing.paycenter.api.merchant.vo.MerchantVO;
......@@ -27,7 +26,7 @@ import com.jiejing.paycenter.common.enums.pay.PayStateEnums;
import com.jiejing.paycenter.common.enums.pay.PayTypeEnums;
import com.jiejing.paycenter.common.event.PayEvent;
import com.jiejing.paycenter.common.event.RefundEvent;
import com.jiejing.paycenter.common.model.SubChannelInfo;
import com.jiejing.studio.api.studio.vo.StudioVO;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date;
......@@ -46,7 +45,7 @@ public class PayConvert {
private static final List<String> WX_AUTH_CODE_PREFIX = Lists.newArrayList("10", "11", "12", "13", "14",
"15");
public static PayRequest convert(BrandMerchantPayParams params, BrandCashierRecord record) {
public static PayRequest convert(StudioMerchantPayParams params, BrandCashierRecord record) {
PayRequest request = BeanUtil.map(params, PayRequest.class);
request.setTransNo(record.getTransNo());
request.setMerchantId(record.getMerchantId());
......@@ -60,7 +59,7 @@ public class PayConvert {
return request;
}
public static BrandCashierRecord convertPayInit(BrandMerchantPayParams params, BrandToMerchant relation,
public static BrandCashierRecord convertPayInit(StudioMerchantPayParams params, StudioVO studio,
MerchantVO merchant) {
setSubChannel(params);
Long id = IdWorker.getId();
......@@ -72,7 +71,7 @@ public class PayConvert {
.orderNo(params.getOrderNo())
.orderType(params.getOrderType())
.transType(BrandCashierTransTypeEnums.PAY)
.brandId(relation.getBrandId())
.brandId(studio.getBrandId())
.studioId(params.getStudioId())
.merchantId(merchant.getId())
.merchantNo(merchant.getMerchantNo())
......@@ -94,7 +93,7 @@ public class PayConvert {
.build();
}
private static void setSubChannel(BrandMerchantPayParams params) {
private static void setSubChannel(StudioMerchantPayParams params) {
if (PayTypeEnums.BARCODE != params.getPayType() || StringUtil.isBlank(params.getAuthCode())) {
// 未设置子渠道,不是付款码支付或付款码为空,直接返回
return;
......@@ -111,7 +110,7 @@ public class PayConvert {
}
}
private static BigDecimal getFeeRate(BrandMerchantPayParams params, MerchantVO merchant) {
private static BigDecimal getFeeRate(StudioMerchantPayParams params, MerchantVO merchant) {
SubChannelOpenTypeEnums scene;
switch (params.getPayType()) {
case MINI:
......
......@@ -2,14 +2,14 @@ package com.jiejing.fitness.finance.service.pay.impl;
import com.jiejing.common.exception.BizException;
import com.jiejing.fitness.finance.repository.entity.BrandCashierRecord;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.repository.entity.PartyToMerchant;
import com.jiejing.fitness.finance.repository.service.BrandCashierRecordRpService;
import com.jiejing.fitness.finance.repository.service.BrandToMerchantRpService;
import com.jiejing.fitness.finance.repository.service.PartyToMerchantRpService;
import com.jiejing.fitness.finance.service.enums.FinanceErrorEnums;
import com.jiejing.fitness.finance.service.pay.PayService;
import com.jiejing.fitness.finance.service.pay.convert.PayConvert;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantPayParams;
import com.jiejing.fitness.finance.service.pay.params.BrandMerchantRefundParams;
import com.jiejing.fitness.finance.service.pay.params.StudioMerchantPayParams;
import com.jiejing.fitness.finance.service.rpc.MerchantRpcService;
import com.jiejing.fitness.finance.service.rpc.PayRpcService;
import com.jiejing.fitness.finance.service.rpc.StudioRpcService;
......@@ -18,12 +18,10 @@ import com.jiejing.paycenter.api.pay.request.PayRequest;
import com.jiejing.paycenter.api.pay.request.RefundPayRequest;
import com.jiejing.paycenter.api.pay.vo.PayVO;
import com.jiejing.paycenter.api.pay.vo.RefundVO;
import com.jiejing.paycenter.common.enums.pay.PayStateEnums;
import com.jiejing.paycenter.common.event.PayEvent;
import com.jiejing.paycenter.common.event.RefundEvent;
import com.jiejing.studio.api.studio.vo.StudioVO;
import java.math.BigDecimal;
import java.util.List;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
......@@ -41,7 +39,7 @@ public class PayServiceImpl implements PayService {
private String channel;
@Resource
private BrandToMerchantRpService brandToMerchantRpService;
private PartyToMerchantRpService partyToMerchantRpService;
@Resource
private PayRpcService payRpcService;
......@@ -56,13 +54,16 @@ public class PayServiceImpl implements PayService {
private MerchantRpcService merchantRpcService;
@Override
public PayVO merchantPay(BrandMerchantPayParams params) {
public PayVO merchantPay(StudioMerchantPayParams params) {
StudioVO studio = studioRpcService.getStudio(params.getStudioId());
BrandToMerchant relation = brandToMerchantRpService.getByBrandId(studio.getBrandId(), channel);
PartyToMerchant relation = partyToMerchantRpService.getByStudioId(studio.getId(), channel);
if (null == relation) {
throw new BizException(FinanceErrorEnums.MERCHANT_NOT_OPEN);
}
MerchantVO merchant = merchantRpcService.getByMerchantId(relation.getMerchantId());
BrandCashierRecord record = PayConvert.convertPayInit(params, relation, merchant);
BrandCashierRecord record = PayConvert.convertPayInit(params, studio, merchant);
brandCashierRecordRpService.insert(record);
PayRequest request = PayConvert.convert(params, record);
......
......@@ -22,8 +22,8 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(description = "品牌商户支付Params")
public class BrandMerchantPayParams {
@ApiModel(description = "场馆商户支付Params")
public class StudioMerchantPayParams {
@ApiModelProperty(value = "场馆ID", required = true)
@NotNull(message = "场馆ID不能为空")
......
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