|
@@ -1,6 +1,7 @@
|
|
|
package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
import cn.dev33.satoken.stp.StpUtil;
|
|
|
+import cn.hutool.core.date.DateTime;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
|
import com.alibaba.excel.ExcelWriter;
|
|
@@ -27,7 +28,9 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -57,19 +60,30 @@ public class AuthorizeRtkServiceImpl extends ServiceImpl<IAuthorizeRtkMapper, Au
|
|
|
if(rtkDevice == null || rtkDevice.getUseStatus() ==1){
|
|
|
throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
|
|
|
}
|
|
|
- if(rtkDevice.getValidStartTime() != null || rtkDevice.getValidEndTime() != null){
|
|
|
- throw new BusinessException(ResultCode.RTK_TIME_ERROR);
|
|
|
- }
|
|
|
+
|
|
|
if(authorizeRtk.getValidEndTime().before(authorizeRtk.getValidStartTime())){
|
|
|
throw new BusinessException(ResultCode.RTK_TIME_ERROR2);
|
|
|
}
|
|
|
|
|
|
String startTime = DateUtils.getStartTime(authorizeRtk.getValidStartTime());
|
|
|
String endTime = DateUtils.getEndTime(authorizeRtk.getValidEndTime());
|
|
|
+
|
|
|
+ DateTime startDate = DateUtil.parse(startTime);
|
|
|
+ DateTime endDate = DateUtil.parse(endTime);
|
|
|
+ if(rtkDevice.getValidStartTime() != null && rtkDevice.getValidEndTime() != null){
|
|
|
+ if(DateUtil.isIn(startDate,rtkDevice.getValidStartTime(),rtkDevice.getValidEndTime())){
|
|
|
+ throw new BusinessException(ResultCode.RTK_TIME_ERROR);
|
|
|
+ }
|
|
|
+ if(DateUtil.isIn(endDate,rtkDevice.getValidStartTime(),rtkDevice.getValidEndTime())){
|
|
|
+ throw new BusinessException(ResultCode.RTK_TIME_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
rtkDeviceService.updateValidTime(rtkDevice.getId(),startTime,endTime);
|
|
|
|
|
|
- authorizeRtk.setValidStartTime(DateUtil.parse(startTime));
|
|
|
- authorizeRtk.setValidEndTime(DateUtil.parse(endTime));
|
|
|
+ authorizeRtk.setValidStartTime(startDate);
|
|
|
+ authorizeRtk.setValidEndTime(endDate);
|
|
|
authorizeRtk.setSysUserId(Long.valueOf(StpUtil.getLoginId().toString()));
|
|
|
authorizeRtk.setOrderSn(DateUtils.getOrderSn());
|
|
|
this.save(authorizeRtk);
|
|
@@ -134,4 +148,11 @@ public class AuthorizeRtkServiceImpl extends ServiceImpl<IAuthorizeRtkMapper, Au
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<AuthorizeRtk> getByRtkCode(String rtkSnCode) {
|
|
|
+ LambdaQueryWrapper<AuthorizeRtk> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(AuthorizeRtk::getRtkCode,rtkSnCode);
|
|
|
+ return this.list(wrapper);
|
|
|
+ }
|
|
|
}
|