kongdeqiang
2023-02-22 9812f31d6402a268fa6fd35e8c3a2a59582b720d
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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(DateUtil.getCurrentDate());
        workLogging.setUsername(failureLogging.getPersonName());
        workLogging.setContentText("更换ip为"+failureLogging.getOldDeviceIp()+"的"+failureLogging.getOldDeviceModel()+",替换为"+failureLogging.getNewDeviceIp()+"的"+failureLogging.getNewDeviceModel());
        workLoggingMapper.save(workLogging);
    }
 
    /**
     * 保存更换设备日志
     * @param failureLogging
     * @throws Exception
     */
    public void update(FailureLogging failureLogging) throws Exception {
        WorkLogging workLogging = new WorkLogging();
        workLogging.setId(UUIDUtil.getUUID());
        workLogging.setWorkDate(DateUtil.getCurrentDate());
        workLogging.setUsername(failureLogging.getPersonName());
        workLogging.setContentText("修改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(DateUtil.getCurrentDate());
        workLogging.setUsername("管理员");
        workLogging.setContentText("创立"+inspectionTask.getStartDate()+"到"+inspectionTask.getEndDate()+"的任务,标题为"+inspectionTask.getTitle());
        workLoggingMapper.save(workLogging);
    }
 
    /**
     * 保存创立任务日志
     * @param
     * @throws Exception
     */
    public void update(InspectionTask inspectionTask) throws Exception {
        WorkLogging workLogging = new WorkLogging();
        workLogging.setId(UUIDUtil.getUUID());
        workLogging.setWorkDate(DateUtil.getCurrentDate());
        workLogging.setUsername("管理员");
        workLogging.setContentText("修改"+inspectionTask.getStartDate()+"到"+inspectionTask.getEndDate()+"的任务");
        workLoggingMapper.save(workLogging);
    }
}