Commit dd8587f2 by 程裕兵

feat:resource

parent f0dbb1b5
package com.jiejing.fitness.finance.api.merchant.request;
import com.jiejing.common.swagger.EnumMapping;
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.common.enums.merchant.CompanyTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Map;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.AllArgsConstructor;
......@@ -57,9 +61,10 @@ public class ApplyStudioMerchantRequest {
@Valid
private BrandBankCardInfo bankCard;
@ApiModelProperty(value = "进件所需资料", required = true)
@NotNull(message = "进件所需资料不能为空")
@EnumMapping(enumClass = ResourceTypeEnums.class)
@ApiModelProperty(value = "进件所需资料", required = true, notes = "key从ResourceTypeEnums获取")
@NotEmpty(message = "进件所需资料不能为空")
@Valid
private BrandResourceInfo resource;
private Map<String, BrandResourceInfo> resourceMap;
}
......@@ -19,40 +19,11 @@ import lombok.NoArgsConstructor;
@ApiModel(description = "品牌商户:进件资料")
public class BrandResourceInfo {
@ApiModelProperty(value = "营业执照图片", required = true)
@NotNull(message = "营业执照图片不能为空")
private Long licensePicId;
@ApiModelProperty(value = "资源ID", required = true)
@NotNull(message = "资源ID不能为空")
private Long resourceId;
@ApiModelProperty(value = "线下经营门头照", required = true)
@NotNull(message = "线下经营门头照不能为空")
private Long storeHeaderPicId;
@ApiModelProperty(value = "线下经营内景照", required = true)
@NotNull(message = "线下经营内景照不能为空")
private Long storeInnerPicId;
@ApiModelProperty(value = "线下经营收银台", required = true)
@NotNull(message = "线下经营收银台不能为空")
private Long storeCashierDescPicId;
@ApiModelProperty(value = "法人证件人像面(正面)", required = true)
@NotNull(message = "法人身份证人像面不能为空")
private Long legalCertFrontPicId;
@ApiModelProperty(value = "法人证件国徽面(反面)", required = true)
@NotNull(message = "法人身份证国徽面不能为空")
private Long legalCertBackPicId;
@ApiModelProperty(value = "银行卡正面")
private Long bankCardFrontPicId;
@ApiModelProperty(value = "银行卡反面")
private Long bankCardBackPicId;
@ApiModelProperty(value = "结算卡持卡人证件人像面(正面)")
private Long bankCardCertFrontPicId;
@ApiModelProperty(value = "结算卡持卡人证件国徽面(反面)")
private Long bankCardCertBackPicId;
@ApiModelProperty(value = "资源链接", required = true)
private String url;
}
......@@ -4,7 +4,6 @@ import com.jiejing.common.swagger.EnumMapping;
import com.jiejing.paycenter.api.merchant.vo.SubChannelConfigVO;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.ExpireTypeEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
......@@ -100,9 +99,6 @@ public class BrandMerchantVO {
@ApiModelProperty(value = "结算卡信息")
private BrandBankCardVO bankCard;
@ApiModelProperty(value = "进件所需资料")
private BrandResourceVO resource;
@ApiModelProperty("子渠道配置记录")
private List<SubChannelConfigVO> subChannelConfigs;
......
......@@ -8,9 +8,11 @@ import com.jiejing.fitness.finance.api.merchant.request.model.BrandLicenseInfo;
import com.jiejing.fitness.finance.api.merchant.request.model.BrandResourceInfo;
import com.jiejing.paycenter.common.enums.common.OpenStateEnums;
import com.jiejing.paycenter.common.enums.merchant.CompanyTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -121,7 +123,7 @@ public class StudioMerchantApplyVO {
private BrandBankCardInfo bankCard;
@ApiModelProperty(value = "进件所需资料")
private BrandResourceInfo resource;
private Map<String, BrandResourceInfo> resourceMap;
@ApiModelProperty("完成时间")
private Date finishTime;
......
package com.jiejing.fitness.finance.api.merchant.vo;
import com.jiejing.common.swagger.EnumMapping;
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;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
import java.util.Map;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
......@@ -100,7 +102,7 @@ public class StudioMerchantVO {
private BrandBankCardVO bankCard;
@ApiModelProperty(value = "进件所需资料")
private BrandResourceVO resource;
private Map<String, BrandResourceInfo> resourceMap;
@ApiModelProperty("子渠道配置记录")
private List<SubChannelConfigVO> subChannelConfigs;
......
......@@ -200,7 +200,7 @@ public class MerchantConvert {
.legal(encrypt.getLegal())
.license(encrypt.getLicense())
.bankCard(encrypt.getBankCard())
.resource(encrypt.getResource())
.resourceMap(encrypt.getResourceMap())
.build());
}
......@@ -259,71 +259,16 @@ public class MerchantConvert {
return legalInfo;
}
private static BrandResourceVO convertResource(
private static Map<String, BrandResourceInfo> convertResourceMap(
Map<String, com.jiejing.paycenter.api.merchant.vo.ResourceInfoVO> resourceMap,
Map<Long, String> urlMap) {
BrandResourceVO resourceInfo = new BrandResourceVO();
setPicId(resourceInfo, resourceMap);
setPicUrl(resourceInfo, urlMap);
return resourceInfo;
}
private static void setPicUrl(BrandResourceVO resourceInfo, Map<Long, String> urlMap) {
if (CollectionUtil.isEmpty(urlMap)) {
return;
}
resourceInfo.setLicensePicUrl(
resourceInfo.getLicensePicId() == null ? null : urlMap.get(resourceInfo.getLicensePicId()));
resourceInfo.setStoreHeaderPicUrl(
resourceInfo.getStoreHeaderPicId() == null ? null : urlMap.get(resourceInfo.getStoreHeaderPicId()));
resourceInfo.setStoreInnerPicUrl(
resourceInfo.getStoreInnerPicId() == null ? null : urlMap.get(resourceInfo.getStoreInnerPicId()));
resourceInfo.setStoreCashierDescPicUrl(resourceInfo.getStoreCashierDescPicId() == null ? null
: urlMap.get(resourceInfo.getStoreCashierDescPicId()));
resourceInfo.setLegalCertFrontPicUrl(resourceInfo.getLegalCertFrontPicId() == null ? null
: urlMap.get(resourceInfo.getLegalCertFrontPicId()));
resourceInfo.setLegalCertBackPicUrl(resourceInfo.getLegalCertBackPicId() == null ? null
: urlMap.get(resourceInfo.getLegalCertBackPicId()));
resourceInfo.setBankCardFrontPicUrl(resourceInfo.getBankCardFrontPicId() == null ? null
: urlMap.get(resourceInfo.getBankCardFrontPicId()));
resourceInfo.setBankCardBackPicUrl(
resourceInfo.getBankCardBackPicId() == null ? null : urlMap.get(resourceInfo.getBankCardBackPicId()));
resourceInfo.setBankCardCertFrontPicUrl(resourceInfo.getBankCardCertFrontPicId() == null ? null
: urlMap.get(resourceInfo.getBankCardCertFrontPicId()));
resourceInfo.setBankCardCertBackPicUrl(resourceInfo.getBankCardCertBackPicId() == null ? null
: urlMap.get(resourceInfo.getBankCardCertBackPicId()));
}
private static void setPicId(BrandResourceVO resourceInfo,
Map<String, com.jiejing.paycenter.api.merchant.vo.ResourceInfoVO> resourceMap) {
resourceInfo.setLicensePicId(
Optional.ofNullable(resourceMap.get(LICENSE.name())).map(e -> e.getResourceId()).orElse(null));
resourceInfo.setStoreHeaderPicId(
Optional.ofNullable(resourceMap.get(STORE_HEADER_PIC.name())).map(e -> e.getResourceId())
.orElse(null));
resourceInfo.setStoreInnerPicId(
Optional.ofNullable(resourceMap.get(STORE_INNER_PIC.name())).map(e -> e.getResourceId())
.orElse(null));
resourceInfo.setStoreCashierDescPicId(
Optional.ofNullable(resourceMap.get(STORE_CASHIER_DESK_PIC.name())).map(e -> e.getResourceId())
.orElse(null));
resourceInfo.setLegalCertFrontPicId(
Optional.ofNullable(resourceMap.get(LEGAL_CERT_FRONT.name())).map(e -> e.getResourceId())
.orElse(null));
resourceInfo.setLegalCertBackPicId(
Optional.ofNullable(resourceMap.get(LEGAL_CERT_BACK.name())).map(e -> e.getResourceId())
.orElse(null));
resourceInfo.setBankCardFrontPicId(
Optional.ofNullable(resourceMap.get(BANK_CARD_FRONT.name())).map(e -> e.getResourceId())
.orElse(null));
resourceInfo.setBankCardBackPicId(
Optional.ofNullable(resourceMap.get(BANK_CARD_BACK.name())).map(e -> e.getResourceId()).orElse(null));
resourceInfo.setBankCardCertFrontPicId(
Optional.ofNullable(resourceMap.get(BANK_CARD_CERT_FRONT.name())).map(e -> e.getResourceId())
.orElse(null));
resourceInfo.setBankCardCertBackPicId(
Optional.ofNullable(resourceMap.get(BANK_CARD_CERT_BACK.name())).map(e -> e.getResourceId())
.orElse(null));
Map<String, BrandResourceInfo> map = new HashMap<>(resourceMap.size());
resourceMap.keySet().forEach(key -> {
Long resourceId = resourceMap.get(key).getResourceId();
String url = urlMap.get(resourceId);
map.put(key, BrandResourceInfo.builder().resourceId(resourceId).url(url).build());
});
return map;
}
private static OpenStateEnums convertWxOfflineAuthState(List<SubChannelAuthInfo> auths) {
......@@ -416,43 +361,23 @@ public class MerchantConvert {
.collect(Collectors.toList());
}
public static Map<ResourceTypeEnums, ResourceInfo> convertResourceMap(BrandResourceInfo resource) {
Map<ResourceTypeEnums, ResourceInfo> map = new HashMap<>(1);
if (null != resource.getLicensePicId()) {
map.put(LICENSE, convert(resource.getLicensePicId(), LICENSE));
}
if (null != resource.getStoreHeaderPicId()) {
map.put(STORE_HEADER_PIC, convert(resource.getStoreHeaderPicId(), STORE_HEADER_PIC));
}
if (null != resource.getStoreInnerPicId()) {
map.put(STORE_INNER_PIC, convert(resource.getStoreInnerPicId(), STORE_INNER_PIC));
}
if (null != resource.getStoreCashierDescPicId()) {
map.put(STORE_CASHIER_DESK_PIC, convert(resource.getStoreCashierDescPicId(), STORE_CASHIER_DESK_PIC));
}
if (null != resource.getLegalCertFrontPicId()) {
map.put(LEGAL_CERT_FRONT, convert(resource.getLegalCertFrontPicId(), LEGAL_CERT_FRONT));
}
if (null != resource.getLegalCertBackPicId()) {
map.put(LEGAL_CERT_BACK, convert(resource.getLegalCertBackPicId(), LEGAL_CERT_BACK));
}
if (null != resource.getBankCardFrontPicId()) {
map.put(BANK_CARD_FRONT, convert(resource.getBankCardFrontPicId(), BANK_CARD_FRONT));
}
if (null != resource.getBankCardBackPicId()) {
map.put(BANK_CARD_BACK, convert(resource.getBankCardBackPicId(), BANK_CARD_BACK));
}
if (null != resource.getBankCardCertFrontPicId()) {
map.put(BANK_CARD_CERT_FRONT, convert(resource.getBankCardCertFrontPicId(), BANK_CARD_CERT_FRONT));
}
if (null != resource.getBankCardCertBackPicId()) {
map.put(BANK_CARD_CERT_BACK, convert(resource.getBankCardCertBackPicId(), BANK_CARD_CERT_BACK));
}
return map;
private static ResourceInfo convertResourceInfo(ResourceTypeEnums type, BrandResourceInfo info) {
return ResourceInfo.builder()
.type(type)
.resourceId(info.getResourceId())
.build();
}
private static ResourceInfo convert(Long id, ResourceTypeEnums type) {
return ResourceInfo.builder().resourceId(id).type(type).build();
public static Map<ResourceTypeEnums, ResourceInfo> convertResourceMap(
Map<String, BrandResourceInfo> resourceMap) {
Map<ResourceTypeEnums, ResourceInfo> map = new HashMap<>(1);
resourceMap.keySet().stream()
.filter(key -> null != ResourceTypeEnums.getByName(key))
.forEach(key -> {
ResourceTypeEnums type = ResourceTypeEnums.getByName(key);
map.put(type, convertResourceInfo(type, resourceMap.get(key)));
});
return map;
}
public static StudioMerchantVO convertStudioMerchant(PartyToMerchant relation, MerchantVO merchant,
......@@ -486,7 +411,7 @@ public class MerchantConvert {
.license(JsonUtil.convertObject(merchant.getLicense(), BrandLicenseVO.class))
.legal(convertLegal(merchant.getLegal(), merchant.getContact()))
.bankCard(JsonUtil.convertObject(merchant.getBankCard(), BrandBankCardVO.class))
.resource(convertResource(merchant.getResourceMap(), urlMap))
.resourceMap(convertResourceMap(merchant.getResourceMap(), urlMap))
.subChannelConfigs(merchant.getSubChannelConfigs())
.build();
}
......@@ -523,7 +448,7 @@ public class MerchantConvert {
.license(info.getLicense())
.legal(info.getLegal())
.bankCard(info.getBankCard())
.resource(info.getResource())
.resourceMap(info.getResourceMap())
.finishTime(apply.getFinishTime())
.createTime(apply.getCreateTime())
.updateTime(apply.getUpdateTime())
......
......@@ -284,7 +284,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
private Map<ResourceTypeEnums, ResourceInfo> upload(ApplyStudioMerchantParams params) {
Map<ResourceTypeEnums, ResourceInfo> resourceMap = MerchantConvert.convertResourceMap(
params.getResource());
params.getResourceMap());
Map<Long, ResourceInfoVO> resourceIdUrlMap = resourceRpcService.getResourceMap(params.getStudioId(),
getResourceIds(resourceMap));
......@@ -308,7 +308,7 @@ public class StudioMerchantServiceImpl implements StudioMerchantService {
private List<Long> getResourceIds(MerchantVO merchant) {
return merchant.getResourceMap().values().stream()
.map(e -> e.getResourceId())
.map(com.jiejing.paycenter.api.merchant.vo.ResourceInfoVO::getResourceId)
.filter(Objects::nonNull)
.distinct()
.collect(Collectors.toList());
......
package com.jiejing.fitness.finance.service.merchant.params;
import com.alibaba.fastjson.JSON;
import com.jiejing.common.swagger.EnumMapping;
import com.jiejing.common.utils.crypt.AesUtil;
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.common.enums.merchant.CompanyTypeEnums;
import com.jiejing.paycenter.common.enums.merchant.ResourceTypeEnums;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Map;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.AllArgsConstructor;
......@@ -59,13 +63,15 @@ public class ApplyStudioMerchantParams {
@Valid
private BrandBankCardInfo bankCard;
@ApiModelProperty(value = "进件所需资料", required = true)
@NotNull(message = "进件所需资料不能为空")
@EnumMapping(enumClass = ResourceTypeEnums.class)
@ApiModelProperty(value = "进件所需资料", required = true, notes = "key从ResourceTypeEnums获取")
@NotEmpty(message = "进件所需资料不能为空")
@Valid
private BrandResourceInfo resource;
private Map<String, BrandResourceInfo> resourceMap;
public ApplyStudioMerchantParams encrypt(String salt) {
ApplyStudioMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyStudioMerchantParams.class);
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()));
......@@ -81,7 +87,8 @@ public class ApplyStudioMerchantParams {
}
public ApplyStudioMerchantParams decrypt(String salt) {
ApplyStudioMerchantParams copy = JSON.parseObject(JSON.toJSONString(this), ApplyStudioMerchantParams.class);
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()));
......
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