添加数据分析定时任务调用接口

master
duLingLing 5 years ago
parent 74820c22af
commit e5b19f1503

@ -10,7 +10,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>manage</artifactId>
<version>1.1.9</version>
<version>1.1.10</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

@ -10,6 +10,7 @@ import au.com.royalpay.payment.channels.yeepay.runtime.YeePayClient;
import au.com.royalpay.payment.core.PaymentApi;
import au.com.royalpay.payment.core.exceptions.InvalidShortIdException;
import au.com.royalpay.payment.core.exceptions.OrderNotExistsException;
import au.com.royalpay.payment.manage.analysis.core.DashboardService;
import au.com.royalpay.payment.manage.analysis.core.PlatformClearService;
import au.com.royalpay.payment.manage.appclient.core.RetailAppService;
import au.com.royalpay.payment.manage.dev.bean.AliExcel;
@ -36,6 +37,7 @@ import au.com.royalpay.payment.tools.exceptions.BadRequestException;
import au.com.royalpay.payment.tools.http.HttpUtils;
import au.com.royalpay.payment.tools.merchants.core.MerchantInfoProvider;
import au.com.royalpay.payment.tools.permission.enums.ManagerRole;
import au.com.royalpay.payment.tools.scheduler.SynchronizedScheduler;
import au.com.royalpay.payment.tools.utils.PdfUtils;
import au.com.royalpay.payment.tools.utils.TimeZoneUtils;
import au.com.royalpay.payment.tools.utils.XmlFormatUtils;
@ -44,6 +46,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.serializer.SerializerFeature;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.dom4j.Element;
import org.joda.time.DateTime;
import org.slf4j.Logger;
@ -64,6 +67,8 @@ import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@ -135,6 +140,11 @@ public class TestController implements ApplicationEventPublisherAware {
private TradeSecureService tradeSecureService;
private final static String EMAIL = "lily.tao@royalpay.com.au,bella.sun@royalpay.com.au,astro.dai@royalpay.com.au,taylor.dang@royalpay.com.au";
@Resource
private DashboardService dashboardService;
@Resource
private SynchronizedScheduler synchronizedScheduler;
@ManagerMapping(value = "/{clientMoniker}/export/agreepdf", method = RequestMethod.GET, role = {ManagerRole.ADMIN, ManagerRole.DIRECTOR, ManagerRole.OPERATOR})
public void exportAgreeFile(@PathVariable String clientMoniker, @ModelAttribute(CommonConsts.MANAGER_STATUS) JSONObject manager, HttpServletResponse httpResponse) throws Exception {
httpResponse.setContentType("application/pdf");
@ -516,5 +526,16 @@ public class TestController implements ApplicationEventPublisherAware {
return api.registerShortUrl(longUrl);
}
@GetMapping(value = "/task/analysisDashboard/")
public void analysisDashboard(@RequestParam("date") String date) {
synchronizedScheduler.executeProcess("manage_task:dashboardTask", 120_000,
() -> {
try {
dashboardService.generateCustomersAndOrdersStatistics(DateUtils.addDays(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(date), -1));
} catch (ParseException e) {
e.printStackTrace();
}
});
}
}

Loading…
Cancel
Save