|
|
@@ -105,10 +105,10 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
String code = DateUtils.generateCode("XJGD"); |
|
|
|
workOrder.setCode(code); |
|
|
|
workOrder.setStatus(WorkOrderStatusEnum.STATUS_ALLOCATED.getCode()); |
|
|
|
workOrder.setAssignDeptId(deptId); |
|
|
|
workOrder.setAssignUser(user.getId()); |
|
|
|
workOrder.setAssignContact(user.getMobile()); |
|
|
|
workOrder.setAssignTime(DateUtils.now()); |
|
|
|
// workOrder.setAssignDeptId(deptId); |
|
|
|
// workOrder.setAssignUser(user.getId()); |
|
|
|
// workOrder.setAssignContact(user.getMobile()); |
|
|
|
// workOrder.setAssignTime(DateUtils.now()); |
|
|
|
workOrder.setCreateUser(user.getId()); |
|
|
|
workOrder.setCreateTime(DateUtils.now()); |
|
|
|
workOrder.setMark(1); |
|
|
@@ -145,18 +145,11 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
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()); |
|
|
|
} |
|
|
|
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery() |
|
|
|
.eq(User::getMark, MarkEnum.VALID.getCode()) |
|
|
|
.eq(User::getUsername, username)); |
|
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
|
if (ObjectUtil.isNull(user)) { |
|
|
|
return JsonResult.error(WorkOrderEnum.USER_IS_NOT_EXIST.getCode(), WorkOrderEnum.USER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
String tenantId = userInfo1.getTenantId(); |
|
|
|
String tenantId = user.getTenantId(); |
|
|
|
if (null == tenantId) { |
|
|
|
return JsonResult.error(WorkOrderEnum.DEPT_ID_IS_NULL.getCode(), WorkOrderEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
@@ -173,15 +166,116 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
} |
|
|
|
query.setOrderStartTime(startTime); |
|
|
|
query.setOrderEndTime(endTime); |
|
|
|
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户 |
|
|
|
Integer type = user.getDataPermission(); |
|
|
|
// if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
// |
|
|
|
// return JsonResult.success(null,"超级管理员代办工单不显示数据"); |
|
|
|
// } |
|
|
|
|
|
|
|
//用户角色为2部门管理员 3普通用户 |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type ||RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) { |
|
|
|
//查询分配我的待处理工单 |
|
|
|
List<WorkOrderInfoVo> workOrderVo = this.myWorkOrderList(user,query); |
|
|
|
List<WorkOrderInfoVo> list = new ArrayList<>(); |
|
|
|
//数据权限为1当前租户下的数据 |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
//查询当前租户下所有工单数据 |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getStatus, 5) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
.eq(WorkOrder::getMark, MarkEnum.VALID.getCode()) |
|
|
|
.orderByDesc(WorkOrder::getCreateTime)); |
|
|
|
if (null == workPageData.getRecords()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
List<WorkOrderInfoVo> getWorkOrderVo = this.getWorkOrderList(workPageData,user); |
|
|
|
if(CollectionUtil.isNotEmpty(workOrderVo) || workOrderVo.size() != 0){ |
|
|
|
list.addAll(workOrderVo); |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(getWorkOrderVo) || getWorkOrderVo.size() != 0){ |
|
|
|
list.addAll(getWorkOrderVo); |
|
|
|
} |
|
|
|
pageData.setRecords(list); |
|
|
|
|
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
|
|
|
|
//数据权限为2部门管理员查询本部门及子部门工单数据 |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
//根据部门id获取本部门及子部门列表 |
|
|
|
String deptId = user.getDeptId(); |
|
|
|
if(StringUtils.isEmpty(deptId)){ |
|
|
|
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(),QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
List<String> deptIdList = deptMapper.selectAllChildListById(deptId); |
|
|
|
if (CollectionUtil.isEmpty(deptIdList)) { |
|
|
|
log.info("获取部门列表为空"); |
|
|
|
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_LIST_IS_FAILED.getCode(), QueryDeptChildListCodeEnum.DEPT_LIST_IS_FAILED.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
//查询当前部门及子部门下所有工单数据 |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getStatus, 5) |
|
|
|
.in(WorkOrder::getDeptId,deptIdList) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
.eq(WorkOrder::getMark, MarkEnum.VALID.getCode()) |
|
|
|
.orderByDesc(WorkOrder::getCreateTime)); |
|
|
|
if (null == workPageData.getRecords()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
List<WorkOrderInfoVo> getWorkOrderVo = this.getWorkOrderList(workPageData,user); |
|
|
|
if(CollectionUtil.isNotEmpty(workOrderVo) || workOrderVo.size() != 0){ |
|
|
|
list.addAll(workOrderVo); |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(getWorkOrderVo) || getWorkOrderVo.size() != 0){ |
|
|
|
list.addAll(getWorkOrderVo); |
|
|
|
} |
|
|
|
pageData.setRecords(list); |
|
|
|
|
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
|
|
|
|
//数据权限为3普通用户查询本部门数据 |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type) { |
|
|
|
String deptId = user.getDeptId(); |
|
|
|
if(StringUtils.isEmpty(deptId)){ |
|
|
|
return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(),QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getStatus, 5) |
|
|
|
.eq(WorkOrder::getDeptId,deptId) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
.eq(WorkOrder::getMark, MarkEnum.VALID.getCode()) |
|
|
|
.orderByDesc(WorkOrder::getCreateTime)); |
|
|
|
if (null == workPageData.getRecords()) { |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
List<WorkOrderInfoVo> getWorkOrderVo = this.getWorkOrderList(workPageData,user); |
|
|
|
if(CollectionUtil.isNotEmpty(workOrderVo) || workOrderVo.size() != 0){ |
|
|
|
list.addAll(workOrderVo); |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(getWorkOrderVo) || getWorkOrderVo.size() != 0){ |
|
|
|
list.addAll(getWorkOrderVo); |
|
|
|
} |
|
|
|
pageData.setRecords(list); |
|
|
|
|
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
|
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 获取我的待处理工单数据 |
|
|
|
* @param user |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private List<WorkOrderInfoVo> myWorkOrderList(User user,WorkOrderQuery query) { |
|
|
|
Integer type = user.getDataPermission(); |
|
|
|
IPage<WorkOrder> page = new Page<>(query.getPage(), query.getLimit()); |
|
|
|
List<WorkOrderInfoVo> workOrderInfoList = new ArrayList<>(); |
|
|
|
if (RoleEnum.SUPER_ADMIN.getCode() == type || RoleEnum.ADMIN.getCode() == type || RoleEnum.ORDINARY_USER.getCode() == type) { |
|
|
|
String deptId = user.getDeptId(); |
|
|
|
if (StringUtils.isEmpty(deptId)) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
@@ -189,86 +283,95 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//获取当前分配人对应的工单分页数据 |
|
|
|
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery() |
|
|
|
.eq(WorkOrder::getAssignDeptId, deptId) |
|
|
|
.in(WorkOrder::getStatus, 5,10) |
|
|
|
.in(WorkOrder::getStatus,10) |
|
|
|
.like(StringUtils.isNotEmpty(user.getId()), WorkOrder::getAssignUser, user.getId()) |
|
|
|
.eq(WorkOrder::getTenantId, tenantId) |
|
|
|
.eq(WorkOrder::getTenantId, user.getTenantId()) |
|
|
|
.between(null != query.getOrderStartTime() && null != query.getOrderEndTime(), WorkOrder::getCreateTime, query.getOrderStartTime(), query.getOrderEndTime()) |
|
|
|
.eq(WorkOrder::getMark, MarkEnum.VALID.getCode()) |
|
|
|
.orderByDesc(WorkOrder::getCreateTime)); |
|
|
|
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.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.getRealname()); |
|
|
|
} |
|
|
|
} |
|
|
|
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); |
|
|
|
workOrderInfoList = this.getWorkOrderList(workPageData, user); |
|
|
|
} |
|
|
|
return workOrderInfoList; |
|
|
|
} |
|
|
|
|
|
|
|
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); |
|
|
|
} |
|
|
|
/** |
|
|
|
* vo数据封装 |
|
|
|
* @param workPageData |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private List<WorkOrderInfoVo> getWorkOrderList(IPage<WorkOrder> workPageData,User user) { |
|
|
|
|
|
|
|
List<WorkOrderInfoVo> WorkOrderInfoList = new ArrayList<>(); |
|
|
|
//设置每条工单对应的各状态问题数量 |
|
|
|
List<WorkOrderInfoVo> workOrderList = workPageData.getRecords().stream().map(x -> { |
|
|
|
WorkOrderInfoVo vo = new WorkOrderInfoVo(); |
|
|
|
BeanUtils.copyProperties(x, vo); |
|
|
|
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.getRealname()); |
|
|
|
} |
|
|
|
} |
|
|
|
//工单的待处理问题个数不为0时 重新返回 |
|
|
|
WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(WorkOrderInfoList); |
|
|
|
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 JsonResult.success(pageData); |
|
|
|
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); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
//工单的待处理问题个数不为0时 重新返回 |
|
|
|
WorkOrderInfoList = workOrderList.stream().filter(h -> h.getPromTodo() != 0).collect(Collectors.toList()); |
|
|
|
return WorkOrderInfoList; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 处理工单 |
|
|
|
* |
|
|
@@ -771,6 +874,75 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 分配工单 |
|
|
|
* @param request |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JsonResult distribution(DistributionWorkorderRequest request) { |
|
|
|
log.info("进入分配工单业务, request:{}", request); |
|
|
|
JsonResult jsonResult = this.disCheck(request); |
|
|
|
if (0 != jsonResult.getCode()) { |
|
|
|
log.info("进入分配工单业务:校验失败:{}", jsonResult.getMsg()); |
|
|
|
return jsonResult; |
|
|
|
} |
|
|
|
User user = CurrentUserUtil.getUserInfo(); |
|
|
|
String userId = user.getId(); |
|
|
|
jsonResult = this.distributionWorkOrder(userId, request); |
|
|
|
if (0 != jsonResult.getCode()) { |
|
|
|
log.info("进入分配工单:分配工单失败:{}", jsonResult.getMsg()); |
|
|
|
return jsonResult; |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
private JsonResult disCheck(DistributionWorkorderRequest request) { |
|
|
|
if(StringUtils.isEmpty(request.getWorkorderId())){ |
|
|
|
return JsonResult.error(DistributionWorkorderCodeEnum.ID_LIST_IS_NULL.getCode(),DistributionWorkorderCodeEnum.ID_LIST_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(StringUtils.isEmpty(request.getAssignDeptId())){ |
|
|
|
return JsonResult.error(DistributionWorkorderCodeEnum.ASSIGN_DEPT_ID_IS_NULL.getCode(),DistributionWorkorderCodeEnum.ASSIGN_DEPT_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(StringUtils.isEmpty(request.getAssignUserIds())){ |
|
|
|
return JsonResult.error(DistributionWorkorderCodeEnum.ASSIGN_USER_ID_IS_NULL.getCode(), DistributionWorkorderCodeEnum.ASSIGN_USER_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
WorkOrder workOrder = workOrderMapper.selectOne(new LambdaQueryWrapper<WorkOrder>() |
|
|
|
.eq(WorkOrder::getId, request.getWorkorderId()) |
|
|
|
.eq(WorkOrder::getMark, 1)); |
|
|
|
if (null == workOrder) { |
|
|
|
return JsonResult.error(DistributionWorkorderCodeEnum.WORK_ORDER_IS_NOT_EXIST.getCode(), DistributionWorkorderCodeEnum.WORK_ORDER_IS_NOT_EXIST.getMsg()); |
|
|
|
} |
|
|
|
return JsonResult.success(workOrder); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* 分配工单 |
|
|
|
* 1)、修改分配字段信息 |
|
|
|
* 2)、修改工单状态 |
|
|
|
* 3)、修改更新字段 |
|
|
|
* |
|
|
|
* @param userId |
|
|
|
* @param request |
|
|
|
*/ |
|
|
|
private JsonResult distributionWorkOrder(String userId, DistributionWorkorderRequest request) { |
|
|
|
WorkOrder workOrder = new WorkOrder(); |
|
|
|
workOrder.setId(request.getWorkorderId()); |
|
|
|
workOrder.setUpdateUser(userId); |
|
|
|
workOrder.setUpdateTime(DateUtils.now()); |
|
|
|
workOrder.setStatus(WorkOrderStatusEnum.STATUS_ASSIGNED.getCode()); |
|
|
|
workOrder.setAssignDeptId(request.getAssignDeptId()); |
|
|
|
workOrder.setAssignUser(request.getAssignUserIds()); |
|
|
|
workOrder.setAssignTime(DateUtils.now()); |
|
|
|
Integer rowCount = workOrderMapper.updateWorkOrder(workOrder); |
|
|
|
if (rowCount <= 0) { |
|
|
|
log.info("修改工单状态, 确认失败"); |
|
|
|
return JsonResult.error(GenerateWorkorderCodeEnum.GENERATE_IS_FAILED.getCode(), GenerateWorkorderCodeEnum.GENERATE_IS_FAILED.getMsg()); |
|
|
|
} |
|
|
|
return JsonResult.success(); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 判断是否有生成工单权限 |
|
|
|
* 1)、超级管理员可选择所有部门问题生成工单 |
|
|
@@ -836,9 +1008,9 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
//分配人员为当前登录用户 |
|
|
|
workOrder.setDistributionId(user.getId()); |
|
|
|
//指派人员目前临时是当前登录用户 |
|
|
|
workOrder.setAssignUser(user.getId()); |
|
|
|
workOrder.setAssignContact(user.getMobile()); |
|
|
|
workOrder.setAssignTime(DateUtils.now()); |
|
|
|
// workOrder.setAssignUser(user.getId()); |
|
|
|
// workOrder.setAssignContact(user.getMobile()); |
|
|
|
// workOrder.setAssignTime(DateUtils.now()); |
|
|
|
workOrder.setCreateUser(user.getId()); |
|
|
|
workOrder.setCreateTime(DateUtils.now()); |
|
|
|
Integer rowCount = workOrderMapper.insert(workOrder); |