commit
6307d6c2d8
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.qiwenshare</groupId>
|
||||
<artifactId>qiwenshare</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<version>1.1.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>qiwen-file</artifactId>
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.qiwenshare.file.api;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.qiwenshare.file.domain.ShareFile;
|
||||
import com.qiwenshare.file.domain.UserLoginInfo;
|
||||
import com.qiwenshare.file.vo.share.ShareFileListVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IUserLoginInfoService extends IService<UserLoginInfo> {
|
||||
|
||||
}
|
@ -227,8 +227,8 @@ public class FiletransferController {
|
||||
/********************************** 图片预览适配 **************************************/
|
||||
LambdaQueryWrapper<Image> imageLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
imageLambdaQueryWrapper.eq(Image::getFileId, fileBean.getFileId());
|
||||
Image result = imageMapper.selectOne(imageLambdaQueryWrapper);
|
||||
if (result == null) {
|
||||
List<Image> result = imageMapper.selectList(imageLambdaQueryWrapper);
|
||||
if (result == null || result.isEmpty()) {
|
||||
if (UFOPUtils.isImageFile(userFile.getExtendName())) {
|
||||
Downloader downloader = ufopFactory.getDownloader(fileBean.getStorageType());
|
||||
DownloadFile downloadFile = new DownloadFile();
|
||||
|
@ -53,6 +53,8 @@ public class OfficeController {
|
||||
|
||||
@Value("${deployment.host}")
|
||||
private String deploymentHost;
|
||||
@Value("${server.port}")
|
||||
private String port;
|
||||
@Value("${ufop.storage-type}")
|
||||
private Integer storageType;
|
||||
|
||||
@ -142,7 +144,7 @@ public class OfficeController {
|
||||
}
|
||||
UserFile userFile = userFileService.getById(previewOfficeFileDTO.getUserFileId());
|
||||
|
||||
String baseUrl = request.getScheme()+"://"+ deploymentHost + request.getContextPath();
|
||||
String baseUrl = request.getScheme()+"://"+ deploymentHost + ":" + port + request.getContextPath();
|
||||
|
||||
FileModel file = new FileModel(userFile.getFileName() + "." + userFile.getExtendName(),
|
||||
previewOfficeFileDTO.getPreviewUrl(),
|
||||
@ -181,7 +183,7 @@ public class OfficeController {
|
||||
}
|
||||
UserFile userFile = userFileService.getById(editOfficeFileDTO.getUserFileId());
|
||||
|
||||
String baseUrl = request.getScheme()+"://"+ deploymentHost + request.getContextPath();
|
||||
String baseUrl = request.getScheme()+"://"+ deploymentHost + ":" + port + request.getContextPath();
|
||||
|
||||
log.info("回调地址baseUrl:" + baseUrl);
|
||||
|
||||
|
@ -2,11 +2,16 @@ package com.qiwenshare.file.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.qiwenshare.common.anno.MyLog;
|
||||
import com.qiwenshare.common.result.RestResult;
|
||||
import com.qiwenshare.common.util.DateUtil;
|
||||
import com.qiwenshare.common.util.JjwtUtil;
|
||||
import com.qiwenshare.file.api.IUserLoginInfoService;
|
||||
import com.qiwenshare.file.api.IUserService;
|
||||
import com.qiwenshare.file.domain.UserBean;
|
||||
import com.qiwenshare.file.domain.UserLoginInfo;
|
||||
import com.qiwenshare.file.dto.user.RegisterDTO;
|
||||
import com.qiwenshare.file.vo.user.UserLoginVo;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -31,6 +36,8 @@ public class UserController {
|
||||
|
||||
@Resource
|
||||
IUserService userService;
|
||||
@Resource
|
||||
IUserLoginInfoService userLoginInfoService;
|
||||
|
||||
|
||||
|
||||
@ -100,6 +107,13 @@ public class UserController {
|
||||
}
|
||||
UserBean sessionUserBean = userService.getUserBeanByToken(token);
|
||||
if (sessionUserBean != null) {
|
||||
LambdaQueryWrapper<UserLoginInfo> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.likeRight(UserLoginInfo::getUserloginDate, DateUtil.getCurrentTime().substring(0, 10));
|
||||
userLoginInfoService.remove(lambdaQueryWrapper);
|
||||
UserLoginInfo userLoginInfo = new UserLoginInfo();
|
||||
userLoginInfo.setUserId(sessionUserBean.getUserId());
|
||||
userLoginInfo.setUserloginDate(DateUtil.getCurrentTime());
|
||||
userLoginInfoService.save(userLoginInfo);
|
||||
return RestResult.success().data(sessionUserBean);
|
||||
|
||||
} else {
|
||||
|
@ -30,6 +30,9 @@ public class FileBean {
|
||||
@Column(columnDefinition="bigint(10)")
|
||||
private Long fileSize;
|
||||
|
||||
@Column(columnDefinition="int(1)")
|
||||
private Integer fileStatus;
|
||||
|
||||
@Column(columnDefinition="int(1)")
|
||||
private Integer storageType;
|
||||
|
||||
|
@ -70,4 +70,6 @@ public class OperationLogBean {
|
||||
*/
|
||||
private String logLevel;
|
||||
|
||||
private Integer platform;
|
||||
|
||||
}
|
||||
|
@ -23,29 +23,7 @@ public class Permission {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long permissionId;//主键.
|
||||
/**
|
||||
* 权限名称
|
||||
*/
|
||||
@Column
|
||||
private String name;//名称.
|
||||
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
@Column
|
||||
private String resourceType;//资源类型,[menu|button]
|
||||
|
||||
/**
|
||||
* 资源路径
|
||||
*/
|
||||
@Column
|
||||
private String url;//资源路径.
|
||||
/**
|
||||
* 权限字符串,menu例子:role:*,button例子:role:create,role:update,role:delete,role:view
|
||||
*/
|
||||
@Column
|
||||
private String permission;
|
||||
private Long permissionId;//主键
|
||||
|
||||
/**
|
||||
* 父编号
|
||||
@ -54,22 +32,34 @@ public class Permission {
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 父编号列表
|
||||
* 权限名称
|
||||
*/
|
||||
@Column
|
||||
private String parentIds;
|
||||
private String permissionName;//名称.
|
||||
|
||||
/**
|
||||
* 是否生效
|
||||
* 资源类型
|
||||
*/
|
||||
@Column
|
||||
private Boolean available = Boolean.FALSE;
|
||||
private Integer resourceType;//资源类型
|
||||
|
||||
/**
|
||||
* 角色列表
|
||||
* 权限字符串
|
||||
*/
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private List<Role> roles;
|
||||
@Column
|
||||
private String permissionCode;
|
||||
|
||||
@Column
|
||||
private Integer orderNum;
|
||||
|
||||
|
||||
private String createTime;
|
||||
|
||||
private Long createUserId;
|
||||
|
||||
private String modifyTime;
|
||||
|
||||
private Long modifyUserId;
|
||||
|
||||
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package com.qiwenshare.file.domain;
|
||||
|
||||
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;
|
||||
@ -27,7 +28,7 @@ public class Role {
|
||||
/**
|
||||
* 角色名
|
||||
*/
|
||||
private String role; // 角色标识程序中判断使用,如"admin",这个是唯一的:
|
||||
private String roleName; // 角色标识程序中判断使用,如"admin",这个是唯一的:
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
@ -37,21 +38,24 @@ public class Role {
|
||||
/**
|
||||
* 是否可用
|
||||
*/
|
||||
private Boolean available = Boolean.FALSE; // 是否可用,如果不可用将不会添加给用户
|
||||
private Integer available; // 是否可用,如果不可用将不会添加给用户
|
||||
|
||||
private String createTime;
|
||||
|
||||
private Long createUserId;
|
||||
|
||||
private String modifyTime;
|
||||
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 权限列表
|
||||
*/
|
||||
@ManyToMany(fetch = FetchType.EAGER)//立即从数据库中进行加载数据
|
||||
@JoinTable(name = "role_permission",
|
||||
joinColumns = {@JoinColumn(name = "roleId")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "permissionId")})
|
||||
joinColumns = {@JoinColumn(name = "roleid")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "permissionid")})
|
||||
@TableField(exist = false)
|
||||
private List<Permission> permissions;
|
||||
|
||||
// @ManyToMany
|
||||
// @JoinTable(name = "role_permission",
|
||||
// joinColumns = {@JoinColumn(name="roleId")},
|
||||
// inverseJoinColumns = {@JoinColumn(name="permissionId")})
|
||||
// private List<UserBean> userList;// 一个角色对应多个用户
|
||||
|
||||
}
|
@ -31,6 +31,11 @@ public class StorageBean {
|
||||
@Column(columnDefinition="bigint(20)")
|
||||
private Long totalStorageSize;
|
||||
|
||||
@Column(columnDefinition="varchar(25) comment '修改时间'")
|
||||
private String modifyTime;
|
||||
@Column(columnDefinition="bigint(20) comment '修改用户id'")
|
||||
private Long modifyUserId;
|
||||
|
||||
public StorageBean() {
|
||||
|
||||
}
|
||||
|
@ -85,6 +85,14 @@ public class UserBean {
|
||||
@Column(columnDefinition = "varchar(30)")
|
||||
private String registerTime;
|
||||
|
||||
private String lastLoginTime;
|
||||
|
||||
private Integer available;
|
||||
|
||||
private String modifyTime;
|
||||
|
||||
private Long modifyUserId;
|
||||
|
||||
/**
|
||||
* 验证码
|
||||
*/
|
||||
@ -104,6 +112,6 @@ public class UserBean {
|
||||
joinColumns = {@JoinColumn(name = "userId")},
|
||||
inverseJoinColumns = {@JoinColumn(name = "roleid")})
|
||||
@TableField(exist = false)
|
||||
private List<Role> roleList;// 一个用户具有多个角色
|
||||
private List<Role> roles;
|
||||
|
||||
}
|
||||
|
27
src/main/java/com/qiwenshare/file/domain/UserLoginInfo.java
Normal file
27
src/main/java/com/qiwenshare/file/domain/UserLoginInfo.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.qiwenshare.file.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
/**
|
||||
* @author MAC
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2021/11/18 22:36
|
||||
*/
|
||||
@Data
|
||||
@Table(name = "userlogininfo")
|
||||
@Entity
|
||||
@TableName("userlogininfo")
|
||||
public class UserLoginInfo {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long userLoginId;
|
||||
private String userloginDate;
|
||||
private Long userId;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.qiwenshare.file.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.qiwenshare.file.domain.UserLoginInfo;
|
||||
|
||||
/**
|
||||
* @author MAC
|
||||
* @version 1.0
|
||||
* @description: TODO
|
||||
* @date 2021/11/18 22:38
|
||||
*/
|
||||
public interface UserLoginInfoMapper extends BaseMapper<UserLoginInfo> {
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.qiwenshare.file.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.qiwenshare.file.api.IShareService;
|
||||
import com.qiwenshare.file.api.IUserLoginInfoService;
|
||||
import com.qiwenshare.file.domain.Share;
|
||||
import com.qiwenshare.file.domain.UserLoginInfo;
|
||||
import com.qiwenshare.file.dto.sharefile.ShareListDTO;
|
||||
import com.qiwenshare.file.mapper.ShareMapper;
|
||||
import com.qiwenshare.file.mapper.UserLoginInfoMapper;
|
||||
import com.qiwenshare.file.vo.share.ShareListVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(rollbackFor=Exception.class)
|
||||
public class UserLoginInfoService extends ServiceImpl<UserLoginInfoMapper, UserLoginInfo> implements IUserLoginInfoService {
|
||||
|
||||
|
||||
}
|
@ -12,6 +12,8 @@ import com.qiwenshare.file.api.IUserService;
|
||||
import com.qiwenshare.file.component.UserDealComp;
|
||||
import com.qiwenshare.file.controller.UserController;
|
||||
import com.qiwenshare.file.domain.UserBean;
|
||||
import com.qiwenshare.file.domain.UserLoginInfo;
|
||||
import com.qiwenshare.file.mapper.UserLoginInfoMapper;
|
||||
import com.qiwenshare.file.mapper.UserMapper;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -33,6 +35,8 @@ public class UserService extends ServiceImpl<UserMapper, UserBean> implements IU
|
||||
UserMapper userMapper;
|
||||
@Resource
|
||||
UserDealComp userDealComp;
|
||||
@Resource
|
||||
UserLoginInfoMapper userLoginInfoMapper;
|
||||
|
||||
@Override
|
||||
public UserBean getUserBeanByToken(String token){
|
||||
@ -81,6 +85,7 @@ public class UserService extends ServiceImpl<UserMapper, UserBean> implements IU
|
||||
}
|
||||
if (tokenPassword.equals(savePassword)) {
|
||||
|
||||
|
||||
return saveUserBean;
|
||||
} else {
|
||||
return null;
|
||||
|
@ -1,15 +0,0 @@
|
||||
package com.qiwenshare.file.test;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class test {
|
||||
public static void main(String[] args) {
|
||||
List<Integer> list = new ArrayList<>();
|
||||
list.add(1);
|
||||
list.add(2);
|
||||
System.out.println(JSON.toJSONString(list));
|
||||
}
|
||||
}
|
@ -14,13 +14,6 @@ spring.application.name=qiwen-file
|
||||
logging.file.name=/qiwenshare/qiwen-file/log/web.log
|
||||
logging.level.root=info
|
||||
|
||||
#mybatis配置
|
||||
mybatis.type-aliases-package=com.qiwenshare.file.domain
|
||||
mybatis.config-locations=classpath:mybatis-config.xml
|
||||
mybatis.mapper-locations=classpath:mapper/*.xml
|
||||
#mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
|
||||
#数据库初始化
|
||||
spring.datasource.data=classpath:database/data.sql
|
||||
spring.datasource.sql-script-encoding=utf-8
|
||||
@ -43,8 +36,9 @@ spring.servlet.multipart.enabled=true
|
||||
|
||||
spring.main.allow-bean-definition-overriding=true
|
||||
|
||||
mybatis-plus.type-aliases-package=com.qiwenshare.file.domain
|
||||
mybatis-plus.config-locations=classpath:mybatis-config.xml
|
||||
mybatis-plus.mapper-locations=classpath:mapper/*.xml
|
||||
mybatis-plus.type-aliases-package=com.qiwenshare.file.domain
|
||||
mybatis-plus.configuration.map-underscore-to-camel-case=false
|
||||
mybatis-plus.global-config.banner=false
|
||||
|
||||
@ -106,6 +100,6 @@ spring.elasticsearch.rest.password=
|
||||
|
||||
|
||||
# 当前部署外网IP,用于office预览
|
||||
deployment.host=192.168.31.158:${server.port}
|
||||
deployment.host=192.168.31.158
|
||||
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
insert ignore into role (roleId, role, description) values (1, 'admin', '管理员'),(2, 'user', '普通用户');
|
||||
insert ignore into permission (permissionId, permission) values (1, 'admin'),(2, 'user');
|
||||
insert ignore into user (userId, username, telephone, salt, password, available) values (1, 'admin', 'admin', 'admin', 'df655ad8d3229f3269fad2a8bab59b6c', 1);
|
||||
|
||||
INSERT ignore INTO `role` (`roleid`, `available`, `description`, `roleName`, `createTime`, `createUserId`, `modifyTime`, `modifyUserId`) VALUES (1, 1, '超级管理员', '超级管理员', NULL, NULL, '2021-11-10 20:46:06', NULL);
|
||||
INSERT ignore INTO `role` (`roleid`, `available`, `description`, `roleName`, `createTime`, `createUserId`, `modifyTime`, `modifyUserId`) VALUES (2, 1, '普通用户', '普通用户', NULL, NULL, NULL, NULL);
|
||||
|
||||
insert ignore into sysparam (sysParamId, sysParamKey, sysParamValue, sysParamDesc) values (1, 'totalStorageSize', '1024', '总存储大小(单位M)');
|
Loading…
Reference in New Issue
Block a user