Przeglądaj źródła

超时时间处理

hanzhiwei 2 lat temu
rodzic
commit
89ff04b1fb

+ 16 - 6
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/AlarmRecordServiceImpl.java

@@ -1,5 +1,7 @@
 package com.zd.airbottle.service.impl;
 
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.date.LocalDateTimeUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
@@ -97,6 +99,9 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
     private IQpQualificationApplyService qualificationApplyService;
 
     @Autowired
+    private IQpUsegasApplyService qpUsegasApplyService;
+
+    @Autowired
     private RemoteMessageService remoteMessageService;
 
     private static final String RFID_CODE = "RFID:";
@@ -483,12 +488,17 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
                 phones.append(i.getAdminPhone()).append(",").append(i.getSafeUserPhone());
             }
             //过期时间在提醒天数内 并且在一天之内
-            QpQualificationApplyVO qualificationApply = new QpQualificationApplyVO();
-            qualificationApply.setUserId(QpUseRecord.getUserId());
-            List<QpQualificationApplyVO> qualificationApplies = qualificationApplyService.selectQpQualificationApplyList(qualificationApply);
-            qualificationApplies = qualificationApplies.stream().filter(qa -> qa.getCenterAuditStatus() == 1).filter(qa -> qa.getEndTime().getTime() < Calendar.getInstance().getTime().getTime()).collect(Collectors.toList());
-
-            if(qualificationApplies.size() > 0){
+            QpUsegasApplyVO qpUsegasApplyVO = new QpUsegasApplyVO();
+            qpUsegasApplyVO.setUserId(QpUseRecord.getUserId());
+            qpUsegasApplyVO.setSubjectId(QpUseRecord.getSubjectId());
+            qpUsegasApplyVO.setUseGasId(qpAirBottle.getId());
+            List<QpUsegasApplyVO> qpUsegasApplyVOS = qpUsegasApplyService.selectQpUsegasApplyList(qpUsegasApplyVO);
+            List<QpUsegasApplyVO> collect = qpUsegasApplyVOS.stream().filter(qa -> "1".equals(qa.getRemark())).sorted(Comparator.comparing(QpUsegasApplyVO::getEndTime).reversed()).limit(1).collect(Collectors.toList());
+            QpUsegasApplyVO qpUsegasApplyVO1 = collect.get(0);
+            Date endTime = qpUsegasApplyVO1.getEndTime();
+            DateTime now = DateTime.now();
+            DateTime yesterday = DateUtil.offsetDay(now, -1);
+            if(yesterday.getTime() < endTime.getTime() && now.getTime() > endTime.getTime()){
                 //过了最大领用时间
                 warningNoticeLogDto.setWarningContent("气瓶超时未归还");
                 String timeout = warningConfigDto.getTimeout();

+ 4 - 3
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpStockServiceImpl.java

@@ -937,8 +937,8 @@ public class HxpStockServiceImpl implements IHxpStockService {
             Date expirationTime = hxpStock.getExpirationTime();
             //即将过期提醒天数
             Integer unexpiredWarnDays = warningConfigDto.getUnexpiredWarnDays();
-            DateTime startDateTime = DateUtil.offsetDay(DateTime.now(), unexpiredWarnDays);
-            DateTime endDateTime = DateUtil.offsetDay(DateTime.now(), unexpiredWarnDays + 1);
+            DateTime startDateTime = DateUtil.offsetDay(DateTime.now(), unexpiredWarnDays -1);
+            DateTime endDateTime = DateUtil.offsetDay(DateTime.now(), unexpiredWarnDays);
 
             ResultData resultData = remoteLaboratoryService.getRemindData(hxpStock.getId());
             if (HttpStatus.SUCCESS != resultData.getCode()) {
@@ -1086,6 +1086,7 @@ public class HxpStockServiceImpl implements IHxpStockService {
                 Integer collectMinute = hxpChemical.getCollectMinute();
                 Integer minute = (collectHour != null?collectHour:0) * 60 + (collectMinute != null?collectMinute:0);
                 DateTime dateTime = DateUtil.offsetMinute(hxpUserecord.getCollectTime(), minute);
+                DateTime yesterday = DateUtil.offsetDay(dateTime, -1);
 
                 //过期时间在提醒天数内 并且在一天之内
                 WarningNoticeLogDto warningNoticeLogDto = new WarningNoticeLogDto();
@@ -1117,7 +1118,7 @@ public class HxpStockServiceImpl implements IHxpStockService {
                     userIdStr.append(i.getSafeUserId()).append(",").append(i.getAdminId());
                     phones.append(i.getAdminPhone()).append(",").append(i.getSafeUserPhone());
                 }
-                if(DateUtils.getNowDate().getTime() > dateTime.getTime()){
+                if(DateUtils.getNowDate().getTime() > dateTime.getTime() && yesterday.getTime() < dateTime.getTime()){
                     hxpIds.add(hxpUserecord.getId());
                     //过了最大领用时间
                     warningNoticeLogDto.setWarningContent("化学品超时未归还");