|
|
@@ -33,7 +33,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.text.ParseException; |
|
|
|
import java.util.*; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@@ -73,10 +76,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//登录用户信息 |
|
|
|
String tenantId = CurrentUserUtil.getTenantId(); |
|
|
|
dto.setTenantId(tenantId); |
|
|
|
if(StringUtils.isEmpty(dto.getTenantId())){ |
|
|
|
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(),WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(dto.getTenantId())) { |
|
|
|
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(StringUtils.isEmpty(dto.getInspectionFileId())) { |
|
|
|
if (StringUtils.isEmpty(dto.getInspectionFileId())) { |
|
|
|
return JsonResult.error(WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), WorkOrderEnum.INSPECTION_FILE_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
// if(StringUtils.isEmpty(dto.getUserId())){ |
|
|
@@ -85,18 +88,18 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//登录用户信息 |
|
|
|
User userInfo = CurrentUserUtil.getUserInfo(); |
|
|
|
String username = userInfo.getUsername(); |
|
|
|
if(StringUtils.isEmpty(username)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(username)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//根据用户id查询部门id |
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
.eq(User::getMark, 1).eq(User::getUsername,username)); |
|
|
|
if(ObjectUtil.isNull(user)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
.eq(User::getMark, 1).eq(User::getUsername, username)); |
|
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
String deptId = user.getDeptId(); |
|
|
|
if(StringUtils.isEmpty(deptId)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(deptId)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
WorkOrder workOrder = new WorkOrder(); |
|
|
|
workOrder.setTenantId(dto.getTenantId()); |
|
|
@@ -121,14 +124,14 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
workOrderFile.setInspectionFileId(dto.getInspectionFileId()); |
|
|
|
workOrderFile.setWorkOrderId(workOrder.getId()); |
|
|
|
int num = workOrderFileMapper.insert(workOrderFile); |
|
|
|
if(num<=0){ |
|
|
|
if (num <= 0) { |
|
|
|
return JsonResult.error(); |
|
|
|
} |
|
|
|
//更新问题状态为工单已生成 |
|
|
|
InspectionFile inspectionFile = inspectionFileMapper.selectById(dto.getInspectionFileId()); |
|
|
|
inspectionFile.setStatus(InspectionFileStatusEnum.GENERATE_ORDER.getCode()); |
|
|
|
int count = inspectionFileMapper.updateById(inspectionFile); |
|
|
|
if(count<=0){ |
|
|
|
if (count <= 0) { |
|
|
|
return JsonResult.error(); |
|
|
|
} |
|
|
|
|
|
|
@@ -137,63 +140,64 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
/** |
|
|
|
* 代办工单 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JsonResult getTodoList(WorkOrderQuery query) { |
|
|
|
if(query.getLimit()==null && query.getPage()==null){ |
|
|
|
if (query.getLimit() == null && query.getPage() == null) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//登录用户信息 |
|
|
|
User userInfo1 = CurrentUserUtil.getUserInfo(); |
|
|
|
String username = userInfo1.getUsername(); |
|
|
|
if(null ==username){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
if (null == username) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
.eq(User::getMark, 1) |
|
|
|
.eq(User::getUsername, username)); |
|
|
|
if(ObjectUtil.isNull(user)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
String tenantId = userInfo1.getTenantId(); |
|
|
|
if(null == tenantId){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
if (null == tenantId) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
query.setTenantId(tenantId); |
|
|
|
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户 |
|
|
|
Integer type = user.getRoleId(); |
|
|
|
if(RoleEnum.SUPER_ADMIN.getCode()==type){ |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
//获取分页数据 |
|
|
|
IPage<WorkOrder> page = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
//时间处理 |
|
|
|
Date startTime = null; |
|
|
|
Date endTime = null; |
|
|
|
if(StringUtils.isNotEmpty(query.getTime())){ |
|
|
|
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 00:00:00"); |
|
|
|
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 23:59:59"); |
|
|
|
if (StringUtils.isNotEmpty(query.getTime())) { |
|
|
|
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 00:00:00"); |
|
|
|
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 23:59:59"); |
|
|
|
} |
|
|
|
query.setOrderStartTime(startTime); |
|
|
|
query.setOrderEndTime(endTime); |
|
|
|
//用户角色为2部门管理员 3普通用户 |
|
|
|
if (RoleEnum.ADMIN.getCode()==type || RoleEnum.ORDINARY_USER.getCode()==type){ |
|
|
|
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) { |
|
|
|
String deptId = user.getDeptId(); |
|
|
|
if(StringUtils.isEmpty(deptId)){ |
|
|
|
if (StringUtils.isEmpty(deptId)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//获取当前分配人对应的工单分页数据 |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getAssignDeptId, deptId) |
|
|
|
.eq(WorkOrder::getStatus,10) |
|
|
|
.like(StringUtils.isNotEmpty(user.getId()),WorkOrder::getAssignUser,user.getId()) |
|
|
|
.eq(WorkOrder::getStatus, 10) |
|
|
|
.like(StringUtils.isNotEmpty(user.getId()), WorkOrder::getAssignUser, user.getId()) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.between(null !=query.getOrderStartTime() && null !=query.getOrderEndTime(),WorkOrder::getCreateTime,query.getOrderStartTime(),query.getOrderEndTime()) |
|
|
|
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
.eq(WorkOrder::getMark, 1)); |
|
|
|
if(null == workPageData.getRecords()){ |
|
|
|
if (null == workPageData.getRecords()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
List<WorkOrderInfoVo> WorkOrderInfoList = new ArrayList<>(); |
|
|
@@ -243,15 +247,15 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
long count1 = inspectionFileList.stream().filter(t -> t.getStatus() == 25).count(); |
|
|
|
vo.setPromProcessed((int) count1); |
|
|
|
|
|
|
|
return vo; |
|
|
|
return vo; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
//当待处理问题总数为0时,此工单不出现在代办工单列表并且工单状态修改为15已完成 |
|
|
|
List<WorkOrderInfoVo> collect = workOrderList.stream().filter(f -> f.getPromTodo() == 0).collect(Collectors.toList()); |
|
|
|
if(null != collect){ |
|
|
|
if (null != collect) { |
|
|
|
for (WorkOrderInfoVo workOrderInfoVo : collect) { |
|
|
|
//每一个工单对应的状态发生改变,一个工单id对应一个工单 |
|
|
|
WorkOrder workOrder = workOrderMapper.selectById(workOrderInfoVo.getId()); |
|
|
|
if(ObjectUtil.isNotNull(workOrder)){ |
|
|
|
if (ObjectUtil.isNotNull(workOrder)) { |
|
|
|
workOrder.setStatus(15); |
|
|
|
workOrder.setUpdateTime(DateUtils.now()); |
|
|
|
workOrder.setUpdateUser(user.getId()); |
|
|
@@ -260,35 +264,36 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
} |
|
|
|
} |
|
|
|
//工单的待处理问题个数不为0时 重新返回 |
|
|
|
WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList()); |
|
|
|
WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(WorkOrderInfoList); |
|
|
|
|
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 处理工单 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JsonResult handle(HandleQuery query) { |
|
|
|
if(StringUtils.isEmpty(query.getId())){ |
|
|
|
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(),WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(query.getId())) { |
|
|
|
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(), WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(null == query.getPage() && null == query.getLimit()){ |
|
|
|
if (null == query.getPage() && null == query.getLimit()) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//获取分页数据 |
|
|
|
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<InspectionFile> page = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
//根据工单id获取对应的问题集合 |
|
|
|
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() |
|
|
|
.eq(WorkOrderFile::getWorkOrderId, query.getId())); |
|
|
|
if(null == workOrderFiles){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
if (null == workOrderFiles) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//工单子表获取对应的问题集合id |
|
|
|
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); |
|
|
@@ -301,8 +306,11 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//工单id |
|
|
|
vo.setWorkOrderId(query.getId()); |
|
|
|
//缩略图处理 |
|
|
|
if(StringUtils.isNotEmpty(t.getFileThumbnail())){ |
|
|
|
vo.setFileThumbnail(CommonConfig.imageURL+t.getFileThumbnail()); |
|
|
|
if (StringUtils.isNotEmpty(t.getFileThumbnail())) { |
|
|
|
vo.setFileThumbnail(CommonConfig.imageURL + t.getFileThumbnail()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(t.getFileOriginal())) { |
|
|
|
vo.setFileOriginal(CommonConfig.imageURL + t.getFileOriginal()); |
|
|
|
} |
|
|
|
//任务名称 任务执行时间 道路位置编号 |
|
|
|
if (StringUtils.isEmpty(t.getInspectionId())) { |
|
|
@@ -340,6 +348,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
/** |
|
|
|
* 已完成工单 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
@@ -348,42 +357,42 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
// if(query.getOrderEndTime()==null && query.getOrderStartTime()==null){ |
|
|
|
// throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
// } |
|
|
|
if(query.getLimit()==null && query.getPage()==null){ |
|
|
|
if (query.getLimit() == null && query.getPage() == null) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//获取登录用户信息 |
|
|
|
User userInfo1 = CurrentUserUtil.getUserInfo(); |
|
|
|
String username = userInfo1.getUsername(); |
|
|
|
if(null ==username){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
if (null == username) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
.eq(User::getMark, 1) |
|
|
|
.eq(User::getUsername, username)); |
|
|
|
if(ObjectUtil.isNull(user)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
String tenantId = user.getTenantId(); |
|
|
|
if(null == tenantId){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
if (null == tenantId) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
query.setTenantId(tenantId); |
|
|
|
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户 |
|
|
|
Integer type = user.getRoleId(); |
|
|
|
//获取分页数据 |
|
|
|
IPage<WorkOrder> page = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
IPage<WorkOrderInfoVo> pageData = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
//时间处理 |
|
|
|
Date startTime = null; |
|
|
|
Date endTime = null; |
|
|
|
if(StringUtils.isNotEmpty(query.getTime())){ |
|
|
|
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 00:00:00"); |
|
|
|
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS,query.getTime()+" 23:59:59"); |
|
|
|
if (StringUtils.isNotEmpty(query.getTime())) { |
|
|
|
startTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 00:00:00"); |
|
|
|
endTime = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, query.getTime() + " 23:59:59"); |
|
|
|
} |
|
|
|
query.setOrderStartTime(startTime); |
|
|
|
query.setOrderEndTime(endTime); |
|
|
|
//用户角色为2部门管理员 3普通用户 |
|
|
|
if(RoleEnum.SUPER_ADMIN.getCode()==type){ |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
//超级管理员可查看系统内所有已处理工单 |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>() |
|
|
|
.eq(WorkOrder::getStatus, 15) |
|
|
@@ -425,10 +434,10 @@ 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 (RoleEnum.ADMIN.getCode() == user.getRoleId() || RoleEnum.ORDINARY_USER.getCode() == user.getRoleId()) { |
|
|
|
//获取部门 |
|
|
|
String deptId = user.getDeptId(); |
|
|
|
if(StringUtils.isEmpty(deptId)){ |
|
|
|
if (StringUtils.isEmpty(deptId)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//获取当前分配人对应的工单分页数据 |
|
|
@@ -473,30 +482,31 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
|
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 工单详情 |
|
|
|
* |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JsonResult details(HandleQuery query) { |
|
|
|
if(StringUtils.isEmpty(query.getId())){ |
|
|
|
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(),WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(query.getId())) { |
|
|
|
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(), WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(null == query.getPage() && null == query.getLimit()){ |
|
|
|
if (null == query.getPage() && null == query.getLimit()) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//获取分页数据 |
|
|
|
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<InspectionFile> page = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
//根据工单id获取对应的问题集合 |
|
|
|
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() |
|
|
|
.eq(WorkOrderFile::getWorkOrderId, query.getId())); |
|
|
|
if(null == workOrderFiles){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
if (null == workOrderFiles) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//工单子表获取对应的问题集合id |
|
|
|
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); |
|
|
@@ -507,7 +517,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
WorkOrderHandleVo covert = Convert.convert(WorkOrderHandleVo.class, p); |
|
|
|
//缩略图处理 |
|
|
|
if (StringUtils.isNotEmpty(p.getFileThumbnail())) { |
|
|
|
covert.setFileThumbnail(p.getFileThumbnail()); |
|
|
|
covert.setFileThumbnail(CommonConfig.imageURL + p.getFileThumbnail()); |
|
|
|
} |
|
|
|
if (StringUtils.isNotEmpty(p.getFileOriginal())) { |
|
|
|
covert.setFileOriginal(CommonConfig.imageURL + p.getFileThumbnail()); |
|
|
|
} |
|
|
|
//任务名称 任务执行时间 道路位置编号 |
|
|
|
if (StringUtils.isEmpty(p.getInspectionId())) { |
|
|
@@ -543,6 +556,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
/** |
|
|
|
* 统计近七天工单数量 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
@@ -550,59 +564,59 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//获取登录用户信息 |
|
|
|
User userInfo = CurrentUserUtil.getUserInfo(); |
|
|
|
String username = userInfo.getUsername(); |
|
|
|
if(StringUtils.isEmpty(username)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(username)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
.eq(User::getMark, 1) |
|
|
|
.eq(User::getUsername, username)); |
|
|
|
if(ObjectUtil.isNull(user)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
String tenantId = user.getTenantId(); |
|
|
|
if(StringUtils.isEmpty(tenantId)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(),WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(tenantId)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//用户角色 |
|
|
|
Integer type = user.getRoleId(); |
|
|
|
if(null == type){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
if (null == type) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
WorkOrderNumVo vo = new WorkOrderNumVo(); |
|
|
|
//今日 |
|
|
|
DateTime endTime = DateUtil.endOfDay(DateUtil.date()); |
|
|
|
//一周前的时间 |
|
|
|
DateTime startTime = DateUtil.offset(DateUtil.beginOfDay(DateUtil.date()), DateField.WEEK_OF_MONTH, -1); |
|
|
|
if(null == endTime || null == startTime){ |
|
|
|
if (null == endTime || null == startTime) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户 |
|
|
|
if(RoleEnum.SUPER_ADMIN.getCode() == type){ |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
//获取当前登录用户(超级管理员)已完成工单列表 |
|
|
|
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getMark, 1) |
|
|
|
.eq(WorkOrder::getTenantId,tenantId) |
|
|
|
.eq(WorkOrder::getStatus,15) |
|
|
|
.between(WorkOrder::getUpdateTime,startTime,endTime)); |
|
|
|
if(StringUtils.isNotEmpty(workOrders)){ |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.eq(WorkOrder::getStatus, 15) |
|
|
|
.between(WorkOrder::getUpdateTime, startTime, endTime)); |
|
|
|
if (StringUtils.isNotEmpty(workOrders)) { |
|
|
|
vo.setWeekWorkOrderFinishedSum(workOrders.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
//部门管理员 普通用户 |
|
|
|
if(RoleEnum.ADMIN.getCode() ==type || RoleEnum.ORDINARY_USER.getCode() == type){ |
|
|
|
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) { |
|
|
|
//获取部门id |
|
|
|
if(StringUtils.isEmpty(user.getDeptId())){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(user.getDeptId())) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//获取当前登录用户(被分配人员)的待处理工单列表 |
|
|
|
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getMark, 1) |
|
|
|
.like(WorkOrder::getAssignUser, user.getId()) |
|
|
|
.eq(WorkOrder::getStatus,10) |
|
|
|
.eq(WorkOrder::getTenantId,tenantId) |
|
|
|
.eq(WorkOrder::getDeptId,user.getDeptId()) |
|
|
|
.between(WorkOrder::getAssignTime,startTime,endTime)); |
|
|
|
if(StringUtils.isNotEmpty(workOrders)){ |
|
|
|
.eq(WorkOrder::getStatus, 10) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.eq(WorkOrder::getDeptId, user.getDeptId()) |
|
|
|
.between(WorkOrder::getAssignTime, startTime, endTime)); |
|
|
|
if (StringUtils.isNotEmpty(workOrders)) { |
|
|
|
vo.setWeekWorkOrderTodoSum(workOrders.size()); |
|
|
|
} |
|
|
|
//获取当前登录用户(被分配人员)的已完成工单列表 |
|
|
@@ -613,7 +627,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.eq(WorkOrder::getDeptId, user.getDeptId()) |
|
|
|
.between(WorkOrder::getUpdateTime, startTime, endTime)); |
|
|
|
if(StringUtils.isNotEmpty(result)){ |
|
|
|
if (StringUtils.isNotEmpty(result)) { |
|
|
|
vo.setWeekWorkOrderFinishedSum(result.size()); |
|
|
|
} |
|
|
|
} |
|
|
@@ -623,6 +637,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
|
|
|
|
/** |
|
|
|
* 统计上个月的工单数量 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
@@ -630,23 +645,23 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//获取登录用户信息 |
|
|
|
User userInfo = CurrentUserUtil.getUserInfo(); |
|
|
|
String username = userInfo.getUsername(); |
|
|
|
if(StringUtils.isEmpty(username)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(),WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(username)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_NAME_IS_NULL.getCode(), WorkOrderEnum.USER_NAME_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
.eq(User::getMark, 1) |
|
|
|
.eq(User::getUsername, username)); |
|
|
|
if(ObjectUtil.isNull(user)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(),WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
String tenantId = user.getTenantId(); |
|
|
|
if(StringUtils.isEmpty(tenantId)){ |
|
|
|
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(),WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(tenantId)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.TENANT_ID_IS_NULL.getCode(), WorkOrderEnum.TENANT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//用户角色 |
|
|
|
Integer type = user.getRoleId(); |
|
|
|
if(null == type){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
if (null == type) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
WorkOrderCountVo vo = new WorkOrderCountVo(); |
|
|
|
// 上月起始 |
|
|
@@ -660,36 +675,36 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
Calendar.DAY_OF_MONTH, lastMonthEndDateCal.getActualMaximum(Calendar.DAY_OF_MONTH)); |
|
|
|
DateTime beginTime = DateUtil.beginOfDay(lastMonthFirstDateCal.getTime()); |
|
|
|
DateTime endTime = DateUtil.endOfDay(lastMonthEndDateCal.getTime()); |
|
|
|
if(null == endTime || null == beginTime){ |
|
|
|
if (null == endTime || null == beginTime) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户 |
|
|
|
if(RoleEnum.SUPER_ADMIN.getCode() == type){ |
|
|
|
//获取当前登录用户(超级管理员)已完成工单列表 |
|
|
|
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getMark, 1) |
|
|
|
.eq(WorkOrder::getTenantId,tenantId) |
|
|
|
.eq(WorkOrder::getStatus,15) |
|
|
|
.between(WorkOrder::getUpdateTime,beginTime,endTime)); |
|
|
|
if(StringUtils.isNotEmpty(workOrders)){ |
|
|
|
vo.setMonthWorkOrderFinishedSum(workOrders.size()); |
|
|
|
} |
|
|
|
//根据用户角色判断 1超级管理员 2部门管理员 3普通用户 |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
//获取当前登录用户(超级管理员)已完成工单列表 |
|
|
|
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getMark, 1) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.eq(WorkOrder::getStatus, 15) |
|
|
|
.between(WorkOrder::getUpdateTime, beginTime, endTime)); |
|
|
|
if (StringUtils.isNotEmpty(workOrders)) { |
|
|
|
vo.setMonthWorkOrderFinishedSum(workOrders.size()); |
|
|
|
} |
|
|
|
} |
|
|
|
//部门管理员 普通用户 |
|
|
|
if(RoleEnum.ADMIN.getCode() ==type || RoleEnum.ORDINARY_USER.getCode() == type){ |
|
|
|
if (RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) { |
|
|
|
//获取部门id |
|
|
|
if(StringUtils.isEmpty(user.getDeptId())){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(),WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
if (StringUtils.isEmpty(user.getDeptId())) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//获取当前登录用户(被分配人员)的待处理工单列表 |
|
|
|
List<WorkOrder> workOrders = workOrderMapper.selectList(Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getMark, 1) |
|
|
|
.like(WorkOrder::getAssignUser, user.getId()) |
|
|
|
.eq(WorkOrder::getStatus,10) |
|
|
|
.eq(WorkOrder::getTenantId,tenantId) |
|
|
|
.eq(WorkOrder::getDeptId,user.getDeptId()) |
|
|
|
.between(WorkOrder::getAssignTime,beginTime,endTime)); |
|
|
|
if(StringUtils.isNotEmpty(workOrders)){ |
|
|
|
.eq(WorkOrder::getStatus, 10) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.eq(WorkOrder::getDeptId, user.getDeptId()) |
|
|
|
.between(WorkOrder::getAssignTime, beginTime, endTime)); |
|
|
|
if (StringUtils.isNotEmpty(workOrders)) { |
|
|
|
vo.setMonthWorkOrderTodoSum(workOrders.size()); |
|
|
|
} |
|
|
|
//获取当前登录用户(被分配人员)的已完成工单列表 |
|
|
@@ -700,7 +715,7 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.eq(WorkOrder::getDeptId, user.getDeptId()) |
|
|
|
.between(WorkOrder::getUpdateTime, beginTime, endTime)); |
|
|
|
if(StringUtils.isNotEmpty(result)){ |
|
|
|
if (StringUtils.isNotEmpty(result)) { |
|
|
|
vo.setMonthWorkOrderFinishedSum(result.size()); |
|
|
|
} |
|
|
|
} |