|
@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.fdkankan.common.constant.CommonOperStatus;
|
|
|
import com.fdkankan.common.constant.RecStatus;
|
|
|
import com.fdkankan.fyun.face.FYunFileServiceInterface;
|
|
|
import com.fdkankan.jp.xspace.common.PageInfo;
|
|
@@ -33,10 +34,7 @@ import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Set;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
@@ -178,4 +176,36 @@ public class SceneXspaceServiceImpl extends ServiceImpl<ISceneXspaceMapper, Scen
|
|
|
public SceneXspace getByNumAndUserId(String num, long userId) {
|
|
|
return this.getOne(new LambdaQueryWrapper<SceneXspace>().eq(SceneXspace::getNum, num).eq(SceneXspace::getUserId, userId));
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Result replaceSync(Long id,User user) {
|
|
|
+
|
|
|
+ SceneXspace sceneXspace = this.getById(id);
|
|
|
+ if(Objects.isNull(sceneXspace)){
|
|
|
+ throw new BusinessException(ResultCode.NOT_RECORD);
|
|
|
+ }
|
|
|
+
|
|
|
+ //校验数据
|
|
|
+ Set<Long> roleIds = userRoleService.getByUser(user);
|
|
|
+ boolean notPermission = false;
|
|
|
+ if(!roleIds.contains(5L)){//平台管理员可以看到所有
|
|
|
+ if(roleIds.contains(6L)){//公司管理员可以看到同一公司下所有
|
|
|
+ User sceneUser = userService.getById(sceneXspace.getId());
|
|
|
+ notPermission = !sceneUser.getCompanyId().equals(user.getCompanyId());
|
|
|
+ }else{//普通员工只能删除自己的
|
|
|
+ notPermission = !sceneXspace.getUserId().equals(user.getId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(notPermission){
|
|
|
+ return Result.failure(ResultCode.NOT_PERMISSION);
|
|
|
+ }
|
|
|
+
|
|
|
+ sceneXspace.setStatus(CommonOperStatus.WAITING.code());
|
|
|
+ sceneXspace.setUpdateTime(new Date());
|
|
|
+ this.updateById(sceneXspace);
|
|
|
+
|
|
|
+ mqProducer.sendByWorkQueue(RabbitmqConstant.QUEUE_PACK_XSPACE, sceneXspace);
|
|
|
+
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
}
|