Kaynağa Gözat

clear

tags/V1.3.3^2
wanjing 1 yıl önce
ebeveyn
işleme
24ae6e0e9d
41 değiştirilmiş dosya ile 178 ekleme ve 150 silme
  1. +8
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/User.java
  2. +11
    -8
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/DataPermissionEnum.java
  3. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/user/AddUserCodeEnum.java
  4. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/user/EditUserCodeEnum.java
  5. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/workorder/DistributionWorkorderCodeEnum.java
  6. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentTipsService.java
  7. +2
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardListService.java
  8. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardPageListService.java
  9. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeService.java
  10. +20
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/flightdata/query/QueryFindFlightDataService.java
  11. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java
  12. +5
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java
  13. +5
    -5
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryNewInspectionListService.java
  14. +1
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/EditHandle.java
  15. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/ExecuteHandle.java
  16. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/UpdateInspectionService.java
  17. +7
    -10
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java
  18. +3
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java
  19. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java
  20. +2
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java
  21. +5
    -9
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/road/RoadInformationServiceImpl.java
  22. +6
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java
  23. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/structure/StructureServiceImpl.java
  24. +1
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java
  25. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/StartAIService.java
  26. +2
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/AddOidcTenantService.java
  27. +4
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/add/AddUserService.java
  28. +2
    -3
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserListByDeptIdService.java
  29. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserPageListService.java
  30. +4
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/update/UpdateUserService.java
  31. +7
    -15
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/distribution/DistributionWorkorderService.java
  32. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/generate/GenerateWorkorderService.java
  33. +4
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/query/QueryWorkOrderPageListService.java
  34. +5
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/user/UserInfoVo.java
  35. +4
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/user/UserPageListVo.java
  36. +6
    -4
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/UserMapper.xml
  37. +4
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/User.java
  38. +5
    -5
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/DataPermissionEnum.java
  39. +4
    -4
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java
  40. +4
    -4
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java
  41. +12
    -13
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java

+ 8
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/User.java Dosyayı Görüntüle

