kongdeqiang
2023-02-17 ac94b1d939373a684344764e5b00dac44feabd81
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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);
    }
}