合并分支 'dev_third_stage' 到 'master'

Dev third stage

查看合并请求 laws-nio/laws-weilai!158
This commit is contained in:
高嵩
2022-08-25 23:46:45 +08:00
45 changed files with 515 additions and 138 deletions
@@ -958,3 +958,11 @@ DROP INDEX `uniq_sys_user_work_no`;
-- 工作流 流程表增加流程名称 英文字段 2022-08-19 已同步生产环境
ALTER TABLE `laws_weilai_wkflow`.`bus_process_name`
ADD COLUMN `PRC_NAME_EN` varchar(255) NULL COMMENT '流程名称(英文)' AFTER `PROJECT_LAWS_INVENTORY_ID`;
-- 法规月报填写 新增字段 2022-08-25 未同步生产环境
ALTER TABLE `laws_weilai`.`laws_monthly_report_write`
ADD COLUMN `related_areas_cn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '相关领域中文' AFTER `export_state`,
ADD COLUMN `related_areas_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '相关领域英文' AFTER `related_areas_cn`,
ADD COLUMN `source_cn` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源中文' AFTER `related_areas_en`,
ADD COLUMN `time` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '日期' AFTER `source_cn`,
ADD COLUMN `source_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源英文' AFTER `time`;
@@ -35,6 +35,7 @@ import com.jero.modules.project.util.WordUtil;
import com.jero.modules.split.common.ReadExcel;
import com.jero.modules.system.entity.SysDictItem;
import com.jero.modules.system.service.ISysDictItemService;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.util.HSSFColor;
@@ -762,21 +763,21 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
nowFile.mkdirs();
String fileName = fileOriName + ".docx";
// 查询导出数据
List<Map> allParamsInfoList = queryForExportCustom(paramsReportDetailVO);
Map<String, String> params = allParamsInfoList.get(0);
List<Map<String, Object>> imgListAll = (List<Map<String, Object>>) allParamsInfoList.get(1).get("imgListAll");
String templateUrl = "";
ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId());
List<OSSFile> ossFiles = ossFileService.getFileInfosByConnectId(paramsExportTemplateEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFiles)) {
templateUrl = ossFiles.get(0).getUrl();
}
// 替换模板中的占位符
try {
// 查询导出数据
List<Map> allParamsInfoList = queryForExportCustom(paramsReportDetailVO);
Map<String, String> params = allParamsInfoList.get(0);
List<Map<String, Object>> imgListAll = (List<Map<String, Object>>) allParamsInfoList.get(1).get("imgListAll");
String templateUrl = "";
ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId());
List<OSSFile> ossFiles = ossFileService.getFileInfosByConnectId(paramsExportTemplateEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFiles)) {
templateUrl = ossFiles.get(0).getUrl();
}
// 拿取模板
String repFileName = fileName.replaceAll("/","_");
wordOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
@@ -788,16 +789,36 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
List<Map<String, Object>> fileListAll = (List<Map<String, Object>>) allParamsInfoList.get(2).get("fileListAll");
if (fileListAll != null && !fileListAll.isEmpty()) {
Map<String,String> paramsAfterFilter = WordUtil.filterParams(wordMLPackage, params);
Map<String,String> paramsAfterFilter = WordUtil.filterParams(wordMLPackage, params); // 过滤出需要导出的参数项
if (CollectionUtil.isNotEmpty(paramsAfterFilter)) {
List<String> nioNumberList = paramsAfterFilter.keySet().stream().collect(Collectors.toList());
List<OSSFile> allRelevFileList = new ArrayList<>();
// 判断文件是否重复
for (Map<String, Object> fileMap : fileListAll) {
for (Map.Entry map : fileMap.entrySet()) {
String key = (String) map.getKey();
List<OSSFile> fileList = (List<OSSFile>) map.getValue();
if (nioNumberList.contains(key)) {
allRelevFileList.addAll(fileList);
String newFileName = isRepeat(allRelevFileList, fileList.get(0));
if (!"".equals(newFileName) && !"old".equals(newFileName)) { // 文件名称重复 且文件内容不同
String configDataStr = params.get(key);
if (StringUtils.isNotEmpty(configDataStr)) {
if (configDataStr.contains("#")) {
String newConfigDataStr = configDataStr.substring(0, configDataStr.lastIndexOf("#")) + newFileName;
params.put(key, newConfigDataStr);
} else {
params.put(key, newFileName);
}
}
fileList.get(0).setFileName(newFileName);
allRelevFileList.addAll(fileList);
} else if ("".equals(newFileName)) { // 文件名称不重复
allRelevFileList.addAll(fileList);
}
}
}
}
@@ -893,21 +914,21 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
nowFile.mkdirs();
String fileName = fileOriName + ".xlsx";
// 查询导出数据
List<Map> allParamsInfoList = queryForExportCustom(paramsReportDetailVO);
HashMap<String, String> params = (HashMap<String, String>) allParamsInfoList.get(0);
List<Map<String, Object>> imgListAll = (List<Map<String, Object>>) allParamsInfoList.get(1).get("imgListAll");
String templateUrl = "";
ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId());
List<OSSFile> ossFiles = ossFileService.getFileInfosByConnectId(paramsExportTemplateEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFiles)) {
templateUrl = ossFiles.get(0).getUrl();
}
// 替换模板中的占位符
try {
// 查询导出数据
List<Map> allParamsInfoList = queryForExportCustom(paramsReportDetailVO);
HashMap<String, String> params = (HashMap<String, String>) allParamsInfoList.get(0);
List<Map<String, Object>> imgListAll = (List<Map<String, Object>>) allParamsInfoList.get(1).get("imgListAll");
String templateUrl = "";
ParamsExportTemplateEO paramsExportTemplateEO = paramsExportTemplateEOService.getById(paramsReportDetailVO.getExportTemplateId());
List<OSSFile> ossFiles = ossFileService.getFileInfosByConnectId(paramsExportTemplateEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFiles)) {
templateUrl = ossFiles.get(0).getUrl();
}
// 拿取模板
String repFileName = fileName.replaceAll("/","_");
wordOS = new FileOutputStream(fileNowPath + File.separator + repFileName);
@@ -931,7 +952,25 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
String key = (String) map.getKey();
List<OSSFile> fileList = (List<OSSFile>) map.getValue();
if (nioNumberList.contains(key)) {
allRelevFileList.addAll(fileList);
String newFileName = isRepeat(allRelevFileList, fileList.get(0));
if (!"".equals(newFileName) && !"old".equals(newFileName)) { // 文件名称重复 且文件内容不同
String configDataStr = params.get(key);
if (StringUtils.isNotEmpty(configDataStr)) {
if (configDataStr.contains("#")) {
String newConfigDataStr = configDataStr.substring(0, configDataStr.lastIndexOf("#")) + newFileName;
params.put(key, newConfigDataStr);
} else {
params.put(key, newFileName);
}
}
fileList.get(0).setFileName(newFileName);
allRelevFileList.addAll(fileList);
} else if ("".equals(newFileName)) { // 文件名称不重复
allRelevFileList.addAll(fileList);
}
}
}
}
@@ -1064,7 +1103,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
bis.close(); // 先开后关
}
private List<Map<String, Object>> queryForExportNormal(ParamsReportDetailVO paramsReportDetailVO) {
private List<Map<String, Object>> queryForExportNormal(ParamsReportDetailVO paramsReportDetailVO) throws IOException {
List<String> idList = new ArrayList<>();
if (StringUtils.isNotEmpty(paramsReportDetailVO.getIds())) {
idList = Arrays.asList(paramsReportDetailVO.getIds().split(","));
@@ -1074,6 +1113,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
List<ParamsReportConfigEO> paramsConfigEOList = paramsReportConfigEOService.queryList(paramsReportDetailVO.getParamsManifestId()); // 查询所有配置列
List<OSSFile> fileListAll = new ArrayList<>(); // 仅用于校验文件是否重复
// 查询配置列数据
for (Map<String, Object> record1 : dataList) {
@@ -1086,7 +1126,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
//不合并
if ("1".equals(paramsReportDetailVO.getCombineFlag())) {
paramsConfigEOList = paramsConfigEOList.stream().filter(e->configIdList.contains(e.getId())).collect(Collectors.toList()); // 过滤出要导出的配置列
paramsConfigEOList.forEach(paramsConfigEO -> { // 参数配置
for (ParamsConfigEO paramsConfigEO : paramsConfigEOList) { // 参数配置
if (ControlTypeEnum.Title.getValue().equals(controlType)) {
record1.put(paramsConfigEO.getId(), titleDefaultValue);
@@ -1103,9 +1143,24 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
if (StringUtils.isNotEmpty(paramsConfigDataEO.getFileConnectId())) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(paramsConfigDataEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFileList)) {
configDataBuilder.append(ossFileList.get(0).getFileName()).append("#");
// 不合并导出时 验证文件名是否相同,相同进一步验证文件内容是否相同,不同时重命名文件
String fileName = ossFileList.get(0).getFileName();
String newFileName = isRepeat(fileListAll, ossFileList.get(0));
if (!"".equals(newFileName) && !"old".equals(newFileName)) { // 文件名称重复 且文件内容不同
configDataBuilder.append(newFileName).append("#");
ossFileList.get(0).setFileName(newFileName);
fileList.addAll(ossFileList);
fileListAll.addAll(ossFileList);
} else if ("old".equals(newFileName)) { // 文件名称重复 且文件内容相同
configDataBuilder.append(fileName).append("#");
fileList.addAll(ossFileList);
}else {
configDataBuilder.append(fileName).append("#");
fileList.addAll(ossFileList);
fileListAll.addAll(ossFileList);
}
fileList.addAll(ossFileList);
}
}
@@ -1116,7 +1171,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
record1.put(paramsConfigEO.getId(), configData);
}
});
}
} else if ("2".equals(paramsReportDetailVO.getCombineFlag())) { // 合并
String configData = "";
@@ -1136,9 +1191,35 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
if (StringUtils.isNotEmpty(paramsReportConfigDataEO.getFileConnectId())) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(paramsReportConfigDataEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFileList)) {
fileNameList.add(ossFileList.get(0).getFileName());
// 合并导出时 验证文件名是否相同,相同进一步验证文件内容是否形同,不同时重命名文件
String fileName = ossFileList.get(0).getFileName();
String newFileName = isRepeat(fileListAll, ossFileList.get(0));
if (!"".equals(newFileName) && !"old".equals(newFileName)) { // 文件名称重复 且文件内容不同
// 判断 新文件名是不是当前参数下 配置间的 重复
int count = (int) fileList.stream().filter(e->newFileName.equals(e.getFileName())).count();
if (count <= 0) { // 不是 (如果是,不做任何操作)
fileNameList.add(newFileName);
ossFileList.get(0).setFileName(newFileName);
fileList.addAll(ossFileList);
fileListAll.addAll(ossFileList);
}
} else if ("old".equals(newFileName)) { // 文件名称重复 且文件内容相同
// 判断这种重复是不是当前参数下 配置间的
int count = (int) fileList.stream().filter(e->fileName.equals(e.getFileName())).count();
if (count <= 0) { // 不是 (如果是,不做任何操作)
fileNameList.add(fileName);
fileList.addAll(ossFileList);
fileListAll.addAll(ossFileList);
}
}else { // 文件名称不重复
fileNameList.add(fileName);
fileList.addAll(ossFileList);
fileListAll.addAll(ossFileList);
}
fileList.addAll(ossFileList);
}
}
}
@@ -1151,7 +1232,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
configDataBuilder.append(textDatas).append("#");
}
if (CollectionUtil.isNotEmpty(fileNameList)) {
fileNameList = fileNameList.stream().distinct().collect(Collectors.toList());
// fileNameList = fileNameList.stream().distinct().collect(Collectors.toList());
configDataBuilder.append(StringUtils.join(fileNameList, paramsReportDetailVO.getSeparator())).append("#");
}
configData = configDataBuilder.toString();
@@ -1168,7 +1249,7 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
return dataList;
}
private List<Map> queryForExportCustom(ParamsReportDetailVO paramsReportDetailVO) {
private List<Map> queryForExportCustom(ParamsReportDetailVO paramsReportDetailVO) throws IOException {
paramsReportDetailVO.setSeparator("*"); // 设置分隔符
List<String> idList = new ArrayList<>();
@@ -1194,8 +1275,8 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
String controlType = (String) record1.get("control_type");
if (CollectionUtil.isNotEmpty(paramsConfigEOList)) {
List<OSSFile> fileList = new ArrayList<>();
List<OSSFile> imgFileList = new ArrayList<>();
List<OSSFile> fileList = new ArrayList<>(); // 存放当前编号下的非图片文件
List<OSSFile> imgFileList = new ArrayList<>(); // 存放当前编号下的图片文件
// 合并配置数据
String configData = "";
@@ -1208,7 +1289,8 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
.map(ParamsReportConfigDataEO::getPullData).distinct().collect(Collectors.joining(paramsReportDetailVO.getSeparator())); // 整合下拉数据
List<String> fileNameList = new ArrayList<>();
for (ParamsReportConfigDataEO paramsReportConfigDataEO : paramsReportConfigDataEOS) { // 获取”导出文件夹“下的文件
if (CollectionUtil.isNotEmpty(paramsReportConfigDataEOS)) {
ParamsReportConfigDataEO paramsReportConfigDataEO = paramsReportConfigDataEOS.get(0); // 获取”导出文件夹“下的文件
if (StringUtils.isNotEmpty(paramsReportConfigDataEO.getFileConnectId())) {
List<OSSFile> ossFileList = ossFileService.getFileInfosByConnectId(paramsReportConfigDataEO.getFileConnectId());
if (CollectionUtil.isNotEmpty(ossFileList)) {
@@ -1561,6 +1643,73 @@ public class ParamsReportDetailEOServiceImpl extends ServiceImpl<ParamsReportDet
return null;
}
private boolean compareFileContent(String fileUrl1, String fileUrl2) throws IOException {
if (CosBootUtil.doesObjectExist(fileUrl1) && CosBootUtil.doesObjectExist(fileUrl2)){
try (InputStream file1 = CosBootUtil.download(fileUrl1);
InputStream file2 = CosBootUtil.download(fileUrl2);) {
String md5Hex1 = DigestUtils.md5Hex(file1);
String md5Hex2 = DigestUtils.md5Hex(file2);
return md5Hex1.equals(md5Hex2);
} catch (IOException e) {
log.error(e.getMessage(), e);
throw new IOException(e.getMessage());
}
} else { // 有文件不存在时,也视为不相同
return false;
}
}
// 判断导出文件是否重复
private String isRepeat(List<OSSFile> fileList, OSSFile ossFile) throws IOException {
String fileName = ossFile.getFileName();
String currentFileUrl = ossFile.getUrl();
List<OSSFile> result = fileList.stream().filter(e-> fileName.equals(e.getFileName())).collect(Collectors.toList());
if (result.size() > 0) { // 文件名重复
String fileUrl = result.get(0).getUrl();
if (!compareFileContent(currentFileUrl, fileUrl)) { // 文件内容不同
List<OSSFile> sameFileList = fileList.stream().filter(e-> compareFileName(fileName, e.getFileName())).collect(Collectors.toList());
int count = sameFileList.size();
if (count > 0) {
// 判断 和重命名的文件 内容是否相同
for (OSSFile file : sameFileList) {
if (compareFileContent(currentFileUrl, file.getUrl())) {
return file.getFileName();
}
}
// 遍历完 没相同的 再重命名
String newFileName = fileName.substring(0, fileName.lastIndexOf(".")) + (count + 1) + fileName.substring(fileName.lastIndexOf("."));
return newFileName;
} else {
String newFileName = fileName.substring(0, fileName.lastIndexOf(".")) + (count + 1) + fileName.substring(fileName.lastIndexOf("."));
return newFileName;
}
} else { // 文件内容相同
return "old";
}
} else { // 文件名不重复
return "";
}
}
// 比较文件名,如 currentFileName: 文件.pdf ; fileName: 文件1.pdf
private boolean compareFileName(String currentFileName, String fileName) {
StringBuilder sb = new StringBuilder();
sb.append(fileName.substring(0, fileName.lastIndexOf(".") - 1));
sb.append(fileName.substring(fileName.lastIndexOf("."), fileName.length()));
if (currentFileName.equals(sb.toString())) {
return true;
} else { // 当 currentFileName = fileName 时 也返回false
return false;
}
}
/**
* 实体对象转成Map
* @param obj 实体对象
@@ -137,8 +137,7 @@ public class ParamsInfoEOController extends JeroController<ParamsInfoEO, IParams
@PostMapping(value = "/add")
// @RequiresPermissions("params:paramsInfo:add")
public Result<?> add(@Validated @RequestBody ParamsInfoEO paramsInfoEO) {
if (StringUtils.isEmpty(paramsInfoEO.getCertCategory())
&& !ControlTypeEnum.Title.getValue().equals(paramsInfoEO.getControlType())) {
if (StringUtils.isEmpty(paramsInfoEO.getCertCategory())) {
return Result.error("认证类别不能为空!");
}
boolean isSuccess = paramsInfoEOService.add(paramsInfoEO);
@@ -160,8 +159,7 @@ public class ParamsInfoEOController extends JeroController<ParamsInfoEO, IParams
@PostMapping(value = "/edit")
@RequiresPermissions("params:paramsInfo:edit")
public Result<?> edit(@Validated @RequestBody ParamsInfoEO paramsInfoEO) {
if (StringUtils.isEmpty(paramsInfoEO.getCertCategory())
&& !ControlTypeEnum.Title.getValue().equals(paramsInfoEO.getControlType())) {
if (StringUtils.isEmpty(paramsInfoEO.getCertCategory())) {
return Result.error("认证类别不能为空!");
}
boolean isSuccess = paramsInfoEOService.editById(paramsInfoEO);
@@ -1311,6 +1311,13 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
// 认证类别
// 来源:认证类别sheet页
resultMap = validateMustAndLength(nioCertCategoryMap.get(nioNumber), "认证类别", "Cert Category", IsMustEnum.YES.getValue(), "1000", false, cut);
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
dto.setCertCategory(nioCertCategoryMap.get(nioNumber));
// String certCategory = dto.getCertCategory();
// resultMap = validateMustAndLength(certCategory, "认证类别", "cert category", IsMustEnum.YES.getValue(), "1000", false, cut);
// errorMsg += (String)resultMap.get("errorMsg");
@@ -1332,17 +1339,6 @@ public class ParamsInfoEOServiceImpl extends ServiceImpl<ParamsInfoEOMapper, Par
controlType = (String)resultMap.get("value");
dto.setControlType(controlType);
// 认证类别
// 来源:认证类别sheet页
if (ControlTypeEnum.Title.getValue().equals(controlType)) {
resultMap = validateMustAndLength(nioCertCategoryMap.get(nioNumber), "认证类别", "Cert Category", IsMustEnum.NO.getValue(), "1000", false, cut);
} else {
resultMap = validateMustAndLength(nioCertCategoryMap.get(nioNumber), "认证类别", "Cert Category", IsMustEnum.YES.getValue(), "1000", false, cut);
}
errorMsg += (String)resultMap.get("errorMsg");
countError += (int)resultMap.get("countError");
dto.setCertCategory(nioCertCategoryMap.get(nioNumber));
// 控件备选值
String controlValues = dto.getControlValues();
if (ControlTypeEnum.PULL_SINGLE.getValue().equals(controlType)
+20
View File
@@ -125,6 +125,20 @@
<groupId>cn.afterturn</groupId>
<artifactId>easypoi-base</artifactId>
<version>3.2.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>cn.afterturn</groupId>
@@ -220,6 +234,12 @@
<artifactId>hanlp</artifactId>
<version>portable-1.7.5</version>
</dependency>
<dependency>
<groupId>org.apache.xmlbeans</groupId>
<artifactId>xmlbeans</artifactId>
<version>2.6.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
@@ -494,4 +494,10 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
String title = bussDocumentLibraryEOService.getTitle(id, cut);
return Result.OK(title);
}
@ApiOperation(value="编辑ES数据(添加module_type_flag)", notes="编辑ES数据(添加module_type_flag)")
@GetMapping(value = "/updateES")
public Result<?> getTitle() {
int count = bussDocumentLibraryEOService.updateES();
return Result.OK(count);
}
}
@@ -223,4 +223,6 @@ public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibr
String getTitle(String id,String cut);
String sqlJoint(List<QueryConditionVO> queryConditionVOList);
int updateES();
}
@@ -51,6 +51,7 @@ import com.jero.modules.message.websocket.WebSocket;
import com.jero.modules.ocr.service.IOcrRecordEOService;
import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.searchcenter.enums.ModuleTypeFlagEnum;
import com.jero.modules.split.common.FileUnZip;
import com.jero.modules.split.entity.SarFileSplitInfoEO;
import com.jero.modules.split.service.ISarFileSplitInfoService;
@@ -328,6 +329,9 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), id);
//删除全部英文的
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), id);
//以下两条为带条件搜索的数据
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), SearchEnum.FULL_TEXT_SEARCH_CN.getValue(), id+"1");
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), SearchEnum.FULL_TEXT_SEARCH_EN.getValue(), id+"2");
for (String fileId : fileIdList) {
//删除全部中文的
jeroElasticsearchTemplate.delete(SearchEnum.FULL_TEXT_SEARCH.getValue(), SearchEnum.FULL_TEXT_SEARCH.getValue(), id + fileId);
@@ -1759,6 +1763,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
for (OSSFile ossFile : ossFileList) {
Map<String, Object> stringMapCn = new HashMap<>();
Map<String, Object> stringMapEn = new HashMap<>();
stringMapCn.put("create_time",new Date());
stringMapEn.put("create_time",new Date());
String fileText = "";
if (ossFile.getFileName().endsWith(".doc")
|| ossFile.getFileName().endsWith(".docx")
@@ -1839,11 +1845,19 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
} else {
Map<String, Object> stringMapCn = new HashMap<>();
Map<String, Object> stringMapEn = new HashMap<>();
Map<String, Object> mapBaseDateCn = new HashMap<>();
Map<String, Object> mapBaseDateEn = new HashMap<>();
stringMapCn.put("create_time",new Date());
stringMapEn.put("create_time",new Date());
mapBaseDateCn.put("create_time",new Date());
mapBaseDateEn.put("create_time",new Date());
for (OnlCgformField onlCgformField : searchFieldList) {
String s = StringUtils.valueOf(map.get(onlCgformField.getDbFieldName()));
if(StringUtils.isNotBlank(s)){
stringMapCn.put(onlCgformField.getDbFieldName(), s);
stringMapEn.put(onlCgformField.getDbFieldName(), s);
mapBaseDateCn.put(onlCgformField.getDbFieldName(), s);
mapBaseDateEn.put(onlCgformField.getDbFieldName(), s);
}
}
//封装中文的全文内容(es)
@@ -1856,8 +1870,23 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
StringUtils.valueOf(map.get("title")), "", "",
cutEn, stringMapEn,SEARCH_FLAG);
stringMapEn.put("file_sort",idTemp+"_"+1);
//用于全文带条件查询-----------------------------
//封装中文的全文内容(es)
putMapCn(idTemp+"1", StringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(),
StringUtils.valueOf(map.get("title")), "", "",
cutCn, mapBaseDateCn, null);
mapBaseDateCn.put("file_sort",idTemp+"_"+1);
//封装英文的全文内容(es)
putMapCn(idTemp+"2", StringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(),
StringUtils.valueOf(map.get("title")), "", "",
cutEn, mapBaseDateEn,null);
stringMapEn.put("file_sort",idTemp+"_"+1);
//用于全文带条件查询-----------------------------
mapListTempCn.add(stringMapCn);
mapListTempEn.add(stringMapEn);
mapListTempCn.add(mapBaseDateCn);
mapListTempEn.add(mapBaseDateEn);
}
} catch (Exception e) {
e.printStackTrace();
@@ -1879,6 +1908,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//添加es
map.put("id", idTemp);
map.put("module_type", "文档库");
map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue());
map.put("create_time", new Date());
map.put("file_text",fileTextAll);
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(map));
JSONArray arrayCn = JSONArray.parseArray(JSON.toJSONString(mapListTempCn));
@@ -2224,6 +2255,14 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if(StringUtils.isNotBlank(issueTime)){
issueTimeDate = df.parse(issueTime);
}
if(ObjectUtils.isNotEmpty(map.get("es_update_flag"))){
if(ObjectUtils.isNotEmpty(map.get("implement_time"))){
map.put("implement_time",df.format(map.get("implement_time")));
}
if(ObjectUtils.isNotEmpty(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){
map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",df.format(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1")));
}
}
String implementTime = (String) map.get("implement_time");//在产车实施日期
String newCarimplementTime = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1");//新车型实施日期
if (StringUtils.isNotBlank(implementTime) && ObjectUtils.isNotEmpty(issueTimeDate)) {
@@ -2398,7 +2437,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String key = entry.getKey();
String value = StringUtils.valueOf(entry.getValue());
if(fileFieldList.contains(key)){
if(!"null".equals(value)){
if(!"null".equals(value) && StringUtils.isNotBlank(value)){
connectIdList.add(value);
}
}
@@ -2413,6 +2452,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//之前没有上传过文件
Map<String, Object> stringMapCn = new HashMap<>();
Map<String, Object> stringMapEn = new HashMap<>();
Map<String, Object> mapBaseDateCn = new HashMap<>();
Map<String, Object> mapBaseDateEn = new HashMap<>();
stringMapCn.put("create_time",new Date());
stringMapEn.put("create_time",new Date());
mapBaseDateCn.put("create_time",new Date());
mapBaseDateEn.put("create_time",new Date());
for (OnlCgformField onlCgformField : searchFieldList) {
String s = (String) map.get(onlCgformField.getDbFieldName());
if(FieldTypeEnum.DATE_SINGLE.getValue().equals(onlCgformField.getFieldShowType()) && StringUtils.isNotBlank(s)){
@@ -2435,8 +2480,23 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
cutEn, stringMapEn,SEARCH_FLAG);
stringMapEn.put("file_sort", StringUtils.valueOf(map.get("id")+"_"+1));
//用于全文带条件查询-----------------------------
//封装中文的全文内容(es)
putMapCn(StringUtils.valueOf(map.get("id"))+"1", StringUtils.valueOf(map.get("serial_number")), "文档库", sbCn.toString(),
StringUtils.valueOf(map.get("title")), "", "",
cutCn, mapBaseDateCn, null);
mapBaseDateCn.put("file_sort",StringUtils.valueOf(map.get("id")+"_"+1));
//封装英文的全文内容(es)
putMapCn(StringUtils.valueOf(map.get("id"))+"2", StringUtils.valueOf(map.get("serial_number")), "document library", sbEn.toString(),
StringUtils.valueOf(map.get("title")), "", "",
cutEn, mapBaseDateEn,null);
stringMapEn.put("file_sort",StringUtils.valueOf(map.get("id")+"_"+1));
//用于全文带条件查询-----------------------------
mapListTempCn.add(stringMapCn);
mapListTempEn.add(stringMapEn);
mapListTempCn.add(mapBaseDateCn);
mapListTempEn.add(mapBaseDateEn);
}
}
@@ -2473,6 +2533,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
bussDocumentLibraryEOMapper.deleteById((String) map.get("id"));
bussDocumentLibraryEOMapper.insertInfo(insertField, insertValue);
map.put("module_type", "文档库");
map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue());
map.put("create_time", new Date());
map.put("file_text", fileTextAll);
Map<String,Object> objectMapTemp = new HashMap<>();
for (Map.Entry<String, Object> entry : map.entrySet()) {
@@ -2481,7 +2543,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
if(dateSingleList.contains(entry.getKey())){
value = value.toString().split(" ")[0];
}else if("create_time".equals(entry.getKey()) || "update_time".equals(entry.getKey())){
value = value.toString().split(" ")[0];
// value = value.toString().split(" ")[0];
}
objectMapTemp.put(entry.getKey(),value);
}
@@ -5652,6 +5714,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
stringMap.put("id", id);
stringMap.put("serial_number", serialNumber);
stringMap.put("module_type", moduleType);
stringMap.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue());
stringMap.put("content", content);
stringMap.put("title", title);
stringMap.put("file_text", fileText);
@@ -5923,4 +5986,16 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
return title;
}
@Override
public int updateES() {
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMapsAll(null);
int count = 0;
for (Map<String, Object> map : mapList) {
map.put("es_update_flag","es_update_flag");
updateInfo(map);
count ++;
}
return count;
}
}
@@ -92,7 +92,7 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
//如果展示权限是公开,则把该数据插入到搜索中心中。
this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
}
// this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
}
/**
@@ -403,7 +403,7 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
//this.deleteElasticsearchData(problemKnowledgeBaseEO.getId());
}
// this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
this.addOrUpdateElasticsearch(problemKnowledgeBaseEO);
}
/**
@@ -439,9 +439,9 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
this.problemKnowledgeBaseCommentEOService.remove(deleteWrapper);
// for (String problemKnowledgeBaseId : ids) {
// this.deleteElasticsearchData(problemKnowledgeBaseId);
// }
for (String problemKnowledgeBaseId : ids) {
this.deleteElasticsearchData(problemKnowledgeBaseId);
}
}
/**
@@ -146,7 +146,7 @@ public class LawsMonthlyReportManageEOServiceImpl extends ServiceImpl<LawsMonthl
this.updateById(lawsMonthlyReportManageEO);
// 同步es
// syncElasticsearch(id, issueStatus, issueTime);
syncElasticsearch(id, issueStatus, issueTime);
}
private void syncElasticsearch(String id, String issueStatus, Date issueTime) {
@@ -41,10 +41,7 @@ import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -547,20 +544,21 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
JSONObject jsonObjectThree = jeroElasticsearchTemplate.buildBoolQuery(null, null, queryMapJsonThree);
queryMapJsonAll.add(jsonObjectThree);
}
JSONObject sort = new JSONObject();
Map<String,Object> score = new HashMap<>();
Map<String,Object> score1 = new HashMap<>();
score.put("order","desc");
score1.put("_score",score);
sort.putAll(score1);
/*JSONObject sort = new JSONObject();
if(StringUtils.isEmpty(selectValue)){
Map<String,Object> createTime = new HashMap<>();
Map<String,Object> createTime1 = new HashMap<>();
createTime.put("order","desc");
createTime1.put("create_time",createTime);
sort.putAll(createTime1);
}*/
}else {
Map<String,Object> score = new HashMap<>();
Map<String,Object> score1 = new HashMap<>();
score.put("order","desc");
score1.put("_score",score);
sort.putAll(score1);
}
// Map<String,Object> mapSort = new HashMap<>();
// Map<String,Object> mapSortTemp = new HashMap<>();
@@ -1186,9 +1184,15 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
mapHighlight1.put("fields",mapHighlight);
}
//封装问题类型选择框查询条件。
//封装问题类型选择框查询条件(类似于in条件)。
if (StringUtils.isNotBlank(problem_type)) {
this.createQueryWhere(problem_type,"problem_type",queryMapJson,SearchEnum.INDEX_PROBLEM_KNOWLEDGE_BASE.getValue());
List<String> problemTypeList = Arrays.asList(problem_type.split(","));
Map<String, Object> problemTypeKeyMap = new HashMap<>();
Map<String, Object> problemTypeMatchMap = new HashMap<>();
problemTypeKeyMap.put("problem_type", problemTypeList);
problemTypeMatchMap.put("terms",problemTypeKeyMap);
queryMapJson.add(problemTypeMatchMap);
}
//封装市场选择框查询条件。
@@ -1258,6 +1262,12 @@ public class DocumentSearchServiceImpl implements IDocumentSearchService {
createTime.put("order","desc");
createTime1.put("create_time",createTime);
sort.putAll(createTime1);
}else {
Map<String,Object> score = new HashMap<>();
Map<String,Object> score1 = new HashMap<>();
score.put("order","desc");
score1.put("_score",score);
sort.putAll(score1);
}
Integer pageNo = Integer.parseInt(map.get("pageNo").toString());
@@ -144,10 +144,13 @@ public class LawsWarnService {
String beforeTimeTwelve = beforeTime(12,new Date());
Date parseSix = sdf.parse(beforeTimeSix);
Date parseTwelve = sdf.parse(beforeTimeTwelve);
if((newCarTimeDate.after(new Date()) && newCarTimeDate.before(parseSix)) || newCarTime.equals(beforeTimeSix)){
if((newCarTimeDate.after(new Date()) && newCarTimeDate.before(parseSix))
|| newCarTime.equals(beforeTimeSix)
||newCarTime.equals(sdf.format(new Date()))){
record.put("new_colour","red");
}
if((newCarTimeDate.after(parseSix) && newCarTimeDate.before(parseTwelve)) || newCarTime.equals(beforeTimeTwelve)){
if((newCarTimeDate.after(parseSix) && newCarTimeDate.before(parseTwelve))
|| newCarTime.equals(beforeTimeTwelve)){
record.put("new_colour","yellow");
}
}
@@ -164,10 +167,13 @@ public class LawsWarnService {
String beforeTimeTwelve = beforeTime(12,new Date());
Date parseSix = sdf.parse(beforeTimeSix);
Date parseTwelve = sdf.parse(beforeTimeTwelve);
if((implementTimeDate.after(new Date()) && implementTimeDate.before(parseSix)) || implementTime.equals(beforeTimeSix)){
if((implementTimeDate.after(new Date()) && implementTimeDate.before(parseSix))
|| implementTime.equals(beforeTimeSix)
|| implementTime.equals(sdf.format(new Date()))){
record.put("implement_colour","red");
}
if((implementTimeDate.after(parseSix) && implementTimeDate.before(parseTwelve)) || implementTime.equals(beforeTimeTwelve)){
if((implementTimeDate.after(parseSix) && implementTimeDate.before(parseTwelve))
|| implementTime.equals(beforeTimeTwelve)){
record.put("implement_colour","yellow");
}
}