大屏数据票务api

This commit is contained in:
XinWei 2024-07-23 16:34:44 +08:00
parent 06a1ea6b7d
commit 145b7e7a30
42 changed files with 1592 additions and 18 deletions

View File

@ -18,11 +18,12 @@ $(function(){
// 直接清理cookie直接设置过期 // 直接清理cookie直接设置过期
document.cookie = "ACCESS_TOKEN=; max-age=0; path=/xxl-job-admin"; document.cookie = "ACCESS_TOKEN=; max-age=0; path=/xxl-job-admin";
document.cookie = "REFRESH_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', icon: '2',
title: I18n.system_tips, 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) { /*$.post(base_url + "/logout", function(data, status) {
if (data.code == "200") { if (data.code == "200") {
layer.msg( I18n.logout_success ); layer.msg( I18n.logout_success );

View File

@ -86,12 +86,12 @@
<a href="javascript:" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false"> <a href="javascript:" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
<#-- ${I18n.system_welcome} ${Request["XXL_JOB_LOGIN_IDENTITY"].username}--> <#-- ${I18n.system_welcome} ${Request["XXL_JOB_LOGIN_IDENTITY"].username}-->
${I18n.system_welcome} <span id="authUsername"></span> ${I18n.system_welcome} <span id="authUsername"></span>
<#-- <span class="caret"></span>--> <span class="caret"></span>
</a> </a>
<#-- <ul class="dropdown-menu" role="menu">--> <ul class="dropdown-menu" role="menu">
<#-- <li id="updatePwd" ><a href="javascript:">${I18n.change_pwd}</a></li>--> <#-- <li id="updatePwd" ><a href="javascript:">${I18n.change_pwd}</a></li>-->
<#-- <li id="logoutBtn" ><a href="javascript:">${I18n.logout_btn}</a></li>--> <li id="logoutBtn" ><a href="javascript:">${I18n.logout_btn}</a></li>
<#-- </ul>--> </ul>
</li> </li>
</ul> </ul>
</div> </div>

View File

@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ludu-module-datacenter</artifactId>
<groupId>cn.iocoder.cloud</groupId>
<version>${revision}</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ludu-module-datacenter-api</artifactId>
<packaging>jar</packaging> <!-- 2. 新增 packaging 为 jar -->
<name>${project.artifactId}</name> <!-- 3. 新增 name 为 ${project.artifactId} -->
<description> <!-- 4. 新增 description 为该模块的描述 -->
数据中心 模块 API暴露给其它模块调用
</description>
<dependencies>
<!-- 新增 yudao-common 依赖 -->
<dependency>
<groupId>cn.iocoder.cloud</groupId>
<artifactId>yudao-common</artifactId>
</dependency>
<!-- Web 相关 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<scope>provided</scope>
</dependency>
<!-- 参数校验 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
<optional>true</optional>
</dependency>
<!-- RPC 远程调用相关 -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

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

View File

@ -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, "售票不存在");
}

View File

@ -12,12 +12,16 @@
<artifactId>ludu-module-datacenter-biz</artifactId> <artifactId>ludu-module-datacenter-biz</artifactId>
<dependencies> <dependencies>
<!-- 引入票务服务 -->
<dependency> <dependency>
<groupId>cn.iocoder.cloud</groupId> <groupId>cn.iocoder.cloud</groupId>
<artifactId>ludu-module-ticketing-api</artifactId> <artifactId>ludu-module-datacenter-api</artifactId>
<version>${revision}</version> <version>${revision}</version>
</dependency> </dependency>
<!-- mongodb -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
</dependency>
<!-- Spring Cloud 基础 --> <!-- Spring Cloud 基础 -->
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>

View File

@ -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.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -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<List<Map<String, String>>> countAsset() {
return success(assetService.countAsset());
}
@GetMapping("/name/{assettypename}")
@Operation(summary = "获取符合设备类型名的所有设备")
public CommonResult<List<AssetRespVO>> nameAsset(@PathVariable("assettypename") String assettypename) {
return success(assetService.nameAsset(assettypename));
}
}

View File

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

View File

@ -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<Long> checkTicketTotal(@PathVariable("day") String day) {
return success(checkTicketService.checkTicketTotal(day));
}
@GetMapping("/qushi/{day}")
@Operation(summary = "获取日期当天各个时段的检票人数")
public CommonResult<List<Map<String, String>>> findbytimetemp(@PathVariable("day") String day) {
return success(checkTicketService.findbytimetemp(day));
}
}

View File

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

View File

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

View File

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

View File

@ -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<Long> checkTicketTotal(@PathVariable("day") String day) {
return success(saleDataService.countBySddate(day));
}
@GetMapping("/thisyear/{startTime}")
@Operation(summary = "获得今年日期往前十天内的数据")
public CommonResult<List<Map<String, String>>> thisyearNum(@PathVariable("startTime") String startTime) {
return success(saleDataService.findCheckticketcountBytime(startTime));
}
@GetMapping("/lastyear/{startTime}")
@Operation(summary = "获得去年日期往前推十天的数据")
public CommonResult<List<Map<String, String>>> lastyearNum(@PathVariable("startTime") String startTime) {
return success(saleDataService.findCheckticketcountBytime(startTime));
}
@GetMapping("/gender")
@Operation(summary = "获得所有数据的男女数量")
public CommonResult<List<Map<String, String>>> findByGender() {
return success(saleDataService.findByGender());
}
@GetMapping("/age")
@Operation(summary = "获得所有数据的年龄分段和数量")
public CommonResult<List<Map<String, String>>> findByage() {
return success(saleDataService.findByAge());
}
@GetMapping("/lastyear/region")
@Operation(summary = "查询去年各个省份的人数")
public CommonResult<List<Map<String, String>>> lastyearfindByregion() {
return success(saleDataService.findByregion(saleDataService.findEventsLastYear()));
}
@GetMapping("/thisyear/region")
@Operation(summary = "查询今年各个省份的人数")
public CommonResult<List<Map<String, String>>> thisyearfindByregion() {
return success(saleDataService.findByregion(saleDataService.findEventsThisYear()));
}
@GetMapping("/salemethod")
@Operation(summary = "查询各个销售渠道的购票人数")
public CommonResult<List<Map<String, String>>> findBysaleMethod() {
return success(saleDataService.findBySaleMethod());
}
@GetMapping("/wuyi/{x}")
@Operation(summary = "查询最近前几年当年的五一期间的数据")
public CommonResult<List<Map<String, String>>> findByWuyi(@PathVariable("x") int x) {
return success(saleDataService.findWuyi(x));
}
@GetMapping("/guoqing/{x}")
@Operation(summary = "查询最近前几年当年的国庆期间的数据")
public CommonResult<List<Map<String, String>>> findByGuoqing(@PathVariable("x") int x) {
return success(saleDataService.findGuoqing(x));
}
@GetMapping("/rijunthisyear/{startTime}")
@Operation(summary = "查询今年对应日期的近三十天日均售票数量")
public CommonResult<String> findThisyearRijun(@PathVariable("startTime") String startTime) {
return success(saleDataService.findrijun(startTime));
}
@GetMapping("/rijunlastyear/{startTime}")
@Operation(summary = "查询去年对应日期的近三十天日均售票数量")
public CommonResult<String> findLastyearRijun(@PathVariable("startTime") String startTime) {
return success(saleDataService.findrijun(startTime));
}
// TODO 年度平均什么并没有说清楚原代码是直接计算一年的总金额
@GetMapping("/thisyear/nianjun")
@Operation(summary = "查询今年年度售票平均金额")
public CommonResult<BigDecimal> findmoneythisyear() {
return success(saleDataService.findyearJun(saleDataService.findEventsThisYear()));
}
@GetMapping("/lastyear/nianjun")
@Operation(summary = "查询去年年度售票平均金额")
public CommonResult<BigDecimal> findmoneylastyear() {
return success(saleDataService.findyearJun(saleDataService.findEventsLastYear()));
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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<Asset,String> {
List<Asset> findAllByAssettypename(String assettypename);
Asset findByDataId(String dataId);
List<Asset> findAllByIsOnline(String online);
}

View File

@ -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<CheckTicket,String> {
@Query("{'name': {'$regex': '?0', '$options': 'i'}}")
Page<CheckTicket> findByName(String q, PageRequest pageable);
int countByCheckticketdate(String day);
@Query("{'checktickettime':{'$gte': ?0, '$lt': ?1},'checkticketdate':{'$dt': ?2}}")
List<CheckTicket> findByTimestampBetweenAndCheckticketdate(String startTime, String endTime,String day);
List<CheckTicket>findByCheckticketdateAndChecktickettimeBetween(String day,String startTime, String endTime);
}

View File

@ -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<SaleData,String> {
/*@Query("{'name': {'$regex': '?0', '$options': 'i'}}")
Page<SaleData> 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}")
List<SaleData>findBySddateBetween(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();
}

View File

@ -1,12 +1,9 @@
package cn.iocoder.yudao.module.datacenter.framework.rpc.config; 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.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@EnableFeignClients(clients = {TicketAssetApi.class, TicketCheckTicketApi.class, TicketSaleDataApi.class}) @EnableFeignClients(clients = {})
public class RpcConfiguration { public class RpcConfiguration {
} }

View File

@ -18,6 +18,8 @@ public class SecurityConfiguration {
@Override @Override
public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) { public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) {
// TODO 暂时放行所有用于测试
registry.antMatchers("/**").permitAll();
// Swagger 接口文档 // Swagger 接口文档
registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据 registry.antMatchers("/v3/api-docs/**").permitAll() // 元数据
.antMatchers("/swagger-ui.html").permitAll(); // Swagger UI .antMatchers("/swagger-ui.html").permitAll(); // Swagger UI

View File

@ -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<Map<String, String>> countAsset();
/**
* 获取符合设备类型名的所有设备
* @param assettypename 设备类型名
* @return java.util.List<cn.iocoder.yudao.module.ticket.dal.dataobject.asset.AssetDO>
*/
public List<AssetRespVO> nameAsset(String assettypename);
}

View File

@ -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<Map<String, String>> countAsset() {
List<Asset> assetList = assetRepository.findAll();
int[] assetTypeCounts = new int[3];
Map<String, String> 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<Map<String,String>>mapList=new ArrayList<>();
for (Map.Entry<String, String> 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<AssetRespVO> nameAsset(String assettypename) {
List<AssetRespVO> 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;
}
}

View File

@ -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<java.util.Map<java.lang.String,java.lang.String>>
*/
public List<Map<String, String>> findbytimetemp(String day);
/**
* 获得日期当天的检票人数
* @param day 日期
* @return long 检票人数
*/
public long checkTicketTotal(String day);
}

View File

@ -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<Map<String, String>> findbytimetemp(String day) {
LocalDateTime startTime = LocalDateTime.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("HH:mm:ss");
List<Map<String, String>> mapList = new ArrayList<>();
for (int i = 0; i < 24; i++) {
Map<String,String>map =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<CheckTicket> 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);
}
}

