Merge remote-tracking branch 'origin/develop' into develop

master
liuxinxin 6 years ago
commit d65dc5d156

@ -5,12 +5,12 @@
<parent> <parent>
<groupId>au.com.royalpay.payment</groupId> <groupId>au.com.royalpay.payment</groupId>
<artifactId>payment-parent</artifactId> <artifactId>payment-parent</artifactId>
<version>1.0.1</version> <version>1.0.4</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId> <artifactId>manage</artifactId>
<version>1.0.26</version> <version>1.0.28</version>
<properties> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -21,6 +21,8 @@ import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Sheet;
import org.dom4j.Element; import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -44,6 +46,8 @@ public class AliforexcelServiceImpl implements AliforexcelService {
private AlipayClient alipayClient; private AlipayClient alipayClient;
@Resource @Resource
private OrderMapper orderMapper; private OrderMapper orderMapper;
private Logger logger = LoggerFactory.getLogger(getClass());
@Override @Override
public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) { public JSONObject listClients(HttpServletResponse httpResponse,JSONObject manager, AliExcel query) {
@ -105,7 +109,7 @@ 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 = transactionMapper.useAlipayOnlineClients(); List<Integer> useAlipayOnlineMerchant = clientMapper.listUseAlipayMerchant();
for (int clientId : useAlipayOnlineMerchant) { for (int clientId : useAlipayOnlineMerchant) {
JSONObject client = clientMapper.findClient(clientId); JSONObject client = clientMapper.findClient(clientId);
if (client == null) { if (client == null) {
@ -113,6 +117,9 @@ public class AliforexcelServiceImpl implements AliforexcelService {
} }
try { try {
needRegisterMerchant.add(client.getString("client_moniker")); 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"); checkPartnerInfo(client,"online");
} catch (InvalidParameterException e) { } catch (InvalidParameterException e) {
JSONObject exception = new JSONObject(); JSONObject exception = new JSONObject();
@ -122,29 +129,37 @@ public class AliforexcelServiceImpl implements AliforexcelService {
lessInfoMerchant.add(exception); lessInfoMerchant.add(exception);
continue; continue;
} }
AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant(); try {
Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client); AlipayConfig.AlipayMerchant mch = AlipayEnvironment.getEnv().getAlipayOnlineMerchant();
if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) { Element resultElement = alipayClient.registerOnlineGmsPortal(mch.getPid(), client);
JSONObject exception = new JSONObject(); if (!StringUtils.equalsIgnoreCase("T", resultElement.elementText("is_success"))) {
exception.put("client_moniker", client.getString("client_moniker")); JSONObject exception = new JSONObject();
exception.put("return_msg", resultElement.elementText("error")); exception.put("client_moniker", client.getString("client_moniker"));
registerFailMerchant.add(exception); exception.put("return_msg", resultElement.elementText("error"));
continue; registerFailMerchant.add(exception);
} continue;
Element responseElement = resultElement.element("response").element("alipay"); }
if (!StringUtils.equalsIgnoreCase("SUCCESS", responseElement.elementText("result_code"))) { 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(); JSONObject exception = new JSONObject();
exception.put("client_moniker", client.getString("client_moniker")); exception.put("client_moniker", client.getString("client_moniker"));
exception.put("return_msg", resultElement.elementText("error")); exception.put("return_msg", e.getMessage());
registerFailMerchant.add(exception); registerFailMerchant.add(exception);
continue;
} }
registerSuccessMerchant.add(client.getString("client_moniker"));
} }
result.put("need_register_merchant", needRegisterMerchant); result.put("need_register_merchant", needRegisterMerchant);
result.put("success_register_merchant", registerSuccessMerchant); result.put("success_register_merchant", registerSuccessMerchant);
result.put("fail_register_merchant", registerFailMerchant); result.put("fail_register_merchant", registerFailMerchant);
result.put("less_info_merchant", lessInfoMerchant); result.put("less_info_merchant", lessInfoMerchant);
logger.info("-------AlipayOnline Gms end----fail_register_merchant"+registerFailMerchant.toString());
return result; return result;
} }

@ -136,4 +136,7 @@ public interface ClientMapper {
int getPartnercode(@Param("codes") String codes); int getPartnercode(@Param("codes") String codes);
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();
} }

@ -735,6 +735,9 @@
WHERE address= #{address} WHERE address= #{address}
GROUP BY GROUP BY
address address
</select>
<select id="listUseAlipayMerchant" resultType="int">
select client_id from sys_clients where gateway_alipay_online=1 and is_valid=1
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save