|
@@ -2,7 +2,6 @@ package com.xy.service;
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
import cn.hutool.core.map.MapUtil;
|
|
-import cn.hutool.core.util.StrUtil;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
@@ -13,8 +12,6 @@ import com.xy.consts.CommConsts;
|
|
import com.xy.dto.DeviceFaultInfoDto;
|
|
import com.xy.dto.DeviceFaultInfoDto;
|
|
import com.xy.dto.DeviceFaultInfoFlowDto;
|
|
import com.xy.dto.DeviceFaultInfoFlowDto;
|
|
import com.xy.dto.SysCodeConfigureDto;
|
|
import com.xy.dto.SysCodeConfigureDto;
|
|
-import com.xy.dto.SysWorkUser.ListDto;
|
|
|
|
-import com.xy.dto.SysWorkUser.SysWorkVo;
|
|
|
|
import com.xy.dto.be.MercDto;
|
|
import com.xy.dto.be.MercDto;
|
|
import com.xy.entity.DeviceFaultInfo;
|
|
import com.xy.entity.DeviceFaultInfo;
|
|
import com.xy.entity.DeviceFaultLog;
|
|
import com.xy.entity.DeviceFaultLog;
|
|
@@ -68,7 +65,8 @@ public class DeviceFaultInfoServiceImpl extends ServiceImpl<DeviceFaultInfoMappe
|
|
@PostMapping("countToDo")
|
|
@PostMapping("countToDo")
|
|
@ApiOperation("待处理设备故障统计")
|
|
@ApiOperation("待处理设备故障统计")
|
|
public R<Long> countToDo() {
|
|
public R<Long> countToDo() {
|
|
- long count = count(Wrappers.<DeviceFaultInfo>lambdaQuery().eq(DeviceFaultInfo::getState, 0));
|
|
|
|
|
|
+ // 只统计严重 紧急
|
|
|
|
+ long count = count(Wrappers.<DeviceFaultInfo>lambdaQuery().eq(DeviceFaultInfo::getState, 0).in(DeviceFaultInfo::getFaultLevel, CollUtil.newArrayList(3, 4)));
|
|
return R.ok(count);
|
|
return R.ok(count);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -101,7 +99,7 @@ public class DeviceFaultInfoServiceImpl extends ServiceImpl<DeviceFaultInfoMappe
|
|
if (CollUtil.isEmpty(list)) {
|
|
if (CollUtil.isEmpty(list)) {
|
|
return R.ok(list);
|
|
return R.ok(list);
|
|
}
|
|
}
|
|
- //最多只取5个
|
|
|
|
|
|
+ // 最多只取5个
|
|
if (list.size() > 5) {
|
|
if (list.size() > 5) {
|
|
list = CollUtil.sub(list, 0, 5);
|
|
list = CollUtil.sub(list, 0, 5);
|
|
}
|
|
}
|
|
@@ -140,7 +138,7 @@ public class DeviceFaultInfoServiceImpl extends ServiceImpl<DeviceFaultInfoMappe
|
|
|
|
|
|
Long sysId = AuthorizeUtils.getSysId();
|
|
Long sysId = AuthorizeUtils.getSysId();
|
|
List<String> roleCodes = AuthorizeUtils.getRoleCodes(sysId);
|
|
List<String> roleCodes = AuthorizeUtils.getRoleCodes(sysId);
|
|
- //售后角色只看转售后的,其他角色看所有
|
|
|
|
|
|
+ // 售后角色只看转售后的,其他角色看所有
|
|
if (roleCodes.contains(CommConsts.MERC_SH_ADMIN)) {
|
|
if (roleCodes.contains(CommConsts.MERC_SH_ADMIN)) {
|
|
lambdaQueryWrapper.eq(DeviceFaultInfo::getToAfterSale, true);
|
|
lambdaQueryWrapper.eq(DeviceFaultInfo::getToAfterSale, true);
|
|
}
|
|
}
|
|
@@ -166,7 +164,7 @@ public class DeviceFaultInfoServiceImpl extends ServiceImpl<DeviceFaultInfoMappe
|
|
r.setMercName(longVoJMap.get(mercId).getName());
|
|
r.setMercName(longVoJMap.get(mercId).getName());
|
|
}
|
|
}
|
|
SysCodeConfigureDto.Vo sysCodeInfo = sysCodeMap.get(r.getEventCode());
|
|
SysCodeConfigureDto.Vo sysCodeInfo = sysCodeMap.get(r.getEventCode());
|
|
- //故障说明与建议
|
|
|
|
|
|
+ // 故障说明与建议
|
|
if (sysCodeInfo != null) {
|
|
if (sysCodeInfo != null) {
|
|
r.setMsg(sysCodeInfo.getMsg());
|
|
r.setMsg(sysCodeInfo.getMsg());
|
|
r.setPropose(sysCodeInfo.getPropose());
|
|
r.setPropose(sysCodeInfo.getPropose());
|
|
@@ -219,9 +217,9 @@ public class DeviceFaultInfoServiceImpl extends ServiceImpl<DeviceFaultInfoMappe
|
|
save.setFaultId(faultId);
|
|
save.setFaultId(faultId);
|
|
save.setContent("故障已解决");
|
|
save.setContent("故障已解决");
|
|
deviceFaultInfoFlowService.save(save);
|
|
deviceFaultInfoFlowService.save(save);
|
|
- //清理日志 故障信息表标记已解决,清除日志表中对应设备事件在标记已解决时间之前所有事件。
|
|
|
|
|
|
+ // 清理日志 故障信息表标记已解决,清除日志表中对应设备事件在标记已解决时间之前所有事件。
|
|
deviceFaultLogService.remove(Wrappers.<DeviceFaultLog>lambdaUpdate().le(DeviceFaultLog::getEventTime, LocalDateTime.now()));
|
|
deviceFaultLogService.remove(Wrappers.<DeviceFaultLog>lambdaUpdate().le(DeviceFaultLog::getEventTime, LocalDateTime.now()));
|
|
- //更新故障等级为正常
|
|
|
|
|
|
+ // 更新故障等级为正常
|
|
deviceInfoService.updateById(new DeviceInfo().setDeviceId(deviceFaultInfo.getDeviceId()).setFaultLevel(-1));
|
|
deviceInfoService.updateById(new DeviceInfo().setDeviceId(deviceFaultInfo.getDeviceId()).setFaultLevel(-1));
|
|
}
|
|
}
|
|
}
|
|
}
|