add 文档拆分增加译文
This commit is contained in:
+5
@@ -40,6 +40,11 @@ public class SarFileSplitItemsVal implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("条目内容")
|
@ApiModelProperty("条目内容")
|
||||||
private String itemContent;
|
private String itemContent;
|
||||||
|
/**
|
||||||
|
* 译文
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("译文")
|
||||||
|
private String translation;
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
|
|||||||
+5
-5
@@ -40,10 +40,10 @@
|
|||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertSarFileSplitItemsVal">
|
<insert id="insertSarFileSplitItemsVal">
|
||||||
insert into sar_file_split_items_val(id, sys_org_code, item_id, type, item_content, display_seq, valid_flag, img_name, index_item, creation_time, modify_user, modify_time, creation_user)
|
insert into sar_file_split_items_val(id, sys_org_code, item_id, type, item_content, translation, display_seq, valid_flag, img_name, index_item, creation_time, modify_user, modify_time, creation_user)
|
||||||
values
|
values
|
||||||
<foreach collection="entities" item="entity" separator=",">
|
<foreach collection="entities" item="entity" separator=",">
|
||||||
(#{entity.id}, #{entity.sysOrgCode}, #{entity.itemId}, #{entity.type}, #{entity.itemContent}, #{entity.displaySeq}, #{entity.validFlag}, #{entity.imgName}, #{entity.indexItem}, #{entity.creationTime}, #{entity.modifyUser}, #{entity.modifyTime}, #{entity.creationUser})
|
(#{entity.id}, #{entity.sysOrgCode}, #{entity.itemId}, #{entity.type}, #{entity.itemContent}, #{entity.translation}, #{entity.displaySeq}, #{entity.validFlag}, #{entity.imgName}, #{entity.indexItem}, #{entity.creationTime}, #{entity.modifyUser}, #{entity.modifyTime}, #{entity.creationUser})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryItemsValByItemIds" resultType="com.jero.modules.split.entity.SarFileSplitItemsValEO">
|
<select id="queryItemsValByItemIds" resultType="com.jero.modules.split.entity.SarFileSplitItemsValEO">
|
||||||
select id, type, item_id, item_content, valid_flag, creation_user,
|
select id, type, item_id, item_content, translation, valid_flag, creation_user,
|
||||||
creation_time, modify_time, modify_user, display_seq,img_name,index_item
|
creation_time, modify_time, modify_user, display_seq,img_name,index_item
|
||||||
from SAR_FILE_SPLIT_ITEMS_VAL
|
from SAR_FILE_SPLIT_ITEMS_VAL
|
||||||
where valid_flag = '0' and ITEM_ID in
|
where valid_flag = '0' and ITEM_ID in
|
||||||
@@ -150,7 +150,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="queryItemsValByItemId" resultType="com.jero.modules.split.entity.SarFileSplitItemsValEO">
|
<select id="queryItemsValByItemId" resultType="com.jero.modules.split.entity.SarFileSplitItemsValEO">
|
||||||
select id, type, item_id, item_content, valid_flag, creation_user,
|
select id, type, item_id, item_content, translation, valid_flag, creation_user,
|
||||||
creation_time, modify_time, modify_user, display_seq,img_name,index_item
|
creation_time, modify_time, modify_user, display_seq,img_name,index_item
|
||||||
from SAR_FILE_SPLIT_ITEMS_VAL
|
from SAR_FILE_SPLIT_ITEMS_VAL
|
||||||
where valid_flag = '0' and ITEM_ID = #{itemId}
|
where valid_flag = '0' and ITEM_ID = #{itemId}
|
||||||
@@ -194,7 +194,7 @@
|
|||||||
|
|
||||||
<select id="querySarFileSplitItemsValByItemId"
|
<select id="querySarFileSplitItemsValByItemId"
|
||||||
resultType="com.jero.modules.laws.documenttool.entity.SarFileSplitItemsVal">
|
resultType="com.jero.modules.laws.documenttool.entity.SarFileSplitItemsVal">
|
||||||
select id, sys_org_code, item_id, type, item_content, display_seq, valid_flag,
|
select id, sys_org_code, item_id, type, item_content, translation, display_seq, valid_flag,
|
||||||
img_name, index_item, creation_time, modify_user, modify_time, creation_user
|
img_name, index_item, creation_time, modify_user, modify_time, creation_user
|
||||||
from sar_file_split_items_val
|
from sar_file_split_items_val
|
||||||
where valid_flag = 0 and item_id = #{itemId}
|
where valid_flag = 0 and item_id = #{itemId}
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ public class SarFileSplitItemsValEO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty("条文内容")
|
@ApiModelProperty("条文内容")
|
||||||
private String itemContent;
|
private String itemContent;
|
||||||
|
/**
|
||||||
|
* 译文
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("译文")
|
||||||
|
private String translation;
|
||||||
/**
|
/**
|
||||||
* 有效标识
|
* 有效标识
|
||||||
*/
|
*/
|
||||||
|
|||||||
+12
-3
@@ -7,6 +7,7 @@
|
|||||||
<result column="type" property="type" />
|
<result column="type" property="type" />
|
||||||
<result column="item_id" property="itemId" />
|
<result column="item_id" property="itemId" />
|
||||||
<result column="item_content" property="itemContent" />
|
<result column="item_content" property="itemContent" />
|
||||||
|
<result column="translation" property="translation" />
|
||||||
<result column="valid_flag" property="validFlag" />
|
<result column="valid_flag" property="validFlag" />
|
||||||
<result column="creation_user" property="creationUser" />
|
<result column="creation_user" property="creationUser" />
|
||||||
<result column="creation_time" property="creationTime" />
|
<result column="creation_time" property="creationTime" />
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
|
|
||||||
<!-- SAR_FILE_SPLIT_ITEMS_VAL table all fields -->
|
<!-- SAR_FILE_SPLIT_ITEMS_VAL table all fields -->
|
||||||
<sql id="Base_Column_List" >
|
<sql id="Base_Column_List" >
|
||||||
id, type, item_id, item_content, valid_flag, creation_user, creation_time, modify_time, modify_user, display_seq,img_name,index_item
|
id, type, item_id, item_content, translation, valid_flag, creation_user, creation_time, modify_time, modify_user, display_seq,img_name,index_item
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<!-- 查询条件 -->
|
<!-- 查询条件 -->
|
||||||
@@ -77,7 +78,7 @@
|
|||||||
SELECT SEQ_SAR_FILE_SPLIT_ITEMS_VAL.NEXTVAL FROM DUAL
|
SELECT SEQ_SAR_FILE_SPLIT_ITEMS_VAL.NEXTVAL FROM DUAL
|
||||||
</selectKey> -->
|
</selectKey> -->
|
||||||
insert into SAR_FILE_SPLIT_ITEMS_VAL(<include refid="Base_Column_List" />)
|
insert into SAR_FILE_SPLIT_ITEMS_VAL(<include refid="Base_Column_List" />)
|
||||||
values (#{id, jdbcType=VARCHAR}, #{type, jdbcType=VARCHAR}, #{itemId, jdbcType=VARCHAR}, #{itemContent, jdbcType=CLOB}, #{validFlag, jdbcType=INTEGER}, #{creationUser, jdbcType=VARCHAR}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP}, #{modifyUser, jdbcType=VARCHAR}, #{displaySeq, jdbcType=INTEGER})
|
values (#{id, jdbcType=VARCHAR}, #{type, jdbcType=VARCHAR}, #{itemId, jdbcType=VARCHAR}, #{itemContent, jdbcType=CLOB}, #{translation, jdbcType=CLOB}, #{validFlag, jdbcType=INTEGER}, #{creationUser, jdbcType=VARCHAR}, #{creationTime, jdbcType=TIMESTAMP}, #{modifyTime, jdbcType=TIMESTAMP}, #{modifyUser, jdbcType=VARCHAR}, #{displaySeq, jdbcType=INTEGER})
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<!-- 动态插入记录 主键是序列 -->
|
<!-- 动态插入记录 主键是序列 -->
|
||||||
@@ -91,6 +92,7 @@
|
|||||||
<if test="type != null" >type,</if>
|
<if test="type != null" >type,</if>
|
||||||
<if test="itemId != null" >item_id,</if>
|
<if test="itemId != null" >item_id,</if>
|
||||||
<if test="itemContent != null" >item_content,</if>
|
<if test="itemContent != null" >item_content,</if>
|
||||||
|
<if test="translation != null" >translation,</if>
|
||||||
<if test="validFlag != null" >valid_flag,</if>
|
<if test="validFlag != null" >valid_flag,</if>
|
||||||
<if test="creationUser != null" >creation_user,</if>
|
<if test="creationUser != null" >creation_user,</if>
|
||||||
<if test="creationTime != null" >creation_time,</if>
|
<if test="creationTime != null" >creation_time,</if>
|
||||||
@@ -105,6 +107,7 @@
|
|||||||
<if test="type != null" >#{type, jdbcType=VARCHAR},</if>
|
<if test="type != null" >#{type, jdbcType=VARCHAR},</if>
|
||||||
<if test="itemId != null" >#{itemId, jdbcType=VARCHAR},</if>
|
<if test="itemId != null" >#{itemId, jdbcType=VARCHAR},</if>
|
||||||
<if test="itemContent != null" >#{itemContent, jdbcType=CLOB},</if>
|
<if test="itemContent != null" >#{itemContent, jdbcType=CLOB},</if>
|
||||||
|
<if test="translation != null" >#{translation},</if>
|
||||||
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
<if test="validFlag != null" >#{validFlag, jdbcType=INTEGER},</if>
|
||||||
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
|
<if test="creationUser != null" >#{creationUser, jdbcType=VARCHAR},</if>
|
||||||
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
<if test="creationTime != null" >#{creationTime, jdbcType=TIMESTAMP},</if>
|
||||||
@@ -122,6 +125,7 @@
|
|||||||
set type = #{type},
|
set type = #{type},
|
||||||
item_id = #{itemId},
|
item_id = #{itemId},
|
||||||
item_content = #{itemContent},
|
item_content = #{itemContent},
|
||||||
|
translation = #{translation},
|
||||||
valid_flag = #{validFlag},
|
valid_flag = #{validFlag},
|
||||||
creation_user = #{creationUser},
|
creation_user = #{creationUser},
|
||||||
creation_time = #{creationTime},
|
creation_time = #{creationTime},
|
||||||
@@ -144,6 +148,9 @@
|
|||||||
<if test="itemContent != null" >
|
<if test="itemContent != null" >
|
||||||
item_content = #{itemContent},
|
item_content = #{itemContent},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="translation != null" >
|
||||||
|
translation = #{translation},
|
||||||
|
</if>
|
||||||
<if test="validFlag != null" >
|
<if test="validFlag != null" >
|
||||||
valid_flag = #{validFlag},
|
valid_flag = #{validFlag},
|
||||||
</if>
|
</if>
|
||||||
@@ -226,7 +233,7 @@
|
|||||||
<!-- 批量插入接口 -->
|
<!-- 批量插入接口 -->
|
||||||
<insert id="insertForeach" parameterType="java.util.List">
|
<insert id="insertForeach" parameterType="java.util.List">
|
||||||
insert into SAR_FILE_SPLIT_ITEMS_VAL
|
insert into SAR_FILE_SPLIT_ITEMS_VAL
|
||||||
(id, type, item_id, valid_flag, creation_user, creation_time, modify_time, modify_user, display_seq, img_name, item_content, index_item)
|
(id, type, item_id, valid_flag, creation_user, creation_time, modify_time, modify_user, display_seq, img_name, item_content, translation, index_item)
|
||||||
values
|
values
|
||||||
<foreach collection="list" item="item" index="index" separator=",">(
|
<foreach collection="list" item="item" index="index" separator=",">(
|
||||||
#{item.id, jdbcType=VARCHAR}, #{item.type, jdbcType=VARCHAR},
|
#{item.id, jdbcType=VARCHAR}, #{item.type, jdbcType=VARCHAR},
|
||||||
@@ -236,6 +243,7 @@
|
|||||||
#{item.modifyUser, jdbcType=VARCHAR}, #{item.displaySeq, jdbcType=INTEGER},
|
#{item.modifyUser, jdbcType=VARCHAR}, #{item.displaySeq, jdbcType=INTEGER},
|
||||||
#{item.imgName, jdbcType=INTEGER},
|
#{item.imgName, jdbcType=INTEGER},
|
||||||
#{item.itemContent, jdbcType=CLOB},
|
#{item.itemContent, jdbcType=CLOB},
|
||||||
|
#{item.translation},
|
||||||
#{item.indexItem, jdbcType=INTEGER})
|
#{item.indexItem, jdbcType=INTEGER})
|
||||||
</foreach>
|
</foreach>
|
||||||
</insert>
|
</insert>
|
||||||
@@ -316,6 +324,7 @@
|
|||||||
item_id,
|
item_id,
|
||||||
type,
|
type,
|
||||||
item_content,
|
item_content,
|
||||||
|
translation,
|
||||||
display_seq,
|
display_seq,
|
||||||
valid_flag,
|
valid_flag,
|
||||||
img_name,
|
img_name,
|
||||||
|
|||||||
+97
-106
@@ -1436,6 +1436,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
String importDtoId = UUID.randomUUID().toString().replace("-", "");
|
String importDtoId = UUID.randomUUID().toString().replace("-", "");
|
||||||
importDto.put("id", importDtoId); // 记得去掉
|
importDto.put("id", importDtoId); // 记得去掉
|
||||||
importDto.put("info_id", infoId);
|
importDto.put("info_id", infoId);
|
||||||
|
String[] valArr = importDto.get("item_content").toString().split("\n");
|
||||||
|
String[] translationArr = importDto.get("translation").toString().split("\n");
|
||||||
|
int j = translationArr.length;
|
||||||
List<SarFileSplitItemsValEO> addItemValList = new ArrayList<>();
|
List<SarFileSplitItemsValEO> addItemValList = new ArrayList<>();
|
||||||
if (addItemsEOList != null && !addItemsEOList.isEmpty()) {
|
if (addItemsEOList != null && !addItemsEOList.isEmpty()) {
|
||||||
Map<String, Object> oldItems = addItemsEOList.get(addItemsEOList.size()-1);
|
Map<String, Object> oldItems = addItemsEOList.get(addItemsEOList.size()-1);
|
||||||
@@ -1447,7 +1450,6 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
addItemValList = (List<SarFileSplitItemsValEO>) oldItems.get("itemValEOList");
|
addItemValList = (List<SarFileSplitItemsValEO>) oldItems.get("itemValEOList");
|
||||||
String itemContent = oldItems.get("item_content").toString() + importDto.get("item_content").toString();
|
String itemContent = oldItems.get("item_content").toString() + importDto.get("item_content").toString();
|
||||||
oldItems.put("item_content", itemContent);
|
oldItems.put("item_content", itemContent);
|
||||||
String[] valArr = importDto.get("item_content").toString().split("\n");
|
|
||||||
if (valArr != null && valArr.length > 0) {
|
if (valArr != null && valArr.length > 0) {
|
||||||
for (int i=0;i<valArr.length;i++) {
|
for (int i=0;i<valArr.length;i++) {
|
||||||
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
||||||
@@ -1460,36 +1462,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
valEO.setItemContent(splitTableInfo.getTableHtml());
|
valEO.setItemContent(splitTableInfo.getTableHtml());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i < j) {
|
||||||
|
for (SplitTableInfo splitTableInfo1 : getSheetTableList) {
|
||||||
|
if (splitTableInfo1.getTableName().equals(translationArr[i])) {
|
||||||
|
valEO.setTranslation(splitTableInfo1.getTableHtml());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||||
String url = nowfilelist.get(0).getPath();
|
String url = nowfilelist.get(0).getPath();
|
||||||
MultipartFile multipartFile = createMfileByPath(url);
|
MultipartFile multipartFile = createMfileByPath(url);
|
||||||
String state = "0";
|
|
||||||
// String fileSuffix = url.substring(url.lastIndexOf("."));
|
|
||||||
// String fileTypeStr = ".doc,.DOC,.docx,.DOCX,.xls, .XLS,.xlsx,.XLSX,.pdf,.PDF";
|
|
||||||
// if (fileTypeStr.contains(fileSuffix)) {
|
|
||||||
// state = "1";
|
|
||||||
// }
|
|
||||||
// OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
|
||||||
// if(oSSFile!=null){
|
|
||||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
|
||||||
isText = false;
|
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);
|
|
||||||
//
|
|
||||||
// String imageName = UUIDUtils.randomUUID10() + multipartFile.getName();
|
|
||||||
// String filepathandname = uploadCospath + "/" + imageName;
|
|
||||||
try {
|
try {
|
||||||
// String paths = splitUrl+imageName;
|
|
||||||
// MinioUtil.uploadByte(bytev, filepathandname);
|
|
||||||
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
||||||
OSSFile ossFile = new OSSFile();
|
OSSFile ossFile = new OSSFile();
|
||||||
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||||
@@ -1498,6 +1484,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
ossFileService.save(ossFile);
|
ossFileService.save(ossFile);
|
||||||
valEO.setType("IMG");
|
valEO.setType("IMG");
|
||||||
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
||||||
|
if (i < j) {
|
||||||
|
List<File> translationfilelist = FileUnZip.readFileByFilename(filepath, translationArr[i]);
|
||||||
|
if (CollectionUtil.isNotEmpty(translationfilelist)) {
|
||||||
|
String urlTranslation = translationfilelist.get(0).getPath();
|
||||||
|
MultipartFile multipartFileTranslation = createMfileByPath(urlTranslation);
|
||||||
|
String uploadTranslation = ObsBootUtil.upload(multipartFileTranslation, "temp");
|
||||||
|
OSSFile ossFileTranslation = new OSSFile();
|
||||||
|
ossFileTranslation.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||||
|
ossFileTranslation.setFileName(multipartFileTranslation.getName());
|
||||||
|
ossFileTranslation.setUrl(uploadTranslation);
|
||||||
|
ossFileService.save(ossFileTranslation);
|
||||||
|
valEO.setTranslation(splitUrl+uploadTranslation.replace("temp\\", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -1506,6 +1506,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
if (isText) {
|
if (isText) {
|
||||||
valEO.setType("TEXT");
|
valEO.setType("TEXT");
|
||||||
valEO.setItemContent(valArr[i]);
|
valEO.setItemContent(valArr[i]);
|
||||||
|
if(i < j){
|
||||||
|
valEO.setTranslation(translationArr[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addItemValList.add(valEO);
|
addItemValList.add(valEO);
|
||||||
}
|
}
|
||||||
@@ -1513,7 +1516,6 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
oldItems.put("itemValEOList", addItemValList);
|
oldItems.put("itemValEOList", addItemValList);
|
||||||
}else {
|
}else {
|
||||||
if(ObjectUtil.isNotEmpty(importDto.get("item_content"))) {
|
if(ObjectUtil.isNotEmpty(importDto.get("item_content"))) {
|
||||||
String[] valArr = importDto.get("item_content").toString().split("\n");
|
|
||||||
if (valArr != null && valArr.length > 0) {
|
if (valArr != null && valArr.length > 0) {
|
||||||
for (int i = 0; i < valArr.length; i++) {
|
for (int i = 0; i < valArr.length; i++) {
|
||||||
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
||||||
@@ -1526,36 +1528,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
valEO.setItemContent(splitTableInfo.getTableHtml());
|
valEO.setItemContent(splitTableInfo.getTableHtml());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i < j) {
|
||||||
|
for (SplitTableInfo splitTableInfo1 : getSheetTableList) {
|
||||||
|
if (splitTableInfo1.getTableName().equals(translationArr[i])) {
|
||||||
|
valEO.setTranslation(splitTableInfo1.getTableHtml());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||||
String url = nowfilelist.get(0).getPath();
|
String url = nowfilelist.get(0).getPath();
|
||||||
MultipartFile multipartFile = createMfileByPath(url);
|
MultipartFile multipartFile = createMfileByPath(url);
|
||||||
String state = "0";
|
|
||||||
// String fileSuffix = url.substring(url.lastIndexOf("."));
|
|
||||||
// String fileTypeStr = ".doc,.DOC,.docx,.DOCX,.xls, .XLS,.xlsx,.XLSX,.pdf,.PDF";
|
|
||||||
// if (fileTypeStr.contains(fileSuffix)) {
|
|
||||||
// state = "1";
|
|
||||||
// }
|
|
||||||
// OSSFile oSSFile = ossFileService.uploadLocalOfCos(multipartFile, "", state,null);
|
|
||||||
// OSSFile oSSFile = ossFileService.uploadLocalForSplit(multipartFile, "",state,null);
|
|
||||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
|
||||||
// if (oSSFile != null) {
|
|
||||||
// oSSFile = ossFileService.getById(oSSFile.getId());
|
|
||||||
isText = false;
|
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);
|
|
||||||
// }
|
|
||||||
try {
|
try {
|
||||||
// String paths = splitUrl+imageName;
|
|
||||||
// MinioUtil.uploadByte(bytev, filepathandname);
|
|
||||||
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
||||||
OSSFile ossFile = new OSSFile();
|
OSSFile ossFile = new OSSFile();
|
||||||
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||||
@@ -1564,6 +1550,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
ossFileService.save(ossFile);
|
ossFileService.save(ossFile);
|
||||||
valEO.setType("IMG");
|
valEO.setType("IMG");
|
||||||
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
||||||
|
if (i < j) {
|
||||||
|
List<File> translationfilelist = FileUnZip.readFileByFilename(filepath, translationArr[i]);
|
||||||
|
if (CollectionUtil.isNotEmpty(translationfilelist)) {
|
||||||
|
String urlTranslation = translationfilelist.get(0).getPath();
|
||||||
|
MultipartFile multipartFileTranslation = createMfileByPath(urlTranslation);
|
||||||
|
String uploadTranslation = ObsBootUtil.upload(multipartFileTranslation, "temp");
|
||||||
|
OSSFile ossFileTranslation = new OSSFile();
|
||||||
|
ossFileTranslation.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||||
|
ossFileTranslation.setFileName(multipartFileTranslation.getName());
|
||||||
|
ossFileTranslation.setUrl(uploadTranslation);
|
||||||
|
ossFileService.save(ossFileTranslation);
|
||||||
|
valEO.setTranslation(splitUrl+uploadTranslation.replace("temp\\", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -1571,6 +1571,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
if (isText) {
|
if (isText) {
|
||||||
valEO.setType("TEXT");
|
valEO.setType("TEXT");
|
||||||
valEO.setItemContent(valArr[i]);
|
valEO.setItemContent(valArr[i]);
|
||||||
|
if(i < j){
|
||||||
|
valEO.setTranslation(translationArr[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addItemValList.add(valEO);
|
addItemValList.add(valEO);
|
||||||
}
|
}
|
||||||
@@ -1581,7 +1584,6 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(ObjectUtil.isNotEmpty(importDto.get("item_content"))) {
|
if(ObjectUtil.isNotEmpty(importDto.get("item_content"))) {
|
||||||
String[] valArr = importDto.get("item_content").toString().split("\n");
|
|
||||||
if (valArr != null && valArr.length > 0) {
|
if (valArr != null && valArr.length > 0) {
|
||||||
for (int i = 0; i < valArr.length; i++) {
|
for (int i = 0; i < valArr.length; i++) {
|
||||||
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
SarFileSplitItemsValEO valEO = new SarFileSplitItemsValEO();
|
||||||
@@ -1594,30 +1596,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
valEO.setItemContent(splitTableInfo.getTableHtml());
|
valEO.setItemContent(splitTableInfo.getTableHtml());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (i < j) {
|
||||||
|
for (SplitTableInfo splitTableInfo1 : getSheetTableList) {
|
||||||
|
if (splitTableInfo1.getTableName().equals(translationArr[i])) {
|
||||||
|
valEO.setTranslation(splitTableInfo1.getTableHtml());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
List<File> nowfilelist = FileUnZip.readFileByFilename(filepath, valArr[i]);
|
||||||
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
if (nowfilelist != null && !nowfilelist.isEmpty()) {
|
||||||
String url = nowfilelist.get(0).getPath();
|
String url = nowfilelist.get(0).getPath();
|
||||||
MultipartFile multipartFile = createMfileByPath(url);
|
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) {
|
|
||||||
isText = false;
|
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);
|
|
||||||
// }
|
|
||||||
try {
|
try {
|
||||||
// String paths = splitUrl+imageName;
|
|
||||||
// MinioUtil.uploadByte(bytev, filepathandname);
|
|
||||||
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
String upload = ObsBootUtil.upload(multipartFile, "temp");
|
||||||
OSSFile ossFile = new OSSFile();
|
OSSFile ossFile = new OSSFile();
|
||||||
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
ossFile.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||||
@@ -1626,6 +1618,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
ossFileService.save(ossFile);
|
ossFileService.save(ossFile);
|
||||||
valEO.setType("IMG");
|
valEO.setType("IMG");
|
||||||
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
valEO.setItemContent(splitUrl+upload.replace("temp\\", ""));
|
||||||
|
if (i < j) {
|
||||||
|
List<File> translationfilelist = FileUnZip.readFileByFilename(filepath, translationArr[i]);
|
||||||
|
if (CollectionUtil.isNotEmpty(translationfilelist)) {
|
||||||
|
String urlTranslation = translationfilelist.get(0).getPath();
|
||||||
|
MultipartFile multipartFileTranslation = createMfileByPath(urlTranslation);
|
||||||
|
String uploadTranslation = ObsBootUtil.upload(multipartFileTranslation, "temp");
|
||||||
|
OSSFile ossFileTranslation = new OSSFile();
|
||||||
|
ossFileTranslation.setId(String.valueOf(SnowflakeUtils.snowflake()));
|
||||||
|
ossFileTranslation.setFileName(multipartFileTranslation.getName());
|
||||||
|
ossFileTranslation.setUrl(uploadTranslation);
|
||||||
|
ossFileService.save(ossFileTranslation);
|
||||||
|
valEO.setTranslation(splitUrl+uploadTranslation.replace("temp\\", ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -1633,6 +1639,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
if (isText) {
|
if (isText) {
|
||||||
valEO.setType("TEXT");
|
valEO.setType("TEXT");
|
||||||
valEO.setItemContent(valArr[i]);
|
valEO.setItemContent(valArr[i]);
|
||||||
|
if(i < j){
|
||||||
|
valEO.setTranslation(translationArr[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
addItemValList.add(valEO);
|
addItemValList.add(valEO);
|
||||||
}
|
}
|
||||||
@@ -1658,39 +1667,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
//当导入节点没有子节点时,获取当前节点的序号
|
//当导入节点没有子节点时,获取当前节点的序号
|
||||||
treeListDisplay = targetMenuEO.getDisplaySeq();
|
treeListDisplay = targetMenuEO.getDisplaySeq();
|
||||||
}
|
}
|
||||||
|
|
||||||
// if(!"总目录".equals(targetMenuEO.getName())){
|
|
||||||
// String regex = "^[0-9]{0}([0-9]|[.])+$"; //TODO 待优化:数字和点必须交替
|
|
||||||
// if(!targetMenuEO.getName().matches(regex)){
|
|
||||||
// throw new AdcDaBaseException("所选目录命名不规范");
|
|
||||||
// }
|
|
||||||
// String[] str = targetMenuEO.getName().split(".");
|
|
||||||
// if(str.length == 0){
|
|
||||||
// levelNum = 2;
|
|
||||||
// }else {
|
|
||||||
// levelNum = str.length + 1;
|
|
||||||
// }
|
|
||||||
// }else{
|
|
||||||
// levelNum = 1;
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取导入数据的所有一级节点
|
|
||||||
int finalLevelNum = levelNum;
|
|
||||||
/*List<SarFileSplitItemsEO> itemNumList = new ArrayList<>();
|
|
||||||
for(SarFileSplitItemsEO sarFileSplitItemsEO : addItemsEOList){
|
|
||||||
String[] str = sarFileSplitItemsEO.getItemsNum().split(".");
|
|
||||||
if(str.length == finalLevelNum){
|
|
||||||
itemNumList.add(sarFileSplitItemsEO);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
// 2022-03-31 注释
|
|
||||||
// List<SarFileSplitItemsEO> itemNumList = addItemsEOList.stream()
|
|
||||||
// .filter(e->e.getItemsNum().split("\\.").length == finalLevelNum || e.getItemsNum().contains("附录"))
|
|
||||||
// .collect(Collectors.toList());
|
|
||||||
//构造目录树
|
//构造目录树
|
||||||
HashMap<String, String> menuAndItemMap = new HashMap<>();
|
HashMap<String, String> menuAndItemMap = new HashMap<>();
|
||||||
// if(CollectionUtils.isNotEmpty(itemNumList)) {
|
|
||||||
List<Map<String, Object>> itemsEOList = new ArrayList<>(addItemsEOList);
|
List<Map<String, Object>> itemsEOList = new ArrayList<>(addItemsEOList);
|
||||||
List<SarFileSplitMenuTreeNode> treeList = buildTree(itemsEOList, treeListDisplay, menuId);
|
List<SarFileSplitMenuTreeNode> treeList = buildTree(itemsEOList, treeListDisplay, menuId);
|
||||||
|
|
||||||
@@ -1699,9 +1678,6 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
for (SarFileSplitMenuTreeNode treeNode : treeList) {
|
for (SarFileSplitMenuTreeNode treeNode : treeList) {
|
||||||
menuAndItemMap.put(treeNode.getItemId(), treeNode.getId());
|
menuAndItemMap.put(treeNode.getItemId(), treeNode.getId());
|
||||||
}
|
}
|
||||||
// }else{
|
|
||||||
// throw new AdcDaBaseException("导入目录命名不规范");
|
|
||||||
// }
|
|
||||||
//添加条款
|
//添加条款
|
||||||
for (Map<String, Object> itemsEO : addItemsEOList) {
|
for (Map<String, Object> itemsEO : addItemsEOList) {
|
||||||
if(menuAndItemMap.get(itemsEO.get("id")) != null) {
|
if(menuAndItemMap.get(itemsEO.get("id")) != null) {
|
||||||
@@ -2950,20 +2926,34 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
//添加val表数据
|
//添加val表数据
|
||||||
List<SarFileSplitItemsValEO> getValList = (List<SarFileSplitItemsValEO>) sarFileSplitItemsEO.get("itemValEOList");
|
List<SarFileSplitItemsValEO> getValList = (List<SarFileSplitItemsValEO>) sarFileSplitItemsEO.get("itemValEOList");
|
||||||
String itemConditions = "";
|
String itemConditions = "";
|
||||||
|
String itemConditionsTranslation = "";
|
||||||
int ind = 1;
|
int ind = 1;
|
||||||
if (getValList != null && !getValList.isEmpty()) {
|
if (getValList != null && !getValList.isEmpty()) {
|
||||||
for (SarFileSplitItemsValEO valEO : getValList) {
|
for (SarFileSplitItemsValEO valEO : getValList) {
|
||||||
|
String type = valEO.getType();
|
||||||
|
String itemContent = valEO.getItemContent();
|
||||||
|
String translation = valEO.getTranslation();
|
||||||
// 当前段内容
|
// 当前段内容
|
||||||
String valContent = "";
|
String valContent = "";
|
||||||
if ("TEXT".equals(valEO.getType())) {
|
String valContentTranslation = "";
|
||||||
valContent += "<p>" + valEO.getItemContent() + "</p>";
|
if ("TEXT".equals(type)) {
|
||||||
} else if ("IMG".equals(valEO.getType())) {
|
valContent += "<p>" + itemContent + "</p>";
|
||||||
valContent += "<img class=\"wordImg\" style=\"width:100%;height:100%\" src=\""+ valEO.getItemContent() +"\">";
|
if (StringUtils.isNotBlank(translation)){
|
||||||
// valContent += valEO.getItemContent();
|
valContentTranslation += "<p>" + translation + "</p>";
|
||||||
} else if ("TABLE".equals(valEO.getType())) {
|
}
|
||||||
valContent += valEO.getItemContent();
|
} else if ("IMG".equals(type)) {
|
||||||
|
valContent += "<img class=\"wordImg\" style=\"width:100%;height:100%\" src=\""+ itemContent +"\">";
|
||||||
|
if (StringUtils.isNotBlank(translation)){
|
||||||
|
valContentTranslation += "<img class=\"wordImg\" style=\"width:100%;height:100%\" src=\""+ translation +"\">";
|
||||||
|
}
|
||||||
|
} else if ("TABLE".equals(type)) {
|
||||||
|
valContent += itemContent;
|
||||||
|
if (StringUtils.isNotBlank(translation)){
|
||||||
|
valContentTranslation += translation;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
itemConditions += valContent;
|
itemConditions += valContent;
|
||||||
|
itemConditionsTranslation += valContentTranslation;
|
||||||
// val表信息
|
// val表信息
|
||||||
valEO.setId(UUIDUtils.randomUUID20());
|
valEO.setId(UUIDUtils.randomUUID20());
|
||||||
// valEO.setItemId(itemsId);
|
// valEO.setItemId(itemsId);
|
||||||
@@ -2978,6 +2968,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
|||||||
}
|
}
|
||||||
sarFileSplitItemsValEOMapper.insertForeach(getValList);
|
sarFileSplitItemsValEOMapper.insertForeach(getValList);
|
||||||
sarFileSplitItemsEO.put("item_content", itemConditions);
|
sarFileSplitItemsEO.put("item_content", itemConditions);
|
||||||
|
sarFileSplitItemsEO.put("translation", itemConditionsTranslation);
|
||||||
}
|
}
|
||||||
String id = (String)sarFileSplitItemsEO.get("id");
|
String id = (String)sarFileSplitItemsEO.get("id");
|
||||||
sarFileSplitItemsEO.remove("id");
|
sarFileSplitItemsEO.remove("id");
|
||||||
|
|||||||
Reference in New Issue
Block a user