|
@@ -4,10 +4,9 @@ package com.bofeng.service;
|
|
import com.baomidou.mybatisplus.toolkit.IdWorker;
|
|
import com.baomidou.mybatisplus.toolkit.IdWorker;
|
|
import com.bofeng.dao.MsReportMapper;
|
|
import com.bofeng.dao.MsReportMapper;
|
|
import com.bofeng.dao.MsSuspectedMapper;
|
|
import com.bofeng.dao.MsSuspectedMapper;
|
|
-import com.bofeng.entity.MsReport;
|
|
|
|
-import com.bofeng.entity.MsSuspected;
|
|
|
|
-import com.bofeng.entity.MsTripDet;
|
|
|
|
-import com.bofeng.entity.UserOpen;
|
|
|
|
|
|
+import com.bofeng.dao.MsTripDetMapper;
|
|
|
|
+import com.bofeng.dao.MsTripMapper;
|
|
|
|
+import com.bofeng.entity.*;
|
|
import org.apache.commons.lang3.tuple.Triple;
|
|
import org.apache.commons.lang3.tuple.Triple;
|
|
import org.joda.time.DateTime;
|
|
import org.joda.time.DateTime;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -36,15 +35,17 @@ public class MsReportService {
|
|
@Autowired
|
|
@Autowired
|
|
private MsReportService msReportService;
|
|
private MsReportService msReportService;
|
|
@Autowired
|
|
@Autowired
|
|
- private MsSuspectedService msSuspectedService;
|
|
|
|
|
|
+ private MsTripDetMapper msTripDetMapper;
|
|
|
|
+ @Autowired
|
|
|
|
+ private MsTripMapper msTripMapper;
|
|
|
|
|
|
public List<MsSuspected> getByReportId(Long reportId) {
|
|
public List<MsSuspected> getByReportId(Long reportId) {
|
|
List<MsSuspected> listSuspected = null;
|
|
List<MsSuspected> listSuspected = null;
|
|
- listSuspected=msSuspectedMapper.selectByReportId(reportId);
|
|
|
|
|
|
+ listSuspected = msSuspectedMapper.selectByReportId(reportId);
|
|
if (listSuspected != null && listSuspected.size() > 0) {
|
|
if (listSuspected != null && listSuspected.size() > 0) {
|
|
String tripDet;
|
|
String tripDet;
|
|
for (MsSuspected msSuspected : listSuspected) {
|
|
for (MsSuspected msSuspected : listSuspected) {
|
|
- tripDet="";
|
|
|
|
|
|
+ tripDet = "";
|
|
//出行详细
|
|
//出行详细
|
|
List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(msSuspected.getSuspectedId());
|
|
List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(msSuspected.getSuspectedId());
|
|
if (listDet != null && listDet.size() > 0) {
|
|
if (listDet != null && listDet.size() > 0) {
|
|
@@ -60,7 +61,7 @@ public class MsReportService {
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
- return listSuspected ;
|
|
|
|
|
|
+ return listSuspected;
|
|
}
|
|
}
|
|
|
|
|
|
public MsReport getByReport(Long reportId) {
|
|
public MsReport getByReport(Long reportId) {
|
|
@@ -76,12 +77,12 @@ public class MsReportService {
|
|
if (listSuspected != null && listSuspected.size() > 0) {
|
|
if (listSuspected != null && listSuspected.size() > 0) {
|
|
String tripDet;
|
|
String tripDet;
|
|
for (MsSuspected msSuspected : listSuspected) {
|
|
for (MsSuspected msSuspected : listSuspected) {
|
|
- tripDet="";
|
|
|
|
|
|
+ tripDet = "";
|
|
//出行详细
|
|
//出行详细
|
|
List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(msSuspected.getSuspectedId());
|
|
List<MsTripDet> listDet = msSuspectedMapper.selectTripSuspected(msSuspected.getSuspectedId());
|
|
if (listDet != null && listDet.size() > 0) {
|
|
if (listDet != null && listDet.size() > 0) {
|
|
for (MsTripDet msTripDet : listDet) {
|
|
for (MsTripDet msTripDet : listDet) {
|
|
- tripDet += "出发地:" + getLocalOther(msTripDet.getStartLocal(),msTripDet.getStartLocalOther()) + ",";
|
|
|
|
|
|
+ tripDet += "出发地:" + getLocalOther(msTripDet.getStartLocal(), msTripDet.getStartLocalOther()) + ",";
|
|
tripDet += "目的地:" + getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
|
|
tripDet += "目的地:" + getLocalOther(msTripDet.getEndLocal(), msTripDet.getEndLocalOther()) + ",";
|
|
tripDet += "出行方式:" + getTripType(msTripDet.getTripType()) + ",";
|
|
tripDet += "出行方式:" + getTripType(msTripDet.getTripType()) + ",";
|
|
tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
|
|
tripDet += "车次/航班/车牌:" + msTripDet.getTripTypeDesp() + ",";
|
|
@@ -125,7 +126,7 @@ public class MsReportService {
|
|
//获取今天数据
|
|
//获取今天数据
|
|
public MsReport getReportByDateNow(Long userCreate) {
|
|
public MsReport getReportByDateNow(Long userCreate) {
|
|
//根据昨天的获取今天的
|
|
//根据昨天的获取今天的
|
|
- // msReportService.getNowByYesterday(userCreate);
|
|
|
|
|
|
+ //msReportService.getNowByYesterday(userCreate);
|
|
//msReportService.getNowByYesterdayDate();
|
|
//msReportService.getNowByYesterdayDate();
|
|
//msReportService.addReport250();
|
|
//msReportService.addReport250();
|
|
Date t = new Date();
|
|
Date t = new Date();
|
|
@@ -133,7 +134,17 @@ public class MsReportService {
|
|
String reportDate = df.format(t);
|
|
String reportDate = df.format(t);
|
|
List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
MsReport msReport = new MsReport();
|
|
MsReport msReport = new MsReport();
|
|
- if (listReport != null && listReport.size() > 0) {
|
|
|
|
|
|
+ //今天不存在
|
|
|
|
+ if (listReport == null || listReport.size() == 0) {
|
|
|
|
+ //最近一天数据复制到今天
|
|
|
|
+ msReportService.getNowByNextDat(userCreate);
|
|
|
|
+ List<MsReport> listReport1 = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
|
|
+ //今天不存在
|
|
|
|
+ if (listReport1 != null && listReport1.size() > 0)
|
|
|
|
+ msReport = msReportMapper.selectById(Long.parseLong(listReport1.get(0).getReportId().toString()));
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+
|
|
msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
}
|
|
}
|
|
return msReport;
|
|
return msReport;
|
|
@@ -365,4 +376,112 @@ public class MsReportService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ //通过最近一天数据更新今天数据
|
|
|
|
+ @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
|
+ public void getNowByNextDat(Long userCreate) {
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat sj = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Date d = new Date();
|
|
|
|
+
|
|
|
|
+ //判断今天是否有数据
|
|
|
|
+ String DateNow = sj.format(d);
|
|
|
|
+ List<MsReport> listReport = msReportMapper.selectByReportDate(DateNow, userCreate);
|
|
|
|
+ if (listReport != null && listReport.size() > 0)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ //判断最近一天是否有数据
|
|
|
|
+ List<MsSuspected> listSuspected = msSuspectedMapper.selectNextSuspected(userCreate);
|
|
|
|
+ //有数据
|
|
|
|
+ if (listSuspected != null && listSuspected.size() > 0) {
|
|
|
|
+ //添加到今天日报
|
|
|
|
+ MsReport msReport = msReportMapper.selectById(Long.parseLong(listSuspected.get(0).getReportId().toString()));
|
|
|
|
+ Long reportId = 0L;
|
|
|
|
+ if (msReport != null) {
|
|
|
|
+ MsReport msReport1 = new MsReport();
|
|
|
|
+ msReport1.setReportId(IdWorker.getId());
|
|
|
|
+ msReport1.setHouseId(msReport.getHouseId());
|
|
|
|
+ msReport1.setSafetyNum(msReport.getSafetyNum());
|
|
|
|
+ msReport1.setSureNum(msReport.getSureNum());
|
|
|
|
+ msReport1.setSuspectedNum(msReport.getSuspectedNum());
|
|
|
|
+ msReport1.setNormalNum(msReport.getNormalNum());
|
|
|
|
+ msReport1.setSingleNum(msReport.getSingleNum());
|
|
|
|
+ msReport1.setRemarks(msReport.getRemarks());
|
|
|
|
+ msReport1.setReportDate(DateTime.now().toDate());
|
|
|
|
+ msReport1.setReportStatus(0);//未上报
|
|
|
|
+ msReport1.setMsStatus(msReport.getMsStatus());
|
|
|
|
+ msReport1.setUserCreate(userCreate);
|
|
|
|
+ msReport1.setTimeCreate(DateTime.now());
|
|
|
|
+ msReport1.setUserUpdate(userCreate);
|
|
|
|
+ msReport1.setTimeUpdate(DateTime.now());
|
|
|
|
+ msReportMapper.insert(msReport1);
|
|
|
|
+ reportId = msReport1.getReportId();
|
|
|
|
+ }
|
|
|
|
+ //添加今日家人
|
|
|
|
+ for (MsSuspected msSuspected : listSuspected) {
|
|
|
|
+ MsSuspected msSuspected1 = new MsSuspected();
|
|
|
|
+ msSuspected1.setSuspectedId(IdWorker.getId());
|
|
|
|
+ msSuspected1.setReportId(reportId);
|
|
|
|
+ msSuspected1.setUserName(msSuspected.getUserName());
|
|
|
|
+ msSuspected1.setGrender(msSuspected.getGrender());
|
|
|
|
+ msSuspected1.setAge(msSuspected.getAge());
|
|
|
|
+ msSuspected1.setFamilyStatus(msSuspected.getFamilyStatus());
|
|
|
|
+ msSuspected1.setStatusDesp(msSuspected.getStatusDesp());
|
|
|
|
+ msSuspected1.setMedical(msSuspected.getMedical());
|
|
|
|
+ msSuspected1.setTemperature(new BigDecimal(0));
|
|
|
|
+ msSuspected1.setCough(msSuspected.getCough());
|
|
|
|
+ msSuspected1.setMuscle(msSuspected.getMuscle());
|
|
|
|
+ msSuspected1.setDiarrhea(msSuspected.getDiarrhea());
|
|
|
|
+ msSuspected1.setFatigue(msSuspected.getFatigue());
|
|
|
|
+ msSuspected1.setDiarrhea(msSuspected.getDiarrhea());
|
|
|
|
+ msSuspected1.setSingleRoom(msSuspected.getSingleRoom());
|
|
|
|
+ msSuspected1.setOthers(msSuspected.getOthers());
|
|
|
|
+ // msSuspected1.setScoreRezult(msSuspected.getScoreRezult());
|
|
|
|
+ // msSuspected1.setScore(msSuspected.getScore());
|
|
|
|
+ // msSuspected1.setScoreHistroy(msSuspected.getScoreHistroy());
|
|
|
|
+ // msSuspected1.setTemperatureScore(msSuspected.getTemperatureScore());
|
|
|
|
+ msSuspected1.setSuspectedStatus(0);
|
|
|
|
+ msSuspected1.setUserCreate(userCreate);
|
|
|
|
+ msSuspected1.setTimeCreate(DateTime.now());
|
|
|
|
+ msSuspected1.setUserUpdate(userCreate);
|
|
|
|
+ msSuspected1.setTimeUpdate(DateTime.now());
|
|
|
|
+ msSuspectedMapper.insert(msSuspected1);
|
|
|
|
+
|
|
|
|
+ //添加行程
|
|
|
|
+ MsTrip msTrip = new MsTrip();
|
|
|
|
+ msTrip.setTripId(msSuspected1.getSuspectedId());
|
|
|
|
+ msTrip.setIsTrip(msSuspected.getIsTrip());
|
|
|
|
+ msTrip.setTodayLocal(msSuspected.getTodayLocal());
|
|
|
|
+ msTrip.setTodayLocalOther(msSuspected.getTodayLocalOther());
|
|
|
|
+ msTrip.setWorkLocal(msSuspected.getWorkLocal());
|
|
|
|
+ msTrip.setWorkLocalOther(msSuspected.getWorkLocalOther());
|
|
|
|
+ msTripMapper.insert(msTrip);
|
|
|
|
+
|
|
|
|
+ //添加出行详细
|
|
|
|
+ List<MsTripDet> listTripDet = msSuspectedMapper.selectTripSuspected(msSuspected.getSuspectedId());
|
|
|
|
+ if (listTripDet != null && listTripDet.size() > 0) {
|
|
|
|
+ for (MsTripDet msTripDet : listTripDet) {
|
|
|
|
+ MsTripDet msTripDet1 = new MsTripDet();
|
|
|
|
+ msTripDet1.setTripDetId(IdWorker.getId());
|
|
|
|
+ msTripDet1.setTripId(msSuspected.getSuspectedId());
|
|
|
|
+ msTripDet1.setSort(msTripDet.getSort());
|
|
|
|
+ msTripDet1.setStartLocal(msTripDet.getStartLocal());
|
|
|
|
+ msTripDet1.setStartLocalOther(msTripDet.getStartLocalOther());
|
|
|
|
+ msTripDet1.setEndLocal(msTripDet.getEndLocal());
|
|
|
|
+ msTripDet1.setEndLocalOther(msTripDet.getEndLocalOther());
|
|
|
|
+ msTripDet1.setTripType(msTripDet.getTripType());
|
|
|
|
+ msTripDet1.setTripTypeDesp(msTripDet.getTripTypeDesp());
|
|
|
|
+ msTripDet1.setTimeCreate(DateTime.now());
|
|
|
|
+ msTripDet1.setUserCreate(userCreate);
|
|
|
|
+ msTripDet1.setTimeUpdate(DateTime.now());
|
|
|
|
+ msTripDet1.setUserUpdate(userCreate);
|
|
|
|
+ msTripDetMapper.insert(msTripDet1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
}
|
|
}
|