Browse Source

修改获取工单列表(分页)

tags/v1.1.0^2
wanghaoran 1 year ago
parent
commit
e1cfdd974f
2 changed files with 29 additions and 10 deletions
  1. +19
    -0
      tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/WorkOrder.java
  2. +10
    -10
      tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/WorkOrderServiceImpl.java

+ 19
- 0
tuoheng-admin/src/main/java/com/tuoheng/admin/entity/domain/WorkOrder.java View File

package com.tuoheng.admin.entity.domain; package com.tuoheng.admin.entity.domain;


import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.common.BaseEntity; import com.tuoheng.common.common.BaseEntity;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date finishTime; private Date finishTime;


/**
* 问题总数
*/
@TableField(exist = false)
private Integer questionTotal;

/**
* 未处理问题数
*/
@TableField(exist = false)
private Integer unhandledTotal;

/**
* 指派负责人名称
*/
@TableField(exist = false)
private String assignUserName;

} }

+ 10
- 10
tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/WorkOrderServiceImpl.java View File

.eq(WorkOrder::getMark, MarkTypeEnum.VALID.getCode()) .eq(WorkOrder::getMark, MarkTypeEnum.VALID.getCode())
.orderByDesc(WorkOrder::getCreateTime)); .orderByDesc(WorkOrder::getCreateTime));


pageData.getRecords().stream().map(x ->{
WorkOrderInfoVO vo = new WorkOrderInfoVO();
BeanUtils.copyProperties(x, vo);
pageData.getRecords().stream().map(vo -> {


//查询问题总数 //查询问题总数
Integer questionTotal = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() Integer questionTotal = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>()
.eq(WorkOrderQuestion::getWorkOrderId, x.getId()));
.eq(WorkOrderQuestion::getWorkOrderId, vo.getId()));
vo.setQuestionTotal(questionTotal); vo.setQuestionTotal(questionTotal);


//查询未处理问题数 //查询未处理问题数
Integer unhandledTotal = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() Integer unhandledTotal = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>()
.eq(WorkOrderQuestion::getWorkOrderId, x.getId())
.eq(WorkOrderQuestion::getWorkOrderId, vo.getId())
.eq(WorkOrderQuestion::getStatus, 0)); .eq(WorkOrderQuestion::getStatus, 0));
vo.setUnhandledTotal(unhandledTotal); vo.setUnhandledTotal(unhandledTotal);


//处理人员名称 //处理人员名称
List<String> assignUser = Arrays.asList(x.getAssignUser().split(","));
List<Integer> assignUserInteger = assignUser.stream().map(Integer::parseInt).collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getId, assignUserInteger));
List<String> assignUserNameList = userList.stream().map(User::getRealname).collect(Collectors.toList());
vo.setAssignUserName(String.join(",",assignUserNameList));
if (StringUtils.isNotEmpty(vo.getAssignUser())) {
List<String> assignUser = Arrays.asList(vo.getAssignUser().split(","));
List<Integer> assignUserInteger = assignUser.stream().map(Integer::parseInt).collect(Collectors.toList());
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().in(User::getId, assignUserInteger));
List<String> assignUserNameList = userList.stream().map(User::getRealname).collect(Collectors.toList());
vo.setAssignUserName(String.join(",", assignUserNameList));
}


return vo; return vo;
}).collect(Collectors.toList()); }).collect(Collectors.toList());

Loading…
Cancel
Save