智慧保安后台管理项目备份
Administrator
2021-11-09 4027720673c690cb750bd4cd25fb68574f7f47f5
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
package org.springblade.modules.information.controller;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.modules.information.service.IInformationService;
import org.springblade.modules.information.vo.InformationVO;
import org.springblade.modules.information.vo.ResponseVo;
import org.springframework.web.bind.annotation.GetMapping;
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;
 
/**
 * 组织机构详情控制层 2
 * @author zhongrj
 * @time 2021-09-14
 */
@RestController
@RequestMapping("/information")
@AllArgsConstructor
public class InformationsController {
 
    private final IInformationService informationService;
 
    /**
     * 获取保安公司信息(本市保安公司,分公司)包含经纬度
     * @return
     */
    @GetMapping("/getSecurityUnitPositionInfo")
    public R getSecurityUnitPositionInfo(){
        return R.data(informationService.getSecurityUnitPositionInfo());
    }
 
 
    /**
     * 根据辖区查询保安公司分页信息(本市保安公司,分公司)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitInfoPage")
    public R<IPage<InformationVO>> getSecurityUnitInfoPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitInfoPage(Condition.getPage(query), information));
    }
 
 
    /**
     * 根据辖区查询统计保安公司持证情况分页信息(本市保安公司,分公司)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitHoldInfoPage")
    public R<IPage<InformationVO>> getSecurityUnitHoldInfoPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitHoldInfoPage(Condition.getPage(query), information));
    }
 
 
    /**
     * 根据辖区查询统计保安公司持证率低于50%的保安公司个数及保安公司分页信息(本市保安公司,分公司)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitHoldLessPage")
    public R<IPage<InformationVO>> getSecurityUnitHoldLessPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitHoldLess50Page(Condition.getPage(query), information));
    }
 
    /**
     * 根据辖区查询统计保安公司派遣率低于50%的保安公司个数及保安公司分页信息(本市保安公司,分公司)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitDispatcherLessPage")
    public R<IPage<InformationVO>> getSecurityUnitDispatcherLessPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitDispatcherLess50Page(Condition.getPage(query), information));
    }
 
    /**
     * 根据辖区查询统计保安公司社保缴纳率低于50%的保安公司个数及保安公司分页信息(本市保安公司,分公司)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitSoilLessPage")
    public R<IPage<InformationVO>> getSecurityUnitSoilLessPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitSoilLess50Page(Condition.getPage(query), information));
    }
 
    /**
     * 根据辖区查询统计保安公司保险缴纳率低于90%的保安公司个数及保安公司分页信息(本市保安公司,分公司)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitInsuranceLessPage")
    public R<IPage<InformationVO>> getSecurityUnitInsuranceLessPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitInsuranceLessPage(Condition.getPage(query), information));
    }
 
    /**
     * 根据辖区查询统计保安公司考试通过率低于50%的保安公司个数及保安公司分页信息(本市保安公司,分公司)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitExamLessPage")
    public R<IPage<InformationVO>> getSecurityUnitExamLessPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitExamLess50Page(Condition.getPage(query), information));
    }
 
    /**
     * 根据辖区查询统计当前辖区下的保安公司(本市保安公司,分公司)预警信息,包含(未持证,现实表现差,未缴纳社保,资格审查异常)
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSubstationWarnInfoPage")
    public R<IPage<InformationVO>> getSubstationWarnInfoPage(InformationVO information, Query query){
        return R.data(informationService.getSubstationWarnInfoPage(Condition.getPage(query), information));
    }
 
    /**
     * 根据辖区查询统计当前辖区下的保安公司(本市保安公司,分公司))服务对象小于2家的公司数量的分页信息
     * @param query  分页条件
     * @param information 查询条件
     * @return
     */
    @GetMapping("/getSecurityUnitServerLessPage")
    public R<IPage<InformationVO>> getSecurityUnitServerLessPage(InformationVO information, Query query){
        return R.data(informationService.getSecurityUnitServerLess2Page(Condition.getPage(query), information));
    }
 
    /**
     * 首页分局预警统计(保安员预警(表现差,审查异常),保安公司预警(考试通过率低于50%,持证率低于50%,社保缴纳率低于50%,派遣率低于50%))
     * @return
     */
    @GetMapping("/selectSubstationWarnInfo")
    public R selectSubstationWarnInfo() {
        //辖区信息
        List<Map<Object, Object>> list = informationService.selectJur();
        List<Map<String, Object>> lists = new ArrayList<>();
 
        //1.保安员表现差预警数量
        List<ResponseVo> performanceGroupCountList = informationService.getSecurityPerformanceGroupCountList();
 
        //2.保安员资格异常的数量
        List<ResponseVo> examinationGroupCountList = informationService.getSecurityExaminationGroupCountList();
 
        //3.考试通过率低于50%
        List<ResponseVo> examPassingGroupCountList = informationService.getSecurityExamPassingGroupCountList();
 
        //4.持证率低于50%
        List<ResponseVo> holdGroupCountList = informationService.getSecurityHoldAndSoidAndDispatchGroupCountList(1);
 
        //5.社保缴纳率低于50%
        List<ResponseVo> soidGroupCountList = informationService.getSecurityHoldAndSoidAndDispatchGroupCountList(2);
 
        //6.派遣率低于50%
        List<ResponseVo> dispatchGroupCountList = informationService.getSecurityHoldAndSoidAndDispatchGroupCountList(3);
 
 
        for (int i = 0; i < list.size(); i++) {
            int count = 0;
            Map<String, Object> map = new HashMap<String, Object>();
            //辖区id
            String id = list.get(i).get("id").toString();
            //辖区名称
            String jurname = list.get(i).get("dept_name").toString();
 
            //1.保安员表现差预警数量
            //遍历计算总数
            for (ResponseVo responseVo : performanceGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += performanceGroupCountList.get(i).getNum();
                }
            }
 
 
            //2.保安员资格异常的数量
            //遍历计算总数
            for (ResponseVo responseVo : examinationGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += examinationGroupCountList.get(i).getNum();
                }
            }
 
            //3.考试通过率低于50%
            //遍历计算总数
            for (ResponseVo responseVo : examPassingGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += examPassingGroupCountList.get(i).getNum();
                }
            }
 
            //4.持证率低于50%
            //遍历计算总数
            for (ResponseVo responseVo : holdGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += holdGroupCountList.get(i).getNum();
                }
            }
 
            //5.社保缴纳率低于50%
            //遍历计算总数
            for (ResponseVo responseVo : soidGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += soidGroupCountList.get(i).getNum();
                }
            }
 
            //6.派遣率低于50%
            //遍历计算总数
            for (ResponseVo responseVo : dispatchGroupCountList) {
                //辖区id相同则数量相加
                if (responseVo.getId().equals(id)){
                    count += dispatchGroupCountList.get(i).getNum();
                }
            }
 
            //封装数据
            map.put("Count", count);
            map.put("jurname", jurname);
            map.put("id", id);
            lists.add(map);
        }
        return R.data(lists);
    }
 
 
}