feat 解决冲突
This commit is contained in:
+125
-116
@@ -10,7 +10,6 @@ import com.adc.da.person.dao.PersonCollectEODao;
|
||||
import com.adc.da.person.dao.PersonShareEODao;
|
||||
import com.adc.da.person.entity.PersonMsgEO;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.search.service.StandLawsSearchService;
|
||||
import com.adc.da.slrs.sarLawsInfo.entity.SarLawsInfo;
|
||||
import com.adc.da.slrs.sarLawsInfo.page.SarLawsInfoEOPage;
|
||||
import com.adc.da.slrs.sarLawsInfo.page.SarLawsItemsEOPage;
|
||||
@@ -160,8 +159,8 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
@Autowired
|
||||
private SysInfoEOService sysInfoEOService;
|
||||
|
||||
@Autowired
|
||||
private StandLawsSearchService standLawsSearchService;
|
||||
// @Autowired
|
||||
// private StandLawsSearchService standLawsSearchService;
|
||||
|
||||
@Value("${file.path}")
|
||||
private String filePath;//文件存储路径
|
||||
@@ -1871,124 +1870,134 @@ public class SarStandardsInfoServiceImpl extends ServiceImpl<SarStandardsInfoDao
|
||||
|
||||
@Override
|
||||
public void insertIntoIndexForMap(Map<String, Object> attrInfoMap) {
|
||||
Set<String> keys = attrInfoMap.keySet();
|
||||
for (String key:keys) {
|
||||
String value = String.valueOf(attrInfoMap.get(key));
|
||||
if (com.adc.da.util.utils.StringUtils.isNotBlank(value) && !"null".equals(value) && !"SVPPS".equals(key)){
|
||||
value = value.replace(" , ",",");
|
||||
value = value.replace(","," , ");
|
||||
attrInfoMap.put(key,value);
|
||||
}
|
||||
}
|
||||
// 根据文件attid 读取文件内容
|
||||
if (org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(attrInfoMap.get("content")))) {
|
||||
String[] attidlist = String.valueOf(attrInfoMap.get("content")).split(" , ");
|
||||
StringBuilder content = new StringBuilder("");
|
||||
for (int i = 0; i < attidlist.length; i++) {
|
||||
if(org.apache.commons.lang.StringUtils.isNotEmpty(attidlist[i]) ){
|
||||
AttFileEO attFileEO = attFileEOService.getFileInfo(attidlist[i]);
|
||||
String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||
try {
|
||||
// 判断文件是docx还是PDF
|
||||
if (null != attFileEO.getFileSuffix() && (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("ppt") || attFileEO.getFileSuffix().equals("pptx"))) {
|
||||
if(attFileEO.getFileSuffix().equals("doc")){
|
||||
FileInputStream fis = new FileInputStream(readFilePath);
|
||||
WordExtractor wordExtractor = new WordExtractor(fis);
|
||||
String txt = wordExtractor.getText();
|
||||
content.append(txt);
|
||||
}else {
|
||||
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
|
||||
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
String txt = extractor.getText();
|
||||
content.append(txt);
|
||||
}
|
||||
} else {
|
||||
PDDocument document = PDDocument.load(new File(readFilePath));
|
||||
document.getClass();
|
||||
if (!document.isEncrypted()) {
|
||||
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
|
||||
stripper.setSortByPosition(true);
|
||||
PDFTextStripper tStripper = new PDFTextStripper();
|
||||
String pdfFileInText = tStripper.getText(document);
|
||||
// String[] lines = pdfFileInText.split("\\r?\\n");
|
||||
content.append(pdfFileInText);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索中心新增数据读取文档内容时失败");
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
/*catch (IOException | OpenXML4JException | XmlException e) {
|
||||
logger.error(e.getMessage(),e);
|
||||
}*/
|
||||
attrInfoMap.put("content",content.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
attrInfoMap.put("content","");
|
||||
}
|
||||
standLawsSearchService.addStandLawsSearchForMap(attrInfoMap);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateIntoIndexForMap(Map<String, Object> attrInfoMap) {
|
||||
Set<String> keys = attrInfoMap.keySet();
|
||||
for (String key:keys) {
|
||||
String value = String.valueOf(attrInfoMap.get(key));
|
||||
if (com.adc.da.util.utils.StringUtils.isNotBlank(value) && !"null".equals(value) && !"SVPPS".equals(key) && !"content".equals(key)){
|
||||
value = value.replace(" , ",",");
|
||||
value = value.replace(","," , ");
|
||||
attrInfoMap.put(key,value);
|
||||
}
|
||||
}
|
||||
// 根据文件attid 读取文件内容
|
||||
if (org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(attrInfoMap.get("content")))) {
|
||||
String[] attidlist = String.valueOf(attrInfoMap.get("content")).split(" , ");
|
||||
StringBuilder content = new StringBuilder("");
|
||||
for (int i = 0; i < attidlist.length; i++) {
|
||||
if(org.apache.commons.lang.StringUtils.isNotEmpty(attidlist[i]) && !"null".equals(attidlist[i])){
|
||||
AttFileEO attFileEO = attFileEOService.getFileInfo(attidlist[i]);
|
||||
String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||
try {
|
||||
// 判断文件是docx还是PDF
|
||||
if (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc")) {
|
||||
if(attFileEO.getFileSuffix().equals("doc")){
|
||||
FileInputStream fis = new FileInputStream(readFilePath);
|
||||
WordExtractor wordExtractor = new WordExtractor(fis);
|
||||
String txt = wordExtractor.getText();
|
||||
content.append(txt);
|
||||
}else {
|
||||
OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
|
||||
XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
String txt = extractor.getText();
|
||||
content.append(txt);
|
||||
}
|
||||
} else if (attFileEO.getFileSuffix().equals("pdf")){
|
||||
PDDocument document = PDDocument.load(new File(readFilePath));
|
||||
document.getClass();
|
||||
if (!document.isEncrypted()) {
|
||||
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
|
||||
stripper.setSortByPosition(true);
|
||||
PDFTextStripper tStripper = new PDFTextStripper();
|
||||
String pdfFileInText = tStripper.getText(document);
|
||||
// String[] lines = pdfFileInText.split("\\r?\\n");
|
||||
content.append(pdfFileInText);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("搜索中心修改数据读取文档内容时失败");
|
||||
logger.error(e.getMessage(),e);
|
||||
}
|
||||
attrInfoMap.put("content",content.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
attrInfoMap.put("content","");
|
||||
}
|
||||
standLawsSearchService.updateStandLawsSearchForMap(attrInfoMap);
|
||||
|
||||
}
|
||||
//
|
||||
// @Override
|
||||
// public void insertIntoIndexForMap(Map<String, Object> attrInfoMap) {
|
||||
// Set<String> keys = attrInfoMap.keySet();
|
||||
// for (String key:keys) {
|
||||
// String value = String.valueOf(attrInfoMap.get(key));
|
||||
// if (com.adc.da.util.utils.StringUtils.isNotBlank(value) && !"null".equals(value) && !"SVPPS".equals(key)){
|
||||
// value = value.replace(" , ",",");
|
||||
// value = value.replace(","," , ");
|
||||
// attrInfoMap.put(key,value);
|
||||
// }
|
||||
// }
|
||||
// // 根据文件attid 读取文件内容
|
||||
// if (org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(attrInfoMap.get("content")))) {
|
||||
// String[] attidlist = String.valueOf(attrInfoMap.get("content")).split(" , ");
|
||||
// StringBuilder content = new StringBuilder("");
|
||||
// for (int i = 0; i < attidlist.length; i++) {
|
||||
// if(org.apache.commons.lang.StringUtils.isNotEmpty(attidlist[i]) ){
|
||||
// AttFileEO attFileEO = attFileEOService.getFileInfo(attidlist[i]);
|
||||
// String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||
// try {
|
||||
// // 判断文件是docx还是PDF
|
||||
// if (null != attFileEO.getFileSuffix() && (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc") || attFileEO.getFileSuffix().equals("ppt") || attFileEO.getFileSuffix().equals("pptx"))) {
|
||||
// if(attFileEO.getFileSuffix().equals("doc")){
|
||||
// FileInputStream fis = new FileInputStream(readFilePath);
|
||||
// WordExtractor wordExtractor = new WordExtractor(fis);
|
||||
// String txt = wordExtractor.getText();
|
||||
// content.append(txt);
|
||||
// }else {
|
||||
// OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
|
||||
// XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
// String txt = extractor.getText();
|
||||
// content.append(txt);
|
||||
// }
|
||||
// } else {
|
||||
// PDDocument document = PDDocument.load(new File(readFilePath));
|
||||
// document.getClass();
|
||||
// if (!document.isEncrypted()) {
|
||||
// PDFTextStripperByArea stripper = new PDFTextStripperByArea();
|
||||
// stripper.setSortByPosition(true);
|
||||
// PDFTextStripper tStripper = new PDFTextStripper();
|
||||
// String pdfFileInText = tStripper.getText(document);
|
||||
// // String[] lines = pdfFileInText.split("\\r?\\n");
|
||||
// content.append(pdfFileInText);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// logger.error("搜索中心新增数据读取文档内容时失败");
|
||||
// logger.error(e.getMessage(),e);
|
||||
// }
|
||||
// /*catch (IOException | OpenXML4JException | XmlException e) {
|
||||
// logger.error(e.getMessage(),e);
|
||||
// }*/
|
||||
// attrInfoMap.put("content",content.toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// attrInfoMap.put("content","");
|
||||
// }
|
||||
// standLawsSearchService.addStandLawsSearchForMap(attrInfoMap);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void updateIntoIndexForMap(Map<String, Object> attrInfoMap) {
|
||||
// Set<String> keys = attrInfoMap.keySet();
|
||||
// for (String key:keys) {
|
||||
// String value = String.valueOf(attrInfoMap.get(key));
|
||||
// if (com.adc.da.util.utils.StringUtils.isNotBlank(value) && !"null".equals(value) && !"SVPPS".equals(key) && !"content".equals(key)){
|
||||
// value = value.replace(" , ",",");
|
||||
// value = value.replace(","," , ");
|
||||
// attrInfoMap.put(key,value);
|
||||
// }
|
||||
// }
|
||||
// // 根据文件attid 读取文件内容
|
||||
// if (org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(attrInfoMap.get("content")))) {
|
||||
// String[] attidlist = String.valueOf(attrInfoMap.get("content")).split(" , ");
|
||||
// StringBuilder content = new StringBuilder("");
|
||||
// for (int i = 0; i < attidlist.length; i++) {
|
||||
// if(org.apache.commons.lang.StringUtils.isNotEmpty(attidlist[i]) && !"null".equals(attidlist[i])){
|
||||
// AttFileEO attFileEO = attFileEOService.getFileInfo(attidlist[i]);
|
||||
// String readFilePath = filePath + "/" + attFileEO.getFilePath() + attFileEO.getFileName();
|
||||
// try {
|
||||
// // 判断文件是docx还是PDF
|
||||
// if (attFileEO.getFileSuffix().equals("docx") || attFileEO.getFileSuffix().equals("doc")) {
|
||||
// if(attFileEO.getFileSuffix().equals("doc")){
|
||||
// FileInputStream fis = new FileInputStream(readFilePath);
|
||||
// WordExtractor wordExtractor = new WordExtractor(fis);
|
||||
// String txt = wordExtractor.getText();
|
||||
// content.append(txt);
|
||||
// }else {
|
||||
// OPCPackage opcPackage = XWPFDocument.openPackage(readFilePath);
|
||||
// XWPFWordExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
// String txt = extractor.getText();
|
||||
// content.append(txt);
|
||||
// }
|
||||
// } else if (attFileEO.getFileSuffix().equals("pdf")){
|
||||
// PDDocument document = PDDocument.load(new File(readFilePath));
|
||||
// document.getClass();
|
||||
// if (!document.isEncrypted()) {
|
||||
// PDFTextStripperByArea stripper = new PDFTextStripperByArea();
|
||||
// stripper.setSortByPosition(true);
|
||||
// PDFTextStripper tStripper = new PDFTextStripper();
|
||||
// String pdfFileInText = tStripper.getText(document);
|
||||
// // String[] lines = pdfFileInText.split("\\r?\\n");
|
||||
// content.append(pdfFileInText);
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// logger.error("搜索中心修改数据读取文档内容时失败");
|
||||
// logger.error(e.getMessage(),e);
|
||||
// }
|
||||
// attrInfoMap.put("content",content.toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// else{
|
||||
// attrInfoMap.put("content","");
|
||||
// }
|
||||
// standLawsSearchService.updateStandLawsSearchForMap(attrInfoMap);
|
||||
// }
|
||||
|
||||
public void getStandDetailsForAct (SarStandardsInfoEOPage page,String[] idArr,String standState,List<ActSarItemsEO> standList) throws Exception{
|
||||
page.setPageSize(100);
|
||||
|
||||
Reference in New Issue
Block a user