View File

@ -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<java.util.Map>
*/
public List<Map<String,String>> findCheckticketcountBytime(String startTime);
/**
* 查询男女人数
* @return 男女人数
*/
public List<Map<String, String>> findByGender();
/**
* 查询各个年龄段的人数
* @return 各个年龄段的人数
*/
public List<Map<String, String>> findByAge();
/**
* 查询去年1月1日到12月31日的全部数据
* @return
*/
public List<SaleData> findEventsLastYear();
/**
* 查询今年1月1日到12月31日的全部数据
* @return
*/
public List<SaleData> findEventsThisYear();
/**
* 查询各个省份和人数
* @param list 售票数据
* @return 各个省份和人数
*/
public List<Map<String, String>> findByregion(List<SaleData> list);
/**
* 查询销售渠道
* @return
*/
public List<Map<String, String>> findBySaleMethod();
/**
* 查询最近前x年五一期间的数据
* @param x 前几年
*/
List<Map<String, String>> findWuyi(int x);
/**
* 查询最近前x年国庆期间的数据
* @param x 前几年
*/
List<Map<String, String>> findGuoqing(int x);
/**
* 查询今年的近三十天日均
* @param startTime 中间时间
* @return java.lang.Object
*/
String findrijun(String startTime);
/**
* 查年度平均
* @param list 一年的全部数据
* @return java.math.BigDecimal
*/
BigDecimal findyearJun(List<SaleData> list);
}

