人员档案功能和网盘功能重构。

This commit is contained in:
Renpc-kilig 2022-07-05 14:45:23 +08:00
parent c8cabe1f8a
commit 9cf48abc5a
22 changed files with 279 additions and 14 deletions

View File

@ -1,7 +1,9 @@
package cn.com.tenlion.systemoa.controller.app.api.filecatalogue;
import cn.com.tenlion.systemoa.pojo.dtos.filecatalogue.ListZTreeDTO;
import ink.wgink.annotation.CheckRequestBodyAnnotation;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.exceptions.SearchException;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.result.ErrorResult;
@ -12,6 +14,7 @@ import cn.com.tenlion.systemoa.pojo.dtos.filecatalogue.FileCatalogueDTO;
import cn.com.tenlion.systemoa.pojo.vos.filecatalogue.FileCatalogueVO;
import cn.com.tenlion.systemoa.service.filecatalogue.IFileCatalogueService;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -90,6 +93,7 @@ public class FileCatalogueAppController extends DefaultBaseController {
@GetMapping("list")
public List<FileCatalogueDTO> list(@RequestHeader("token") String token) {
Map<String, Object> params = requestParams();
params.put("token", token);
return fileCatalogueService.list(params);
}
@ -106,6 +110,7 @@ public class FileCatalogueAppController extends DefaultBaseController {
@GetMapping("listpagefilecatalogue")
public SuccessResultList<List<FileCatalogueDTO>> listPage(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
params.put("token", token);
page.setParams(params);
return fileCatalogueService.listPage(page);
}
@ -118,4 +123,20 @@ public class FileCatalogueAppController extends DefaultBaseController {
return new SuccessResultData<>(fileCatalogueService.count(params));
}
@ApiOperation(value = "文档目录树形", notes = "文档目录树形接口")
@ApiImplicitParams({})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("ztree")
public List<ListZTreeDTO> ztree(@RequestHeader("token") String token) throws SearchException {
Map<String, Object> params = requestParams();
params.put("token", token);
String parentId = "0";
if (!StringUtils.isBlank(params.get(ISystemConstant.PARAMS_ID) == null ? null : params.get(ISystemConstant.PARAMS_ID).toString())) {
parentId = params.get(ISystemConstant.PARAMS_ID).toString();
}
params.put("parentId", parentId);
return fileCatalogueService.ztree(params);
}
}

View File

@ -79,7 +79,7 @@ public class FileUploadAppController extends DefaultBaseController {
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get/{fileUploadId}")
public FileUploadDTO get(@RequestHeader("token") String token, @PathVariable("fileUploadId") String fileUploadId) {
return fileUploadService.get(fileUploadId);
return fileUploadService.get(token, fileUploadId);
}
@ApiOperation(value = "文档上传列表", notes = "文档上传列表接口")
@ -90,6 +90,7 @@ public class FileUploadAppController extends DefaultBaseController {
@GetMapping("list")
public List<FileUploadDTO> list(@RequestHeader("token") String token) {
Map<String, Object> params = requestParams();
params.put("token", token);
return fileUploadService.list(params);
}
@ -119,4 +120,21 @@ public class FileUploadAppController extends DefaultBaseController {
return new SuccessResultData<>(fileUploadService.count(params));
}
@ApiOperation(value = "共享文档分页列表", notes = "共享文档分页列表接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
})
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("sharelistpage")
public SuccessResultList<List<FileUploadDTO>> shareListPage(@RequestHeader("token") String token, ListPage page) {
Map<String, Object> params = requestParams();
params.put("token", token);
page.setParams(params);
return fileUploadService.shareListPage(page);
}
}

View File

@ -128,4 +128,12 @@ public class UserArchivesAppController extends DefaultBaseController {
return new SuccessResultData<>(userArchivesService.count(params));
}
@ApiOperation(value = "获取个人档案ID", notes = "获取个人档案ID接口")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("pageTurnTo")
public String pageTurnTo(@RequestHeader("token") String token) {
Map<String, Object> params = requestParams();
return userArchivesService.pageTurnTo(token, params);
}
}

