From c63da8fed1401e34633ea5b70140880f7838dd8c Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Wed, 31 Jan 2018 11:55:36 +0800 Subject: [PATCH] fixbug --- .../core/impls/RetailAppServiceImp.java | 42 +++++++++++-------- 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java index 8bc77c27c..ef3a07c5a 100644 --- a/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java +++ b/src/main/java/au/com/royalpay/payment/manage/appclient/core/impls/RetailAppServiceImp.java @@ -495,7 +495,7 @@ public class RetailAppServiceImp implements RetailAppService { } catch (Exception e) { logger.error("出错了:" + e.getMessage()); appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage()); - throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e); + throw new ServerErrorException("Send App " + devToken.getString("client_type") + " Failed", e); } }; sendingAppleMsgPool.execute(task); @@ -640,7 +640,7 @@ public class RetailAppServiceImp implements RetailAppService { } catch (Exception e) { logger.error("出错了:" + e.getMessage()); appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage()); - throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e); + throw new ServerErrorException("Send App " + devToken.getString("client_type") + " Failed", e); } } }); @@ -687,7 +687,7 @@ public class RetailAppServiceImp implements RetailAppService { } catch (Exception e) { logger.error("出错了:" + e.getMessage()); appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage()); - throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e); + throw new ServerErrorException("Send App " + devToken.getString("client_type") + " Failed", e); } } } @@ -719,24 +719,21 @@ public class RetailAppServiceImp implements RetailAppService { return; } JSONObject managerMsg = new JSONObject(); - managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.daily_notice")); - managerMsg.put("body", trade_date + ": 总交易额 " - + PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + ", 付款人数:" + customers); + managerMsg.put("title", LocaleSupport.localeMessage("app.message.title.daily_notice")); + managerMsg.put("body", trade_date + ": 总交易额 " + PlatformEnvironment.getEnv().getForeignCurrency() + total_amount + ", 订单数:" + total_orders + + ", 付款人数:" + customers); managerMsg.put("type", type); managerMsg.put("data", tradeInfo); managerMsg.put("msgType", "daily_notice"); AppMessage appMessage = new AppManagerMessageBuilder(managerMsg).buildMessage(); sender.sendMessage(appMessage, devToken); - - - log.put("status", 2); appMessageLogMapper.update(log); } catch (Exception e) { logger.error("出错了:" + e.getMessage()); appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage()); - throw new ServerErrorException("Send App "+devToken.getString("client_type")+" Failed", e); + throw new ServerErrorException("Send App " + devToken.getString("client_type") + " Failed", e); } } } @@ -845,9 +842,18 @@ public class RetailAppServiceImp implements RetailAppService { res.put("customer_surcharge_rate", client.getBigDecimal("customer_surcharge_rate")); } res.put("max_customer_surcharge_rate", PlatformEnvironment.getEnv().getMaxCustomerSurchargeRate()); - channels.add(getChannel(clientId, now, "Wechat")); - channels.add(getChannel(clientId, now, "Alipay")); - channels.add(getChannel(clientId, now, "Bestpay")); + JSONObject wechat = getChannel(clientId, now, "Wechat"); + if (wechat.containsKey("channel")) { + channels.add(wechat); + } + JSONObject alipay = getChannel(clientId, now, "Alipay"); + if (wechat.containsKey("channel")) { + channels.add(alipay); + } + JSONObject bestpay = getChannel(clientId, now, "Bestpay"); + if (wechat.containsKey("channel")) { + channels.add(bestpay); + } JSONObject jd = getChannel(clientId, now, "jd"); if (jd.containsKey("channel")) { channels.add(jd); @@ -958,15 +964,15 @@ public class RetailAppServiceImp implements RetailAppService { Boolean isUpdate = PlatformEnvironment.getEnv().isAppUpdate(clientType); String updateContent = PlatformEnvironment.getEnv().getAppUpdateContent(clientType); int update_type = 0;// 0:不更新 1:更新 2:强制更新 - String [] versionArr = version.split("\\."); - String [] newVersionArr = newAppVersion.split("\\."); + String[] versionArr = version.split("\\."); + String[] newVersionArr = newAppVersion.split("\\."); for (int i = 0; i < newVersionArr.length; i++) { - if(Integer.valueOf(newVersionArr[i])>Integer.valueOf(versionArr[i])){ + if (Integer.valueOf(newVersionArr[i]) > Integer.valueOf(versionArr[i])) { update_type = 1; if (isUpdate) { update_type = 2; } - i=newVersionArr.length+1; + i = newVersionArr.length + 1; } } JSONObject res = new JSONObject(); @@ -1193,7 +1199,7 @@ public class RetailAppServiceImp implements RetailAppService { } catch (Exception e) { logger.error("出错了:" + e.getMessage()); appMessageLogMapper.updateStatus(log.getString("send_id"), 1, e.getMessage()); - throw new ServerErrorException("Send App "+params.getString("client_type")+" Failed", e); + throw new ServerErrorException("Send App " + params.getString("client_type") + " Failed", e); } }