View File

@ -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<Map<String,String>> 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<String,String>>map = new ArrayList<>();
while (!calendar.getTime().after(date1)){
Map<String,String>map1= 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<Map<String, String>> findByGender() {
AggregationVO allByCertificateno = saleDataRepository.findAllByCertificateno();
List<Map<String, String>> map = new ArrayList<>();
Map<String,String>map1=new HashMap<>();
Map<String,String>map2=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<Map<String, String>> findByAge() {
AgeVo byAge = saleDataRepository.findByAge();
List<Map<String,String>>map=new ArrayList<>();
Map<String,String>map1=new LinkedHashMap<>();
Map<String,String>map2=new LinkedHashMap<>();
Map<String,String>map3=new LinkedHashMap<>();
Map<String,String>map4=new LinkedHashMap<>();
Map<String,String>map5=new LinkedHashMap<>();
Map<String,String>map6=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<SaleData> 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<SaleData> 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<Map<String, String>> findByregion(List<SaleData> list) {
// 初始化每个省市的计数器
Map<String, Integer> 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<Map<String, String>> mapList = new ArrayList<>();
for (Map.Entry<String, Integer> entry : regionCounts.entrySet()) {
Map<String, String> map = new LinkedHashMap<>();
map.put("region", entry.getKey());
map.put("count", String.valueOf(entry.getValue()));
mapList.add(map);
}
return mapList;
}
@Override
public List<Map<String, String>> findBySaleMethod() {
List<SaleData> saleDataList = saleDataRepository.findAll();
int[] saleMethodCounts = new int[5];
Map<String,String>map=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<Map<String,String>>mapList=new ArrayList<>();
for (Map.Entry<String, String> stringStringEntry : map.entrySet()) {
Map<String, String> map1=new LinkedHashMap<>();
map1.put("transactiontypeno",stringStringEntry.getKey());
map1.put("count",stringStringEntry.getValue());
mapList.add(map1);
}
return mapList;
}
@Override
public List<Map<String, String>> 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<SaleData> 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<Map<String,String>>mapList=new ArrayList<>();
Map<String,String> 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<Map<String, String>> 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<SaleData> 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<Map<String,String>>mapList=new ArrayList<>();
Map<String,String> 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);
Map<String,String>map = 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<SaleData> list) {
BigDecimal total=new BigDecimal(0);
for (SaleData saleData : list) {
BigDecimal amount = saleData.getAmount();
total=total.add(amount);
}
return total;
}
}

