|
@@ -67,6 +67,8 @@ public class ScanController {
|
|
|
private ScanService scanService;
|
|
|
@Autowired
|
|
|
private OutScanEstateMapper outScanEstateMapper;
|
|
|
+ @Autowired
|
|
|
+ private OutUserMapper outUserMapper;
|
|
|
|
|
|
/**
|
|
|
* @param doorId 小区大门ID
|
|
@@ -94,8 +96,8 @@ public class ScanController {
|
|
|
model.put("door", uptownDoor.getUptownName() + uptownDoor.getDoorName());
|
|
|
model.put("doorplate", unit.getRidgepole() + "栋" + unit.getUnit() + "单元" +unit.getDoorplate() + "号");
|
|
|
model.put("name", uptownHomes.get(0).getLinkman());
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- model.put("now", format.format(new Date()));
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ model.put("now", sdf.format(new Date()));
|
|
|
model.put("inType", inType);
|
|
|
if (!unit.getUptownId().equals(uptownDoor.getUptownId())) {
|
|
|
model.put("into", "禁止" + getMsg(inType));
|
|
@@ -103,27 +105,58 @@ public class ScanController {
|
|
|
model.put("errorMsg", "非本小区居民,禁止" + getMsg(inType) + "。");
|
|
|
return new ModelAndView("/user/scan.ftl", model);
|
|
|
}
|
|
|
+ if (inType == 1) {
|
|
|
+ OutScan outScan = outScanMapper.getOutScanByUserlimit(userOpen.getUserId());
|
|
|
+ if (outScan != null && new Date(outScan.getDate().getMillis() + 3600L * 1000 * 24).compareTo(new Date()) == -1) {
|
|
|
+ model.put("collor", "orange");
|
|
|
+ model.put("into", "允许进入");
|
|
|
+ model.put("errorMsg", "您在外驻留时间超过1日,请尽快上报您的健康状况,防止在外长时间逗留。");
|
|
|
+ return new ModelAndView("/user/scan.ftl", model);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (inType == 2) {
|
|
|
+ OutUser outUser = outUserMapper.getOutUserByUserId(userOpen.getUserId());
|
|
|
+ if (outUser != null) {
|
|
|
+ model.put("collor", "green");
|
|
|
+ model.put("into", "允许通行");
|
|
|
+ model.put("errorMsg", "外出请佩戴口罩,避免近距离接触,保生产同时注意自身安全。");
|
|
|
+ scanService.saveOutScan(userOpen.getUserId(), inType, uptownDoor.getUptownId(), uptownDoor.getDoorId());
|
|
|
+ return new ModelAndView("/user/scan.ftl", model);
|
|
|
+ }
|
|
|
OutScanConf outScanConf = outScanConfMapper.getOutScanConfByUptown(uptownDoor.getUptownId());
|
|
|
- OutScan outScan = outScanMapper.getOutScanByUserlimit(userOpen.getUserId());
|
|
|
- if (outScan != null && !compareTime(new Date(), outScan.getOutDate(), outScanConf.getGoOutFre())) {
|
|
|
+ OutScan outScan = outScanMapper.getOutScanThreeday(userOpen.getUserId(), 2, outScanConf.getGoOutFre());
|
|
|
+ if (outScan != null) {
|
|
|
model.put("collor", "red");
|
|
|
model.put("into", "禁止" + getMsg(inType));
|
|
|
- model.put("errorMsg", "外出时间间隔不满三日,禁止外出,请配合,上次外出时间 "+format.format(new Date(outScan.getOutDate().getMillis()))+"。");
|
|
|
+ model.put("errorMsg", "距您上次外出时间未满"+outScanConf.getGoOutFre()+"日,禁止外出,请配合。上次外出登记时间 "+sdf.format(new Date(outScan.getDate().getMillis()))+"。");
|
|
|
return new ModelAndView("/user/scan.ftl", model);
|
|
|
}
|
|
|
List<MsReport> msReports = msReportMapper.selectMsReportLate(userOpen.getUserId());
|
|
|
- if (msReports.size() != 3) {
|
|
|
+ if (msReports.size() == 0) {
|
|
|
model.put("collor", "red");
|
|
|
model.put("into", "禁止" + getMsg(inType));
|
|
|
- model.put("errorMsg", "因近期您未提交健康日报,无法确认您当前健康状态,禁止外出,请配合。");
|
|
|
+ model.put("errorMsg", "您最近三日未上报健康日报,请说明原因,配合监测人员。");
|
|
|
return new ModelAndView("/user/scan.ftl", model);
|
|
|
+ } else if (msReports.size() < 3) {
|
|
|
+ model.put("collor", "orange");
|
|
|
+ model.put("into", "可以" + getMsg(inType));
|
|
|
+ model.put("errorMsg", "您最近三日健康日报漏报,请说明原因并及时填报,配合监测人员。");
|
|
|
+ return new ModelAndView("/user/scan.ftl", model);
|
|
|
+ }
|
|
|
+ MsReport msReport = msReportMapper.selectMsReportToday(userOpen.getUserId());
|
|
|
+ if (msReport != null && msReport.getMsStatus() == 2) {
|
|
|
+ model.put("collor", "red");
|
|
|
+ model.put("into", "禁止通行");
|
|
|
+ model.put("errorMsg", "健康日报提示您存在健康问题,禁止外出,请配合。");
|
|
|
+ return new ModelAndView("/user/scanEstate.ftl", model);
|
|
|
}
|
|
|
}
|
|
|
model.put("collor", "green");
|
|
|
- model.put("into", "可以" + getMsg(inType));
|
|
|
+ model.put("into", "允许" + getMsg(inType));
|
|
|
if (inType == 2) {
|
|
|
- model.put("errorMsg", "请佩戴口罩,避免近距离接触,不得长时间在外逗留。");
|
|
|
+ model.put("errorMsg", "外出请佩戴口罩,避免近距离接触,保生产同时注意自身安全。");
|
|
|
+ } else if (inType == 1) {
|
|
|
+ model.put("errorMsg", "欢迎归来,注意防护。");
|
|
|
}
|
|
|
scanService.saveOutScan(userOpen.getUserId(), inType, uptownDoor.getUptownId(), uptownDoor.getDoorId());
|
|
|
return new ModelAndView("/user/scan.ftl", model);
|
|
@@ -148,16 +181,48 @@ public class ScanController {
|
|
|
model.put("name", uptownHomes.get(0).getLinkman());
|
|
|
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
model.put("now", format.format(new Date()));
|
|
|
+ OutUser outUser = outUserMapper.getOutUserByUserId(userOpen.getUserId());
|
|
|
+ if (outUser != null) {
|
|
|
+ model.put("collor", "green");
|
|
|
+ model.put("into", "允许通行");
|
|
|
+ model.put("errorMsg", "外出请佩戴口罩,避免近距离接触,保生产同时注意自身安全。");
|
|
|
+ return new ModelAndView("/user/scanEstate.ftl", model);
|
|
|
+ }
|
|
|
+ List<MsReport> msReports = msReportMapper.selectMsReportLate(userOpen.getUserId());
|
|
|
+ if (msReports.size() != 3) {
|
|
|
+ model.put("collor", "red");
|
|
|
+ model.put("into", "禁止通行");
|
|
|
+ model.put("errorMsg", "您近期未提交健康日报,无法判断您健康状态,请尽快返回住处。");
|
|
|
+ return new ModelAndView("/user/scan.ftl", model);
|
|
|
+ }
|
|
|
+ MsReport msReport = msReportMapper.selectMsReportToday(userOpen.getUserId());
|
|
|
+ if (msReport != null && msReport.getMsStatus() == 2) {
|
|
|
+ model.put("collor", "red");
|
|
|
+ model.put("into", "禁止通行");
|
|
|
+ model.put("errorMsg", "您近日提交的健康日报显示您健康存在问题,请尽快返回住处。");
|
|
|
+ return new ModelAndView("/user/scanEstate.ftl", model);
|
|
|
+ }
|
|
|
+ OutScan outScan = outScanMapper.getOutScanToday(userOpen.getUserId());
|
|
|
+ if (outScan == null) {
|
|
|
+ model.put("collor", "red");
|
|
|
+ model.put("into", "禁止通行");
|
|
|
+ model.put("errorMsg", "您今日没有正常出门记录,为自身及家人安全,请赶紧回家。");
|
|
|
+ return new ModelAndView("/user/scanEstate.ftl", model);
|
|
|
+ }
|
|
|
List<OutScanEstate> list1 = outScanEstateMapper.getOutScanEstateTodayByUser(userOpen.getUserId());
|
|
|
int conut = list1.size() + 1;
|
|
|
if (list1.size() < 2) {
|
|
|
model.put("collor", "green");
|
|
|
- model.put("into", "允许行动");
|
|
|
- model.put("errorMsg", "这是您今天第" + conut + "次出行,允许同行,注意安全。");
|
|
|
+ model.put("into", "允许通行");
|
|
|
+ if (list1.size() == 0) {
|
|
|
+ model.put("errorMsg", "您今日已"+conut+"次被问讯,请说明外出原因,尽快回家。");
|
|
|
+ } else {
|
|
|
+ model.put("errorMsg", "您今日已"+conut+"次被问讯,请说明外出原因,尽快回家。问询时间:"+queryTime(list1)+"。");
|
|
|
+ }
|
|
|
} else {
|
|
|
model.put("collor", "red");
|
|
|
- model.put("into", "劝您回家");
|
|
|
- model.put("errorMsg", "这是您今天第" + conut + "次出行,为了您的安全,请尽快回家。");
|
|
|
+ model.put("into", "禁止通行");
|
|
|
+ model.put("errorMsg", "您今日已被巡检人员问讯超过2次,为自身及家人安全,请赶紧回家。问询时间:"+queryTime(list1)+"。");
|
|
|
}
|
|
|
scanService.saveOutScanEstate(userOpen.getUserId());
|
|
|
// model.put("img", "/scan/scanEstate_qr.png");
|
|
@@ -165,20 +230,6 @@ public class ScanController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public Boolean compareTime(Date time1, DateTime time2, Integer day) {
|
|
|
- Date date = new Date(time2.getMillis() + 1000L*3600*24*day);
|
|
|
- if (changeTime(date).equals(changeTime(time1))) {
|
|
|
- return true;
|
|
|
- } else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- public String changeTime(Date date) {
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- return format.format(date);
|
|
|
- }
|
|
|
-
|
|
|
public String getMsg(Integer inType) {
|
|
|
if (inType == 1) {
|
|
|
return "进入";
|
|
@@ -188,6 +239,16 @@ public class ScanController {
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
+ public String queryTime (List<OutScanEstate> list) {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("HH:mm");
|
|
|
+ String time = "";
|
|
|
+ for (OutScanEstate o : list) {
|
|
|
+ String date = format.format(new Date(o.getScanDate().getMillis()));
|
|
|
+ time += date + "、";
|
|
|
+ }
|
|
|
+ return time.substring(0, time.length() - 1);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成进出门二维码
|
|
|
* @param doorId 小区大门ID
|