|
|
@@ -182,81 +182,82 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户 |
|
|
|
Integer type = user.getRoleId(); |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getStatus, 10) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
.eq(WorkOrder::getMark, 1)); |
|
|
|
if (null == workPageData.getRecords()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<WorkOrderInfoVo> WorkOrderInfoList = new ArrayList<>(); |
|
|
|
//设置每条工单对应的各状态问题数量 |
|
|
|
List<WorkOrderInfoVo> workOrderList = workPageData.getRecords().stream().map(x -> { |
|
|
|
WorkOrderInfoVo vo = new WorkOrderInfoVo(); |
|
|
|
BeanUtils.copyProperties(x, vo); |
|
|
|
// vo.setCode(x.getCode()); |
|
|
|
// vo.setCreateTime(x.getCreateTime()); |
|
|
|
//被分配人员对应id |
|
|
|
String assignUser = x.getAssignUser(); |
|
|
|
String[] assignUserId = assignUser.split(","); |
|
|
|
if (StringUtils.isEmpty(assignUserId)) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
for (String userId : assignUserId) { |
|
|
|
User userInfo = userMapper.selectById(userId); |
|
|
|
if (ObjectUtil.isNotNull(userInfo)) { |
|
|
|
list.add(userInfo.getUsername()); |
|
|
|
} |
|
|
|
} |
|
|
|
String usernames = list.stream().map(String::valueOf).collect(Collectors.joining("、")); |
|
|
|
vo.setAssignUserName(usernames); |
|
|
|
//问题总数 |
|
|
|
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() |
|
|
|
.eq(WorkOrderFile::getWorkOrderId, x.getId())); |
|
|
|
if (CollectionUtil.isEmpty(workOrderFiles)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
vo.setPromTotal(workOrderFiles.size()); |
|
|
|
//对应的问题id集合 |
|
|
|
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); |
|
|
|
if (CollectionUtil.isEmpty(inspectionFiledIds)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//获取问题集合 |
|
|
|
List<InspectionFile> inspectionFileList = new ArrayList<>(); |
|
|
|
for (String inspectionFiledId : inspectionFiledIds) { |
|
|
|
InspectionFile inspectionFile = inspectionFileMapper.selectById(inspectionFiledId); |
|
|
|
inspectionFileList.add(inspectionFile); |
|
|
|
} |
|
|
|
//待处理问题总数 |
|
|
|
long count = inspectionFileList.stream().filter(t -> t.getStatus() == 20).count(); |
|
|
|
vo.setPromTodo((int) count); |
|
|
|
//已处理问题总数 |
|
|
|
long count1 = inspectionFileList.stream().filter(t -> t.getStatus() == 25).count(); |
|
|
|
vo.setPromProcessed((int) count1); |
|
|
|
|
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
//当待处理问题总数为0时,此工单不出现在代办工单列表并且工单状态修改为15已完成 |
|
|
|
List<WorkOrderInfoVo> collect = workOrderList.stream().filter(f -> f.getPromTodo() == 0).collect(Collectors.toList()); |
|
|
|
if (null != collect) { |
|
|
|
for (WorkOrderInfoVo workOrderInfoVo : collect) { |
|
|
|
//每一个工单对应的状态发生改变,一个工单id对应一个工单 |
|
|
|
WorkOrder workOrder = workOrderMapper.selectById(workOrderInfoVo.getId()); |
|
|
|
if (ObjectUtil.isNotNull(workOrder)) { |
|
|
|
workOrder.setStatus(15); |
|
|
|
workOrder.setUpdateTime(DateUtils.now()); |
|
|
|
workOrder.setUpdateUser(user.getId()); |
|
|
|
super.update(workOrder); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
//工单的待处理问题个数不为0时 重新返回 |
|
|
|
WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(WorkOrderInfoList); |
|
|
|
return JsonResult.success(pageData); |
|
|
|
// IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
// .eq(WorkOrder::getStatus, 10) |
|
|
|
// .eq(WorkOrder::getTenantId, tenantId) |
|
|
|
// .between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
// .eq(WorkOrder::getMark, 1)); |
|
|
|
// if (null == workPageData.getRecords()) { |
|
|
|
// return null; |
|
|
|
// } |
|
|
|
// List<WorkOrderInfoVo> WorkOrderInfoList = new ArrayList<>(); |
|
|
|
// //设置每条工单对应的各状态问题数量 |
|
|
|
// List<WorkOrderInfoVo> workOrderList = workPageData.getRecords().stream().map(x -> { |
|
|
|
// WorkOrderInfoVo vo = new WorkOrderInfoVo(); |
|
|
|
// BeanUtils.copyProperties(x, vo); |
|
|
|
//// vo.setCode(x.getCode()); |
|
|
|
//// vo.setCreateTime(x.getCreateTime()); |
|
|
|
// //被分配人员对应id |
|
|
|
// String assignUser = x.getAssignUser(); |
|
|
|
// String[] assignUserId = assignUser.split(","); |
|
|
|
// if (StringUtils.isEmpty(assignUserId)) { |
|
|
|
// return null; |
|
|
|
// } |
|
|
|
// List<String> list = new ArrayList<>(); |
|
|
|
// for (String userId : assignUserId) { |
|
|
|
// User userInfo = userMapper.selectById(userId); |
|
|
|
// if (ObjectUtil.isNotNull(userInfo)) { |
|
|
|
// list.add(userInfo.getUsername()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// String usernames = list.stream().map(String::valueOf).collect(Collectors.joining("、")); |
|
|
|
// vo.setAssignUserName(usernames); |
|
|
|
// //问题总数 |
|
|
|
// List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() |
|
|
|
// .eq(WorkOrderFile::getWorkOrderId, x.getId())); |
|
|
|
// if (CollectionUtil.isEmpty(workOrderFiles)) { |
|
|
|
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
// } |
|
|
|
// vo.setPromTotal(workOrderFiles.size()); |
|
|
|
// //对应的问题id集合 |
|
|
|
// List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); |
|
|
|
// if (CollectionUtil.isEmpty(inspectionFiledIds)) { |
|
|
|
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
// } |
|
|
|
// //获取问题集合 |
|
|
|
// List<InspectionFile> inspectionFileList = new ArrayList<>(); |
|
|
|
// for (String inspectionFiledId : inspectionFiledIds) { |
|
|
|
// InspectionFile inspectionFile = inspectionFileMapper.selectById(inspectionFiledId); |
|
|
|
// inspectionFileList.add(inspectionFile); |
|
|
|
// } |
|
|
|
// //待处理问题总数 |
|
|
|
// long count = inspectionFileList.stream().filter(t -> t.getStatus() == 20).count(); |
|
|
|
// vo.setPromTodo((int) count); |
|
|
|
// //已处理问题总数 |
|
|
|
// long count1 = inspectionFileList.stream().filter(t -> t.getStatus() == 25).count(); |
|
|
|
// vo.setPromProcessed((int) count1); |
|
|
|
// |
|
|
|
// return vo; |
|
|
|
// }).collect(Collectors.toList()); |
|
|
|
// //当待处理问题总数为0时,此工单不出现在代办工单列表并且工单状态修改为15已完成 |
|
|
|
// List<WorkOrderInfoVo> collect = workOrderList.stream().filter(f -> f.getPromTodo() == 0).collect(Collectors.toList()); |
|
|
|
// if (null != collect) { |
|
|
|
// for (WorkOrderInfoVo workOrderInfoVo : collect) { |
|
|
|
// //每一个工单对应的状态发生改变,一个工单id对应一个工单 |
|
|
|
// WorkOrder workOrder = workOrderMapper.selectById(workOrderInfoVo.getId()); |
|
|
|
// if (ObjectUtil.isNotNull(workOrder)) { |
|
|
|
// workOrder.setStatus(15); |
|
|
|
// workOrder.setUpdateTime(DateUtils.now()); |
|
|
|
// workOrder.setUpdateUser(user.getId()); |
|
|
|
// super.update(workOrder); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// } |
|
|
|
// //工单的待处理问题个数不为0时 重新返回 |
|
|
|
// WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList()); |
|
|
|
// pageData.setRecords(WorkOrderInfoList); |
|
|
|
// return JsonResult.success(pageData); |
|
|
|
return JsonResult.success(null,"超级管理员代办工单不显示数据"); |
|
|
|
} |
|
|
|
|
|
|
|
//用户角色为2部门管理员 3普通用户 |
|
|
@@ -469,45 +470,44 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
query.setOrderEndTime(endTime); |
|
|
|
//用户角色为2部门管理员 3普通用户 |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
// //超级管理员可查看系统内所有已处理工单 |
|
|
|
// IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>() |
|
|
|
// .eq(WorkOrder::getStatus, 15) |
|
|
|
// .eq(WorkOrder::getTenantId, tenantId) |
|
|
|
// .between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
// .eq(WorkOrder::getMark, 1)); |
|
|
|
// //设置每条工单对应的已完成问题数量 问题状态为25问题已处理 |
|
|
|
// List<WorkOrderInfoVo> collect = workPageData.getRecords().stream().map(s -> { |
|
|
|
// WorkOrderInfoVo vo = new WorkOrderInfoVo(); |
|
|
|
// BeanUtils.copyProperties(s, vo); |
|
|
|
// //被分配人员对应的id |
|
|
|
// String assignUser = s.getAssignUser(); |
|
|
|
// if (StringUtils.isEmpty(assignUser)) { |
|
|
|
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
// } |
|
|
|
// String[] assignUserId = assignUser.split(","); |
|
|
|
// List<String> list = new ArrayList<>(); |
|
|
|
// for (String userId : assignUserId) { |
|
|
|
// User userInfo = userMapper.selectById(userId); |
|
|
|
// if (ObjectUtil.isNotNull(userInfo)) { |
|
|
|
// list.add(userInfo.getUsername()); |
|
|
|
// } |
|
|
|
// } |
|
|
|
// String usernames = list.stream().map(String::valueOf).collect(Collectors.joining("、")); |
|
|
|
// vo.setAssignUserName(usernames); |
|
|
|
// //问题总数 |
|
|
|
// List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() |
|
|
|
// .eq(WorkOrderFile::getWorkOrderId, s.getId())); |
|
|
|
// if (null == workOrderFiles) { |
|
|
|
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
// } |
|
|
|
// vo.setPromTotal(workOrderFiles.size()); |
|
|
|
// //已解决问题=问题总数 |
|
|
|
// vo.setPromProcessed(workOrderFiles.size()); |
|
|
|
// return vo; |
|
|
|
// }).collect(Collectors.toList()); |
|
|
|
// pageData.setRecords(collect); |
|
|
|
// |
|
|
|
return JsonResult.success(null,"超级管理员代办工单不显示数据"); |
|
|
|
//超级管理员可查看系统内所有已处理工单 |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>() |
|
|
|
.eq(WorkOrder::getStatus, 15) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
.eq(WorkOrder::getMark, 1)); |
|
|
|
//设置每条工单对应的已完成问题数量 问题状态为25问题已处理 |
|
|
|
List<WorkOrderInfoVo> collect = workPageData.getRecords().stream().map(s -> { |
|
|
|
WorkOrderInfoVo vo = new WorkOrderInfoVo(); |
|
|
|
BeanUtils.copyProperties(s, vo); |
|
|
|
//被分配人员对应的id |
|
|
|
String assignUser = s.getAssignUser(); |
|
|
|
if (StringUtils.isEmpty(assignUser)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
String[] assignUserId = assignUser.split(","); |
|
|
|
List<String> list = new ArrayList<>(); |
|
|
|
for (String userId : assignUserId) { |
|
|
|
User userInfo = userMapper.selectById(userId); |
|
|
|
if (ObjectUtil.isNotNull(userInfo)) { |
|
|
|
list.add(userInfo.getUsername()); |
|
|
|
} |
|
|
|
} |
|
|
|
String usernames = list.stream().map(String::valueOf).collect(Collectors.joining("、")); |
|
|
|
vo.setAssignUserName(usernames); |
|
|
|
//问题总数 |
|
|
|
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() |
|
|
|
.eq(WorkOrderFile::getWorkOrderId, s.getId())); |
|
|
|
if (null == workOrderFiles) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
vo.setPromTotal(workOrderFiles.size()); |
|
|
|
//已解决问题=问题总数 |
|
|
|
vo.setPromProcessed(workOrderFiles.size()); |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(collect); |
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
//用户角色为2部门管理员 3普通用户 |
|
|
|
if (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { |