From fe207450990f67e8f25a652afc355df5d64a49f7 Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Wed, 28 Aug 2024 17:04:05 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A5=A8=E5=8A=A1=E6=96=B0=E5=A2=9E=E5=8C=BA?= =?UTF-8?q?=E9=97=B4=E6=8A=BD=E6=95=B0=E6=96=B9=E6=B3=95=EF=BC=88=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E6=8E=A5=E5=8F=A3=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/ticketing/TicketingController.java | 33 +++++++++++++++++++ .../config/SecurityConfiguration.java | 1 + 2 files changed, 34 insertions(+) create mode 100644 yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/ticketing/TicketingController.java diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/ticketing/TicketingController.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/ticketing/TicketingController.java new file mode 100644 index 000000000..4a6c7a521 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/ticketing/TicketingController.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.infra.controller.admin.ticketing; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils; +import cn.iocoder.yudao.module.infra.job.ticketing.TicketDataMigration; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.Calendar; +import java.util.Date; + +/** + * @Description 测试抽数接口 + */ +@Tag(name = "管理后台 - 抽数接口") +@RestController +@RequestMapping("/infra/ticketing") +@Validated +public class TicketingController { + @Resource + TicketDataMigration ticketDataMigration; + + @GetMapping + public CommonResult testTicketing(@RequestParam("startDate") String startDate, @RequestParam("endDate")String endDate, @RequestParam("method") String method) throws Exception { + Calendar startCalendar = Calendar.getInstance(); + Calendar endCalendar = Calendar.getInstance(); + startCalendar.setTime(TickingDateUtils.parse(startDate)); + endCalendar.setTime(TickingDateUtils.parse(endDate)); + return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, endCalendar, method)); + } +} diff --git a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java index c5b947e11..8a45a0953 100644 --- a/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java +++ b/yudao-module-infra/yudao-module-infra-biz/src/main/java/cn/iocoder/yudao/module/infra/framework/security/config/SecurityConfiguration.java @@ -36,6 +36,7 @@ public class SecurityConfiguration { .antMatchers(adminSeverContextPath + "/**").anonymous(); // 文件读取 registry.antMatchers(buildAdminApi("/infra/file/*/get/**")).permitAll(); + registry.antMatchers("/**/infra/ticketing/**").permitAll(); // TODO 芋艿:这个每个项目都需要重复配置,得捉摸有没通用的方案 // RPC 服务的安全配置