Browse Source

Merge remote-tracking branch 'origin/master'

zhongwei
tyty 1 year ago
parent
commit
f7e019b907
  1. 2
      hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java
  2. 25
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java
  3. 15
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java
  4. 137
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java
  5. 45
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/PointDataVo.java
  6. 37
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java
  7. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java
  8. 62
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/CountrySelectorController.java
  9. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java
  10. 35
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

2
hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/MaintenanceServiceImpl.java

@ -108,7 +108,7 @@ public class MaintenanceServiceImpl extends BaseServiceImpl<MaintenanceMapper, O
regularWorkVO.setRegularWork(0); regularWorkVO.setRegularWork(0);
return regularWorkVO; return regularWorkVO;
} }
regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(id -> id.toString()).collect(Collectors.joining(","))); regularWorkVO.setMainTaskIds(regularWorkList.stream().map(OperMaintenanceTaskEntity::getId).map(Object::toString).collect(Collectors.joining(",")));
regularWorkVO.setRegularWorkSum(regularWorkList.size()); regularWorkVO.setRegularWorkSum(regularWorkList.size());
// 定期工作任务完成数量 // 定期工作任务完成数量
List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList()); List<OperMaintenanceTaskEntity> regularWorkFinishList = regularWorkList.stream().filter(o -> MaintenanceConstant.TASK_STATUS_5 == o.getStatus()).collect(Collectors.toList());

25
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/controller/CentralMonitorController.java

@ -1,18 +1,19 @@
package com.hnac.hzims.operational.config.controller; package com.hnac.hzims.operational.config.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.config.service.CentralMonitorService; import com.hnac.hzims.operational.config.service.CentralMonitorService;
import com.hnac.hzims.operational.config.vo.PointDataVo;
import com.hnac.hzims.operational.station.service.IRealMonitorService; import com.hnac.hzims.operational.station.service.IRealMonitorService;
import com.hnac.hzims.operational.main.vo.RealStationVo; import com.hnac.hzims.operational.main.vo.RealStationVo;
import com.hnac.hzinfo.datasearch.PointData;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -45,4 +46,20 @@ public class CentralMonitorController extends BladeController {
realMonitorService.realTimeData(""); realMonitorService.realTimeData("");
return R.success("true"); return R.success("true");
} }
/**
* 查询通讯告警的最后一小时的运行数据
* @param page
* @param size
* @param roleId
* @return
*/
@GetMapping("/selectCommunication/{page}/{size}")
public R selectCommunication(@PathVariable Integer page,
@PathVariable Integer size,
String roleId){
IPage<PointDataVo> result = monitorService.selectOriginalDataByRealIds(page, size, roleId);
return R.data(result);
}
} }

15
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/CentralMonitorService.java

@ -1,7 +1,11 @@
package com.hnac.hzims.operational.config.service; package com.hnac.hzims.operational.config.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.hnac.hzims.operational.config.vo.PointDataVo;
import com.hnac.hzims.operational.main.vo.RealStationVo; import com.hnac.hzims.operational.main.vo.RealStationVo;
import com.hnac.hzinfo.datasearch.PointData;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import java.util.List; import java.util.List;
@ -15,4 +19,15 @@ public interface CentralMonitorService{
* @return * @return
*/ */
List<RealStationVo> getStationMonitor(); List<RealStationVo> getStationMonitor();
/**
* 查询通讯告警的最后一小时的运行数据
* @param page 当前页
* @param size 每页记录数
* @param roleId
* @return
*/
IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId);
} }

137
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/CentralMonitorServiceImpl.java

