fix(89157): 优化拆分导入速度,导出译文bug修复
This commit is contained in:
+6
@@ -135,4 +135,10 @@ public class LawsDocumentSplit extends BaseEntity {
|
||||
// 拆分信息记录id
|
||||
@ApiModelProperty("拆分信息记录id")
|
||||
private String infoId;
|
||||
// 菜单id
|
||||
@ApiModelProperty("菜单id")
|
||||
private String menuId;
|
||||
// 所属部门
|
||||
@ApiModelProperty("所属部门")
|
||||
private String sysOrgCode;
|
||||
}
|
||||
|
||||
+7
@@ -130,6 +130,13 @@ public interface DocumentSplitMapper extends BaseMapper<LawsDocumentSplit> {
|
||||
*/
|
||||
int insertLawsDocumentSplit(@Param("insertField") String insertField, @Param("insertValue") List<String> insertValue);
|
||||
|
||||
/**
|
||||
* 文档拆分详情-批量新增
|
||||
* @param LawsDocumentSplit
|
||||
* @return
|
||||
*/
|
||||
int insertBatchLawsDocumentSplit(@Param("entity") List<LawsDocumentSplit> LawsDocumentSplit);
|
||||
|
||||
/**
|
||||
* 条目批量删除根据itemId
|
||||
* @param itemIds
|
||||
|
||||
+10
@@ -48,6 +48,16 @@
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatchLawsDocumentSplit">
|
||||
INSERT INTO laws_document_split (id, create_by, create_time, update_by, update_time, sys_org_code,
|
||||
is_same_as_prev_version, item_title, menu_id, item_content, translation, item_num, info_id)
|
||||
values
|
||||
<foreach collection="entity" item="item" index="index" separator=",">
|
||||
(#{item.id}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.sysOrgCode},
|
||||
#{item.isSameAsPrevVersion}, #{item.itemTitle}, #{item.menuId}, #{item.itemContent}, #{item.translation}, #{item.itemNum}, #{item.infoId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<delete id="sarFileSplitMenuDeleteByIdList">
|
||||
delete from SAR_FILE_SPLIT_MENU
|
||||
where id in
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.jero.modules.split.asynservice;
|
||||
|
||||
import com.jero.modules.laws.documenttool.entity.LawsDocumentSplit;
|
||||
import com.jero.modules.laws.documenttool.entity.SarFileSplitMenu;
|
||||
import com.jero.modules.laws.documenttool.mapper.DocumentSplitMapper;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsValEO;
|
||||
import com.jero.modules.split.mapper.SarFileSplitItemsValEOMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName: AsynService
|
||||
* @Description:
|
||||
* @Author: yjz
|
||||
* @Date: 2024-08-20 16:59
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AsynService {
|
||||
@Autowired
|
||||
private SarFileSplitItemsValEOMapper sarFileSplitItemsValEOMapper;
|
||||
@Autowired
|
||||
private DocumentSplitMapper documentSplitMapper;
|
||||
|
||||
@Async("asyncServiceExecutor")
|
||||
public void executeAsynSaveItemsVal(List<SarFileSplitItemsValEO> list) {
|
||||
log.warn(Thread.currentThread().getId() + "条款详情线程开始");
|
||||
sarFileSplitItemsValEOMapper.insertForeach(list);
|
||||
log.warn(Thread.currentThread().getId() + "条款详情线程结束");
|
||||
}
|
||||
|
||||
@Async("asyncServiceExecutor")
|
||||
public void executeAsynSarFileSplitMenu(List<SarFileSplitMenu> list) {
|
||||
log.warn(Thread.currentThread().getId() + "菜单线程开始");
|
||||
documentSplitMapper.insertBatchSarFileSplitMenuByInfoId(list);
|
||||
log.warn(Thread.currentThread().getId() + "菜单线程结束");
|
||||
}
|
||||
|
||||
@Async("asyncServiceExecutor")
|
||||
public void executeAsynSaveItems(List<LawsDocumentSplit> list) {
|
||||
log.warn(Thread.currentThread().getId() + "条款线程开始");
|
||||
documentSplitMapper.insertBatchLawsDocumentSplit(list);
|
||||
log.warn(Thread.currentThread().getId() + "条款线程结束");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.jero.modules.split.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
@Slf4j
|
||||
public class ExecutorConfig {
|
||||
@Bean(name = "asyncServiceExecutor")
|
||||
public Executor asyncServiceExecutor() {
|
||||
log.info("start asyncServiceExecutor");
|
||||
//获取cpu核心数
|
||||
int i = Runtime.getRuntime().availableProcessors();
|
||||
//核心线程数
|
||||
int corePoolSize = i * 2;
|
||||
//最大线程数
|
||||
int maxPoolSize = i * 2;
|
||||
//队列大小
|
||||
int queueCapacity = i * 2 * 10;
|
||||
|
||||
//在这里修改
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
//配置核心线程数
|
||||
executor.setCorePoolSize(corePoolSize);
|
||||
//配置最大线程数
|
||||
executor.setMaxPoolSize(maxPoolSize);
|
||||
//配置队列大小
|
||||
executor.setQueueCapacity(queueCapacity);
|
||||
//配置线程池中的线程的名称前缀
|
||||
executor.setThreadNamePrefix("asyncServiceExecutor");
|
||||
// rejection-policy:当pool已经达到max size的时候,如何处理新任务
|
||||
// CALLER_RUNS:不在新线程中执行任务,而是有调用者所在的线程来执行
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
//执行初始化
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ public class FileSplitValExportDto {
|
||||
|
||||
private String valContent;
|
||||
|
||||
private String translation;
|
||||
|
||||
private boolean hasImg;
|
||||
|
||||
private List<SarFileSplitItemsTableEO> tableEOList;
|
||||
|
||||
+307
-29
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.api.vo.ResultCommon;
|
||||
import com.jero.common.constant.enums.IsMustEnum;
|
||||
import com.jero.common.constant.enums.LanguageEnum;
|
||||
import com.jero.common.constant.enums.ModuleEnum;
|
||||
@@ -24,6 +25,8 @@ 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.entity.LawsDocumentSplit;
|
||||
import com.jero.modules.laws.documenttool.entity.SarFileSplitMenu;
|
||||
import com.jero.modules.laws.documenttool.mapper.DocumentSplitMapper;
|
||||
import com.jero.modules.laws.documenttool.service.IDocumentSplitService;
|
||||
import com.jero.modules.laws.labeldatabase.entity.LawsLabelDatabase;
|
||||
@@ -32,6 +35,7 @@ import com.jero.modules.laws.standard.entity.PartName;
|
||||
import com.jero.modules.laws.standard.service.ILawsPartNameService;
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import com.jero.modules.oss.service.IOSSFileService;
|
||||
import com.jero.modules.split.asynservice.AsynService;
|
||||
import com.jero.modules.split.common.ConvertHtml2Excel;
|
||||
import com.jero.modules.split.common.FileUnZip;
|
||||
import com.jero.modules.split.common.ReadExcel;
|
||||
@@ -117,13 +121,10 @@ import static org.jeecgframework.poi.util.ExcelUtil.getCellValue;
|
||||
public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMapper, SarFileSplitItemsEO> implements IFileSplitItemsEOService {
|
||||
@Autowired
|
||||
private FileSplitItemsEOMapper dao;
|
||||
|
||||
@Autowired
|
||||
private SarFileSplitMenuEOMapper sarFileSplitMenuEOMapper;
|
||||
|
||||
@Autowired
|
||||
private SarFileSplitItemsValEOMapper sarFileSplitItemsValEOMapper;
|
||||
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
@Autowired
|
||||
@@ -158,7 +159,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
private ISysDictItemService sysDictItemService;
|
||||
@Autowired
|
||||
private DocumentSplitMapper documentSplitMapper;
|
||||
|
||||
@Autowired
|
||||
private AsynService asynService;
|
||||
|
||||
@Value(value = "${jero.path.upload}")
|
||||
private String uploadpath;
|
||||
@@ -174,6 +176,9 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
public static String DECRYPT_APP_CODE;
|
||||
public static String DECRYPT_SECRET_KEY;
|
||||
|
||||
private static final int NUMBER_1 = 200;
|
||||
private static final int NUMBER_2 = 500;
|
||||
|
||||
private static final List<String> SPECIAL_FIELD = Arrays.asList("part_name", "applicable_components");
|
||||
|
||||
@Value("${download.enable}")
|
||||
@@ -658,6 +663,173 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
return documentSplitMapper.insertLawsDocumentSplit(insertField, valuesList);
|
||||
}
|
||||
|
||||
public void insertInfo3(Map<String, Object> parameter, String id, String type, List<LawsTag> fieldListSelect, List<LawsDocumentSplit> lawsDocumentSplit){
|
||||
StringBuilder fieldsBuilder = new StringBuilder(); // 字段名称
|
||||
List<String> valuesList = new ArrayList<>();// 字段值
|
||||
StringBuilder valuesBuilder = new StringBuilder(); // 字段值
|
||||
|
||||
// // 查询全部字段列表
|
||||
// List<LawsTag> fieldList = lawsCommonMapper.getFieldList(TableNameEnum.DOCUMENT_SPLIT.getTableName());
|
||||
// // 列表展示字段
|
||||
// List<LawsTag> fieldListSelect = fieldList.stream().filter(v -> YesOrNoEnum.YES.getValue()
|
||||
// .equals(String.valueOf(v.getIsShowList()))).collect(Collectors.toList());
|
||||
|
||||
// 查询全部字段属性
|
||||
// List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(ModuleEnum.FILE_SPLIT_ITEMS.getValue());
|
||||
// 文件类型字段
|
||||
List<LawsTag> onlFieldFileList = fieldListSelect.stream().filter(e -> FieldTypeEnum.FILE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldFieldList = onlFieldFileList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 日期类型字段(单日期选择)
|
||||
List<LawsTag> onlFieldDateList = fieldListSelect.stream().filter(e -> FieldTypeEnum.DATE_SINGLE.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldDateList = onlFieldDateList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 人员选择类型
|
||||
List<LawsTag> onlFieldPersonList = fieldListSelect.stream().filter(e -> FieldTypeEnum.PERSON.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldPersonList = onlFieldPersonList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
// 标准选择类型
|
||||
List<LawsTag> onlFieldStanList = fieldListSelect.stream().filter(e -> FieldTypeEnum.STANDARD.getValue().equals(e.getFieldShowType())).collect(Collectors.toList());
|
||||
List<String> fieldStanList = onlFieldStanList.stream().map(LawsTag::getDbFieldName).collect(Collectors.toList());
|
||||
|
||||
List<String> fieldPersonIdList = new ArrayList<>();
|
||||
fieldPersonList.forEach(item->{
|
||||
String fieldPersonId = item + "_id";
|
||||
fieldPersonIdList.add(fieldPersonId);
|
||||
});
|
||||
List<String> standardIdList = new ArrayList<>();
|
||||
fieldStanList.forEach(item->{
|
||||
String fieldStanId = item + "_id";
|
||||
standardIdList.add(fieldStanId);
|
||||
});
|
||||
LawsDocumentSplit lawsDocumentSplit1 = new LawsDocumentSplit();
|
||||
for (Map.Entry<String, Object> entry : parameter.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
Object value = entry.getValue();
|
||||
// 处理日期,文件,人员选择类型的字段
|
||||
//处理日期格式
|
||||
if (fieldDateList.contains(key) && ("create_time".equals(key) || "update_time".equals(key))) {
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
if(value.toString().equals("") || value.toString().equals("null")){
|
||||
continue;
|
||||
}
|
||||
value = "str_to_date('" + value + "','%Y-%m-%d')";
|
||||
} else {
|
||||
value = null;
|
||||
}
|
||||
// valuesList.add(String.valueOf(value));
|
||||
// valuesBuilder.append("," + value);
|
||||
} else if (fieldFieldList.contains(key)) {
|
||||
//处理文件类型
|
||||
if (ObjectUtils.isNotEmpty(value)) {
|
||||
if("add".equals(type) || "import".equals(type)) {
|
||||
String valueTemp = UUID.randomUUID().toString().replace("-", "");
|
||||
//修改文件表关联信息connect_id
|
||||
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||
for (String fileId : value.toString().split(",")) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileId);
|
||||
ossFile.setConnectId(valueTemp);
|
||||
oSSFileList.add(ossFile);
|
||||
}
|
||||
ossFileService.updateFileInfo(oSSFileList);
|
||||
// valuesList.add(valueTemp);
|
||||
// valuesBuilder.append("," + "'" + valueTemp + "'");
|
||||
} else if("set".equals(type) || "merge".equals(type) ||"copy".equals(type)){
|
||||
// valuesList.add(String.valueOf(value));
|
||||
// valuesBuilder.append("," + "'" + value + "'");
|
||||
} else if("update".equals(type)){
|
||||
// 前端标识 key_flag 0-未修改, 1-已修改
|
||||
if(value.toString().contains(",")){ // 新加了多个文件
|
||||
String valueTemp = UUID.randomUUID().toString().replace("-", "");
|
||||
//修改文件表关联信息connect_id
|
||||
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||
for (String fileId : value.toString().split(",")) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileId);
|
||||
ossFile.setConnectId(valueTemp);
|
||||
oSSFileList.add(ossFile);
|
||||
}
|
||||
ossFileService.updateFileInfo(oSSFileList);
|
||||
// valuesList.add(valueTemp);
|
||||
// valuesBuilder.append("," + "'" + valueTemp + "'");
|
||||
} else {
|
||||
List<OSSFile> ossFiles = ossFileService.getFileInfosByConnectId(value.toString());
|
||||
if(CollectionUtil.isNotEmpty(ossFiles)){ // 没有修改文件
|
||||
// valuesList.add(String.valueOf(value));
|
||||
// valuesBuilder.append("," + "'" + value + "'");
|
||||
} else { // 新加了一个文件
|
||||
String valueTemp = UUID.randomUUID().toString().replace("-", "");
|
||||
//修改文件表关联信息connect_id
|
||||
List<OSSFile> oSSFileList = new ArrayList<>();
|
||||
for (String fileId : value.toString().split(",")) {
|
||||
OSSFile ossFile = new OSSFile();
|
||||
ossFile.setId(fileId);
|
||||
ossFile.setConnectId(valueTemp);
|
||||
oSSFileList.add(ossFile);
|
||||
}
|
||||
ossFileService.updateFileInfo(oSSFileList);
|
||||
// valuesList.add(valueTemp);
|
||||
// valuesBuilder.append("," + "'" + valueTemp + "'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
// valuesList.add(String.valueOf(value));
|
||||
// valuesBuilder.append("," + "'" + value + "'");
|
||||
}
|
||||
} else if(fieldPersonList.contains(key)){ // || fieldStanList.contains(key)
|
||||
// 人员选择类型 标准选择类型
|
||||
if(ObjectUtil.isNotNull(parameter.get(key+"_id"))) {
|
||||
value = parameter.get(key + "_id");
|
||||
}
|
||||
// valuesList.add(String.valueOf(value));
|
||||
// valuesBuilder.append("," + "'" + value + "'");
|
||||
} else if(fieldPersonIdList.contains(key) || standardIdList.contains(key)){
|
||||
continue;
|
||||
} else {
|
||||
if ("item_content".equals(key)) {
|
||||
value = value.toString().replaceAll("\\\\", "\\\\\\\\").replaceAll("'", "\\\\'");
|
||||
}
|
||||
// valuesList.add(String.valueOf(value));
|
||||
// valuesBuilder.append("," + "'" + value + "'");
|
||||
}
|
||||
|
||||
fieldsBuilder.append("," + key);
|
||||
switch (key){
|
||||
case "is_same_as_prev_version":
|
||||
lawsDocumentSplit1.setIsSameAsPrevVersion(String.valueOf(value));
|
||||
break;
|
||||
case "item_title":
|
||||
lawsDocumentSplit1.setItemTitle(String.valueOf(value));
|
||||
case "translation":
|
||||
lawsDocumentSplit1.setTranslation(String.valueOf(value));
|
||||
break;
|
||||
case "menu_id":
|
||||
lawsDocumentSplit1.setMenuId(String.valueOf(value));
|
||||
break;
|
||||
case "item_content":
|
||||
lawsDocumentSplit1.setItemContent(String.valueOf(value));
|
||||
break;
|
||||
case "item_num":
|
||||
lawsDocumentSplit1.setItemNum(String.valueOf(value));
|
||||
break;
|
||||
case "info_id":
|
||||
lawsDocumentSplit1.setInfoId(String.valueOf(value));
|
||||
break;
|
||||
}
|
||||
}
|
||||
// String mustFields = "id,create_by,create_time,update_by,update_time,sys_org_code";
|
||||
List<String> mustValues = getMustValues3(id, lawsDocumentSplit1);
|
||||
if (!fieldsBuilder.toString().contains("is_same_as_prev_version")){
|
||||
// mustFields += ",is_same_as_prev_version";
|
||||
// mustValues.add("");
|
||||
lawsDocumentSplit1.setIsSameAsPrevVersion("");
|
||||
}
|
||||
// valuesList.addAll(0, mustValues);
|
||||
// String insertField = mustFields + fieldsBuilder.toString();
|
||||
// return documentSplitMapper.insertLawsDocumentSplit(insertField, valuesList);
|
||||
lawsDocumentSplit.add(lawsDocumentSplit1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据信息id更新排序字段
|
||||
* @param parameter
|
||||
@@ -729,6 +901,25 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<String> getMustValues3(String id, LawsDocumentSplit lawsDocumentSplit1) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<String> list = new ArrayList<>();
|
||||
Date date = new Date();
|
||||
list.add(id);
|
||||
lawsDocumentSplit1.setId(id);
|
||||
list.add(sysUser.getUsername());
|
||||
lawsDocumentSplit1.setCreateBy(sysUser.getUsername());
|
||||
list.add(sdf.format(date));
|
||||
lawsDocumentSplit1.setCreateTime(date);
|
||||
list.add(sysUser.getUsername());
|
||||
lawsDocumentSplit1.setUpdateBy(sysUser.getUsername());
|
||||
list.add(sdf.format(date));
|
||||
lawsDocumentSplit1.setUpdateTime(date);
|
||||
list.add(sysUser.getOrgCode());
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage getInfoPage(Map<String, Object> parameter) {
|
||||
String cut = CutUtils.getCurrentCut();// 中英文切换标识
|
||||
@@ -1403,7 +1594,6 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
.map(LawsTag :: getDictField)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 树形数据字典
|
||||
List<SysCategory> categoryList = new ArrayList<>();
|
||||
if(CollectionUtil.isNotEmpty(dictIdList)){
|
||||
@@ -1800,14 +1990,24 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// }
|
||||
//添加条款
|
||||
long aa = System.currentTimeMillis();
|
||||
List<SarFileSplitItemsValEO> addItemValList = new ArrayList<>();
|
||||
List<LawsDocumentSplit> LawsDocumentSplit = new ArrayList<>();
|
||||
for (Map<String, Object> itemsEO : addItemsEOList) {
|
||||
if(menuAndItemMap.get(itemsEO.get("id")) != null) {
|
||||
createItemsInfo(itemsEO, menuAndItemMap.get((String)itemsEO.get("id")), infoId);
|
||||
createItemsInfo(itemsEO, menuAndItemMap.get((String)itemsEO.get("id")), infoId, addItemValList, LawsDocumentSplit, fieldListSelect);
|
||||
}
|
||||
countSuccess++;
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(addItemValList)){
|
||||
batchSaveItemsVal(addItemValList);
|
||||
}
|
||||
long l = System.currentTimeMillis();
|
||||
log.error("================插入条款详情耗时:" + (l - aa) + "ms");
|
||||
if (CollectionUtils.isNotEmpty(LawsDocumentSplit)){
|
||||
batchSaveItems(LawsDocumentSplit);
|
||||
}
|
||||
long bb = System.currentTimeMillis();
|
||||
log.error("================插入条款耗时:" + (bb - aa) + "ms");
|
||||
log.error("================插入条款耗时:" + (bb - l) + "ms");
|
||||
//导入之后的节点(包括子节点),序号加一
|
||||
SarFileSplitMenuEOPage page = new SarFileSplitMenuEOPage();
|
||||
page.setInfoId(targetMenuEO.getInfoId());
|
||||
@@ -1831,22 +2031,41 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
}
|
||||
long e = System.currentTimeMillis();
|
||||
List<SarFileSplitMenu> sarFileSplitMenuList = new ArrayList<>();
|
||||
for (SarFileSplitMenuTreeNode treeNode : treeList) {
|
||||
//创建菜单
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO = new SarFileSplitMenuEO();
|
||||
sarFileSplitMenuEO.setId(treeNode.getId());
|
||||
sarFileSplitMenuEO.setInfoId(infoId);
|
||||
sarFileSplitMenuEO.setName(treeNode.getName());
|
||||
sarFileSplitMenuEO.setItemName(treeNode.getItemName());
|
||||
sarFileSplitMenuEO.setPId(treeNode.getParentId());
|
||||
sarFileSplitMenuEO.setDisplaySeq(treeNode.getOrderNum());
|
||||
sarFileSplitMenuEO.setCreationUser(userId);
|
||||
sarFileSplitMenuEO.setModifyUser(userId);
|
||||
sarFileSplitMenuEO.setValidFlag(0);
|
||||
sarFileSplitMenuEO.setCreationTime(new Date());
|
||||
sarFileSplitMenuEO.setModifyTime(new Date());
|
||||
sarFileSplitMenuEOMapper.insertSelective(sarFileSplitMenuEO);
|
||||
// SarFileSplitMenuEO sarFileSplitMenuEO = new SarFileSplitMenuEO();
|
||||
// sarFileSplitMenuEO.setId(treeNode.getId());
|
||||
// sarFileSplitMenuEO.setInfoId(infoId);
|
||||
// sarFileSplitMenuEO.setName(treeNode.getName());
|
||||
// sarFileSplitMenuEO.setItemName(treeNode.getItemName());
|
||||
// sarFileSplitMenuEO.setPId(treeNode.getParentId());
|
||||
// sarFileSplitMenuEO.setDisplaySeq(treeNode.getOrderNum());
|
||||
// sarFileSplitMenuEO.setCreationUser(userId);
|
||||
// sarFileSplitMenuEO.setModifyUser(userId);
|
||||
// sarFileSplitMenuEO.setValidFlag(0);
|
||||
// sarFileSplitMenuEO.setCreationTime(new Date());
|
||||
// sarFileSplitMenuEO.setModifyTime(new Date());
|
||||
// sarFileSplitMenuEOMapper.insertSelective(sarFileSplitMenuEO);
|
||||
|
||||
SarFileSplitMenu sarFileSplitMenu = new SarFileSplitMenu();
|
||||
sarFileSplitMenu.setId(treeNode.getId());
|
||||
sarFileSplitMenu.setInfoId(infoId);
|
||||
sarFileSplitMenu.setName(treeNode.getName());
|
||||
sarFileSplitMenu.setItemName(treeNode.getItemName());
|
||||
sarFileSplitMenu.setParentId(treeNode.getParentId());
|
||||
sarFileSplitMenu.setDisplaySeq(Math.toIntExact(treeNode.getOrderNum()));
|
||||
sarFileSplitMenu.setCreationUser(userId);
|
||||
sarFileSplitMenu.setModifyUser(userId);
|
||||
sarFileSplitMenu.setValidFlag(0);
|
||||
sarFileSplitMenu.setCreationTime(new Date());
|
||||
sarFileSplitMenu.setModifyTime(new Date());
|
||||
sarFileSplitMenuList.add(sarFileSplitMenu);
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(sarFileSplitMenuList)){
|
||||
batchSaveMenu(sarFileSplitMenuList);
|
||||
}
|
||||
|
||||
long f = System.currentTimeMillis();
|
||||
log.error("================插入菜单耗时:" + (f - e) + "ms");
|
||||
String msg = "";
|
||||
@@ -1868,6 +2087,57 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
}
|
||||
|
||||
private void batchSaveItems(List<LawsDocumentSplit> lawsDocumentSplit) {
|
||||
int size = lawsDocumentSplit.size();
|
||||
int count = (int)Math.ceil((double) size / NUMBER_1);
|
||||
for (int i = 1; i <= count; i++) {
|
||||
List<LawsDocumentSplit> list = lawsDocumentSplit.stream()
|
||||
.skip((long) (Math.max(i, 1) - 1) * NUMBER_1)
|
||||
.limit(NUMBER_1)
|
||||
.collect(Collectors.toList());
|
||||
try {
|
||||
asynService.executeAsynSaveItems(list);
|
||||
} catch (Exception e) {
|
||||
log.error("条款线程异常:"+e.getMessage());
|
||||
throw new JeroBootException(ResultCommon.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void batchSaveMenu(List<SarFileSplitMenu> sarFileSplitMenuList) {
|
||||
int size = sarFileSplitMenuList.size();
|
||||
int count = (int)Math.ceil((double) size / NUMBER_2);
|
||||
for (int i = 1; i <= count; i++) {
|
||||
List<SarFileSplitMenu> list = sarFileSplitMenuList.stream()
|
||||
.skip((long) (Math.max(i, 1) - 1) * NUMBER_2)
|
||||
.limit(NUMBER_2)
|
||||
.collect(Collectors.toList());
|
||||
try {
|
||||
asynService.executeAsynSarFileSplitMenu(list);
|
||||
} catch (Exception e) {
|
||||
log.error("目录线程异常:"+e.getMessage());
|
||||
throw new JeroBootException(ResultCommon.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void batchSaveItemsVal(List<SarFileSplitItemsValEO> addItemValList) {
|
||||
int size = addItemValList.size();
|
||||
int count = (int)Math.ceil((double) size / NUMBER_1);
|
||||
for (int i = 1; i <= count; i++) {
|
||||
List<SarFileSplitItemsValEO> list = addItemValList.stream()
|
||||
.skip((long) (Math.max(i, 1) - 1) * NUMBER_1)
|
||||
.limit(NUMBER_1)
|
||||
.collect(Collectors.toList());
|
||||
try {
|
||||
asynService.executeAsynSaveItemsVal(list);
|
||||
} catch (Exception e) {
|
||||
log.error("条款详情线程异常:"+e.getMessage());
|
||||
throw new JeroBootException(ResultCommon.ERROR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> importSplitItems(MultipartFile file, String cut, String menuId, String infoId, SarFileSplitInfoEO sarFileSplitInfoEO) throws IOException {
|
||||
// 水平越权
|
||||
@@ -3077,7 +3347,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
}
|
||||
}
|
||||
|
||||
private void createItemsInfo(Map<String, Object> sarFileSplitItemsEO, String menuId, String infoId){
|
||||
private void createItemsInfo(Map<String, Object> sarFileSplitItemsEO, String menuId, String infoId, List<SarFileSplitItemsValEO> addItemValList, List<LawsDocumentSplit> lawsDocumentSplit, List<LawsTag> fieldListSelect){
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = sysUser.getId();
|
||||
//创建菜单
|
||||
@@ -3140,7 +3410,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
valEO.setModifyUser(userId);
|
||||
ind++;
|
||||
}
|
||||
sarFileSplitItemsValEOMapper.insertForeach(getValList);
|
||||
// sarFileSplitItemsValEOMapper.insertForeach(getValList);
|
||||
addItemValList.addAll(getValList);
|
||||
sarFileSplitItemsEO.put("item_content", itemConditions);
|
||||
sarFileSplitItemsEO.put("translation", itemConditionsTranslation);
|
||||
}
|
||||
@@ -3153,7 +3424,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
String str = String.valueOf(v);
|
||||
finalSarFileSplitItemsEO.put(k, str.replace("'", "\\'"));
|
||||
});
|
||||
insertInfo2(finalSarFileSplitItemsEO,id,"import"); // 添加条款
|
||||
insertInfo3(finalSarFileSplitItemsEO,id,"import", fieldListSelect, lawsDocumentSplit); // 添加条款
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4033,6 +4304,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
if(preType.equals(type) && "TEXT".equals(type)) {
|
||||
lastOne = valContent.get(valContent.size() - 1);
|
||||
lastOne.setValContent(lastOne.getValContent()+itemsValEO.getItemContent() + "\n");
|
||||
// 添加译文
|
||||
lastOne.setTranslation(lastOne.getTranslation()+itemsValEO.getTranslation() + "\n");
|
||||
valContent.set(valContent.size() - 1, lastOne);
|
||||
|
||||
//循环到最后一次是文本的情况
|
||||
@@ -4042,6 +4315,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
|
||||
} else if ("TEXT".equals(type)) {
|
||||
lastOne.setValContent(StringUtils.isNotEmpty(lastOne.getValContent())? lastOne.getValContent() : "" + itemsValEO.getItemContent() + "\n");
|
||||
// 添加译文
|
||||
lastOne.setTranslation(StringUtils.isNotEmpty(lastOne.getTranslation())? lastOne.getTranslation() : "" + itemsValEO.getTranslation() + "\n");
|
||||
valContent.add(lastOne);
|
||||
|
||||
//第一次
|
||||
@@ -4259,7 +4534,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// String fileName = fileOriName.replace(".zip", "") + ".xls";
|
||||
String fileName = tempPath.replace(".zip", "") + ".xls";
|
||||
// 设置表格相关属性
|
||||
HSSFSheet sheetItems = workbook.createSheet("条文内容");
|
||||
HSSFSheet sheetItems = workbook.createSheet("条款内容");
|
||||
String[] headers = getWorkbookTitleForExport(cut); // 获取表头
|
||||
HSSFCellStyle cellStyle =workbook.createCellStyle();
|
||||
cellStyle.setWrapText(true);
|
||||
@@ -4319,7 +4594,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
cell.setCellValue(text);
|
||||
cell.setCellStyle(cellStyle1);
|
||||
// 设置单元格宽度
|
||||
if("条文内容".equals(headers[i]) || "条文解读".equals(headers[i])) {
|
||||
if("条款内容".equals(headers[i]) || "条文解读".equals(headers[i]) || "译文".equals(headers[i])) {
|
||||
sheetItems.setColumnWidth(i, 80 * 256);
|
||||
} else {
|
||||
sheetItems.setColumnWidth(i, 20 * 256);
|
||||
@@ -4414,7 +4689,8 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
// 条款内容特殊处理
|
||||
HSSFCell cell2 = row1.createCell(cellNum);
|
||||
row1.getCell(cellNum).setCellStyle(cellStyle);
|
||||
String content = (String) exportDto.get(fieldName);
|
||||
// String content = (String) exportDto.get(fieldName);
|
||||
String content = fileSplitValExportDto.getTranslation();
|
||||
if (StringUtils.isNotEmpty(content)) {
|
||||
content = content.replaceAll("null","");
|
||||
content = content.replaceAll("<p>","");
|
||||
@@ -4435,7 +4711,7 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
row1.getCell(cellNum).setCellStyle(cellStyleLink);
|
||||
} else if ("IMG".equals(fileSplitValExportDto.getValType())) {
|
||||
/* 连接跳转*/
|
||||
if (fileSplitValExportDto.isHasImg()) {
|
||||
// if (fileSplitValExportDto.isHasImg()) {
|
||||
content = fileSplitValExportDto.getValContent();
|
||||
content = content.substring(0,content.indexOf("."))+"translation.png";
|
||||
CreationHelper createHelper = workbook.getCreationHelper();
|
||||
@@ -4447,9 +4723,11 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
row1.getCell(cellNum).setCellFormula("HYPERLINK(\"" + ".\\附件\\" + imgName + "\", \"" + "附件/" + imgName + "\")");
|
||||
row1.getCell(cellNum).setCellValue("附件\\" + imgName);
|
||||
row1.getCell(cellNum).setCellStyle(cellStyleLink);
|
||||
}
|
||||
// }
|
||||
}
|
||||
if (!"IMG".equals(fileSplitValExportDto.getValType())){
|
||||
cell2.setCellValue(content); // IllegalArgumentException异常,excel单元格最大字符长度有限制
|
||||
}
|
||||
cell2.setCellValue(content); // IllegalArgumentException异常,excel单元格最大字符长度有限制
|
||||
}
|
||||
else if ("interpretation_articles".equals(fieldName)) {
|
||||
// 条文解读特殊处理
|
||||
|
||||
Reference in New Issue
Block a user