调整服务指令预览界面 超时指令判断规则
This commit is contained in:
parent
a47bd86dec
commit
c812da2a07
|
|
@ -13,6 +13,7 @@ import org.jeecg.common.api.vo.Result;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -146,59 +147,73 @@ public class CareDirectiveApi {
|
||||||
|
|
||||||
//给数据加标识
|
//给数据加标识
|
||||||
if (!CollectionUtils.isEmpty(history)) {
|
if (!CollectionUtils.isEmpty(history)) {
|
||||||
|
//未结束就是未执行;结束时间在应该结束时间后就是超时
|
||||||
history.stream().forEach(item -> {
|
history.stream().forEach(item -> {
|
||||||
if ("N".equals(item.getIzStart())) {
|
if ("N".equals(item.getIzFinish())) {
|
||||||
// 未开始
|
//未执行
|
||||||
item.setExecuteStatus("hisUnExe");
|
item.setExecuteStatus("hisUnExe");
|
||||||
} else {
|
} else if (item.getFinishTime().after(item.getEndTime())) {
|
||||||
// 已开始
|
//超时
|
||||||
Date ygjssj = item.getEndTime(); // 应该结束时间
|
|
||||||
Date sjkssj = item.getBeginTime(); // 实际开始时间
|
|
||||||
Date sjjssj = item.getFinishTime(); // 实际结束时间
|
|
||||||
String cssc = item.getTimeoutDuration(); // 超时时长(分钟)
|
|
||||||
String fwsc = item.getServiceDuration(); // 服务时长(分钟)
|
|
||||||
|
|
||||||
// 判断是否超时
|
|
||||||
boolean isTimeout = false;
|
|
||||||
|
|
||||||
// 条件1:如果实际开始时间 > (应该结束时间 + 超时时长)
|
|
||||||
if (sjkssj != null && ygjssj != null && cssc != null) {
|
|
||||||
try {
|
|
||||||
int csscInt = Integer.parseInt(cssc);
|
|
||||||
Calendar calendar = Calendar.getInstance();
|
|
||||||
calendar.setTime(ygjssj);
|
|
||||||
calendar.add(Calendar.MINUTE, csscInt);
|
|
||||||
Date latestAllowedTime = calendar.getTime(); // 最晚允许开始时间
|
|
||||||
|
|
||||||
if (sjkssj.after(latestAllowedTime)) {
|
|
||||||
isTimeout = true;
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 条件2:如果实际结束时间-实际开始时间 > 服务时长
|
|
||||||
if (!isTimeout && sjkssj != null && sjjssj != null && fwsc != null) {
|
|
||||||
try {
|
|
||||||
long actualServiceMinutes = (sjjssj.getTime() - sjkssj.getTime()) / (1000 * 60);
|
|
||||||
int fwscInt = Integer.parseInt(fwsc);
|
|
||||||
|
|
||||||
if (actualServiceMinutes > fwscInt) {
|
|
||||||
isTimeout = true;
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isTimeout) {
|
|
||||||
item.setExecuteStatus("hisTimeOut");
|
item.setExecuteStatus("hisTimeOut");
|
||||||
} else {
|
} else {
|
||||||
|
//正常
|
||||||
item.setExecuteStatus("hisOk");
|
item.setExecuteStatus("hisOk");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
//旧版逻辑
|
||||||
|
// history.stream().forEach(item -> {
|
||||||
|
// if ("N".equals(item.getIzStart())) {
|
||||||
|
// // 未开始
|
||||||
|
// item.setExecuteStatus("hisUnExe");
|
||||||
|
// } else {
|
||||||
|
// // 已开始
|
||||||
|
// Date ygjssj = item.getEndTime(); // 应该结束时间
|
||||||
|
// Date sjkssj = item.getBeginTime(); // 实际开始时间
|
||||||
|
// Date sjjssj = item.getFinishTime(); // 实际结束时间
|
||||||
|
// String cssc = item.getTimeoutDuration(); // 超时时长(分钟)
|
||||||
|
// String fwsc = item.getServiceDuration(); // 服务时长(分钟)
|
||||||
|
//
|
||||||
|
// // 判断是否超时
|
||||||
|
// boolean isTimeout = false;
|
||||||
|
//
|
||||||
|
// // 条件1:如果实际开始时间 > (应该结束时间 + 超时时长)
|
||||||
|
// if (sjkssj != null && ygjssj != null && cssc != null) {
|
||||||
|
// try {
|
||||||
|
// int csscInt = Integer.parseInt(cssc);
|
||||||
|
// Calendar calendar = Calendar.getInstance();
|
||||||
|
// calendar.setTime(ygjssj);
|
||||||
|
// calendar.add(Calendar.MINUTE, csscInt);
|
||||||
|
// Date latestAllowedTime = calendar.getTime(); // 最晚允许开始时间
|
||||||
|
//
|
||||||
|
// if (sjkssj.after(latestAllowedTime)) {
|
||||||
|
// isTimeout = true;
|
||||||
|
// }
|
||||||
|
// } catch (NumberFormatException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 条件2:如果实际结束时间-实际开始时间 > 服务时长
|
||||||
|
// if (!isTimeout && sjkssj != null && sjjssj != null && fwsc != null) {
|
||||||
|
// try {
|
||||||
|
// long actualServiceMinutes = (sjjssj.getTime() - sjkssj.getTime()) / (1000 * 60);
|
||||||
|
// int fwscInt = Integer.parseInt(fwsc);
|
||||||
|
//
|
||||||
|
// if (actualServiceMinutes > fwscInt) {
|
||||||
|
// isTimeout = true;
|
||||||
|
// }
|
||||||
|
// } catch (NumberFormatException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if (isTimeout) {
|
||||||
|
// item.setExecuteStatus("hisTimeOut");
|
||||||
|
// } else {
|
||||||
|
// item.setExecuteStatus("hisOk");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty(current)) {
|
if (!CollectionUtils.isEmpty(current)) {
|
||||||
current.stream().forEach(item -> {
|
current.stream().forEach(item -> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue