From 7c760fe8034bcc28a9cd281efc34c2c1d58429dd Mon Sep 17 00:00:00 2001 From: wangning <164851225@qq.com> Date: Fri, 9 Mar 2018 20:18:16 +0800 Subject: [PATCH] update --- .../core/impl/ClientContractServiceImpl.java | 23 ++++++++----------- .../mappers/system/ClientRateMapper.xml | 1 + 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java index 3bb137041..20d66a08d 100644 --- a/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java +++ b/src/main/java/au/com/royalpay/payment/manage/system/core/impl/ClientContractServiceImpl.java @@ -168,27 +168,22 @@ public class ClientContractServiceImpl implements ClientContractService { return result; } int waringDays = sysConfigManager.getSysConfig().getIntValue("rate_warning_days"); - rateInfo.forEach((p) -> { + for (JSONObject p : rateInfo) { if (now.compareTo(DateUtils.addDays(p.getDate("expiry_time"),1)) > -1) { result.put("rate_expire", true); } if (DateUtils.addDays(now, waringDays).compareTo(DateUtils.addDays(p.getDate("expiry_time"),1)) > -1) { + int expireDay = 0; + long expireSS = (DateUtils.addDays(p.getDate("expiry_time"),1).getTime()-now.getTime()); + expireDay = (int)expireSS/(1000*60*60*24); + if(expireSS%(1000*60*60*24)>1){ + ++expireDay; + } + result.put("expire_days",expireDay); result.put("rate_waring", true); } - }); - int expireDay = 0; - long expireSS = (DateUtils.addDays(rateInfo.get(0).getDate("expiry_time"),1).getTime()-now.getTime()); - expireDay = (int)expireSS/(1000*60*60*24); - logger.debug("kirawang__expiryTime+1:"+DateUtils.addDays(rateInfo.get(0).getDate("expiry_time"),1).getTime()); - logger.debug("kirawang__当前时间:"+now.getTime()); - logger.debug("kirawang__时间差:"+(DateUtils.addDays(rateInfo.get(0).getDate("expiry_time"),1).getTime()-now.getTime())); - logger.debug("kirawang__取整位:"+(int)expireSS/(1000*60*60*24)); - logger.debug("kirawang__取整位:"+(int)expireSS/(1000*60*60*24)); - - if(expireSS%(1000*60*60*24)>1){ - ++expireDay; } - result.put("expire_days",expireDay); + return result; } } diff --git a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml index 9c8788324..87e6219b2 100644 --- a/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml +++ b/src/main/resources/au/com/royalpay/payment/manage/mappers/system/ClientRateMapper.xml @@ -96,5 +96,6 @@ SELECT max(active_time) FROM sys_client_rates WHERE client_id = #{client_id} ) + order by expiry_time desc \ No newline at end of file