return roadInformationService.deleteByIds(ids); | return roadInformationService.deleteByIds(ids); | ||||
} | } | ||||
} | } |
import com.tuoheng.admin.entity.Dept; | import com.tuoheng.admin.entity.Dept; | ||||
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum; | import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum; | ||||
import com.tuoheng.admin.mapper.DeptMapper; | 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.JsonResult; | ||||
import com.tuoheng.common.core.utils.StringUtils; | import com.tuoheng.common.core.utils.StringUtils; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
*/ | */ | ||||
public JsonResult getChildList(String deptId) { | public JsonResult getChildList(String deptId) { | ||||
log.info("进入查询子部门列表业务"); | log.info("进入查询子部门列表业务"); | ||||
JsonResult result = this.check(deptId); | |||||
String tenantId = CurrentUserUtil.getTenantId(); | |||||
JsonResult result = this.check(tenantId, deptId); | |||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("根据id查询子部门列表业务:校验失败:{}", result.getMsg()); | log.info("根据id查询子部门列表业务:校验失败:{}", result.getMsg()); | ||||
return result; | return result; | ||||
/** | /** | ||||
* 检查参数 | * 检查参数 | ||||
* | * | ||||
* @param tenantId | |||||
* @param id | * @param id | ||||
* | |||||
* @return | * @return | ||||
*/ | */ | ||||
private JsonResult check(String id) { | |||||
private JsonResult check(String tenantId, String id) { | |||||
// 判断id是否为空 | // 判断id是否为空 | ||||
if (StringUtils.isEmpty(id)) { | if (StringUtils.isEmpty(id)) { | ||||
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | ||||
// 判断部门是否存在 | // 判断部门是否存在 | ||||
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>() | Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>() | ||||
.eq(Dept::getTenantId, tenantId) | |||||
.eq(Dept::getId, id) | .eq(Dept::getId, id) | ||||
.eq(Dept::getMark, 1)); | .eq(Dept::getMark, 1)); | ||||
if (count <= 0) { | if (count <= 0) { |
import cn.hutool.core.collection.CollectionUtil; | import cn.hutool.core.collection.CollectionUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.constant.SystemConstant; | |||||
import com.tuoheng.admin.conver.DeptConverMapper; | import com.tuoheng.admin.conver.DeptConverMapper; | ||||
import com.tuoheng.admin.entity.Dept; | import com.tuoheng.admin.entity.Dept; | ||||
import com.tuoheng.admin.enums.code.dept.QueryDeptTreeListCodeEnum; | import com.tuoheng.admin.enums.code.dept.QueryDeptTreeListCodeEnum; | ||||
} | } | ||||
for (DeptTreeVo deptTreeVo : deptTreeVoListTmp) { | for (DeptTreeVo deptTreeVo : deptTreeVoListTmp) { | ||||
DeptTreeVo child = deptTreeVo; | DeptTreeVo child = deptTreeVo; | ||||
if ("0".equals(child.getPid())) { | |||||
if (SystemConstant.ROOT_DEPT_PID.equals(child.getPid())) { | |||||
deptTreeVoList.add(deptTreeVo); | deptTreeVoList.add(deptTreeVo); | ||||
} else { | } else { | ||||
DeptTreeVo parent = deptVoMap.get(child.getPid()); | DeptTreeVo parent = deptVoMap.get(child.getPid()); |
import com.tuoheng.admin.mapper.InspectionFileMapper; | import com.tuoheng.admin.mapper.InspectionFileMapper; | ||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.mapper.UserMapper; | 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.JsonResult; | ||||
import com.tuoheng.common.core.utils.SecurityUserUtils; | import com.tuoheng.common.core.utils.SecurityUserUtils; | ||||
import com.tuoheng.common.core.utils.StringUtils; | import com.tuoheng.common.core.utils.StringUtils; | ||||
} | } | ||||
List<Inspection> inspections = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>() | List<Inspection> inspections = inspectionMapper.selectList(new LambdaQueryWrapper<Inspection>() | ||||
.eq(Inspection::getMark, 1) | .eq(Inspection::getMark, 1) | ||||
.eq(Inspection::getTenantId, CurrentUserUtil.getTenantId()) | |||||
.eq(Inspection::getDeptId, deptId) | .eq(Inspection::getDeptId, deptId) | ||||
.eq(Inspection::getAirportId, dto.getAirportId()) | .eq(Inspection::getAirportId, dto.getAirportId()) | ||||
.in(Inspection::getStatus, 10, 15) | .in(Inspection::getStatus, 10, 15) | ||||
.orderByDesc(Inspection::getCreateTime)); | .orderByDesc(Inspection::getCreateTime)); | ||||
return JsonResult.success(inspections); | return JsonResult.success(inspections); | ||||
} | } | ||||
} | } |
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum; | import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum; | ||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.mapper.UserMapper; | import com.tuoheng.admin.mapper.UserMapper; | ||||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||||
import com.tuoheng.admin.vo.inspection.InspectionListVo; | import com.tuoheng.admin.vo.inspection.InspectionListVo; | ||||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | import com.tuoheng.common.core.enums.ServiceExceptionEnum; | ||||
import com.tuoheng.common.core.exception.ServiceException; | import com.tuoheng.common.core.exception.ServiceException; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import com.tuoheng.common.core.utils.SecurityUserUtils; | |||||
import com.tuoheng.common.core.utils.StringUtils; | import com.tuoheng.common.core.utils.StringUtils; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||
public JsonResult getList() { | 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)) { | if (ObjectUtil.isNull(user)) { | ||||
JsonResult.error(ListByDeptUserTypeEnum.USER_IS_NULL.getCode(), ListByDeptUserTypeEnum.USER_IS_NULL.getMsg()); | JsonResult.error(ListByDeptUserTypeEnum.USER_IS_NULL.getCode(), ListByDeptUserTypeEnum.USER_IS_NULL.getMsg()); | ||||
} | } | ||||
} | } | ||||
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { | if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { | ||||
Stream<InspectionListVo> inspections = this.getInspectionListVoStream(inspectionList); | Stream<InspectionListVo> inspections = this.getInspectionListVoStream(inspectionList); | ||||
return JsonResult.success(inspections); | return JsonResult.success(inspections); | ||||
} | } | ||||
} | } | ||||
//若角色为部门管理员或普通用户,查询最新五条数据 | //若角色为部门管理员或普通用户,查询最新五条数据 | ||||
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { | if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { | ||||
String deptId = user.getDeptId(); | String deptId = user.getDeptId(); | ||||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | ||||
} | } | ||||
Stream<InspectionListVo> inspectionListVoStream = this.getInspectionListVoStream(inspectionList); | Stream<InspectionListVo> inspectionListVoStream = this.getInspectionListVoStream(inspectionList); | ||||
return JsonResult.success(inspectionListVoStream); | return JsonResult.success(inspectionListVoStream); | ||||
} | } | ||||
return JsonResult.error(); | return JsonResult.error(); | ||||
} | } | ||||
BeanUtils.copyProperties(x, vo); | BeanUtils.copyProperties(x, vo); | ||||
//修改执行人属性为realname | //修改执行人属性为realname | ||||
User user = userMapper.selectById(x.getCreateUser()); | User user = userMapper.selectById(x.getCreateUser()); | ||||
if(ObjectUtil.isNotNull(user)){ | |||||
if (ObjectUtil.isNotNull(user)) { | |||||
vo.setCreateUser(user.getRealname()); | vo.setCreateUser(user.getRealname()); | ||||
} | } | ||||
return vo; | return vo; | ||||
}); | }); | ||||
} | } | ||||
} | } |
package com.tuoheng.admin.service.inspectionfile.processing; | package com.tuoheng.admin.service.inspectionfile.processing; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 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.InspectionFileStatusEnum; | ||||
import com.tuoheng.admin.enums.WorkOrderStatusEnum; | import com.tuoheng.admin.enums.WorkOrderStatusEnum; | ||||
import com.tuoheng.admin.enums.code.inspectionfilehandle.InspectionFileProcessingCodeEnum; | import com.tuoheng.admin.enums.code.inspectionfilehandle.InspectionFileProcessingCodeEnum; | ||||
public JsonResult processing(InspectionFileProcessingRresultRequest request) { | public JsonResult processing(InspectionFileProcessingRresultRequest request) { | ||||
log.info("进入任务问题处理业务:inspectionFileId:{}", request.getInspectionFileId()); | 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); | JsonResult result = this.check(request); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { |
inspectionFilePageListVoPageData.setRecords(inspectionFilePageListVoList); | inspectionFilePageListVoPageData.setRecords(inspectionFilePageListVoList); | ||||
return JsonResult.success(inspectionFilePageListVoPageData); | return JsonResult.success(inspectionFilePageListVoPageData); | ||||
} | } | ||||
/** | /** | ||||
private List<InspectionFilePageListByInspectionIdVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) { | private List<InspectionFilePageListByInspectionIdVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) { | ||||
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() | List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() | ||||
.eq(QuestionType::getMark, 1)); | .eq(QuestionType::getMark, 1)); | ||||
Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity())); | |||||
List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(inspectionFileList); | List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(inspectionFileList); | ||||
for (InspectionFilePageListByInspectionIdVo inspectionFilePageListVo : inspectionFilePageListVoList) { | for (InspectionFilePageListByInspectionIdVo inspectionFilePageListVo : inspectionFilePageListVoList) { | ||||
*/ | */ | ||||
public JsonResult getPageList(QueryReportPageListRequest request) { | public JsonResult getPageList(QueryReportPageListRequest request) { | ||||
// log.info("进入查询报告分页列表业务"); | // 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); | request.setTenantId(tenantId); | ||||
JsonResult result = this.check(tenantId, request); | JsonResult result = this.check(tenantId, request); |
@Override | @Override | ||||
public JsonResult getListByUserType() { | public JsonResult getListByUserType() { | ||||
//获取当前登录人信息 登录用户名 | //获取当前登录人信息 登录用户名 | ||||
String userId = CurrentUserUtil.getUserId(); | |||||
if(StringUtils.isEmpty(userId)){ | |||||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||||
} | |||||
User user = CurrentUserUtil.getUserInfo(); | User user = CurrentUserUtil.getUserInfo(); | ||||
if(null == user){ | if(null == user){ | ||||
return JsonResult.error("用户不存在"); | return JsonResult.error("用户不存在"); | ||||
} | } | ||||
roadInformationList =this.getRoadInformationList(tenantId,roadDeptList); | roadInformationList =this.getRoadInformationList(tenantId,roadDeptList); | ||||
} | } | ||||
return JsonResult.success(roadInformationList); | return JsonResult.success(roadInformationList); | ||||
} | } | ||||
if (ObjectUtil.isNull(user)) { | if (ObjectUtil.isNull(user)) { | ||||
return JsonResult.error(SectionEnum.USER_IS_NOT_EXIST.getCode(), SectionEnum.USER_IS_NOT_EXIST.getMsg()); | 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()); | IPage<Section> pageData = new Page<>(query.getPage(), query.getLimit()); | ||||
//数据权限 超级管理员可以查看全部路段 | //数据权限 超级管理员可以查看全部路段 | ||||
if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) { | if (RoleEnum.SUPER_ADMIN.getCode() == user.getRoleId()) { |
@Transactional | @Transactional | ||||
public JsonResult distribution(DistributionWorkorderRequest request) { | public JsonResult distribution(DistributionWorkorderRequest request) { | ||||
log.info("进入分配工单业务, request:{}", request); | log.info("进入分配工单业务, request:{}", request); | ||||
String userId = CurrentUserUtil.getUserId(); | |||||
String tenantId = CurrentUserUtil.getTenantId(); | |||||
JsonResult result = this.check(request); | JsonResult result = this.check(request); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("进入分配工单业务:校验失败:{}", result.getMsg()); | log.info("进入分配工单业务:校验失败:{}", result.getMsg()); | ||||
} | } | ||||
WorkOrder workOrder = (WorkOrder) result.getData(); | WorkOrder workOrder = (WorkOrder) result.getData(); | ||||
User user = CurrentUserUtil.getUserInfo(); | |||||
String userId = user.getId(); | |||||
String tenantId = user.getTenantId(); | |||||
// 检查权限 | // 检查权限 | ||||
result = checkPermission(userId, tenantId, workOrder); | result = checkPermission(userId, tenantId, workOrder); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("进入分配工单:校验权限失败:{}", result.getMsg()); | log.info("进入分配工单:校验权限失败:{}", result.getMsg()); | ||||
return result; | return result; | ||||
} | } | ||||
result = this.distributionWorkOrder(userId, request); | result = this.distributionWorkOrder(userId, request); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("进入分配工单:分配工单失败:{}", result.getMsg()); | log.info("进入分配工单:分配工单失败:{}", result.getMsg()); | ||||
return result; | return result; | ||||
} | } | ||||
return JsonResult.success(); | return JsonResult.success(); | ||||
} | } | ||||
public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | ||||
log.info("进入查询工单分页列表业务, request:{}", request.toString()); | log.info("进入查询工单分页列表业务, request:{}", request.toString()); | ||||
String userId = CurrentUserUtil.getUserId(); | |||||
String tenantId = CurrentUserUtil.getTenantId(); | |||||
request.setTenantId(tenantId); | |||||
JsonResult result = this.check(request); | JsonResult result = this.check(request); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("进入查询工单分页列表业务:校验失败:{}", result.getMsg()); | log.info("进入查询工单分页列表业务:校验失败:{}", result.getMsg()); | ||||
return result; | 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()) { | if (RoleEnum.SUPER_ADMIN.getCode() != user.getRoleId()) { | ||||
request.setUserDeptId(user.getDeptId()); | request.setUserDeptId(user.getDeptId()); | ||||
} | } | ||||
String tenantId = user.getTenantId(); | |||||
request.setTenantId(tenantId); | |||||
// 获取部门Id的查询范围 | // 获取部门Id的查询范围 | ||||
List<String> deptIdList = this.getDeptIdList(user, request.getDeptId()); | List<String> deptIdList = this.getDeptIdList(user, request.getDeptId()); | ||||
request.setDeptIdList(deptIdList); | request.setDeptIdList(deptIdList); | ||||
workOrderPageListVoPageData.setRecords(workOrderPageListVoList); | workOrderPageListVoPageData.setRecords(workOrderPageListVoList); | ||||
return JsonResult.success(workOrderPageListVoPageData); | return JsonResult.success(workOrderPageListVoPageData); | ||||
} | } | ||||
/** | /** |