|
|
|
|
@ -22,6 +22,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.math.RoundingMode; |
|
|
|
|
import java.sql.Timestamp; |
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
import java.time.Instant; |
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
@ -52,6 +53,8 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
|
|
|
|
|
|
|
|
|
|
public final ModelClueDataMapper modelClueDataMapper; |
|
|
|
|
|
|
|
|
|
public final ModelClueDataDMMapper modelClueDataDMMapper; |
|
|
|
|
|
|
|
|
|
public final ModelClueRecordMapper modelClueRecordMapper; |
|
|
|
|
|
|
|
|
|
public final SupExternalDepartMapper supExternalDepartMapper; |
|
|
|
|
@ -230,6 +233,9 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
|
|
|
|
|
} else if (modelId == 20) { // 20号模型:连续7天上传散油购销记录小于10的异常数据
|
|
|
|
|
getModelCluesForModel20(sql, modelClues); |
|
|
|
|
return modelClues; |
|
|
|
|
} else if (modelId == 22) { // 22号模型:执法记录仪使用不规范问题
|
|
|
|
|
getModelCluesForModel22(sql, modelClues); |
|
|
|
|
return modelClues; |
|
|
|
|
} else { |
|
|
|
|
System.out.println("模型" + modelId + "开始查询数据库"); |
|
|
|
|
modelClues = modelClueDataMapper.selectDataByDynamicSql(sql); |
|
|
|
|
@ -696,6 +702,62 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void getModelCluesForModel22(String sql, List<ModelClue> modelClues) { |
|
|
|
|
System.out.println("模型22开始查询数据库"); |
|
|
|
|
List<Map<String, Object>> sqlList = modelClueDataDMMapper.selectByUniqueKeys(sql); |
|
|
|
|
System.out.println("模型22查询数据库完毕"); |
|
|
|
|
if (sqlList.isEmpty()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
for (Map<String, Object> map : sqlList) { |
|
|
|
|
ModelClue newModelClue = new ModelClue(); |
|
|
|
|
newModelClue.setUniqueKey(""); |
|
|
|
|
newModelClue.setNegativeIdEx(""); |
|
|
|
|
newModelClue.setInvolvePoliceName((String) map.get("USERNAME")); |
|
|
|
|
newModelClue.setInvolveDepartName((String) map.get("orgname")); |
|
|
|
|
SupExternalDepart supExternalDepart = supExternalDepartMapper.selectOne(new LambdaQueryWrapper<SupExternalDepart>().eq(SupExternalDepart::getInternalName, map.get("orgname")).last("LIMIT 1")); |
|
|
|
|
if (supExternalDepart != null) { |
|
|
|
|
if (supExternalDepart.getInternalId() != null) { |
|
|
|
|
newModelClue.setInvolveDepartId(supExternalDepart.getInternalId()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
newModelClue.setData(JSONObject.toJSONString(map)); |
|
|
|
|
newModelClue.setDistributionState("0"); |
|
|
|
|
String createTime = ""; |
|
|
|
|
Object createTimeObj = map.get("CREATETIME"); |
|
|
|
|
try { |
|
|
|
|
if (createTimeObj instanceof Timestamp timestamp) { |
|
|
|
|
Instant instant = timestamp.toInstant(); |
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
|
|
LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); |
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日"); |
|
|
|
|
createTime = "于" + formatter.format(localDateTime); |
|
|
|
|
} else if (createTimeObj instanceof String createTimeStr) { |
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSSSS"); |
|
|
|
|
Date parseDate = sdf.parse(createTimeStr); |
|
|
|
|
Instant instant = parseDate.toInstant(); |
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
|
|
LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); |
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日"); |
|
|
|
|
createTime = "于" + formatter.format(localDateTime); |
|
|
|
|
} else if (createTimeObj instanceof Date date) { |
|
|
|
|
Instant instant = date.toInstant(); |
|
|
|
|
ZoneId zoneId = ZoneId.systemDefault(); |
|
|
|
|
LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); |
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy年MM月dd日"); |
|
|
|
|
createTime = "于" + formatter.format(localDateTime); |
|
|
|
|
} |
|
|
|
|
} catch (Exception ex) { |
|
|
|
|
log.error("模型20日期解析失败: {}", ex.getMessage(), ex); |
|
|
|
|
} |
|
|
|
|
newModelClue.setThingDesc( |
|
|
|
|
"灵敏感知系统" + createTime + "发现" + newModelClue.getInvolveDepartName() + "有" |
|
|
|
|
+ map.get("TYPENAME") + "的问题,问题详情:“" |
|
|
|
|
+ map.get("DESCRIBEDETAILS") + "”,请予以重点关注。"); |
|
|
|
|
modelClues.add(newModelClue); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void mergeModelClues(List<ModelClue> modelClues2, List<ModelClue> modelClues1 , int no) { |
|
|
|
|
for (ModelClue modelClue2 : modelClues2) { |
|
|
|
|
Iterator<ModelClue> iterator1 = modelClues1.iterator(); |
|
|
|
|
|