@ -4,15 +4,19 @@ import com.dongjian.dashboard.back.common.Constants;
import com.dongjian.dashboard.back.common.response.ResponseCode ;
import com.dongjian.dashboard.back.common.response.ResponseCode ;
import com.dongjian.dashboard.back.common.response.SimpleDataResponse ;
import com.dongjian.dashboard.back.common.response.SimpleDataResponse ;
import com.dongjian.dashboard.back.dao.ex.DashboardNotificationMapperExt ;
import com.dongjian.dashboard.back.dao.ex.DashboardNotificationMapperExt ;
import com.dongjian.dashboard.back.dao.ex.LevelMapperExt ;
import com.dongjian.dashboard.back.dao.ex.MonitoringPointCategoryMapperExt ;
import com.dongjian.dashboard.back.dao.ex.MonitoringPointCategoryMapperExt ;
import com.dongjian.dashboard.back.dao.ex.OverviewInfoMapperExt ;
import com.dongjian.dashboard.back.dao.ex.OverviewInfoMapperExt ;
import com.dongjian.dashboard.back.dto.monitoringpointcategory.MonitoringPointCategorySearchParams ;
import com.dongjian.dashboard.back.dto.monitoringpointcategory.MonitoringPointCategorySearchParams ;
import com.dongjian.dashboard.back.service.OverviewService ;
import com.dongjian.dashboard.back.service.OverviewService ;
import com.dongjian.dashboard.back.service.common.CommonOpt ;
import com.dongjian.dashboard.back.service.common.CommonOpt ;
import com.dongjian.dashboard.back.service.common.MenuTree ;
import com.dongjian.dashboard.back.vo.TreeMenusDTO ;
import com.dongjian.dashboard.back.vo.dashboardnotification.DashboardNotificationPageVO ;
import com.dongjian.dashboard.back.vo.dashboardnotification.DashboardNotificationPageVO ;
import com.dongjian.dashboard.back.vo.data.OverviewCategoryVO ;
import com.dongjian.dashboard.back.vo.data.OverviewCategoryVO ;
import com.dongjian.dashboard.back.vo.data.OverviewInfo ;
import com.dongjian.dashboard.back.vo.data.OverviewInfo ;
import com.dongjian.dashboard.back.vo.data.OverviewVO ;
import com.dongjian.dashboard.back.vo.data.OverviewVO ;
import com.dongjian.dashboard.back.vo.level.BuildingPathDTO ;
import com.dongjian.dashboard.back.vo.monitoringpointcategory.MonitoringPointCategoryPageVO ;
import com.dongjian.dashboard.back.vo.monitoringpointcategory.MonitoringPointCategoryPageVO ;
import com.dongjian.dashboard.back.weather.JpMeshHourlyForecasts ;
import com.dongjian.dashboard.back.weather.JpMeshHourlyForecasts ;
import com.dongjian.dashboard.back.weather.QueryWeather ;
import com.dongjian.dashboard.back.weather.QueryWeather ;
@ -53,6 +57,10 @@ public class OverviewServiceImpl implements OverviewService {
private DashboardNotificationMapperExt dashboardNotificationMapperExt ;
private DashboardNotificationMapperExt dashboardNotificationMapperExt ;
@Autowired
@Autowired
private MonitoringPointCategoryMapperExt monitoringPointCategoryMapperExt ;
private MonitoringPointCategoryMapperExt monitoringPointCategoryMapperExt ;
@Autowired
private LevelMapperExt levelMapperExt ;
@Autowired
@Autowired
private CommonOpt commonOpt ;
private CommonOpt commonOpt ;
@ -60,7 +68,7 @@ public class OverviewServiceImpl implements OverviewService {
public SimpleDataResponse < List < OverviewVO > > getOverviewInfo ( Long userId , Long companyId , Integer languageType , Integer utcOffset ) {
public SimpleDataResponse < List < OverviewVO > > getOverviewInfo ( Long userId , Long companyId , Integer languageType , Integer utcOffset ) {
Map < String , Object > buildingMap = new HashMap < > ( ) ;
Map < String , Object > buildingMap = new HashMap < > ( ) ;
buildingMap . put ( "companyId" , companyId ) ;
buildingMap . put ( "companyId" , companyId ) ;
buildingMap . put ( "bindBuildingIdList" , commonOpt . getBindLevel BuildingIdList ( userId ) ) ;
buildingMap . put ( "bindBuildingIdList" , commonOpt . getBindBuildingIdList ( userId ) ) ;
List < OverviewVO > buildingInfoList = overviewInfoMapperExt . getBuildingInfo ( buildingMap ) ;
List < OverviewVO > buildingInfoList = overviewInfoMapperExt . getBuildingInfo ( buildingMap ) ;
@ -264,4 +272,54 @@ public class OverviewServiceImpl implements OverviewService {
return SimpleDataResponse . success ( dashboardNotificationMapperExt . getNotification ( companyId ) ) ;
return SimpleDataResponse . success ( dashboardNotificationMapperExt . getNotification ( companyId ) ) ;
}
}
@Override
public SimpleDataResponse < List < TreeMenusDTO > > getOverallBoundLevel ( Long companyId , Long userId , Integer languageType ) {
List < Long > bindBuildingIdList = commonOpt . getBindBuildingIdList ( userId ) ;
List < BuildingPathDTO > selectBuildingFullPath = levelMapperExt . selectBuildingFullPath ( bindBuildingIdList ) ;
// 构建节点
Map < String , TreeMenusDTO > nodeMap = new HashMap < > ( ) ;
for ( BuildingPathDTO row : selectBuildingFullPath ) {
String branchKey = "BRANCH-" + row . getBranchId ( ) ;
String storeKey = "STORE-" + row . getStoreId ( ) + "-" + branchKey ;
String areaKey = "AREA-" + row . getAreaId ( ) + "-" + storeKey ;
String siteKey = "SITE-" + row . getSiteId ( ) + "-" + areaKey ;
String buildingKey = "BUILDING-" + row . getBuildingId ( ) + "-" + siteKey ;
nodeMap . putIfAbsent ( branchKey ,
createNode ( branchKey , "ROOT" , row . getBranchName ( ) ) ) ;
nodeMap . putIfAbsent ( storeKey ,
createNode ( storeKey , branchKey , row . getStoreName ( ) ) ) ;
nodeMap . putIfAbsent ( areaKey ,
createNode ( areaKey , storeKey , row . getAreaName ( ) ) ) ;
nodeMap . putIfAbsent ( siteKey ,
createNode ( siteKey , areaKey , row . getSiteName ( ) ) ) ;
nodeMap . putIfAbsent ( buildingKey ,
createNode ( buildingKey , siteKey , row . getBuildingName ( ) ) ) ;
}
List < TreeMenusDTO > allNodes = new ArrayList < > ( nodeMap . values ( ) ) ;
// 原来的 MenuTree
MenuTree tree = new MenuTree ( allNodes ) ;
List < TreeMenusDTO > result = tree . buildTree ( "ROOT" ) ;
return SimpleDataResponse . success ( result ) ;
}
private TreeMenusDTO createNode ( String key , String parentKey , String label ) {
TreeMenusDTO node = new TreeMenusDTO ( ) ;
node . setKey ( key ) ;
node . setParentKey ( parentKey ) ;
node . setLabel ( label ) ;
return node ;
}
}
}