第一次提交

main
吴顺杰 2 weeks ago
commit a16a8bacf7

33
.gitignore vendored

@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 奔跑的面条
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

@ -0,0 +1,14 @@
1、修改数据库配置
数据库文件为sqllite》goview.db
application-dev.yml
修改为自己对于的存放地址
url: jdbc:sqlite:D:\\eclipse-workspace\v2-goview-bate\sqllite\goview.db
2、修改配置文件图片存放地址3个值必须对oss与fileurl 路径一样写法不一样别搞错了 有file:
v2>oss值
v2>fileurl值
v2>httpurl值
httpurl为图片上传的访问地址

File diff suppressed because one or more lines are too long

@ -0,0 +1,150 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>cn.com</groupId>
<artifactId>goview_admin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>oss</name>
<description>goview后台系统</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<commons.fileupload.version>1.3.3</commons.fileupload.version>
<commons.io.version>2.7</commons.io.version>
<druid.version>1.2.6</druid.version>
<mysql.version>8.0.31</mysql.version>
</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--io常用工具类 -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons.io.version}</version>
</dependency>
<!--文件上传工具类 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons.fileupload.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-io</artifactId>
<groupId>commons-io</groupId>
</exclusion>
</exclusions>
</dependency>
<!-- knife4j -->
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-spring-boot-starter</artifactId>
<version>2.0.7</version>
</dependency>
<!-- Hutool是一个Java工具包 http://hutool.cn/ -->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.3.3</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>1.18.20.0</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
</dependency>
<!-- Sa-Token 权限认证在线文档https://sa-token.cc -->
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot-starter</artifactId>
<version>1.34.0</version>
</dependency>
</dependencies>
<build>
<!-- 打包不带版本号 -->
<!-- <finalName>springboot_v2</finalName> -->
<plugins>
<!-- JUnit 配置 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<!--忽略测试启动类 -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<!-- jar运行配置 正常打包-->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>cn.com.GogoApplication</mainClass>
</configuration>
</plugin>
</plugins>
</build>
</project>

Binary file not shown.

@ -0,0 +1,15 @@
package cn.com;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan("cn.com.v2.mapper")
public class GogoApplication {
public static void main(String[] args) {
SpringApplication.run(GogoApplication.class, args);
}
}

@ -0,0 +1,13 @@
package cn.com;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(GogoApplication.class);
}
}

@ -0,0 +1,117 @@
package cn.com.v2.common.base;
import cn.com.v2.common.domain.AjaxResult;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import java.beans.PropertyEditorSupport;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
* web
*
* @ClassName: BaseController
* @author fuce
* @date 2018818
*
*/
public class BaseController {
/**
* Date
*/
@InitBinder
public void initBinder(WebDataBinder binder) {
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new MyDateEditor());
}
/**
*
*
* @param rows
* @return
*/
protected AjaxResult toAjax(int rows) {
return rows > 0 ? success() : error();
}
/**
*
*/
public AjaxResult success() {
return AjaxResult.success();
}
/**
*
*/
public AjaxResult error() {
return AjaxResult.error();
}
public AjaxResult successData(int code, Object value) {
AjaxResult json = new AjaxResult();
json.put("code", code);
json.put("data", value);
return json;
}
/**
*
*/
public AjaxResult success(String message) {
return AjaxResult.success(message);
}
/**
*
*/
public AjaxResult error(String message) {
return AjaxResult.error(message);
}
/**
*
*/
public AjaxResult error(int code, String message) {
return AjaxResult.error(code, message);
}
/**
* object
*/
public AjaxResult retobject(int code, Object data) {
return AjaxResult.successData(code, data);
}
private class MyDateEditor extends PropertyEditorSupport {
@Override
public void setAsText(String text) throws IllegalArgumentException {
// 通过两次异常的处理可以,绑定两次日期的格式
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = format.parse(text);
} catch (ParseException e) {
format = new SimpleDateFormat("yyyy-MM-dd");
try {
date = format.parse(text);
} catch (ParseException e1) {
format = new SimpleDateFormat("yyyy/MM/dd H:mm");
try {
date = format.parse(text);
} catch (ParseException e2) {
e2.printStackTrace();
}
}
}
setValue(date);
}
}
}

@ -0,0 +1,24 @@
package cn.com.v2.common.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
//重写WebMvcConfigurer实现全局跨域配置
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
// 是否发送Cookie
.allowCredentials(true)
// 放行哪些原始域
.allowedOrigins("*")
// 放行哪些请求方式
.allowedMethods("GET", "POST", "PUT", "DELETE")
// 放行哪些原始请求头部信息
.allowedHeaders("*")
// 暴露哪些头部信息
.exposedHeaders("*");
}
}

