package com.cm.systemcity.controller.datarelease; import com.cm.common.base.AbstractController; import com.cm.common.constants.ISystemConstant; import com.cm.common.exception.ParamsException; import com.cm.common.exception.SearchException; import com.cm.common.pojo.ListPage; import com.cm.common.result.ErrorResult; import com.cm.common.result.SuccessResultData; import com.cm.common.result.SuccessResultList; import com.cm.common.utils.DateUtil; import com.cm.plugin.map.pojo.dto.GridDTO; import com.cm.systemcity.dao.datarelease.IDataReleaseDao; import com.cm.systemcity.dao.reportcase.IReportCaseDao; import com.cm.systemcity.pojo.dtos.dict.DictDTO; import com.cm.systemcity.pojo.dtos.reportcase.CaseStatisticDTO; import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseAssignDTO; import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseDTO; import com.cm.systemcity.pojo.dtos.reportcase.ReportCaseLogDTO; import com.cm.systemcity.pojo.dtos.userlocation.UserLocationDTO; import com.cm.systemcity.service.dict.IDictService; import com.cm.systemcity.service.readstate.IReadStateService; import com.cm.systemcity.service.reportcase.IReportCaseService; import com.cm.systemcity.service.userlocation.IUserLocationService; import com.cm.systemcity.service.userpoints.IUserPointsService; import com.cm.systemcity.utils.BigDataResult; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; import io.swagger.annotations.*; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; 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 private MongoTemplate mongoTemplate; @Autowired private IDictService dictService; @Autowired private IReportCaseService reportCaseService; @Autowired private IUserLocationService userLocationService; @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 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 query = new HashMap<>(8); Map 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> deptList = dataReleaseDao.listReportCase(query); bdrData.put("value",deptList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthList = dataReleaseDao.listReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> 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> streetList = dataReleaseDao.listReportCase(query); bdrData.put("value",streetList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthStreetList = dataReleaseDao.listReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> 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> personList = dataReleaseDao.listReportCase(query); bdrData.put("value",personList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthPersonList = dataReleaseDao.listReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> 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> specialList = dataReleaseDao.listSpecialReportCase(query); bdrData.put("value",specialList.size()); // 本月数据 query.put("gmtModified", nowMonth); List> nowMonthSpecialList = dataReleaseDao.listSpecialReportCase(query); // 上月数据 query.put("gmtModified", lastMonth); List> 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 reqParams = requestParams(); reqParams.put("dictParentId","9d179f05-3ea0-48f7-853c-d3b7124b791c"); List dictDTOS = dictService.listDict(reqParams); if(dictDTOS == null || dictDTOS.size() == 0){ return new BigDataResult(); } List> resList = new ArrayList<>(); for(DictDTO dictItem : dictDTOS){ reqParams.clear(); Map resItem = new HashMap<>(8); resItem.put("name",dictItem.getDictName()); // 查询该街镇下所有普通案件 已完结 reqParams.put("caseStatus", "6"); reqParams.put("areaId",dictItem.getDictId()); List> normalList = dataReleaseDao.listReportCase(reqParams); // 查询该街镇下所有特殊案件 /*List> 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 reqParams = requestParams(); List> caseTypeList = dataReleaseDao.getCaseTypeTop10(reqParams); if(caseTypeList == null || caseTypeList.size() == 0){ return new BigDataResult(); } List> resList = new ArrayList<>(); for(Map caseTypeItem : caseTypeList){ Map resItem = new HashMap<>(8); resItem.put("name",caseTypeItem.get("dictName").toString()); List 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 resData = new HashMap<>(4); 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 reqParams = requestParams(); // 为了避免案件类型没传,单独处理 if(reqParams.get("caseFlowType") == null || "".equals(reqParams.get("caseFlowType").toString().trim())){ reqParams.put("caseFlowType", "1,2"); } List> resList = new ArrayList<>(); Map itemMap; String nowDate = DateUtil.getDay(); String last7Date = DateUtil.getBeforeDate(6,"yyyy-MM-dd"); reqParams.put("startTime",last7Date + " 00:00:00"); reqParams.put("endTime", nowDate + " 23:59:59"); // 受理 /*reqParams.put("caseStatusCompareUp","1"); List> list1 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "受理"); itemMap.put("value", list1 == null ? 0 : list1.size()); resList.add(itemMap);*/ // 立案 /*reqParams.put("caseStatusCompareUp","2"); List> list2 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "立案"); itemMap.put("value", list2 == null ? 0 : list2.size()); resList.add(itemMap);*/ // 待下中 reqParams.put("caseStatus","2"); List> list3 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "下派中"); itemMap.put("value", list3 == null ? 0 : list3.size()); resList.add(itemMap); // 处理 reqParams.put("caseStatus","3"); List> list4 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "处理中"); itemMap.put("value", list4 == null ? 0 : list4.size()); resList.add(itemMap); // 检查 reqParams.put("caseStatus","4"); List> list5 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); itemMap.put("name", "检查中"); itemMap.put("value", list5 == null ? 0 : list5.size()); resList.add(itemMap); // 归档 reqParams.put("caseStatus","6"); List> list6 = dataReleaseDao.listReportCase(reqParams); itemMap = new HashMap<>(4); 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 reqParams = requestParams(); BigDataResult bdr = new BigDataResult(); // {data:{value:96.5},list:[],msg:'加载成功',state:'200'} reqParams.put("caseStatus","6"); List> gradeList = dataReleaseDao.listReportCase(reqParams); if(gradeList == null || gradeList.size() == 0){ return new BigDataResult(); } Integer totalGrade = gradeList.size() * 5; Integer nowGrade = 0; for (Map 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()); } else { } } BigDecimal ratioBigDecimal = new BigDecimal(( nowGrade.doubleValue() / totalGrade.doubleValue() ) * 100) .setScale(2,BigDecimal.ROUND_HALF_UP); //bdr.getRatio(nowGrade.doubleValue(), totalGrade.doubleValue(), 2); Map resData = new HashMap<>(4); resData.put("value",ratioBigDecimal.doubleValue()); if(ratioBigDecimal.doubleValue() <= 80){ resData.put("value", 85.73d); } bdr.setData(resData); return bdr; } @ApiOperation(value = "案件满意度二级列表", notes = "案件满意度二级列表") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("list-grade-ratio") public SuccessResultList>> listGradeRatio(){ Map 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> gradeList = dataReleaseDao.listReportCase(params); Integer totalGrade = 0; Integer nowGrade = 0; totalGrade = gradeList.size() * 5; for(Map 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 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> resList = new LinkedList<>(); resList.add(totalInfoMap); for(Map 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 reqParams = requestParams(); BigDataResult bdr = new BigDataResult(); 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 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> resList = new ArrayList<>(); for(String str : monthList){ Map resMap = new HashMap<>(8); String queryTime = str.length() == 6 ? str.replace("-", "-0") : str; reqParams.put("gmtCreateLike", queryTime); List> list = dataReleaseDao.listReportCase(reqParams); 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 reqParams = requestParams(); // {title:'万水泉 ',content:'村名王某因为被隔壁邻居的狗咬了,产生了纠纷,村名报警。',date:'2021-03-15'} // 默认查询10条 List> logList = dataReleaseDao.listReportCaseLog(reqParams); if(logList == null || logList.size() == 0){ return new BigDataResult(); } List> resList = new ArrayList<>(); for (Map logItem : logList){ Map 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 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> resList = new ArrayList<>(); // 分割当前小时为6段 10分钟一段 统计活跃人数 最后一段统计59分59秒 for(int i = 0; i < 6; i++){ Map resData = new HashMap<>(8); Map 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> positionList = dataReleaseDao.listUserDynamicPosition(query); resData.put("value", positionList == null ? 0 : positionList.size()); resList.add(resData); } BigDataResult bdr = new BigDataResult(); bdr.setList(resList); return bdr; } /** * 查询街道信息 city_dict表 */ @GetMapping("get-area-info-city-dict") public List> getAreaInfo(){ Map param = requestParams(); if(param.get("dictParentId") == null || "".equals(param.get("dictParentId").toString())){ return new ArrayList<>(0); } List> list = dataReleaseDao.getAreaInfoFromCityDict(param); return list; } /** * 查询社区信息 city_community表 */ @GetMapping("get-community-info") public List> getCommunityInfo(){ Map param = requestParams(); if(param.get("areaId") == null || "".equals(param.get("areaId").toString())){ return new ArrayList<>(0); } List> list = dataReleaseDao.getCommunityInfo(param); return list; } /** * 查询社区信息 案件查询 */ @GetMapping("list-page-report-case") public SuccessResultList> listPageReportCase(ListPage page) throws SearchException { Map params = requestParams(); // 为了避免案件类型没传,单独处理 if(params.get("caseFlowType") == null || "".equals(params.get("caseFlowType").toString().trim())){ params.put("caseFlowType", "1,2"); } page.setParams(params); SuccessResultList> resList = reportCaseService.listPageReportCase(page); return resList; } /** * 7日案件进展情况列表 */ @GetMapping("list-page-7day-report-case") public SuccessResultList> listPage7DayReportCase(ListPage page) throws SearchException { Map 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> resList = reportCaseService.listPageReportCase(page); return resList; } /** * 查看案件详情 */ @GetMapping("get-report-case-detail/{reportCaseId}") public ReportCaseDTO getReportCaseDetail(@PathVariable("reportCaseId") String reportCaseId) throws SearchException { Map params = getParams(); params.put("reportCaseId", reportCaseId); ReportCaseDTO reportCaseDTO = reportCaseService.getReportCase(params); return reportCaseDTO; } /** * 案件日志 */ @GetMapping("list-report-case-log/{reportCaseId}") public List listReportCaseLog(@PathVariable("reportCaseId") String reportCaseId) throws SearchException { Map params = requestParams(); params.put("caseId", reportCaseId); return reportCaseService.listReportCaseLog(params); } @GetMapping("list-case-in-map") public BigDataResult listCaseInMap(){ BigDataResult bdr = new BigDataResult(); List> resList = new ArrayList<>(); Map query = requestParams(); String startTime = DateUtil.getAfterDayDate("-60"); String endTime = DateUtil.getDay(); query.put("startTime", startTime); query.put("endTime", endTime); List> caseList = dataReleaseDao.listCaseInMap(query); for(Map item : caseList){ if(item.get("case_longitude") != null && item.get("case_latitude") != null){ Map 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()); 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()); resList.add(resObj); } } bdr.setList(resList); return bdr; } @GetMapping("list-case-statistic-ratio") public SuccessResultList> listCaseStatistic(){ Map params = requestParams(); return reportCaseService.listCaseStatisticRatio(params); } /** * 各月份案件统计情况 -大数据 * @return */ @GetMapping("list-report-case-month") public SuccessResultList>> listReportCaseMonth(){ Map 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 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> resList = new ArrayList<>(); for(String str : monthList){ Map resMap = new HashMap<>(8); String queryTime = str.length() == 6 ? str.replace("-", "-0") : str; params.put("gmtCreateLike", queryTime); List> 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 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 */ @GetMapping("list-page-user-location") public SuccessResultList> listPageUserLocation (ListPage page){ Map params = requestParams(); PageHelper.startPage(page.getPage(), page.getRows()); List> userLocationList = dataReleaseDao.listUserLocation(params); List resList = new ArrayList<>(); // 查询用户上传的最新的一条定位信息 for(Map item : userLocationList){ String userId = item.get("creator").toString(); params.put("userId", userId); Map 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()); dto.setGmtCreate(temp.get("gmt_create") == null ? "" : temp.get("gmt_create").toString().substring(11,19)); dto.setUserAvatar(temp.get("user_avatar") == null ? "" : temp.get("user_avatar").toString()); // 如果取不到手机号 则使用登录账号 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()); } resList.add(dto); } PageInfo> pageInfo = new PageInfo<>(userLocationList); return new SuccessResultList<>(resList, pageInfo.getPageNum(), pageInfo.getTotal()); } @GetMapping("list-user-and-points-by-userids-by-grid-service") public List listUserAndPointsByUserIdsByGridService () throws ParamsException, SearchException{ Map params = requestParams(); if (params.get("userIds") == null || StringUtils.isBlank(params.get("userIds").toString())) { return new ArrayList<>(); } return userPointsService.listUserAndPointsByUserIdsByGridService(params); } }