@ -1,21 +1,40 @@
package com.hnac.hzims.operational.config.service.impl; package com.hnac.hzims.operational.config.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hnac.hzims.operational.config.service.CentralMonitorService; import com.hnac.hzims.operational.config.service.CentralMonitorService;
import com.hnac.hzims.operational.config.vo.PointDataVo;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
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 com.hnac.hzims.operational.main.vo.RealStationVo; import com.hnac.hzims.operational.main.vo.RealStationVo;
import com.hnac.hzims.operational.ticket.fegin.StationFeginService;
import com.hnac.hzinfo.datasearch.PointData;
import com.hnac.hzinfo.datasearch.history.IHistoryDataSearchClient;
import com.hnac.hzinfo.datasearch.history.OriginalDataQuery;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
import lombok.Getter;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springblade.core.log.exception.ServiceException;
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.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.entity.Dept; import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -24,37 +43,89 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class CentralMonitorServiceImpl implements CentralMonitorService { public class CentralMonitorServiceImpl implements CentralMonitorService {
private final IStationService stationService; private final IStationService stationService;
private final ISysClient sysClient; private final ISysClient sysClient;
private final RedisTemplate redisTemplate; private final RedisTemplate redisTemplate;
private final IHistoryDataSearchClient historyDataSearchClient;
@Value("${hzims.operation.monitor.station}")
public String moniter_station_key; @Value("${hzims.operation.monitor.station}")
public String moniter_station_key;
/**
* 获取站点监控数据 /**
* @return * 获取站点监控数据
*/ *
@Override * @return
public List<RealStationVo> getStationMonitor() { */
// 根据用户权限获取机构 @Override
R<List<Dept>> R = sysClient.getDeptByCurrentUser(); public List<RealStationVo> getStationMonitor() {
if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) { // 根据用户权限获取机构
return null; R<List<Dept>> R = sysClient.getDeptByCurrentUser();
} if (!R.isSuccess() || CollectionUtil.isEmpty(R.getData())) {
List<Long> deptIdList = R.getData().stream().map(Dept::getId).collect(Collectors.toList()); return null;
List<StationEntity> list = stationService.getStationType(null, Collections.singletonList(HomePageConstant.HYDROPOWER),deptIdList); }
if(CollectionUtil.isEmpty(list)){ List<Long> deptIdList = R.getData().stream().map(Dept::getId).collect(Collectors.toList());
return null; List<StationEntity> list = stationService.getStationType(null, Collections.singletonList(HomePageConstant.HYDROPOWER), deptIdList);
} if (CollectionUtil.isEmpty(list)) {
List<String> codeList = list.stream().map(StationEntity::getCode).collect(Collectors.toList()); return null;
if(CollectionUtil.isEmpty(codeList)){ }
return null; List<String> codeList = list.stream().map(StationEntity::getCode).collect(Collectors.toList());
} if (CollectionUtil.isEmpty(codeList)) {
List<RealStationVo> result = (List<RealStationVo>) redisTemplate.opsForValue().get(moniter_station_key); return null;
if(StringUtil.isEmpty(result)){ }
return null; List<RealStationVo> result = (List<RealStationVo>) redisTemplate.opsForValue().get(moniter_station_key);
} if (StringUtil.isEmpty(result)) {
return result.stream().filter(o->codeList.contains(o.getStationCode())).collect(Collectors.toList()); return null;
} }
return result.stream().filter(o -> codeList.contains(o.getStationCode())).collect(Collectors.toList());
}
/**
* 查询通讯告警的最后一小时的运行数据
*
* @param page 当前页
* @param size 每页记录数
* @param roleId
* @return
*/
@Override
public IPage<PointDataVo> selectOriginalDataByRealIds(Integer page, Integer size, String roleId) {
OriginalDataQuery originalDataQuery = new OriginalDataQuery();
originalDataQuery.setRealId(roleId);
originalDataQuery.setLimit(size);
LocalDateTime endTime = LocalDateTime.now();
LocalDateTime startTime = endTime.minusHours(1);
originalDataQuery.setBeginTime(this.getOriginalDate(startTime));
originalDataQuery.setEndTime(this.getOriginalDate(endTime));
Result<HzPage<PointData>> originalDataByRealIds = historyDataSearchClient.getOriginalDataByRealIds(originalDataQuery);
if (!originalDataByRealIds.isSuccess()) {
throw new ServiceException("数据不存在");
}
HzPage<PointData> data = originalDataByRealIds.getData();
List<PointDataVo> collect = data.getRecords().stream().map(item -> {
PointDataVo pointDataVo = new PointDataVo();
BeanUtils.copyProperties(item, pointDataVo);
//通过站点id获取站点名称
String station = pointDataVo.getStation();
String stationName = stationService.selectStationById(station);
pointDataVo.setStationName(stationName);
return pointDataVo;
}).collect(Collectors.toList());
IPage<PointDataVo> iPage = new Page(data.getCurrent(), data.getSize());
iPage.setRecords(collect);
return iPage;
}
/**
* LocalDateTime date
*
* @param localDateTime
* @return
*/
public static Date getOriginalDate(LocalDateTime localDateTime) {
Instant instant = localDateTime.atZone(ZoneId.systemDefault()).toInstant();
return Date.from(instant);
}
} }

