refactor(ticket): 优化工单相关代码结构和逻辑
-调整 AdminTicketReportVO 和 AdminTicketVO 结构,优化字段顺序和注解 - 修改 DeviceMapper.xml 中的 SQL 查询,增加排序和限制条件 - 优化 DeviceServiceImpl 中的 getByDeviceNo 方法,增加空值检查 -调整 TicketController 中的工单处理逻辑,移除冗余代码 - 修改 TicketSolutionServiceImpl 中的解决方案创建逻辑,增加备注字段 - 优化 TiketController 中的设备信息获取,增加空值检查
This commit is contained in:
parent
f9a5c61d90
commit
4d1b8c784d
|
|
@ -574,12 +574,13 @@ public class TicketController extends ControllerBase {
|
||||||
DictionaryItem warrantyState = dictionaryItemService.getById(device.getWarrantyState());
|
DictionaryItem warrantyState = dictionaryItemService.getById(device.getWarrantyState());
|
||||||
warrantyStateDesc = warrantyState.getName();
|
warrantyStateDesc = warrantyState.getName();
|
||||||
}
|
}
|
||||||
String handle = ticket.getHandle();
|
// String handle = ticket.getHandle();
|
||||||
List<Integer> handleIds= Arrays.stream(handle.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
// List<Integer> handleIds= Arrays.stream(handle.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||||
if (StrUtil.isNotBlank(handle)) {
|
// if (StrUtil.isNotBlank(handle)) {
|
||||||
List<AdminUser> adminUsers = adminUserService.listByIds(handleIds);
|
// List<AdminUser> adminUsers = adminUserService.listByIds(handleIds);
|
||||||
handle = adminUsers.stream().map(AdminUser::getUserName).collect(Collectors.joining(","));
|
// handle = adminUsers.stream().map(AdminUser::getUserName).collect(Collectors.joining(","));
|
||||||
}
|
// }
|
||||||
|
List<Integer> handleIds=StrUtil.split(ticket.getHandle(),",").stream().map(Integer::parseInt).collect(Collectors.toList());
|
||||||
List<Integer> cqms=adminUserService.getCQMIds();
|
List<Integer> cqms=adminUserService.getCQMIds();
|
||||||
TicketInfoVO vo = new TicketInfoVO()
|
TicketInfoVO vo = new TicketInfoVO()
|
||||||
.setId(ticket.getId())
|
.setId(ticket.getId())
|
||||||
|
|
@ -610,7 +611,7 @@ public class TicketController extends ControllerBase {
|
||||||
.setCreateTime(ticket.getCreateTime())
|
.setCreateTime(ticket.getCreateTime())
|
||||||
.setAreaName(areaName)
|
.setAreaName(areaName)
|
||||||
.setCompanyName(device.getCustomerName())
|
.setCompanyName(device.getCustomerName())
|
||||||
.setHandle(handle)
|
.setHandle(ticket.getHandleName())
|
||||||
.setSolution(ticket.getReason())
|
.setSolution(ticket.getReason())
|
||||||
.setAccidentLevel(ticket.getAccidentLevel())
|
.setAccidentLevel(ticket.getAccidentLevel())
|
||||||
.setUserIsHandle(handleIds.contains(AdminUserUtil.getUserId()))
|
.setUserIsHandle(handleIds.contains(AdminUserUtil.getUserId()))
|
||||||
|
|
|
||||||
|
|
@ -207,7 +207,7 @@ public class TiketController extends ControllerBase {
|
||||||
.setTitle(ticket.getTitle())
|
.setTitle(ticket.getTitle())
|
||||||
.setDeviceNo(ticket.getDeviceNo())
|
.setDeviceNo(ticket.getDeviceNo())
|
||||||
.setDeviceAddress(ticket.getDeviceAddress())
|
.setDeviceAddress(ticket.getDeviceAddress())
|
||||||
.setModelNo(device.getModelNo())
|
.setModelNo(Objects.nonNull(device)?device.getModelNo():"已删除")
|
||||||
.setComponent(ticket.getComponent())
|
.setComponent(ticket.getComponent())
|
||||||
.setUseTime(ticket.getUseTime())
|
.setUseTime(ticket.getUseTime())
|
||||||
.setDescription(ticket.getDescription())
|
.setDescription(ticket.getDescription())
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
||||||
import org.ttzero.excel.annotation.ExcelColumn;
|
import org.ttzero.excel.annotation.ExcelColumn;
|
||||||
import org.ttzero.excel.annotation.IgnoreExport;
|
import org.ttzero.excel.annotation.IgnoreExport;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
@ -31,38 +32,45 @@ public class AdminTicketReportVO {
|
||||||
//紧急程度
|
//紧急程度
|
||||||
@ExcelColumn("紧急程度")
|
@ExcelColumn("紧急程度")
|
||||||
private String urgencyDesc;
|
private String urgencyDesc;
|
||||||
|
|
||||||
//设备编号
|
//设备编号
|
||||||
@ExcelColumn("设备编号")
|
@ExcelColumn("设备编号")
|
||||||
private String deviceNo;
|
private String deviceNo;
|
||||||
|
|
||||||
//设备类型
|
//设备类型
|
||||||
@ExcelColumn("设备类型")
|
@ExcelColumn("设备类型")
|
||||||
private String deviceType;
|
private String deviceType;
|
||||||
|
|
||||||
//使用时长
|
//使用时长
|
||||||
@ExcelColumn("使用时长(小时)")
|
@ExcelColumn("使用时长(小时)")
|
||||||
private Integer useTime;
|
private Integer useTime;
|
||||||
|
|
||||||
//代理商
|
//代理商
|
||||||
@ExcelColumn("代理商")
|
@ExcelColumn("代理商")
|
||||||
private String agentName;
|
private String agentName;
|
||||||
|
|
||||||
//客户
|
//客户
|
||||||
@ExcelColumn("客户")
|
@ExcelColumn("客户")
|
||||||
private String customerName;
|
private String customerName;
|
||||||
|
|
||||||
//提交时间
|
//提交时间
|
||||||
@ExcelColumn("提交时间")
|
@ExcelColumn("提交时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDate createTime;
|
||||||
|
|
||||||
//根本原因分析
|
//根本原因分析
|
||||||
@IgnoreExport
|
@IgnoreExport
|
||||||
private String reason;
|
private String reason;
|
||||||
//根本原因分析
|
|
||||||
@ExcelColumn("根本原因分析")
|
|
||||||
private String reason1;
|
|
||||||
//工单状态
|
//工单状态
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@IgnoreExport
|
@IgnoreExport
|
||||||
private Byte state;
|
private Byte state;
|
||||||
|
|
||||||
//处理完成时间
|
//处理完成时间
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
@IgnoreExport
|
@IgnoreExport
|
||||||
private LocalDateTime completeTime;
|
private LocalDateTime completeTime;
|
||||||
|
|
||||||
//处理时长
|
//处理时长
|
||||||
@ExcelColumn("处理时长")
|
@ExcelColumn("处理时长")
|
||||||
private Long processingTime;
|
private Long processingTime;
|
||||||
|
|
@ -81,10 +89,13 @@ public class AdminTicketReportVO {
|
||||||
public String getReason1() {
|
public String getReason1() {
|
||||||
return reason;
|
return reason;
|
||||||
}
|
}
|
||||||
|
//根本原因分析
|
||||||
|
@ExcelColumn("根本原因分析")
|
||||||
|
private String reason1;
|
||||||
|
|
||||||
public Long getProcessingTime() {
|
public Long getProcessingTime() {
|
||||||
if (TicketState.Processing.getState().compareTo(state)>=0){
|
if (TicketState.Processing.getState().compareTo(state)>=0){
|
||||||
return ChronoUnit.DAYS.between(createTime.toLocalDate(),LocalDateTime.now().toLocalDate())+1;
|
return ChronoUnit.DAYS.between(createTime,LocalDateTime.now().toLocalDate())+1;
|
||||||
}
|
}
|
||||||
if (TicketState.Closed.getState().compareTo(state)>=0) {
|
if (TicketState.Closed.getState().compareTo(state)>=0) {
|
||||||
return ChronoUnit.DAYS.between(completeTime, LocalDateTime.now()) + 1;
|
return ChronoUnit.DAYS.between(completeTime, LocalDateTime.now()) + 1;
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ public class AdminTicketVO {
|
||||||
}
|
}
|
||||||
|
|
||||||
//根本原因分析
|
//根本原因分析
|
||||||
|
@JsonIgnore
|
||||||
@ExcelColumn("根本原因分析")
|
@ExcelColumn("根本原因分析")
|
||||||
private String reason1;
|
private String reason1;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
|
|
@ -31,11 +32,11 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceInfoVO getByDeviceNo(String deviceNo) {
|
public DeviceInfoVO getByDeviceNo(String deviceNo) {
|
||||||
DeviceInfoVO vo=baseMapper.getByDeviceNo(deviceNo);
|
DeviceInfoVO vo = baseMapper.getByDeviceNo(deviceNo);
|
||||||
if (Objects.nonNull(vo.getComponentId())){
|
if (Objects.nonNull(vo) && Objects.nonNull(vo.getComponentId())) {
|
||||||
vo.setComponents(baseMapper.getComponents(vo.getComponentId(), MultilingualUtil.getLanguage()));
|
vo.setComponents(baseMapper.getComponents(vo.getComponentId(), MultilingualUtil.getLanguage()));
|
||||||
}
|
}
|
||||||
return vo;
|
return Optional.ofNullable(vo).orElse(new DeviceInfoVO());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -134,13 +134,15 @@ public class TicketSolutionServiceImpl extends ServiceImpl<TicketSolutionMapper,
|
||||||
.setDescription(solutionMeasuresDataItemVO.getName())
|
.setDescription(solutionMeasuresDataItemVO.getName())
|
||||||
.setSuperintendent(solutionMeasuresDataItemVO.getSuperintendent())
|
.setSuperintendent(solutionMeasuresDataItemVO.getSuperintendent())
|
||||||
.setScheduleDate(solutionMeasuresDataItemVO.getScheduleDate())
|
.setScheduleDate(solutionMeasuresDataItemVO.getScheduleDate())
|
||||||
.setConfirmedDate(solutionMeasuresDataItemVO.getConfirmedDate());
|
.setConfirmedDate(solutionMeasuresDataItemVO.getConfirmedDate())
|
||||||
|
.setRemark(solutionMeasuresDataItemVO.getRemark());
|
||||||
if (Objects.isNull(solutionMeasuresDataItemVO.getId())){
|
if (Objects.isNull(solutionMeasuresDataItemVO.getId())){
|
||||||
solution.setCreateUserId(userId)
|
solution.setCreateUserId(userId)
|
||||||
.setCreateTime(LocalDateTime.now());
|
.setCreateTime(LocalDateTime.now());
|
||||||
forAdd.add(solution);
|
forAdd.add(solution);
|
||||||
}else {
|
}else {
|
||||||
solution.setId(solutionMeasuresDataItemVO.getId());
|
solution.setId(solutionMeasuresDataItemVO.getId());
|
||||||
|
solution.setCreateUserId(solutionMeasuresDataItemVO.getCreateUserId());
|
||||||
forUpdate.add(solution);
|
forUpdate.add(solution);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,22 @@
|
||||||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.DeviceMapper">
|
<mapper namespace="com.nflg.mobilebroken.repository.mapper.DeviceMapper">
|
||||||
|
|
||||||
<select id="getByDeviceNo" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO">
|
<select id="getByDeviceNo" resultType="com.nflg.mobilebroken.common.pojo.vo.DeviceInfoVO">
|
||||||
SELECT d.device_no AS 'deviceNo',d.model_no AS 'modelNo',d.device_type AS 'deviceType'
|
SELECT d.device_no AS 'deviceNo'
|
||||||
,d.device_type_sub AS 'deviceTypeSub',d.warranty_state AS 'warrantyState',d.shipment_date AS 'shipmentDate'
|
, d.model_no AS 'modelNo'
|
||||||
,d.start_warranty_date AS 'startWarrantyDate',d.warranty_month AS 'warrantyMonth',d.customer_name AS 'customerName'
|
, d.device_type AS 'deviceType'
|
||||||
,dc.id AS 'componentId',d.agent_name
|
, d.device_type_sub AS 'deviceTypeSub'
|
||||||
|
, d.warranty_state AS 'warrantyState'
|
||||||
|
, d.shipment_date AS 'shipmentDate'
|
||||||
|
, d.start_warranty_date AS 'startWarrantyDate'
|
||||||
|
, d.warranty_month AS 'warrantyMonth'
|
||||||
|
, d.customer_name AS 'customerName'
|
||||||
|
, dc.id AS 'componentId'
|
||||||
|
, d.agent_name
|
||||||
FROM device d
|
FROM device d
|
||||||
LEFT JOIN device_component dc ON d.model_no=dc.model_no AND dc.`enable`=1
|
LEFT JOIN device_component dc ON d.model_no = dc.model_no AND dc.`enable` = 1
|
||||||
WHERE d.device_no=#{deviceNo}
|
WHERE d.device_no = #{deviceNo}
|
||||||
|
ORDER BY d.data_valid_state DESC,d.device_state
|
||||||
|
LIMIT 1;
|
||||||
</select>
|
</select>
|
||||||
<sql id="whr">
|
<sql id="whr">
|
||||||
<if test="query.deviceNo!=null and query.deviceNo!=''">
|
<if test="query.deviceNo!=null and query.deviceNo!=''">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue