yangys
2024-10-08 ba9557b5edf7f31ab8bce0ae57aaaaefd6459bb4
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
package com.qianwen.mdc.collect.controller;
 
import java.util.List;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
 
import com.qianwen.mdc.collect.dto.StateAggregateTimeDTO;
import com.qianwen.mdc.collect.entity.iotdb.DeviceState;
import com.qianwen.mdc.collect.mapper.iotdb.DeviceStateMapper;
import com.qianwen.mdc.collect.service.DeviceStateAggregateService;
 
@RestController
public class StateController {
 
    @Autowired
    private DeviceStateAggregateService stateAggregateService;
    @Autowired
    private DeviceStateMapper stateMapper;
 
    @GetMapping("/range")
    public Object range() {
        long wod = 1656819188967653378L;
        StateAggregateTimeDTO timeRange = new StateAggregateTimeDTO();
        timeRange.setEndTime(System.currentTimeMillis());
        List<DeviceState> slist = stateMapper.statesInTimeRange(wod, timeRange);
        
        return "2";
    }
 
    @GetMapping("/stateagg")
    public Object stateagg(Long workstationId) {
        stateAggregateService.stateAggregate(workstationId);
 
        return "1";
    }
    
    @GetMapping("/lttime")
    public Object lttime(Long workstationId) {
        DeviceState s = stateMapper.lastNoFeedbackStateLessThanTime(workstationId,System.currentTimeMillis());
 
        return s;
    }
 
}