fix(87338): 文档拆分--编辑--导入拆分结果,阻塞
This commit is contained in:
+3
-3
@@ -32,14 +32,14 @@ public class SplitFileController {
|
||||
@ResponseBody
|
||||
@GetMapping("/getImage")
|
||||
public void queryPageList(@RequestParam("fileName") String fileName, HttpServletResponse response, HttpServletRequest request) {
|
||||
String fileUrl = "/" + filePathCos + "\\" + fileName;
|
||||
String fileUrl = ("temp\\" + fileName).replace("\\\\", "\\");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=\"" + SplitFileUtils.encodeFileName(fileName, request) + "\"");
|
||||
response.setContentType("application/force-download");
|
||||
// if (MinioUtil.doesObjectExist(fileUrl)) {
|
||||
try (OutputStream os = response.getOutputStream();
|
||||
try (OutputStream os = response.getOutputStream();
|
||||
// InputStream fis = MinioUtil.download(fileUrl)) {
|
||||
InputStream fis = ObsBootUtil.getOssFile(fileUrl)) {
|
||||
InputStream fis = ObsBootUtil.getOssFile(fileUrl)) {
|
||||
int len = 0;
|
||||
while ((len = fis.read()) != -1) {
|
||||
os.write(len);
|
||||
|
||||
@@ -175,8 +175,9 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15to18</artifactId>
|
||||
<version>1.64</version>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>1.56</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
+2
-1
@@ -303,7 +303,8 @@ public class DocumentSplitController {
|
||||
@GetMapping("/queryItemsValList")
|
||||
@ApiOperationSupport(order = 12)
|
||||
public Result<List<SarFileSplitItemsValEO>> queryItemsValList(String id) {
|
||||
return Result.OK(documentSplitService.queryItemsValList(id));
|
||||
List<SarFileSplitItemsValEO> data = documentSplitService.queryItemsValList(id);
|
||||
return Result.OK(data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-2
@@ -969,8 +969,7 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
|
||||
for (SarFileSplitItemsValEO sarFileSplitItemsValEO : sarFileSplitItemsValEOS) {
|
||||
String imgPath = sarFileSplitItemsValEO.getItemContent();
|
||||
if (DocumentSplitCommon.IMG.equals(sarFileSplitItemsValEO.getType()) && org.apache.commons.lang.StringUtils.isNotEmpty(imgPath)) {
|
||||
String imgName = imgPath.substring(imgPath.lastIndexOf("/") + 1);
|
||||
sarFileSplitItemsValEO.setImgName(imgName);
|
||||
sarFileSplitItemsValEO.setImgName(imgPath);
|
||||
}
|
||||
if (DocumentSplitCommon.TEXT.equals(sarFileSplitItemsValEO.getType()) && org.apache.commons.lang.StringUtils.isNotEmpty(imgPath)){
|
||||
sarFileSplitItemsValEO.setItemContent(HtmlUtils.htmlUnescape(sarFileSplitItemsValEO.getItemContent()));
|
||||
|
||||
+10
@@ -2,7 +2,9 @@ package com.jero.modules.split.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.util.MessageUtils;
|
||||
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.mapper.SarFileSplitMenuEOMapper;
|
||||
@@ -66,6 +68,14 @@ public class SarFileSplitMenuEOController extends JeroController<SarFileSplitMen
|
||||
return Result.OK("修改成功",sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "标准拆分条款目录-修改层级")
|
||||
@GetMapping("/updateMenuLevel")
|
||||
// @RequiresPermissions("split:sarFileSplitMenu:updateMenuLevel")
|
||||
public Result<SarFileSplitMenuEO> updateMenuLevel(String id, String parentId) {
|
||||
sarFileSplitMenuEOService.updateMenuLevel(id, parentId);
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "标准拆分条款目录-向上或向下移动")
|
||||
@PostMapping("/moveUpOrDown")
|
||||
@RequiresPermissions(value = {"split:sarFileSplitMenu:moveUp","split:sarFileSplitMenu:moveDown"}, logical = Logical.OR)
|
||||
|
||||
@@ -25,6 +25,8 @@ public interface SarFileSplitMenuEOMapper extends BaseMapper<SarFileSplitMenuEO>
|
||||
|
||||
int updateDisplaySeqCut(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByPidAndSelf(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByPidExcpetSelf(SarFileSplitMenuEO sarFileSplitMenuEO);
|
||||
|
||||
int deleteByPId(@Param("idList") List<String> idList);
|
||||
@@ -71,4 +73,10 @@ public interface SarFileSplitMenuEOMapper extends BaseMapper<SarFileSplitMenuEO>
|
||||
List<SarFileSplitMenuEO> selectBatchIds(@Param("idList") List<String> idList);
|
||||
|
||||
SarFileSplitMenuEO findById(String id);
|
||||
|
||||
SarFileSplitMenuEO findLastByParentId(String parentId);
|
||||
|
||||
List<SarFileSplitMenuEO> queryByGTDisplaySeq(@Param("infoId") String infoId, @Param("displaySeq") Long displaySeq);
|
||||
|
||||
List<SarFileSplitMenuEO> findByParentId(String pId);
|
||||
}
|
||||
|
||||
+27
-1
@@ -178,7 +178,7 @@
|
||||
|
||||
<!-- 根据id查询 SAR_FILE_SPLIT_MENU -->
|
||||
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.String">
|
||||
select <include refid="Base_Column_List" />
|
||||
select <include refid="Base_Column_List" />
|
||||
from SAR_FILE_SPLIT_MENU
|
||||
where id = #{value}
|
||||
|
||||
@@ -260,6 +260,14 @@
|
||||
where display_seq <= #{displaySeqEnd} and display_seq > #{displaySeqStart} and valid_flag = 0 and info_id = #{infoId}
|
||||
</update>
|
||||
|
||||
<select id="queryByPidAndSelf" resultMap="BaseResultMap">
|
||||
select m.*
|
||||
from SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
WHERE
|
||||
FIND_IN_SET( m.id, t.pids )
|
||||
AND valid_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="queryByPidExcpetSelf" resultMap="BaseResultMap" parameterType="com.jero.modules.split.entity.SarFileSplitMenuEO">
|
||||
select m.*
|
||||
from SAR_FILE_SPLIT_MENU m,( SELECT ( @nodes := querySplitMenuChildren (#{id})) AS pids ) t
|
||||
@@ -360,4 +368,22 @@
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="findLastByParentId" resultMap="BaseResultMap">
|
||||
select * from SAR_FILE_SPLIT_MENU
|
||||
where parent_id = #{parentId} AND valid_flag = '0'
|
||||
order by display_seq desc
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<select id="queryByGTDisplaySeq" resultMap="BaseResultMap">
|
||||
select * from SAR_FILE_SPLIT_MENU
|
||||
where display_seq > #{displaySeq} and info_id = #{infoId}
|
||||
AND valid_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="findByParentId" resultMap="BaseResultMap">
|
||||
select * from SAR_FILE_SPLIT_MENU
|
||||
where parent_id = #{parentId} AND valid_flag = '0'
|
||||
order by display_seq asc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+2
@@ -57,4 +57,6 @@ public interface ISarFileSplitMenuEOService extends IService<SarFileSplitMenuEO>
|
||||
List<SarFileSplitMenuEO> queryByInfoId(String infoId);
|
||||
|
||||
Result moveUpOrDown(JSONObject json);
|
||||
|
||||
void updateMenuLevel(String id, String parentId);
|
||||
}
|
||||
|
||||
+32
-32
@@ -2,6 +2,8 @@ package com.jero.modules.split.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.RegexPool;
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
import cn.hutool.http.Header;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
@@ -39,6 +41,8 @@ import org.openxmlformats.schemas.drawingml.x2006.main.CTGraphicalObject;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.picture.CTPicture;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTAnchor;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.math.CTOMath;
|
||||
import org.openxmlformats.schemas.officeDocument.x2006.math.CTOMathPara;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDrawing;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTLevelText;
|
||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR;
|
||||
@@ -218,34 +222,34 @@ public class FileSpiltService {
|
||||
// //处理段落中的文本以及图片
|
||||
// handleParagraphRun(content, (XWPFRun) child, imageParser);
|
||||
//} else
|
||||
// if (child instanceof CTOMath) {
|
||||
// CTOMath ctoMath = (CTOMath) child;
|
||||
// String xmlText = ctoMath.xmlText().replaceAll("xml-fragment","m:oMath");
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("encode", xmlText);
|
||||
// String post = HttpRequest.post(mathToImgUrl)
|
||||
// .header(Header.CONTENT_TYPE, "application/json")
|
||||
// .body(xmlText)
|
||||
// .execute().body();
|
||||
// //String post = HttpUtil.post(mathToImgUrl, map);
|
||||
// if (messageList.size() > 0) {
|
||||
// addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
|
||||
// }
|
||||
// }
|
||||
// else if (child instanceof CTOMathPara) {
|
||||
// CTOMathPara ctoMathPara = (CTOMathPara) child;
|
||||
// String xmlText = ctoMathPara.xmlText().replaceAll("xml-fragment","m:oMath");;
|
||||
// Map<String,Object> map = new HashMap<>();
|
||||
// map.put("encode",xmlText);
|
||||
// String post = HttpRequest.post(mathToImgUrl)
|
||||
// .header(Header.CONTENT_TYPE, "application/json")
|
||||
// .body(xmlText)
|
||||
// .execute().body();
|
||||
// //String post = HttpUtil.post(mathToImgUrl, map);
|
||||
// if (messageList.size() > 0) {
|
||||
// addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
|
||||
// }
|
||||
// }
|
||||
if (child instanceof CTOMath) {
|
||||
CTOMath ctoMath = (CTOMath) child;
|
||||
String xmlText = ctoMath.xmlText().replaceAll("xml-fragment","m:oMath");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("encode", xmlText);
|
||||
String post = HttpRequest.post(mathToImgUrl)
|
||||
.header(Header.CONTENT_TYPE, "application/json")
|
||||
.body(xmlText)
|
||||
.execute().body();
|
||||
//String post = HttpUtil.post(mathToImgUrl, map);
|
||||
if (messageList.size() > 0) {
|
||||
addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
|
||||
}
|
||||
}
|
||||
else if (child instanceof CTOMathPara) {
|
||||
CTOMathPara ctoMathPara = (CTOMathPara) child;
|
||||
String xmlText = ctoMathPara.xmlText().replaceAll("xml-fragment","m:oMath");;
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("encode",xmlText);
|
||||
String post = HttpRequest.post(mathToImgUrl)
|
||||
.header(Header.CONTENT_TYPE, "application/json")
|
||||
.body(xmlText)
|
||||
.execute().body();
|
||||
//String post = HttpUtil.post(mathToImgUrl, map);
|
||||
if (messageList.size() > 0) {
|
||||
addItermsMathImage(messageList.get(messageList.size() - 1), itemValList, post);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (XWPFRun xwrun : p.getRuns()) {
|
||||
@@ -1040,10 +1044,6 @@ public class FileSpiltService {
|
||||
return startDigitList;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
getOneStartDigit("Scope", SplitFileTypeTypeEnum.UN);
|
||||
}
|
||||
|
||||
public static String getOneStartDigit(String arr, SplitFileTypeTypeEnum enumByValue) {
|
||||
//\p{Punct} 标点符号:!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~
|
||||
//\p{Space} 空白字符:[ \t\n\x0B\f\r]
|
||||
|
||||
+205
-39
@@ -24,6 +24,7 @@ import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServi
|
||||
import com.jero.modules.document.enums.FieldTypeEnum;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.laws.common.mapper.LawsCommonMapper;
|
||||
import com.jero.modules.laws.documenttool.common.DirectoryComparator;
|
||||
import com.jero.modules.laws.documenttool.mapper.DocumentSplitMapper;
|
||||
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
|
||||
import com.jero.modules.laws.labeldatabase.entity.LawsLabelDatabase;
|
||||
@@ -94,6 +95,7 @@ import sun.misc.BASE64Decoder;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
@@ -1468,20 +1470,37 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// if (fileTypeStr.contains(fileSuffix)) {
|
||||
// state = "1";
|
||||
// }
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
if(oSSFile!=null){
|
||||
// OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
// if(oSSFile!=null){
|
||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
isText = false;
|
||||
|
||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
String path = oSSFile.getUrl();
|
||||
// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
valEO.setType("IMG");
|
||||
// valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(path);
|
||||
}
|
||||
//// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
//// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
// String path = oSSFile.getUrl();
|
||||
//// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
//// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
// valEO.setType("IMG");
|
||||
//// valEO.setItemContent(imgCon);
|
||||
// valEO.setItemContent(path);
|
||||
//
|
||||
// String imageName = UUIDUtils.randomUUID10() + multipartFile.getName();
|
||||
// String filepathandname = uploadCospath + "/" + imageName;
|
||||
try {
|
||||
// String paths = splitUrl+imageName;
|
||||
// MinioUtil.uploadByte(bytev, filepathandname);
|
||||
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||
ossFile.setFileName(multipartFile.getName());
|
||||
ossFile.setUrl(upload);
|
||||
ossFileService.save(ossFile);
|
||||
valEO.setType("IMG");
|
||||
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// }
|
||||
}
|
||||
if (isText) {
|
||||
valEO.setType("TEXT");
|
||||
@@ -1518,20 +1537,34 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// state = "1";
|
||||
// }
|
||||
// OSSFile oSSFile = ossFileService.uploadLocalOfCos(multipartFile, "", state,null);
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
// OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
if (oSSFile != null) {
|
||||
// if (oSSFile != null) {
|
||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
isText = false;
|
||||
|
||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
String path = oSSFile.getUrl();
|
||||
// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
//// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
//// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
// String path = oSSFile.getUrl();
|
||||
//// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
//// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
// valEO.setType("IMG");
|
||||
//// valEO.setItemContent(imgCon);
|
||||
// valEO.setItemContent(path);
|
||||
// }
|
||||
try {
|
||||
// String paths = splitUrl+imageName;
|
||||
// MinioUtil.uploadByte(bytev, filepathandname);
|
||||
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||
ossFile.setFileName(multipartFile.getName());
|
||||
ossFile.setUrl(upload);
|
||||
ossFileService.save(ossFile);
|
||||
valEO.setType("IMG");
|
||||
// valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(path);
|
||||
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -1567,19 +1600,33 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
MultipartFile multipartFile = createMfileByPath(url);
|
||||
String state = "0";
|
||||
// OSSFile oSSFile = ossFileService.uploadLocalOfCos(multipartFile, "", state,null);
|
||||
OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
if (oSSFile != null) {
|
||||
// OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
||||
//// oSSFile = ossFileService.getById(oSSFile.getId());
|
||||
// if (oSSFile != null) {
|
||||
isText = false;
|
||||
|
||||
// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
String path = oSSFile.getUrl();
|
||||
// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
//// BASE64Encoder base64Encoder = new BASE64Encoder();
|
||||
//// String encode = base64Encoder.encode(oSSFile.getUrl().getBytes(StandardCharsets.UTF_8));
|
||||
// String path = oSSFile.getUrl();
|
||||
//// String path = imgpath + oSSFile.getUrl().substring(oSSFile.getUrl().lastIndexOf(File.separator)+1);
|
||||
//// String imgCon = "<img class=\"wordImg\" src=\"" + path + "\">";
|
||||
// valEO.setType("IMG");
|
||||
//// valEO.setItemContent(imgCon);
|
||||
// valEO.setItemContent(path);
|
||||
// }
|
||||
try {
|
||||
// String paths = splitUrl+imageName;
|
||||
// MinioUtil.uploadByte(bytev, filepathandname);
|
||||
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||
ossFile.setFileName(multipartFile.getName());
|
||||
ossFile.setUrl(upload);
|
||||
ossFileService.save(ossFile);
|
||||
valEO.setType("IMG");
|
||||
// valEO.setItemContent(imgCon);
|
||||
valEO.setItemContent(path);
|
||||
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (isText) {
|
||||
@@ -2080,11 +2127,22 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
continue;
|
||||
}
|
||||
String cellValue = null;
|
||||
|
||||
if (!(CellType.NUMERIC == cell.getCellType() && HSSFDateUtil.isCellDateFormatted(cell))) {
|
||||
//设置单元格类型
|
||||
if (y == 0){
|
||||
// 条文号精度丢失问题
|
||||
try {
|
||||
double numericCellValue = cell.getNumericCellValue();
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(numericCellValue);
|
||||
String str = String.valueOf(bigDecimal);
|
||||
if (str.endsWith(".0")){
|
||||
str = str.substring(0, str.length() - 2);
|
||||
}
|
||||
cell.setCellValue(str);
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
cell.setCellType(CellType.STRING);
|
||||
|
||||
}
|
||||
boolean isMerge = isMergedRegion(sheet, row.getRowNum(), cell.getColumnIndex());
|
||||
//判断是否具有合并单元格
|
||||
@@ -2097,7 +2155,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// 进行格式转换
|
||||
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
||||
cellValue = df.format(d);
|
||||
} else {
|
||||
}else {
|
||||
cellValue = cell.getStringCellValue();
|
||||
}
|
||||
}
|
||||
@@ -2729,8 +2787,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
String[] treePathList = value.split(",");
|
||||
for (String treePath : treePathList) {
|
||||
List<SysDictItem> path =
|
||||
sysDictItemList.stream().filter(o -> treePath.equals(o.getLevelPath())
|
||||
|| treePath.equals(o.getItemText()))
|
||||
sysDictItemList.stream().filter(o -> treePath.equals(o.getLevelPath()))
|
||||
.collect(Collectors.toList());
|
||||
if (!path.isEmpty()){
|
||||
if (path.size() > 1) {
|
||||
@@ -2934,6 +2991,13 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
insertInfo2(finalSarFileSplitItemsEO,id,"import"); // 添加条款
|
||||
}
|
||||
|
||||
/**
|
||||
* 外部标准用
|
||||
* @param addItemsEOList
|
||||
* @param treeListDisplay
|
||||
* @param menuId
|
||||
* @return
|
||||
*/
|
||||
private List<SarFileSplitMenuTreeNode> buildTree(List<Map<String, Object>> addItemsEOList, Long treeListDisplay, String menuId){
|
||||
//排序
|
||||
Collections.sort(addItemsEOList, new Comparator<Map<String, Object>>() {
|
||||
@@ -2948,10 +3012,105 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
for (Map<String, Object> itemEO : addItemsEOList) {
|
||||
String itemNum = itemEO.get("item_num").toString();
|
||||
// if(itemNum.matches(regex) || itemNum.contains("附录")) { // TODO 解除条款号格式限制
|
||||
SarFileSplitMenuTreeNode treeNode = new SarFileSplitMenuTreeNode();
|
||||
treeNode.setId(UUIDUtils.randomUUID20());
|
||||
treeNode.setName(itemNum);
|
||||
if(itemNum.matches(regex)) {
|
||||
//父级是 总目录时,不做处理
|
||||
if(itemNum.contains(".")) {
|
||||
String parentName = itemNum.substring(0, itemNum.lastIndexOf("."));
|
||||
treeNode.setParentName(parentName);
|
||||
List<SarFileSplitMenuTreeNode> p = treeNodeList.stream().filter(e -> e.getName().equals(parentName)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(p)) {
|
||||
//其他节点
|
||||
treeNode.setParentId(p.get(0).getId());
|
||||
}else{
|
||||
//一级节点
|
||||
treeNode.setParentId(menuId);
|
||||
}
|
||||
}else{
|
||||
treeNode.setParentId(menuId);
|
||||
}
|
||||
}else{
|
||||
treeNode.setParentId(menuId);
|
||||
}
|
||||
++treeListDisplay;
|
||||
treeNode.setOrderNum(treeListDisplay);
|
||||
treeNode.setItemName(itemEO.get("item_title").toString());
|
||||
treeNode.setItemId(itemEO.get("id").toString());
|
||||
treeNodeList.add(treeNode);
|
||||
// }
|
||||
}
|
||||
//其他节点
|
||||
/*for (SarFileSplitItemsEO itemEO : addItemsEOList) {
|
||||
String itemNum = itemEO.getItemsNum();
|
||||
if (itemNum.matches(regex)) {
|
||||
SarFileSplitMenuTreeNode treeNode = new SarFileSplitMenuTreeNode();
|
||||
String parentName = itemNum.substring(0, itemNum.lastIndexOf("."));
|
||||
List<SarFileSplitMenuTreeNode> p = treeNodeList.stream().filter(e -> e.getName().equals(parentName)).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(p)) {
|
||||
treeNode.setParentId(p.get(0).getId());
|
||||
}
|
||||
treeNode.setId(UUIDUtils.randomUUID20());
|
||||
treeNode.setName(itemNum);
|
||||
if(itemNum.matches(regex)) {
|
||||
treeNode.setParentName(parentName);
|
||||
//判断格式
|
||||
if (itemNum.lastIndexOf(".") + 1 < itemNum.length()) {
|
||||
// treeNode.setOrderNum(Long.valueOf(itemNum.substring(itemNum.lastIndexOf(".") + 1, itemNum.length())));
|
||||
treeNode.setOrderNum(p.get(0).getOrderNum() + Long.valueOf(itemNum.substring(itemNum.lastIndexOf(".") + 1, itemNum.length())));
|
||||
}
|
||||
|
||||
treeNode.setItemName(itemEO.getItemsName());
|
||||
treeNode.setItemId(itemEO.getId());
|
||||
treeNodeList.add(treeNode);
|
||||
}
|
||||
}*/
|
||||
|
||||
return treeNodeList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 欧标用
|
||||
* @param addItemsEOList
|
||||
* @param treeListDisplay
|
||||
* @param menuId
|
||||
* @return
|
||||
*/
|
||||
|
||||
private List<SarFileSplitMenuTreeNode> buildTree2(List<Map<String, Object>> addItemsEOList, Long treeListDisplay, String menuId){
|
||||
// 过滤出 非正常编号的数据
|
||||
String regexs = "^[0-9]{0}([0-9]|[.])+$";
|
||||
List<Map<String, Object>> otherList =
|
||||
addItemsEOList.stream()
|
||||
.filter(v -> !String.valueOf(v.get("item_num")).matches(regexs))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
otherList.stream().map(v -> v.get("item_num"))
|
||||
.collect(Collectors.toList()).forEach(v -> {
|
||||
System.out.println(v);
|
||||
});
|
||||
|
||||
// 排序
|
||||
addItemsEOList.removeAll(otherList);
|
||||
addItemsEOList.sort(new DirectoryComparator());
|
||||
addItemsEOList.addAll(otherList);
|
||||
|
||||
|
||||
List<SarFileSplitMenuTreeNode> treeNodeList = new ArrayList<>();
|
||||
List<String> dotList = new ArrayList<>();
|
||||
String regex = "^[0-9]{0}([0-9]|[.])+$"; //TODO 待优化:数字和点必须交替
|
||||
for (Map<String, Object> itemEO : addItemsEOList) {
|
||||
String itemNum = itemEO.get("item_num").toString();
|
||||
// if(itemNum.matches(regex) || itemNum.contains("附录")) { // TODO 解除条款号格式限制
|
||||
SarFileSplitMenuTreeNode treeNode = new SarFileSplitMenuTreeNode();
|
||||
treeNode.setId(UUIDUtils.randomUUID20());
|
||||
if (itemNum.endsWith(".")){
|
||||
// 处理末尾为小数点的数据
|
||||
itemNum = itemNum.substring(0, itemNum.length() - 1);
|
||||
dotList.add(treeNode.getId());
|
||||
}
|
||||
treeNode.setName(itemNum);
|
||||
// if(itemNum.matches(regex)) {
|
||||
//父级是 总目录时,不做处理
|
||||
if(itemNum.contains(".")) {
|
||||
String parentName = itemNum.substring(0, itemNum.lastIndexOf("."));
|
||||
@@ -2967,9 +3126,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}else{
|
||||
treeNode.setParentId(menuId);
|
||||
}
|
||||
}else{
|
||||
treeNode.setParentId(menuId);
|
||||
}
|
||||
// }else{
|
||||
// treeNode.setParentId(menuId);
|
||||
// }
|
||||
++treeListDisplay;
|
||||
treeNode.setOrderNum(treeListDisplay);
|
||||
treeNode.setItemName(itemEO.get("item_title").toString());
|
||||
@@ -2977,6 +3136,13 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
treeNodeList.add(treeNode);
|
||||
// }
|
||||
}
|
||||
|
||||
// 补回小数点
|
||||
for (SarFileSplitMenuTreeNode sarFileSplitMenuTreeNode : treeNodeList) {
|
||||
if (dotList.contains(sarFileSplitMenuTreeNode.getId())) {
|
||||
sarFileSplitMenuTreeNode.setName(sarFileSplitMenuTreeNode.getName() + ".");
|
||||
}
|
||||
}
|
||||
//其他节点
|
||||
/*for (SarFileSplitItemsEO itemEO : addItemsEOList) {
|
||||
String itemNum = itemEO.getItemsNum();
|
||||
|
||||
+56
@@ -370,4 +370,60 @@ public class SarFileSplitMenuEOServiceImpl extends ServiceImpl<SarFileSplitMenuE
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMenuLevel(String id, String parentId) {
|
||||
// 获取要移动到的层级的最后一个 的排序值
|
||||
SarFileSplitMenuEO lastMenu = getLastMenu(parentId);
|
||||
|
||||
// 查询当前节点和当前节点所有子集
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO1 = baseMapper.findById(id);
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEO1List = new ArrayList<>();
|
||||
sarFileSplitMenuEO1List.add(sarFileSplitMenuEO1);
|
||||
List<SarFileSplitMenuEO> allList = new ArrayList<>();
|
||||
getChildren(allList, sarFileSplitMenuEO1List);
|
||||
|
||||
// 获取要移动节点的数量
|
||||
int childCount = allList.size();
|
||||
|
||||
// 更新下节点排序
|
||||
SarFileSplitMenuEO parentSarFileSplitMenu = baseMapper.findById(parentId);
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEOList =
|
||||
baseMapper.queryByGTDisplaySeq(parentSarFileSplitMenu.getInfoId(), lastMenu.getDisplaySeq());
|
||||
for (SarFileSplitMenuEO fileSplitMenuEO : sarFileSplitMenuEOList) {
|
||||
// 更新排序
|
||||
fileSplitMenuEO.setDisplaySeq(fileSplitMenuEO.getDisplaySeq() + childCount);
|
||||
baseMapper.updateByPrimaryKeySelective(fileSplitMenuEO);
|
||||
}
|
||||
|
||||
// 更新要移动节点的排序
|
||||
for (int i = 0; i <allList.size(); i++) {
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO2 = allList.get(i);
|
||||
sarFileSplitMenuEO2.setDisplaySeq(lastMenu.getDisplaySeq() + i + 1);
|
||||
baseMapper.updateByPrimaryKeySelective(sarFileSplitMenuEO2);
|
||||
}
|
||||
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO = new SarFileSplitMenuEO();
|
||||
sarFileSplitMenuEO.setId(id);
|
||||
sarFileSplitMenuEO.setPId(parentId);
|
||||
baseMapper.updateByPrimaryKeySelective(sarFileSplitMenuEO);
|
||||
}
|
||||
|
||||
private void getChildren(List<SarFileSplitMenuEO> allList, List<SarFileSplitMenuEO> sarFileSplitMenuEOList) {
|
||||
for (SarFileSplitMenuEO sarFileSplitMenuEO : sarFileSplitMenuEOList) {
|
||||
allList.add(sarFileSplitMenuEO);
|
||||
List<SarFileSplitMenuEO> childrenList = baseMapper.findByParentId(sarFileSplitMenuEO.getId());
|
||||
if (CollectionUtils.isNotEmpty(childrenList)){
|
||||
getChildren(allList, childrenList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SarFileSplitMenuEO getLastMenu(String parentId) {
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO1 = baseMapper.findLastByParentId(parentId);
|
||||
if(sarFileSplitMenuEO1 != null){
|
||||
getLastMenu(sarFileSplitMenuEO1.getId());
|
||||
}
|
||||
return sarFileSplitMenuEO1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user