|
@@ -52,9 +52,61 @@ public class TaskHandler {
|
|
List<CenterdataTHousingconstructionEnterprise> enterpriseList = enterpriseService.selectCenterdataTHousingconstructionEnterpriseList(new CenterdataTHousingconstructionEnterprise());
|
|
List<CenterdataTHousingconstructionEnterprise> enterpriseList = enterpriseService.selectCenterdataTHousingconstructionEnterpriseList(new CenterdataTHousingconstructionEnterprise());
|
|
|
|
|
|
//获取每个企业每种报告的最新记录
|
|
//获取每个企业每种报告的最新记录
|
|
- List<CenterdataTHousingconstructionEnterpriseproductionreport> dataList = reportService.selectCenterdataTHousingconstructionEnterpriseproductionreportList(new CenterdataTHousingconstructionEnterpriseproductionreport());
|
|
|
|
|
|
+ List<CenterdataTHousingconstructionEnterpriseproductionreport> dataList = reportService.getNewReport(new CenterdataTHousingconstructionEnterpriseproductionreport());
|
|
|
|
|
|
- //获取报告类型
|
|
|
|
|
|
+
|
|
|
|
+ //遍历企业列表,获取企业信息
|
|
|
|
+ for (CenterdataTHousingconstructionEnterprise enterprise : enterpriseList) {
|
|
|
|
+ StringBuilder enterpriseStr = new StringBuilder();//事故隐患排查治理制度,安全事故应急救援预案,
|
|
|
|
+ //遍历字典集合,获取字典类型
|
|
|
|
+ for (SysDictData sysDictData : reportCacheList) {
|
|
|
|
+ //设置标识,最终根据标识判断是否序号将当前类型的报告拼接到事件描述中
|
|
|
|
+ boolean flag = true;
|
|
|
|
+ //遍历业务结果集
|
|
|
|
+ for (CenterdataTHousingconstructionEnterpriseproductionreport report : dataList) {
|
|
|
|
+ //如果企业id相同 并且 文件类型相同
|
|
|
|
+ if(report.getEnterpriseId().equals(enterprise.getId()) && report.getReportType().equals(sysDictData.getDictValue())){
|
|
|
|
+ //获取文件上传时间 + 阈值30天 与当前时间做比较
|
|
|
|
+ //获取数据的上传时间
|
|
|
|
+ Date createTime = report.getCreateTime();
|
|
|
|
+ // 将 Date 转换为 LocalDateTime
|
|
|
|
+ LocalDateTime localDateTime = convertToLocalDateTime(createTime);
|
|
|
|
+ // 在 LocalDateTime 上加上 30 天
|
|
|
|
+ LocalDateTime increaseBy30Days = localDateTime.plus(30, ChronoUnit.DAYS);
|
|
|
|
+ // 获取当前日期和时间
|
|
|
|
+ LocalDateTime now = LocalDateTime.now();
|
|
|
|
+ //文件上传时间没有超过设定的阈值, 不需要上报
|
|
|
|
+ if (increaseBy30Days.isAfter(now)) {
|
|
|
|
+ //拼接 事件描述
|
|
|
|
+ flag = false;
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(flag){
|
|
|
|
+ enterpriseStr.append(sysDictData.getDictLabel()).append(",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(enterpriseStr.length() > 0){
|
|
|
|
+ enterpriseStr.deleteCharAt(enterpriseStr.length() -1);
|
|
|
|
+ enterpriseStr.append(")发生%s, 超过30天未上传, 请及时处理!%s%s");
|
|
|
|
+ enterpriseStr.insert(0,enterprise.getEnterpriseName() +"的(");
|
|
|
|
+ //创建事件实体类
|
|
|
|
+ SensorEventVo sensorEventVo = new SensorEventVo(
|
|
|
|
+ enterprise.getLongitude(),
|
|
|
|
+ enterprise.getLatitude(),
|
|
|
|
+ enterprise.getId(),
|
|
|
|
+ enterprise.getEnterpriseName(),
|
|
|
|
+ new Date(),
|
|
|
|
+ enterprise.getRegisteredAddress()
|
|
|
|
+ );
|
|
|
|
+ //发送事件
|
|
|
|
+ sendEvent.sendEvent(enterpriseStr.toString(), StaticEntity.ENTERPRISE_NAME, "", "", sensorEventVo, StaticEntity.ENTERPRISE_CODE);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 每个企业每种类型的文件单独上报代码
|
|
|
|
+ /*//获取报告类型
|
|
reportCacheList.forEach(sysDictData -> {
|
|
reportCacheList.forEach(sysDictData -> {
|
|
//获取企业信息
|
|
//获取企业信息
|
|
enterpriseList.forEach(enterprise -> {
|
|
enterpriseList.forEach(enterprise -> {
|
|
@@ -90,12 +142,12 @@ public class TaskHandler {
|
|
);
|
|
);
|
|
//设置基础模板
|
|
//设置基础模板
|
|
StringBuilder template = new StringBuilder();
|
|
StringBuilder template = new StringBuilder();
|
|
- template.append(enterprise.getEnterpriseName()).append("的").append(sysDictData.getDictLabel()).append("发生%s,").append("超过30天未上传, 请及时处理!%s%s");
|
|
|
|
|
|
+ template.append(enterprise.getEnterpriseName()).append("的").append(sysDictData.getDictLabel()).append("发生%s, 超过30天未上传, 请及时处理!%s%s");
|
|
//发送事件
|
|
//发送事件
|
|
sendEvent.sendEvent(template.toString(), StaticEntity.ENTERPRISE_NAME, "", "", sensorEventVo, StaticEntity.ENTERPRISE_CODE);
|
|
sendEvent.sendEvent(template.toString(), StaticEntity.ENTERPRISE_NAME, "", "", sensorEventVo, StaticEntity.ENTERPRISE_CODE);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
- });
|
|
|
|
|
|
+ });*/
|
|
}
|
|
}
|
|
|
|
|
|
// 将 Date 转换为 LocalDateTime
|
|
// 将 Date 转换为 LocalDateTime
|