zhitong.yu
7 天以前 7fc9c42987a13c1d8d2159591a5803e70518827f
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
package com.hxzk.gps.controller.WarnTongJi;
 
import cn.dev33.satoken.annotation.SaCheckLogin;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hxzk.gps.controller.Warning.dto.TableSearchResult.TableSearchResult;
import com.hxzk.gps.entity.Fence.TbFence;
import com.hxzk.gps.entity.User.TbUser;
import com.hxzk.gps.entity.WarnTongJi.WarnTongjiCompany;
import com.hxzk.gps.entity.Warning.TbWarning;
import com.hxzk.gps.mapper.Warning.TbWarningMapper;
import com.hxzk.gps.result.ResultTable;
import com.hxzk.gps.service.Anchor.TbAchorService;
import com.hxzk.gps.service.Company.TbCompanyService;
import com.hxzk.gps.service.Department.TbDepartmentService;
import com.hxzk.gps.service.Fence.TbFenceService;
import com.hxzk.gps.service.Person.TbPersonService;
import com.hxzk.gps.service.WarnTongJi.WarnTongjiCompanyService;
import com.hxzk.gps.service.Warning.TbWarningService;
import com.hxzk.gps.util.GetUser.UserInfoUtil;
import com.hxzk.gps.util.Result.ReturnMessage;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author YuZhiTong
 * @since 2025-06-09
 */
@RestController
@RequestMapping("/WarningTongJi")
public class WarnTongjiCompanyController {
    @Autowired
    WarnTongjiCompanyService warnTongjiCompanyService;
    @Autowired
    TbPersonService personService;
    @Autowired
    TbFenceService fenceService;
    @Autowired
    TbAchorService achorService;
    @Autowired
    TbDepartmentService departmentService;
    @Autowired
    TbWarningMapper warningMapper;
    @Autowired
    TbCompanyService companyService;
 
 
 
    @SaCheckLogin
    @ApiOperation(value = "平台告警列表接口", notes = "该接口提供了平台告警列表的信息查询功能")
    @PostMapping("FindWarningTongJiInfo")
    public ResultTable FindWarningTongJiInfo(@RequestBody TableSearchResult TableSearchResult){
        return warnTongjiCompanyService.FindWarningTongJiInfo(TableSearchResult);
    }
 
 
    @SaCheckLogin
    @ApiOperation(value = "平台用户修改接口", notes = "该接口提供了平台用户修改功能")
    @PostMapping("update")
        public ReturnMessage update(@RequestBody WarnTongjiCompany warnTongjiCompany){
        return warnTongjiCompanyService.update(warnTongjiCompany);
    }
 
    @SaCheckLogin
    @ApiOperation(value = "平台实时统计查询接口", notes = "该接口提供了平台实时统计查询功能")
    @PostMapping("FindDayCountInfo")
    public List<WarnTongjiCompany> FindDayCountInfo(){
        return warnTongjiCompanyService.FindDayCountInfo();
    }
 
    @SaCheckLogin
    @ApiOperation(value = "平台统计页面基础数据查询接口", notes = "该接口提供了平台统计页面基础数据查询功能")
    @PostMapping("FindBSCount")
    public List FindBSCount(){
        List<Long> companyids = companyService.getChildCompanyIds(UserInfoUtil.getUserCompanyId());
        List<Long> companyname = companyService.getChildCompanyNames(UserInfoUtil.getUserCompany());
        List list = new ArrayList<>();
        QueryWrapper queryWrapperOnLinePerson = new QueryWrapper<>();
        queryWrapperOnLinePerson.in("companyid", companyids);
        queryWrapperOnLinePerson.eq("p_online","1");
        list.add(personService.getBaseMapper().selectCount(queryWrapperOnLinePerson));
        QueryWrapper queryWrapperPeronNoLine = new QueryWrapper<>();
        queryWrapperPeronNoLine.in("companyid", companyids);
        queryWrapperPeronNoLine.eq("p_online","0");
        list.add(personService.getBaseMapper().selectCount(queryWrapperPeronNoLine));
        QueryWrapper queryWrapperFence = new QueryWrapper<>();
        queryWrapperFence.in("company", companyname);
        list.add(fenceService.getBaseMapper().selectCount(queryWrapperFence));
        QueryWrapper queryWrapperAchor = new QueryWrapper<>();
        queryWrapperAchor.in("company", companyname);
        list.add(achorService.getBaseMapper().selectCount(queryWrapperAchor));
        QueryWrapper queryWrapperDepartment = new QueryWrapper<>();
        queryWrapperDepartment.in("companyid", companyids);
        list.add(departmentService.getBaseMapper().selectCount(queryWrapperDepartment));
        return list;
    }
    @SaCheckLogin
    @ApiOperation(value = "平台统计页面告警查询接口", notes = "该接口提供了平台统计页面告警查询功能")
    @PostMapping("FindBSWarningCount")
    public List FindBSWarningCount(){
        List list = new ArrayList<>();
        List<Long> list1 = companyService.getChildCompanyIds(UserInfoUtil.getUserCompanyId());
        list.add(warningMapper.FindDayCountInfo("SOS",list1));
        list.add(warningMapper.FindDayCountInfo("进入告警",list1));
        list.add(warningMapper.FindDayCountInfo("出去告警",list1));
        list.add(warningMapper.FindDayCountInfo("聚集告警",list1));
        list.add(warningMapper.FindDayCountInfo("超员告警",list1));
        return list;
    }
    @SaCheckLogin
    @ApiOperation(value = "平台统计页面告警查询接口", notes = "该接口提供了平台统计页面告警查询功能")
    @PostMapping("FindDayWarningCount")
    public Map FindDayWarningCount(@RequestBody TbWarning warning){
        Map map = new HashMap<>();
        map.put("SOS",warningMapper.FindDayDateCountInfo("SOS",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
        map.put("进入告警",warningMapper.FindDayDateCountInfo("进入告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
        map.put("出去告警",warningMapper.FindDayDateCountInfo("出去告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
        map.put("聚集告警",warningMapper.FindDayDateCountInfo("聚集告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
        map.put("超员告警",warningMapper.FindDayDateCountInfo("超员告警",UserInfoUtil.getUserCompany(), Integer.valueOf(warning.getTime())));
        return map;
    }
    @SaCheckLogin
    @ApiOperation(value = "引擎更新时间查询", notes = "该接口提供了引擎更新时间查询功能")
    @PostMapping("FindCSDATE")
    public String FindCSDATE(){
        return warningMapper.FindCSDATE();
    }
}