|
|
@ -3,6 +3,7 @@ package com.hnac.hzims.operational.main.service.impl; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
import com.alibaba.fastjson.TypeReference; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
import com.hnac.hzims.EquipmentConstants; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
|
import com.hnac.hzims.equipment.entity.EmInfoEntity; |
|
|
@ -24,6 +25,7 @@ import com.hnac.hzims.operational.duty.vo.DutyInfoVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyTaskVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.DutyTaskVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.NextDutyInfoVo; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
import com.hnac.hzims.operational.main.constant.HomePageConstant; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.main.entity.UserDeptEntity; |
|
|
|
import com.hnac.hzims.operational.main.service.*; |
|
|
|
import com.hnac.hzims.operational.main.service.*; |
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
import com.hnac.hzims.operational.main.vo.*; |
|
|
|
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; |
|
|
|
import com.hnac.hzims.operational.maintenance.constants.MaintenanceConstant; |
|
|
@ -43,6 +45,7 @@ import com.xxl.job.core.log.XxlJobLogger; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.core.tool.utils.*; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
|
import org.springblade.system.entity.Dept; |
|
|
@ -66,6 +69,8 @@ import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.springblade.system.user.UserConstants.UserDataScopeTypeEnum.dept; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* @author ysj |
|
|
|
* @author ysj |
|
|
|
*/ |
|
|
|
*/ |
|
|
@ -81,6 +86,8 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private final IStationService stationService; |
|
|
|
private final IStationService stationService; |
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
|
|
|
|
private final UserDeptService userDeptService; |
|
|
|
|
|
|
|
@NotNull |
|
|
|
private final IPlanGenertionClient planGenertionClient; |
|
|
|
private final IPlanGenertionClient planGenertionClient; |
|
|
|
@NotNull |
|
|
|
@NotNull |
|
|
|
private final IOperPhenomenonService operPhenomenonService; |
|
|
|
private final IOperPhenomenonService operPhenomenonService; |
|
|
@ -838,7 +845,7 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<AreaPowerScaleVo> areaPowerScale(Long deptId) { |
|
|
|
public List<AreaPowerScaleVo> areaPowerScale(Long deptId) { |
|
|
|
// 获取区域或者站点map结构
|
|
|
|
// 获取区域或者站点map结构
|
|
|
|
Map<Dept,List<StationEntity>> map = this.getAreaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); |
|
|
|
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); |
|
|
|
if(MapUtils.isEmpty(map)){ |
|
|
|
if(MapUtils.isEmpty(map)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -872,7 +879,7 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<OldAreaScaleVo> areaScale(Long deptId) { |
|
|
|
public List<OldAreaScaleVo> areaScale(Long deptId) { |
|
|
|
// 获取区域或者站点map结构
|
|
|
|
// 获取区域或者站点map结构
|
|
|
|
Map<Dept,List<StationEntity>> map = this.getAreaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); |
|
|
|
Map<Dept,List<StationEntity>> map = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); |
|
|
|
if(MapUtils.isEmpty(map)){ |
|
|
|
if(MapUtils.isEmpty(map)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -941,7 +948,7 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
types = Collections.singletonList(HomePageConstant.HYDROPOWER); |
|
|
|
types = Collections.singletonList(HomePageConstant.HYDROPOWER); |
|
|
|
} |
|
|
|
} |
|
|
|
// 获取集团/区域map结构数据
|
|
|
|
// 获取集团/区域map结构数据
|
|
|
|
Map<Dept, List<StationEntity>> deptMap = this.getAreaOrStaion(deptId,types); |
|
|
|
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,types); |
|
|
|
if (MapUtils.isEmpty(deptMap)) { |
|
|
|
if (MapUtils.isEmpty(deptMap)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -1193,7 +1200,7 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN); |
|
|
|
List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN); |
|
|
|
|
|
|
|
|
|
|
|
// 获取部门
|
|
|
|
// 获取部门
|
|
|
|
Map<Dept, List<StationEntity>> deptMap = this.getAreaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); |
|
|
|
Map<Dept, List<StationEntity>> deptMap = areaService.areaOrStaion(deptId,Collections.singletonList(HomePageConstant.HYDROPOWER)); |
|
|
|
if (MapUtils.isEmpty(deptMap)) { |
|
|
|
if (MapUtils.isEmpty(deptMap)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -1282,45 +1289,6 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取区域或者站点map结构 |
|
|
|
|
|
|
|
* @param deptId |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public Map<Dept, List<StationEntity>> getAreaOrStaion(Long deptId,List<Integer> types) { |
|
|
|
|
|
|
|
//根据用户权限获取机构
|
|
|
|
|
|
|
|
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); |
|
|
|
|
|
|
|
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(ObjectUtil.isNotEmpty(deptId)){ |
|
|
|
|
|
|
|
List<Dept> list = R.getData().stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Dept dept = list.get(0); |
|
|
|
|
|
|
|
// 机构为站点 key-站点机构 value-站点
|
|
|
|
|
|
|
|
if(HomePageConstant.AREA.equals(dept.getDeptCategory())){ |
|
|
|
|
|
|
|
List<StationEntity> stationList = stationService.getStationList(R.getData(),dept.getId(),types,HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Map<Dept, List<StationEntity>> map = new HashMap<>(); |
|
|
|
|
|
|
|
stationList.forEach(item->{ |
|
|
|
|
|
|
|
List<Dept> stationDeptList = R.getData().stream().filter(o->o.getId().equals(item.getRefDept())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stationDeptList)){ |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 站点机构
|
|
|
|
|
|
|
|
Dept station = stationDeptList.get(0); |
|
|
|
|
|
|
|
map.put(station,Collections.singletonList(item)); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return map; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return areaService.getAuthArea(R.getData(),deptId,types,HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设备信息设置 |
|
|
|
* 设备信息设置 |
|
|
@ -1544,7 +1512,6 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PowerFinishVo powerFinishMonth(Long deptId) { |
|
|
|
public PowerFinishVo powerFinishMonth(Long deptId) { |
|
|
|
// 获取用户权限机构
|
|
|
|
|
|
|
|
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); |
|
|
|
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); |
|
|
|
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { |
|
|
|
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
@ -1555,8 +1522,32 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
Dept area = list.get(0); |
|
|
|
Dept area = list.get(0); |
|
|
|
|
|
|
|
// 获取用户权限机构
|
|
|
|
|
|
|
|
List<StationEntity> stations = this.getPowerStation(R.getData(),area,deptId); |
|
|
|
|
|
|
|
if(CollectionUtil.isEmpty(stations)){ |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<String> dayList = this.getCurrentDayList(); |
|
|
|
|
|
|
|
// 获取区域月发电数据
|
|
|
|
|
|
|
|
return this.getPowerMonth(area,dayList,stations); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 智能生产-水电站获取 |
|
|
|
|
|
|
|
* @param deptId |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<StationEntity> getPowerStation(List<Dept> depts,Dept area,Long deptId) { |
|
|
|
|
|
|
|
List<UserDeptEntity> configs = userDeptService.list(new LambdaQueryWrapper<UserDeptEntity>(){{ |
|
|
|
|
|
|
|
eq(UserDeptEntity::getUserId, AuthUtil.getUserId()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(configs)){ |
|
|
|
|
|
|
|
return stationService.list(new LambdaQueryWrapper<StationEntity>(){{ |
|
|
|
|
|
|
|
eq(StationEntity::getType,HomePageConstant.HYDROPOWER); |
|
|
|
|
|
|
|
eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
} |
|
|
|
// 获取区域下站点级机构集合
|
|
|
|
// 获取区域下站点级机构集合
|
|
|
|
List<Long> stationDeprList = homePageService.getChildDept(R.getData(), area.getId(), new ArrayList<>()); |
|
|
|
List<Long> stationDeprList = homePageService.getChildDept(depts, area.getId(), new ArrayList<>()); |
|
|
|
if (CollectionUtil.isEmpty(stationDeprList)) { |
|
|
|
if (CollectionUtil.isEmpty(stationDeprList)) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
@ -1565,9 +1556,7 @@ public class SideHustleServiceImpl implements ISideHustleService { |
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> dayList = this.getCurrentDayList(); |
|
|
|
return stationList; |
|
|
|
// 获取区域月发电数据
|
|
|
|
|
|
|
|
return this.getPowerMonth(area,dayList,stationList); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|