Commit 8bcd5460 by 程裕兵

feat:get/page merchant

parent 48429446
package com.jiejing.fitness.finance.api.merchant; package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult; 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.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
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.vo.BrandMerchantApplyVO;
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;
...@@ -27,4 +31,12 @@ public interface BrandMerchantApi { ...@@ -27,4 +31,12 @@ public interface BrandMerchantApi {
@PostMapping(value = "/private/brandMerchant/get") @PostMapping(value = "/private/brandMerchant/get")
JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request); 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);
} }
package com.jiejing.fitness.finance.api.merchant; package com.jiejing.fitness.finance.api.merchant;
import com.jiejing.common.model.JsonResult; 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.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
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.vo.BrandMerchantApplyVO;
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;
...@@ -26,6 +30,16 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp ...@@ -26,6 +30,16 @@ public class BrandMerchantApiFallback implements FallbackFactory<BrandMerchantAp
public JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request) { public JsonResult<BrandMerchantVO> get(GetBrandMerchantRequest request) {
return JsonResult.rpcError(); return JsonResult.rpcError();
} }
@Override
public JsonResult<BrandMerchantApplyVO> getApply(GetBrandMerchantApplyRequest request) {
return JsonResult.rpcError();
}
@Override
public JsonResult<PageVO<BrandMerchantApplyVO>> pageApply(PageBrandMerchantApplyRequest request) {
return JsonResult.rpcError();
}
}; };
} }
} }
package com.jiejing.fitness.finance.api.merchant.request;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 品牌申请商户请求
*
* @author chengyubing
* @since 2024/2/20 14:03
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户记录请求信息")
public class GetBrandMerchantApplyRequest {
@ApiModelProperty(value = "申请ID", required = true)
@NotNull(message = "申请ID不能为空")
private Long id;
}
package com.jiejing.fitness.finance.api.merchant.request;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author chengyubing
* @since 2024/2/22 16:38
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "分页查询申请品牌商户请求信息Request")
public class PageBrandMerchantApplyRequest {
@ApiModelProperty(value = "商户简称")
private String shortName;
@ApiModelProperty(value = "操作类型")
private ApplyTypeEnums applyType;
@ApiModelProperty(value = "场馆ID")
private Long studioId;
@ApiModelProperty(value = "申请类型")
private CompanyTypeEnums companyType;
@ApiModelProperty(value = "商户名称")
private String merchantName;
@ApiModelProperty(value = "申请状态")
private OpenStateEnums openState;
@ApiModelProperty(value = "商户号")
private String merchantNo;
@ApiModelProperty(value = "支付宝商户号")
private String aliMerchantNo;
@ApiModelProperty(value = "微信线上商户号")
private String wxOnlineMerchantNo;
@ApiModelProperty(value = "微信线下商户号")
private String wxOfflineMerchantNo;
@ApiModelProperty(value = "页码:0开始", required = true)
@NotNull(message = "页码不能为空")
private Integer current;
@ApiModelProperty(value = "分页大小", required = true)
@NotNull(message = "分页大小不能为空")
private Integer size;
}
package com.jiejing.fitness.finance.app.controller.merchant; package com.jiejing.fitness.finance.app.controller.merchant;
import com.jiejing.common.model.JsonResult; import com.jiejing.common.model.JsonResult;
import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.convert.BeanUtil; import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.fitness.finance.api.merchant.BrandMerchantApi; 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.ApplyBrandMerchantRequest;
import com.jiejing.fitness.finance.api.merchant.request.GetBrandMerchantApplyRequest;
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.vo.BrandMerchantApplyVO;
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;
import com.jiejing.fitness.finance.service.merchant.params.PageBrandMerchantApplyParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.Valid; import javax.validation.Valid;
...@@ -41,4 +46,20 @@ public class BrandMerchantController implements BrandMerchantApi { ...@@ -41,4 +46,20 @@ public class BrandMerchantController implements BrandMerchantApi {
return JsonResult.success(brandMerchantService.getMerchant(request.getBrandId())); 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));
}
} }
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 javax.validation.constraints.NotNull;
import lombok.Data;
/**
* @author chengyubing
* @since 2024/2/22 18:03
*/
@Data
public class PageBrandMerchantApplyQuery {
/**
* 商户简称
*/
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;
}
...@@ -14,9 +14,13 @@ ...@@ -14,9 +14,13 @@
package com.jiejing.fitness.finance.repository.service; 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.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.mapper.BrandMerchantApplyMapper; import com.jiejing.fitness.finance.repository.mapper.BrandMerchantApplyMapper;
import com.jiejing.fitness.finance.repository.query.PageBrandMerchantApplyQuery;
import com.jiejing.mbp.MapperRepoService; import com.jiejing.mbp.MapperRepoService;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -34,4 +38,39 @@ public class BrandMerchantApplyRpService extends ...@@ -34,4 +38,39 @@ public class BrandMerchantApplyRpService extends
return this.baseMapper.getLatestOneSuccessByBrandId(brandId); return this.baseMapper.getLatestOneSuccessByBrandId(brandId);
} }
public Page<BrandMerchantApply> page(PageBrandMerchantApplyQuery params) {
QueryWrapper<BrandMerchantApply> wrapper = new QueryWrapper<>();
if (StringUtil.isNotBlank(params.getShortName())) {
wrapper.like(BrandMerchantApply.SHORT_NAME, params.getShortName());
}
if (null != params.getApplyType()) {
wrapper.eq(BrandMerchantApply.APPLY_TYPE, params.getApplyType());
}
if (null != params.getStudioId()) {
wrapper.eq(BrandMerchantApply.STUDIO_ID, params.getStudioId());
}
if (null != params.getCompanyType()) {
wrapper.eq(BrandMerchantApply.COMPANY_TYPE, params.getCompanyType());
}
if (StringUtil.isNotBlank(params.getMerchantName())) {
wrapper.like(BrandMerchantApply.MERCHANT_NAME, params.getMerchantName());
}
if (null != params.getOpenState()) {
wrapper.eq(BrandMerchantApply.OPEN_STATE, params.getOpenState());
}
if (StringUtil.isNotBlank(params.getMerchantNo())) {
wrapper.eq(BrandMerchantApply.MERCHANT_NO, params.getMerchantNo());
}
if (StringUtil.isNotBlank(params.getAliMerchantNo())) {
wrapper.eq(BrandMerchantApply.ALI_MERCHANT_NO, params.getAliMerchantNo());
}
if (StringUtil.isNotBlank(params.getWxOnlineMerchantNo())) {
wrapper.eq(BrandMerchantApply.WX_ONLINE_MERCHANT_NO, params.getWxOnlineMerchantNo());
}
if (StringUtil.isNotBlank(params.getWxOfflineMerchantNo())) {
wrapper.eq(BrandMerchantApply.WX_OFFLINE_MERCHANT_NO, params.getWxOfflineMerchantNo());
}
return this.findByWrapperPage(wrapper, params.getCurrent(), params.getSize());
}
} }
...@@ -38,6 +38,14 @@ public interface BrandMerchantService { ...@@ -38,6 +38,14 @@ public interface BrandMerchantService {
BrandMerchantVO getMerchant(Long brandId); BrandMerchantVO getMerchant(Long brandId);
/** /**
* 获取申请记录详情
*
* @param id ID
* @return 结果
*/
BrandMerchantApplyVO getApply(Long id);
/**
* 分页查询品牌商户申请记录 * 分页查询品牌商户申请记录
* *
* @param params 请求 * @param params 请求
......
...@@ -15,6 +15,7 @@ import com.jiejing.fitness.finance.api.merchant.model.BrandBankCardInfo; ...@@ -15,6 +15,7 @@ import com.jiejing.fitness.finance.api.merchant.model.BrandBankCardInfo;
import com.jiejing.fitness.finance.api.merchant.model.BrandLegalInfo; import com.jiejing.fitness.finance.api.merchant.model.BrandLegalInfo;
import com.jiejing.fitness.finance.api.merchant.model.BrandLicenseInfo; import com.jiejing.fitness.finance.api.merchant.model.BrandLicenseInfo;
import com.jiejing.fitness.finance.api.merchant.model.BrandResourceInfo; import com.jiejing.fitness.finance.api.merchant.model.BrandResourceInfo;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantApplyVO;
import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply; import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant; import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
...@@ -458,4 +459,22 @@ public class MerchantConvert { ...@@ -458,4 +459,22 @@ public class MerchantConvert {
.build(); .build();
} }
public static BrandMerchantApplyVO convertApply(BrandMerchantApply apply) {
ApplyBrandMerchantParams info = JSON.parseObject(apply.getMerchantInfo(),
ApplyBrandMerchantParams.class).decrypt(apply.getSalt());
BrandMerchantApplyVO vo = BeanUtil.map(apply, BrandMerchantApplyVO.class);
vo.setLegal(info.getLegal());
vo.setResource(info.getResource());
vo.setLicense(info.getLicense());
vo.setBankCard(info.getBankCard());
return vo;
}
public static List<BrandMerchantApplyVO> convertApplyList(List<BrandMerchantApply> applies) {
return Optional.ofNullable(applies)
.orElse(new ArrayList<>())
.stream()
.map(MerchantConvert::convertApply)
.collect(Collectors.toList());
}
} }
...@@ -3,11 +3,13 @@ package com.jiejing.fitness.finance.service.merchant.impl; ...@@ -3,11 +3,13 @@ package com.jiejing.fitness.finance.service.merchant.impl;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.jiejing.common.exception.BizException; import com.jiejing.common.exception.BizException;
import com.jiejing.common.model.PageVO; import com.jiejing.common.model.PageVO;
import com.jiejing.common.utils.convert.BeanUtil;
import com.jiejing.filecenter.api.resource.vo.ResourceInfoVO; import com.jiejing.filecenter.api.resource.vo.ResourceInfoVO;
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.BrandMerchantVO; import com.jiejing.fitness.finance.api.merchant.vo.BrandMerchantVO;
import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply; import com.jiejing.fitness.finance.repository.entity.BrandMerchantApply;
import com.jiejing.fitness.finance.repository.entity.BrandToMerchant; import com.jiejing.fitness.finance.repository.entity.BrandToMerchant;
import com.jiejing.fitness.finance.repository.query.PageBrandMerchantApplyQuery;
import com.jiejing.fitness.finance.repository.service.BrandMerchantApplyRpService; import com.jiejing.fitness.finance.repository.service.BrandMerchantApplyRpService;
import com.jiejing.fitness.finance.repository.service.BrandToMerchantRpService; import com.jiejing.fitness.finance.repository.service.BrandToMerchantRpService;
import com.jiejing.fitness.finance.service.enums.FinanceErrorEnums; import com.jiejing.fitness.finance.service.enums.FinanceErrorEnums;
...@@ -32,6 +34,7 @@ import java.util.stream.Collectors; ...@@ -32,6 +34,7 @@ import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -122,8 +125,17 @@ public class BrandMerchantServiceImpl implements BrandMerchantService { ...@@ -122,8 +125,17 @@ public class BrandMerchantServiceImpl implements BrandMerchantService {
} }
@Override @Override
public BrandMerchantApplyVO getApply(Long id) {
BrandMerchantApply apply = brandMerchantApplyRpService.getById(id)
.orElseThrow(() -> new BizException(FinanceErrorEnums.NOT_EXIST));
return MerchantConvert.convertApply(apply);
}
@Override
public PageVO<BrandMerchantApplyVO> pageApply(PageBrandMerchantApplyParams params) { public PageVO<BrandMerchantApplyVO> pageApply(PageBrandMerchantApplyParams params) {
return null; Page<BrandMerchantApply> page = brandMerchantApplyRpService.page(BeanUtil.map(params,
PageBrandMerchantApplyQuery.class));
return PageVO.convert(page, MerchantConvert.convertApplyList(page.getContent()));
} }
private void doOpenMerchantSuccess(MerchantEvent event) { private void doOpenMerchantSuccess(MerchantEvent event) {
......
...@@ -85,4 +85,20 @@ public class ApplyBrandMerchantParams { ...@@ -85,4 +85,20 @@ public class ApplyBrandMerchantParams {
return copy; return copy;
} }
public ApplyBrandMerchantParams decrypt(String salt) {
ApplyBrandMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyBrandMerchantParams.class);
if (null != copy.getBankCard()) {
copy.getBankCard().setCardNo(AesUtil.decrypt(salt, copy.getBankCard().getCardNo()));
copy.getBankCard().setCertNo(AesUtil.decrypt(salt, copy.getBankCard().getCertNo()));
copy.getBankCard().setBaseDepositNo(AesUtil.decrypt(salt, copy.getBankCard().getBaseDepositNo()));
}
if (null != copy.getLegal()) {
copy.getLegal().setLegalCertNo(AesUtil.decrypt(salt, copy.getLegal().getLegalCertNo()));
}
if (null != copy.getLicense()) {
copy.getLicense().setLicenseCode(AesUtil.decrypt(salt, copy.getLicense().getLicenseCode()));
}
return copy;
}
} }
package com.jiejing.fitness.finance.service.merchant.params; package com.jiejing.fitness.finance.service.merchant.params;
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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import javax.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/** /**
* @author chengyubing * @author chengyubing
* @since 2024/2/22 16:38 * @since 2024/2/22 16:38
*/ */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@ApiModel(description = "申请品牌商户请求信息")
public class PageBrandMerchantApplyParams { public class PageBrandMerchantApplyParams {
@ApiModelProperty(value = "商户简称")
private String shortName;
@ApiModelProperty(value = "操作类型")
private ApplyTypeEnums applyType;
@ApiModelProperty(value = "场馆ID")
private Long studioId;
@ApiModelProperty(value = "申请类型")
private CompanyTypeEnums companyType;
@ApiModelProperty(value = "商户名称")
private String merchantName;
@ApiModelProperty(value = "申请状态")
private OpenStateEnums openState;
@ApiModelProperty(value = "商户号")
private String merchantNo;
@ApiModelProperty(value = "支付宝商户号")
private String aliMerchantNo;
@ApiModelProperty(value = "微信线上商户号")
private String wxOnlineMerchantNo;
@ApiModelProperty(value = "微信线下商户号")
private String wxOfflineMerchantNo;
@ApiModelProperty(value = "页码:0开始", required = true)
@NotNull(message = "页码不能为空")
private Integer current;
@ApiModelProperty(value = "分页大小", required = true)
@NotNull(message = "分页大小不能为空")
private Integer size;
} }
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