@ -0,0 +1,22 @@
package cn.com.v2.common.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class MybatisPlusConfig {
/**
*
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); // 如果配置多个插件, 切记分页最后添加
// 如果有多数据源可以不配具体类型, 否则都建议配上具体的 DbType
return interceptor;
}
}

@ -0,0 +1,70 @@
package cn.com.v2.common.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
*
*
* @author fuce
*/
@Component
@ConfigurationProperties(prefix = "v2")
public class V2Config {
/**
*
*/
private String fileurl;
/**
* url
*/
private String httpurl;
/**
* map
*/
private Map<String, String> xnljmap;
/**
*
*/
private String defaultFormat;
public String getFileurl() {
return fileurl;
}
public void setFileurl(String fileurl) {
this.fileurl = fileurl;
}
public String getHttpurl() {
return httpurl;
}
public void setHttpurl(String httpurl) {
this.httpurl = httpurl;
}
public Map<String, String> getXnljmap() {
return xnljmap;
}
public void setXnljmap(Map<String, String> xnljmap) {
this.xnljmap = xnljmap;
}
public String getDefaultFormat() {
return defaultFormat;
}
public void setDefaultFormat(String defaultFormat) {
this.defaultFormat = defaultFormat;
}
}

@ -0,0 +1,96 @@
package cn.com.v2.common.domain;
import java.util.HashMap;
/**
* @ClassName: AjaxResult
* @Description: ajax
* @author fuce
* @date 2018818
*
*/
public class AjaxResult extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
/**
* Message
*/
public AjaxResult() {
}
/**
*
*
* @return
*/
public static AjaxResult error() {
return error(500, "操作失败");
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult error(String msg) {
return error(500, msg);
}
/**
*
*
* @param code
* @param msg
* @return
*/
public static AjaxResult error(int code, String msg) {
AjaxResult json = new AjaxResult();
json.put("code", code);
json.put("msg", msg);
return json;
}
/**
*
*
* @param msg
* @return
*/
public static AjaxResult success(String msg) {
AjaxResult json = new AjaxResult();
json.put("msg", msg);
json.put("code", 200);
return json;
}
/**
*
*
* @return
*/
public static AjaxResult success() {
return AjaxResult.success("操作成功");
}
public static AjaxResult successData(int code, Object value) {
AjaxResult json = new AjaxResult();
json.put("code", code);
json.put("data", value);
return json;
}
/**
*
*
* @param key
* @param value
* @return
*/
@Override
public AjaxResult put(String key, Object value) {
super.put(key, value);
return this;
}
}

@ -0,0 +1,84 @@
package cn.com.v2.common.domain;
public class ResultTable {
/**
*
* */
private Integer code;
/**
*
* */
private String msg;
/**
*
* */
private Long count;
/**
*
* */
private Object data;
/**
*
* */
public static ResultTable pageTable(long count, Object data) {
ResultTable resultTable = new ResultTable();
resultTable.setData(data);
resultTable.setCode(0);
resultTable.setCount(count);
if (data != null) {
resultTable.setMsg("获取成功");
} else {
resultTable.setMsg("获取失败");
}
return resultTable;
}
public static ResultTable dataTable(Object data) {
ResultTable resultTable = new ResultTable();
resultTable.setData(data);
resultTable.setCode(0);
if (data != null) {
resultTable.setMsg("获取成功");
} else {
resultTable.setMsg("获取失败");
}
return resultTable;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Long getCount() {
return count;
}
public void setCount(Long count) {
this.count = count;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}

@ -0,0 +1,55 @@
package cn.com.v2.common.domain;
/**
* boostrap table post
* @author fc
*
*/
public class Tablepar {
private int page;//页码
private int limit;//数量
private String orderByColumn;//排序字段
private String isAsc;//排序字符 asc desc
private String searchText;//列表table里面的搜索
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getLimit() {
return limit;
}
public void setLimit(int limit) {
this.limit = limit;
}
public String getOrderByColumn() {
return orderByColumn;
}
public void setOrderByColumn(String orderByColumn) {
this.orderByColumn = orderByColumn;
}
public String getIsAsc() {
return isAsc;
}
public void setIsAsc(String isAsc) {
this.isAsc = isAsc;
}
public String getSearchText() {
return searchText;
}
public void setSearchText(String searchText) {
this.searchText = searchText;
}
}

@ -0,0 +1,22 @@
package cn.com.v2.common.interceptor;
import org.springframework.web.servlet.HandlerInterceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
*/
public class Interceptor implements HandlerInterceptor {
/**
* Controller
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
return true;//如果设置为false时被请求时拦截器执行到此处将不会继续操作
//如果设置为true时请求将会继续执行后面的操作
}
}

@ -0,0 +1,92 @@
package cn.com.v2.common.interceptor;
import cn.com.v2.common.config.V2Config;
import cn.hutool.core.util.ArrayUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Configuration
public class WebMvcConfig extends WebMvcConfigurationSupport {
@Autowired
private V2Config v2Config;
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("error.html").addResourceLocations("classpath:/META-INF/resources/static/error.html");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
List<String> list1 = new ArrayList<String>();
List<String> list2 = new ArrayList<String>();
Map<String, String> map = v2Config.getXnljmap();
Set<String> set = map.keySet();
for (String o : set) {
list1.add("/" + o + "/**");
list2.add(map.get(o));
}
registry.addResourceHandler(ArrayUtil.toArray(list1, String.class)).addResourceLocations(ArrayUtil.toArray(list2, String.class));
}
/**
* addCorsMappings()
* http访
*
* @param registry
*/
@Override
public void addCorsMappings(CorsRegistry registry) {
// 设置允许多个域名请求
//String[] allowDomains = {"http://www.toheart.xin","http://192.168.11.213:8080","http://localhost:8080"};
//指哪些接口URL需要增加跨域设置
registry.addMapping("/**")
//.allowedOrigins("*")//指的是前端哪些域名被允许跨域
.allowedOriginPatterns("*")
//需要带cookie等凭证时设置为true就会把cookie的相关信息带上
.allowCredentials(true)
//指的是允许哪些方法
.allowedMethods("GET", "HEAD", "POST", "PUT", "DELETE", "OPTIONS")
//cookie的失效时间单位为秒s若设置为-1则关闭浏览器就失效
.maxAge(3600);
}
/**
* addInterceptors()
*
*
* @param registry
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
//注册Interceptor拦截器(Interceptor这个类是我们自己写的拦截器类)
InterceptorRegistration registration = registry.addInterceptor(new Interceptor());
//addPathPatterns()方法添加需要拦截的路径
//所有路径都被拦截
registration.addPathPatterns("/**");
//excludePathPatterns()方法添加不拦截的路径
String[] excludePatterns = new String[]{"/error", "/error.html", "/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**",
"/api", "/api-docs", "/api-docs/**", "/doc.html/**",
"/api/file/*"};
//添加不拦截路径
registration.excludePathPatterns(excludePatterns);
}
}

@ -0,0 +1,87 @@
package cn.com.v2.controller;
import cn.com.v2.common.base.BaseController;
import cn.com.v2.common.domain.AjaxResult;
import cn.com.v2.model.SysUser;
import cn.com.v2.service.ISysUserService;
import cn.com.v2.util.SaTokenUtil;
import cn.dev33.satoken.stp.StpUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.ApiOperation;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/api/goview/sys")
public class ApiController extends BaseController {
@Autowired
private ISysUserService iSysUserService;
@ApiOperation(value = "登陆", notes = "登陆")
@PostMapping("/login")
@ResponseBody
public AjaxResult APIlogin(@RequestBody SysUser user, HttpServletRequest request) {
// 判断是否登陆
if (StpUtil.isLogin()) {
Map<String, Object> map = new HashMap<String, Object>();
map.put("userinfo", SaTokenUtil.getUser());
map.put("token", StpUtil.getTokenInfo());
return success().put("data", map);
} else {
if (StrUtil.isNotBlank(user.getUsername()) && StrUtil.isNotBlank(user.getPassword())) {
SysUser sysUser = iSysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername, user.getUsername()).eq(SysUser::getPassword, SecureUtil.md5(user.getPassword())).last("LIMIT 1"));
if (sysUser != null) {
StpUtil.login(sysUser.getId());
SaTokenUtil.setUser(sysUser);
Map<String, Object> map = new HashMap<String, Object>();
map.put("userinfo", sysUser);
map.put("token", StpUtil.getTokenInfo());
return success().put("data", map);
} else {
return error(500, "账户或者密码错误");
}
} else {
return error(500, "账户密码不能为空");
}
}
}
@ApiOperation(value = "登陆", notes = "登陆")
@GetMapping("/logout")
@ResponseBody
public AjaxResult logout() {
// 判断是否登陆
StpUtil.logout();
return success();
}
@ApiOperation(value = "获取oss地址", notes = "获取oss地址")
@GetMapping("/getOssInfo")
@ResponseBody
public AjaxResult getOssInfo() {
return success();
}
}

@ -0,0 +1,104 @@
package cn.com.v2.controller;
import cn.com.v2.common.base.BaseController;
import cn.com.v2.common.domain.AjaxResult;
import cn.com.v2.model.CommonQuestion;
import cn.com.v2.service.CommonQuestionService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
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 javax.annotation.Resource;
import java.io.Serializable;
/**
* (TCommonQuestion)
*
* @author wu
* @since 2025-04-21 09:36:06
*/
@RestController
@RequestMapping("/api/goview/commonQuestion")
@Api(tags = "常见问题")
@Transactional(rollbackFor = Exception.class)
public class CommonQuestionController extends BaseController {
/**
*
*/
@Resource
private CommonQuestionService commonQuestionService;
/**
*
*
* @param page
* @param commonQuestion
* @return
*/
@GetMapping
@ApiOperation(value = "分页条件查询常见问题", response = CommonQuestion.class)
public AjaxResult page(Page<CommonQuestion> page, CommonQuestion commonQuestion) {
return successData(200, commonQuestionService.page(page, new QueryWrapper<>(commonQuestion)));
}
/**
*
*
* @param id
* @return
*/
@GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条常见问题", response = CommonQuestion.class)
public AjaxResult getById(@PathVariable Serializable id) {
return successData(200, commonQuestionService.getById(id));
}
/**
*
*
* @param commonQuestion
* @return
*/
@PostMapping
@ApiOperation(value = "新增常见问题", response = CommonQuestion.class)
public AjaxResult insert(@RequestBody CommonQuestion commonQuestion) {
return successData(200, commonQuestionService.save(commonQuestion));
}
/**
*
*
* @param commonQuestion
* @return
*/
@PutMapping
@ApiOperation(value = "修改常见问题")
public AjaxResult update(@RequestBody CommonQuestion commonQuestion) {
return successData(200, commonQuestionService.updateById(commonQuestion));
}
/**
*
*
* @param id
* @return
*/
@DeleteMapping("{id}")
@ApiOperation(value = "删除常见问题")
public AjaxResult delete(@PathVariable Serializable id) {
return successData(200, commonQuestionService.removeById(id));
}
}

@ -0,0 +1,117 @@
package cn.com.v2.controller;
import cn.com.v2.common.base.BaseController;
import cn.com.v2.common.domain.AjaxResult;
import cn.com.v2.model.Dictionary;
import cn.com.v2.service.DictionaryService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
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 javax.annotation.Resource;
import java.io.Serializable;
/**
* (Dictionary)
*
* @author wu
* @since 2025-04-21 14:18:31
*/
@RestController
@RequestMapping("/api/goview/dictionary")
@Api(tags = "字典")
@Transactional(rollbackFor = Exception.class)
public class DictionaryController extends BaseController {
/**
*
*/
@Resource
private DictionaryService dictionaryService;
/**
*
*
* @param page
* @param dictionary
* @return
*/
@GetMapping
@ApiOperation(value = "分页条件查询字典", response = Dictionary.class)
public AjaxResult page(Page<Dictionary> page, Dictionary dictionary) {
return successData(200, dictionaryService.page(page, new QueryWrapper<>(dictionary)));
}
/**
*
*
* @param dictType
* @return
*/
@GetMapping("/findByType")
@ApiOperation(value = "根据字典类型查询字典", response = Dictionary.class)
public AjaxResult findByType(String dictType) {
QueryWrapper<Dictionary> wrapper = new QueryWrapper<>();
wrapper.eq("dict_type", dictType);
return successData(200, dictionaryService.list(wrapper));
}
/**
*
*
* @param id
* @return
*/
@GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条字典", response = Dictionary.class)
public AjaxResult getById(@PathVariable Serializable id) {
return successData(200, dictionaryService.getById(id));
}
/**
*
*
* @param dictionary
* @return
*/
@PostMapping
@ApiOperation(value = "新增字典", response = Dictionary.class)
public AjaxResult insert(@RequestBody Dictionary dictionary) {
return successData(200, dictionaryService.save(dictionary));
}
/**
*
*
* @param dictionary
* @return
*/
@PutMapping
@ApiOperation(value = "修改字典")
public AjaxResult update(@RequestBody Dictionary dictionary) {
return successData(200, dictionaryService.updateById(dictionary));
}
/**
*
*
* @param id
* @return
*/
@DeleteMapping("{id}")
@ApiOperation(value = "删除字典")
public AjaxResult delete(@PathVariable Serializable id) {
return successData(200, dictionaryService.removeById(id));
}
}

@ -0,0 +1,356 @@
package cn.com.v2.controller;
import cn.com.v2.common.base.BaseController;
import cn.com.v2.common.config.V2Config;
import cn.com.v2.common.domain.AjaxResult;
import cn.com.v2.model.SysFile;
import cn.com.v2.model.vo.SysFileVo;
import cn.com.v2.service.ISysFileService;
import cn.com.v2.util.SnowflakeIdWorker;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.io.IORuntimeException;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
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.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 org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
/**
* controller
* @author fuce
* @date: 2018916 4:23:50
*/
@Api(value = "文件上传")
@RestController
@RequestMapping("/api/file")
@Slf4j
public class FileController extends BaseController {
@Autowired
private V2Config v2Config;
@Autowired
private ISysFileService iSysFileService;
/**
* mapkey
*
* @param <K> Key
* @param <V> Value
* @param map
* @return
*/
public static <K, V> K getFirstNotNull(Map<K, V> map) {
K obj = null;
for (Entry<K, V> entry : map.entrySet()) {
obj = entry.getKey();
if (obj != null) {
break;
}
}
return obj;
}
public final static File getAbsoluteFile(String uploadDir, String filename) throws IOException {
File desc = new File(uploadDir + File.separator + filename);
if (!desc.getParentFile().exists()) {
desc.getParentFile().mkdirs();
}
if (!desc.exists()) {
desc.createNewFile();
}
return desc;
}
/**
*
* @param ids
* @return
*/
@ApiOperation(value = "删除", notes = "删除")
@DeleteMapping("/remove")
public AjaxResult remove(String ids) {
Boolean b = iSysFileService.removeByIds(StrUtil.split(ids, ',', -1));
if (b) {
return success();
} else {
return error();
}
}
@ApiOperation(value = "修改", notes = "修改")
@PutMapping("/update")
public AjaxResult update(String id, @RequestBody MultipartFile object) throws IllegalStateException, IOException {
SysFile sysFile = iSysFileService.getById(id);
if (sysFile != null) {
String fileurl = sysFile.getAbsolutePath() + sysFile.getRelativePath() + File.separator + sysFile.getFileName();
object.transferTo(new File(fileurl));
return success("修改成功");
} else {
return error();
}
}
/**
*
* @param object
* @param bucketName
* @return
* @throws Exception
*/
@PostMapping("/upload")
public AjaxResult upload(@RequestBody MultipartFile object) throws IOException {
String fileName = object.getOriginalFilename();
//默认文件格式
String suffixName = v2Config.getDefaultFormat();
String mediaKey = "";
Long filesize = object.getSize();
//文件名字
String fileSuffixName = "";
if (fileName.lastIndexOf(".") != -1) {//有后缀
suffixName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
//mediaKey=MD5.create().digestHex(fileName);
mediaKey = SnowflakeIdWorker.getUUID();
fileSuffixName = mediaKey + suffixName;
} else {//无后缀
//取得唯一id
//mediaKey = MD5.create().digestHex(fileName+suffixName);
mediaKey = SnowflakeIdWorker.getUUID();
//fileSuffixName=mediaKey+suffixName;
}
String virtualKey = getFirstNotNull(v2Config.getXnljmap());
String absolutePath = v2Config.getXnljmap().get(getFirstNotNull(v2Config.getXnljmap()));
SysFile sysFile = new SysFile();
sysFile.setId(SnowflakeIdWorker.getUUID());
sysFile.setFileName(fileSuffixName);
sysFile.setFileSize(Integer.parseInt(filesize + ""));
sysFile.setFileSuffix(suffixName);
sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
String filepath = DateUtil.formatDate(new Date());
sysFile.setRelativePath(filepath);
sysFile.setVirtualKey(virtualKey);
sysFile.setAbsolutePath(absolutePath.replace("file:", ""));
iSysFileService.saveOrUpdate(sysFile);
File desc = getAbsoluteFile(v2Config.getFileurl() + File.separator + filepath, fileSuffixName);
object.transferTo(desc);
SysFileVo sysFileVo = BeanUtil.copyProperties(sysFile, SysFileVo.class);
sysFileVo.setFileurl(v2Config.getHttpurl() + sysFile.getVirtualKey() + "/" + sysFile.getRelativePath() + "/" + sysFile.getFileName());
return AjaxResult.successData(200, sysFileVo);
}
/**
* Base64
* @param str
* @throws IOException
*/
@PostMapping("/uploadbase64")
public synchronized AjaxResult uploadbase64(String base64str) throws IOException {
if (StrUtil.isNotBlank(base64str)) {
String suffixName = v2Config.getDefaultFormat();
String mediaKey = SnowflakeIdWorker.getUUID();
String fileSuffixName = mediaKey + suffixName;
String virtualKey = getFirstNotNull(v2Config.getXnljmap());
String absolutePath = v2Config.getXnljmap().get(getFirstNotNull(v2Config.getXnljmap()));
SysFile sysFile = new SysFile();
sysFile.setId(SnowflakeIdWorker.getUUID());
sysFile.setFileName(fileSuffixName);
sysFile.setFileSuffix(suffixName);
sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
String filepath = DateUtil.formatDate(new Date());
sysFile.setRelativePath(filepath);
sysFile.setVirtualKey(virtualKey);
sysFile.setAbsolutePath(absolutePath.replace("file:", ""));
File desc = getAbsoluteFile(v2Config.getFileurl() + File.separator + filepath, fileSuffixName);
File file = null;
try {
file = Base64.decodeToFile(base64str, desc);
} catch (Exception e) {
System.out.println("错误base64" + base64str);
e.printStackTrace();
}
sysFile.setFileSize(Integer.parseInt(file.length() + ""));
iSysFileService.saveOrUpdate(sysFile);
SysFileVo sysFileVo = BeanUtil.copyProperties(sysFile, SysFileVo.class);
sysFileVo.setFileurl(v2Config.getHttpurl() + sysFile.getVirtualKey() + "/" + sysFile.getRelativePath() + "/" + sysFile.getFileName());
return AjaxResult.successData(200, sysFileVo);
}
return AjaxResult.error();
}
/**
*
*
* @param key 访
* @param rpf +
* @return
*/
@PostMapping("/getFileText")
public AjaxResult getFileText(String key, String relativePath) {
String absolutePath = v2Config.getXnljmap().get(key).replace("file:", "");
String fileurl = absolutePath + relativePath;
try {
String text = FileUtil.readUtf8String(fileurl);
return AjaxResult.successData(200, text);
} catch (IORuntimeException e) {
return AjaxResult.error("没有该文件");
} catch (Exception e) {
return AjaxResult.error("报错:" + e.getMessage());
}
}
/**
*
*
* @param key 访
* @param rpf +
* @return
* @throws IOException
*/
@PostMapping("/getFileText302")
public void getFileText302(String key, String relativePath, HttpServletResponse response) throws IOException {
String str = v2Config.getHttpurl() + key + "/" + relativePath;
response.sendRedirect(str);
}
/**
* key
* @param object
* @param bucketName
* @return
* @throws Exception
*/
@PostMapping("/coverupload")
public AjaxResult coverupload(@RequestBody MultipartFile object, String key, String relativePath) throws IOException {
String fileName = object.getOriginalFilename();
String suffixName = v2Config.getDefaultFormat();
Long filesize = object.getSize();
//文件名字
String fileSuffixName = "";
if (fileName.lastIndexOf(".") != -1) {//有后缀
suffixName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
//mediaKey=MD5.create().digestHex(fileName);
//mediaKey=SnowflakeIdWorker.getUUID();
fileSuffixName = relativePath.substring(relativePath.lastIndexOf("/") + 1, relativePath.length());
} else {//无后缀
//取得唯一id
//mediaKey = MD5.create().digestHex(fileName+suffixName);
//mediaKey=SnowflakeIdWorker.getUUID();
//fileSuffixName=mediaKey+suffixName;
}
String virtualKey = key;
String absolutePath = v2Config.getXnljmap().get(key).replace("file:", "");
SysFile sysFile = new SysFile();
sysFile.setId(SnowflakeIdWorker.getUUID());
sysFile.setFileName(fileSuffixName);
sysFile.setFileSize(Integer.parseInt(filesize + ""));
sysFile.setFileSuffix(suffixName);
sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
String filepath = relativePath.substring(0, relativePath.lastIndexOf("/"));
sysFile.setRelativePath(filepath);
sysFile.setVirtualKey(virtualKey);
sysFile.setAbsolutePath(absolutePath);
iSysFileService.saveOrUpdate(sysFile);
File desc = getAbsoluteFile(absolutePath + filepath, fileSuffixName);
object.transferTo(desc);
SysFileVo sysFileVo = BeanUtil.copyProperties(sysFile, SysFileVo.class);
sysFileVo.setFileurl(v2Config.getHttpurl() + sysFile.getVirtualKey() + "/" + sysFile.getRelativePath() + "/" + sysFile.getFileName());
return AjaxResult.successData(200, sysFileVo);
}
/**
* idjson
* @param id
* @return
*/
@GetMapping("/getFileid/{id}")
public AjaxResult getFileid(@PathVariable("id") String id) {
SysFile sysFile = iSysFileService.getById(id);
if (sysFile != null) {
SysFileVo sysFileVo = BeanUtil.copyProperties(sysFile, SysFileVo.class);
sysFileVo.setFileurl(v2Config.getHttpurl() + sysFile.getVirtualKey() + "/" + sysFile.getRelativePath() + "/" + sysFile.getFileName());
return AjaxResult.successData(200, sysFileVo);
}
return AjaxResult.error("没有该文件");
}
/**
* id 302
* @param id
* @param response
* @throws IOException
*/
@GetMapping("/getFileid/302/{id}")
public void getFileid302(@PathVariable("id") String id, HttpServletResponse response) throws IOException {
SysFile sysFile = iSysFileService.getById(id);
if (sysFile != null) {
String str = v2Config.getHttpurl() + sysFile.getVirtualKey() + "/" + sysFile.getRelativePath() + "/" + sysFile.getFileName();
response.sendRedirect(str);
}
}
/**
*
* @param current
* @param size
* @return
*/
@GetMapping("/list")
public Object list(long current, long size) {
Page<SysFile> page = new Page<SysFile>(current, size);
IPage<SysFile> sysFile = iSysFileService.page(page, new LambdaQueryWrapper<SysFile>());
return sysFile;
}
/**
* md5
* @param file
* @return
* @throws IOException
*/
public String getMd5(MultipartFile file) {
try {
//获取文件的byte信息
byte[] uploadBytes = file.getBytes();
// 拿到一个MD5转换器
MessageDigest md5 = MessageDigest.getInstance("MD5");
byte[] digest = md5.digest(uploadBytes);
//转换为16进制
return new BigInteger(1, digest).toString(16);
} catch (Exception e) {
log.error(e.getMessage());
}
return null;
}
}

@ -0,0 +1,269 @@
package cn.com.v2.controller;
import cn.com.v2.common.base.BaseController;
import cn.com.v2.common.config.V2Config;
import cn.com.v2.common.domain.AjaxResult;
import cn.com.v2.common.domain.ResultTable;
import cn.com.v2.common.domain.Tablepar;
import cn.com.v2.model.GoviewProject;
import cn.com.v2.model.GoviewProjectData;
import cn.com.v2.model.SysFile;
import cn.com.v2.model.vo.GoviewProjectVo;
import cn.com.v2.model.vo.SysFileVo;
import cn.com.v2.service.IGoviewProjectDataService;
import cn.com.v2.service.IGoviewProjectService;
import cn.com.v2.service.ISysFileService;
import cn.com.v2.util.ConvertUtil;
import cn.com.v2.util.SnowflakeIdWorker;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpRequest;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.DeleteMapping;
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.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.time.LocalDateTime;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@RestController
@RequestMapping("/api/goview/project")
public class GoviewProjectController extends BaseController {
@Autowired
private ISysFileService iSysFileService;
@Autowired
private V2Config v2Config;
@Autowired
private IGoviewProjectService iGoviewProjectService;
@Autowired
private IGoviewProjectDataService iGoviewProjectDataService;
@ApiOperation(value = "分页跳转", notes = "分页跳转")
@GetMapping("/list")
@ResponseBody
public ResultTable list(Tablepar tablepar) {
Page<GoviewProject> page = new Page<>(tablepar.getPage(), tablepar.getLimit());
GoviewProject entity = new GoviewProject();
entity.setState(1);
IPage<GoviewProject> iPages = iGoviewProjectService.page(page, new QueryWrapper<>(entity));
ResultTable resultTable = new ResultTable();
resultTable.setData(iPages.getRecords());
resultTable.setCode(200);
resultTable.setCount(iPages.getTotal());
resultTable.setMsg("获取成功");
return resultTable;
}
@ApiOperation(value = "分页跳转", notes = "分页跳转")
@PostMapping("/zf")
public String zf(@RequestParam Map<String, Object> map) {
String body = HttpRequest.post("http://baijiahu.mynatapp.cc/").form(map).timeout(120000).execute().body();
return body;
}
/**
*
*
* @param
* @return
*/
//@Log(title = "项目表新增", action = "111")
@ApiOperation(value = "新增", notes = "新增")
@PostMapping("/create")
@ResponseBody
public AjaxResult add(@RequestBody GoviewProject goviewProject) {
goviewProject.setCreateTime(DateUtil.now());
goviewProject.setState(-1);
boolean b = iGoviewProjectService.save(goviewProject);
if (b) {
return successData(200, goviewProject).put("msg", "创建成功");
} else {
return error();
}
}
/**
*
*
* @param ids
* @return
*/
//@Log(title = "项目表删除", action = "111")
@ApiOperation(value = "删除", notes = "删除")
@DeleteMapping("/delete")
@ResponseBody
public AjaxResult remove(String ids) {
List<String> lista = ConvertUtil.toListStrArray(ids);
Boolean b = iGoviewProjectService.removeByIds(lista);
if (b) {
return success();
} else {
return error();
}
}
@ApiOperation(value = "修改保存", notes = "修改保存")
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(@RequestBody GoviewProject goviewProject) {
goviewProject.setState(1);
Boolean b = iGoviewProjectService.updateById(goviewProject);
if (b) {
return success();
}
return error();
}
@ApiOperation(value = "项目重命名", notes = "项目重命名")
@PostMapping("/rename")
@ResponseBody
public AjaxResult rename(@RequestBody GoviewProject goviewProject) {
LambdaUpdateWrapper<GoviewProject> updateWrapper = new LambdaUpdateWrapper<GoviewProject>();
updateWrapper.eq(GoviewProject::getId, goviewProject.getId());
updateWrapper.set(GoviewProject::getProjectName, goviewProject.getProjectName());
Boolean b = iGoviewProjectService.update(updateWrapper);
if (b) {
return success();
}
return error();
}
//发布/取消项目状态
@PutMapping("/publish")
@ResponseBody
public AjaxResult updateVisible(@RequestBody GoviewProject goviewProject) {
if (goviewProject.getState() == -1 || goviewProject.getState() == 1) {
LambdaUpdateWrapper<GoviewProject> updateWrapper = new LambdaUpdateWrapper<GoviewProject>();
updateWrapper.eq(GoviewProject::getId, goviewProject.getId());
updateWrapper.set(GoviewProject::getState, goviewProject.getState());
Boolean b = iGoviewProjectService.update(updateWrapper);
if (b) {
return success();
}
return error();
}
return error("警告非法字段");
}
@ApiOperation(value = "获取项目存储数据", notes = "获取项目存储数据")
@GetMapping("/getData")
@ResponseBody
public AjaxResult getData(String projectId, ModelMap map) {
GoviewProject goviewProject = iGoviewProjectService.getById(projectId);
GoviewProjectData blogText = iGoviewProjectDataService.getProjectid(projectId);
if (blogText != null) {
GoviewProjectVo goviewProjectVo = new GoviewProjectVo();
BeanUtils.copyProperties(goviewProject, goviewProjectVo);
goviewProjectVo.setContent(blogText.getContent());
return AjaxResult.successData(200, goviewProjectVo).put("msg", "获取成功");
}
return AjaxResult.successData(200, null).put("msg", "无数据");
}
@ApiOperation(value = "保存项目数据", notes = "保存项目数据")
@PostMapping("/save/data")
@ResponseBody
public AjaxResult saveData(GoviewProjectData data) {
GoviewProject goviewProject = iGoviewProjectService.getById(data.getProjectId());
if (goviewProject == null) {
return error("没有该项目ID");
}
GoviewProjectData goviewProjectData = iGoviewProjectDataService.getOne(new LambdaQueryWrapper<GoviewProjectData>().eq(GoviewProjectData::getProjectId, goviewProject.getId()));
if (goviewProjectData != null) {
data.setId(goviewProjectData.getId());
iGoviewProjectDataService.updateById(data);
return success("数据保存成功");
} else {
iGoviewProjectDataService.save(data);
return success("数据保存成功");
}
}
/**
*
*
* @param object
* @param bucketName
* @return
* @throws Exception
*/
@PostMapping("/upload")
public AjaxResult upload(@RequestBody MultipartFile object) throws IOException {
String fileName = object.getOriginalFilename();
//默认文件格式
String suffixName = v2Config.getDefaultFormat();
String mediaKey = "";
Long filesize = object.getSize();
//文件名字
String fileSuffixName = "";
if (fileName.lastIndexOf(".") != -1) {//有后缀
suffixName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
//mediaKey=MD5.create().digestHex(fileName);
mediaKey = SnowflakeIdWorker.getUUID();
fileSuffixName = mediaKey + suffixName;
} else {//无后缀
//取得唯一id
//mediaKey = MD5.create().digestHex(fileName+suffixName);
mediaKey = SnowflakeIdWorker.getUUID();
//fileSuffixName=mediaKey+suffixName;
}
String virtualKey = FileController.getFirstNotNull(v2Config.getXnljmap());
String absolutePath = v2Config.getXnljmap().get(FileController.getFirstNotNull(v2Config.getXnljmap()));
SysFile sysFile = new SysFile();
sysFile.setId(SnowflakeIdWorker.getUUID());
sysFile.setFileName(fileSuffixName);
sysFile.setFileSize(Integer.parseInt(filesize + ""));
sysFile.setFileSuffix(suffixName);
sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
String filepath = DateUtil.formatDate(new Date());
sysFile.setRelativePath(filepath);
sysFile.setVirtualKey(virtualKey);
sysFile.setAbsolutePath(absolutePath.replace("file:", ""));
iSysFileService.saveOrUpdate(sysFile);
File desc = FileController.getAbsoluteFile(v2Config.getFileurl() + File.separator + filepath, fileSuffixName);
object.transferTo(desc);
SysFileVo sysFileVo = BeanUtil.copyProperties(sysFile, SysFileVo.class);
sysFileVo.setFileurl(v2Config.getHttpurl() + sysFile.getVirtualKey() + "/" + sysFile.getRelativePath() + "/" + sysFile.getFileName());
return successData(200, sysFileVo);
}
}

@ -0,0 +1,101 @@
package cn.com.v2.controller;
import cn.com.v2.common.base.BaseController;
import cn.com.v2.common.domain.AjaxResult;
import cn.com.v2.model.HistoricalReply;
import cn.com.v2.service.HistoricalReplyService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
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 javax.annotation.Resource;
import java.io.Serializable;
/**
* (THistoricalReply)
*
* @author wu
* @since 2025-04-18 09:34:27
*/
@RestController
@RequestMapping("/api/goview/tHistoricalReply")
@Transactional(rollbackFor = Exception.class)
public class HistoricalReplyController extends BaseController {
/**
*
*/
@Resource
private HistoricalReplyService historicalReplyService;
/**
*
*
* @param page
* @param historicalReply
* @return
*/
@GetMapping
@ApiOperation(value = "分页条件查询", response = HistoricalReply.class)
public AjaxResult page(Page<HistoricalReply> page, HistoricalReply historicalReply) {
return successData(200, historicalReplyService.page(page, new QueryWrapper<>(historicalReply)));
}
/**
*
*
* @param id
* @return
*/
@GetMapping("{id}")
@ApiOperation(value = "通过主键查询单条", response = HistoricalReply.class)
public AjaxResult getById(@PathVariable Serializable id) {
return successData(200, historicalReplyService.getById(id));
}
/**
*
*
* @param historicalReply
* @return
*/
@PostMapping
@ApiOperation(value = "新增", response = HistoricalReply.class)
public AjaxResult insert(@RequestBody HistoricalReply historicalReply) {
return successData(200, historicalReplyService.save(historicalReply));
}
/**
*
*
* @param historicalReply
* @return
*/
@PutMapping
@ApiOperation(value = "修改")
public AjaxResult update(@RequestBody HistoricalReply historicalReply) {
return successData(200, historicalReplyService.updateById(historicalReply));
}
/**commonProblem
*
*
* @param id
* @return
*/
@DeleteMapping("{id}")
@ApiOperation(value = "删除")
public AjaxResult delete(@PathVariable Serializable id) {
return successData(200, historicalReplyService.removeById(id));
}
}

@ -0,0 +1,22 @@
package cn.com.v2.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
@RestController
public class Indexcontroller {
@GetMapping("/")
public void index(HttpServletResponse response) throws IOException {
response.setContentType("text/html; charset=utf-8");
PrintWriter out = response.getWriter();
out.println("<p style='color:orange'>goview后台首页</p>");
out.flush();
out.close();
}
}

@ -0,0 +1,19 @@
package cn.com.v2.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@RestController
@RequestMapping("/v2/sys-user")
public class SysUserController {
}

@ -0,0 +1,15 @@
package cn.com.v2.mapper;
import cn.com.v2.model.CommonQuestion;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* (TCommonQuestion)访
*
* @author wu
* @since 2025-04-21 09:36:06
*/
public interface CommonQuestionMapper extends BaseMapper<CommonQuestion> {
}

@ -0,0 +1,15 @@
package cn.com.v2.mapper;
import cn.com.v2.model.Dictionary;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* (Dictionary)访
*
* @author wu
* @since 2025-04-21 14:18:32
*/
public interface DictionaryMapper extends BaseMapper<Dictionary> {
}

@ -0,0 +1,16 @@
package cn.com.v2.mapper;
import cn.com.v2.model.GoviewProjectData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author fc
* @since 2023-04-30
*/
public interface GoviewProjectDataMapper extends BaseMapper<GoviewProjectData> {
}

@ -0,0 +1,16 @@
package cn.com.v2.mapper;
import cn.com.v2.model.GoviewProject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author fc
* @since 2023-04-30
*/
public interface GoviewProjectMapper extends BaseMapper<GoviewProject> {
}

@ -0,0 +1,15 @@
package cn.com.v2.mapper;
import cn.com.v2.model.HistoricalReply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* (THistoricalReply)访
*
* @author wu
* @since 2025-04-18 09:34:28
*/
public interface HistoricalReplyMapper extends BaseMapper<HistoricalReply> {
}

@ -0,0 +1,16 @@
package cn.com.v2.mapper;
import cn.com.v2.model.SysFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author fc
* @since 2022-12-22
*/
public interface SysFileMapper extends BaseMapper<SysFile> {
}

@ -0,0 +1,16 @@
package cn.com.v2.mapper;
import cn.com.v2.model.SysUser;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper
* </p>
*
* @author fc
* @since 2023-04-30
*/
public interface SysUserMapper extends BaseMapper<SysUser> {
}

@ -0,0 +1,67 @@
package cn.com.v2.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* (TCommonQuestion)
*
* @author wu
* @since 2025-04-21 09:36:06
*/
@Data
@ApiModel("常见问题实体类")
@TableName(value = "t_common_question")
public class CommonQuestion implements Serializable {
private static final long serialVersionUID = -29377218335522611L;
/**
* id
*/
@ApiModelProperty(value = "主键id")
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
*
*/
@ApiModelProperty(value = "问题类型")
private Integer questionType;
/**
*
*/
@ApiModelProperty(value = "问题详情")
private String content;
/**
* id
*/
@ApiModelProperty(value = "问题关联人id")
private String userId;
/**
*
*/
@ApiModelProperty(value = "创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
/**
*
*/
@ApiModelProperty(value = "创建人")
private String createUserId;
}

@ -0,0 +1,52 @@
package cn.com.v2.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* (Dictionary)
*
* @author wu
* @since 2025-04-21 14:18:32
*/
@Data
@ApiModel("字典实体类")
@TableName(value = "dictionary")
public class Dictionary implements Serializable {
private static final long serialVersionUID = -48691319489377843L;
/**
* id
*/
@ApiModelProperty(value = "主键id")
@TableId(type = IdType.ASSIGN_ID)
private String id;
/**
*
*/
@ApiModelProperty(value = "字典类型")
private String dictType;
/**
*
*/
@ApiModelProperty(value = "字典值")
private Integer dictKey;
/**
*
*/
@ApiModelProperty(value = "名称")
private String dictValue;
}

@ -0,0 +1,44 @@
package cn.com.v2.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@TableName("t_goview_project")
@Data
public class GoviewProject implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String projectName;
private Integer state;
@TableField(fill = FieldFill.INSERT)
private String createTime;
private String createUserId;
private Integer isDelete;
private String indexImage;
private String remarks;
}

@ -0,0 +1,38 @@
package cn.com.v2.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@TableName("t_goview_project_data")
@Data
public class GoviewProjectData implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String projectId;
@TableField(fill = FieldFill.INSERT)
private String createTime;
private String createUserId;
private String content;
}

@ -0,0 +1,39 @@
package cn.com.v2.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* (THistoricalReply)
*
* @author wu
* @since 2025-04-18 09:34:28
*/
@Data
@ApiModel("实体类")
@TableName(value = "t_historical_reply")
public class HistoricalReply implements Serializable {
private static final long serialVersionUID = 204285435715666589L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String content;
@TableField(fill = FieldFill.INSERT)
private Date createTime;
private String createUserId;
}

@ -0,0 +1,118 @@
package cn.com.v2.model;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2022-12-22
*/
@TableName("t_sys_file")
public class SysFile implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "id", type = IdType.INPUT)
private String id;
private String fileName;
private Integer fileSize;
private String fileSuffix;
/**
*
*/
private String virtualKey;
/**
*
*/
private String relativePath;
/**
*
*/
private String absolutePath;
@TableField(fill = FieldFill.INSERT)
private String createTime;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public String getFileSuffix() {
return fileSuffix;
}
public void setFileSuffix(String fileSuffix) {
this.fileSuffix = fileSuffix;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getVirtualKey() {
return virtualKey;
}
public void setVirtualKey(String virtualKey) {
this.virtualKey = virtualKey;
}
public String getAbsolutePath() {
return absolutePath;
}
public void setAbsolutePath(String absolutePath) {
this.absolutePath = absolutePath;
}
public String getRelativePath() {
return relativePath;
}
public void setRelativePath(String relativePath) {
this.relativePath = relativePath;
}
}

@ -0,0 +1,38 @@
package cn.com.v2.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@TableName("t_sys_user")
@Data
public class SysUser implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(type = IdType.ASSIGN_ID)
private String id;
private String username;
private String password;
private String nickname;
private Integer depId;
private String posId;
}

@ -0,0 +1,128 @@
package cn.com.v2.model.vo;
import cn.hutool.core.date.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
public class GoviewProjectVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
private String id;
@ApiModelProperty(value = "项目名称")
private String projectName;
@ApiModelProperty(value = "项目状态[-1未发布,1发布]")
private Integer state;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "创建人id")
private String createUserId;
@ApiModelProperty(value = "删除状态[1删除,-1未删除]")
private Integer isDelete;
@ApiModelProperty(value = "首页图片")
private String indexImage;
@ApiModelProperty(value = "项目介绍")
private String remarks;
private String content;
@JsonProperty("id")
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@JsonProperty("projectName")
public String getProjectName() {
return projectName;
}
public void setProjectName(String projectName) {
this.projectName = projectName;
}
@JsonProperty("state")
public Integer getState() {
return state;
}
public void setState(Integer state) {
this.state = state;
}
@JsonProperty("createTime")
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@JsonProperty("createUserId")
public String getCreateUserId() {
return createUserId;
}
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
@JsonProperty("isDelete")
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
@JsonProperty("indexImage")
public String getIndexImage() {
return indexImage;
}
public void setIndexImage(String indexImage) {
this.indexImage = indexImage;
}
@JsonProperty("remarks")
public String getRemarks() {
return remarks;
}
public void setRemarks(String remarks) {
this.remarks = remarks;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String dateToStringConvert(Date date) {
if (date != null) {
return DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
}
return "";
}
}

