Browse Source

#广宁水利局大屏配置

zhongwei
yang_shj 1 year ago
parent
commit
0fd4b4e84f
  1. 33
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java
  2. 3
      hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitVo.java
  3. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/UserDeptMapper.java
  4. 5
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/UserDeptMapper.xml
  5. 2
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java
  6. 11
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/UserDeptService.java
  7. 21
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaServiceImpl.java
  8. 27
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java
  9. 85
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java
  10. 18
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/UserDeptServiceImpl.java

33
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/entity/UserDeptEntity.java

@ -0,0 +1,33 @@
package com.hnac.hzims.operational.main.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.support.QueryField;
import org.springblade.core.mp.support.SqlCondition;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
/**
* @author ysj
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("hzims_user_dept")
public class UserDeptEntity extends TenantEntity implements Serializable {
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("用户ID")
private Long userId;
@ApiModelProperty("机构Id")
private Long deptId;
}

3
hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitVo.java

@ -17,6 +17,9 @@ public class HydropowerUnitVo {
@ApiModelProperty(value = "水电站机组名称") @ApiModelProperty(value = "水电站机组名称")
private String deivceName; private String deivceName;
@ApiModelProperty(value = "水电站机组名称")
private Integer ord;
@ApiModelProperty(value = "水电站机组实时数据") @ApiModelProperty(value = "水电站机组实时数据")
private HydropowerUnitRealVo hydropowerPumpRealVo; private HydropowerUnitRealVo hydropowerPumpRealVo;

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/UserDeptMapper.java

@ -0,0 +1,11 @@
package com.hnac.hzims.operational.main.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hnac.hzims.operational.main.entity.UserDeptEntity;
/**
* @author ysj
*/
public interface UserDeptMapper extends BaseMapper<UserDeptEntity> {
}

5
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/mapper/UserDeptMapper.xml

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.hnac.hzims.operational.main.mapper.UserDeptMapper">
</mapper>

2
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/ISideHustleService.java

@ -29,6 +29,4 @@ public interface ISideHustleService {
List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types); List<MapMarkerVo> getMapMarker(Long deptId,List<Integer> types);
List<PlanGenerationEntity> getStaionPlanPower(Map<Dept, List<StationEntity>> map); List<PlanGenerationEntity> getStaionPlanPower(Map<Dept, List<StationEntity>> map);
Map<Dept, List<StationEntity>> getAreaOrStaion(Long deptId, List<Integer> types);
} }

11
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/UserDeptService.java

@ -0,0 +1,11 @@
package com.hnac.hzims.operational.main.service;
import com.hnac.hzims.operational.main.entity.UserDeptEntity;
import org.springblade.core.mp.base.BaseService;
/**
* @author ysj
*/
public interface UserDeptService extends BaseService<UserDeptEntity> {
}

21
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/AreaServiceImpl.java