View File

@ -1,5 +1,10 @@
--- #################### 数据库相关配置 #################### --- #################### 数据库相关配置 ####################
spring: spring:
# mongodb数据源
data:
mongodb:
uri: mongodb://root:123456@120.46.37.243:27017/admin?authMechanism=SCRAM-SHA-256
database: sn-lundu-db
# 数据源配置项 # 数据源配置项
autoconfigure: autoconfigure:
exclude: exclude:

View File

@ -43,6 +43,25 @@ knife4j:
setting: setting:
language: zh_cn 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 Data Redis 配置
spring: spring:
@ -57,12 +76,13 @@ easy-trans:
is-enable-cloud: false # 禁用 TransType.RPC 微服务模式 is-enable-cloud: false # 禁用 TransType.RPC 微服务模式
--- #################### 芋道相关配置 #################### --- #################### 芋道相关配置 ####################
yudao: yudao:
info: info:
version: 1.0.0 version: 1.0.0
base-package: cn.iocoder.yudao.module.ticket base-package: cn.iocoder.yudao.module.datacenter
swagger: swagger:
title: 管理后台 title: 管理后台
description: 提供管理员管理的所有功能 description: 提供管理员管理的所有功能

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.ticket.dal.mysql.asset.AssetMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.ticket.dal.mysql.checkticket.CheckTicketMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.ticket.dal.mysql.saledata.SaleDataMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -14,6 +14,7 @@
<name>${project.artifactId}</name> <name>${project.artifactId}</name>
<modules> <modules>
<module>ludu-module-datacenter-biz</module> <module>ludu-module-datacenter-biz</module>
<module>ludu-module-datacenter-api</module>
</modules> </modules>
<description> <description>
大屏服务的数据 模块,我们放数据中心业务,只负责调用数据(读)。 大屏服务的数据 模块,我们放数据中心业务,只负责调用数据(读)。

View File

@ -1,5 +1,10 @@
--- #################### 数据库相关配置 #################### --- #################### 数据库相关配置 ####################
spring: spring:
# mongodb数据源
data:
mongodb:
uri: mongodb://root:123456@120.46.37.243:27017/admin?authMechanism=SCRAM-SHA-256
database: sn-lundu-db
# 数据源配置项 # 数据源配置项
autoconfigure: autoconfigure:
exclude: exclude:

View File

@ -2,7 +2,6 @@ spring:
main: main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务 allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
# Servlet 配置 # Servlet 配置
servlet: servlet:
# 文件上传相关配置项 # 文件上传相关配置项

View File

@ -165,14 +165,20 @@ spring:
- Path=/admin-api/crm/** - Path=/admin-api/crm/**
filters: filters:
- RewritePath=/admin-api/crm/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs - RewritePath=/admin-api/crm/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs
## ticket-manager 服务 ## ticketing 服务
- id: ticket-admin-api # 路由的编号 - id: ticket-admin-api # 路由的编号
uri: grayLb://ticket-server uri: grayLb://ticket-server
predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组 predicates: # 断言,作为路由的匹配条件,对应 RouteDefinition 数组
- Path=/admin-api/ticket/** - Path=/admin-api/ticket/**
filters: filters:
- RewritePath=/admin-api/ticket/v3/api-docs, /v3/api-docs # 配置,保证转发到 /v3/api-docs - 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: x-forwarded:
prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀 prefix-enabled: false # 避免 Swagger 重复带上额外的 /admin-api/system 前缀