/* * 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.controller; import io.swagger.annotations.*; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import io.swagger.models.auth.In; import lombok.AllArgsConstructor; import javax.validation.Valid; import org.springblade.common.cache.DictCache; import org.springblade.common.enums.DictEnum; import org.springblade.core.cache.utils.CacheUtil; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; import org.springblade.core.tool.support.Kv; import org.springblade.modules.dispatcher.vo.DispatcherVO; import org.springblade.modules.information.vo.InformationVO; import org.springblade.modules.information.vo.ResponseVo; import org.springblade.modules.jurisdiction.service.JurisdictionService; import org.springblade.modules.jurisdiction.vo.JurisdictionVO; import org.springblade.modules.system.entity.Dept; import org.springblade.modules.system.service.IDeptService; import org.springframework.web.bind.annotation.*; import com.baomidou.mybatisplus.core.metadata.IPage; import org.springblade.modules.information.entity.Information; import org.springblade.modules.information.service.IInformationService; import org.springblade.core.boot.ctrl.BladeController; import springfox.documentation.annotations.ApiIgnore; import java.text.DecimalFormat; import java.util.List; import java.util.ArrayList; import java.util.Map; import java.util.HashMap; import java.util.*; import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; /** * 控制器 * * @author BladeX * @since 2021-07-07 */ @RestController @AllArgsConstructor @RequestMapping("/information") @Api(value = "", tags = "接口") public class InformationController extends BladeController { private final IInformationService informationService; private final IDeptService iDeptService; private final JurisdictionService jurisdictionService; /** * 详情 */ @GetMapping("/detail") @ApiOperationSupport(order = 1) @ApiOperation(value = "详情", notes = "传入information") public R detail(Information information) { Information detail = informationService.getOne(Condition.getQueryWrapper(information)); return R.data(detail); } /** * 分页 */ @GetMapping("/list") @ApiOperationSupport(order = 2) @ApiOperation(value = "分页", notes = "传入information") public R> list(@ApiIgnore @RequestParam Map information, Query query) { IPage pages = informationService.page(Condition.getPage(query), Condition.getQueryWrapper(information, Information.class)); return R.data(pages); } /** * 自定义分页 */ @GetMapping("/page") @ApiOperationSupport(order = 3) @ApiOperation(value = "分页", notes = "传入information") public R> page(InformationVO information, Query query) { IPage pages = informationService.selectInformationPage(Condition.getPage(query), information); return R.data(pages); } /** * 新增 */ @PostMapping("/save") @ApiOperationSupport(order = 4) @ApiOperation(value = "新增", notes = "传入information") public R save(@Valid @RequestBody Information information) { Dept dept = new Dept(); //String departmentid = information.getDepartmentid(); //Long l = Long.parseLong(departmentid); //自招保安公司 if (information.getStats().equals("0")) { Long i = 1420222768149966850L; dept.setParentId(i); dept.setTenantId("000000"); dept.setDeptName(information.getEnterprisename()); dept.setAncestors("0,1420222768149966850"); dept.setDeptCategory(1); } //保安培训公司 if (information.getStats().equals("1")) { Long i = 1418458374477549569L; dept.setParentId(i); dept.setTenantId("000000"); dept.setDeptName(information.getEnterprisename()); dept.setAncestors("0,1418458374477549569"); dept.setDeptCategory(1); } //保安服务公司 if (information.getStats().equals("2")) { Long i = 1413470343230877697L; dept.setParentId(i); dept.setTenantId("000000"); dept.setDeptName(information.getEnterprisename()); dept.setAncestors("0,1413470343230877697"); dept.setDeptCategory(1); } //武装守押公司 if (information.getStats().equals("3")) { Long i = 1420222961377357825L; dept.setParentId(i); dept.setTenantId("000000"); dept.setDeptName(information.getEnterprisename()); dept.setAncestors("0,1420222961377357825"); dept.setDeptCategory(1); } //dept.setId(l); if (iDeptService.submit(dept)) { CacheUtil.clear(SYS_CACHE); // 返回懒加载树更新节点所需字段 Kv kv = Kv.create().set("id", String.valueOf(dept.getId())).set("tenantId", dept.getTenantId()) .set("deptCategoryName", DictCache.getValue(DictEnum.ORG_CATEGORY, dept.getDeptCategory())); String id = kv.get("id").toString(); information.setDepartmentid(id); } return R.status(informationService.save(information)); } /** * 修改 */ @PostMapping("/update") @ApiOperationSupport(order = 5) @ApiOperation(value = "修改", notes = "传入information") public R update(@Valid @RequestBody Information information) { return R.status(informationService.updateById(information)); } /** * 新增或修改 */ @PostMapping("/submit") @ApiOperationSupport(order = 6) @ApiOperation(value = "新增或修改", notes = "传入information") public R submit(@Valid @RequestBody Information information) { return R.status(informationService.saveOrUpdate(information)); } /** * 删除 */ @PostMapping("/remove") @ApiOperationSupport(order = 8) @ApiOperation(value = "删除", notes = "传入ids") public R remove(String ids) { informationService.deleteIn(ids); informationService.deleteSh(ids); informationService.deleteMe(ids); return R.success("删除成功"); } /** * 统计保安公司未持证的保安的公司数量 */ @PostMapping("/selectInCount") public R selectInCount(String jurisdiction, String deptid) { List> maps = informationService.selectInCount(jurisdiction, deptid); Map map = new HashMap(); map.put("Count", maps.size()); map.put("List", maps); List> lists = new ArrayList<>(); lists.add(map); return R.data(lists); } /** * 未缴社保数量 * 通过辖区查询机构id,然后通过机构id查询当前机构交社保的人数(numj单位已交社保数量;numz单位人员总数) */ @PostMapping("/selectCs") public R selectCs(String jurisdiction, String deptid) { List> maps = informationService.selectCs(jurisdiction, deptid); List> lists = new ArrayList<>(); List> lists1 = new ArrayList<>(); Map map1 = new HashMap(); Integer count = 0; for (int i = 0; i < maps.size(); i++) { Map map = new HashMap(); //交社保数 String numjs = maps.get(i).get("numj").toString(); Integer numj = Integer.parseInt(numjs); //单位总人数 String numzs = maps.get(i).get("numz").toString(); Integer numz = Integer.parseInt(numzs); String deptname = maps.get(i).get("deptname").toString(); //统计未交社保人数 int i1 = numz - numj; count += i1; map.put("count", i1); map.put("name", deptname); lists1.add(map); } map1.put("Count", count); map1.put("List", lists1); lists.add(map1); return R.data(lists); } /** * 管辖区域下拉 */ @PostMapping("/selecttree") public R selecttree() { List> maps = iDeptService.selectCount(); return R.data(maps); } /** * 管辖区域下拉 */ @PostMapping("/lazyTreeJu") public R lazyTreeJu() { List jurisdictionVOS = jurisdictionService.lazyTreeJu(); return R.data(jurisdictionVOS); } /** * 统计这个月和上个月交社保的人数,以及金额 * * @return */ @PostMapping("/selectTo") public R selectTo(String jurisdiction, String deptid) { //上个月人数数量 Integer lnum = 0; //这个月人数数量 Integer tnum = 0; Integer znum = 0; //上个月派遣人数 Integer tpznum = 0; //这个月人数数量 Integer lpznum = 0; Integer pznum = 0; //上个月总人数 Integer tznum = 0; //这个月总人数 Integer lznum = 0; Integer sbnum = 0; //上个月金额 Double lmount = 0.0; //这个月金额 Double tmount = 0.0; Double tamountnum = 0.0; Map map = new HashMap(); List> lists = new ArrayList<>(); List> list = informationService.selectTo(jurisdiction, deptid); for (int i = 0; i < list.size(); i++) { String lastmonths = list.get(i).get("lastmonth").toString(); Integer lastmonth = Integer.parseInt(lastmonths); lnum += lastmonth; String thismouths = list.get(i).get("thismouth").toString(); Integer thismouth = Integer.parseInt(thismouths); tnum += thismouth; //社保总数 String nums = list.get(i).get("num").toString(); Integer numss = Integer.parseInt(nums); znum += numss; String lastamounts = list.get(i).get("lastamount").toString(); Double lastamount = Double.parseDouble(lastamounts); lmount += lastamount; String thisamounts = list.get(i).get("thisamount").toString(); Double thisamount = Double.parseDouble(thisamounts); tmount += thisamount; //缴纳总数 String amountnums = list.get(i).get("amountnum").toString(); Double amountnumss = Double.parseDouble(amountnums); tamountnum += amountnumss; String userthismouth = list.get(i).get("userthismouth").toString(); Integer userthismouths = Integer.parseInt(userthismouth); lpznum += userthismouths; String userlastmouth = list.get(i).get("userlastmouth").toString(); Integer userlastmouths = Integer.parseInt(userlastmouth); tpznum += userlastmouths; String usernums = list.get(i).get("usernum").toString(); Integer usernumss = Integer.parseInt(usernums); pznum += usernumss; //公司派遣总数 String userpcthismouth = list.get(i).get("userpcthismouth").toString(); Integer userpcthismouths = Integer.parseInt(userpcthismouth); lznum += userpcthismouths; String userpclastmouth = list.get(i).get("userpclastmouth").toString(); Integer userpclastmouths = Integer.parseInt(userpclastmouth); tznum += userpclastmouths; //缴纳社保总数 String userpcnums = list.get(i).get("userpcnum").toString(); Integer userpcnumss = Integer.parseInt(userpcnums); sbnum += userpcnumss; } map.put("lastmonth", lnum); map.put("thismouth", tnum); map.put("znum", znum); map.put("lastamount", lmount); map.put("thisamount", tmount); map.put("tamountnum", tamountnum); map.put("userlastmouth", tpznum); map.put("userthismouth", lpznum); map.put("usernum", pznum); map.put("userpcthismouth", lznum); map.put("userpclastmouth", tznum); map.put("userpcnum", sbnum); lists.add(map); return R.data(lists); } /** * 查询本年所有月份交社保人数 * * @return */ @GetMapping("/queryYearSoil") public R queryYearSoil(String jurisdiction, String deptid) { Calendar cal = Calendar.getInstance(); String year = String.valueOf(cal.get(Calendar.YEAR)); Map map = informationService.queryYearSoil(year, jurisdiction, deptid); map = (HashMap) sortMapBykeyAsc(map);//key升序 return R.data(map); } /** * 查询本年所有月份派遣人数 * * @return */ @GetMapping("/queryYearPz") public R queryYearPz(String jurisdiction, String deptid) { Calendar cal = Calendar.getInstance(); String year = String.valueOf(cal.get(Calendar.YEAR)); Map map = informationService.queryYearPz(year, jurisdiction, deptid); map = (HashMap) sortMapBykeyAsc(map);//key升序 return R.data(map); } /** * 查询本年所有月份社保金额(公司经济运营趋势) * * @return */ @GetMapping("/queryYearAn") public R queryYearAn(String jurisdiction, String deptid) { Calendar cal = Calendar.getInstance(); String year = String.valueOf(cal.get(Calendar.YEAR)); Map map = informationService.queryYearAn(year, jurisdiction, deptid); map = (HashMap) sortMapBykeyAsc(map);//key升序 return R.data(map); } /** * 公司运营智能统计 * * @return */ @GetMapping("/queryCounts") public R queryCounts(String jurisdiction, String deptid) { List> lists = new ArrayList<>(); Integer a = 0; Integer b = 0; Integer num = 0; Integer znum = 0; Integer cznum = 0; Integer sbnum = 0; Integer khnum = 0; Integer pqnum = 0; Integer zca = 0; Integer zcb = 0; Integer cza = 0; Integer czb = 0; Integer sba = 0; Integer sbb = 0; Integer kha = 0; Integer khb = 0; Integer pqa = 0; Integer pqb = 0; Integer integer = 0; String deptname = null; String jurname = null; //保安员数量 Map map = new HashMap(); Map mapzc = new HashMap(); Map mapcz = new HashMap(); Map mapsb = new HashMap(); Map mapkh = new HashMap(); Map mappq = new HashMap(); Map mapC = new HashMap(); List> maps = informationService.queryCountB(jurisdiction, deptid); for (int i = 0; i < maps.size(); i++) { //这个月数量 String thisnum = maps.get(i).get("thisnum").toString(); a += Integer.valueOf(thisnum); //上个月数量 String lastnum = maps.get(i).get("lastnum").toString(); b += Integer.valueOf(lastnum); String nums = maps.get(i).get("num").toString(); num += Integer.valueOf(nums); String fznums = maps.get(i).get("fznum").toString(); integer += Integer.valueOf(fznums); } map.put("thisnum", a); map.put("lastnum", b); if(deptid.equals("")|| deptid.equals("null")){ map.put("num", num-integer); } else { map.put("num", num); } map.put("List", maps); mapC.put("baoan", map); //正常保安员数量 List> maps1 = informationService.queryCountZc(jurisdiction, deptid); for (int i = 0; i < maps1.size(); i++) { //这个月数量 String thisnum = maps1.get(i).get("thisnum").toString(); zca += Integer.valueOf(thisnum); //上个月数量 String lastnum = maps1.get(i).get("lastnum").toString(); zcb += Integer.valueOf(lastnum); String nums = maps1.get(i).get("num").toString(); znum += Integer.valueOf(nums); } mapzc.put("thisnum", zca); mapzc.put("lastnum", zcb); mapzc.put("num", znum); mapzc.put("List", maps1); mapC.put("zcbaoan", mapzc); //持证保安数量 List> maps2 = informationService.queryCountCz(jurisdiction, deptid); for (int i = 0; i < maps2.size(); i++) { //这个月数量 String thisnum = maps2.get(i).get("thisnum").toString(); cza += Integer.valueOf(thisnum); //上个月数量 String lastnum = maps2.get(i).get("lastnum").toString(); czb += Integer.valueOf(lastnum); String nums = maps2.get(i).get("num").toString(); cznum += Integer.valueOf(nums); } mapcz.put("thisnum", cza); mapcz.put("lastnum", czb); mapcz.put("num", cznum); mapcz.put("List", maps2); mapC.put("czbaoan", mapcz); //缴纳社保数量 List> maps3 = informationService.queryCountSb(jurisdiction, deptid); for (int i = 0; i < maps3.size(); i++) { //这个月数量 String thisnum = maps3.get(i).get("thisnum").toString(); sba += Integer.valueOf(thisnum); //上个月数量 String lastnum = maps3.get(i).get("lastnum").toString(); sbb += Integer.valueOf(lastnum); String nums = maps3.get(i).get("num").toString(); sbnum += Integer.valueOf(nums); } mapsb.put("thisnum", sba); mapsb.put("lastnum", sbb); mapsb.put("num", sbnum); mapsb.put("List", maps3); mapC.put("sheb", mapsb); //服务客户数量 List> maps4 = informationService.queryCountKh(jurisdiction, deptid); for (int i = 0; i < maps4.size(); i++) { //这个月数量 String thisnum = maps4.get(i).get("thisnum").toString(); kha += Integer.valueOf(thisnum); //上个月数量 String lastnum = maps4.get(i).get("lastnum").toString(); khb += Integer.valueOf(lastnum); String nums = maps4.get(i).get("num").toString(); khnum += Integer.valueOf(nums); } mapkh.put("thisnum", kha); mapkh.put("lastnum", khb); mapkh.put("num", khnum); mapkh.put("List", maps4); mapC.put("kh", mapkh); //保安派遣数量 List> maps5 = informationService.queryCountPq(jurisdiction, deptid); for (int i = 0; i < maps5.size(); i++) { //这个月数量 String thisnum = maps5.get(i).get("thisnum").toString(); pqa += Integer.valueOf(thisnum); //上个月数量 String lastnum = maps5.get(i).get("lastnum").toString(); pqb += Integer.valueOf(lastnum); String nums = maps5.get(i).get("num").toString(); pqnum += Integer.valueOf(nums); } mappq.put("thisnum", pqa); mappq.put("lastnum", pqb); mappq.put("num", pqnum); mappq.put("List", maps5); mapC.put("paiq", mappq); lists.add(mapC); return R.data(lists); } /** * 查询本年公司运营智能统计 * * @return */ @GetMapping("/queryYearG") public R queryYearG(String jurisdiction, String deptid) { Calendar cal = Calendar.getInstance(); String year = String.valueOf(cal.get(Calendar.YEAR)); Map mapz = new HashMap(); Map mapzc1 = new HashMap(); Map mapcz1 = new HashMap(); Map mapsb1 = new HashMap(); List> lists = new ArrayList<>(); Map map = informationService.queryYearZ(year, jurisdiction, deptid); map = (HashMap) sortMapBykeyAsc(map);//key升序 mapz.put("baoan", map); lists.add(mapz); //正常保安数量 Map mapzc = informationService.queryYearZc(year, jurisdiction, deptid); mapzc = (HashMap) sortMapBykeyAsc(mapzc);//key升序 mapzc1.put("zc", mapzc); lists.add(mapzc1); //保安持证数量 Map mapcz = informationService.queryYearCz(year, jurisdiction, deptid); mapcz = (HashMap) sortMapBykeyAsc(mapcz);//key升序 mapcz1.put("chiz", mapcz); lists.add(mapcz1); //缴纳社保数 Map mapsb = informationService.queryYearSoil(year, jurisdiction, deptid); mapsb = (HashMap) sortMapBykeyAsc(mapsb);//key升序 mapsb1.put("sheb", mapsb); //保安派遣 Map mapde = informationService.queryYearBanan(year, jurisdiction, deptid); mapde = (HashMap) sortMapBykeyAsc(mapde);//key升序 mapsb1.put("paiq", mapde); lists.add(mapsb1); return R.data(lists); } /** * 查询本年所有月份的客户数量 * * @return */ @GetMapping("/queryYearKh") public R queryYearKh(String jurisdiction, String deptid) { Calendar cal = Calendar.getInstance(); String year = String.valueOf(cal.get(Calendar.YEAR)); Map map = informationService.queryYearKh(year, jurisdiction, deptid); map = (HashMap) sortMapBykeyAsc(map);//key升序 return R.data(map); } /** * 查询本年所有月份的保安派遣数量 * * @return */ @GetMapping("/queryYearBanan") public R queryYearBanan(String jurisdiction, String deptid) { Calendar cal = Calendar.getInstance(); String year = String.valueOf(cal.get(Calendar.YEAR)); Map map = informationService.queryYearBanan(year, jurisdiction, deptid); map = (HashMap) sortMapBykeyAsc(map);//key升序 return R.data(map); } //升序 public static Map sortMapBykeyAsc(Map oriMap) { Map sortedMap = new LinkedHashMap(); try { if (oriMap != null && !oriMap.isEmpty()) { List> entryList = new ArrayList>(oriMap.entrySet()); Collections.sort(entryList, new Comparator>() { public int compare(Map.Entry entry2, Map.Entry entry1) { int value2 = 0, value1 = 0; try { value2 = Integer.parseInt(entry1.getKey()); value1 = Integer.parseInt(entry2.getKey()); } catch (NumberFormatException e) { value2 = 0; value1 = 0; } return value1 - value2; } }); Iterator> iter = entryList.iterator(); Map.Entry tmpEntry = null; while (iter.hasNext()) { tmpEntry = iter.next(); sortedMap.put(tmpEntry.getKey(), tmpEntry.getValue()); } } } catch (Exception e) { } return sortedMap; } /** * 统计用户资格异常的数量 * * @return */ @PostMapping("/selectExtypeUser") public int selectExtypeUser() { return informationService.selectExtypeUser(); } /** * 单位删除 */ @PostMapping("/deleteDept") public R deleteDept(String ids) { informationService.deleteDept(ids); return R.success("删除成功"); } /** * 保安员统计 */ @PostMapping("/selectLi") public R selectLi(String jurisdiction, String deptid, String stats, String startTime, String endTime, Query query) { IPage list = informationService.selectLi(Condition.getPage(query), jurisdiction, deptid, stats, startTime, endTime); return R.data(list); } /** * 单位类型统计 */ @PostMapping("/seCountI") public R seCountI(String jurisdiction, String deptid) { List> list = informationService.seCountI(jurisdiction, deptid); return R.data(list); } /** * 保安在职男女数量 */ @PostMapping("/seCountUg") public R seCountUg(String jurisdiction, String deptid) { String mnum = informationService.seCountUm(jurisdiction, deptid); String gnum = informationService.seCountUg(jurisdiction, deptid); Map map = new HashMap(); map.put("mnum", mnum); map.put("gnum", gnum); List list = new ArrayList(); list.add(map); return R.data(list); } /** * 保安员详情 */ @PostMapping("/selectUIn") public R selectUIn(String deptid, String name, String hold, String photo, String examinationtype, String dispatch, String soil, Query query) { IPage list = informationService.selectUIn(Condition.getPage(query), deptid, name, hold, photo, examinationtype, dispatch, soil); return R.data(list); } /** * 业务统计明细 */ @PostMapping("/selectDis") public R selectDis(String jurisdiction, String deptid, String fid, Query query) { IPage list = informationService.selectDis(Condition.getPage(query), jurisdiction, deptid, fid); return R.data(list); } /** * 服务单位下拉 */ @PostMapping("/selectFw") public R selectFw() { List> list = informationService.selectFw(); return R.data(list); } /** * 公司材料不全数量统计 */ @PostMapping("/selectCl") public R selectCl(String jurisdiction) { Map map = new HashMap(); Integer count = 0; List> lists = new ArrayList<>(); List> maps = informationService.selectCl(jurisdiction); for (int i = 0; i < maps.size(); i++) { String num = maps.get(i).get("num").toString(); count += Integer.valueOf(num); } map.put("count", count); map.put("list", maps); lists.add(map); return R.data(lists); } /** * @return */ @PostMapping("/selectAge") public R selectAge(String jurisdiction, String deptid) { List> list = informationService.selectAge(jurisdiction, deptid); int qcount = 0;//青年 int zcount = 0;//中年 int lcount = 0;//老年 for (int i = 0; i < list.size(); i++) { String age = list.get(i).get("age").toString(); int a = Integer.parseInt(age); if (a <= 0) { continue; } else if (a >= 19 && a < 35) { qcount++; } else if (a >= 36 && a < 59) { zcount++; } else { lcount++; } } Map map = new HashMap(); map.put("qcount", qcount); map.put("zcount", zcount); map.put("lcount", lcount); return R.data(map); } /** * 首页保安公司统计接口 * * @return */ @PostMapping("/SelectCount") public R SelectCount() { //查出所有辖区 List> list = informationService.selJur(); List> lists = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { Map map = new HashMap(); Map mapc = new HashMap(); String id = list.get(i).get("id").toString(); //查出辖区下面所有的子菜单 String childer = informationService.selJurchilder(id); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String substring = strArrays.substring(0, strArrays.length() - 1); List> maps = informationService.seleJuList(substring); mapc.put("confess", maps.get(0).get("num")); mapc.put("staff", maps.get(1).get("num")); mapc.put("security", maps.get(2).get("num")); mapc.put("armed", maps.get(3).get("num")); mapc.put("region", maps.get(4).get("num")); map.put("name", list.get(i).get("deptname")); map.put("server", mapc); lists.add(map); } return R.data(lists); } /** * 首页保安持证统计接口 * * @return */ @PostMapping("/SelectCounthold") public R SelectCounthold() { List> list = informationService.selJur(); List> lists = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { int cznumber = 0;//总的持证数量 int wcznumber = 0;//总的未持证数量 String id = list.get(i).get("id").toString(); //查出辖区下面所有的子菜单 String childer = informationService.selJurchilder(id); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String deptid = strArrays.substring(0, strArrays.length() - 1); Map map = new HashMap(); List> objectStringMap = iDeptService.selectHold(deptid); if (objectStringMap.size() == 0) { map.put("name", list.get(i).get("deptname")); map.put("cz", cznumber); map.put("wcz", wcznumber); lists.add(map); } else { for (int c = 0; c < objectStringMap.size(); c++) { String cz = objectStringMap.get(c).get("cz").toString(); cznumber += Integer.valueOf(cz); String wcz = objectStringMap.get(c).get("wcz").toString(); wcznumber += Integer.valueOf(wcz); } map.put("name", list.get(i).get("deptname")); map.put("cz", cznumber); map.put("wcz", wcznumber); lists.add(map); } } return R.data(lists); } /** * 统计保安员表现差的数量 * * @param jurisdiction * @param deptid * @param type 1:当天 2:当月 3:全部 * @return */ @PostMapping("/selectBx") public R selectBx(String jurisdiction, String deptid, String type) { Map map = new HashMap(); Integer count = 0; List> lists = new ArrayList<>(); if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) { List> maps = informationService.selectBx(jurisdiction, deptid, type); for (int i = 0; i < maps.size(); i++) { String num = maps.get(i).get("num").toString(); count += Integer.valueOf(num); } map.put("count", count); map.put("list", maps); lists.add(map); } else { // String childer = informationService.selJurchilder(jurisdiction); // String[] split = childer.split(","); // String strArrays = ""; // for (int j = 0; j < split.length; j++) { // strArrays += "'" + split[j] + "',"; // } // String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> maps = informationService.selectBx(jurisdiction, deptid, type); for (int i = 0; i < maps.size(); i++) { String num = maps.get(i).get("num").toString(); count += Integer.valueOf(num); } map.put("count", count); map.put("list", maps); lists.add(map); } return R.data(lists); } /** * 统计保安员资格异常的数量 * * @param jurisdiction * @param deptid * @param type 1:当天 2:当月 3:全部 * @return */ @PostMapping("/selectExtype") public R selectExtype(String jurisdiction, String deptid, String type) { Map map = new HashMap(); Integer count = 0; List> lists = new ArrayList<>(); if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) { List> maps = informationService.selectExtype(jurisdiction, deptid, type); for (int i = 0; i < maps.size(); i++) { String num = maps.get(i).get("num").toString(); count += Integer.valueOf(num); } map.put("count", count); map.put("list", maps); lists.add(map); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> maps = informationService.selectExtype(jurisdictiond, deptid, type); for (int i = 0; i < maps.size(); i++) { String num = maps.get(i).get("num").toString(); count += Integer.valueOf(num); } map.put("count", count); map.put("list", maps); lists.add(map); } return R.data(lists); } /** * 违规经营 */ @PostMapping("/selectWg") public R selectWg(String jurisdiction) { if (jurisdiction.equals("1372091709474910209") || jurisdiction.equals("") ) { List> list = informationService.selectWg(jurisdiction); List list1 = new ArrayList(); int count = 0; Map map = new HashMap(); for (int i = 0; i < list.size(); i++) { //总数 String znums = list.get(i).get("znum").toString(); int znum = Integer.parseInt(znums); //持证人数 String cznums = list.get(i).get("cznum").toString(); int cznum = Integer.parseInt(cznums); //缴纳社保人数 String sbnums = list.get(i).get("sbnum").toString(); int sbnum = Integer.parseInt(sbnums); //保安总人数为0 if (znum == 0) { continue; } else { int a = znum / 2; if (cznum <= a || sbnum <= a) { count++; list1.add(list.get(i)); } } } map.put("count", count); map.put("list", list1); return R.data(map); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> list = informationService.selectWg(jurisdictiond); List list1 = new ArrayList(); int count = 0; Map map = new HashMap(); for (int i = 0; i < list.size(); i++) { //总数 String znums = list.get(i).get("znum").toString(); int znum = Integer.parseInt(znums); //持证人数 String cznums = list.get(i).get("cznum").toString(); int cznum = Integer.parseInt(cznums); //缴纳社保人数 String sbnums = list.get(i).get("sbnum").toString(); int sbnum = Integer.parseInt(sbnums); //保安总人数为0 if (znum == 0) { continue; } else { int a = znum / 2; if (cznum <= a || sbnum <= a) { count++; list1.add(list.get(i)); } } } map.put("count", count); map.put("list", list1); return R.data(map); } } /** * 经营不善 */ @PostMapping("/selectJy") public R selectJy(String jurisdiction) { if (jurisdiction.equals("1372091709474910209")) { List> list = informationService.selectJy(jurisdiction); List list1 = new ArrayList(); Map map = new HashMap(); int count = 0; for (int i = 0; i < list.size(); i++) { String num = list.get(i).get("fwnum").toString(); int a = Integer.parseInt(num); if (a == 0) { count++; list1.add(list.get(i)); } } map.put("count", count); map.put("List", list1); return R.data(map); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> list = informationService.selectJy(jurisdictiond); List list1 = new ArrayList(); Map map = new HashMap(); int count = 0; for (int i = 0; i < list.size(); i++) { String num = list.get(i).get("fwnum").toString(); int a = Integer.parseInt(num); if (a == 0) { count++; list1.add(list.get(i)); } } map.put("count", count); map.put("List", list1); return R.data(map); } } /** * 有实无名 */ @PostMapping("/selectYs") public R selectYs(String jurisdiction) { if (jurisdiction.equals("1372091709474910209")) { List> list = informationService.selectYs(jurisdiction); List list1 = new ArrayList(); Map map = new HashMap(); int count = 0; for (int i = 0; i < list.size(); i++) { String num = list.get(i).get("znum").toString(); int a = Integer.parseInt(num); if (a == 0) { count++; list1.add(list.get(i)); } } map.put("count", count); map.put("List", list1); return R.data(map); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> list = informationService.selectYs(jurisdictiond); List list1 = new ArrayList(); Map map = new HashMap(); int count = 0; for (int i = 0; i < list.size(); i++) { String num = list.get(i).get("znum").toString(); int a = Integer.parseInt(num); if (a == 0) { count++; list1.add(list.get(i)); } } map.put("count", count); map.put("List", list1); return R.data(map); } } /** * 公司处罚数量统计 */ @PostMapping("/selectCf") public R selectCf(String jurisdiction) { Map map = new HashMap(); Integer count = 0; List> lists = new ArrayList<>(); if (jurisdiction.equals("1372091709474910209")) { List> maps = informationService.selectCf(jurisdiction); map.put("count", maps.size()); return R.data(map); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> maps = informationService.selectCf(jurisdictiond); map.put("count", maps.size()); return R.data(map); } } /** * 单位列表 */ @PostMapping("/selectIn") public R selectIn(String jurisdiction) { if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) { List> maps = informationService.selectIn(jurisdiction); return R.data(maps); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> maps = informationService.selectIn(jurisdictiond); return R.data(maps); } } /** * 公司运营情况进入图表 */ @PostMapping("/selectTb") public R selectTb(String jurisdiction, String enterpriseName, Query query) { if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) { IPage list = informationService.selectTb(Condition.getPage(query), jurisdiction, enterpriseName); return R.data(list); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); IPage list = informationService.selectTb(Condition.getPage(query), jurisdictiond, enterpriseName); return R.data(list); } } /** * 公司经济情况进入图表 */ @PostMapping("/selectJj") public R selectJj(String jurisdiction, String enterpriseName, Query query) { if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) { IPage list = informationService.selectJj(Condition.getPage(query), jurisdiction, enterpriseName); return R.data(list); } else { String childer = informationService.selJurchilder(jurisdiction); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); IPage list = informationService.selectJj(Condition.getPage(query), jurisdictiond, enterpriseName); return R.data(list); } } /** * 业务统计情况 */ @PostMapping("/selectYw") public R selectYw(String jurisdiction, String deptid, String stats, String startTime, String endTime, Query query) { if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) { IPage list = informationService.selectYw(Condition.getPage(query), jurisdiction, deptid, stats, startTime, endTime); return R.data(list); } else { // String childer = informationService.selJurchilder(jurisdiction); // String[] split = childer.split(","); // String strArrays = ""; // for (int j = 0; j < split.length; j++) { // strArrays += "'" + split[j] + "',"; // } // String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); IPage list = informationService.selectYw(Condition.getPage(query), jurisdiction, deptid, stats, startTime, endTime); return R.data(list); } } @PostMapping("/selectPCount") public R selectPCount(String jurisdiction, String deptid) { Map map = new HashMap(); List> lists = new ArrayList<>(); // String childer = informationService.selJurchilder(jurisdiction); // String[] split = childer.split(","); // String strArrays = ""; // for (int j = 0; j < split.length; j++) { // strArrays += "'" + split[j] + "',"; // } Integer pnums = 0; Integer wpnums = 0; if (jurisdiction.equals("1372091709474910209") || "".equals(jurisdiction)) { List> list = informationService.seleP(jurisdiction, deptid); for (int i = 0; i < list.size(); i++) { String pnum = list.get(i).get("pnum").toString(); Integer a = Integer.parseInt(pnum); pnums += a; String wpnum = list.get(i).get("wpnum").toString(); Integer b = Integer.parseInt(wpnum); wpnums += b; } } else { //String jurisdictiond = strArrays.substring(0, strArrays.length() - 1); List> list = informationService.seleP(jurisdiction, deptid); for (int i = 0; i < list.size(); i++) { String pnum = list.get(i).get("pnum").toString(); Integer a = Integer.parseInt(pnum); pnums += a; String wpnum = list.get(i).get("wpnum").toString(); Integer b = Integer.parseInt(wpnum); wpnums += b; } } // Map map1 = informationService.selectPcount(jurisdiction, deptid); // String pnum = map1.get("pnum").toString(); // Integer a = Integer.valueOf(pnum); // Map map2 = informationService.selectWPcount(jurisdiction, deptid); // String wpnum = map2.get("wpnum").toString(); // Integer b = Integer.valueOf(wpnum); map.put("PCount", pnums); map.put("WPCount", wpnums); lists.add(map); return R.data(lists); } /** * 分局预警统计 */ @PostMapping("/selectFj") public R selectFj() { //辖区信息 List> list = informationService.selectJur(); List> lists = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { Integer count = 0; int countwg = 0; int countjy = 0; int countwm = 0; Map map = new HashMap(); //辖区id String id = list.get(i).get("id").toString(); //辖区名称 String jurname = list.get(i).get("dept_name").toString(); String childer = informationService.selJurchilder(id); String[] split = childer.split(","); String strArrays = ""; for (int j = 0; j < split.length; j++) { strArrays += "'" + split[j] + "',"; } String jurisdiction = strArrays.substring(0, strArrays.length() - 1); //保安员表现差预警数量 List> mapbx = informationService.selectBx(jurisdiction, "", ""); for (int ibx = 0; ibx < mapbx.size(); ibx++) { String num = mapbx.get(ibx).get("num").toString(); count += Integer.valueOf(num); } //保安员资格异常的数量 List> mapEx = informationService.selectExtype(jurisdiction, "", ""); for (int iex = 0; iex < mapEx.size(); iex++) { String num = mapEx.get(iex).get("num").toString(); count += Integer.valueOf(num); } List> maps = informationService.seleFj(jurisdiction); for (int z = 0; z < maps.size(); z++) { //违规经营 //总数 String znums = maps.get(z).get("znum").toString(); int znum = Integer.parseInt(znums); //持证人数 String cznums = maps.get(z).get("cznum").toString(); int cznum = Integer.parseInt(cznums); //缴纳社保人数 String sbnums = maps.get(z).get("sbnum").toString(); int sbnum = Integer.parseInt(sbnums); //保安总人数为0 if (znum == 0) { } else { int a = znum / 2; if (cznum <= a || sbnum <= a) { countwg++; } } //经营不善 String num = maps.get(z).get("fwnum").toString(); int a = Integer.parseInt(num); if (a == 0) { countjy++; } //有实无名 String numw = maps.get(z).get("znum").toString(); int aw = Integer.parseInt(numw); if (aw == 0) { countwm++; } } //处罚 List> mapc = informationService.selectCf(jurisdiction); int size = mapc.size(); map.put("Count", count + countjy + countwg + countwm + size); map.put("jurname", jurname); lists.add(map); } return R.data(lists); } @PostMapping("/selectBxc") public R selectBxc(String jurisdiction,String type,Query query) { IPage maps = informationService.selectBxc(Condition.getPage(query), jurisdiction,type); return R.data(maps); } }