提交 751aa2f2 编写于 作者: O o2null

Merge branch 'cherry-pick-dd43249c' into 'develop_java8'

Merge branch 'fix/sole_2' into 'wrdp'

See merge request o2oa/o2oa!4601
......@@ -25,11 +25,12 @@ public class FileTools {
/**
* 创建目录-递归父级
*
* @param dist
* @throws Exception
*/
public static void forceMkdir(File dist) throws Exception {
if(!dist.exists()){
if (!dist.exists()) {
File parent = dist.getParentFile();
forceMkdir(parent);
FileUtils.forceMkdir(dist);
......@@ -38,8 +39,9 @@ public class FileTools {
/**
* 获取文件夹下所有的文件 + 模糊查询(当不需要模糊查询时,queryStr传空或null即可)
*
* @param folderPath 路径
* @param queryStr 模糊查询字符串
* @param queryStr 模糊查询字符串
* @return
*/
public static Map<String, List<FileInfo>> getFiles(String folderPath, String queryStr, String splitPath) {
......@@ -48,23 +50,23 @@ public class FileTools {
List<FileInfo> folders = new ArrayList<>();
File f = new File(folderPath);
if (f.exists()) {
if(!f.isDirectory()){ //路径为文件
String path = f.getAbsolutePath().replaceAll("\\\\","/");
if(StringUtils.isNotEmpty(splitPath) && f.getAbsolutePath().indexOf(splitPath) > -1){
if (!f.isDirectory()) { // 路径为文件
String path = f.getAbsolutePath().replaceAll("\\\\", "/");
if (StringUtils.isNotEmpty(splitPath) && f.getAbsolutePath().indexOf(splitPath) > -1) {
path = StringUtils.substringAfter(path, splitPath);
}
if(StringUtils.isEmpty(queryStr) || f.getName().indexOf(queryStr)!=-1) {
if (StringUtils.isEmpty(queryStr) || f.getName().indexOf(queryStr) != -1) {
files.add(new FileInfo(path, f.getName(), "file", f.lastModified()));
}
}else{ //路径为文件夹
} else { // 路径为文件夹
File fa[] = f.listFiles();
for (int i = 0; i < fa.length; i++) {
File fs = fa[i];
String path = fs.getAbsolutePath().replaceAll("\\\\","/");
if(StringUtils.isNotEmpty(splitPath) && path.indexOf(splitPath) > -1){
String path = fs.getAbsolutePath().replaceAll("\\\\", "/");
if (StringUtils.isNotEmpty(splitPath) && path.indexOf(splitPath) > -1) {
path = StringUtils.substringAfter(path, splitPath);
}
if(StringUtils.isEmpty(queryStr) || fs.getName().indexOf(queryStr)!=-1){
if (StringUtils.isEmpty(queryStr) || fs.getName().indexOf(queryStr) != -1) {
if (fs.isDirectory()) {
folders.add(new FileInfo(path, fs.getName(), "folder", f.lastModified()));
} else {
......@@ -93,9 +95,10 @@ public class FileTools {
private Date lastModifyTime;
public FileInfo(){}
public FileInfo() {
}
public FileInfo(String filePath, String fileName, String fileType, long time){
public FileInfo(String filePath, String fileName, String fileType, long time) {
this.filePath = filePath;
this.fileName = fileName;
this.fileType = fileType;
......@@ -135,4 +138,14 @@ public class FileTools {
}
}
public static String toFileName(String name) {
/*
* windows下文件名中不能含有:\ / : * ? " < > | 英文的这些字符 ,这里使用"."、"'"进行替换。 \/:?| 用.替换 "<>
* 用'替换
*/
name = name.replaceAll("[/\\\\:*?|]", "_");
name = name.replaceAll("[\"<>]", "'");
return name;
}
}
......@@ -4,12 +4,16 @@ import java.nio.charset.StandardCharsets;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoFile;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.FileTools;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
......@@ -25,9 +29,15 @@ class ActionDownload extends BaseAction {
if (!allow(effectivePerson, business, snap)) {
throw new ExceptionAccessDenied(effectivePerson, snap);
}
String name = snap.getProcessName() + "-" + snap.getTitle();
if (null != snap.getStartTime()) {
name += "-" + DateTools.compact(snap.getStartTime());
}
name = FileTools.toFileName(name);
name = StringTools.utf8SubString(name, JpaObject.length_128B);
String text = gson.toJson(snap);
Wo wo = new Wo(text.getBytes(StandardCharsets.UTF_8), this.contentType(false, id),
this.contentDisposition(false, id));
Wo wo = new Wo(text.getBytes(StandardCharsets.UTF_8), this.contentType(false, name),
this.contentDisposition(false, name));
result.setData(wo);
}
return result;
......
package com.x.processplatform.core.entity.content;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
......@@ -108,6 +110,7 @@ public class Snap extends SliceJpaObject {
this.setActivityName(work.getActivityName());
this.setActivityToken(work.getActivityToken());
this.setActivityType(work.getActivityType());
this.setStartTime(work.getStartTime());
}
public Snap(WorkCompleted workCompleted) {
......@@ -122,6 +125,7 @@ public class Snap extends SliceJpaObject {
this.setCreatorIdentity(workCompleted.getCreatorIdentity());
this.setCreatorPerson(workCompleted.getCreatorPerson());
this.setCreatorUnit(workCompleted.getCreatorUnit());
this.setStartTime(workCompleted.getStartTime());
}
public SnapProperties getProperties() {
......@@ -267,8 +271,13 @@ public class Snap extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private String activityToken;
public static final String properties_FIELDNAME = "properties";
@FieldDescribe("流程启动时间.")
public static final String startTime_FIELDNAME = "startTime";
@Column(name = ColumnNamePrefix + startTime_FIELDNAME)
private Date startTime;
@FieldDescribe("属性对象存储字段.")
public static final String properties_FIELDNAME = "properties";
@Persistent
@Strategy(JsonPropertiesValueHandler)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + properties_FIELDNAME)
......@@ -419,4 +428,12 @@ public class Snap extends SliceJpaObject {
this.activityToken = activityToken;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
}
\ No newline at end of file
......@@ -450,9 +450,11 @@ public class ManualProcessor extends AbstractManualProcessor {
// 取得本环节已经处理的已办
List<TaskCompleted> taskCompleteds = this.listJoinInquireTaskCompleted(aeiObjects, identities);
// 存在优先路由,如果有人选择了优先路由那么直接流转.需要判断是否启用了soleDirect
Route soleRoute = aeiObjects.getRoutes().stream()
.filter(r -> BooleanUtils.isTrue(r.getSole()) && BooleanUtils.isTrue(r.getSoleDirect())).findFirst()
.orElse(null);
// Route soleRoute = aeiObjects.getRoutes().stream()
// .filter(r -> BooleanUtils.isTrue(r.getSole()) && BooleanUtils.isTrue(r.getSoleDirect())).findFirst()
// .orElse(null);
Route soleRoute = aeiObjects.getRoutes().stream().filter(r -> BooleanUtils.isTrue(r.getSoleDirect()))
.findFirst().orElse(null);
if (null != soleRoute) {
TaskCompleted soleTaskCompleted = taskCompleteds.stream()
.filter(t -> BooleanUtils.isTrue(t.getJoinInquire())
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册