@ -0,0 +1,83 @@
package cn.com.v2.model.vo;
public class SysFileVo {
private String id;
private String fileName;
private Integer fileSize;
private String createTime;
/**
*
*/
private String relativePath;
/**
* key
*/
private String virtualKey;
/**
* url
*/
private String fileurl;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public Integer getFileSize() {
return fileSize;
}
public void setFileSize(Integer fileSize) {
this.fileSize = fileSize;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getRelativePath() {
return relativePath;
}
public void setRelativePath(String relativePath) {
this.relativePath = relativePath;
}
public String getVirtualKey() {
return virtualKey;
}
public void setVirtualKey(String virtualKey) {
this.virtualKey = virtualKey;
}
public String getFileurl() {
return fileurl;
}
public void setFileurl(String fileurl) {
this.fileurl = fileurl;
}
}

@ -0,0 +1,15 @@
package cn.com.v2.service;
import cn.com.v2.model.CommonQuestion;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* (TCommonQuestion)
*
* @author wu
* @since 2025-04-21 09:36:07
*/
public interface CommonQuestionService extends IService<CommonQuestion> {
}

@ -0,0 +1,15 @@
package cn.com.v2.service;
import cn.com.v2.model.Dictionary;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* (Dictionary)
*
* @author wu
* @since 2025-04-21 14:18:32
*/
public interface DictionaryService extends IService<Dictionary> {
}

@ -0,0 +1,15 @@
package cn.com.v2.service;
import cn.com.v2.model.HistoricalReply;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* (THistoricalReply)
*
* @author wu
* @since 2025-04-18 09:34:28
*/
public interface HistoricalReplyService extends IService<HistoricalReply> {
}

@ -0,0 +1,18 @@
package cn.com.v2.service;
import cn.com.v2.model.GoviewProjectData;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
public interface IGoviewProjectDataService extends IService<GoviewProjectData> {
public GoviewProjectData getProjectid(String projectId);
}

@ -0,0 +1,16 @@
package cn.com.v2.service;
import cn.com.v2.model.GoviewProject;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
public interface IGoviewProjectService extends IService<GoviewProject> {
}

@ -0,0 +1,18 @@
package cn.com.v2.service;
import cn.com.v2.model.SysFile;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2022-12-22
*/
public interface ISysFileService extends IService<SysFile> {
public SysFile selectByExamplefileName(String filename);
}

@ -0,0 +1,16 @@
package cn.com.v2.service;
import cn.com.v2.model.SysUser;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
public interface ISysUserService extends IService<SysUser> {
}

@ -0,0 +1,19 @@
package cn.com.v2.service.impl;
import cn.com.v2.mapper.CommonQuestionMapper;
import cn.com.v2.model.CommonQuestion;
import cn.com.v2.service.CommonQuestionService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* (TCommonQuestion)
*
* @author wu
* @since 2025-04-21 09:36:07
*/
@Service("commonQuestionService")
public class CommonQuestionServiceImpl extends ServiceImpl<CommonQuestionMapper, CommonQuestion> implements CommonQuestionService {
}

@ -0,0 +1,19 @@
package cn.com.v2.service.impl;
import cn.com.v2.mapper.DictionaryMapper;
import cn.com.v2.model.Dictionary;
import cn.com.v2.service.DictionaryService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* (Dictionary)
*
* @author wu
* @since 2025-04-21 14:18:32
*/
@Service("dictionaryService")
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements DictionaryService {
}

@ -0,0 +1,32 @@
package cn.com.v2.service.impl;
import cn.com.v2.mapper.GoviewProjectDataMapper;
import cn.com.v2.model.GoviewProjectData;
import cn.com.v2.service.IGoviewProjectDataService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@Service
public class GoviewProjectDataServiceImpl extends ServiceImpl<GoviewProjectDataMapper, GoviewProjectData> implements IGoviewProjectDataService {
@Autowired
GoviewProjectDataMapper dataMapper;
@Override
public GoviewProjectData getProjectid(String projectId) {
LambdaQueryWrapper<GoviewProjectData> lambdaQueryWrapper = new LambdaQueryWrapper<GoviewProjectData>();
lambdaQueryWrapper.eq(GoviewProjectData::getProjectId, projectId);
return dataMapper.selectOne(lambdaQueryWrapper);
}
}

@ -0,0 +1,20 @@
package cn.com.v2.service.impl;
import cn.com.v2.mapper.GoviewProjectMapper;
import cn.com.v2.model.GoviewProject;
import cn.com.v2.service.IGoviewProjectService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@Service
public class GoviewProjectServiceImpl extends ServiceImpl<GoviewProjectMapper, GoviewProject> implements IGoviewProjectService {
}

@ -0,0 +1,19 @@
package cn.com.v2.service.impl;
import cn.com.v2.mapper.HistoricalReplyMapper;
import cn.com.v2.model.HistoricalReply;
import cn.com.v2.service.HistoricalReplyService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* (THistoricalReply)
*
* @author wu
* @since 2025-04-18 09:34:28
*/
@Service("historicalReplyService")
public class HistoricalReplyServiceImpl extends ServiceImpl<HistoricalReplyMapper, HistoricalReply> implements HistoricalReplyService {
}

@ -0,0 +1,30 @@
package cn.com.v2.service.impl;
import cn.com.v2.mapper.SysFileMapper;
import cn.com.v2.model.SysFile;
import cn.com.v2.service.ISysFileService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2022-12-22
*/
@Service
public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> implements ISysFileService {
@Autowired
private SysFileMapper sysFileMapper;
@Override
public SysFile selectByExamplefileName(String filename) {
SysFile sysFile = sysFileMapper.selectOne(new LambdaQueryWrapper<SysFile>().eq(SysFile::getFileName, filename));
return sysFile;
}
}

@ -0,0 +1,20 @@
package cn.com.v2.service.impl;
import cn.com.v2.mapper.SysUserMapper;
import cn.com.v2.model.SysUser;
import cn.com.v2.service.ISysUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
*
* </p>
*
* @author fc
* @since 2023-04-30
*/
@Service
public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
}

