btxtgxq-system-city/src/main/java/com/cm/systemcity/controller/datarelease/DataReleaseController.java

1214 lines
58 KiB
Java
Raw Normal View History

package com.cm.systemcity.controller.datarelease;
import com.cm.common.base.AbstractController;
2022-11-03 11:35:52 +08:00
import com.cm.common.component.SecurityComponent;
import com.cm.common.constants.ISystemConstant;
2022-10-11 18:26:30 +08:00
import com.cm.common.exception.ParamsException;
2022-09-06 11:01:29 +08:00
import com.cm.common.exception.SearchException;
2022-11-30 00:37:10 +08:00
import com.cm.common.plugin.oauth.service.user.IUserService;
2022-09-06 11:01:29 +08:00
import com.cm.common.pojo.ListPage;
2022-11-03 11:35:52 +08:00
import com.cm.common.pojo.dtos.department.DepartmentSortDTO;
import com.cm.common.result.ErrorResult;
2022-09-25 13:49:22 +08:00
import com.cm.common.result.SuccessResultData;
2022-09-06 11:01:29 +08:00
import com.cm.common.result.SuccessResultList;
import com.cm.common.utils.DateUtil;
2022-10-11 18:26:30 +08:00
import com.cm.plugin.map.pojo.dto.GridDTO;
import com.cm.systemcity.dao.datarelease.IDataReleaseDao;
2022-09-06 11:01:29 +08:00
import com.cm.systemcity.dao.reportcase.IReportCaseDao;
2022-11-03 11:35:52 +08:00
import com.cm.systemcity.pojo.dtos.community.CommunityDTO;
import com.cm.systemcity.pojo.dtos.communityboss.CommunityBossDTO;
import com.cm.systemcity.pojo.dtos.dict.DictDTO;
2022-09-22 13:50:02 +08:00
import com.cm.systemcity.pojo.dtos.reportcase.CaseStatisticDTO;
2022-09-06 11:01:29 +08:00
import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseAssignDTO;
import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseDTO;
import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseLogDTO;
2022-09-25 13:49:22 +08:00
import com.cm.systemcity.pojo.dtos.userlocation.UserLocationDTO;
2022-11-03 11:35:52 +08:00
import com.cm.systemcity.service.bindingdepartment.IBindingDepartmentService;
import com.cm.systemcity.service.community.ICommunityService;
import com.cm.systemcity.service.communityboss.ICommunityBossService;
import com.cm.systemcity.service.dict.IDictService;
2022-11-30 00:37:10 +08:00
import com.cm.systemcity.service.grid.IGridService;
2022-09-06 11:01:29 +08:00
import com.cm.systemcity.service.readstate.IReadStateService;
import com.cm.systemcity.service.reportcase.IReportCaseService;
2022-09-25 13:49:22 +08:00
import com.cm.systemcity.service.userlocation.IUserLocationService;
2022-10-11 18:26:30 +08:00
import com.cm.systemcity.service.userpoints.IUserPointsService;
import com.cm.systemcity.utils.BigDataResult;
2022-09-25 13:49:22 +08:00
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
2022-09-06 11:01:29 +08:00
import io.swagger.annotations.*;
2022-10-11 18:26:30 +08:00
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
2022-10-11 18:26:30 +08:00
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 网格治理对外提供数据接口类
* @author xwangs
* @create 2021-07-22 10:50
* @description
*/
@Api(tags = ISystemConstant.API_PREFIX + "网格治理对外提供数据接口类")
@RestController
@RequestMapping(ISystemConstant.APP_PREFIX + "/data-external-release")
public class DataReleaseController extends AbstractController {
@Autowired
private IDataReleaseDao dataReleaseDao;
@Autowired
2022-10-11 18:26:30 +08:00
private MongoTemplate mongoTemplate;
@Autowired
private IDictService dictService;
2022-09-06 11:01:29 +08:00
@Autowired
private IReportCaseService reportCaseService;
2022-09-25 13:49:22 +08:00
@Autowired
private IUserLocationService userLocationService;
2022-10-11 18:26:30 +08:00
@Autowired
private IUserPointsService userPointsService;
2022-11-03 11:35:52 +08:00
@Autowired
private ICommunityService communityService;
@Autowired
private ICommunityBossService communityBossService;
@Autowired
private IBindingDepartmentService bindingDepartmentService;
2022-11-30 00:37:10 +08:00
@Autowired
private IGridService gridService;
/**
* 大数据网格详情页接口
*/
@GetMapping("get-big-data-grid-detail")
public Map<String, Object> listBigDataGridDetail(){
Map<String, Object> query = requestParams();
Map<String, Object> res = new HashMap<>(8);
if(query.get("gridId") == null || "".equals(query.get("gridId").toString())){
return res;
}
String gridId = query.get("gridId").toString();
// 查询网格信息
com.cm.systemcity.pojo.dtos.grid.GridDTO gridDTO = gridService.get(gridId);
res.put("gridInfo", gridDTO);
// 查询网格内所有网格员或专管员
List<Map<String, Object>> gridUserList = dataReleaseDao.listUserByGridId(gridId);
for(Map<String, Object> item : gridUserList){
// 判断用户是否为专管员
String userId = item.get("userId").toString();
Map<String, Object> roleObj = dataReleaseDao.getUserRoleForCheckNPerson(userId);
item.put("deptOrCommunity", "");
item.put("reportCaseNum", "0");
item.put("handleCaseNum", "0");
if(roleObj != null){
// 专管员
List<Map<String, Object>> usersDept = dataReleaseDao.listDepartmentByUserId(userId);
String deptNames = "";
for(Map<String, Object> deptItem : usersDept){
if("".equals(deptNames)){
deptNames += deptItem.get("departmentName").toString();
} else{
deptNames += "," + deptItem.get("departmentName").toString();
}
}
item.put("deptOrCommunity", deptNames);
// 查询案件信息
item.put("reportCaseNum", "-");
List<Map<String, Object>> handleCaseNum = dataReleaseDao.listHandleCaseByUserId(userId);
item.put("handleCaseNum", handleCaseNum.size());
} else {
// 网格员
query.put("communityBossUserId", userId);
CommunityBossDTO communityBoss = communityBossService.getCommunityBoss(query);
query.put("communityId", communityBoss.getCommunityId());
CommunityDTO community = communityService.getCommunity(query);
String deptOrCommunity = "";
deptOrCommunity += communityBoss.getAreaName();
if(community != null){
deptOrCommunity += "/" + community.getCommunityName();
}
item.put("deptOrCommunity", deptOrCommunity);
// 查询案件信息
query.put("creator", userId);
List<Map<String, Object>> listReport = dataReleaseDao.listReportCase(query);
item.put("reportCaseNum", listReport.size());
List<Map<String, Object>> handleCaseNum = dataReleaseDao.listHandleCaseByUserId(userId);
item.put("handleCaseNum", handleCaseNum.size());
}
}
res.put("gridUser", gridUserList == null ? new ArrayList<>(0) : gridUserList);
return res;
}
2022-11-03 11:35:52 +08:00
/**
* 大数据二级页面-地图大网格
*/
@GetMapping("list-big-data-map-grid")
public List<Map<String, Object>> listBigDataMapGrid(){
Map<String, Object> query = new HashMap<>(8);
List<Map<String, Object>> resList = new ArrayList<>(0);
List<String> gridIds = new ArrayList<>(0);
// 万水泉街道网格一
gridIds.add("9074df15-de5b-42d1-ae08-d8207b26a2d7");
// 万水泉街道网格二
gridIds.add("cea3a6af-f67f-4cdf-9c50-a28479d72ac5");
// 稀土路街道网格(稀土)
gridIds.add("6901b73b-7ace-4fd6-9977-20ec85166bbe");
// 希望工业园区网格(民馨路)
gridIds.add("99bb2615-907e-466d-96c5-093b6ef3333a");
for(String gridId : gridIds){
query.put("gridId", gridId);
List<Map<String, Object>> gridList = dataReleaseDao.listMapGrid(query);
for(Map<String, Object> grid : gridList){
Map<String, Object> temp = new HashMap<>(8);
temp.put("gridColor", grid.get("fill_color").toString());
temp.put("gridName", grid.get("grid_name").toString());
List<Map<String, Object>> pointList = dataReleaseDao.listMapGridPoint(query);
temp.put("gridPointList", pointList);
if(gridId.equals("9074df15-de5b-42d1-ae08-d8207b26a2d7")
|| gridId.equals("cea3a6af-f67f-4cdf-9c50-a28479d72ac5")){
// 案件数-万水泉
query.put("areaId", "8d62a0cc-2c15-4355-906c-6720f8f3617e");
List<Map<String, Object>> reportCaseList = dataReleaseDao.listReportCase(query);
temp.put("reportCount", reportCaseList.size());
// 网格员数
List<Map<String, Object>> communityBossList = dataReleaseDao.countOfCommunityBoss(query);
temp.put("sysUserCount", communityBossList.size());
// 小区数
query.put("areaId", "752237");
List<Map<String, Object>> districtList = dataReleaseDao.listDistrict(query);
temp.put("districtCount", districtList.size());
// 房屋数
// 人口数
query.put("areaParentId", "752237");
Integer populationCount = dataReleaseDao.countOfBasePopulation(query);
temp.put("populationCount", populationCount);
resList.add(temp);
}
if(gridId.equals("6901b73b-7ace-4fd6-9977-20ec85166bbe")){
// 案件数-稀土
query.put("areaId", "7ed23f06-566d-43b7-acd9-4f0b5db08974");
List<Map<String, Object>> reportCaseList = dataReleaseDao.listReportCase(query);
temp.put("reportCount", reportCaseList.size());
// 网格员数
List<Map<String, Object>> communityBossList = dataReleaseDao.countOfCommunityBoss(query);
temp.put("sysUserCount", communityBossList.size());
// 小区数
query.put("areaId", "752235");
List<Map<String, Object>> districtList = dataReleaseDao.listDistrict(query);
temp.put("districtCount", districtList.size());
// 房屋数
// 人口数
query.put("areaParentId", "752235");
Integer populationCount = dataReleaseDao.countOfBasePopulation(query);
temp.put("populationCount", populationCount);
resList.add(temp);
}
if(gridId.equals("99bb2615-907e-466d-96c5-093b6ef3333a")){
// 案件数-民馨
query.put("areaId", "6e922367-f21f-4daf-b38c-c55a67d9a35b");
List<Map<String, Object>> reportCaseList = dataReleaseDao.listReportCase(query);
temp.put("reportCount", reportCaseList.size());
// 网格员数
List<Map<String, Object>> communityBossList = dataReleaseDao.countOfCommunityBoss(query);
temp.put("sysUserCount", communityBossList.size());
// 小区数
query.put("areaId", "752236");
List<Map<String, Object>> districtList = dataReleaseDao.listDistrict(query);
temp.put("districtCount", districtList.size());
// 房屋数
// 人口数
query.put("areaParentId", "752236");
Integer populationCount = dataReleaseDao.countOfBasePopulation(query);
temp.put("populationCount", populationCount);
resList.add(temp);
}
}
}
return resList;
}
/**
* 大数据地图二级页面-定位-查询当日人员定位
*/
@GetMapping("list-user-location")
public List<Map<String, Object>> listUserLocation(){
Map<String, Object> query = requestParams();
if(query.get("nodeIds") == null || "".equals(query.get("nodeIds").toString())){
return new ArrayList<>(0);
}
List<Map<String, Object>> resList = new ArrayList<>(0);
String nodeIdStr = query.get("nodeIds").toString();
String[] nodeIds = nodeIdStr.split(",");
for(String userId : nodeIds){
query.put("userId", userId);
Map<String, Object> location = dataReleaseDao.getLastUserLocationInfo(query);
if(location != null){
Map<String, Object> temp = new HashMap<>(8);
temp.put("lastPointTime", location.get("gmt_create").toString().substring(0,19));
temp.put("lng", location.get("user_longitude").toString());
temp.put("lat", location.get("user_latitude").toString());
temp.put("userName", location.get("user_name").toString());
temp.put("userAvatar", location.get("user_avatar").toString());
temp.put("userPhone", location.get("user_phone").toString());
temp.put("userAccount", location.get("user_username").toString());
resList.add(temp);
}
}
return resList;
}
/**
* 大数据地图二级页面-点击案件类型获取案件点位地点等信息
*/
@GetMapping("list-report-info-by-case-id")
public List<Map<String, Object>> listReportInfoByCaseId(){
Map<String, Object> query = requestParams();
if(query.get("nodeIds") == null || "".equals(query.get("nodeIds").toString())){
return new ArrayList<>(0);
}
query.put("caseTypeId", query.get("nodeIds").toString());
// 仅查询 待转派 待处理 的案件
query.put("caseStatus", "2,3");
List<Map<String, Object>> resList = new ArrayList<>(0);
List<Map<String, Object>> list = dataReleaseDao.listReportCase(query);
for(Map<String, Object> item : list){
Map<String, Object> temp = new HashMap<>(8);
temp.put("reportCaseId", item.get("report_case_id"));
temp.put("text", item.get("case_content"));
temp.put("lng", item.get("case_longitude"));
temp.put("lat", item.get("case_latitude"));
temp.put("reportTime", item.get("gmt_create").toString().substring(0,19));
temp.put("caseStatus", item.get("case_status"));
temp.put("caseTypeName", item.get("case_type_name"));
resList.add(temp);
}
return resList;
}
/**
* 大数据地图二级页面-案件类型树
*/
@GetMapping("list-tree-all-case-type")
public List<Map<String, Object>> listTreeAllCaseType(){
Map<String, Object> query = new HashMap<>(8);
List<Map<String, Object>> resList= new ArrayList<>(0);
// 顶级节点
query.put("dictParentId","46d108b2-4ef9-4f6f-b30c-0c700e3ee852");
List<DictDTO> topList = dictService.listDict(query);
for(DictDTO item : topList){
Map<String, Object> topNode = new HashMap<>(8);
topNode.put("lable", item.getDictName());
topNode.put("nodeTag", "top");
topNode.put("nodeId", item.getDictId());
List<Map<String, Object>> caseTypeList = new ArrayList<>(0);
topNode.put("children", caseTypeList);
// 查询案件子类型列表
query.put("dictParentId",item.getDictId());
List<DictDTO> childrenList = dictService.listDict(query);
for(DictDTO children : childrenList){
Map<String, Object> childrenNode = new HashMap<>(8);
childrenNode.put("nodeTag", "caseType");
childrenNode.put("nodeId", children.getDictId());
childrenNode.put("lable", children.getDictName());
childrenNode.put("children", new ArrayList<>());
caseTypeList.add(childrenNode);
}
resList.add(topNode);
}
return resList;
}
/**
* 大数据地图二级页面-点击节点查询网格
*/
@GetMapping("list-map-grid")
public List<Map<String, Object>> listMapGrid(){
List<Map<String, Object>> mapGridResult = new ArrayList<>(0);
String street = "street";
String community = "community";
String dept = "dept";
String user = "user";
Map<String, Object> query = requestParams();
Map<String, Object> param = new HashMap<>(8);
// 如果没传该参数, 则返回大网格
if(query.get("nodeTag") == null
|| "top".equals(query.get("nodeTag").toString())
|| "".equals(query.get("nodeTag").toString())){
// 放入高新区大网格
List<String> gridIds = new ArrayList<>(0);
// 万水泉街道网格一
gridIds.add("9074df15-de5b-42d1-ae08-d8207b26a2d7");
// 万水泉街道网格二
gridIds.add("cea3a6af-f67f-4cdf-9c50-a28479d72ac5");
// 稀土路街道网格
gridIds.add("6901b73b-7ace-4fd6-9977-20ec85166bbe");
// 希望工业园区网格
gridIds.add("99bb2615-907e-466d-96c5-093b6ef3333a");
for(String gridId : gridIds){
param.clear();
param.put("gridId", gridId);
List<Map<String, Object>> gridList = dataReleaseDao.listMapGrid(param);
for(Map<String, Object> grid : gridList){
Map<String, Object> temp = new HashMap<>(8);
temp.put("gridId", grid.get("grid_id").toString());
temp.put("gridName", grid.get("grid_name").toString());
temp.put("gridColor", grid.get("fill_color").toString());
// 放入当前网格的边界点
param.put("gridId", grid.get("grid_id").toString());
List<Map<String, Object>> pointList = dataReleaseDao.listMapGridPoint(param);
temp.put("gridPointList", pointList);
mapGridResult.add(temp);
}
}
return mapGridResult;
}
String nodeTag = query.get("nodeTag").toString();
// 点击街道
if(street.equals(nodeTag)){
String nodeId;
try {
nodeId = query.get("nodeId").toString();
} catch (Exception e){
// 没传ID返回空内容
return mapGridResult;
}
param.put("areaId", nodeId);
List<CommunityDTO> communityList = communityService.listCommunity(param);
for (CommunityDTO item : communityList){
param.clear();
param.put("areaCode", item.getCommunityId());
// 到map_grid表中查询网格
List<Map<String, Object>> gridList = dataReleaseDao.listMapGrid(param);
for(Map<String, Object> grid : gridList){
Map<String, Object> temp = new HashMap<>(8);
temp.put("gridId", grid.get("grid_id").toString());
temp.put("gridName", grid.get("grid_name").toString());
temp.put("gridColor", grid.get("fill_color").toString());
// 放入当前网格的边界点 。。。。
param.put("gridId", grid.get("grid_id").toString());
List<Map<String, Object>> pointList = dataReleaseDao.listMapGridPoint(param);
temp.put("gridPointList", pointList);
mapGridResult.add(temp);
}
}
return mapGridResult;
}
// 点击社区
if(community.equals(nodeTag)){
String nodeId;
try {
nodeId = query.get("nodeId").toString();
} catch (Exception e){
// 没传ID返回空内容
return mapGridResult;
}
param.put("areaCode", nodeId);
// 到map_grid表中查询网格
List<Map<String, Object>> gridList = dataReleaseDao.listMapGrid(param);
for(Map<String, Object> grid : gridList){
param.clear();
Map<String, Object> temp = new HashMap<>(8);
temp.put("gridId", grid.get("grid_id").toString());
temp.put("gridName", grid.get("grid_name").toString());
temp.put("gridColor", grid.get("fill_color").toString());
// 放入当前网格的边界点
param.put("gridId", grid.get("grid_id").toString());
List<Map<String, Object>> pointList = dataReleaseDao.listMapGridPoint(param);
temp.put("gridPointList", pointList);
mapGridResult.add(temp);
}
return mapGridResult;
}
// 点击部门
if(dept.equals(nodeTag)){
String nodeId;
try {
nodeId = query.get("nodeId").toString();
} catch (Exception e){
// 没传ID返回空内容
return mapGridResult;
}
param.put("departmentId", nodeId);
Map<String, Object> deptObj = dataReleaseDao.getDepartment(param);
String deptName = deptObj.get("department_name").toString();
// 画网格时专管员部门列表取的是city_community表中新建的数据
// 需要根据专管单位名称查询sys_department表中的部门ID, 根据部门ID取到该部门下所有专管员的所有网格
param.put("communityName", deptName);
List<Map<String, Object>> communityInfo = dataReleaseDao.getCommunityInfo(param);
for (Map<String, Object> item : communityInfo){
param.clear();
String communityId = item.get("community_id").toString();
param.put("areaCode", communityId);
// 到map_grid表中查询网格
List<Map<String, Object>> gridList = dataReleaseDao.listMapGrid(param);
for(Map<String, Object> grid : gridList){
Map<String, Object> temp = new HashMap<>(8);
temp.put("gridId", grid.get("grid_id").toString());
temp.put("gridName", grid.get("grid_name").toString());
temp.put("gridColor", grid.get("fill_color").toString());
// 放入当前网格的边界点
param.put("gridId", grid.get("grid_id").toString());
List<Map<String, Object>> pointList = dataReleaseDao.listMapGridPoint(param);
temp.put("gridPointList", pointList);
mapGridResult.add(temp);
}
}
return mapGridResult;
}
// 点击用户
if(user.equals(nodeTag)){
String nodeId;
try {
nodeId = query.get("nodeId").toString();
} catch (Exception e){
// 没传ID返回空内容
return mapGridResult;
}
param.put("relationId", nodeId);
List<Map<String, Object>> relationList = dataReleaseDao.listMapGridRelation(param);
for(Map<String, Object> relation : relationList){
param.clear();
String gridId = relation.get("grid_id").toString();
param.put("gridId", gridId);
List<Map<String, Object>> gridList = dataReleaseDao.listMapGrid(param);
for(Map<String, Object> grid : gridList){
Map<String, Object> temp = new HashMap<>(8);
temp.put("gridId", grid.get("grid_id").toString());
temp.put("gridName", grid.get("grid_name").toString());
temp.put("gridColor", grid.get("fill_color").toString());
// 放入当前网格的边界点
param.put("gridId", grid.get("grid_id").toString());
List<Map<String, Object>> pointList = dataReleaseDao.listMapGridPoint(param);
temp.put("gridPointList", pointList);
mapGridResult.add(temp);
}
}
return mapGridResult;
}
return mapGridResult;
}
/**
* 大数据地图二级页面-网格-专管单位
* @return
*/
@GetMapping("list-tree-all-dept-grid")
public List<Map<String, Object>> listTreeAllDeptGrid(){
Map<String, Object> query = requestParams();
List<Map<String, Object>> resList= new ArrayList<>(0);
// 顶级节点
Map<String, Object> topNode = new HashMap<>(8);
topNode.put("nodeTag", "top");
topNode.put("nodeId", "");
topNode.put("lable", "专管单位");
List<Map<String, Object>> deptNodeList = new ArrayList<>(0);
topNode.put("children", deptNodeList);
// 专管单位节点
List<DepartmentSortDTO> departmentSortDTOs = bindingDepartmentService.listDepartmentForMainPanel(query);
for(DepartmentSortDTO item : departmentSortDTOs){
Map<String, Object> deptNode = new HashMap<>(8);
deptNode.put("nodeTag", "dept");
deptNode.put("nodeId", item.getDepartmentId());
deptNode.put("lable", item.getDepartmentName());
List<Map<String, Object>> userNodeList = new ArrayList<>(0);
deptNode.put("children", userNodeList);
deptNodeList.add(deptNode);
// 查询专管员
query.put("departmentId", item.getDepartmentId());
List<Map<String, Object>> userList = bindingDepartmentService.listNPerson(query);
for(Map<String, Object> user : userList){
Map<String, Object> userNode = new HashMap<>(8);
userNode.put("nodeId", user.get("userId") == null ? "缺失" : user.get("userId").toString());
userNode.put("lable", user.get("userName") == null ? "缺失" : user.get("userName").toString());
userNode.put("nodeTag", "user");
userNode.put("children", new ArrayList<>(0));
userNodeList.add(userNode);
}
}
resList.add(topNode);
return resList;
}
/**
* 大数据地图二级页面-网格-所有网格
* @return
*/
@GetMapping("list-tree-all-normal-grid")
public List<Map<String, Object>> listTreeAllNormalGrid(){
Map<String, Object> query = requestParams();
List<Map<String, Object>> resList= new ArrayList<>(0);
// 顶级节点
Map<String, Object> topNode = new HashMap<>(8);
topNode.put("lable", "所有网格");
topNode.put("nodeTag", "top");
topNode.put("nodeId", "");
List<Map<String, Object>> streetNodeList = new ArrayList<>(0);
topNode.put("children", streetNodeList);
// 街道节点
query.put("dictParentId", "9d179f05-3ea0-48f7-853c-d3b7124b791c");
List<DictDTO> streetList = dictService.listDict(query);
for(DictDTO item : streetList){
String dictName = item.getDictName();
if("专管员区域".equals(dictName)){
continue;
}
Map<String, Object> streetNode = new HashMap<>(8);
streetNode.put("lable", dictName);
streetNode.put("nodeTag", "street");
streetNode.put("nodeId", item.getDictId());
List<Map<String, Object>> communityNodeList = new ArrayList<>(0);
streetNode.put("children", communityNodeList);
streetNodeList.add(streetNode);
// 社区节点
query.put("areaId", item.getDictId());
List<CommunityDTO> communityDTOS = communityService.listCommunity(query);
for(CommunityDTO item2 : communityDTOS){
Map<String, Object> communityNode = new HashMap<>(8);
communityNode.put("lable", item2.getCommunityName());
communityNode.put("nodeTag", "community");
communityNode.put("nodeId", item2.getCommunityId());
List<Map<String, Object>> userNodeList = new ArrayList<>(0);
communityNode.put("children", userNodeList);
communityNodeList.add(communityNode);
// 查询网格员
query.put("communityId", item2.getCommunityId());
List<CommunityBossDTO> gridUser = communityBossService.listGridUser(query);
for(CommunityBossDTO user : gridUser){
Map<String, Object> userNode = new HashMap<>(8);
userNode.put("lable", user.getCommunityBossName());
userNode.put("nodeTag", "user");
userNode.put("nodeId", user.getCommunityBossUserId());
userNode.put("children", new ArrayList<>(0));
userNode.put("areaId", item.getDictId());
userNode.put("communityId", item2.getCommunityId());
userNodeList.add(userNode);
}
}
}
resList.add(topNode);
return resList;
}
2022-10-11 18:26:30 +08:00
@GetMapping("repair-data")
public void repairData(){
// 更新地图左侧人员树缓存
mongoTemplate.remove(new Query(), "INDEX_PANEL_GRID_TREE");
}
@ApiOperation(value = "案件情况-数量", notes = "案件情况-数量")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-case-report-count-info")
public BigDataResult getCaseReportCountInfo(){
Map<String,Object> reqParams = requestParams();
// 判断获取哪类案件的标识
if(reqParams.get("dataCatalog") == null && reqParams.get("dataCatalog").toString().length() == 0){
return new BigDataResult();
}
String dataCatalog = reqParams.get("dataCatalog").toString();
// dept职能部门案件 street街镇案件 person群众上报 special特殊案件
// {type:'up',value:98625,percentage:15.6}
BigDataResult bdr = new BigDataResult();
Map<String, Object> query = new HashMap<>(8);
Map<String, Object> bdrData = new HashMap<>(8);
bdrData.put("value",0);
bdrData.put("type","up");
bdrData.put("percentage","0");
String nowMonth = DateUtil.getDay().substring(0,7);
String lastMonth = bdr.lastMonth();
query.put("caseStatus","6");
query.put("dataCatalog",dataCatalog);
switch (dataCatalog){
case "dept" :
List<Map<String, Object>> deptList = dataReleaseDao.listReportCase(query);
bdrData.put("value",deptList.size());
// 本月数据
query.put("gmtModified", nowMonth);
List<Map<String, Object>> nowMonthList = dataReleaseDao.listReportCase(query);
// 上月数据
query.put("gmtModified", lastMonth);
List<Map<String, Object>> lastMonthList = dataReleaseDao.listReportCase(query);
bdrData.put("type" ,nowMonthList.size() - lastMonthList.size() >= 0 ? "up" : "down");
bdrData.put("percentage", Math.abs(nowMonthList.size() - lastMonthList.size()) + "");
break;
case "street" :
List<Map<String, Object>> streetList = dataReleaseDao.listReportCase(query);
bdrData.put("value",streetList.size());
// 本月数据
query.put("gmtModified", nowMonth);
List<Map<String, Object>> nowMonthStreetList = dataReleaseDao.listReportCase(query);
// 上月数据
query.put("gmtModified", lastMonth);
List<Map<String, Object>> lastMonthStreetList = dataReleaseDao.listReportCase(query);
bdrData.put("type" ,nowMonthStreetList.size() - lastMonthStreetList.size() >= 0 ? "up" : "down");
bdrData.put("percentage", Math.abs(nowMonthStreetList.size() - lastMonthStreetList.size()) + "");
break;
case "person" :
List<Map<String, Object>> personList = dataReleaseDao.listReportCase(query);
bdrData.put("value",personList.size());
// 本月数据
query.put("gmtModified", nowMonth);
List<Map<String, Object>> nowMonthPersonList = dataReleaseDao.listReportCase(query);
// 上月数据
query.put("gmtModified", lastMonth);
List<Map<String, Object>> lastMonthPersonList = dataReleaseDao.listReportCase(query);
bdrData.put("type" ,nowMonthPersonList.size() - lastMonthPersonList.size() >= 0 ? "up" : "down");
bdrData.put("percentage", Math.abs(nowMonthPersonList.size() - lastMonthPersonList.size()) + "");
break;
case "special" :
List<Map<String, Object>> specialList = dataReleaseDao.listSpecialReportCase(query);
bdrData.put("value",specialList.size());
// 本月数据
query.put("gmtModified", nowMonth);
List<Map<String, Object>> nowMonthSpecialList = dataReleaseDao.listSpecialReportCase(query);
// 上月数据
query.put("gmtModified", lastMonth);
List<Map<String, Object>> lastMonthSpecialList = dataReleaseDao.listSpecialReportCase(query);
bdrData.put("type" ,nowMonthSpecialList.size() - lastMonthSpecialList.size() >= 0 ? "up" : "down");
bdrData.put("percentage", Math.abs(nowMonthSpecialList.size() - lastMonthSpecialList.size()) + "");
break;
default:
return bdr;
}
bdr.setData(bdrData);
return bdr;
}
@ApiOperation(value = "各区域案件占比-包含特殊案件量", notes = "各区域案件占比-包含特殊案件量")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-community-report-case")
public BigDataResult getCommunityReportCase(){
// {data:{},list:[{name:'万水泉镇',value:300},{name:'民馨路',value:1200},{name:'稀土路',value:3600}],msg:'加载成功',state:'200'}
Map<String,Object> reqParams = requestParams();
reqParams.put("dictParentId","9d179f05-3ea0-48f7-853c-d3b7124b791c");
List<DictDTO> dictDTOS = dictService.listDict(reqParams);
if(dictDTOS == null || dictDTOS.size() == 0){
return new BigDataResult();
}
List<Map<String, Object>> resList = new ArrayList<>();
for(DictDTO dictItem : dictDTOS){
reqParams.clear();
Map<String, Object> resItem = new HashMap<>(8);
resItem.put("name",dictItem.getDictName());
// 查询该街镇下所有普通案件 已完结
reqParams.put("caseStatus", "6");
reqParams.put("areaId",dictItem.getDictId());
List<Map<String, Object>> normalList = dataReleaseDao.listReportCase(reqParams);
// 查询该街镇下所有特殊案件
/*List<Map<String, Object>> specialList = dataReleaseDao.listSpecialReportCase(reqParams);*/
resItem.put("value",normalList.size());
resList.add(resItem);
}
BigDataResult bdr = new BigDataResult();
bdr.setList(resList);
return bdr;
}
@ApiOperation(value = "案件类型TOP10", notes = "案件类型TOP10")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-case-type-top10")
public BigDataResult getCaseTypeTop10(){
// {data:{nameColumns:['案件数量']},list:[{name:'餐厨垃圾',columns:[3]},{name:'污水管网及井盖养护',columns:[0]},{name:'暂住人口问题',columns:[5]},
// {name:'道路交通设施',columns:[5]},{name:'人行道维修养护',columns:[25]}],msg:'加载成功',state:'200'}
Map<String,Object> reqParams = requestParams();
List<Map<String, Object>> caseTypeList = dataReleaseDao.getCaseTypeTop10(reqParams);
if(caseTypeList == null || caseTypeList.size() == 0){
return new BigDataResult();
}
List<Map<String, Object>> resList = new ArrayList<>();
for(Map<String, Object> caseTypeItem : caseTypeList){
Map<String, Object> resItem = new HashMap<>(8);
resItem.put("name",caseTypeItem.get("dictName").toString());
List<Integer> columnsList = new ArrayList<>();
columnsList.add(Integer.parseInt(caseTypeItem.get("caseTypeCount").toString()));
resItem.put("columns",columnsList);
resItem.put("caseTypeId",caseTypeItem.get("caseTypeId"));
resList.add(resItem);
}
BigDataResult bdr = new BigDataResult();
Map<String, Object> resData = new HashMap<>(4);
2021-08-07 10:26:15 +08:00
resData.put("nameColumns","案件数量");
bdr.setData(resData);
bdr.setList(resList);
return bdr;
}
@ApiOperation(value = "7日案件进展情况", notes = "7日案件进展情况")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-7day-report-case")
public BigDataResult get7DayReportCase(){
Map<String,Object> reqParams = requestParams();
2022-10-11 18:26:30 +08:00
// 为了避免案件类型没传,单独处理
if(reqParams.get("caseFlowType") == null || "".equals(reqParams.get("caseFlowType").toString().trim())){
reqParams.put("caseFlowType", "1,2");
}
List<Map<String, Object>> resList = new ArrayList<>();
Map<String, Object> itemMap;
String nowDate = DateUtil.getDay();
2022-10-11 18:26:30 +08:00
String last7Date = DateUtil.getBeforeDate(6,"yyyy-MM-dd");
reqParams.put("startTime",last7Date + " 00:00:00");
reqParams.put("endTime", nowDate + " 23:59:59");
// 受理
2022-10-11 18:26:30 +08:00
/*reqParams.put("caseStatusCompareUp","1");
List<Map<String, Object>> list1 = dataReleaseDao.listReportCase(reqParams);
itemMap = new HashMap<>(4);
itemMap.put("name", "受理");
itemMap.put("value", list1 == null ? 0 : list1.size());
2022-10-11 18:26:30 +08:00
resList.add(itemMap);*/
// 立案
2022-10-11 18:26:30 +08:00
/*reqParams.put("caseStatusCompareUp","2");
List<Map<String, Object>> list2 = dataReleaseDao.listReportCase(reqParams);
itemMap = new HashMap<>(4);
itemMap.put("name", "立案");
itemMap.put("value", list2 == null ? 0 : list2.size());
2022-10-11 18:26:30 +08:00
resList.add(itemMap);*/
// 待下中
reqParams.put("caseStatus","2");
List<Map<String, Object>> list3 = dataReleaseDao.listReportCase(reqParams);
itemMap = new HashMap<>(4);
2022-10-11 18:26:30 +08:00
itemMap.put("name", "下派中");
itemMap.put("value", list3 == null ? 0 : list3.size());
resList.add(itemMap);
// 处理
2022-10-11 18:26:30 +08:00
reqParams.put("caseStatus","3");
List<Map<String, Object>> list4 = dataReleaseDao.listReportCase(reqParams);
itemMap = new HashMap<>(4);
2022-10-11 18:26:30 +08:00
itemMap.put("name", "处理中");
itemMap.put("value", list4 == null ? 0 : list4.size());
resList.add(itemMap);
// 检查
2022-10-11 18:26:30 +08:00
reqParams.put("caseStatus","4");
List<Map<String, Object>> list5 = dataReleaseDao.listReportCase(reqParams);
itemMap = new HashMap<>(4);
2022-10-11 18:26:30 +08:00
itemMap.put("name", "检查中");
itemMap.put("value", list5 == null ? 0 : list5.size());
resList.add(itemMap);
// 归档
2022-10-11 18:26:30 +08:00
reqParams.put("caseStatus","6");
List<Map<String, Object>> list6 = dataReleaseDao.listReportCase(reqParams);
itemMap = new HashMap<>(4);
2022-10-11 18:26:30 +08:00
itemMap.put("name", "已归档");
itemMap.put("value", list6 == null ? 0 : list6.size());
resList.add(itemMap);
BigDataResult bdr = new BigDataResult();
bdr.setList(resList);
return bdr;
}
@ApiOperation(value = "案件处理满意度", notes = "案件处理满意度")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-grade-ratio")
public BigDataResult getGradeRatio(){
Map<String,Object> reqParams = requestParams();
BigDataResult bdr = new BigDataResult();
// {data:{value:96.5},list:[],msg:'加载成功',state:'200'}
reqParams.put("caseStatus","6");
List<Map<String, Object>> gradeList = dataReleaseDao.listReportCase(reqParams);
if(gradeList == null || gradeList.size() == 0){
return new BigDataResult();
}
Integer totalGrade = gradeList.size() * 5;
Integer nowGrade = 0;
for (Map<String, Object> gradeItem : gradeList){
2022-11-03 11:35:52 +08:00
if(gradeItem.get("grade") == null
|| "".equals(gradeItem.get("grade").toString())
|| "null".equals(gradeItem.get("grade").toString())
|| "0".equals(gradeItem.get("grade").toString())
){
2022-11-03 11:35:52 +08:00
nowGrade += 3;
2022-10-11 18:26:30 +08:00
} else {
2022-11-03 11:35:52 +08:00
nowGrade += Integer.parseInt(gradeItem.get("grade").toString());
}
}
BigDecimal ratioBigDecimal = new BigDecimal(( nowGrade.doubleValue() / totalGrade.doubleValue() ) * 100)
.setScale(2,BigDecimal.ROUND_HALF_UP);
//bdr.getRatio(nowGrade.doubleValue(), totalGrade.doubleValue(), 2);
Map<String, Object> resData = new HashMap<>(4);
resData.put("value",ratioBigDecimal.doubleValue());
bdr.setData(resData);
return bdr;
}
2022-10-11 18:26:30 +08:00
@ApiOperation(value = "案件满意度二级列表", notes = "案件满意度二级列表")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-grade-ratio")
public SuccessResultList<List<Map<String, Object>>> listGradeRatio(){
Map<String,Object> params = requestParams();
params.put("caseStatus","6");
List<Map<String, Object>> gradeList = dataReleaseDao.listReportCase(params);
Integer totalGrade = 0;
Integer nowGrade = 0;
totalGrade = gradeList.size() * 5;
for(Map<String, Object> item : gradeList){
item.put("gmt_create", item.get("gmt_create").toString().substring(0,19));
if(item.get("grade") == null
|| "0".equals(item.get("grade").toString())
|| "".equals(item.get("grade").toString())){
nowGrade += 3;
} else {
nowGrade += Integer.parseInt(item.get("grade").toString());
}
}
if(totalGrade == 0){
return new SuccessResultList<>(new ArrayList<>(), 1, 0L);
}
Map<String, Object> totalInfoMap = new HashMap<>(8);
totalInfoMap.put("case_reporter", "合计: " + gradeList.size() + "");
BigDecimal ratioBigDecimal = new BigDecimal(( nowGrade.doubleValue() / totalGrade.doubleValue() ) * 100)
.setScale(2,BigDecimal.ROUND_HALF_UP);
totalInfoMap.put("grade", "总体满意度: " + ratioBigDecimal.doubleValue());
List<Map<String, Object>> resList = new LinkedList<>();
resList.add(totalInfoMap);
for(Map<String, Object> item : gradeList){
resList.add(item);
}
return new SuccessResultList<>(resList, 1, 0L);
}
@ApiOperation(value = "各月份案件情况统计", notes = "各月份案件情况统计")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-month-report-case")
public BigDataResult getMonthReportCase(){
Map<String,Object> reqParams = requestParams();
BigDataResult bdr = new BigDataResult();
2022-10-11 18:26:30 +08:00
Integer year = Integer.parseInt(DateUtil.getYear());
Integer month;
2022-11-03 11:35:52 +08:00
if(DateUtil.getMonth().length() > 1 && "0".equals(DateUtil.getMonth().substring(0,1))){
2022-10-11 18:26:30 +08:00
month = Integer.parseInt(DateUtil.getMonth().replaceAll("0", ""));
} else {
month = Integer.parseInt(DateUtil.getMonth());
}
List<String> monthList = new ArrayList<>();
2022-10-11 18:26:30 +08:00
for(int i = 0; i < 12; i++){
if(month - i == 0){
monthList.add((year - 1) + "-" + 12);
continue;
}
2022-10-11 18:26:30 +08:00
if(month - i < 0){
monthList.add((year -1) + "-" + (12 + (month - i)));
continue;
}
monthList.add(year + "-" + (month - i));
}
2022-10-11 18:26:30 +08:00
List<Map<String, Object>> resList = new ArrayList<>();
for(String str : monthList){
Map<String, Object> resMap = new HashMap<>(8);
String queryTime = str.length() == 6 ? str.replace("-", "-0") : str;
reqParams.put("gmtCreateLike", queryTime);
List<Map<String, Object>> list = dataReleaseDao.listReportCase(reqParams);
2022-10-11 18:26:30 +08:00
resMap.put("name", queryTime);
resMap.put("value", list == null ? 0 : list.size());
resList.add(resMap);
}
bdr.setList(resList);
return bdr;
}
@ApiOperation(value = "案件动态", notes = "案件动态")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-report-case-dynamic")
public BigDataResult getReportCaseDynamic(){
Map<String,Object> reqParams = requestParams();
// {title:'万水泉 ',content:'村名王某因为被隔壁邻居的狗咬了,产生了纠纷,村名报警。',date:'2021-03-15'}
// 默认查询10条
List<Map<String, Object>> logList = dataReleaseDao.listReportCaseLog(reqParams);
if(logList == null || logList.size() == 0){
return new BigDataResult();
}
List<Map<String, Object>> resList = new ArrayList<>();
for (Map<String, Object> logItem : logList){
Map<String, Object> resData = new HashMap<>(8);
resData.put("title", "" + logItem.get("optionType").toString() + "】- " + logItem.get("userName").toString());
resData.put("date", logItem.get("gmtCreate").toString().substring(0,19));
resData.put("content", logItem.get("caseContent").toString());
2022-11-03 11:35:52 +08:00
resData.put("caseNumber", logItem.get("caseNumber").toString());
resList.add(resData);
}
BigDataResult bdr = new BigDataResult();
bdr.setList(resList);
return bdr;
}
@ApiOperation(value = "人员实时活跃情况", notes = "人员实时活跃情况")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("get-user-dynamic-position")
public BigDataResult getUserDynamicPosition(){
Map<String,Object> reqParams = requestParams();
Date nowData = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("HH");
String nowHour = sdf.format(nowData);
//nowHour = "10";
String nowDate = DateUtil.getDay() + " ";
//nowDate = "2021-07-19 ";
System.out.println(nowHour);
List<Map<String, Object>> resList = new ArrayList<>();
// 分割当前小时为6段 10分钟一段 统计活跃人数 最后一段统计59分59秒
for(int i = 0; i < 6; i++){
Map<String, Object> resData = new HashMap<>(8);
Map<String, Object> query = new HashMap<>(8);
if(i == 0){
query.put("timeStr",nowDate + nowHour + ":00:00");
} else {
query.put("timeStr",nowDate + nowHour + ":" + (i * 10) + ":00");
}
if(i == 5){
query.put("timeEnd",nowDate + nowHour + ":59:59");
query.put("time", nowHour + ":59");
resData.put("time", nowHour + ":59");
} else {
query.put("timeEnd",nowDate + nowHour + ":" + (i + 1) * 10 + ":00");
query.put("time", nowHour + ":" + (i + 1) * 10);
resData.put("time", nowHour + ":" + (i + 1) * 10);
}
List<Map<String, Object>> positionList = dataReleaseDao.listUserDynamicPosition(query);
resData.put("value", positionList == null ? 0 : positionList.size());
resList.add(resData);
}
BigDataResult bdr = new BigDataResult();
bdr.setList(resList);
return bdr;
}
2022-09-06 11:01:29 +08:00
/**
* 查询街道信息 city_dict表
*/
@GetMapping("get-area-info-city-dict")
public List<Map<String, Object>> getAreaInfo(){
Map<String, Object> param = requestParams();
if(param.get("dictParentId") == null || "".equals(param.get("dictParentId").toString())){
return new ArrayList<>(0);
}
List<Map<String, Object>> list = dataReleaseDao.getAreaInfoFromCityDict(param);
return list;
}
/**
* 查询社区信息 city_community表
*/
@GetMapping("get-community-info")
public List<Map<String, Object>> getCommunityInfo(){
Map<String, Object> param = requestParams();
if(param.get("areaId") == null || "".equals(param.get("areaId").toString())){
return new ArrayList<>(0);
}
List<Map<String, Object>> list = dataReleaseDao.getCommunityInfo(param);
return list;
}
/**
* 查询社区信息 案件查询
*/
@GetMapping("list-page-report-case")
public SuccessResultList<List<ReportCaseDTO>> listPageReportCase(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
// 为了避免案件类型没传,单独处理
if(params.get("caseFlowType") == null || "".equals(params.get("caseFlowType").toString().trim())){
params.put("caseFlowType", "1,2");
}
2022-09-06 11:01:29 +08:00
page.setParams(params);
SuccessResultList<List<ReportCaseDTO>> resList = reportCaseService.listPageReportCase(page);
return resList;
}
2022-10-11 18:26:30 +08:00
/**
* 7日案件进展情况列表
*/
@GetMapping("list-page-7day-report-case")
public SuccessResultList<List<ReportCaseDTO>> listPage7DayReportCase(ListPage page) throws SearchException {
Map<String, Object> params = requestParams();
// 为了避免案件类型没传,单独处理
if(params.get("caseFlowType") == null || "".equals(params.get("caseFlowType").toString().trim())){
params.put("caseFlowType", "1,2");
}
// 查询7天内的数据
if(params.get("startTime") == null && params.get("endTime") == null){
String startTime = DateUtil.getBeforeDate(6, "yyyy-MM-dd");
String endTime = DateUtil.getDay();
params.put("startTime", startTime);
params.put("endTime", endTime);
}
// 案件状态没传情况
if(params.get("caseStatus") == null || "".equals(params.get("caseStatus").toString())){
params.put("caseStatus", "2,3,4,5,6");
}
page.setParams(params);
SuccessResultList<List<ReportCaseDTO>> resList = reportCaseService.listPageReportCase(page);
return resList;
}
2022-09-06 11:01:29 +08:00
/**
* 查看案件详情
*/
@GetMapping("get-report-case-detail/{reportCaseId}")
public ReportCaseDTO getReportCaseDetail(@PathVariable("reportCaseId") String reportCaseId) throws SearchException {
Map<String, Object> params = getParams();
params.put("reportCaseId", reportCaseId);
ReportCaseDTO reportCaseDTO = reportCaseService.getReportCase(params);
return reportCaseDTO;
}
2022-11-03 11:35:52 +08:00
@GetMapping("get-report-case-by-number/{caseNumber}")
public ReportCaseDTO getReportCaseByCaseNumber(@PathVariable("caseNumber") String caseNumber) throws SearchException {
Map<String, Object> params = getParams();
params.put("caseNumber", caseNumber);
ReportCaseDTO reportCaseDTO = reportCaseService.getReportCase(params);
return reportCaseDTO;
}
2022-09-06 11:01:29 +08:00
/**
* 案件日志
*/
@GetMapping("list-report-case-log/{reportCaseId}")
public List<ReportCaseLogDTO> listReportCaseLog(@PathVariable("reportCaseId") String reportCaseId) throws SearchException {
Map<String, Object> params = requestParams();
params.put("caseId", reportCaseId);
return reportCaseService.listReportCaseLog(params);
}
@GetMapping("list-case-in-map")
public BigDataResult listCaseInMap(){
BigDataResult bdr = new BigDataResult();
List<Map<String, String>> resList = new ArrayList<>();
Map<String, Object> query = requestParams();
String startTime = DateUtil.getAfterDayDate("-60");
String endTime = DateUtil.getDay();
query.put("startTime", startTime);
query.put("endTime", endTime);
List<Map<String, Object>> caseList = dataReleaseDao.listCaseInMap(query);
for(Map<String, Object> item : caseList){
if(item.get("case_longitude") != null && item.get("case_latitude") != null){
Map<String, String> resObj = new HashMap<>(8);
resObj.put("gmtCreate", item.get("gmt_create").toString().substring(0,19));
resObj.put("long", item.get("case_longitude").toString());
resObj.put("lat", item.get("case_latitude").toString());
resObj.put("text", item.get("case_content") == null ? "" : item.get("case_content").toString());
2022-10-11 18:26:30 +08:00
resObj.put("reportCaseId", item.get("report_case_id") == null ? "" : item.get("report_case_id").toString());
resObj.put("caseReporter", item.get("case_reporter") == null ? "" : item.get("case_reporter").toString());
2022-09-06 11:01:29 +08:00
resList.add(resObj);
}
}
bdr.setList(resList);
return bdr;
}
2022-09-22 13:50:02 +08:00
@GetMapping("list-case-statistic-ratio")
public SuccessResultList<List<CaseStatisticDTO>> listCaseStatistic(){
Map<String, Object> params = requestParams();
return reportCaseService.listCaseStatisticRatio(params);
}
2022-09-25 13:49:22 +08:00
2022-10-11 18:26:30 +08:00
/**
* 各月份案件统计情况 -大数据
* @return
*/
@GetMapping("list-report-case-month")
public SuccessResultList<List<Map<String, Object>>> listReportCaseMonth(){
Map<String, Object> params = requestParams();
Integer year = Integer.parseInt(DateUtil.getYear());
Integer month;
2022-11-03 11:35:52 +08:00
if(DateUtil.getMonth().length() > 1 && "0".equals(DateUtil.getMonth().substring(0,1))){
2022-10-11 18:26:30 +08:00
month = Integer.parseInt(DateUtil.getMonth().replaceAll("0", ""));
} else {
month = Integer.parseInt(DateUtil.getMonth());
}
List<String> monthList = new ArrayList<>();
for(int i = 0; i < 12; i++){
if(month - i == 0){
monthList.add((year - 1) + "-" + 12);
continue;
}
if(month - i < 0){
monthList.add((year -1) + "-" + (12 + (month - i)));
continue;
}
monthList.add(year + "-" + (month - i));
}
List<Map<String, Object>> resList = new ArrayList<>();
for(String str : monthList){
Map<String, Object> resMap = new HashMap<>(8);
String queryTime = str.length() == 6 ? str.replace("-", "-0") : str;
params.put("gmtCreateLike", queryTime);
List<Map<String, Object>> list = dataReleaseDao.listReportCase(params);
resMap.put("yearMonth", queryTime);
resMap.put("totalCount", list.size());
// 下派中
Integer xiapai = 0;
// 处理中
Integer chuli = 0;
// 检查中
Integer jiancha = 0;
// 已归档
Integer guidang = 0;
for(Map<String, Object> item : list){
if(item.get("case_status") != null && "2".equals(item.get("case_status").toString())){
xiapai++;
}
if(item.get("case_status") != null && "3".equals(item.get("case_status").toString())){
chuli++;
}
if(item.get("case_status") != null && "4".equals(item.get("case_status").toString())){
jiancha++;
}
if(item.get("case_status") != null && "6".equals(item.get("case_status").toString())){
guidang++;
}
}
resMap.put("xiapai", xiapai);
resMap.put("chuli", chuli);
resMap.put("jiancha", jiancha);
resMap.put("guidang", guidang);
resList.add(resMap);
}
return new SuccessResultList<>(resList, 1, 0L);
}
/**
* 大数据页面人员实施定位 二级弹窗列表页数据接口
* @param page
* @return
*/
2022-09-25 13:49:22 +08:00
@GetMapping("list-page-user-location")
public SuccessResultList<List<UserLocationDTO>> listPageUserLocation (ListPage page){
Map<String, Object> params = requestParams();
PageHelper.startPage(page.getPage(), page.getRows());
List<Map<String, Object>> userLocationList = dataReleaseDao.listUserLocation(params);
List<UserLocationDTO> resList = new ArrayList<>();
// 查询用户上传的最新的一条定位信息
for(Map<String, Object> item : userLocationList){
String userId = item.get("creator").toString();
params.put("userId", userId);
Map<String, Object> temp = dataReleaseDao.getLastUserLocationInfo(params);
UserLocationDTO dto = new UserLocationDTO();
dto.setUserLocationId(temp.get("user_location_id") == null ? "" : temp.get("user_location_id").toString());
dto.setUserLongitude(temp.get("user_longitude") == null ? "" : temp.get("user_longitude").toString());
dto.setUserLatitude(temp.get("user_latitude") == null ? "" : temp.get("user_latitude").toString());
dto.setUserLocation(temp.get("user_location") == null ? "" : temp.get("user_location").toString());
dto.setIsOverstep(temp.get("is_overstep") == null ? "" : temp.get("is_overstep").toString());
dto.setUserName(temp.get("user_name") == null ? "" : temp.get("user_name").toString());
dto.setCreator(temp.get("creator") == null ? "" : temp.get("creator").toString());
2022-10-11 18:26:30 +08:00
dto.setGmtCreate(temp.get("gmt_create") == null ? "" : temp.get("gmt_create").toString().substring(11,19));
2022-09-25 13:49:22 +08:00
dto.setUserAvatar(temp.get("user_avatar") == null ? "" : temp.get("user_avatar").toString());
2022-10-11 18:26:30 +08:00
// 如果取不到手机号 则使用登录账号
if(temp.get("user_phone") == null){
dto.setUserPhone(temp.get("user_username") == null ? "" : temp.get("user_username").toString());
} else {
dto.setUserPhone(temp.get("user_phone").toString());
}
2022-09-25 13:49:22 +08:00
resList.add(dto);
}
PageInfo<Map<String, Object>> pageInfo = new PageInfo<>(userLocationList);
return new SuccessResultList<>(resList, pageInfo.getPageNum(), pageInfo.getTotal());
}
2022-10-11 18:26:30 +08:00
@GetMapping("list-user-and-points-by-userids-by-grid-service")
public List<GridDTO> listUserAndPointsByUserIdsByGridService () throws ParamsException, SearchException{
Map<String, Object> params = requestParams();
if (params.get("userIds") == null || StringUtils.isBlank(params.get("userIds").toString())) {
return new ArrayList<>();
}
return userPointsService.listUserAndPointsByUserIdsByGridService(params);
}
2022-11-03 11:35:52 +08:00
}