Просмотр исходного кода

小程序工单 模块功能修改

tags/V1.3.2
chenlu 5 месяцев назад
Родитель
Сommit
32c58581a2
5 измененных файлов: 213 добавлений и 2 удалений
  1. +11
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderController.java
  2. +1
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderStatusEnum.java
  3. +7
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderService.java
  4. +3
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileHandleServiceImpl.java
  5. +191
    -1
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java

+ 11
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/controller/WorkOrderController.java Просмотреть файл

@@ -59,6 +59,17 @@ public class WorkOrderController extends BaseController {
return workOrderService.getTodoList(query);
}

/**
* 待审核工单
* @param query
* @return
*/
@GetMapping("/getAuditList")
public JsonResult getAuditList(WorkOrderQuery query){
return workOrderService.getAuditList(query);
}


/**
* 处理工单
* @param query

+ 1
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/enums/WorkOrderStatusEnum.java Просмотреть файл

@@ -8,6 +8,7 @@ public enum WorkOrderStatusEnum {

STATUS_ALLOCATED(5, "工单待分配"),
STATUS_ASSIGNED(10, "工单处理中已分配"),
STATUS_PENDING_REVIEW(11,"待审核"),
STATUS_COMPLETED(15, "工单已完成");

/**

+ 7
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/IWorkOrderService.java Просмотреть файл

@@ -21,6 +21,13 @@ public interface IWorkOrderService extends IBaseService<WorkOrder> {

JsonResult getTodoList(WorkOrderQuery query);

/**
* 待审核工单
* @param query
* @return
*/
JsonResult getAuditList(WorkOrderQuery query);

JsonResult handle(HandleQuery query);

JsonResult getCompleted(WorkOrderQuery query);

+ 3
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/InspectionFileHandleServiceImpl.java Просмотреть файл

@@ -14,6 +14,7 @@ import com.tuoheng.miniprogram.entity.dto.UploadResultDto;
import com.tuoheng.miniprogram.enums.InspectionFileHandleEnum;
import com.tuoheng.miniprogram.enums.MarkEnum;
import com.tuoheng.miniprogram.enums.ServiceExceptionEnum;
import com.tuoheng.miniprogram.enums.WorkOrderStatusEnum;
import com.tuoheng.miniprogram.service.IInspectionFileHandleService;
import com.tuoheng.miniprogram.utils.CurrentUserUtil;
import lombok.extern.slf4j.Slf4j;
@@ -116,7 +117,8 @@ public class InspectionFileHandleServiceImpl implements IInspectionFileHandleSer
return JsonResult.success();
}
WorkOrder workOrder = workOrderMapper.selectById(dto.getWorkOrderId());
workOrder.setStatus(15);
//此处修改 现阶段问题处理完后 状态改为 11待审核
workOrder.setStatus(WorkOrderStatusEnum.STATUS_PENDING_REVIEW.getCode());
workOrder.setUpdateUser(user.getId());
workOrder.setUpdateTime(DateUtils.now());
int i = workOrderMapper.updateById(workOrder);

+ 191
- 1
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/service/impl/WorkOrderServiceImpl.java Просмотреть файл

@@ -374,7 +374,8 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
//每一个工单对应的状态发生改变,一个工单id对应一个工单
WorkOrder workOrder = workOrderMapper.selectById(workOrderInfoVo.getId());
if (ObjectUtil.isNotNull(workOrder)) {
workOrder.setStatus(15);
//问题处理完 状态改为待审核 新需求
workOrder.setStatus(WorkOrderStatusEnum.STATUS_PENDING_REVIEW.getCode());
workOrder.setUpdateTime(DateUtils.now());
workOrder.setUpdateUser(user.getId());
super.update(workOrder);
@@ -474,6 +475,195 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO
return JsonResult.success(pageData);
}

/**
* 待审核工单
*
* @param query
* @return
*/
@Override
public JsonResult getAuditList(WorkOrderQuery query) {
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());
}
User user = userMapper.selectOne(Wrappers.<User>lambdaQuery()
.eq(User::getMark, MarkEnum.VALID.getCode())
.eq(User::getUsername, username));
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());
}
query.setTenantId(tenantId);
//根据登录用户判断角色 1超级管理员 2部门管理员 3普通用户
Integer type = user.getDataPermission();
//获取分页数据
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");
}
query.setOrderStartTime(startTime);
query.setOrderEndTime(endTime);
//用户角色为2部门管理员 3普通用户
if (RoleEnum.SUPER_ADMIN.getCode() == type) {
//超级管理员可查看系统内所有已处理工单
IPage<WorkOrder> workPageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>()
.eq(WorkOrder::getStatus, 11)
.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));
//设置每条工单对应的已完成问题数量 问题状态为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.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, 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本部门及子部门数据列表
if (RoleEnum.ADMIN.getCode() == user.getDataPermission()) {
//获取部门
String deptId = user.getDeptId();
if (StringUtils.isEmpty(deptId)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//获取当前本部门及子部门数据
List<String> deptIdList = deptMapper.selectAllChildListById(deptId);
//获取当前分配人对应的工单分页数据
IPage<WorkOrder> workPageData1 = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery()
.in(WorkOrder::getAssignDeptId, deptIdList)
.eq(WorkOrder::getStatus, 15)
.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));
//设置每条工单对应的状态问题数量
List<WorkOrderInfoVo> collect1 = workPageData1.getRecords().stream().map(g -> {
WorkOrderInfoVo vo = new WorkOrderInfoVo();
BeanUtils.copyProperties(g, vo);
//被分配人员对应的id
String assignUser = g.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.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, g.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(collect1);
return JsonResult.success(pageData);
}

//3普通用户
if(RoleEnum.ORDINARY_USER.getCode() == user.getDataPermission()){
//获取部门
String deptId = user.getDeptId();
if (StringUtils.isEmpty(deptId)) {
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL);
}
//获取当前分配人对应的工单分页数据
IPage<WorkOrder> workPageData1 = workOrderMapper.selectPage(page, Wrappers.<WorkOrder>lambdaQuery()
.eq(WorkOrder::getAssignDeptId, deptId)
.eq(WorkOrder::getStatus, 15)
.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));
//设置每条工单对应的状态问题数量
List<WorkOrderInfoVo> collect2 = workPageData1.getRecords().stream().map(g -> {
WorkOrderInfoVo vo = new WorkOrderInfoVo();
BeanUtils.copyProperties(g, vo);
//被分配人员对应的id
String assignUser = g.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.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, g.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(collect2);
return JsonResult.success(pageData);
}

return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(), WorkOrderEnum.DATA_IS_NULL.getMsg());
}


/**
* 已完成工单
*

Загрузка…
Отмена
Сохранить