@ -1,10 +1,14 @@
package com.hnac.hzims.operational.main.service.impl; package com.hnac.hzims.operational.main.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hnac.hzims.operational.main.entity.UserDeptEntity;
import com.hnac.hzims.operational.main.service.AreaService; import com.hnac.hzims.operational.main.service.AreaService;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.main.service.UserDeptService;
import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService; import com.hnac.hzims.operational.station.service.IStationService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
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.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
@ -25,7 +29,10 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class AreaServiceImpl implements AreaService { public class AreaServiceImpl implements AreaService {
private final UserDeptService userDeptService;
private final IStationService stationService; private final IStationService stationService;
private final ISysClient sysClient; private final ISysClient sysClient;
/** /**
@ -97,7 +104,19 @@ public class AreaServiceImpl implements AreaService {
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) {
return null; return null;
} }
if(ObjectUtil.isNotEmpty(deptId)){ List<UserDeptEntity> configs = userDeptService.list(new LambdaQueryWrapper<UserDeptEntity>(){{
eq(UserDeptEntity::getUserId, AuthUtil.getUserId());
}});
if(CollectionUtil.isNotEmpty(configs)){
List<StationEntity> stations =stationService.list(new LambdaQueryWrapper<StationEntity>(){{
eq(StationEntity::getType,HomePageConstant.HYDROPOWER);
eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE);
}});
if(CollectionUtil.isEmpty(stations)){
return new HashMap<>();
}
return stations.stream().collect(Collectors.toMap(m->R.getData().stream().filter(dept->m.getRefDept().equals(dept.getId())).collect(Collectors.toList()).get(0), Collections::singletonList));
}else if(ObjectUtil.isNotEmpty(deptId)){
List<Dept> list = R.getData().stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList()); List<Dept> list = R.getData().stream().filter(o->deptId.equals(o.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(list)){ if(CollectionUtil.isEmpty(list)){
return null; return null;

27
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java

@ -23,6 +23,7 @@ import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo;
import com.hnac.hzims.operational.fill.service.GenerateService; import com.hnac.hzims.operational.fill.service.GenerateService;
import com.hnac.hzims.operational.fill.service.PowerService; import com.hnac.hzims.operational.fill.service.PowerService;
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;
@ -42,6 +43,7 @@ import com.hnac.hzinfo.sdk.core.response.Result;
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.CollectionUtil; import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.DateUtil;
@ -82,6 +84,8 @@ public class HydropowerServiceImpl implements HydropowerService {
private final GenerateService generateService; private final GenerateService generateService;
private final UserDeptService userDeptService;
private final PowerService photovoltaicService; private final PowerService photovoltaicService;
private final IImsDutyMainService dutyMainService; private final IImsDutyMainService dutyMainService;
@ -641,6 +645,7 @@ public class HydropowerServiceImpl implements HydropowerService {
// 设备编号 // 设备编号
hydropowerUnitVo.setDeivceCode(real.getDeviceCode()); hydropowerUnitVo.setDeivceCode(real.getDeviceCode());
hydropowerUnitVo.setDeivceName(real.getDeviceName()); hydropowerUnitVo.setDeivceName(real.getDeviceName());
hydropowerUnitVo.setOrd(real.getOrd());
// 实时数据 // 实时数据
hydropowerUnitVo.setHydropowerPumpRealVo(real); hydropowerUnitVo.setHydropowerPumpRealVo(real);
// 指标数据 // 指标数据
@ -652,7 +657,7 @@ public class HydropowerServiceImpl implements HydropowerService {
} }
list.add(hydropowerUnitVo); list.add(hydropowerUnitVo);
} }
return list.stream().sorted(Comparator.comparing(HydropowerUnitVo::getDeivceCode)).collect(Collectors.toList()); return list.stream().sorted(Comparator.comparing(HydropowerUnitVo::getOrd)).collect(Collectors.toList());
} }
/** /**
@ -999,7 +1004,7 @@ public class HydropowerServiceImpl implements HydropowerService {
@Override @Override
public HydropowerScoreVo KPIs(Long deptId) { public HydropowerScoreVo KPIs(Long deptId) {
// 查询水电站站点 // 查询水电站站点
List<StationEntity> stations = stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.HYDROPOWER), HomePageConstant.HYDROPOWER_SERVETYPE); List<StationEntity> stations = this.getStations(deptId);
if (CollectionUtil.isEmpty(stations)) { if (CollectionUtil.isEmpty(stations)) {
return new HydropowerScoreVo(); return new HydropowerScoreVo();
} }
@ -1160,6 +1165,24 @@ public class HydropowerServiceImpl implements HydropowerService {
/** /**
* 获取站点
* @param deptId
* @return
*/
private List<StationEntity> getStations(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);
}});
}
return stationService.getHomeStationList(deptId, Collections.singletonList(HomePageConstant.HYDROPOWER), HomePageConstant.HYDROPOWER_SERVETYPE);
}
/**
* 区域天气 * 区域天气
* @param scale * @param scale
* @param nowWeather * @param nowWeather

85
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/SideHustleServiceImpl.java

@ -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);
} }
/** /**

18
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/UserDeptServiceImpl.java

@ -0,0 +1,18 @@
package com.hnac.hzims.operational.main.service.impl;
import com.hnac.hzims.operational.main.entity.UserDeptEntity;
import com.hnac.hzims.operational.main.mapper.UserDeptMapper;
import com.hnac.hzims.operational.main.service.UserDeptService;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
/**
* @author Lch
*/
@Service
@Slf4j
public class UserDeptServiceImpl extends BaseServiceImpl<UserDeptMapper, UserDeptEntity> implements UserDeptService {
}
Loading…
Cancel
Save