|
|
@ -105,7 +105,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
needRegisterMerchant.add(client.getString("client_moniker"));
|
|
|
|
needRegisterMerchant.add(client.getString("client_moniker"));
|
|
|
|
checkPartnerInfo(client);
|
|
|
|
checkPartnerInfo(client,"online");
|
|
|
|
} catch (InvalidParameterException e) {
|
|
|
|
} catch (InvalidParameterException e) {
|
|
|
|
JSONObject exception = new JSONObject();
|
|
|
|
JSONObject exception = new JSONObject();
|
|
|
|
exception.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
exception.put("client_moniker", client.getString("client_moniker"));
|
|
|
@ -140,6 +140,57 @@ public class AliforexcelServiceImpl implements AliforexcelService {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public JSONObject registerAlipayMerchant() {
|
|
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
|
|
|
|
List<String> needRegisterMerchant = new ArrayList<>();
|
|
|
|
|
|
|
|
List<String> registerSuccessMerchant = new ArrayList<>();
|
|
|
|
|
|
|
|
List<JSONObject> registerFailMerchant = new ArrayList<>();
|
|
|
|
|
|
|
|
List<JSONObject> lessInfoMerchant = new ArrayList<>();
|
|
|
|
|
|
|
|
String alipayOfflineMerchantsStr = "FORE,RAYI,AASO,BGWI,HYMQ,LIFE,TWTA,AMYW,CCTM,JCYA,JICH,ADGJ,MAGL,TOMA,MCNE,LILC,YOTR,PENG,CASM,SHAO,SWCG,TMCF,BPAR,DNLG,OVAU,SJZH,VWPA,BCOL,MOLI,LIYA,TST3,AUKN,MMEK,GINF,EZE2,GOTR,CJKD,QR12,NJHI,WHAP,HOTO,OMNI,UGGM,JJTV,HHPL,BSPL,TOUR,AUMG,AYUC,BFLI,WAOR,SUTR,LTEA,BRAV,BTTC,FATT,VFPL,LEOH,BHHO,ISSP,JOLP,SUNH,NEVC,QR56,GNH9,SHFO,4UBW,ZZAO,B12H,QUMA,MAYH,FMPS,OWPL,CUDE,I2MI,FAGO,FADA,ZHHS,MANT,DOMU,NTTB,SDCN,8QNF,BHLW,KNIT,U4N9,WNNN";
|
|
|
|
|
|
|
|
String[] alipayOfflineMerchants = alipayOfflineMerchantsStr.split(",");
|
|
|
|
|
|
|
|
for (String clientMoniker : alipayOfflineMerchants) {
|
|
|
|
|
|
|
|
JSONObject client = clientMapper.findClientByMoniker(clientMoniker);
|
|
|
|
|
|
|
|
if (client == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
needRegisterMerchant.add(client.getString("client_moniker"));
|
|
|
|
|
|
|
|
checkPartnerInfo(client,"offline");
|
|
|
|
|
|
|
|
} catch (InvalidParameterException e) {
|
|
|
|
|
|
|
|
JSONObject exception = new JSONObject();
|
|
|
|
|
|
|
|
exception.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
|
|
|
exception.put("return_msg", e.getMessage());
|
|
|
|
|
|
|
|
exception.put("bd_name", client.getString("bd_user_name"));
|
|
|
|
|
|
|
|
lessInfoMerchant.add(exception);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayRetailMerchant();
|
|
|
|
|
|
|
|
Element resultElement = alipayClient.registerGmsPortal(mch.getPid(), client);
|
|
|
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
|
|
|
|
|
|
|
|
JSONObject exception = new JSONObject();
|
|
|
|
|
|
|
|
exception.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
|
|
|
exception.put("return_msg", resultElement.elementText("error"));
|
|
|
|
|
|
|
|
registerFailMerchant.add(exception);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Element responseElement = resultElement.element("response").element("alipay");
|
|
|
|
|
|
|
|
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) {
|
|
|
|
|
|
|
|
JSONObject exception = new JSONObject();
|
|
|
|
|
|
|
|
exception.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
|
|
|
|
exception.put("return_msg", resultElement.elementText("error"));
|
|
|
|
|
|
|
|
registerFailMerchant.add(exception);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
registerSuccessMerchant.add(client.getString("client_moniker"));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
result.put("need_register_merchant", needRegisterMerchant);
|
|
|
|
|
|
|
|
result.put("success_register_merchant", registerSuccessMerchant);
|
|
|
|
|
|
|
|
result.put("fail_register_merchant", registerFailMerchant);
|
|
|
|
|
|
|
|
result.put("less_info_merchant", lessInfoMerchant);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public JSONObject getLessPartnerInfo() {
|
|
|
|
public JSONObject getLessPartnerInfo() {
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
@ -151,7 +202,7 @@ public class AliforexcelServiceImpl implements AliforexcelService {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
checkPartnerInfo(client);
|
|
|
|
checkPartnerInfo(client,"online");
|
|
|
|
} catch (InvalidParameterException e) {
|
|
|
|
} catch (InvalidParameterException e) {
|
|
|
|
JSONObject exception = new JSONObject();
|
|
|
|
JSONObject exception = new JSONObject();
|
|
|
|
exception.put("client_moniker", client.getString("client_moniker"));
|
|
|
|
exception.put("client_moniker", client.getString("client_moniker"));
|
|
|
@ -164,12 +215,15 @@ public class AliforexcelServiceImpl implements AliforexcelService {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void checkPartnerInfo(JSONObject client) {
|
|
|
|
private void checkPartnerInfo(JSONObject client,String type) {
|
|
|
|
if (client == null) {
|
|
|
|
if ("online".equals(type)) {
|
|
|
|
throw new InvalidShortIdException();
|
|
|
|
if (!client.containsKey("company_website") || StringUtils.isBlank(client.getString("company_website"))) {
|
|
|
|
}
|
|
|
|
throw new InvalidParameterException("Website cannot be empty ");
|
|
|
|
if (!client.containsKey("company_website") || StringUtils.isBlank(client.getString("company_website"))) {
|
|
|
|
}
|
|
|
|
throw new InvalidParameterException("Website cannot be empty ");
|
|
|
|
}else {
|
|
|
|
|
|
|
|
if (!client.containsKey("store_photo") || !client.containsKey("company_photo")) {
|
|
|
|
|
|
|
|
throw new InvalidParameterException("store photo cannot be empty ");
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (StringUtils.isBlank(client.getString("business_structure"))) {
|
|
|
|
if (StringUtils.isBlank(client.getString("business_structure"))) {
|
|
|
|
throw new InvalidParameterException("Business Structure can't be null");
|
|
|
|
throw new InvalidParameterException("Business Structure can't be null");
|
|
|
@ -179,5 +233,4 @@ public class AliforexcelServiceImpl implements AliforexcelService {
|
|
|
|
throw new InvalidParameterException("Alipay Industry can't be null");
|
|
|
|
throw new InvalidParameterException("Alipay Industry can't be null");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|