修复了定时更新文本状态,由于海外标准的格式与不与国内相同,添加了新的标准号查询方法

This commit is contained in:
zhaokaiyao@91isoft.com
2022-01-15 17:02:26 +08:00
parent 421df00d9b
commit 84a246ea06
3 changed files with 53 additions and 19 deletions
@@ -230,7 +230,10 @@ public class ScheduledJob {
List<Map<String, Object>> replaceStandIdMaps = sarStandAttrInfoDao.selectMaps(columnForDTBJH);
HashMap<String, Integer> replaceIdCountMap = new HashMap<>();
// 格式为 T/CSAE 175-2021
Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
/**
* 国内外表准号格式不统一
*/
// Pattern pattern = Pattern.compile("^\\S*\\s\\S*[\\u2014\\u002d\\s]\\d{4}$");
replaceStandIdMaps.forEach(item->{
if (item!=null){
//此标准代替的标准的标准号的数组
@@ -241,30 +244,30 @@ public class ScheduledJob {
String[] DTBJHArray = DTBJHStr.split(",");
for (String DTBJH : DTBJHArray) {
if (!pattern.matcher(DTBJH).matches()){
continue;
}
// if (!pattern.matcher(DTBJH).matches()){
// continue;
// }
String[] split = DTBJH.split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
String sort = split[0];
String number = split[1];
String year = split[2];
QueryWrapper<SarStandardsInfo> infoWrapper = new QueryWrapper<>();
infoWrapper.select("ID")
.eq("STAND_SORT", sort)
.eq("STAND_NUMBER", number)
.eq("STAND_YEAR", year);
// String[] split = DTBJH.split("[\\u2014\\u002d\\s]");//以空格或'-'或'—'分割
// String sort = split[0];
// String number = split[1];
// String year = split[2];
//
// 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);
if (idMaps.size() > 0) {
String standId = idMaps.get(0).get("ID").toString();
List<String> standId = sarStandardsInfoDao.selectIdFormDTBZH(DTBJH);
if (standId.size() > 0) {
//如果代替标准id已存在则映射为2不存在则添加并映射为1
if (replaceIdCountMap.containsKey(standId)) {
replaceIdCountMap.replace(standId, 2);
replaceIdCountMap.replace(standId.get(0), 2);
} else {
replaceIdCountMap.put(standId, 1);
replaceIdCountMap.put(standId.get(0), 1);
}
}
@@ -74,4 +74,7 @@ public interface SarStandardsInfoDao extends BaseMapper<SarStandardsInfo> {
int updateISRELATEACCESSById(@Param("IS_RELATE_ACCESS") String ACCESS,@Param("list") List<String> list);
List<String> selectIdFormDTBZH(String DTBZHCode);
}