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());
|
||||
warrantyStateDesc = warrantyState.getName();
|
||||
}
|
||||
String handle = ticket.getHandle();
|
||||
List<Integer> handleIds= Arrays.stream(handle.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
if (StrUtil.isNotBlank(handle)) {
|
||||
List<AdminUser> adminUsers = adminUserService.listByIds(handleIds);
|
||||
handle = adminUsers.stream().map(AdminUser::getUserName).collect(Collectors.joining(","));
|
||||
}
|
||||
// String handle = ticket.getHandle();
|
||||
// List<Integer> handleIds= Arrays.stream(handle.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
||||
// if (StrUtil.isNotBlank(handle)) {
|
||||
// List<AdminUser> adminUsers = adminUserService.listByIds(handleIds);
|
||||
// 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();
|
||||
TicketInfoVO vo = new TicketInfoVO()
|
||||
.setId(ticket.getId())
|
||||
|
|
@ -610,7 +611,7 @@ public class TicketController extends ControllerBase {
|
|||
.setCreateTime(ticket.getCreateTime())
|
||||
.setAreaName(areaName)
|
||||
.setCompanyName(device.getCustomerName())
|
||||
.setHandle(handle)
|
||||
.setHandle(ticket.getHandleName())
|
||||
.setSolution(ticket.getReason())
|
||||
.setAccidentLevel(ticket.getAccidentLevel())
|
||||
.setUserIsHandle(handleIds.contains(AdminUserUtil.getUserId()))
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ public class TiketController extends ControllerBase {
|
|||
.setTitle(ticket.getTitle())
|
||||
.setDeviceNo(ticket.getDeviceNo())
|
||||
.setDeviceAddress(ticket.getDeviceAddress())
|
||||
.setModelNo(device.getModelNo())
|
||||
.setModelNo(Objects.nonNull(device)?device.getModelNo():"已删除")
|
||||
.setComponent(ticket.getComponent())
|
||||
.setUseTime(ticket.getUseTime())
|
||||
.setDescription(ticket.getDescription())
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import lombok.Data;
|
|||
import org.ttzero.excel.annotation.ExcelColumn;
|
||||
import org.ttzero.excel.annotation.IgnoreExport;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Objects;
|
||||
|
|
@ -31,38 +32,45 @@ public class AdminTicketReportVO {
|
|||
//紧急程度
|
||||
@ExcelColumn("紧急程度")
|
||||
private String urgencyDesc;
|
||||
|
||||
//设备编号
|
||||
@ExcelColumn("设备编号")
|
||||
private String deviceNo;
|
||||
|
||||
//设备类型
|
||||
@ExcelColumn("设备类型")
|
||||
private String deviceType;
|
||||
|
||||
//使用时长
|
||||
@ExcelColumn("使用时长(小时)")
|
||||
private Integer useTime;
|
||||
|
||||
//代理商
|
||||
@ExcelColumn("代理商")
|
||||
private String agentName;
|
||||
|
||||
//客户
|
||||
@ExcelColumn("客户")
|
||||
private String customerName;
|
||||
|
||||
//提交时间
|
||||
@ExcelColumn("提交时间")
|
||||
private LocalDateTime createTime;
|
||||
private LocalDate createTime;
|
||||
|
||||
//根本原因分析
|
||||
@IgnoreExport
|
||||
private String reason;
|
||||
//根本原因分析
|
||||
@ExcelColumn("根本原因分析")
|
||||
private String reason1;
|
||||
|
||||
//工单状态
|
||||
@JsonIgnore
|
||||
@IgnoreExport
|
||||
private Byte state;
|
||||
|
||||
//处理完成时间
|
||||
@JsonIgnore
|
||||
@IgnoreExport
|
||||
private LocalDateTime completeTime;
|
||||
|
||||
//处理时长
|
||||
@ExcelColumn("处理时长")
|
||||
private Long processingTime;
|
||||
|
|
@ -81,10 +89,13 @@ public class AdminTicketReportVO {
|
|||
public String getReason1() {
|
||||
return reason;
|
||||
}
|
||||
//根本原因分析
|
||||
@ExcelColumn("根本原因分析")
|
||||
private String reason1;
|
||||
|
||||
public Long getProcessingTime() {
|
||||
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) {
|
||||
return ChronoUnit.DAYS.between(completeTime, LocalDateTime.now()) + 1;
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public class AdminTicketVO {
|
|||
}
|
||||
|
||||
//根本原因分析
|
||||
@JsonIgnore
|
||||
@ExcelColumn("根本原因分析")
|
||||
private String reason1;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
|
@ -32,10 +33,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
|
|||
@Override
|
||||
public DeviceInfoVO getByDeviceNo(String 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()));
|
||||
}
|
||||
return vo;
|
||||
return Optional.ofNullable(vo).orElse(new DeviceInfoVO());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -134,13 +134,15 @@ public class TicketSolutionServiceImpl extends ServiceImpl<TicketSolutionMapper,
|
|||
.setDescription(solutionMeasuresDataItemVO.getName())
|
||||
.setSuperintendent(solutionMeasuresDataItemVO.getSuperintendent())
|
||||
.setScheduleDate(solutionMeasuresDataItemVO.getScheduleDate())
|
||||
.setConfirmedDate(solutionMeasuresDataItemVO.getConfirmedDate());
|
||||
.setConfirmedDate(solutionMeasuresDataItemVO.getConfirmedDate())
|
||||
.setRemark(solutionMeasuresDataItemVO.getRemark());
|
||||
if (Objects.isNull(solutionMeasuresDataItemVO.getId())){
|
||||
solution.setCreateUserId(userId)
|
||||
.setCreateTime(LocalDateTime.now());
|
||||
forAdd.add(solution);
|
||||
}else {
|
||||
solution.setId(solutionMeasuresDataItemVO.getId());
|
||||
solution.setCreateUserId(solutionMeasuresDataItemVO.getCreateUserId());
|
||||
forUpdate.add(solution);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,13 +3,22 @@
|
|||
<mapper namespace="com.nflg.mobilebroken.repository.mapper.DeviceMapper">
|
||||
|
||||
<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'
|
||||
,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
|
||||
SELECT d.device_no AS 'deviceNo'
|
||||
, d.model_no AS 'modelNo'
|
||||
, d.device_type AS 'deviceType'
|
||||
, 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
|
||||
LEFT JOIN device_component dc ON d.model_no = dc.model_no AND dc.`enable` = 1
|
||||
WHERE d.device_no = #{deviceNo}
|
||||
ORDER BY d.data_valid_state DESC,d.device_state
|
||||
LIMIT 1;
|
||||
</select>
|
||||
<sql id="whr">
|
||||
<if test="query.deviceNo!=null and query.deviceNo!=''">
|
||||
|
|
|
|||
Loading…
Reference in New Issue