制度手册编号排序优化
This commit is contained in:
parent
97a27211fd
commit
459f9177c0
@ -39,6 +39,7 @@ import com.actionsoft.bpms.util.DBSql;
|
||||
import com.actionsoft.bpms.util.UtilDate;
|
||||
import com.actionsoft.bpms.util.UtilFile;
|
||||
import com.actionsoft.bpms.util.UtilString;
|
||||
import com.actionsoft.exception.AWSQuotaException;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.actionsoft.sdk.local.api.internal.PlatformAPIImpl;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@ -432,7 +433,7 @@ public class Report1Gener {
|
||||
return null;
|
||||
}
|
||||
|
||||
prReportComment.getCommentContent(dataMap, repositoryModel); //获取一些公共的数据(手册首页的手册岗位名称、部门、时间等)
|
||||
prReportComment.getCommentContent(dataMap, repositoryModel); // 获取一些公共的数据(手册首页的手册岗位名称、部门、时间等)
|
||||
|
||||
JSONArray repositoryShapeTable = new JSONArray(); //流程步骤Table
|
||||
JSONArray fileTable = new JSONArray(); //流程附件Table
|
||||
@ -472,6 +473,7 @@ public class Report1Gener {
|
||||
|
||||
//文件属性附件
|
||||
int fileIndex = 1;
|
||||
ArrayList<String> isNumberAscArray = new ArrayList<String>();
|
||||
if (search != null && search.size() > 0) {
|
||||
// 复制附件
|
||||
for (UpfileModel upfileModel : search) {
|
||||
@ -493,6 +495,27 @@ public class Report1Gener {
|
||||
e.printStackTrace();
|
||||
}
|
||||
JSONObject object = new JSONObject();
|
||||
//按照附件编号排序
|
||||
String fileNamel= upfileModel.getFileName();
|
||||
if(UtilString.isNotEmpty(fileNamel)&&fileNamel.contains("附件")&&fileNamel.length()>2&&(fileNamel.contains(":")||fileNamel.contains(":"))) {
|
||||
if(fileNamel.indexOf("附件")==0) {
|
||||
int indexOf2 = 3;
|
||||
if(fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}else if(fileNamel.contains(":")) {
|
||||
indexOf2 = fileNamel.indexOf(":");
|
||||
}
|
||||
String numberStr = fileNamel.substring(2,indexOf2);
|
||||
if(isNumeric(numberStr)) {
|
||||
isNumberAscArray.add("true");
|
||||
int fileNumber = Integer.parseInt(numberStr);
|
||||
object.put("file_number", fileNumber);
|
||||
}
|
||||
}
|
||||
|
||||
}else {
|
||||
isNumberAscArray.add("false");
|
||||
}
|
||||
object.put("file_name", upfileModel.getFileName());
|
||||
String link = fileName + File.separator + upfileModel.getFileName();
|
||||
object.put("link", link);
|
||||
@ -823,6 +846,16 @@ public class Report1Gener {
|
||||
|
||||
|
||||
dataMap.put(OutputWordUtil.TABLE_REPOSITORY_SHAPE, repositoryShapeTable);
|
||||
boolean contains = isNumberAscArray.contains("false");
|
||||
if(contains) {
|
||||
fileTable.sort(Comparator.comparing(obj -> ((JSONObject) obj).getString("file_name")));
|
||||
}else {
|
||||
try {
|
||||
fileTable.sort(Comparator.comparing(obj -> ((JSONObject) obj).getInteger("file_number")));
|
||||
} catch (Exception e) {
|
||||
throw new AWSQuotaException("附件格式请以:《附件1:XXXXXX》格式命名");
|
||||
}
|
||||
}
|
||||
dataMap.put("file_table", fileTable);
|
||||
dataMap.put("file_table_count", fileTable.size());
|
||||
//dataMap.put("file_table_count", 0);// 暂时置空
|
||||
@ -863,7 +896,14 @@ public class Report1Gener {
|
||||
dataMap.put("listDef", listDef);// 列表编号
|
||||
return dataMap;
|
||||
}
|
||||
|
||||
public static boolean isNumeric(String str) {
|
||||
for (int i = str.length(); --i >= 0;) {
|
||||
int chr = str.charAt(i);
|
||||
if (chr < 48 || chr > 57)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 修订记录
|
||||
* @param repositoryModel
|
||||
|
||||
Loading…
Reference in New Issue
Block a user