‘liusuyi’
2023-06-16 a2f6f1975b6e0eca7ae24cb19cfe30343d93fab6
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
package com.ruoyi.inspect.service.impl;
 
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
import com.ruoyi.device.hiksdk.util.hikSdkUtil.GisUtil;
import com.ruoyi.inspect.domain.ArdVideoInspectTask;
import com.ruoyi.inspect.domain.ArdVideoInspectTaskStep;
import com.ruoyi.inspect.service.IArdVideoInspectTaskService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Comparator;
 
@Service
public class ArdVideoInspectTaskStepComparator implements Comparator<ArdVideoInspectTaskStep> {
    private ArdAlarmpointsWellMapper ardAlarmpointsWellMapper;
    private double cameraLon;
    private double cameraLat;
 
    public ArdVideoInspectTaskStepComparator() {
    }
 
    public ArdVideoInspectTaskStepComparator(ArdAlarmpointsWellMapper ardAlarmpointsWellMapper,double cameraLon, double cameraLat) {
        this.ardAlarmpointsWellMapper = ardAlarmpointsWellMapper;
        this.cameraLon = cameraLon;
        this.cameraLat = cameraLat;
    }
 
    public double getCameraLon() {
        return cameraLon;
    }
 
    public void setCameraLon(double cameraLon) {
        this.cameraLon = cameraLon;
    }
 
    public double getCameraLat() {
        return cameraLat;
    }
 
    public void setCameraLat(double cameraLat) {
        this.cameraLat = cameraLat;
    }
 
 
    @Override
    public int compare(ArdVideoInspectTaskStep s1, ArdVideoInspectTaskStep s2) {
        ArdAlarmpointsWell well1 = this.ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(s1.getWellId());
        ArdAlarmpointsWell well2 = this.ardAlarmpointsWellMapper.selectArdAlarmpointsWellById(s2.getWellId());
        //计算s1相对角度
        double angle1 = GisUtil.getNorthAngle(this.cameraLon, this.cameraLat, well1.getLongitude(), well1.getLatitude()) * 1000;
        //计算s2相对角度
        double angle2 = GisUtil.getNorthAngle(this.cameraLon, this.cameraLat, well2.getLongitude(), well2.getLatitude()) * 1000;
        return (int) (angle1 - angle2);
    }
 
}