|
@@ -120,7 +120,7 @@ public class IndividualLogApiController {
|
|
|
map.put("temperatureMax", temperatureConfig.getMax());
|
|
|
map.put("faceImageUrl",person.getFaceImageUrl());
|
|
|
|
|
|
- PersonDeviceLog lastPersonLog = personDeviceLogService.findLastPersonLog(person.getId(),temperatureConfig.getMax());
|
|
|
+ PersonDeviceFilterLog lastPersonLog = personDeviceFilterLogService.lastPersonLog(person.getId());
|
|
|
|
|
|
BigDecimal lastTemperature = lastPersonLog.getTemperature();
|
|
|
|
|
@@ -140,59 +140,6 @@ public class IndividualLogApiController {
|
|
|
map.put("isNormal",true);
|
|
|
}
|
|
|
|
|
|
- DateTime today = DateTime.now().withTimeAtStartOfDay();
|
|
|
-
|
|
|
- //todo 最近14天未测体温数
|
|
|
- Integer detectedCount = personDeviceFilterLogService.countDayByPersonIdAndDate(person.getId(),today.minusDays(13).toDate(),today.plusDays(1).toDate());
|
|
|
- map.put("undetectedCount",14 - detectedCount);
|
|
|
-
|
|
|
- //todo 获取连续检测天数
|
|
|
- //最近一年的节假日
|
|
|
- Set<String> holidaySet = holidayInfoService.getHolidaySetByDate(today.minusDays(364).toDate(),today.plusDays(1).toDate());
|
|
|
-
|
|
|
- //查询当前用户的考勤设置
|
|
|
- Set<Integer> weekdaySet = alarmConfigService.getWeekdaySetByCompanyId(person.getCompanyId());
|
|
|
-
|
|
|
- int totalDays = 0;
|
|
|
-
|
|
|
- //最多查一年
|
|
|
- for(int i=0;i<365;i++) {
|
|
|
- DateTime prevDay = today.minusDays(i);
|
|
|
-
|
|
|
- DateTime startTime = prevDay;
|
|
|
- DateTime endTime = prevDay.plusDays(1);
|
|
|
-
|
|
|
- PersonDeviceFilterLog item = personDeviceFilterLogService.findByPersonOrderTemperature(person.getId(), startTime.toString("yyyy-MM-dd"), endTime.toString("yyyy-MM-dd"));
|
|
|
-
|
|
|
- if(item!=null){
|
|
|
- float curTemperature = item.getTemperature().floatValue();
|
|
|
-
|
|
|
- if(curTemperature<=temperatureConfig.getMax()){
|
|
|
- totalDays++;
|
|
|
- }
|
|
|
- else{
|
|
|
- //有异常温度跳出循环
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else{
|
|
|
- if (!weekdaySet.contains(startTime.getDayOfWeek())){
|
|
|
- //先排除一周非工作日
|
|
|
- continue;
|
|
|
- }
|
|
|
- else if (holidaySet.contains(startTime.toString("yyyy-MM-dd"))){
|
|
|
- //再排除节假日
|
|
|
- continue;
|
|
|
- }
|
|
|
- else if(i!=0) {
|
|
|
- //之前无测温记录则跳出循环
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- map.put("totalDays",totalDays);
|
|
|
-
|
|
|
messageResult.setResult(true);
|
|
|
messageResult.setData(map);
|
|
|
}
|
|
@@ -225,6 +172,8 @@ public class IndividualLogApiController {
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
DateTime now = DateTime.now();
|
|
|
+
|
|
|
+ //最近14天
|
|
|
DateTime startTime = now.minusDays(13);
|
|
|
DateTime endTime = now;
|
|
|
|
|
@@ -235,27 +184,41 @@ public class IndividualLogApiController {
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
PersonDeviceFilterLog lastPersonLog = personDeviceFilterLogService.lastPersonLog(person.getId());
|
|
|
- String lastDateStr = sdf.format(lastPersonLog.getRecordTime());
|
|
|
+
|
|
|
+ String lastDateStr = DateTime.now().toString("yyyy-MM-dd");
|
|
|
+
|
|
|
+ if(lastPersonLog!=null) {
|
|
|
+ sdf.format(lastPersonLog.getRecordTime());
|
|
|
+ }
|
|
|
+
|
|
|
+ DateTime today = DateTime.now().withTimeAtStartOfDay();
|
|
|
+ int undetectedCount = 0; //未测温天数
|
|
|
+ int totalDays = 0; //连续测温天数
|
|
|
+
|
|
|
+ //最近一年的节假日
|
|
|
+ Set<String> holidaySet = holidayInfoService.getHolidaySetByDate(today.minusDays(364).toDate(),today.plusDays(1).toDate());
|
|
|
+
|
|
|
+ //查询当前用户的考勤设置
|
|
|
+ Set<Integer> weekdaySet = alarmConfigService.getWeekdaySetByCompanyId(person.getCompanyId());
|
|
|
|
|
|
for (int i =0;i<14;i++) {
|
|
|
Map<String, Object> map1 = new HashMap<>();
|
|
|
- DateTime today = startTime.plusDays(i);
|
|
|
+ DateTime curDay = startTime.plusDays(i);
|
|
|
|
|
|
- String startDate = today.toString("yyyy-MM-dd");
|
|
|
- String endDate = today.plusDays(1).toString("yyyy-MM-dd");
|
|
|
+ String startDate = curDay.toString("yyyy-MM-dd");
|
|
|
+ String endDate = curDay.plusDays(1).toString("yyyy-MM-dd");
|
|
|
|
|
|
- PersonDeviceFilterLog personDeviceFilterLog = null;
|
|
|
+ PersonDeviceFilterLog personDeviceFilterLog;
|
|
|
|
|
|
- if (lastDateStr.equals(startDate)){
|
|
|
+ if (lastDateStr.equals(startDate) && lastPersonLog!=null){
|
|
|
personDeviceFilterLog = lastPersonLog;
|
|
|
}
|
|
|
else{
|
|
|
- personDeviceFilterLog = personDeviceFilterLogService.findByPersonOrderTemperature(person.getId(), startDate, endDate);
|
|
|
+ personDeviceFilterLog = personDeviceFilterLogService.findByPersonOrderTemperature(person.getId(), startDate, endDate);
|
|
|
}
|
|
|
|
|
|
if (personDeviceFilterLog != null) {
|
|
|
boolean isDanger = false;
|
|
|
-
|
|
|
map1.put("name", today.toString("MM-dd"));
|
|
|
map1.put("value", personDeviceFilterLog.getTemperature());
|
|
|
|
|
@@ -264,18 +227,33 @@ public class IndividualLogApiController {
|
|
|
}
|
|
|
|
|
|
map1.put("danger", isDanger);
|
|
|
+ totalDays++;
|
|
|
}
|
|
|
else{
|
|
|
+ //如果没有记录,先判断是否非工作日
|
|
|
+ if (!weekdaySet.contains(startTime.getDayOfWeek())){
|
|
|
+ //先排除一周非工作日
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ else if (holidaySet.contains(startTime.toString("yyyy-MM-dd"))){
|
|
|
+ //再排除节假日
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ //工作日没有记录,则显示为0
|
|
|
map1.put("name", today.toString("MM-dd"));
|
|
|
map1.put("value", 0);
|
|
|
map1.put("danger", false);
|
|
|
+ undetectedCount++;
|
|
|
}
|
|
|
|
|
|
list1.add(map1);
|
|
|
}
|
|
|
|
|
|
map.put("list", list1);
|
|
|
- map.put("temperatureMax",temperatureConfig.getMax());
|
|
|
+ map.put("temperatureMax", temperatureConfig.getMax());
|
|
|
+ map.put("undetectedCount", undetectedCount);
|
|
|
+ map.put("totalDays", totalDays);
|
|
|
|
|
|
totalList.add(map);
|
|
|
|