车车 1 anno fa
parent
commit
f5e0b9e557

+ 2 - 2
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsLoanServiceImpl.java

@@ -214,13 +214,13 @@ public class IsMaterialsLoanServiceImpl extends ServiceImpl<IsMaterialsLoanMappe
                     // 1.2.2计算应该归还时间
                     Date restitutionTime = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration());
                     isMaterialsLoan.setRestitutionTime(restitutionTime);
-                    if (materialsTypePageVO.getReminderTime() != null) {
+                    if (materialsTypePageVO.getReminderTime() != null && materialsTypePageVO.getReminderTime() > 0) {
                         // 1.2.3计算提醒时间
                         re = materialsTypePageVO.getLoanDuration() - materialsTypePageVO.getReminderTime();
                         Date reminderTime = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration() - materialsTypePageVO.getReminderTime());
                         isMaterialsLoan.setReminderTime(reminderTime);
                     }
-                    if (materialsTypePageVO.getTimeoutAlarm() != null) {
+                    if (materialsTypePageVO.getTimeoutAlarm() != null && materialsTypePageVO.getTimeoutAlarm() > 0) {
                         // 1.2.4计算告警时间
                         al = materialsTypePageVO.getLoanDuration() + materialsTypePageVO.getTimeoutAlarm();
                         Date timeoutAlarm = formatDateTime(nowDate, materialsTypePageVO.getLoanDuration() + materialsTypePageVO.getTimeoutAlarm());

+ 2 - 0
ktg-iscs/src/main/java/com/ktg/iscs/service/impl/IsMaterialsTypeServiceImpl.java

@@ -73,6 +73,7 @@ public class IsMaterialsTypeServiceImpl extends ServiceImpl<IsMaterialsTypeMappe
     @Override
     public int insertIsMaterialsType(MaterialsTypePageDTO dto)
     {
+        Assert.isTrue(dto.getLoanDuration() >= dto.getReminderTime(), "借用时长需要大于等于提醒时长!");
         dto.setCreateTime(DateUtils.getNowDate());
         IsMaterialsType isMaterialsType = BeanUtils.toBean(dto, IsMaterialsType.class);
         int i = isMaterialsTypeMapper.insertIsMaterialsType(isMaterialsType);
@@ -99,6 +100,7 @@ public class IsMaterialsTypeServiceImpl extends ServiceImpl<IsMaterialsTypeMappe
     @Override
     public int updateIsMaterialsType(MaterialsTypePageDTO dto)
     {
+        Assert.isTrue(dto.getLoanDuration() >= dto.getReminderTime(), "借用时长需要大于等于提醒时长!");
         dto.setUpdateTime(DateUtils.getNowDate());
         IsMaterialsType isMaterialsType = BeanUtils.toBean(dto, IsMaterialsType.class);
         int i = isMaterialsTypeMapper.updateIsMaterialsType(isMaterialsType);