@@ -87,6 +87,4 @@ public class RoadInformationController { | |||
return roadInformationService.deleteByIds(ids); | |||
} | |||
} |
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -34,7 +35,8 @@ public class QueryChildListService { | |||
*/ | |||
public JsonResult getChildList(String deptId) { | |||
log.info("进入查询子部门列表业务"); | |||
JsonResult result = this.check(deptId); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(tenantId, deptId); | |||
if (0 != result.getCode()) { | |||
log.info("根据id查询子部门列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
@@ -51,10 +53,12 @@ public class QueryChildListService { | |||
/** | |||
* 检查参数 | |||
* | |||
* @param tenantId | |||
* @param id | |||
* | |||
* @return | |||
*/ | |||
private JsonResult check(String id) { | |||
private JsonResult check(String tenantId, String id) { | |||
// 判断id是否为空 | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | |||
@@ -62,6 +66,7 @@ public class QueryChildListService { | |||
// 判断部门是否存在 | |||
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>() | |||
.eq(Dept::getTenantId, tenantId) | |||
.eq(Dept::getId, id) | |||
.eq(Dept::getMark, 1)); | |||
if (count <= 0) { |
@@ -2,6 +2,7 @@ package com.tuoheng.admin.service.dept.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.constant.SystemConstant; | |||
import com.tuoheng.admin.conver.DeptConverMapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.enums.code.dept.QueryDeptTreeListCodeEnum; | |||
@@ -60,7 +61,7 @@ public class QueryListTreeService { | |||
} | |||
for (DeptTreeVo deptTreeVo : deptTreeVoListTmp) { | |||
DeptTreeVo child = deptTreeVo; | |||
if ("0".equals(child.getPid())) { | |||
if (SystemConstant.ROOT_DEPT_PID.equals(child.getPid())) { | |||
deptTreeVoList.add(deptTreeVo); | |||
} else { | |||
DeptTreeVo parent = deptVoMap.get(child.getPid()); |
@@ -10,6 +10,7 @@ import com.tuoheng.admin.enums.code.inspection.QueryInspectionListServiceEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.SecurityUserUtils; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
@@ -57,11 +58,11 @@ public class QueryInspectionListService { | |||
} | |||
List<Inspection> inspections = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>() | |||
.eq(Inspection::getMark, 1) | |||
.eq(Inspection::getTenantId, CurrentUserUtil.getTenantId()) | |||
.eq(Inspection::getDeptId, deptId) | |||
.eq(Inspection::getAirportId, dto.getAirportId()) | |||
.in(Inspection::getStatus, 10, 15) | |||
.orderByDesc(Inspection::getCreateTime)); | |||
return JsonResult.success(inspections); | |||
} | |||
} |
@@ -11,11 +11,11 @@ import com.tuoheng.admin.enums.code.inspection.QueryInspectionListServiceEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.inspection.InspectionListVo; | |||
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; | |||
@@ -42,14 +42,7 @@ public class QueryNewInspectionListService { | |||
public JsonResult getList() { | |||
//获取登录用户信息 | |||
String username = SecurityUserUtils.username(); | |||
if (StringUtils.isEmpty(username)) { | |||
JsonResult.error(ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getCode(), ListByDeptUserTypeEnum.USER_NAME_IS_NULL.getMsg()); | |||
} | |||
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() | |||
.eq(User::getUsername, username) | |||
.eq(User::getStatus, 1) | |||
.eq(User::getMark, 1)); | |||
User user = CurrentUserUtil.getUserInfo(); | |||
if (ObjectUtil.isNull(user)) { | |||
JsonResult.error(ListByDeptUserTypeEnum.USER_IS_NULL.getCode(), ListByDeptUserTypeEnum.USER_IS_NULL.getMsg()); | |||
} | |||
@@ -74,13 +67,10 @@ public class QueryNewInspectionListService { | |||
} | |||
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { | |||
Stream<InspectionListVo> inspections = this.getInspectionListVoStream(inspectionList); | |||
return JsonResult.success(inspections); | |||
} | |||
} | |||
//若角色为部门管理员或普通用户,查询最新五条数据 | |||
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { | |||
String deptId = user.getDeptId(); | |||
@@ -97,11 +87,8 @@ public class QueryNewInspectionListService { | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
Stream<InspectionListVo> inspectionListVoStream = this.getInspectionListVoStream(inspectionList); | |||
return JsonResult.success(inspectionListVoStream); | |||
} | |||
return JsonResult.error(); | |||
} | |||
@@ -111,11 +98,10 @@ public class QueryNewInspectionListService { | |||
BeanUtils.copyProperties(x, vo); | |||
//修改执行人属性为realname | |||
User user = userMapper.selectById(x.getCreateUser()); | |||
if(ObjectUtil.isNotNull(user)){ | |||
if (ObjectUtil.isNotNull(user)) { | |||
vo.setCreateUser(user.getRealname()); | |||
} | |||
return vo; | |||
}); | |||
} | |||
} |
@@ -1,10 +1,7 @@ | |||
package com.tuoheng.admin.service.inspectionfile.processing; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileHandle; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.entity.WorkOrderFile; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.WorkOrderStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfilehandle.InspectionFileProcessingCodeEnum; | |||
@@ -49,8 +46,9 @@ public class InspectionFileProcessingService { | |||
public JsonResult processing(InspectionFileProcessingRresultRequest request) { | |||
log.info("进入任务问题处理业务:inspectionFileId:{}", request.getInspectionFileId()); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
User user = CurrentUserUtil.getUserInfo(); | |||
String userId = user.getId(); | |||
String tenantId = user.getTenantId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { |
@@ -73,7 +73,6 @@ public class QueryInspectionFilePageListByInspectionIdService { | |||
inspectionFilePageListVoPageData.setRecords(inspectionFilePageListVoList); | |||
return JsonResult.success(inspectionFilePageListVoPageData); | |||
} | |||
/** | |||
@@ -109,9 +108,6 @@ public class QueryInspectionFilePageListByInspectionIdService { | |||
private List<InspectionFilePageListByInspectionIdVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) { | |||
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() | |||
.eq(QuestionType::getMark, 1)); | |||
Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity())); | |||
List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(inspectionFileList); | |||
for (InspectionFilePageListByInspectionIdVo inspectionFilePageListVo : inspectionFilePageListVoList) { | |||
@@ -50,9 +50,9 @@ public class QueryReportPageListService { | |||
*/ | |||
public JsonResult getPageList(QueryReportPageListRequest request) { | |||
// log.info("进入查询报告分页列表业务"); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
User user = CurrentUserUtil.getUserInfo(); | |||
String userId = user.getId(); | |||
String tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(tenantId, request); |
@@ -141,10 +141,6 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM | |||
@Override | |||
public JsonResult getListByUserType() { | |||
//获取当前登录人信息 登录用户名 | |||
String userId = CurrentUserUtil.getUserId(); | |||
if(StringUtils.isEmpty(userId)){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
User user = CurrentUserUtil.getUserInfo(); | |||
if(null == user){ | |||
return JsonResult.error("用户不存在"); | |||
@@ -183,7 +179,6 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM | |||
} | |||
roadInformationList =this.getRoadInformationList(tenantId,roadDeptList); | |||
} | |||
return JsonResult.success(roadInformationList); | |||
} | |||
@@ -82,7 +82,7 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section> | |||
if (ObjectUtil.isNull(user)) { | |||
return JsonResult.error(SectionEnum.USER_IS_NOT_EXIST.getCode(), SectionEnum.USER_IS_NOT_EXIST.getMsg()); | |||
} | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
String tenantId = user.getTenantId(); | |||
IPage<Section> pageData = new Page<>(query.getPage(), query.getLimit()); | |||
//数据权限 超级管理员可以查看全部路段 | |||
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) { |
@@ -45,8 +45,6 @@ public class DistributionWorkorderService { | |||
@Transactional | |||
public JsonResult distribution(DistributionWorkorderRequest request) { | |||
log.info("进入分配工单业务, request:{}", request); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入分配工单业务:校验失败:{}", result.getMsg()); | |||
@@ -54,19 +52,21 @@ public class DistributionWorkorderService { | |||
} | |||
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()); | |||
return result; | |||
} | |||
return JsonResult.success(); | |||
} | |||
@@ -54,25 +54,17 @@ public class QueryWorkOrderPageListService { | |||
public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | |||
log.info("进入查询工单分页列表业务, request:{}", request.toString()); | |||
String userId = CurrentUserUtil.getUserId(); | |||
String tenantId = CurrentUserUtil.getTenantId(); | |||
request.setTenantId(tenantId); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询工单分页列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 用户能看到被指派到自己部门的工单 | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
User user = CurrentUserUtil.getUserInfo(); | |||
if (RoleEnum.SUPER_ADMIN.getCode() != user.getRoleId()) { | |||
request.setUserDeptId(user.getDeptId()); | |||
} | |||
String tenantId = user.getTenantId(); | |||
request.setTenantId(tenantId); | |||
// 获取部门Id的查询范围 | |||
List<String> deptIdList = this.getDeptIdList(user, request.getDeptId()); | |||
request.setDeptIdList(deptIdList); | |||
@@ -98,7 +90,6 @@ public class QueryWorkOrderPageListService { | |||
workOrderPageListVoPageData.setRecords(workOrderPageListVoList); | |||
return JsonResult.success(workOrderPageListVoPageData); | |||
} | |||
/** |