修改OTAbug

This commit is contained in:
高嵩
2023-08-27 23:45:45 +08:00
parent 07eda5d874
commit d51fb25470
3 changed files with 33 additions and 3 deletions
@@ -58,4 +58,7 @@ public interface IOtaManagePermissionService extends IService<OtaManagePermissio
* @return
*/
List<OtaManagePermission> queryList();
List<OtaManagePermission> queryByUserId(String userId);
}
@@ -207,9 +207,7 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
if (otaManager) {
dataList = otaManageApplyEOList;
} else {
LambdaQueryWrapper<OtaManagePermission> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OtaManagePermission::getUserId, currentUser.getId());
List<OtaManagePermission> managePermissionList = otaManagePermissionService.list(wrapper);
List<OtaManagePermission> managePermissionList = otaManagePermissionService.queryByUserId(currentUser.getId());
if (!managePermissionList.isEmpty()) {
List<String> applyIdList = managePermissionList.stream().map(OtaManagePermission::getApplyId).distinct().collect(Collectors.toList());
List<OtaManageApplyEO> collect = otaManageApplyEOList.stream().filter(e -> applyIdList.contains(e.getPlannedBpLaunchBatch())).collect(Collectors.toList());
@@ -297,6 +295,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
*/
@Override
public List<OtaManageApplyEO> getAllCarPage(OtaManageApplyEO otaManageApplyEO) {
if(!hasPermission(otaManageApplyEO.getPlannedBpLaunchBatch())){
return new ArrayList<>();
}
List<OtaManageApplyEO> otaManageApplyEOList = this.getBaseMapper().getOtaList(otaManageApplyEO);
//studio数据权限
if (isOtaManager()) {
@@ -674,6 +675,21 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
}
}
private boolean hasPermission(String plannedBpLaunchBatch){
if(isOtaManager()){
return true;
}
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
List<OtaManagePermission> managePermissionList = otaManagePermissionService.queryByUserId(currentUser.getId());
if (!managePermissionList.isEmpty()) {
List<String> applyIdList = managePermissionList.stream().map(OtaManagePermission::getApplyId).distinct().collect(Collectors.toList());
if(applyIdList.contains(plannedBpLaunchBatch)){
return true;
}
}
return false;
}
/**
* 分车型列表-分页列表查询
*
@@ -682,6 +698,9 @@ public class OtaManageApplyEOServiceImpl extends ServiceImpl<OtaManageApplyEOMap
*/
@Override
public List<OtaManageApplyEO> getOtaCarPage(OtaManageApplyEO otaManageApplyEO, String cut) {
if(!hasPermission(otaManageApplyEO.getPlannedBpLaunchBatch())){
return new ArrayList<>();
}
List<OtaManageApplyEO> otaManageApplyEOList = this.getBaseMapper().getOtaCarPage(otaManageApplyEO);
List<OtaManageApplyEO> list = new ArrayList<>();
Map<String, OtaManageApplyEO> omaMap = new HashMap<>();
@@ -1,5 +1,6 @@
package com.jero.modules.ota.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.ota.entity.OtaManagePermission;
import com.jero.modules.ota.mapper.OtaManagePermissionMapper;
import com.jero.modules.ota.service.IOtaManagePermissionService;
@@ -86,4 +87,11 @@ public class OtaManagePermissionServiceImpl extends ServiceImpl<OtaManagePermiss
public List<OtaManagePermission> queryList() {
return list();
}
@Override
public List<OtaManagePermission> queryByUserId(String userId) {
LambdaQueryWrapper<OtaManagePermission> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(OtaManagePermission::getUserId, userId);
return this.list(wrapper);
}
}