@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.binarywang.wxpay.bean.applyment.WxPayApplyment4SubCreateRequest;
import com.github.binarywang.wxpay.bean.applyment.WxPayApplymentCreateResult;
import com.github.binarywang.wxpay.bean.applyment.enums.SalesScenesTypeEnum;
import com.github.binarywang.wxpay.bean.bank.BankingResult;
import com.github.binarywang.wxpay.exception.WxPayException;
import com.github.binarywang.wxpay.service.WxPayService;
@@ -355,7 +356,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
logger.info("未上传证件正面照片");
return false;
}
if(EnumSharingReceiverIdDocType.getOtherNeddBack().contains(enumIdDocType.getCode() )){
if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumIdDocType )){
JSONObject id_doc_copy_back_info = idDocInfoObject.getJSONObject("id_doc_copy_back_info");
if(StringUtils.isBlank(this.getMerchantMediaId(id_doc_copy_back_info))){
logger.info("未上传证件反面照片");
@@ -521,16 +522,17 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
return false;
}
JSONArray store_entrance_pic = biz_store_info.getJSONArray("store_entrance_pic");
if(store_entrance_pic == null || store_entrance_pic.isEmpty()){
List<String> mediaIds = this.getMerchantMediaIds(store_entrance_pic);
if(mediaIds.isEmpty()){
logger.info("未上传线下场所门头照片");
return false;
}
JSONArray indoor_pic = biz_store_info.getJSONArray("indoor_pic");
if(indoor_pic == null || indoor_pic.isEmpty()){
List<String> mediaIds1 = this.getMerchantMediaIds(indoor_pic);
if(mediaIds1.isEmpty()){
logger.info("未上传线下场所内部照片");
return false;
}
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MP.getCode())){
JSONObject mp_info = salesInfoObject.getJSONObject("mp_info");
@@ -545,10 +547,15 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
return false;
}
JSONArray mp_pics = mp_info.getJSONArray("mp_pics");
if(mp_pics == null || mp_pics.isEmpty()){
List<String> mediaIds = this.getMerchantMediaIds(mp_pics);
if(mediaIds.isEmpty()){
logger.info("未上传公众号页面截图");
return false;
}
if(mediaIds.size() > 5){
logger.info("上传公众号页面截图超限");
return false;
}
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MINI_PROGRAM.getCode())){
@@ -563,6 +570,12 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
logger.info("未填写对应小程序APPID");
return false;
}
JSONArray mini_program_pics = mini_program_info.getJSONArray("mini_program_pics");
List<String> mediaIds = this.getMerchantMediaIds(mini_program_pics);
if(mediaIds.size() > 5){
logger.info("上传小程序页面截图超限");
return false;
}
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEB.getCode())){
@@ -590,10 +603,15 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
return false;
}
JSONArray app_pics = app_info.getJSONArray("app_pics");
if(app_pics == null || app_pics.isEmpty()){
List<String> mediaIds = this.getMerchantMediaIds(app_pics);
if(mediaIds.isEmpty()){
logger.info("未上传APP页面截图");
return false;
}
if(mediaIds.size() > 5){
logger.info("上传APP页面截图超限");
return false;
}
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEWORK.getCode())){
JSONObject wework_info = salesInfoObject.getJSONObject("wework_info");
@@ -607,10 +625,15 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
return false;
}
JSONArray wework_pics = wework_info.getJSONArray("wework_pics");
if(wework_pics == null || wework_pics.isEmpty()){
List<String> mediaIds = this.getMerchantMediaIds(wework_pics);
if(mediaIds.isEmpty()){
logger.info("未上传企业微信页面截图");
return false;
}
if(mediaIds.size() > 5){
logger.info("上传企业微信页面截图超限");
return false;
}
}
return true;
@@ -681,7 +704,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
return false;
}
if(mediaIds.size() > 5){
logger.info("上传资质数量过多 ");
logger.info("上传资质数量超限 ");
return false;
}
}
@@ -699,7 +722,7 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
return false;
}
if(mediaIds.size() > 5){
logger.info("上传资质数量过多 ");
logger.info("上传资质数量超限 ");
return false;
}
}
@@ -928,10 +951,141 @@ public class WxProfitSharingReceiverApplyServiceImpl implements WxProfitSharingR
WxPayApplyment4SubCreateRequest request = new WxPayApplyment4SubCreateRequest();
request.setBusinessCode(receiverApply.getOutRequestNo());
WxPayApplyment4SubCreateRequest.SubjectInfo subjectInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo();
EnumSharingReceiverOrganizationType enumOrganizationType = EnumSharingReceiverOrganizationType.getEnum(receiverApply.getOrganizationType());
subjectInfo.setSubjectType(enumOrganizationType.getSubjectTypeEnum());
if(EnumYesOrNo.YES.getCode().equals(receiverApply.getFinanceInstitution())){
//todo 金融机构
// subjectInfo.setFinanceInstitution(true);
}
if(EnumSharingReceiverOrganizationType.GETI.equals(enumOrganizationType) || EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){
JSONObject businessLicenseInfoObject = JSONObject.parseObject(receiverApply.getBusinessLicenseInfo());
WxPayApplyment4SubCreateRequest.SubjectInfo.BusinessLicenseInfo businessLicenseInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.BusinessLicenseInfo();
JSONObject license_copy_info = businessLicenseInfoObject.getJSONObject("license_copy_info");
businessLicenseInfo.setLicenseCopy(this.getMerchantMediaId(license_copy_info));
businessLicenseInfo.setLicenseNumber(businessLicenseInfoObject.getString("license_number"));
businessLicenseInfo.setMerchantName(businessLicenseInfoObject.getString("merchant_name"));
businessLicenseInfo.setLegalPerson(businessLicenseInfoObject.getString("legal_person"));
businessLicenseInfo.setLicenseAddress(businessLicenseInfoObject.getString("license_address"));
businessLicenseInfo.setPeriodBegin(businessLicenseInfoObject.getString("period_begin"));
businessLicenseInfo.setPeriodEnd(businessLicenseInfoObject.getString("period_end"));
subjectInfo.setBusinessLicenseInfo(businessLicenseInfo);
WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo identityInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo();
EnumSharingReceiverIdDocType enumIdDocType = EnumSharingReceiverIdDocType.getEnum(receiverApply.getIdDocType());
identityInfo.setIdDocType(enumIdDocType.getIdTypeEnum());
if(EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_IDCARD.equals(enumIdDocType)){
JSONObject idCardInfoObject = JSONObject.parseObject(receiverApply.getIdCardInfo());
WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdCardInfo idCardInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdCardInfo();
JSONObject id_card_copy_info = idCardInfoObject.getJSONObject("id_card_copy_info");
idCardInfo.setIdCardCopy(this.getMerchantMediaId(id_card_copy_info));
JSONObject id_card_national_info = idCardInfoObject.getJSONObject("id_card_national_info");
idCardInfo.setIdCardNational(this.getMerchantMediaId(id_card_national_info));
idCardInfo.setIdCardName(idCardInfoObject.getString("id_card_name"));
idCardInfo.setIdCardNumber(idCardInfoObject.getString("id_card_number"));
idCardInfo.setIdCardAddress(idCardInfoObject.getString("id_card_address"));
idCardInfo.setCardPeriodBegin(idCardInfoObject.getString("card_period_begin"));
idCardInfo.setCardPeriodEnd(idCardInfoObject.getString("card_period_end"));
identityInfo.setIdCardInfo(idCardInfo);
}else{
JSONObject idDocInfoObject = JSONObject.parseObject(receiverApply.getIdDocInfo());
WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdDocInfo idDocInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.IdentityInfo.IdDocInfo();
JSONObject id_doc_copy_info = idDocInfoObject.getJSONObject("id_doc_copy_info");
idDocInfo.setIdDocCopy(this.getMerchantMediaId(id_doc_copy_info));
if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumIdDocType)){
JSONObject id_doc_copy_back_info = idDocInfoObject.getJSONObject("id_doc_copy_back_info");
idDocInfo.setIdDocCopyBack(this.getMerchantMediaId(id_doc_copy_back_info));
}
idDocInfo.setIdDocName(idDocInfoObject.getString("id_doc_name"));
idDocInfo.setIdDocNumber(idDocInfoObject.getString("id_doc_number"));
idDocInfo.setIdDocAddress(idDocInfoObject.getString("id_doc_address"));
idDocInfo.setDocPeriodBegin(idDocInfoObject.getString("doc_period_begin"));
idDocInfo.setDocPeriodEnd(idDocInfoObject.getString("doc_period_end"));
identityInfo.setIdDocInfo(idDocInfo);
}
if(EnumSharingReceiverOrganizationType.QIYE.equals(enumOrganizationType)){
if(EnumYesOrNo.YES.getCode().equals(receiverApply.getOwner())){
identityInfo.setOwner(true);
}else{
identityInfo.setOwner(false);
List<WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo> uboInfoList = new ArrayList<>();
JSONArray jsonArray = JSONArray.parseArray(receiverApply.getUboInfoList());
for(int i = 0;i < jsonArray.size();i++){
JSONObject uboInfoObject = jsonArray.getJSONObject(i);
WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo uboInfo = new WxPayApplyment4SubCreateRequest.SubjectInfo.UboInfo();
Integer ubo_id_doc_type = uboInfoObject.getInteger("ubo_id_doc_type");
EnumSharingReceiverIdDocType enumUboIdDocType = EnumSharingReceiverIdDocType.getEnum(ubo_id_doc_type);
uboInfo.setUboIdDocType(enumUboIdDocType.getIdTypeEnum());
JSONObject ubo_id_doc_copy_info = uboInfoObject.getJSONObject("ubo_id_doc_copy_info");
uboInfo.setUboIdDocCopy(this.getMerchantMediaId(ubo_id_doc_copy_info));
if(!EnumSharingReceiverIdDocType.IDENTIFICATION_TYPE_OVERSEA_PASSPORT.equals(enumUboIdDocType)){
JSONObject ubo_id_doc_copy_back_info = uboInfoObject.getJSONObject("ubo_id_doc_copy_back_info");
uboInfo.setUboIdDocCopyBack(this.getMerchantMediaId(ubo_id_doc_copy_back_info));
}
uboInfo.setUboIdDocName(uboInfoObject.getString("ubo_id_doc_name"));
uboInfo.setUboIdDocNumber(uboInfoObject.getString("ubo_id_doc_number"));
uboInfo.setUboIdDocAddress(uboInfoObject.getString("ubo_id_doc_address"));
uboInfo.setUboPeriodBegin(uboInfoObject.getString("ubo_period_begin"));
uboInfo.setUboPeriodEnd(uboInfoObject.getString("ubo_period_end"));
uboInfoList.add(uboInfo);
}
subjectInfo.setUboInfoList(uboInfoList);
}
}
subjectInfo.setIdentityInfo(identityInfo);
} else{
//todo 其他主体
}
request.setSubjectInfo(subjectInfo);
WxPayApplyment4SubCreateRequest.BusinessInfo businessInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo();
businessInfo.setMerchantShortname(receiverApply.getMerchantShortname());
businessInfo.setServicePhone(receiverApply.getServicePhone());
JSONObject salesInfoObject = JSONObject.parseObject(receiverApply.getSalesInfo());
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo salesInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo();
JSONArray sales_scenes_type = salesInfoObject.getJSONArray("sales_scenes_type");
List<Integer> salesScenesTypes = sales_scenes_type.toJavaList(Integer.class);
List<SalesScenesTypeEnum> salesScenesTypeEnumList = EnumSharingReceiverSalesScenesType.getSalesScenesTypeEnumList(salesScenesTypes);
salesInfo.setSalesScenesType(salesScenesTypeEnumList);
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_STORE.getCode())){
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.BizStoreInfo bizStoreInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.BizStoreInfo();
//todo 线下场所场景
salesInfo.setBizStoreInfo(bizStoreInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MP.getCode())){
JSONObject mp_info = salesInfoObject.getJSONObject("mp_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MpInfo mpInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MpInfo();
//todo 公众号场景
salesInfo.setMpInfo(mpInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_MINI_PROGRAM.getCode())){
JSONObject mini_program_info = salesInfoObject.getJSONObject("mini_program_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MiniProgramInfo miniProgramInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.MiniProgramInfo();
miniProgramInfo.setMiniProgramAppid(mini_program_info.getString("mini_program_appid"));
miniProgramInfo.setMiniProgramSubAppid(mini_program_info.getString("mini_program_sub_appid"));
List<String> mediaIds = this.getMerchantMediaIds(mini_program_info.getJSONArray("mini_program_pics"));
if(!mediaIds.isEmpty()){
miniProgramInfo.setMiniProgramPics(mediaIds);
}
salesInfo.setMiniProgramInfo(miniProgramInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEB.getCode())){
JSONObject web_info = salesInfoObject.getJSONObject("web_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WebInfo webInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WebInfo();
//todo 互联网网站场景
salesInfo.setWebInfo(webInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_APP.getCode())){
JSONObject app_info = salesInfoObject.getJSONObject("app_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.AppInfo appInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.AppInfo();
//todo APP场景
salesInfo.setAppInfo(appInfo);
}
if(salesScenesTypes.contains(EnumSharingReceiverSalesScenesType.SALES_SCENES_WEWORK.getCode())){
JSONObject wework_info = salesInfoObject.getJSONObject("wework_info");
WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WeworkInfo weworkInfo = new WxPayApplyment4SubCreateRequest.BusinessInfo.SalesInfo.WeworkInfo();
//todo 企业微信场景
salesInfo.setWeworkInfo(weworkInfo);
}
businessInfo.setSalesInfo(salesInfo);
request.setBusinessInfo(businessInfo);
WxPayApplyment4SubCreateRequest.SettlementInfo settlementInfo = new WxPayApplyment4SubCreateRequest.SettlementInfo();