|
@@ -7,6 +7,7 @@ import cn.cslg.pas.common.dto.es.EsQueryPatentFieldsDTO;
|
|
import cn.cslg.pas.common.dto.es.InnerFields;
|
|
import cn.cslg.pas.common.dto.es.InnerFields;
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
import cn.cslg.pas.common.model.cronModel.Records;
|
|
import cn.cslg.pas.common.model.request.QueryRequest;
|
|
import cn.cslg.pas.common.model.request.QueryRequest;
|
|
|
|
+import cn.cslg.pas.common.model.request.StringRequest;
|
|
import cn.cslg.pas.common.utils.*;
|
|
import cn.cslg.pas.common.utils.*;
|
|
import cn.cslg.pas.common.vo.ConfigVOS.PatentConfigVO;
|
|
import cn.cslg.pas.common.vo.ConfigVOS.PatentConfigVO;
|
|
import cn.cslg.pas.common.vo.FieldValueVO;
|
|
import cn.cslg.pas.common.vo.FieldValueVO;
|
|
@@ -91,6 +92,7 @@ public class PatentExportService {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private EsPatentService esPatentService;
|
|
private EsPatentService esPatentService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 导出专利
|
|
* 导出专利
|
|
*
|
|
*
|
|
@@ -317,12 +319,13 @@ public class PatentExportService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public Integer updateTaskStateToDoing(Integer taskId) {
|
|
|
|
|
|
+ public Integer updateTaskStateToDoing(Integer taskId,Long total) {
|
|
ImportTask importTask = importTaskService.getById(taskId);
|
|
ImportTask importTask = importTaskService.getById(taskId);
|
|
if (importTask == null) {
|
|
if (importTask == null) {
|
|
throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "导入任务不存在");
|
|
throw new XiaoShiException(ExceptionEnum.BUSINESS_ERROR, "导入任务不存在");
|
|
} else {
|
|
} else {
|
|
importTask.setState(1);
|
|
importTask.setState(1);
|
|
|
|
+ importTask.setAllNum(total.intValue());
|
|
importTask.updateById();
|
|
importTask.updateById();
|
|
}
|
|
}
|
|
return importTask.getId();
|
|
return importTask.getId();
|
|
@@ -349,7 +352,7 @@ public class PatentExportService {
|
|
return records;
|
|
return records;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ @Async
|
|
public void exportPatent2(ExportTaskDTO exportTask, ImportTaskAMVO importTaskAMVO) throws Exception {
|
|
public void exportPatent2(ExportTaskDTO exportTask, ImportTaskAMVO importTaskAMVO) throws Exception {
|
|
|
|
|
|
EsCustomFieldBatchVO esVO = exportTask.getEsVO();
|
|
EsCustomFieldBatchVO esVO = exportTask.getEsVO();
|
|
@@ -364,7 +367,6 @@ public class PatentExportService {
|
|
throw new IllegalArgumentException("没有选择要导出的字段数据");
|
|
throw new IllegalArgumentException("没有选择要导出的字段数据");
|
|
}
|
|
}
|
|
|
|
|
|
- this.updateTaskStateToDoing(taskId);
|
|
|
|
|
|
|
|
List<String> headers = selectedFields.stream().filter(PatentExportVO::getSelected).map(PatentExportVO::getName).distinct().collect(Collectors.toList());
|
|
List<String> headers = selectedFields.stream().filter(PatentExportVO::getSelected).map(PatentExportVO::getName).distinct().collect(Collectors.toList());
|
|
|
|
|
|
@@ -383,7 +385,7 @@ public class PatentExportService {
|
|
}
|
|
}
|
|
HSSFWorkbook hssfWorkbook = this.getExportHssWorkbook(headers);
|
|
HSSFWorkbook hssfWorkbook = this.getExportHssWorkbook(headers);
|
|
HSSFSheet hssfSheet = hssfWorkbook.createSheet();
|
|
HSSFSheet hssfSheet = hssfWorkbook.createSheet();
|
|
- QueryRequest queryRequest = new QueryRequest();
|
|
|
|
|
|
+ StringRequest queryRequest = new StringRequest();
|
|
BeanUtils.copyProperties(esVO, queryRequest);
|
|
BeanUtils.copyProperties(esVO, queryRequest);
|
|
|
|
|
|
EsQueryPatentFieldsDTO esQueryPatentFieldsDTO = new EsQueryPatentFieldsDTO();
|
|
EsQueryPatentFieldsDTO esQueryPatentFieldsDTO = new EsQueryPatentFieldsDTO();
|
|
@@ -395,16 +397,16 @@ public class PatentExportService {
|
|
Long startNum = null;
|
|
Long startNum = null;
|
|
Long endNum = null;
|
|
Long endNum = null;
|
|
if (esVO.getStartNumber() != null) {
|
|
if (esVO.getStartNumber() != null) {
|
|
- startNum = Long.getLong(esVO.getStartNumber().toString());
|
|
|
|
|
|
+ startNum =0l+esVO.getStartNumber();
|
|
}
|
|
}
|
|
if (esVO.getEndNumber() != null) {
|
|
if (esVO.getEndNumber() != null) {
|
|
- endNum = Long.getLong(esVO.getEndNumber().toString());
|
|
|
|
|
|
+ endNum = 0l+esVO.getEndNumber();
|
|
}
|
|
}
|
|
|
|
|
|
if (startNum == null) {
|
|
if (startNum == null) {
|
|
startNum = 1l;
|
|
startNum = 1l;
|
|
}
|
|
}
|
|
- Long toNum = 10L;
|
|
|
|
|
|
+ Long toNum = startNum+9l;
|
|
if (endNum != null && endNum < toNum) {
|
|
if (endNum != null && endNum < toNum) {
|
|
toNum = endNum;
|
|
toNum = endNum;
|
|
}
|
|
}
|
|
@@ -414,7 +416,7 @@ public class PatentExportService {
|
|
|
|
|
|
EsPatentCommonVO esPatentCommonVO = esService.tranPatentRequestToComVO(queryRequest);
|
|
EsPatentCommonVO esPatentCommonVO = esService.tranPatentRequestToComVO(queryRequest);
|
|
esPatentCommonVO.setStartNum(startNum);
|
|
esPatentCommonVO.setStartNum(startNum);
|
|
- esPatentCommonVO.setEndNum(endNum);
|
|
|
|
|
|
+ esPatentCommonVO.setEndNum(toNum);
|
|
Records firstRecords = this.queryPatents(esPatentCommonVO);
|
|
Records firstRecords = this.queryPatents(esPatentCommonVO);
|
|
|
|
|
|
Long total = 0l;
|
|
Long total = 0l;
|
|
@@ -431,6 +433,8 @@ public class PatentExportService {
|
|
} else {
|
|
} else {
|
|
firstRecords.getTotal();
|
|
firstRecords.getTotal();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ this.updateTaskStateToDoing(taskId,total);
|
|
List<Patent> firstPatentList = (List<Patent>) firstRecords.getData();
|
|
List<Patent> firstPatentList = (List<Patent>) firstRecords.getData();
|
|
List<String> firstPatentNos = firstPatentList.stream().map(Patent::getPatentNo).collect(Collectors.toList());
|
|
List<String> firstPatentNos = firstPatentList.stream().map(Patent::getPatentNo).collect(Collectors.toList());
|
|
;
|
|
;
|
|
@@ -445,6 +449,7 @@ public class PatentExportService {
|
|
this.loadPatentCell(patent, selectedFields, patentConfigVOS, firstEsPatentFieldsVOS, hssfSheet, commonCellStyle, index);
|
|
this.loadPatentCell(patent, selectedFields, patentConfigVOS, firstEsPatentFieldsVOS, hssfSheet, commonCellStyle, index);
|
|
|
|
|
|
index++;
|
|
index++;
|
|
|
|
+ importTaskAMVO.setDoneNum(index);
|
|
this.sendWebSocketMessage(projectId, taskId, createId, total.intValue(), index, false);
|
|
this.sendWebSocketMessage(projectId, taskId, createId, total.intValue(), index, false);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -478,6 +483,8 @@ public class PatentExportService {
|
|
this.loadPatentCell(patent, selectedFields, patentConfigVOS, esPatentFieldsVOS, hssfSheet, commonCellStyle, index);
|
|
this.loadPatentCell(patent, selectedFields, patentConfigVOS, esPatentFieldsVOS, hssfSheet, commonCellStyle, index);
|
|
|
|
|
|
index++;
|
|
index++;
|
|
|
|
+ importTaskAMVO.setDoneNum(index);
|
|
|
|
+
|
|
this.sendWebSocketMessage(projectId, taskId, createId, total.intValue(), index, false);
|
|
this.sendWebSocketMessage(projectId, taskId, createId, total.intValue(), index, false);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -486,8 +493,8 @@ public class PatentExportService {
|
|
|
|
|
|
esQueryPatentFieldsDTO.setPatentNos(inNos);
|
|
esQueryPatentFieldsDTO.setPatentNos(inNos);
|
|
List<EsPatentFieldsVO> esPatentFieldsVOS = esCustomFieldService.getPatentFields(esQueryPatentFieldsDTO);
|
|
List<EsPatentFieldsVO> esPatentFieldsVOS = esCustomFieldService.getPatentFields(esQueryPatentFieldsDTO);
|
|
- List<Patent> patentList = esPatentService.getPatentsByNo(inNos,true,null,null);
|
|
|
|
- for (int i=0;i<patentList.size();i++){
|
|
|
|
|
|
+ List<Patent> patentList = esPatentService.getPatentsByNo(inNos, true, null, null);
|
|
|
|
+ for (int i = 0; i < patentList.size(); i++) {
|
|
|
|
|
|
Patent patent = patentList.get(i);
|
|
Patent patent = patentList.get(i);
|
|
if (notInNos != null && notInNos.contains(patent.getPatentNo())) {
|
|
if (notInNos != null && notInNos.contains(patent.getPatentNo())) {
|
|
@@ -496,6 +503,7 @@ public class PatentExportService {
|
|
this.loadPatentCell(patent, selectedFields, patentConfigVOS, esPatentFieldsVOS, hssfSheet, commonCellStyle, index);
|
|
this.loadPatentCell(patent, selectedFields, patentConfigVOS, esPatentFieldsVOS, hssfSheet, commonCellStyle, index);
|
|
|
|
|
|
index++;
|
|
index++;
|
|
|
|
+ importTaskAMVO.setDoneNum(index);
|
|
this.sendWebSocketMessage(projectId, taskId, createId, total.intValue(), index, false);
|
|
this.sendWebSocketMessage(projectId, taskId, createId, total.intValue(), index, false);
|
|
|
|
|
|
}
|
|
}
|
|
@@ -581,7 +589,7 @@ public class PatentExportService {
|
|
String valueStr = fieldValueVO.getValue();
|
|
String valueStr = fieldValueVO.getValue();
|
|
sb.append(valueStr);
|
|
sb.append(valueStr);
|
|
}
|
|
}
|
|
- HSSFCell cell = row.createCell(index);
|
|
|
|
|
|
+ HSSFCell cell = row.createCell(j);
|
|
ExcelUtils.setExcelCellStyle(commonCellStyle);
|
|
ExcelUtils.setExcelCellStyle(commonCellStyle);
|
|
commonCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
|
|
commonCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
|
|
commonCellStyle.setWrapText(true);
|
|
commonCellStyle.setWrapText(true);
|
|
@@ -602,7 +610,7 @@ public class PatentExportService {
|
|
GetValueImp getValueImp = patentExportFactory.getClass(exportClass);
|
|
GetValueImp getValueImp = patentExportFactory.getClass(exportClass);
|
|
if (getValueImp != null) {
|
|
if (getValueImp != null) {
|
|
String reValue = getValueImp.getValue(value);
|
|
String reValue = getValueImp.getValue(value);
|
|
- HSSFCell cell = row.createCell(index);
|
|
|
|
|
|
+ HSSFCell cell = row.createCell(j);
|
|
cell.setCellStyle(commonCellStyle);
|
|
cell.setCellStyle(commonCellStyle);
|
|
cell.setCellValue(reValue);
|
|
cell.setCellValue(reValue);
|
|
}
|
|
}
|