wangning 7 years ago
commit 5160d9f9cb

@ -6,11 +6,14 @@ import au.com.royalpay.payment.core.tasksupport.SettlementSupport;
import au.com.royalpay.payment.manage.management.clearing.core.CleanService;
import au.com.royalpay.payment.manage.mappers.log.*;
import au.com.royalpay.payment.manage.mappers.payment.TransactionMapper;
import au.com.royalpay.payment.manage.mappers.system.CalendarMapper;
import au.com.royalpay.payment.manage.mappers.system.ClientRateMapper;
import au.com.royalpay.payment.manage.mappers.system.ManagerMapper;
import au.com.royalpay.payment.manage.mappers.system.RateMapper;
import au.com.royalpay.payment.manage.merchants.core.ClientManager;
import au.com.royalpay.payment.manage.notice.core.MailService;
import au.com.royalpay.payment.manage.signin.beans.TodoNotice;
import au.com.royalpay.payment.manage.signin.core.ManagerTodoNoticeProvider;
import au.com.royalpay.payment.manage.support.abafile.ABAFile;
import au.com.royalpay.payment.manage.tradelog.beans.ClearingLogQuery;
import au.com.royalpay.payment.tools.connections.mpsupport.MpWechatApi;
@ -21,6 +24,7 @@ import au.com.royalpay.payment.tools.env.PlatformEnvironment;
import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.exceptions.ForbiddenException;
import au.com.royalpay.payment.tools.exceptions.NotFoundException;
import au.com.royalpay.payment.tools.locale.LocaleSupport;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.tasksupport.TaskFinishNotifyEvent;
import au.com.royalpay.payment.tools.utils.PageListUtils;
@ -42,6 +46,8 @@ import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.joda.time.DateTime;
import org.joda.time.Days;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@ -74,7 +80,7 @@ import static au.com.royalpay.payment.manage.permission.utils.OrgCheckUtils.chec
* Created by davep on 2016-08-29.
*/
@Service
public class CleanServiceImpl implements CleanService, ApplicationEventPublisherAware {
public class CleanServiceImpl implements CleanService, ManagerTodoNoticeProvider, ApplicationEventPublisherAware {
private Logger logger = LoggerFactory.getLogger(getClass());
@Resource
private SettlementSupport settlementSupport;
@ -107,6 +113,8 @@ public class CleanServiceImpl implements CleanService, ApplicationEventPublisher
@Resource
private PaymentApi paymentApi;
@Resource
private CalendarMapper calendarMapper;
@Resource
private SpringTemplateEngine thymeleaf;
@Value("${app.settlement.email-to}")
@ -958,4 +966,30 @@ public class CleanServiceImpl implements CleanService, ApplicationEventPublisher
public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
this.publisher = applicationEventPublisher;
}
@Override
public void checkTodo(JSONObject manager, List<TodoNotice> notices) {
if (ManagerRole.OPERATOR.hasRole(manager.getIntValue("role"))) {
checkSettleDateConfig(notices);
rateWarningsCheck(notices);
}
}
private void rateWarningsCheck(List<TodoNotice> notices) {
JSONObject rateWarnings = rateWarnings();
if (rateWarnings.getJSONArray("no_rate").size() + rateWarnings.getJSONArray("rate_warning").size() > 0) {
String rateWarningSettingMsg = LocaleSupport.localeMessage("todo.rate.expire_warning");
notices.add(new TodoNotice("clearing_rate", rateWarningSettingMsg, "#/analysis/clearing_logs/rate_warnings"));
}
}
private void checkSettleDateConfig(List<TodoNotice> notices) {
Date lastSettleDate = calendarMapper.getLastSettleDate();
Date today = DateUtils.truncate(new Date(), Calendar.DATE);
int days = Days.daysBetween(new DateTime(today), new DateTime(lastSettleDate)).getDays();
if (days < 7) {
String settleDateSettingMsg = LocaleSupport.localeMessage("todo.settlement.date_setting");
notices.add(new TodoNotice("settlement", settleDateSettingMsg, "#/analysis/clearing_logs/date_setting"));
}
}
}

@ -34,6 +34,7 @@
c.client_moniker,
c.short_name,
c.bd_user_name,
r.rate_name,
r.rate_value,
r.expiry_time
FROM sys_clients c
@ -54,6 +55,7 @@
c.client_moniker,
c.short_name,
c.bd_user_name,
r.rate_name,
r.active_time,
r.expiry_time,
r.rate_value,

@ -8,6 +8,7 @@
<tr>
<th>Client Moniker</th>
<th>Short Name</th>
<th>Channel</th>
<th>BD</th>
<th>Latest Rate</th>
<th>Expire Date</th>
@ -20,6 +21,7 @@
<a ui-sref="partners.detail.rates({clientMoniker:client.client_moniker})" ng-bind="client.client_moniker"></a>
</td>
<td ng-bind="client.short_name"></td>
<td ng-bind="client.rate_name"></td>
<td ng-bind="client.bd_user_name"></td>
<td ng-bind="client.rate_value"></td>
<td ng-bind="client.expiry_time|date:'dd/MMM/yyyy'"></td>
@ -41,6 +43,7 @@
<tr>
<th>Client Moniker</th>
<th>Short Name</th>
<th>Channel</th>
<th>BD</th>
<th>Rate</th>
<th>Expire Date</th>
@ -53,6 +56,7 @@
<a ui-sref="partners.detail.rates({clientMoniker:client.client_moniker})" ng-bind="client.client_moniker"></a>
</td>
<td ng-bind="client.short_name"></td>
<td ng-bind="client.rate_name"></td>
<td ng-bind="client.bd_user_name"></td>
<td ng-bind="client.rate_value"></td>
<td ng-bind="client.expiry_time|date:'dd/MMM/yyyy'"></td>

Loading…
Cancel
Save