| package com.zy.acs.manager.core.service; | 
|   | 
| import com.zy.acs.framework.common.SnowflakeIdWorker; | 
| import com.zy.acs.manager.core.domain.VehicleFaultDto; | 
| import com.zy.acs.manager.manager.entity.VehFaultRec; | 
| import com.zy.acs.manager.manager.service.VehFaultRecService; | 
| import lombok.extern.slf4j.Slf4j; | 
| import org.springframework.beans.factory.annotation.Autowired; | 
| import org.springframework.scheduling.annotation.Async; | 
| import org.springframework.stereotype.Service; | 
|   | 
| /** | 
|  * Created by vincent on 8/19/2024 | 
|  */ | 
| @Slf4j | 
| @Service | 
| public class FaultProcessor { | 
|   | 
|     @Autowired | 
|     private VehFaultRecService vehFaultRecService; | 
|     @Autowired | 
|     private SnowflakeIdWorker snowflakeIdWorker; | 
|   | 
|     @Async | 
|     public void execute(VehicleFaultDto dto) { | 
|         try { | 
|   | 
|             VehFaultRec vehFaultRec = new VehFaultRec(); | 
|             vehFaultRec.setUuid(String.valueOf(snowflakeIdWorker.nextId()).substring(3)); | 
| //            vehFaultRec.setFaultHex(); | 
|   | 
|   | 
|             if (!vehFaultRecService.save(vehFaultRec)) { | 
|                 log.error("{}号车辆故障!记录故障信息失败......", dto.getVehicle()); | 
|             } | 
|   | 
|         } catch (Exception e) { | 
|             log.error("FaultProcessor", e); | 
|         } | 
|     } | 
|   | 
| } |