文本状态更新被代替,废止根据代替标准号
This commit is contained in:
@@ -12,6 +12,7 @@ import com.adc.da.slrs.sarStandardsInfo.dao.SarStandardsInfoDao;
|
|||||||
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
import com.adc.da.slrs.sarStandardsInfo.entity.SarStandardsInfo;
|
||||||
import com.adc.da.util.UUIDUtils;
|
import com.adc.da.util.UUIDUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.sun.corba.se.spi.ior.iiop.IIOPFactories;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -174,8 +175,8 @@ public class ScheduledJob {
|
|||||||
/**
|
/**
|
||||||
* 定时更新文本状态
|
* 定时更新文本状态
|
||||||
*/
|
*/
|
||||||
// @Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
@Scheduled(cron = "0 0 0 * * ?") //每天的凌晨0点执行
|
||||||
@Scheduled(cron="*/5 * * * * ?")
|
// @Scheduled(cron="*/5 * * * * ?")
|
||||||
@Async
|
@Async
|
||||||
public void TextStatusSchedulingTasks() {
|
public void TextStatusSchedulingTasks() {
|
||||||
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
|
QueryWrapper<SarStandardsInfo> wrapper = new QueryWrapper<>();
|
||||||
@@ -208,30 +209,56 @@ public class ScheduledJob {
|
|||||||
/**
|
/**
|
||||||
* 被多个标准代替的标准变为“被代替”,只被一个标准代替的自动变为“废止”
|
* 被多个标准代替的标准变为“被代替”,只被一个标准代替的自动变为“废止”
|
||||||
*/
|
*/
|
||||||
QueryWrapper<SarStandardsInfo> columns = new QueryWrapper<>();
|
QueryWrapper<SarStandAttrInfo> columnForDTBJH = new QueryWrapper<>();
|
||||||
|
|
||||||
columns.select("REPLACE_STAND_NUM");
|
columnForDTBJH.select("DTBJH");
|
||||||
//查询代替标准字段得到一个 被代替了的标准的id的键值对列表
|
//查询代替标准字段得到一个 被代替了的标准的id的键值对列表
|
||||||
List<Map<String, Object>> replaceStandIdMaps = sarStandardsInfoDao.selectMaps(columns);
|
List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH);
|
||||||
HashMap<String, Integer> replaceIdCountMap = new HashMap<>();
|
HashMap<String, Integer> replaceIdCountMap = new HashMap<>();
|
||||||
|
|
||||||
replaceStandIdMaps.forEach(item->{
|
|
||||||
if (item!=null){
|
|
||||||
//此标准代替的标准的id数组
|
|
||||||
String[] standIds = item.get("REPLACE_STAND_NUM").toString().split(",");
|
|
||||||
for (String standId : standIds) {
|
|
||||||
|
|
||||||
//如果代替标准id已存在则映射为2不存在则添加并映射为1
|
replaceStandIdMaps.forEach(item->{
|
||||||
if (replaceIdCountMap.containsKey(standId)) {
|
if (item!=null){
|
||||||
replaceIdCountMap.replace(standId,2);
|
//此标准代替的标准的标准号的数组
|
||||||
}else {
|
String DTBJHStr = item.get("DTBJH").toString();
|
||||||
replaceIdCountMap.put(standId, 1);
|
if (!DTBJHStr.equals("")){
|
||||||
}
|
String[] DTBJHArray = DTBJHStr.split(",");
|
||||||
}
|
for (String DTBJH : DTBJHArray) {
|
||||||
|
String[] sortOrNumberAndYear = DTBJH.split("\\s+");
|
||||||
|
String sort = sortOrNumberAndYear[0];
|
||||||
|
|
||||||
|
String[] numberOrYear = sortOrNumberAndYear[1].split("\\-");
|
||||||
|
String number=numberOrYear[0];
|
||||||
|
String year=numberOrYear[1];
|
||||||
|
|
||||||
|
QueryWrapper<SarStandardsInfo> infoWrapper = new QueryWrapper<>();
|
||||||
|
infoWrapper.select("ID")
|
||||||
|
.eq("STAND_SORT",sort)
|
||||||
|
.eq("STAND_NUMBER",number)
|
||||||
|
.eq("STAND_YEAR",year);
|
||||||
|
|
||||||
|
|
||||||
|
List<Map<String, Object>> idMaps = sarStandardsInfoDao.selectMaps(infoWrapper);
|
||||||
|
String standId = idMaps.get(0).get("ID").toString();
|
||||||
|
|
||||||
|
//如果代替标准id已存在则映射为2不存在则添加并映射为1
|
||||||
|
if (replaceIdCountMap.containsKey(standId)) {
|
||||||
|
replaceIdCountMap.replace(standId,2);
|
||||||
|
}else {
|
||||||
|
replaceIdCountMap.put(standId, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
|
//一个被代替标准号时,文本状态更新为废止状态,两个及以上时更新为被代替状态
|
||||||
|
|||||||
Reference in New Issue
Block a user