From 145b7e7a30245ec760be65bd7e472fecc3d4bcfd Mon Sep 17 00:00:00 2001 From: XinWei <2718030729@qq.com> Date: Tue, 23 Jul 2024 16:34:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=A7=E5=B1=8F=E6=95=B0=E6=8D=AE=E7=A5=A8?= =?UTF-8?q?=E5=8A=A1api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/static/js/common.1.js | 7 +- .../templates/common/common.macro.ftl | 8 +- .../ludu-module-datacenter-api/pom.xml | 49 +++ .../module/datacenter/enums/ApiConstants.java | 23 ++ .../datacenter/enums/ErrorCodeConstants.java | 12 + .../ludu-module-datacenter-biz/pom.xml | 8 +- .../DatacenterServerApplication.java | 2 +- .../controller/admin/asset/AssetApi.java | 40 ++ .../admin/asset/vo/AssetRespVO.java | 44 +++ .../admin/checkticket/CheckTicketApi.java | 37 ++ .../checkticket/vo/CheckTicketPageReqVO.java | 50 +++ .../checkticket/vo/CheckTicketRespVO.java | 53 +++ .../checkticket/vo/CheckTicketSaveReqVO.java | 40 ++ .../admin/saledata/SaleDataApi.java | 113 ++++++ .../controller/admin/saledata/vo/AgeVo.java | 16 + .../admin/saledata/vo/AggregationVO.java | 10 + .../admin/saledata/vo/SaleDataPageReqVO.java | 70 ++++ .../admin/saledata/vo/SaleDataRespVO.java | 79 ++++ .../admin/saledata/vo/SaleDataSaveReqVO.java | 61 +++ .../dal/dataobject/asset/Asset.java | 16 + .../dataobject/checkticket/CheckTicket.java | 21 + .../dal/dataobject/saledata/SaleData.java | 29 ++ .../dal/mongodb/asset/AssetRepository.java | 18 + .../checkticket/CheckTicketRepository.java | 23 ++ .../mongodb/saledata/SaleDataRepository.java | 44 +++ .../rpc/config/RpcConfiguration.java | 5 +- .../config/SecurityConfiguration.java | 2 + .../service/asset/AssetService.java | 30 ++ .../service/asset/AssetServiceImpl.java | 81 ++++ .../checkticket/CheckTicketService.java | 28 ++ .../checkticket/CheckTicketServiceImpl.java | 59 +++ .../service/saledata/SaleDataService.java | 92 +++++ .../service/saledata/SaleDataServiceImpl.java | 360 ++++++++++++++++++ .../src/main/resources/application-local.yaml | 5 + .../src/main/resources/application.yaml | 22 +- .../resources/mapper/asset/AssetMapper.xml | 12 + .../mapper/checkticket/CheckticketMapper.xml | 12 + .../mapper/saledata/SaleDataMapper.xml | 12 + ludu-module-datacenter/pom.xml | 1 + .../src/main/resources/application-local.yaml | 5 + .../src/main/resources/application.yaml | 1 - .../src/main/resources/application.yaml | 10 +- 42 files changed, 1592 insertions(+), 18 deletions(-) create mode 100644 ludu-module-datacenter/ludu-module-datacenter-api/pom.xml create mode 100644 ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ApiConstants.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ErrorCodeConstants.java rename ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/{framework => }/DatacenterServerApplication.java (86%) create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/AssetApi.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/vo/AssetRespVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/CheckTicketApi.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketPageReqVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketRespVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketSaveReqVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/SaleDataApi.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AgeVo.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AggregationVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataPageReqVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataRespVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataSaveReqVO.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/asset/Asset.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/saledata/SaleData.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/asset/AssetRepository.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetService.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketService.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataService.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/asset/AssetMapper.xml create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/checkticket/CheckticketMapper.xml create mode 100644 ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/saledata/SaleDataMapper.xml diff --git a/ludu-job-admin/ludu-job-admin-biz/src/main/resources/static/js/common.1.js b/ludu-job-admin/ludu-job-admin-biz/src/main/resources/static/js/common.1.js index 09c840da4..372ca0317 100644 --- a/ludu-job-admin/ludu-job-admin-biz/src/main/resources/static/js/common.1.js +++ b/ludu-job-admin/ludu-job-admin-biz/src/main/resources/static/js/common.1.js @@ -18,11 +18,12 @@ $(function(){ // 直接清理cookie,直接设置过期 document.cookie = "ACCESS_TOKEN=; max-age=0; path=/xxl-job-admin"; document.cookie = "REFRESH_TOKEN=; max-age=0; path=/xxl-job-admin"; - layer.open({ + /*layer.open({ icon: '2', title: I18n.system_tips, - content: ('已退出登录请关闭当前会话框!' || I18n.logout_success) - }); + content: ('已退出登录!' || I18n.logout_success) + });*/ + window.location.href = "http://127.0.0.1:80/logout" /*$.post(base_url + "/logout", function(data, status) { if (data.code == "200") { layer.msg( I18n.logout_success ); diff --git a/ludu-job-admin/ludu-job-admin-biz/src/main/resources/templates/common/common.macro.ftl b/ludu-job-admin/ludu-job-admin-biz/src/main/resources/templates/common/common.macro.ftl index 47868778a..c02fe2e79 100644 --- a/ludu-job-admin/ludu-job-admin-biz/src/main/resources/templates/common/common.macro.ftl +++ b/ludu-job-admin/ludu-job-admin-biz/src/main/resources/templates/common/common.macro.ftl @@ -86,12 +86,12 @@ -<#-- diff --git a/ludu-module-datacenter/ludu-module-datacenter-api/pom.xml b/ludu-module-datacenter/ludu-module-datacenter-api/pom.xml new file mode 100644 index 000000000..b9c4c58dc --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-api/pom.xml @@ -0,0 +1,49 @@ + + + + ludu-module-datacenter + cn.iocoder.cloud + ${revision} + + 4.0.0 + + ludu-module-datacenter-api + + jar + + ${project.artifactId} + + 数据中心 模块 API,暴露给其它模块调用 + + + + + + cn.iocoder.cloud + yudao-common + + + + + org.springdoc + springdoc-openapi-ui + provided + + + + + org.springframework.boot + spring-boot-starter-validation + true + + + + + org.springframework.cloud + spring-cloud-starter-openfeign + true + + + \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ApiConstants.java b/ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ApiConstants.java new file mode 100644 index 000000000..23beadc76 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ApiConstants.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.module.datacenter.enums; + +import cn.iocoder.yudao.framework.common.enums.RpcConstants; + +/** + * API 相关的枚举 + * + * @author 芋道源码 + */ +public class ApiConstants { + + /** + * 服务名 + * + * 注意,需要保证和 spring.application.name 保持一致 + */ + public static final String NAME = "datacenter-server"; + + public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/datacenter"; + + public static final String VERSION = "1.0.0"; + +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ErrorCodeConstants.java b/ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ErrorCodeConstants.java new file mode 100644 index 000000000..74f30000c --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-api/src/main/java/cn/iocoder/yudao/module/datacenter/enums/ErrorCodeConstants.java @@ -0,0 +1,12 @@ +package cn.iocoder.yudao.module.datacenter.enums; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; + +/** + * @Description + */ +public interface ErrorCodeConstants { + ErrorCode ASSET_NOT_EXISTS = new ErrorCode(1_005_001_000, "设备不存在"); + ErrorCode CHECK_TICKET_NOT_EXISTS = new ErrorCode(1_005_001_001, "检票不存在"); + ErrorCode SALE_DATA_NOT_EXISTS = new ErrorCode(1_005_001_002, "售票不存在"); +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/pom.xml b/ludu-module-datacenter/ludu-module-datacenter-biz/pom.xml index de977303c..9381e01ed 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/pom.xml +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/pom.xml @@ -12,12 +12,16 @@ ludu-module-datacenter-biz - cn.iocoder.cloud - ludu-module-ticketing-api + ludu-module-datacenter-api ${revision} + + + org.springframework.boot + spring-boot-starter-data-mongodb + org.springframework.cloud diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/DatacenterServerApplication.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/DatacenterServerApplication.java similarity index 86% rename from ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/DatacenterServerApplication.java rename to ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/DatacenterServerApplication.java index 063e47240..3aa0aa9cd 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/DatacenterServerApplication.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/DatacenterServerApplication.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.datacenter.framework; +package cn.iocoder.yudao.module.datacenter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/AssetApi.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/AssetApi.java new file mode 100644 index 000000000..001e192c4 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/AssetApi.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.asset; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.datacenter.controller.admin.asset.vo.AssetRespVO; +import cn.iocoder.yudao.module.datacenter.service.asset.AssetService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +/** + * @Description 设备 + */ +@Tag(name = "管理后台 - 设备") +@RestController +@RequestMapping("/datacenter/asset") +@Validated +public class AssetApi { + @Resource + private AssetService assetService; + @GetMapping("/type") + @Operation(summary = "获得所有设备名称和数量") + public CommonResult>> countAsset() { + return success(assetService.countAsset()); + } + @GetMapping("/name/{assettypename}") + @Operation(summary = "获取符合设备类型名的所有设备") + public CommonResult> nameAsset(@PathVariable("assettypename") String assettypename) { + return success(assetService.nameAsset(assettypename)); + } +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/vo/AssetRespVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/vo/AssetRespVO.java new file mode 100644 index 000000000..4e3481fff --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/asset/vo/AssetRespVO.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.asset.vo; + +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 设备 Response VO") +@Data +@ExcelIgnoreUnannotated +public class AssetRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30538") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "数据ID", example = "15059") + @ExcelProperty("数据ID") + private String dataId; + + @Schema(description = "设备名称", example = "芋艿") + @ExcelProperty("设备名称") + private String assetname; + + @Schema(description = "设备类型ID", example = "2") + @ExcelProperty("设备类型ID") + private String assettype; + + @Schema(description = "设备类型名称", example = "芋艿") + @ExcelProperty("设备类型名称") + private String assettypename; + + @Schema(description = "设备状态") + @ExcelProperty(value = "设备状态", converter = DictConvert.class) + @DictFormat("asset_status_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private String isOnline; + + @Schema(description = "最后一次反馈时间") + @ExcelProperty("最后一次反馈时间") + private Long lastfeedbacktime; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/CheckTicketApi.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/CheckTicketApi.java new file mode 100644 index 000000000..8ddde9839 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/CheckTicketApi.java @@ -0,0 +1,37 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.checkticket; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.datacenter.service.checkticket.CheckTicketService; +import io.swagger.v3.oas.annotations.Operation; +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.List; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +/** + * @Description 检票 + */ +@Tag(name = "管理后台 - 检票") +@RestController +@RequestMapping("/datacenter/checkticket") +@Validated +public class CheckTicketApi { + @Resource + private CheckTicketService checkTicketService; + @GetMapping("/{day}") + @Operation(summary = "获得日期当天的检票人数") + public CommonResult checkTicketTotal(@PathVariable("day") String day) { + return success(checkTicketService.checkTicketTotal(day)); + } + + @GetMapping("/qushi/{day}") + @Operation(summary = "获取日期当天各个时段的检票人数") + public CommonResult>> findbytimetemp(@PathVariable("day") String day) { + return success(checkTicketService.findbytimetemp(day)); + } +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketPageReqVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketPageReqVO.java new file mode 100644 index 000000000..4c468a9d1 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketPageReqVO.java @@ -0,0 +1,50 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.checkticket.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 检票分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class CheckTicketPageReqVO extends PageParam { + + @Schema(description = "ID", example = "16476") + private Long id; + + @Schema(description = "数据ID", example = "15422") + private String dataId; + + @Schema(description = "检票点ID") + private String checkstation; + + @Schema(description = "检票点名称", example = "李四") + private String checkstationname; + + @Schema(description = "检票日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] checkticketdate; + + @Schema(description = "检票时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] checktickettime; + + @Schema(description = "人数", example = "23164") + private Integer personcount; + + @Schema(description = "订单明细ID") + private String sdshipping; + + @Schema(description = "票ID") + private String ticket; + + @Schema(description = "销售特征名称(票种名称)", example = "张三") + private String salepropetyvaluename; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketRespVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketRespVO.java new file mode 100644 index 000000000..0d4153932 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketRespVO.java @@ -0,0 +1,53 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.checkticket.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 检票 Response VO") +@Data +@ExcelIgnoreUnannotated +public class CheckTicketRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "数据ID", example = "15422") + @ExcelProperty("数据ID") + private String dataId; + + @Schema(description = "检票点ID") + @ExcelProperty("检票点ID") + private String checkstation; + + @Schema(description = "检票点名称", example = "李四") + @ExcelProperty("检票点名称") + private String checkstationname; + + @Schema(description = "检票日期") + @ExcelProperty("检票日期") + private String checkticketdate; + + @Schema(description = "检票时间") + @ExcelProperty("检票时间") + private String checktickettime; + + @Schema(description = "人数", example = "23164") + @ExcelProperty("人数") + private Integer personcount; + + @Schema(description = "订单明细ID") + @ExcelProperty("订单明细ID") + private String sdshipping; + + @Schema(description = "票ID") + @ExcelProperty("票ID") + private String ticket; + + @Schema(description = "销售特征名称(票种名称)", example = "张三") + @ExcelProperty("销售特征名称(票种名称)") + private String salepropetyvaluename; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketSaveReqVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketSaveReqVO.java new file mode 100644 index 000000000..1a9538e3a --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/checkticket/vo/CheckTicketSaveReqVO.java @@ -0,0 +1,40 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.checkticket.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +@Schema(description = "管理后台 - 检票新增/修改 Request VO") +@Data +public class CheckTicketSaveReqVO { + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476") + private Long id; + @Schema(description = "数据ID", example = "15422") + private String dataId; + + @Schema(description = "检票点ID") + private String checkstation; + + @Schema(description = "检票点名称", example = "李四") + private String checkstationname; + + @Schema(description = "检票日期") + private String checkticketdate; + + @Schema(description = "检票时间") + private String checktickettime; + + @Schema(description = "人数", example = "23164") + private Integer personcount; + + @Schema(description = "订单明细ID") + private String sdshipping; + + @Schema(description = "票ID") + private String ticket; + + @Schema(description = "销售特征名称(票种名称)", example = "张三") + private String salepropetyvaluename; + + @Schema(description = "租户编号") + private Long tenant_id; +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/SaleDataApi.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/SaleDataApi.java new file mode 100644 index 000000000..51e06aeb3 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/SaleDataApi.java @@ -0,0 +1,113 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.saledata; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.module.datacenter.service.saledata.SaleDataService; +import io.swagger.v3.oas.annotations.Operation; +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.math.BigDecimal; +import java.util.List; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +/** + * @Description 售票 + */ +@Tag(name = "管理后台 - 售票") +@RestController +@RequestMapping("/datacenter/saledata") +@Validated +public class SaleDataApi { + @Resource + private SaleDataService saleDataService; + + @GetMapping("/{day}") + @Operation(summary = "获得输入日期的当天总售票数") + public CommonResult checkTicketTotal(@PathVariable("day") String day) { + return success(saleDataService.countBySddate(day)); + } + + @GetMapping("/thisyear/{startTime}") + @Operation(summary = "获得今年日期往前十天内的数据") + public CommonResult>> thisyearNum(@PathVariable("startTime") String startTime) { + return success(saleDataService.findCheckticketcountBytime(startTime)); + } + + @GetMapping("/lastyear/{startTime}") + @Operation(summary = "获得去年日期往前推十天的数据") + public CommonResult>> lastyearNum(@PathVariable("startTime") String startTime) { + return success(saleDataService.findCheckticketcountBytime(startTime)); + } + + @GetMapping("/gender") + @Operation(summary = "获得所有数据的男女数量") + public CommonResult>> findByGender() { + return success(saleDataService.findByGender()); + } + + @GetMapping("/age") + @Operation(summary = "获得所有数据的年龄分段和数量") + public CommonResult>> findByage() { + return success(saleDataService.findByAge()); + } + + @GetMapping("/lastyear/region") + @Operation(summary = "查询去年各个省份的人数") + public CommonResult>> lastyearfindByregion() { + return success(saleDataService.findByregion(saleDataService.findEventsLastYear())); + } + + @GetMapping("/thisyear/region") + @Operation(summary = "查询今年各个省份的人数") + public CommonResult>> thisyearfindByregion() { + return success(saleDataService.findByregion(saleDataService.findEventsThisYear())); + } + + @GetMapping("/salemethod") + @Operation(summary = "查询各个销售渠道的购票人数") + public CommonResult>> findBysaleMethod() { + return success(saleDataService.findBySaleMethod()); + } + + @GetMapping("/wuyi/{x}") + @Operation(summary = "查询最近前几年当年的五一期间的数据") + public CommonResult>> findByWuyi(@PathVariable("x") int x) { + return success(saleDataService.findWuyi(x)); + } + + @GetMapping("/guoqing/{x}") + @Operation(summary = "查询最近前几年当年的国庆期间的数据") + public CommonResult>> findByGuoqing(@PathVariable("x") int x) { + return success(saleDataService.findGuoqing(x)); + } + + @GetMapping("/rijunthisyear/{startTime}") + @Operation(summary = "查询今年对应日期的近三十天日均售票数量") + public CommonResult findThisyearRijun(@PathVariable("startTime") String startTime) { + return success(saleDataService.findrijun(startTime)); + } + + @GetMapping("/rijunlastyear/{startTime}") + @Operation(summary = "查询去年对应日期的近三十天日均售票数量") + public CommonResult findLastyearRijun(@PathVariable("startTime") String startTime) { + return success(saleDataService.findrijun(startTime)); + } + + // TODO 年度平均什么,并没有说清楚,原代码是直接计算一年的总金额 + @GetMapping("/thisyear/nianjun") + @Operation(summary = "查询今年年度售票平均金额") + public CommonResult findmoneythisyear() { + return success(saleDataService.findyearJun(saleDataService.findEventsThisYear())); + } + + @GetMapping("/lastyear/nianjun") + @Operation(summary = "查询去年年度售票平均金额") + public CommonResult findmoneylastyear() { + return success(saleDataService.findyearJun(saleDataService.findEventsLastYear())); + } + +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AgeVo.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AgeVo.java new file mode 100644 index 000000000..73bb4cc7e --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AgeVo.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo; + +import lombok.Data; + +/** + * @Description 自定义年龄分段 + */ +@Data +public class AgeVo { + private String one; + private String two; + private String three; + private String four; + private String five; + private String six; +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AggregationVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AggregationVO.java new file mode 100644 index 000000000..1ae0b8c3c --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/AggregationVO.java @@ -0,0 +1,10 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo; + +import lombok.Data; + +@Data +public class AggregationVO { + private long maleCount; + private long femaleCount; + private double maleRatio; +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataPageReqVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataPageReqVO.java new file mode 100644 index 000000000..8a0e4f4e6 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataPageReqVO.java @@ -0,0 +1,70 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo; + +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import org.springframework.format.annotation.DateTimeFormat; + +import java.math.BigDecimal; + +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; + +@Schema(description = "管理后台 - 售票分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class SaleDataPageReqVO extends PageParam { + + @Schema(description = "ID", example = "20492") + private Long id; + + @Schema(description = "数据id", example = "32044") + private String dataId; + + @Schema(description = "金额") + private BigDecimal amount; + + @Schema(description = "证件号") + private String certificateno; + + @Schema(description = "证件类别", example = "2") + private String certificatetype; + + @Schema(description = "产品ID") + private String item; + + @Schema(description = "产品名称", example = "张三") + private String itemname; + + @Schema(description = "产品类型ID", example = "2") + private String itemtype; + + @Schema(description = "产品类型名称", example = "张三") + private String itemtypename; + + @Schema(description = "出游日期") + private String productbatchno; + + @Schema(description = "数量") + private Integer quantity; + + @Schema(description = "销售日期") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] sddate; + + @Schema(description = "订单号") + private String sdno; + + @Schema(description = "销售时间") + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) + private String[] sdtime; + + @Schema(description = "交易类别(订单类型)") + private String transactiontypeno; + + @Schema(description = "销售特征名称(票种名称)", example = "赵六") + private String salepropetyvaluename; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataRespVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataRespVO.java new file mode 100644 index 000000000..d83284e40 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataRespVO.java @@ -0,0 +1,79 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Schema(description = "管理后台 - 售票 Response VO") +@Data +@ExcelIgnoreUnannotated +public class SaleDataRespVO { + + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20492") + @ExcelProperty("ID") + private Long id; + + @Schema(description = "数据id", example = "32044") + @ExcelProperty("数据id") + private String dataId; + + @Schema(description = "金额") + @ExcelProperty("金额") + private BigDecimal amount; + + @Schema(description = "证件号") + @ExcelProperty("证件号") + private String certificateno; + + @Schema(description = "证件类别", example = "2") + @ExcelProperty("证件类别") + private String certificatetype; + + @Schema(description = "产品ID") + @ExcelProperty("产品ID") + private String item; + + @Schema(description = "产品名称", example = "张三") + @ExcelProperty("产品名称") + private String itemname; + + @Schema(description = "产品类型ID", example = "2") + @ExcelProperty("产品类型ID") + private String itemtype; + + @Schema(description = "产品类型名称", example = "张三") + @ExcelProperty("产品类型名称") + private String itemtypename; + + @Schema(description = "出游日期") + @ExcelProperty("出游日期") + private String productbatchno; + + @Schema(description = "数量") + @ExcelProperty("数量") + private Integer quantity; + + @Schema(description = "销售日期") + @ExcelProperty("销售日期") + private String sddate; + + @Schema(description = "订单号") + @ExcelProperty("订单号") + private String sdno; + + @Schema(description = "销售时间") + @ExcelProperty("销售时间") + private String sdtime; + + @Schema(description = "交易类别(订单类型)") + @ExcelProperty("交易类别(订单类型)") + private String transactiontypeno; + + @Schema(description = "销售特征名称(票种名称)", example = "赵六") + @ExcelProperty("销售特征名称(票种名称)") + private String salepropetyvaluename; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataSaveReqVO.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataSaveReqVO.java new file mode 100644 index 000000000..06c4f9ed3 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/controller/admin/saledata/vo/SaleDataSaveReqVO.java @@ -0,0 +1,61 @@ +package cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +@Schema(description = "管理后台 - 售票新增/修改 Request VO") +@Data +public class SaleDataSaveReqVO { + @Schema(description = "ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "16476") + private Long id; + @Schema(description = "数据id", example = "32044") + private String dataId; + + @Schema(description = "金额") + private BigDecimal amount; + + @Schema(description = "证件号") + private String certificateno; + + @Schema(description = "证件类别", example = "2") + private String certificatetype; + + @Schema(description = "产品ID") + private String item; + + @Schema(description = "产品名称", example = "张三") + private String itemname; + + @Schema(description = "产品类型ID", example = "2") + private String itemtype; + + @Schema(description = "产品类型名称", example = "张三") + private String itemtypename; + + @Schema(description = "出游日期") + private String productbatchno; + + @Schema(description = "数量") + private Integer quantity; + + @Schema(description = "销售日期") + private String sddate; + + @Schema(description = "订单号") + private String sdno; + + @Schema(description = "销售时间") + private String sdtime; + + @Schema(description = "交易类别(订单类型)") + private String transactiontypeno; + + @Schema(description = "销售特征名称(票种名称)", example = "赵六") + private String salepropetyvaluename; + + @Schema(description = "租户编号") + private Long tenant_id; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/asset/Asset.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/asset/Asset.java new file mode 100644 index 000000000..43b63ccb0 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/asset/Asset.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.module.datacenter.dal.dataobject.asset; +import lombok.Data; +import org.springframework.data.mongodb.core.mapping.Document; + + +@Document("asset") +@Data +public class Asset { + private String id; + private String dataId; + private String assetname; + private String assettype; + private String assettypename; + private String isOnline; + private Long lastFeedbackTime; +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java new file mode 100644 index 000000000..ba82b053c --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/checkticket/CheckTicket.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.datacenter.dal.dataobject.checkticket; + +import lombok.Data; +import org.springframework.data.mongodb.core.mapping.Document; + +@Document("checkticket") +//@Document("checktickettest") +@Data +public class CheckTicket { + private String id; + private String dataId; + private String checkstation; + private String checkstationname; + private String ticket; + private String checkticketdate; + private String checktickettime; + private Integer personcount; + private String sdshipping; + private String salepropetyvaluename; + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/saledata/SaleData.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/saledata/SaleData.java new file mode 100644 index 000000000..56ccc6708 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/dataobject/saledata/SaleData.java @@ -0,0 +1,29 @@ +package cn.iocoder.yudao.module.datacenter.dal.dataobject.saledata; + +import lombok.Data; +import org.springframework.data.mongodb.core.mapping.Document; + +import java.math.BigDecimal; + +@Document("saledata") +@Data +public class SaleData { + private String id; + private String dataId; + private String sdno; + private String transactiontypeno; + private String sddate; + private String sdtime; + private BigDecimal amount; + private Integer quantity; + private String certificatetype; + private String certificateno; + private String itemtype; + private String itemtypename; + private String item; + private String itemname; + private String productbatchno; + private String salepropetyvaluename; + + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/asset/AssetRepository.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/asset/AssetRepository.java new file mode 100644 index 000000000..494c29400 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/asset/AssetRepository.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.datacenter.dal.mongodb.asset; + +import cn.iocoder.yudao.module.datacenter.dal.dataobject.asset.Asset; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + +/** + * @Description TODO + */ +@Repository +public interface AssetRepository extends MongoRepository { + + List findAllByAssettypename(String assettypename); + Asset findByDataId(String dataId); + List findAllByIsOnline(String online); +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java new file mode 100644 index 000000000..5cc6effca --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/checkticket/CheckTicketRepository.java @@ -0,0 +1,23 @@ +package cn.iocoder.yudao.module.datacenter.dal.mongodb.checkticket; + + +import cn.iocoder.yudao.module.datacenter.dal.dataobject.checkticket.CheckTicket; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageRequest; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.data.mongodb.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.List; +@Repository +public interface CheckTicketRepository extends MongoRepository { + @Query("{'name': {'$regex': '?0', '$options': 'i'}}") + Page findByName(String q, PageRequest pageable); + + int countByCheckticketdate(String day); + + @Query("{'checktickettime':{'$gte': ?0, '$lt': ?1},'checkticketdate':{'$dt': ?2}}") + List findByTimestampBetweenAndCheckticketdate(String startTime, String endTime,String day); + + ListfindByCheckticketdateAndChecktickettimeBetween(String day,String startTime, String endTime); +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java new file mode 100644 index 000000000..44109e7ad --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/dal/mongodb/saledata/SaleDataRepository.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.datacenter.dal.mongodb.saledata; + + +import cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo.AgeVo; +import cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo.AggregationVO; +import cn.iocoder.yudao.module.datacenter.dal.dataobject.saledata.SaleData; +import org.springframework.data.mongodb.repository.Aggregation; +import org.springframework.data.mongodb.repository.MongoRepository; +import org.springframework.data.mongodb.repository.Query; +import org.springframework.stereotype.Repository; + +import java.util.List; +@Repository +public interface SaleDataRepository extends MongoRepository { + /*@Query("{'name': {'$regex': '?0', '$options': 'i'}}") + Page findByName(String q, PageRequest pageable);*/ + int countBySddate(String day); + + +// @Query("{ 'sddate' : { $gte: ?0, $lte: ?1 } }") + @Query(value = "{ 'sddate': { $gte: ?0, $lte: ?1 } }", fields = "{ 'certificateno': 1, 'amount': 1}") + ListfindBySddateBetween(String begin,String end); + + @Aggregation(pipeline = { + "{$project: {certLength: {$strLenCP: '$certificateno'}, secondLastChar: {$substrCP: ['$certificateno', {$subtract: [{$strLenCP: '$certificateno'}, 2]}, 1]}}}", + "{$group: {_id: null, maleCount: {$sum: {$cond: {if: {$eq: [{$mod: [{$toInt: '$secondLastChar'}, 2]}, 1]}, then: 1, else: 0}}}, femaleCount: {$sum: {$cond: {if: {$eq: [{$mod: [{$toInt: '$secondLastChar'}, 2]}, 0]}, then: 1, else: 0}}}, totalCount: {$sum: 1}}}", + "{$project: {_id: 0, maleCount: 1, femaleCount: 1, maleRatio: {$divide: ['$maleCount', '$totalCount']}}}" + }) + AggregationVO findAllByCertificateno(); + + @Aggregation(pipeline = { + "{$match: {certificateno: {$regex: '^.{18}$'}}}", + "{$project: {birthYear: {$toInt: {$substr: ['$certificateno', 6, 4]}}, currentYear: {$year: '$$NOW'}}}", + "{$addFields: {age: {$subtract: ['$currentYear', '$birthYear']}}}", + "{$group: {_id: null, one: {$sum: {$cond: [{$lte: ['$age', 20]}, 1, 0]}}, " + + "two: {$sum: {$cond: [{$and: [{$gt: ['$age', 20]}, {$lte: ['$age', 30]}]}, 1, 0]}}, " + + "three: {$sum: {$cond: [{$and: [{$gt: ['$age', 30]}, {$lte: ['$age', 40]}]}, 1, 0]}}, " + + "four: {$sum: {$cond: [{$and: [{$gt: ['$age', 40]}, {$lte: ['$age', 50]}]}, 1, 0]}}, " + + "five: {$sum: {$cond: [{$and: [{$gt: ['$age', 50]}, {$lte: ['$age', 60]}]}, 1, 0]}}, " + + "six: {$sum: {$cond: [{$gt: ['$age', 60]}, 1, 0]}}}}" + }) + AgeVo findByAge(); + +} diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/rpc/config/RpcConfiguration.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/rpc/config/RpcConfiguration.java index 9ff28853d..872e8e36e 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/rpc/config/RpcConfiguration.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/rpc/config/RpcConfiguration.java @@ -1,12 +1,9 @@ package cn.iocoder.yudao.module.datacenter.framework.rpc.config; -import cn.iocoder.yudao.module.ticket.api.asset.TicketAssetApi; -import cn.iocoder.yudao.module.ticket.api.checkticket.TicketCheckTicketApi; -import cn.iocoder.yudao.module.ticket.api.saledata.TicketSaleDataApi; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Configuration; @Configuration(proxyBeanMethods = false) -@EnableFeignClients(clients = {TicketAssetApi.class, TicketCheckTicketApi.class, TicketSaleDataApi.class}) +@EnableFeignClients(clients = {}) public class RpcConfiguration { } diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java index 725273fb6..921644e67 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/security/config/SecurityConfiguration.java @@ -18,6 +18,8 @@ public class SecurityConfiguration { @Override public void customize(ExpressionUrlAuthorizationConfigurer.ExpressionInterceptUrlRegistry registry) { + // TODO 暂时放行所有,用于测试 + registry.antMatchers("/**").permitAll(); // Swagger 接口文档 registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据 .antMatchers("/swagger-ui.html").permitAll(); // Swagger UI diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetService.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetService.java new file mode 100644 index 000000000..719b998c4 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetService.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.datacenter.service.asset; + +import cn.iocoder.yudao.module.datacenter.controller.admin.asset.vo.AssetRespVO; + +import java.util.List; +import java.util.Map; + +/** + * 设备 Service 接口 + * + * @author 芋道源码 + */ +public interface AssetService { + + + /** + * 计算不同设备的数量 + * @param + * @return 所有设备名称和数量 + */ + public List> countAsset(); + + /** + * 获取符合设备类型名的所有设备 + * @param assettypename 设备类型名 + * @return java.util.List + */ + public List nameAsset(String assettypename); + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java new file mode 100644 index 000000000..a7135ad7a --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/asset/AssetServiceImpl.java @@ -0,0 +1,81 @@ +package cn.iocoder.yudao.module.datacenter.service.asset; + +import cn.iocoder.yudao.module.datacenter.controller.admin.asset.vo.AssetRespVO; +import cn.iocoder.yudao.module.datacenter.dal.dataobject.asset.Asset; +import cn.iocoder.yudao.module.datacenter.dal.mongodb.asset.AssetRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +/** + * 设备 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class AssetServiceImpl implements AssetService { + + @Autowired + private AssetRepository assetRepository; + + @Override + public List> countAsset() { + List assetList = assetRepository.findAll(); + int[] assetTypeCounts = new int[3]; + Map map = new LinkedHashMap<>(); + for (Asset asset : assetList) { + String assettype = asset.getAssettype(); + switch (assettype) { + case "C": + assetTypeCounts[0]++; + break; + case "D": + assetTypeCounts[1]++; + break; + case "F": + assetTypeCounts[2]++; + break; + default: + break; + } + } + map.put("其他电子设备", String.valueOf(assetTypeCounts[0])); + map.put("运输设备", String.valueOf(assetTypeCounts[1])); + map.put("手持机", String.valueOf(assetTypeCounts[2])); + List>mapList=new ArrayList<>(); + for (Map.Entry stringStringEntry : map.entrySet()) { + Map map1=new LinkedHashMap(); + map1.put("assettype",stringStringEntry.getKey()); + map1.put("count",stringStringEntry.getValue()); + mapList.add(map1); + } + return mapList; + } + + @Override + public List nameAsset(String assettypename) { + List assetRespVOList = new ArrayList<>(); + for (Asset assetDO : assetRepository.findAllByAssettypename(assettypename)) { + AssetRespVO assetRespVO = new AssetRespVO(); + assetRespVO.setId(Long.valueOf(assetDO.getId())); + assetRespVO.setDataId(assetDO.getDataId()); + assetRespVO.setAssetname(assetDO.getAssetname()); + assetRespVO.setAssettype(assetDO.getAssettype()); + assetRespVO.setAssettypename(assetDO.getAssettypename()); + assetRespVO.setIsOnline(assetDO.getIsOnline()); + if (assetDO.getLastFeedbackTime() != null) { + assetRespVO.setLastfeedbacktime(assetDO.getLastFeedbackTime()); + } + assetRespVOList.add(assetRespVO); + } + return assetRespVOList; + } + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketService.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketService.java new file mode 100644 index 000000000..6964e6423 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketService.java @@ -0,0 +1,28 @@ +package cn.iocoder.yudao.module.datacenter.service.checkticket; + + +import java.util.List; +import java.util.Map; + +/** + * 检票 Service 接口 + * + * @author 芋道源码 + */ +public interface CheckTicketService { + + + /** + * 获取日期当天各个时段的检票人数 + * @param day + * @return java.util.List> + */ + public List> findbytimetemp(String day); + + /** + * 获得日期当天的检票人数 + * @param day 日期 + * @return long 检票人数 + */ + public long checkTicketTotal(String day); +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java new file mode 100644 index 000000000..18aee1159 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/checkticket/CheckTicketServiceImpl.java @@ -0,0 +1,59 @@ +package cn.iocoder.yudao.module.datacenter.service.checkticket; + +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; + +import cn.iocoder.yudao.module.datacenter.dal.dataobject.checkticket.CheckTicket; +import cn.iocoder.yudao.module.datacenter.dal.mongodb.checkticket.CheckTicketRepository; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; + +/** + * 检票 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class CheckTicketServiceImpl implements CheckTicketService { + + @Resource + private CheckTicketRepository checkTicketRepository; + + + @Override + public List> findbytimetemp(String day) { + LocalDateTime startTime = LocalDateTime.now(); + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss"); + List> mapList = new ArrayList<>(); + + for (int i = 0; i < 24; i++) { + Mapmap =new LinkedHashMap<>(); + LocalDateTime hourStartTime = startTime.withHour(i).withMinute(0).withSecond(0).withNano(0); + LocalDateTime hourEndTime = hourStartTime.plusHours(1); + String begintime = formatter.format(hourStartTime); + String endtime = formatter.format(hourEndTime); + List checkTickets = checkTicketRepository.findByCheckticketdateAndChecktickettimeBetween(day,begintime,endtime); + map.put("date",begintime+"-"+endtime); + map.put("count", String.valueOf(checkTickets.stream().count())); + mapList.add(map); + } + + return mapList; + } + + @Override + public long checkTicketTotal(String day) { + return checkTicketRepository.countByCheckticketdate(day); + } + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataService.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataService.java new file mode 100644 index 000000000..224560916 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataService.java @@ -0,0 +1,92 @@ +package cn.iocoder.yudao.module.datacenter.service.saledata; + +import cn.iocoder.yudao.module.datacenter.dal.dataobject.saledata.SaleData; + +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * 售票 Service 接口 + * + * @author 芋道源码 + */ +public interface SaleDataService { + + /** + * 获得输入日期的当天总售票数 + * @param day 日期 + * @return 当天总售票数 + */ + public long countBySddate(String day); + /** + * 日期往前十天内的数据 + * @param startTime 起始日期 + * @return java.util.List + */ + + public List> findCheckticketcountBytime(String startTime); + + /** + * 查询男女人数 + * @return 男女人数 + */ + public List> findByGender(); + + /** + * 查询各个年龄段的人数 + * @return 各个年龄段的人数 + */ + public List> findByAge(); + + /** + * 查询去年1月1日到12月31日的全部数据 + * @return + */ + public List findEventsLastYear(); + /** + * 查询今年1月1日到12月31日的全部数据 + * @return + */ + public List findEventsThisYear(); + + /** + * 查询各个省份和人数 + * @param list 售票数据 + * @return 各个省份和人数 + */ + public List> findByregion(List list); + + + + /** + * 查询销售渠道 + * @return + */ + public List> findBySaleMethod(); + + /** + * 查询最近前x年五一期间的数据 + * @param x 前几年 + */ + List> findWuyi(int x); + /** + * 查询最近前x年国庆期间的数据 + * @param x 前几年 + */ + List> findGuoqing(int x); + + /** + * 查询今年的近三十天日均 + * @param startTime 中间时间 + * @return java.lang.Object + */ + String findrijun(String startTime); + + /** + * 查年度平均 + * @param list 一年的全部数据 + * @return java.math.BigDecimal + */ + BigDecimal findyearJun(List list); +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java new file mode 100644 index 000000000..cfe43a57d --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/service/saledata/SaleDataServiceImpl.java @@ -0,0 +1,360 @@ +package cn.iocoder.yudao.module.datacenter.service.saledata; + + +import cn.iocoder.yudao.framework.common.util.ticket.IdCardUtil; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; + + +import cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo.AgeVo; +import cn.iocoder.yudao.module.datacenter.controller.admin.saledata.vo.AggregationVO; +import cn.iocoder.yudao.module.datacenter.dal.dataobject.saledata.SaleData; +import cn.iocoder.yudao.module.datacenter.dal.mongodb.saledata.SaleDataRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.math.BigDecimal; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; +import java.util.*; + + +/** + * 售票 Service 实现类 + * + * @author 芋道源码 + */ +@Service +public class SaleDataServiceImpl implements SaleDataService { + + @Autowired + private SaleDataRepository saleDataRepository; + @Override + public long countBySddate(String day) { + return saleDataRepository.countBySddate(day); + } + + @Override + public List> findCheckticketcountBytime(String startTime) { + SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMdd"); + SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd"); + Calendar calendar = Calendar.getInstance(); + Date date1= null; + try { + date1 = inputFormat.parse(startTime); + } catch (ParseException e) { + throw new RuntimeException(e); + } + calendar.setTime(date1); + calendar.add(Calendar.DAY_OF_YEAR, -9); + List>map = new ArrayList<>(); + while (!calendar.getTime().after(date1)){ + Mapmap1= new HashMap<>(); + String date = inputFormat.format(calendar.getTime()); + map1.put("date",outputFormat.format(calendar.getTime())); + map1.put("count", String.valueOf(this.countBySddate(date))); + map.add(map1); + calendar.add(Calendar.DAY_OF_YEAR, 1); + } + return map; + } + + @Override + public List> findByGender() { + AggregationVO allByCertificateno = saleDataRepository.findAllByCertificateno(); + List> map = new ArrayList<>(); + Mapmap1=new HashMap<>(); + Mapmap2=new HashMap<>(); + map1.put("sex","女生" ); + map1.put("count",Long.toString(allByCertificateno.getFemaleCount())); + map2.put("sex","男生" ); + map2.put("count", Long.toString(allByCertificateno.getMaleCount())); + map.add(map1); + map.add(map2); + return map; + } + + @Override + public List> findByAge() { + AgeVo byAge = saleDataRepository.findByAge(); + List>map=new ArrayList<>(); + Mapmap1=new LinkedHashMap<>(); + Mapmap2=new LinkedHashMap<>(); + Mapmap3=new LinkedHashMap<>(); + Mapmap4=new LinkedHashMap<>(); + Mapmap5=new LinkedHashMap<>(); + Mapmap6=new LinkedHashMap<>(); + + map1.put("age","20以下"); + map1.put("count",byAge.getOne()); + map2.put("age","20-30"); + map2.put("count",byAge.getTwo()); + map3.put("age","30-40"); + map3.put("count",byAge.getThree()); + map4.put("age","40-50"); + map4.put("count",byAge.getFour()); + map5.put("age","50-60"); + map5.put("count",byAge.getFive()); + map6.put("age","60以上"); + map6.put("count",byAge.getSix()); + map.add(map1); + map.add(map2); + map.add(map3); + map.add(map4); + map.add(map5); + map.add(map6); + return map; + } + + @Override + public List findEventsLastYear() { + DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd"); + LocalDate lastYear = LocalDate.now().minusYears(1); + LocalDate startOfYear = lastYear.withDayOfYear(1); + LocalDate endOfYear = lastYear.withDayOfYear(lastYear.lengthOfYear()); + String start = date.format(startOfYear); + String end = date.format(endOfYear); + return saleDataRepository.findBySddateBetween(start, end); + } + @Override + public List findEventsThisYear() { + DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd"); + LocalDate thisYear = LocalDate.now().minusYears(0); + LocalDate startOfYear = thisYear.withDayOfYear(1); + LocalDate endOfYear = thisYear.withDayOfYear(thisYear.lengthOfYear()); + String start = date.format(startOfYear); + String end = date.format(endOfYear); + return saleDataRepository.findBySddateBetween(start,end); + } + + @Override + public List> findByregion(List list) { + // 初始化每个省市的计数器 + Map regionCounts = new LinkedHashMap<>(); + String[] regions = { + "北京市", "天津市", "河北省", "山西省", "内蒙古自治区", "辽宁省", "吉林省", "黑龙江省", + "上海市", "江苏省", "浙江省", "安徽省", "福建省", "江西省", "山东省", "河南省", + "湖北省", "湖南省", "广东省", "广西壮族自治区", "海南省", "重庆市", "四川省", + "贵州省", "云南省", "西藏自治区", "陕西省", "甘肃省", "青海省", "宁夏回族自治区", + "新疆维吾尔自治区", "台湾省", "香港特别行政区", "澳门特别行政区" + }; + for (String region : regions) { + regionCounts.put(region, 0); + } + + // 遍历销售数据列表 + for (SaleData saleData : list) { + String certificateno = saleData.getCertificateno(); + if (certificateno.length() != 18) { + continue; + } + String region = IdCardUtil.getRegion(certificateno); + if (regionCounts.containsKey(region)) { + regionCounts.put(region, regionCounts.get(region) + 1); + } + } + + // 构建返回的结果列表 + List> mapList = new ArrayList<>(); + for (Map.Entry entry : regionCounts.entrySet()) { + Map map = new LinkedHashMap<>(); + map.put("region", entry.getKey()); + map.put("count", String.valueOf(entry.getValue())); + mapList.add(map); + } + + return mapList; + } + + + + @Override + public List> findBySaleMethod() { + List saleDataList = saleDataRepository.findAll(); + int[] saleMethodCounts = new int[5]; + Mapmap=new LinkedHashMap<>(); + for (SaleData saleData : saleDataList) { + String transactiontypeno = saleData.getTransactiontypeno(); + switch (transactiontypeno){ + case "SD01": + saleMethodCounts[0]++; + break; + case "SD02": + saleMethodCounts[1]++; + break; + case "SD03": + saleMethodCounts[2]++; + break; + case "SD04": + saleMethodCounts[3]++; + break; + case "SD05": + saleMethodCounts[4]++; + break; + default: + break; + } + } + map.put("一般销货", String.valueOf(saleMethodCounts[0])); + map.put("网络订单", String.valueOf(saleMethodCounts[1])); + map.put("特殊退票", String.valueOf(saleMethodCounts[2])); + map.put("预约单", String.valueOf(saleMethodCounts[3])); + map.put("快速购票", String.valueOf(saleMethodCounts[4])); + List>mapList=new ArrayList<>(); + for (Map.Entry stringStringEntry : map.entrySet()) { + Map map1=new LinkedHashMap<>(); + map1.put("transactiontypeno",stringStringEntry.getKey()); + map1.put("count",stringStringEntry.getValue()); + mapList.add(map1); + } + return mapList; + } + + @Override + public List> findWuyi(int x) { + DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd"); + LocalDate xYear = LocalDate.now().minusYears(x); + LocalDate month = xYear.withMonth(5); + LocalDate startOfMonth = month.withDayOfMonth(1); + LocalDate endOfMonth = month.withDayOfMonth(5); + String start = date.format(startOfMonth); + String end = date.format(endOfMonth); + List saleDataList = saleDataRepository.findBySddateBetween(start, end); + int[] Counts = new int[5]; + for (SaleData saleData : saleDataList) { + String sddate = saleData.getSddate(); + String substring = sddate.substring(6, 8); + switch (substring){ + case "01": + Counts[0]++; + break; + case "02": + Counts[1]++; + break; + case "03": + Counts[2]++; + break; + case "04": + Counts[3]++; + break; + case "05": + Counts[4]++; + break; + default: + break; + } + } + List>mapList=new ArrayList<>(); + Map map=new LinkedHashMap(); + map.put("第一天", String.valueOf(Counts[0])); + map.put("第二天", String.valueOf(Counts[1])); + map.put("第三天", String.valueOf(Counts[2])); + map.put("第四天", String.valueOf(Counts[3])); + map.put("第五天", String.valueOf(Counts[4])); + for (Map.Entry stringStringEntry : map.entrySet()) { + Map map1=new LinkedHashMap(); + map1.put("day",stringStringEntry.getKey()); + map1.put("count",stringStringEntry.getValue()); + mapList.add(map1); + } + return mapList; + } + + @Override + public List> findGuoqing(int x) { + DateTimeFormatter date = DateTimeFormatter.ofPattern("yyyyMMdd"); + LocalDate xYear = LocalDate.now().minusYears(x); + LocalDate month = xYear.withMonth(10); + LocalDate startOfMonth = month.withDayOfMonth(1); + LocalDate endOfMonth = month.withDayOfMonth(7); + String start = date.format(startOfMonth); + String end = date.format(endOfMonth); + List saleDataList = saleDataRepository.findBySddateBetween(start, end); + int[] Counts = new int[7]; + for (SaleData saleData : saleDataList) { + String sddate = saleData.getSddate(); + String substring = sddate.substring(6, 8); + switch (substring){ + case "01": + Counts[0]++; + break; + case "02": + Counts[1]++; + break; + case "03": + Counts[2]++; + break; + case "04": + Counts[3]++; + break; + case "05": + Counts[4]++; + break; + case "06": + Counts[5]++; + break; + case "07": + Counts[6]++; + break; + default: + break; + } + } + List>mapList=new ArrayList<>(); + Map map=new LinkedHashMap(); + map.put("第一天", String.valueOf(Counts[0])); + map.put("第二天", String.valueOf(Counts[1])); + map.put("第三天", String.valueOf(Counts[2])); + map.put("第四天", String.valueOf(Counts[3])); + map.put("第五天", String.valueOf(Counts[4])); + map.put("第六天", String.valueOf(Counts[5])); + map.put("第七天", String.valueOf(Counts[6])); + for (Map.Entry stringStringEntry : map.entrySet()) { + Map map1=new LinkedHashMap(); + map1.put("day",stringStringEntry.getKey()); + map1.put("count",stringStringEntry.getValue()); + mapList.add(map1); + } + return mapList; + } + + @Override + public String findrijun(String startTime) { + SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMdd"); + Calendar calendar = Calendar.getInstance(); + Date date1 = null; + try { + date1 = inputFormat.parse(startTime); + } catch (ParseException e) { +// throw new RuntimeException(e); + System.out.println("抛出日期转换异常"); + } + assert date1 != null; + calendar.setTime(date1); + calendar.add(Calendar.DAY_OF_YEAR, -29); + Mapmap = new LinkedHashMap<>(); + int count = 0; + while (!calendar.getTime().after(date1)){ + String date = inputFormat.format(calendar.getTime()); + long i = this.countBySddate(date); + count+=i; + calendar.add(Calendar.DAY_OF_YEAR, 1); + } + return String.valueOf(count/30); + } + + @Override + public BigDecimal findyearJun(List list) { + BigDecimal total=new BigDecimal(0); + for (SaleData saleData : list) { + BigDecimal amount = saleData.getAmount(); + total=total.add(amount); + } + return total; + } + + +} \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application-local.yaml b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application-local.yaml index 05aa78028..eb64b2abe 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application-local.yaml +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application-local.yaml @@ -1,5 +1,10 @@ --- #################### 数据库相关配置 #################### spring: + # mongodb数据源 + data: + mongodb: + uri: mongodb://root:123456@120.46.37.243:27017/admin?authMechanism=SCRAM-SHA-256 + database: sn-lundu-db # 数据源配置项 autoconfigure: exclude: diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application.yaml b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application.yaml index ae70cfad3..9c158807e 100644 --- a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application.yaml +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/application.yaml @@ -43,6 +43,25 @@ knife4j: setting: language: zh_cn +# MyBatis Plus 的配置项 +mybatis-plus: + configuration: + map-underscore-to-camel-case: true # 虽然默认为 true ,但是还是显示去指定下。 + global-config: + db-config: + id-type: NONE # “智能”模式,基于 IdTypeEnvironmentPostProcessor + 数据源的类型,自动适配成 AUTO、INPUT 模式。 + # id-type: AUTO # 自增 ID,适合 MySQL 等直接自增的数据库 + # id-type: INPUT # 用户输入 ID,适合 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库 + # id-type: ASSIGN_ID # 分配 ID,默认使用雪花算法。注意,Oracle、PostgreSQL、Kingbase、DB2、H2 数据库时,需要去除实体类上的 @KeySequence 注解 + logic-delete-value: 1 # 逻辑已删除值(默认为 1) + logic-not-delete-value: 0 # 逻辑未删除值(默认为 0) + banner: false # 关闭控制台的 Banner 打印 + type-aliases-package: ${yudao.info.base-package}.dal.dataobject + encryptor: + password: XDV71a+xqStEA3WH # 加解密的秘钥,可使用 https://www.imaegoo.com/2020/aes-key-generator/ 网站生成 + +mybatis-plus-join: + banner: false # 关闭控制台的 Banner 打印 # Spring Data Redis 配置 spring: @@ -57,12 +76,13 @@ easy-trans: is-enable-cloud: false # 禁用 TransType.RPC 微服务模式 + --- #################### 芋道相关配置 #################### yudao: info: version: 1.0.0 - base-package: cn.iocoder.yudao.module.ticket + base-package: cn.iocoder.yudao.module.datacenter swagger: title: 管理后台 description: 提供管理员管理的所有功能 diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/asset/AssetMapper.xml b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/asset/AssetMapper.xml new file mode 100644 index 000000000..b7f6844e5 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/asset/AssetMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/checkticket/CheckticketMapper.xml b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/checkticket/CheckticketMapper.xml new file mode 100644 index 000000000..aff2460b9 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/checkticket/CheckticketMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/saledata/SaleDataMapper.xml b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/saledata/SaleDataMapper.xml new file mode 100644 index 000000000..1a0c49966 --- /dev/null +++ b/ludu-module-datacenter/ludu-module-datacenter-biz/src/main/resources/mapper/saledata/SaleDataMapper.xml @@ -0,0 +1,12 @@ + + + + + + + \ No newline at end of file diff --git a/ludu-module-datacenter/pom.xml b/ludu-module-datacenter/pom.xml index 52ad262d1..44ae44ec2 100644 --- a/ludu-module-datacenter/pom.xml +++ b/ludu-module-datacenter/pom.xml @@ -14,6 +14,7 @@ ${project.artifactId} ludu-module-datacenter-biz + ludu-module-datacenter-api 大屏服务的数据 模块,我们放数据中心业务,只负责调用数据(读)。 diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application-local.yaml b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application-local.yaml index 05aa78028..eb64b2abe 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application-local.yaml +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application-local.yaml @@ -1,5 +1,10 @@ --- #################### 数据库相关配置 #################### spring: + # mongodb数据源 + data: + mongodb: + uri: mongodb://root:123456@120.46.37.243:27017/admin?authMechanism=SCRAM-SHA-256 + database: sn-lundu-db # 数据源配置项 autoconfigure: exclude: diff --git a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application.yaml b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application.yaml index 0e6f514bc..3f109836a 100644 --- a/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application.yaml +++ b/ludu-module-ticketing/ludu-module-ticketing-biz/src/main/resources/application.yaml @@ -2,7 +2,6 @@ spring: main: allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务 - # Servlet 配置 servlet: # 文件上传相关配置项 diff --git a/yudao-gateway/src/main/resources/application.yaml b/yudao-gateway/src/main/resources/application.yaml index f0b35af8d..912b36ef8 100644 --- a/yudao-gateway/src/main/resources/application.yaml +++ b/yudao-gateway/src/main/resources/application.yaml @@ -165,14 +165,20 @@ spring: - Path=/admin-api/crm/** filters: - RewritePath=/admin-api/crm/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs - ## ticket-manager 服务 + ## ticketing 服务 - id: ticket-admin-api # 路由的编号 uri: grayLb://ticket-server predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组 - Path=/admin-api/ticket/** filters: - RewritePath=/admin-api/ticket/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs - + ## datacenter 服务 + - id: datacenter-admin-api # 路由的编号 + uri: grayLb://datacenter-server + predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组 + - Path=/admin-api/datacenter/** + filters: + - RewritePath=/admin-api/datacenter/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs x-forwarded: prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