45
hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/vo/PointDataVo.java

@ -0,0 +1,45 @@
package com.hnac.hzims.operational.config.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
/**
* @Author WL
* @Version v1.0
* @Serial 1.0
* @Date 2023/8/1 10:37
*/
@Data
public class PointDataVo {
/**
* 站点id
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String station;
/**
* 站点名称
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private String stationName;
/**
* 数据采集时间
*/
private String time;
/**
* 数据
*/
private String value;
/**
* 质量值
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer q;
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private String signage;
}

37
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java

@ -1,12 +1,14 @@
package com.hnac.hzims.operational.main.service.impl; package com.hnac.hzims.operational.main.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.util.concurrent.ThreadFactoryBuilder; import com.google.common.util.concurrent.ThreadFactoryBuilder;
import com.hnac.hzims.equipment.entity.PlanGenerationEntity; import com.hnac.hzims.equipment.entity.PlanGenerationEntity;
import com.hnac.hzims.equipment.feign.IPlanGenertionClient; import com.hnac.hzims.equipment.feign.IPlanGenertionClient;
import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo;
import com.hnac.hzims.operational.fill.entity.*; import com.hnac.hzims.operational.fill.entity.*;
import com.hnac.hzims.operational.fill.service.*; import com.hnac.hzims.operational.fill.service.*;
import com.hnac.hzims.operational.main.constant.HomePageConstant; import com.hnac.hzims.operational.main.constant.HomePageConstant;
@ -55,6 +57,8 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
public class HomeServiceImpl implements HomeService { public class HomeServiceImpl implements HomeService {
private final WindService windService;
private final OverService overService; private final OverService overService;
private final OtherService otherService; private final OtherService otherService;
@ -82,6 +86,8 @@ public class HomeServiceImpl implements HomeService {
@Value("${hzims.operation.homePage.charge.url}") @Value("${hzims.operation.homePage.charge.url}")
public String charge_url; public String charge_url;
public final static String device_cache_final = "hzims:equipment:emInfo:deviceCode.emInfoList";
private final static String load_home_target_key = "load:operation:home:target:key"; private final static String load_home_target_key = "load:operation:home:target:key";
private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key"; private final static String load_hydropower_unit_real_key = "hzims:operation:loadhydropowerunit:real:key";
private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key"; private final static String load_hydropower_unit_target_key = "hzims:operation:loadhydropowerunit:target:key";
@ -234,27 +240,32 @@ public class HomeServiceImpl implements HomeService {
if(CollectionUtil.isEmpty(stations)){ if(CollectionUtil.isEmpty(stations)){
return target; return target;
} }
QueryWrapper<PowerEntity> queryWrapper = new QueryWrapper<PowerEntity>() {{ List<WindEntity> winds = windService.list(Wrappers.<WindEntity>lambdaQuery()
in("create_dept", stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList())); .in(WindEntity::getStationCode, stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))
eq("type", HomePageConstant.WIND_POWER_TYPE); .likeRight(WindEntity::getFillDate, DateUtil.format(new Date(),"yyyy")));
likeRight("mon", DateUtil.format(new Date(),"yyyy")); if(CollectionUtil.isEmpty(winds)){
}};
List<PowerEntity> list = powerService.list(queryWrapper);
if(CollectionUtil.isEmpty(list)){
return target; return target;
} }
double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); double plan = winds.stream().mapToDouble(WindEntity::getPlan).sum();
double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); double power = winds.stream().mapToDouble(WindEntity::getPower).sum();
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() {});
// 装机容量 // 装机容量
target.setTaget_one(list.get(0).getInstalledCapacity()); target.setTaget_one(devices.stream().filter(o->stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(o.getCreateDept())).mapToDouble(EminfoAndEmParamVo::getInstalledCapacity).sum());
// 发电量 // 发电量
target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum()); target.setTaget_two(power);
if(Math.abs(plan) > 0){ if(Math.abs(plan) > 0){
// 发电完成率 // 发电完成率
target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); target.setTaget_three(BigDecimal.valueOf(power / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
} }
// 双票合格率 // 双票合格率
target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); LocalDate firstDay = LocalDate.now().withDayOfYear(1);
LocalDateTime firstDateTime = LocalDateTime.of(firstDay, LocalTime.MIN);
R<List<Dept>> result = sysClient.getDeptList();
List<Long> areas = result.getData().stream().filter(dept -> stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()).contains(dept.getId())).map(Dept::getParentId).collect(Collectors.toList());
DoublePassRateVO pass = ticketClient.getDoublePassRate(areas, firstDateTime, LocalDateTime.now());
if (ObjectUtil.isNotEmpty(pass)) {
target.setTaget_four(Double.valueOf(pass.getDoublePassRate()));
}
return target; return target;
} }

4
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/WindHomeServiceImpl.java

@ -493,13 +493,13 @@ public class WindHomeServiceImpl implements WindHomeService {
.like(WindEntity::getFillDate,DateUtil.format(new Date(),DateUtil.PATTERN_DATE)); .like(WindEntity::getFillDate,DateUtil.format(new Date(),DateUtil.PATTERN_DATE));
}}); }});
if(CollectionUtil.isNotEmpty(winds)){ if(CollectionUtil.isNotEmpty(winds)){
areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getPower).average().orElse(0.0)); areaDuty.setSpeed(winds.stream().mapToDouble(WindEntity::getSpeed).average().orElse(0.0));
areaDuty.setSurfPower(winds.stream().mapToDouble(WindEntity::getSurfPower).sum()); areaDuty.setSurfPower(winds.stream().mapToDouble(WindEntity::getSurfPower).sum());
areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum()); areaDuty.setBelowPower(winds.stream().mapToDouble(WindEntity::getBelowPower).sum());
areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0)); areaDuty.setAvailable(winds.stream().mapToDouble(WindEntity::getAvailable).average().orElse(0.0));
areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum()); areaDuty.setComprehensivePower(winds.stream().mapToDouble(WindEntity::getComprehensivePower).sum());
areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); areaDuty.setPeakPower(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0));
areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getPeakPower).average().orElse(0.0)); areaDuty.setFaultHours(winds.stream().mapToDouble(WindEntity::getFaultHours).average().orElse(0.0));
} }
List<WindEntity> windMons = windService.list(new LambdaQueryWrapper<WindEntity>() {{ List<WindEntity> windMons = windService.list(new LambdaQueryWrapper<WindEntity>() {{
in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList())) in(WindEntity::getStationCode,stations.stream().map(StationEntity::getCode).collect(Collectors.toList()))

62
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/controller/CountrySelectorController.java

@ -0,0 +1,62 @@
package com.hnac.hzims.operational.station.controller;
import io.swagger.annotations.Api;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.Dict;
import org.springblade.system.feign.IDictClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/country/selector")
@Api(value = "国家管理", tags = "国家管理")
public class CountrySelectorController {
@Autowired
private IDictClient iDictClient;
/**
* 查询国家字典数据
*
* @return
*/
@GetMapping("/countryOfIssue")
public R countryOfIssue() {
R<List<Dict>> regionGlobal = iDictClient.getList("region_global");
if (!regionGlobal.isSuccess()) {
return R.fail("查询数据不存在");
}
List<Dict> collect = regionGlobal.getData().stream()
.filter(item -> item.getParentId().longValue() == 1684523498650771L)
.collect(Collectors.toList());
return R.data(collect);
}
/**
* 查询省份字典数据
*
* @return
*/
@GetMapping("/loadProvince")
public R loadProvince() {
R<List<Dict>> regionGlobal = iDictClient.getList("region_global");
if (!regionGlobal.isSuccess()) {
return R.fail("查询数据不存在");
}
List<Dict> collect = regionGlobal.getData().stream()
.filter(item -> item.getParentId().longValue() == 1684523498650771459L)
.collect(Collectors.toList());
return R.data(collect);
}
}

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/IStationService.java

