|
@@ -1,15 +1,20 @@
|
|
|
package com.pj.project.tb_person_visit_record;
|
|
|
|
|
|
import java.io.File;
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.Date;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
+import cn.hutool.core.util.NumberUtil;
|
|
|
import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import cn.hutool.poi.excel.ExcelUtil;
|
|
@@ -23,6 +28,7 @@ import com.pj.project.tb_venues.TbVenues;
|
|
|
import com.pj.project.tb_venues.TbVenuesService;
|
|
|
import com.pj.project4sp.uploadfile.UploadConfig;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import com.pj.utils.so.*;
|
|
@@ -46,6 +52,7 @@ public class TbPersonVisitRecordService extends ServiceImpl<TbPersonVisitRecordM
|
|
|
@Resource
|
|
|
private UploadConfig uploadConfig;
|
|
|
@Resource
|
|
|
+ @Lazy
|
|
|
private TbVenuesService tbVenuesService;
|
|
|
|
|
|
|
|
@@ -80,9 +87,9 @@ public class TbPersonVisitRecordService extends ServiceImpl<TbPersonVisitRecordM
|
|
|
} else if (direction.equals(TbPersonVisitRecord.DirectionEnum.OUT.getDirection())) {
|
|
|
record.setVisitDate(t.getOutTime()).setTemperature(t.getOutTemperature());
|
|
|
}
|
|
|
- if(StrUtil.equals(record.getHealthStatus(), TbPersonVisitRecord.HealthEnum.GREEN.getStatus())){
|
|
|
+ if (StrUtil.equals(record.getHealthStatus(), TbPersonVisitRecord.HealthEnum.GREEN.getStatus())) {
|
|
|
record.setWay("无需处置").setIsSolve(0).setIsNotify(0);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
record.setIsSolve(1).setIsNotify(1);
|
|
|
}
|
|
|
this.save(record);
|
|
@@ -156,7 +163,7 @@ public class TbPersonVisitRecordService extends ServiceImpl<TbPersonVisitRecordM
|
|
|
return list.isEmpty() ? null : list.get(0);
|
|
|
}
|
|
|
|
|
|
- public void solve(SoMap so){
|
|
|
+ public void solve(SoMap so) {
|
|
|
String id = so.getString("id");
|
|
|
String way = so.getString("way");
|
|
|
TbPersonVisitRecord t = getById(id);
|
|
@@ -164,4 +171,31 @@ public class TbPersonVisitRecordService extends ServiceImpl<TbPersonVisitRecordM
|
|
|
this.updateById(t);
|
|
|
}
|
|
|
|
|
|
+ public MonitorVO getMonitor() {
|
|
|
+ MonitorVO vo=new MonitorVO();
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
+ LocalDate today = LocalDate.now();
|
|
|
+ String todayStr = today.format(formatter);
|
|
|
+ long todayCount = tbPersonVisitRecordMapper.getMonitor(today.format(formatter), todayStr,1);
|
|
|
+ long todayHealthErrorCount = tbPersonVisitRecordMapper.getMonitor(today.format(formatter), todayStr,0);
|
|
|
+ LocalDate week = today.minusDays(7);
|
|
|
+ long weekCount = tbPersonVisitRecordMapper.getMonitor(week.format(formatter), todayStr,1);
|
|
|
+ long weekHealthErrorCount = tbPersonVisitRecordMapper.getMonitor(week.format(formatter), todayStr,0);
|
|
|
+
|
|
|
+ LocalDate month = today.minusMonths(1);
|
|
|
+ long monthCount = tbPersonVisitRecordMapper.getMonitor(month.format(formatter), todayStr,1);
|
|
|
+ long monthHealthErrorCount = tbPersonVisitRecordMapper.getMonitor(month.format(formatter), todayStr,0);
|
|
|
+
|
|
|
+ LocalDate year = today.minusYears(1);
|
|
|
+ long yearCount = tbPersonVisitRecordMapper.getMonitor(year.format(formatter), todayStr,1);
|
|
|
+ long yearHealthErrorCount = tbPersonVisitRecordMapper.getMonitor(year.format(formatter), todayStr,0);
|
|
|
+ long avg = new BigDecimal(weekCount).divide(new BigDecimal(7),BigDecimal.ROUND_UP).longValue();
|
|
|
+ long avgError = new BigDecimal(weekHealthErrorCount).divide(new BigDecimal(7),BigDecimal.ROUND_UP).longValue();
|
|
|
+ vo.setTodayCount(todayCount).setTodayHealthErrorCount(todayHealthErrorCount)
|
|
|
+ .setWeekCount(weekCount).setWeekHealthErrorCount(weekHealthErrorCount)
|
|
|
+ .setMonthCount(monthCount).setMonthHealthErrorCount(monthHealthErrorCount)
|
|
|
+ .setYearCount(yearCount).setYearHealthErrorCount(yearHealthErrorCount)
|
|
|
+ .setAvg(avg).setAvgError(avgError);
|
|
|
+ return vo;
|
|
|
+ }
|
|
|
}
|