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

684 lines
32 KiB
Java
Raw Normal View History

package com.cm.systemcity.controller.datarelease;
import com.cm.common.base.AbstractController;
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;
import com.cm.common.pojo.ListPage;
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;
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;
import com.cm.systemcity.service.dict.IDictService;
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;
@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){
if(gradeItem.get("grade") != null
|| !"".equals(gradeItem.get("grade").toString())
|| !"null".equals(gradeItem.get("grade").toString())
){
nowGrade += Integer.parseInt(gradeItem.get("grade").toString());
2022-10-11 18:26:30 +08:00
} else {
}
}
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());
2022-09-22 13:50:02 +08:00
if(ratioBigDecimal.doubleValue() <= 80){
resData.put("value", 85.73d);
}
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");
// 只显示近7天的情况
String startTime = DateUtil.getBeforeDate(7, "yyyy-MM-dd");
startTime += " 00:00:00";
String endTime = DateUtil.getDay();
endTime += " 23:59:59";
params.put("startTime", startTime);
params.put("endTime", endTime);
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;
if(DateUtil.getMonth().length() > 1 || "0".equals(DateUtil.getMonth().substring(0,1))){
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());
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;
}
/**
* 案件日志
*/
@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;
if(DateUtil.getMonth().length() > 1 || "0".equals(DateUtil.getMonth().substring(0,1))){
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);
}
}