add: 预警功能只预警最新文件类型的分解单
This commit is contained in:
@@ -19,6 +19,7 @@ import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||
import com.adc.da.slrs.sarUpdLog.service.ISarUpdLogService;
|
||||
import com.adc.da.sys.service.IDicTypeEOService;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
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;
|
||||
@@ -159,8 +160,33 @@ public class ScheduledJob {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//此处开始处理条款中的预警数据
|
||||
//查询符合预警期限的标准 多个
|
||||
List<WarningDate> warningDateOfItems = sarStandardWarningDao.getWarningDateOfItems(term);
|
||||
warningDateOfItems.forEach(item -> {
|
||||
for (String s : item.getSSRQ().split(",")) {
|
||||
String pattern = term.getTermStr();
|
||||
Pattern r = Pattern.compile(pattern);
|
||||
Matcher m = r.matcher(s);
|
||||
//判断是否是日期格式
|
||||
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);
|
||||
data.add(warningDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
//清空标准的日期子表
|
||||
iWarningDateService.remove(null);
|
||||
// 保存进入标准的日期子表 保存标准的实施日期 新车型实施日期 在产车实施日期 多个
|
||||
@@ -184,6 +210,52 @@ public class ScheduledJob {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 将文本状态转换成文件类型
|
||||
* @param textState
|
||||
* @return
|
||||
*/
|
||||
private String convertTextStateToItemType(String textState){
|
||||
String fileType ="";
|
||||
switch (textState){
|
||||
case "DRAFT"://草稿
|
||||
fileType="CA";
|
||||
break;
|
||||
case "ADVICE"://征求意见稿
|
||||
fileType="ZQYJG";
|
||||
break;
|
||||
case "RADYSUBMIT"://报批稿
|
||||
fileType="BPG";
|
||||
break;
|
||||
case "SUBMIT"://送审稿
|
||||
fileType="SSG";
|
||||
break;
|
||||
case "FJNVYX9Q7J"://发布稿
|
||||
fileType="FBGBJBD";
|
||||
break;
|
||||
case "ZTJJSS"://修订中
|
||||
fileType=null;
|
||||
break;
|
||||
case "TOVOID"://已作废
|
||||
fileType=null;
|
||||
break;
|
||||
case "ZTXXYX"://计划修订
|
||||
fileType=null;
|
||||
break;
|
||||
case "5E5Z3CELX6"://已实施
|
||||
fileType="FBGBJBD";
|
||||
break;
|
||||
case "N5KLTFLNRC"://已修订
|
||||
fileType=null;
|
||||
break;
|
||||
default:
|
||||
fileType=null;
|
||||
break;
|
||||
}
|
||||
return fileType;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISarUpdLogService sarUpdLogEOService;
|
||||
@@ -285,17 +357,10 @@ public class ScheduledJob {
|
||||
replaceIdCountMap.put(standId.get(0), 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
|
||||
for (String key : replaceIdCountMap.keySet()) {
|
||||
SarStandardsInfo sarStandardsInfo = new SarStandardsInfo();
|
||||
|
||||
@@ -23,4 +23,8 @@ public interface SarStandardWarningDao extends BaseMapper<EarlyWarningEO> {
|
||||
|
||||
public List<WarningDate> getWarningDate(TermDTO term);
|
||||
|
||||
public List<WarningDate> getWarningDateOfItems(TermDTO term);
|
||||
|
||||
public String getStandTextStateByStandId(String standId);
|
||||
|
||||
}
|
||||
|
||||
@@ -22,4 +22,6 @@ public class WarningDate {
|
||||
|
||||
@TableField("time_Name")
|
||||
private String timeName;
|
||||
|
||||
private String fileType;
|
||||
}
|
||||
|
||||
+25
-16
@@ -91,22 +91,6 @@ select A.* from
|
||||
from sar_stand_attr_info attr
|
||||
WHERE
|
||||
ZCCSSRQ REGEXP #{termStr}
|
||||
|
||||
|
||||
|
||||
UNION All
|
||||
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
|
||||
ZCCSSRQ as SSRQ
|
||||
from sar_stand_items item
|
||||
WHERE
|
||||
ZCCSSRQ REGEXP #{termStr}
|
||||
|
||||
UNION All
|
||||
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
|
||||
XCXSSRQ as SSRQ
|
||||
from sar_stand_items item
|
||||
WHERE
|
||||
XCXSSRQ REGEXP #{termStr}
|
||||
) AS A
|
||||
left join sar_standards_info as sarInfo
|
||||
on sarInfo.id=A.lawId
|
||||
@@ -115,5 +99,30 @@ select A.* from
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getWarningDateOfItems" resultType="com.adc.da.slrs.sarStandWarning.entity.WarningDate">
|
||||
select A.* from
|
||||
(
|
||||
select item.STAND_ID as lawId,item.ID as itemId,'ZCCSSRQ' as timeName,
|
||||
ZCCSSRQ as SSRQ,item.FILE_TYPE AS fileType
|
||||
from sar_stand_items item
|
||||
WHERE
|
||||
ZCCSSRQ REGEXP #{termStr}
|
||||
UNION All
|
||||
select item.STAND_ID as lawId,item.ID as itemId,'XCXSSRQ' as timeName,
|
||||
XCXSSRQ as SSRQ,item.FILE_TYPE AS fileType
|
||||
from sar_stand_items item
|
||||
WHERE
|
||||
XCXSSRQ REGEXP #{termStr}
|
||||
) AS A
|
||||
left join sar_standards_info as sarInfo
|
||||
on sarInfo.id=A.lawId
|
||||
where sarInfo.valid_flag = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getStandTextStateByStandId" resultType="java.lang.String">
|
||||
SELECT TEXT_STATUS FROM sar_standards_info WHERE ID = #{}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user