上传图片
This commit is contained in:
@@ -48,9 +48,6 @@ public class OrderMqListener {
|
||||
orderInfoCustomService.updateOrderDetailStatus(Long.valueOf(finalInfo));
|
||||
|
||||
});
|
||||
info = info.replace("UP_ORDER_DETAIL:", "");
|
||||
System.out.println(info);
|
||||
|
||||
}
|
||||
|
||||
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_STOCK_QUEUE})
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
package com.czg;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.czg.dto.req.*;
|
||||
import com.czg.dto.resp.BankBranchDto;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.third.alipay.AlipayEntryManager;
|
||||
import com.czg.third.wechat.WechatEntryManager;
|
||||
import com.czg.utils.AssertUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -16,16 +21,252 @@ public class EntryManager {
|
||||
/**
|
||||
* 查询银行支行列表
|
||||
*
|
||||
* @param province 省份 陕西省
|
||||
* @param city 城市 西安市
|
||||
* @param instId 顶级机构ID CMB
|
||||
* @param province 省份 陕西省
|
||||
* @param city 城市 西安市
|
||||
* @param instId 顶级机构ID CMB
|
||||
*/
|
||||
public static List<BankBranchDto> queryBankBranchList(String province, String city, String instId) {
|
||||
return AlipayEntryManager.queryBankBranchList(instId, province, city);
|
||||
}
|
||||
|
||||
/**
|
||||
* 进件
|
||||
* 请先执行:
|
||||
* 1. {@link com.czg.EntryManager#verifyEntryParam(AggregateMerchantDto)} 验证进件参数
|
||||
* 2. {@link com.czg.EntryManager#uploadParamImage(AggregateMerchantDto)} 上传图片至第三方
|
||||
* @param reqDto 进件参数
|
||||
*/
|
||||
public static void entryMerchant(AggregateMerchantDto reqDto) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传图片至第三方
|
||||
* 请先执行 {@link com.czg.EntryManager#verifyEntryParam(AggregateMerchantDto)} 验证进件参数
|
||||
* @param reqDto 进件参数
|
||||
*/
|
||||
public static void uploadParamImage(AggregateMerchantDto reqDto) {
|
||||
MerchantBaseInfoDto baseInfo = reqDto.getMerchantBaseInfo();
|
||||
// 联系人身份证反面
|
||||
if (baseInfo.getContactIdCardBackPic() != null) {
|
||||
uploadImageToThird(baseInfo.getContactIdCardBackPic());
|
||||
}
|
||||
// 联系人身份证正面
|
||||
if (baseInfo.getContactIdCardFrontPic() != null) {
|
||||
uploadImageToThird(baseInfo.getContactIdCardFrontPic());
|
||||
}
|
||||
|
||||
LegalPersonInfoDto legalPersonInfo = reqDto.getLegalPersonInfo();
|
||||
// 法人身份证反面
|
||||
if (legalPersonInfo.getIdCardBackPic() != null) {
|
||||
uploadImageToThird(legalPersonInfo.getIdCardBackPic());
|
||||
}
|
||||
// 法人身份证正面
|
||||
if (legalPersonInfo.getIdCardFrontPic() != null) {
|
||||
uploadImageToThird(legalPersonInfo.getIdCardFrontPic());
|
||||
}
|
||||
// 法人手持身份证
|
||||
if (legalPersonInfo.getIdCardHandPic() != null) {
|
||||
uploadImageToThird(legalPersonInfo.getIdCardHandPic());
|
||||
}
|
||||
|
||||
BusinessLicenceInfoDto businessLicenceInfo = reqDto.getBusinessLicenceInfo();
|
||||
// 营业执照
|
||||
if (businessLicenceInfo.getLicensePic() != null) {
|
||||
uploadImageToThird(businessLicenceInfo.getLicensePic());
|
||||
}
|
||||
|
||||
SettlementInfoDto settlementInfo = reqDto.getSettlementInfo();
|
||||
// 银行卡背面
|
||||
if (settlementInfo.getBankCardBackPic() != null) {
|
||||
uploadImageToThird(settlementInfo.getBankCardBackPic());
|
||||
}
|
||||
// 银行卡正面
|
||||
if (settlementInfo.getBankCardFrontPic() != null) {
|
||||
uploadImageToThird(settlementInfo.getBankCardFrontPic());
|
||||
}
|
||||
// 开户许可证
|
||||
if (settlementInfo.getOpenAccountLicencePic() != null) {
|
||||
uploadImageToThird(settlementInfo.getOpenAccountLicencePic());
|
||||
}
|
||||
// 非法人手持授权函
|
||||
if (settlementInfo.getNoLegalHandSettleAuthPic() != null) {
|
||||
uploadImageToThird(settlementInfo.getNoLegalHandSettleAuthPic());
|
||||
}
|
||||
// 非法人授权函
|
||||
if (settlementInfo.getNoLegalSettleAuthPic() != null) {
|
||||
uploadImageToThird(settlementInfo.getNoLegalSettleAuthPic());
|
||||
}
|
||||
// 非法人身份证反面
|
||||
if (settlementInfo.getNoLegalIdCardBackPic() != null) {
|
||||
uploadImageToThird(settlementInfo.getNoLegalIdCardBackPic());
|
||||
}
|
||||
// 非法人身份证正面
|
||||
if (settlementInfo.getNoLegalIdCardFrontPic() != null) {
|
||||
uploadImageToThird(settlementInfo.getNoLegalIdCardFrontPic());
|
||||
}
|
||||
|
||||
StoreInfoDto storeInfo = reqDto.getStoreInfo();
|
||||
// 店内图片
|
||||
if (storeInfo.getInsidePic() != null) {
|
||||
uploadImageToThird(storeInfo.getInsidePic());
|
||||
}
|
||||
// 门店门头图片
|
||||
if (storeInfo.getDoorPic() != null) {
|
||||
uploadImageToThird(storeInfo.getDoorPic());
|
||||
}
|
||||
// 收银台图片
|
||||
if (storeInfo.getCashierDeskPic() != null) {
|
||||
uploadImageToThird(storeInfo.getCashierDeskPic());
|
||||
}
|
||||
}
|
||||
|
||||
private static void uploadImageToThird(ImageDto dto) {
|
||||
if (StrUtil.isBlank(dto.getWechatId())) {
|
||||
String image = WechatEntryManager.uploadImage(dto.getUrl());
|
||||
dto.setWechatId(image);
|
||||
}
|
||||
if (StrUtil.isBlank(dto.getAlipayId())) {
|
||||
String image = AlipayEntryManager.uploadImage(dto.getUrl());
|
||||
dto.setAlipayId(image);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证进件参数
|
||||
*
|
||||
* @param reqDto 进件参数
|
||||
*/
|
||||
public static void verifyEntryParam(AggregateMerchantDto reqDto) {
|
||||
AssertUtil.isBlank(reqDto.getMerchantCode(), "商户编号不能为空");
|
||||
|
||||
AssertUtil.isNull(reqDto.getMerchantBaseInfo(), "商户基础信息不能为空");
|
||||
|
||||
MerchantBaseInfoDto baseInfo = reqDto.getMerchantBaseInfo();
|
||||
AssertUtil.isBlank(baseInfo.getUserType(), "商户类型不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getShortName(), "商户简称不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getCertType(), "证件类型不能为空");
|
||||
if (!"0".equals(baseInfo.getCertType())) {
|
||||
throw new CzgException("证件类型错误");
|
||||
}
|
||||
AssertUtil.isBlank(baseInfo.getMccCode(), "商户行业编码不能为空");
|
||||
if ("SUPER".equals(baseInfo.getContactPersonType())) {
|
||||
AssertUtil.isBlank(baseInfo.getContactName(), "联系人姓名不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactPersonId(), "联系人身份证号不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactPhone(), "联系人电话不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactAddr(), "联系人地址不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactEmail(), "联系人邮箱不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactIdStartDate(), "联系人身份证开始日期不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactPersonIdEndDate(), "联系人身份证到期日期不能为空");
|
||||
AssertUtil.isNull(baseInfo.getContactIdCardBackPic(), "联系人身份证反面不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactIdCardBackPic().getUrl(), "联系人身份证反面不能为空");
|
||||
AssertUtil.isNull(baseInfo.getContactIdCardFrontPic(), "联系人身份证正面不能为空");
|
||||
AssertUtil.isBlank(baseInfo.getContactIdCardFrontPic().getUrl(), "联系人身份证正面不能为空");
|
||||
}
|
||||
AssertUtil.isBlank(baseInfo.getCompanyChildType(), "商户类型不能为空");
|
||||
if ("0".equals(baseInfo.getUserType())) {
|
||||
// 个体商户, 暂无其他校验
|
||||
} else if ("1".equals(baseInfo.getUserType())) {
|
||||
if (!"1".equals(baseInfo.getCompanyChildType()) && !"2".equals(baseInfo.getCompanyChildType()) && !"3".equals(baseInfo.getCompanyChildType())) {
|
||||
throw new CzgException("商户类型错误");
|
||||
}
|
||||
} else {
|
||||
throw new CzgException("商户类型错误");
|
||||
}
|
||||
|
||||
AssertUtil.isNull(reqDto.getBusinessLicenceInfo(), "营业执照信息不能为空");
|
||||
BusinessLicenceInfoDto businessLicenceInfo = reqDto.getBusinessLicenceInfo();
|
||||
AssertUtil.isBlank(businessLicenceInfo.getLicenceNo(), "营业执照编号不能为空");
|
||||
AssertUtil.isBlank(businessLicenceInfo.getLicenceName(), "营业执照名称不能为空");
|
||||
AssertUtil.isBlank(businessLicenceInfo.getRegisteredAddress(), "营业执照注册地址不能为空");
|
||||
AssertUtil.isBlank(businessLicenceInfo.getLicenceStartDate(), "营业执照开始日期不能为空");
|
||||
AssertUtil.isBlank(businessLicenceInfo.getLicenceEndDate(), "营业执照到期日期不能为空");
|
||||
AssertUtil.isNull(businessLicenceInfo.getLicensePic(), "营业执照名称不能为空");
|
||||
AssertUtil.isBlank(businessLicenceInfo.getLicensePic().getUrl(), "营业执照名称不能为空");
|
||||
|
||||
|
||||
AssertUtil.isNull(reqDto.getLegalPersonInfo(), "法人信息不能为空");
|
||||
LegalPersonInfoDto legalPersonInfo = reqDto.getLegalPersonInfo();
|
||||
AssertUtil.isBlank(legalPersonInfo.getLegalPersonName(), "法人姓名不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getLegalPersonId(), "法人身份证号不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getLegalIdStartDate(), "法人身份证开始日期不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getLegalPersonIdEndDate(), "法人身份证到期日期不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getLegalPersonPhone(), "法人电话不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getLegalGender(), "法人性别不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getLegalAddress(), "法人地址不能为空");
|
||||
AssertUtil.isNull(legalPersonInfo.getIdCardHandPic(), "法人身份证手持不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getIdCardHandPic().getUrl(), "法人身份证手持不能为空");
|
||||
AssertUtil.isNull(legalPersonInfo.getIdCardFrontPic(), "法人身份证正面不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getIdCardFrontPic().getUrl(), "法人身份证正面不能为空");
|
||||
AssertUtil.isNull(legalPersonInfo.getIdCardBackPic(), "法人身份证反面不能为空");
|
||||
AssertUtil.isBlank(legalPersonInfo.getIdCardBackPic().getUrl(), "法人身份证反面不能为空");
|
||||
|
||||
AssertUtil.isNull(reqDto.getStoreInfo(), "门店信息不能为空");
|
||||
StoreInfoDto storeInfo = reqDto.getStoreInfo();
|
||||
AssertUtil.isBlank(storeInfo.getMercProvId(), "门店省ID不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getMercCityId(), "门店市ID不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getMercAreaId(), "门店区ID不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getMercProv(), "门店省不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getMercCity(), "门店市不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getMercArea(), "门店区不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getBusinessAddress(), "门店营业地址不能为空");
|
||||
AssertUtil.isNull(storeInfo.getInsidePic(), "门店营业地址不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getInsidePic().getUrl(), "门店营业地址不能为空");
|
||||
AssertUtil.isNull(storeInfo.getDoorPic(), "门店门头照不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getDoorPic().getUrl(), "门店门头照不能为空");
|
||||
AssertUtil.isNull(storeInfo.getCashierDeskPic(), "门店收银台照不能为空");
|
||||
AssertUtil.isBlank(storeInfo.getCashierDeskPic().getUrl(), "门店收银台照不能为空");
|
||||
|
||||
|
||||
AssertUtil.isNull(reqDto.getSettlementInfo(), "结算信息不能为空");
|
||||
SettlementInfoDto settlementInfo = reqDto.getSettlementInfo();
|
||||
AssertUtil.isBlank(settlementInfo.getSettlementCardNo(), "结算卡号不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getSettlementName(), "结算账户户名不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getBankMobile(), "结算银行预留手机号不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getSettlementCardType(), "结算卡类型不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getOpenAccProvinceId(), "结算开户行省ID不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getOpenAccCityId(), "结算开户行市ID不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getOpenAccAreaId(), "结算开户行区ID不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getOpenAccProvince(), "结算开户行省不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getOpenAccCity(), "结算开户行市不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getOpenAccArea(), "结算开户行区不能为空");
|
||||
if ("11".equals(settlementInfo.getSettlementCardType())) {
|
||||
// 11 对私借记卡(结算卡正面照、结算卡反面照图片必传)
|
||||
AssertUtil.isNull(settlementInfo.getBankCardFrontPic(), "结算卡正面照不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getBankCardFrontPic().getUrl(), "结算卡正面照不能为空");
|
||||
AssertUtil.isNull(settlementInfo.getBankCardBackPic(), "结算卡反面照不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getBankCardBackPic().getUrl(), "结算卡反面照不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getSettlementType(), "结算类型不能为空");
|
||||
if ("0".equals(settlementInfo.getSettlementType())) {
|
||||
// 非法人结算
|
||||
AssertUtil.isBlank(settlementInfo.getNoLegalName(), "非法人姓名不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getNoLegalId(), "非法人身份证号不能为空");
|
||||
AssertUtil.isNull(settlementInfo.getNoLegalIdCardFrontPic(), "非法人身份证正面不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getNoLegalIdCardFrontPic().getUrl(), "非法人身份证正面不能为空");
|
||||
AssertUtil.isNull(settlementInfo.getNoLegalIdCardBackPic(), "非法人身份证反面不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getNoLegalIdCardBackPic().getUrl(), "非法人身份证反面不能为空");
|
||||
AssertUtil.isNull(settlementInfo.getNoLegalSettleAuthPic(), "非法人结算授权书不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getNoLegalSettleAuthPic().getUrl(), "非法人结算授权书不能为空");
|
||||
} else if ("1".equals(settlementInfo.getSettlementType())) {
|
||||
// 法人结算 暂无处理
|
||||
} else {
|
||||
throw new CzgException("结算类型错误");
|
||||
}
|
||||
} else if ("21".equals(settlementInfo.getSettlementCardType())) {
|
||||
// 21 对公借记卡(只须结算卡正面照片)
|
||||
AssertUtil.isNull(settlementInfo.getOpenAccountLicencePic(), "开户许可证不能为空");
|
||||
AssertUtil.isBlank(settlementInfo.getOpenAccountLicencePic().getUrl(), "开户许可证不能为空");
|
||||
} else {
|
||||
throw new CzgException("结算卡类型错误");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
List<BankBranchDto> dtoList = queryBankBranchList("陕西省", "西安市", "CMB");
|
||||
System.out.println(dtoList);
|
||||
|
||||
AggregateMerchantDto merchantDto = new AggregateMerchantDto();
|
||||
merchantDto.setMerchantCode("20220106000000000001");
|
||||
|
||||
verifyEntryParam(merchantDto);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,5 +38,5 @@ public class BusinessLicenceInfoDto {
|
||||
/**
|
||||
* 营业执照
|
||||
*/
|
||||
private String licensePic;
|
||||
private ImageDto licensePic;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.czg.dto.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yjjie
|
||||
* @date 2026/1/6 16:53
|
||||
*/
|
||||
@Data
|
||||
public class ImageDto {
|
||||
|
||||
/**
|
||||
* 图片 url
|
||||
*/
|
||||
private String url;
|
||||
|
||||
/**
|
||||
* 微信 图片 mediaId
|
||||
*/
|
||||
private String wechatId;
|
||||
|
||||
/**
|
||||
* 支付宝 图片 mediaId
|
||||
*/
|
||||
private String alipayId;
|
||||
}
|
||||
@@ -54,15 +54,17 @@ public class LegalPersonInfoDto {
|
||||
/**
|
||||
* 身份证手持 图片
|
||||
*/
|
||||
private String idCardHandPic;
|
||||
private ImageDto idCardHandPic;
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 身份证正面
|
||||
*/
|
||||
private String idCardFrontPic;
|
||||
private ImageDto idCardFrontPic;
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 身份证反面
|
||||
*/
|
||||
private String idCardBackPic;
|
||||
private ImageDto idCardBackPic;
|
||||
}
|
||||
|
||||
@@ -38,6 +38,13 @@ public class MerchantBaseInfoDto {
|
||||
*/
|
||||
private String mccCode;
|
||||
|
||||
/**
|
||||
* 联系人类型
|
||||
* LEGAL: 经营者/法定代表人
|
||||
* SUPER: 经办人
|
||||
*/
|
||||
private String contactPersonType = "LEGAL";
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 联系人姓名
|
||||
@@ -50,6 +57,30 @@ public class MerchantBaseInfoDto {
|
||||
*/
|
||||
private String contactPersonId;
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 联系人身份证开始日期
|
||||
*/
|
||||
private String contactIdStartDate;
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 联系人身份证到期日期
|
||||
*/
|
||||
private String contactPersonIdEndDate;
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 联系人身份证背面
|
||||
*/
|
||||
private ImageDto contactIdCardBackPic;
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 联系人身份证正面
|
||||
*/
|
||||
private ImageDto contactIdCardFrontPic;
|
||||
|
||||
/**
|
||||
* 【必填】
|
||||
* 联系人电话
|
||||
|
||||
@@ -4,6 +4,7 @@ import lombok.Data;
|
||||
|
||||
/**
|
||||
* 结算信息
|
||||
*
|
||||
* @author yjjie
|
||||
* @date 2026/1/6 10:22
|
||||
*/
|
||||
@@ -11,19 +12,19 @@ import lombok.Data;
|
||||
public class SettlementInfoDto {
|
||||
|
||||
/**
|
||||
* 法人结算 0:非法人结算, 1:法人结算
|
||||
* 结算类型 0:非法人结算, 1:法人结算
|
||||
*/
|
||||
private String codeLegalPersonAcc;
|
||||
private String settlementType;
|
||||
|
||||
/**
|
||||
* 非法人姓名
|
||||
*/
|
||||
private String unincorporatedName;
|
||||
private String noLegalName;
|
||||
|
||||
/**
|
||||
* 非法人身份证号码
|
||||
*/
|
||||
private String unincorporatedId;
|
||||
private String noLegalId;
|
||||
|
||||
/**
|
||||
* 结算卡类型 必填 11 对私借记卡(结算卡正面照、结算卡反面照图片必传) 21 对公借记卡(只须结算卡正面照片)
|
||||
@@ -98,35 +99,35 @@ public class SettlementInfoDto {
|
||||
/**
|
||||
* 银行卡正面
|
||||
*/
|
||||
private String bankCardFrontPic;
|
||||
private ImageDto bankCardFrontPic;
|
||||
|
||||
/**
|
||||
* 银行卡反面
|
||||
*/
|
||||
private String bankCardBackPic;
|
||||
private ImageDto bankCardBackPic;
|
||||
|
||||
/**
|
||||
* 开户许可证
|
||||
*/
|
||||
private String openAccountLicence;
|
||||
private ImageDto openAccountLicencePic;
|
||||
|
||||
/**
|
||||
* 非法人手持结算授权书
|
||||
*/
|
||||
private String nonLegHandSettleAuthPic;
|
||||
private ImageDto noLegalHandSettleAuthPic;
|
||||
|
||||
/**
|
||||
* 非法人结算授权书
|
||||
*/
|
||||
private String nonLegSettleAuthPic;
|
||||
private ImageDto noLegalSettleAuthPic;
|
||||
|
||||
/**
|
||||
* 非法人身份证正面
|
||||
*/
|
||||
private String nonLegIdCardFrontPic;
|
||||
private ImageDto noLegalIdCardFrontPic;
|
||||
|
||||
/**
|
||||
* 非法人身份证反面
|
||||
*/
|
||||
private String nonLegIdCardBackPic;
|
||||
private ImageDto noLegalIdCardBackPic;
|
||||
}
|
||||
|
||||
@@ -52,15 +52,15 @@ public class StoreInfoDto {
|
||||
/**
|
||||
* 经营场所内设照片
|
||||
*/
|
||||
private String insidePic;
|
||||
private ImageDto insidePic;
|
||||
|
||||
/**
|
||||
* 门头照
|
||||
*/
|
||||
private String doorPic;
|
||||
private ImageDto doorPic;
|
||||
|
||||
/**
|
||||
* 收银台照片
|
||||
*/
|
||||
private String cashierDeskPic;
|
||||
private ImageDto cashierDeskPic;
|
||||
}
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
package com.czg.third.alipay;
|
||||
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.alipay.api.DefaultAlipayClient;
|
||||
import com.alipay.api.domain.AlipayFinancialnetAuthPbcnameQueryModel;
|
||||
import com.alipay.api.domain.AntMerchantExpandIndirectZftSimplecreateModel;
|
||||
import com.alipay.api.request.AlipayFinancialnetAuthPbcnameQueryRequest;
|
||||
import com.alipay.api.request.AntMerchantExpandIndirectZftSimplecreateRequest;
|
||||
import com.alipay.api.response.AlipayFinancialnetAuthPbcnameQueryResponse;
|
||||
import com.alipay.api.response.AntMerchantExpandIndirectZftSimplecreateResponse;
|
||||
import com.alipay.v3.ApiClient;
|
||||
import com.alipay.v3.ApiException;
|
||||
import com.alipay.v3.Configuration;
|
||||
@@ -19,17 +14,13 @@ import com.alipay.v3.model.*;
|
||||
import com.alipay.v3.util.model.AlipayConfig;
|
||||
import com.czg.dto.resp.BankBranchDto;
|
||||
import com.czg.utils.CommonUtil;
|
||||
import com.czg.third.alipay.dto.config.AlipayConfigDto;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 支付宝进件管理
|
||||
@@ -41,8 +32,6 @@ import java.nio.file.Path;
|
||||
*/
|
||||
@Slf4j
|
||||
public class AlipayEntryManager {
|
||||
// 匹配常见的图片扩展名
|
||||
private static final Pattern PATTERN = Pattern.compile("\\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)(?:[\\?#]|$)", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
public static String uploadImage(String url) {
|
||||
try {
|
||||
@@ -59,7 +48,7 @@ public class AlipayEntryManager {
|
||||
|
||||
AntMerchantExpandIndirectImageUploadModel model = new AntMerchantExpandIndirectImageUploadModel();
|
||||
// 从 url 中获取图片 后缀
|
||||
model.setImageType(extractImageExtension(url));
|
||||
model.setImageType(CommonUtil.extractImageExtension(url));
|
||||
AntMerchantExpandIndirectImageUploadResponseModel upload = imageApi.upload(model, file);
|
||||
return upload.getImageId();
|
||||
} catch (Exception e) {
|
||||
@@ -96,21 +85,6 @@ public class AlipayEntryManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用正则表达式提取图片后缀
|
||||
*/
|
||||
public static String extractImageExtension(String imageUrl) {
|
||||
java.util.regex.Matcher matcher = PATTERN.matcher(imageUrl);
|
||||
|
||||
if (matcher.find()) {
|
||||
String extension = matcher.group(1).toLowerCase();
|
||||
// 处理jpeg的情况
|
||||
return "jpeg".equals(extension) ? "jpg" : extension;
|
||||
}
|
||||
// 默认后缀
|
||||
return "png";
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
queryBankBranchList("CMB", "西安市", "陕西省");
|
||||
|
||||
@@ -19,6 +19,9 @@ public class WechatConfig {
|
||||
* @return 微信支付配置
|
||||
*/
|
||||
public static Config getRsaConfig(WechatPayConfigDto dto) {
|
||||
if (dto == null) {
|
||||
dto = WechatPayConfigDto.getDefaultConfig();
|
||||
}
|
||||
return new RSAPublicKeyConfig.Builder()
|
||||
.merchantId(dto.getMerchantId())
|
||||
.privateKey(dto.getPrivateKey())
|
||||
@@ -29,7 +32,7 @@ public class WechatConfig {
|
||||
.build();
|
||||
}
|
||||
|
||||
public static FileUploadService getFileUploadService(Config config) {
|
||||
public static FileUploadService getFileUploadServiceByConfig(Config config) {
|
||||
return new FileUploadService.Builder()
|
||||
.config(config)
|
||||
.build();
|
||||
@@ -41,7 +44,7 @@ public class WechatConfig {
|
||||
* @return 文件上传服务
|
||||
*/
|
||||
public static FileUploadService getFileUploadService(WechatPayConfigDto dto) {
|
||||
return getFileUploadService(getRsaConfig(dto));
|
||||
return getFileUploadServiceByConfig(getRsaConfig(dto));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public class WechatEntryManager {
|
||||
}
|
||||
|
||||
public static JSONObject queryCityList(WechatPayConfigDto configDto, String provinceCode) {
|
||||
String resp = WechatReqUtils.getReq(configDto, "/v3/capital/capitallhh/areas/provinces/" + provinceCode + "/cities", Map.of());
|
||||
String resp = WechatReqUtils.getReq(configDto, "/v3/capital/capitallhh/areas/provinces/" + provinceCode + "/cities", Map.of());
|
||||
return JSONObject.parseObject(resp);
|
||||
}
|
||||
|
||||
@@ -64,14 +64,14 @@ public class WechatEntryManager {
|
||||
/**
|
||||
* 上传图片
|
||||
*
|
||||
* @param configDto 配置
|
||||
* @param url 图片URL
|
||||
* @return 图片ID
|
||||
*/
|
||||
public static String uploadImage(WechatPayConfigDto configDto, String url) {
|
||||
public static String uploadImage(String url) {
|
||||
WechatPayConfigDto configDto = WechatPayConfigDto.getDefaultConfig();
|
||||
// 校验入参
|
||||
if (configDto == null || url == null || url.trim().isEmpty()) {
|
||||
log.error("上传图片失败:配置或URL参数为空");
|
||||
if (url == null || url.trim().isEmpty()) {
|
||||
log.error("上传图片失败:URL参数为空");
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import java.net.URI;
|
||||
import java.net.http.HttpClient;
|
||||
import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* @author yjjie
|
||||
@@ -13,6 +14,25 @@ import java.net.http.HttpResponse;
|
||||
*/
|
||||
@Slf4j
|
||||
public class CommonUtil {
|
||||
|
||||
// 匹配常见的图片扩展名
|
||||
private static final Pattern PATTERN = Pattern.compile("\\.(jpg|jpeg|png|gif|bmp|webp|svg|ico)(?:[\\?#]|$)", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
/**
|
||||
* 使用正则表达式提取图片后缀
|
||||
*/
|
||||
public static String extractImageExtension(String imageUrl) {
|
||||
java.util.regex.Matcher matcher = PATTERN.matcher(imageUrl);
|
||||
|
||||
if (matcher.find()) {
|
||||
String extension = matcher.group(1).toLowerCase();
|
||||
// 处理jpeg的情况
|
||||
return "jpeg".equals(extension) ? "jpg" : extension;
|
||||
}
|
||||
// 默认后缀
|
||||
return "png";
|
||||
}
|
||||
|
||||
/**
|
||||
* 下载图片
|
||||
* @param url 图片地址
|
||||
|
||||
Reference in New Issue
Block a user