feat: 标准重新拆分2
This commit is contained in:
+2
-1
@@ -496,6 +496,7 @@ public class DocumentSplitController {
|
|||||||
@ApiOperation(value = "标准拆分详情-查询所有拆分错误的标准")
|
@ApiOperation(value = "标准拆分详情-查询所有拆分错误的标准")
|
||||||
@GetMapping("/fixAllBadSplit")
|
@GetMapping("/fixAllBadSplit")
|
||||||
public Result<String> 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);
|
void deleteBatchTitle(String ids);
|
||||||
|
|
||||||
String fixAllBadSplit();
|
void fixAllBadSplit();
|
||||||
}
|
}
|
||||||
|
|||||||
+23
-10
@@ -106,6 +106,7 @@ import java.io.FileOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
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 MENU_ID = "menu_id";
|
||||||
private static final String CREATE_TIME = "create_time";
|
private static final String CREATE_TIME = "create_time";
|
||||||
private static final String SPLIT_STATUS = "split_status";
|
private static final String SPLIT_STATUS = "split_status";
|
||||||
|
|
||||||
public DocumentSplitServiceImpl(DocumentSplitMapper documentSplitMapper,
|
public DocumentSplitServiceImpl(DocumentSplitMapper documentSplitMapper,
|
||||||
ISarFileSplitInfoService sarFileSplitInfoService,
|
ISarFileSplitInfoService sarFileSplitInfoService,
|
||||||
LawsCommonMapper lawsCommonMapper,
|
LawsCommonMapper lawsCommonMapper,
|
||||||
@@ -314,6 +316,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断操作权限
|
* 判断操作权限
|
||||||
|
*
|
||||||
* @param ids
|
* @param ids
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@@ -1093,7 +1096,6 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
|||||||
* }
|
* }
|
||||||
* outputStream.close();
|
* outputStream.close();
|
||||||
* }
|
* }
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void generateExcel(Workbook workbook, String fileName, String replacePath) throws IOException {
|
private void generateExcel(Workbook workbook, String fileName, String replacePath) throws IOException {
|
||||||
@@ -1166,6 +1168,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
|||||||
|
|
||||||
return lawsDocumentSplitView;
|
return lawsDocumentSplitView;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ProcessProjectAssessTerm> processProjectAssessGetList(String ids) {
|
public List<ProcessProjectAssessTerm> processProjectAssessGetList(String ids) {
|
||||||
List<ProcessProjectAssessTerm> processProjectAssessTermList = new ArrayList<>();
|
List<ProcessProjectAssessTerm> processProjectAssessTermList = new ArrayList<>();
|
||||||
@@ -1730,6 +1733,7 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 模糊查询
|
* 模糊查询
|
||||||
|
*
|
||||||
* @param fieldName
|
* @param fieldName
|
||||||
* @param value
|
* @param value
|
||||||
* @return 返回数据样例 and fieldName like '%value%'
|
* @return 返回数据样例 and fieldName like '%value%'
|
||||||
@@ -1834,9 +1838,9 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String fixAllBadSplit() {
|
public void fixAllBadSplit() {
|
||||||
|
CompletableFuture.runAsync(() -> {
|
||||||
List<SarFileSplitItemsValEO> list = sarFileSplitItemsValEOService.list();
|
List<SarFileSplitItemsValEO> list = sarFileSplitItemsValEOService.list();
|
||||||
Map<String, List<SarFileSplitItemsValEO>> valMap = list.stream().collect(Collectors.groupingBy(SarFileSplitItemsValEO::getItemId));
|
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());
|
List<SarFileSplitItemsValEO> imageOneList = list.stream().filter(val -> val.getItemContent().startsWith("图1")).collect(Collectors.toList());
|
||||||
@@ -1876,13 +1880,16 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
|||||||
infoEOLambdaQueryWrapper.in(SarFileSplitInfoEO::getId, infoIdList);
|
infoEOLambdaQueryWrapper.in(SarFileSplitInfoEO::getId, infoIdList);
|
||||||
// infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getId, "19e6041480f8469bb9c2e09487ed8770");
|
// infoEOLambdaQueryWrapper.eq(SarFileSplitInfoEO::getId, "19e6041480f8469bb9c2e09487ed8770");
|
||||||
List<SarFileSplitInfoEO> infoList = sarFileSplitInfoService.list(infoEOLambdaQueryWrapper);
|
List<SarFileSplitInfoEO> infoList = sarFileSplitInfoService.list(infoEOLambdaQueryWrapper);
|
||||||
log.info("共发现{}条没有拆出图片的企标", infoList.size());
|
// 根据fileId去重
|
||||||
|
long needSplit = infoList.stream().collect(Collectors.groupingBy(SarFileSplitInfoEO::getFileId)).entrySet().stream().count();
|
||||||
|
log.info("共发现{}条没有拆出图片的企标", needSplit);
|
||||||
// 开始重新拆分
|
// 开始重新拆分
|
||||||
int count = 1;
|
|
||||||
List<String> failedList = new ArrayList<>();
|
List<String> failedList = new ArrayList<>();
|
||||||
for (SarFileSplitInfoEO info : infoList) {
|
Map<String, String> alreadySplitMap = new HashMap<>();
|
||||||
|
for (int i = 0; i < infoList.size(); i++) {
|
||||||
|
SarFileSplitInfoEO info = infoList.get(i);
|
||||||
try {
|
try {
|
||||||
log.info("正在处理第{}条,企标编号{}", count, info.getSerialNumber());
|
log.info("正在处理第{}条,企标编号{}", i, info.getSerialNumber());
|
||||||
String fileId = info.getFileId();
|
String fileId = info.getFileId();
|
||||||
String infoId = info.getId();
|
String infoId = info.getId();
|
||||||
String author = info.getAuthor();
|
String author = info.getAuthor();
|
||||||
@@ -1891,15 +1898,21 @@ public class DocumentSplitServiceImpl extends ServiceImpl<DocumentSplitMapper, L
|
|||||||
// 重新拆分
|
// 重新拆分
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("ids", fileId);
|
jsonObject.put("ids", fileId);
|
||||||
|
String s = alreadySplitMap.get(fileId);
|
||||||
|
if (s != null) {
|
||||||
|
log.info("该企标已经拆分过了,跳过{}", fileId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
alreadySplitMap.put(fileId, "split");
|
||||||
documentSplitService.batchSplit(jsonObject, author);
|
documentSplitService.batchSplit(jsonObject, author);
|
||||||
log.info("第{}条处理完毕", count++);
|
log.info("第{}条处理完毕", i);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("第{}条处理失败", count++);
|
log.info("第{}条处理失败", i);
|
||||||
failedList.add(info.getId());
|
failedList.add(info.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 将失败的标准编号打印出来,逗号拼接
|
// 将失败的标准编号打印出来,逗号拼接
|
||||||
log.error("企标拆分失败企标编号:{}", StringUtils.join(failedList, ","));
|
log.error("企标拆分失败企标编号:{}", StringUtils.join(failedList, ","));
|
||||||
return failedList.size() + "条企标拆分失败";
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user