Browse Source

#数据关联

zhongwei
yang_shj 1 year ago
parent
commit
099e778623
  1. 36
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java
  2. 8
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java
  3. 190
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

36
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java

@ -5,6 +5,10 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO;
import com.hnac.hzims.operational.access.vo.OperAccessTaskVO;
import com.hnac.hzims.operational.census.service.TargetService;
import com.hnac.hzims.operational.census.vo.CompleteGenerationVo;
import com.hnac.hzims.operational.census.vo.CompleteTicketVo;
import com.hnac.hzims.operational.census.vo.ElectricGenerationVo;
import com.hnac.hzims.operational.census.vo.InstalledCapacityVo;
import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO;
import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO;
import io.swagger.annotations.Api;
@ -33,21 +37,17 @@ public class TargetController {
@ApiOperation("装机容量统计:区分填报/接入站点")
@PostMapping("/installed-capacity")
@ApiOperationSupport(order = 1)
public R installedCapacity(@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size) {
return R.data(service.installedCapacity(stationName,type,current,size));
public R<IPage<InstalledCapacityVo>> installedCapacity(Query query,@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type) {
return R.data(service.installedCapacity(Condition.getPage(query),stationName,type));
}
@ApiOperation("发电量统计:区分填报/接入站点")
@PostMapping("/electric-generation")
@ApiOperationSupport(order = 2)
public R electricGeneration(@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size) {
return R.data(service.electricGeneration(stationName,type,current,size));
public R<IPage<ElectricGenerationVo>> electricGeneration(Query query, @RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type) {
return R.data(service.electricGeneration(Condition.getPage(query),stationName,type));
}
@ -55,11 +55,9 @@ public class TargetController {
@ApiOperation("计划发电量/实际发电量统计:区分填报/接入站点")
@PostMapping("/complete-generation")
@ApiOperationSupport(order = 3)
public R completeGeneration(@RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size) {
return R.data(service.completeGeneration(stationName,type,current,size));
public R<IPage<CompleteGenerationVo>> completeGeneration(Query query, @RequestParam(value = "stationName",required = false) String stationName,
@RequestParam(value = "type") Integer type) {
return R.data(service.completeGeneration(Condition.getPage(query),stationName,type));
}
@ -67,11 +65,9 @@ public class TargetController {
@ApiOperation("两票统计:区分填报/平台业务数据")
@PostMapping("/complete-ticket")
@ApiOperationSupport(order = 4)
public R completeTicket(@RequestParam(value = "areaName",required = false) String areaName,
@RequestParam(value = "type") Integer type,
@RequestParam(value = "current") Integer current,
@RequestParam(value = "size") Integer size) {
return R.data(service.completeTicket(areaName,type,current,size));
public R<IPage<CompleteTicketVo>> completeTicket(Query query,@RequestParam(value = "areaName",required = false) String areaName,
@RequestParam(value = "type") Integer type) {
return R.data(service.completeTicket(Condition.getPage(query),areaName,type));
}
@ApiLog

8
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java

@ -19,16 +19,16 @@ import java.util.List;
public interface TargetService {
// 获取站点装机容量
List<InstalledCapacityVo> installedCapacity(String stationName,Integer type,Integer current,Integer size);
IPage<InstalledCapacityVo> installedCapacity(IPage<InstalledCapacityVo> page,String stationName,Integer type);
// 发电量统计
List<ElectricGenerationVo> electricGeneration(String stationName,Integer type,Integer current,Integer size);
IPage<ElectricGenerationVo> electricGeneration(IPage<ElectricGenerationVo> page,String stationName,Integer type);
// 计划发电量/实际发电量统计
List<CompleteGenerationVo> completeGeneration(String stationName,Integer type,Integer current,Integer size);
IPage<CompleteGenerationVo> completeGeneration(IPage<CompleteGenerationVo> page,String stationName,Integer type);
// 两票统计
List<CompleteTicketVo> completeTicket(String areaName,Integer type,Integer current,Integer size);
IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type);
// 缺陷率统计
List<CompleteDefectVo> defect(String areaName, Integer type);

190
hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java

@ -118,21 +118,21 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<InstalledCapacityVo> installedCapacity(String stationName,Integer type,Integer current,Integer size) {
public IPage<InstalledCapacityVo> installedCapacity(IPage<InstalledCapacityVo> page,String stationName,Integer type) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
wappers.eq(StationEntity::getServeType,2);
//wappers.eq(StationEntity::getServeType,2);
if(!StringUtils.isEmpty(stationName)){
wappers.like(StationEntity::getName,stationName);
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
// 设备
List<EminfoAndEmParamVo> devices = maintenanceService.getEmInfoList();
return stations.stream().map(station->{
List<InstalledCapacityVo> capacitys = stations.stream().map(station->{
InstalledCapacityVo item = new InstalledCapacityVo();
item.setStationName(station.getName());
List<EminfoAndEmParamVo> stationDevices = devices.stream().filter(device->device.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
@ -148,7 +148,10 @@ public class TargetServiceImpl implements TargetService {
List<String> details = stationDevices.stream().map(device-> "[" + device.getName() + " " +device.getInstalledCapacity() +"kw]").collect(Collectors.toList());
item.setDetail(String.join("|",details));
return item;
}).filter(capacity->Math.abs(capacity.getInstalledCapacity()) > 0).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
}).filter(capacity->Math.abs(capacity.getInstalledCapacity()) > 0).collect(Collectors.toList());
page.setTotal(capacitys.size());
page.setRecords(capacitys.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -156,26 +159,27 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<ElectricGenerationVo> electricGeneration(String stationName,Integer type,Integer current,Integer size) {
public IPage<ElectricGenerationVo> electricGeneration(IPage<ElectricGenerationVo> page,String stationName,Integer type) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
wappers.eq(StationEntity::getServeType,2);
//wappers.eq(StationEntity::getServeType,2);
if(!StringUtils.isEmpty(stationName)){
wappers.like(StationEntity::getName,stationName);
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
List<ElectricGenerationVo> electrics;
// 填报数据
if(HomePageConstant.HYDROPOWER.equals(type)){
// 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
return page;
}
return stations.stream().map(station->{
electrics = stations.stream().map(station->{
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
@ -191,50 +195,53 @@ public class TargetServiceImpl implements TargetService {
List<String> details = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).map(target-> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getPowerYear() +"kWh]").collect(Collectors.toList());
item.setDetail(String.join("|",details));
return item;
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
}else if(HomePageConstant.PHOTOVOLTAIC.equals(type)){
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList());
}else if(HomePageConstant.PHOTOVOLTAIC.equals(type)) {
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
if(CollectionUtil.isEmpty(targets)){
return new ArrayList<>();
if (CollectionUtil.isEmpty(targets)) {
return page;
}
return stations.stream().map(station->{
electrics = stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(device->device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationTargets)){
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(device -> device.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(stationTargets)) {
item.setElectricGeneration(0.0);
item.setDetail("站点暂无发电");
return item;
}
// 年发电量
double sum = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum();
double sum = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).mapToDouble(PhotovoltaicTargetVo::getGenerationYear).sum();
item.setElectricGeneration(sum);
// 发电量详情
List<String> details = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).map(target-> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getGenerationYear() +"kWh]").collect(Collectors.toList());
item.setDetail(String.join("|",details));
List<String> details = targets.stream().filter(target -> target.getDeptId().equals(station.getRefDept())).map(target -> "[" + Optional.ofNullable(target.getDeviceCode()).orElse("填报电量") + " " + target.getGenerationYear() + "kWh]").collect(Collectors.toList());
item.setDetail(String.join("|", details));
return item;
}).filter(generate->Math.abs(generate.getElectricGeneration()) > 0).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
}).filter(generate -> Math.abs(generate.getElectricGeneration()) > 0).collect(Collectors.toList());
}else{
// 查询填报数据
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
electrics = stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setElectricGeneration(0.0);
}else{
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
}
item.setDetail("站点为填报数据,暂无设备装机发电量信息!");
return item;
}).collect(Collectors.toList());
}
// 查询填报数据
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
return stations.stream().map(station -> {
ElectricGenerationVo item = new ElectricGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setElectricGeneration(0.0);
}else{
item.setElectricGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
}
item.setDetail("站点为填报数据,暂无设备装机发电量信息!");
return item;
}).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
page.setTotal(electrics.size());
page.setRecords(electrics.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -242,27 +249,28 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<CompleteGenerationVo> completeGeneration(String stationName,Integer type,Integer current,Integer size) {
public IPage<CompleteGenerationVo> completeGeneration(IPage<CompleteGenerationVo> page,String stationName,Integer type) {
// 站点
LambdaQueryWrapper<StationEntity> wappers = Wrappers.lambdaQuery();
wappers.eq(StationEntity::getType, type);
wappers.eq(StationEntity::getServeType,2);
//wappers.eq(StationEntity::getServeType,2);
if(!StringUtils.isEmpty(stationName)){
wappers.like(StationEntity::getName,stationName);
}
List<StationEntity> stations = stationService.list(wappers);
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
return page;
}
List<CompleteGenerationVo> generations;
if(HomePageConstant.HYDROPOWER.equals(type)){
// 计划发电量
List<PlanGenerationEntity> plans = planClient.getPlanGenerationByParam(stations.stream().map(StationEntity::getCode).collect(Collectors.toList()), null, DateUtil.format(new Date(), "yyyy"));
// 设备指标数据
List<HydropowerUnitTargetVo> targets = (List<HydropowerUnitTargetVo>) redisTemplate.opsForValue().get(load_hydropower_unit_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
return page;
}
return stations.stream().map(station->{
generations = stations.stream().map(station->{
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
List<HydropowerUnitTargetVo> stationTargets = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
@ -292,8 +300,7 @@ public class TargetServiceImpl implements TargetService {
item.setCompleteRate(0.0);
}
return item;
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0)
.skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList());
}else if(HomePageConstant.PHOTOVOLTAIC.equals(type)){
// 计划发电量
String mon = DateUtil.format(new Date(),"yyyy");
@ -304,9 +311,9 @@ public class TargetServiceImpl implements TargetService {
// 设备指标数据
List<PhotovoltaicTargetVo> targets = (List<PhotovoltaicTargetVo>) redisTemplate.opsForValue().get(load_photovoltaic_target_key);
if(CollectionUtils.isEmpty(targets)){
return new ArrayList<>();
return page;
}
return stations.stream().map(station->{
generations = stations.stream().map(station->{
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
List<PhotovoltaicTargetVo> stationTargets = targets.stream().filter(target->target.getDeptId().equals(station.getRefDept())).collect(Collectors.toList());
@ -336,29 +343,33 @@ public class TargetServiceImpl implements TargetService {
item.setCompleteRate(0.0);
}
return item;
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
}).filter(complete->Math.abs(complete.getPlanGeneration()) > 0 || Math.abs(complete.getRealityGeneration()) > 0).collect(Collectors.toList());
}else{
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
generations = stations.stream().map(station -> {
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setPlanGeneration(0.0);
item.setRealityGeneration(0.0);
item.setCompleteRate(0.0);
}else{
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear());
item.setRealityGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
item.setCompleteRate(Double.valueOf(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerRateYear()));
}
return item;
}).collect(Collectors.toList());
}
String mon = DateUtil.format(new Date(),"yyyy");
List<PowerEntity> powers = powerService.list(Wrappers.<PowerEntity>lambdaQuery()
.in(PowerEntity::getCreateDept,stations.stream().map(StationEntity::getRefDept).collect(Collectors.toList()))
.ge(PowerEntity::getMon, mon + "-01")
);
return stations.stream().map(station -> {
CompleteGenerationVo item = new CompleteGenerationVo();
item.setStationName(station.getName());
// 发电量
List<PowerEntity> stationPowers = powers.stream().filter(o->o.getCreateDept().equals(station.getRefDept())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(stationPowers)){
item.setPlanGeneration(0.0);
item.setRealityGeneration(0.0);
item.setCompleteRate(0.0);
}else{
item.setPlanGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPlannedPowerYear());
item.setRealityGeneration(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerYear());
item.setCompleteRate(Double.valueOf(stationPowers.stream().sorted(Comparator.comparing(PowerEntity::getMon).reversed()).collect(Collectors.toList()).get(0).getPowerRateYear()));
}
return item;
}).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
page.setTotal(generations.size());
page.setRecords(generations.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -366,10 +377,13 @@ public class TargetServiceImpl implements TargetService {
* @return
*/
@Override
public List<CompleteTicketVo> completeTicket(String areaName,Integer type,Integer current,Integer size) {
public IPage<CompleteTicketVo> completeTicket(IPage<CompleteTicketVo> page,String areaName,Integer type) {
// 光伏/风电双票填报数据
if(HomePageConstant.WIND_POWER.equals(type) || HomePageConstant.PHOTOVOLTAIC.equals(type)){
return this.getcompleteFillTicket(areaName,type,current,size);
List<CompleteTicketVo> completes = this.getcompleteFillTicket(areaName,type);
page.setTotal(completes.size());
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
// 平台业务数据
List<Integer> types;
@ -380,7 +394,7 @@ public class TargetServiceImpl implements TargetService {
}
List<Dept> areas = this.areas(types);
if(CollectionUtils.isEmpty(areas)){
return new ArrayList<>();
return page;
}
// 开始时间
LocalDate firstDay = LocalDate.now().withDayOfYear(1);
@ -389,7 +403,7 @@ public class TargetServiceImpl implements TargetService {
ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(areas.size(), namedThreadFactory, new ThreadPoolExecutor.AbortPolicy());
//监控线程执行完后返回结果
CountDownLatch countDownLatch = new CountDownLatch(areas.size());
List<CompleteTicketVo> completeTickets = new ArrayList<>();
List<CompleteTicketVo> completes = new ArrayList<>();
exe.execute(()-> {
if(StringUtil.isEmpty(areaName)){
for (Dept dept: areas.stream().filter(area->area.getDeptName().equals(areaName)).collect(Collectors.toList())) {
@ -407,7 +421,7 @@ public class TargetServiceImpl implements TargetService {
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString());
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
}
completeTickets.add(completeTicketVo);
completes.add(completeTicketVo);
}
}else{
for (Dept dept: areas) {
@ -425,7 +439,7 @@ public class TargetServiceImpl implements TargetService {
completeTicketVo.setCompleteCount(doublePass.getDoubleTicketPassCount().toString());
completeTicketVo.setCompleteRate(doublePass.getDoublePassRate());
}
completeTickets.add(completeTicketVo);
completes.add(completeTicketVo);
}
countDownLatch.countDown();
}
@ -438,7 +452,9 @@ public class TargetServiceImpl implements TargetService {
Thread.currentThread().interrupt();
}
exe.shutdown();
return completeTickets.stream().filter(complete->Math.abs(Integer.parseInt(complete.getTicketCount())) > 0 || Math.abs(Integer.parseInt(complete.getCompleteCount())) > 0).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
page.setTotal(completes.size());
page.setRecords(completes.stream().skip((page.getCurrent() - 1) * page.getSize()).limit(page.getSize()).collect(Collectors.toList()));
return page;
}
/**
@ -472,10 +488,10 @@ public class TargetServiceImpl implements TargetService {
* @param type
* @return
*/
private List<CompleteTicketVo> getcompleteFillTicket(String stationName, Integer type,Integer current,Integer size) {
private List<CompleteTicketVo> getcompleteFillTicket(String stationName, Integer type) {
List<StationEntity> stations = stationService.list(Wrappers.<StationEntity>lambdaQuery()
.eq(StationEntity::getType, type)
.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
//.eq(StationEntity::getServeType,HomePageConstant.HYDROPOWER_SERVETYPE)
.like(StationEntity::getName,stationName));
if(CollectionUtils.isEmpty(stations)){
return new ArrayList<>();
@ -499,7 +515,7 @@ public class TargetServiceImpl implements TargetService {
item.setCompleteRate(String.valueOf(BigDecimal.valueOf(rate/ stationPower.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
}
return item;
}).skip((long) (current - 1) * size).limit(size).collect(Collectors.toList());
}).collect(Collectors.toList());
}
/**
@ -704,7 +720,7 @@ public class TargetServiceImpl implements TargetService {
return null;
}
// 查询日常维护任务
params.setDeptIds(areas.entrySet().stream().map(entry->entry.getKey().getId()).collect(Collectors.toList()));
params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList()));
return maintenanceTaskService.list(params,query);
}
@ -723,7 +739,7 @@ public class TargetServiceImpl implements TargetService {
return null;
}
// 查询检修任务
params.setDeptIds(areas.keySet().stream().map(key-> key.getId()).collect(Collectors.toList()));
params.setDeptIds(areas.keySet().stream().map(Dept::getId).collect(Collectors.toList()));
return accessTaskService.list(params,query);
}
@ -1003,19 +1019,19 @@ public class TargetServiceImpl implements TargetService {
if(CollectionUtils.isEmpty(faultList)){
group.setFaultCount(0L);
}else{
group.setFaultCount(numbers.stream().filter(number -> faultList.contains(number)).count());
group.setFaultCount(numbers.stream().filter(faultList::contains).count());
}
// 检修
if(CollectionUtils.isEmpty(overhaultList)){
group.setFaultCount(0L);
}else{
group.setFaultCount(numbers.stream().filter(number -> overhaultList.contains(number)).count());
group.setFaultCount(numbers.stream().filter(overhaultList::contains).count());
}
// 运行
if(CollectionUtils.isEmpty(runtList)){
group.setFaultCount(0L);
}else{
group.setFaultCount(numbers.stream().filter(number -> runtList.contains(number)).count());
group.setFaultCount(numbers.stream().filter(runtList::contains).count());
}
// 备用
group.setReserveCount(numbers.size() - group.getFaultCount() - group.getOverhaultCount() - group.getRunCount());

Loading…
Cancel
Save