View File

@ -26,7 +26,7 @@ import java.util.Map;
* @Date: 2022-06-13 10:26:43
* @Version: 3.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "接口")
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "人力档案类型接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/userarchivestype")
public class UserArchivesTypeAppController extends DefaultBaseController {

View File

@ -26,7 +26,7 @@ import java.util.Map;
* @Date: 2022-06-24 10:28:35
* @Version: 3.0
**/
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "接口")
@Api(tags = ISystemConstant.API_TAGS_APP_PREFIX + "个人荣誉接口")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/userhonor")
public class UserHonorAppController extends DefaultBaseController {

View File

@ -50,6 +50,8 @@ public class FileCatalogueDTO {
private String viewUserId;
@ApiModelProperty(name = "viewUserName", value = "查看人员名称")
private String viewUserName;
@ApiModelProperty(name = "shareUserName", value = "谁共享给我")
private String shareUserName;
public String getFileCatalogueId() {
return fileCatalogueId == null ? "" : fileCatalogueId.trim();
@ -194,4 +196,12 @@ public class FileCatalogueDTO {
public void setViewUserName(String viewUserName) {
this.viewUserName = viewUserName;
}
public String getShareUserName() {
return shareUserName;
}
public void setShareUserName(String shareUserName) {
this.shareUserName = shareUserName;
}
}

View File

@ -68,6 +68,8 @@ public class FileUploadDTO {
private String operationRole;
@ApiModelProperty(name = "isOff", value = "下架状态0草稿1发布")
private Integer isOff;
@ApiModelProperty(name = "shareUserName", value = "谁共享给我")
private String shareUserName;
public String getFileUploadId() {
return fileUploadId == null ? "" : fileUploadId.trim();
@ -284,4 +286,12 @@ public class FileUploadDTO {
public void setIsOff(Integer isOff) {
this.isOff = isOff;
}
public String getShareUserName() {
return shareUserName;
}
public void setShareUserName(String shareUserName) {
this.shareUserName = shareUserName;
}
}

View File

@ -172,8 +172,22 @@ public class FileCatalogueServiceImpl extends DefaultBaseService implements IFil
if (null != userInfoBO) {
creator = userInfoBO.getUserId();
}
String token = null;
if (null != params.get("token")) {
token = params.get("token").toString();
try {
AppTokenUser appTokenUser = securityComponent.getAppTokenUser(token);
if (null != appTokenUser) {
creator = appTokenUser.getId();
}
} catch (Exception e) {
e.printStackTrace();
}
}
if(null != params.get("type") && params.get("type").toString().equals("0")) {
params.put("creator", userInfoBO.getUserId());
params.put("creator", creator);
}
List<FileCatalogueDTO> list = fileCatalogueDao.list(params);
if(null != list && list.size() > 0) {

View File

@ -115,6 +115,14 @@ public interface IFileUploadService {
*/
FileUploadDTO get(String fileUploadId);
/**
* 文档上传详情
*
* @param fileUploadId
* @return
*/
FileUploadDTO get(String token, String fileUploadId);
/**
* 文档上传详情
*
@ -194,4 +202,6 @@ public interface IFileUploadService {
SuccessResultList<List<FileUploadDTO>> listPageOff(ListPage page);
List<FileUploadDTO> listOff(Map<String, Object> params);
SuccessResultList<List<FileUploadDTO>> shareListPage(ListPage page);
}

View File

@ -1,6 +1,7 @@
package cn.com.tenlion.systemoa.service.fileupload.impl;
import cn.com.tenlion.systemoa.config.properties.ConfigPro;
import cn.com.tenlion.systemoa.dao.filerole.IFileRoleDao;
import cn.com.tenlion.systemoa.dao.fileupload.IFileUploadDao;
import cn.com.tenlion.systemoa.pojo.bos.fileupload.FileUploadBO;
import cn.com.tenlion.systemoa.pojo.dtos.filecatalogue.FileCatalogueDTO;
@ -26,9 +27,11 @@ import ink.wgink.module.file.service.IFileService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.app.AppTokenUser;
import ink.wgink.pojo.bos.UserInfoBO;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.pos.FilePO;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.properties.FileProperties;
import ink.wgink.service.user.service.IUserService;
import ink.wgink.util.UUIDUtil;
import ink.wgink.util.date.DateUtil;
import ink.wgink.util.map.HashMapUtil;
@ -73,6 +76,10 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
private IFileRoleService fileRoleService;
@Autowired
private ITypeRoleService typeRoleService;
@Autowired
private IUserService userService;
@Autowired
private IFileRoleDao fileRoleDao;
@Override
public void save(FileUploadVO fileUploadVO) {
@ -169,11 +176,43 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
@Override
public FileUploadDTO get(Map<String, Object> params) {
String creator = null;
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
if (null != userInfoBO) {
creator = userInfoBO.getUserId();
}
String token = null;
if (null != params.get("token")) {
token = params.get("token").toString();
try {
AppTokenUser appTokenUser = securityComponent.getAppTokenUser(token);
if (null != appTokenUser) {
creator = appTokenUser.getId();
}
} catch (Exception e) {
e.printStackTrace();
}
}
FileUploadDTO fileUploadDTO = fileUploadDao.get(params);
if(null != fileUploadDTO) {
// 设置操作权限和查看权限为无权限
fileUploadDTO.setOperationRole("0");
if(!StringUtils.isEmpty(fileUploadDTO.getFileTypeId())) {
FileCatalogueDTO fileCatalogueDTO = fileCatalogueService.get(fileUploadDTO.getFileTypeId());
if(null != fileCatalogueDTO) {
// 若文档类型创建者和当前登录用户一致则授权操作权限
if(creator.equals(fileCatalogueDTO.getCreator())) {
fileUploadDTO.setOperationRole("1");
}else {
// 获取操作权限
params.put("fileCatalogueId", fileCatalogueDTO.getFileCatalogueId());
if(typeRoleService.hasRole(params)) {
fileUploadDTO.setOperationRole("1");
}
}
fileUploadDTO.setOldFileType(fileCatalogueDTO.getName());
fileUploadDTO.setFileTypeName(fileCatalogueDTO.getName());
@ -238,6 +277,14 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
return get(params);
}
@Override
public FileUploadDTO get(String token, String fileUploadId) {
Map<String, Object> params = super.getHashMap(2);
params.put("fileUploadId", fileUploadId);
params.put("token", token);
return get(params);
}
@Override
public FileUploadBO getBO(Map<String, Object> params) {
return fileUploadDao.getBO(params);
@ -707,6 +754,55 @@ public class FileUploadServiceImpl extends DefaultBaseService implements IFileUp
return fileUploadDTOList;
}
@Override
public SuccessResultList<List<FileUploadDTO>> shareListPage(ListPage page) {
PageHelper.startPage(page.getPage(), page.getRows());
List<FileUploadDTO> fileUploadDTOs = shareList(page.getParams());
PageInfo<FileUploadDTO> pageInfo = new PageInfo<>(fileUploadDTOs);
return new SuccessResultList<>(fileUploadDTOs, pageInfo.getPageNum(), pageInfo.getTotal());
}
private List<FileUploadDTO> shareList(Map<String, Object> params) {
List<FileUploadDTO> fileUploadDTOList = new ArrayList<>();
UserInfoBO userInfoBO = this.securityComponent.getCurrentUser();
if (null != userInfoBO) {
params.put("creator", userInfoBO.getUserId());
}
String token = null;
if(null != params.get("token")) {
token = params.get("token").toString();
try {
AppTokenUser appTokenUser = securityComponent.getAppTokenUser(token);
if(null != appTokenUser) {
params.put("creator", appTokenUser.getId());
}
}catch (Exception e) {
e.printStackTrace();
}
}
List<FileRoleDTO> fileRoleDTOList = fileRoleDao.list(params);
params.remove("creator");
if(null != fileRoleDTOList && fileRoleDTOList.size() > 0) {
for(FileRoleDTO fileRoleDTO: fileRoleDTOList) {
FileUploadDTO fileUploadDTO = get(fileRoleDTO.getFileUploadId());
if(null != fileUploadDTO) {
UserDTO userDTO = userService.get(fileRoleDTO.getCreator());
if(null != userDTO) {
fileUploadDTO.setShareUserName(userDTO.getUserName());
}
params.put("fileCatalogueId", fileUploadDTO.getFileTypeId());
FileCatalogueDTO fileCatalogueDTO = fileCatalogueService.get(params);
fileUploadDTO.setCatalogueId(fileCatalogueDTO.getFileCatalogueId());
fileUploadDTO.setCatalogueName(fileCatalogueDTO.getName());
fileUploadDTO.setCatalogueType("0".equals(fileCatalogueDTO.getType()) ? "个人文档": "公共文档");
fileUploadDTOList.add(fileUploadDTO);
}
}
}
return fileUploadDTOList;
}
private void toPdf(FileUploadVO fileUploadVO, String fileUploadId) {
Map<String, Object> params = new HashMap<>();
// 生成临时PDF文件

View File

@ -228,7 +228,7 @@ public class TypeRoleServiceImpl extends DefaultBaseService implements ITypeRole
try {
AppTokenUser appTokenUser = securityComponent.getAppTokenUser(token);
if(null != appTokenUser) {
creator = userInfoBO.getUserId();
creator = appTokenUser.getId();
params.put("userId", appTokenUser.getId());
}
}catch (Exception e) {

View File

@ -126,6 +126,9 @@
</if>
<if test="userArchivesId != null and userArchivesId != ''">
user_archives_id = #{userArchivesId},
</if>
<if test="photo == null or photo == ''">
photo = '',
</if>
gmt_modified = #{gmtModified},
modifier = #{modifier},

View File

@ -82,9 +82,33 @@
});
}
function addHoverDom(treeId, treeNode) {
if(1 == type) {
var aObj = $("#" + treeNode.tId + "_a");
if ($("#diyBtn_" + treeNode.id).length > 0) return;
var editStr = "<span id='diyBtn_space_" + treeNode.id + "' > </span>"
+ "<button type='button' class='diyBtn1' id='diyBtn_" + treeNode.id
+ "' title='" + treeNode.name + "' onfocus='this.blur();'>授权</button>";
aObj.append(editStr);
var btn = $("#diyBtn_" + treeNode.id);
if (btn) btn.bind("click", function () {
setRole(treeNode.id, treeNode.typeType);
});
}
};
function removeHoverDom(treeId, treeNode) {
$("#diyBtn_"+treeNode.id).unbind().remove();
$("#diyBtn_space_" +treeNode.id).unbind().remove();
};
// 初始化树
function initThree() {
var setting = {
view: {
addHoverDom: addHoverDom,
removeHoverDom: removeHoverDom
},
async: {
enable: true,
autoLoad: false,
@ -108,10 +132,10 @@
initIFrame(treeLevel);
return false;
},
onRightClick: function(event, treeId, treeNode) {
/*onRightClick: function(event, treeId, treeNode) {
console.log(treeNode)
setRole(treeNode.id, treeNode.typeType);
}
}*/
},
};
var zTree = $.fn.zTree.init($("#leftTree"), setting);

View File

@ -239,6 +239,7 @@
var loadLayerIndex;
formData.field.type = type;
top.restAjax.post(top.restAjax.path('api/filecatalogue/save', []), formData.field, null, function(code, data) {
parent.parent.common.refreshTree('leftTree');
var layerIndex = top.dialog.msg(top.dataMessage.commitSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],

View File

@ -227,6 +227,7 @@
top.dialog.close(index);
var loadLayerIndex;
top.restAjax.put(top.restAjax.path('api/filecatalogue/update/{fileCatalogueId}', [fileCatalogueId]), formData.field, null, function(code, data) {
parent.parent.common.refreshTree('leftTree');
var layerIndex = top.dialog.msg(top.dataMessage.updateSuccess, {
time: 0,
btn: [top.dataMessage.button.yes, top.dataMessage.button.no],

View File

@ -144,7 +144,7 @@
});
}
function fileView(fileId, fileHz) {
/*function fileView(fileId, fileHz) {
var url = getWebRootPath() + "/route/file/download/false/" + fileId;
var previewUrl = url + '&fullfilename=' + fileHz;
@ -155,9 +155,21 @@
area: ['80%', '80%'],
shadeClose: true,
anim: 2,
content: 'http://192.168.0.120:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl)),
content: 'http://121.36.71.250/onlinePreview/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl)),
end: function() {
}
});
}*/
function fileView(fileId, fileHz) {
top.dialog.open({
url: top.restAjax.path('oa/index/onlineFileView/{fileId}', [fileId]),
title: false,
width: '800px',
height: '500px',
onClose: function() {
}
});
}

View File

@ -223,7 +223,7 @@
});
}
function fileView(fileId, fileHz) {
/*function fileView(fileId, fileHz) {
var url = getWebRootPath() + "/route/file/download/false/" + fileId;
var previewUrl = url + '&fullfilename=' + fileHz;
@ -237,6 +237,18 @@
content: 'http://192.168.0.120:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl)),
end: function() {
}
});
}*/
function fileView(fileId, fileHz) {
top.dialog.open({
url: top.restAjax.path('oa/index/onlineFileView/{fileId}', [fileId]),
title: false,
width: '800px',
height: '500px',
onClose: function() {
}
});
}

View File

@ -258,7 +258,7 @@
});
}
function fileView(fileId, fileHz) {
/*function fileView(fileId, fileHz) {
var url = getWebRootPath() + "/route/file/download/false/" + fileId;
var previewUrl = url + '&fullfilename=' + fileHz;
@ -272,6 +272,18 @@
content: 'http://192.168.0.120:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl)),
end: function() {
}
});
}*/
function fileView(fileId, fileHz) {
top.dialog.open({
url: top.restAjax.path('oa/index/onlineFileView/{fileId}', [fileId]),
title: false,
width: '800px',
height: '500px',
onClose: function() {
}
});
}

View File

@ -151,7 +151,7 @@
});
}
function fileView(fileId, fileHz) {
/*function fileView(fileId, fileHz) {
var url = getWebRootPath() + "/route/file/download/false/" + fileId;
var previewUrl = url + '&fullfilename=' + fileHz;
@ -165,6 +165,18 @@
content: 'http://192.168.0.120:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl)),
end: function() {
}
});
}*/
function fileView(fileId, fileHz) {
top.dialog.open({
url: top.restAjax.path('oa/index/onlineFileView/{fileId}', [fileId]),
title: false,
width: '800px',
height: '500px',
onClose: function() {
}
});
}

View File

@ -84,6 +84,7 @@
height: $win.height() - 50,
});
}
// 初始化树
function initThree() {
var setting = {

View File

@ -102,7 +102,7 @@
<div class="layui-form-item">
<label class="layui-form-label">文件说明</label>
<div class="layui-input-block">
<input type="text" id="content" name="content" class="layui-input" value="" placeholder="请输入文件说明" maxlength="255">
<input type="text" lay-verify="required" id="content" name="content" class="layui-input" value="" placeholder="请输入文件说明" maxlength="255">
</div>
</div>
<div class="layui-form-item">

View File

@ -125,7 +125,7 @@
<div class="layui-form-item">
<label class="layui-form-label">文件说明</label>
<div class="layui-input-block">
<input type="text" id="content" name="content" class="layui-input" value="" placeholder="请输入文件说明" maxlength="255">
<input type="text" lay-verify="required" id="content" name="content" class="layui-input" value="" placeholder="请输入文件说明" maxlength="255">
</div>
</div>
<div class="layui-form-item">