智慧保安后台管理-外网项目备份
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
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.information.service.impl;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.cache.DictCache;
import org.springblade.common.cache.ParamCache;
import org.springblade.common.cache.SysCache;
import org.springblade.common.cache.UserCache;
import org.springblade.common.enums.DictEnum;
import org.springblade.common.utils.arg;
import org.springblade.core.cache.utils.CacheUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.support.Kv;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.modules.information.entity.Information;
import org.springblade.modules.information.excel.ExportInformationExcel;
import org.springblade.modules.information.excel.ExportInformationSecurityStatistics;
import org.springblade.modules.information.excel.InforExcel;
import org.springblade.modules.information.mapper.InformationMapper;
import org.springblade.modules.information.service.IInformationService;
import org.springblade.modules.information.vo.InformationStatisticsVO;
import org.springblade.modules.information.vo.InformationVO;
import org.springblade.modules.system.entity.Dept;
import org.springblade.modules.system.entity.Role;
import org.springblade.modules.system.entity.User;
import org.springblade.modules.system.service.IDeptService;
import org.springblade.modules.system.service.IRoleService;
import org.springblade.modules.system.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.AbstractExecutorService;
 
import static org.springblade.common.constant.CommonConstant.DEFAULT_PARAM_PASSWORD;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
 
/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2021-07-07
 */
@Service
public class InformationServiceImpl extends ServiceImpl<InformationMapper, Information> implements IInformationService {
 
 
    @Override
    public IPage<InformationVO> selectInformationPage(IPage<InformationVO> page, InformationVO information) {
        List<InformationVO> informationVOS = baseMapper.selectInformationPage(page, information);
        //遍历
        if (informationVOS.size()>0){
            //判断有无子级
            for (InformationVO informationVO : informationVOS) {
                List<Dept> deptList = baseMapper.getDeptHashChildren(informationVO);
                //有子级
                if (deptList.size()>0){
                    Dept dept = new Dept();
                    dept.setId(Long.parseLong(informationVO.getDepartmentid()));
                    //查询当前子单位的人数
                    Integer z = baseMapper.selectInformationUserNumCount(dept) + Integer.parseInt(informationVO.getZnum());
                    informationVO.setZnum(z.toString());
                    //已派遣人数
                    Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + Integer.parseInt(informationVO.getPnum());
                    informationVO.setPnum(p.toString());
                    //持证人数
                    Integer c = baseMapper.selectInformationHoldNumCount(dept) + Integer.parseInt(informationVO.getCnum());
                    informationVO.setCnum(c.toString());
                }
            }
        }
        return page.setRecords(informationVOS);
    }
 
    @Override
    public void deleteIn(String departmentid) {
        baseMapper.deleteIn(departmentid);
    }
 
    @Override
    public void deleteSh(String deptId) {
        baseMapper.deleteSh(deptId);
    }
 
    @Override
    public void insertIn( Information information) {
        baseMapper.insertIn(information);
    }
 
    @Override
    public void deleteMe(String deptId) {
        baseMapper.deleteMe(deptId);
    }
 
    @Override
    public Map selectCount(String departmentid) {
        return baseMapper.selectCount(departmentid);
    }
 
    @Override
    public List<Map<Object, String>> selectInCount() {
        return baseMapper.selectInCount();
    }
 
    @Override
    public void deleteDept(String departmentid) {
        baseMapper.deleteDept(departmentid);
    }
 
    @Override
    public List<Map<Object, Object>> selectExtype(String deptid,String jurisdiction) {
        return baseMapper.selectExtype(deptid,jurisdiction);
    }
 
    @Override
    public List<Map<Object, Object>> selectHold(String deptid,String jurisdiction) {
        return baseMapper.selectHold(deptid,jurisdiction);
    }
 
    @Override
    public List<Map<Object, Object>> selectDis(String deptid) {
        return baseMapper.selectDis(deptid);
    }
 
    @Override
    public List<Map<Object, Object>> selectDisp(String deptid,String jurisdiction) {
        return baseMapper.selectDisp(deptid,jurisdiction);
    }
 
    @Override
    public List<Map<Object, Object>> selectSoil(String deptid,String jurisdiction) {
        return baseMapper.selectSoil(deptid,jurisdiction);
    }
 
    @Override
    public List queryYearKh(String year, String jurisdiction, String deptid) {
        return baseMapper.queryYearKh(year, jurisdiction, deptid);
    }
 
 
    /**
     * 查询培训单位信息(可以报名)
     * @param page
     * @param information 保安单位信息对象
     * @return
     */
    @Override
    public IPage<InformationVO> securityPage(IPage<InformationVO> page, InformationVO information) {
        return page.setRecords(baseMapper.securityPage(page, information));
    }
 
