|
@@ -3,6 +3,7 @@ package com.jeeplus.business.program.configuration.projectDict.service;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.extra.spring.SpringUtil;
|
|
|
+import com.aliyun.oss.OSSClient;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.jeeplus.business.program.configuration.fileDict.domain.ProgramFileDict;
|
|
@@ -24,6 +25,7 @@ import com.jeeplus.sys.service.dto.UserDTO;
|
|
|
import com.jeeplus.sys.service.dto.WorkAttachmentInfoDTO;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -170,7 +172,7 @@ public class ProjectDictService {
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<FileDictVo> getFileDictList(ProjectDictDto projectDictDto, String id, String projectId) {
|
|
|
+ public List<FileDictVo> getFileDictList(ProjectDictDto projectDictDto, String projectId, String id) {
|
|
|
//获取当前登陆人信息
|
|
|
UserDTO userDTO = SpringUtil.getBean(IUserApi.class).getByToken(TokenProvider.getCurrentToken());
|
|
|
List<FileDictVo> list = new ArrayList<>();
|
|
@@ -188,31 +190,32 @@ public class ProjectDictService {
|
|
|
List<WorkAttachmentInfoDTO> fileList = Lists.newArrayList();
|
|
|
String stage="";
|
|
|
//获取当前项目处于哪个阶段
|
|
|
- JyProject jyProject = jyProjectMapper.getById(id);
|
|
|
+ JyProject jyProject = jyProjectMapper.getById(projectId);
|
|
|
//获取当前节点审核人
|
|
|
List<String> users = SpringUtil.getBean(IFlowableApi.class).getTaskAuditUsers(jyProject.getTaskIdEia());
|
|
|
|
|
|
if (StringUtils.isNotBlank(jyProject.getOutInstanceId()) || StringUtils.isNotBlank(jyProject.getArchiveId()) || StringUtils.isNotBlank(jyProject.getEiaId())){
|
|
|
//设置必填项
|
|
|
//外审
|
|
|
- if (jyProject.getOutInstanceId().equals(projectId)){
|
|
|
+ if (jyProject.getOutInstanceId().equals(id)){
|
|
|
stage="2";
|
|
|
}
|
|
|
//如果是环评项目,则需要在设置审核阶段的必填项
|
|
|
- if (jyProject.getEiaId().equals(projectId)){
|
|
|
+ if (jyProject.getEiaId().equals(id)){
|
|
|
stage="1";
|
|
|
//判断当前登录人是否是节点审核人
|
|
|
if (ObjectUtil.isNotEmpty(users)){
|
|
|
for (String user : users) {
|
|
|
- if (user.equals(userDTO.getId())){
|
|
|
- stage= "4";
|
|
|
+ if (user.equals(userDTO.getId())) {
|
|
|
+ stage = "4";
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//归档
|
|
|
- if (jyProject.getArchiveId().equals(projectId)){
|
|
|
+ if (jyProject.getArchiveId().equals(id)){
|
|
|
stage="3";
|
|
|
}
|
|
|
}
|
|
@@ -230,7 +233,6 @@ public class ProjectDictService {
|
|
|
List<WorkAttachmentInfoDTO> files = jyProjectOutinstanceMapper.getFileListByAttachmentAndModuleType(dictVo.getId(), projectId);
|
|
|
if (CollectionUtils.isNotEmpty(files)) {
|
|
|
fileList.addAll(files);
|
|
|
- continue;
|
|
|
}
|
|
|
}else{
|
|
|
dictVo.setLevelFlag(1);
|
|
@@ -247,6 +249,7 @@ public class ProjectDictService {
|
|
|
info.setFileSize(workAttachmentInfoDTO.getFileSize());
|
|
|
info.setCreateDate(workAttachmentInfoDTO.getCreateTime());
|
|
|
info.setUrl(workAttachmentInfoDTO.getUrl());
|
|
|
+ info.setLsUrl(getFileTemporaryLookUrl(aliyunUrl + workAttachmentInfoDTO.getUrl()));
|
|
|
//此处为子集菜单,需根据项目id和附件类型id查询对应附件信息
|
|
|
info.setLevelFlag(3);
|
|
|
list.add(info);
|
|
@@ -256,4 +259,51 @@ public class ProjectDictService {
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ @Value("${config.accessory.aliyun.aliyunUrl}")
|
|
|
+ private String aliyunUrl;
|
|
|
+
|
|
|
+ @Value("${config.accessory.aliyun.aliyunDownloadUrl}")
|
|
|
+ private String aliyunDownloadUrl;
|
|
|
+
|
|
|
+ @Value("${config.accessory.aliyun.endpoint}")
|
|
|
+ private String endpoint;
|
|
|
+
|
|
|
+ @Value("${config.accessory.aliyun.accessKeyId}")
|
|
|
+ private String accessKeyId;
|
|
|
+
|
|
|
+ @Value("${config.accessory.aliyun.accessKeySecret}")
|
|
|
+ private String accessKeySecret;
|
|
|
+
|
|
|
+ @Value("${config.accessory.aliyun.bucketName}")
|
|
|
+ private String bucketName;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 阿里云获取临时文件查看url
|
|
|
+ * @param url
|
|
|
+ */
|
|
|
+ public String getFileTemporaryLookUrl(String url){
|
|
|
+ url = url.replace("amp;","");
|
|
|
+ String cons = "";
|
|
|
+ if (url.contains(aliyunUrl)){
|
|
|
+ cons = aliyunUrl;
|
|
|
+ }else if (url.contains("http://gangwan-app.oss-cn-hangzhou.aliyuncs.com")){
|
|
|
+ cons = "http://gangwan-app.oss-cn-hangzhou.aliyuncs.com";
|
|
|
+ }else {
|
|
|
+ cons = aliyunDownloadUrl;
|
|
|
+ }
|
|
|
+ String key = "";
|
|
|
+ String[] split = url.split(cons + "/");
|
|
|
+ if(split.length>1){
|
|
|
+ key = split[1];
|
|
|
+ }else{
|
|
|
+ key = url;
|
|
|
+ }
|
|
|
+ // 指定过期时间为24小时。
|
|
|
+ Date expiration = new Date(new Date().getTime() + 1000 * 60 * 60 * 24 );
|
|
|
+ //初始化OSSClient
|
|
|
+ OSSClient ossClient = new OSSClient(endpoint,accessKeyId,accessKeySecret);
|
|
|
+ return ossClient.generatePresignedUrl(bucketName, key, expiration).toString();
|
|
|
+ }
|
|
|
}
|