|
@@ -1,19 +1,21 @@
|
|
package com.fdkankan.manage.inner.controller;
|
|
package com.fdkankan.manage.inner.controller;
|
|
|
|
|
|
|
|
+import cn.hutool.extra.servlet.ServletUtil;
|
|
import cn.hutool.log.Log;
|
|
import cn.hutool.log.Log;
|
|
import com.fdkankan.common.util.SecurityUtil;
|
|
import com.fdkankan.common.util.SecurityUtil;
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
import com.fdkankan.manage.common.ResultCode;
|
|
import com.fdkankan.manage.common.ResultData;
|
|
import com.fdkankan.manage.common.ResultData;
|
|
import com.fdkankan.manage.controller.BaseController;
|
|
import com.fdkankan.manage.controller.BaseController;
|
|
|
|
+import com.fdkankan.manage.entity.RtkAccount;
|
|
|
|
+import com.fdkankan.manage.entity.RtkDevice;
|
|
import com.fdkankan.manage.entity.RtkInfo;
|
|
import com.fdkankan.manage.entity.RtkInfo;
|
|
|
|
+import com.fdkankan.manage.entity.RtkUseLog;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
import com.fdkankan.manage.exception.BusinessException;
|
|
-import com.fdkankan.manage.service.ICommonService;
|
|
|
|
-import com.fdkankan.manage.service.IRtkInfoService;
|
|
|
|
-import com.fdkankan.manage.service.ISceneProService;
|
|
|
|
-import com.fdkankan.manage.service.IServiceUpTipService;
|
|
|
|
|
|
+import com.fdkankan.manage.service.*;
|
|
import com.fdkankan.manage.util.RsaUtils;
|
|
import com.fdkankan.manage.util.RsaUtils;
|
|
import com.fdkankan.manage.vo.request.SceneParam;
|
|
import com.fdkankan.manage.vo.request.SceneParam;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -76,6 +78,12 @@ public class InnerController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
IRtkInfoService rtkInfoService;
|
|
IRtkInfoService rtkInfoService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IRtkAccountService rtkAccountService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IRtkDeviceService rtkDeviceService;
|
|
|
|
+ @Autowired
|
|
|
|
+ IRtkUseLogService rtkUseLogService;
|
|
|
|
|
|
/**
|
|
/**
|
|
*
|
|
*
|
|
@@ -85,27 +93,23 @@ public class InnerController extends BaseController {
|
|
if(StringUtils.isBlank(rtkSnCode)){
|
|
if(StringUtils.isBlank(rtkSnCode)){
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
}
|
|
}
|
|
-// String token = getSign();
|
|
|
|
-// if(StringUtils.isBlank(token)){
|
|
|
|
-// throw new BusinessException(ResultCode.RTK_TOKEN_NOT_EXIT);
|
|
|
|
-// }
|
|
|
|
-// try {
|
|
|
|
-// String deTxt = RsaUtils.decipher(token, RsaUtils.privateKey);
|
|
|
|
-// if(!deTxt.equals(rtkSnCode)){
|
|
|
|
-// throw new BusinessException(ResultCode.RTK_TOKEN_ERROR);
|
|
|
|
-// }
|
|
|
|
-// }catch (Exception e){
|
|
|
|
-// throw new BusinessException(ResultCode.RTK_TOKEN_ERROR);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- RtkInfo rtkInfo = rtkInfoService.getByRtkSnCode(rtkSnCode);
|
|
|
|
- if(rtkInfo == null){
|
|
|
|
|
|
+ RtkDevice rtkDevice = rtkDeviceService.getByRtkSnCode(rtkSnCode);
|
|
|
|
+ if(rtkDevice == null){
|
|
throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
|
|
throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_EXIT);
|
|
}
|
|
}
|
|
-// if(rtkInfo.getStatus() == 0){
|
|
|
|
-// throw new BusinessException(ResultCode.RTK_SN_CODE_NOT_AC);
|
|
|
|
-// }
|
|
|
|
|
|
+ RtkInfo rtkInfo = new RtkInfo();
|
|
|
|
+ rtkInfo.setRtkSnCode(rtkSnCode);
|
|
|
|
+ rtkInfo.setRtkType(rtkDevice.getType());
|
|
|
|
+ //rtkDevice.getType() = 0板卡自带账号信息,无需关联
|
|
|
|
+ if(rtkDevice.getType() != 0){
|
|
|
|
+ RtkAccount rtkAccount = rtkAccountService.getOneNotUseAccount(rtkSnCode);
|
|
|
|
+ BeanUtils.copyProperties(rtkAccount,rtkInfo);
|
|
|
|
+ }
|
|
|
|
+ RtkUseLog rtkUseLog = new RtkUseLog();
|
|
|
|
+ BeanUtils.copyProperties(rtkInfo,rtkUseLog);
|
|
|
|
+ String clientIP = ServletUtil.getClientIP(request);
|
|
|
|
+ rtkUseLog.setVisitIp(clientIP);
|
|
|
|
+ rtkUseLogService.save(rtkUseLog);
|
|
return ResultData.ok(rtkInfo);
|
|
return ResultData.ok(rtkInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|