diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java index d4dcac1fd..e2c1e9bdd 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/document/service/impl/BussDocumentLibraryEOServiceImpl.java @@ -1735,9 +1735,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl> fileTextList = new ArrayList<>(); List oSSFileAll = new ArrayList<>(); Map stringObjectMap = new HashMap<>(); @@ -1750,7 +1748,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl entry : map.entrySet()) { + //es全文新增数据(数据转换) + esFullText(cut, fieldList, categoryList, dictItemList, mapList, sbCn,sbEn, entry); + } + + // 将用户选择、输入的在产车实施日期、新车型实施日期恢复 + map.put("implement_time",implement_time); + map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xin1_che1_xing2_shi2_shi1_ri4_qi1); + //多文件es List fileIdList = oSSFileAll.stream().map(OSSFile::getId).collect(Collectors.toList()); @@ -1953,9 +1972,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl phasedImplementationDetailsEOS = this.insertBatchPhasedImplementationDetailsInfo(map); - String replaceStandard = StringUtils.valueOf(map.get("replace_standard")); if (StringUtils.isNotBlank(replaceStandard)) { //新增时如果填写代替标准,需要向填写的代替标准的负责人发消息 @@ -2462,14 +2478,12 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl oSSFileAll = new ArrayList<>(); - StringBuilder sbCn = new StringBuilder(); - StringBuilder sbEn = new StringBuilder(); Map stringObjectMap = new HashMap<>(); for (Map.Entry entry : mapNew.entrySet()) { String key = entry.getKey(); Object value = entry.getValue(); //es全文新增数据(数据转换) - esFullText(cut, fieldList, categoryList, dictItemList, listMap, sbCn,sbEn, entry); + // esFullText(cut, fieldList, categoryList, dictItemList, listMap, sbCn,sbEn, entry); if (ObjectUtils.isNotEmpty(value)) { //处理修改人和修改时间 @@ -2535,6 +2549,24 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl ossFileList = fileSort(fieldFileList, fileInfos, stringObjectMap); + // 将用户选择、输入的新车型实施日期、在产车实施日期备份出来。如果不处理的话,插入ES时会报 解析失败 错误。 + String implement_time = (String) map.get("implement_time"); + String xin1_che1_xing2_shi2_shi1_ri4_qi1 = (String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"); + + // 批量添加分阶段实施明细信息 + this.insertBatchPhasedImplementationDetailsInfo(map); + + StringBuilder sbCn = new StringBuilder(); + StringBuilder sbEn = new StringBuilder(); + for (Map.Entry entry : map.entrySet()) { + //es全文新增数据(数据转换) + esFullText(cut, fieldList, categoryList, dictItemList, listMap, sbCn,sbEn, entry); + } + + // 将用户选择、输入的在产车实施日期、新车型实施日期恢复 + map.put("implement_time",implement_time); + map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",xin1_che1_xing2_shi2_shi1_ri4_qi1); + List> mapListTempCn = new ArrayList<>(); List> mapListTempEn = new ArrayList<>(); String fileTextAll = ""; @@ -2650,8 +2682,6 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl phasedImplDetailsEOList = this.insertBatchPhasedImplementationDetailsInfo(map); map.put("module_type", "文档库"); map.put("module_type_flag", ModuleTypeFlagEnum.DOCUMENT_LIBRARY.getValue()); @@ -4870,6 +4900,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl phasedImplDetailsQueryWrap = new QueryWrapper<>(); phasedImplDetailsQueryWrap.lambda().in(PhasedImplementationDetailsEO::getBussDocumentLibraryId,idList); phasedImplDetailsEOList = this.phasedImplementationDetailsEOService.list(phasedImplDetailsQueryWrap); + this.phasedImplementationDetailsEOService.disposeData(phasedImplDetailsEOList,cut); } for (Map data : datas) { @@ -4901,8 +4932,8 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl"); } - if(StringUtils.isNotEmpty(detailsEO.getImplementationType())){ - phasedImplDetailsSbTemp.append(detailsEO.getImplementationType()).append(""); + if(StringUtils.isNotEmpty(detailsEO.getImplementationTypeText())){ + phasedImplDetailsSbTemp.append(detailsEO.getImplementationTypeText()).append(""); } if(detailsEO.getImplementationDate()!=null){ phasedImplDetailsSbTemp.append(DateUtils.formatTime(detailsEO.getImplementationDate())).append(""); @@ -6874,6 +6905,55 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl newCarModelDateList = phasedImplDetailsEOList.stream().filter(phasedDetails -> { + boolean flag = false; + if (StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue())) { + flag = true; + } + return flag; + }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); + + Date newCarModelDate = null; + try { + if (StringUtils.isNotEmpty((String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))) { + newCarModelDate = DateUtils.parseDate((String) map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"), "yyyy-MM-dd"); + } + } catch (ParseException e) { + e.printStackTrace(); + } + if(newCarModelDate != null){ + newCarModelDateList.add(newCarModelDate); + } + + String newCarModelDateStr = DateUtils.formatDateList(newCarModelDateList); + map.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",newCarModelDateStr); + + // 处理在产车实施日期 + List carInProductionDateList = phasedImplDetailsEOList.stream().filter(phasedDetails -> { + boolean flag = false; + if (StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue())) { + flag = true; + } + return flag; + }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); + + Date carInProductionDateDate = null; + try { + if (StringUtils.isNotEmpty((String) map.get("implement_time"))) { + carInProductionDateDate = DateUtils.parseDate((String) map.get("implement_time"), "yyyy-MM-dd"); + } + } catch (ParseException e) { + e.printStackTrace(); + } + if(carInProductionDateDate != null){ + carInProductionDateList.add(carInProductionDateDate); + } + + String carInProductionDateStr = DateUtils.formatDateList(carInProductionDateList); + map.put("implement_time",carInProductionDateStr); } return phasedImplDetailsEOList; diff --git a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/LawsWarnService.java b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/LawsWarnService.java index 527eb8527..de4f64d82 100644 --- a/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/LawsWarnService.java +++ b/jero-boot/jero-boot-modules/src/main/java/com/jero/modules/warn/service/LawsWarnService.java @@ -1,5 +1,6 @@ package com.jero.modules.warn.service; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.jero.common.constant.enums.CutEnum; @@ -7,11 +8,16 @@ import com.jero.common.constant.enums.MessageTypeEnum; import com.jero.common.constant.enums.ModuleEnum; import com.jero.common.exception.JeroBootException; import com.jero.common.system.vo.LoginUser; +import com.jero.common.util.DateUtils; import com.jero.generater.modules.online.cgform.entity.OnlCgformField; import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl; +import com.jero.modules.document.entity.PhasedImplementationDetailsEO; import com.jero.modules.document.enums.FieldTypeEnum; +import com.jero.modules.document.enums.ImplementationTypeEnum; import com.jero.modules.document.mapper.BussDocumentLibraryEOMapper; +import com.jero.modules.document.service.IPhasedImplementationDetailsEOService; import com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl; +import com.jero.modules.dummy.entity.DummyInventoryInfoEO; import com.jero.modules.feishu.service.IFeishuService; import com.jero.modules.feishu.vo.FeishuMsgVo; import com.jero.modules.system.entity.SysAnnouncement; @@ -24,6 +30,7 @@ import com.jero.modules.system.service.ISysUserService; import com.jero.modules.system.service.impl.SysCategoryServiceImpl; import com.jero.modules.system.service.impl.SysDictItemServiceImpl; import com.jero.modules.system.util.StringUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.ss.usermodel.CellStyle; import org.apache.poi.ss.usermodel.HorizontalAlignment; @@ -82,6 +89,8 @@ public class LawsWarnService { private ISysAnnouncementService sysAnnouncementService; @Resource private IFeishuService iFeishuService; + @Autowired + private IPhasedImplementationDetailsEOService phasedImplementationDetailsEOService; public IPage getInfoPage(Map parameter) { String cut = (String) parameter.get("cut");//中英文切换标识 @@ -183,8 +192,85 @@ public class LawsWarnService { } } } + + this.disposeData(records,cut); + return infoPage; } + + private void disposeData(List datas, String cut) { + if(CollectionUtils.isNotEmpty(datas)){ + List bussDocumentLibraryIdList = datas.stream().map(data -> (String) data.get("id")).distinct().collect(Collectors.toList()); + QueryWrapper phasedDetailsQueryWrap = new QueryWrapper<>(); + phasedDetailsQueryWrap.lambda().in(PhasedImplementationDetailsEO::getBussDocumentLibraryId,bussDocumentLibraryIdList); + List phasedDetailsList = this.phasedImplementationDetailsEOService.list(phasedDetailsQueryWrap); + + // 新车型分阶段实施数据信息 + List newCarModelPhasedDetailsList = phasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if(org.apache.commons.lang3.StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.NEW_CAR_MODEL.getItemValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + // 在产车分阶段实施数据信息 + List carInProductionPhasedDetailsList = phasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if(org.apache.commons.lang3.StringUtils.contains(phasedDetails.getImplementationType(), ImplementationTypeEnum.CAR_IN_PRODUCTION.getItemValue())){ + flag = true; + } + return flag; + }).collect(Collectors.toList()); + + for (Map data : datas) { + String bussDocumentLibraryId = (String) data.get("id"); + + // 处理新车型实施日期展示 + List newCarModelDateList = newCarModelPhasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if (org.apache.commons.lang3.StringUtils.equals(phasedDetails.getBussDocumentLibraryId(), bussDocumentLibraryId)) { + flag = true; + } + return flag; + }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); + + + Date newCarModelDate = null; + try { + newCarModelDate = DateUtils.parseDate((String) data.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"), "yyyy-MM-dd"); + } catch (ParseException e) { + e.printStackTrace(); + } + if(newCarModelDate != null){ + newCarModelDateList.add(newCarModelDate); + } + String newCarModelDateStr = DateUtils.formatDateList(newCarModelDateList); + data.put("xin1_che1_xing2_shi2_shi1_ri4_qi1",newCarModelDateStr); + + // 处理在产车实施日期展示 + List carInProductionDateList = carInProductionPhasedDetailsList.stream().filter(phasedDetails -> { + boolean flag = false; + if (org.apache.commons.lang3.StringUtils.equals(phasedDetails.getBussDocumentLibraryId(), bussDocumentLibraryId)) { + flag = true; + } + return flag; + }).map(PhasedImplementationDetailsEO::getImplementationDate).collect(Collectors.toList()); + Date implementTime = null; + try { + implementTime = DateUtils.parseDate((String) data.get("implement_time"), "yyyy-MM-dd"); + } catch (ParseException e) { + e.printStackTrace(); + } + if(implementTime != null){ + carInProductionDateList.add(implementTime); + } + String carInProductionDateStr = DateUtils.formatDateList(carInProductionDateList); + data.put("implement_time",carInProductionDateStr); + } + } + } + private String beforeTime (int month, Date date){ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar calendarBefore = Calendar.getInstance();