|
|
|
|
@ -3,6 +3,7 @@ package com.hisense.hiatmp.server_api.controller; |
|
|
|
|
import com.github.pagehelper.PageHelper; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import com.hisense.hiatmp.model.common.*; |
|
|
|
|
import com.hisense.hiatmp.server_api.mapper.ConfigureMapper; |
|
|
|
|
import com.hisense.hiatmp.server_api.mapper.HighDangerMapper; |
|
|
|
|
import com.hisense.hiatmp.server_api.mapper.OperatorMapper; |
|
|
|
|
import com.hisense.hiatmp.model.common.DangerProblem; |
|
|
|
|
@ -35,6 +36,9 @@ public class HighDangerController { |
|
|
|
|
@Autowired |
|
|
|
|
HighDangerService highDangerService; |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
ConfigureMapper configureMapper; |
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
查询各个状态的数据情况 |
|
|
|
|
*/ |
|
|
|
|
@ -75,6 +79,8 @@ public class HighDangerController { |
|
|
|
|
return ServerResponse.error("未找到当前用户"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int termTime = Integer.parseInt(configureMapper.getTermTime()); |
|
|
|
|
|
|
|
|
|
//Page<HighDangerBase> page = new Page<>(pageNum, pageSize);
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
|
// 将要查询的状态和部门id查询数据库,获得隐患排查表
|
|
|
|
|
@ -88,7 +94,8 @@ public class HighDangerController { |
|
|
|
|
|
|
|
|
|
for (HighDangerBase base : statusCounts) { |
|
|
|
|
Date nowDate = new Date(); |
|
|
|
|
Date pcEndTime = base.getPcEndTime(); |
|
|
|
|
Date pcEndTime = base.getRoadPcEndTime(); |
|
|
|
|
Date pcStartTime = base.getPcStartTime(); |
|
|
|
|
if (pcEndTime != null) { |
|
|
|
|
long diff = nowDate.getTime() - pcEndTime.getTime(); |
|
|
|
|
// 时间差,天数
|
|
|
|
|
@ -122,7 +129,7 @@ public class HighDangerController { |
|
|
|
|
base.setDeadline(diffDays); |
|
|
|
|
base.setDeadlineStatus("超期" + diffDays + "天" + remainingHours + "小时"); |
|
|
|
|
base.setDeadlineType("1"); |
|
|
|
|
} else if (comparison > 0 && diffDays <= 3) { // 临期
|
|
|
|
|
} else if (comparison > 0 && diffDays <= termTime) { // 临期
|
|
|
|
|
if (diffHours < 1) { |
|
|
|
|
base.setDeadlineStatus("临期不足一小时"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
@ -145,8 +152,67 @@ public class HighDangerController { |
|
|
|
|
base.setDeadlineStatus("正常"); |
|
|
|
|
base.setDeadlineType("3"); |
|
|
|
|
} |
|
|
|
|
} else if(pcStartTime != null){ |
|
|
|
|
// 无排查结束时间,根据开始时间判断
|
|
|
|
|
long diff = nowDate.getTime() - pcStartTime.getTime(); |
|
|
|
|
|
|
|
|
|
// 时间差,天数
|
|
|
|
|
long diffDays = diff / (24 * 60 * 60 * 1000); |
|
|
|
|
diffDays = Math.abs(diffDays); |
|
|
|
|
|
|
|
|
|
// 小时
|
|
|
|
|
long remainingHours = (diff % (24 * 60 * 60 * 1000)) / (60 * 60 * 1000); |
|
|
|
|
remainingHours = Math.abs(remainingHours); |
|
|
|
|
|
|
|
|
|
// 判断不足一小时
|
|
|
|
|
long diffHours = diff / (60 * 60 * 1000); |
|
|
|
|
diffHours = Math.abs(diffHours); |
|
|
|
|
|
|
|
|
|
int comparison = nowDate.compareTo(pcStartTime); |
|
|
|
|
if (comparison < 0) { // 超期
|
|
|
|
|
if (diffHours < 1) { |
|
|
|
|
base.setDeadlineStatus("超期不足一小时"); |
|
|
|
|
base.setDeadlineType("1"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
if(diffDays == 0){ |
|
|
|
|
base.setDeadlineStatus("超期" + remainingHours + "小时"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
continue; |
|
|
|
|
}else if(remainingHours == 0){ |
|
|
|
|
base.setDeadlineStatus("超期" + diffDays + "天"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
base.setDeadline(diffDays); |
|
|
|
|
base.setDeadlineStatus("超期" + diffDays + "天" + remainingHours + "小时"); |
|
|
|
|
base.setDeadlineType("1"); |
|
|
|
|
} else if (comparison > 0 && diffDays <= termTime) { // 临期
|
|
|
|
|
if (diffHours < 1) { |
|
|
|
|
base.setDeadlineStatus("临期不足一小时"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
base.setDeadline(diffDays); |
|
|
|
|
if (diffDays == 0) { |
|
|
|
|
base.setDeadlineStatus("临期" + remainingHours + "小时"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
continue; |
|
|
|
|
} else if (remainingHours == 0) { |
|
|
|
|
base.setDeadlineStatus("临期" + diffDays + "天"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
base.setDeadlineStatus("临期" + diffDays + "天" + remainingHours + "小时"); |
|
|
|
|
base.setDeadlineType("2"); |
|
|
|
|
}else{ |
|
|
|
|
base.setDeadlineStatus("正常"); |
|
|
|
|
base.setDeadlineType("3"); |
|
|
|
|
} |
|
|
|
|
// base.setDeadlineStatus("无排查结束时间");
|
|
|
|
|
// base.setDeadlineType("3");
|
|
|
|
|
}else{ |
|
|
|
|
base.setDeadlineStatus("无排查结束时间"); |
|
|
|
|
base.setDeadlineStatus("无排查结束和开始时间"); |
|
|
|
|
base.setDeadlineType("3"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|