feat: 标准重新拆分2
This commit is contained in:
+2
-1
@@ -496,6 +496,7 @@ public class DocumentSplitController {
|
||||
@ApiOperation(value = "标准拆分详情-查询所有拆分错误的标准")
|
||||
@GetMapping("/fixAllBadSplit")
|
||||
public Result<String> fixAllBadSplit() {
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK), documentSplitService.fixAllBadSplit());
|
||||
documentSplitService.fixAllBadSplit();
|
||||
return Result.OK(MessageUtils.getMessage(ResultCommon.OK));
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -246,5 +246,5 @@ public interface IDocumentSplitService extends IService<LawsDocumentSplit> {
|
||||
*/
|
||||
void deleteBatchTitle(String ids);
|
||||
|
||||
String fixAllBadSplit();
|
||||
void fixAllBadSplit();
|
||||
}
|
||||
|
||||
+222
-209
@@ -106,6 +106,7 @@ import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -158,6 +159,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
private static final String MENU_ID = "menu_id";
|
||||
private static final String CREATE_TIME = "create_time";
|
||||
private static final String SPLIT_STATUS = "split_status";
|
||||
|
||||
public DocumentSplitServiceImpl(DocumentSplitMapper documentSplitMapper,
|
||||
ISarFileSplitInfoService sarFileSplitInfoService,
|
||||
LawsCommonMapper lawsCommonMapper,
|
||||
@@ -223,7 +225,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
}
|
||||
|
||||
private void setData(List<DocumentSplitInfo> data) {
|
||||
if (CollectionUtils.isEmpty(data)){
|
||||
if (CollectionUtils.isEmpty(data)) {
|
||||
return;
|
||||
}
|
||||
// 获取标准信息
|
||||
@@ -238,7 +240,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
List<String> authorList = data.stream().map(DocumentSplitInfo::getAuthor).distinct().collect(Collectors.toList());
|
||||
List<String> createByList = data.stream().map(DocumentSplitInfo::getCreateBy).distinct().collect(Collectors.toList());
|
||||
List<SysUser> sysUserList = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(authorList) || !CollectionUtils.isEmpty(createByList)){
|
||||
if (!CollectionUtils.isEmpty(authorList) || !CollectionUtils.isEmpty(createByList)) {
|
||||
sysUserList = sysUserService.list(
|
||||
new LambdaQueryWrapper<SysUser>()
|
||||
.in(!CollectionUtils.isEmpty(authorList), SysUser::getId, authorList)
|
||||
@@ -247,16 +249,16 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
for (DocumentSplitInfo documentSplitInfo : data) {
|
||||
String standardId = documentSplitInfo.getStandardId();
|
||||
if (StringUtils.isNotBlank(standardId)){
|
||||
if (domesticMap.containsKey(documentSplitInfo.getStandardId())){
|
||||
if (!CollectionUtils.isEmpty(domesticMap.get(standardId))){
|
||||
if (StringUtils.isNotBlank(standardId)) {
|
||||
if (domesticMap.containsKey(documentSplitInfo.getStandardId())) {
|
||||
if (!CollectionUtils.isEmpty(domesticMap.get(standardId))) {
|
||||
LawsDomesticStandard lawsDomesticStandard = domesticMap.get(standardId).get(0);
|
||||
documentSplitInfo.setSerialNumber(lawsDomesticStandard.getStandardNumber());
|
||||
documentSplitInfo.setTitle(lawsDomesticStandard.getStandardName());
|
||||
}
|
||||
documentSplitInfo.setSplitStandardSource("1");
|
||||
}else if (enterpriseMap.containsKey(documentSplitInfo.getStandardId())){
|
||||
if (!CollectionUtils.isEmpty(enterpriseMap.get(standardId))){
|
||||
} else if (enterpriseMap.containsKey(documentSplitInfo.getStandardId())) {
|
||||
if (!CollectionUtils.isEmpty(enterpriseMap.get(standardId))) {
|
||||
LawsEnterpriseStandard lawsEnterpriseStandard = enterpriseMap.get(standardId).get(0);
|
||||
documentSplitInfo.setSerialNumber(lawsEnterpriseStandard.getStandardNumber());
|
||||
documentSplitInfo.setTitle(lawsEnterpriseStandard.getStandardName());
|
||||
@@ -264,7 +266,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
documentSplitInfo.setSplitStandardSource("3");
|
||||
}
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(sysUserList)){
|
||||
if (!CollectionUtils.isEmpty(sysUserList)) {
|
||||
Optional<SysUser> first = sysUserList.stream()
|
||||
.filter(v -> v.getUsername().equals(documentSplitInfo.getCreateBy())).findFirst();
|
||||
first.ifPresent(v -> documentSplitInfo.setCreateBy(v.getId()));
|
||||
@@ -272,7 +274,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
Optional<SysUser> optionalSysUser = sysUserList.stream()
|
||||
.filter(v -> v.getId().equals(documentSplitInfo.getAuthor())).findFirst();
|
||||
optionalSysUser.ifPresent(v -> {
|
||||
if (!"云平台".equals(documentSplitInfo.getAuthor())){
|
||||
if (!"云平台".equals(documentSplitInfo.getAuthor())) {
|
||||
documentSplitInfo.setAuthor(v.calcNameWorkNo());
|
||||
}
|
||||
});
|
||||
@@ -295,9 +297,9 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
LambdaUpdateWrapper<SarFileSplitInfoEO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
List<String> ids;
|
||||
// 获取id集合
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getIds())){
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getIds())) {
|
||||
ids = Arrays.asList(documentSplitInfo.getIds().split(","));
|
||||
}else {
|
||||
} else {
|
||||
List<DocumentSplitInfo> documentSplitInfos = queryByList(documentSplitInfo);
|
||||
ids = documentSplitInfos.stream().map(DocumentSplitInfo::getId).collect(Collectors.toList());
|
||||
}
|
||||
@@ -314,23 +316,24 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
/**
|
||||
* 判断操作权限
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
public void checkOutOperation(List<String> ids) {
|
||||
// 登陆人信息
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (sysUser.getRoleIds().contains("admin")){
|
||||
if (sysUser.getRoleIds().contains("admin")) {
|
||||
return;
|
||||
}
|
||||
List<SarFileSplitInfoEO> sarFileSplitInfoEOS = sarFileSplitInfoService.listByIds(ids);
|
||||
for (SarFileSplitInfoEO sarFileSplitInfoEO : sarFileSplitInfoEOS) {
|
||||
String createBy = sarFileSplitInfoEO.getCreateBy();
|
||||
String author = sarFileSplitInfoEO.getAuthor();
|
||||
if (!sysUser.getUsername().equals(createBy) || !sysUser.getId().equals(author)){
|
||||
if(LanguageEnum.CN.getValue().equals(MessageUtils.getLanguage().getValue())) {
|
||||
if (!sysUser.getUsername().equals(createBy) || !sysUser.getId().equals(author)) {
|
||||
if (LanguageEnum.CN.getValue().equals(MessageUtils.getLanguage().getValue())) {
|
||||
throw new JeroBootException("只能删除有操作权限的数据!");
|
||||
}else{
|
||||
} else {
|
||||
throw new JeroBootException("You can delete only the data that you have permission to operate!");
|
||||
}
|
||||
}
|
||||
@@ -343,7 +346,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
isHorizontalOverstep(parameter.get(INFO_ID).toString());
|
||||
}
|
||||
// 企标权限校验
|
||||
if (parameter.containsKey("serialNumber")){
|
||||
if (parameter.containsKey("serialNumber")) {
|
||||
SarFileSplitInfoEO sarFileSplitInfoEO = new SarFileSplitInfoEO();
|
||||
sarFileSplitInfoEO.setSerialNumber((String) parameter.get("serialNumber"));
|
||||
enterpriseCheck(sarFileSplitInfoEO);
|
||||
@@ -377,7 +380,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
private String orderBy(Map<String, Object> parameter, String selectCondition, List<LawsTag> fieldListSelect) {
|
||||
StringBuilder sb = new StringBuilder(selectCondition);
|
||||
if (parameter.containsKey("column")){
|
||||
if (parameter.containsKey("column")) {
|
||||
sb.append(" order by ");
|
||||
String column = (String) parameter.get("column");
|
||||
String order = (String) parameter.get("order");
|
||||
@@ -385,15 +388,15 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
Optional<LawsTag> lawsTag = fieldListSelect.stream().filter(o -> column.equals(o.getDbFieldName())).findFirst();
|
||||
lawsTag.ifPresent(l -> {
|
||||
// 多日期特殊处理
|
||||
if (LawsFieldTypeEnum.DATE_MANY.getValue().equals(l.getFieldShowType())){
|
||||
if (LawsFieldTypeEnum.DATE_MANY.getValue().equals(l.getFieldShowType())) {
|
||||
sb.append(DocumentSplitCommon.STR_TO_DATE_BEGIN + "substring_index(")
|
||||
.append(l.getDbFieldName()).append(", ',', -1)").append(",'%Y-%m-%d')");
|
||||
}else {
|
||||
} else {
|
||||
sb.append(column);
|
||||
}
|
||||
});
|
||||
sb.append(" ").append(order);
|
||||
}else {
|
||||
} else {
|
||||
// 默认排序
|
||||
sb.append(" order by display_seq asc, sort_number is null, sort_number asc");
|
||||
}
|
||||
@@ -430,10 +433,10 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
for (Map<String, Object> map : records) {
|
||||
for (LawsTag lawsTag : lawsTags) {
|
||||
String dbFieldName = lawsTag.getDbFieldName();
|
||||
if (map.containsKey(dbFieldName)){
|
||||
if (map.containsKey(dbFieldName)) {
|
||||
// 字典查找
|
||||
SysDict sysDict = sysDictService.getById(lawsTag.getDictId());
|
||||
if (!Objects.isNull(sysDict)){
|
||||
if (!Objects.isNull(sysDict)) {
|
||||
setDicText(map, dbFieldName, sysDict);
|
||||
}
|
||||
}
|
||||
@@ -445,13 +448,13 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
private void specialTranslate(Map<String, Object> map) {
|
||||
// 零部件翻译
|
||||
if (map.containsKey("applicable_components")){
|
||||
if (map.containsKey("applicable_components")) {
|
||||
String applicableComponents = (String) map.get("applicable_components");
|
||||
List<PartName> partNames = partNameService.queryEcho(applicableComponents);
|
||||
map.put("applicable_components_dictText", partNames.stream().map(PartName::getName).collect(Collectors.joining(",")));
|
||||
}
|
||||
// 属性标识翻译
|
||||
if (map.containsKey("property_tag")){
|
||||
if (map.containsKey("property_tag")) {
|
||||
String propertyTag = (String) map.get("property_tag");
|
||||
List<LawsLabelDatabase> lawsLabelDatabases = lawsLabelDatabaseService.queryByCodes(propertyTag);
|
||||
map.put("property_tag_dictText", lawsLabelDatabases.stream().map(LawsLabelDatabase::getName).collect(Collectors.joining(",")));
|
||||
@@ -464,7 +467,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
.in(SysDictItem::getItemValue, Arrays.asList(map.get(dbFieldName).toString().split(",")));
|
||||
// 字典值查询
|
||||
List<SysDictItem> list = sysDictItemService.list(queryWrapper);
|
||||
if(!list.isEmpty()){
|
||||
if (!list.isEmpty()) {
|
||||
List<String> itemTextList = list.stream().map(SysDictItem::getItemText).collect(Collectors.toList());
|
||||
map.put(dbFieldName + DocumentSplitCommon.DIC_TEXT, String.join(",", itemTextList));
|
||||
}
|
||||
@@ -481,10 +484,10 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
//拆分
|
||||
int count = fileSpiltService.fileCHN(sarFileSplitInfoEO, SplitFileTypeTypeEnum.GBT);
|
||||
|
||||
if(count == -1){
|
||||
if(LanguageEnum.CN.getValue().equals(MessageUtils.getLanguage().getValue())) {
|
||||
if (count == -1) {
|
||||
if (LanguageEnum.CN.getValue().equals(MessageUtils.getLanguage().getValue())) {
|
||||
throw new JeroBootException("文档格式错误,请检查文档内容!");
|
||||
}else{
|
||||
} else {
|
||||
throw new JeroBootException("The document format is wrong. Please check the document content!");
|
||||
}
|
||||
}
|
||||
@@ -497,7 +500,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 管理员有所有企标的权限
|
||||
List<String> roleIdList = Arrays.asList(sysUser.getRoleIds().split(","));
|
||||
Collection<String> intersection = CollectionUtils.intersection(adminRoleCodeList, roleIdList);
|
||||
if (!intersection.isEmpty()){
|
||||
if (!intersection.isEmpty()) {
|
||||
// 有权限
|
||||
return;
|
||||
}
|
||||
@@ -505,9 +508,9 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
LawsEnterpriseStandard lawsEnterpriseStandard = lawsEnterpriseStandardService.getOne(
|
||||
new LambdaQueryWrapper<LawsEnterpriseStandard>()
|
||||
.eq(LawsEnterpriseStandard::getStandardNumber, sarFileSplitInfoEO.getSerialNumber()));
|
||||
if (!Objects.isNull(lawsEnterpriseStandard)){
|
||||
if (!Objects.isNull(lawsEnterpriseStandard)) {
|
||||
String id = lawsEnterpriseStandard.getId();
|
||||
if (StringUtils.isBlank(sarFileSplitInfoEO.getStandardId())){
|
||||
if (StringUtils.isBlank(sarFileSplitInfoEO.getStandardId())) {
|
||||
sarFileSplitInfoEO.setStandardId(id);
|
||||
}
|
||||
// 登陆人所在部门
|
||||
@@ -530,13 +533,13 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
tempAuthDeptWrapper.isNotNull(EnterpriseStandardAuthDept::getAuthExpireDate);
|
||||
tempAuthDeptWrapper.isNotNull(EnterpriseStandardAuthDept::getAuthDept);
|
||||
List<EnterpriseStandardAuthDept> tempAuthDeptList = enterpriseStandardAuthDeptService.list(tempAuthDeptWrapper);
|
||||
if (!tempAuthDeptList.isEmpty()){
|
||||
if (!tempAuthDeptList.isEmpty()) {
|
||||
// 有权限
|
||||
return;
|
||||
}
|
||||
tempAuthDeptWrapper.ge(EnterpriseStandardAuthDept::getAuthExpireDate, date);
|
||||
List<EnterpriseStandardAuthDept> authDeptExpireDateList = enterpriseStandardAuthDeptService.list(tempAuthDeptWrapper);
|
||||
if (!authDeptExpireDateList.isEmpty()){
|
||||
if (!authDeptExpireDateList.isEmpty()) {
|
||||
// 有权限
|
||||
return;
|
||||
}
|
||||
@@ -564,7 +567,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 临时权限
|
||||
if (authUserList.stream().map(EnterpriseStandardAuthUser::getStandardId).collect(Collectors.toList()).contains(id)) {
|
||||
// 有权限
|
||||
return;
|
||||
return;
|
||||
}
|
||||
// 等级分类
|
||||
String gradeClassification = lawsEnterpriseStandard.getGradeClassification();
|
||||
@@ -601,9 +604,9 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
}
|
||||
|
||||
private void noAccess() {
|
||||
if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
|
||||
if (LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
|
||||
throw new JeroBootException("无权限!");
|
||||
}else{
|
||||
} else {
|
||||
throw new JeroBootException("No access!");
|
||||
}
|
||||
}
|
||||
@@ -629,18 +632,18 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
List<SarFileSplitItemsValEO> articlesList = JSON.parseArray(JSON.toJSONString(parameter.get(INTERPRETATION_ARTICLES_LIST)), SarFileSplitItemsValEO.class);
|
||||
parameter.remove(INTERPRETATION_ARTICLES_LIST);
|
||||
parameter.putIfAbsent(INTERPRETATION_ARTICLES, "");
|
||||
parameter.forEach((k, v) ->{
|
||||
parameter.forEach((k, v) -> {
|
||||
// 条文内容拼接
|
||||
if (ITEM_CONTENT.equals(k)){
|
||||
if (ITEM_CONTENT.equals(k)) {
|
||||
v = itemContentJoin(valList, (String) parameter.get(ID));
|
||||
}
|
||||
// 条文解读
|
||||
if (INTERPRETATION_ARTICLES.equals(k)){
|
||||
if (INTERPRETATION_ARTICLES.equals(k)) {
|
||||
v = articlesJoin(articlesList, (String) parameter.get(ID));
|
||||
}
|
||||
// 修改字段
|
||||
String updateValue = getUpdateValue(finalFieldList, k, (String) v);
|
||||
if (StringUtils.isNotBlank(updateValue)){
|
||||
if (StringUtils.isNotBlank(updateValue)) {
|
||||
updateSet.append(updateValue).append(",");
|
||||
}
|
||||
});
|
||||
@@ -655,7 +658,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
//条文解读更新
|
||||
// 删除旧数据
|
||||
documentSplitMapper.deleteItemsValByItemId((String) parameter.get(ID), DocumentSplitCommon.INTERPRETATION);
|
||||
if (!Objects.isNull(articlesList) && !articlesList.isEmpty()){
|
||||
if (!Objects.isNull(articlesList) && !articlesList.isEmpty()) {
|
||||
// 添加新数据
|
||||
documentSplitMapper.addBatchItemsVal(articlesList);
|
||||
}
|
||||
@@ -663,16 +666,16 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 条目信息更新
|
||||
// 删除旧数据
|
||||
documentSplitMapper.deleteItemsValByItemId((String) parameter.get(ID), "");
|
||||
if (!Objects.isNull(valList) && !valList.isEmpty()){
|
||||
if (!Objects.isNull(valList) && !valList.isEmpty()) {
|
||||
// 添加新数据
|
||||
documentSplitMapper.addBatchItemsVal(valList);
|
||||
}
|
||||
}
|
||||
|
||||
private void mapValueNullToString(Map<String, Object> parameter) {
|
||||
if (parameter!= null){
|
||||
parameter.forEach((k, v) ->{
|
||||
if (Objects.isNull(v)){
|
||||
if (parameter != null) {
|
||||
parameter.forEach((k, v) -> {
|
||||
if (Objects.isNull(v)) {
|
||||
parameter.put(k, "");
|
||||
}
|
||||
});
|
||||
@@ -683,9 +686,9 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
StringBuilder valContent = new StringBuilder();
|
||||
int index = 0;
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
if (!Objects.isNull(articlesList) && !articlesList.isEmpty()){
|
||||
if (!Objects.isNull(articlesList) && !articlesList.isEmpty()) {
|
||||
for (SarFileSplitItemsValEO sarFileSplitItemsValEO : articlesList) {
|
||||
index ++;
|
||||
index++;
|
||||
valContent.append("<p>").append(sarFileSplitItemsValEO.getItemContent()).append("</p>");
|
||||
sarFileSplitItemsValEO.setId(UUIDUtils.randomUUID20());
|
||||
sarFileSplitItemsValEO.setItemId(itemId);
|
||||
@@ -703,13 +706,13 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
private String itemContentJoin(List<SarFileSplitItemsValEO> valList, String itemId) {
|
||||
StringBuilder valContent = new StringBuilder();
|
||||
if (!Objects.isNull(valList) && !valList.isEmpty()){
|
||||
if (!Objects.isNull(valList) && !valList.isEmpty()) {
|
||||
int index = 0;
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
for (SarFileSplitItemsValEO sarFileSplitItemsValEO : valList) {
|
||||
// 条文内容拼接
|
||||
if (DocumentSplitCommon.TEXT.equals(sarFileSplitItemsValEO.getType())) {
|
||||
if (StringUtils.isNotBlank(sarFileSplitItemsValEO.getItemContent())){
|
||||
if (StringUtils.isNotBlank(sarFileSplitItemsValEO.getItemContent())) {
|
||||
sarFileSplitItemsValEO.setItemContent(sarFileSplitItemsValEO.getItemContent()
|
||||
.replace("<", "<").replace(">", ">"));
|
||||
}
|
||||
@@ -743,10 +746,10 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
AtomicReference<String> sql = new AtomicReference<>("");
|
||||
lawsTag.ifPresent(l -> {
|
||||
// 构建修改字段
|
||||
if (LawsFieldTypeEnum.DATE_MANY.getValue().equals(l.getFieldShowType())){
|
||||
if (LawsFieldTypeEnum.DATE_MANY.getValue().equals(l.getFieldShowType())) {
|
||||
// 多日期
|
||||
sql.set(new DateManyConditionImpl().buildUpdate(l.getDbFieldName(), v));
|
||||
}else {
|
||||
} else {
|
||||
sql.set(new UniversalImpl().buildUpdate(l.getDbFieldName(), v));
|
||||
}
|
||||
});
|
||||
@@ -775,12 +778,12 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
parameter.forEach((k, v) -> {
|
||||
// 条文解读
|
||||
if (INTERPRETATION_ARTICLES.equals(k)){
|
||||
if (INTERPRETATION_ARTICLES.equals(k)) {
|
||||
v = articlesJoin(articlesList, (String) parameter.get(ID));
|
||||
}
|
||||
// 修改字段
|
||||
String updateValue = getUpdateValue(finalFieldList, k, (String) v);
|
||||
if (StringUtils.isNotBlank(updateValue)){
|
||||
if (StringUtils.isNotBlank(updateValue)) {
|
||||
updateSet.append(updateValue).append(",");
|
||||
}
|
||||
});
|
||||
@@ -790,11 +793,11 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
updateSet.deleteCharAt(updateSet.length() - 1);
|
||||
// where条件
|
||||
String updateCondition = "";
|
||||
if (parameter.containsKey("ids")){
|
||||
if (parameter.containsKey("ids")) {
|
||||
String ids = (String) parameter.get("ids");
|
||||
List<String> list = Arrays.asList(ids.split(","));
|
||||
updateCondition = "id in ('" + String.join("','", list) + "')";
|
||||
}else {
|
||||
} else {
|
||||
String infoId = (String) parameter.get(INFO_ID);
|
||||
updateCondition = "info_id = " + "'" + infoId + "'";
|
||||
}
|
||||
@@ -803,7 +806,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 条文解读更新
|
||||
// 删除旧数据
|
||||
documentSplitMapper.deleteItemsValByItemIds((String) parameter.get("ids"), DocumentSplitCommon.INTERPRETATION);
|
||||
if (!Objects.isNull(articlesList) && !articlesList.isEmpty()){
|
||||
if (!Objects.isNull(articlesList) && !articlesList.isEmpty()) {
|
||||
// 添加新数据
|
||||
documentSplitMapper.addBatchItemsVal(articlesList);
|
||||
}
|
||||
@@ -843,12 +846,12 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
String content = firstData.get(ITEM_CONTENT) + mergeData(listMap, ITEM_CONTENT);
|
||||
String updateByAndUpdateTime = new UniversalImpl().getUpdateByAndUpdateTime();
|
||||
String updateSet = updateByAndUpdateTime +
|
||||
"," + ITEM_TITLE + " = " + "' "+ title + "'" +
|
||||
"," + ITEM_TITLE + " = " + "' " + title + "'" +
|
||||
"," + ITEM_CONTENT + " = " + "'" + content + "'";
|
||||
String updateCondition = "id = " + "'" + firstData.get(ID) + "'";
|
||||
String updateCondition = "id = " + "'" + firstData.get(ID) + "'";
|
||||
// 修改数据
|
||||
documentSplitMapper.editDocumentSplitDetail(updateSet, updateCondition);
|
||||
List<String> otherIds = listMap.stream().map(v -> (String)v.get(ID)).collect(Collectors.toList());
|
||||
List<String> otherIds = listMap.stream().map(v -> (String) v.get(ID)).collect(Collectors.toList());
|
||||
// 删除旧数据
|
||||
lawsDocumentSplitMapper.deleteBatchIds(otherIds);
|
||||
|
||||
@@ -859,14 +862,14 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (!menuIdList.isEmpty()){
|
||||
if (!menuIdList.isEmpty()) {
|
||||
// 判断被合并条款之前有没有复制过,复制过则不删除相关目录
|
||||
List<LawsDocumentSplit> lawsDocumentSplits = documentSplitMapper.queryLawsDocumentSplitInIds(Collections.singletonList((String) firstData.get(ID)));
|
||||
List<String> menuIds = documentSplitMapper.queryLawsDocumentSplitGroupByMenuId(lawsDocumentSplits.get(0).getInfoId());
|
||||
if (CollectionUtils.isNotEmpty(menuIds)){
|
||||
if (CollectionUtils.isNotEmpty(menuIds)) {
|
||||
menuIdList = menuIdList.stream().filter(v -> !menuIds.contains(v)).collect(Collectors.toList());
|
||||
}
|
||||
if (!menuIdList.isEmpty()){
|
||||
if (!menuIdList.isEmpty()) {
|
||||
// 删除旧数据
|
||||
documentSplitMapper.sarFileSplitMenuDeleteByIdList(menuIdList);
|
||||
}
|
||||
@@ -882,7 +885,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
List<SarFileSplitItemsValEO> sarFileSplitItemsValEOS = documentSplitMapper.queryItemsValByItemId((String) firstData.get(ID), "");
|
||||
// 第一条数据信息的最大的排序字段值
|
||||
Optional<SarFileSplitItemsValEO> sarFileSplitItemsValEOOptional = sarFileSplitItemsValEOS.stream().sorted(Comparator.comparing(v -> Integer.valueOf(String.valueOf(v.getDisplaySeq())))).findFirst();
|
||||
sarFileSplitItemsValEOOptional.ifPresent(v ->{
|
||||
sarFileSplitItemsValEOOptional.ifPresent(v -> {
|
||||
// 排序字段
|
||||
Integer displaySeq = v.getDisplaySeq();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
@@ -895,7 +898,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 修改数据
|
||||
sarFileSplitItemsValEOMapper.updateByPrimaryKeySelective(fileSplitItemsValEO);
|
||||
}
|
||||
} );
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -924,7 +927,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
@Override
|
||||
public void deleteBatchDocumentSplitDetail(Map<String, Object> parameter) {
|
||||
if (parameter.containsKey(IDS)){
|
||||
if (parameter.containsKey(IDS)) {
|
||||
String ids = (String) parameter.get(IDS);
|
||||
String[] list = ids.split(",");
|
||||
for (String id : list) {
|
||||
@@ -981,14 +984,14 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
@Override
|
||||
public List<SarFileSplitItemsValEO> queryItemsValList(String itemId) {
|
||||
List<SarFileSplitItemsValEO> sarFileSplitItemsValEOS = documentSplitMapper.queryItemsValByItemId(itemId, "");
|
||||
if (!Objects.isNull(sarFileSplitItemsValEOS) && !sarFileSplitItemsValEOS.isEmpty()){
|
||||
if (!Objects.isNull(sarFileSplitItemsValEOS) && !sarFileSplitItemsValEOS.isEmpty()) {
|
||||
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);
|
||||
}
|
||||
if (DocumentSplitCommon.TEXT.equals(sarFileSplitItemsValEO.getType()) && org.apache.commons.lang.StringUtils.isNotEmpty(imgPath)){
|
||||
if (DocumentSplitCommon.TEXT.equals(sarFileSplitItemsValEO.getType()) && org.apache.commons.lang.StringUtils.isNotEmpty(imgPath)) {
|
||||
sarFileSplitItemsValEO.setItemContent(HtmlUtils.htmlUnescape(sarFileSplitItemsValEO.getItemContent()));
|
||||
}
|
||||
}
|
||||
@@ -1009,7 +1012,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 水平越权
|
||||
isHorizontalOverstep(request.getParameter("infoId"));
|
||||
|
||||
try (Workbook workbook = new XSSFWorkbook()){
|
||||
try (Workbook workbook = new XSSFWorkbook()) {
|
||||
String fileName = "拆分导入模版下载.xlsx";
|
||||
// sheet页
|
||||
XSSFSheet sheet = (XSSFSheet) workbook.createSheet("拆分导入模版");
|
||||
@@ -1063,37 +1066,36 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
//删除指定文件夹
|
||||
FileUtils.deleteFolders(replacePath);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("下载文件失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* private static void returnOutPutStream(HttpServletResponse response, String fileName, String zipPath) throws IOException {
|
||||
* ServletOutputStream outputStream = null;
|
||||
* try (InputStream in = Files.newInputStream(Paths.get(zipPath));){
|
||||
* response.reset();
|
||||
* response.setContentType("application/ostet-stream");
|
||||
* response.setHeader("content-type", "application/octet-stream");
|
||||
* response.setContentType("application/octet-stream");
|
||||
* response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + new String((fileName + ".zip").getBytes("GB2312"), StandardCharsets.ISO_8859_1));
|
||||
* response.setCharacterEncoding("UTF-8");
|
||||
* outputStream = response.getOutputStream();
|
||||
* //创建存放文件内容的数组
|
||||
* byte[] buff = new byte[1024];
|
||||
* //所读取的内容使用n来接收
|
||||
* int n;
|
||||
* //当没有读取完时,继续读取,循环
|
||||
* while ((n = in.read(buff)) != -1) {
|
||||
* //将字节数组的数据全部写入到输出流中
|
||||
* outputStream.write(buff, 0, n);
|
||||
* }
|
||||
* //强制将缓存区的数据进行输出
|
||||
* outputStream.println();
|
||||
* }
|
||||
* outputStream.close();
|
||||
* }
|
||||
*
|
||||
* private static void returnOutPutStream(HttpServletResponse response, String fileName, String zipPath) throws IOException {
|
||||
* ServletOutputStream outputStream = null;
|
||||
* try (InputStream in = Files.newInputStream(Paths.get(zipPath));){
|
||||
* response.reset();
|
||||
* response.setContentType("application/ostet-stream");
|
||||
* response.setHeader("content-type", "application/octet-stream");
|
||||
* response.setContentType("application/octet-stream");
|
||||
* response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + new String((fileName + ".zip").getBytes("GB2312"), StandardCharsets.ISO_8859_1));
|
||||
* response.setCharacterEncoding("UTF-8");
|
||||
* outputStream = response.getOutputStream();
|
||||
* //创建存放文件内容的数组
|
||||
* byte[] buff = new byte[1024];
|
||||
* //所读取的内容使用n来接收
|
||||
* int n;
|
||||
* //当没有读取完时,继续读取,循环
|
||||
* while ((n = in.read(buff)) != -1) {
|
||||
* //将字节数组的数据全部写入到输出流中
|
||||
* outputStream.write(buff, 0, n);
|
||||
* }
|
||||
* //强制将缓存区的数据进行输出
|
||||
* outputStream.println();
|
||||
* }
|
||||
* outputStream.close();
|
||||
* }
|
||||
*/
|
||||
|
||||
private void generateExcel(Workbook workbook, String fileName, String replacePath) throws IOException {
|
||||
@@ -1105,9 +1107,9 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 生成excel文件路径
|
||||
String excelPath = replacePath + File.separator + fileName;
|
||||
// 写出excel文件
|
||||
try (FileOutputStream fos = new FileOutputStream(excelPath)){
|
||||
try (FileOutputStream fos = new FileOutputStream(excelPath)) {
|
||||
workbook.write(fos);
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1123,7 +1125,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
String id = (String) parameter.get(ID);
|
||||
boolean itemContent = false;
|
||||
// 水平越权
|
||||
if (parameter.containsKey("horizontalOverstep")){
|
||||
if (parameter.containsKey("horizontalOverstep")) {
|
||||
isHorizontalOverstep(id);
|
||||
parameter.remove("horizontalOverstep");
|
||||
}
|
||||
@@ -1131,13 +1133,13 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 文档拆分信息
|
||||
DocumentSplitInfo documentSplitInfo = new DocumentSplitInfo();
|
||||
documentSplitInfo.setId(id);
|
||||
if (parameter.containsKey("publishBeforeId")){
|
||||
if (parameter.containsKey("publishBeforeId")) {
|
||||
documentSplitInfo.setPublishBeforeId((String) parameter.get("publishBeforeId"));
|
||||
}
|
||||
List<DocumentSplitInfo> documentSplitInfos = queryByList(documentSplitInfo);
|
||||
lawsDocumentSplitView.setDocumentSplitInfo(documentSplitInfos.get(0));
|
||||
|
||||
if (parameter.containsKey("item_content")){
|
||||
if (parameter.containsKey("item_content")) {
|
||||
itemContent = true;
|
||||
}
|
||||
// 文档拆分详情
|
||||
@@ -1151,14 +1153,14 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
splitMenuEOPage.setValidFlag("0");
|
||||
splitMenuEOPage.setOrderBy("display_seq");
|
||||
splitMenuEOPage.setInfoId(id);
|
||||
if (itemContent && CollectionUtils.isNotEmpty(documentSplitDetailByList)){
|
||||
if (itemContent && CollectionUtils.isNotEmpty(documentSplitDetailByList)) {
|
||||
List<String> menuId = documentSplitDetailByList.stream()
|
||||
.map(v -> String.valueOf(v.get("menu_id"))).distinct()
|
||||
.collect(Collectors.toList());
|
||||
splitMenuEOPage.setIdList(menuId);
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEOS = sarFileSplitMenuEOService.queryByList(splitMenuEOPage);
|
||||
lawsDocumentSplitView.setSarFileSplitMenuEO(sarFileSplitMenuEOS);
|
||||
}else {
|
||||
} else {
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEOS = sarFileSplitMenuEOService.queryByList(splitMenuEOPage);
|
||||
// 不需要总目录层级
|
||||
lawsDocumentSplitView.setSarFileSplitMenuEO(sarFileSplitMenuEOS.get(0).getChildren());
|
||||
@@ -1166,6 +1168,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
return lawsDocumentSplitView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ProcessProjectAssessTerm> processProjectAssessGetList(String ids) {
|
||||
List<ProcessProjectAssessTerm> processProjectAssessTermList = new ArrayList<>();
|
||||
@@ -1230,7 +1233,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
private void publishs(Map<String, Object> parameter, boolean b) {
|
||||
long l = System.currentTimeMillis();
|
||||
String id = (String) parameter.get(ID);
|
||||
if (b){
|
||||
if (b) {
|
||||
// 水平越权
|
||||
isHorizontalOverstep(id);
|
||||
}
|
||||
@@ -1240,7 +1243,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
SarFileSplitInfoEO sarFileSplitInfoEO = sarFileSplitInfoService.getOne(
|
||||
new QueryWrapper<SarFileSplitInfoEO>().lambda()
|
||||
.eq(SarFileSplitInfoEO::getPublishBeforeId, id));
|
||||
if (!Objects.isNull(sarFileSplitInfoEO)){
|
||||
if (!Objects.isNull(sarFileSplitInfoEO)) {
|
||||
// 删除旧发布数据
|
||||
sarFileSplitInfoService.deleteById(sarFileSplitInfoEO.getId());
|
||||
}
|
||||
@@ -1304,7 +1307,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
});
|
||||
|
||||
List<String> keyList = new ArrayList<>(map.keySet());
|
||||
List<String> valueList = map.values().stream().map(o ->(String.valueOf(o))).collect(Collectors.toList());
|
||||
List<String> valueList = map.values().stream().map(o -> (String.valueOf(o))).collect(Collectors.toList());
|
||||
String insertField = String.join(",", keyList);
|
||||
documentSplitMapper.insertLawsDocumentSplit(insertField, valueList);
|
||||
}
|
||||
@@ -1317,12 +1320,12 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
fileSplitItemsVal.setItemId(oldNewMap.get(fileSplitItemsVal.getItemId()));
|
||||
}
|
||||
batchSaveItemsVal(sarFileSplitItemsVal);
|
||||
log.info("===================================耗时:"+(System.currentTimeMillis() - l));
|
||||
log.info("===================================耗时:" + (System.currentTimeMillis() - l));
|
||||
}
|
||||
|
||||
private void batchSaveItemsVal(List<SarFileSplitItemsVal> allvItemsValList) {
|
||||
int size = allvItemsValList.size();
|
||||
int count = (int)Math.ceil((double) size / NUMBER);
|
||||
int count = (int) Math.ceil((double) size / NUMBER);
|
||||
for (int i = 1; i <= count; i++) {
|
||||
List<SarFileSplitItemsVal> list = allvItemsValList.stream()
|
||||
.skip((long) (Math.max(i, 1) - 1) * NUMBER)
|
||||
@@ -1348,7 +1351,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
@Override
|
||||
public void exportDocumentSplitDetail(Map<String, Object> parameter, HttpServletRequest request, HttpServletResponse response) {
|
||||
try (Workbook workbook = new XSSFWorkbook()){
|
||||
try (Workbook workbook = new XSSFWorkbook()) {
|
||||
// 文档拆分详情数据
|
||||
List<Map<String, Object>> mapList = queryDocumentSplitDetailByList(parameter);
|
||||
// 创建工作簿
|
||||
@@ -1357,7 +1360,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
Sheet sheet = workbook.createSheet("条文内容");
|
||||
// 字段名
|
||||
List<String> keyList = new ArrayList<>();
|
||||
if(!Objects.isNull(mapList) && !mapList.isEmpty()){
|
||||
if (!Objects.isNull(mapList) && !mapList.isEmpty()) {
|
||||
Map<String, Object> map = mapList.get(0);
|
||||
keyList = map.entrySet().stream().map(Map.Entry::getKey).collect(Collectors.toList());
|
||||
}
|
||||
@@ -1385,13 +1388,13 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
cell.setCellValue(new XSSFRichTextString(keyList.get(i)));
|
||||
cell.setCellStyle(cellStyleOne);
|
||||
|
||||
if("条文内容".equals(keyList.get(i))) {
|
||||
if ("条文内容".equals(keyList.get(i))) {
|
||||
sheet.setColumnWidth(i, 80 * 256);
|
||||
} else {
|
||||
sheet.setColumnWidth(i, 20 * 256);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("导出失败!");
|
||||
}
|
||||
}
|
||||
@@ -1407,10 +1410,10 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
queryWrapper.isNotNull("o.standard_id");
|
||||
queryWrapper.orderByDesc(CREATE_TIME);
|
||||
queryWrapper.eq(StringUtils.isNotBlank(splitFileInfo.getStandardSplitStatus()), "standard.standard_split_status", splitFileInfo.getStandardSplitStatus());
|
||||
if (StringUtils.isNotBlank(splitFileInfo.getEsMainDraftUnit())){
|
||||
if (StringUtils.isNotBlank(splitFileInfo.getEsMainDraftUnit())) {
|
||||
queryWrapper.in("esMainDraftUnit", Arrays.asList(splitFileInfo.getEsMainDraftUnit().split(",")));
|
||||
}
|
||||
if (StringUtils.isNotBlank(splitFileInfo.getIds())){
|
||||
if (StringUtils.isNotBlank(splitFileInfo.getIds())) {
|
||||
queryWrapper.in("o.id", Arrays.asList(splitFileInfo.getIds().split(",")));
|
||||
}
|
||||
return documentSplitMapper.querySplitFileInfoByPage(queryWrapper, new Page<>(pageNo, pageSize));
|
||||
@@ -1427,7 +1430,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
splitMenuEOPage.setInfoId(infoId);
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEOS = sarFileSplitMenuEOService.queryByList(splitMenuEOPage);
|
||||
|
||||
if (!sarFileSplitMenuEOS.isEmpty() && !Objects.isNull(sarFileSplitMenuEOS.get(0).getChildren())){
|
||||
if (!sarFileSplitMenuEOS.isEmpty() && !Objects.isNull(sarFileSplitMenuEOS.get(0).getChildren())) {
|
||||
return sarFileSplitMenuEOS.get(0).getChildren();
|
||||
}
|
||||
return new ArrayList<>();
|
||||
@@ -1439,7 +1442,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 未发布的只有自己可见,发布的数据所有人可见
|
||||
String roleIds = loginUser.getRoleIds();
|
||||
QueryWrapper<SarFileSplitInfoEO> queryWrapper = new QueryWrapper<>();
|
||||
if (StringUtils.isBlank(ids)){
|
||||
if (StringUtils.isBlank(ids)) {
|
||||
return;
|
||||
}
|
||||
List<String> idList = Arrays.asList(ids.split(","));
|
||||
@@ -1493,13 +1496,13 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
sarFileSplitInfoService.updateStandardSplitStatus(sarFileSplitInfoEO.getStandardId(), DocumentSplitCommon.STANDARD_SPLIT_STATUS1);
|
||||
// 提交事务
|
||||
dataSourceTransactionManager.commit(transaction);
|
||||
}catch (JeroBootException e){
|
||||
} catch (JeroBootException e) {
|
||||
// 回滚事务
|
||||
dataSourceTransactionManager.rollback(transaction);
|
||||
errorList.add("标准编号为:" + fileInfo.getStandardNumber() + " " + e.getMessage());
|
||||
}
|
||||
}
|
||||
if (!errorList.isEmpty()){
|
||||
if (!errorList.isEmpty()) {
|
||||
throw new JeroBootException(String.join("<br/>", errorList));
|
||||
}
|
||||
}
|
||||
@@ -1521,10 +1524,10 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
sarFileSplitItemsValEOMapper.deleteByitemId(lawsDocumentSplit.getId());
|
||||
|
||||
// 构建新条文详情
|
||||
if (StringUtils.isNotBlank(lawsDocumentSplit.getItemContent())){
|
||||
if (StringUtils.isNotBlank(lawsDocumentSplit.getItemContent())) {
|
||||
Document document = Jsoup.parse(lawsDocumentSplit.getItemContent());
|
||||
Elements elements = document.select("p:not(table p):not(:empty), img, table");
|
||||
if (elements.isEmpty() && StringUtils.isNotBlank(lawsDocumentSplit.getItemContent())){
|
||||
if (elements.isEmpty() && StringUtils.isNotBlank(lawsDocumentSplit.getItemContent())) {
|
||||
SarFileSplitItemsValEO sarFileSplitItemsValEO = new SarFileSplitItemsValEO();
|
||||
sarFileSplitItemsValEO.setId(UUIDUtils.randomUUID20());
|
||||
sarFileSplitItemsValEO.setItemId(lawsDocumentSplit.getId());
|
||||
@@ -1537,17 +1540,17 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
}
|
||||
for (int i = 0; i < elements.size(); i++) {
|
||||
Element element = elements.get(i);
|
||||
if (StringUtils.isBlank(element.text()) && "p".equals(element.tagName())){
|
||||
if (StringUtils.isBlank(element.text()) && "p".equals(element.tagName())) {
|
||||
continue;
|
||||
}
|
||||
SarFileSplitItemsValEO sarFileSplitItemsValEO = new SarFileSplitItemsValEO();
|
||||
if ("table".equals(element.tagName())){
|
||||
if ("table".equals(element.tagName())) {
|
||||
sarFileSplitItemsValEO.setType("TABLE");
|
||||
sarFileSplitItemsValEO.setItemContent(element.outerHtml());
|
||||
}else if ("img".equals(element.tagName())){
|
||||
} else if ("img".equals(element.tagName())) {
|
||||
sarFileSplitItemsValEO.setType("IMG");
|
||||
sarFileSplitItemsValEO.setItemContent(element.attr("src"));
|
||||
}else if ("p".equals(element.tagName())){
|
||||
} else if ("p".equals(element.tagName())) {
|
||||
sarFileSplitItemsValEO.setType("TEXT");
|
||||
sarFileSplitItemsValEO.setItemContent(element.text());
|
||||
}
|
||||
@@ -1567,7 +1570,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
public String queryItemValueByMenuId(String menuId) {
|
||||
LawsDocumentSplit lawsDocumentSplit = documentSplitMapper.selectOne(new LambdaQueryWrapper<LawsDocumentSplit>()
|
||||
.eq(LawsDocumentSplit::getMenuId, menuId));
|
||||
if (!Objects.isNull(lawsDocumentSplit)){
|
||||
if (!Objects.isNull(lawsDocumentSplit)) {
|
||||
SarFileSplitItemsValEO sarFileSplitItemsValEO = new SarFileSplitItemsValEO();
|
||||
sarFileSplitItemsValEO.setItemId(lawsDocumentSplit.getId());
|
||||
sarFileSplitItemsValEO.setType("TEXT");
|
||||
@@ -1634,10 +1637,10 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
documentSplitInfo.setSerialNumber(sarFileSplitInfoEO.getSerialNumber());
|
||||
documentSplitInfo.setFileType(sarFileSplitInfoEO.getFileType());
|
||||
List<DocumentSplitInfo> list = queryByList(documentSplitInfo);
|
||||
if(!list.isEmpty()){
|
||||
if(LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
|
||||
if (!list.isEmpty()) {
|
||||
if (LanguageEnum.CN.equals(MessageUtils.getLanguage())) {
|
||||
throw new JeroBootException("每个文件类型只能拆分一次!");
|
||||
}else{
|
||||
} else {
|
||||
throw new JeroBootException("Each file type can only be split once!");
|
||||
}
|
||||
}
|
||||
@@ -1651,11 +1654,11 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
selectColumn.append(",");
|
||||
selectColumn.append(DocumentSplitCommon.IF_NULL_BEGIN);
|
||||
// 日期字段需要格式化
|
||||
if (LawsFieldTypeEnum.DATE_SINGLE.getValue().equals(lawsTag.getDbFieldName())){
|
||||
if (LawsFieldTypeEnum.DATE_SINGLE.getValue().equals(lawsTag.getDbFieldName())) {
|
||||
selectColumn.append(DocumentSplitCommon.DATE_FORMAT_BEGIN)
|
||||
.append(lawsTag.getDbFieldName())
|
||||
.append(DocumentSplitCommon.DATE_FORMAT_END);
|
||||
}else {
|
||||
} else {
|
||||
// 普通字段直接拼接
|
||||
selectColumn.append(lawsTag.getDbFieldName());
|
||||
}
|
||||
@@ -1689,36 +1692,36 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
}
|
||||
|
||||
private void defaultCondition(Map<String, Object> parameter, StringBuilder selectCondition) {
|
||||
if (parameter.containsKey(ID)){
|
||||
if (parameter.containsKey(ID)) {
|
||||
selectCondition.append(" and s.id = '").append(parameter.get(ID)).append("'");
|
||||
parameter.remove(ID);
|
||||
}
|
||||
if (parameter.containsKey(INFO_ID)){
|
||||
if (parameter.containsKey(INFO_ID)) {
|
||||
selectCondition.append(" and s.info_id = '").append(parameter.get(INFO_ID)).append("'");
|
||||
parameter.remove(INFO_ID);
|
||||
}
|
||||
if (parameter.containsKey(ITEM_NUM)){
|
||||
if (parameter.containsKey(ITEM_NUM)) {
|
||||
selectCondition.append(" and item_num = '").append(parameter.get(ITEM_NUM)).append("'");
|
||||
parameter.remove(ITEM_NUM);
|
||||
}
|
||||
if (parameter.containsKey(ITEM_TITLE)){
|
||||
if (parameter.containsKey(ITEM_TITLE)) {
|
||||
// 模糊匹配
|
||||
selectCondition.append(likeCondition(ITEM_TITLE, (String) parameter.get(ITEM_TITLE)));
|
||||
parameter.remove(ITEM_TITLE);
|
||||
}
|
||||
if (parameter.containsKey(ITEM_CONTENT)){
|
||||
if (parameter.containsKey(ITEM_CONTENT)) {
|
||||
// 模糊匹配
|
||||
selectCondition.append(likeCondition(ITEM_CONTENT, (String) parameter.get(ITEM_CONTENT)));
|
||||
parameter.remove(ITEM_CONTENT);
|
||||
}
|
||||
// 树节点搜索
|
||||
if (parameter.containsKey(MENU_ID)){
|
||||
if (parameter.containsKey(MENU_ID)) {
|
||||
// 查询此节点下的所有子节点
|
||||
SarFileSplitMenuEO sarFileSplitMenuEO = new SarFileSplitMenuEO();
|
||||
sarFileSplitMenuEO.setId( (String) parameter.get(MENU_ID));
|
||||
sarFileSplitMenuEO.setId((String) parameter.get(MENU_ID));
|
||||
List<SarFileSplitMenuEO> sarFileSplitMenuEOS = sarFileSplitMenuEOService.queryAllChildrenById(sarFileSplitMenuEO);
|
||||
if (!sarFileSplitMenuEOS.isEmpty()){
|
||||
String menuIds= sarFileSplitMenuEOS.stream()
|
||||
if (!sarFileSplitMenuEOS.isEmpty()) {
|
||||
String menuIds = sarFileSplitMenuEOS.stream()
|
||||
.map(SarFileSplitMenuEO::getId)
|
||||
.collect(Collectors.joining("','"));
|
||||
// in查询
|
||||
@@ -1730,13 +1733,14 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
|
||||
/**
|
||||
* 模糊查询
|
||||
*
|
||||
* @param fieldName
|
||||
* @param value
|
||||
* @return 返回数据样例 and fieldName like '%value%'
|
||||
*/
|
||||
private String likeCondition(String fieldName, String value) {
|
||||
return DocumentSplitCommon.AND + fieldName + DocumentSplitCommon.LIKE +
|
||||
DocumentSplitCommon.CONCAT_LIKE_BEGIN + value + DocumentSplitCommon.CONCAT_LIKE_END;
|
||||
DocumentSplitCommon.CONCAT_LIKE_BEGIN + value + DocumentSplitCommon.CONCAT_LIKE_END;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -1764,7 +1768,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
}
|
||||
}
|
||||
// 标准编号
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getSerialNumber())){
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getSerialNumber())) {
|
||||
List<LawsDomesticStandard> lawsDomesticStandardList = lawsDomesticStandardService.list(
|
||||
new LambdaQueryWrapper<LawsDomesticStandard>()
|
||||
.like(LawsDomesticStandard::getStandardNumber, documentSplitInfo.getSerialNumber()));
|
||||
@@ -1782,7 +1786,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
}
|
||||
}
|
||||
// 标准名称
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getTitle())){
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getTitle())) {
|
||||
List<LawsDomesticStandard> lawsDomesticStandardList = lawsDomesticStandardService.list(
|
||||
new LambdaQueryWrapper<LawsDomesticStandard>()
|
||||
.like(LawsDomesticStandard::getStandardName, documentSplitInfo.getTitle()));
|
||||
@@ -1804,18 +1808,18 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
// 拆分状态
|
||||
queryWrapper.eq(StringUtils.isNotBlank(documentSplitInfo.getSplitStatus()), SPLIT_STATUS, documentSplitInfo.getSplitStatus());
|
||||
// 编辑人
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getAuthor())){
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getAuthor())) {
|
||||
List<SysUser> sysUserList = sysUserService.list(new LambdaQueryWrapper<SysUser>().like(SysUser::getRealname, documentSplitInfo.getAuthor()));
|
||||
List<String> sysUserIdList = sysUserList.stream().map(SysUser::getId).collect(Collectors.toList());
|
||||
queryWrapper.and(qw ->
|
||||
qw.in("author", sysUserIdList)
|
||||
.or().eq("云平台".contains(documentSplitInfo.getAuthor()), "author", "云平台")
|
||||
qw.in("author", sysUserIdList)
|
||||
.or().eq("云平台".contains(documentSplitInfo.getAuthor()), "author", "云平台")
|
||||
);
|
||||
}
|
||||
// 发布前id
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getPublishBeforeId())){
|
||||
if (StringUtils.isNotBlank(documentSplitInfo.getPublishBeforeId())) {
|
||||
queryWrapper.eq("publish_before_id", documentSplitInfo.getPublishBeforeId());
|
||||
}else {
|
||||
} else {
|
||||
queryWrapper.isNull("publish_before_id");
|
||||
}
|
||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
@@ -1825,7 +1829,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
qw.and(qwi -> qwi.eq(SPLIT_STATUS, DocumentSplitCommon.SPLIT_STATUS1)
|
||||
.eq("author", loginUser.getId()))
|
||||
.or().eq(SPLIT_STATUS, DocumentSplitCommon.SPLIT_STATUS2)
|
||||
.or().eq(roleIds.contains("admin"), "author", "云平台"));
|
||||
.or().eq(roleIds.contains("admin"), "author", "云平台"));
|
||||
// 逻辑删除
|
||||
queryWrapper.eq("del_flag", 0);
|
||||
// 排序
|
||||
@@ -1834,72 +1838,81 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String fixAllBadSplit() {
|
||||
List<SarFileSplitItemsValEO> list = sarFileSplitItemsValEOService.list();
|
||||
Map<String, List<SarFileSplitItemsValEO>> valMap = list.stream().collect(Collectors.groupingBy(SarFileSplitItemsValEO::getItemId));
|
||||
List<SarFileSplitItemsValEO> imageOneList = list.stream().filter(val -> val.getItemContent().startsWith("图1")).collect(Collectors.toList());
|
||||
ConcurrentLinkedQueue<String> itemIdList = new ConcurrentLinkedQueue<>();
|
||||
imageOneList.stream().parallel().forEach(one -> {
|
||||
List<SarFileSplitItemsValEO> vals = valMap.get(one.getItemId());
|
||||
if (vals.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, List<SarFileSplitItemsValEO>> orderMap = vals.stream().collect(Collectors.groupingBy(SarFileSplitItemsValEO::getDisplaySeq));
|
||||
List<SarFileSplitItemsValEO> imageList = orderMap.get(one.getDisplaySeq() - 1);
|
||||
if (imageList == null || imageList.isEmpty()) {
|
||||
itemIdList.add(one.getItemId());
|
||||
return;
|
||||
}
|
||||
SarFileSplitItemsValEO image = imageList.get(0);
|
||||
if (!image.getType().equals("IMG")) {
|
||||
itemIdList.add(one.getItemId());
|
||||
}
|
||||
});
|
||||
public void fixAllBadSplit() {
|
||||
CompletableFuture.runAsync(() -> {
|
||||
List<SarFileSplitItemsValEO> list = sarFileSplitItemsValEOService.list();
|
||||
Map<String, List<SarFileSplitItemsValEO>> valMap = list.stream().collect(Collectors.groupingBy(SarFileSplitItemsValEO::getItemId));
|
||||
List<SarFileSplitItemsValEO> imageOneList = list.stream().filter(val -> val.getItemContent().startsWith("图1")).collect(Collectors.toList());
|
||||
ConcurrentLinkedQueue<String> itemIdList = new ConcurrentLinkedQueue<>();
|
||||
imageOneList.stream().parallel().forEach(one -> {
|
||||
List<SarFileSplitItemsValEO> vals = valMap.get(one.getItemId());
|
||||
if (vals.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, List<SarFileSplitItemsValEO>> orderMap = vals.stream().collect(Collectors.groupingBy(SarFileSplitItemsValEO::getDisplaySeq));
|
||||
List<SarFileSplitItemsValEO> imageList = orderMap.get(one.getDisplaySeq() - 1);
|
||||
if (imageList == null || imageList.isEmpty()) {
|
||||
itemIdList.add(one.getItemId());
|
||||
return;
|
||||
}
|
||||
SarFileSplitItemsValEO image = imageList.get(0);
|
||||
if (!image.getType().equals("IMG")) {
|
||||
itemIdList.add(one.getItemId());
|
||||
}
|
||||
});
|
||||
|
||||
// 找到所有infoId
|
||||
LambdaQueryWrapper<LawsDocumentSplit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(LawsDocumentSplit::getId, itemIdList);
|
||||
List<LawsDocumentSplit> documentSplistList = documentSplitService.list(lambdaQueryWrapper);
|
||||
Set<String> infoIdList = documentSplistList.stream()
|
||||
.map(LawsDocumentSplit::getInfoId).collect(Collectors.toSet());
|
||||
// 找到所有infoId
|
||||
LambdaQueryWrapper<LawsDocumentSplit> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(LawsDocumentSplit::getId, itemIdList);
|
||||
List<LawsDocumentSplit> documentSplistList = documentSplitService.list(lambdaQueryWrapper);
|
||||
Set<String> infoIdList = documentSplistList.stream()
|
||||
.map(LawsDocumentSplit::getInfoId).collect(Collectors.toSet());
|
||||
|
||||
// 找到所有info 并打印所有标准编号 和splitId
|
||||
List<LawsEnterpriseStandard> esList = esService.list();
|
||||
List<String> esStandardNoList = esList.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<SarFileSplitInfoEO> infoEOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
infoEOLambdaQueryWrapper.in(SarFileSplitInfoEO::getSerialNumber, esStandardNoList);
|
||||
infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getDelFlag, YesOrNoEnum.NO.getValue());
|
||||
infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getSplitResult, "成功");
|
||||
infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getSplitStatus, "2");
|
||||
infoEOLambdaQueryWrapper.in(SarFileSplitInfoEO::getId, infoIdList);
|
||||
// 找到所有info 并打印所有标准编号 和splitId
|
||||
List<LawsEnterpriseStandard> esList = esService.list();
|
||||
List<String> esStandardNoList = esList.stream().map(LawsEnterpriseStandard::getStandardNumber).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<SarFileSplitInfoEO> infoEOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
infoEOLambdaQueryWrapper.in(SarFileSplitInfoEO::getSerialNumber, esStandardNoList);
|
||||
infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getDelFlag, YesOrNoEnum.NO.getValue());
|
||||
infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getSplitResult, "成功");
|
||||
infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getSplitStatus, "2");
|
||||
infoEOLambdaQueryWrapper.in(SarFileSplitInfoEO::getId, infoIdList);
|
||||
// infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getId, "19e6041480f8469bb9c2e09487ed8770");
|
||||
List<SarFileSplitInfoEO> infoList = sarFileSplitInfoService.list(infoEOLambdaQueryWrapper);
|
||||
log.info("共发现{}条没有拆出图片的企标", infoList.size());
|
||||
// 开始重新拆分
|
||||
int count = 1;
|
||||
List<String> failedList = new ArrayList<>();
|
||||
for (SarFileSplitInfoEO info : infoList) {
|
||||
try {
|
||||
log.info("正在处理第{}条,企标编号{}", count, info.getSerialNumber());
|
||||
String fileId = info.getFileId();
|
||||
String infoId = info.getId();
|
||||
String author = info.getAuthor();
|
||||
// 删除拆分记录
|
||||
sarFileSplitInfoService.deleteByIds(Collections.singletonList(infoId));
|
||||
// 重新拆分
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("ids", fileId);
|
||||
documentSplitService.batchSplit(jsonObject, author);
|
||||
log.info("第{}条处理完毕", count++);
|
||||
} catch (Exception e) {
|
||||
log.info("第{}条处理失败", count++);
|
||||
failedList.add(info.getId());
|
||||
List<SarFileSplitInfoEO> infoList = sarFileSplitInfoService.list(infoEOLambdaQueryWrapper);
|
||||
// 根据fileId去重
|
||||
long needSplit = infoList.stream().collect(Collectors.groupingBy(SarFileSplitInfoEO::getFileId)).entrySet().stream().count();
|
||||
log.info("共发现{}条没有拆出图片的企标", needSplit);
|
||||
// 开始重新拆分
|
||||
List<String> failedList = new ArrayList<>();
|
||||
Map<String, String> alreadySplitMap = new HashMap<>();
|
||||
for (int i = 0; i < infoList.size(); i++) {
|
||||
SarFileSplitInfoEO info = infoList.get(i);
|
||||
try {
|
||||
log.info("正在处理第{}条,企标编号{}", i, info.getSerialNumber());
|
||||
String fileId = info.getFileId();
|
||||
String infoId = info.getId();
|
||||
String author = info.getAuthor();
|
||||
// 删除拆分记录
|
||||
sarFileSplitInfoService.deleteByIds(Collections.singletonList(infoId));
|
||||
// 重新拆分
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("ids", fileId);
|
||||
String s = alreadySplitMap.get(fileId);
|
||||
if (s != null) {
|
||||
log.info("该企标已经拆分过了,跳过{}", fileId);
|
||||
continue;
|
||||
}
|
||||
alreadySplitMap.put(fileId, "split");
|
||||
documentSplitService.batchSplit(jsonObject, author);
|
||||
log.info("第{}条处理完毕", i);
|
||||
} catch (Exception e) {
|
||||
log.info("第{}条处理失败", i);
|
||||
failedList.add(info.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 将失败的标准编号打印出来,逗号拼接
|
||||
log.error("企标拆分失败企标编号:{}", StringUtils.join(failedList, ","));
|
||||
return failedList.size() + "条企标拆分失败";
|
||||
// 将失败的标准编号打印出来,逗号拼接
|
||||
log.error("企标拆分失败企标编号:{}", StringUtils.join(failedList, ","));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user