@ -0,0 +1,233 @@
package cn.com.v2.util;
import cn.hutool.core.util.StrUtil;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.List;
/**
*
*
* @author fc
*
*/
public class ConvertUtil {
/**
* <br>
* null<br>
*
*
* @param value
* @param defaultValue
* @return
*/
public static String toStr(Object value, String defaultValue) {
if (null == value) {
return defaultValue;
}
if (value instanceof String) {
return (String) value;
}
return value.toString();
}
/**
* Integer<br>
* @param split
* @return
*/
public static Integer[] toIntArray(String str) {
return toIntArray(",", str);
}
/**
* Integer<br>
* @param split
* @param split
* @return
*/
public static Integer[] toIntArray(String split, String str) {
if (StrUtil.isEmpty(str)) {
return new Integer[]{};
}
String[] strings = str.split(split);
final Integer[] ints = new Integer[strings.length];
for (int i = 0; i < strings.length; i++) {
final Integer v = toInt(strings[i], 0);
ints[i] = v;
}
return ints;
}
/**
* int<br>
* <br>
*
* @param value
* @param defaultValue
* @return
*/
public static Integer toInt(Object value, Integer defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Integer) {
return (Integer) value;
}
if (value instanceof Number) {
return ((Number) value).intValue();
}
final String valueStr = toStr(value, null);
if (StrUtil.isEmpty(valueStr)) {
return defaultValue;
}
try {
return Integer.parseInt(valueStr.trim());
} catch (Exception e) {
return defaultValue;
}
}
/**
* List<String><br>
* @param split
* @return
*/
public static List<String> toListStrArray(String str) {
String[] stringArray = toStrArray(str);
List<String> stringB = Arrays.asList(stringArray);
return stringB;
}
/**
* List<Long><br>
* @param split
* @return
*/
public static List<Long> toListLongArray(String str) {
Long[] stringArray = toLongArray(str);
List<Long> stringB = Arrays.asList(stringArray);
return stringB;
}
/**
* String<br>
* @param split
* @return
*/
public static String[] toStrArray(String str) {
return toStrArray(",", str);
}
/**
* String<br>
*
* @param split
* @param split
* @return
*/
public static String[] toStrArray(String split, String str) {
return str.split(split);
}
/**
* Long<br>
*
* @param split
* @return
*/
public static Long[] toLongArray(String str) {
return toLongArray(",", str);
}
/**
* Long<br>
*
* @param isIgnoreConvertError null
* @param values
* @return
*/
public static Long[] toLongArray(String split, String str) {
if (StrUtil.isEmpty(str)) {
return new Long[]{};
}
String[] arr = str.split(split);
final Long[] longs = new Long[arr.length];
for (int i = 0; i < arr.length; i++) {
final Long v = toLong(arr[i], null);
longs[i] = v;
}
return longs;
}
/**
* long<br>
* <br>
*
*
* @param value
* @param defaultValue
* @return
*/
public static Long toLong(Object value, Long defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof Long) {
return (Long) value;
}
if (value instanceof Number) {
return ((Number) value).longValue();
}
final String valueStr = toStr(value, null);
if (StrUtil.isEmpty(valueStr)) {
return defaultValue;
}
try {
// 支持科学计数法
return new BigDecimal(valueStr.trim()).longValue();
} catch (Exception e) {
return defaultValue;
}
}
/**
* BigDecimal<br>
* <br>
*
*
* @param value
* @param defaultValue
* @return
*/
public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) {
if (value == null) {
return defaultValue;
}
if (value instanceof BigDecimal) {
return (BigDecimal) value;
}
if (value instanceof Long) {
return new BigDecimal((Long) value);
}
if (value instanceof Double) {
return new BigDecimal((Double) value);
}
if (value instanceof Integer) {
return new BigDecimal((Integer) value);
}
final String valueStr = toStr(value, null);
if (StrUtil.isEmpty(valueStr)) {
return defaultValue;
}
try {
return new BigDecimal(valueStr);
} catch (Exception e) {
return defaultValue;
}
}
}

