package com.sooka.sponest.mobile.appbigdata.controller; import com.ruoyi.common.core.constant.EventTypeMenuConstants; import com.ruoyi.common.core.constant.HttpStatus; import com.ruoyi.common.core.domain.R; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.page.TableDataInfo; import com.ruoyi.common.security.utils.DictUtils; import com.ruoyi.system.api.domain.SysMenuEventType; import com.sooka.sponest.mobile.aop.NoRepeatSubmit; import com.sooka.sponest.mobile.appbigdata.domain.bo.ImportBo; import com.sooka.sponest.mobile.appbigdata.domain.bo.KeyProjectsScheduleBO; import com.sooka.sponest.mobile.appbigdata.domain.bo.VisuForestResourceBO; import com.sooka.sponest.mobile.appbigdata.domain.vo.VisuFireSendingSMSVo; import com.sooka.sponest.mobile.appbigdata.domain.vo.VisuForestCloudMapVO; import com.sooka.sponest.mobile.appbigdata.domain.vo.VisuForestDataCenterVO; import com.sooka.sponest.mobile.base.service.AppAttendanceService; import com.sooka.sponest.mobile.data.digitalagriculture.domain.VisuBaseService; import com.sooka.sponest.mobile.remoteapi.RemoteDataBaseService; import com.sooka.sponest.mobile.remoteapi.RemoteEventBaseService; import com.sooka.sponest.mobile.remoteapi.RemoteSystemBaseService; import com.sooka.sponest.mobile.remoteapi.domain.CenterdataTForestFireteam; import com.sooka.sponest.mobile.remoteapi.domain.CommandCenterBO; import com.sooka.sponest.mobile.utils.PictureReplaceAll; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.*; @RestController @RequestMapping("/AppBigDataController") public class AppBigDataController extends VisuBaseService { @Resource RemoteDataBaseService remoteDataBaseService; @Resource RemoteEventBaseService remoteEventBaseService; @Resource RemoteSystemBaseService remoteSystemBaseService; public static final String EVENT_TYPE = "eventType"; public static final String FOREST_EVENT_STATUS_2 = "forest_event_status_2"; public static final String FOREST_EVENT_STATUS_5 = "forest_event_status_5"; public static final String NAME_CHINESE = "name_chinese"; public static final String NAME_ORIGINAL = "name_original"; public static final String EVENT = "event"; public static final String PHOTO_ID = "photoId"; /** * 手机端获取全部事件 * * @return com.ruoyi.common.core.domain.R * @author pengyu * @date 2023/2/22 13:34 **/ @ApiOperation(value = "全部事件", notes = "全部事件") @NoRepeatSubmit @PostMapping("getAllData") public R getAllData() { return R.ok(remoteDataBaseService.getAllData().getData()); } /** * 手机端获取林业事件统计 * * @return com.ruoyi.common.core.web.domain.AjaxResult * @author pengyu * @date 2023/2/22 13:43 **/ @ApiOperation(value = "林业事件统计", notes = "林业事件统计") //@NoRepeatSubmit @PostMapping("getFireData") public AjaxResult getFireData() { SysMenuEventType sysMenuEventType = new SysMenuEventType(); sysMenuEventType.setMenuId(EventTypeMenuConstants.FOREST); Map stringMap = appAttendanceService.selectByMenuId(sysMenuEventType).getData(); VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO(); visuForestCloudMapVO.setEventTypeId(stringMap.get(EVENT_TYPE)); List list = new ArrayList<>(); list.add(FOREST_EVENT_STATUS_2); list.add(FOREST_EVENT_STATUS_5); visuForestCloudMapVO.setEventStatus(list); Map map = new HashMap<>(); //基础数据 List dataMap = (List) remoteDataBaseService.getFireData().getData(); for (Map data : dataMap) { data.put(NAME_CHINESE, data.get("name").toString().split("\\(")[0] + "(" + data.get("name").toString().split("\\(")[1].split("\\)")[0] + ")"); data.put(NAME_ORIGINAL, data.get("name").toString().split("\\(")[0]); } map.put("rows", dataMap); //事件 map.put(EVENT, remoteEventBaseService.getEventCountGroupByEventStatus(visuForestCloudMapVO).getData()); return AjaxResult.success(map); } @Resource AppAttendanceService appAttendanceService; /** * 手机端消防统计数据 * * @return com.ruoyi.common.core.web.domain.AjaxResult * @author pengyu * @date 2023/2/22 11:23 */ @ApiOperation(value = "消防统计数据", notes = "消防统计数据") @NoRepeatSubmit @PostMapping("getFireControlData") public AjaxResult getFireControlData() { SysMenuEventType sysMenuEventType = new SysMenuEventType(); sysMenuEventType.setMenuId(EventTypeMenuConstants.FIRECONTROL); Map stringMap = appAttendanceService.selectByMenuId(sysMenuEventType).getData(); VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO(); visuForestCloudMapVO.setEventTypeId(stringMap.get(EVENT_TYPE)); List list = new ArrayList<>(); list.add(FOREST_EVENT_STATUS_2); list.add(FOREST_EVENT_STATUS_5); visuForestCloudMapVO.setEventStatus(list); Map map = new HashMap<>(); //基础数据 List dataMap = remoteDataBaseService.fireControlViewList().getData(); Iterator iterator = dataMap.iterator(); while (iterator.hasNext()) { Map data = iterator.next(); if ("centerdata_t_forest_fireteam".equals(data.get("type").toString())) { iterator.remove(); } else { data.put(NAME_CHINESE, data.get("name").toString().split("\\(")[0] + "(" + data.get("name").toString().split("\\(")[1].split("\\)")[0] + ")"); data.put(NAME_ORIGINAL, data.get("name").toString().split("\\(")[0]); } } //基础数据 map.put("rows", dataMap); //事件 map.put(EVENT, remoteEventBaseService.getEventCountGroupByEventStatus(visuForestCloudMapVO).getData()); return AjaxResult.success(map); } /** * 手机端环保首页大数据 * * @return com.ruoyi.common.core.web.domain.AjaxResult * @author pengyu * @date 2023/2/22 9:55 */ @ApiOperation(value = "环保大数据", notes = "环保大数据") @NoRepeatSubmit @PostMapping("getEnvironmentControlData") public AjaxResult getEnvironmentControlData() { SysMenuEventType sysMenuEventType = new SysMenuEventType(); sysMenuEventType.setMenuId(EventTypeMenuConstants.ENVIRONMENT); Map stringMap = appAttendanceService.selectByMenuId(sysMenuEventType).getData(); VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO(); visuForestCloudMapVO.setEventTypeId(stringMap.get(EVENT_TYPE)); List list = new ArrayList<>(); list.add(FOREST_EVENT_STATUS_2); list.add(FOREST_EVENT_STATUS_5); visuForestCloudMapVO.setEventStatus(list); Map map = new HashMap<>(); List dataMap = (List) remoteDataBaseService.getEnvironmentControlData().getData(); for (Map data : dataMap) { data.put(NAME_CHINESE, data.get("name").toString().split("\\(")[0] + "(" + data.get("name").toString().split("\\(")[1].split("\\)")[0] + ")"); data.put(NAME_ORIGINAL, data.get("name").toString().split("\\(")[0]); } //基础数据 map.put("rows", dataMap); //事件 map.put(EVENT, remoteEventBaseService.getEventCountGroupByEventStatus(visuForestCloudMapVO).getData()); return AjaxResult.success(map); } /** * 林业统计 * * @return * @Version 1.0 * @author wang_xy * @since 2023/2/23 8:57 */ @ApiOperation(value = "林业统计", notes = "林业统计") @NoRepeatSubmit @PostMapping("getLocationData") public R getLocationData(@RequestBody VisuForestResourceBO visuForestResourceBO) { Map map = new HashMap<>(); map.put("up", remoteDataBaseService.getCountGroupByDept(visuForestResourceBO).getData()); map.put("down", remoteDataBaseService.getLocation(visuForestResourceBO).getData()); return R.ok(map); } /** * 手机端水利首页大数据 * * @return com.ruoyi.common.core.web.domain.AjaxResult * @author pengyu * @date 2023/2/22 9:55 */ @ApiOperation(value = "水利大数据", notes = "水利大数据") @PostMapping("getWaterControlData") public AjaxResult getWaterControlData() { SysMenuEventType sysMenuEventType = new SysMenuEventType(); sysMenuEventType.setMenuId(EventTypeMenuConstants.WATER); Map stringMap = appAttendanceService.selectByMenuId(sysMenuEventType).getData(); VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO(); visuForestCloudMapVO.setEventTypeId(stringMap.get(EVENT_TYPE)); List list = new ArrayList<>(); list.add(FOREST_EVENT_STATUS_2); list.add(FOREST_EVENT_STATUS_5); visuForestCloudMapVO.setEventStatus(list); Map map = new HashMap<>(); //基础数据 VisuForestDataCenterVO visuForestDataCenterVO = new VisuForestDataCenterVO(); setSookaDataBase(visuForestDataCenterVO); List dataMap = (List) remoteDataBaseService.getWaterResourceCount().getData(); for (Map data : dataMap) { data.put(NAME_CHINESE, data.get("name").toString().split("\\(")[0] + "(" + data.get("name").toString().split("\\(")[1].split("\\)")[0] + ")"); data.put(NAME_ORIGINAL, data.get("name").toString().split("\\(")[0]); } map.put("rows", dataMap); //事件 map.put(EVENT, remoteEventBaseService.getEventCountGroupByEventStatus(visuForestCloudMapVO).getData()); return AjaxResult.success(map); } /** * 手机端资源首页大数据 * * @return com.ruoyi.common.core.web.domain.AjaxResult * @author pengyu * @date 2023/2/22 9:55 */ @ApiOperation(value = "资源大数据", notes = "资源大数据") @PostMapping("getResourcesControlData") public AjaxResult getResourcesControlData() { SysMenuEventType sysMenuEventType = new SysMenuEventType(); sysMenuEventType.setMenuId(EventTypeMenuConstants.RESOURCES); Map stringMap = appAttendanceService.selectByMenuId(sysMenuEventType).getData(); VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO(); visuForestCloudMapVO.setEventTypeId(stringMap.get(EVENT_TYPE)); List list = new ArrayList<>(); list.add(FOREST_EVENT_STATUS_2); list.add(FOREST_EVENT_STATUS_5); visuForestCloudMapVO.setEventStatus(list); Map map = new HashMap<>(); //基础数据 VisuForestDataCenterVO visuForestDataCenterVO = new VisuForestDataCenterVO(); setSookaDataBase(visuForestDataCenterVO); List> datalist = remoteDataBaseService.getResourcesResourceCount().getData(); for (Map data : datalist) { data.put(NAME_CHINESE, data.get("name").toString().split("\\(")[0] + "(" + data.get("name").toString().split("\\(")[1].split("\\)")[0] + ")"); data.put(NAME_ORIGINAL, data.get("name").toString().split("\\(")[0]); } map.put("rows", datalist); //事件 map.put(EVENT, remoteEventBaseService.getEventCountGroupByEventStatus(visuForestCloudMapVO).getData()); return AjaxResult.success(map); } /** * 手机端应急首页大数据 * * @return com.ruoyi.common.core.web.domain.AjaxResult * @author pengyu * @date 2023/2/22 9:55 */ @ApiOperation(value = "应急大数据", notes = "应急大数据") @PostMapping("getEmergencyControlData") public AjaxResult getEmergencyControlData() { SysMenuEventType sysMenuEventType = new SysMenuEventType(); sysMenuEventType.setMenuId(EventTypeMenuConstants.EMERGENCY); Map stringMap = appAttendanceService.selectByMenuId(sysMenuEventType).getData(); VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO(); visuForestCloudMapVO.setEventTypeId(stringMap.get(EVENT_TYPE)); List list = new ArrayList<>(); list.add(FOREST_EVENT_STATUS_2); list.add(FOREST_EVENT_STATUS_5); visuForestCloudMapVO.setEventStatus(list); Map map = new HashMap<>(); //基础数据 VisuForestDataCenterVO visuForestDataCenterVO = new VisuForestDataCenterVO(); setSookaDataBase(visuForestDataCenterVO); List dataMap = remoteDataBaseService.getEmergencyResourceCount().getData(); for (Map data : dataMap) { data.put(NAME_CHINESE, data.get("name").toString().split("\\(")[0] + "(" + data.get("name").toString().split("\\(")[1].split("\\)")[0] + ")"); data.put(NAME_ORIGINAL, data.get("name").toString().split("\\(")[0]); } map.put("rows", dataMap); //事件 map.put(EVENT, remoteEventBaseService.getEventCountGroupByEventStatus(visuForestCloudMapVO).getData()); return AjaxResult.success(map); } /** * 手机端交通首页大数据 * * @return com.ruoyi.common.core.web.domain.AjaxResult * @author pengyu * @date 2023/2/22 9:55 */ @ApiOperation(value = "交通大数据", notes = "交通大数据") @PostMapping("getTrafficControlData") public AjaxResult getTrafficControlData() { SysMenuEventType sysMenuEventType = new SysMenuEventType(); sysMenuEventType.setMenuId(EventTypeMenuConstants.TRAFFIC); Map stringMap = appAttendanceService.selectByMenuId(sysMenuEventType).getData(); VisuForestCloudMapVO visuForestCloudMapVO = new VisuForestCloudMapVO(); visuForestCloudMapVO.setEventTypeId(stringMap.get(EVENT_TYPE)); List list = new ArrayList<>(); list.add(FOREST_EVENT_STATUS_2); list.add(FOREST_EVENT_STATUS_5); visuForestCloudMapVO.setEventStatus(list); Map map = new HashMap<>(); //基础数据 VisuForestDataCenterVO visuForestDataCenterVO = new VisuForestDataCenterVO(); setSookaDataBase(visuForestDataCenterVO); List dataMap = remoteDataBaseService.getTrafficResourcesCount().getData(); for (Map data : dataMap) { data.put(NAME_CHINESE, data.get("name").toString().split("\\(")[0] + "(" + data.get("name").toString().split("\\(")[1].split("\\)")[0] + ")"); data.put(NAME_ORIGINAL, data.get("name").toString().split("\\(")[0]); } map.put("rows", dataMap); //事件 map.put(EVENT, remoteEventBaseService.getEventCountGroupByEventStatus(visuForestCloudMapVO).getData()); return AjaxResult.success(map); } /**************************************************市局领导页面接口——开始****************************************************/ /** * 获取重点工程 * 无分页,无筛选 * * @return * @Version 1.0 * @author wang_xy * @since 2023/4/24 15:09 */ @ApiOperation(value = "获取重点工程(无分页,无筛选)", notes = "获取重点工程(无分页,无筛选)") @GetMapping("getKeyProjects") public AjaxResult getKeyProjects(Long deptId, String state) { AjaxResult ajaxResult = remoteDataBaseService.getKeyProjects(deptId, state); if ("200".equals(ajaxResult.get("code").toString())) { List> list = (List>) ajaxResult.get("data"); list.forEach(map -> { if (null != map.get("cameraCode")) { map.put("cameraCode", map.get("cameraCode").toString().split(",")); } }); PictureReplaceAll.replaceAllPictureUrl(list, "photoId"); } return ajaxResult; } /** * @throws * @description * @author LG * @param[1] null * @time 2023/8/16 9:33 * 有分页,有筛选 */ @ApiOperation(value = "获取重点工程(有分页, 有筛选)", notes = "获取重点工程(有分页, 有筛选)") @PostMapping("getKeyProjectsByParams") public AjaxResult getKeyProjectsByParams(@RequestBody CommandCenterBO bo) { TableDataInfo keyProjectsByParams = remoteDataBaseService.getKeyProjectsByParams(bo.getPageNum(), bo.getPageSize(), bo.getDeptId(), bo.getPark(), bo.getProjectName(), bo.getTerritoriality(), bo.getNature(), bo.getState()); if (HttpStatus.SUCCESS == keyProjectsByParams.getCode()) { List> list = (List>) keyProjectsByParams.getRows(); list.forEach(map -> { if (null != map.get("cameraCode")) { map.put("cameraCode", map.get("cameraCode").toString().split(",")); } }); PictureReplaceAll.replaceAllPictureUrl(list, "photoId"); return AjaxResult.success(list); } else { return AjaxResult.error(keyProjectsByParams.getMsg()); } } /** * 根据重点工程id获取进度列表 */ @ApiOperation(value = "根据重点工程id获取进度列表", notes = "根据重点工程id获取进度列表") @GetMapping("/appGetScheduleByTime") public AjaxResult appGetScheduleByTime(KeyProjectsScheduleBO bo) throws Exception { AjaxResult ajaxResult = remoteDataBaseService.appGetScheduleByTime(bo.getKeyProjectsId(), bo.getStartTime(), bo.getEndTime()); if ("200".equals(ajaxResult.get("code").toString())) { List> list = (List>) ajaxResult.get("data"); PictureReplaceAll.replaceAllPictureUrl(list, "schedulePictures"); } return ajaxResult; } /** * 获取重点区域 * * @return * @Version 1.0 * @author wang_xy * @since 2023/4/24 15:09 */ @ApiOperation(value = "获取重点区域", notes = "获取重点区域") @GetMapping("getImportAreaList") public AjaxResult getImportAreaList(Long deptId) { List ajax = (List) remoteDataBaseService.getImportAreaList(deptId).get("data"); for (int i = 0; i < ajax.size(); i++) { Map map = ajax.get(i); List areaList = (List) map.get("areaList"); for (int j = 0; j < areaList.size(); j++) { Map area = areaList.get(j); String photoId = area.containsKey(PHOTO_ID) && null != area.get(PHOTO_ID) ? area.get(PHOTO_ID).toString().replaceAll("172.18.1.32:8081", "218.27.3.115:9301") : ""; photoId = photoId.replaceAll("10.6.52.32:8081", "218.27.3.115:9301"); area.put(PHOTO_ID, photoId); areaList.set(j, area); } ajax.set(i, map); } return AjaxResult.success(ajax); } /** * 获取重点区域 * 带筛选,带分页 * * @return * @Version 1.0 * @author wang_xy * @since 2023/4/24 15:09 */ @ApiOperation(value = "获取重点区域(分页,筛选)", notes = "获取重点区域(分页,筛选)") @GetMapping("getImportAreaListByParams") public AjaxResult getImportAreaListByParams(ImportBo bo) { TableDataInfo importAreaListByParams = remoteDataBaseService.getImportAreaListByParams(bo.getAreaName(), bo.getProjectType(), bo.getProjectLevel(), bo.getPageNum(), bo.getPageSize()); if (HttpStatus.SUCCESS == importAreaListByParams.getCode()) { List> list = (List>) importAreaListByParams.getRows(); Map areaType = DictUtils.getDictCacheToMap("area_type"); Map projectLevel = DictUtils.getDictCacheToMap("centerdata_project_level"); for (HashMap area : list) { String photoId = area.containsKey(PHOTO_ID) && null != area.get(PHOTO_ID) ? area.get(PHOTO_ID).toString().replaceAll("172.18.1.32:8081", "218.27.3.115:9301") : ""; photoId = photoId.replaceAll("10.6.52.32:8081", "218.27.3.115:9301"); area.put(PHOTO_ID, photoId); area.put("projectTypeLabel", areaType.get(area.get("projectType"))); area.put("projectLevelLabel", projectLevel.get(area.get("projectLevel"))); } return AjaxResult.success(list); } else { return AjaxResult.error(importAreaListByParams.getCode(), importAreaListByParams.getMsg()); } } /** * 实时关注 * * @return * @Version 1.0 * @author wang_xy * @since 2023/4/24 15:09 */ @ApiOperation(value = "实时关注", notes = "实时关注") @GetMapping("getDeptEventCount") public AjaxResult getDeptEventCount(Long deptId) { AjaxResult ret = remoteEventBaseService.getDeptEventCount(deptId); ArrayList list = (ArrayList) ret.get("data"); Integer count = 0; for (int i = 0; i < list.size(); i++) { count += (Integer) ((LinkedHashMap) list.get(i)).get("num"); } Map rets = new HashMap(); rets.put("count", count); rets.put("list", list); return AjaxResult.success(rets); } /** * app事件统计 * * @param deptId * @return */ @ApiOperation(value = "app事件统计", notes = "app事件统计") @GetMapping("appEventStatistics") public AjaxResult appEventStatistics(Long deptId) { return remoteEventBaseService.appEventStatistics(deptId); } /** * 四长统计 * * @param deptId * @return */ @ApiOperation(value = "四长统计", notes = "四长统计") @GetMapping("fourLengthOverview") public AjaxResult fourLengthOverview(Long deptId) { return remoteDataBaseService.fourLengthOverview(deptId); } /** * 四长概况点击事件 * * @param CommandCenterBO * @return */ @ApiOperation(value = "四长统计点击事件", notes = "四长统计点击事件") @GetMapping("fourLengthOverviewOther") public AjaxResult fourLengthOverviewOther(CommandCenterBO CommandCenterBO) { Map data = (Map) remoteDataBaseService.fourLengthOverviewOther(CommandCenterBO.getDeptId()).get("data"); Map structure = (Map) data.get("structure"); Map structureNew = new HashMap(); structureNew.put("one", structure.get("1")); structureNew.put("two", structure.get("2")); structureNew.put("three", structure.get("3")); structureNew.put("four", structure.get("4")); data.put("structure", structureNew); return AjaxResult.success(data); } /** * 手机端四长接口 * * @param CommandCenterBO * @return */ @ApiOperation(value = "手机端四长接口", notes = "手机端四长接口") @GetMapping("fourLengthOver") public AjaxResult fourLengthOver(CommandCenterBO CommandCenterBO) { return AjaxResult.success(remoteDataBaseService.fourLengthOver(CommandCenterBO.getDeptId(), CommandCenterBO.getTimeTag(), CommandCenterBO.getKeyWord()).get("data")); } /** * 通讯录组织机构 * * @return */ @ApiOperation(value = "通讯录组织机构", notes = "通讯录组织机构") @GetMapping("/getDeptList") public AjaxResult getDeptList() { return remoteSystemBaseService.getDeptList(""); } /** * 根据部门id获取通讯录列表 * * @param deptId * @param pageNum * @param pageSize * @param selectParam * @return */ @ApiOperation(value = "根据部门id获取通讯录列表", notes = "根据部门id获取通讯录列表") @GetMapping("/getCommunicationByDeptId") public AjaxResult getCommunicationByDeptId(String deptId, int pageNum, int pageSize, String selectParam) { return remoteDataBaseService.getCommunicationByDeptId(deptId, selectParam, pageNum, pageSize); } /** * 大事迹按部门搜索 * * @param deptId * @return */ @ApiOperation(value = "大事迹按部门搜索", notes = "大事迹按部门搜索") @GetMapping("/greatdeedsApp") public AjaxResult greatdeedsApp(Long deptId) { AjaxResult ajaxResult = remoteDataBaseService.greatdeedsApp(deptId); return ajaxResult; } /** * 防火队发送短信 * * @param visuFireSendingSMSVo * @return */ @ApiOperation(value = "防火队发送短信", notes = "防火队发送短信") @PostMapping("firesendingSMSApp") public AjaxResult firesendingSMSApp(@RequestBody VisuFireSendingSMSVo visuFireSendingSMSVo) { AjaxResult ajaxResult = remoteEventBaseService.firesendingSMSApp(visuFireSendingSMSVo); return ajaxResult; } /** * 防火队列表 * * @param dataBO * @return */ @ApiOperation(value = "防火队列表", notes = "防火队列表") @PostMapping("forestViewPointApp") public R forestViewPointApp(@RequestBody CenterdataTForestFireteam dataBO) { R R = remoteDataBaseService.forestViewPointApp(dataBO); return R; } @ApiOperation(value = "上报防火办", notes = "上报防火办") @PostMapping("eventcatalogueApp") public AjaxResult eventcatalogueApp(@RequestBody VisuFireSendingSMSVo visuFireSendingSMSVo) { AjaxResult ajaxResult = remoteEventBaseService.eventcatalogueApp(visuFireSendingSMSVo); return ajaxResult; } /**************************************************市局领导页面接口——结束****************************************************/ }