|
|
|
@ -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; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|