@ -0,0 +1,74 @@
package cn.com.v2.util;
import cn.com.v2.model.SysUser;
import cn.dev33.satoken.stp.StpUtil;
import org.springframework.beans.BeanUtils;
/**
* Sa-Token
* @author kong
*
*/
public class SaTokenUtil {
/**
* model
*/
public static SysUser getUser() {
Object object = StpUtil.getSession().get("user");
if (object != null) {
SysUser tsysUser = new SysUser();
BeanUtils.copyProperties(tsysUser, object);
return tsysUser;
}
return null;
}
/**
* set
*/
public static void setUser(SysUser user) {
StpUtil.getSession().set("user", user);
}
/**
* id
*/
public static String getUserId() {
return StpUtil.getLoginIdAsString();
}
/**
* name
*/
public static String getLoginName() {
SysUser tsysUser = getUser();
if (tsysUser == null) {
throw new RuntimeException("用户不存在!");
}
return tsysUser.getUsername();
}
/**
* ip
* @return
* @author fuce
* @Date 20191121 9:58:26
*/
public static String getIp() {
return StpUtil.getTokenSession().getString("login_ip");
}
/**
*
* @return
* @author fuce
* @Date 20191121 9:58:26
*/
public static boolean isLogin() {
return StpUtil.isLogin();
}
}

