package com.wgcloud.service; import cn.hutool.crypto.SecureUtil; import com.wgcloud.entity.FailureLogging; import com.wgcloud.entity.InspectionTask; import com.wgcloud.entity.TcpState; import com.wgcloud.entity.WorkLogging; import com.wgcloud.mapper.TcpStateMapper; import com.wgcloud.mapper.WorkLoggingMapper; import com.wgcloud.util.DateUtil; import com.wgcloud.util.UUIDUtil; import com.wgcloud.util.staticvar.StaticKeys; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequestWrapper; /** * @author kdq * @version 1.0.0 * @ClassName WorkLoggingService.java * @Description TODO * @createTime 2022年12月14日 14:15:00 */ @Service public class WorkLoggingService { @Autowired private WorkLoggingMapper workLoggingMapper; /** * 保存更换设备日志 * @param failureLogging * @throws Exception */ public void save(FailureLogging failureLogging) throws Exception { WorkLogging workLogging = new WorkLogging(); workLogging.setId(UUIDUtil.getUUID()); workLogging.setWorkDate(failureLogging.getPersonDate()); workLogging.setUsername(failureLogging.getPersonName()); workLogging.setContent("更换ip为"+failureLogging.getOldDeviceIp()+"的"+failureLogging.getOldDeviceModel()+",替换为"+failureLogging.getNewDeviceIp()+"的"+failureLogging.getNewDeviceModel()); workLoggingMapper.save(workLogging); } /** * 保存创立任务日志 * @param inspectionTask * @throws Exception */ public void save(InspectionTask inspectionTask) throws Exception { WorkLogging workLogging = new WorkLogging(); workLogging.setId(UUIDUtil.getUUID()); workLogging.setWorkDate(inspectionTask.getCreateTime()); workLogging.setUsername("管理员"); workLogging.setContent("创立"+inspectionTask.getStartDate()+"-"+inspectionTask.getEndDate()+"的任务,标题为"+inspectionTask.getTitle()); workLoggingMapper.save(workLogging); } }