diff --git a/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java index 15007290..14f076a5 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java +++ b/adc-da-slrs/src/main/java/com/adc/da/scheduled/ScheduledJob.java @@ -23,6 +23,7 @@ import com.adc.da.utils.util.InitStandAttrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import lombok.extern.slf4j.Slf4j; import net.sf.json.JSONObject; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -155,7 +156,7 @@ public class ScheduledJob { BeanUtils.copyProperties(item, warningDate); warningDate.setId(UUIDUtils.randomUUID20()); warningDate.setSSRQ(s); - warningDate.setFileType("0"); + warningDate.setType("0"); data.add(warningDate); } } @@ -163,13 +164,16 @@ public class ScheduledJob { //此处开始处理条款中的预警数据 //查询符合预警期限的标准 多个 List warningDateOfItems = sarStandardWarningDao.getWarningDateOfItems(term); + //第二步便利相同的 +// List second = sarStandardWarningDao.getWarningDateOfItems(term); + Map> standMap = new HashMap<>(); warningDateOfItems.forEach(item -> { for (String s : item.getSSRQ().split(",")) { - String id = item.getLawId(); - if (id.equals("vgh0j186ve7uhxjelctt")){ - System.out.println(id); - } - System.out.println(id); +// String id = item.getLawId(); +// if (id.equals("vgh0j186ve7uhxjelctt")){ +// System.out.println(id); +// } +// System.out.println(id); String pattern = term.getTermStr(); Pattern r = Pattern.compile(pattern); Matcher m = r.matcher(s); @@ -177,22 +181,32 @@ public class ScheduledJob { if (m.matches()) { //此处判断当前条款的数据是否是最新状态的 String lawsId = item.getLawId(); - String fileType =item.getFileType(); - String textState = sarStandardWarningDao.getStandTextStateByStandId(lawsId); - if(StringUtils.isNotBlank(textState)){ - String convertFileType = convertTextStateToItemType(textState); - if(StringUtils.isNotBlank(convertFileType) && fileType.equals(convertFileType)){ - WarningDate warningDate = new WarningDate(); - BeanUtils.copyProperties(item, warningDate); - warningDate.setId(UUIDUtils.randomUUID20()); - warningDate.setSSRQ(s); - warningDate.setFileType("1"); - data.add(warningDate); - } +// String fileType =item.getFileType(); +// String textState = sarStandardWarningDao.getStandTextStateByStandId(lawsId); + List warningDates = null; + if(standMap.containsKey(lawsId)){ + warningDates = standMap.get(lawsId); + }else{ + warningDates=new ArrayList<>(); } + WarningDate warningDate = new WarningDate(); + BeanUtils.copyProperties(item, warningDate); + warningDate.setId(UUIDUtils.randomUUID20()); + warningDate.setSSRQ(s); + warningDate.setType("1"); + warningDates.add(warningDate); + standMap.put(lawsId,warningDates); } } }); + for (String lawId : standMap.keySet()){ + List warningDates = standMap.get(lawId); + List warningDateSend = compareState(warningDates); + if (null != warningDateSend) { + data.addAll(warningDateSend); + } + } + //清空标准的日期子表 iWarningDateService.remove(null); // 保存进入标准的日期子表 保存标准的实施日期 新车型实施日期 在产车实施日期 多个 @@ -216,6 +230,60 @@ public class ScheduledJob { } } + private List compareState(List warningDates){ + List ca = new ArrayList<>(); + List zqyjg = new ArrayList<>(); + List bpg = new ArrayList<>(); + List ssg = new ArrayList<>(); + List fbgbjbd = new ArrayList<>(); + for (WarningDate warningDate :warningDates){ + if (null == warningDate.getFileType()){ + warningDate.setFileType(""); + } + switch (warningDate.getFileType()){ + case "CA"://草稿 + ca.add(warningDate); +// fileType="CA"; + break; + case "ZQYJG"://征求意见稿 + zqyjg.add(warningDate); +// fileType="ZQYJG"; + break; + case "BPG"://报批稿 + bpg.add(warningDate); +// fileType="BPG"; + break; + case "SSG"://送审稿 + ssg.add(warningDate); +// fileType="SSG"; + break; + case "FBGBJBD"://发布稿 + fbgbjbd.add(warningDate); +// fileType="FBGBJBD"; + break; +// case "vsaga7nwub"://已实施 +// fbgbjbd.add(warningDate); +//// fileType="FBGBJBD"; +// break; + default: + break; + } + } + if (!CollectionUtils.isEmpty(fbgbjbd)){ + return fbgbjbd; + }else if (!CollectionUtils.isEmpty(ssg)){ + return ssg; + }else if (!CollectionUtils.isEmpty(bpg)){ + return bpg; + }else if (!CollectionUtils.isEmpty(zqyjg)){ + return zqyjg; + }else if (!CollectionUtils.isEmpty(ca)){ + return ca; + }else{ + return null; + } + } + /** * 将文本状态转换成文件类型 * @param textState diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandWarning/entity/WarningDate.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandWarning/entity/WarningDate.java index a0c63994..1bcd8c59 100644 --- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandWarning/entity/WarningDate.java +++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandWarning/entity/WarningDate.java @@ -24,5 +24,8 @@ public class WarningDate { private String timeName; @TableField("type") + private String type; + + @TableField(exist = false) private String fileType; }