    @Override
    public void importInfor(List<InforExcel> data, Boolean isCovered) {
        data.forEach(InforExcel -> {
            Information information = Objects.requireNonNull(BeanUtil.copy(InforExcel, Information.class));
            //自招保安公司
            if (information.getStats().equals("自招保安单位")) {
            information.setStats("0");
            }
            //保安培训公司
            if (information.getStats().equals("保安培训公司")) {
                information.setStats("1");
            }
            //保安服务公司
            if (information.getStats().equals("保安服务公司")) {
                information.setStats("2");
            }
            //武装守押公司
            if (information.getStats().equals("武装守押公司")) {
                information.setStats("3");
            }
            //跨区域保安公司
            if (information.getStats().equals("跨区域保安公司")) {
                information.setStats("4");
            }
            try {
                arg.test01(arg.url+"/information/save",information);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
    }
 
    /**
     * 根据deptid 删除用户信息
     * @param deptId
     */
    @Override
    public void deleteUserByDeptId(String deptId) {
        baseMapper.deleteUserByDeptId(deptId);
    }
 
    @Override
    public String selJurchilder(String id) {
        return baseMapper.selJurchilder(id);
    }
 
    /**
     * 业务统计情况
     * @param page
     * @param information
     * @return
     */
    @Override
    public IPage selectBusinessStatistics(IPage page, InformationVO information) {
        List<InformationStatisticsVO> list = baseMapper.selectBusinessStatistics(page, information);
        if (list.size()>0) {
            //遍历
            for (InformationStatisticsVO informationStatisticsVO : list) {
                List<Dept> deptList = baseMapper.getDeptHashChildrens(informationStatisticsVO);
                //有子级
                if (deptList.size()>0){
                    Dept dept = new Dept();
                    dept.setId(Long.parseLong(informationStatisticsVO.getDepartmentid()));
                    //查询当前子单位的人数
                    Integer z = baseMapper.selectInformationUserNumCount(dept) + informationStatisticsVO.getZnum();
                    informationStatisticsVO.setZnum(z);
                    //已派遣人数
                    Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + informationStatisticsVO.getPqnum();
                    informationStatisticsVO.setPqnum(p);
                    //持证人数
                    Integer c = baseMapper.selectInformationHoldNumCount(dept) + informationStatisticsVO.getCznum();
                    informationStatisticsVO.setCznum(c);
                    //服务单位数
                    Integer f = baseMapper.selectInformationUnitNumCount(dept) + informationStatisticsVO.getFwnum();
                    informationStatisticsVO.setFwnum(f);
                    //服务单位到期数
                    Integer d = baseMapper.selectInformationUnitExpireNumCount(dept) + informationStatisticsVO.getDqnum();
                    informationStatisticsVO.setDqnum(d);
                }
            }
        }
        return page.setRecords(list);
    }
 
    /**
     * 保安员情况统计
     * @param page
     * @param information
     * @return
     */
    @Override
    public IPage selectSecurityStatistics(IPage page, InformationVO information) {
        List<InformationStatisticsVO> list = baseMapper.selectSecurityStatistics(page,information);
        if (list.size()>0) {
            //遍历
            for (InformationStatisticsVO informationStatisticsVO : list) {
                List<Dept> deptList = baseMapper.getDeptHashChildrens(informationStatisticsVO);
                //有子级
                if (deptList.size()>0){
                    Dept dept = new Dept();
                    dept.setId(Long.parseLong(informationStatisticsVO.getDepartmentid()));
                    //查询当前子单位的人数
                    Integer z = baseMapper.selectInformationUserNumCount(dept) + informationStatisticsVO.getNum();
                    informationStatisticsVO.setNum(z);
                    //持证人数
                    Integer c = baseMapper.selectInformationHoldNumCount(dept) + informationStatisticsVO.getCznum();
                    informationStatisticsVO.setCznum(c);
                    //已派遣人数
                    Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + informationStatisticsVO.getPqnum();
                    informationStatisticsVO.setPqnum(p);
                    //未派遣人数
                    Integer wpq = baseMapper.selectInformationNotDispatcherNumCount(dept) + informationStatisticsVO.getWpqnum();
                    informationStatisticsVO.setWpqnum(wpq);
                    //已采集照片数
                    Integer ycjzp = baseMapper.selectInformationUnitAvatarNumCount(dept) + informationStatisticsVO.getYcjzpnum();
                    informationStatisticsVO.setYcjzpnum(ycjzp);
                    //未采集照片数
                    Integer wcjzp = baseMapper.selectInformationUnitNotAvatarNumCount(dept) + informationStatisticsVO.getWcjzpnum();
                    informationStatisticsVO.setWcjzpnum(wcjzp);
                    //已采集指纹数
                    Integer ycjzw = baseMapper.selectInformationUnitZwNumCount(dept) + informationStatisticsVO.getYcjzwnum();
                    informationStatisticsVO.setYcjzwnum(ycjzw);
                    //审查异常数
                    Integer scyc = baseMapper.selectInformationUnitYcNumCount(dept) + informationStatisticsVO.getScycnum();
                    informationStatisticsVO.setScycnum(scyc);
                    //缴纳社保数
                    Integer jnsb = baseMapper.selectInformationUnitJnsbNumCount(dept) + informationStatisticsVO.getJnsbnum();
                    informationStatisticsVO.setJnsbnum(jnsb);
                }
            }
        }
        return page.setRecords(list);
    }
 
    /**
     * 业务统计导出
     * @param information
     * @return
     */
    @Override
    public List<ExportInformationExcel> exportBusinessStatis(InformationVO information) {
        List<ExportInformationExcel> list = baseMapper.exportBusinessStatis(information);
        if (list.size()>0) {
            //遍历
            for (ExportInformationExcel informationStatisticsVO : list) {
                List<Dept> deptList = baseMapper.getDeptChildrens(informationStatisticsVO.getDepartmentid());
                //有子级
                if (deptList.size()>0){
                    Dept dept = new Dept();
                    dept.setId(Long.parseLong(informationStatisticsVO.getDepartmentid()));
                    //查询当前子单位的人数
                    Integer z = baseMapper.selectInformationUserNumCount(dept) + informationStatisticsVO.getZnum();
                    informationStatisticsVO.setZnum(z);
                    //已派遣人数
                    Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + informationStatisticsVO.getPqnum();
                    informationStatisticsVO.setPqnum(p);
                    //持证人数
                    Integer c = baseMapper.selectInformationHoldNumCount(dept) + informationStatisticsVO.getCznum();
                    informationStatisticsVO.setCznum(c);
                    //服务单位数
                    Integer f = baseMapper.selectInformationUnitNumCount(dept) + informationStatisticsVO.getFwnum();
                    informationStatisticsVO.setFwnum(f);
                    //服务单位到期数
                    Integer d = baseMapper.selectInformationUnitExpireNumCount(dept) + informationStatisticsVO.getDqnum();
                    informationStatisticsVO.setDqnum(d);
                }
            }
        }
        return list;
    }
 
    /**
     * 保安员统计导出
     * @param information
     * @return
     */
    @Override
    public List<ExportInformationSecurityStatistics> exportSecurityStatisInfo(InformationVO information) {
        List<ExportInformationSecurityStatistics> list = baseMapper.exportSecurityStatisInfo(information);
        if (list.size()>0) {
            //遍历
            for (ExportInformationSecurityStatistics informationStatisticsVO : list) {
                List<Dept> deptList = baseMapper.getDeptChildrens(informationStatisticsVO.getDepartmentid());
                //有子级
                if (deptList.size()>0){
                    Dept dept = new Dept();
                    dept.setId(Long.parseLong(informationStatisticsVO.getDepartmentid()));
                    //查询当前子单位的人数
                    Integer z = baseMapper.selectInformationUserNumCount(dept) + informationStatisticsVO.getNum();
                    informationStatisticsVO.setNum(z);
                    //持证人数
                    Integer c = baseMapper.selectInformationHoldNumCount(dept) + informationStatisticsVO.getCznum();
                    informationStatisticsVO.setCznum(c);
                    //已派遣人数
                    Integer p = baseMapper.selectInformationDispatcherNumCount(dept) + informationStatisticsVO.getPqnum();
                    informationStatisticsVO.setPqnum(p);
                    //未派遣人数
                    Integer wpq = baseMapper.selectInformationNotDispatcherNumCount(dept) + informationStatisticsVO.getWpqnum();
                    informationStatisticsVO.setWpqnum(wpq);
                    //已采集照片数
                    Integer ycjzp = baseMapper.selectInformationUnitAvatarNumCount(dept) + informationStatisticsVO.getYcjzpnum();
                    informationStatisticsVO.setYcjzpnum(ycjzp);
                    //未采集照片数
                    Integer wcjzp = baseMapper.selectInformationUnitNotAvatarNumCount(dept) + informationStatisticsVO.getWcjzpnum();
                    informationStatisticsVO.setWcjzpnum(wcjzp);
                    //已采集指纹数
                    Integer ycjzw = baseMapper.selectInformationUnitZwNumCount(dept) + informationStatisticsVO.getYcjzwnum();
                    informationStatisticsVO.setYcjzwnum(ycjzw);
                    //审查异常数
                    Integer scyc = baseMapper.selectInformationUnitYcNumCount(dept) + informationStatisticsVO.getScycnum();
                    informationStatisticsVO.setScycnum(scyc);
                    //缴纳社保数
                    Integer jnsb = baseMapper.selectInformationUnitJnsbNumCount(dept) + informationStatisticsVO.getJnsbnum();
                    informationStatisticsVO.setJnsbnum(jnsb);
                }
            }
        }
        return list;
    }
 
    /**
     * 保安员详情
     * @param page
     * @param deptid
     * @param name
     * @param hold
     * @param photo
     * @param examinationtype
     * @param dispatch
     * @param soil
     * @return
     */
    @Override
    public IPage selectUIn(IPage<List> page, String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil) {
        return page.setRecords(baseMapper.selectUIn(page,deptid, name, hold, photo, examinationtype, dispatch,soil));
    }
}