add 支付宝线上批量报备range

master
luoyang 5 years ago
parent ca27ab3cf7
commit 45286ac2d3

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.0.29</version> <version>1.0.30</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -13,6 +13,8 @@ public interface AliforexcelService {
JSONObject registerAlipayOnlineMerchant(); JSONObject registerAlipayOnlineMerchant();
JSONObject registerRangeAlipayOnlineMerchant(int start,int end);
JSONObject registerAlipayMerchant(); JSONObject registerAlipayMerchant();
JSONObject registerInsertAlipayMerchant(String partners); JSONObject registerInsertAlipayMerchant(String partners);

@ -109,7 +109,68 @@ public class AliforexcelServiceImpl implements AliforexcelService {
List<String> registerSuccessMerchant = new ArrayList<>(); List<String> registerSuccessMerchant = new ArrayList<>();
List<JSONObject> registerFailMerchant = new ArrayList<>(); List<JSONObject> registerFailMerchant = new ArrayList<>();
List<JSONObject> lessInfoMerchant = new ArrayList<>(); List<JSONObject> lessInfoMerchant = new ArrayList<>();
List<Integer> useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(); List<Integer> useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(0,10000);
for (int clientId : useAlipayOnlineMerchant) {
JSONObject client = clientMapper.findClient(clientId);
if (client == null) {
continue;
}
try {
needRegisterMerchant.add(client.getString("client_moniker"));
if (StringUtils.isBlank(client.getString("company_website"))) {
client.put("company_website", client.getString("ali_sub_merchant_id")+".royalpay.com.au");
}
checkPartnerInfo(client,"online");
} 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;
}
try {
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
Element resultElement = alipayClient.registerOnlineGmsPortal(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"));
} catch (Exception e) {
JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", e.getMessage());
registerFailMerchant.add(exception);
}
}
result.put("need_register_merchant", needRegisterMerchant);
result.put("success_register_merchant", registerSuccessMerchant);
result.put("fail_register_merchant", registerFailMerchant);
result.put("less_info_merchant", lessInfoMerchant);
logger.info("-------AlipayOnline Gms end----fail_register_merchant"+registerFailMerchant.toString());
return result;
}
@Override
public JSONObject registerRangeAlipayOnlineMerchant(int start, int end) {
JSONObject result = new JSONObject();
List<String> needRegisterMerchant = new ArrayList<>();
List<String> registerSuccessMerchant = new ArrayList<>();
List<JSONObject> registerFailMerchant = new ArrayList<>();
List<JSONObject> lessInfoMerchant = new ArrayList<>();
List<Integer> useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant(start,end);
for (int clientId : useAlipayOnlineMerchant) { for (int clientId : useAlipayOnlineMerchant) {
JSONObject client = clientMapper.findClient(clientId); JSONObject client = clientMapper.findClient(clientId);
if (client == null) { if (client == null) {

@ -459,6 +459,11 @@ public class TestController implements ApplicationEventPublisherAware {
return aliforexcelService.registerAlipayOnlineMerchant(); return aliforexcelService.registerAlipayOnlineMerchant();
} }
@ManagerMapping(value = "/register/alipayOnlineGms", role = ManagerRole.DEVELOPER, method = RequestMethod.GET)
public JSONObject registerRangeAlipayOnlineMerchant(@RequestParam int start,@RequestParam int end) {
return aliforexcelService.registerRangeAlipayOnlineMerchant(start,end);
}
@ManagerMapping(value = "/register/alipayGms", role = ManagerRole.DEVELOPER, method = RequestMethod.POST) @ManagerMapping(value = "/register/alipayGms", role = ManagerRole.DEVELOPER, method = RequestMethod.POST)
public JSONObject registerAlipayMerchant() { public JSONObject registerAlipayMerchant() {
return aliforexcelService.registerAlipayMerchant(); return aliforexcelService.registerAlipayMerchant();

@ -137,6 +137,6 @@ public interface ClientMapper {
JSONObject findCountByBd(@Param("bd_group") String bd_group, @Param("today") Date today, @Param("yesterday") Date yesterday, @Param("month") Date month); JSONObject findCountByBd(@Param("bd_group") String bd_group, @Param("today") Date today, @Param("yesterday") Date yesterday, @Param("month") Date month);
List<Integer> listUseAlipayMerchant(); List<Integer> listUseAlipayMerchant(@Param("start") int start, @Param("end") int end);
} }

@ -739,5 +739,6 @@
<select id="listUseAlipayMerchant" resultType="int"> <select id="listUseAlipayMerchant" resultType="int">
select client_id from sys_clients where gateway_alipay_online=1 and is_valid=1 select client_id from sys_clients where gateway_alipay_online=1 and is_valid=1
and client_id >=#{start} and client_id &lt;#{end}
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save