|
|
|
@ -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"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|