1. 统一包名修改
This commit is contained in:
23
zt-module-report/pom.xml
Normal file
23
zt-module-report/pom.xml
Normal file
@@ -0,0 +1,23 @@
|
||||
<?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>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<modules>
|
||||
<module>zt-module-report-api</module>
|
||||
<module>zt-module-report-server</module>
|
||||
</modules>
|
||||
<artifactId>zt-module-report</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
report 模块,主要实现数据可视化报表等功能。
|
||||
</description>
|
||||
|
||||
</project>
|
||||
26
zt-module-report/zt-module-report-api/pom.xml
Normal file
26
zt-module-report/zt-module-report-api/pom.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?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>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-module-report</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>zt-module-report-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
report 模块 API,暴露给其它模块调用
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 占位,避免 api 目录无文件时,git 无法提交
|
||||
*/
|
||||
package com.zt.plat.module.report.api;
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.zt.plat.module.report.enums;
|
||||
|
||||
import com.zt.plat.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Report 错误码枚举类
|
||||
*
|
||||
* report 系统,使用 1-003-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== GoView 模块 1-003-000-000 ==========
|
||||
ErrorCode GO_VIEW_PROJECT_NOT_EXISTS = new ErrorCode(1_003_000_000, "GoView 项目不存在");
|
||||
|
||||
}
|
||||
19
zt-module-report/zt-module-report-server/Dockerfile
Normal file
19
zt-module-report/zt-module-report-server/Dockerfile
Normal file
@@ -0,0 +1,19 @@
|
||||
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
|
||||
|
||||
FROM 172.16.46.66:10043/base-service/eclipse-temurin:21-jre
|
||||
|
||||
## 创建目录,并使用它作为工作目录
|
||||
RUN mkdir -p /cloud-module-report-server
|
||||
WORKDIR /cloud-module-report-server
|
||||
## 将后端项目的 Jar 文件,复制到镜像中
|
||||
COPY ./target/cloud-module-report-server.jar app.jar
|
||||
|
||||
## 设置 TZ 时区
|
||||
## 设置 JAVA_OPTS 环境变量,可通过 docker run -e "JAVA_OPTS=" 进行覆盖
|
||||
ENV TZ=Asia/Shanghai JAVA_OPTS="-Xms512m -Xmx512m"
|
||||
|
||||
## 暴露后端项目的 48080 端口
|
||||
EXPOSE 48084
|
||||
|
||||
## 启动后端项目
|
||||
CMD java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar app.jar
|
||||
133
zt-module-report/zt-module-report-server/pom.xml
Normal file
133
zt-module-report/zt-module-report-server/pom.xml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,30 @@
|
||||
package com.zt.plat.module.report;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
/**
|
||||
* 项目的启动类
|
||||
*
|
||||
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
* 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
*
|
||||
* @author ZT
|
||||
*/
|
||||
@SpringBootApplication
|
||||
public class ReportServerApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
|
||||
SpringApplication.run(ReportServerApplication.class, args);
|
||||
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
// 如果你碰到启动的问题,请认真阅读 http://172.16.46.63:30888/quick-start/ 文章
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
package com.zt.plat.module.report.controller.admin.ajreport;
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.zt.plat.module.report.controller.admin.goview;
|
||||
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.report.controller.admin.goview.vo.data.GoViewDataGetBySqlReqVO;
|
||||
import com.zt.plat.module.report.controller.admin.goview.vo.data.GoViewDataRespVO;
|
||||
import com.zt.plat.module.report.service.goview.GoViewDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - GoView 数据", description = "提供 SQL、HTTP 等数据查询的能力")
|
||||
@RestController
|
||||
@RequestMapping("/report/go-view/data")
|
||||
@Validated
|
||||
public class GoViewDataController {
|
||||
|
||||
@Resource
|
||||
private GoViewDataService goViewDataService;
|
||||
|
||||
@RequestMapping("/get-by-sql")
|
||||
@Operation(summary = "使用 SQL 查询数据")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-data:get-by-sql')")
|
||||
public CommonResult<GoViewDataRespVO> getDataBySQL(@Valid @RequestBody GoViewDataGetBySqlReqVO reqVO) {
|
||||
return success(goViewDataService.getDataBySQL(reqVO.getSql()));
|
||||
}
|
||||
|
||||
@RequestMapping("/get-by-http")
|
||||
@Operation(summary = "使用 HTTP 查询数据", description = "这个只是示例接口,实际应该每个查询,都要写一个接口")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-data:get-by-http')")
|
||||
public CommonResult<GoViewDataRespVO> getDataByHttp(
|
||||
@RequestParam(required = false) Map<String, String> params,
|
||||
@RequestBody(required = false) String body) { // params、body 按照需要去接收,这里仅仅是示例
|
||||
GoViewDataRespVO respVO = new GoViewDataRespVO();
|
||||
// 1. 数据维度
|
||||
respVO.setDimensions(Arrays.asList("日期", "PV", "UV")); // PV 是每天访问次数;UV 是每天访问人数
|
||||
// 2. 明细数据列表
|
||||
// 目前通过随机的方式生成。一般来说,这里你可以写逻辑来实现数据的返回
|
||||
respVO.setSource(new LinkedList<>());
|
||||
for (int i = 1; i <= 12; i++) {
|
||||
String date = "2021-" + (i < 10 ? "0" + i : i);
|
||||
Integer pv = RandomUtil.randomInt(1000, 10000);
|
||||
Integer uv = RandomUtil.randomInt(100, 1000);
|
||||
respVO.getSource().add(MapUtil.<String, Object>builder().put("日期", date)
|
||||
.put("PV", pv).put("UV", uv).build());
|
||||
}
|
||||
return success(respVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.zt.plat.module.report.controller.admin.goview;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.framework.common.pojo.PageParam;
|
||||
import com.zt.plat.framework.common.pojo.PageResult;
|
||||
import com.zt.plat.module.report.controller.admin.goview.vo.project.GoViewProjectCreateReqVO;
|
||||
import com.zt.plat.module.report.controller.admin.goview.vo.project.GoViewProjectRespVO;
|
||||
import com.zt.plat.module.report.controller.admin.goview.vo.project.GoViewProjectUpdateReqVO;
|
||||
import com.zt.plat.module.report.convert.goview.GoViewProjectConvert;
|
||||
import com.zt.plat.module.report.dal.dataobject.goview.GoViewProjectDO;
|
||||
import com.zt.plat.module.report.service.goview.GoViewProjectService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
|
||||
import static com.zt.plat.framework.common.pojo.CommonResult.success;
|
||||
import static com.zt.plat.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "管理后台 - GoView 项目")
|
||||
@RestController
|
||||
@RequestMapping("/report/go-view/project")
|
||||
@Validated
|
||||
public class GoViewProjectController {
|
||||
|
||||
@Resource
|
||||
private GoViewProjectService goViewProjectService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建项目")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:create')")
|
||||
public CommonResult<Long> createProject(@Valid @RequestBody GoViewProjectCreateReqVO createReqVO) {
|
||||
return success(goViewProjectService.createProject(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新项目")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:update')")
|
||||
public CommonResult<Boolean> updateProject(@Valid @RequestBody GoViewProjectUpdateReqVO updateReqVO) {
|
||||
goViewProjectService.updateProject(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除 GoView 项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:delete')")
|
||||
public CommonResult<Boolean> deleteProject(@RequestParam("id") Long id) {
|
||||
goViewProjectService.deleteProject(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得项目")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:query')")
|
||||
public CommonResult<GoViewProjectRespVO> getProject(@RequestParam("id") Long id) {
|
||||
GoViewProjectDO project = goViewProjectService.getProject(id);
|
||||
return success(GoViewProjectConvert.INSTANCE.convert(project));
|
||||
}
|
||||
|
||||
@GetMapping("/my-page")
|
||||
@Operation(summary = "获得我的项目分页")
|
||||
@PreAuthorize("@ss.hasPermission('report:go-view-project:query')")
|
||||
public CommonResult<PageResult<GoViewProjectRespVO>> getMyProjectPage(@Valid PageParam pageVO) {
|
||||
PageResult<GoViewProjectDO> pageResult = goViewProjectService.getMyProjectPage(
|
||||
pageVO, getLoginUserId());
|
||||
return success(GoViewProjectConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user