定时任务:预警
This commit is contained in:
@@ -23,6 +23,7 @@ import com.adc.da.utils.util.InitStandAttrUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -155,7 +156,7 @@ public class ScheduledJob {
|
|||||||
BeanUtils.copyProperties(item, warningDate);
|
BeanUtils.copyProperties(item, warningDate);
|
||||||
warningDate.setId(UUIDUtils.randomUUID20());
|
warningDate.setId(UUIDUtils.randomUUID20());
|
||||||
warningDate.setSSRQ(s);
|
warningDate.setSSRQ(s);
|
||||||
warningDate.setFileType("0");
|
warningDate.setType("0");
|
||||||
data.add(warningDate);
|
data.add(warningDate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -163,13 +164,16 @@ public class ScheduledJob {
|
|||||||
//此处开始处理条款中的预警数据
|
//此处开始处理条款中的预警数据
|
||||||
//查询符合预警期限的标准 多个
|
//查询符合预警期限的标准 多个
|
||||||
List<WarningDate> warningDateOfItems = sarStandardWarningDao.getWarningDateOfItems(term);
|
List<WarningDate> warningDateOfItems = sarStandardWarningDao.getWarningDateOfItems(term);
|
||||||
|
//第二步便利相同的
|
||||||
|
// List<WarningDate> second = sarStandardWarningDao.getWarningDateOfItems(term);
|
||||||
|
Map<String,List<WarningDate>> standMap = new HashMap<>();
|
||||||
warningDateOfItems.forEach(item -> {
|
warningDateOfItems.forEach(item -> {
|
||||||
for (String s : item.getSSRQ().split(",")) {
|
for (String s : item.getSSRQ().split(",")) {
|
||||||
String id = item.getLawId();
|
// String id = item.getLawId();
|
||||||
if (id.equals("vgh0j186ve7uhxjelctt")){
|
// if (id.equals("vgh0j186ve7uhxjelctt")){
|
||||||
System.out.println(id);
|
// System.out.println(id);
|
||||||
}
|
// }
|
||||||
System.out.println(id);
|
// System.out.println(id);
|
||||||
String pattern = term.getTermStr();
|
String pattern = term.getTermStr();
|
||||||
Pattern r = Pattern.compile(pattern);
|
Pattern r = Pattern.compile(pattern);
|
||||||
Matcher m = r.matcher(s);
|
Matcher m = r.matcher(s);
|
||||||
@@ -177,22 +181,32 @@ public class ScheduledJob {
|
|||||||
if (m.matches()) {
|
if (m.matches()) {
|
||||||
//此处判断当前条款的数据是否是最新状态的
|
//此处判断当前条款的数据是否是最新状态的
|
||||||
String lawsId = item.getLawId();
|
String lawsId = item.getLawId();
|
||||||
String fileType =item.getFileType();
|
// String fileType =item.getFileType();
|
||||||
String textState = sarStandardWarningDao.getStandTextStateByStandId(lawsId);
|
// String textState = sarStandardWarningDao.getStandTextStateByStandId(lawsId);
|
||||||
if(StringUtils.isNotBlank(textState)){
|
List<WarningDate> warningDates = null;
|
||||||
String convertFileType = convertTextStateToItemType(textState);
|
if(standMap.containsKey(lawsId)){
|
||||||
if(StringUtils.isNotBlank(convertFileType) && fileType.equals(convertFileType)){
|
warningDates = standMap.get(lawsId);
|
||||||
WarningDate warningDate = new WarningDate();
|
}else{
|
||||||
BeanUtils.copyProperties(item, warningDate);
|
warningDates=new ArrayList<>();
|
||||||
warningDate.setId(UUIDUtils.randomUUID20());
|
|
||||||
warningDate.setSSRQ(s);
|
|
||||||
warningDate.setFileType("1");
|
|
||||||
data.add(warningDate);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
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<WarningDate> warningDates = standMap.get(lawId);
|
||||||
|
List<WarningDate> warningDateSend = compareState(warningDates);
|
||||||
|
if (null != warningDateSend) {
|
||||||
|
data.addAll(warningDateSend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//清空标准的日期子表
|
//清空标准的日期子表
|
||||||
iWarningDateService.remove(null);
|
iWarningDateService.remove(null);
|
||||||
// 保存进入标准的日期子表 保存标准的实施日期 新车型实施日期 在产车实施日期 多个
|
// 保存进入标准的日期子表 保存标准的实施日期 新车型实施日期 在产车实施日期 多个
|
||||||
@@ -216,6 +230,60 @@ public class ScheduledJob {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private List<WarningDate> compareState(List<WarningDate> warningDates){
|
||||||
|
List<WarningDate> ca = new ArrayList<>();
|
||||||
|
List<WarningDate> zqyjg = new ArrayList<>();
|
||||||
|
List<WarningDate> bpg = new ArrayList<>();
|
||||||
|
List<WarningDate> ssg = new ArrayList<>();
|
||||||
|
List<WarningDate> 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
|
* @param textState
|
||||||
|
|||||||
@@ -24,5 +24,8 @@ public class WarningDate {
|
|||||||
private String timeName;
|
private String timeName;
|
||||||
|
|
||||||
@TableField("type")
|
@TableField("type")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
private String fileType;
|
private String fileType;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user