@ -131,4 +131,10 @@ public interface IStationService extends BaseService<StationEntity> {
*/ */
void uniqueStationByStation(String signage); void uniqueStationByStation(String signage);
/**
* 通过站点id获取站点名称
* @param station
* @return
*/
String selectStationById(String station);
} }

35
hzims-service/operational/src/main/java/com/hnac/hzims/operational/station/service/impl/StationServiceImpl.java

@ -2,6 +2,7 @@ package com.hnac.hzims.operational.station.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.service.UserAuthDataService; import com.hnac.hzims.common.service.UserAuthDataService;
@ -37,6 +38,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springblade.core.log.exception.ServiceException; import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.log.logger.BladeLogger; import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
@ -106,19 +108,20 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
/** /**
* 推送站点 * 推送站点
*
* @param req 推送站点内容 * @param req 推送站点内容
*/ */
private void pushStation(StationEntity req) { private void pushStation(StationEntity req) {
// 读取站点类型配置确定是否推送FDP // 读取站点类型配置确定是否推送FDP
StationPushConfigEntity config = StationPushConfigEntity.builder().stationType(req.getType()).build(); StationPushConfigEntity config = StationPushConfigEntity.builder().stationType(req.getType()).build();
StationPushConfigVO configVO = stationPushConfigService.getOne(BeanUtil.copy(config, StationPushConfigDTO.class)); StationPushConfigVO configVO = stationPushConfigService.getOne(BeanUtil.copy(config, StationPushConfigDTO.class));
if(ObjectUtil.isNotEmpty(configVO) && configVO.getIsPush()) { if (ObjectUtil.isNotEmpty(configVO) && configVO.getIsPush()) {
log.info("{}站点开始智能诊断站点推送",req.getCode()); log.info("{}站点开始智能诊断站点推送", req.getCode());
new Thread(() -> questionClient.submitStationInfo(configVO.getFdpStationType(), req.getCode(), "运维平台推送"), "智能诊断站点推送").start(); new Thread(() -> questionClient.submitStationInfo(configVO.getFdpStationType(), req.getCode(), "运维平台推送"), "智能诊断站点推送").start();
} }
// 如果设备数据来源未选定其他 则进行站点初始化操作 // 如果设备数据来源未选定其他 则进行站点初始化操作
if (StationConstants.GATHER.equals(req.getDataOrigin()) && !StationConstants.HZ3000_OTHER.equals(req.getDataSource())) { if (StationConstants.GATHER.equals(req.getDataOrigin()) && !StationConstants.HZ3000_OTHER.equals(req.getDataSource())) {
log.info("{}站点开始数据平台新建项目",req.getCode()); log.info("{}站点开始数据平台新建项目", req.getCode());
new Thread(() -> this.instanceProject(req), "数据平台新建项目").start(); new Thread(() -> this.instanceProject(req), "数据平台新建项目").start();
} }
} }
@ -697,8 +700,30 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn
LambdaQueryWrapper<StationEntity> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(StationEntity::getSignage, signage); queryWrapper.eq(StationEntity::getSignage, signage);
Integer count = baseMapper.selectCount(queryWrapper); Integer count = baseMapper.selectCount(queryWrapper);
if (count > 0){ if (count > 0) {
throw new ServiceException("两票编号抬头已存在"); throw new ServiceException("两票编号抬头已存在");
}
}
/**
* 通过站点id获取站点名称
*
* @param station
* @return
*/
@Override
public String selectStationById(String station) {
if (StringUtils.isEmpty(station)) {
return null;
}
QueryWrapper<StationEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(BaseEntity::getId, station);
queryWrapper.lambda().or().eq(StationEntity::getCode, station);
StationEntity stationEntity = baseMapper.selectOne(queryWrapper);
if (stationEntity != null) {
return stationEntity.getName();
} }
return null;
} }
} }

Loading…
Cancel
Save