@ -0,0 +1,143 @@
package cn.com.v2.util;
/**
* Twitter_Snowflake<br>
* SnowFlake(-):<br>
* 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
* 1longJava01id0<br>
* 41()41 - )
* id使IdWorkerstartTime41使69T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
* 1010245datacenterId5workerId<br>
* 1212()4096ID<br>
* 64Long<br>
* SnowFlakeID(IDID)SnowFlake26ID
*/
public class SnowflakeIdWorker {
// ==============================Fields===========================================
static SnowflakeIdWorker idWorker = new SnowflakeIdWorker(1, 1);
/** 开始时间截 (2015-01-01) */
private final long twepoch = 1489111610226L;
/** 机器id所占的位数 */
private final long workerIdBits = 5L;
/** 数据标识id所占的位数 */
private final long dataCenterIdBits = 5L;
/** 支持的最大机器id结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
/** 支持的最大数据标识id结果是31 */
private final long maxDataCenterId = -1L ^ (-1L << dataCenterIdBits);
/** 序列在id中占的位数 */
private final long sequenceBits = 12L;
/** 机器ID向左移12位 */
private final long workerIdShift = sequenceBits;
/** 数据标识id向左移17位(12+5) */
private final long dataCenterIdShift = sequenceBits + workerIdBits;
/** 时间截向左移22位(5+5+12) */
private final long timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits;
/** 生成序列的掩码这里为4095 (0b111111111111=0xfff=4095) */
private final long sequenceMask = -1L ^ (-1L << sequenceBits);
/** 工作机器ID(0~31) */
private long workerId;
/** 数据中心ID(0~31) */
private long dataCenterId;
/** 毫秒内序列(0~4095) */
private long sequence = 0L;
/** 上次生成ID的时间截 */
private long lastTimestamp = -1L;
//==============================Constructors=====================================
/**
*
* @param workerId ID (0~31)
* @param dataCenterId ID (0~31)
*/
public SnowflakeIdWorker(long workerId, long dataCenterId) {
if (workerId > maxWorkerId || workerId < 0) {
throw new IllegalArgumentException(String.format("workerId can't be greater than %d or less than 0", maxWorkerId));
}
if (dataCenterId > maxDataCenterId || dataCenterId < 0) {
throw new IllegalArgumentException(String.format("dataCenterId can't be greater than %d or less than 0", maxDataCenterId));
}
this.workerId = workerId;
this.dataCenterId = dataCenterId;
}
// ==============================Methods==========================================
/** 测试 */
public static void main(String[] args) {
System.out.println(System.currentTimeMillis());
SnowflakeIdWorker idWorker = new SnowflakeIdWorker(1, 1);
long startTime = System.nanoTime();
for (int i = 0; i < 500; i++) {
long id = idWorker.nextId();
System.out.println(id);
}
System.out.println((System.nanoTime() - startTime) / 1000000 + "ms");
}
public static String getUUID() {
long id = idWorker.nextId();
return String.valueOf(id);
}
/**
* ID (线)
* @return SnowflakeId
*/
public synchronized long nextId() {
long timestamp = timeGen();
//如果当前时间小于上一次ID生成的时间戳说明系统时钟回退过这个时候应当抛出异常
if (timestamp < lastTimestamp) {
throw new RuntimeException(
String.format("Clock moved backwards. Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
}
//如果是同一时间生成的,则进行毫秒内序列
if (lastTimestamp == timestamp) {
sequence = (sequence + 1) & sequenceMask;
//毫秒内序列溢出
if (sequence == 0) {
//阻塞到下一个毫秒,获得新的时间戳
timestamp = tilNextMillis(lastTimestamp);
}
}
//时间戳改变,毫秒内序列重置
else {
sequence = 0L;
}
//上次生成ID的时间截
lastTimestamp = timestamp;
//移位并通过或运算拼到一起组成64位的ID
return ((timestamp - twepoch) << timestampLeftShift) //
| (dataCenterId << dataCenterIdShift) //
| (workerId << workerIdShift) //
| sequence;
}
//==============================Test=============================================
/**
*
* @param lastTimestamp ID
* @return
*/
protected long tilNextMillis(long lastTimestamp) {
long timestamp = timeGen();
while (timestamp <= lastTimestamp) {
timestamp = timeGen();
}
return timestamp;
}
/**
*
* @return ()
*/
protected long timeGen() {
return System.currentTimeMillis();
}
}

@ -0,0 +1,21 @@
#dev环境 mysql7.0
spring:
datasource:
druid:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/go-view?useSSL=false&allowPublicKeyRetrieval=true
username: root
password: 123456
initial-size: 10
min-idle: 10
max-active: 20
max-wait: 40
validation-query: SELECT 1
# url: jdbc:sqlite:D:\javaSpaces\go-view-serve\sqllite\goview.db
#linux服务器
#url: jdbc:sqlite://home/cqfy/project/OSSDATABASE/oss.db
username:
password:
### 连接池配置

@ -0,0 +1,21 @@
#dev环境 mysql7.0
spring:
datasource:
druid:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://39.101.188.84:3307/go-view?useSSL=false&allowPublicKeyRetrieval=true
username: root
password: Admin123@
initial-size: 10
min-idle: 10
max-active: 20
max-wait: 40
validation-query: SELECT 1
# url: jdbc:sqlite:D:\javaSpaces\go-view-serve\sqllite\goview.db
#linux服务器
#url: jdbc:sqlite://home/cqfy/project/OSSDATABASE/oss.db
username:
password:
### 连接池配置

@ -0,0 +1,109 @@
v2:
#虚拟路径映射路径 2个文件路径一一对应 第一个为主存储,其他为配置相关
xnljmap:
#win服务器 本地 注意!! 记住这个结尾有一个/
oss: file:D:/upload/
#linux服务器
#oss: file:/home/webapps/oss/
#虚拟路径映射路径 end
#本地存放地址 注意!! 记住这个结尾没有/
fileurl: D:/upload
#http://127.0.0.1:8080/oss/{yy}/2022-12-22/c83a77ae134a540c30daa6a0666fa945.md
httpurl: http://39.101.188.84:8012/
defaultFormat: .png
#tomcat config
server:
port: 8012
##项目名字配置
servlet:
context-path: /
#session过期
session:
timeout: PT4H
#cookie:
# name: jxfgzs
tomcat:
uri-encoding: UTF-8
#xx 报错修改的地方
max-connections: 200000
max-http-form-post-size: 9000000
threads:
max: 128
min-spare: 5
spring:
# 环境 dev|test|prod
profiles:
active: dev
servlet:
multipart:
#设置总上传的数据大小
max-request-size: 100MB
#单个文件大小
maxFileSize: 30MB
#xx 报错修改的地方
max-connections: 200000
max-http-post-size: 9000000
#热部署模块
devtools:
restart:
#热部署开关
enabled: true
#指定热部署的目录
additional-paths: src/main/java
#指定目录不更新
exclude: test/**
mvc: #静态文件
static-path-pattern: /static/**
pathmatch:
matching-strategy: ant_path_matcher
#模板引擎
thymeleaf:
model: HTML5
prefix: classpath:/templates/
suffix: .html
#指定编码
encoding: utf-8
#禁用缓存 默认false
cache: false
#mybatis
mybatis-plus:
mapper-locations: classpath:/mapper/*Mapper.xml
#实体扫描多个package用逗号或者分号分隔
typeAliasesPackage: cn.com.v2.model
global-config:
# 数据库相关配置
db-config:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID",ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: INPUT
#字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断"
field-strategy: not_empty
#驼峰下划线转换
column-underline: true
#数据库大写下划线转换
#capital-mode: true
#逻辑删除配置
logic-delete-value: 0
logic-not-delete-value: 1
#刷新mapper 调试神器
refresh: true
# 原生配置
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
############## Sa-Token 配置 (文档: https://sa-token.cc) ##############
sa-token:
# token名称 (同时也是cookie名称)
token-name: satoken
# token有效期单位s 默认30天, -1代表永不过期
timeout: 2592000
# token临时有效期 (指定时间内无操作就视为token过期) 单位: 秒
activity-timeout: -1
# 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)
is-concurrent: true
# 在多人登录同一账号时是否共用一个token (为true时所有登录共用一个token, 为false时每次登录新建一个token)
is-share: true
# token风格
token-style: uuid
# 是否输出操作日志
is-log: false

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.v2.mapper.GoviewProjectDataMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.v2.mapper.GoviewProjectMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.v2oss.mapper.SysFileMapper">
</mapper>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.v2.mapper.SysUserMapper">
</mapper>

@ -0,0 +1,13 @@
package cn.com.jetshine.oos;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class OosApplicationTests {
@Test
void contextLoads() {
}
}
Loading…
Cancel
Save