| | |
| | | package com.ycl.platform.service.impl; |
| | | |
| | | import com.alibaba.excel.annotation.format.DateTimeFormat; |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | |
| | | import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.config.PlatformConfig; |
| | | import com.ycl.config.ServerConfig; |
| | | import com.ycl.exception.ServiceException; |
| | | import com.ycl.platform.domain.entity.*; |
| | | import com.ycl.platform.domain.excel.PointExport; |
| | |
| | | import com.ycl.platform.service.WorkOrderAuditingRecordService; |
| | | import com.ycl.platform.service.WorkOrderService; |
| | | import com.ycl.platform.service.YwPointService; |
| | | import com.ycl.platform.wvp.StreamContent; |
| | | import com.ycl.platform.wvp.WVPResult; |
| | | import com.ycl.system.Result; |
| | | import com.ycl.system.domain.SysConfig; |
| | | import com.ycl.system.entity.SysDictData; |
| | | import com.ycl.system.mapper.SysConfigMapper; |
| | | import com.ycl.system.mapper.SysDictDataMapper; |
| | | import com.ycl.system.model.LoginUser; |
| | | import com.ycl.system.page.PageUtil; |
| | | import com.ycl.utils.DateUtils; |
| | |
| | | import com.ycl.utils.http.HttpUtils; |
| | | import com.ycl.utils.redis.RedisCache; |
| | | import com.ycl.utils.uuid.IdUtils; |
| | | import constant.ApiConstants; |
| | | import constant.CheckConstants; |
| | | import constant.Constants; |
| | | import constant.RedisConstant; |
| | | import enumeration.ErrorType; |
| | | import enumeration.general.*; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | | import org.bytedeco.javacv.*; |
| | | import org.bytedeco.javacv.FFmpegFrameGrabber; |
| | | import org.bytedeco.javacv.Frame; |
| | | import org.bytedeco.javacv.FrameGrabber; |
| | | import org.bytedeco.javacv.OpenCVFrameConverter; |
| | | import org.bytedeco.opencv.global.opencv_imgcodecs; |
| | | import org.bytedeco.opencv.opencv_core.Mat; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.Assert; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.util.StringUtils; |
| | | import pojo.CascadeOption; |
| | | |
| | | import javax.imageio.ImageIO; |
| | | import javax.swing.*; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.net.HttpURLConnection; |
| | | import java.net.URL; |
| | | import java.net.URLDecoder; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.time.ZoneId; |
| | | import java.util.*; |
| | |
| | | private final NotifyService notifyService; |
| | | private final WorkOrderDistributeRecordMapper workOrderDistributeRecordMapper; |
| | | private final WorkOrderErrorTypeServiceImpl workOrderErrorTypeService; |
| | | private final WorkOrderErrorTypeMapper workOrderErrorTypeMapper; |
| | | private final SysConfigMapper configMapper; |
| | | private final ReportMapper reportMapper; |
| | | private final WorkOrderCheckImgMapper workOrderCheckImgMapper; |
| | | private final WorkOrderWhiteMapper workOrderWhiteMapper; |
| | | private final DeviceInfoMapper deviceInfoMapper; |
| | | private final ApplicationContext applicationContext; |
| | | @Value("${rtsp.server:http://127.0.0.1:7788}") |
| | | private String rtspServer; |
| | | |
| | |
| | | private RedisCache redisCache; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public synchronized Boolean innerAddWorkOrder(List<WorkOrder> workOrderList) { |
| | | //避免坑(事务加锁会失效、方法内部调用事务会失效) |
| | | WorkOrderServiceImpl self = applicationContext.getBean(WorkOrderServiceImpl.class); |
| | | return self.batchAddWorkOrder(workOrderList); |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Boolean batchAddWorkOrder(List<WorkOrder> workOrderList){ |
| | | int total = workOrderList.size(); |
| | | // 查询出白名单列表 |
| | | List<String> serialNumbers = workOrderWhiteMapper.selectList().stream().map(WorkOrderWhite::getSerialNumber).collect(Collectors.toList()); |
| | | // 遍历工单列表,判断是否在白名单中 |
| | | workOrderList = workOrderList.stream().filter(item -> !serialNumbers.contains(item.getSerialNumber())) |
| | | .collect(Collectors.toList()); |
| | | .collect(Collectors.toList()); |
| | | workOrderList = workOrderList.stream().filter(item -> { |
| | | return StringUtils.hasText(item.getSerialNumber()) && Objects.nonNull(item.getStatus()) && !CollectionUtils.isEmpty(item.getErrorTypeList()); |
| | | }).collect(Collectors.toList()); |
| | |
| | | return Boolean.TRUE; |
| | | } |
| | | List<String> willAddSerialNumber = waitAddList.stream().map(WorkOrder::getSerialNumber).collect(Collectors.toList()); |
| | | //只生成考核设备的工单 |
| | | //只生成考核设备、且有运维单位的工单 |
| | | List<YwPoint> pointList = new LambdaQueryChainWrapper<>(ywPointService.getBaseMapper()) |
| | | .select(YwPoint::getUnitId, YwPoint::getSerialNumber, YwPoint::getImportantTag, YwPoint::getImportantTag, YwPoint::getProvinceTag, YwPoint::getImportantCommandImageTag) |
| | | .in(YwPoint::getSerialNumber, willAddSerialNumber) |
| | | .eq(YwPoint::getExamineStatus, Boolean.TRUE) |
| | | .isNotNull(YwPoint::getUnitId) |
| | | .list(); |
| | | Map<String, YwPoint> pointMapping = pointList.stream().collect(Collectors.toMap(YwPoint::getSerialNumber, point -> point)); |
| | | // 查出重点点位、普通点位的处理时间 |
| | |
| | | log.info("传入工单总数: {},实际添加工单数:{}, 实际修改工单数:{}", total, waitAddList.size(), updateNum); |
| | | return Boolean.TRUE; |
| | | } |
| | | |
| | | /** |
| | | * 添加 |
| | | * |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result batchAuditing(WorkOrderBatchAuditingForm form) { |
| | | // 根据故障类型获取列表 |
| | | List<WorkOrder> list = new LambdaQueryChainWrapper<>(baseMapper) |
| | | .in(WorkOrder::getStatus, WorkOrderStatusEnum.YW_HANDLE.getValue()) |
| | | .in(WorkOrder::getErrorType, form.getErrorTypes()) |
| | | .select(WorkOrder::getId, WorkOrder::getUnitId, WorkOrder::getWorkOrderNo, WorkOrder::getSerialNumber) |
| | | .list(); |
| | | //根据工单编号获取工单 |
| | | List<WorkOrder> list = baseMapper.selectByNos(form.getWorkOrderNumbers()); |
| | | if (list.isEmpty()) { |
| | | return Result.error("没有工单可以审核"); |
| | | return Result.error("没有待审核工单"); |
| | | } |
| | | List<String> workOrderNoList = list.stream().map(WorkOrder::getWorkOrderNo).collect(Collectors.toList()); |
| | | List<String> serialNumbers = list.stream().map(WorkOrder::getSerialNumber).toList(); |
| | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result ywCondition(WorkOrderYWConditionForm form) { |
| | | |
| | | WorkOrder workOrder = baseMapper.selectById(form.getId()); |
| | | if (Objects.isNull(workOrder)) { |
| | | throw new ServiceException("工单不存在"); |
| | |
| | | workOrderYwConditionRecord.setYwProofMaterials(form.getYwProofMaterials()); |
| | | workOrderYwConditionRecord.setSysMsg(Boolean.FALSE); |
| | | workOrderYwConditionRecordMapper.insert(workOrderYwConditionRecord); |
| | | //异步获取图片 |
| | | WorkOrderServiceImpl self = applicationContext.getBean(WorkOrderServiceImpl.class); |
| | | self.getImage(workOrder); |
| | | return Result.ok("操作成功"); |
| | | } |
| | | |
| | | @Async("threadPoolTaskExecutor") |
| | | public void getImage(WorkOrder workOrder) { |
| | | List<DeviceInfo> gbDevices = new LambdaQueryChainWrapper<>(deviceInfoMapper) |
| | | .orderByDesc(DeviceInfo::getUpdateTime) |
| | | .last("limit 1") |
| | | .list(); |
| | | if (CollectionUtils.isEmpty(gbDevices)) { |
| | | return; |
| | | } |
| | | // 国标设备的编码就是取视频流的设备编码,国标设备就一个。国标设备的每一个通道代表一个摄像头,也就是设备id是取流的通道id |
| | | String frameImg = null; |
| | | try { |
| | | log.info("国标平台:{},设备编码:{},工单号:{}",gbDevices.get(0).getDeviceId(), workOrder.getSerialNumber(), workOrder.getWorkOrderNo()); |
| | | frameImg = this.getFrameImgByDevice(gbDevices.get(0).getDeviceId(), workOrder.getSerialNumber(), workOrder.getWorkOrderNo()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if (StringUtils.hasText(frameImg)) { |
| | | WorkOrderCheckImg img = new WorkOrderCheckImg(); |
| | | img.setWorkOrderNo(workOrder.getWorkOrderNo()); |
| | | img.setImgUrl(frameImg); |
| | | img.setCreateTime(new Date()); |
| | | workOrderCheckImgMapper.insert(img); |
| | | } |
| | | } |
| | | @Override |
| | | public List<WorkOrderYwConditionRecordVO> selectYwConditionByYwId(String workOrderNo) { |
| | | List<WorkOrderYwConditionRecordVO> ywConditionList = workOrderYwConditionRecordMapper.selectYwConditionByYwId(workOrderNo); |
| | | ywConditionList.stream().forEach(item -> { |
| | | if(item.getUserId().equals(1)){ |
| | | item.setUnitName("管理员"); |
| | | } |
| | | if (Objects.nonNull(item.getSysMsg()) && item.getSysMsg()) { |
| | | item.setUnitName("系统消息"); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public Result removeById(String id) { |
| | | WorkOrder workOrder = baseMapper.selectById(id); |
| | | String workOrderNo = workOrder.getWorkOrderNo(); |
| | | //删除工单审核记录 |
| | | workOrderAuditingRecordMapper.delete(new QueryWrapper<WorkOrderAuditingRecord>().eq("work_order_no", workOrderNo)); |
| | | //删除工单图片记录 |
| | | workOrderCheckImgMapper.delete(new QueryWrapper<WorkOrderCheckImg>().eq("work_order_no", workOrderNo)); |
| | | //删除工单下发记录 |
| | | workOrderDistributeRecordMapper.delete(new QueryWrapper<WorkOrderDistributeRecord>().eq("work_order_no", workOrderNo)); |
| | | //删除工单故障类型 |
| | | workOrderErrorTypeMapper.delete(new QueryWrapper<WorkOrderErrorType>().eq("work_order_no", workOrderNo)); |
| | | //删除工单情况记录 |
| | | workOrderYwConditionRecordMapper.delete(new QueryWrapper<WorkOrderYwConditionRecord>().eq("work_order_no", workOrderNo)); |
| | | |
| | | if (baseMapper.deleteById(id) > 0) { |
| | | return Result.ok("删除成功"); |
| | | } |
| | |
| | | @Override |
| | | public Result page(WorkOrderQuery query) { |
| | | IPage<WorkOrderVO> page = PageUtil.getPage(query, WorkOrderVO.class); |
| | | query.setUnitId(SecurityUtils.getUnitId()); |
| | | query.setStart(DateUtils.getDayStart(query.getStart())); |
| | | query.setEnd(DateUtils.getDayEnd(query.getEnd())); |
| | | if(query.getUnitId()==null) { |
| | | query.setUnitId(SecurityUtils.getUnitId()); |
| | | } |
| | | if(query.getStart()!=null) query.setStart(DateUtils.getDayStart(query.getStart())); |
| | | if(query.getEnd()!=null) query.setEnd(DateUtils.getDayEnd(query.getEnd())); |
| | | baseMapper.page(page, query); |
| | | if (!CollectionUtils.isEmpty(page.getRecords())) { |
| | | page.getRecords().stream().forEach(item -> { |
| | | if (StringUtils.hasText(item.getErrorType())) { |
| | | item.setErrorTypeList(List.of(item.getErrorType().split(","))); |
| | | List<String> errorTypeList = new ArrayList<>(List.of(item.getErrorType().split(","))); |
| | | int index = errorTypeList.indexOf(query.getErrorTypeLabel()); |
| | | if (index != -1) { |
| | | // 保存要移动的元素 |
| | | String firstOccurrence = errorTypeList.get(index); |
| | | // 从列表中移除该元素(第一次出现的位置) |
| | | errorTypeList.remove(index); |
| | | // 将该元素添加到列表的首位 |
| | | errorTypeList.add(0, firstOccurrence); |
| | | } |
| | | // 设置更新后的列表 |
| | | item.setErrorTypeList(errorTypeList); |
| | | } |
| | | if (StringUtils.hasText(item.getImgListStr())) { |
| | | item.setImgList(List.of(item.getImgListStr().split(","))); |
| | |
| | | @Override |
| | | public Result distributePage(DistributeWorkOrderQuery query) { |
| | | IPage<WorkOrderVO> page = PageUtil.getPage(query, WorkOrderVO.class); |
| | | if(query.getStart()!=null) query.setStart(DateUtils.getDayStart(query.getStart())); |
| | | if(query.getEnd()!=null) query.setEnd(DateUtils.getDayEnd(query.getEnd())); |
| | | baseMapper.distributePage(page, query); |
| | | return Result.ok().data(page).total(page.getTotal()); |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | public synchronized String getFrameImgByDevice(String deviceId, String channelId, String workOrderNo) throws Exception { |
| | | public String getFrameImgByDevice(String deviceId, String channelId, String workOrderNo) throws Exception { |
| | | String url = String.format(this.rtspServer + "/api/play/start/img/%s/%s", deviceId, channelId); |
| | | log.info("访问路径{}",url); |
| | | String result = HttpUtils.sendGet(url); |
| | | log.info("拿到取流图片响应结果:" + result); |
| | | WVPResult wvpResult = JSON.parseObject(result, WVPResult.class); |
| | |
| | | |
| | | @Override |
| | | public List<WorkOrderVO> export (WorkOrderExportQuery query){ |
| | | query.setUnitId(SecurityUtils.getUnitId()); |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | if (query.getStart() == null) { |
| | | query.setStart(format.format(DateUtils.getDayStart(new Date()))); |
| | | } else { |
| | | query.setStart(query.getStart() + " 00:00:00"); |
| | | if(query.getUnitId()==null) { |
| | | query.setUnitId(SecurityUtils.getUnitId()); |
| | | } |
| | | if (query.getEnd() == null) { |
| | | query.setStart(format.format(DateUtils.getDayEnd(new Date()))); |
| | | } else { |
| | | query.setEnd(query.getEnd() + " 23:59:59"); |
| | | } |
| | | if (query.getStart() != null) query.setStart(query.getStart() + " 00:00:00"); |
| | | if (query.getEnd() != null) query.setEnd(query.getEnd() + " 23:59:59"); |
| | | |
| | | List<WorkOrderVO> export = baseMapper.export(query); |
| | | |
| | | System.out.println(export); |
| | | return export; |
| | | return baseMapper.export(query); |
| | | } |
| | | |
| | | /** |
| | |
| | | public Result selectWorkOrderWhiteList(WorkOrderWhiteQuery query) { |
| | | IPage<WorkOrderWhite> page = PageUtil.getPage(query, WorkOrderWhite.class); |
| | | workOrderWhiteMapper.page(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | List<WorkOrderWhite> records = page.getRecords(); |
| | | records.forEach(white-> { |
| | | List<String> errorTextList = new ArrayList<>(); |
| | | List<String> errorTypeList = JSONArray.parseArray(white.getErrorType(), String.class); |
| | | errorTypeList.forEach(error->{ |
| | | String errorText = ErrorType.getDescriptionByValue(error); |
| | | errorTextList.add(errorText); |
| | | }); |
| | | white.setErrorType(String.join(",", errorTextList)); |
| | | }); |
| | | return Result.ok().data(records).total(page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Override |
| | | public Result addWorkOrderWhite(WorkOrderWhite workOrderWhite) { |
| | | // 通过设备编码查询设备信息 |
| | | YwPoint ywPoint = ywPointService.selectBySerialNumber(workOrderWhite.getSerialNumber()); |
| | | // 新增白名单设备记录 |
| | | if (ywPoint == null){ |
| | | return Result.error("设备不存在"); |
| | | } |
| | | // 检查是否已经存在该白名单 |
| | | WorkOrderWhite flag = workOrderWhiteMapper.selectBySerialNumber(workOrderWhite.getSerialNumber()); |
| | | if (flag != null) { |
| | | return Result.error("该设备已存在白名单"); |
| | | } else { |
| | | workOrderWhite.setPointName(ywPoint.getPointName()); |
| | | List<String> errorTypeList = workOrderWhite.getErrorTypeList(); |
| | | workOrderWhite.setErrorType(JSONArray.toJSONString(errorTypeList)); |
| | | workOrderWhite.setCreateBy(SecurityUtils.getUsername()); |
| | | workOrderWhiteMapper.insert(workOrderWhite); |
| | | return Result.ok(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 修改工单白名单 |
| | | * |
| | | * @param workOrderWhite 白色工单 |
| | | * @return {@link Result } |
| | | * @author |
| | | */ |
| | | @Override |
| | | public Result updateWorkOrderWhite(WorkOrderWhite workOrderWhite) { |
| | | WorkOrderWhite white = workOrderWhiteMapper.selectBySerialNumber(workOrderWhite.getSerialNumber()); |
| | | workOrderWhite.setId(white.getId()); |
| | | List<String> errorTypeList = workOrderWhite.getErrorTypeList(); |
| | | workOrderWhite.setErrorType(JSONArray.toJSONString(errorTypeList)); |
| | | workOrderWhiteMapper.updateById(workOrderWhite); |
| | | return Result.ok(); |
| | | } |
| | | /** |
| | | * 批量删除工单白名单 |
| | | * |
| | |
| | | */ |
| | | @Override |
| | | public void batchImportWhite(List<PointExport> dataList) { |
| | | // 获得所有需要新增的白名单对象 |
| | | List<WorkOrderWhite> whitelist = dataList.stream().map(pointExport -> |
| | | new WorkOrderWhite(pointExport.getSerialNumber(), pointExport.getPointName(), SecurityUtils.getUsername())) |
| | | .collect(Collectors.toList()); |
| | | // 获得所有已存在的白名单设备编码 |
| | | List<String> serialNumbers = workOrderWhiteMapper.selectList().stream().map(WorkOrderWhite::getSerialNumber).collect(Collectors.toList()); |
| | | // 筛选出新增、修改的白名单对象 |
| | | List<WorkOrderWhite> updateWhiteList = whitelist.stream().filter(white -> serialNumbers.contains(white.getSerialNumber())).collect(Collectors.toList()); |
| | | List<WorkOrderWhite> insertWhiteList = whitelist.stream().filter(white ->!serialNumbers.contains(white.getSerialNumber())).collect(Collectors.toList()); |
| | | // 新增/修改白名单设备记录 |
| | | updateWhiteList.stream().forEach(white -> workOrderWhiteMapper.updateBySerialNumber(white)); |
| | | insertWhiteList.stream().forEach(white -> workOrderWhiteMapper.insert(white)); |
| | | // // 获得所有需要新增的白名单对象 |
| | | // List<WorkOrderWhite> whitelist = dataList.stream().map(pointExport -> |
| | | // new WorkOrderWhite(pointExport.getSerialNumber(), pointExport.getPointName(), SecurityUtils.getUsername())) |
| | | // .collect(Collectors.toList()); |
| | | // // 获得所有已存在的白名单设备编码 |
| | | // List<String> serialNumbers = workOrderWhiteMapper.selectList().stream().map(WorkOrderWhite::getSerialNumber).collect(Collectors.toList()); |
| | | // // 筛选出新增、修改的白名单对象 |
| | | // List<WorkOrderWhite> updateWhiteList = whitelist.stream().filter(white -> serialNumbers.contains(white.getSerialNumber())).collect(Collectors.toList()); |
| | | // List<WorkOrderWhite> insertWhiteList = whitelist.stream().filter(white ->!serialNumbers.contains(white.getSerialNumber())).collect(Collectors.toList()); |
| | | // // 新增/修改白名单设备记录 |
| | | // updateWhiteList.stream().forEach(white -> workOrderWhiteMapper.updateBySerialNumber(white)); |
| | | // insertWhiteList.stream().forEach(white -> workOrderWhiteMapper.insert(white)); |
| | | } |
| | | |
| | | /** |
| | | * 检测工单按钮 |
| | | * @param workOrderNo |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result checkImage(String workOrderNo,String serialNumber) { |
| | | // 查出国标设备,就一条数据 |
| | | List<DeviceInfo> gbDevices = new LambdaQueryChainWrapper<>(deviceInfoMapper) |
| | | .orderByDesc(DeviceInfo::getUpdateTime) |
| | | .last("limit 1") |
| | | .list(); |
| | | if (!CollectionUtils.isEmpty(gbDevices)) { |
| | | try { |
| | | String imgUrl = this.getFrameImgByDevice(gbDevices.get(0).getDeviceId(), serialNumber,workOrderNo); |
| | | if (StringUtils.hasText(imgUrl)) { |
| | | WorkOrderCheckImg img = new WorkOrderCheckImg(); |
| | | img.setWorkOrderNo(workOrderNo); |
| | | img.setImgUrl(imgUrl); |
| | | img.setCreateTime(new Date()); |
| | | workOrderCheckImgMapper.insert(img); |
| | | } |
| | | return Result.ok().data(imgUrl); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result batchDeleteWorkOrder(List<String> workOrderNos) { |
| | | if(!CollectionUtils.isEmpty(workOrderNos)) { |
| | | //删除工单审核记录 |
| | | workOrderAuditingRecordMapper.delete(new QueryWrapper<WorkOrderAuditingRecord>().in("work_order_no", workOrderNos)); |
| | | //删除工单图片记录 |
| | | workOrderCheckImgMapper.delete(new QueryWrapper<WorkOrderCheckImg>().in("work_order_no", workOrderNos)); |
| | | //删除工单下发记录 |
| | | workOrderDistributeRecordMapper.delete(new QueryWrapper<WorkOrderDistributeRecord>().in("work_order_no", workOrderNos)); |
| | | //删除工单故障类型 |
| | | workOrderErrorTypeMapper.delete(new QueryWrapper<WorkOrderErrorType>().in("work_order_no", workOrderNos)); |
| | | //删除工单情况记录 |
| | | workOrderYwConditionRecordMapper.delete(new QueryWrapper<WorkOrderYwConditionRecord>().in("work_order_no", workOrderNos)); |
| | | //删除工单 |
| | | this.baseMapper.delete(new QueryWrapper<WorkOrder>().in("work_order_no", workOrderNos)); |
| | | } |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public Result errorAll() { |
| | | List<CascadeOption> results = new ArrayList<>(); |
| | | CascadeOption video = new CascadeOption(); |
| | | video.setLabel("视频"); |
| | | video.setValue("VIDEO"); |
| | | List<ErrorType> videoErr = ErrorType.getErrorTypesByCategory("VIDEO"); |
| | | List<ErrorType> videoErr1 = ErrorType.getErrorTypesByCategory("COMMON"); |
| | | videoErr.addAll(videoErr1); |
| | | List<CascadeOption> videoChildren = videoErr.stream().map(item -> CascadeOption.builder() |
| | | .value(item.getValue()) |
| | | .label(item.getDesc()) |
| | | .build()).collect(Collectors.toList()); |
| | | video.setChildren(videoChildren); |
| | | |
| | | CascadeOption car = new CascadeOption(); |
| | | car.setLabel("车辆"); |
| | | car.setValue("CAR"); |
| | | List<ErrorType> carErr = ErrorType.getErrorTypesByCategory("CAR"); |
| | | List<ErrorType> carErr1 = ErrorType.getErrorTypesByCategory("COMMON"); |
| | | List<ErrorType> carErr2 = ErrorType.getErrorTypesByCategory("CARORFACE"); |
| | | carErr.addAll(carErr1); |
| | | carErr.addAll(carErr2); |
| | | List<CascadeOption> carChildren = carErr.stream().map(item -> CascadeOption.builder() |
| | | .value(item.getValue()) |
| | | .label(item.getDesc()) |
| | | .build()).collect(Collectors.toList()); |
| | | car.setChildren(carChildren); |
| | | |
| | | CascadeOption face = new CascadeOption(); |
| | | face.setLabel("人脸"); |
| | | face.setValue("FACE"); |
| | | List<ErrorType> faceErr = ErrorType.getErrorTypesByCategory("FACE"); |
| | | List<ErrorType> faceErr1 = ErrorType.getErrorTypesByCategory("COMMON"); |
| | | List<ErrorType> faceErr2 = ErrorType.getErrorTypesByCategory("CARORFACE"); |
| | | faceErr.addAll(faceErr1); |
| | | faceErr.addAll(faceErr2); |
| | | List<CascadeOption> faceChildren = faceErr.stream().map(item -> CascadeOption.builder() |
| | | .value(item.getValue()) |
| | | .label(item.getDesc()) |
| | | .build()).collect(Collectors.toList()); |
| | | face.setChildren(faceChildren); |
| | | |
| | | results.add(video); |
| | | results.add(car); |
| | | results.add(face); |
| | | return Result.ok().data(results); |
| | | } |
| | | |
| | | @Override |
| | | public Result selectWorkOrderWhiteDetail(Integer id) { |
| | | WorkOrderWhite workOrderWhite = workOrderWhiteMapper.getById(id); |
| | | List<String> errorList = JSONArray.parseArray(workOrderWhite.getErrorType(), String.class); |
| | | workOrderWhite.setErrorTypeList(errorList); |
| | | return Result.ok().data(workOrderWhite); |
| | | } |
| | | |
| | | |
| | | } |