|
@@ -6,12 +6,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
import com.fdkankan.fusion.common.ResultCode;
|
|
|
import com.fdkankan.fusion.common.util.RedisKeyUtil;
|
|
import com.fdkankan.fusion.common.util.RedisKeyUtil;
|
|
|
-import com.fdkankan.fusion.entity.CaseEntity;
|
|
|
|
|
-import com.fdkankan.fusion.entity.SceneDeptShare;
|
|
|
|
|
|
|
+import com.fdkankan.fusion.entity.*;
|
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
import com.fdkankan.fusion.exception.BusinessException;
|
|
|
import com.fdkankan.fusion.mapper.ISceneDeptShareMapper;
|
|
import com.fdkankan.fusion.mapper.ISceneDeptShareMapper;
|
|
|
-import com.fdkankan.fusion.service.ICaseService;
|
|
|
|
|
-import com.fdkankan.fusion.service.ISceneDeptShareService;
|
|
|
|
|
|
|
+import com.fdkankan.fusion.service.*;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
import com.fdkankan.redis.util.RedisUtil;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -36,6 +34,20 @@ public class SceneDeptShareServiceImpl extends ServiceImpl<ISceneDeptShareMapper
|
|
|
RedisUtil redisUtil;
|
|
RedisUtil redisUtil;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
ICaseService caseService;
|
|
ICaseService caseService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ICaseFusionService caseFusionService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ITmUserService tmUserService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ITmProjectService tmProjectService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ IScenePlusService scenePlusService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ICameraService cameraService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ITmRoleService tmRoleService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ ITmCameraService tmCameraService;
|
|
|
@Override
|
|
@Override
|
|
|
public void share(SceneDeptShare param) {
|
|
public void share(SceneDeptShare param) {
|
|
|
if(((StringUtils.isBlank(param.getNum()) || param.getIsObj() == null) && param.getCaseId() == null && param.getFusionId() == null)
|
|
if(((StringUtils.isBlank(param.getNum()) || param.getIsObj() == null) && param.getCaseId() == null && param.getFusionId() == null)
|
|
@@ -168,7 +180,20 @@ public class SceneDeptShareServiceImpl extends ServiceImpl<ISceneDeptShareMapper
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void checkNum(String num,Integer isObj) {
|
|
public void checkNum(String num,Integer isObj) {
|
|
|
|
|
+ List<String> roleList = StpUtil.getRoleList();
|
|
|
|
|
+ if(roleList.contains("admin-super")){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
String deptId =(String) StpUtil.getExtra("deptId");
|
|
String deptId =(String) StpUtil.getExtra("deptId");
|
|
|
|
|
+ ScenePlus scenePlus = scenePlusService.getByNum(num);
|
|
|
|
|
+ if(scenePlus == null || scenePlus.getSceneStatus() !=-2){
|
|
|
|
|
+ throw new BusinessException(ResultCode.SCENE_BUILDING);
|
|
|
|
|
+ }
|
|
|
|
|
+ Camera camera = cameraService.getByCameraId(scenePlus.getCameraId());
|
|
|
|
|
+ TmCamera bySnCode = tmCameraService.getBySnCode(camera.getSnCode());
|
|
|
|
|
+ if(bySnCode.getDeptId().equals(deptId)){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
List<SceneDeptShare> numListByDeptId = this.getNumListByDeptId(deptId,num, isObj);
|
|
List<SceneDeptShare> numListByDeptId = this.getNumListByDeptId(deptId,num, isObj);
|
|
|
if(numListByDeptId == null || numListByDeptId.isEmpty()){
|
|
if(numListByDeptId == null || numListByDeptId.isEmpty()){
|
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
@@ -177,7 +202,23 @@ public class SceneDeptShareServiceImpl extends ServiceImpl<ISceneDeptShareMapper
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void checkFusion(Integer fusionId) {
|
|
public void checkFusion(Integer fusionId) {
|
|
|
|
|
+ List<String> roleList = StpUtil.getRoleList();
|
|
|
|
|
+ if(roleList.contains("admin-super")){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
String deptId =(String) StpUtil.getExtra("deptId");
|
|
String deptId =(String) StpUtil.getExtra("deptId");
|
|
|
|
|
+ CaseFusion caseFusion = caseFusionService.getById(fusionId);
|
|
|
|
|
+ if(caseFusion == null){
|
|
|
|
|
+ throw new BusinessException(ResultCode.RECORD_NOT_EXITS);
|
|
|
|
|
+ }
|
|
|
|
|
+ TmUser tmUser = tmUserService.getById(caseFusion.getSysUserId());
|
|
|
|
|
+ if(tmUser == null){
|
|
|
|
|
+ throw new BusinessException(ResultCode.RECORD_NOT_EXITS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(deptId.equals(tmUser.getDeptId())){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
List<SceneDeptShare> numListByDeptId = this.getFusionIdsListByDeptId(deptId,fusionId);
|
|
List<SceneDeptShare> numListByDeptId = this.getFusionIdsListByDeptId(deptId,fusionId);
|
|
|
if(numListByDeptId == null || numListByDeptId.isEmpty()){
|
|
if(numListByDeptId == null || numListByDeptId.isEmpty()){
|
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
@@ -199,7 +240,27 @@ public class SceneDeptShareServiceImpl extends ServiceImpl<ISceneDeptShareMapper
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public void checkCaseId(Integer caseId) {
|
|
public void checkCaseId(Integer caseId) {
|
|
|
|
|
+ List<String> roleList = StpUtil.getRoleList();
|
|
|
|
|
+ if(roleList.contains("admin-super")){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
String deptId =(String) StpUtil.getExtra("deptId");
|
|
String deptId =(String) StpUtil.getExtra("deptId");
|
|
|
|
|
+
|
|
|
|
|
+ CaseEntity caseEntity = caseService.getById(caseId);
|
|
|
|
|
+ if(caseEntity == null){
|
|
|
|
|
+ throw new BusinessException(ResultCode.RECORD_NOT_EXITS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(caseEntity.getDeptId()!= null && deptId.equals(caseEntity.getDeptId())){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ TmProject tmProject = tmProjectService.getById(caseEntity.getTmProjectId());
|
|
|
|
|
+ if(tmProject == null){
|
|
|
|
|
+ throw new BusinessException(ResultCode.RECORD_NOT_EXITS);
|
|
|
|
|
+ }
|
|
|
|
|
+ if(deptId.equals(tmProject.getDeptId())){
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
List<SceneDeptShare> numListByDeptId = this.getCaseIdsListByDeptId(deptId,caseId);
|
|
List<SceneDeptShare> numListByDeptId = this.getCaseIdsListByDeptId(deptId,caseId);
|
|
|
if(numListByDeptId == null || numListByDeptId.isEmpty()){
|
|
if(numListByDeptId == null || numListByDeptId.isEmpty()){
|
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|
|
throw new BusinessException(ResultCode.NOT_PERMISSION);
|