Commit fef5cceb authored by tangwei's avatar tangwei

Merge branch 'developer' into dev0124

# Conflicts: # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/util/NumberUtil.java
parents 1f15dc31 58f336f5
......@@ -94,8 +94,8 @@ public class AcceptanceDto extends BaseDto {
private Long peasantHouseholdId;
//验收单id
private Long acceptanceCheckItemId;
}
......@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AcceptanceMapper extends BaseMapper<BaseEntity> {
/**
* 分页查询验收列表数据
......@@ -14,8 +16,8 @@ public interface AcceptanceMapper extends BaseMapper<BaseEntity> {
* @param acceptanceDto 查询参数
* @return 分页结果
*/
IPage<AcceptanceDto> page(
@Param("page") IPage<AcceptanceDto> page,
List<AcceptanceDto> page(
@Param("param") AcceptanceDto acceptanceDto
);
}
......@@ -16,11 +16,14 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
List<PeasantHousehold> selectPeasantHouseholdList(@Param("developerId") Long developerId,
@Param("regionalCompaniesSeq")Long regionalCompaniesSeq,
@Param("peasantHouseholdNo")String peasantHouseholdNo,
@Param("ownersName")String ownersName
@Param("ownersName")String ownersName,
@Param("ids")String ids
);
List<PeasantHousehold> selectPeasantHouseholdListsg(@Param("developerId") Long developerId,
@Param("regionalCompaniesSeq")Long regionalCompaniesSeq,
@Param("peasantHouseholdNo")String peasantHouseholdNo,
@Param("ownersName")String ownersName
@Param("ownersName")String ownersName,
@Param("ids")String ids
);
}
package com.yeejoin.amos.boot.module.hygf.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem;
......@@ -14,7 +15,7 @@ public interface IAcceptanceService {
* @param acceptanceDto 查询参数
* @return 分页结果
*/
IPage<AcceptanceDto> page(IPage<AcceptanceDto> page, AcceptanceDto acceptanceDto);
Page<AcceptanceDto> page(Integer current, Integer size, AcceptanceDto acceptanceDto);
/**
* 根据sequenceNbr查询验收详情(线下验收)
......
......@@ -41,10 +41,11 @@ public class NumberUtil {
return num;
}else{
int num = rand.nextInt(9000) + 1;
needQueryResProductList.put("num",num);
needQueryResProductList.put("num",num);
return num;
}
return num;
}
}
......@@ -55,13 +56,13 @@ public class NumberUtil {
code= code+ getChineseStr(address.replace("省","")
.replace("市","")
.replace("区","")
.replace("县","")
.replace(",",""));
.replace("市","")
.replace("区","")
.replace("县","")
.replace(",",""));
code= type+code+dateFormat()+getnum();
return code;
return code;
}
}
......@@ -33,6 +33,8 @@
bga.next_executor_ids nextExecutorIds,
bga.next_node_key nextNodeKey,
(select hygf_acceptance_check_item.sequence_nbr from hygf_acceptance_check_item where hygf_acceptance_check_item.work_order_power_station_id=bga.work_order_power_station_id LIMIT 1) acceptanceCheckItemId,
hygf_work_order.region_company_id regionCompanyId,
ph.regional_companies_code AS regionalCompaniesCode,
ph.regional_companies_name AS regionalCompaniesName,
......
......@@ -64,7 +64,7 @@
AND hbga.grid_status = #{map.gridStatus}
</if>
<if test="map.gridConnectionTime != null">
AND DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d') = DATE_FORMAT(map.gridConnectionTime, '%Y-%m-%d')
AND DATE_FORMAT(hogaa.grid_connection_time, '%Y-%m-%d') = DATE_FORMAT( #{map.gridConnectionTime}, '%Y-%m-%d')
</if>
</where>
ORDER BY hogaa.grid_connection_time desc ,hogaa.rec_date desc
......
......@@ -12,6 +12,10 @@ and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq}
and hygf_peasant_household.survey_or_not=3 and hygf_peasant_household.sequence_nbr not in
(select hygf_document_station.station_id from hygf_preparation_money LEFT JOIN hygf_document_station
on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nbr where hygf_preparation_money.delivery_state !='已作废'
<if test="ids!=null and ids !=''">
and hygf_document_station.preparation_money_id !=#{ids}
</if>
and hygf_document_station.station_id is not null
)
<if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''">
......@@ -34,6 +38,10 @@ and hygf_document_station.station_id is not null
and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq}
and hygf_peasant_household.sequence_nbr not in (
select hygf_work_order_power_station.peasant_household_id from hygf_work_order_power_station
where 1=1
<if test="ids!=null and ids !=''">
and hygf_work_order_power_station.work_order_id !=#{ids}
</if>
)
<if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''">
and hygf_peasant_household.peasant_household_no like concat(concat("%",#{peasantHouseholdNo}),"%")
......
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto;
......@@ -32,7 +33,7 @@ public class AcceptanceController extends BaseController {
@PostMapping(value = "/page")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "Get", value = "获取验收单列表", notes = "获取验收单列表")
public ResponseModel<IPage<AcceptanceDto>> page(
public ResponseModel<Page<AcceptanceDto>> page(
@RequestParam(value = "current", required = false, defaultValue = "1") Integer current,
@RequestParam(value = "size", required = false, defaultValue = "20") Integer size,
@RequestBody AcceptanceDto param
......@@ -43,10 +44,8 @@ public class AcceptanceController extends BaseController {
param.setAmosDealerId(userUnitInformationDto.getAmosDealerId());
}
IPage<AcceptanceDto> page = new Page<>(current, size);
page = acceptanceService.page(page, param);
return ResponseHelper.buildResponse(page);
return ResponseHelper.buildResponse( acceptanceService.page(current, size, param));
}
@GetMapping("/acceptance-details")
......
......@@ -289,8 +289,8 @@ public class TdHygfJpInverterWarnController extends BaseController {
if (nameMaps.containsKey(map.getThirdStationId())){
map.setStationName(nameMaps.get(map.getThirdStationId()));
}
map.setTimeLongFormat(TimeUtil
.longFormat(map.getTimeLong()));
String te= map.getTimeLong()!=null?TimeUtil.longFormat(map.getTimeLong()):"";
map.setTimeLongFormat(te);
}
result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content));
......
......@@ -739,7 +739,7 @@ public class UnitInfoController extends BaseController {
) {
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,null,null);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,null,null,null);
List<Map<String,Object>> date=new ArrayList<>();
if(list!=null){
......@@ -763,10 +763,11 @@ public class UnitInfoController extends BaseController {
@RequestParam(value = "current") int current,
@RequestParam (value = "size") int size,
@RequestParam (required=false) String peasantHouseholdNo,
@RequestParam (required=false) String ownersName
@RequestParam (required=false) String ownersName,
@RequestParam (required=false) String ids
) {
return ResponseHelper.buildResponse(unitInfoServiceImpl.getPeasantHouseholdData( unitInfoId,regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName));
return ResponseHelper.buildResponse(unitInfoServiceImpl.getPeasantHouseholdData( unitInfoId,regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName,ids));
}
......@@ -829,11 +830,12 @@ public ResponseModel< List<Map<String,Object>> > getRegionalCompanieByuser(
@RequestParam(value = "current") int current,
@RequestParam (value = "size") int size,
@RequestParam (required=false) String peasantHouseholdNo,
@RequestParam (required=false) String ownersName
@RequestParam (required=false) String ownersName,
@RequestParam (required=false) String ids
) {
UserUnitInformationDto userUnitInformationDto=personnelBusinessMapper.getUserUnitInformationDto( getUserInfo().getUserId());
return ResponseHelper.buildResponse(unitInfoServiceImpl.selectPeasantHouseholdListsg( userUnitInformationDto.getAmosDealerId(),regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName));
return ResponseHelper.buildResponse(unitInfoServiceImpl.selectPeasantHouseholdListsg( userUnitInformationDto.getAmosDealerId(),regionalCompaniesSeq, current,size,peasantHouseholdNo,ownersName, ids));
}
}
......@@ -2,11 +2,15 @@ package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.module.hygf.api.Enum.AcceptanceStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.StandardDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem;
import com.yeejoin.amos.boot.module.hygf.api.entity.BasicGridAcceptance;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceCheckItemMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAcceptanceMapper;
......@@ -44,7 +48,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService {
* @return 分页结果
*/
@Override
public IPage<AcceptanceDto> page(IPage<AcceptanceDto> page, AcceptanceDto acceptanceDto) {
public Page<AcceptanceDto> page(Integer current, Integer size, AcceptanceDto acceptanceDto) {
if (Objects.nonNull(acceptanceDto)) {
// 处理提交日期
......@@ -57,9 +61,16 @@ public class AcceptanceServiceImpl implements IAcceptanceService {
}
}
}
IPage<AcceptanceDto> resultPage = acceptanceMapper.page(page, acceptanceDto);
return resultPage;
PageHelper.startPage(current, size);
List<AcceptanceDto> resultPage = acceptanceMapper.page(acceptanceDto);
PageInfo<AcceptanceDto> page = new PageInfo(resultPage);
Page<AcceptanceDto> pagenew = new Page<AcceptanceDto>();
pagenew.setCurrent(current);
pagenew.setTotal(page.getTotal());
pagenew.setSize(size);
pagenew.setRecords(page.getList());
return pagenew;
}
/**
......
......@@ -50,14 +50,14 @@ public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAccepta
PageHelper.startPage(current, size);
Map<String, Object> map = new HashMap<>();
Date date = null;
if (StringUtils.isNotEmpty(gridConnectionTime)) {
date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss");
}
// if (StringUtils.isNotEmpty(gridConnectionTime)) {
// date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss");
// }
map.put("projectAddress", projectAddress);
map.put("powerStationCode", powerStationCode);
map.put("ownersName", ownersName);
map.put("gridStatus", gridStatus);
map.put("gridConnectionTime", date);
map.put("gridConnectionTime", gridConnectionTime);
map.put("formType", formType);
map.put("regionCompanyId", regionCompanyId);
map.put("amosDealerId", amosDealerId);
......
......@@ -978,10 +978,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
int pageNum,
int pageSize,
String peasantHouseholdNo,
String ownersName){
String ownersName,
String ids){
PageHelper.startPage(pageNum, pageSize);
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,peasantHouseholdNo,ownersName);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdList(unitInfo.getAmosCompanySeq(),regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids);
PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum);
......@@ -995,9 +996,10 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
int pageNum,
int pageSize,
String peasantHouseholdNo,
String ownersName){
String ownersName,
String ids){
PageHelper.startPage(pageNum, pageSize);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId,regionalCompaniesSeq,peasantHouseholdNo,ownersName);
List<PeasantHousehold> list=peasantHouseholdMapper.selectPeasantHouseholdListsg(unitInfoId,regionalCompaniesSeq,peasantHouseholdNo,ownersName,ids);
PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum);
......
......@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
......@@ -77,6 +78,8 @@ public class BigScreenAnalyseController extends BaseController {
@Autowired
RiskWarningFeign riskWarningFeign;
@Autowired
IPermissionService permissionService;
@Autowired
......@@ -107,14 +110,14 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) {
List<String> gatewayIds = this.getGatewayIds();
if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId();
}
HashMap<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode);
List<Map<String, Object>> healthListInfo = idxBizFanHealthIndexMapper.getHealthListInfo(areaCode, stationCode, gatewayIds);
List<String> time = new ArrayList<>();
List<String> valueList = new ArrayList<>();
healthListInfo.forEach(item -> {
......@@ -808,7 +811,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@GetMapping("/getFullViewRecall")
public ResponseModel<Map<String, Object>> getFullViewRecall() {
HashMap<String, Object> resultMapFinally = new HashMap<>();
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
......@@ -825,9 +828,9 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList();
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds);
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall();
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(null);
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
Collectors.groupingBy(FullViewRecallDataDTO::getStation,
......@@ -1151,4 +1154,16 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
return ResponseHelper.buildResponse(true);
}
/**
* 获取用户权限(此处使用gatewayId)
*
* @return gatewayIds
*/
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
}
......@@ -16,6 +16,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointTag;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointTagMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanHealthIndexServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexHourMapper;
......@@ -27,6 +28,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexMoment;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -44,7 +46,7 @@ import java.util.*;
import java.util.stream.Collectors;
/**
*
*
*
* @author system_generator
* @date 2023-08-15
......@@ -69,6 +71,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
FanHealthIndexMomentMapper fanHealthIndexMomentMapper;
@Autowired
FanWaringRecordMapper fanWarningRecord;
@Autowired
IPermissionService permissionService;
public final DecimalFormat df = new DecimalFormat("#.0");
public final DecimalFormat dfSS = new DecimalFormat("#.00");
......@@ -238,11 +242,11 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime
) {
if(address.isEmpty()||statioName.isEmpty()||equipmentName.isEmpty()||arae.isEmpty()){
if(StringUtils.isEmpty(address) || StringUtils.isEmpty(statioName) || StringUtils.isEmpty(equipmentName) || StringUtils.isEmpty(arae)){
throw new RuntimeException("片区,场站,设备名称,子系统,分析变量不能为空");
}
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( type,address,statioName,equipmentName,arae,startTime,endTime));
List<String> gatewayIds = this.getGatewayIds();
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( type,address,statioName,equipmentName,arae,startTime,endTime,gatewayIds));
}
......@@ -386,7 +390,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
}
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<String> gatewayIds = this.getGatewayIds();
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexDays.forEach(item -> {
double roundedNumber = Double.parseDouble(df.format(item.getHealthIndex()));
......@@ -432,7 +437,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
}
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null);
List<String> gatewayIds = this.getGatewayIds();
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, gatewayIds);
Map<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(Double.parseDouble(fanHealthIndexDays.get(0).getValue()))));
......@@ -447,7 +453,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "station",required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType
) {
List<Map<String, Object>> maps = fanHealthIndexDayMapper.selectEquipStatusByStation(area, analysisObjType, station);
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = fanHealthIndexDayMapper.selectEquipStatusByStation(area, analysisObjType, station, gatewayIds);
if (maps.size() == 4){
for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel"));
......@@ -577,7 +584,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
fanHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
......@@ -608,7 +615,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
fanHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
......@@ -632,7 +639,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
fanHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
......@@ -681,7 +688,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
Map<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexDays.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map);
......@@ -705,7 +712,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
Map<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map);
......@@ -722,7 +729,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate);
// }
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, null);
Map<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map);
......@@ -750,7 +757,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Map<String,Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
if (requiredType.equals("按天")){
List<String> gatewayIds = this.getGatewayIds();
if ("按天".equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
......@@ -759,8 +767,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, gatewayIds);
fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(FanHealthIndexDay::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexDay obj : fanHealthIndexDays) {
......@@ -774,7 +781,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
result.put("seriesData",seriesData);
result.put("axisData",axisData);
return ResponseHelper.buildResponse(result);
}else if (requiredType.equals("按小时")){
}else if ("按小时".equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
......@@ -782,7 +789,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null);
List<FanHealthIndexHour> fanHealthIndexHours = fanHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, gatewayIds);
fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(FanHealthIndexHour::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexHour obj : fanHealthIndexHours) {
if (type.equals("0")){
......@@ -806,7 +813,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null);
List<FanHealthIndexMoment> fanHealthIndexMoments = fanHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, gatewayIds);
fanHealthIndexMoments= fanHealthIndexMoments.stream().sorted(Comparator.comparing(FanHealthIndexMoment::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexMoment obj : fanHealthIndexMoments) {
if (type.equals("0")){
......@@ -824,4 +831,17 @@ public class IdxBizFanHealthIndexController extends BaseController {
}
}
/**
* 获取用户权限(此处使用gatewayId)
*
* @return gatewayIds
*/
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
}
......@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanPointProcessVariableClassificationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointProcessVariableClassificationServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -18,7 +19,7 @@ import java.util.List;
import java.util.Map;
/**
*
*
*
* @author system_generator
* @date 2023-08-15
......@@ -31,6 +32,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
@Autowired
IdxBizFanPointProcessVariableClassificationServiceImpl idxBizFanPointProcessVariableClassificationServiceImpl;
@Autowired
private IIdxBizTableService idxBizTableService;
/**
* 新增
*
......@@ -125,7 +129,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/selectParams")
public ResponseModel<List<Map<String,Object>>> selectParams(String tableName,String column,@RequestParam(required = false) String isFx) {
return ResponseHelper.buildResponse(idxBizFanPointProcessVariableClassificationServiceImpl.selectParams(column,tableName,isFx));
// return ResponseHelper.buildResponse(idxBizFanPointProcessVariableClassificationServiceImpl.selectParams(column,tableName,isFx));
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(tableName, column, null,null, null, isFx);
return ResponseHelper.buildResponse(selectOptions);
}
}
......@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
......@@ -54,6 +55,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
@Autowired
FanWaringRecordMapper fanWaringRecordMapper;
@Autowired
private IPermissionService permissionService;
@Autowired
IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper;
......@@ -357,7 +360,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> maps = fanWaringRecordMapper.selectFanWarningNum(station);
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = fanWaringRecordMapper.selectFanWarningNum(station, gatewayIds);
Map<String, Map<String, Object>> equipmentNameInfoMap = maps.stream().collect(Collectors.toMap(t -> t.get("EQUIPMENT_NAME").toString(), t -> t));
List<Integer> wxList = new ArrayList<>();
......@@ -403,8 +407,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
@GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<Map<String, Object>> selectEquipWarningTotal(@RequestParam String STATION, @RequestParam String EQUIPMENTNAME) {
Map<String, Object> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION, EQUIPMENTNAME);
List<String> gatewayIds = this.getGatewayIds();
Map<String, Object> maps = fanWaringRecordMapper.selectEquipWarningTotal(STATION, EQUIPMENTNAME, gatewayIds);
return ResponseHelper.buildResponse(maps);
}
......@@ -415,11 +419,20 @@ public class IdxBizFanWarningRecordController extends BaseController {
Page<FanWarningRecord> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
List<FanWarningRecord> maps = fanWaringRecordMapper.selectWarningPoint(STATION, EQUIPMENTNAME, (current - 1) * size, size);
List<String> gatewayIds = this.getGatewayIds();
List<FanWarningRecord> maps = fanWaringRecordMapper.selectWarningPoint(STATION, EQUIPMENTNAME, (current - 1) * size, size, gatewayIds);
page.setRecords(maps);
int total = fanWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME);
page.setTotal(total);
return ResponseHelper.buildResponse(page);
}
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
}
......@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvPointProcessVariabl
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvHealthIndexServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*;
......@@ -33,7 +34,7 @@ import java.util.*;
import java.util.stream.Collectors;
/**
*
*
*
* @author system_generator
* @date 2023-08-15
......@@ -53,6 +54,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
PvHealthIndexMomentMapper pvHealthIndexMomentMapper;
@Autowired
PvWaringRecordMapper pvWaringRecordMapper;
@Autowired
IPermissionService permissionService;
@Autowired
......@@ -261,20 +264,20 @@ public class IdxBizPvHealthIndexController extends BaseController {
@RequestParam(value = "subarray",required = false) String subarray){
List<String> gatewayIds = this.getGatewayIds();
if (requiredType.equals("按天")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, gatewayIds);
fanHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
int total = pvHealthIndexDayMapper.selectDataTotal(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName);
int total = pvHealthIndexDayMapper.selectDataTotal(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, gatewayIds);
Page page = new Page<>();
page.setCurrent(current);
page.setSize(size);
......@@ -293,11 +296,11 @@ public class IdxBizPvHealthIndexController extends BaseController {
e.printStackTrace();
}
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
int total = pvHealthIndexHourMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
int total = pvHealthIndexHourMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, gatewayIds);
Page page = new Page<>();
page.setCurrent(current);
......@@ -310,7 +313,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,(current-1)*size,size, gatewayIds);
fanHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
});
......@@ -318,7 +321,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
page.setCurrent(current);
page.setSize(size);
page.setRecords(fanHealthIndexMoments);
int total = pvHealthIndexMomentMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop);
int total = pvHealthIndexMomentMapper.selectDataTotal(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop, gatewayIds);
page.setTotal(total);
return ResponseHelper.buildResponse(page);
}
......@@ -345,14 +348,14 @@ public class IdxBizPvHealthIndexController extends BaseController {
@RequestParam(value = "subarray",required = false) String subarray){
List<String> gatewayIds = this.getGatewayIds();
if (requiredType.equals("按天")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, requiredType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, requiredType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, gatewayIds);
Map<String,Object> map = new HashMap<>();
......@@ -374,7 +377,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
} catch (ParseException e) {
e.printStackTrace();
}
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, gatewayIds);
Map<String,Object> map = new HashMap<>();
map.put("value", Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex())));
......@@ -385,7 +388,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName,(current-1)*size,size, gatewayIds);
Map<String,Object> map = new HashMap<>();
map.put("value", Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex())));
......@@ -417,7 +420,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
Map<String,Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>();
List<Object> axisData = new ArrayList<>();
if (requiredType.equals("按天")){
List<String> gatewayIds = this.getGatewayIds();
if ("按天".equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
......@@ -427,7 +431,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size);
List<PvHealthIndexDay> fanHealthIndexDays = pvHealthIndexDayMapper.selectData(station, analysisType, indexAddress, healthLevel, area, analysisObjType, subarray, pointName, startTimeTop, endTimeTop, equipmentName, (current - 1) * size, size, gatewayIds);
fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(PvHealthIndexDay::getAnalysisTime)).collect(Collectors.toList());
for (PvHealthIndexDay obj : fanHealthIndexDays) {
......@@ -441,7 +445,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
result.put("seriesData",seriesData);
result.put("axisData",axisData);
return ResponseHelper.buildResponse(result);
}else if (requiredType.equals("按小时")){
}else if ("按小时".equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
......@@ -449,7 +453,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
}
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null);
List<PvHealthIndexHour> fanHealthIndexHours = pvHealthIndexHourMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, gatewayIds);
fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(PvHealthIndexHour::getAnalysisTime)).collect(Collectors.toList());
for (PvHealthIndexHour obj : fanHealthIndexHours) {
if (type.equals("0")){
......@@ -476,7 +480,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null);
List<PvHealthIndexMoment> fanHealthIndexMoments = pvHealthIndexMomentMapper.selectData(healthLevel, area, equipmentName, subarray, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, gatewayIds);
fanHealthIndexMoments= fanHealthIndexMoments.stream().sorted(Comparator.comparing(PvHealthIndexMoment::getAnalysisTime)).collect(Collectors.toList());
for (PvHealthIndexMoment obj : fanHealthIndexMoments) {
if (type.equals("0")){
......@@ -498,7 +502,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计 TD", notes = "预警监测设备级统计 TD")
@GetMapping(value = "/selectPointNum")
public ResponseModel<List<Map<String,Object>>> selectPointNum(@RequestParam(required = false) String STATION,@RequestParam(required = false) String SUBARRAY,@RequestParam(required = false) String EQUIPMENTNAME) {
List<Map<String, Object>> maps = pvHealthIndexDayMapper.selectEquipStatusByEquipment( "测点", STATION,EQUIPMENTNAME, SUBARRAY);
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = pvHealthIndexDayMapper.selectEquipStatusByEquipment( "测点", STATION,EQUIPMENTNAME, SUBARRAY, gatewayIds);
if (maps.size() == 4){
for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel"));
......@@ -538,9 +543,10 @@ public class IdxBizPvHealthIndexController extends BaseController {
Page<PvWarningRecord> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
List<PvWarningRecord> maps = pvWaringRecordMapper.selectWarningPoint(STATION,EQUIPMENTNAME,SUBARRAY,(current-1)*size,size);
List<String> gatewayIds = this.getGatewayIds();
List<PvWarningRecord> maps = pvWaringRecordMapper.selectWarningPoint(STATION,EQUIPMENTNAME,SUBARRAY,(current-1)*size,size, gatewayIds);
page.setRecords(maps);
int total = pvWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME,SUBARRAY);
int total = pvWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME,SUBARRAY, gatewayIds);
page.setTotal(total);
return ResponseHelper.buildResponse(page);
}
......@@ -550,8 +556,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
@GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<Map<String,Object>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam(required = false) String SUBARRAY) {
Map<String, Object> map = pvWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME,SUBARRAY);
List<String> gatewayIds = this.getGatewayIds();
Map<String, Object> map = pvWaringRecordMapper.selectEquipWarningTotal(STATION,EQUIPMENTNAME,SUBARRAY, gatewayIds);
return ResponseHelper.buildResponse(map);
}
......@@ -562,7 +568,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
@RequestParam(value = "station",required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType
) {
List<Map<String, Object>> maps = pvHealthIndexDayMapper.selectEquipStatusByStationPv(area, analysisObjType, station);
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = pvHealthIndexDayMapper.selectEquipStatusByStationPv(area, analysisObjType, station, gatewayIds);
if (maps.size() == 4){
for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel"));
......@@ -607,10 +614,9 @@ public class IdxBizPvHealthIndexController extends BaseController {
wrapper.groupBy(IdxBizPvPointProcessVariableClassification::getSubarray);
wrapper.last(" ORDER BY SUBARRAY desc");
List<IdxBizPvPointProcessVariableClassification> variableClassificationList = idxBizPvPointProcessVariableClassificationMapper.selectList(wrapper);
Map<String, Object> resultMap = new HashMap<>();
List<Map<String, Object>> maps = pvWaringRecordMapper.selectFanWarningNum(station);
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> maps = pvWaringRecordMapper.selectFanWarningNum(station, gatewayIds);
Map<String, Map<String, Object>> equipmentNameInfoMap = maps.stream().collect(Collectors.toMap(t -> t.get("subarray").toString(), t -> t));
List<Integer> wxList = new ArrayList<>();
......@@ -650,4 +656,16 @@ public class IdxBizPvHealthIndexController extends BaseController {
}
/**
* 获取用户权限(此处使用gatewayId)
*
* @return gatewayIds
*/
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "idx业务前置接口")
@RequestMapping(value = "/idx")
public class IdxBizTableController {
@Autowired
IIdxBizTableService idxBizTableService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "分页查询业务事实表的数据", notes = "分页查询业务事实表的数据-IDX前置接口")
@GetMapping(value = "/table/getPage")
public ResponseModel<Page<Map<String, Object>>> getTablePage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(idxBizTableService.getPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "列表下拉框选项数据", notes = "列表下拉框选项数据")
@GetMapping(value = "/select-options")
public ResponseModel<List<Map<String, Object>>> getSelectOptions(
@RequestParam(value = "tableName") String tableName,
@RequestParam(value = "column") String column,
@RequestParam(value = "valueColumn", required = false) String valueColumn,
@RequestParam(value = "conditionColumn", required = false) String conditionColumn,
@RequestParam(value = "conditionValue", required = false) String conditionValue,
@RequestParam(value = "isFx", required = false) String isFx
) {
List<Map<String, Object>> selectOptions = idxBizTableService.getSelectOptions(tableName, column, valueColumn, conditionColumn, conditionValue, isFx);
return ResponseHelper.buildResponse(selectOptions);
}
}
......@@ -11,6 +11,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.kafka.FanConditionVariablesMessage
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -24,10 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jxiop.biz.kafka.Constant.*;
......@@ -43,6 +41,8 @@ public class KafkaAnalyseController {
@Autowired
RedisUtils redisUtils;
@Autowired
IPermissionService permissionService;
@Autowired
IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
......@@ -162,25 +162,26 @@ public class KafkaAnalyseController {
@ApiOperation(value = "全景诊断回溯")
@GetMapping("/getFullViewRecall")
public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(@RequestParam(required = false, value = "analysisType") String analysisType) {
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType);
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfoByParam(analysisType);
List<Map<String, Object>> equipmentIndexInfo = idxBizFanHealthIndexMapper.getEquipmentIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> equipmentIndexInfoMap = equipmentIndexInfo.stream().collect(Collectors.toMap(t -> t.get("equipmentName").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfoByParam(analysisType);
List<Map<String, Object>> subSystemIndexInfo = idxBizFanHealthIndexMapper.getSubSystemIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> subSystemIndexInfoMap = subSystemIndexInfo.stream().collect(Collectors.toMap(t -> t.get("subSystem").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfoByParam(analysisType);
List<Map<String, Object>> pointNameIndexInfo = idxBizFanHealthIndexMapper.getPointNameIndexInfoByParam(analysisType, gatewayIds);
Map<String, Double> pointNameIndexInfoMap = pointNameIndexInfo.stream().collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList();
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds);
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall();
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(gatewayIds);
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
Collectors.groupingBy(FullViewRecallDataDTO::getStation,
......@@ -384,4 +385,12 @@ public class KafkaAnalyseController {
return resultDto;
}
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
}
......@@ -6,17 +6,10 @@ import java.sql.Timestamp;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils;
......@@ -114,6 +107,8 @@ public class TDBigScreenAnalyseController extends BaseController {
PvWaringRecordMapper pvWaringRecordMapper;
@Autowired
FanHealthIndexDayMapper fanHealthIndexDayMapper;
@Autowired
IPermissionService permissionService;
@Autowired
private IdxBizFanWarningRuleSetServiceImpl idxBizFanWarningRuleSetService;
......@@ -921,7 +916,7 @@ public class TDBigScreenAnalyseController extends BaseController {
@GetMapping("/getFullViewRecall")
public ResponseModel<Map<String, Object>> getFullViewRecall() {
HashMap<String, Object> resultMapFinally = new HashMap<>();
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors
.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
......@@ -939,9 +934,9 @@ public class TDBigScreenAnalyseController extends BaseController {
.collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(),
t -> Double.parseDouble(t.get("healthIndex").toString())));
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList();
List<IdxBizFanHealthLevel> healthLevelInfoList = idxBizFanHealthIndexMapper.getHealthLevelInfoList(gatewayIds);
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall();
List<FullViewRecallDataDTO> list = idxBizFanHealthIndexMapper.getFullViewRecall(null);
Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list
.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
......@@ -1588,4 +1583,12 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(null);
}
private List<String> getGatewayIds() {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = Collections.emptyList();
}
return permissions;
}
}
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.core.framework.GatewayIdAutowired;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallInfoDTO;
......@@ -71,6 +72,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
......@@ -138,6 +140,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
@GatewayIdAutowired
public ResponseModel<Page<PvHealthIndex>> getPvHealthIndexInfo(@RequestBody PvHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
......@@ -188,6 +191,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanWarningRecordInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanWarningRecord>> getFanWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
......@@ -237,6 +241,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvWarningRecordInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
@GatewayIdAutowired
public ResponseModel<Page<PvWarningRecord>> getPvWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
......
package com.yeejoin.amos.boot.module.jxiop.biz.core.framework;
import java.lang.annotation.*;
/**
* @author keyong
* @title: GatewayIdAutowired
* <pre>
* @description: TODO
* </pre>
* @date 2024/1/25 9:39
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface GatewayIdAutowired {
/**
* 是否添加当前登录人的gatewayId为参数进行过滤权限查询
* @return boolean
*/
boolean isNeedGatewayId() default true;
}
package com.yeejoin.amos.boot.module.jxiop.biz.core.framework;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.Arrays;
import java.util.List;
/**
* @author keyong
* @title: GatewayIdAutowiredAspect
* <pre>
* @description: TODO
* </pre>
* @date 2024/1/25 10:21
*/
@Component
@Aspect
public class GatewayIdAutowiredAspect {
private static final transient Logger log = LoggerFactory.getLogger(GatewayIdAutowiredAspect.class);
@Autowired
private IPermissionService permissionService;
@Before(value = "@annotation(com.yeejoin.amos.boot.module.jxiop.biz.core.framework.GatewayIdAutowired) && @annotation(gatewayIdAutowired)")
public void doBefore(JoinPoint joinPoint, GatewayIdAutowired gatewayIdAutowired) {
if (gatewayIdAutowired.isNeedGatewayId()) {
try {
//获取入参列表
Object[] args = joinPoint.getArgs();
log.info("args: {}", JSON.toJSONString(args));
//入参判空
if (null == args || args.length == 0) {
log.info("No fields!");
return;
}
// 只有一个参数主要针对@RequestBody,一般只会有一个入参,若遇到多个@RequestParam,需循环处理
if (args.length == 1) {
Object arg = args[0];
List<String> ids = permissionService.getCurrentUserPermissions();
//获取字段域
Field[] fields = arg.getClass().getDeclaredFields();
log.info("getDeclaredFields: {}", JSON.toJSONString(fields));
if (Arrays.stream(fields).noneMatch(item -> "gatewayIds".equals(item.getName()))) {
log.info("No gatewayId field !!!");
return;
}
//入参中有"gatewayIds",获取该字段
Field field = arg.getClass().getDeclaredField("gatewayIds");
//判断是否可使用
boolean accessible = ((!Modifier.isPublic(field.getModifiers())
|| !Modifier.isPublic(field.getDeclaringClass().getModifiers())
|| Modifier.isFinal(field.getModifiers())) && !field.isAccessible());
//若不可用,则需要进行setAccessible
if (accessible) {
ServletRequestAttributes attributes
= (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
// 获取request对象
HttpServletRequest request = attributes.getRequest();
log.info("Method name: {}", request.getRequestURI());
field.setAccessible(true);
//参数替换
field.set(arg, ids);
}
}
// 若是get方法,有多个参数则需要扩展
} catch (Exception e) {
log.error("切面参数设置异常", e);
}
}
}
}
......@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.io.Serializable;
import java.util.ArrayList;
......@@ -43,4 +44,5 @@ public class FanHealthIndexDto implements Serializable {
private String subarray;
private String sortOne;
private String sortsString;
private List<String> gatewayIds;
}
......@@ -45,5 +45,5 @@ public class PvHealthIndexDto {
private String orderColumns;
private String sortOne;
private String sortsString;
private List<String> gatewayIds;
}
......@@ -34,13 +34,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, String>> getDateInfoBy15();
List<Map<String, String>> getDateInfo(Date startTime, Date endTime);
List<Map<String, String>> getHourInfo(Date startTime, Date endTime);
List<Map<String, String>> getMomentInfo(Date startTime, Date endTime);
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode,
@Param("stationCode") String stationCode);
@Param("stationCode") String stationCode, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName);
......@@ -100,7 +100,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName,
@Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall();
List<FullViewRecallDataDTO> getFullViewRecall(@Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getStationIndexInfo();
......@@ -110,15 +110,15 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPointNameIndexInfo();
List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getStationIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getEquipmentIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getSubSystemIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getSubSystemIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType);
List<Map<String, Object>> getPointNameIndexInfoByParam(@Param("analysisType") String analysisType, @Param("gatewayIds") List<String> gatewayIds);
List<IdxBizFanHealthLevel> getHealthLevelInfoList();
List<IdxBizFanHealthLevel> getHealthLevelInfoList(@Param("gatewayIds") List<String> gatewayIds);
List<String> getAddressInfo();
......
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface IdxBizTableMapper extends BaseMapper {
List<Map<String, Object>> getSelectOptions(
@Param("tableName") String tableName,
@Param("column") String column,
@Param("valueColumn") String valueColumn,
@Param("conditionColumn") String conditionColumn,
@Param("conditionValue") String conditionValue,
@Param("isFx") String isFx,
@Param("gatewayIds") List<String> gatewayIds
);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
public interface IIdxBizTableService {
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
Page<Map<String, Object>> getPage(Map<String, Object> map);
/**
* 获取下拉列表参数
*
* @param tableName 表名
* @param column 列名
* @param valueColumn 数据值列
* @param conditionColumn 条件列名
* @param conditionValue 条件值
* @param isFx 是否是"分析变量"
*/
List<Map<String, Object>> getSelectOptions(String tableName, String column, String valueColumn, String conditionColumn, String conditionValue, String isFx);
}
......@@ -5,4 +5,5 @@ import java.util.List;
public interface IPermissionService {
List<String> getCurrentUserPermissions();
List<String> getCurrentUserProjectOrgCodes();
}
......@@ -1666,9 +1666,9 @@ public class CommonServiceImpl {
Table healthData = Table.create("healthData");
healthData.addColumns(DoubleColumn.create("analysisVariable", analysisVariable), DoubleColumn.create("stdDev", stdDev), DoubleColumn.create("centerValue", centerValue), StringColumn.create("ProcessPoint1Id", ProcessPoint1Id), DoubleColumn.create("ProcessPoint1", ProcessPoint1), StringColumn.create("ProcessPoint2Id", ProcessPoint2Id), DoubleColumn.create("ProcessPoint2", ProcessPoint2), StringColumn.create("ProcessPoint3Id", ProcessPoint3Id), DoubleColumn.create("ProcessPoint3", ProcessPoint3), StringColumn.create("analysisVariableId", analysisVariableIds));
logger.info("------------------------------------------开始调用健康指数计算算法开始----------------------------------------");
logger.info("------------------------------------------开始调用风机健康指数计算算法开始----------------------------------------");
logger.info("------------------------------------------调用地址:"+baseUrlZSFX);
logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
//logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
JSONObject jsonObject = JSON.parseObject(response);
......@@ -1752,7 +1752,7 @@ public class CommonServiceImpl {
try {
logger.info("--------------------response: " + response);
logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------");
logger.info("------------------------------------------调用风机健康指数计算算法结束----------------------------------------");
logger.info("------------------------------------------开始计算预警----------------------------------------");
// healthStatusIndicatorService.healthWarningMinute(calendar, time);
......@@ -1949,9 +1949,9 @@ public class CommonServiceImpl {
Table healthData = Table.create("healthData");
healthData.addColumns(DoubleColumn.create("analysisVariable", analysisVariable), DoubleColumn.create("stdDev", stdDev), DoubleColumn.create("centerValue", centerValue), StringColumn.create("ProcessPoint1Id", ProcessPoint1Id), DoubleColumn.create("ProcessPoint1", ProcessPoint1), StringColumn.create("ProcessPoint2Id", ProcessPoint2Id), DoubleColumn.create("ProcessPoint2", ProcessPoint2), StringColumn.create("ProcessPoint3Id", ProcessPoint3Id), DoubleColumn.create("ProcessPoint3", ProcessPoint3), StringColumn.create("analysisVariableId", analysisVariableIds));
logger.info("------------------------------------------开始调用健康指数计算算法开始----------------------------------------");
logger.info("------------------------------------------开始调用光伏健康指数计算算法开始----------------------------------------");
logger.info("------------------------------------------调用地址:"+baseUrlZSFX);
logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
//logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
JSONObject jsonObject = JSON.parseObject(response);
if (jsonObject.containsKey("indexValue")) {
......@@ -2029,7 +2029,7 @@ public class CommonServiceImpl {
}
try {
logger.info("--------------------response: " + response);
logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------");
logger.info("------------------------------------------调用光伏健康指数计算算法结束----------------------------------------");
} catch (Exception e) {
throw new RuntimeException(e);
}
......
......@@ -35,13 +35,6 @@ public class IPermissionServiceImpl implements IPermissionService {
@Autowired
private StationBasicMapper stationBasicMapper;
// @Autowired
// public IPermissionServiceImpl(RedisUtils redisUtils, UserEmpowerMapper userEmpowerMapper, StationBasicMapper stationBasicMapper) {
// this.redisUtils = redisUtils;
// this.userEmpowerMapper = userEmpowerMapper;
// this.stationBasicMapper = stationBasicMapper;
// }
@Override
public List<String> getCurrentUserPermissions() {
List<String> result = new ArrayList<>();
......@@ -70,4 +63,33 @@ public class IPermissionServiceImpl implements IPermissionService {
}
return result;
}
@Override
public List<String> getCurrentUserProjectOrgCodes() {
List<String> result = new ArrayList<>();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level").toString();
if (companyLevel.equals("categroy_leve2")) {
return null;
}
if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
result = stationBasics.stream().map(StationBasic::getProjectOrgCode).collect(Collectors.toList());
return result;
}
if (companyLevel.equals("station")) {
StationBasic stationBasic = stationBasicMapper.selectOne(new QueryWrapper<StationBasic>().eq("project_org_code", permissionOrgCode));
result.add(stationBasic.getProjectOrgCode());
return result;
}
}
return result;
}
}
......@@ -73,7 +73,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
public final DecimalFormat dfSS = new DecimalFormat("0.00");
public Object getqyt(String type,String address,String statioName,String equipmentName, String arae,String startTime,String endTime){
public Object getqyt(String type,String address,String statioName,String equipmentName, String arae,String startTime,String endTime,List<String> gatewayIds){
Map<String, Object> map = new HashMap<>();
try {
//获取场站网关
......@@ -118,7 +118,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
endTime= sdf.format(currentDayEndTime);
}
List<IndicatorData> indicatorDataListActivePowers = new ArrayList<>();
indicatorDataListActivePowers= indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(tdid,startTime,endTime);
indicatorDataListActivePowers= indicatorDataMapper.selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(tdid,startTime,endTime,gatewayIds);
List<String> axisData = new ArrayList<>();
List<String> activePowers = new ArrayList<>();
for (int i = 0; i < indicatorDataListActivePowers.size(); i++) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.feign.IdxFeign;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizTableMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@Service
@Slf4j
public class IdxBizTableServiceImpl implements IIdxBizTableService {
@Autowired
private IPermissionService permissionService;
@Autowired
private IdxBizTableMapper idxBizTableMapper;
@Autowired
private IdxFeign idxFeign;
/**
* 分页查询业务事实表的数据-IDX(/idx/table/getPage)前置接口, 增加权限控制
*
* @param map 查询参数
*/
public Page<Map<String, Object>> getPage(Map<String, Object> map) {
List<String> currentUserPermissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(currentUserPermissions)) {
currentUserPermissions = new ArrayList<>();
}
String gatewayIds = String.join(",", currentUserPermissions);
if (!gatewayIds.isEmpty()) {
map.put("GATEWAY_ID", String.format("[%s]", gatewayIds));
}
FeignClientResult<Page<Map<String, Object>>> page = idxFeign.getPage(map);
return page.getResult();
}
/**
* 获取下拉列表参数
*
* @param tableName 表名
* @param column 列名
* @param valueColumn 数据值列
* @param conditionColumn 条件列名
* @param conditionValue 条件值
* @param isFx 是否是"分析变量"
*/
@Override
public List<Map<String, Object>> getSelectOptions(String tableName, String column, String valueColumn, String conditionColumn, String conditionValue, String isFx) {
List<String> permissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(permissions)) {
permissions = new ArrayList<>();
}
return idxBizTableMapper.getSelectOptions(tableName, column, valueColumn, conditionColumn, conditionValue, isFx, permissions);
}
}
......@@ -21,11 +21,14 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>")
List<FanHealthIndexDay> selectData(@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("equipmentName")String equipmentName,@Param("subSystem")String subSystem,@Param("analysisType")String analysisType,@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("pointName")String pointName, @Param("indexAddress")String indexAddress,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop,
@Param("current")Integer current,@Param("size") Integer size);
@Param("current")Integer current,@Param("size") Integer size,
@Param("gatewayIds") List<String> gatewayIds
);
@Select("<script>"+
......@@ -47,9 +50,10 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM analysis_data.fan_health_index_day WHERE analysis_obj_type = #{analysisObjType} AND ts >= TODAY()-8h" +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" GROUP BY station,health_level order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByStation(@Param("area")String area,@Param("analysisObjType")String analysisObjType,@Param("station")String station);
List<Map<String,Object>> selectEquipStatusByStation(@Param("area")String area,@Param("analysisObjType")String analysisObjType,@Param("station")String station, @Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getHealthInfoByArea();
......
......@@ -20,9 +20,10 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour>
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>")
List<FanHealthIndexHour> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size);
List<FanHealthIndexHour> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size,@Param("gatewayIds") List<String> gatewayIds);
}
......@@ -20,9 +20,10 @@ public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMom
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>")
List<FanHealthIndexMoment> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size);
List<FanHealthIndexMoment> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subSystem")String subSystem, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("current")Integer current,@Param("size") Integer size,@Param("gatewayIds") List<String> gatewayIds);
}
......@@ -14,15 +14,15 @@ import java.util.Map;
public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> {
public List<Map<String,Object>> selectFanWarningNum(String station);
public List<Map<String,Object>> selectFanWarningNum(String station, @Param("gatewayIds") List<String> gatewayIds);
public List<FanWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBSYSTEM);
public List<FanWarningRecord> selectWarningPoint(String STATION,String EQUIPMENTNAME,Integer current,Integer size);
public List<FanWarningRecord> selectWarningPoint(String STATION,String EQUIPMENTNAME,Integer current,Integer size, @Param("gatewayIds") List<String> gatewayIds);
public int selectWarningPointTotal(String STATION,String EQUIPMENTNAME);
public Map<String,Object> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME);
public Map<String,Object> selectEquipWarningTotal(String STATION,String EQUIPMENTNAME, @Param("gatewayIds") List<String> gatewayIds);
int saveBatchWarningRecords(@Param("list") List<FanWarningRecord> list);
......
......@@ -22,6 +22,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>")
......@@ -36,7 +37,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Param("startTimeTop") String startTimeTop,
@Param("endTimeTop")String endTimeTop,
@Param("equipmentName")String equipmentName
, @Param("current")Integer current, @Param("size")Integer size);
, @Param("current")Integer current, @Param("size")Integer size,@Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+
......@@ -51,16 +52,18 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"</script>")
int selectDataTotal(@Param("station")String station,@Param("analysisType")String analysisType,@Param("indexAddress")String indexAddress,@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("analysisObjType")String analysisObjType, @Param("subarray")String subarray, @Param("pointName")String pointName,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("equipmentName")String equipmentName);
int selectDataTotal(@Param("station")String station,@Param("analysisType")String analysisType,@Param("indexAddress")String indexAddress,@Param("healthLevel")String healthLevel,@Param("area")String area,@Param("analysisObjType")String analysisObjType, @Param("subarray")String subarray, @Param("pointName")String pointName,@Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("equipmentName")String equipmentName, @Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+
"SELECT station, health_level as healthlevel,( CASE HEALTH_LEVEL WHEN '危险' THEN 4 WHEN '警告' THEN 3 WHEN '注意' THEN 2 ELSE 1 END ) AS sort, count( 1 ) AS `value` FROM analysis_data.pv_health_index_day WHERE analysis_obj_type = #{analysisObjType} AND ts >= TODAY()-8h" +
"<if test='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" GROUP BY station,health_level order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area")String area, @Param("analysisObjType")String analysisObjType, @Param("station")String station);
List<Map<String,Object>> selectEquipStatusByStationPv(@Param("area")String area, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+
......@@ -68,8 +71,9 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
" GROUP BY station,health_level,equipment_name order by sort"+
"</script>")
List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("equipmentName")String equipmentName, @Param("subarray") String subarray);
List<Map<String,Object>> selectEquipStatusByEquipment(@Param("analysisObjType")String analysisObjType,@Param("station")String station,@Param("equipmentName")String equipmentName, @Param("subarray") String subarray, @Param("gatewayIds") List<String> gatewayIds);
}
......@@ -21,11 +21,12 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>")
List<PvHealthIndexHour> selectData (@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop
, @Param("current")Integer current, @Param("size")Integer size);
, @Param("current")Integer current, @Param("size")Integer size,@Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+
"SELECT count(1)" +
" FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
......@@ -38,7 +39,8 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"</script>")
int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("gatewayIds") List<String> gatewayIds);
}
......@@ -21,11 +21,12 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>")
List<PvHealthIndexMoment> selectData(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop
, @Param("current")Integer current, @Param("size")Integer size);;
, @Param("current")Integer current, @Param("size")Integer size,@Param("gatewayIds") List<String> gatewayIds);
@Select("<script>"+
"SELECT count(1)" +
......@@ -39,7 +40,8 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='gatewayIds != null and gatewayIds.size() > 0'>AND GATEWAY_ID IN <foreach collection='gatewayIds' item='gatewayId' open='(' separator=',' close=')'>#{gatewayId}</foreach></if>" +
"</script>")
int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop);
int selectDataTotal(@Param("healthLevel")String healthLevel, @Param("area")String area, @Param("equipmentName")String equipmentName, @Param("subarray")String subarray, @Param("analysisType")String analysisType, @Param("analysisObjType")String analysisObjType, @Param("station")String station, @Param("pointName")String pointName, @Param("indexAddress")String indexAddress, @Param("startTimeTop") String startTimeTop, @Param("endTimeTop")String endTimeTop, @Param("gatewayIds") List<String> gatewayIds);
}
......@@ -15,12 +15,12 @@ public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> {
public List<PvWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBARRAY);
public List<Map<String,Object>> selectFanWarningNum(String station);
public List<Map<String,Object>> selectFanWarningNum(String station, @Param("gatewayIds") List<String> gatewayIds);
List<PvWarningRecord> selectWarningPoint(String STATION, String EQUIPMENTNAME, String SUBARRAY,Integer current,Integer size);
int selectWarningPointTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY);
List<PvWarningRecord> selectWarningPoint(String STATION, String EQUIPMENTNAME, String SUBARRAY,Integer current,Integer size, @Param("gatewayIds") List<String> gatewayIds);
int selectWarningPointTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY, @Param("gatewayIds") List<String> gatewayIds);
Map<String, Object> selectEquipWarningTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY);
Map<String, Object> selectEquipWarningTotal(String STATION, String EQUIPMENTNAME, String SUBARRAY, @Param("gatewayIds") List<String> gatewayIds);
List<PvWarningRecord> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
......
......@@ -48,8 +48,8 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
List<IndicatorData> selectByIndexNameAndDate(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId, @Param("date") String date, @Param("limitNum") Integer limitNum);
@Select("select `value_f` as valueF, created_time from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("id") String id, @Param("startTime") String startTime, @Param("endTime") String endTime);
// @Select("select `value_f` as valueF, created_time from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("id") String id, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("gatewayIds") List<String> gatewayIds);
@Select("select `value`,`value_f`, address, gateway_id from iot_data.indicator_data where ts > NOW()-10m and gateway_id = #{gatewayId}")
List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId);
......
......@@ -90,7 +90,7 @@ spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
# 分析专用td数据库 analyse_data
# ����ר��td���ݿ� analyse_data
#spring.db4.datasource.type: com.alibaba.druid.pool.DruidDataSource
spring.db4.datasource.url=jdbc:TAOS-RS://10.20.0.203:6041/analysis_data?user=root&password=taosdata&timezone=GMT%2b8&allowMultiQueries=true
spring.db4.datasource.username=root
......@@ -181,19 +181,19 @@ spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.Str
spring.kafka.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.listener.ack-mode=manual_immediate
spring.kafka.listener.type=batch
#一次拉取数量 && 线程数量
����ȡ���� && �߳�����
spring.kafka.consumer.max-poll-records=30
#spring.kafka.consumer.fetch-max-wait= 10000
#当前时间向前偏移月数 向历史偏移月数
#��ǰʱ����ǰƫ������ ����ʷƫ������
last.month.num = 12
#相关性 算法调用
#����� �㷨����
base.url.XGX=http://139.9.171.247:8052/intelligent-analysis/correlation
#工况划分 算法调用地
#�������� �㷨���õ�ַ
base.url.GKHF=http://139.9.171.247:8052/intelligent-analysis/working-condition-division
#相关性 算法调用
#����� �㷨����
base.url.ZXZ=http://139.9.171.247:8052/intelligent-analysis/central-value
#指数分析,算法调用
���������㷨����
base.url.zsfx:http://139.9.171.247:8052/intelligent-analysis/index-analysis
\ No newline at end of file
......@@ -166,6 +166,12 @@
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</where>
UNION ALL
(
......@@ -187,6 +193,12 @@
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区'
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
)
) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date
......@@ -730,6 +742,11 @@
AND SUB_SYSTEM is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
)
UNION ALL
(SELECT ARAE AS area,
......@@ -747,6 +764,11 @@
AND EQUIPMENT_NAME is not null
AND POINT_NAME is not null
AND INDEX_ADDRESS is not null
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
)
) a
ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc
......@@ -857,16 +879,26 @@
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_fan_health_level
WHERE STATUS IS NOT NULL
OR STATUS != ''
WHERE (STATUS IS NOT NULL
OR STATUS != '')
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
UNION ALL
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_pv_health_level
WHERE STATUS IS NOT NULL
OR STATUS != ''
WHERE (STATUS IS NOT NULL
OR STATUS != '')
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>
<select id="getAddressInfo" resultType="java.lang.String">
select index_address
......@@ -1321,6 +1353,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY STATION
UNION ALL
......@@ -1342,6 +1379,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY STATION
)
......@@ -1369,6 +1411,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY EQUIPMENT_NAME
UNION ALL
......@@ -1390,6 +1437,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY SUBARRAY
)
......@@ -1420,6 +1472,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY SUB_SYSTEM
UNION ALL
......@@ -1441,6 +1498,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY EQUIPMENT_NAME
)
......@@ -1469,6 +1531,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY INDEX_ADDRESS
UNION ALL
......@@ -1490,6 +1557,11 @@
AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
GROUP BY INDEX_ADDRESS
)
......@@ -1616,20 +1688,20 @@
<select id="getHourInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1
</select>
<select id="getMomentInfo" resultType="java.util.Map">
SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL (@s-1)*10 MINUTE ), '%Y-%m-%d %H:%i:%s' ) AS date,
( @s := @s + 1 )- 1 AS `index`
( @s := @s + 1 )- 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 1 ) temp
( SELECT @s := 1 ) temp
WHERE
TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
</select>
......
<?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.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizTableMapper">
<select id="getSelectOptions" resultType="java.util.Map">
SELECT
DISTINCT ${column} AS text,
<if test="valueColumn != null and valueColumn != ''">
${valueColumn} AS value
</if>
<if test="valueColumn == null or valueColumn == ''">
${column} AS value
</if>
FROM
${tableName}
WHERE
${column} IS NOT NULL AND ${column} != ''
<if test="isFx != null and isFx != ''">
AND TAG_CODE = '分析变量'
</if>
<if test="conditionColumn != null and conditionColumn != '' and conditionValue != null and conditionValue != ''">
AND ${conditionColumn} = #{conditionValue}
</if>
<if test="gatewayIds != null">
<if test="gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
<if test="gatewayIds.size() == 0">
AND 1 = 2
</if>
</if>
GROUP BY
${column}
</select>
</mapper>
......@@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper">
<select id="selectDataByequipmentIndexNameAndtimeAndEquipmentNumber" resultType="com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData">
SELECT
`value_f` AS valueF,
created_time
FROM
iot_data.indicator_data
WHERE
id =#{id} AND ts >= #{startTime} AND ts &lt;= #{endTime}
<if test="gatewayIds != null and gatewayIds.size() > 0">
AND GATEWAY_ID IN
<foreach collection="gatewayIds" item="item" open="(" separator="," close=")">
${item}
</foreach>
</if>
</select>
</mapper>
......@@ -81,6 +81,11 @@
<if test="station != null">
and station = #{station}
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by `station`,
`equipment_name`,
`warning_name`) a
......@@ -129,6 +134,11 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND a.equipment_name = #{EQUIPMENTNAME}
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by
station,
equipment_name,
......@@ -198,6 +208,11 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND z.equipment_name = #{EQUIPMENTNAME}
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by
`z`.`station`,
`z`.`warning_name`,
......@@ -220,6 +235,11 @@
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.gatewayIds != null and dto.gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="dto.gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
<if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns}
......@@ -242,6 +262,11 @@
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if>
<if test="dto.endDate!= null and dto.endDate!= '' "> and ts &lt;= #{dto.endDate} </if>
<if test="dto.startDate!= null and dto.startDate!= ''"> and ts &gt;= #{dto.startDate} </if>
<if test="dto.gatewayIds != null and dto.gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="dto.gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</where>
</select>
......
......@@ -105,6 +105,11 @@
<if test="station != null">
and station = #{station}
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> and GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by
re.station,
re.subarray,
......@@ -140,6 +145,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null">
AND a.subarray = #{SUBARRAY}
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by
station,
equipment_name,
......@@ -173,6 +183,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null">
AND a.subarray = #{SUBARRAY}
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by
station,
equipment_name,
......@@ -216,6 +231,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null">
AND z.subarray = #{SUBARRAY}
</if>
<if test="gatewayIds != null and gatewayIds.size() > 0"> AND GATEWAY_ID in
<foreach item="item" index="index" collection="gatewayIds" open="(" separator="," close=")">
#{item}
</foreach>
</if>
group by
`z`.`station`,
`z`.`warning_name`,
......
package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -17,4 +18,10 @@ public interface IdxFeign {
FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "stationType") String stationType);
/**
* 分页查询业务事实表的数据
*/
@GetMapping("/table/getPage")
FeignClientResult<Page<Map<String, Object>>> getPage(@RequestParam Map<String, Object> map);
}
package com.yeejoin.amos.boot.module.jxiop.api.feign;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
......@@ -39,4 +40,35 @@ public interface McbWarningFeign {
@PostMapping("/task/updateRawDataByTraceId")
FeignClientResult<Boolean> updateRawDataByTraceId(@RequestParam(value = "traceId") String traceId, @RequestParam(value = "rawData") String rawData);
/**
* 任务详情分页列表
*/
@GetMapping("/warning-warning-info/page")
FeignClientResult<Page<Map<String, Object>>> getTaskDetailPage(@RequestParam Map<String, Object> map);
/**
* 问题记录分页列表
*/
@GetMapping("/warning-question-info/questionPage")
FeignClientResult<Page<Map<String, Object>>> getQuestionRecordPage(@RequestParam Map<String, Object> map);
/**
* 任务详情、问题记录左侧树
*/
@GetMapping("/warning-warning-info/tree")
FeignClientResult getWarnTree(@RequestParam Map<String, Object> map);
/**
* 任务详情列表统计
*/
@GetMapping("/warning-warning-info/statistics")
FeignClientResult getTaskDetailStatistic(@RequestParam Map<String, Object> map);
/**
* 问题记录列表统计
*/
@GetMapping("/warning-question-info/questionPageTopStatistics")
FeignClientResult getQuestionRecordStatistic(@RequestParam Map<String, Object> map);
}
package com.yeejoin.amos.boot.module.jxiop.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
public interface IMcbWarningService {
/**
* 今日预警-预警总数
*
* @param processingStatus 处理状态
* @return 预警总数
*/
Map<String, Object> queryTodayCount(Integer processingStatus);
/**
* 近七日预警统计
*
* @return 预警统计
*/
List<Map<String, Object>> queryWeekCount();
/**
* 预警信息列表
*
* @return 预警信息列表
*/
Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus, String eventLevel, String createDate, String warningSourceType);
/**
* 预警信息总数
*
* @return 预警信息总数
*/
Long queryWarningCount(Integer processingStatus, String eventLevel, String createDate, String warningSourceType);
/**
* 问题信息列表
*
* @return 问题信息列表
*/
Page<Map<String, Object>> queryQuestionPage(Page<Map<String, Object>> page, Integer completionStatus);
/**
* 问题信息列表
*
* @return 问题信息列表
*/
Long queryQuestionCount(Integer completionStatus);
/**
* 获取地图点位/路线
*
* @return 地图点位/路线
*/
Object queryMapRoutes(String province);
/**
* 任务详情分页列表
*
* @return 任务详情分页列表
*/
Page<Map<String, Object>> getTaskDetailPage(Map<String, Object> map);
/**
* 问题记录分页列表
*
* @return 任务详情分页列表
*/
Page<Map<String, Object>> getQuestionRecordPage(Map<String, Object> map);
/**
* 任务详情、问题记录左侧树
*/
Object getWarnTree(Map<String, Object> map);
/**
* 任务详情列表统计
*/
Object getTaskDetailStatistic(Map<String, Object> map);
/**
* 问题记录列表统计
*/
Object getQuestionRecordStatistic(Map<String, Object> map);
}
package com.yeejoin.amos.boot.module.jxiop.api.service;
import java.util.List;
public interface IPermissionService {
List<String> getCurrentUserPermissions();
List<String> getCurrentUserProjectOrgCodes();
}
<?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.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper.McbWarningMapper">
<select id="queryTodayCount" resultType="java.util.Map">
SELECT
COUNT(*) as count
FROM
amos_mcb.mcb_warning_warning_info log
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = log.SOURCE_ATTRIBUTION
<where>
date(log.CREATE_DATE) = CURRENT_DATE
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="processingStatus != null and processingStatus != ''">
AND log.processing_status = #{processingStatus}
</if>
</where>
</select>
<select id="queryWeekCount" resultType="java.util.Map">
SELECT
DATE_FORMAT(b.alarmDate, '%m/%d') AS alarmDate,
b.code AS code,
b.province AS province,
IFNULL(count(log.SEQUENCE_NBR), 0) AS countNum
FROM
(
SELECT
source.CODE AS code,
a.DATE AS alarmDate,
source.PROVINCE AS province
FROM
amos_mcb.mcb_warning_base_source_attribution source,
(
SELECT CURDATE() AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 1 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 2 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 3 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 4 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 5 DAY ) AS date
UNION ALL
SELECT DATE_SUB( CURDATE(), INTERVAL 6 DAY ) AS date
) a
) b
LEFT JOIN amos_mcb.mcb_warning_warning_info log ON date(log.CREATE_DATE) = b.alarmDate AND log.SOURCE_ATTRIBUTION = b.CODE
GROUP BY
-- b.code,
b.alarmDate
<trim prefix="having" prefixOverrides="and">
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND log.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</trim>
ORDER BY
b.alarmDate ASC
</select>
<select id="queryWarningList" resultType="java.util.Map">
SELECT
log.SEQUENCE_NBR,
DATE_FORMAT(log.CREATE_DATE, '%Y-%m-%d %H:%i:%s') AS CREATE_DATE,
log.EVENT_LEVEL_DESC,
log.EVENT_LEVEL,
log.SOURCE_ATTRIBUTION_DESC,
log.SOURCE_ATTRIBUTION,
log.CONTENT,
LEVEL.COLOR,
source.PROVINCE,
log.WARNING_SOURCE_TYPE
FROM
amos_mcb.mcb_warning_warning_info log
LEFT JOIN amos_mcb.mcb_warning_base_warning_level LEVEL ON log.EVENT_LEVEL = LEVEL.CODE and LEVEL.SEQUENCE_NBR in (1, 2, 3)
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = log.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND log.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="processingStatus != null">
AND log.PROCESSING_STATUS = #{processingStatus}
</if>
<if test="eventLevel != null and eventLevel != ''">
AND log.EVENT_LEVEL = #{eventLevel}
</if>
<if test="createDate != null and createDate != ''">
AND log.CREATE_DATE &gt;= concat(#{createDate}, ' 00:00:00')
AND log.CREATE_DATE &lt;= concat(#{createDate}, ' 23:59:59')
</if>
<if test="warningSourceType != null and warningSourceType != ''">
AND log.WARNING_SOURCE_TYPE = #{warningSourceType}
</if>
</where>
ORDER BY
log.CREATE_DATE DESC
LIMIT #{start}, #{offset}
</select>
<select id="queryWarningCount" resultType="java.lang.Long">
SELECT
count(*)
FROM
amos_mcb.mcb_warning_warning_info log
LEFT JOIN amos_mcb.mcb_warning_base_warning_level LEVEL ON log.EVENT_LEVEL = LEVEL.CODE and LEVEL.SEQUENCE_NBR in (1, 2, 3)
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = log.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND log.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="processingStatus != null">
AND log.PROCESSING_STATUS = #{processingStatus}
</if>
<if test="eventLevel != null and eventLevel != ''">
AND log.EVENT_LEVEL = #{eventLevel}
</if>
<if test="createDate != null and createDate != ''">
AND log.CREATE_DATE &gt;= concat(#{createDate}, ' 00:00:00')
AND log.CREATE_DATE &lt;= concat(#{createDate}, ' 23:59:59')
</if>
<if test="warningSourceType != null and warningSourceType != ''">
AND log.WARNING_SOURCE_TYPE = #{warningSourceType}
</if>
</where>
</select>
<select id="queryQuestionList" resultType="java.util.Map">
SELECT
question.SEQUENCE_NBR,
DATE_FORMAT(ifnull(question.REC_DATE, question.CREATE_DATE), '%Y-%m-%d %H:%i:%s') AS REC_DATE,
question.COMPLETION_STATUS_DESC,
question.COMPLETION_STATUS,
question.SOURCE_ATTRIBUTION_DESC,
question.SOURCE_ATTRIBUTION,
question.CONTENT,
source.PROVINCE
FROM
amos_mcb.mcb_warning_question_info question
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = question.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND question.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="completionStatus != null">
AND question.COMPLETION_STATUS = #{completionStatus}
</if>
</where>
ORDER BY
question.REC_DATE DESC
LIMIT #{start}, #{offset}
</select>
<select id="queryQuestionCount" resultType="java.lang.Long">
SELECT
count(*)
FROM
amos_mcb.mcb_warning_question_info question
LEFT JOIN amos_mcb.mcb_warning_base_source_attribution source ON source.CODE = question.SOURCE_ATTRIBUTION
<where>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND question.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="completionStatus != null">
AND question.COMPLETION_STATUS = #{completionStatus}
</if>
</where>
</select>
</mapper>
......@@ -97,7 +97,9 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
if(!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result;
}
......@@ -128,7 +130,9 @@ public class CommonServiceImpl {
// }
public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double totalvalue = 0.0;
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
if(!ObjectUtils.isEmpty(mapList)) {
totalvalue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", totalvalue));
}
......@@ -139,7 +143,9 @@ public class CommonServiceImpl {
*/
public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double avageValue = 0.0;
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
if(!ObjectUtils.isEmpty(mapList)) {
avageValue = mapList.stream().filter(stringObjectMap -> stringObjectMap.get("equipmentIndexName").toString().contains(indicator) && !ObjectUtils.isEmpty(stringObjectMap.get("value"))).mapToDouble(l -> Double.parseDouble((String) l.get("value"))).sum();
}
return Double.valueOf(String.format("%.2f", avageValue));
}
......@@ -232,7 +238,11 @@ public class CommonServiceImpl {
stationCacheInfoDto.setStationType(stationBasic.getStationType());
stationCacheInfoDto.setBelongProvince(regionList.stream().filter(region -> region.getRegionCode().toString().equals(stationBasic.getBelongArea().replace("[", "").split(",")[0])).map(region -> region.getRegionName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBelongArea(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getName()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber())));
Double installedCapacity = 0.0d;
if(!ObjectUtils.isEmpty(sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber()))){
installedCapacity =sjglZsjZsbtzMapper.getStationCapactityByStationWerks(stationBasic.getStationNumber());
}
stationCacheInfoDto.setInstalledCapacity(String.format("%.2f", installedCapacity));
stationCacheInfoDto.setFanGatewayId(stationBasic.getFanGatewayId());
stationCacheInfoDto.setAreaCode(mapRegionList.stream().filter(mapRegion -> mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 2)) || mapRegion.getProvince().contains(stationCacheInfoDto.getBelongProvince().substring(0, 3))).map(mapRegion -> mapRegion.getAreaCode()).collect(Collectors.toList()).get(0));
stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
......@@ -371,7 +381,10 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
if(equipments!=null)
{
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result;
}
......
......@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Double powerOfDay = 0.0000;
Double powerOfMonth = 0.0000;
Double powerOfAnnual = 0.0000;
if(ObjectUtils.isEmpty(query)){
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}else {
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
if(result!=null)
{
if(ObjectUtils.isEmpty(query)){
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}else {
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
}
Map<String, Object> hashMap = new HashMap<>();
hashMap.put("日发电量",powerOfDay);
hashMap.put("月发电量",powerOfMonth);
......
......@@ -30,114 +30,112 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
@Service
public class MonitoringServiceImpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
@Value("${plannedPowerGenerationTotal:10000}")
Long plannedPowerGenerationTotal;
/**
* 区域mapper
*/
@Autowired
RegionMapper regionMapper;
@Autowired
StationPlanMapper stationPlanMapper;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
* 场站mapper
*/
@Autowired
StationBasicMapper stationBasicMapper;
/**
* 场站坐标mapper
*/
@Autowired
StationCoordinateMapper stationCoordinateMapper;
/***
* 设备基础信息中间表数据-热工院
*/
@Autowired
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
CommonServiceImpl commonServiceImpl;
//维护的接口信息
@Autowired
MapRegionMapper mapRegionMapper;
@Autowired
EmqKeeper emqKeeper;
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
@Value("${plannedPowerGenerationTotal:10000}")
Long plannedPowerGenerationTotal;
/**
* 区域mapper
*/
@Autowired
RegionMapper regionMapper;
@Autowired
StationPlanMapper stationPlanMapper;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
* 场站mapper
*/
@Autowired
StationBasicMapper stationBasicMapper;
/**
* 场站坐标mapper
*/
@Autowired
StationCoordinateMapper stationCoordinateMapper;
/***
* 设备基础信息中间表数据-热工院
*/
@Autowired
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
CommonServiceImpl commonServiceImpl;
// 维护的接口信息
@Autowired
MapRegionMapper mapRegionMapper;
@Autowired
EmqKeeper emqKeeper;
// @Autowired
// InfluxdbUtil influxdbUtil;
/**
* 根据场站编号获取该场站的装机容量
*
* @param werks
* @return
*/
public Double getStationCaPACITYL(String werks) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
}
/***
* 获取风站场站
*
* */
public Map<String, String> getStationfs(StationBasic stationBasic) {
String value = "0";
Map<String, String> map = new HashMap<>();
Map<String, List<String>> queryCondtion = new HashMap<>();
if (stationBasic.getStationType().equals("FDZ")) {
String gatewayId = stationBasic.getFanGatewayId();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速"));
map.put("name", "风速/辐照度");
map.put("value", value + "m/s");
} else {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"));
map.put("name", "风速/辐照度");
map.put("value", value + "W/㎡");
}
return map;
}
/***
* 电站容量
* */
public Map<String, String> getStationrl(StationBasic stationBasic) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity);
Map<String, String> map = new HashMap<>();
map.put("name", "容量");
map.put("value", value + "MW");
return map;
}
/**
* 根据省份名称查询电站详情
*
* @param provinceName
* @return
*/
/**
* 根据场站编号获取该场站的装机容量
*
* @param werks
* @return
*/
public Double getStationCaPACITYL(String werks) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
}
/***
* 获取风站场站
*
*/
public Map<String, String> getStationfs(StationBasic stationBasic) {
String value = "0";
Map<String, String> map = new HashMap<>();
Map<String, List<String>> queryCondtion = new HashMap<>();
if (stationBasic.getStationType().equals("FDZ")) {
String gatewayId = stationBasic.getFanGatewayId();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速"));
map.put("name", "风速/辐照度");
map.put("value", value + "m/s");
} else {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
value = String.format("%.2f",
commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"));
map.put("name", "风速/辐照度");
map.put("value", value + "W/㎡");
}
return map;
}
/***
* 电站容量
*/
public Map<String, String> getStationrl(StationBasic stationBasic) {
Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl
.getStationCapactityByStationWerks(stationBasic.getStationNumber());
String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity);
Map<String, String> map = new HashMap<>();
map.put("name", "容量");
map.put("value", value + "MW");
return map;
}
/**
* 根据省份名称查询电站详情
*
* @param provinceName
* @return
*/
// public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
// List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
......@@ -226,7 +224,6 @@ public class MonitoringServiceImpl {
// return regionNationWideDtoList;
// }
// public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
//
// List<ColModel> colModels = new ArrayList<>();
......@@ -368,82 +365,95 @@ public class MonitoringServiceImpl {
// logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
// }
// }
public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>();
if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) {
TabDto tab0 = new TabDto("风机布置图", "0");
TabDto tab1 = new TabDto("集电线路图", "1");
TabDto tab2 = new TabDto("运行列表", "2");
TabDto tab3 = new TabDto("升压站监控", "3");
TabDto tab4 = new TabDto("电量表计", "4");
TabDto tab5 = new TabDto("故障信息", "5");
tabDtoList.add(tab0);
tabDtoList.add(tab1);
tabDtoList.add(tab2);
tabDtoList.add(tab3);
tabDtoList.add(tab4);
tabDtoList.add(tab5);
} else {
TabDto tab6 = new TabDto("光伏区布置图", "6");
TabDto tab7 = new TabDto("集电线路图", "7");
TabDto tab8 = new TabDto("运行列表", "8");
TabDto tab9 = new TabDto("升压站监控", "9");
TabDto tab10 = new TabDto("电量表计", "10");
TabDto tab11 = new TabDto("故障信息", "11");
public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>();
if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) {
TabDto tab0 = new TabDto("风机布置图", "0");
TabDto tab1 = new TabDto("集电线路图", "1");
TabDto tab2 = new TabDto("运行列表", "2");
TabDto tab3 = new TabDto("升压站监控", "3");
TabDto tab4 = new TabDto("电量表计", "4");
TabDto tab5 = new TabDto("故障信息", "5");
tabDtoList.add(tab0);
tabDtoList.add(tab1);
tabDtoList.add(tab2);
tabDtoList.add(tab3);
tabDtoList.add(tab4);
tabDtoList.add(tab5);
} else {
TabDto tab6 = new TabDto("光伏区布置图", "6");
TabDto tab7 = new TabDto("集电线路图", "7");
TabDto tab8 = new TabDto("运行列表", "8");
TabDto tab9 = new TabDto("升压站监控", "9");
TabDto tab10 = new TabDto("电量表计", "10");
TabDto tab11 = new TabDto("故障信息", "11");
// TabDto tab12 = new TabDto("集中式-离散率", "12");
// TabDto tab13 = new TabDto("组串式-离散率", "13");
TabDto tab14 = new TabDto("离散率", "14");
tabDtoList.add(tab6);
tabDtoList.add(tab7);
tabDtoList.add(tab8);
tabDtoList.add(tab9);
tabDtoList.add(tab10);
tabDtoList.add(tab11);
TabDto tab14 = new TabDto("离散率", "14");
tabDtoList.add(tab6);
tabDtoList.add(tab7);
tabDtoList.add(tab8);
tabDtoList.add(tab9);
tabDtoList.add(tab10);
tabDtoList.add(tab11);
// tabDtoList.add(tab12);
// tabDtoList.add(tab13);
tabDtoList.add(tab14);
}
return tabDtoList;
}
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
mapRegionList.forEach(mapRegion -> {
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
//开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
List<Region> regions = regionList.stream().filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2)) || stringArrayList.contains(region.getRegionName().substring(0, 3))).collect(Collectors.toList());
List<String> regionNames = regions.stream().map(region -> region.getRegionName()).collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList());
mapAreaInfoDto.setProvince(regionNames);
// --------------------省份名称处理结束----------------------------
//设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
//设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
//风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
//集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
//分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
//储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
//获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
//获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
return mapAreaInfoDtoList;
}
tabDtoList.add(tab14);
}
return tabDtoList;
}
public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
mapRegionList.forEach(mapRegion -> {
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto();
// 开始处理省份名称-三维与二维的名称有差异
ArrayList<String> stringArrayList = mapRegion.getProvince();
List<Region> regions = regionList.stream()
.filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2))
|| stringArrayList.contains(region.getRegionName().substring(0, 3)))
.collect(Collectors.toList());
List<String> regionNames = regions.stream().map(region -> region.getRegionName())
.collect(Collectors.toList());
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode()))
.collect(Collectors.toList());
List<StationBasic> stationBasicListAll = stationBasicList.stream()
.filter(stationBasic -> regionCodes
.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0]))
.collect(Collectors.toList());
mapAreaInfoDto.setProvince(regionNames);
// --------------------省份名称处理结束----------------------------
// 设置片区名称
mapAreaInfoDto.setAreaName(mapRegion.getName());
// 设置片区code
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
// 风电站数量
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
// 集中式光伏电站数量
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
// 分布式光伏电站数量
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count()));
// 储能光伏电站数量
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count()));
// 获取装机容量
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll));
// 获取当日发电量
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll));
mapAreaInfoDto.setPosition(mapRegion.getPosition());
mapAreaInfoDtoList.add(mapAreaInfoDto);
});
return mapAreaInfoDtoList;
}
// public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
// List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
......@@ -488,160 +498,172 @@ public class MonitoringServiceImpl {
// return homeMapStationInfoDtoList;
// }
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) {
Map<String, Object> map = new HashMap<>();
List<String> values = new ArrayList<>();
Map<Date, Double> groupMap = new HashMap<>();
List<String> time = new ArrayList<>();
Map<String, Object> activePowerInfo = new HashMap<>();
List<IndicatorData> activePowerList = new ArrayList<>();
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) {
Map<String, Object> map = new HashMap<>();
List<String> values = new ArrayList<>();
Map<Date, Double> groupMap = new HashMap<>();
List<String> time = new ArrayList<>();
Map<String, Object> activePowerInfo = new HashMap<>();
List<IndicatorData> activePowerList = new ArrayList<>();
// String startTime = DateUtil.today() + " 00:00:00";
// String endTime = DateUtil.today() + " 23:59:59";
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime);
String endTime = sdf.format(currentDayEndTime);
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
} else {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
}
for (int i = 0; i < activePowerList.size(); i++) {
IndicatorData indicatorData = activePowerList.get(i);
time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
} else {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF() * CommonConstans.kwToMv));
}
}
String max = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String min = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String mean = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
activePowerInfo.put("mean", mean);
activePowerInfo.put("max", max);
activePowerInfo.put("min", min);
activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max)));
activePowerInfo.put("minTime", time.get(values.lastIndexOf(min)));
activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces, Double.valueOf(values.get(values.size() - 1)) / installedCapacity));
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map3 = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map1.put("data", values);
seriesData.add(map1);
map.put("seriesData", seriesData);
map.put("axisData", time);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table", JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info", JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true);
} catch (Exception exception) {
exception.printStackTrace();
}
return map;
}
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getStationNumber() != null) {
try {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
try {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<Map<String, String>> result = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
Map<String, String> stringStringMap = new HashMap<>();
stringStringMap.put("name", key);
stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
result.add(stringStringMap);
});
return result;
}
//获取装机容量
public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
});
hashMap.put("title", String.format("%.2f", total.get()));
return hashMap;
}
//获取有功功率
public HashMap<String, String> getActivePowerByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
});
//有功功率换算
hashMap.put("title", String.format("%.2f", total.get() / 1000));
return hashMap;
}
//获取社会贡献
/**
* @param areaName 片区名称
* @param stationId 场站id
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果 areaName 与stationId都传 则取场站id
*/
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime);
String endTime = sdf.format(currentDayEndTime);
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
} else {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
}
for (int i = 0; i < activePowerList.size(); i++) {
IndicatorData indicatorData = activePowerList.get(i);
time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
} else {
values.add(String.format(CommonConstans.Twodecimalplaces,
indicatorData.getValueF() * CommonConstans.kwToMv));
}
}
String max = String.format(CommonConstans.Twodecimalplaces,
values.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String min = String.format(CommonConstans.Twodecimalplaces,
values.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String mean = String.format(CommonConstans.Twodecimalplaces,
values.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
activePowerInfo.put("mean", mean);
activePowerInfo.put("max", max);
activePowerInfo.put("min", min);
activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max)));
activePowerInfo.put("minTime", time.get(values.lastIndexOf(min)));
activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces,
Double.valueOf(values.get(values.size() - 1)) / installedCapacity));
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map3 = new HashMap<>();
Map<String, Object> map1 = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map1.put("data", values);
seriesData.add(map1);
map.put("seriesData", seriesData);
map.put("axisData", time);
try {
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table",
JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info",
JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true);
} catch (Exception exception) {
exception.printStackTrace();
}
return map;
}
public String getInstallCapity(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getStationNumber() != null) {
try {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
AtomicReference<Double> total = new AtomicReference<>(0.0);
stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
try {
total.updateAndGet(
v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) {
}
}
});
return String.format("%.2f", total.get());
}
public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
List<Map<String, String>> result = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream()
.collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
listMap.keySet().forEach(key -> {
Map<String, String> stringStringMap = new HashMap<>();
stringStringMap.put("name", key);
stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
result.add(stringStringMap);
});
return result;
}
// 获取装机容量
public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
});
hashMap.put("title", String.format("%.2f", total.get()));
return hashMap;
}
// 获取有功功率
public HashMap<String, String> getActivePowerByAreaName(String areaName) {
HashMap<String, String> hashMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0);
List<StationBasic> stationBasicListAll = new ArrayList<>();
if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
} else {
stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
});
// 有功功率换算
hashMap.put("title", String.format("%.2f", total.get() / 1000));
return hashMap;
}
// 获取社会贡献
/**
* @param areaName 片区名称
* @param stationId 场站id
* @return 社会贡献列表
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果
* areaName 与stationId都传 则取场站id
*/
// public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
// AtomicReference<Double> total = new AtomicReference<>(0.0);
// List<StationBasic> stationBasicListAll = new ArrayList<>();
......@@ -731,20 +753,21 @@ public class MonitoringServiceImpl {
// hashMapPage.setRecords(hashMapList);
// return hashMapPage;
// }
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
return stationBasicListAll;
}
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
// 获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince();
// 变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper
.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
stationBasicListAll.addAll(stationBasicList);
}
return stationBasicListAll;
}
// public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) {
// List<StationBasic> stationBasicListAll = new ArrayList<>();
......@@ -774,7 +797,6 @@ public class MonitoringServiceImpl {
// return hashMap;
// }
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
// Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
// List<HashMap<String, String>> mapList = new ArrayList<>();
......@@ -811,18 +833,17 @@ public class MonitoringServiceImpl {
// return hashMapPage;
// }
public List<String> getXListofRecentOneYear() {
List<String> xList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
Date date = new Date();
for (int i = 1; i < 13; i++) {
calendar.setTime(date);
calendar.add(Calendar.MONTH, i - 12);
xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH));
}
return xList;
}
public List<String> getXListofRecentOneYear() {
List<String> xList = new ArrayList<>();
Calendar calendar = Calendar.getInstance();
Date date = new Date();
for (int i = 1; i < 13; i++) {
calendar.setTime(date);
calendar.add(Calendar.MONTH, i - 12);
xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH));
}
return xList;
}
//
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
......@@ -893,21 +914,23 @@ public class MonitoringServiceImpl {
// return page;
// }
@Scheduled(cron = "0/5 * * * * *")
public void getTotalData() {
//计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR);
int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1;
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear, String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ")).mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon))).mapToDouble(StationPlan::getValue).sum();
//查询风电站年计划完成量
@Scheduled(cron = "0/5 * * * * *")
public void getTotalData() {
// 计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR);
int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1;
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear, String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ"))
.mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon)))
.mapToDouble(StationPlan::getValue).sum();
// 查询风电站年计划完成量
//
// List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
// List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
......@@ -917,142 +940,178 @@ public class MonitoringServiceImpl {
// List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
// double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
List<StationBasic> stationBasicListAll = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream()
.filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
List<StationBasic> gfList = stationBasicListAll.stream()
.filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10);
Page<HashMap<String, String>> page1 = new Page<>(1, 10);
Page<HashMap<String, String>> page2 = new Page<>(1, 10);
Page<HashMap<String, String>> page3 = new Page<>(1, 10);
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list = new ArrayList<>();
//装机容量
HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
// stringHashMap.put("title", totalInstall.toString());
//stringHashMap.put("data", "");
// list.add(stringHashMap);
//风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1);
//集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2);
//分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString());
stringHashMap3.put("data", String.valueOf(fbsgfdzList.size()));
list.add(stringHashMap3);
page.setRecords(list);
BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList));
List<HashMap<String, String>> list = new ArrayList<>();
// 装机容量
HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
// stringHashMap.put("title", totalInstall.toString());
// stringHashMap.put("data", "");
// list.add(stringHashMap);
// 风电站
HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1);
// 集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2);
// 分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString());
stringHashMap3.put("data", String.valueOf(fbsgfdzList.size()));
list.add(stringHashMap3);
page.setRecords(list);
BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList));
//----------------------装机容量结束----------------------------------------
// ----------------装机容量开始-----------------------
List<HashMap<String, String>> list1 = new ArrayList<>();
List<HashMap<String, String>> list2 = new ArrayList<>();
List<HashMap<String, String>> list3 = new ArrayList<>();
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
List<HashMap<String, String>> list1 = new ArrayList<>();
List<HashMap<String, String>> list2 = new ArrayList<>();
List<HashMap<String, String>> list3 = new ArrayList<>();
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
// powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
// powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
// powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
powerOfAnnualFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
});
gfList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
});
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF.get() * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap9.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("Moon", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
resultMap.put("Year", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
list2.add(stringHashMap12);
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get());
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
stringHashMap13.put("unit", "二氧化碳减排量(t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("unit", "节约标准煤(t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner)));
stringHashMap15.put("unit", "碳粉尘减排量(t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide)));
stringHashMap16.put("unit", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic", JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true);
} catch (Exception ex) {
}
}
powerOfDayFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
powerOfAnnualFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
});
gfList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
powerOfDayGF.updateAndGet(
v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v
+ commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF.updateAndGet(
v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
});
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/"
+ String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/"
+ String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/"
+ String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue)
+ "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title",
String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/"
+ String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualGF.get() * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap9.put("title",
String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title",
String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("Moon",
String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces,
(powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title",
String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
resultMap.put("Year",
String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces,
(powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
list2.add(stringHashMap12);
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get());
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
stringHashMap13.put("unit", "二氧化碳减排量(t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("unit", "节约标准煤(t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner)));
stringHashMap15.put("unit", "碳粉尘减排量(t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title",
String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide)));
stringHashMap16.put("unit", "二氧化硫减排量(t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1,
true);
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"),
1, true);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic",
JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic",
JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"),
1, true);
} catch (Exception ex) {
}
}
// public List<HashMap<String, Object>> getNationalPowerGenerationData() {
// List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
......@@ -1076,40 +1135,44 @@ public class MonitoringServiceImpl {
// return resultHashMap;
// }
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList, String color) {
HashMap<String, Object> hashMap = new HashMap<>();
List<String> xData = new ArrayList<>();
List<String> yData = new ArrayList<>();
stationBasicList.forEach(stationBasic -> {
xData.add(stationBasic.getStationName());
yData.add(stationBasic.getAddress());
});
hashMap.put("title", title);
hashMap.put("color", color);
hashMap.put("xData", xData);
hashMap.put("yData", yData);
return hashMap;
}
public List<HashMap<String, Object>> getSelectDataForNational() {
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
regionList.forEach(region -> {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("label", region.getRegionName());
hashMap.put("value", region.getRegionCode());
List<HashMap<String, Object>> children = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode()))).map(stationBasic -> {
HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("label", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getSequenceNbr());
return hashMap1;
}).collect(Collectors.toList());
hashMap.put("children", children);
hashMapList.add(hashMap);
});
return hashMapList;
}
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList,
String color) {
HashMap<String, Object> hashMap = new HashMap<>();
List<String> xData = new ArrayList<>();
List<String> yData = new ArrayList<>();
stationBasicList.forEach(stationBasic -> {
xData.add(stationBasic.getStationName());
yData.add(stationBasic.getAddress());
});
hashMap.put("title", title);
hashMap.put("color", color);
hashMap.put("xData", xData);
hashMap.put("yData", yData);
return hashMap;
}
public List<HashMap<String, Object>> getSelectDataForNational() {
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper
.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
regionList.forEach(region -> {
HashMap<String, Object> hashMap = new HashMap<>();
hashMap.put("label", region.getRegionName());
hashMap.put("value", region.getRegionCode());
List<HashMap<String, Object>> children = stationBasicList.stream().filter(
stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())))
.map(stationBasic -> {
HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap1.put("label", stationBasic.getStationName());
hashMap1.put("value", stationBasic.getSequenceNbr());
return hashMap1;
}).collect(Collectors.toList());
hashMap.put("children", children);
hashMapList.add(hashMap);
});
return hashMapList;
}
// const data = {
// xData: [],
......@@ -1127,234 +1190,298 @@ public class MonitoringServiceImpl {
// ]
// };
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
//x轴数据
List<String> xdata = new ArrayList<>();
//实时有功功率
List<String> currentPowerYdata = new ArrayList<>();
//短期功率预测
List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0));
shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0));
superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0));
}
result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " + date);
currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 " + date);
shortPowerHashMap.put("yData", currentPowerYdata);
result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 " + date);
superShortPowerHashMap.put("yData", currentPowerYdata);
result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String shortMin = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> gz = new ArrayList<>();
List<String> sj1 = new ArrayList<>();
gz.add(currentMin);
sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin)));
gz.add(shortMin);
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin)));
gz.add(supreMin);
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String currentMax = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String shortMax = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String supreMax = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>();
List<String> sj2 = new ArrayList<>();
zdz.add(currentMax);
zdz.add(shortMax);
zdz.add(supreMax);
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString();
List<String> pjz = new ArrayList<>();
List<String> fjl = new ArrayList<>();
pjz.add(currentAvg);
pjz.add(shortAvg);
pjz.add(supreAvg);
fjl = Arrays.asList("0.68", "0.89", "0.56");
footerList.put("gz", gz);
footerList.put("sj1", sj1);
footerList.put("zdz", zdz);
footerList.put("sj2", sj2);
footerList.put("pjz", pjz);
footerList.put("fjl", fjl);
result.put("footerList", footerList);
return result;
}
public Double keepFourdecimalPlaces(Double param) {
return Double.valueOf(String.format("%.4f", param));
}
public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) {
HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%");
returnResult.put("monthValue", "0.0000");
returnResult.put("monthPlanValue", "0.0000");
returnResult.put("yearCompleteRate", "0.00%");
returnResult.put("yearValue", "0.0000");
returnResult.put("yearPlanValue", "0.0000");
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList());
}
if (StringUtils.isNotBlank(stationId)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId)).collect(Collectors.toList());
}
//月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
//年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) {
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
List<StationPlan> stationPlans = stationPlanMapper.selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds));
String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN);
String currentYear = currentYearAndMonth.split("-")[0];
Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]);
Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear)).mapToDouble(i -> i.getValue()).sum();
Double monthPlanValue = stationPlans.stream().filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly())).mapToDouble(i -> i.getValue()).sum();
if (monthlyPower.get() > 0 && monthPlanValue > 0) {
returnResult.put("monthCompleteRate", String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%");
returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()));
returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue));
}
if (annualPower.get() > 0 && yearPlanValue > 0) {
returnResult.put("yearCompleteRate", String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%");
returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()));
returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue));
}
return returnResult;
}
public Map<String, Object> getGenPowerInfo(String areaCode) {
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code",areaCode));
List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList());
stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos;
if(!ObjectUtils.isEmpty(mapRegion)){
stationCacheInfoDtos =filterData;
}
}
List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList());
Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince));
HashMap<String, Object> returnResult = new HashMap<>();
HashMap<String, Object> pv_interval = new HashMap<>();
HashMap<String, Object> fan_interval = new HashMap<>();
HashMap<String, Double> dayGenCache = new HashMap();
HashMap<String, Double> monthGenCache = new HashMap();
returnResult.put("pv_station_count", pvStationList.size());
returnResult.put("fan_station_count", fanStationList.size());
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfGF = new AtomicReference<>(new Double(0.00));
fanStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
pvStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
planOfGF.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
returnResult.put("today_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
returnResult.put("today_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()));
returnResult.put("month_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
returnResult.put("month_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()));
returnResult.put("month_pv_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthGF.get() / planOfGF.get()) * 100));
if(returnResult.get("month_pv_quota_schedule").toString().equals("NaN")){
returnResult.put("month_pv_quota_schedule",0.00f);
}
returnResult.put("month_fan_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() / planOfFD.get()) * 100));
if(returnResult.get("month_fan_quota_schedule").toString().equals("NaN")){
returnResult.put("month_fan_quota_schedule",0.00f);
}
groupByProvince.keySet().forEach(s -> {
HashMap<String, Object> fan = new HashMap<>();
HashMap<String, Object> pv = new HashMap<>();
List<StationCacheInfoDto> list = groupByProvince.get(s);
List<String> fanStationIds = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
List<String> pvStationIds = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
fan.put("station_count", fanStationIds.size());
pv.put("station_count", pvStationIds.size());
fan.put("today_power", getTotalPowerFromCache(fanStationIds, dayGenCache));
pv.put("today_power", getTotalPowerFromCache(pvStationIds, dayGenCache));
fan.put("month_power", getTotalPowerFromCache(fanStationIds, monthGenCache));
pv.put("month_power", getTotalPowerFromCache(pvStationIds, monthGenCache));
pv_interval.put(s, pv);
fan_interval.put(s, fan);
});
returnResult.put("pv_interval", pv_interval);
returnResult.put("fan_interval", fan_interval);
return returnResult;
}
public Double getPlanGenByStationIdAndMonth(String stationId) {
String[] dates = DateUtil.today().split("-");
return stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0], String.valueOf(Integer.valueOf(dates[1])));
}
public Double getTotalPowerFromCache(List<String> keys, HashMap<String, Double> cache) {
AtomicReference<Double> result = new AtomicReference<>(0.0);
keys.forEach(s -> {
result.set(result.get() + cache.get(s));
});
return keepFourdecimalPlaces(result.get());
}
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
// x轴数据
List<String> xdata = new ArrayList<>();
// 实时有功功率
List<String> currentPowerYdata = new ArrayList<>();
// 短期功率预测
List<String> shortPowerYdata = new ArrayList<>();
// 超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0));
shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0));
superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0));
}
result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " + date);
currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 " + date);
shortPowerHashMap.put("yData", currentPowerYdata);
result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 " + date);
superShortPowerHashMap.put("yData", currentPowerYdata);
result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f",
currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String shortMin = String.format("%.2f",
shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f",
superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> gz = new ArrayList<>();
List<String> sj1 = new ArrayList<>();
gz.add(currentMin);
sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin)));
gz.add(shortMin);
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin)));
gz.add(supreMin);
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String currentMax = String.format("%.2f",
currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String shortMax = String.format("%.2f",
shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
String supreMax = String.format("%.2f",
superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>();
List<String> sj2 = new ArrayList<>();
zdz.add(currentMax);
zdz.add(shortMax);
zdz.add(supreMax);
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString();
List<String> pjz = new ArrayList<>();
List<String> fjl = new ArrayList<>();
pjz.add(currentAvg);
pjz.add(shortAvg);
pjz.add(supreAvg);
fjl = Arrays.asList("0.68", "0.89", "0.56");
footerList.put("gz", gz);
footerList.put("sj1", sj1);
footerList.put("zdz", zdz);
footerList.put("sj2", sj2);
footerList.put("pjz", pjz);
footerList.put("fjl", fjl);
result.put("footerList", footerList);
return result;
}
public Double keepFourdecimalPlaces(Double param) {
return Double.valueOf(String.format("%.4f", param));
}
public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) {
HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%");
returnResult.put("monthValue", "0.0000");
returnResult.put("monthPlanValue", "0.0000");
returnResult.put("yearCompleteRate", "0.00%");
returnResult.put("yearValue", "0.0000");
returnResult.put("yearPlanValue", "0.0000");
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
.collect(Collectors.toList());
}
if (StringUtils.isNotBlank(stationId)) {
stationCacheInfoDtos = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId))
.collect(Collectors.toList());
}
// 月发电量
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
// 年发电量
AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) {
if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
monthlyPower.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId,
Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId)
.collect(Collectors.toList());
List<StationPlan> stationPlans = stationPlanMapper
.selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds));
String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN);
String currentYear = currentYearAndMonth.split("-")[0];
Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]);
Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear))
.mapToDouble(i -> i.getValue()).sum();
Double monthPlanValue = stationPlans.stream()
.filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly()))
.mapToDouble(i -> i.getValue()).sum();
if (monthlyPower.get() > 0 && monthPlanValue > 0) {
returnResult.put("monthCompleteRate",
String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%");
returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()));
returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue));
}
if (annualPower.get() > 0 && yearPlanValue > 0) {
returnResult.put("yearCompleteRate",
String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%");
returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()));
returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue));
}
return returnResult;
}
public Map<String, Object> getGenPowerInfo(String areaCode) {
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
if (StringUtils.isNotBlank(areaCode)) {
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code", areaCode));
List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
.collect(Collectors.toList());
stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos;
if (!ObjectUtils.isEmpty(mapRegion)) {
stationCacheInfoDtos = filterData;
}
}
List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList());
List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream()
.filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList());
Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream()
.collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince));
HashMap<String, Object> returnResult = new HashMap<>();
HashMap<String, Object> pv_interval = new HashMap<>();
HashMap<String, Object> fan_interval = new HashMap<>();
HashMap<String, Double> dayGenCache = new HashMap();
HashMap<String, Double> monthGenCache = new HashMap();
returnResult.put("pv_station_count", pvStationList.size());
returnResult.put("fan_station_count", fanStationList.size());
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> planOfGF = new AtomicReference<>(new Double(0.00));
fanStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
if (result != null) {
powerOfDayFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfMonthFD.updateAndGet(
v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
dayGenCache.put(stationBasic.getStationId(),
keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthGenCache.put(stationBasic.getStationId(),
keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
}
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
pvStationList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
if (result != null) {
powerOfDayGF.updateAndGet(v -> v
+ commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v
+ commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
}
planOfGF.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
});
returnResult.put("today_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
returnResult.put("today_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()));
returnResult.put("month_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
returnResult.put("month_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()));
returnResult.put("month_pv_quota_schedule",
String.format(CommonConstans.Twodecimalplaces, (powerOfMonthGF.get() / planOfGF.get()) * 100));
if (returnResult.get("month_pv_quota_schedule").toString().equals("NaN")) {
returnResult.put("month_pv_quota_schedule", 0.00f);
}
returnResult.put("month_fan_quota_schedule",
String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() / planOfFD.get()) * 100));
if (returnResult.get("month_fan_quota_schedule").toString().equals("NaN")) {
returnResult.put("month_fan_quota_schedule", 0.00f);
}
groupByProvince.keySet().forEach(s -> {
HashMap<String, Object> fan = new HashMap<>();
HashMap<String, Object> pv = new HashMap<>();
List<StationCacheInfoDto> list = groupByProvince.get(s);
List<String> fanStationIds = list.stream()
.filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
List<String> pvStationIds = list.stream()
.filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
.collect(Collectors.toList()).stream()
.map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList());
fan.put("station_count", fanStationIds.size());
pv.put("station_count", pvStationIds.size());
fan.put("today_power", getTotalPowerFromCache(fanStationIds, dayGenCache));
pv.put("today_power", getTotalPowerFromCache(pvStationIds, dayGenCache));
fan.put("month_power", getTotalPowerFromCache(fanStationIds, monthGenCache));
pv.put("month_power", getTotalPowerFromCache(pvStationIds, monthGenCache));
pv_interval.put(s, pv);
fan_interval.put(s, fan);
});
returnResult.put("pv_interval", pv_interval);
returnResult.put("fan_interval", fan_interval);
return returnResult;
}
public Double getPlanGenByStationIdAndMonth(String stationId) {
String[] dates = DateUtil.today().split("-");
Double plan = stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0],
String.valueOf(Integer.valueOf(dates[1])));
if (plan == null) {
plan = 0.0;
}
return plan;
}
public Double getTotalPowerFromCache(List<String> keys, HashMap<String, Double> cache) {
AtomicReference<Double> result = new AtomicReference<>(0.0);
if (keys != null && !keys.isEmpty() && cache != null && !cache.isEmpty()) {
keys.forEach(s -> {
if(cache.get(s)!=null)
{
result.set(result.get() + cache.get(s));
}
});
}
return keepFourdecimalPlaces(result.get());
}
}
......@@ -15,11 +15,12 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!--
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-ugp-api</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
</dependency>-->
<dependency>
<groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-biz</artifactId>
......@@ -53,7 +54,7 @@
<version>5.7.22</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
......
......@@ -13,5 +13,6 @@ import java.util.Map;
* @createDate: 2023/11/9
*/
public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> {
@Select("select company_name as companyName , level from privilege_company where org_code = #{orgCode}")
Map<String,String> getCompanyInfoByOrgCode(String orgCode);
}
package com.yeejoin.amos.boot.module.jxiop.biz.config;
import com.alibaba.druid.pool.DruidDataSource;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor;
import org.apache.ibatis.plugin.Interceptor;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.util.Properties;
@Configuration
@MapperScan(basePackages = "com.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper", sqlSessionFactoryRef = "mcbWarningSqlSessionFactory")
public class MabWarningDbConfig {
private Logger logger = LoggerFactory.getLogger(MabWarningDbConfig.class);
// 精确到 master 目录,以便跟其他数据源隔离
private static final String MAPPER_LOCATION = "classpath*:mapper/warning/*.xml";
@Value("${spring.db3.datasource.url}")
private String dbUrl;
@Value("${spring.db2.datasource.username}")
private String username;
@Value("${spring.db2.datasource.password}")
private String password;
@Value("${spring.db2.datasource.driver-class-name}")
private String driverClassName;
@Bean(name="mcbWarningDataSource") //声明其为Bean实例
public DataSource masterDataSource() {
DruidDataSource datasource = new DruidDataSource();
datasource.setUrl(this.dbUrl);
datasource.setUsername(username);
datasource.setPassword(password);
datasource.setDriverClassName(driverClassName);
return datasource;
}
@Bean(name = "mcbWarningTransactionManager")
public DataSourceTransactionManager masterTransactionManager() {
return new DataSourceTransactionManager(masterDataSource());
}
@Bean(name = "mcbWarningSqlSessionFactory")
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("mcbWarningDataSource") DataSource masterDataSource)
throws Exception {
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
sessionFactory.setDataSource(masterDataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver()
.getResources(MabWarningDbConfig.MAPPER_LOCATION));
sessionFactory.setTypeAliasesPackage("com.yeejoin.amos.boot.module.jxiop.biz.entity");
//mybatis 数据库字段与实体类属性驼峰映射配置
sessionFactory.getObject().getConfiguration().setMapUnderscoreToCamelCase(true);
//分页插件
Interceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
properties.setProperty("helperDialect", "mysql");
properties.setProperty("offsetAsPageNum", "true");
properties.setProperty("rowBoundsWithCount", "true");
properties.setProperty("reasonable", "true");
properties.setProperty("supportMethodsArguments","true");
properties.setProperty("params", "pageNum=pageNum;pageSize=pageSize;");
interceptor.setProperties(properties);
sessionFactory.setPlugins(interceptor);
return sessionFactory.getObject();
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMcbWarningService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@Api(tags = "McbWarning Controller")
@RequestMapping(value = "/warning")
public class McbWarningController {
@Autowired
private IMcbWarningService mcbWarningService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]今日预警-预警总数", notes = "[监测总览]今日预警-预警总数")
@GetMapping(value = "/count/today")
public ResponseModel<Map<String, Object>> queryTodayCount(@RequestParam(value = "processingStatus", required = false) Integer processingStatus) {
return ResponseHelper.buildResponse(mcbWarningService.queryTodayCount(processingStatus));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]近七日预警统计", notes = "[监测总览]近七日预警统计")
@GetMapping(value = "/count/week")
public ResponseModel<List<Map<String, Object>>> queryWeekCount() {
return ResponseHelper.buildResponse(mcbWarningService.queryWeekCount());
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]预警信息列表", notes = "[监测总览]预警信息列表")
@GetMapping(value = "/warning/page")
public ResponseModel<Page<Map<String, Object>>> queryWarningPage(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
@RequestParam(value = "processingStatus", required = false) Integer processingStatus,
@RequestParam(value = "eventLevel", required = false) String eventLevel,
@RequestParam(value = "createDate", required = false) String createDate,
@RequestParam(value = "warningSourceType", required = false) String warningSourceType
) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
return ResponseHelper.buildResponse(mcbWarningService.queryWarningPage(page, processingStatus, eventLevel, createDate, warningSourceType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]预警信息总数", notes = "[监测总览]预警信息总数")
@GetMapping(value = "/warning/count")
public ResponseModel<Map<String, Object>> queryWarningCount(@RequestParam(value = "processingStatus", required = false) Integer processingStatus,
@RequestParam(value = "eventLevel", required = false) String eventLevel,
@RequestParam(value = "createDate", required = false) String createDate,
@RequestParam(value = "warningSourceType", required = false) String warningSourceType) {
Long count = mcbWarningService.queryWarningCount(processingStatus, eventLevel, createDate, warningSourceType);
Map<String, Object> result = new HashMap<String, Object>() {{
this.put("count", count);
}};
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]问题列表", notes = "[监测总览]问题列表")
@GetMapping(value = "/question/page")
public ResponseModel<Page<Map<String, Object>>> queryQuestionList(@RequestParam(value = "pageNumber", defaultValue = "1") Integer pageNumber,
@RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
@RequestParam(value = "completionStatus", required = false) Integer completionStatus) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
return ResponseHelper.buildResponse(mcbWarningService.queryQuestionPage(page, completionStatus));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "任务详情、问题记录左侧树", notes = "任务详情、问题记录左侧树")
@GetMapping(value = "/warning-warning-info/tree")
public ResponseModel getWarnTree(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getWarnTree(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "任务详情分页列表", notes = "任务详情分页列表")
@GetMapping(value = "/warning-warning-info/page")
public ResponseModel<Page<Map<String, Object>>> getTaskDetailPage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getTaskDetailPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "任务详情统计", notes = "任务详情统计")
@GetMapping(value = "/warning-warning-info/statistics")
public ResponseModel getTaskDetailStatistic(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getTaskDetailStatistic(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "问题记录分页列表", notes = "问题记录分页列表")
@GetMapping(value = "/warning-question-info/questionPage")
public ResponseModel<Page<Map<String, Object>>> getQuestionRecordPage(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getQuestionRecordPage(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "问题记录统计", notes = "问题记录统计")
@GetMapping(value = "/warning-question-info/questionPageTopStatistics")
public ResponseModel getQuestionRecordStatistic(@RequestParam Map<String, Object> map) {
return ResponseHelper.buildResponse(mcbWarningService.getQuestionRecordStatistic(map));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]问题总数", notes = "[监测总览]问题总数")
@GetMapping(value = "/question/count")
public ResponseModel<Map<String, Object>> queryQuestionCount(@RequestParam(value = "completionStatus", required = false) Integer completionStatus) {
Long count = mcbWarningService.queryQuestionCount(completionStatus);
Map<String, Object> result = new HashMap<String, Object>() {{
this.put("count", count);
}};
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "[监测总览]地图点位/路线", notes = "[监测总览]地图点位/路线")
@GetMapping(value = "/map/routes")
public ResponseModel<Object> queryMapRoutes(@RequestParam(value = "province", required = false) String province) {
return ResponseHelper.buildResponse(mcbWarningService.queryMapRoutes(province));
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSON;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.dto.CompanyTreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.ListCompanyModel;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.StdUserEmpower;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.*;
import java.util.stream.Collectors;
/**
* @description:
......@@ -37,143 +46,196 @@ import java.util.stream.Collectors;
@RestController
@Api(tags = "平台单位部门树")
@RequestMapping(value = "/companyClient")
public class PrivilegeController extends BaseController{
@Autowired
private RedisUtils redisUtils;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryOrgTree")
@ApiOperation(httpMethod = "GET",value = "查询单位、子单位、部门树", notes = "查询单位、子单位、部门树")
public FeignClientResult<Collection<UserOrgTreeModel>> queryOrgTree() {
//获取当前登录人单位
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
Long companyId=reginParams.getCompany().getSequenceNbr();
FeignClientResult<Collection<UserOrgTreeModel>> de =Privilege.companyClient.queryOrgTree(companyId);
return de;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/subcompany")
@ApiOperation(httpMethod = "GET",value = "查询单位、子单位", notes = "查询单位、子单位")
public ResponseModel< Collection<CompanyModel>> subcompany(String orgCode,String type) {
Long companyId =null;
if(orgCode!=null){
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
.queryByOrgcode(orgCode).getResult();
for (Map.Entry<Object, Object> it : l.entrySet()) {
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
CompanyModel.class);
if (companyModel != null) {
companyId = companyModel.getSequenceNbr();
}
break;
}
}else{
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
companyId = reginParams.getCompany().getSequenceNbr();
}
//获取当前登录人单位
List<ListCompanyModel> data = new ArrayList();
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId);
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
CompanyModel companyModel=dat.getResult();
List<CompanyModel> list =new ArrayList<>();
//如果是公司则获取所有片区
// 86*353*328*364
if(companyModel.getLevel().equals("categroy_leve2")){
Collection<CompanyModel> companyModelList= de.getResult();
companyModelList=companyModelList.stream().filter(companyModel1 ->companyModel1.getCompanyName().contains("区域")).collect(Collectors.toList());
companyModelList.parallelStream().forEach((companyModel1)->{companyModel1.setChildren(new ArrayList());});
return ResponseHelper.buildResponse(companyModelList);
}
//如果是片区则获取片区
if(companyModel.getLevel().equals("area")){
list.add(companyModel);
return ResponseHelper.buildResponse(list);
}
if(!"add".equals(type)){
if(companyModel.getLevel().equals("station")){
FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId());
list.add(areaInfo.getResult());
}
}
//如果是场站获取片区
public class PrivilegeController extends BaseController {
@Autowired
private RedisUtils redisUtils;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
@Value("${yth.qg.id}")
private Long qgCompanyId;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryOrgTree")
@ApiOperation(httpMethod = "GET", value = "查询单位、子单位、部门树", notes = "查询单位、子单位、部门树")
public FeignClientResult<Collection<UserOrgTreeModel>> queryOrgTree() {
// 获取当前登录人单位
ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
Long companyId = reginParams.getCompany().getSequenceNbr();
FeignClientResult<Collection<UserOrgTreeModel>> de = Privilege.companyClient.queryOrgTree(companyId);
return de;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/subcompany")
@ApiOperation(httpMethod = "GET", value = "查询单位、子单位", notes = "查询单位、子单位")
public ResponseModel<Collection<CompanyModel>> subcompany(String orgCode, String type) {
// Long companyId =null;
// if(orgCode!=null){
// LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
// .queryByOrgcode(orgCode).getResult();
// for (Map.Entry<Object, Object> it : l.entrySet()) {
//
// CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
// CompanyModel.class);
// if (companyModel != null) {
// companyId = companyModel.getSequenceNbr();
// }
// break;
// }
//
// }else{
// ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
// companyId = reginParams.getCompany().getSequenceNbr();
// }
// //获取当前登录人单位
// List<ListCompanyModel> data = new ArrayList();
// FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
// CompanyModel companyModel=dat.getResult();
// List<CompanyModel> list =new ArrayList<>();
// //如果是公司则获取所有片区
//// 86*353*328*364
// if(companyModel.getLevel().equals("departmentorcompany")){
// Collection<CompanyModel> companyModelList= de.getResult();
// companyModelList=companyModelList.stream().filter(companyModel1 ->companyModel1.getCompanyName().contains("区域")).collect(Collectors.toList());
// companyModelList.parallelStream().forEach((companyModel1)->{companyModel1.setChildren(new ArrayList());});
// return ResponseHelper.buildResponse(companyModelList);
// }
// //如果是片区则获取片区
// if(companyModel.getLevel().equals("area")){
// list.add(companyModel);
// return ResponseHelper.buildResponse(list);
// }
// if(!"add".equals(type)){
// if(companyModel.getLevel().equals("station")){
// FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId());
// list.add(areaInfo.getResult());
// }
// }
// 如果是场站获取片区
// if(companyModel.getLevel().equals("station")){
// FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId());
// list.add(areaInfo.getResult());
// }
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/stationTree")
@ApiOperation(httpMethod = "GET",value = "查询所属场站", notes = "查询所属场站")
public ResponseModel< Collection<CompanyModel>> stationTree(String orgCode ) {
Long companyId =null;
if(orgCode!=null){
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
.queryByOrgcode(orgCode).getResult();
for (Map.Entry<Object, Object> it : l.entrySet()) {
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
CompanyModel.class);
if (companyModel != null) {
companyId = companyModel.getSequenceNbr();
}
break;
}
}else{
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
companyId = reginParams.getCompany().getSequenceNbr();
}
List<ListCompanyModel> data = new ArrayList();
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId);
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
CompanyModel companyModel=dat.getResult();
companyModel.setChildren(de.getResult());
List<CompanyModel> list =new ArrayList<>();
list.add(companyModel);
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/permissionTree")
@ApiOperation(httpMethod = "GET",value = "查询所属场站", notes = "查询所属场站")
public ResponseModel< Collection<CompanyModel>> permissionTree(@RequestParam(required = false,defaultValue = "86*353*328") String orgCode ) {
Long companyId =null;
if(orgCode!=null){
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
.queryByOrgcode(orgCode).getResult();
for (Map.Entry<Object, Object> it : l.entrySet()) {
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
CompanyModel.class);
if (companyModel != null) {
companyId = companyModel.getSequenceNbr();
}
break;
}
}
List<ListCompanyModel> data = new ArrayList();
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId);
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
CompanyModel companyModel=dat.getResult();
companyModel.setChildren(de.getResult());
List<CompanyModel> list =new ArrayList<>();
list.add(companyModel);
return ResponseHelper.buildResponse(list);
}
String companyLevel = "categroy_leve2";
String companyName = "";
Long parentId = null;
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
Map<String, String> companyInfo = new HashMap<String, String>();
if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!");
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString();
companyName = companyInfo.get("companyName").toString();
}
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(qgCompanyId);
List<CompanyModel> list = new ArrayList<>();
// 如果是全国
if (companyLevel.equals("categroy_leve2")) {
Collection<CompanyModel> companyModelList = de.getResult();
companyModelList = companyModelList.stream()
.filter(companyModel1 -> companyModel1.getCompanyName().contains("区域"))
.collect(Collectors.toList());
companyModelList.parallelStream().forEach((companyModel1) -> {
companyModel1.setChildren(new ArrayList());
});
return ResponseHelper.buildResponse(companyModelList);
}
// 如果是片区则获取片区
if (companyLevel.equals("area")||(!"add".equals(type)&&companyLevel.equals("station"))) {
Collection<CompanyModel> companyModelList = de.getResult();
companyModelList = companyModelList.stream()
.filter(companyModel1 -> companyModel1.getCompanyName().contains("区域"))
.collect(Collectors.toList());
for (CompanyModel companyModel : companyModelList) {
if (companyModel.getCompanyName().equals(companyName)) {
list.add(companyModel);
break;
}
}
list.parallelStream().forEach((companyModel1) -> {
companyModel1.setChildren(new ArrayList());
});
return ResponseHelper.buildResponse(list);
}
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/stationTree")
@ApiOperation(httpMethod = "GET", value = "查询所属场站", notes = "查询所属场站")
public ResponseModel<Collection<CompanyModel>> stationTree(String orgCode) {
Long companyId = null;
if (orgCode != null) {
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
.queryByOrgcode(orgCode).getResult();
for (Map.Entry<Object, Object> it : l.entrySet()) {
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
CompanyModel.class);
if (companyModel != null) {
companyId = companyModel.getSequenceNbr();
}
break;
}
} else {
ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
ReginParams.class);
companyId = reginParams.getCompany().getSequenceNbr();
}
List<ListCompanyModel> data = new ArrayList();
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId);
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
CompanyModel companyModel = dat.getResult();
companyModel.setChildren(de.getResult());
List<CompanyModel> list = new ArrayList<>();
list.add(companyModel);
return ResponseHelper.buildResponse(list);
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@GetMapping(value = "/permissionTree")
@ApiOperation(httpMethod = "GET", value = "查询所属场站", notes = "查询所属场站")
public ResponseModel<Collection<CompanyModel>> permissionTree(
@RequestParam(required = false, defaultValue = "86*353*328") String orgCode) {
Long companyId = null;
if (orgCode != null) {
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
.queryByOrgcode(orgCode).getResult();
for (Map.Entry<Object, Object> it : l.entrySet()) {
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
CompanyModel.class);
if (companyModel != null) {
companyId = companyModel.getSequenceNbr();
}
break;
}
}
List<ListCompanyModel> data = new ArrayList();
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId);
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
CompanyModel companyModel = dat.getResult();
companyModel.setChildren(de.getResult());
List<CompanyModel> list = new ArrayList<>();
list.add(companyModel);
return ResponseHelper.buildResponse(list);
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface McbWarningMapper extends BaseMapper {
/**
* 今日预警-预警总数
*
* @param processingStatus 处理状态
* @return 总数信息
*/
Map<String, Object> queryTodayCount(
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus
);
/**
* 近七日预警统计
*
* @return 预警统计
*/
List<Map<String, Object>> queryWeekCount(
@Param("projectOrgCodes") List<String> projectOrgCodes
);
/**
* 预警列表
*
* @return 预警列表
*/
List<Map<String, Object>> queryWarningList(
@Param("start") Long start,
@Param("offset") Long offset,
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus,
@Param("eventLevel") String eventLevel,
@Param("createDate") String createDate,
@Param("warningSourceType") String warningSourceType
);
/**
* 预警总数
*
* @return 预警总数
*/
Long queryWarningCount(
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("processingStatus") Integer processingStatus,
@Param("eventLevel") String eventLevel,
@Param("createDate") String createDate,
@Param("warningSourceType") String warningSourceType
);
/**
* 问题列表
*
* @return 问题列表
*/
List<Map<String, Object>> queryQuestionList(
@Param("start") Long start,
@Param("offset") Long offset,
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("completionStatus") Integer completionStatus
);
/**
* 问题总数
*
* @return 问题总数
*/
Long queryQuestionCount(
@Param("projectOrgCodes") List<String> projectOrgCodes,
@Param("completionStatus") Integer completionStatus
);
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.amosprojectmapper.UserEmpowerMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.StdUserEmpower;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class IPermissionServiceImpl implements IPermissionService {
@Autowired
private RedisUtils redisUtils;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
@Autowired
private StationBasicMapper stationBasicMapper;
@Override
public List<String> getCurrentUserPermissions() {
List<String> result = new ArrayList<>();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level");
if (companyLevel.equals("categroy_leve2")) {
return null;
}
if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
result = stationBasics.stream().map(StationBasic::getFanGatewayId).collect(Collectors.toList());
return result;
}
if (companyLevel.equals("station")) {
StationBasic stationBasic = stationBasicMapper.selectOne(new QueryWrapper<StationBasic>().eq("project_org_code", permissionOrgCode));
result.add(stationBasic.getFanGatewayId());
return result;
}
}
return result;
}
@Override
public List<String> getCurrentUserProjectOrgCodes() {
List<String> result = new ArrayList<>();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
return null;
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
String companyLevel = companyInfo.get("level");
if (companyLevel.equals("categroy_leve2")) {
return null;
}
if (companyLevel.equals("area")) {
List<StationBasic> stationBasics = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("project_org_code", permissionOrgCode));
result = stationBasics.stream().map(StationBasic::getProjectOrgCode).collect(Collectors.toList());
return result;
}
if (companyLevel.equals("station")) {
StationBasic stationBasic = stationBasicMapper.selectOne(new QueryWrapper<StationBasic>().eq("project_org_code", permissionOrgCode));
result.add(stationBasic.getProjectOrgCode());
return result;
}
}
return result;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.feign.McbWarningFeign;
import com.yeejoin.amos.boot.module.jxiop.api.service.IMcbWarningService;
import com.yeejoin.amos.boot.module.jxiop.api.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.mcbwarningmapper.McbWarningMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class McbWarningServiceImpl implements IMcbWarningService {
@Autowired
private McbWarningMapper mcbWarningMapper;
@Autowired
private IPermissionService permissionService;
@Autowired
private McbWarningFeign mcbWarningFeign;
/**
* 今日预警-预警总数
*
* @param processingStatus 处理状态
* @return 总数信息
*/
@Override
public Map<String, Object> queryTodayCount(Integer processingStatus) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryTodayCount(projectOrgCodes, processingStatus);
}
/**
* 近七日预警统计
*
* @return 预警统计
*/
@Override
public List<Map<String, Object>> queryWeekCount() {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryWeekCount(projectOrgCodes);
}
/**
* 预警信息列表
*
* @param page 分页
* @param processingStatus 处理状态
* @return 预警信息列表
*/
@Override
public Page<Map<String, Object>> queryWarningPage(Page<Map<String, Object>> page, Integer processingStatus, String eventLevel, String createDate, String warningSourceType) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
long start = page.getCurrent() - 1;
long offset = page.getSize() * page.getCurrent();
List<Map<String, Object>> records = mcbWarningMapper.queryWarningList(start, offset, projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
Long total = mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
page.setRecords(records);
page.setTotal(total);
return page;
}
/**
* 预警信息总数
*
* @param processingStatus 处理状态
* @return 预警信息总数
*/
@Override
public Long queryWarningCount(Integer processingStatus, String eventLevel, String createDate, String warningSourceType) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryWarningCount(projectOrgCodes, processingStatus, eventLevel, createDate, warningSourceType);
}
/**
* 问题信息列表
*
* @param page 分页
* @param completionStatus 完成状态
* @return 问题信息列表
*/
@Override
public Page<Map<String, Object>> queryQuestionPage(Page<Map<String, Object>> page, Integer completionStatus) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
long start = page.getCurrent() - 1;
long offset = page.getSize() * page.getCurrent();
List<Map<String, Object>> records = mcbWarningMapper.queryQuestionList(start, offset, projectOrgCodes, completionStatus);
Long total = mcbWarningMapper.queryQuestionCount(projectOrgCodes, completionStatus);
page.setRecords(records);
page.setTotal(total);
return page;
}
/**
* 问题信息列表
*
* @param completionStatus 完成状态
* @return 问题信息列表
*/
@Override
public Long queryQuestionCount(Integer completionStatus) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
return mcbWarningMapper.queryQuestionCount(projectOrgCodes, completionStatus);
}
/**
* 获取地图点位/路线
*
* @param province 省份
* @return 地图点位/路线
*/
@Override
public Object queryMapRoutes(String province) {
List<String> projectOrgCodes = this.getProjectOrgCodes();
// TODO: 远程调用warning服务
return null;
}
/**
* 任务详情分页列表
*/
@Override
public Page<Map<String, Object>> getTaskDetailPage(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult<Page<Map<String, Object>>> page = mcbWarningFeign.getTaskDetailPage(map);
return page.getResult();
}
@Override
public Page<Map<String, Object>> getQuestionRecordPage(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult<Page<Map<String, Object>>> page = mcbWarningFeign.getQuestionRecordPage(map);
return page.getResult();
}
/**
* 任务详情、问题记录左侧树
*
*/
@Override
public Object getWarnTree(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult result = mcbWarningFeign.getWarnTree(map);
return result.getResult();
}
/**
* 任务详情列表统计
*
*/
@Override
public Object getTaskDetailStatistic(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult result = mcbWarningFeign.getTaskDetailStatistic(map);
return result.getResult();
}
/**
* 问题记录统计
*
*/
@Override
public Object getQuestionRecordStatistic(Map<String, Object> map) {
map.put("GATEWAY_ID", String.format("[%s]", buildGateWayIdsParam()));
FeignClientResult result = mcbWarningFeign.getQuestionRecordStatistic(map);
return result.getResult();
}
/**
* 获取用户权限(此处使用projectOrgCode)
*
* @return gatewayIds
*/
private List<String> getProjectOrgCodes() {
List<String> projectOrgCodes = permissionService.getCurrentUserProjectOrgCodes();
if (Objects.isNull(projectOrgCodes)) {
projectOrgCodes = Collections.emptyList();
}
return projectOrgCodes;
}
private String buildGateWayIdsParam() {
List<String> currentUserPermissions = permissionService.getCurrentUserPermissions();
if (Objects.isNull(currentUserPermissions)) {
currentUserPermissions = new ArrayList<>();
}
String gatewayIds = String.join(",", currentUserPermissions);
if (!gatewayIds.isEmpty()) {
gatewayIds = String.format("[%s]", gatewayIds);
}
return Optional.ofNullable(gatewayIds).orElse("[]");
}
}
......@@ -9,6 +9,11 @@ spring.db2.datasource.url=jdbc:mysql://139.9.173.44:3306/amos_project?allowMulti
spring.db2.datasource.username=root
spring.db2.datasource.password=Yeejoin@2020
spring.db3.datasource.driver-class-name: com.mysql.cj.jdbc.Driver
spring.db3.datasource.url=jdbc:mysql://139.9.173.44:3306/amos_mcb?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull
spring.db3.datasource.username=root
spring.db3.datasource.password=Yeejoin@2020
## eureka properties:
eureka.instance.hostname=172.16.10.220
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
......
......@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
@Slf4j
public class CommonServiceImpl {
// @Autowired
// @Autowired
// InfluxdbUtil influxdbUtil;
@Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
......@@ -246,7 +246,7 @@ public class CommonServiceImpl {
} catch (Exception e) {
return totalvalue;
}
return Double.valueOf(String.format("%.4f", totalvalue ));
return Double.valueOf(String.format("%.4f", totalvalue));
}
// public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) {
......@@ -371,10 +371,10 @@ public class CommonServiceImpl {
coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal)));
socialContributionDtoList.add(coal);
toner.setUnit(CommonConstans.TAN_FEN_CHEN_ZHUBIANDIYACE);
toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner )));
toner.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.toner)));
socialContributionDtoList.add(toner);
so2.setUnit(CommonConstans.ER_YANG_HUA_LIU_ZHUBIANDIYACE);
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide )));
so2.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.sulfurDioxide)));
socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100);
......@@ -390,11 +390,12 @@ public class CommonServiceImpl {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del","0").isNotNull("WERKS"));
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
//.isNotNull("fan_gateway_id"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del", "0").isNotNull("WERKS"));
for (int i = 0; i < stationBasicList.size(); i++) {
StationBasic stationBasic = stationBasicList.get(i);
Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber())&& !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l->Double.valueOf(l.getCapacityl())).sum();
Double StationCapactity = sjglZsjZsbtzList.stream().filter(sjglZsjZsbtz -> sjglZsjZsbtz.getWerks().equals(stationBasic.getStationNumber()) && !StringUtils.isEmpty(sjglZsjZsbtz.getCapacityl())).collect(Collectors.toList()).stream().mapToDouble(l -> Double.valueOf(l.getCapacityl())).sum();
StationCacheInfoDto stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName());
......@@ -560,13 +561,17 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
if (!ObjectUtils.isEmpty(equipments)) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).average().getAsDouble();
}
return result;
}
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
if (equipments != null) {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).filter(esEquipments -> esEquipments.getValueF() != null).mapToDouble(ESEquipments::getValueF).sum();
}
return result;
}
......
......@@ -26,62 +26,63 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipAlarmEventMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipDivergenceAlarmEventMapper;
@Service
public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, EquipAlarmEvent, EquipAlarmEventMapper> {
public class EquipAlarmEventServiceImpl
extends BaseService<EquipAlarmEventDto, EquipAlarmEvent, EquipAlarmEventMapper> {
@Autowired
EquipAlarmEventMapper equipAlarmEventMapper;
@Autowired
StationBasicMapper stationBasicMapper;
@Autowired
EquipDivergenceAlarmEventMapper equipDivergenceAlarmEventMapper;
@Autowired
EquipAlarmEventMapper equipAlarmEventMapper;
@Autowired
StationBasicMapper stationBasicMapper;
@Autowired
EquipDivergenceAlarmEventMapper equipDivergenceAlarmEventMapper;
public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex, String frontModule) {
List<EquipAlarmEventDto> equipAlarmEvents = new ArrayList<>();
LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>();
if(equipIndex!=null)
{
queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex);
}
queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId);
if(frontModule!=null)
{
queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule);
}
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -7);
queryWrapper.gt(EquipAlarmEvent::getCreatedTime, calendar.getTime());
int count = equipAlarmEventMapper.selectCount(queryWrapper);
IPage<EquipAlarmEvent> p = new Page<>(current, size);
equipAlarmEvents= equipAlarmEventMapper.getAlarmEventList(gatewayId, equipIndex, frontModule, (p.getCurrent()-1)*p.getSize(), p.getSize(),calendar.getTime());
// equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper);
// equipAlarmEvents=page.getRecords();
equipAlarmEvents.forEach(i->{
if("true".equals(i.getValue()))
{
i.setValue("合");
}else
{
i.setValue("分");
}
});
DataGridMock DataGridMock = new DataGridMock(current, count, false, current, equipAlarmEvents);
ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName");
ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc");
ColModel colModelEventDesc = new ColModel("createdTime", "createdTime", "告警时间", "告警时间", "dataGrid", "createdTime");
ColModel colModelValueDesc = new ColModel("value", "value", "动作", "动作", "dataGrid", "value");
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
public ResultsData getEquipDivergenceEvent(String gatewayId, int current, int size) {
PageHelper.startPage(current, size);
public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex,
String frontModule) {
List<EquipAlarmEventDto> equipAlarmEvents = new ArrayList<>();
LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>();
if (equipIndex != null) {
queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex);
}
queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId);
if (frontModule != null) {
queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule);
}
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -7);
queryWrapper.gt(EquipAlarmEvent::getCreatedTime, calendar.getTime());
int count = equipAlarmEventMapper.selectCount(queryWrapper);
IPage<EquipAlarmEvent> p = new Page<>(current, size);
equipAlarmEvents = equipAlarmEventMapper.getAlarmEventList(gatewayId, equipIndex, frontModule,
(p.getCurrent() - 1) * p.getSize(), p.getSize(), calendar.getTime());
// equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper);
// equipAlarmEvents=page.getRecords();
equipAlarmEvents.forEach(i -> {
if ("true".equals(i.getValue())) {
i.setValue("合");
} else {
i.setValue("分");
}
});
DataGridMock DataGridMock = new DataGridMock(current, count, false, current, equipAlarmEvents);
ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName");
ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc");
ColModel colModelEventDesc = new ColModel("createdTime", "createdTime", "告警时间", "告警时间", "dataGrid",
"createdTime");
ColModel colModelValueDesc = new ColModel("value", "value", "动作", "动作", "dataGrid", "value");
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,
colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
public ResultsData getEquipDivergenceEvent(String gatewayId, int current, int size) {
PageHelper.startPage(current, size);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -2);
List<EquipDivergenceAlarmEvent> alarmEventList = equipDivergenceAlarmEventMapper.getEventList(gatewayId, null, null,
calendar.getTime());
List<EquipDivergenceAlarmEvent> alarmEventList = equipDivergenceAlarmEventMapper.getEventList(gatewayId, null,
null, calendar.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar car = Calendar.getInstance();
......@@ -91,12 +92,12 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
// } else if ("false".equals(i.getValue())) {
// i.setValue("分");
// }
long mills = i.getCreatedTime() ;
long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime());
if (time.contains("1970")) {
mills = i.getCreatedTime()/ 1000000;
if (time.contains("1970-")) {
mills = i.getCreatedTime();
car.setTimeInMillis(mills);
time = sdf.format(car.getTime());
}
......@@ -118,5 +119,5 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
colModelEventDesc, colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData;
}
}
}
......@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
@Override
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
String table = gateway;
Map<String, List<String>> queryCodntion = new HashMap<>();
......@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) {
String userId = reginParams.getUserModel().getUserId();
String companyLevel ="";
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
String companyLevel = "";
StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!");
}else{
} else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String,String> companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString();
Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString();
}
StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr);
List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class);
......@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
gfzTreeDto.setChildren(gfz);
List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto);
treeDto.setChildren(treeDtos);
if(companyLevel.equals("station")){
List<TreeDto> children = stationListByRegionCode.stream().filter(t->t.getCode().equals(sequenceNbr)).collect(Collectors.toList());
if(stationBasic.getStationType().equals("FDZ")){
treeDto = fdzTreeDto;
}else {
if (companyLevel.equals("station")) {
List<TreeDto> children = stationListByRegionCode.stream().filter(t -> t.getCode().equals(sequenceNbr))
.collect(Collectors.toList());
if (stationBasic.getStationType().equals("FDZ")) {
treeDto = fdzTreeDto;
} else {
treeDto = gfzTreeDto;
}
treeDto.setChildren(children);
......@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return new ArrayList<ESEquipmentsDTO>();
}
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,
Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态","30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态",
"停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态", "30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
......@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Override
public Map<String, Object> partofWaring3D(String stationId, String equipNum) {
Map<String, Object> resultMap = new HashMap<>();
if (stationId == null || equipNum == null || "null".equals(stationId) || "equipNum".equals(equipNum)) {
return resultMap;
}
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
......
......@@ -149,13 +149,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"));
} else if(stationCacheInfoDto.getStationType().contains("GFDZ")){
if(result!=null)
{
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"));
}
}else if(stationCacheInfoDto.getStationType().contains("GFDZ")){
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "WTX-801_25_WTX-801_总辐射"));
if(result!=null)
{
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "WTX-801_25_WTX-801_总辐射"));
}
}else {
speendOrirradiate="0.00";
}
......@@ -246,16 +252,22 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
if(result!=null)
{
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
if(result1!=null)
{
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))));
}
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
......@@ -265,15 +277,21 @@ public class MonitoringServiceImpl {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, null);
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv));
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
if(result!=null)
{
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
if(result1!=null)
{
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv));
}
gfzinstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
}
} catch (Exception exception) {
......@@ -533,17 +551,20 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
if(result!=null)
{
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率")));
}
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
if(esEquipmentsList!=null)
{
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
}
} else {
// Map<String, List<String>> queryCondtion = new HashMap<>();
// queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率"));
......@@ -559,14 +580,19 @@ public class MonitoringServiceImpl {
queryCondtion2.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion2.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null, ESEquipments.class);
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")));
if(esEquipmentsList!=null)
{
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P")));
}
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
if(result1!=null)
{
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")));
}
}
StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
//获取场站经纬度
......@@ -604,13 +630,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
if(result!=null)
{
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorDay));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
if(result!=null)
{
total.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
}
}
} catch (Exception e) {
......@@ -646,13 +678,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear);
if(result!=null)
{
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear);
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
if(result!=null)
{
total1 = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
}
Double finalTotal = total1;
total.updateAndGet(v -> v + finalTotal);
......@@ -678,13 +716,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
}
Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal);
......@@ -719,17 +763,23 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
if(result!=null)
{
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
if(result!=null)
{
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
});
HashMap<String, String> dayHashMap = new HashMap<>();
......@@ -781,13 +831,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth);
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator);
}
}
Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal);
......@@ -823,15 +879,28 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorMonth));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
if(result!=null)
{
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator));
if(result!=null)
{
total.set(commonServiceImpl.getSumByEquipmentIndxName(result, finalIndicator));
}
}
Double PlanGen = getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId());
if(PlanGen!=null)
{
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 /PlanGen));
}else
{
stationCacheInfoDto.setAddress("0.0");
}
stationCacheInfoDto.setAddress(String.format(CommonConstans.Twodecimalplaces, (total.get()) * 100 / getPlanGenByStationIdAndMonth(stationCacheInfoDto.getStationId())));
});
List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> {
......@@ -893,14 +962,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
if(result!=null)
{
total = commonServiceImpl.getSumByEquipmentIndxName(result, indicator.get());
}
}
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, (total * 10) / gfInstall.doubleValue()));
if (stationBasic.getAddress().equals("NaN")) {
......@@ -1011,9 +1085,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
if(result!=null)
{
powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
}
}
for (int i = 0; i < gfList.size(); i++) {
StationBasic stationBasic = gfList.get(i);
......@@ -1021,10 +1098,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
if(result!=null)
{
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
}
}
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
......@@ -1093,14 +1172,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
if(result!=null)
{
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
}
} else {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
if(result!=null)
{
stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
}
}
});
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
......@@ -1314,18 +1398,22 @@ public class MonitoringServiceImpl {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
}
stationBasicListAll.forEach(stationBasic -> {
if (stationBasic.getStationType().equals("FDZ")) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
if(esEquipmentsList!=null)
{
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
}
} else {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P") * CommonConstans.kwToMv);
if(esEquipmentsList!=null)
{
total.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "南瑞光差保护_313P") * CommonConstans.kwToMv);
}
}
});
//有功功率换算
......
......@@ -166,12 +166,12 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
i.setValue("分");
}
i.setStationName("升压站");
long mills = i.getCreatedTime() ;
long mills = i.getCreatedTime()/ 1000000 ;
car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime());
if (time.contains("1970")) {
mills = i.getCreatedTime()/ 1000000;
if (time.contains("1970-")) {
mills = i.getCreatedTime();
car.setTimeInMillis(mills);
time = sdf.format(car.getTime());
}
......
......@@ -64,12 +64,12 @@ public class EquipAlarmEventServiceImpl
} else if ("false".equals(i.getValue())) {
i.setValue("分");
}
long mills = i.getCreatedTime() ;
long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime());
if (time.contains("1970")) {
mills = i.getCreatedTime()/ 1000000;
if (time.contains("1970-")) {
mills = i.getCreatedTime();
car.setTimeInMillis(mills);
time = sdf.format(car.getTime());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment