first commit

This commit is contained in:
裴浩宇 2024-01-13 13:29:20 +08:00
commit 4a70bc82ce
2395 changed files with 214963 additions and 0 deletions

46
README.md Normal file
View File

@ -0,0 +1,46 @@
### 博客功能
- :tw-1f334: 采用了时下流行的若依前后分离版技术。
- :tw-1f38b: 缓存方案技术支持redis简洁严谨的代码逻辑 。
- :tw-1f363: 博客系统支持MySQL严格的数据库规范设计。
- :tw-1f375: 独具特色的评论回复功能,不依赖任何三方评论回复插件,课增强博客的互动性。
### 环境依赖
| 环境依赖 | 说明描述 |
| ------------------------ | ----------------------------- |
| 软件基础环境 | 服务器(例:1 vCPU 2 GiB 1Mbps+域名(例kiwipeach.cn) ,注意这里的域名需要备案才能够访问喔|
| 数据库 | MySQL |
| JDK | 推荐使用jdk1.8及1.8以上的版本 |
| Redis | 应用缓存 |
| node | 前端需要使用node环境启动前端服务其中请求转发可以使用前端提供转发工具当然也可以使用nginx看具体部署条件。 |
### 主要功能预览
#### 博客首页
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/pnkx/首页.jpg "在这里输入图片标题")
#### 博客文章列表
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/pnkx/文章列表.jpg "在这里输入图片标题")
#### 博客相册
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/pnkx/相册.jpg "在这里输入图片标题")
#### 博客友链
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/pnkx/友链.jpg "在这里输入图片标题")
#### 博客留言板
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/pnkx/留言板.jpg "在这里输入图片标题")
#### 博客后台管理
![输入图片说明](https://gitee.com/phyqxx/picture-warehouse/raw/master/pnkx/管理页面.jpg "在这里输入图片标题")
### 博客首页
网址:[https://pnkx.top](https://pnkx.top)

2
TempSSH.txt Normal file
View File

@ -0,0 +1,2 @@
cd /app/
sh start.sh restart

12
bin/clean.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 清理生成路径。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean
pause

12
bin/package.bat Normal file
View File

@ -0,0 +1,12 @@
@echo off
echo.
echo [信息] 打包Web工程生成war/jar包文件。
echo.
%~d0
cd %~dp0
cd ..
call mvn clean package -Dmaven.test.skip=true
pause

14
bin/run.bat Normal file
View File

@ -0,0 +1,14 @@
@echo off
echo.
echo [<5B><>Ϣ] <20><><EFBFBD><EFBFBD>Web<65><62><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../pnkx-admin/target
set JAVA_OPTS=-Xms256m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -jar %JAVA_OPTS% pnkx-admin.jar
cd bin
pause

176
pnkx-admin/pom.xml Normal file
View File

@ -0,0 +1,176 @@
<?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>pnkx</artifactId>
<groupId>com.pnkx</groupId>
<version>3.3.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<artifactId>pnkx-admin</artifactId>
<description>
web服务入口
</description>
<dependencies>
<!--图片压缩工具-->
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.8</version>
</dependency>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional> <!-- 表示依赖不会传递 -->
</dependency>
<!-- swagger2-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
</dependency>
<!--防止进入swagger页面报类型转换错误排除2.9.2中的引用手动增加1.5.21版本-->
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<!-- swagger2-UI-->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<!-- Mysql驱动包 -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!--引入websocket依赖 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
<!-- 核心模块-->
<dependency>
<groupId>com.pnkx</groupId>
<artifactId>pnkx-framework</artifactId>
</dependency>
<!-- 定时任务-->
<dependency>
<groupId>com.pnkx</groupId>
<artifactId>pnkx-quartz</artifactId>
</dependency>
<!-- 代码生成-->
<dependency>
<groupId>com.pnkx</groupId>
<artifactId>pnkx-generator</artifactId>
</dependency>
<!-- 博客模块-->
<dependency>
<groupId>com.pnkx</groupId>
<artifactId>pnkx-blog</artifactId>
</dependency>
<!-- 生活模块-->
<dependency>
<groupId>com.pnkx</groupId>
<artifactId>pnkx-life</artifactId>
</dependency>
<!--博客素材模块-->
<dependency>
<groupId>com.pnkx</groupId>
<artifactId>pnkx-material</artifactId>
<version>${pnkx.version}</version>
</dependency>
<!--html代码转字符串-->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.10.3</version>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>2.2.3</version>
<classifier>jdk15</classifier>
<!-- jdk版本 -->
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.1.1.RELEASE</version>
<configuration>
<fork>true</fork> <!-- 如果没有该配置devtools不会生效 -->
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warName>${project.artifactId}</warName>
</configuration>
</plugin>
</plugins>
<finalName>${project.artifactId}</finalName>
</build>
</project>

View File

@ -0,0 +1,17 @@
# 指定是基于哪个基础镜像
FROM openjdk:8
# 作者信息
MAINTAINER PNKX
# 挂载点声明
VOLUME /tmp
# 将本地的一个文件或目录,拷贝到容器的文件或目录里
ADD pnkx-admin.jar pnkx-admin.jar
# 将容器的8000端口暴露给外部访问。
EXPOSE 8068
# 当容器运行起来时执行使用运行jar的指令
ENTRYPOINT ["java", "-jar", "pnkx-admin.jar"]

View File

@ -0,0 +1,26 @@
package com.pnkx;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
/**
* 启动程序
*
* @author phy
*/
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class PnkxApplication {
public static void main(String[] args) {
SpringApplication.run(PnkxApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ pei你看雪博客管理系统启动成功 ლ(´ڡ`ლ)゙ \n" +
" _ \n" +
" | |\n" +
" _ __ _ __ | | ____ __ \n" +
" | '_ \\| '_ \\| |/ /\\ \\/ / \n" +
" | |_) | | | | < > < \n" +
" | .__/|_| |_|_|\\_\\/_/\\_\\ \n" +
" | | \n" +
" |_| \n");
}
}

View File

@ -0,0 +1,16 @@
package com.pnkx;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
/**
* web容器中进行部署
*
* @author phy
*/
public class PnkxServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(PnkxApplication.class);
}
}

View File

@ -0,0 +1,126 @@
package com.pnkx.web.config;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.pnkx.common.config.PnkxConfig;
import io.swagger.annotations.ApiOperation;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.ApiKey;
import springfox.documentation.service.AuthorizationScope;
import springfox.documentation.service.Contact;
import springfox.documentation.service.SecurityReference;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spi.service.contexts.SecurityContext;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* Swagger2的接口配置
*
* @author phy
*/
@Configuration
@EnableSwagger2
public class SwaggerConfig {
/**
* 系统基础配置
*/
@Autowired
private PnkxConfig pnkxConfig;
/**
* 是否开启swagger
*/
@Value("${swagger.enabled}")
private boolean enabled;
/**
* 设置请求的统一前缀
*/
@Value("${swagger.pathMapping}")
private String pathMapping;
/**
* 创建API
*/
@Bean
public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2)
// 是否启用Swagger
.enable(enabled)
// 用来创建该API的基本信息展示在文档的页面中自定义展示的信息
.apiInfo(apiInfo())
// 设置哪些接口暴露给Swagger展示
.select()
// 扫描所有有注解的api用这种方式更灵活
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
// 扫描指定包中的swagger注解
// .apis(RequestHandlerSelectors.basePackage("com.pnkx.project.tool.swagger"))
// 扫描所有 .apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
/* 设置安全模式swagger可以设置访问token */
.securitySchemes(securitySchemes())
.securityContexts(securityContexts())
.pathMapping(pathMapping);
}
/**
* 安全模式这里指定token通过Authorization头请求头传递
*/
private List<ApiKey> securitySchemes() {
List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
return apiKeyList;
}
/**
* 安全上下文
*/
private List<SecurityContext> securityContexts() {
List<SecurityContext> securityContexts = new ArrayList<>();
securityContexts.add(
SecurityContext.builder()
.securityReferences(defaultAuth())
.forPaths(PathSelectors.regex("^(?!auth).*$"))
.build());
return securityContexts;
}
/**
* 默认的安全上引用
*/
private List<SecurityReference> defaultAuth() {
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
List<SecurityReference> securityReferences = new ArrayList<>();
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
return securityReferences;
}
/**
* 添加摘要信息
*/
private ApiInfo apiInfo() {
// 用ApiInfoBuilder进行定制
return new ApiInfoBuilder()
// 设置标题
.title("标题pei你看雪博客管理_接口文档")
// 描述
.description("描述用于管理pei你看雪博客")
// 作者信息
.contact(new Contact(pnkxConfig.getName(), null, null))
// 版本
.version("版本号:" + pnkxConfig.getVersion())
.build();
}
}

View File

@ -0,0 +1,22 @@
package com.pnkx.web.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
/**
* @author PHY
* @Classname WebSocketConfig
* @Description TODO
* @Date 2021-03-11 10:56
* @Created by PHY
*/
@Configuration
public class WebSocketConfig {
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

View File

@ -0,0 +1,140 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysDictData;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxArticle;
import com.pnkx.domain.vo.PxArticleTypeVo;
import com.pnkx.domain.vo.PxArticleVo;
import com.pnkx.service.IPxArticleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 文章Controller
*
* @author phy
* @date 2021-01-26
*/
@Api("博客管理-文章管理")
@RestController
@RequestMapping("/admin/article")
public class PxAdminArticleController extends BaseController {
@Resource
private IPxArticleService pxArticleService;
/**
* 查询文章列表
*/
@ApiOperation("查询文章列表")
@Log(title = "查询文章列表")
@GetMapping("/list")
public TableDataInfo list(PxArticleVo pxArticle) {
startPage();
List<PxArticleVo> list = pxArticleService.selectPxArticleList(pxArticle);
return getDataTable(list);
}
/**
* 查询文章列表不包含内容
*/
@ApiOperation("查询文章列表不包含内容")
@Log(title = "查询文章列表不包含内容")
@GetMapping("/listArticleNotContent")
public TableDataInfo listArticleNotContent(PxArticleVo pxArticle) {
startPage();
List<PxArticleVo> list = pxArticleService.selectPxArticleNotContent(pxArticle);
return getDataTable(list);
}
/**
* 导出文章列表
*/
@ApiOperation("导出文章列表")
@Log(title = "导出文章列表", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxArticle pxArticle) {
List<PxArticleVo> list = pxArticleService.selectPxArticleList(pxArticle);
ExcelUtil<PxArticleVo> util = new ExcelUtil<>(PxArticleVo.class);
return util.exportExcel(list, "article");
}
/**
* 获取文章详细信息
*/
@ApiOperation("获取文章详细信息")
@Log(title = "获取文章详细信息")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(pxArticleService.getArticleById(id));
}
/**
* 新增文章
*/
@Log(title = "文章", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxArticleVo pxArticle) {
return AjaxResult.success(pxArticleService.insertPxArticle(pxArticle));
}
/**
* 修改文章
*/
@Log(title = "文章", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxArticleVo pxArticle) {
return toAjax(pxArticleService.updatePxArticle(pxArticle));
}
/**
* 删除文章
*/
@Log(title = "文章", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(pxArticleService.deletePxArticleByIds(ids));
}
/**
* 校验字典项标签键值唯一性
*
* @param dictData
* @return
*/
@RequestMapping("/dictDataCheckUniqueness")
public AjaxResult dictDataCheckUniqueness(SysDictData dictData) {
Integer res = pxArticleService.dictDataCheckUniqueness(dictData);
return AjaxResult.success(res);
}
/**
* 获取文章类型列表
*
* @param dictData
* @return
*/
@GetMapping("/getArticleTypeList")
public TableDataInfo list(SysDictData dictData) {
List<PxArticleTypeVo> list = pxArticleService.selectPxArticleByType(dictData);
return getDataTable(list);
}
/**
* 获取待办事项标签列表
*/
@PostMapping(value = "/getLabelList")
public AjaxResult getLabelList() {
return AjaxResult.success(pxArticleService.getLabelList());
}
}

View File

@ -0,0 +1,106 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysUser;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ip.IpLocation;
import com.pnkx.common.utils.ip.IpUtils;
import com.pnkx.domain.po.PxChatMessage;
import com.pnkx.service.IPxChatMemberService;
import com.pnkx.service.IPxChatMessageService;
import com.pnkx.web.websocket.controller.WebSocketController;
import com.pnkx.web.websocket.domain.MessageType;
import com.pnkx.web.websocket.domain.WebSocketMessage;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* ChatController
*
* @author 裴浩宇
* @version 1.0
* @date 2023/11/14 11:46
* @description 聊天控制器
*/
@Api("博客管理-聊天管理")
@RestController
@RequestMapping("/admin/chat")
public class PxAdminChatController {
@Resource
WebSocketController webSocketController;
@Resource
IPxChatMemberService pxChatMemberService;
@Resource
IPxChatMessageService pxChatMessageService;
/**
* 登录聊天室
*
* @return 新增结果
*/
@RequestMapping("/loginChat")
public AjaxResult loginChat(HttpServletRequest request) {
String ip = IpUtils.getIpAddr(request);
IpLocation location = IpUtils.getLocation(ip);
WebSocketMessage webSocketMessage = new WebSocketMessage();
SysUser user = SecurityUtils.getLoginUser().getUser();
user.setLocation(location);
webSocketMessage.setWebSocket(MessageType.LOGIN);
webSocketMessage.setUserId(user.getUserId().toString());
webSocketMessage.setMessage(user);
webSocketController.sendAllMessage(webSocketMessage);
return AjaxResult.success("新增成功", pxChatMemberService.loginChat(user));
}
/**
* 退出聊天室
* @return 新增结果
*/
@RequestMapping("/signOut")
public AjaxResult signOut() {
WebSocketMessage webSocketMessage = new WebSocketMessage();
webSocketMessage.setWebSocket(MessageType.LOG_OUT);
webSocketMessage.setUserId(SecurityUtils.getUserId().toString());
webSocketController.sendAllMessage(webSocketMessage);
pxChatMemberService.signOut(SecurityUtils.getUserId().toString());
return AjaxResult.success("退出成功");
}
/**
* 发送消息
*
* @param pxChatMessage 参数
* @return 发送结果
*/
@RequestMapping("/sendMessage")
public AjaxResult sendMessage(@RequestBody PxChatMessage pxChatMessage, HttpServletRequest request) {
SysUser user = SecurityUtils.getLoginUser().getUser();
pxChatMessage.setUserId(user.getUserId().toString());
pxChatMessage.setNickName(user.getNickName());
pxChatMessage.setAvatar(user.getAvatar());
String ip = IpUtils.getIpAddr(request);
IpLocation location = IpUtils.getLocation(ip);
pxChatMessage.setLocation(location);
WebSocketMessage webSocketMessage = new WebSocketMessage();
webSocketMessage.setWebSocket(MessageType.CHAT_MESSAGE);
webSocketMessage.setUserId(SecurityUtils.getUserId().toString());
webSocketMessage.setMessage(pxChatMessage);
webSocketController.sendAllMessage(webSocketMessage);
return AjaxResult.success("发送成功", pxChatMessageService.sendMessage(pxChatMessage));
}
/**
* 获取消息
*
* @return 获取消息
*/
@RequestMapping("/getMessageRecord")
public AjaxResult getMessageRecord() {
return AjaxResult.success("获取消息成功", pxChatMessageService.getMessageRecord());
}
}

View File

@ -0,0 +1,90 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.domain.po.PxBookkeepingRecord;
import com.pnkx.domain.po.PxDiary;
import com.pnkx.domain.po.PxNoteFolder;
import com.pnkx.domain.po.PxToDo;
import com.pnkx.domain.vo.PxArticleVo;
import com.pnkx.service.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 管理端controller
*
* @author phy
* @date 2021-10-30
*/
@RestController
@RequestMapping("/admin")
public class PxAdminController extends BaseController {
@Resource
IPxArticleService pxArticleService;
@Resource
IPxToDoService pxToDoService;
@Resource
IPxBookkeepingRecordService pxBookkeepingRecordService;
@Resource
IPxDiaryService pxDiaryService;
@Resource
private IPxNoteFolderService pxNoteFolderService;
/**
* 全文检索
*/
@GetMapping("/fullRetrieval")
public AjaxResult retrieval(String searchCode) {
logger.info("全文检索-检索条件为:" + searchCode);
List<Map<String, Object>> result = new ArrayList<>();
// 文章列表
PxArticleVo pxArticle = new PxArticleVo();
pxArticle.setSearchValue(searchCode);
pxArticle.setCreateBy(SecurityUtils.getUserId().toString());
List<PxArticleVo> pxArticles = pxArticleService.selectPxArticleNotContent(pxArticle);
Map<String, Object> article = new HashMap<>();
article.put("label", "博客文章");
article.put("options", pxArticles);
result.add(article);
// 待办事项
PxToDo pxToDo = new PxToDo();
pxToDo.setSearchValue(searchCode);
List<PxToDo> pxToDos = pxToDoService.selectPxToDoList(pxToDo);
Map<String, Object> todo = new HashMap<>();
todo.put("label", "待办事项");
todo.put("options", pxToDos);
result.add(todo);
// 生活账本
PxBookkeepingRecord pxBookkeepingRecord = new PxBookkeepingRecord();
pxBookkeepingRecord.setSearchValue(searchCode);
List<?> pxBookkeepingRecords = pxBookkeepingRecordService.selectPxBookkeepingRecordList(pxBookkeepingRecord).getRows();
Map<String, Object> bookkeeping = new HashMap<>();
bookkeeping.put("label", "生活账本");
bookkeeping.put("options", pxBookkeepingRecords);
result.add(bookkeeping);
// 日记
List<PxDiary> diaryList = pxDiaryService.retrieval(searchCode);
Map<String, Object> diary = new HashMap<>();
diary.put("label", "日记");
diary.put("options", diaryList);
result.add(diary);
// 笔记
PxNoteFolder pxNoteFolder = new PxNoteFolder();
pxNoteFolder.setName(searchCode);
List<PxNoteFolder> noteList = pxNoteFolderService.selectPxNoteFolderList(pxNoteFolder);
Map<String, Object> note = new HashMap<>();
note.put("label", "笔记");
note.put("options", noteList);
result.add(note);
return AjaxResult.success(result);
}
}

View File

@ -0,0 +1,82 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxFriendLink;
import com.pnkx.service.IPxFriendLinkService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author by PHY
* @Classname 友链Controller
* @date 2021-04-30 11:42
*/
@RestController
@RequestMapping("/admin/link")
public class PxAdminFriendLinkController extends BaseController {
@Resource
private IPxFriendLinkService pxFriendLinkService;
/**
* 查询友链列表
*/
@GetMapping("/list")
public TableDataInfo list(PxFriendLink pxFriendLink) {
startPage();
List<PxFriendLink> list = pxFriendLinkService.selectPxFriendLinkList(pxFriendLink);
return getDataTable(list);
}
/**
* 导出友链列表
*/
@Log(title = "友链", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxFriendLink pxFriendLink) {
List<PxFriendLink> list = pxFriendLinkService.selectPxFriendLinkList(pxFriendLink);
ExcelUtil<PxFriendLink> util = new ExcelUtil<>(PxFriendLink.class);
return util.exportExcel(list, "link");
}
/**
* 获取友链详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxFriendLinkService.selectPxFriendLinkById(id));
}
/**
* 新增友链
*/
@Log(title = "友链", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxFriendLink pxFriendLink) {
return toAjax(pxFriendLinkService.insertPxFriendLink(pxFriendLink));
}
/**
* 修改友链
*/
@Log(title = "友链", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxFriendLink pxFriendLink) {
return toAjax(pxFriendLinkService.updatePxFriendLink(pxFriendLink));
}
/**
* 删除友链
*/
@Log(title = "友链", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxFriendLinkService.deletePxFriendLinkByIds(ids));
}
}

View File

@ -0,0 +1,78 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ip.IpLocation;
import com.pnkx.common.utils.ip.IpUtils;
import com.pnkx.domain.po.PxLeaveMessage;
import com.pnkx.service.IPxMessageService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 留言Controller
*
* @author phy
* @date 2021-01-26
*/
@RestController
@RequestMapping("/admin/message")
public class PxAdminMessageController extends BaseController {
@Resource
private IPxMessageService pxMessageService;
/**
* 留言
*
* @param pxLeaveMessage 参数
* @return 留言结果
*/
@RequestMapping("/addMessage")
public AjaxResult addMessage(HttpServletRequest request, @RequestBody PxLeaveMessage pxLeaveMessage) {
String ipAddr = IpUtils.getIpAddr(request);
IpLocation location = IpUtils.getLocation(ipAddr);
pxLeaveMessage.setIp(ipAddr);
String rectangle = IpUtils.getRectangle(ipAddr);
pxLeaveMessage.setLocation(rectangle);
pxLeaveMessage.setCountry(location.getCountry());
pxLeaveMessage.setProvince(location.getProvince());
pxLeaveMessage.setCity(location.getCity());
return AjaxResult.success("留言成功", pxMessageService.addMessage(pxLeaveMessage));
}
/**
* 查询留言列表
*/
@GetMapping("/getMessageList")
public TableDataInfo list(PxLeaveMessage pxLeaveMessage) {
startPage();
List<PxLeaveMessage> list = pxMessageService.selectPxLeaveMessageList(pxLeaveMessage);
return getDataTable(list);
}
/**
* 查询留言审核
*/
@GetMapping("/getMessageExamine")
public TableDataInfo getMessageExamine(PxLeaveMessage pxLeaveMessage) {
startPage();
List<PxLeaveMessage> list = pxMessageService.selectPxLeaveMessageExamine(pxLeaveMessage);
return getDataTable(list);
}
/**
* 修改留言
*/
@Log(title = "留言", businessType = BusinessType.UPDATE)
@PutMapping("updateMessage")
public AjaxResult edit(@RequestBody PxLeaveMessage pxLeaveMessage) {
return toAjax(pxMessageService.updatePxLeaveMessage(pxLeaveMessage));
}
}

View File

@ -0,0 +1,95 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxPhoto;
import com.pnkx.service.IPxPhotoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 相册Controller
*
* @author phy
* @date 2021-02-05
*/
@RestController
@RequestMapping("/admin/photo")
public class PxAdminPhotoController extends BaseController {
@Resource
private IPxPhotoService pxPhotoService;
/**
* 获取相册列表
*
* @param params 参数
* @return 相册列表
*/
@PostMapping("/getAlbumList")
public AjaxResult getAlbumList(@RequestBody Map<String, Object> params) {
return AjaxResult.success(pxPhotoService.getAlbumList(params));
}
/**
* 查询相册列表
*/
@GetMapping("/list")
public TableDataInfo list(PxPhoto pxPhoto) {
startPage();
List<PxPhoto> list = pxPhotoService.selectPxPhotoList(pxPhoto);
return getDataTable(list);
}
/**
* 导出相册列表
*/
@Log(title = "相册", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxPhoto pxPhoto) {
List<PxPhoto> list = pxPhotoService.selectPxPhotoList(pxPhoto);
ExcelUtil<PxPhoto> util = new ExcelUtil<PxPhoto>(PxPhoto.class);
return util.exportExcel(list, "photo");
}
/**
* 获取相册详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(pxPhotoService.selectPxPhotoById(id));
}
/**
* 新增相册
*/
@Log(title = "相册", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxPhoto pxPhoto) {
return toAjax(pxPhotoService.insertPxPhoto(pxPhoto));
}
/**
* 修改相册
*/
@Log(title = "相册", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxPhoto pxPhoto) {
return toAjax(pxPhotoService.updatePxPhoto(pxPhoto));
}
/**
* 删除相册
*/
@Log(title = "相册", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(pxPhotoService.deletePxPhotoByIds(ids));
}
}

View File

@ -0,0 +1,96 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.domain.po.PxStatistics;
import com.pnkx.service.IPxStatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
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;
/**
* 统计Controller
*
* @author phy
* @date 2021-02-05
*/
@Api("博客管理-数据统计")
@RestController
@RequestMapping("/admin/statistics")
public class PxAdminStatisticsController extends BaseController {
@Resource
private IPxStatisticsService pxStatisticsService;
/**
* 获取统计数据
*
* @return
*/
@PostMapping(value = "/getStatistics")
public AjaxResult getStatistics() {
return AjaxResult.success(pxStatisticsService.getStatistics());
}
/**
* 获取折线图统计数据
*
* @return
*/
@ApiOperation("根据统计维度获取折线图统计数据")
@ApiImplicitParam(name = "statistics", value = "统计信息", dataType = "Statistics")
@PostMapping(value = "/getLineChart")
public AjaxResult getLineChart(@RequestBody PxStatistics params) {
logger.info(("根据统计维度获取统计数据,参数为:" + params.toString()));
List<Map<String, Object>> lineChart = pxStatisticsService.getLineChart(params);
logger.info("获取统计数据成功");
return AjaxResult.success(lineChart);
}
/**
* 获取饼状图统计数据
*
* @return
*/
@ApiOperation("获取饼状图统计数据")
@ApiImplicitParam(name = "statistics", value = "统计信息", dataType = "Statistics")
@PostMapping(value = "/getPieChart")
public AjaxResult getPieChart(@RequestBody PxStatistics params) {
logger.info("获取统计数据,参数为:" + params.toString());
Map<String, Object> pieChart = pxStatisticsService.getPieChart(params);
logger.info("获取统计数据成功");
return AjaxResult.success(pieChart);
}
/**
* 获取更多统计数据
*
* @return
*/
@ApiOperation("获取更多统计数据")
@ApiImplicitParam(name = "statistics", value = "统计信息", dataType = "Statistics")
@PostMapping(value = "/getMoreStatistics")
public AjaxResult getMoreStatistics(@RequestBody PxStatistics params) {
logger.info("获取更多统计数据,参数为:" + params.toString());
if (StringUtils.isNull(params.getStartDate())) {
logger.error("统计开始时间不能为空");
return AjaxResult.error("统计开始时间不能为空");
}
if (StringUtils.isNull(params.getEndDate())) {
logger.error("统计结束时间不能为空");
return AjaxResult.error("统计结束时间不能为空");
}
Map<String, Object> pieChart = pxStatisticsService.getMoreStatistics(params);
logger.info("获取更多统计数据");
return AjaxResult.success(pieChart);
}
}

View File

@ -0,0 +1,71 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.domain.po.PxSubscribe;
import com.pnkx.service.IPxSubscribeService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author by PHY
* @Classname PxAdminSubscribeController
* @date 2021-06-17 15:41
*/
@RestController
@RequestMapping("/admin/subscribe")
public class PxAdminSubscribeController extends BaseController {
@Resource
IPxSubscribeService pxSubscribeService;
/**
* 查询订阅列表
*/
@GetMapping("/list")
public TableDataInfo list(PxSubscribe pxSubscribe) {
startPage();
List<PxSubscribe> list = pxSubscribeService.selectPxSubscribeList(pxSubscribe);
return getDataTable(list);
}
/**
* 获取订阅详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxSubscribeService.selectPxSubscribeById(id));
}
/**
* 新增订阅
*/
@Log(title = "订阅", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxSubscribe pxSubscribe) {
return toAjax(pxSubscribeService.insertPxSubscribe(pxSubscribe));
}
/**
* 修改订阅
*/
@Log(title = "订阅", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxSubscribe pxSubscribe) {
return toAjax(pxSubscribeService.updatePxSubscribe(pxSubscribe));
}
/**
* 删除订阅
*/
@Log(title = "订阅", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxSubscribeService.deletePxSubscribeByIds(ids));
}
}

View File

@ -0,0 +1,91 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxVideo;
import com.pnkx.service.IPxVideoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 视频模块Controller
*
* @author 裴大头
* @date 2023-04-19
*/
@RestController
@RequestMapping("/admin/video")
public class PxAdminVideoController extends BaseController {
@Resource
private IPxVideoService pxVideoService;
/**
* 查询视频模块列表
*/
@GetMapping("/list")
public TableDataInfo list(PxVideo pxVideo) {
startPage();
List<PxVideo> list = pxVideoService.selectPxVideoList(pxVideo);
return getDataTable(list);
}
/**
* 导出视频模块列表
*/
@Log(title = "视频模块", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxVideo pxVideo) {
List<PxVideo> list = pxVideoService.selectPxVideoList(pxVideo);
ExcelUtil<PxVideo> util = new ExcelUtil<PxVideo>(PxVideo.class);
return util.exportExcel(list, "video");
}
/**
* 获取视频模块详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxVideoService.selectPxVideoById(id));
}
/**
* 新增视频模块
*/
@Log(title = "视频模块", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxVideo pxVideo) {
return toAjax(pxVideoService.insertPxVideo(pxVideo));
}
/**
* 修改视频模块
*/
@Log(title = "视频模块", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxVideo pxVideo) {
return toAjax(pxVideoService.updatePxVideo(pxVideo));
}
/**
* 删除视频模块
*/
@Log(title = "视频模块", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxVideoService.deletePxVideoByIds(ids));
}
/**
* 获取视频标签列表
*/
@GetMapping(value = "/getLabelList")
public AjaxResult getLabelList() {
return AjaxResult.success(pxVideoService.getLabelList());
}
}

View File

@ -0,0 +1,58 @@
package com.pnkx.web.controller.blog.admin;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxVisits;
import com.pnkx.service.IPxVisitsService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 访客Controller
*
* @author phy
* @date 2021-10-30
*/
@RestController
@RequestMapping("/admin/visits")
public class PxAdminVisitsController extends BaseController {
@Resource
private IPxVisitsService pxVisitsService;
/**
* 查询访客列表
*/
@GetMapping("/list")
public TableDataInfo list(PxVisits pxVisits) {
startPage();
List<PxVisits> list = pxVisitsService.selectPxVisitsList(pxVisits);
return getDataTable(list);
}
/**
* 导出访客列表
*/
@Log(title = "访客", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxVisits pxVisits) {
List<PxVisits> list = pxVisitsService.selectPxVisitsList(pxVisits);
ExcelUtil<PxVisits> util = new ExcelUtil<PxVisits>(PxVisits.class);
return util.exportExcel(list, "visits");
}
/**
* 删除访客
*/
@Log(title = "访客", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxVisitsService.deletePxVisitsByIds(ids));
}
}

View File

@ -0,0 +1,91 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.domain.vo.PxArticleVo;
import com.pnkx.service.IPxArticleService;
import io.swagger.annotations.ApiOperation;
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;
/**
* 文章表 前端控制器
*
* @author 裴浩宇
* @since 2021-01-10
*/
@RestController
@RequestMapping("/client/article")
public class PxClientArticleController extends BaseController {
@Resource
private IPxArticleService pxArticleService;
/**
* 获取文章详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(pxArticleService.getArticleById(id));
}
/**
* 查询文章列表
*/
@ApiOperation("查询文章列表")
@Log(title = "查询文章列表")
@GetMapping("/list")
public TableDataInfo list(PxArticleVo pxArticle) {
pxArticle.setOpen("1");
startPage();
List<PxArticleVo> list = pxArticleService.selectPxArticleList(pxArticle);
return getDataTable(list);
}
/**
* 查询文章列表不包括内容
*/
@GetMapping("/listNotContent")
public TableDataInfo listNotContent(PxArticleVo pxArticle) {
pxArticle.setOpen("1");
startPage();
List<PxArticleVo> list = pxArticleService.selectPxArticleNotContent(pxArticle);
return getDataTable(list);
}
/**
* 查询文章列表格式化内容
*/
@GetMapping("/listOrdinaryContent")
public TableDataInfo listOrdinaryContent(PxArticleVo pxArticle) {
pxArticle.setOpen("1");
startPage();
List<PxArticleVo> list = pxArticleService.selectPxArticleOrdinaryContent(pxArticle);
return getDataTable(list);
}
/**
* 获取推荐文章
*
* @return
*/
@GetMapping("/getHotArticle")
public AjaxResult getHotArticle() {
return AjaxResult.success("获取推荐文章成功", pxArticleService.getHotArticle());
}
/**
* 文章按类型分组
*/
@GetMapping("/getArticleListGroupByType")
public AjaxResult getArticleListGroupByType() {
return AjaxResult.success(pxArticleService.getArticleListGroupByType());
}
}

View File

@ -0,0 +1,168 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysDictData;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.common.utils.ip.IpUtils;
import com.pnkx.domain.po.PxRegion;
import com.pnkx.domain.po.PxSubscribe;
import com.pnkx.service.IPxRegionService;
import com.pnkx.service.IPxStatisticsService;
import com.pnkx.service.IPxSubscribeService;
import com.pnkx.system.domain.SysConfig;
import com.pnkx.system.domain.SysFile;
import com.pnkx.system.domain.SysNotice;
import com.pnkx.system.domain.vo.SysNoticeVo;
import com.pnkx.system.service.*;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author by PHY
* @Classname PxCustomerController
* @date 2021-03-24 11:44
*/
@RequestMapping("/client")
@RestController
public class PxClientController extends BaseController {
@Resource
private IPxSubscribeService pxSubscribeService;
@Resource
private IPxStatisticsService pxStatisticsService;
@Resource
private ISysConfigService sysConfigService;
@Resource
private ISysDictDataService sysDictDataService;
@Resource
private ISysFileService sysFileService;
@Resource
private ISysDictTypeService dictTypeService;
@Resource
private ISysNoticeService noticeService;
@Resource
private IPxRegionService pxRegionService;
/**
* 获取ip
*
* @param request request
* @return ip
*/
@GetMapping("/getIpLocation")
public AjaxResult getIp(HttpServletRequest request) {
String ip = IpUtils.getIpAddr(request);
return AjaxResult.success(IpUtils.getLocation(ip));
}
/**
* 添加订阅
*
* @param pxSubscribe pxSubscribe
* @return 订阅结果
*/
@PostMapping("/addSubscribe")
public AjaxResult addSubscribe(@RequestBody PxSubscribe pxSubscribe) {
return AjaxResult.success(pxSubscribeService.insertPxSubscribe(pxSubscribe));
}
/**
* 获取随机图片
* @param sysFile 参数
* @return 随机图片
*/
@GetMapping("/getGalleryPicture")
public TableDataInfo list(SysFile sysFile, Boolean isRandom) {
sysFile.setType("tk");
List<SysFile> list;
if (isRandom) {
list = sysFileService.getRandomPicture(15);
} else {
startPage();
list = sysFileService.selectSysFileList(sysFile);
}
return getDataTable(list);
}
/**
* 获取博客信息
*
* @return 博客信息
*/
@GetMapping(value = "/getBlogInfo")
public AjaxResult getBlogInfo() {
Map<String, Object> result = pxStatisticsService.getStatistics();
SysDictData sysDictData = new SysDictData();
sysDictData.setDictType("px_article_type");
result.put("articleTypeNumber", sysDictDataService.selectDictDataList(sysDictData).size());
SysConfig sysConfig = new SysConfig();
sysConfig.setConfigType("blog");
result.put("blogConfig", sysConfigService.selectConfigList(sysConfig));
return AjaxResult.success(result);
}
/**
* 文件浏览+1
*/
@GetMapping(value = "/file/browse/{id}")
public AjaxResult browse(@PathVariable("id") Long id) {
return AjaxResult.success(sysFileService.browse(id));
}
/**
* 文件点赞+1
*/
@GetMapping(value = "/file/like/{id}")
public AjaxResult like(@PathVariable("id") Long id) {
return AjaxResult.success(sysFileService.like(id));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/dictType/{dictType}")
public AjaxResult dictType(@PathVariable String dictType) {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) {
data = new ArrayList<>();
}
return AjaxResult.success(data);
}
/**
* 获取博客通知公告列表
*/
@GetMapping("/getNoticeList")
public AjaxResult getClientNoticeList() {
SysNotice sysNotice = new SysNotice();
// 博客通知类型
sysNotice.setNoticeType("bktz");
List<SysNoticeVo> list = noticeService.selectNoticeList(sysNotice);
return AjaxResult.success(list);
}
/**
* 根据通知公告编号获取详细信息
*/
@GetMapping(value = "/getNotice/{noticeId}")
public AjaxResult getInfo(HttpServletRequest request, @PathVariable Long noticeId) {
return AjaxResult.success(noticeService.selectNoticeById(request, noticeId));
}
/**
* 获取地区信息列表
* @param pxRegion 地区信息
* @return 地区信息列表
*/
@GetMapping(value = "/getRegionList")
public AjaxResult getRegionList(PxRegion pxRegion) {
return AjaxResult.success(pxRegionService.getRegionList(pxRegion));
}
}

View File

@ -0,0 +1,70 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.exception.ServiceException;
import com.pnkx.common.utils.template.TemplateUtils;
import com.pnkx.domain.po.PxFriendLink;
import com.pnkx.service.IPxFriendLinkService;
import com.pnkx.system.domain.SysEmail;
import com.pnkx.system.service.ISysConfigService;
import com.pnkx.system.service.ISysEmailService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author by PHY
* @Classname 友链Controller
* @date 2021-04-30 11:42
*/
@RestController
@RequestMapping("/client/link")
public class PxClientFriendLinkController extends BaseController {
@Resource
private IPxFriendLinkService pxFriendLinkService;
@Resource
private ISysEmailService sysEmailService;
@Resource
private ISysConfigService configService;
/**
* 获取友情链接
*
* @return
*/
@GetMapping("/list")
public AjaxResult getFriendLink(PxFriendLink pxFriendLink) {
return AjaxResult.success(pxFriendLinkService.selectPxFriendLinkList(pxFriendLink));
}
/**
* 新增友链
*/
@Log(title = "友链", businessType = BusinessType.INSERT)
@PostMapping("/addLink")
public AjaxResult add(@RequestBody PxFriendLink pxFriendLink) {
SysEmail sysEmail = new SysEmail();
String activationTemplate = TemplateUtils.getTemplate("link");
activationTemplate = activationTemplate.replace("template-lineTheme", pxFriendLink.getTitle() + "的博主申请友链");
activationTemplate = activationTemplate.replace("template-lineTitle", pxFriendLink.getTitle());
activationTemplate = activationTemplate.replace("template-lineRemark", pxFriendLink.getRemark());
activationTemplate = activationTemplate.replace("template-lineUrl", pxFriendLink.getUrl());
activationTemplate = activationTemplate.replace("template-lineImg", pxFriendLink.getImg());
activationTemplate = activationTemplate.replace("template-lineEmail", pxFriendLink.getEmail());
String siteEmail = configService.selectConfigByKey("siteEmail");
String[] emails = siteEmail.split(",");
sysEmail.setReceiverEmail(emails[0]);
sysEmail.setCcEmail(emails[1]);
sysEmail.setSubject("\uD83D\uDC49 叮咚「Pei你看雪博客」上有人申请友链");
sysEmail.setContent(activationTemplate);
try {
sysEmailService.sendMail(sysEmail);
} catch (Exception e) {
throw new ServiceException("发送邮件异常");
}
return toAjax(pxFriendLinkService.insertPxFriendLink(pxFriendLink));
}
}

View File

@ -0,0 +1,56 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.domain.po.PxLikeRecord;
import com.pnkx.service.IPxLikeRecordService;
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;
/**
* 点赞记录Controller
*
* @author pnkx
* @date 2023-08-25
*/
@RestController
@RequestMapping("/client/like")
public class PxClientLikeController extends BaseController {
@Resource
private IPxLikeRecordService pxLikeRecordService;
/**
* 查询点赞记录列表
*/
@GetMapping("/list")
public AjaxResult list(PxLikeRecord pxLikeRecord) {
List<PxLikeRecord> list = pxLikeRecordService.selectPxLikeRecordList(pxLikeRecord);
return AjaxResult.success(list);
}
/**
* 文章点赞
*/
@Log(title = "点赞记录", businessType = BusinessType.INSERT)
@GetMapping("/likeArticle/{id}")
public AjaxResult likeArticle(@PathVariable("id") Long id) {
return AjaxResult.success(pxLikeRecordService.like(id, "0"));
}
/**
* 评论点赞
*/
@Log(title = "点赞记录", businessType = BusinessType.INSERT)
@GetMapping("/likeComment/{id}")
public AjaxResult likeComment(@PathVariable("id") Long id) {
return AjaxResult.success(pxLikeRecordService.like(id, "1"));
}
}

View File

@ -0,0 +1,35 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.domain.po.PxLeaveMessage;
import com.pnkx.service.IPxMessageService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* 留言Controller
*
* @author phy
* @date 2021-01-26
*/
@RestController
@RequestMapping("/client/message")
public class PxClientMessageController extends BaseController {
@Resource
private IPxMessageService pxAdminMessageService;
/**
* 查询留言列表
*/
@GetMapping("/getMessageList")
public TableDataInfo list(PxLeaveMessage pxLeaveMessage) {
startPage();
List<PxLeaveMessage> list = pxAdminMessageService.selectPxLeaveMessageList(pxLeaveMessage);
return getDataTable(list);
}
}

View File

@ -0,0 +1,95 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxPhoto;
import com.pnkx.service.IPxPhotoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* 相册Controller
*
* @author phy
* @date 2021-02-05
*/
@RestController
@RequestMapping("/client/photo")
public class PxClientPhotoController extends BaseController {
@Resource
private IPxPhotoService pxPhotoService;
/**
* 查询相册列表
*/
@GetMapping("/list")
public TableDataInfo list(PxPhoto pxPhoto) {
startPage();
List<PxPhoto> list = pxPhotoService.selectPxPhotoList(pxPhoto);
return getDataTable(list);
}
/**
* 导出相册列表
*/
@Log(title = "相册", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxPhoto pxPhoto) {
List<PxPhoto> list = pxPhotoService.selectPxPhotoList(pxPhoto);
ExcelUtil<PxPhoto> util = new ExcelUtil<PxPhoto>(PxPhoto.class);
return util.exportExcel(list, "photo");
}
/**
* 获取相册详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") String id) {
return AjaxResult.success(pxPhotoService.selectPxPhotoById(id));
}
/**
* 新增相册
*/
@Log(title = "相册", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxPhoto pxPhoto) {
return toAjax(pxPhotoService.insertPxPhoto(pxPhoto));
}
/**
* 修改相册
*/
@Log(title = "相册", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxPhoto pxPhoto) {
return toAjax(pxPhotoService.updatePxPhoto(pxPhoto));
}
/**
* 删除相册
*/
@Log(title = "相册", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable String[] ids) {
return toAjax(pxPhotoService.deletePxPhotoByIds(ids));
}
/**
* 获取相册列表
*
* @param params
* @return
*/
@RequestMapping("/getAlbumList")
public AjaxResult getAlbumList(@RequestBody Map<String, Object> params) {
return AjaxResult.success(pxPhotoService.getAlbumList(params));
}
}

View File

@ -0,0 +1,45 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.domain.po.PxVideo;
import com.pnkx.service.IPxVideoService;
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;
/**
* 视频模块Controller
*
* @author 裴大头
* @date 2023-04-19
*/
@RestController
@RequestMapping("/client/video")
public class PxClientVideoController extends BaseController {
@Resource
private IPxVideoService pxVideoService;
/**
* 查询视频模块列表
*/
@GetMapping("/list")
public TableDataInfo list(PxVideo pxVideo) {
startPage();
List<PxVideo> list = pxVideoService.selectPxVideoList(pxVideo);
return getDataTable(list);
}
/**
* 获取视频模块详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxVideoService.selectPxVideoById(id));
}
}

View File

@ -0,0 +1,48 @@
package com.pnkx.web.controller.blog.client;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ip.IpLocation;
import com.pnkx.common.utils.ip.IpUtils;
import com.pnkx.domain.po.PxVisits;
import com.pnkx.service.IPxVisitsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
/**
* 访客Controller
*
* @author phy
* @date 2021-10-30
*/
@RestController
@RequestMapping("/client/visits")
public class PxClientVisitsController extends BaseController {
@Resource
private IPxVisitsService pxVisitsService;
/**
* 新增访客
*/
@Log(title = "访客", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(HttpServletRequest request) {
String ip = IpUtils.getIpAddr(request);
IpLocation location = IpUtils.getLocation(ip);
PxVisits pxVisits = new PxVisits();
pxVisits.setIp(ip);
pxVisits.setCountry(location.getCountry());
pxVisits.setProvince(location.getProvince());
pxVisits.setCity(location.getCity());
pxVisits.setIsp(location.getIsp());
pxVisits.setLocation(IpUtils.getRectangle(ip));
return toAjax(pxVisitsService.insertPxVisits(pxVisits));
}
}

View File

@ -0,0 +1,79 @@
package com.pnkx.web.controller.common;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import javax.imageio.ImageIO;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.FastByteArrayOutputStream;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import com.google.code.kaptcha.Producer;
import com.pnkx.common.constant.Constants;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.redis.RedisCache;
import com.pnkx.common.utils.sign.Base64;
import com.pnkx.common.utils.uuid.IdUtils;
/**
* 验证码操作处理
*
* @author phy
*/
@RestController
public class CaptchaController {
@Resource(name = "captchaProducer")
private Producer captchaProducer;
@Resource(name = "captchaProducerMath")
private Producer captchaProducerMath;
@Autowired
private RedisCache redisCache;
// 验证码类型
@Value("${pnkx.captchaType}")
private String captchaType;
/**
* 生成验证码
*/
@GetMapping("/captchaImage")
public AjaxResult getCode(HttpServletResponse response) throws IOException {
// 保存验证码信息
String uuid = IdUtils.simpleUUID();
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
String capStr = null, code = null;
BufferedImage image = null;
// 生成验证码
if ("math".equals(captchaType)) {
String capText = captchaProducerMath.createText();
capStr = capText.substring(0, capText.lastIndexOf("@"));
code = capText.substring(capText.lastIndexOf("@") + 1);
image = captchaProducerMath.createImage(capStr);
} else if ("char".equals(captchaType)) {
capStr = code = captchaProducer.createText();
image = captchaProducer.createImage(capStr);
}
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
// 转换流信息写出
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
try {
ImageIO.write(image, "jpg", os);
} catch (IOException e) {
return AjaxResult.error(e.getMessage());
}
AjaxResult ajax = AjaxResult.success();
ajax.put("uuid", uuid);
ajax.put("img", Base64.encode(os.toByteArray()));
return ajax;
}
}

View File

@ -0,0 +1,148 @@
package com.pnkx.web.controller.common;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.pnkx.common.constant.WebsiteAddressConstants;
import com.pnkx.common.utils.file.FileTypeUtils;
import com.pnkx.common.utils.file.MimeTypeUtils;
import com.pnkx.system.domain.SysFile;
import com.pnkx.system.service.ISysFileService;
import net.coobird.thumbnailator.Thumbnails;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import com.pnkx.common.config.PnkxConfig;
import com.pnkx.common.constant.Constants;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.common.utils.file.FileUploadUtils;
import com.pnkx.common.utils.file.FileUtils;
import com.pnkx.framework.config.ServerConfig;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Objects;
import static com.pnkx.web.controller.system.SysFileController.deleteFile;
/**
* 通用请求处理
*
* @author phy
*/
@RestController
public class CommonController {
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
@Resource
private ISysFileService sysFileService;
@Resource
private ServerConfig serverConfig;
/**
* 通用下载请求
*
* @param fileName 文件名称
* @param delete 是否删除
*/
@GetMapping("common/download")
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request) {
try {
if (!FileUtils.checkAllowDownload(fileName)) {
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
}
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
String filePath = PnkxConfig.getDownloadPath() + fileName;
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
FileUtils.writeBytes(filePath, response.getOutputStream());
if (delete) {
FileUtils.deleteFile(filePath);
}
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
/**
* 通用上传请求
*/
@PostMapping("/common/upload")
public AjaxResult uploadFile(MultipartFile file, String fileType, String uploadPath) {
try {
// 上传并返回新文件名称
String path = sysFileService.uploadMultipartFile(file, uploadPath);
SysFile sysFile = new SysFile();
sysFile.setPath(path);
sysFile.setType(fileType);
sysFile.setUrl(WebsiteAddressConstants.FTP_SITE_ADDRESS + path);
sysFile.setName(file.getOriginalFilename());
sysFile.setPort("博客管理端");
// 图片压缩(大小超过1M)
if (Arrays.asList(MimeTypeUtils.IMAGE_EXTENSION).contains(FileTypeUtils.getFileType(Objects.requireNonNull(file.getOriginalFilename()))) && file.getSize() > 1024*1024) {
// 上传文件路径
String filePath = PnkxConfig.getUploadPath();
String thumbnail = filePath + File.separator + "thumbnail" + File.separator + file.getOriginalFilename();
File thumbnailPath = new File(filePath + File.separator + "thumbnail");
if (!thumbnailPath.exists()) {
thumbnailPath.mkdirs();
}
File fileTemp = FileUtils.convert(file);
Thumbnails.of(fileTemp)
.size(128, 128)
.toFile(thumbnail);
File thumbnailFile = new File(thumbnail);
String thumbnailUrl = sysFileService.uploadFile(thumbnailFile, null, "thumbnail-" + file.getOriginalFilename());
sysFile.setThumbnail(WebsiteAddressConstants.FTP_SITE_ADDRESS + thumbnailUrl);
deleteFile(thumbnailFile);
}
sysFileService.insertSysFile(sysFile);
AjaxResult ajax = AjaxResult.success();
ajax.put("fileId", sysFile.getId());
ajax.put("fileName", sysFile.getName());
ajax.put("url", sysFile.getUrl());
ajax.put("thumbnail", sysFile.getThumbnail());
return ajax;
} catch (Exception e) {
return AjaxResult.error(e.getMessage());
}
}
/**
* 本地资源通用下载
*/
@GetMapping("/common/download/resource")
public void resourceDownload(String resource, HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
if (!FileUtils.checkAllowDownload(resource)) {
throw new Exception(StringUtils.format("资源文件({})非法,不允许下载。 ", resource));
}
// 本地资源路径
String localPath = PnkxConfig.getProfile();
// 数据库资源地址
String downloadPath = localPath + StringUtils.substringAfter(resource, Constants.RESOURCE_PREFIX);
// 下载名称
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, downloadName);
FileUtils.writeBytes(downloadPath, response.getOutputStream());
} catch (Exception e) {
log.error("下载文件失败", e);
}
}
}

View File

@ -0,0 +1,34 @@
package com.pnkx.web.controller.common;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.enums.OperatorType;
import com.pnkx.common.utils.ip.IpUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/**
* 开放式接口Controller
*
* @author phy
* @date 2021-10-30
*/
@RestController
@RequestMapping("/open")
public class OpenController extends BaseController {
/**
* 获取ip
*/
@ApiOperation("获取IP")
@Log(title = "获取IP", operatorType = OperatorType.OTHER)
@GetMapping("/getIp")
public AjaxResult getIp(HttpServletRequest request) {
return AjaxResult.success("获取IP成功", IpUtils.getIpAddr(request));
}
}

View File

@ -0,0 +1,44 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.domain.po.PxCommemorationDay;
import com.pnkx.service.IPxCommemorationDayService;
import com.pnkx.service.IPxMenstruationRecordService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
/**
* @author by PHY
* @classname PxHomepageController
* @date 2022/4/6 17:40
* @description: 描述
*/
@RestController
@RequestMapping("/homepage")
public class PxAppHomepageController extends BaseController {
@Resource
IPxCommemorationDayService pxCommemorationDayService;
@Resource
private IPxMenstruationRecordService pxMenstruationRecordService;
/**
* APP首页查询纪念日列表
*/
@GetMapping("/getCommemorationDayList")
public AjaxResult getCommemorationDayList(PxCommemorationDay pxCommemorationDay) {
return AjaxResult.success("获取首页纪念日列表成功", pxCommemorationDayService.getCommemorationDayList(pxCommemorationDay));
}
/**
* APP首页获取姨妈提醒列表
*/
@GetMapping("/selectMenstruationRecordList")
public AjaxResult selectMenstruationRecordList(com.pnkx.domain.po.PxMenstruationRecord pxMenstruationRecord) {
return AjaxResult.success("获取首页姨妈提醒列表成功", pxMenstruationRecordService.selectMenstruationRecordList(pxMenstruationRecord));
}
}

View File

@ -0,0 +1,88 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.domain.po.PxBookkeepingAccount;
import com.pnkx.domain.po.PxBookkeepingClassification;
import com.pnkx.service.IPxBookKeepingAccountService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author by PHY
* @classname PxAdminBookkeepingAccountController
* @date 2021-11-08 21:01
* @description: 描述
*/
@Api("生活工具-生活账本-账户管理")
@RestController
@RequestMapping("/bookkeeping/account")
public class PxBookkeepingAccountController extends BaseController {
@Resource
private IPxBookKeepingAccountService pxBookkeepingAccountService;
/**
* 查询最近使用账户列表
*/
@ApiOperation("查询最近使用账户列表")
@Log(title = "查询最近使用账户列表")
@GetMapping("/getLatelyAccountList")
public TableDataInfo getLatelyAccountList(PxBookkeepingClassification pxBookkeepingClassification) {
startPage();
List<PxBookkeepingAccount> list = pxBookkeepingAccountService.getLatelyAccountList(pxBookkeepingClassification);
return getDataTable(list);
}
/**
* 查询账本用户列表
*/
@GetMapping("/list")
public TableDataInfo list(PxBookkeepingAccount pxBookkeepingAccount) {
startPage();
List<PxBookkeepingAccount> list = pxBookkeepingAccountService.selectPxBookkeepingAccountList(pxBookkeepingAccount);
return getDataTable(list);
}
/**
* 获取账本用户详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxBookkeepingAccountService.selectPxBookkeepingAccountById(id));
}
/**
* 新增账本用户
*/
@ApiOperation("新增账本用户")
@Log(title = "新增账本用户", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxBookkeepingAccount pxBookkeepingAccount) {
return toAjax(pxBookkeepingAccountService.insertPxBookkeepingAccount(pxBookkeepingAccount));
}
/**
* 修改账本用户
*/
@Log(title = "修改账本用户", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxBookkeepingAccount pxBookkeepingAccount) {
return toAjax(pxBookkeepingAccountService.updatePxBookkeepingAccount(pxBookkeepingAccount));
}
/**
* 删除账本用户
*/
@Log(title = "账本用户", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
return toAjax(pxBookkeepingAccountService.deletePxBookkeepingAccountById(id));
}
}

View File

@ -0,0 +1,81 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.domain.po.PxBookkeepingClassification;
import com.pnkx.service.IPxBookkeepingClassificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author by QXX
* @classname PxAdminBookkeepingClassificationController
* @date 2021-11-18 10.24
* @description: 描述
*/
@RestController
@RequestMapping("/bookkeeping/classification")
public class PxBookkeepingClassificationController extends BaseController {
@Autowired
private IPxBookkeepingClassificationService pxBookkeepingClassificationService;
/**
* 查询最近使用分类列表
*/
@GetMapping("/getLatelyTypeList")
public TableDataInfo getLatelyTypeList(PxBookkeepingClassification pxBookkeepingClassification) {
startPage();
List<PxBookkeepingClassification> list = pxBookkeepingClassificationService.getLatelyTypeList(pxBookkeepingClassification);
return getDataTable(list);
}
/**
* 查询账本分类列表
*/
@GetMapping("/list")
public TableDataInfo list(PxBookkeepingClassification pxBookkeepingClassification) {
startPage();
List<PxBookkeepingClassification> list = pxBookkeepingClassificationService.selectPxBookkeepingClassificationList(pxBookkeepingClassification);
return getDataTable(list);
}
/**
* 获取账本分类详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxBookkeepingClassificationService.selectPxBookkeepingClassificationById(id));
}
/**
* 新增账本分类
*/
@Log(title = "新增账本分类", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxBookkeepingClassification pxBookkeepingClassification) {
return toAjax(pxBookkeepingClassificationService.insertPxBookkeepingClassification(pxBookkeepingClassification));
}
/**
* 修改账本分类
*/
@Log(title = "修改账本分类", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxBookkeepingClassification pxBookkeepingClassification) {
return toAjax(pxBookkeepingClassificationService.updatePxBookkeepingClassification(pxBookkeepingClassification));
}
/**
* 删除账本分类
*/
@Log(title = "账本分类", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id) {
return toAjax(pxBookkeepingClassificationService.deletePxBookkeepingClassificationById(id));
}
}

View File

@ -0,0 +1,70 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.domain.po.PxBookkeepingRecord;
import com.pnkx.service.IPxBookkeepingRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
/**
* @author PHY
* @classname PxAdminBookkeepingRecordController
* @data 2021/11/18 0018 14:33
* @description 描述
*/
@RestController
@RequestMapping("/bookkeeping/record")
public class PxBookkeepingRecordController extends BaseController {
@Resource
private IPxBookkeepingRecordService pxBookkeepingRecordService;
/**
* 查询账本记录列表
*/
@GetMapping("/list")
public TableDataInfo list(PxBookkeepingRecord pxBookkeepingRecord) {
startPage();
return pxBookkeepingRecordService.selectPxBookkeepingRecordList(pxBookkeepingRecord);
}
/**
* 获取账本记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxBookkeepingRecordService.selectPxBookkeepingRecordById(id));
}
/**
* 新增账本记录
*/
@Log(title = "新增账本记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxBookkeepingRecord pxBookkeepingRecord) {
return toAjax(pxBookkeepingRecordService.insertPxBookkeepingRecord(pxBookkeepingRecord));
}
/**
* 修改账本记录
*/
@Log(title = "修改账本记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxBookkeepingRecord pxBookkeepingRecord) {
return toAjax(pxBookkeepingRecordService.updatePxBookkeepingRecord(pxBookkeepingRecord));
}
/**
* 删除账本记录
*/
@Log(title = "账本记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxBookkeepingRecordService.deletePxBookkeepingRecordByIds(ids));
}
}

View File

@ -0,0 +1,84 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxBookkeepingRecordModel;
import com.pnkx.service.IPxBookkeepingRecordModelService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 账本记录模板Controller
*
* @author pnkx
* @date 2021-12-08
*/
@RestController
@RequestMapping("/myTool/menstruationRecordModel")
public class PxBookkeepingRecordModelController extends BaseController {
@Resource
private IPxBookkeepingRecordModelService pxBookkeepingRecordModelService;
/**
* 查询账本记录模板列表
*/
@GetMapping("/list")
public TableDataInfo list(PxBookkeepingRecordModel pxBookkeepingRecordModel) {
startPage();
List<PxBookkeepingRecordModel> list = pxBookkeepingRecordModelService.selectPxBookkeepingRecordModelList(pxBookkeepingRecordModel);
return getDataTable(list);
}
/**
* 导出账本记录模板列表
*/
@Log(title = "账本记录模板", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxBookkeepingRecordModel pxBookkeepingRecordModel) {
List<PxBookkeepingRecordModel> list = pxBookkeepingRecordModelService.selectPxBookkeepingRecordModelList(pxBookkeepingRecordModel);
ExcelUtil<PxBookkeepingRecordModel> util = new ExcelUtil<PxBookkeepingRecordModel>(PxBookkeepingRecordModel.class);
return util.exportExcel(list, "model");
}
/**
* 获取账本记录模板详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxBookkeepingRecordModelService.selectPxBookkeepingRecordModelById(id));
}
/**
* 新增账本记录模板
*/
@Log(title = "账本记录模板", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxBookkeepingRecordModel pxBookkeepingRecordModel) {
return toAjax(pxBookkeepingRecordModelService.insertPxBookkeepingRecordModel(pxBookkeepingRecordModel));
}
/**
* 修改账本记录模板
*/
@Log(title = "账本记录模板", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxBookkeepingRecordModel pxBookkeepingRecordModel) {
return toAjax(pxBookkeepingRecordModelService.updatePxBookkeepingRecordModel(pxBookkeepingRecordModel));
}
/**
* 删除账本记录模板
*/
@Log(title = "账本记录模板", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxBookkeepingRecordModelService.deletePxBookkeepingRecordModelByIds(ids));
}
}

View File

@ -0,0 +1,91 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.domain.po.PxBookkeepingRecord;
import com.pnkx.service.IPxBookkeepingStatisticsService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Map;
/**
* 账本统计Controller
*
* @author phy
* @date 2021-02-05
*/
@RestController
@RequestMapping("/bookkeeping/statistics")
public class PxBookkeepingStatisticsController extends BaseController {
@Resource
IPxBookkeepingStatisticsService pxBookkeepingStatisticsService;
/**
* 获取统计每月日消费折线图
*
* @param pxBookkeepingRecord 时间月份
* @return 折线数据
*/
@PostMapping(value = "/getLineChart")
public AjaxResult getLineChartByDay(@RequestBody PxBookkeepingRecord pxBookkeepingRecord) {
return AjaxResult.success(pxBookkeepingStatisticsService.getLineChartByDay(pxBookkeepingRecord));
}
/**
* 一级分类统计
*
* @param params 时间 分类类型
* @return 一级分类统计数据
*/
@PostMapping(value = "/getPrimaryStatistics")
public AjaxResult getPrimaryStatistics(@RequestBody Map<String, Object> params) {
return AjaxResult.success(pxBookkeepingStatisticsService.getPrimaryStatistics(params));
}
/**
* 二级分类统计
*
* @param params 时间 分类类型
* @return 二级分类统计数据
*/
@PostMapping(value = "/getSecondaryStatistics")
public AjaxResult getSecondaryStatistics(@RequestBody Map<String, Object> params) {
return AjaxResult.success(pxBookkeepingStatisticsService.getSecondaryStatistics(params));
}
/**
* 账户统计
*
* @param params 时间 分类类型
* @return 账户统计数据
*/
@PostMapping(value = "/getAccountStatistics")
public AjaxResult getAccountStatistics(@RequestBody Map<String, Object> params) {
return AjaxResult.success(pxBookkeepingStatisticsService.getAccountStatistics(params));
}
/**
* 资产负债统计
*
* @return 资产负债统计数据
*/
@PostMapping(value = "/getAssetsStatistics")
public AjaxResult getAssetsStatistics() {
return AjaxResult.success(pxBookkeepingStatisticsService.getAssetsStatistics());
}
/**
* 月度统计
*
* @param params 时间 分类类型
* @return 月度统计数据
*/
@PostMapping(value = "/getMonthlyStatistics")
public AjaxResult getMonthlyStatistics(@RequestBody Map<String, Object> params) {
return AjaxResult.success(pxBookkeepingStatisticsService.getMonthlyStatistics(params));
}
}

View File

@ -0,0 +1,71 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.domain.po.PxCommemorationDay;
import com.pnkx.service.IPxCommemorationDayService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author PHY
* @classname PxAdminCommemorationDayController
* @data 2021/11/29 16:34
* @description 纪念日Controller
*/
@RestController
@RequestMapping("/commemorationDay")
public class PxCommemorationDayController extends BaseController {
@Resource
private IPxCommemorationDayService pxCommemorationDayService;
/**
* 查询纪念日列表
*/
@GetMapping("/list")
public TableDataInfo list(PxCommemorationDay pxCommemorationDay) {
startPage();
List<PxCommemorationDay> list = pxCommemorationDayService.selectPxCommemorationDayList(pxCommemorationDay);
return getDataTable(list);
}
/**
* 获取纪念日详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxCommemorationDayService.selectPxCommemorationDayById(id));
}
/**
* 新增纪念日
*/
@Log(title = "纪念日", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxCommemorationDay pxCommemorationDay) {
return toAjax(pxCommemorationDayService.insertPxCommemorationDay(pxCommemorationDay));
}
/**
* 修改纪念日
*/
@Log(title = "纪念日", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxCommemorationDay pxCommemorationDay) {
return toAjax(pxCommemorationDayService.updatePxCommemorationDay(pxCommemorationDay));
}
/**
* 删除纪念日
*/
@Log(title = "纪念日", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxCommemorationDayService.deletePxCommemorationDayByIds(ids));
}
}

View File

@ -0,0 +1,93 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxDiary;
import com.pnkx.service.IPxDiaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author PHY
* @classname PxDiaryController
* @data 2021/12/30 0030 17:46
* @description 日记Controller
*/
@RestController
@RequestMapping("/admin/diary")
public class PxDiaryController extends BaseController {
@Resource
private IPxDiaryService pxDiaryService;
/**
* 查询日记列表
*/
@GetMapping("/retrieval")
public AjaxResult retrieval(String searchCode) {
logger.info("检索条件为:" + searchCode);
return AjaxResult.success(pxDiaryService.retrieval(searchCode));
}
/**
* 查询日记列表
*/
@GetMapping("/list")
public TableDataInfo list(PxDiary pxDiary) {
startPage();
List<PxDiary> list = pxDiaryService.selectPxDiaryList(pxDiary);
return getDataTable(list);
}
/**
* 导出日记列表
*/
@Log(title = "日记", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxDiary pxDiary) {
List<PxDiary> list = pxDiaryService.selectPxDiaryList(pxDiary);
ExcelUtil<PxDiary> util = new ExcelUtil<PxDiary>(PxDiary. class);
return util.exportExcel(list, "diary");
}
/**
* 获取日记详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxDiaryService.selectPxDiaryById(id));
}
/**
* 新增日记
*/
@Log(title = "日记", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxDiary pxDiary) {
return toAjax(pxDiaryService.insertPxDiary(pxDiary));
}
/**
* 修改日记
*/
@Log(title = "日记", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxDiary pxDiary) {
return toAjax(pxDiaryService.updatePxDiary(pxDiary));
}
/**
* 删除日记
*/
@Log(title = "日记", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxDiaryService.deletePxDiaryByIds(ids));
}
}

View File

@ -0,0 +1,138 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxCardRecord;
import com.pnkx.domain.po.PxLoversCard;
import com.pnkx.domain.vo.PxCardRecordVo;
import com.pnkx.service.IPxLoversCardService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 情侣卡券Controller
*
* @author pnkx
* @date 2022-05-21
*/
@RestController
@RequestMapping("/px/card")
public class PxLoversCardController extends BaseController {
@Resource
private IPxLoversCardService pxLoversCardService;
/**
* 查询情侣卡券列表
*/
@GetMapping("/list")
public TableDataInfo list(PxLoversCard pxLoversCard) {
startPage();
List<PxLoversCard> list = pxLoversCardService.selectPxLoversCardList(pxLoversCard);
return getDataTable(list);
}
/**
* 查询情侣卡券使用记录列表
*/
@GetMapping("/listRecord")
public TableDataInfo listRecord(PxCardRecordVo pxCardRecordVo) {
startPage();
List<PxCardRecordVo> list = pxLoversCardService.selectPxLoversCardRecordList(pxCardRecordVo);
return getDataTable(list);
}
/**
* 导出情侣卡券列表
*/
@Log(title = "情侣卡券", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxLoversCard pxLoversCard) {
List<PxLoversCard> list = pxLoversCardService.selectPxLoversCardList(pxLoversCard);
ExcelUtil<PxLoversCard> util = new ExcelUtil<PxLoversCard>(PxLoversCard.class);
return util.exportExcel(list, "card");
}
/**
* 获取情侣卡券详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxLoversCardService.selectPxLoversCardById(id));
}
/**
* 新增情侣卡券
*/
@Log(title = "情侣卡券", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxLoversCard pxLoversCard) {
return toAjax(pxLoversCardService.insertPxLoversCard(pxLoversCard));
}
/**
* 修改情侣卡券
*/
@Log(title = "情侣卡券", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxLoversCard pxLoversCard) {
return toAjax(pxLoversCardService.updatePxLoversCard(pxLoversCard));
}
/**
* 删除情侣卡券
*/
@Log(title = "情侣卡券", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxLoversCardService.deletePxLoversCardByIds(ids));
}
/**
* 获取当前人的卡券
*/
@GetMapping("/getCardByUserId")
public AjaxResult getCardByUserId() {
return AjaxResult.success(pxLoversCardService.getCardByUserId());
}
/**
* 使用卡券
*/
@Log(title = "使用卡券", businessType = BusinessType.UPDATE)
@PostMapping("/useCard")
public AjaxResult useCard(@RequestBody PxCardRecord pxCardRecord) {
return toAjax(pxLoversCardService.useCard(pxCardRecord));
}
/**
* 卡券确认使用
*/
@Log(title = "卡券确认使用", businessType = BusinessType.UPDATE)
@PostMapping("/confirmCard")
public AjaxResult confirmCard(@RequestBody PxCardRecord pxCardRecord) {
return toAjax(pxLoversCardService.confirmCard(pxCardRecord));
}
/**
* 使用卡券评分
*/
@Log(title = "使用卡券评分", businessType = BusinessType.UPDATE)
@PostMapping("/scoreCard")
public AjaxResult scoreCard(@RequestBody PxCardRecord pxCardRecord) {
return toAjax(pxLoversCardService.scoreCard(pxCardRecord));
}
/**
* 获取待处理的卡券
*/
@Log(title = "获取待处理的卡券", businessType = BusinessType.UPDATE)
@GetMapping("/getToDoCard")
public AjaxResult getToDoCard() {
return AjaxResult.success(pxLoversCardService.getToDoCard());
}
}

View File

@ -0,0 +1,101 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.service.IPxMenstruationRecordService;
import com.pnkx.domain.po.PxMenstruationRecord;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 姨妈记录Controller
*
* @author pnkx
* @date 2021-12-03
*/
@RestController
@RequestMapping("/myTool/menstruationRecord")
public class PxMenstruationRecordController extends BaseController {
@Resource
private IPxMenstruationRecordService pxMenstruationRecordService;
/**
* 查询姨妈记录列表
*/
@GetMapping("/list")
public TableDataInfo list(PxMenstruationRecord pxMenstruationRecord) {
startPage();
List<PxMenstruationRecord> list = pxMenstruationRecordService.selectPxMenstruationRecordList(pxMenstruationRecord);
return getDataTable(list);
}
/**
* 查询姨妈记录列表
*/
@GetMapping("/getPxMenstruationRecordList")
public TableDataInfo getPxMenstruationRecordList(PxMenstruationRecord pxMenstruationRecord) {
startPage();
List<PxMenstruationRecord> list = pxMenstruationRecordService.getPxMenstruationRecordList(pxMenstruationRecord);
return getDataTable(list);
}
/**
* 导出姨妈记录列表
*/
@Log(title = "姨妈记录", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxMenstruationRecord pxMenstruationRecord) {
List<PxMenstruationRecord> list = pxMenstruationRecordService.selectPxMenstruationRecordList(pxMenstruationRecord);
ExcelUtil<PxMenstruationRecord> util = new ExcelUtil<PxMenstruationRecord>(PxMenstruationRecord.class);
return util.exportExcel(list, "menstruationRecord");
}
/**
* 获取姨妈记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxMenstruationRecordService.selectPxMenstruationRecordById(id));
}
/**
* 获取最后一次姨妈开始的记录
*/
@GetMapping(value = "/getLastStartDate")
public AjaxResult getLastStartDate() {
return AjaxResult.success(pxMenstruationRecordService.getLastStartDate());
}
/**
* 新增姨妈记录
*/
@Log(title = "姨妈记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxMenstruationRecord pxMenstruationRecord) {
return toAjax(pxMenstruationRecordService.insertPxMenstruationRecord(pxMenstruationRecord));
}
/**
* 修改姨妈记录
*/
@Log(title = "姨妈记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxMenstruationRecord pxMenstruationRecord) {
return toAjax(pxMenstruationRecordService.updatePxMenstruationRecord(pxMenstruationRecord));
}
/**
* 删除姨妈记录
*/
@Log(title = "姨妈记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxMenstruationRecordService.deletePxMenstruationRecordByIds(ids));
}
}

View File

@ -0,0 +1,84 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.domain.po.PxNote;
import com.pnkx.domain.po.PxNoteFolder;
import com.pnkx.service.IPxNoteService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author PHY
* @classname PxNoteController
* @data 2021/12/30 17:38
* @description 笔记Controller
*/
@RestController
@RequestMapping("/note")
public class PxNoteController extends BaseController {
@Resource
private IPxNoteService pxNoteService;
/**
* 查询笔记列表
*/
@GetMapping("/list")
public TableDataInfo list(PxNote pxNote) {
startPage();
List<PxNoteFolder> list = pxNoteService.selectPxNoteList(pxNote);
return getDataTable(list);
}
/**
* 导出笔记列表
*/
@Log(title = "笔记", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxNote pxNote) {
List<PxNoteFolder> list = pxNoteService.selectPxNoteList(pxNote);
ExcelUtil<PxNoteFolder> util = new ExcelUtil<>(PxNoteFolder. class);
return util.exportExcel(list, "note");
}
/**
* 获取笔记详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxNoteService.selectPxNoteById(id));
}
/**
* 新增笔记
*/
@Log(title = "笔记", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxNote pxNote) {
return AjaxResult.success(pxNoteService.insertPxNote(pxNote));
}
/**
* 修改笔记
*/
@Log(title = "笔记", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxNote pxNote) {
return AjaxResult.success(pxNoteService.updatePxNote(pxNote));
}
/**
* 删除笔记
*/
@Log(title = "笔记", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxNoteService.deletePxNoteByIds(ids));
}
}

View File

@ -0,0 +1,80 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.domain.po.PxNoteFolder;
import com.pnkx.service.IPxNoteFolderService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author PHY
* @classname PxNoteFolderController
* @data 2021/12/30 17:37
* @description 笔记文件夹Controller
*/
@RestController
@RequestMapping("/note/folder")
public class PxNoteFolderController extends BaseController {
@Resource
private IPxNoteFolderService pxNoteFolderService;
/**
* 查询笔记文件夹列表
*/
@GetMapping("/list")
public TableDataInfo list(PxNoteFolder pxNoteFolder) {
startPage();
List<PxNoteFolder> list = pxNoteFolderService.selectPxNoteFolderList(pxNoteFolder);
return getDataTable(list);
}
/**
* 查询笔记文件夹树形列表
*/
@GetMapping("/treeList")
public AjaxResult treeList(PxNoteFolder pxNoteFolder) {
return AjaxResult.success(pxNoteFolderService.selectPxNoteFolderTreeList(pxNoteFolder));
}
/**
* 获取笔记文件夹详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxNoteFolderService.selectPxNoteFolderById(id));
}
/**
* 新增笔记文件夹
*/
@Log(title = "笔记文件夹", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxNoteFolder pxNoteFolder) {
return AjaxResult.success(pxNoteFolderService.insertPxNoteFolder(pxNoteFolder));
}
/**
* 修改笔记文件夹
*/
@Log(title = "笔记文件夹", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxNoteFolder pxNoteFolder) {
return AjaxResult.success(pxNoteFolderService.updatePxNoteFolder(pxNoteFolder));
}
/**
* 删除笔记文件夹
*/
@Log(title = "笔记文件夹", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxNoteFolderService.deletePxNoteFolderByIds(ids));
}
}

View File

@ -0,0 +1,101 @@
package com.pnkx.web.controller.life;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.model.LoginUser;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ServletUtils;
import com.pnkx.domain.po.PxToDo;
import com.pnkx.framework.web.service.TokenService;
import com.pnkx.service.IPxToDoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 待办事项Controller
*
* @author phy
* @date 2021-04-13
*/
@RestController
@RequestMapping("/admin/toDo")
public class PxToDoController extends BaseController {
@Resource
private IPxToDoService pxToDoService;
@Resource
private TokenService tokenService;
/**
* 查询待办事项列表
*/
@GetMapping("/list")
public TableDataInfo list(PxToDo pxToDo) {
startPage();
List<PxToDo> list = pxToDoService.selectPxToDoList(pxToDo);
return getDataTable(list);
}
/**
* 导出待办事项列表
*/
@Log(title = "待办事项", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(PxToDo pxToDo) {
List<PxToDo> list = pxToDoService.selectPxToDoList(pxToDo);
ExcelUtil<PxToDo> util = new ExcelUtil<PxToDo>(PxToDo.class);
return util.exportExcel(list, "do");
}
/**
* 获取待办事项详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(pxToDoService.selectPxToDoById(id));
}
/**
* 新增待办事项
*/
@Log(title = "待办事项", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody PxToDo pxToDo) {
pxToDo.setCreateBy(SecurityUtils.getUserId().toString());
pxToDo.setPerformer(SecurityUtils.getUserId().toString());
return toAjax(pxToDoService.insertPxToDo(pxToDo));
}
/**
* 修改待办事项
*/
@Log(title = "待办事项", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody PxToDo pxToDo) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
pxToDo.setUpdateBy(String.valueOf(loginUser.getUser().getUserId()));
return toAjax(pxToDoService.updatePxToDo(pxToDo));
}
/**
* 删除待办事项
*/
@Log(title = "待办事项", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(pxToDoService.deletePxToDoByIds(ids));
}
/**
* 获取待办事项标签列表
*/
@GetMapping(value = "/getLabelList")
public AjaxResult getLabelList() {
return AjaxResult.success(pxToDoService.getLabelList());
}
}

View File

@ -0,0 +1,50 @@
package com.pnkx.web.controller.monitor;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisCallback;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.utils.StringUtils;
/**
* 缓存监控
*
* @author phy
*/
@RestController
@RequestMapping("/monitor/cache")
public class CacheController {
@Autowired
private RedisTemplate<String, String> redisTemplate;
@GetMapping()
public AjaxResult getInfo() throws Exception {
Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info());
Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats"));
Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize());
Map<String, Object> result = new HashMap<>(3);
result.put("info", info);
result.put("dbSize", dbSize);
List<Map<String, String>> pieList = new ArrayList<>();
commandStats.stringPropertyNames().forEach(key -> {
Map<String, String> data = new HashMap<>(2);
String property = commandStats.getProperty(key);
data.put("name", StringUtils.removeStart(key, "cmdstat_"));
data.put("value", StringUtils.substringBetween(property, "calls=", ",usec"));
pieList.add(data);
});
result.put("commandStats", pieList);
return AjaxResult.success(result);
}
}

View File

@ -0,0 +1,23 @@
package com.pnkx.web.controller.monitor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.framework.web.domain.Server;
/**
* 服务器监控
*
* @author phy
*/
@RestController
@RequestMapping("/monitor/server")
public class ServerController {
@GetMapping()
public AjaxResult getInfo() throws Exception {
Server server = new Server();
server.copyTo();
return AjaxResult.success(server);
}
}

View File

@ -0,0 +1,58 @@
package com.pnkx.web.controller.monitor;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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 com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.domain.SysLogininfor;
import com.pnkx.system.service.ISysLogininforService;
/**
* 系统访问记录
*
* @author phy
*/
@RestController
@RequestMapping("/monitor/logininfor")
public class SysLogininforController extends BaseController {
@Autowired
private ISysLogininforService logininforService;
@GetMapping("/list")
public TableDataInfo list(SysLogininfor logininfor) {
startPage();
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
return getDataTable(list);
}
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysLogininfor logininfor) {
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
return util.exportExcel(list, "登录日志");
}
@Log(title = "登录日志", businessType = BusinessType.DELETE)
@DeleteMapping("/{infoIds}")
public AjaxResult remove(@PathVariable Long[] infoIds) {
return toAjax(logininforService.deleteLogininforByIds(infoIds));
}
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean() {
logininforService.cleanLogininfor();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,57 @@
package com.pnkx.web.controller.monitor;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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 com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.domain.SysOperLog;
import com.pnkx.system.service.ISysOperLogService;
/**
* 操作日志记录
*
* @author phy
*/
@RestController
@RequestMapping("/monitor/operlog")
public class SysOperlogController extends BaseController {
@Autowired
private ISysOperLogService operLogService;
@GetMapping("/list")
public TableDataInfo list(SysOperLog operLog) {
startPage();
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
return getDataTable(list);
}
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysOperLog operLog) {
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
return util.exportExcel(list, "操作日志");
}
@DeleteMapping("/{operIds}")
public AjaxResult remove(@PathVariable Long[] operIds) {
return toAjax(operLogService.deleteOperLogByIds(operIds));
}
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
@DeleteMapping("/clean")
public AjaxResult clean() {
operLogService.cleanOperLog();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,76 @@
package com.pnkx.web.controller.monitor;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
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 com.pnkx.common.annotation.Log;
import com.pnkx.common.constant.Constants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.model.LoginUser;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.core.redis.RedisCache;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.system.domain.SysUserOnline;
import com.pnkx.system.service.ISysUserOnlineService;
/**
* 在线用户监控
*
* @author phy
*/
@RestController
@RequestMapping("/monitor/online")
public class SysUserOnlineController extends BaseController {
@Autowired
private ISysUserOnlineService userOnlineService;
@Autowired
private RedisCache redisCache;
@GetMapping("/list")
public TableDataInfo list(String ipaddr, String userName) {
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
for (String key : keys) {
LoginUser user = redisCache.getCacheObject(key);
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName)) {
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUserName())) {
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
}
} else if (StringUtils.isNotEmpty(ipaddr)) {
if (StringUtils.equals(ipaddr, user.getIpaddr())) {
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
}
} else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser())) {
if (StringUtils.equals(userName, user.getUserName())) {
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
}
} else {
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
}
}
Collections.reverse(userOnlineList);
userOnlineList.removeAll(Collections.singleton(null));
return getDataTable(userOnlineList);
}
/**
* 强退用户
*/
@Log(title = "在线用户", businessType = BusinessType.FORCE)
@DeleteMapping("/{tokenId}")
public AjaxResult forceLogout(@PathVariable String tokenId) {
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
return AjaxResult.success();
}
}

View File

@ -0,0 +1,90 @@
package com.pnkx.web.controller.system;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.domain.SysAppUpdateLog;
import com.pnkx.system.service.ISysAppService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* app版本管理
*
* @author phy
*/
@RestController
@RequestMapping("/app")
public class SysAppController extends BaseController {
@Resource
ISysAppService sysAppService;
/**
* 获取最新版app信息
*/
@GetMapping("/getNewestAppInfo")
public AjaxResult getNewestAppInfo() {
return AjaxResult.success(sysAppService.getNewestAppInfo());
}
/**
* 查询app更新日志列表
*/
@GetMapping("/log/list")
public TableDataInfo getUpdateLogList(SysAppUpdateLog appUpdateLog) {
startPage();
List<SysAppUpdateLog> list = sysAppService.selectAppUpdateLogList(appUpdateLog);
return getDataTable(list);
}
/**
* 导出app更新日志列表
*/
@Log(title = "app更新日志", businessType = BusinessType.EXPORT)
@GetMapping("/log/export")
public AjaxResult export(SysAppUpdateLog appUpdateLog) {
List<SysAppUpdateLog> list = sysAppService.selectAppUpdateLogList(appUpdateLog);
ExcelUtil<SysAppUpdateLog> util = new ExcelUtil<>(SysAppUpdateLog.class);
return util.exportExcel(list, "log");
}
/**
* 获取app更新日志详细信息
*/
@GetMapping(value = "/log/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysAppService.selectAppUpdateLogById(id));
}
/**
* 新增app更新日志
*/
@Log(title = "app更新日志", businessType = BusinessType.INSERT)
@PostMapping("/log")
public AjaxResult add(@RequestBody SysAppUpdateLog appUpdateLog) {
return toAjax(sysAppService.insertAppUpdateLog(appUpdateLog));
}
/**
* 修改app更新日志
*/
@Log(title = "app更新日志", businessType = BusinessType.UPDATE)
@PutMapping("/log")
public AjaxResult edit(@RequestBody SysAppUpdateLog appUpdateLog) {
return toAjax(sysAppService.updateAppUpdateLog(appUpdateLog));
}
/**
* 删除app更新日志
*/
@Log(title = "app更新日志", businessType = BusinessType.DELETE)
@DeleteMapping("/log/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sysAppService.deleteAppUpdateLogByIds(ids));
}
}

View File

@ -0,0 +1,117 @@
package com.pnkx.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.annotation.RepeatSubmit;
import com.pnkx.common.constant.UserConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.domain.SysConfig;
import com.pnkx.system.service.ISysConfigService;
/**
* 参数配置 信息操作处理
*
* @author phy
*/
@RestController
@RequestMapping("/system/config")
public class SysConfigController extends BaseController {
@Autowired
private ISysConfigService configService;
/**
* 获取参数配置列表
*/
@GetMapping("/list")
public TableDataInfo list(SysConfig config) {
startPage();
List<SysConfig> list = configService.selectConfigList(config);
return getDataTable(list);
}
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysConfig config) {
List<SysConfig> list = configService.selectConfigList(config);
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
return util.exportExcel(list, "参数数据");
}
/**
* 根据参数编号获取详细信息
*/
@GetMapping(value = "/{configId}")
public AjaxResult getInfo(@PathVariable Long configId) {
return AjaxResult.success(configService.selectConfigById(configId));
}
/**
* 根据参数键名查询参数值
*/
@GetMapping(value = "/configKey/{configKey}")
public AjaxResult getConfigKey(@PathVariable String configKey) {
return AjaxResult.success(configService.selectConfigByKey(configKey));
}
/**
* 新增参数配置
*/
@Log(title = "参数管理", businessType = BusinessType.INSERT)
@PostMapping
@RepeatSubmit
public AjaxResult add(@Validated @RequestBody SysConfig config) {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setCreateBy(SecurityUtils.getUserId().toString());
return toAjax(configService.insertConfig(config));
}
/**
* 修改参数配置
*/
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysConfig config) {
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config))) {
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
}
config.setUpdateBy(SecurityUtils.getUserName());
return toAjax(configService.updateConfig(config));
}
/**
* 删除参数配置
*/
@Log(title = "参数管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{configIds}")
public AjaxResult remove(@PathVariable Long[] configIds) {
return toAjax(configService.deleteConfigByIds(configIds));
}
/**
* 清空缓存
*/
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache")
public AjaxResult clearCache() {
configService.clearCache();
return AjaxResult.success();
}
}

View File

@ -0,0 +1,138 @@
package com.pnkx.web.controller.system;
import java.util.Iterator;
import java.util.List;
import org.apache.commons.lang3.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.constant.UserConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysDept;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.system.service.ISysDeptService;
/**
* 部门信息
*
* @author phy
*/
@RestController
@RequestMapping("/system/dept")
public class SysDeptController extends BaseController {
@Autowired
private ISysDeptService deptService;
/**
* 获取部门列表
*/
@GetMapping("/list")
public AjaxResult list(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(depts);
}
/**
* 查询部门列表排除节点
*/
@GetMapping("/list/exclude/{deptId}")
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
Iterator<SysDept> it = depts.iterator();
while (it.hasNext()) {
SysDept d = (SysDept) it.next();
if (d.getDeptId().intValue() == deptId
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + "")) {
it.remove();
}
}
return AjaxResult.success(depts);
}
/**
* 根据部门编号获取详细信息
*/
@GetMapping(value = "/{deptId}")
public AjaxResult getInfo(@PathVariable Long deptId) {
return AjaxResult.success(deptService.selectDeptById(deptId));
}
/**
* 获取部门下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysDept dept) {
List<SysDept> depts = deptService.selectDeptList(dept);
return AjaxResult.success(deptService.buildDeptTreeSelect(depts));
}
/**
* 加载对应角色部门列表树
*/
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId) {
List<SysDept> depts = deptService.selectDeptList(new SysDept());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
return ajax;
}
/**
* 新增部门
*/
@Log(title = "部门管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDept dept) {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
}
dept.setCreateBy(SecurityUtils.getUserId().toString());
return toAjax(deptService.insertDept(dept));
}
/**
* 修改部门
*/
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDept dept) {
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept))) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
} else if (dept.getParentId().equals(dept.getDeptId())) {
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
} else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0) {
return AjaxResult.error("该部门包含未停用的子部门!");
}
dept.setUpdateBy(SecurityUtils.getUserName());
return toAjax(deptService.updateDept(dept));
}
/**
* 删除部门
*/
@Log(title = "部门管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{deptId}")
public AjaxResult remove(@PathVariable Long deptId) {
if (deptService.hasChildByDeptId(deptId)) {
return AjaxResult.error("存在下级部门,不允许删除");
}
if (deptService.checkDeptExistUser(deptId)) {
return AjaxResult.error("部门存在用户,不允许删除");
}
return toAjax(deptService.deleteDeptById(deptId));
}
}

View File

@ -0,0 +1,117 @@
package com.pnkx.web.controller.system;
import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysDictData;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.service.ISysDictDataService;
import com.pnkx.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author phy
*/
@RestController
@RequestMapping("/system/dict/data")
public class SysDictDataController extends BaseController {
@Autowired
private ISysDictDataService dictDataService;
@Autowired
private ISysDictTypeService dictTypeService;
@GetMapping("/list")
public TableDataInfo list(SysDictData dictData) {
startPage();
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
return getDataTable(list);
}
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysDictData dictData) {
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
return util.exportExcel(list, "字典数据");
}
/**
* 查询字典数据详细
*/
@GetMapping(value = "/{dictCode}")
public AjaxResult getInfo(@PathVariable Long dictCode) {
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
}
/**
* 根据字典类型查询字典数据信息
*/
@GetMapping(value = "/type/{dictType}")
public AjaxResult dictType(@PathVariable(value = "dictType") String dictType) {
List<SysDictData> data = dictTypeService.selectDictDataByType(dictType);
if (StringUtils.isNull(data)) {
data = new ArrayList<>();
}
return AjaxResult.success(data);
}
/**
* 根据字典类型查询字典数据信息当前登陆人所创建的字典项
*/
@GetMapping(value = "/typeByLogin/{dictType}")
public AjaxResult dictTypeByLogin(@PathVariable String dictType) {
List<SysDictData> data = dictTypeService.selectDictTypeByLogin(dictType);
if (StringUtils.isNull(data)) {
data = new ArrayList<SysDictData>();
}
return AjaxResult.success(data);
}
/**
* 新增字典类型
*/
@Log(title = "字典数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictData dict) {
dict.setCreateBy(SecurityUtils.getUserId().toString());
return toAjax(dictDataService.insertDictData(dict));
}
/**
* 修改保存字典类型
*/
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
dict.setUpdateBy(SecurityUtils.getUserName());
return toAjax(dictDataService.updateDictData(dict));
}
/**
* 删除字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictCodes}")
public AjaxResult remove(@PathVariable Long[] dictCodes) {
return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
}
}

View File

@ -0,0 +1,113 @@
package com.pnkx.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.constant.UserConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysDictType;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.service.ISysDictTypeService;
/**
* 数据字典信息
*
* @author phy
*/
@RestController
@RequestMapping("/system/dict/type")
public class SysDictTypeController extends BaseController {
@Autowired
private ISysDictTypeService dictTypeService;
@GetMapping("/list")
public TableDataInfo list(SysDictType dictType) {
startPage();
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
return getDataTable(list);
}
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysDictType dictType) {
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
return util.exportExcel(list, "字典类型");
}
/**
* 查询字典类型详细
*/
@GetMapping(value = "/{dictId}")
public AjaxResult getInfo(@PathVariable Long dictId) {
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
}
/**
* 新增字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysDictType dict) {
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setCreateBy(SecurityUtils.getUserId().toString());
return toAjax(dictTypeService.insertDictType(dict));
}
/**
* 修改字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
}
dict.setUpdateBy(SecurityUtils.getUserName());
return toAjax(dictTypeService.updateDictType(dict));
}
/**
* 删除字典类型
*/
@Log(title = "字典类型", businessType = BusinessType.DELETE)
@DeleteMapping("/{dictIds}")
public AjaxResult remove(@PathVariable Long[] dictIds) {
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
}
/**
* 清空缓存
*/
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
@DeleteMapping("/clearCache")
public AjaxResult clearCache() {
dictTypeService.clearCache();
return AjaxResult.success();
}
/**
* 获取字典选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect() {
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
return AjaxResult.success(dictTypes);
}
}

View File

@ -0,0 +1,89 @@
package com.pnkx.web.controller.system;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.domain.SysEmail;
import com.pnkx.system.service.ISysEmailService;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* @author by PHY
* @Classname EmailController
* @date 2021-05-13 11:08
*/
@RestController
@RequestMapping("/system/email")
public class SysEmailController extends BaseController {
@Resource
private ISysEmailService sysEmailService;
/**
* 查询邮件记录列表
*/
@GetMapping("/list")
public TableDataInfo list(SysEmail pxEmail) {
startPage();
List<SysEmail> list = sysEmailService.selectSysEmailList(pxEmail);
return getDataTable(list);
}
/**
* 导出邮件记录列表
*/
@Log(title = "邮件记录", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysEmail pxEmail) {
List<SysEmail> list = sysEmailService.selectSysEmailList(pxEmail);
ExcelUtil<SysEmail> util = new ExcelUtil<>(SysEmail.class);
return util.exportExcel(list, "email");
}
/**
* 获取邮件记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysEmailService.selectSysEmailById(id));
}
/**
* 修改邮件记录
*/
@Log(title = "邮件记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysEmail pxEmail) {
return toAjax(sysEmailService.updateSysEmail(pxEmail));
}
/**
* 删除邮件记录
*/
@Log(title = "邮件记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sysEmailService.deleteSysEmailByIds(ids));
}
@ApiOperation("发送HTML邮件")
@PostMapping("/sendHtmlEmail")
@Transactional()
public AjaxResult sendHtmlEmail(@RequestBody SysEmail email) {
try {
sysEmailService.sendMail(email);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.success("发送失败", false);
}
return AjaxResult.success("发送成功", true);
}
}

View File

@ -0,0 +1,283 @@
package com.pnkx.web.controller.system;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.config.PnkxConfig;
import com.pnkx.common.constant.WebsiteAddressConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.common.utils.file.FileTypeUtils;
import com.pnkx.common.utils.file.MimeTypeUtils;
import com.pnkx.system.domain.SysFile;
import com.pnkx.system.service.ISysFileService;
import net.coobird.thumbnailator.Thumbnails;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.text.NumberFormat;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
/**
* 通用请求处理
*
* @author phy
*/
@RequestMapping("/system/file")
@RestController
public class SysFileController extends BaseController {
private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
@Resource
private ISysFileService sysFileService;
/**
* 大文件分片上传
*
* @param request
* @return
*/
@PostMapping(value = "/uploadLarge")
public AjaxResult uploadLarge(HttpServletRequest request) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
// 文件
MultipartFile chunk = multipartRequest.getFile("file");
// 文件名
String filename = request.getParameter("filename");
log.info("上传文件:{}", filename);
// 当前块的次序第一个块是 1注意不是从 0 开始的
String chunkNumber = request.getParameter("chunkNumber");
// 文件被分成块的总数
String totalChunks = request.getParameter("totalChunks");
// 文件唯一标识
String identifier = request.getParameter("identifier");
// 上传指定路径
String uploadPath = request.getParameter("uploadPath");
// 文件类型
String fileType = request.getParameter("fileType");
// 是否生成缩略图
Boolean isThumbnail = Boolean.valueOf(request.getParameter("isThumbnail"));
// 分片文件存放位置
String undeterminedArea = PnkxConfig.getUploadPath() + File.separator + "undetermined" + File.separator + identifier;
// 用于存储文件分片的文件夹
File folder = new File(undeterminedArea);
if (!folder.exists() && !folder.isDirectory()) {
folder.mkdirs();
}
// 文件分片的路径
String filePath = undeterminedArea + File.separator + chunkNumber + filename.substring(filename.lastIndexOf("."));
try {
File saveFile = new File(filePath);
// 写入文件中
FileOutputStream fileOutputStream = new FileOutputStream(saveFile);
fileOutputStream.write(chunk.getBytes());
fileOutputStream.close();
chunk.transferTo(saveFile);
double uploaded = (double) Integer.parseInt(chunkNumber) / Integer.parseInt(totalChunks);
NumberFormat nt = NumberFormat.getPercentInstance();
nt.setMinimumFractionDigits(2);
String mergeChunkName = "已上传" + nt.format(uploaded);
// 获取分片文件
File[] list = folder.listFiles();
assert list != null;
if (list.length == Integer.parseInt(totalChunks)) {
// 合并文件分片
mergeChunkName = mergeChunk(undeterminedArea, uploadPath, isThumbnail, identifier + filename.substring(filename.lastIndexOf(".")), fileType, filename);
return AjaxResult.success(mergeChunkName, true);
}
return AjaxResult.success(mergeChunkName, false);
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.error("保存文件分片异常");
}
}
/**
* 查询文件记录列表
*/
@GetMapping("/list")
public TableDataInfo list(SysFile sysFile) {
startPage();
List<SysFile> list = sysFileService.selectSysFileList(sysFile);
return getDataTable(list);
}
/**
* 导出文件记录列表
*/
@Log(title = "文件记录", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysFile sysFile) {
List<SysFile> list = sysFileService.selectSysFileList(sysFile);
ExcelUtil<SysFile> util = new ExcelUtil<SysFile>(SysFile.class);
return util.exportExcel(list, "file");
}
/**
* 获取文件记录详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return AjaxResult.success(sysFileService.selectSysFileById(id));
}
/**
* 新增文件记录
*/
@Log(title = "文件记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody SysFile sysFile) {
return toAjax(sysFileService.insertSysFile(sysFile));
}
/**
* 修改文件记录
*/
@Log(title = "文件记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody SysFile sysFile) {
return toAjax(sysFileService.updateSysFile(sysFile));
}
/**
* 删除文件记录
*/
@Log(title = "文件记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(sysFileService.deleteSysFileByIds(ids));
}
/**
* 合并文件分片
*
* @param path 文件分片所在的文件夹
* @param uploadPath 上传指定路径
* @param isThumbnail 是否生成缩略图
* @param fileName 文件名
* @param fileType 文件类型
* @param originalName 文件名包括后缀
* @return
* @throws IOException
*/
private String mergeChunk(String path, String uploadPath, Boolean isThumbnail, String fileName, String fileType, String originalName) throws IOException {
// 文件分片所在的文件夹
File chunkFileFolder = new File(path);
// 合并后的文件的路径
String newFilePath = PnkxConfig.getUploadPath();
File file = new File(newFilePath);
if (!file.exists()) {
file.mkdirs();
}
File mergeFile = new File(newFilePath + File.separator + fileName);
// 得到文件分片所在的文件夹下的所有文件
File[] chunks = chunkFileFolder.listFiles();
assert chunks != null;
// 排序
File[] files = Arrays.stream(chunks)
// 按照id值排序
.sorted(Comparator.comparing(o -> Integer.valueOf(o.getName().substring(0, o.getName().lastIndexOf(".")))))
.toArray(File[]::new);
try {
// 合并文件
RandomAccessFile randomAccessFileWriter = new RandomAccessFile(mergeFile, "rw");
byte[] bytes = new byte[1024];
for (File chunk : files) {
RandomAccessFile randomAccessFileReader = new RandomAccessFile(chunk, "r");
int len;
while ((len = randomAccessFileReader.read(bytes)) != -1) {
randomAccessFileWriter.write(bytes, 0, len);
}
randomAccessFileReader.close();
}
randomAccessFileWriter.close();
} catch (Exception e) {
e.printStackTrace();
AjaxResult.error("合并文件异常");
}
// 合并后删除分片文件
deleteFile(chunkFileFolder);
String mergeFilePath = sysFileService.uploadFile(mergeFile, uploadPath, fileName);
SysFile sysFile = new SysFile();
sysFile.setPath(mergeFilePath);
sysFile.setUrl(WebsiteAddressConstants.FTP_SITE_ADDRESS + mergeFilePath);
sysFile.setName(originalName);
sysFile.setPort("博客管理端分片上传");
sysFile.setType(fileType);
if (Boolean.TRUE.equals(Arrays.asList(MimeTypeUtils.IMAGE_EXTENSION).contains(FileTypeUtils.getFileType(mergeFile)) && isThumbnail) && mergeFile.length() > 1024*500) {
String thumbnail = newFilePath + File.separator + "thumbnail" + File.separator + fileName;
File thumbnailPath = new File(newFilePath + File.separator + "thumbnail");
if (!thumbnailPath.exists()) {
thumbnailPath.mkdirs();
}
Thumbnails.of(mergeFile)
.size(128, 128)
.toFile(thumbnail);
File thumbnailFile = new File(thumbnail);
String thumbnailUrl = sysFileService.uploadFile(thumbnailFile, uploadPath, "thumbnail-" + fileName);
sysFile.setThumbnail(WebsiteAddressConstants.FTP_SITE_ADDRESS + thumbnailUrl);
deleteFile(thumbnailFile);
}
// 上传到FTP后删除本地文件
deleteFile(mergeFile);
sysFileService.insertSysFile(sysFile);
return sysFile.getUrl();
}
/**
* 删除文件
*
* @param file
* @return
*/
public static Boolean deleteFile(File file) {
// 判断文件不为null或文件目录存在
if (file == null || !file.exists()) {
log.error("文件删除失败,请检查文件是否存在以及文件路径是否正确");
return false;
}
if (file.isFile()) {
// 文件删除
file.delete();
// 打印文件名
log.info("删除文件名:" + file.getName());
} else if (file.isDirectory()) {
//获取目录下子文件
File[] files = file.listFiles();
//遍历该目录下的文件对象
for (File f : files) {
// 判断子目录是否存在子目录,如果是文件则删除
if (f.isDirectory()) {
// 递归删除目录下的文件
deleteFile(f);
} else {
// 文件删除
f.delete();
// 打印文件名
log.info("删除文件名:" + f.getName());
}
}
// 文件夹删除
file.delete();
log.info("删除目录名:" + file.getName());
}
return true;
}
}

View File

@ -0,0 +1,184 @@
package com.pnkx.web.controller.system;
import com.pnkx.common.constant.Constants;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysMenu;
import com.pnkx.common.core.domain.entity.SysUser;
import com.pnkx.common.core.domain.model.LoginBody;
import com.pnkx.common.core.domain.model.LoginUser;
import com.pnkx.common.utils.ServletUtils;
import com.pnkx.common.utils.ip.IpLocation;
import com.pnkx.common.utils.ip.IpUtils;
import com.pnkx.common.utils.uuid.UUID;
import com.pnkx.domain.po.PxLikeRecord;
import com.pnkx.framework.web.service.SysLoginService;
import com.pnkx.framework.web.service.SysPermissionService;
import com.pnkx.framework.web.service.TokenService;
import com.pnkx.service.IPxLikeRecordService;
import com.pnkx.system.service.ISysMenuService;
import com.pnkx.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 登录验证
*
* @author phy
*/
@RestController
public class SysLoginController {
private static final Logger logger = LoggerFactory.getLogger(SysLoginController.class);
@Resource
private SysLoginService loginService;
@Resource
private ISysMenuService menuService;
@Resource
private SysPermissionService permissionService;
@Resource
private TokenService tokenService;
@Resource
private IPxLikeRecordService pxLikeRecordService;
@Resource
private ISysUserService userService;
/**
* 登录方法
*
* @param loginBody 登录信息
* @return 结果
*/
@PostMapping("/login")
public AjaxResult login(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(loginBody.getUserName(),
loginBody.getPassword(),
loginBody.getCode(),
loginBody.getUuid());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 博客客户端登录
*
* @param loginBody
* @return
*/
@PostMapping("clientLogin")
public AjaxResult clientLogin(@RequestBody LoginBody loginBody) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.userNameAndPassWordLogin(loginBody.getUserName(), loginBody.getPassword());
ajax.put(Constants.TOKEN, token);
return ajax;
}
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("getInfo")
public AjaxResult getInfo(HttpServletRequest request) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = userService.selectUserByUserName(loginUser.getUserName());
PxLikeRecord like = new PxLikeRecord();
like.setCreateBy(user.getUserId().toString());
String ip = IpUtils.getIpAddr(request);
IpLocation location = IpUtils.getLocation(ip);
user.setLocation(location);
like.setType("0");
user.setArticleLikeSet(pxLikeRecordService.selectPxLikeRecordList(like).stream().map(PxLikeRecord::getItemId).collect(Collectors.toList()));
like.setType("1");
user.setCommentLikeSet(pxLikeRecordService.selectPxLikeRecordList(like).stream().map(PxLikeRecord::getItemId).collect(Collectors.toList()));
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
return ajax;
}
/**
* 获取路由信息
*
* @return 路由信息
*/
@GetMapping("getRouters")
public AjaxResult getRouters() {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
// 用户信息
SysUser user = loginUser.getUser();
List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId());
return AjaxResult.success(menuService.buildMenus(menus));
}
@PostMapping("register")
public AjaxResult register(@RequestBody LoginBody registerBody) throws Exception {
// 用户注册
loginService.register(registerBody.getUserName(), registerBody.getPassword());
return AjaxResult.success(true);
}
/**
* 账号激活
*
* @param userName 用户名
* @return 激活结果
*/
@GetMapping("/activation/{userName}")
public AjaxResult activation(@PathVariable("userName") String userName) {
SysUser sysUser = new SysUser();
sysUser.setUserName(userName);
sysUser.setStatus("0");
return AjaxResult.success(userService.updateUserByUserName(sysUser));
}
/**
* 发送重置邮件
*
* @param userName 用户名
* @return 激活结果
*/
@GetMapping("/sendResetEmail/{userName}")
public AjaxResult sendResetEmail(@PathVariable("userName") String userName) {
try {
return AjaxResult.success(loginService.sendResetEmail(userName));
} catch (Exception e) {
e.printStackTrace();
return AjaxResult.success(false);
}
}
/**
* 重置账号密码
*
* @param userName 用户名
* @return 重置结果
*/
@GetMapping("/restPassword/{userName}")
public AjaxResult restPassword(@PathVariable("userName") String userName) {
SysUser sysUser = new SysUser();
sysUser.setUserName(userName);
String newPassword = UUID.randomString(8);
sysUser.setPassword(newPassword);
if (userService.updateUserByUserName(sysUser) > 0) {
return AjaxResult.success("重置密码成功", newPassword);
}
return AjaxResult.error("重置密码失败");
}
}

View File

@ -0,0 +1,142 @@
package com.pnkx.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.constant.Constants;
import com.pnkx.common.constant.UserConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysMenu;
import com.pnkx.common.core.domain.model.LoginUser;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ServletUtils;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.framework.web.service.TokenService;
import com.pnkx.system.service.ISysMenuService;
/**
* 菜单信息
*
* @author phy
*/
@RestController
@RequestMapping("/system/menu")
public class SysMenuController extends BaseController {
@Autowired
private ISysMenuService menuService;
@Autowired
private TokenService tokenService;
/**
* 获取菜单列表
*/
@GetMapping("/list")
public AjaxResult list(SysMenu menu) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
Long userId = loginUser.getUser().getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return AjaxResult.success(menus);
}
/**
* 获取菜单列表(有参)
*/
@GetMapping("/listByParams")
public AjaxResult listByParams(SysMenu menu) {
return AjaxResult.success(menuService.selectMenuListByParams(menu));
}
/**
* 根据菜单编号获取详细信息
*/
@GetMapping(value = "/{menuId}")
public AjaxResult getInfo(@PathVariable Long menuId) {
return AjaxResult.success(menuService.selectMenuById(menuId));
}
/**
* 获取菜单下拉树列表
*/
@GetMapping("/treeselect")
public AjaxResult treeselect(SysMenu menu) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
Long userId = loginUser.getUser().getUserId();
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
}
/**
* 加载对应角色菜单列表树
*/
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
/**
* 新增菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysMenu menu) {
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) {
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
}
menu.setCreateBy(SecurityUtils.getUserId().toString());
return toAjax(menuService.insertMenu(menu));
}
/**
* 修改菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu))) {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
} else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS)) {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败地址必须以http(s)://开头");
} else if (menu.getMenuId().equals(menu.getParentId())) {
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
}
menu.setUpdateBy(SecurityUtils.getUserName());
return toAjax(menuService.updateMenu(menu));
}
/**
* 删除菜单
*/
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{menuId}")
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
if (menuService.hasChildByMenuId(menuId)) {
return AjaxResult.error("存在子菜单,不允许删除");
}
if (menuService.checkMenuExistRole(menuId)) {
return AjaxResult.error("菜单已分配,不允许删除");
}
return toAjax(menuService.deleteMenuById(menuId));
}
}

View File

@ -0,0 +1,103 @@
package com.pnkx.web.controller.system;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.framework.web.service.TokenService;
import com.pnkx.system.domain.SysNotice;
import com.pnkx.system.domain.SysNoticeRead;
import com.pnkx.system.domain.vo.SysNoticeVo;
import com.pnkx.system.service.ISysNoticeService;
import com.pnkx.web.websocket.controller.WebSocketController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* 公告 信息操作处理
*
* @author phy
*/
@RestController
@RequestMapping("/system/notice")
public class SysNoticeController extends BaseController {
@Resource
private ISysNoticeService noticeService;
@Resource
WebSocketController webSocketController;
/**
* 获取通知公告列表
*/
@GetMapping("/list")
public TableDataInfo list(SysNotice notice) {
startPage();
List<SysNoticeVo> list = noticeService.selectNoticeList(notice);
return getDataTable(list);
}
/**
* 获取通知公告已读列表
*/
@GetMapping("/readList")
public TableDataInfo selectNoticeRead(SysNoticeRead sysNoticeRead) {
startPage();
List<SysNoticeRead> list = noticeService.selectNoticeRead(sysNoticeRead);
return getDataTable(list);
}
/**
* 查询通知公告未读读列表
*/
@GetMapping("/getUnreadNoticeList")
public List<SysNotice> getUnreadNoticeList(SysNoticeRead sysNoticeRead) {
sysNoticeRead.setCreateBy(SecurityUtils.getUserId().toString());
return noticeService.getUnreadNoticeList(sysNoticeRead);
}
/**
* 根据通知公告编号获取详细信息
*/
@GetMapping(value = "/{noticeId}")
public AjaxResult getInfo(HttpServletRequest request, @PathVariable Long noticeId) {
return AjaxResult.success(noticeService.selectNoticeById(request, noticeId));
}
/**
* 新增通知公告
*/
@Log(title = "通知公告", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysNotice notice) {
notice.setCreateBy(SecurityUtils.getUserId().toString());
int sysNotice = noticeService.insertNotice(notice);
webSocketController.sendAllMessage(notice);
return toAjax(sysNotice);
}
/**
* 修改通知公告
*/
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
notice.setUpdateBy(SecurityUtils.getUserName());
return toAjax(noticeService.updateNotice(notice));
}
/**
* 删除通知公告
*/
@Log(title = "通知公告", businessType = BusinessType.DELETE)
@DeleteMapping("/{noticeIds}")
public AjaxResult remove(@PathVariable Long[] noticeIds) {
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
}
}

View File

@ -0,0 +1,110 @@
package com.pnkx.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.constant.UserConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.system.domain.SysPost;
import com.pnkx.system.service.ISysPostService;
/**
* 岗位信息操作处理
*
* @author phy
*/
@RestController
@RequestMapping("/system/post")
public class SysPostController extends BaseController {
@Autowired
private ISysPostService postService;
/**
* 获取岗位列表
*/
@GetMapping("/list")
public TableDataInfo list(SysPost post) {
startPage();
List<SysPost> list = postService.selectPostList(post);
return getDataTable(list);
}
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysPost post) {
List<SysPost> list = postService.selectPostList(post);
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
return util.exportExcel(list, "岗位数据");
}
/**
* 根据岗位编号获取详细信息
*/
@GetMapping(value = "/{postId}")
public AjaxResult getInfo(@PathVariable Long postId) {
return AjaxResult.success(postService.selectPostById(postId));
}
/**
* 新增岗位
*/
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysPost post) {
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setCreateBy(SecurityUtils.getUserId().toString());
return toAjax(postService.insertPost(post));
}
/**
* 修改岗位
*/
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysPost post) {
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post))) {
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
} else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post))) {
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
}
post.setUpdateBy(SecurityUtils.getUserName());
return toAjax(postService.updatePost(post));
}
/**
* 删除岗位
*/
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{postIds}")
public AjaxResult remove(@PathVariable Long[] postIds) {
return toAjax(postService.deletePostByIds(postIds));
}
/**
* 获取岗位选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect() {
List<SysPost> posts = postService.selectPostAll();
return AjaxResult.success(posts);
}
}

View File

@ -0,0 +1,130 @@
package com.pnkx.web.controller.system;
import java.io.IOException;
import com.pnkx.common.constant.WebsiteAddressConstants;
import com.pnkx.system.domain.SysFile;
import com.pnkx.system.service.ISysFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
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 org.springframework.web.multipart.MultipartFile;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.config.PnkxConfig;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysUser;
import com.pnkx.common.core.domain.model.LoginUser;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ServletUtils;
import com.pnkx.common.utils.file.FileUploadUtils;
import com.pnkx.framework.web.service.TokenService;
import com.pnkx.system.service.ISysUserService;
import javax.annotation.Resource;
/**
* 个人信息 业务处理
*
* @author phy
*/
@RestController
@RequestMapping("/system/user/profile")
public class SysProfileController extends BaseController {
@Resource
private ISysUserService userService;
@Resource
private TokenService tokenService;
@Resource
private ISysFileService sysFileService;
/**
* 个人信息
*/
@GetMapping
public AjaxResult profile() {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUserName()));
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUserName()));
return ajax;
}
/**
* 修改用户
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult updateProfile(@RequestBody SysUser user) {
if (userService.updateUserProfile(user) > 0) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser sysUser = userService.selectUserById(user.getUserId());
// 更新缓存用户信息
loginUser.setUser(sysUser);
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改个人信息异常,请联系管理员");
}
/**
* 重置密码
*/
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
@PutMapping("/updatePwd")
public AjaxResult updatePwd(String oldPassword, String newPassword) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String userName = loginUser.getUserName();
String password = loginUser.getPassword();
if (!SecurityUtils.matchesPassword(oldPassword, password)) {
return AjaxResult.error("修改密码失败,旧密码错误");
}
if (SecurityUtils.matchesPassword(newPassword, password)) {
return AjaxResult.error("新密码不能与旧密码相同");
}
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0) {
// 更新缓存用户密码
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
tokenService.setLoginUser(loginUser);
return AjaxResult.success();
}
return AjaxResult.error("修改密码异常,请联系管理员");
}
/**
* 头像上传
*/
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
@PostMapping("/avatar")
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) {
if (!file.isEmpty()) {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String avatar = sysFileService.uploadMultipartFile(file, "avatar");
String url = WebsiteAddressConstants.FTP_SITE_ADDRESS + avatar;
SysFile sysFile = new SysFile();
sysFile.setPath(avatar);
sysFile.setUrl(url);
sysFile.setName(file.getOriginalFilename());
sysFile.setPort("用户头像上传");
sysFile.setType("yhtx");
sysFileService.insertSysFile(sysFile);
if (userService.updateUserAvatar(loginUser.getUserName(), url)) {
AjaxResult ajax = AjaxResult.success();
ajax.put("imgUrl", url);
// 更新缓存用户头像
loginUser.getUser().setAvatar(url);
tokenService.setLoginUser(loginUser);
return ajax;
}
}
return AjaxResult.error("上传图片异常,请联系管理员");
}
}

View File

@ -0,0 +1,155 @@
package com.pnkx.web.controller.system;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.constant.UserConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysRole;
import com.pnkx.common.core.domain.model.LoginUser;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ServletUtils;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.framework.web.service.SysPermissionService;
import com.pnkx.framework.web.service.TokenService;
import com.pnkx.system.service.ISysRoleService;
import com.pnkx.system.service.ISysUserService;
/**
* 角色信息
*
* @author phy
*/
@RestController
@RequestMapping("/system/role")
public class SysRoleController extends BaseController {
@Autowired
private ISysRoleService roleService;
@Autowired
private TokenService tokenService;
@Autowired
private SysPermissionService permissionService;
@Autowired
private ISysUserService userService;
@GetMapping("/list")
public TableDataInfo list(SysRole role) {
startPage();
List<SysRole> list = roleService.selectRoleList(role);
return getDataTable(list);
}
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysRole role) {
List<SysRole> list = roleService.selectRoleList(role);
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
return util.exportExcel(list, "角色数据");
}
/**
* 根据角色编号获取详细信息
*/
@GetMapping(value = "/{roleId}")
public AjaxResult getInfo(@PathVariable Long roleId) {
return AjaxResult.success(roleService.selectRoleById(roleId));
}
/**
* 新增角色
*/
@Log(title = "角色管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysRole role) {
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setCreateBy(SecurityUtils.getUserId().toString());
return toAjax(roleService.insertRole(role));
}
/**
* 修改保存角色
*/
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role))) {
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
} else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role))) {
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
}
role.setUpdateBy(SecurityUtils.getUserName());
if (roleService.updateRole(role) > 0) {
// 更新缓存用户权限
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin()) {
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
tokenService.setLoginUser(loginUser);
}
return AjaxResult.success();
}
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
}
/**
* 修改保存数据权限
*/
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/dataScope")
public AjaxResult dataScope(@RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
return toAjax(roleService.authDataScope(role));
}
/**
* 状态修改
*/
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysRole role) {
roleService.checkRoleAllowed(role);
role.setUpdateBy(SecurityUtils.getUserName());
return toAjax(roleService.updateRoleStatus(role));
}
/**
* 删除角色
*/
@Log(title = "角色管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{roleIds}")
public AjaxResult remove(@PathVariable Long[] roleIds) {
return toAjax(roleService.deleteRoleByIds(roleIds));
}
/**
* 获取角色选择框列表
*/
@GetMapping("/optionselect")
public AjaxResult optionselect() {
return AjaxResult.success(roleService.selectRoleAll());
}
}

View File

@ -0,0 +1,169 @@
package com.pnkx.web.controller.system;
import com.pnkx.common.annotation.Log;
import com.pnkx.common.constant.UserConstants;
import com.pnkx.common.core.controller.BaseController;
import com.pnkx.common.core.domain.AjaxResult;
import com.pnkx.common.core.domain.entity.SysRole;
import com.pnkx.common.core.domain.entity.SysUser;
import com.pnkx.common.core.domain.model.LoginUser;
import com.pnkx.common.core.page.TableDataInfo;
import com.pnkx.common.enums.BusinessType;
import com.pnkx.common.utils.ExcelUtil;
import com.pnkx.common.utils.SecurityUtils;
import com.pnkx.common.utils.ServletUtils;
import com.pnkx.common.utils.StringUtils;
import com.pnkx.framework.web.service.TokenService;
import com.pnkx.system.service.ISysPostService;
import com.pnkx.system.service.ISysRoleService;
import com.pnkx.system.service.ISysUserService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.List;
import java.util.stream.Collectors;
/**
* 用户信息
*
* @author phy
*/
@RestController
@RequestMapping("/system/user")
public class SysUserController extends BaseController {
@Resource
private ISysUserService userService;
@Resource
private ISysRoleService roleService;
@Resource
private ISysPostService postService;
@Resource
private TokenService tokenService;
/**
* 获取用户列表
*/
@GetMapping("/list")
public TableDataInfo list(SysUser user) {
startPage();
List<SysUser> list = userService.selectUserList(user);
return getDataTable(list);
}
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(SysUser user) {
List<SysUser> list = userService.selectUserList(user);
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.exportExcel(list, "用户数据");
}
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
@PostMapping("/importData")
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
List<SysUser> userList = util.importExcel(file.getInputStream());
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
String operName = loginUser.getUserName();
String message = userService.importUser(userList, updateSupport, operName);
return AjaxResult.success(message);
}
@GetMapping("/importTemplate")
public AjaxResult importTemplate() {
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
return util.importTemplateExcel("用户数据");
}
/**
* 根据用户编号获取详细信息
*/
@GetMapping(value = {"/", "/{userId}"})
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId) {
AjaxResult ajax = AjaxResult.success();
List<SysRole> roles = roleService.selectRoleAll();
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId)) {
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
}
return ajax;
}
/**
* 新增用户
*/
@Log(title = "用户管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody SysUser user) {
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName()))) {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
} else if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
} else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setCreateBy(SecurityUtils.getUserId().toString());
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
return toAjax(userService.insertUser(user));
}
/**
* 修改用户
*/
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody SysUser user) {
userService.checkUserAllowed(user);
if (StringUtils.isNotEmpty(user.getPhonenumber())
&& UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user))) {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
} else if (StringUtils.isNotEmpty(user.getEmail())
&& UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user))) {
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
}
user.setUpdateBy(SecurityUtils.getUserName());
return toAjax(userService.updateUser(user));
}
/**
* 删除用户
*/
@Log(title = "用户管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{userIds}")
public AjaxResult remove(@PathVariable Long[] userIds) {
return toAjax(userService.deleteUserByIds(userIds));
}
/**
* 重置密码
*/
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/resetPwd")
public AjaxResult resetPwd(@RequestBody SysUser user) {
userService.checkUserAllowed(user);
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
user.setUpdateBy(SecurityUtils.getUserName());
return toAjax(userService.resetPwd(user));
}
/**
* 状态修改
*/
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
@PutMapping("/changeStatus")
public AjaxResult changeStatus(@RequestBody SysUser user) {
userService.checkUserAllowed(user);
user.setUpdateBy(SecurityUtils.getUserName());
return toAjax(userService.updateUserStatus(user));
}
}

View File

@ -0,0 +1,20 @@
package com.pnkx.web.controller.tool;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import com.pnkx.common.core.controller.BaseController;
/**
* swagger 接口
*
* @author phy
*/
@Controller
@RequestMapping("/tool/swagger")
public class SwaggerController extends BaseController {
@GetMapping()
public String index() {
return redirect("/swagger-ui.html");
}
}

View File

@ -0,0 +1,103 @@
package com.pnkx.web.websocket.controller;
import com.pnkx.web.websocket.encoder.NoticeEncoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.websocket.OnClose;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.CopyOnWriteArraySet;
/**
* WebSocket
*
* @author 裴浩宇
* @version 1.0
* @date 2023/11/14 11:46
* @description WebSocket
*/
@Component
@ServerEndpoint(value = "/websocket/{userName}", encoders = { NoticeEncoder.class })
public class WebSocketController {
private static final Logger log = LoggerFactory.getLogger(WebSocketController.class);
private static final CopyOnWriteArraySet<WebSocketController> WEB_SOCKETS = new CopyOnWriteArraySet<>();
private static final Map<String, Session> SESSION_POOL = new HashMap<String, Session>();
private Session session;
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
WebSocketController webSocketController = (WebSocketController) o;
return Objects.equals(session, webSocketController.session);
}
@Override
public int hashCode() {
return Objects.hash(session);
}
@OnOpen
public void onOpen(Session session, @PathParam(value = "userName") String userName) {
this.session = session;
WEB_SOCKETS.add(this);
SESSION_POOL.put(userName, session);
log.info("【websocket消息】有新的连接新连接用户名为{},总数为:{}", userName, WEB_SOCKETS.size());
}
@OnClose
public void onClose(@PathParam(value = "userName") String userName) {
WEB_SOCKETS.remove(this);
log.info("【websocket消息】连接断开总数为{}", WEB_SOCKETS.size());
}
@OnMessage
public void onMessage(String message) {
log.info("【websocket消息】收到客户端消息{}", message);
}
/**
* 此为广播消息
*/
public void sendAllMessage(Object object) {
log.info("【websocket消息】广播消息{}", object.toString());
for (WebSocketController webSocketController : WEB_SOCKETS) {
try {
webSocketController.session.getAsyncRemote().sendObject(object);
} catch (Exception e) {
log.error("广播消息异常,异常信息:{}", e.getMessage());
}
}
}
/**
* 此为单点消息
*/
public void sendOneMessage(String userName, String message) {
log.info("【websocket消息】单点消息{}", message);
Session oneSession = SESSION_POOL.get(userName);
if (oneSession != null) {
try {
oneSession.getAsyncRemote().sendText(message);
} catch (Exception e) {
log.error("单点消息异常,异常信息:{}", e.getMessage());
}
}
}
}

View File

@ -0,0 +1,27 @@
package com.pnkx.web.websocket.domain;
/**
* MessageType
*
* @author 裴浩宇
* @version 1.0
* @date 2023/11/14 16:20
* @description 消息类型
*/
public class MessageType {
/**
* 登录
*/
public static final String LOGIN = "login";
/**
* 退出登录
*/
public static final String LOG_OUT = "log_out";
/**
* 聊天消息
*/
public static final String CHAT_MESSAGE = "chat_message";
}

View File

@ -0,0 +1,39 @@
package com.pnkx.web.websocket.domain;
import lombok.Data;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* Notice
*
* @author 裴浩宇
* @version 1.0
* @date 2023/11/14 16:01
* @description WebSocket消息实体
*/
@Data
public class WebSocketMessage {
/**
* 消息类型
*/
private String webSocket;
/**
* 用户ID
*/
private String userId;
/**
* 信息内容
*/
private Object message;
// 获取当前时间
LocalDateTime now = LocalDateTime.now();
// 定义日期时间格式
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
/**
* 发送时间
*/
private String sendTime = now.format(formatter);
}

View File

@ -0,0 +1,37 @@
package com.pnkx.web.websocket.encoder;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.pnkx.web.websocket.domain.WebSocketMessage;
import javax.websocket.Encoder;
import javax.websocket.EndpointConfig;
/**
* @author by PHY
* @classname NoticeEncoder
* @date 2022/8/23 15:22
* @description: 描述
*/
public class NoticeEncoder implements Encoder.Text<WebSocketMessage> {
@Override
public String encode(WebSocketMessage webSocketMessage) {
try {
JsonMapper jsonMapper = new JsonMapper();
return jsonMapper.writeValueAsString(webSocketMessage);
} catch ( JsonProcessingException e) {
e.printStackTrace();
return null;
}
}
@Override
public void init(EndpointConfig endpointConfig) {
}
@Override
public void destroy() {
}
}

View File

@ -0,0 +1 @@
restart.include.json=/com.alibaba.fastjson.*.jar

View File

@ -0,0 +1,92 @@
# 项目相关配置
pnkx:
# 文件路径 示例( Windows配置D:/office/project-path/pnkx/uploadPathLinux配置 /home/pnkx/uploadPath
profile: D:/project-path/pnkx/uploadPath
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /dev-api
# 数据源配置
spring:
# redis 配置
redis:
# 地址
host: localhost
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://120.53.247.15:3306/pnkx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
userName: root
password: pnkx0930
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
userName:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-userName:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -0,0 +1,92 @@
# 项目相关配置
pnkx:
# 文件路径 示例( Windows配置D:/pnkx/uploadPathLinux配置 /home/pnkx/uploadPath
profile: /home/pnkx/uploadPath
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /prod-api
# 数据源配置
spring:
# redis 配置
redis:
# 地址
host: 192.168.31.43
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.31.43:3306/pnkx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
userName: root
password: 123456
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
userName:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-userName:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -0,0 +1,92 @@
# 项目相关配置
pnkx:
# 文件路径 示例( Windows配置D:/pnkx/uploadPathLinux配置 /home/pnkx/uploadPath
profile: /home/pnkx/uploadPath
# Swagger配置
swagger:
# 是否开启swagger
enabled: true
# 请求前缀
pathMapping: /prod-api
# 数据源配置
spring:
# redis 配置
redis:
# 地址
host: localhost
# 端口默认为6379
port: 6379
# 数据库索引
database: 0
# 密码
password:
# 连接超时时间
timeout: 10s
lettuce:
pool:
# 连接池中的最小空闲连接
min-idle: 0
# 连接池中的最大空闲连接
max-idle: 8
# 连接池的最大数据库连接数
max-active: 8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
druid:
# 主库数据源
master:
url: jdbc:mysql://120.53.247.15:3306/pnkx?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
userName: root
password: pnkx0930
# 从库数据源
slave:
# 从数据源开关/默认关闭
enabled: false
url:
userName:
password:
# 初始连接数
initialSize: 5
# 最小连接池数量
minIdle: 10
# 最大连接池数量
maxActive: 20
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
# 配置一个连接在池中最大生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000
# 配置检测连接是否有效
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
webStatFilter:
enabled: true
statViewServlet:
enabled: true
# 设置白名单,不填则允许所有访问
allow:
url-pattern: /druid/*
# 控制台管理用户名和密码
login-userName:
login-password:
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true

View File

@ -0,0 +1,108 @@
# 项目相关配置
pnkx:
# 名称
name: Pnkx
# 版本
version: 3.3.0
# 版权年份
copyrightYear: 2021
# 实例演示开关
demoEnabled: true
# 获取ip地址开关
addressEnabled: true
# 验证码类型 math 数组计算 char 字符验证
captchaType: math
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
port: 8068
servlet:
# 应用的访问路径
context-path: /
tomcat:
# tomcat的URI编码
uri-encoding: UTF-8
# tomcat最大线程数默认为200
max-threads: 800
# Tomcat启动初始化的线程数默认值25
min-spare-threads: 30
# 日志配置
logging:
level:
com.pnkx: debug
org.springframework: warn
# Spring配置
spring:
# 资源信息
messages:
# 国际化资源文件路径
basename: i18n/messages
profiles:
active: prod
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 30MB
# 设置总上传的文件大小
max-request-size: 100MB
# 服务模块
devtools:
restart:
# 热部署开关
enabled: false
# 邮箱配置
mail:
host: smtp.qq.com
userName: 617594538@qq.com
#邮箱授权码
password: gormkqlrtleobecb
properties:
mail:
smtp:
socketFactory:
class: javax.net.ssl.SSLSocketFactory
port: 465
ssl:
trust: smtp.qq.com
auth: true
starttls:
enable: true
required: true
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 43200
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.pnkx.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
params: count=countSql
# 防止XSS攻击
xss:
# 过滤开关
enabled: true
# 排除链接(多个用逗号分隔)
excludes: /system/notice/*
# 匹配链接
urlPatterns: /system/*,/monitor/*,/tool/*

View File

@ -0,0 +1,13 @@
Application Version: ${pnkx.version}
Spring Boot Version: ${spring-boot.version}
.----------------. .-----------------. .----------------. .----------------.
| .--------------. || .--------------. || .--------------. || .--------------. |
| | ______ | || | ____ _____ | || | ___ ____ | || | ____ ____ | |
| | |_ __ \ | || ||_ \|_ _| | || | |_ ||_ _| | || | |_ _||_ _| | |
| | | |__) | | || | | \ | | | || | | |_/ / | || | \ \ / / | |
| | | ___/ | || | | |\ \| | | || | | __'. | || | > `' < | |
| | _| |_ | || | _| |_\ |_ | || | _| | \ \_ | || | _/ /'`\ \_ | |
| | |_____| | || ||_____|\____| | || | |____||____| | || | |____||____| | |
| | | || | | || | | || | | |
| '--------------' || '--------------' || '--------------' || '--------------' |
'----------------' '----------------' '----------------' '----------------'

View File

@ -0,0 +1,31 @@
#错误消息
not.null=* 必须填写
user.jcaptcha.error=验证码错误
user.jcaptcha.expire=验证码已失效
user.not.exists=用户不存在/密码错误
user.password.not.match=用户不存在/密码错误
user.password.retry.limit.count=密码输入错误{0}次
user.password.retry.limit.exceed=密码输入错误{0}次帐户锁定10分钟
user.password.delete=对不起,您的账号已被删除
user.blocked=用户已封禁,请联系管理员
role.blocked=角色已封禁,请联系管理员
user.logout.success=退出成功
length.not.valid=长度必须在{min}到{max}个字符之间
user.userName.not.valid=* 2到20个汉字、字母、数字或下划线组成且必须以非数字开头
user.password.not.valid=* 5-50个字符
user.email.not.valid=邮箱格式错误
user.mobile.phone.number.not.valid=手机号格式错误
user.login.success=登录成功
user.notfound=请重新登录
user.forcelogout=管理员强制退出,请重新登录
user.unknown.error=未知错误,请重新登录
##文件上传消息
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB
upload.filename.exceed.length=上传的文件名最长{0}个字符
##权限
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- 日志存放路径 -->
<property name="log.path" value="/home/pnkx/logs"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 按天回滚 daily -->
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.pnkx" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>

View File

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="cacheEnabled" value="true"/> <!-- 全局映射器启用缓存 -->
<setting name="useGeneratedKeys" value="true"/> <!-- 允许 JDBC 支持自动生成主键 -->
<setting name="defaultExecutorType" value="REUSE"/> <!-- 配置默认的执行器 -->
<setting name="logImpl" value="SLF4J"/> <!-- 指定 MyBatis 所用日志的具体实现 -->
<!-- <setting name="mapUnderscoreToCamelCase" value="true"/> &lt;!&ndash;驼峰式命名 &ndash;&gt;-->
</settings>
</configuration>

185
pnkx-app-apk/index.html Normal file

File diff suppressed because one or more lines are too long

272
pnkx-app-apk/manifest.json Normal file
View File

@ -0,0 +1,272 @@
{
"@platforms" : [ "android", "iPhone", "iPad" ],
"id" : "H5A8E5E14", /**/
"name" : "Pei你看雪", /**/
"version" : {
"name" : "v1.4.1", /**/
"code" : 141
},
"description" : "pei你看雪博客后台管理", /**/
"icons" : {
"72" : "icon.png"
},
"launch_path" : "index.html", /*index.htmlhttp://https://*/
"developer" : {
"name" : "pnkx", /**/
"email" : "617594538@qq.com", /**/
"url" : "https://phy0412.top" /**/
},
"permissions" : {
"Accelerometer" : {
"description" : "访问加速度感应器"
},
"Audio" : {
"description" : "访问麦克风"
},
"Messaging" : {
"description" : "短彩邮件插件"
},
"Cache" : {
"description" : "管理应用缓存"
},
"Camera" : {
"description" : "访问摄像头"
},
"Console" : {
"description" : "跟踪调试输出日志"
},
"Contacts" : {
"description" : "访问系统联系人信息"
},
"Device" : {
"description" : "访问设备信息"
},
"Downloader" : {
"description" : "文件下载管理"
},
"Events" : {
"description" : "应用扩展事件"
},
"File" : {
"description" : "访问本地文件系统"
},
"Gallery" : {
"description" : "访问系统相册"
},
"Geolocation" : {
"description" : "访问位置信息"
},
"Invocation" : {
"description" : "使用Native.js能力"
},
"Orientation" : {
"description" : "访问方向感应器"
},
"Proximity" : {
"description" : "访问距离感应器"
},
"Storage" : {
"description" : "管理应用本地数据"
},
"Uploader" : {
"description" : "管理文件上传任务"
},
"Runtime" : {
"description" : "访问运行期环境"
},
"XMLHttpRequest" : {
"description" : "跨域网络访问"
},
"Zip" : {
"description" : "文件压缩与解压缩"
},
"Barcode" : {
"description" : "管理二维码扫描插件"
},
"Maps" : {
"description" : "管理地图插件"
},
"Speech" : {
"description" : "管理语音识别插件"
},
"Webview" : {
"description" : "窗口管理"
},
"NativeUI" : {
"description" : "原生UI控件"
},
"Navigator" : {
"description" : "浏览器信息"
},
"NativeObj" : {
"description" : "原生对象"
},
"Push" : {}
},
"plus" : {
"splashscreen" : {
"autoclose" : true, /*truefalseplus.navigator.closeSplashscreen()*/
"waiting" : true /*truefalse*/
},
"popGesture" : "close", /*Webview"none""hide"Webviewhttp://ask.dcloud.net.cn/article/102*/
"runmode" : "normal", /*liberatenormalliberateAndroidFile API访_www*/
"signature" : "Sk9JTiBVUyBtYWlsdG86aHIyMDEzQGRjbG91ZC5pbw==", /*使*/
"distribute" : {
"apple" : {
"appid" : "", /*iOSappidio.dcloud.HelloH5*/
"mobileprovision" : "", /*iOS*/
"password" : "", /*iOS*/
"p12" : "", /*iOS*/
"devices" : "universal", /*iOSiphone/ipad/universal*/
"frameworks" : [] /*Native.jsObjective-c APIFrameWorkGameCenter"GameKit.framework"*/
},
"google" : {
"packagename" : "", /*Androidio.dcloud.HelloH5*/
"keystore" : "", /*Android使*/
"password" : "", /*Android使*/
"aliasname" : "", /*Android使*/
"permissions" : [
"<uses-feature android:name=\"android.hardware.camera\"/>",
"<uses-feature android:name=\"android.hardware.camera.autofocus\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.ACCESS_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.CALL_PHONE\"/>",
"<uses-permission android:name=\"android.permission.CAMERA\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_NETWORK_STATE\"/>",
"<uses-permission android:name=\"android.permission.CHANGE_WIFI_STATE\"/>",
"<uses-permission android:name=\"android.permission.FLASHLIGHT\"/>",
"<uses-permission android:name=\"android.permission.GET_ACCOUNTS\"/>",
"<uses-permission android:name=\"android.permission.INTERNET\"/>",
"<uses-permission android:name=\"android.permission.MODIFY_AUDIO_SETTINGS\"/>",
"<uses-permission android:name=\"android.permission.MOUNT_UNMOUNT_FILESYSTEMS\"/>",
"<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.READ_LOGS\"/>",
"<uses-permission android:name=\"android.permission.READ_PHONE_STATE\"/>",
"<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>",
"<uses-permission android:name=\"android.permission.VIBRATE\"/>",
"<uses-permission android:name=\"android.permission.WAKE_LOCK\"/>",
"<uses-permission android:name=\"android.permission.WRITE_CONTACTS\"/>",
"<uses-permission android:name=\"android.permission.WRITE_EXTERNAL_STORAGE\"/>",
"<uses-permission android:name=\"android.permission.WRITE_SETTINGS\"/>"
]
},
/*使Native.jsAPI使*/
"orientation" : [ "portrait-primary" ], /*portrait-primaryportrait-secondarylandscape-primarylandscape-secondary*/
"icons" : {
"ios" : {
"prerendered" : true, /*iOS6*/
"auto" : "", /*512x512*/
"iphone" : {
"normal" : "", /*iPhone3/3GS57x57*/
"retina" : "", /*iPhone4114x114*/
"retina7" : "", /*iPhone4S/5/6120x120*/
"retina8" : "", /*iPhone6 Plus180x180*/
"spotlight-normal" : "", /*iPhone3/3GS Spotlight29x29*/
"spotlight-retina" : "", /*iPhone4 Spotlight58x58*/
"spotlight-retina7" : "", /*iPhone4S/5/6 Spotlight80x80*/
"settings-normal" : "", /*iPhone429x29*/
"settings-retina" : "", /*iPhone4S/5/658x58*/
"settings-retina8" : "", /*iPhone6Plus87x87*/
"app@2x" : "unpackage/res/icons/120x120.png",
"app@3x" : "unpackage/res/icons/180x180.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"notification@3x" : "unpackage/res/icons/60x60.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"settings@3x" : "unpackage/res/icons/87x87.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png",
"spotlight@3x" : "unpackage/res/icons/120x120.png"
},
"ipad" : {
"normal" : "", /*iPad72x72*/
"retina" : "", /*iPad144x144*/
"normal7" : "", /*iPad iOS776x76*/
"retina7" : "", /*iPad iOS7152x152*/
"spotlight-normal" : "", /*iPad Spotlight50x50*/
"spotlight-retina" : "", /*iPadSpotlight100x100*/
"spotlight-normal7" : "", /*iPad iOS7 Spotlight40x40*/
"spotlight-retina7" : "", /*iPad iOS7Spotlight80x80*/
"settings-normal" : "", /*iPad29x29*/
"settings-retina" : "", /*iPad58x58*/
"app" : "unpackage/res/icons/76x76.png",
"app@2x" : "unpackage/res/icons/152x152.png",
"notification" : "unpackage/res/icons/20x20.png",
"notification@2x" : "unpackage/res/icons/40x40.png",
"proapp@2x" : "unpackage/res/icons/167x167.png",
"settings" : "unpackage/res/icons/29x29.png",
"settings@2x" : "unpackage/res/icons/58x58.png",
"spotlight" : "unpackage/res/icons/40x40.png",
"spotlight@2x" : "unpackage/res/icons/80x80.png"
},
"appstore" : "unpackage/res/icons/1024x1024.png"
},
"android" : {
"mdpi" : "", /*48x48*/
"ldpi" : "", /*48x48*/
"hdpi" : "unpackage/res/icons/72x72.png", /*72x72*/
"xhdpi" : "unpackage/res/icons/96x96.png", /*720P96x96*/
"xxhdpi" : "unpackage/res/icons/144x144.png", /*1080P 144x144*/
"xxxhdpi" : "unpackage/res/icons/192x192.png"
}
},
"splashscreen" : {
"ios" : {
"iphone" : {
"default" : "", /*iPhone3320x480*/
"retina35" : "", /*3.5(iPhone4)640x960*/
"retina40" : "", /*4.0 (iPhone5/iPhone5s)640x1136*/
"retina47" : "", /*4.7 (iPhone6)750x1334*/
"retina55" : "", /*5.5 (iPhone6 Plus)1242x2208*/
"retina55l" : "" /*5.5 (iPhone6 Plus)2208x1242*/
},
"ipad" : {
"portrait" : "", /*iPad768x1004*/
"portrait-retina" : "", /*iPad1536x2008*/
"landscape" : "", /*iPad1024x748*/
"landscape-retina" : "", /*iPad2048x1496*/
"portrait7" : "", /*iPad iOS7768x1024*/
"portrait-retina7" : "", /*iPad iOS71536x2048*/
"landscape7" : "", /*iPad iOS71024x768*/
"landscape-retina7" : "" /*iPad iOS72048x1536*/
}
},
"android" : {
"mdpi" : "", /*240x282*/
"ldpi" : "", /*320x442*/
"hdpi" : "C:/Users/PHY/Pictures/Camera Roll/临时/ce4205363983829f50a9b1b85f30ff63.png", /*480x762*/
"xhdpi" : "", /*720P720x1242*/
"xxhdpi" : "" /*1080P1080x1882*/
},
"androidStyle" : "common",
"useOriginalMsgbox" : false
},
"plugins" : {
"speech" : {
"ifly" : {}
},
"ad" : {},
"push" : {
"unipush" : {}
},
"geolocation" : {
"amap" : {
"__platform__" : [ "android" ],
"appkey_ios" : "828bd02670b3e277d27adb31ad31025c",
"appkey_android" : "828bd02670b3e277d27adb31ad31025c"
}
},
"maps" : {
"amap" : {
"appkey_ios" : "828bd02670b3e277d27adb31ad31025c",
"appkey_android" : "828bd02670b3e277d27adb31ad31025c"
}
}
},
"ios" : {
"dSYMs" : false
}
}
},
"screenOrientation" : [ "portrait-primary" ]
}

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
.page[data-v-4d770394]{padding-top:1rem}

View File

@ -0,0 +1 @@
.icon-body[data-v-91bd4486]{padding:1rem;margin:1rem;border-radius:.5rem;background-color:#fff}.icon-body .van-grid[data-v-91bd4486]{margin-top:1rem}.icon-body .van-grid .van-grid-item[data-v-91bd4486]{width:4rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.icon-body .van-grid .van-grid-item[data-v-91bd4486] .van-grid-item__content{width:100%;height:100%}.icon-body .van-grid .van-grid-item .svg-icon[data-v-91bd4486]{width:1.2rem;height:1.5rem}.icon-body .van-grid .van-grid-item span[data-v-91bd4486]{margin-top:.2rem;font-size:.8rem}.icon[data-v-4b9f7789]{padding-bottom:1rem}

View File

@ -0,0 +1 @@
.message-review .van-cell-group[data-v-153af935]{margin-top:1rem}.message-review .van-cell-group .cell-left .message-content[data-v-153af935]{color:#7a7a7a}.message-review .van-cell-group .cell-left .author-name[data-v-153af935]{color:#5a8dee}.message-review .van-empty[data-v-153af935]{background-color:#fff;margin:1rem;border-radius:.5rem}.message-review .van-popup[data-v-153af935]{top:30%;border-radius:.5rem}.message-review .handle-content[data-v-153af935]{width:20rem;padding:1rem}.message-review .handle-content .handle-title[data-v-153af935]{text-align:center;font-size:1.2rem;font-weight:700;margin-bottom:1rem}.message-review .handle-content .message-one[data-v-153af935]{border-bottom:1px solid #7a7a7a;margin-top:.5rem}.message-review .handle-content .button[data-v-153af935]{padding:2rem 1rem 0 1rem}

View File

@ -0,0 +1 @@
.to-do .van-cell-group[data-v-2d408e8c]{margin-top:1rem}

View File

@ -0,0 +1 @@
.card .card-list[data-v-1942c180]{padding:1rem}.card .card-list .card-item[data-v-1942c180]{margin-top:1rem;padding:.5rem;height:8rem;border:1px solid #fff;border-radius:.4rem}.card .card-list .card-item[data-v-1942c180]:first-child{margin-top:0}.card .card-list .card-item .card-image[data-v-1942c180]{height:100%}.card .card-list .card-item .card-image .card-picture[data-v-1942c180]{height:100%;width:100%}.card .card-list .card-item .card-content[data-v-1942c180]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-pack:distribute;justify-content:space-around;height:100%;padding-left:.5rem}.card .card-list .card-item .card-content .card-title[data-v-1942c180]{font-family:;font-size:1rem;font-weight:700;color:#5a8dee}.card .card-list .card-item .card-content .card-desc[data-v-1942c180]{font-size:.8rem}.card .card-list .card-item .card-operation[data-v-1942c180]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;height:100%}.card .card-list .card-item .card-operation .card-count[data-v-1942c180],.card .card-list .card-item .card-operation .card-use[data-v-1942c180]{font-size:.8rem}.card .use-hint[data-v-1942c180]{margin:.5rem 0}.card .use-button[data-v-1942c180],.card .use-hint[data-v-1942c180]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center}.card .use-button .van-button[data-v-1942c180]{width:35%;margin:.5rem .5rem 1rem}.card .use-button .van-button.van-button--plain[data-v-1942c180]{border:1px solid #7a7a7a}

View File

@ -0,0 +1 @@
.account[data-v-1062802a]{padding-bottom:1rem}.account .page .account-type .assets[data-v-1062802a]{color:#7a7a7a;font-size:.9rem}.account .page .account-type .van-swipe-cell[data-v-1062802a]{margin-top:1rem}.account .page .account-type .van-swipe-cell .right .label[data-v-1062802a]{font-size:.7rem;color:#7a7a7a}

View File

@ -0,0 +1 @@
.add-photo .van-cell-group[data-v-72de0e7b]{margin-top:1rem}.add-photo .van-cell-group .van-image[data-v-72de0e7b]{margin:1rem}.add-photo .van-cell-group .van-button[data-v-72de0e7b]{width:4rem;height:2rem}.add-photo .van-cell-group .van-uploader[data-v-72de0e7b]{margin:1rem}

View File

@ -0,0 +1 @@
.van-cell-group[data-v-344d0b75]{margin-top:1rem}

View File

@ -0,0 +1 @@
.diary .el-calendar[data-v-2cebeb7c]{margin:1rem;border-radius:.5rem}.diary[data-v-2cebeb7c] .el-calendar-day{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:4rem!important}.diary .diary-logon[data-v-2cebeb7c]{-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:end;-ms-flex-align:end;align-items:flex-end;height:1.8rem}.diary .diary-content .el-form-item[data-v-2cebeb7c],.diary .diary-content[data-v-2cebeb7c],.diary .diary-logon[data-v-2cebeb7c]{display:-webkit-box;display:-ms-flexbox;display:flex}

View File

@ -0,0 +1 @@
.van-grid[data-v-294fda57]{margin-top:1rem}.van-grid[data-v-294fda57] .van-grid-item__content{border-radius:.5rem}.van-grid[data-v-294fda57] .van-grid-item__content .van-image ::v-deep img{width:100%;height:100%}.van-grid[data-v-294fda57] .van-grid-item__content .album-name{margin-top:.5rem}

View File

@ -0,0 +1 @@
.to-do-list[data-v-27c9c58a]{padding-bottom:1rem}.to-do-list .van-cell-group[data-v-27c9c58a]{margin-top:1rem}.to-do-list .van-cell-group .van-swipe-cell[data-v-27c9c58a]{margin:0!important}.to-do-list .van-cell-group .van-icon[data-v-27c9c58a]{font-size:1.2rem}.to-do-list .to-do-details[data-v-27c9c58a]{padding:1rem}.to-do-list .to-do-details .to-do-one[data-v-27c9c58a]{padding:.5rem 0;border-bottom:1px solid #7a7a7a}.to-do-list .to-do-details .to-do-title[data-v-27c9c58a]{margin-bottom:1rem;font-size:1.2rem;color:#5a8dee}.to-do-list .van-pagination[data-v-27c9c58a]{margin:1rem}

View File

@ -0,0 +1 @@
.manage .page[data-v-46241efc]{padding:1rem 0}.manage .page[data-v-46241efc] .van-grid-item__content{border-radius:.5rem}.manage .page[data-v-46241efc] .van-grid-item__content .svg-icon{font-size:1.5rem}.manage .page[data-v-46241efc] .van-grid-item__content .menu-name{font-size:.8rem;color:#7a7a7a;margin-top:.2rem}.manage .page[data-v-46241efc] .van-grid-item__content .num{height:1.5rem;width:1.5rem;position:absolute;margin:-5rem -5rem 0 0;background-color:red;border-radius:50%;line-height:1.5rem;text-align:center;color:#fff}

View File

@ -0,0 +1 @@
.commemoration-day .van-cell-group[data-v-d1b94e54]{margin-top:1rem;padding:1rem}.commemoration-day .van-cell-group .van-row .svg-icon[data-v-d1b94e54]{font-size:2rem;margin-right:1rem}.commemoration-day .van-cell-group .middle .top[data-v-d1b94e54]{font-size:1rem;font-weight:700}.commemoration-day .van-cell-group .bottom[data-v-d1b94e54]{font-size:.8rem;margin-top:.2rem}

View File

@ -0,0 +1 @@
.icon-body[data-v-91bd4486]{padding:1rem;margin:1rem;border-radius:.5rem;background-color:#fff}.icon-body .van-grid[data-v-91bd4486]{margin-top:1rem}.icon-body .van-grid .van-grid-item[data-v-91bd4486]{width:4rem;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.icon-body .van-grid .van-grid-item[data-v-91bd4486] .van-grid-item__content{width:100%;height:100%}.icon-body .van-grid .van-grid-item .svg-icon[data-v-91bd4486]{width:1.2rem;height:1.5rem}.icon-body .van-grid .van-grid-item span[data-v-91bd4486]{margin-top:.2rem;font-size:.8rem}

View File

@ -0,0 +1 @@
.my .van-cell-group[data-v-48199a18]{margin-bottom:.5rem}.my .user-header[data-v-48199a18]{margin:1rem 0}.my .user-header .van-image[data-v-48199a18],.my .user-header .van-image[data-v-48199a18] img{border-radius:50%}.my .user-name[data-v-48199a18]{color:#5a8dee;font-size:1.2rem;font-weight:700;margin-bottom:1rem;background-color:#fff;padding:1rem 0}.my .log-out[data-v-48199a18]{position:absolute;bottom:7rem;margin-left:calc(50% - 5rem)}.my .log-out .van-button[data-v-48199a18]{width:10rem}.my .version-info[data-v-48199a18]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-flow:column;flex-flow:column;-webkit-box-align:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;color:#7a7a7a;font-size:.8rem;position:absolute;width:100%;bottom:4rem}.my .version-info .van-row[data-v-48199a18]:first-child{margin-bottom:.2rem}.my[data-v-48199a18] .van-dialog__header{font-weight:700}

View File

@ -0,0 +1 @@
.record[data-v-6539b543]{padding-bottom:1rem}.record .page .bookkeeping-background .expenditure span[data-v-6539b543]:first-child{color:#f8ce5e;font-size:1.2rem;margin-right:.2rem}.record .page .bookkeeping-background .expenditure span[data-v-6539b543]:nth-child(2){font-size:.8rem}.record .page .bookkeeping-background .income[data-v-6539b543]{margin-top:.5rem}.record .page .bookkeeping-background .income .van-col[data-v-6539b543]:first-child{font-size:.8rem;margin-right:.4rem}.record .page .van-cell-group[data-v-6539b543]{margin-bottom:1rem}.record .page .van-cell-group .transfer[data-v-6539b543]{width:60vw!important}.record .page .van-cell-group .blue .van-cell__value[data-v-6539b543]{color:#5a8dee!important}.record .page .van-cell-group .red .van-cell__value[data-v-6539b543]{color:#f1523a!important}.record .page .van-cell-group .gray .van-cell__value[data-v-6539b543]{color:#7a7a7a!important}.record .page .van-cell-group .date[data-v-6539b543]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:1rem 1rem .5rem 1rem;border-bottom:1px solid #5a8dee}.record .page .van-cell-group .date .left span[data-v-6539b543]:first-child{font-size:1.2rem;font-weight:700}.record .page .van-cell-group .date .left span[data-v-6539b543]:nth-child(2){color:#7a7a7a;font-size:.8rem}.record .page .van-cell-group .date .right[data-v-6539b543]{font-size:.9rem;color:#7a7a7a}.record .page .van-cell-group .date .right .income[data-v-6539b543]{margin-left:.5rem}.record .page .van-cell-group .date .right span .svg-icon[data-v-6539b543]{margin-right:.2rem}.record .page .van-cell-group .record-day[data-v-6539b543]{padding:1rem}.record .page .van-cell-group .record-day .van-cell__title[data-v-6539b543]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.record .page .van-cell-group .record-day .van-cell__title .content[data-v-6539b543]{margin-left:.5rem}.record .page .van-cell-group .record-day .van-cell__title .content .remark[data-v-6539b543]{font-size:.8rem;color:#7a7a7a}.record .page .van-cell-group .record-day .van-cell__value[data-v-6539b543]{font-weight:700;color:#5a8dee}.record .page .pagination[data-v-6539b543]{margin:1rem;border-radius:.5rem;background-color:#fff}.record .page .pagination .van-col[data-v-6539b543]:nth-child(2){color:#5a8dee;font-weight:700}.record .page .pagination .van-col[data-v-6539b543]:nth-child(odd){background-color:#f8ce5e;color:#fff;padding:1rem;border-radius:.5rem}.record .page .pagination .van-col[data-v-6539b543]:nth-child(odd):active{opacity:.6}

View File

@ -0,0 +1 @@
.van-grid[data-v-392fa64c]{margin-top:1rem}.van-grid[data-v-392fa64c] .van-grid-item__content{border-radius:.5rem}.van-grid[data-v-392fa64c] .van-grid-item__content .van-image ::v-deep img{width:100%;height:100%}.van-grid[data-v-392fa64c] .van-grid-item__content .album-name{margin-top:.5rem}

View File

@ -0,0 +1 @@
.primary[data-v-10c4e3aa]{padding-bottom:1rem}.primary .page .van-swipe-cell .van-cell[data-v-10c4e3aa]{padding:1.2rem 1rem}

View File

@ -0,0 +1 @@
.account-details[data-v-2bf6de1e]{padding-bottom:1rem}.bookkeeping-background .overview[data-v-2bf6de1e]{font-size:.8rem}.bookkeeping-background .balance[data-v-2bf6de1e]{margin:.5rem 0}.van-cell-group[data-v-2bf6de1e]{margin-bottom:1rem}.van-cell-group .transfer[data-v-2bf6de1e]{width:60vw!important}.van-cell-group .blue .van-cell__value[data-v-2bf6de1e]{color:#5a8dee!important}.van-cell-group .red .van-cell__value[data-v-2bf6de1e]{color:#f1523a!important}.van-cell-group .gray .van-cell__value[data-v-2bf6de1e]{color:#7a7a7a!important}.van-cell-group .date[data-v-2bf6de1e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;padding:1rem 1rem .5rem 1rem;border-bottom:1px solid #5a8dee}.van-cell-group .date .left span[data-v-2bf6de1e]:first-child{font-size:1.2rem;font-weight:700}.van-cell-group .date .left span[data-v-2bf6de1e]:nth-child(2){color:#7a7a7a;font-size:.8rem}.van-cell-group .date .right[data-v-2bf6de1e]{font-size:.9rem;color:#7a7a7a}.van-cell-group .date .right .income[data-v-2bf6de1e]{margin-left:.5rem}.van-cell-group .date .right span .svg-icon[data-v-2bf6de1e]{margin-right:.2rem}.van-cell-group .record-day[data-v-2bf6de1e]{padding:1rem}.van-cell-group .record-day .van-cell__title[data-v-2bf6de1e]{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.van-cell-group .record-day .van-cell__title .content[data-v-2bf6de1e]{margin-left:.5rem}.van-cell-group .record-day .van-cell__title .content .remark[data-v-2bf6de1e]{font-size:.8rem;color:#7a7a7a}.van-cell-group .record-day .van-cell__value[data-v-2bf6de1e]{font-weight:700;color:#5a8dee}

Some files were not shown because too many files have changed in this diff Show More