diff --git a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppEnterpriseInformationController.java b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppEnterpriseInformationController.java index 148112f9..4b63e4d8 100644 --- a/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppEnterpriseInformationController.java +++ b/lib/EmergencyService/zdxtEmergencyAppService/src/main/java/com/zdxt/app/controller/AppEnterpriseInformationController.java @@ -272,7 +272,10 @@ public class AppEnterpriseInformationController extends BaseController @ResponseBody public ZDResponse addQrCode(@PathVariable("num") String num) { - return enterpriseInformationService.insertQrCode(num) > 0 ? - ZDResponse.success("失效成功"): ZDResponse.error("失效失败"); + int i = enterpriseInformationService.insertQrCode(num); + if(i == 3){ + return ZDResponse.success("二维码生成时效不足24小时"); + } + return i > 0 ? ZDResponse.success("失效成功"): ZDResponse.error("失效失败"); } } diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/user/edit.html b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/user/edit.html index 0b2dcd9c..378caff0 100644 --- a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/user/edit.html +++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/system/user/edit.html @@ -36,7 +36,7 @@
- +
diff --git a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java index 2e9714bf..4fbc1930 100644 --- a/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java +++ b/lib/EmergencyService/zdxtLawEnforcementCodeService/src/main/java/com/zdxt/code/service/impl/EnterpriseInformationServiceImpl.java @@ -352,6 +352,25 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS @Override public int insertQrCode(String num) { + + //查询最新的二维码数据 + QrCodeGenerateHistory qrCodeGenerateHistory1 = + iQrCodeGenerateHistoryService.selectQrCodeGenerateHistoryByNewest(num); + //判断二维码生成时间 + Instant instant = qrCodeGenerateHistory1.getGenerateTime().toInstant(); + ZoneId zoneId = ZoneId.systemDefault(); + // atZone()方法返回在指定时区从此Instant生成的ZonedDateTime。 + LocalDateTime date1 = instant.atZone(zoneId).toLocalDateTime(); + //当前时间 + LocalDateTime date2 = LocalDateTime.now(); + //判断相差多少个小时 + long hoursDiff = ChronoUnit.HOURS.between(date1, date2); + + if(hoursDiff < 24){ + log.error("二维码生成时间不足24小时"); + return 3; + } + // 先将与之关联的其他二维码都失效 QrCodeGenerateHistory qrParams = new QrCodeGenerateHistory(); qrParams.setEnterpriseNumber(num); @@ -395,5 +414,4 @@ public class EnterpriseInformationServiceImpl implements IEnterpriseInformationS } return 0; } - }