|
@@ -3,6 +3,7 @@ package com.fdkankan.manage.controller.inner;
|
|
import cn.hutool.extra.servlet.ServletUtil;
|
|
import cn.hutool.extra.servlet.ServletUtil;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
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.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.dtflys.forest.annotation.Post;
|
|
import com.dtflys.forest.annotation.Post;
|
|
import com.fdkankan.manage.common.CameraTypeEnum;
|
|
import com.fdkankan.manage.common.CameraTypeEnum;
|
|
@@ -20,6 +21,7 @@ import com.fdkankan.manage.vo.request.*;
|
|
import com.fdkankan.manage.vo.response.ManageLoginResponse;
|
|
import com.fdkankan.manage.vo.response.ManageLoginResponse;
|
|
import com.fdkankan.manage.vo.response.UserAuthSceneVo;
|
|
import com.fdkankan.manage.vo.response.UserAuthSceneVo;
|
|
import com.fdkankan.manage.vo.response.UserShareSceneVo;
|
|
import com.fdkankan.manage.vo.response.UserShareSceneVo;
|
|
|
|
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
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.*;
|
|
@@ -49,6 +51,11 @@ public class InnerAPIController extends BaseController {
|
|
ISysUserService sysUserService;
|
|
ISysUserService sysUserService;
|
|
@Autowired
|
|
@Autowired
|
|
IJyPlatformService jyPlatformService;
|
|
IJyPlatformService jyPlatformService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ICaseService caseService;
|
|
|
|
+ @Autowired
|
|
|
|
+ ManageService manageService;
|
|
|
|
+
|
|
|
|
|
|
@PostMapping("/getByRyId")
|
|
@PostMapping("/getByRyId")
|
|
public ResultData getByRyId(@RequestBody UserParam param){
|
|
public ResultData getByRyId(@RequestBody UserParam param){
|
|
@@ -396,8 +403,7 @@ public class InnerAPIController extends BaseController {
|
|
return ResultData.ok(camera);
|
|
return ResultData.ok(camera);
|
|
}
|
|
}
|
|
|
|
|
|
- @Autowired
|
|
|
|
- ManageService manageService;
|
|
|
|
|
|
+
|
|
|
|
|
|
@PostMapping("/getTokenByRyNo")
|
|
@PostMapping("/getTokenByRyNo")
|
|
public ResultData getTokenByRyNo(@RequestBody ManageLoginRequest param){
|
|
public ResultData getTokenByRyNo(@RequestBody ManageLoginRequest param){
|
|
@@ -418,4 +424,97 @@ public class InnerAPIController extends BaseController {
|
|
return ResultData.ok(jyPlatformService.pageList(param));
|
|
return ResultData.ok(jyPlatformService.pageList(param));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ @PostMapping("/getTokenByProjectId")
|
|
|
|
+ public ResultData getTokenByProjectId(@RequestBody ManageLoginRequest param){
|
|
|
|
+ if(StringUtils.isBlank(param.getProjectId())){
|
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<ScenePlus> sceneQw = new LambdaQueryWrapper<>();
|
|
|
|
+ sceneQw.eq(ScenePlus::getTaskId,param.getProjectId());
|
|
|
|
+ List<ScenePlus> list = scenePlusService.list(sceneQw);
|
|
|
|
+ if(list == null || list.isEmpty()){
|
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
|
|
|
|
+ }
|
|
|
|
+ ScenePlus scenePlus = list.get(0);
|
|
|
|
+ User user = userService.getById(scenePlus.getUserId());
|
|
|
|
+ if(user == null){
|
|
|
|
+ throw new BusinessException(ResultCode.JY_ID_NO_EXIST);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ param.setUserName(user.getUserName());
|
|
|
|
+ String clientIP = ServletUtil.getClientIP(request);
|
|
|
|
+ param.setNeedPassword(false);
|
|
|
|
+ param.setClientIp(clientIP);
|
|
|
|
+ ManageLoginResponse login = manageService.login(param);
|
|
|
|
+ HashMap<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("token",login.getToken());
|
|
|
|
+ map.put("num",scenePlus.getNum());
|
|
|
|
+ return ResultData.ok(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @PostMapping("/getTokenByKno")
|
|
|
|
+ public ResultData getTokenByKno(@RequestBody ManageLoginRequest param){
|
|
|
|
+ if(StringUtils.isBlank(param.getKno())){
|
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<ScenePlus> sceneQw = new LambdaQueryWrapper<>();
|
|
|
|
+ sceneQw.eq(ScenePlus::getKNo,param.getKno());
|
|
|
|
+ List<ScenePlus> list = scenePlusService.list(sceneQw);
|
|
|
|
+ if(list == null || list.isEmpty()){
|
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
|
|
|
|
+ }
|
|
|
|
+ ScenePlus scenePlus = list.get(0);
|
|
|
|
+ JyUser jyUser = jyUserService.getByUserId(scenePlus.getUserId());
|
|
|
|
+ Integer platformId = jyUser.getPlatformId();
|
|
|
|
+ List<JyUser> jyUserList = jyUserService.getAdminByPlatformId(platformId);
|
|
|
|
+ if(jyUserList == null || jyUserList.isEmpty()){
|
|
|
|
+ throw new BusinessException(ResultCode.NOT_ROLE);
|
|
|
|
+ }
|
|
|
|
+ Case caseEntity = caseService.getByKno(param.getKno());
|
|
|
|
+
|
|
|
|
+ param.setUserName(jyUserList.get(0).getRyNo());
|
|
|
|
+ String clientIP = ServletUtil.getClientIP(request);
|
|
|
|
+ param.setNeedPassword(false);
|
|
|
|
+ param.setClientIp(clientIP);
|
|
|
|
+ ManageLoginResponse login = manageService.login(param);
|
|
|
|
+
|
|
|
|
+ HashMap<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("token",login.getToken());
|
|
|
|
+ map.put("numList",list.stream().map(ScenePlus::getNum).collect(Collectors.toList()));
|
|
|
|
+ if(caseEntity !=null){
|
|
|
|
+ map.put("caseId", caseEntity.getCaseId());
|
|
|
|
+ }
|
|
|
|
+ return ResultData.ok(map);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ RabbitMqProducer rabbitMqProducer;
|
|
|
|
+
|
|
|
|
+ @PostMapping("/updateKno")
|
|
|
|
+ public ResultData updateKno(@RequestBody ManageLoginRequest param){
|
|
|
|
+ if(StringUtils.isBlank(param.getProjectId())){
|
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
|
+ }
|
|
|
|
+ LambdaQueryWrapper<ScenePlus> sceneQw = new LambdaQueryWrapper<>();
|
|
|
|
+ sceneQw.eq(ScenePlus::getTaskId,param.getProjectId());
|
|
|
|
+ List<ScenePlus> list = scenePlusService.list(sceneQw);
|
|
|
|
+ if(list == null || list.isEmpty()){
|
|
|
|
+ throw new BusinessException(ResultCode.SCENE_NOT_EXIST);
|
|
|
|
+ }
|
|
|
|
+ ScenePlus scenePlus = list.get(0);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ LambdaUpdateWrapper<ScenePlus> wrapper = new LambdaUpdateWrapper<>();
|
|
|
|
+ wrapper.eq(ScenePlus::getTaskId,param.getProjectId());
|
|
|
|
+ wrapper.set(ScenePlus::getKNo,param.getKno());
|
|
|
|
+ scenePlusService.update(wrapper);
|
|
|
|
+ HashMap<String,Object> map = new HashMap<>();
|
|
|
|
+ map.put("num",scenePlus.getNum());
|
|
|
|
+ map.put("kNo",param.getKno());
|
|
|
|
+ //rabbitMqProducer.sendByWorkQueue("queue-aj-add-scene",map);
|
|
|
|
+
|
|
|
|
+ return ResultData.ok();
|
|
|
|
+ }
|
|
}
|
|
}
|