@@ -23,7 +23,7 @@ import java.util.Date;
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("th_oauth_user")
@TableName("th_user")
public class User implements Serializable {

private static final long serialVersionUID = 1L;
@@ -208,8 +208,8 @@ public class User implements Serializable {
/**
* 角色ID
*/
@TableField(exist = false)
private String[] roleIds;
// @TableField(exist = false)
// private String[] roleIds;

/**
* 城市集合
@@ -226,4 +226,9 @@ public class User implements Serializable {
* 标识id 小程序,pc
*/
private String clientId;

/**
* 数据权限:1:查看所有部门数据;2:查看本部门及子部门;3:查看本部门数据;
*/
private Integer dataPermission;
}

+ 11
- 8
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/DataPermissionEnum.java Dosyayı Görüntüle

@@ -12,13 +12,16 @@ import java.util.Map;
* @team tuoheng
* @date 2022-11-25
*/
public enum RoleEnum {
public enum DataPermissionEnum {

SUPER_ADMIN(1,"超级管理员"),
ADMIN(2,"管理员"),
ORDINARY_USER(3,"普通用户");
ALL(1,"查看所有部门数据"),
DEPT_AND_SUB_DEPT(2,"查看本部门及子部门数据"),
DEPT(3,"查看本部门数据");

RoleEnum(int code, String description){
// ADMIN(2,"管理员"),
// ORDINARY_USER(3,"普通用户");

DataPermissionEnum(int code, String description){
this.code = code;
this.description = description;
}
@@ -29,15 +32,15 @@ public enum RoleEnum {
@Getter
private String description;

private static Map<Integer, RoleEnum> data = new HashMap<>();
private static Map<Integer, DataPermissionEnum> data = new HashMap<>();

static {
for (RoleEnum type : RoleEnum.values()) {
for (DataPermissionEnum type : DataPermissionEnum.values()) {
data.put(type.code, type);
}
}

public static RoleEnum parse(int code) {
public static DataPermissionEnum parse(int code) {
if (data.containsKey(code)) {
return data.get(code);
}

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/user/AddUserCodeEnum.java Dosyayı Görüntüle

@@ -22,7 +22,8 @@ public enum AddUserCodeEnum {
TYPE_ID_IS_NOT_EXISTS(1100108, "用户类型不存在"),
PHONE_NOT_IMATCH(1100109, "手机号不匹配"),
USERNAME_ALREADY_EXISTS(1100110, "系统中已经存在该账号"),
ROLE_IS_NOT_EXISTS(1100111, "该角色不存在");
ROLE_IS_NOT_EXISTS(1100111, "该角色不存在"),
DATA_PERMISSION_IS_NULL(1100112, "数据权限不能为空");

/**
* 错误码

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/user/EditUserCodeEnum.java Dosyayı Görüntüle

@@ -21,7 +21,8 @@ public enum EditUserCodeEnum {
PHONE_NOT_IMATCH(1100307, "手机号不匹配"),
USER_IS_NOT_EXIST(1100308, "用户不存在"),
USERNAME_ALREADY_EXISTS(1100309, "系统中已经存在该用户名"),
ROLE_IS_NOT_EXISTS(1100310, "该角色不存在");;
ROLE_IS_NOT_EXISTS(1100310, "该角色不存在"),
DATA_PERMISSION_IS_NULL(1100311, "数据权限不能为空"),;

/**
* 错误码

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/workorder/DistributionWorkorderCodeEnum.java Dosyayı Görüntüle

@@ -17,7 +17,7 @@ public enum DistributionWorkorderCodeEnum {
ASSIGN_DEPT_ID_IS_NULL(1260403, "指派部门ID为空"),
ASSIGN_USER_ID_IS_NULL(1260404, "指派负责人为空"),
ASSIGN_USER_ID_IS_NOT_EXIST(1260405, "指派负责人不存在"),
SUPER_ADMIN_NOT_DISTRIBUTION(1260406, "超级管理员不能分配工单"),
ALL_NOT_DISTRIBUTION(1260406, "超级管理员不能分配工单"),
ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER(1260407, "管理员不能分配子部门工单"),
ORDINARY_USER_NOT_DISTRIBUTION(1260408, "普通用户不能分配工单");


+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/AccidentTipsService.java Dosyayı Görüntüle

@@ -8,7 +8,7 @@ import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.SectionMapper;
@@ -77,7 +77,7 @@ public class AccidentTipsService {
}
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getDeptId, accident.getDeptId())
.eq(User::getRoleId, RoleEnum.ADMIN.getCode())
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode())
.eq(User::getMark, MarkEnum.VALID.getCode()));
if(ObjectUtils.isEmpty(user)){
throw new ServiceException("登录用户对应的部门没有管理员账户");

+ 2
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardListService.java Dosyayı Görüntüle

@@ -3,12 +3,11 @@ package com.tuoheng.admin.service.accident.query;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.conver.AccidentConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.accident.QueryAccidentCardListRequest;
import com.tuoheng.admin.utils.CurrentUserUtil;
@@ -161,7 +160,7 @@ public class QueryAccidentCardListService {
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, RoleEnum.ADMIN.getCode()));
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/accident/query/QueryAccidentCardPageListService.java Dosyayı Görüntüle

@@ -12,7 +12,7 @@ import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.AccidentEnum;
import com.tuoheng.admin.enums.FlagEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.mapper.AccidentMapper;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
@@ -142,7 +142,7 @@ public class QueryAccidentCardPageListService {
List<String> deptIdList = deptMap.keySet().stream().collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.in(User::getDeptId, deptIdList)
.eq(User::getRoleId, RoleEnum.ADMIN.getCode()));
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()));
Map<String, User> userMap = userList.stream().collect(HashMap::new, (m, v) -> m.put(v.getDeptId(), v), HashMap::putAll);
return userMap;
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/dept/query/QueryListTreeService.java Dosyayı Görüntüle

@@ -50,7 +50,7 @@ public class QueryListTreeService {

if (CollectionUtil.isEmpty(deptList)) {
log.info("获取部门列表为空");
return JsonResult.error(QueryDeptTreeListCodeEnum.DEPT_LIST_IS_NULL.getCode(), QueryDeptTreeListCodeEnum.DEPT_LIST_IS_NULL.getMsg());
return JsonResult.success(deptTreeVoList);
}

List<DeptTreeVo> deptTreeVoListTmp = DeptConverMapper.INSTANCE.deptListToDeptVoList(deptList);

+ 20
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/flightdata/query/QueryFindFlightDataService.java Dosyayı Görüntüle

@@ -1,8 +1,14 @@
package com.tuoheng.admin.service.flightdata.query;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.FlightData;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionInfoByIdCodeEnum;
import com.tuoheng.admin.mapper.FlightDataMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@@ -21,6 +27,9 @@ import java.util.List;
@Slf4j
public class QueryFindFlightDataService {

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private FlightDataMapper flightDataMapper;

@@ -28,6 +37,17 @@ public class QueryFindFlightDataService {
if (StringUtils.isEmpty(id)) {
return JsonResult.error(QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getCode(), QueryInspectionInfoByIdCodeEnum.INSPECTION_ID_IS_NULL.getMsg());
}
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getId, id)
.eq(Inspection::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(inspection)) {
log.info("没有该任务记录, id={}", id);
throw new ServiceException("没有该任务记录");
}
if (2 == inspection.getType() && StringUtils.isNotEmpty(inspection.getEmergencyDataInspectionId())) {
id = inspection.getEmergencyDataInspectionId();
}

//根据任务id查询对应的云盒遥测数据
List<FlightData> listData = flightDataMapper.selectListByInspectionId(id);


+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/delete/DeleteInspectionService.java Dosyayı Görüntüle

@@ -6,7 +6,7 @@ import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspection.DeleteInspectionCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.CurrentUserUtil;
@@ -160,14 +160,14 @@ public class DeleteInspectionService {
.eq(User::getTenantId, tenantId)
.eq(User::getId, userId)
.eq(User::getMark, 1));
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return JsonResult.success();
} else if (RoleEnum.ADMIN.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
if (user.getDeptId().equals(inspection.getDeptId())) {
return JsonResult.success();
}
return JsonResult.error(DeleteInspectionCodeEnum.ADMIN_NOT_DELETE_CHILD_INSPECTION.getCode(), DeleteInspectionCodeEnum.ADMIN_NOT_DELETE_CHILD_INSPECTION.getMsg());
} else if (RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
return JsonResult.error(DeleteInspectionCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_DELETE.getCode(), DeleteInspectionCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_DELETE.getMsg());
}
return JsonResult.error();

+ 5
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryInspectionPageListService.java Dosyayı Görüntüle

@@ -7,7 +7,7 @@ import com.tuoheng.admin.conver.InspectionConverMapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
@@ -99,7 +99,6 @@ public class QueryInspectionPageListService {

public JsonResult getPageList(QueryInspectionPageListRequest request) {
// log.info("进入查询巡检任务分页列表业务");

String userId = CurrentUserUtil.getUserId();
String tenantId = CurrentUserUtil.getTenantId();
request.setTenantId(tenantId);
@@ -124,17 +123,17 @@ public class QueryInspectionPageListService {
.eq(Dept::getMark, 1));

IPage<Inspection> pageData = null;
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
pageData = this.getAllList(request);
} else if (RoleEnum.ADMIN.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
pageData = this.getListByDept(request, user);
} else if (RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
pageData = this.getListByDept(request, user);
}

if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务分页列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
return JsonResult.success(pageData);
}

// 构造返回结果对象

+ 5
- 5
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/QueryNewInspectionListService.java Dosyayı Görüntüle

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionListServiceEnum;
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
@@ -53,11 +53,11 @@ public class QueryNewInspectionListService {
}

//判断用户角色 1超级管理员 2部门管理员 3普通用户
if (null == user.getRoleId()) {
if (null == user.getDataPermission()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//若角色为超级管理员,查询任务表最新五条数据
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
List<Inspection> inspectionList = inspectionMapper.selectList(Wrappers.<Inspection>lambdaQuery()
.eq(Inspection::getTenantId, tenantId)
.eq(Inspection::getMark, MarkEnum.VALID.getCode())
@@ -66,14 +66,14 @@ public class QueryNewInspectionListService {
if (CollectionUtil.isEmpty(inspectionList)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
Stream<InspectionListVo> inspections = this.getInspectionListVoStream(inspectionList);
return JsonResult.success(inspections);
}
}

//若角色为部门管理员或普通用户,查询最新五条数据
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
String deptId = user.getDeptId();
if (StringUtils.isEmpty(deptId)) {
JsonResult.error(QueryInspectionListServiceEnum.DEPT_ID_IS_NULL.getCode(), QueryInspectionListServiceEnum.DEPT_ID_IS_NULL.getMsg());

+ 1
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/EditHandle.java Dosyayı Görüntüle

@@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.*;
import com.tuoheng.admin.enums.code.inspection.EditInspectionCodeEnum;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.vo.inspection.InspectionVo;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -73,7 +71,7 @@ public class EditHandle implements GenerateInspectionFieldHander {
// 查询部门管理员,若是部门管理员可修改,非部门管理员不能修改
User userTmp = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getDeptId, user.getDeptId())
.eq(User::getRoleId, RoleEnum.ADMIN.getCode())
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode())
.eq(User::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(userTmp)) {
if (null != handler) {

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/query/handle/ExecuteHandle.java Dosyayı Görüntüle

@@ -4,7 +4,7 @@ import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.InspectionTypeEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.vo.inspection.InspectionVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -45,17 +45,17 @@ public class ExecuteHandle implements GenerateInspectionFieldHander {
return;
}

if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
// 超级管理员不能执行任务操作
inspectionVo.setExecute(false);
} else if (RoleEnum.ADMIN.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
// 管理员可对本部门的任务执行此操作
if (user.getDeptId().equals(inspectionVo.getDeptId())) {
if (1 == inspectionVo.getExecutionStatus()) {
inspectionVo.setExecute(true);
}
}
} else if (RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
// 普通用户可对自己创建的任务执行此操作
if (user.getId().equals(inspectionVo.getCreateUser())) {
inspectionVo.setExecute(true);

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspection/update/UpdateInspectionService.java Dosyayı Görüntüle

@@ -11,7 +11,7 @@ import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.InspectionExecutionStatusEnum;
import com.tuoheng.admin.enums.InspectionStatusEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspection.EditInspectionCodeEnum;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.RoadInformationMapper;
@@ -173,7 +173,7 @@ public class UpdateInspectionService {
// 查询部门管理员,若是部门管理员可修改,非部门管理员不能修改
User userTmp = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getDeptId, user.getDeptId())
.eq(User::getRoleId, RoleEnum.ADMIN.getCode())
.eq(User::getRoleId, DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode())
.eq(User::getMark, MarkEnum.VALID.getCode()));
if (ObjectUtil.isNull(userTmp)) {
return JsonResult.error(EditInspectionCodeEnum.NON_DEPT_ADMIN_NOT_EDIT.getCode(), EditInspectionCodeEnum.NON_DEPT_ADMIN_NOT_EDIT.getMsg());

+ 7
- 10
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/InspectionFileServiceImpl.java Dosyayı Görüntüle

@@ -3,19 +3,17 @@ package com.tuoheng.admin.service.inspectionfile;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.QuestionType;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum;
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.*;
import com.tuoheng.admin.service.inspectionfile.IInspectionFileService;
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService;
import com.tuoheng.admin.service.inspectionfile.handle.QueryInspectionFileHandleByInspectionFileIdService;
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService;
@@ -32,7 +30,6 @@ import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.enums.ServiceExceptionEnum;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.SecurityUserUtils;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@@ -109,14 +106,14 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
//获取当前登录人信息
User user = CurrentUserUtil.getUserInfo();
//获取用户角色
Integer roleId = user.getRoleId();
Integer roleId = user.getDataPermission();
if(roleId ==null){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//查询区域范范围问题
List<InspectionFile> inspectionFileLists = new ArrayList<>();
//超级管理员
if(RoleEnum.SUPER_ADMIN.getCode()==roleId){
if(DataPermissionEnum.ALL.getCode()==roleId){
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getMark, 1)
.eq(InspectionFile::getTenantId, tenantId));
@@ -133,7 +130,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
}
}
//部门管理员及普通用户 本部门的问题
if(RoleEnum.ADMIN.getCode()== user.getRoleId() || RoleEnum.ORDINARY_USER.getCode()== user.getRoleId()){
if(DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()== user.getDataPermission() || DataPermissionEnum.DEPT.getCode()== user.getDataPermission()){
//根据用户查询对应的巡检任务id
List<Inspection> inspectionList = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>()
.eq(Inspection::getTenantId, tenantId)
@@ -194,7 +191,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
public JsonResult getListByDeptUserType(InspectionFileQuery query) {
User user = CurrentUserUtil.getUserInfo();
//用户角色判断 1超级管理员 2部门管理员 3普通用户
if(null == user.getRoleId()){
if(null == user.getDataPermission()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
List<ListByDeptUserTypeVo> list = new ArrayList<>();
@@ -218,7 +215,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
//5块状裂纹
Integer massiveCrack = 0;
//若角色为超级管理员,查看状态为已生成工单和和问题已处理
if(RoleEnum.SUPER_ADMIN.getCode()==user.getRoleId()){
if(DataPermissionEnum.ALL.getCode()==user.getDataPermission()){
//直接查问题列表
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery()
.eq(InspectionFile::getMark, 1)
@@ -275,7 +272,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
Collections.addAll(list,vo,vo1,vo2,vo3,vo4,vo5);
}
//若角色为部门管理员或普通用户
if(RoleEnum.ADMIN.getCode()== user.getRoleId() || RoleEnum.ORDINARY_USER.getCode()== user.getRoleId()){
if(DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()== user.getDataPermission() || DataPermissionEnum.DEPT.getCode()== user.getDataPermission()){
//获取用户对应的部门
String deptId = user.getDeptId();
if(StringUtils.isEmpty(deptId)){

+ 3
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java Dosyayı Görüntüle

@@ -3,7 +3,7 @@ package com.tuoheng.admin.service.inspectionfile.query;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.conver.InspectionFileConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
@@ -70,7 +70,7 @@ public class QueryInspectionFileDistributionListService {
List<InspectionFileDistribution> inspectionFileDistributionList = inspectionFileMapper.selectDistributionList(request);
if (null == inspectionFileDistributionList || inspectionFileDistributionList.size() == 0) {
log.info("获取任务问题分布列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
return JsonResult.success(inspectionFileDistributionList, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
}

// 构造返回结果对象
@@ -104,7 +104,7 @@ public class QueryInspectionFileDistributionListService {
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getId, userId)
.eq(User::getMark, 1));
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListByWorkOrderIdService.java Dosyayı Görüntüle

@@ -76,7 +76,7 @@ public class QueryInspectionFilePageListByWorkOrderIdService {

if (null == pageData || pageData.getTotal() == 0) {
log.info("根据工单ID查询工单问题列表业务:获取任务分页列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
return JsonResult.success(pageData, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
}

List<WorkOrderFile> workOrderFileList = pageData.getRecords();

+ 2
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java Dosyayı Görüntüle

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.InspectionFileConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
@@ -124,7 +124,7 @@ public class QueryInspectionFilePageListService {
.eq(User::getId, userId)
.eq(User::getTenantId, tenantId)
.eq(User::getMark, 1));
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());

+ 5
- 9
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/road/RoadInformationServiceImpl.java Dosyayı Görüntüle

@@ -7,10 +7,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.query.RoadInformationQuery;
import com.tuoheng.admin.service.road.RoadInformationService;
import com.tuoheng.admin.service.road.query.QueryRoadListByDeptIdService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.common.BaseServiceImpl;
@@ -166,13 +165,10 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM
public JsonResult getListByUserType() {
//获取当前登录人信息 登录用户名
User user = CurrentUserUtil.getUserInfo();
if(null == user){
return JsonResult.error("用户不存在");
}
//获取租户id
String tenantId = user.getTenantId();
//用户类型角色判断 1超级管理员 2 部门管理员 3普通用户
if(null == user.getRoleId()){
if(null == user.getDataPermission()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//登录用户若为部门管理员或普通用户需要查询所在部门
@@ -180,11 +176,11 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM
//获取公路列表
List<RoadInformation> roadInformationList = new ArrayList<>();
//超级管理员
if(RoleEnum.SUPER_ADMIN.getCode()== user.getRoleId()){
if(DataPermissionEnum.ALL.getCode()== user.getDataPermission()){
roadInformationList = this.getAllRoadInformationList(tenantId);
}
//部门管理员
if(RoleEnum.ADMIN.getCode() == user.getRoleId()){
if(DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()){
//根据当前用户对应的部门id获取该部门及子部门的id集合
List<String> deptIdList = deptMapper.selectAllChildListById(deptId);
if(CollectionUtil.isEmpty(deptIdList)){
@@ -194,7 +190,7 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM
roadInformationList = this.getRoadInformationList(tenantId, list);
}
//普通用户
if(RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()){
if(DataPermissionEnum.DEPT.getCode() == user.getDataPermission()){
List<RoadDept> roadDeptList = roadDeptMapper.selectList(new LambdaQueryWrapper<RoadDept>()
.eq(RoadDept::getTenantId, tenantId)
.eq(RoadDept::getDeptId, deptId));

+ 6
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java Dosyayı Görüntüle

@@ -13,7 +13,7 @@ import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.entity.SectionDept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.SectionEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.RoadInformationMapper;
@@ -88,7 +88,7 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
String tenantId = user.getTenantId();
IPage<Section> pageData = new Page<>(query.getPage(), query.getLimit());
//数据权限 超级管理员可以查看全部路段
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
//获取分页数据
IPage<Section> page = new Page<>(query.getPage(), query.getLimit());
pageData = sectionMapper.selectPage(page, Wrappers.<Section>lambdaQuery()
@@ -114,7 +114,7 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
pageData.setRecords(list);
}
//部门管理员和普通用户 查看本部门及下属部门
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
//获取分页数据
IPage<Section> page = new Page<>(query.getPage(), query.getLimit());
//获取当前部门及其子部门列表
@@ -287,7 +287,7 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
}
String tenantId = CurrentUserUtil.getTenantId();
//超级管理员获取当前租户下全部公路,部门管理员和普通用户显示用户所属部门监管范围路段之和
if(null == user.getRoleId()){
if(null == user.getDataPermission()){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//登录用户若为部门管理员或普通用户需要查询所在部门
@@ -296,13 +296,13 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
List<RoadInformation> roadInformationList = new ArrayList<>();

//超级管理员
if(RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()){
if(DataPermissionEnum.ALL.getCode() == user.getDataPermission()){
roadInformationList = this.getAllRoadInformationList(tenantId);
return JsonResult.success(roadInformationList);
}

//部门管理员和普通用户
if(RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()){
if(DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()){
//对应部门下的路段列表
List<SectionDept> sectionDeptList = sectionDeptMapper.selectList(new LambdaQueryWrapper<SectionDept>()
.eq(SectionDept::getDeptId, deptId).eq(SectionDept::getTenantId, tenantId));

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/structure/StructureServiceImpl.java Dosyayı Görüntüle

@@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.SectionEnum;
import com.tuoheng.admin.enums.StructureEnum;
import com.tuoheng.admin.mapper.*;
@@ -70,11 +70,11 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc
query.setTenantId(tenantId);

//获取用户角色
Integer roleId = user.getRoleId();
Integer roleId = user.getDataPermission();
IPage<Structure> page = new Page<>(query.getPage(), query.getLimit());
IPage<StructureInfoVo> pageData = null;
//如果是超级管理员,查看所有构造物
if (RoleEnum.SUPER_ADMIN.getCode() == roleId) {
if (DataPermissionEnum.ALL.getCode() == roleId) {
//数据分页
pageData = structureMapper.queryPage(page, query);
List<StructureInfoVo> list = pageData.getRecords().stream().map((item) -> {
@@ -102,7 +102,7 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc

}
//如果是部门管理员或普通用户,查询本部门及子部门包含的路段及路段对应的构造物
if (RoleEnum.ADMIN.getCode() == roleId || RoleEnum.ORDINARY_USER.getCode() == roleId) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == roleId || DataPermissionEnum.DEPT.getCode() == roleId) {
String deptId = user.getDeptId();
if (StringUtils.isEmpty(deptId)) {
return JsonResult.error(StructureEnum.DEPT_IS_NOT_EXIST.getCode(), StructureEnum.DEPT_IS_NOT_EXIST.getMsg());

+ 1
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/airport/ExecuteTaskService.java Dosyayı Görüntüle

@@ -39,6 +39,7 @@ public class ExecuteTaskService {
JSONObject jsonObject = new JSONObject();
jsonObject.put("taskId", inspection.getInspectionLine());
jsonObject.put("requestId", inspection.getId());
jsonObject.put("requestName", inspection.getName());
jsonObject.put("code", "gs"); // 与机场平台约定好的
jsonObject.put("tenantCode", tenant.getCode());


+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/StartAIService.java Dosyayı Görüntüle

@@ -34,7 +34,8 @@ public class StartAIService {
* @return
*/
public JsonResult startAI(MissionStatusRequest missionStatusRequest) {
log.info("进入调用DSP接口方法");
log.info("进入调用DSP接口方法, missionStatusRequest={}", missionStatusRequest.getId());
log.info("进入调用DSP接口方法, dspServiceInstId={}", dspServiceInstId);
JSONObject request = new JSONObject();
JSONArray configList = new JSONArray();
JSONObject instConfigMode = new JSONObject();

+ 2
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/oidc/AddOidcTenantService.java Dosyayı Görüntüle

@@ -3,29 +3,25 @@ package com.tuoheng.admin.service.third.oidc;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tuoheng.admin.constant.SystemConstant;
import com.tuoheng.admin.dto.ClientRoleDto;
import com.tuoheng.admin.entity.Role;
import com.tuoheng.admin.entity.Tenant;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.ClientEnum;
import com.tuoheng.admin.enums.MarkEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.mapper.RoleMapper;
import com.tuoheng.admin.mapper.TenantMapper;
import com.tuoheng.admin.mapper.UserMapper;
import com.tuoheng.admin.request.third.oidc.CreateOidcTenantRequest;
import com.tuoheng.admin.request.user.UserInitRequest;
import com.tuoheng.common.core.utils.CommonUtils;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

@Slf4j
@Service
@@ -110,7 +106,7 @@ public class AddOidcTenantService {
return JsonResult.error(400, "系统中已经存在该用户名");
}
count = roleMapper.selectCount(new LambdaQueryWrapper<Role>()
.eq(Role::getId, RoleEnum.SUPER_ADMIN.getCode())
.eq(Role::getId, DataPermissionEnum.ALL.getCode())
.eq(Role::getMark, MarkEnum.VALID.getCode()));
if (count <= 0) {
return JsonResult.error(400, "角色不存在");

+ 4
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/add/AddUserService.java Dosyayı Görüntüle

@@ -88,6 +88,9 @@ public class AddUserService {
if (ObjectUtil.isNull(user.getRoleId()) || 0 == user.getRoleId()) {
return JsonResult.error(AddUserCodeEnum.ROLE_ID_IS_NULL.getCode(), AddUserCodeEnum.ROLE_ID_IS_NULL.getMsg());
}
if (ObjectUtil.isNull(user.getDataPermission()) || 0 == user.getDataPermission()) {
return JsonResult.error(AddUserCodeEnum.DATA_PERMISSION_IS_NULL.getCode(), AddUserCodeEnum.DATA_PERMISSION_IS_NULL.getMsg());
}
if (StringUtils.isEmpty(user.getDeptId())) {
return JsonResult.error(AddUserCodeEnum.DEPT_ID_IS_NULL.getCode(), AddUserCodeEnum.DEPT_ID_IS_NULL.getMsg());
}
@@ -107,7 +110,7 @@ public class AddUserService {
return JsonResult.error(AddUserCodeEnum.USERNAME_ALREADY_EXISTS.getCode(), AddUserCodeEnum.USERNAME_ALREADY_EXISTS.getMsg());
}
count = roleMapper.selectCount(new LambdaQueryWrapper<Role>()
.eq(Role::getId, user.getRoleId())
.eq(Role::getId, user.getDataPermission())
.eq(Role::getMark, 1));
if (count < 0) {
return JsonResult.error(AddUserCodeEnum.ROLE_IS_NOT_EXISTS.getCode(), AddUserCodeEnum.ROLE_IS_NOT_EXISTS.getMsg());

+ 2
- 3
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserListByDeptIdService.java Dosyayı Görüntüle

@@ -4,8 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.user.QueryUserListByDeptIdCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.UserMapper;
@@ -51,7 +50,7 @@ public class QueryUserListByDeptIdService {
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>()
.eq(User::getTenantId, tenantId)
.eq(User::getDeptId, deptId)
.ne(User::getRoleId, RoleEnum.SUPER_ADMIN.getCode())
.ne(User::getRoleId, DataPermissionEnum.ALL.getCode())
.eq(User::getMark, 1));

if (CollectionUtil.isEmpty(userList)) {

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/query/QueryUserPageListService.java Dosyayı Görüntüle

@@ -7,7 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.UserConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.user.QueryUserPageListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.RoleMapper;
@@ -71,7 +71,7 @@ public class QueryUserPageListService {

if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务分页列表为空");
return JsonResult.success();
return JsonResult.success(pageData);
}

// 构造返回结果对象
@@ -95,7 +95,7 @@ public class QueryUserPageListService {
* @return
*/
private JsonResult check(User user) {
if (RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
return JsonResult.error(QueryUserPageListCodeEnum.ORDINARY_USERS_NO_PERMISSION.getCode(), QueryUserPageListCodeEnum.ORDINARY_USERS_NO_PERMISSION.getMsg());
}
return JsonResult.success();
@@ -112,7 +112,7 @@ public class QueryUserPageListService {
*/
private List<String> getDeptIdList(User user) {
List<String> deptIdList;
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());

+ 4
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/user/update/UpdateUserService.java Dosyayı Görüntüle

@@ -85,6 +85,9 @@ public class UpdateUserService {
if (ObjectUtil.isNull(user.getRoleId()) || 0 == user.getRoleId()) {
return JsonResult.error(EditUserCodeEnum.ROLE_ID_IS_NULL.getCode(), EditUserCodeEnum.ROLE_ID_IS_NULL.getMsg());
}
if (ObjectUtil.isNull(user.getDataPermission()) || 0 == user.getDataPermission()) {
return JsonResult.error(EditUserCodeEnum.DATA_PERMISSION_IS_NULL.getCode(), EditUserCodeEnum.DATA_PERMISSION_IS_NULL.getMsg());
}
if (StringUtils.isEmpty(user.getClientId())) {
return JsonResult.error(EditUserCodeEnum.CLIENT_ID_IS_NULL.getCode(), EditUserCodeEnum.CLIENT_ID_IS_NULL.getMsg());
}
@@ -102,7 +105,7 @@ public class UpdateUserService {
}
Integer count = roleMapper.selectCount(new LambdaQueryWrapper<Role>()
.eq(Role::getTenantId, tenantId)
.eq(Role::getId, user.getRoleId())
.eq(Role::getId, user.getDataPermission())
.eq(Role::getMark, 1));
if (count <= 0) {
// return JsonResult.error(EditUserCodeEnum.ROLE_IS_NOT_EXISTS.getCode(), EditUserCodeEnum.ROLE_IS_NOT_EXISTS.getMsg());

+ 7
- 15
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/distribution/DistributionWorkorderService.java Dosyayı Görüntüle

@@ -3,7 +3,7 @@ package com.tuoheng.admin.service.workorder.distribution;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.User;
import com.tuoheng.admin.entity.WorkOrder;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.WorkOrderStatusEnum;
import com.tuoheng.admin.enums.code.workorder.DistributionWorkorderCodeEnum;
import com.tuoheng.admin.enums.code.workorder.GenerateWorkorderCodeEnum;
@@ -50,18 +50,8 @@ public class DistributionWorkorderService {
log.info("进入分配工单业务:校验失败:{}", result.getMsg());
return result;
}
WorkOrder workOrder = (WorkOrder) result.getData();

User user = CurrentUserUtil.getUserInfo();
String userId = user.getId();
String tenantId = user.getTenantId();

// 检查权限
result = checkPermission(userId, tenantId, workOrder);
if (0 != result.getCode()) {
log.info("进入分配工单:校验权限失败:{}", result.getMsg());
return result;
}
result = this.distributionWorkOrder(userId, request);
if (0 != result.getCode()) {
log.info("进入分配工单:分配工单失败:{}", result.getMsg());
@@ -107,6 +97,8 @@ public class DistributionWorkorderService {
* 2)、部门管理员仅可分配本部门工单,无法分配子部门工单
* 3)、普通用户不能分配工单
*
* 2023-05-11 角色权限功能改造为子定义,去除该检验
*
* @param userId
* @param workOrder
* @return
@@ -116,14 +108,14 @@ public class DistributionWorkorderService {
.eq(User::getId, userId)
.eq(User::getTenantId, tenantId)
.eq(User::getMark, 1));
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
return JsonResult.error(DistributionWorkorderCodeEnum.SUPER_ADMIN_NOT_DISTRIBUTION.getCode(), DistributionWorkorderCodeEnum.SUPER_ADMIN_NOT_DISTRIBUTION.getMsg());
} else if (RoleEnum.ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return JsonResult.error(DistributionWorkorderCodeEnum.ALL_NOT_DISTRIBUTION.getCode(), DistributionWorkorderCodeEnum.ALL_NOT_DISTRIBUTION.getMsg());
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
if (!user.getDeptId().equals(workOrder.getDeptId())) {
return JsonResult.error(DistributionWorkorderCodeEnum.ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER.getCode(), DistributionWorkorderCodeEnum.ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER.getMsg());
}
return JsonResult.success(user);
} else if (RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
return JsonResult.error(DistributionWorkorderCodeEnum.ORDINARY_USER_NOT_DISTRIBUTION.getCode(), DistributionWorkorderCodeEnum.ORDINARY_USER_NOT_DISTRIBUTION.getMsg());
}
return JsonResult.error();

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/generate/GenerateWorkorderService.java Dosyayı Görüntüle

@@ -4,7 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.InspectionFileStatusEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.WorkOrderStatusEnum;
import com.tuoheng.admin.enums.code.workorder.GenerateWorkorderCodeEnum;
import com.tuoheng.admin.mapper.*;
@@ -126,16 +126,16 @@ public class GenerateWorkorderService {
* @return
*/
private JsonResult checkPermission(User user, List<Inspection> inspectionList) {
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return JsonResult.success(user);
} else if (RoleEnum.ADMIN.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission()) {
for (Inspection inspection : inspectionList) {
if (!user.getDeptId().equals(inspection.getDeptId())) {
return JsonResult.error(GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getCode(), GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getMsg());
}
}
return JsonResult.success(user);
} else if (RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
} else if (DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
return JsonResult.error(GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getCode(), GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getMsg());
}
return JsonResult.error();

+ 4
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/workorder/query/QueryWorkOrderPageListService.java Dosyayı Görüntüle

@@ -8,7 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.WorkOrderConverMapper;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.InspectionFileStatusEnum;
import com.tuoheng.admin.enums.RoleEnum;
import com.tuoheng.admin.enums.DataPermissionEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest;
@@ -60,7 +60,7 @@ public class QueryWorkOrderPageListService {
return result;
}
User user = CurrentUserUtil.getUserInfo();
if (RoleEnum.SUPER_ADMIN.getCode() != user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() != user.getDataPermission()) {
request.setUserDeptId(user.getDeptId());
}
String tenantId = user.getTenantId();
@@ -75,7 +75,7 @@ public class QueryWorkOrderPageListService {
IPage<WorkOrder> pageData = workOrderMapper.selectPageList(page, request);
if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务分页列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
return JsonResult.success(pageData, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
}

// 构造返回结果对象
@@ -119,7 +119,7 @@ public class QueryWorkOrderPageListService {
deptIdList.add(deptId);
return deptIdList;
}
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
return null;
} else {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());

+ 5
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/user/UserInfoVo.java Dosyayı Görüntüle

@@ -204,4 +204,9 @@ public class UserInfoVo {
*/
private String clientId;

/**
* 数据权限:1:查看所有部门数据;2:查看本部门及子部门;3:查看本部门数据;
*/
private Integer dataPermission;

}

+ 4
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/user/UserPageListVo.java Dosyayı Görüntüle

@@ -202,4 +202,8 @@ public class UserPageListVo {
*/
private String clientId;

/**
* 数据权限:1:查看所有部门数据;2:查看本部门及子部门;3:查看本部门数据;
*/
private Integer dataPermission;
}

+ 6
- 4
tuoheng-service/tuoheng-admin/src/main/resources/mapper/UserMapper.xml Dosyayı Görüntüle

@@ -22,6 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="streetCode" column="street_code" />
<result property="address" column="address" />
<result property="cityName" column="city_name" />
<result property="dataPermission" column="data_permission" />
<result property="username" column="username" />
<result property="password" column="password" />
<result property="driverType" column="driver_type" />
@@ -44,11 +45,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>

<sql id="selectUserVo">
id, tenant_id, code, realname, nickname, gender, avatar, mobile, email, birthday, dept_id, province_code, city_code, district_code, street_code, address, city_name, username, password, driver_type, driver_code, salt, intro, status, note, sort, login_num, login_ip, login_time, create_user, create_time, update_user, update_time, role_id, client_id, mark
id, tenant_id, code, realname, nickname, gender, avatar, mobile, email, birthday, dept_id, province_code, city_code, district_code, street_code, address, city_name, data_permission,
username, password, driver_type, driver_code, salt, intro, status, note, sort, login_num, login_ip, login_time, create_user, create_time, update_user, update_time, role_id, client_id, mark
</sql>

<update id="updateByIdList" parameterType="hashmap">
update th_oauth_user
update th_user
<trim prefix="SET" suffixOverrides=",">
<if test="mark != null"> mark = #{mark}, </if>
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if>
@@ -65,7 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>

<update id="updateDeptIdByIdList" parameterType="hashmap">
update th_oauth_user
update th_user
<trim prefix="SET" suffixOverrides=",">
<if test="deptId != null"> dept_id = #{deptId}, </if>
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if>
@@ -83,7 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"

<select id="selectPageList" parameterType="com.tuoheng.admin.request.user.QueryUserPageListRequest" resultMap="UserResult">
select <include refid="selectUserVo"/>
from th_oauth_user
from th_user
<where>
<if test="1 == 1"> and mark = 1 and role_id != 1 </if>
<if test="request.tenantId != null and request.tenantId != ''"> and tenant_id = #{request.tenantId} </if>

+ 4
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/User.java Dosyayı Görüntüle

@@ -229,4 +229,8 @@ public class User implements Serializable {
*/
private Integer roleId;

/**
* 数据权限:1:查看所有部门数据;2:查看本部门及子部门;3:查看本部门数据;
*/
private Integer dataPermission;
}

+ 5
- 5
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/DataPermissionEnum.java Dosyayı Görüntüle

@@ -9,13 +9,13 @@ import lombok.Getter;
* @team tuoheng
* @date 2022-11-25
*/
public enum RoleEnum {
public enum DataPermissionEnum {

ALL(1,"超级管理员"),
ADMIN(2,"管理员"),
ORDINARY_USER(3,"普通用户");
ALL(1,"查看所有部门数据"),
DEPT_AND_SUB_DEPT(2,"查看本部门及子部门数据"),
DEPT(3,"查看本部门数据");

RoleEnum(int code, String description){
DataPermissionEnum(int code, String description){
this.code = code;
this.description = description;
}

+ 4
- 4
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileServiceImpl.java Dosyayı Görüntüle

@@ -21,7 +21,7 @@ import com.tuoheng.miniprogram.entity.*;
import com.tuoheng.miniprogram.entity.dto.QuestionIdentificationDto;
import com.tuoheng.miniprogram.entity.query.InspectionFileQuery;
import com.tuoheng.miniprogram.enums.InspectionFileEnum;
import com.tuoheng.miniprogram.enums.RoleEnum;
import com.tuoheng.miniprogram.enums.DataPermissionEnum;
import com.tuoheng.miniprogram.service.IInspectionFileService;
import com.tuoheng.miniprogram.utils.CurrentUserUtil;
import com.tuoheng.miniprogram.vo.InspectionFileCountVo;
@@ -365,7 +365,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
if (StringUtils.isEmpty(user.getId())) {
return JsonResult.error(InspectionFileEnum.USER_ID_IS_NULL.getCode(), InspectionFileEnum.USER_ID_IS_NULL.getMsg());
}
if (null == user.getRoleId()) {
if (null == user.getDataPermission()) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//获取当前租户id
@@ -380,7 +380,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
DateTime startTime = DateUtil.offset(DateUtil.beginOfDay(DateUtil.date()), DateField.DAY_OF_WEEK, -4);
List<InspectionFileCountVo> result = new ArrayList<>();
//判断角色 1超级管理员 2部门管理员 3普通用户
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) {
if (DataPermissionEnum.ALL.getCode() == user.getDataPermission()) {
try {
List<String> list = findDates(startTime, endTime);
for (String s : list) {
@@ -397,7 +397,7 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
e.printStackTrace();
}
}
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
try {
List<String> list = findDates(startTime, endTime);
for (String s : list) {

+ 4
- 4
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionServiceImpl.java Dosyayı Görüntüle

@@ -12,7 +12,7 @@ import com.tuoheng.common.core.utils.*;
import com.tuoheng.miniprogram.dao.*;
import com.tuoheng.miniprogram.entity.*;
import com.tuoheng.miniprogram.entity.query.InspectionQuery;
import com.tuoheng.miniprogram.enums.RoleEnum;
import com.tuoheng.miniprogram.enums.DataPermissionEnum;
import com.tuoheng.miniprogram.service.IInspectionService;
import com.tuoheng.miniprogram.utils.CurrentUserUtil;
import com.tuoheng.miniprogram.vo.*;
@@ -90,13 +90,13 @@ public class InspectionServiceImpl implements IInspectionService {
}
query.setStartTimeDate(startTime);
query.setEndTimeDate(endTime);
Integer type = user.getRoleId();
Integer type = user.getDataPermission();
if(null == type){
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
List<InspectionInfoVo> inspectionInfoVoList = new ArrayList<>();
//用户角色判断 1超级管理员 2部门管理员 3普通用户
if(RoleEnum.SUPER_ADMIN.getCode()==type){
if(DataPermissionEnum.ALL.getCode()==type){
IPage<InspectionInfoVo> IPageData = inspectionMapper.queryPage(page, query);
IPageData.getRecords().stream().forEach(x->{
//修改执行人属性
@@ -126,7 +126,7 @@ public class InspectionServiceImpl implements IInspectionService {

}
//登录用户角色为部门管理员或普通用户
if(RoleEnum.ADMIN.getCode()==type || RoleEnum.ORDINARY_USER.getCode()==type){
if(DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode()==type || DataPermissionEnum.DEPT.getCode()==type){
// 根据部门id获取此部门id和所有下级部门id封装list集合
List<String> deptLists = deptMapper.selectAllChildListById(query.getDeptId());
if (StringUtils.isEmpty(deptLists)){

+ 12
- 13
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java Dosyayı Görüntüle

@@ -1,7 +1,6 @@
package com.tuoheng.miniprogram.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
@@ -180,14 +179,14 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
query.setOrderStartTime(startTime);
query.setOrderEndTime(endTime);
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户
Integer type = user.getRoleId();
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
Integer type = user.getDataPermission();
if (DataPermissionEnum.ALL.getCode() == type) {

return JsonResult.success(null,"超级管理员代办工单不显示数据");
}

//用户角色为2部门管理员 3普通用户
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == type || DataPermissionEnum.DEPT.getCode() == type) {
String deptId = user.getDeptId();
if (StringUtils.isEmpty(deptId)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
@@ -386,7 +385,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
}
query.setTenantId(tenantId);
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户
Integer type = user.getRoleId();
Integer type = user.getDataPermission();
//获取分页数据
IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit());
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(), query.getLimit());
@@ -400,7 +399,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
query.setOrderStartTime(startTime);
query.setOrderEndTime(endTime);
//用户角色为2部门管理员 3普通用户
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
if (DataPermissionEnum.ALL.getCode() == type) {
//超级管理员可查看系统内所有已处理工单
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>()
.eq(WorkOrder::getStatus, 15)
@@ -442,7 +441,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return JsonResult.success(pageData);
}
//用户角色为2部门管理员 3普通用户
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == user.getDataPermission() || DataPermissionEnum.DEPT.getCode() == user.getDataPermission()) {
//获取部门
String deptId = user.getDeptId();
if (StringUtils.isEmpty(deptId)) {
@@ -637,7 +636,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
}
//用户角色
Integer type = user.getRoleId();
Integer type = user.getDataPermission();
if (null == type) {
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
}
@@ -650,7 +649,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return null;
}
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
if (DataPermissionEnum.ALL.getCode() == type) {
//获取当前登录用户(超级管理员)已完成工单列表
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getMark, 1)
@@ -662,7 +661,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
}
}
//部门管理员 普通用户
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == type || DataPermissionEnum.DEPT.getCode() == type) {
//获取部门id
if (StringUtils.isEmpty(user.getDeptId())) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());
@@ -718,7 +717,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg());
}
//用户角色
Integer type = user.getRoleId();
Integer type = user.getDataPermission();
if (null == type) {
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
}
@@ -738,7 +737,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return null;
}
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
if (DataPermissionEnum.ALL.getCode() == type) {
//获取当前登录用户(超级管理员)已完成工单列表
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getMark, 1)
@@ -750,7 +749,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
}
}
//部门管理员 普通用户
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) {
if (DataPermissionEnum.DEPT_AND_SUB_DEPT.getCode() == type || DataPermissionEnum.DEPT.getCode() == type) {
//获取部门id
if (StringUtils.isEmpty(user.getDeptId())) {
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg());

Yükleniyor…
İptal
Kaydet