|
@@ -82,20 +82,27 @@ public class MsReportService {
|
|
|
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
|
|
|
public void getNowByYesterday(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;
|
|
|
+
|
|
|
+ //判断昨天是否有数据
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(d);
|
|
|
calendar.add(Calendar.DATE, -1);
|
|
|
String reportDate = sj.format(calendar.getTime());
|
|
|
- List<MsReport> listReport = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
|
+ List<MsReport> listReport1 = msReportMapper.selectByReportDate(reportDate, userCreate);
|
|
|
//有数据
|
|
|
- if (listReport != null && listReport.size() > 0) {
|
|
|
+ if (listReport1 != null && listReport1.size() > 0) {
|
|
|
//添加到今天日报
|
|
|
- MsReport msReport = msReportMapper.selectById(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
|
+ MsReport msReport = msReportMapper.selectById(Long.parseLong(listReport1.get(0).getReportId().toString()));
|
|
|
Long reportId=0L;
|
|
|
- if (msReport != null) {
|
|
|
+ if (msReport != null ) {
|
|
|
MsReport msReport1 = new MsReport();
|
|
|
msReport1.setReportId(IdWorker.getId());
|
|
|
msReport1.setHouseId(msReport.getHouseId());
|
|
@@ -115,10 +122,9 @@ public class MsReportService {
|
|
|
reportId=msReport1.getReportId();
|
|
|
}
|
|
|
//添加今日家庭
|
|
|
- List<MsSuspected> listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport.get(0).getReportId().toString()));
|
|
|
+ List<MsSuspected> listSuspected = msSuspectedMapper.selectByReportId(Long.parseLong(listReport1.get(0).getReportId().toString()));
|
|
|
if (listSuspected != null && listSuspected.size() > 0) {
|
|
|
for (MsSuspected msSuspected : listSuspected) {
|
|
|
-
|
|
|
MsSuspected msSuspected1 = new MsSuspected();
|
|
|
msSuspected1.setSuspectedId(IdWorker.getId());
|
|
|
msSuspected1.setReportId(reportId);
|