|
@@ -1,15 +1,18 @@
|
|
|
package com.fdkankan.manage.service.impl;
|
|
|
|
|
|
+import cn.dev33.satoken.stp.StpUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.fdkankan.manage.common.PageInfo;
|
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
|
import com.fdkankan.manage.entity.AgentAudit;
|
|
|
+import com.fdkankan.manage.entity.Camera;
|
|
|
import com.fdkankan.manage.entity.RtkInfo;
|
|
|
import com.fdkankan.manage.entity.SysUser;
|
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
|
import com.fdkankan.manage.mapper.IRtkInfoMapper;
|
|
|
+import com.fdkankan.manage.service.ICameraService;
|
|
|
import com.fdkankan.manage.service.IRtkInfoService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.manage.service.ISysUserService;
|
|
@@ -18,10 +21,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.HashSet;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -38,7 +38,8 @@ public class RtkInfoServiceImpl extends ServiceImpl<IRtkInfoMapper, RtkInfo> imp
|
|
|
|
|
|
@Autowired
|
|
|
ISysUserService sysUserService;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ ICameraService cameraService;
|
|
|
@Override
|
|
|
public RtkInfo getByRtkSnCode(String rtkSnCode) {
|
|
|
LambdaQueryWrapper<RtkInfo> wrapper = new LambdaQueryWrapper<>();
|
|
@@ -120,4 +121,49 @@ public class RtkInfoServiceImpl extends ServiceImpl<IRtkInfoMapper, RtkInfo> imp
|
|
|
wrapper.set(RtkInfo::getStatus,rtkInfo.getStatus());
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void saveOrEditEntity(RtkInfo rtkInfo) {
|
|
|
+ RtkInfo dbRtkInfo = null;
|
|
|
+ RtkInfo dbRtkInfo2 = null;
|
|
|
+ Camera camera = null;
|
|
|
+ if(StringUtils.isNotBlank(rtkInfo.getRtkSnCode())){
|
|
|
+ dbRtkInfo = this.getByRtkSnCode(rtkInfo.getRtkSnCode());
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(rtkInfo.getCameraSnCode())){
|
|
|
+ camera = cameraService.getBySnCode(rtkInfo.getCameraSnCode());
|
|
|
+ if(camera == null){
|
|
|
+ throw new BusinessException(ResultCode.CAMERA_NOT_EXIST);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(rtkInfo.getCameraSnCode())){
|
|
|
+ dbRtkInfo2 = this.getByCameraSnCode(rtkInfo.getRtkSnCode());
|
|
|
+ }
|
|
|
+
|
|
|
+ if(rtkInfo.getId() == null){
|
|
|
+ if(dbRtkInfo != null){
|
|
|
+ throw new BusinessException(ResultCode.RTK_SN_EXIST);
|
|
|
+ }
|
|
|
+ rtkInfo.setCreateUserId(Long.valueOf((String) StpUtil.getLoginId()));
|
|
|
+ }else {
|
|
|
+ if( dbRtkInfo != null && !Objects.equals(dbRtkInfo.getId(), rtkInfo.getId()) ){
|
|
|
+ throw new BusinessException(ResultCode.RTK_SN_EXIST);
|
|
|
+ }
|
|
|
+ rtkInfo.setUpdateUserId(Long.valueOf((String)StpUtil.getLoginId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(rtkInfo.getRtkType() != null && rtkInfo.getRtkType() == 0){
|
|
|
+ rtkInfo.setIpAddr(null);
|
|
|
+ rtkInfo.setMountPoint(null);
|
|
|
+ rtkInfo.setPort(null);
|
|
|
+ rtkInfo.setUserName(null);
|
|
|
+ rtkInfo.setPassword(null);
|
|
|
+ rtkInfo.setOperator(null);
|
|
|
+ }
|
|
|
+ this.saveOrUpdate(rtkInfo);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void checkSaveParam(RtkInfo param){
|
|
|
+ //2024-07-02 09:44:49.379 [http-nio-8082-exec-2767] ERROR c.f.ucenter.exception.GlobalExceptionHandler - 服务错误:
|
|
|
+ }
|
|
|
}
|