diff --git a/pom.xml b/pom.xml index 12e30ab90..f681267cb 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ 4.0.0 manage - 1.1.9 + 1.1.10 UTF-8 diff --git a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java index 772075c1c..d1cc7876e 100644 --- a/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java +++ b/src/main/java/au/com/royalpay/payment/manage/dev/web/TestController.java @@ -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(); + } + }); + } }