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 { ...@@ -94,8 +94,8 @@ public class AcceptanceDto extends BaseDto {
private Long peasantHouseholdId; private Long peasantHouseholdId;
//验收单id
private Long acceptanceCheckItemId;
} }
...@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity; ...@@ -6,6 +6,8 @@ import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto; import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface AcceptanceMapper extends BaseMapper<BaseEntity> { public interface AcceptanceMapper extends BaseMapper<BaseEntity> {
/** /**
* 分页查询验收列表数据 * 分页查询验收列表数据
...@@ -14,8 +16,8 @@ public interface AcceptanceMapper extends BaseMapper<BaseEntity> { ...@@ -14,8 +16,8 @@ public interface AcceptanceMapper extends BaseMapper<BaseEntity> {
* @param acceptanceDto 查询参数 * @param acceptanceDto 查询参数
* @return 分页结果 * @return 分页结果
*/ */
IPage<AcceptanceDto> page( List<AcceptanceDto> page(
@Param("page") IPage<AcceptanceDto> page,
@Param("param") AcceptanceDto acceptanceDto @Param("param") AcceptanceDto acceptanceDto
); );
} }
...@@ -16,11 +16,14 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> { ...@@ -16,11 +16,14 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
List<PeasantHousehold> selectPeasantHouseholdList(@Param("developerId") Long developerId, List<PeasantHousehold> selectPeasantHouseholdList(@Param("developerId") Long developerId,
@Param("regionalCompaniesSeq")Long regionalCompaniesSeq, @Param("regionalCompaniesSeq")Long regionalCompaniesSeq,
@Param("peasantHouseholdNo")String peasantHouseholdNo, @Param("peasantHouseholdNo")String peasantHouseholdNo,
@Param("ownersName")String ownersName @Param("ownersName")String ownersName,
@Param("ids")String ids
); );
List<PeasantHousehold> selectPeasantHouseholdListsg(@Param("developerId") Long developerId, List<PeasantHousehold> selectPeasantHouseholdListsg(@Param("developerId") Long developerId,
@Param("regionalCompaniesSeq")Long regionalCompaniesSeq, @Param("regionalCompaniesSeq")Long regionalCompaniesSeq,
@Param("peasantHouseholdNo")String peasantHouseholdNo, @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; package com.yeejoin.amos.boot.module.hygf.api.service;
import com.baomidou.mybatisplus.core.metadata.IPage; 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.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem; import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem;
...@@ -14,7 +15,7 @@ public interface IAcceptanceService { ...@@ -14,7 +15,7 @@ public interface IAcceptanceService {
* @param acceptanceDto 查询参数 * @param acceptanceDto 查询参数
* @return 分页结果 * @return 分页结果
*/ */
IPage<AcceptanceDto> page(IPage<AcceptanceDto> page, AcceptanceDto acceptanceDto); Page<AcceptanceDto> page(Integer current, Integer size, AcceptanceDto acceptanceDto);
/** /**
* 根据sequenceNbr查询验收详情(线下验收) * 根据sequenceNbr查询验收详情(线下验收)
......
...@@ -41,10 +41,11 @@ public class NumberUtil { ...@@ -41,10 +41,11 @@ public class NumberUtil {
return num; return num;
}else{ }else{
int num = rand.nextInt(9000) + 1; 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 { ...@@ -55,13 +56,13 @@ public class NumberUtil {
code= code+ getChineseStr(address.replace("省","") code= code+ getChineseStr(address.replace("省","")
.replace("市","") .replace("市","")
.replace("区","") .replace("区","")
.replace("县","") .replace("县","")
.replace(",","")); .replace(",",""));
code= type+code+dateFormat()+getnum(); code= type+code+dateFormat()+getnum();
return code; return code;
} }
} }
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
bga.next_executor_ids nextExecutorIds, bga.next_executor_ids nextExecutorIds,
bga.next_node_key nextNodeKey, 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, hygf_work_order.region_company_id regionCompanyId,
ph.regional_companies_code AS regionalCompaniesCode, ph.regional_companies_code AS regionalCompaniesCode,
ph.regional_companies_name AS regionalCompaniesName, ph.regional_companies_name AS regionalCompaniesName,
......
...@@ -64,7 +64,7 @@ ...@@ -64,7 +64,7 @@
AND hbga.grid_status = #{map.gridStatus} AND hbga.grid_status = #{map.gridStatus}
</if> </if>
<if test="map.gridConnectionTime != null"> <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> </if>
</where> </where>
ORDER BY hogaa.grid_connection_time desc ,hogaa.rec_date desc ORDER BY hogaa.grid_connection_time desc ,hogaa.rec_date desc
......
...@@ -12,6 +12,10 @@ and hygf_peasant_household.regional_companies_seq=#{regionalCompaniesSeq} ...@@ -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 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 (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 !='已作废' 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 and hygf_document_station.station_id is not null
) )
<if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''"> <if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''">
...@@ -34,6 +38,10 @@ and hygf_document_station.station_id is not null ...@@ -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.regional_companies_seq=#{regionalCompaniesSeq}
and hygf_peasant_household.sequence_nbr not in ( and hygf_peasant_household.sequence_nbr not in (
select hygf_work_order_power_station.peasant_household_id from hygf_work_order_power_station 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 !=''"> <if test="peasantHouseholdNo!=null and peasantHouseholdNo !=''">
and hygf_peasant_household.peasant_household_no like concat(concat("%",#{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; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto; import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto; import com.yeejoin.amos.boot.module.hygf.api.dto.UserUnitInformationDto;
...@@ -32,7 +33,7 @@ public class AcceptanceController extends BaseController { ...@@ -32,7 +33,7 @@ public class AcceptanceController extends BaseController {
@PostMapping(value = "/page") @PostMapping(value = "/page")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "Get", value = "获取验收单列表", notes = "获取验收单列表") @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 = "current", required = false, defaultValue = "1") Integer current,
@RequestParam(value = "size", required = false, defaultValue = "20") Integer size, @RequestParam(value = "size", required = false, defaultValue = "20") Integer size,
@RequestBody AcceptanceDto param @RequestBody AcceptanceDto param
...@@ -43,10 +44,8 @@ public class AcceptanceController extends BaseController { ...@@ -43,10 +44,8 @@ public class AcceptanceController extends BaseController {
param.setAmosDealerId(userUnitInformationDto.getAmosDealerId()); 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") @GetMapping("/acceptance-details")
......
...@@ -289,8 +289,8 @@ public class TdHygfJpInverterWarnController extends BaseController { ...@@ -289,8 +289,8 @@ public class TdHygfJpInverterWarnController extends BaseController {
if (nameMaps.containsKey(map.getThirdStationId())){ if (nameMaps.containsKey(map.getThirdStationId())){
map.setStationName(nameMaps.get(map.getThirdStationId())); map.setStationName(nameMaps.get(map.getThirdStationId()));
} }
map.setTimeLongFormat(TimeUtil String te= map.getTimeLong()!=null?TimeUtil.longFormat(map.getTimeLong()):"";
.longFormat(map.getTimeLong())); map.setTimeLongFormat(te);
} }
result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content)); result.setTotal(tdHygfJpInverterWarnServiceImpl.selectWarnListTotal(state, level, minvalue, maxValue, snCode, stationId, startTime, endTime, content));
......
...@@ -739,7 +739,7 @@ public class UnitInfoController extends BaseController { ...@@ -739,7 +739,7 @@ public class UnitInfoController extends BaseController {
) { ) {
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId); 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<>(); List<Map<String,Object>> date=new ArrayList<>();
if(list!=null){ if(list!=null){
...@@ -763,10 +763,11 @@ public class UnitInfoController extends BaseController { ...@@ -763,10 +763,11 @@ public class UnitInfoController extends BaseController {
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam (value = "size") int size, @RequestParam (value = "size") int size,
@RequestParam (required=false) String peasantHouseholdNo, @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( ...@@ -829,11 +830,12 @@ public ResponseModel< List<Map<String,Object>> > getRegionalCompanieByuser(
@RequestParam(value = "current") int current, @RequestParam(value = "current") int current,
@RequestParam (value = "size") int size, @RequestParam (value = "size") int size,
@RequestParam (required=false) String peasantHouseholdNo, @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()); 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; ...@@ -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.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; 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.Enum.AcceptanceStatusEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.AcceptanceDto; 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.dto.StandardDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.AcceptanceCheckItem; 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.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.AcceptanceCheckItemMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.AcceptanceMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAcceptanceMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.BasicGridAcceptanceMapper;
...@@ -44,7 +48,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService { ...@@ -44,7 +48,7 @@ public class AcceptanceServiceImpl implements IAcceptanceService {
* @return 分页结果 * @return 分页结果
*/ */
@Override @Override
public IPage<AcceptanceDto> page(IPage<AcceptanceDto> page, AcceptanceDto acceptanceDto) { public Page<AcceptanceDto> page(Integer current, Integer size, AcceptanceDto acceptanceDto) {
if (Objects.nonNull(acceptanceDto)) { if (Objects.nonNull(acceptanceDto)) {
// 处理提交日期 // 处理提交日期
...@@ -57,9 +61,16 @@ public class AcceptanceServiceImpl implements IAcceptanceService { ...@@ -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 ...@@ -50,14 +50,14 @@ public class BasicGridAcceptanceServiceImpl extends BaseService<BasicGridAccepta
PageHelper.startPage(current, size); PageHelper.startPage(current, size);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Date date = null; Date date = null;
if (StringUtils.isNotEmpty(gridConnectionTime)) { // if (StringUtils.isNotEmpty(gridConnectionTime)) {
date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss"); // date = DateUtil.formatStringToDate(gridConnectionTime, "yyyy-MM-dd HH:mm:ss");
} // }
map.put("projectAddress", projectAddress); map.put("projectAddress", projectAddress);
map.put("powerStationCode", powerStationCode); map.put("powerStationCode", powerStationCode);
map.put("ownersName", ownersName); map.put("ownersName", ownersName);
map.put("gridStatus", gridStatus); map.put("gridStatus", gridStatus);
map.put("gridConnectionTime", date); map.put("gridConnectionTime", gridConnectionTime);
map.put("formType", formType); map.put("formType", formType);
map.put("regionCompanyId", regionCompanyId); map.put("regionCompanyId", regionCompanyId);
map.put("amosDealerId", amosDealerId); map.put("amosDealerId", amosDealerId);
......
...@@ -978,10 +978,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -978,10 +978,11 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
int pageNum, int pageNum,
int pageSize, int pageSize,
String peasantHouseholdNo, String peasantHouseholdNo,
String ownersName){ String ownersName,
String ids){
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
UnitInfo unitInfo=unitInfoMapper.selectById(unitInfoId); 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); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
...@@ -995,9 +996,10 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn ...@@ -995,9 +996,10 @@ public class UnitInfoServiceImpl extends BaseService<UnitInfoDto,UnitInfo,UnitIn
int pageNum, int pageNum,
int pageSize, int pageSize,
String peasantHouseholdNo, String peasantHouseholdNo,
String ownersName){ String ownersName,
String ids){
PageHelper.startPage(pageNum, pageSize); 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); PageInfo<PeasantHousehold> page = new PageInfo(list);
Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>(); Page<PeasantHousehold> pagenew = new Page<PeasantHousehold>();
pagenew.setCurrent(pageNum); pagenew.setCurrent(pageNum);
......
...@@ -17,6 +17,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; ...@@ -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.dto.FullViewRecallInfoDTO;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*; 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.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.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
...@@ -77,6 +78,8 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -77,6 +78,8 @@ public class BigScreenAnalyseController extends BaseController {
@Autowired @Autowired
RiskWarningFeign riskWarningFeign; RiskWarningFeign riskWarningFeign;
@Autowired
IPermissionService permissionService;
@Autowired @Autowired
...@@ -107,14 +110,14 @@ public class BigScreenAnalyseController extends BaseController { ...@@ -107,14 +110,14 @@ public class BigScreenAnalyseController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图") @ApiOperation(httpMethod = "GET", value = "场站设备健康状态指数与趋势 - 折线图", notes = "场站设备健康状态指数与趋势 - 折线图")
@GetMapping(value = "/getHealthListInfo") @GetMapping(value = "/getHealthListInfo")
public ResponseModel<Map<String, Object>> getHealthListInfo(@RequestParam(required = false) String areaCode, @RequestParam(required = false) String stationCode) { 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)) { if (StrUtil.isNotEmpty(stationCode)) {
StationBasic stationBasic = stationBasicMapper.selectById(stationCode); StationBasic stationBasic = stationBasicMapper.selectById(stationCode);
stationCode = stationBasic.getFanGatewayId(); stationCode = stationBasic.getFanGatewayId();
} }
HashMap<String, Object> resultMap = new HashMap<>(); 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> time = new ArrayList<>();
List<String> valueList = new ArrayList<>(); List<String> valueList = new ArrayList<>();
healthListInfo.forEach(item -> { healthListInfo.forEach(item -> {
...@@ -808,7 +811,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper; ...@@ -808,7 +811,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
public ResponseModel<Map<String, Object>> getFullViewRecall() { public ResponseModel<Map<String, Object>> getFullViewRecall() {
HashMap<String, Object> resultMapFinally = new HashMap<>(); HashMap<String, Object> resultMapFinally = new HashMap<>();
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo(); 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()))); 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; ...@@ -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()))); 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() Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
Collectors.groupingBy(FullViewRecallDataDTO::getStation, Collectors.groupingBy(FullViewRecallDataDTO::getStation,
...@@ -1151,4 +1154,16 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper; ...@@ -1151,4 +1154,16 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
return ResponseHelper.buildResponse(true); 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; ...@@ -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.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointTagMapper; 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.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.service.impl.IdxBizFanHealthIndexServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexDayMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexHourMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexHourMapper;
...@@ -27,6 +28,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndexMoment; ...@@ -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 com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -44,7 +46,7 @@ import java.util.*; ...@@ -44,7 +46,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* *
* *
* @author system_generator * @author system_generator
* @date 2023-08-15 * @date 2023-08-15
...@@ -69,6 +71,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -69,6 +71,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
FanHealthIndexMomentMapper fanHealthIndexMomentMapper; FanHealthIndexMomentMapper fanHealthIndexMomentMapper;
@Autowired @Autowired
FanWaringRecordMapper fanWarningRecord; FanWaringRecordMapper fanWarningRecord;
@Autowired
IPermissionService permissionService;
public final DecimalFormat df = new DecimalFormat("#.0"); public final DecimalFormat df = new DecimalFormat("#.0");
public final DecimalFormat dfSS = new DecimalFormat("#.00"); public final DecimalFormat dfSS = new DecimalFormat("#.00");
...@@ -238,11 +242,11 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -238,11 +242,11 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "startTime", required = false) String startTime, @RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime @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("片区,场站,设备名称,子系统,分析变量不能为空"); throw new RuntimeException("片区,场站,设备名称,子系统,分析变量不能为空");
} }
List<String> gatewayIds = this.getGatewayIds();
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( type,address,statioName,equipmentName,arae,startTime,endTime)); return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( type,address,statioName,equipmentName,arae,startTime,endTime,gatewayIds));
} }
...@@ -386,7 +390,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -386,7 +390,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); 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 -> { fanHealthIndexDays.forEach(item -> {
double roundedNumber = Double.parseDouble(df.format(item.getHealthIndex())); double roundedNumber = Double.parseDouble(df.format(item.getHealthIndex()));
...@@ -432,7 +437,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -432,7 +437,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); 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<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(Double.parseDouble(fanHealthIndexDays.get(0).getValue())))); map.put("value",Double.parseDouble(df.format(Double.parseDouble(fanHealthIndexDays.get(0).getValue()))));
...@@ -447,7 +453,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -447,7 +453,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station",required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType @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){ if (maps.size() == 4){
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name",map.get("healthlevel"));
...@@ -577,7 +584,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -577,7 +584,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // 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 -> { fanHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
...@@ -608,7 +615,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -608,7 +615,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // 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 -> { fanHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
...@@ -632,7 +639,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -632,7 +639,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // 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 -> { fanHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
...@@ -681,7 +688,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -681,7 +688,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // 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<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexDays.get(0).getHealthIndex()))); map.put("value",Double.parseDouble(df.format(fanHealthIndexDays.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
...@@ -705,7 +712,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -705,7 +712,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // 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<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex()))); map.put("value",Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
...@@ -722,7 +729,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -722,7 +729,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
// Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); // Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
// startTimeTop = formatter.format(startDate); // 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<String,Object> map = new HashMap<>();
map.put("value",Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex()))); map.put("value",Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex())));
return ResponseHelper.buildResponse(map); return ResponseHelper.buildResponse(map);
...@@ -750,7 +757,8 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -750,7 +757,8 @@ public class IdxBizFanHealthIndexController extends BaseController {
Map<String,Object> result = new HashMap<>(); Map<String,Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = 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"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){ if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
...@@ -759,8 +767,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -759,8 +767,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); startTimeTop = formatter.format(startDate);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null, gatewayIds);
List<FanHealthIndexDay> fanHealthIndexDays = fanHealthIndexDayMapper.selectData(healthLevel, area, equipmentName, subSystem, analysisType, analysisObjType, station, pointName, indexAddress, startTimeTop, endTimeTop,null,null);
fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(FanHealthIndexDay::getAnalysisTime)).collect(Collectors.toList()); fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(FanHealthIndexDay::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexDay obj : fanHealthIndexDays) { for (FanHealthIndexDay obj : fanHealthIndexDays) {
...@@ -774,7 +781,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -774,7 +781,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
result.put("seriesData",seriesData); result.put("seriesData",seriesData);
result.put("axisData",axisData); result.put("axisData",axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}else if (requiredType.equals("按小时")){ }else if ("按小时".equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){ if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
...@@ -782,7 +789,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -782,7 +789,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
} }
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); 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()); fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(FanHealthIndexHour::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexHour obj : fanHealthIndexHours) { for (FanHealthIndexHour obj : fanHealthIndexHours) {
if (type.equals("0")){ if (type.equals("0")){
...@@ -806,7 +813,7 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -806,7 +813,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); 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()); fanHealthIndexMoments= fanHealthIndexMoments.stream().sorted(Comparator.comparing(FanHealthIndexMoment::getAnalysisTime)).collect(Collectors.toList());
for (FanHealthIndexMoment obj : fanHealthIndexMoments) { for (FanHealthIndexMoment obj : fanHealthIndexMoments) {
if (type.equals("0")){ if (type.equals("0")){
...@@ -824,4 +831,17 @@ public class IdxBizFanHealthIndexController extends BaseController { ...@@ -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; ...@@ -3,6 +3,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; 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.dto.IdxBizFanPointProcessVariableClassificationDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizTableService;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointProcessVariableClassificationServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanPointProcessVariableClassificationServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -18,7 +19,7 @@ import java.util.List; ...@@ -18,7 +19,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* *
* *
* @author system_generator * @author system_generator
* @date 2023-08-15 * @date 2023-08-15
...@@ -31,6 +32,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC ...@@ -31,6 +32,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
@Autowired @Autowired
IdxBizFanPointProcessVariableClassificationServiceImpl idxBizFanPointProcessVariableClassificationServiceImpl; IdxBizFanPointProcessVariableClassificationServiceImpl idxBizFanPointProcessVariableClassificationServiceImpl;
@Autowired
private IIdxBizTableService idxBizTableService;
/** /**
* 新增 * 新增
* *
...@@ -125,7 +129,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC ...@@ -125,7 +129,9 @@ public class IdxBizFanPointProcessVariableClassificationController extends BaseC
@ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询") @ApiOperation(httpMethod = "GET",value = "列表全部数据查询", notes = "列表全部数据查询")
@GetMapping(value = "/selectParams") @GetMapping(value = "/selectParams")
public ResponseModel<List<Map<String,Object>>> selectParams(String tableName,String column,@RequestParam(required = false) String isFx) { 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; ...@@ -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.IdxBizFanWarningRuleSet;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvWarningRuleSet; 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.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.IdxBizFanWarningRecordServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizFanWarningRuleSetServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.IdxBizPvWarningRuleSetServiceImpl;
...@@ -54,6 +55,8 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -54,6 +55,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
@Autowired @Autowired
FanWaringRecordMapper fanWaringRecordMapper; FanWaringRecordMapper fanWaringRecordMapper;
@Autowired
private IPermissionService permissionService;
@Autowired @Autowired
IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper; IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper;
...@@ -357,7 +360,8 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -357,7 +360,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
Map<String, Object> resultMap = new HashMap<>(); 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)); Map<String, Map<String, Object>> equipmentNameInfoMap = maps.stream().collect(Collectors.toMap(t -> t.get("EQUIPMENT_NAME").toString(), t -> t));
List<Integer> wxList = new ArrayList<>(); List<Integer> wxList = new ArrayList<>();
...@@ -403,8 +407,8 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -403,8 +407,8 @@ public class IdxBizFanWarningRecordController extends BaseController {
@GetMapping(value = "/selectEquipWarningTotal") @GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本") @ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<Map<String, Object>> selectEquipWarningTotal(@RequestParam String STATION, @RequestParam String EQUIPMENTNAME) { 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); return ResponseHelper.buildResponse(maps);
} }
...@@ -415,11 +419,20 @@ public class IdxBizFanWarningRecordController extends BaseController { ...@@ -415,11 +419,20 @@ public class IdxBizFanWarningRecordController extends BaseController {
Page<FanWarningRecord> page = new Page<>(); Page<FanWarningRecord> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); 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); page.setRecords(maps);
int total = fanWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME); int total = fanWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME);
page.setTotal(total); page.setTotal(total);
return ResponseHelper.buildResponse(page); 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 ...@@ -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.entity.IdxBizPvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper; 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.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.service.impl.IdxBizPvHealthIndexServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.*; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*; import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*;
...@@ -33,7 +34,7 @@ import java.util.*; ...@@ -33,7 +34,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* *
* *
* @author system_generator * @author system_generator
* @date 2023-08-15 * @date 2023-08-15
...@@ -53,6 +54,8 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -53,6 +54,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
PvHealthIndexMomentMapper pvHealthIndexMomentMapper; PvHealthIndexMomentMapper pvHealthIndexMomentMapper;
@Autowired @Autowired
PvWaringRecordMapper pvWaringRecordMapper; PvWaringRecordMapper pvWaringRecordMapper;
@Autowired
IPermissionService permissionService;
@Autowired @Autowired
...@@ -261,20 +264,20 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -261,20 +264,20 @@ public class IdxBizPvHealthIndexController extends BaseController {
@RequestParam(value = "subarray",required = false) String subarray){ @RequestParam(value = "subarray",required = false) String subarray){
List<String> gatewayIds = this.getGatewayIds();
if (requiredType.equals("按天")){ if (requiredType.equals("按天")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -8); Date date = DateUtils.dateAddHours(startDayTime, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); 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 -> { fanHealthIndexDays.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); 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 page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
...@@ -293,11 +296,11 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -293,11 +296,11 @@ public class IdxBizPvHealthIndexController extends BaseController {
e.printStackTrace(); 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 -> { fanHealthIndexHours.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); 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 page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
...@@ -310,7 +313,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -310,7 +313,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
date = DateUtils.dateAddHours(date, -8); date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); 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 -> { fanHealthIndexMoments.forEach(item -> {
item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex()))); item.setHealthIndex(Double.parseDouble(df.format(item.getHealthIndex())));
}); });
...@@ -318,7 +321,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -318,7 +321,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); page.setSize(size);
page.setRecords(fanHealthIndexMoments); 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); page.setTotal(total);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
...@@ -345,14 +348,14 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -345,14 +348,14 @@ public class IdxBizPvHealthIndexController extends BaseController {
@RequestParam(value = "subarray",required = false) String subarray){ @RequestParam(value = "subarray",required = false) String subarray){
List<String> gatewayIds = this.getGatewayIds();
if (requiredType.equals("按天")){ if (requiredType.equals("按天")){
Date startDayTime = DateUtils.getCurrentDayStartTime(new Date()); Date startDayTime = DateUtils.getCurrentDayStartTime(new Date());
Date date = DateUtils.dateAddHours(startDayTime, -8); Date date = DateUtils.dateAddHours(startDayTime, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); 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<>(); Map<String,Object> map = new HashMap<>();
...@@ -374,7 +377,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -374,7 +377,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); 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<String,Object> map = new HashMap<>();
map.put("value", Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex()))); map.put("value", Double.parseDouble(df.format(fanHealthIndexHours.get(0).getHealthIndex())));
...@@ -385,7 +388,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -385,7 +388,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
date = DateUtils.dateAddHours(date, -8); date = DateUtils.dateAddHours(date, -8);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
startTimeTop = formatter.format(date); 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<String,Object> map = new HashMap<>();
map.put("value", Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex()))); map.put("value", Double.parseDouble(df.format(fanHealthIndexMoments.get(0).getHealthIndex())));
...@@ -417,7 +420,8 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -417,7 +420,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
Map<String,Object> result = new HashMap<>(); Map<String,Object> result = new HashMap<>();
List<Object> seriesData = new ArrayList<>(); List<Object> seriesData = new ArrayList<>();
List<Object> axisData = 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"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){ if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
...@@ -427,7 +431,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -427,7 +431,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); 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()); fanHealthIndexDays= fanHealthIndexDays.stream().sorted(Comparator.comparing(PvHealthIndexDay::getAnalysisTime)).collect(Collectors.toList());
for (PvHealthIndexDay obj : fanHealthIndexDays) { for (PvHealthIndexDay obj : fanHealthIndexDays) {
...@@ -441,7 +445,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -441,7 +445,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
result.put("seriesData",seriesData); result.put("seriesData",seriesData);
result.put("axisData",axisData); result.put("axisData",axisData);
return ResponseHelper.buildResponse(result); return ResponseHelper.buildResponse(result);
}else if (requiredType.equals("按小时")){ }else if ("按小时".equals(requiredType)){
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
if ( null != endTimeTop){ if ( null != endTimeTop){
Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8); Date endDate = DateUtils.dateAddHours(DateUtils.longStr2Date(endTimeTop), -8);
...@@ -449,7 +453,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -449,7 +453,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
} }
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); 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()); fanHealthIndexHours= fanHealthIndexHours.stream().sorted(Comparator.comparing(PvHealthIndexHour::getAnalysisTime)).collect(Collectors.toList());
for (PvHealthIndexHour obj : fanHealthIndexHours) { for (PvHealthIndexHour obj : fanHealthIndexHours) {
if (type.equals("0")){ if (type.equals("0")){
...@@ -476,7 +480,7 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -476,7 +480,7 @@ public class IdxBizPvHealthIndexController extends BaseController {
Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8); Date startDate = DateUtils.dateAddHours(DateUtils.longStr2Date(startTimeTop), -8);
startTimeTop = formatter.format(startDate); 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()); fanHealthIndexMoments= fanHealthIndexMoments.stream().sorted(Comparator.comparing(PvHealthIndexMoment::getAnalysisTime)).collect(Collectors.toList());
for (PvHealthIndexMoment obj : fanHealthIndexMoments) { for (PvHealthIndexMoment obj : fanHealthIndexMoments) {
if (type.equals("0")){ if (type.equals("0")){
...@@ -498,7 +502,8 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -498,7 +502,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "预警监测设备级统计 TD", notes = "预警监测设备级统计 TD") @ApiOperation(httpMethod = "GET",value = "预警监测设备级统计 TD", notes = "预警监测设备级统计 TD")
@GetMapping(value = "/selectPointNum") @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) { 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){ if (maps.size() == 4){
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name",map.get("healthlevel"));
...@@ -538,9 +543,10 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -538,9 +543,10 @@ public class IdxBizPvHealthIndexController extends BaseController {
Page<PvWarningRecord> page = new Page<>(); Page<PvWarningRecord> page = new Page<>();
page.setCurrent(current); page.setCurrent(current);
page.setSize(size); 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); page.setRecords(maps);
int total = pvWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME,SUBARRAY); int total = pvWaringRecordMapper.selectWarningPointTotal(STATION, EQUIPMENTNAME,SUBARRAY, gatewayIds);
page.setTotal(total); page.setTotal(total);
return ResponseHelper.buildResponse(page); return ResponseHelper.buildResponse(page);
} }
...@@ -550,8 +556,8 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -550,8 +556,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
@GetMapping(value = "/selectEquipWarningTotal") @GetMapping(value = "/selectEquipWarningTotal")
@ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本") @ApiOperation(httpMethod = "GET", value = "预警信息统计富文本", notes = "预警信息统计富文本")
public ResponseModel<Map<String,Object>> selectEquipWarningTotal(@RequestParam String STATION,@RequestParam String EQUIPMENTNAME,@RequestParam(required = false) String SUBARRAY) { 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); return ResponseHelper.buildResponse(map);
} }
...@@ -562,7 +568,8 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -562,7 +568,8 @@ public class IdxBizPvHealthIndexController extends BaseController {
@RequestParam(value = "station",required = false) String station, @RequestParam(value = "station",required = false) String station,
@RequestParam(value = "analysisObjType",required = false) String analysisObjType @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){ if (maps.size() == 4){
for (Map<String, Object> map : maps) { for (Map<String, Object> map : maps) {
map.put("name",map.get("healthlevel")); map.put("name",map.get("healthlevel"));
...@@ -607,10 +614,9 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -607,10 +614,9 @@ public class IdxBizPvHealthIndexController extends BaseController {
wrapper.groupBy(IdxBizPvPointProcessVariableClassification::getSubarray); wrapper.groupBy(IdxBizPvPointProcessVariableClassification::getSubarray);
wrapper.last(" ORDER BY SUBARRAY desc"); wrapper.last(" ORDER BY SUBARRAY desc");
List<IdxBizPvPointProcessVariableClassification> variableClassificationList = idxBizPvPointProcessVariableClassificationMapper.selectList(wrapper); List<IdxBizPvPointProcessVariableClassification> variableClassificationList = idxBizPvPointProcessVariableClassificationMapper.selectList(wrapper);
Map<String, Object> resultMap = new HashMap<>(); 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)); Map<String, Map<String, Object>> equipmentNameInfoMap = maps.stream().collect(Collectors.toMap(t -> t.get("subarray").toString(), t -> t));
List<Integer> wxList = new ArrayList<>(); List<Integer> wxList = new ArrayList<>();
...@@ -650,4 +656,16 @@ public class IdxBizPvHealthIndexController extends BaseController { ...@@ -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 ...@@ -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.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthLevelMapper; 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.mapper2.IdxBizPvHealthLevelMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IPermissionService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -24,10 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper; ...@@ -24,10 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.ArrayList; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.yeejoin.amos.boot.module.jxiop.biz.kafka.Constant.*; import static com.yeejoin.amos.boot.module.jxiop.biz.kafka.Constant.*;
...@@ -43,6 +41,8 @@ public class KafkaAnalyseController { ...@@ -43,6 +41,8 @@ public class KafkaAnalyseController {
@Autowired @Autowired
RedisUtils redisUtils; RedisUtils redisUtils;
@Autowired
IPermissionService permissionService;
@Autowired @Autowired
IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper; IdxBizFanHealthLevelMapper idxBizFanHealthLevelMapper;
...@@ -162,25 +162,26 @@ public class KafkaAnalyseController { ...@@ -162,25 +162,26 @@ public class KafkaAnalyseController {
@ApiOperation(value = "全景诊断回溯") @ApiOperation(value = "全景诊断回溯")
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
public ResponseModel<List<FullViewRecallInfoDTO>> getFullViewRecall(@RequestParam(required = false, value = "analysisType") String analysisType) { 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()))); 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()))); 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()))); 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()))); 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() Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list.stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
Collectors.groupingBy(FullViewRecallDataDTO::getStation, Collectors.groupingBy(FullViewRecallDataDTO::getStation,
...@@ -384,4 +385,12 @@ public class KafkaAnalyseController { ...@@ -384,4 +385,12 @@ public class KafkaAnalyseController {
return resultDto; 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; ...@@ -6,17 +6,10 @@ import java.sql.Timestamp;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.*;
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.stream.Collectors; 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 com.yeejoin.amos.boot.module.jxiop.biz.tdengine.*;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -114,6 +107,8 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -114,6 +107,8 @@ public class TDBigScreenAnalyseController extends BaseController {
PvWaringRecordMapper pvWaringRecordMapper; PvWaringRecordMapper pvWaringRecordMapper;
@Autowired @Autowired
FanHealthIndexDayMapper fanHealthIndexDayMapper; FanHealthIndexDayMapper fanHealthIndexDayMapper;
@Autowired
IPermissionService permissionService;
@Autowired @Autowired
private IdxBizFanWarningRuleSetServiceImpl idxBizFanWarningRuleSetService; private IdxBizFanWarningRuleSetServiceImpl idxBizFanWarningRuleSetService;
...@@ -921,7 +916,7 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -921,7 +916,7 @@ public class TDBigScreenAnalyseController extends BaseController {
@GetMapping("/getFullViewRecall") @GetMapping("/getFullViewRecall")
public ResponseModel<Map<String, Object>> getFullViewRecall() { public ResponseModel<Map<String, Object>> getFullViewRecall() {
HashMap<String, Object> resultMapFinally = new HashMap<>(); HashMap<String, Object> resultMapFinally = new HashMap<>();
List<String> gatewayIds = this.getGatewayIds();
List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo(); List<Map<String, Object>> stationIndexInfo = idxBizFanHealthIndexMapper.getStationIndexInfo();
Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors Map<String, Double> stationHealthIndexMap = stationIndexInfo.stream().collect(Collectors
.toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString()))); .toMap(t -> t.get("station").toString(), t -> Double.parseDouble(t.get("healthIndex").toString())));
...@@ -939,9 +934,9 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -939,9 +934,9 @@ public class TDBigScreenAnalyseController extends BaseController {
.collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(), .collect(Collectors.toMap(t -> t.get("gatewayIndexAddress").toString(),
t -> Double.parseDouble(t.get("healthIndex").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 Map<String, Map<String, Map<String, Map<String, Map<String, List<FullViewRecallDataDTO>>>>>> resultMap = list
.stream() .stream()
.collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea, .collect(Collectors.groupingBy(FullViewRecallDataDTO::getArea,
...@@ -1588,4 +1583,12 @@ public class TDBigScreenAnalyseController extends BaseController { ...@@ -1588,4 +1583,12 @@ public class TDBigScreenAnalyseController extends BaseController {
return ResponseHelper.buildResponse(null); 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; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; 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.FanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.FullViewRecallDataDTO; 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.dto.FullViewRecallInfoDTO;
...@@ -71,6 +72,7 @@ public class TdInfoQueryController { ...@@ -71,6 +72,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanHealthIndexInfo") @PostMapping(value = "/getFanHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto) throws ParseException { public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();
...@@ -138,6 +140,7 @@ public class TdInfoQueryController { ...@@ -138,6 +140,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvHealthIndexInfo") @PostMapping(value = "/getPvHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
@GatewayIdAutowired
public ResponseModel<Page<PvHealthIndex>> getPvHealthIndexInfo(@RequestBody PvHealthIndexDto dto) throws ParseException { public ResponseModel<Page<PvHealthIndex>> getPvHealthIndexInfo(@RequestBody PvHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();
...@@ -188,6 +191,7 @@ public class TdInfoQueryController { ...@@ -188,6 +191,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanWarningRecordInfo") @PostMapping(value = "/getFanWarningRecordInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanWarningRecord>> getFanWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException { public ResponseModel<Page<FanWarningRecord>> getFanWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate(); String startDate = dto.getStartDate();
...@@ -237,6 +241,7 @@ public class TdInfoQueryController { ...@@ -237,6 +241,7 @@ public class TdInfoQueryController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getPvWarningRecordInfo") @PostMapping(value = "/getPvWarningRecordInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏") @ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 光伏", notes = "分页查询健康指数信息 - 光伏")
@GatewayIdAutowired
public ResponseModel<Page<PvWarningRecord>> getPvWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException { public ResponseModel<Page<PvWarningRecord>> getPvWarningRecordInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) { if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = 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; ...@@ -2,6 +2,7 @@ package com.yeejoin.amos.boot.module.jxiop.biz.dto;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data; import lombok.Data;
import org.apache.poi.ss.formula.functions.T;
import java.io.Serializable; import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -43,4 +44,5 @@ public class FanHealthIndexDto implements Serializable { ...@@ -43,4 +44,5 @@ public class FanHealthIndexDto implements Serializable {
private String subarray; private String subarray;
private String sortOne; private String sortOne;
private String sortsString; private String sortsString;
private List<String> gatewayIds;
} }
...@@ -45,5 +45,5 @@ public class PvHealthIndexDto { ...@@ -45,5 +45,5 @@ public class PvHealthIndexDto {
private String orderColumns; private String orderColumns;
private String sortOne; private String sortOne;
private String sortsString; private String sortsString;
private List<String> gatewayIds;
} }
...@@ -34,13 +34,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -34,13 +34,13 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, String>> getDateInfoBy15(); List<Map<String, String>> getDateInfoBy15();
List<Map<String, String>> getDateInfo(Date startTime, Date endTime); List<Map<String, String>> getDateInfo(Date startTime, Date endTime);
List<Map<String, String>> getHourInfo(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, String>> getMomentInfo(Date startTime, Date endTime);
List<Map<String, Object>> getHealthListInfo(@Param("areaCode") String areaCode, 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); List<Map<String, Object>> getAllEquipAlarmInfo(@Param("tableName") String tableName);
...@@ -100,7 +100,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -100,7 +100,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName, String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName,
@Param("gatewayId") String gatewayId); @Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall(); List<FullViewRecallDataDTO> getFullViewRecall(@Param("gatewayIds") List<String> gatewayIds);
List<Map<String, Object>> getStationIndexInfo(); List<Map<String, Object>> getStationIndexInfo();
...@@ -110,15 +110,15 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -110,15 +110,15 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> getPointNameIndexInfo(); 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(); 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; ...@@ -5,4 +5,5 @@ import java.util.List;
public interface IPermissionService { public interface IPermissionService {
List<String> getCurrentUserPermissions(); List<String> getCurrentUserPermissions();
List<String> getCurrentUserProjectOrgCodes();
} }
...@@ -1666,9 +1666,9 @@ public class CommonServiceImpl { ...@@ -1666,9 +1666,9 @@ public class CommonServiceImpl {
Table healthData = Table.create("healthData"); 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)); 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("------------------------------------------调用地址:"+baseUrlZSFX);
logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap)); //logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body(); String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
JSONObject jsonObject = JSON.parseObject(response); JSONObject jsonObject = JSON.parseObject(response);
...@@ -1752,7 +1752,7 @@ public class CommonServiceImpl { ...@@ -1752,7 +1752,7 @@ public class CommonServiceImpl {
try { try {
logger.info("--------------------response: " + response); logger.info("--------------------response: " + response);
logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------"); logger.info("------------------------------------------调用风机健康指数计算算法结束----------------------------------------");
logger.info("------------------------------------------开始计算预警----------------------------------------"); logger.info("------------------------------------------开始计算预警----------------------------------------");
// healthStatusIndicatorService.healthWarningMinute(calendar, time); // healthStatusIndicatorService.healthWarningMinute(calendar, time);
...@@ -1949,9 +1949,9 @@ public class CommonServiceImpl { ...@@ -1949,9 +1949,9 @@ public class CommonServiceImpl {
Table healthData = Table.create("healthData"); 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)); 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("------------------------------------------调用地址:"+baseUrlZSFX);
logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap)); //logger.info("------------------------------------------调用参数:"+JSON.toJSONString(requestMap));
String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body(); String response = HttpUtil.createPost(baseUrlZSFX).body(JSON.toJSONString(requestMap)).execute().body();
JSONObject jsonObject = JSON.parseObject(response); JSONObject jsonObject = JSON.parseObject(response);
if (jsonObject.containsKey("indexValue")) { if (jsonObject.containsKey("indexValue")) {
...@@ -2029,7 +2029,7 @@ public class CommonServiceImpl { ...@@ -2029,7 +2029,7 @@ public class CommonServiceImpl {
} }
try { try {
logger.info("--------------------response: " + response); logger.info("--------------------response: " + response);
logger.info("------------------------------------------调用健康指数计算算法结束----------------------------------------"); logger.info("------------------------------------------调用光伏健康指数计算算法结束----------------------------------------");
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
......
...@@ -35,13 +35,6 @@ public class IPermissionServiceImpl implements IPermissionService { ...@@ -35,13 +35,6 @@ public class IPermissionServiceImpl implements IPermissionService {
@Autowired @Autowired
private StationBasicMapper stationBasicMapper; private StationBasicMapper stationBasicMapper;
// @Autowired
// public IPermissionServiceImpl(RedisUtils redisUtils, UserEmpowerMapper userEmpowerMapper, StationBasicMapper stationBasicMapper) {
// this.redisUtils = redisUtils;
// this.userEmpowerMapper = userEmpowerMapper;
// this.stationBasicMapper = stationBasicMapper;
// }
@Override @Override
public List<String> getCurrentUserPermissions() { public List<String> getCurrentUserPermissions() {
List<String> result = new ArrayList<>(); List<String> result = new ArrayList<>();
...@@ -70,4 +63,33 @@ public class IPermissionServiceImpl implements IPermissionService { ...@@ -70,4 +63,33 @@ public class IPermissionServiceImpl implements IPermissionService {
} }
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").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 ...@@ -73,7 +73,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
public final DecimalFormat dfSS = new DecimalFormat("0.00"); 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<>(); Map<String, Object> map = new HashMap<>();
try { try {
//获取场站网关 //获取场站网关
...@@ -118,7 +118,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth ...@@ -118,7 +118,7 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
endTime= sdf.format(currentDayEndTime); endTime= sdf.format(currentDayEndTime);
} }
List<IndicatorData> indicatorDataListActivePowers = new ArrayList<>(); 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> axisData = new ArrayList<>();
List<String> activePowers = new ArrayList<>(); List<String> activePowers = new ArrayList<>();
for (int i = 0; i < indicatorDataListActivePowers.size(); i++) { 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> { ...@@ -21,11 +21,14 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> {
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " + "<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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 "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</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, 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>"+ @Select("<script>"+
...@@ -47,9 +50,10 @@ public interface FanHealthIndexDayMapper extends BaseMapper<FanHealthIndexDay> { ...@@ -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" + "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='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </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"+ " GROUP BY station,health_level order by sort"+
"</script>") "</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(); List<Map<String, Object>> getHealthInfoByArea();
......
...@@ -20,9 +20,10 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour> ...@@ -20,9 +20,10 @@ public interface FanHealthIndexHourMapper extends BaseMapper<FanHealthIndexHour>
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " + "<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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 "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</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 ...@@ -20,9 +20,10 @@ public interface FanHealthIndexMomentMapper extends BaseMapper<FanHealthIndexMom
"<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null'>AND health_level = #{healthLevel} </if>" +
"<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " + "<if test='subSystem!= null'>AND sub_system = #{subSystem} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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 "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</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; ...@@ -14,15 +14,15 @@ import java.util.Map;
public interface FanWaringRecordMapper extends BaseMapper<FanWarningRecord> { 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> 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 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); int saveBatchWarningRecords(@Param("list") List<FanWarningRecord> list);
......
...@@ -22,6 +22,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -22,6 +22,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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 "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</script>")
...@@ -36,7 +37,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -36,7 +37,7 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
@Param("startTimeTop") String startTimeTop, @Param("startTimeTop") String startTimeTop,
@Param("endTimeTop")String endTimeTop, @Param("endTimeTop")String endTimeTop,
@Param("equipmentName")String equipmentName @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>"+ @Select("<script>"+
...@@ -51,16 +52,18 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -51,16 +52,18 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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>") "</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("<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" + "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='area!= null'> AND area = #{area} </if> " +
"<if test='station!= null'>AND station = #{station} </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"+ " GROUP BY station,health_level order by sort"+
"</script>") "</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>"+ @Select("<script>"+
...@@ -68,8 +71,9 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> { ...@@ -68,8 +71,9 @@ public interface PvHealthIndexDayMapper extends BaseMapper<PvHealthIndexDay> {
"<if test='station!= null'>AND station = #{station} </if>" + "<if test='station!= null'>AND station = #{station} </if>" +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" + "<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </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"+ " GROUP BY station,health_level,equipment_name order by sort"+
"</script>") "</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> { ...@@ -21,11 +21,12 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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 "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</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 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("<script>"+
"SELECT count(1)" + "SELECT count(1)" +
" FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" + " FROM analysis_data.pv_health_index_hour WHERE analysis_obj_type = #{analysisObjType}" +
...@@ -38,7 +39,8 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> { ...@@ -38,7 +39,8 @@ public interface PvHealthIndexHourMapper extends BaseMapper<PvHealthIndexHour> {
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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>") "</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 ...@@ -21,11 +21,12 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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 "+ "order by health_index "+
"<if test='current != null and size != null'>limit ${current},${size} </if>" + "<if test='current != null and size != null'>limit ${current},${size} </if>" +
"</script>") "</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 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("<script>"+
"SELECT count(1)" + "SELECT count(1)" +
...@@ -39,7 +40,8 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen ...@@ -39,7 +40,8 @@ public interface PvHealthIndexMomentMapper extends BaseMapper<PvHealthIndexMomen
"<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" + "<if test='healthLevel!= null '>AND health_level = #{healthLevel} </if>" +
"<if test='subarray!= null'>AND subarray = #{subarray} </if> " + "<if test='subarray!= null'>AND subarray = #{subarray} </if> " +
"<if test='equipmentName!= null'>AND equipment_name = #{equipmentName} </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>") "</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> { ...@@ -15,12 +15,12 @@ public interface PvWaringRecordMapper extends BaseMapper<PvWarningRecord> {
public List<PvWarningRecord> warningData(String STATION,String EQUIPMENTNAME,String SUBARRAY); 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); 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); 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); List<PvWarningRecord> getInfoByPage(@Param("dto") FanHealthIndexDto dto);
......
...@@ -48,8 +48,8 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> { ...@@ -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); 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} ") // @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); 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}") @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); List<IndicatorData> selectDataByGatewayIdAndAddress(@Param("gatewayId") String gatewayId);
......
...@@ -90,7 +90,7 @@ spring.db3.datasource.password=taosdata ...@@ -90,7 +90,7 @@ spring.db3.datasource.password=taosdata
spring.db3.datasource.driver-class-name: com.taosdata.jdbc.rs.RestfulDriver 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.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.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 spring.db4.datasource.username=root
...@@ -181,19 +181,19 @@ spring.kafka.consumer.key-deserializer=org.apache.kafka.common.serialization.Str ...@@ -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.consumer.value-deserializer=org.apache.kafka.common.serialization.StringDeserializer
spring.kafka.listener.ack-mode=manual_immediate spring.kafka.listener.ack-mode=manual_immediate
spring.kafka.listener.type=batch spring.kafka.listener.type=batch
#一次拉取数量 && 线程数量 ����ȡ���� && �߳�����
spring.kafka.consumer.max-poll-records=30 spring.kafka.consumer.max-poll-records=30
#spring.kafka.consumer.fetch-max-wait= 10000 #spring.kafka.consumer.fetch-max-wait= 10000
#当前时间向前偏移月数 向历史偏移月数 #��ǰʱ����ǰƫ������ ����ʷƫ������
last.month.num = 12 last.month.num = 12
#相关性 算法调用 #����� �㷨����
base.url.XGX=http://139.9.171.247:8052/intelligent-analysis/correlation 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.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.ZXZ=http://139.9.171.247:8052/intelligent-analysis/central-value
#指数分析,算法调用 ���������㷨����
base.url.zsfx:http://139.9.171.247:8052/intelligent-analysis/index-analysis base.url.zsfx:http://139.9.171.247:8052/intelligent-analysis/index-analysis
\ No newline at end of file
...@@ -166,6 +166,12 @@ ...@@ -166,6 +166,12 @@
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </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> </where>
UNION ALL UNION ALL
( (
...@@ -187,6 +193,12 @@ ...@@ -187,6 +193,12 @@
<if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')"> <if test="(stationCode == null or stationCode == '') and (areaCode == null or areaCode == '')">
AND ANALYSIS_OBJ_TYPE = '片区' AND ANALYSIS_OBJ_TYPE = '片区'
</if> </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> </where>
) )
) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date ) b ON DATE_FORMAT( b.recDate, "%Y-%m-%d" ) = a.date
...@@ -730,6 +742,11 @@ ...@@ -730,6 +742,11 @@
AND SUB_SYSTEM is not null AND SUB_SYSTEM is not null
AND POINT_NAME is not null AND POINT_NAME is not null
AND INDEX_ADDRESS 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 UNION ALL
(SELECT ARAE AS area, (SELECT ARAE AS area,
...@@ -747,6 +764,11 @@ ...@@ -747,6 +764,11 @@
AND EQUIPMENT_NAME is not null AND EQUIPMENT_NAME is not null
AND POINT_NAME is not null AND POINT_NAME is not null
AND INDEX_ADDRESS 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 ) a
ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc ORDER BY a.station ASC, a.equipmentName ASC, a.equipmentName asc, a.subSystem asc
...@@ -857,16 +879,26 @@ ...@@ -857,16 +879,26 @@
GROUP_LOWER_LIMIT AS groupLowerLimit, GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_fan_health_level FROM idx_biz_fan_health_level
WHERE STATUS IS NOT NULL WHERE (STATUS IS NOT NULL
OR STATUS != '' 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 UNION ALL
SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType, SELECT CONCAT(`STATUS`, '_', ANALYSIS_OBJ_TYPE) AS analysisObjType,
HEALTH_LEVEL AS healthLevel, HEALTH_LEVEL AS healthLevel,
GROUP_LOWER_LIMIT AS groupLowerLimit, GROUP_LOWER_LIMIT AS groupLowerLimit,
GROUP_UPPER_LIMIT AS groupUpperLimit GROUP_UPPER_LIMIT AS groupUpperLimit
FROM idx_biz_pv_health_level FROM idx_biz_pv_health_level
WHERE STATUS IS NOT NULL WHERE (STATUS IS NOT NULL
OR STATUS != '' 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>
<select id="getAddressInfo" resultType="java.lang.String"> <select id="getAddressInfo" resultType="java.lang.String">
select index_address select index_address
...@@ -1321,6 +1353,11 @@ ...@@ -1321,6 +1353,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY STATION GROUP BY STATION
UNION ALL UNION ALL
...@@ -1342,6 +1379,11 @@ ...@@ -1342,6 +1379,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY STATION GROUP BY STATION
) )
...@@ -1369,6 +1411,11 @@ ...@@ -1369,6 +1411,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY EQUIPMENT_NAME GROUP BY EQUIPMENT_NAME
UNION ALL UNION ALL
...@@ -1390,6 +1437,11 @@ ...@@ -1390,6 +1437,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY SUBARRAY GROUP BY SUBARRAY
) )
...@@ -1420,6 +1472,11 @@ ...@@ -1420,6 +1472,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY SUB_SYSTEM GROUP BY SUB_SYSTEM
UNION ALL UNION ALL
...@@ -1441,6 +1498,11 @@ ...@@ -1441,6 +1498,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY EQUIPMENT_NAME GROUP BY EQUIPMENT_NAME
) )
...@@ -1469,6 +1531,11 @@ ...@@ -1469,6 +1531,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
UNION ALL UNION ALL
...@@ -1490,6 +1557,11 @@ ...@@ -1490,6 +1557,11 @@
AND ANALYSIS_TYPE = '按时刻' AND ANALYSIS_TYPE = '按时刻'
AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE ) AND REC_DATE >= DATE_SUB( NOW(), INTERVAL 9 MINUTE )
</if> </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> </where>
GROUP BY INDEX_ADDRESS GROUP BY INDEX_ADDRESS
) )
...@@ -1616,20 +1688,20 @@ ...@@ -1616,20 +1688,20 @@
<select id="getHourInfo" resultType="java.util.Map"> <select id="getHourInfo" resultType="java.util.Map">
SELECT SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL @s-1 HOUR ), '%Y-%m-%d %H:%i:%s' ) AS date, 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 FROM
mysql.help_topic, mysql.help_topic,
( SELECT @s := 1 ) temp ( SELECT @s := 1 ) temp
WHERE WHERE
TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1 TIMESTAMPDIFF( HOUR, #{startTime} , #{endTime}) >= @s-1
</select> </select>
<select id="getMomentInfo" resultType="java.util.Map"> <select id="getMomentInfo" resultType="java.util.Map">
SELECT SELECT
DATE_FORMAT( DATE_ADD(( DATE(#{startTime})), INTERVAL (@s-1)*10 MINUTE ), '%Y-%m-%d %H:%i:%s' ) AS date, 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 FROM
mysql.help_topic, mysql.help_topic,
( SELECT @s := 1 ) temp ( SELECT @s := 1 ) temp
WHERE WHERE
TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1 TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
</select> </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 @@ ...@@ -2,4 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!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"> <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> </mapper>
...@@ -81,6 +81,11 @@ ...@@ -81,6 +81,11 @@
<if test="station != null"> <if test="station != null">
and station = #{station} and station = #{station}
</if> </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`, group by `station`,
`equipment_name`, `equipment_name`,
`warning_name`) a `warning_name`) a
...@@ -129,6 +134,11 @@ ...@@ -129,6 +134,11 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND a.equipment_name = #{EQUIPMENTNAME} AND a.equipment_name = #{EQUIPMENTNAME}
</if> </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 group by
station, station,
equipment_name, equipment_name,
...@@ -198,6 +208,11 @@ ...@@ -198,6 +208,11 @@
<if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null"> <if test="EQUIPMENTNAME != '' and EQUIPMENTNAME != null">
AND z.equipment_name = #{EQUIPMENTNAME} AND z.equipment_name = #{EQUIPMENTNAME}
</if> </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 group by
`z`.`station`, `z`.`station`,
`z`.`warning_name`, `z`.`warning_name`,
...@@ -220,6 +235,11 @@ ...@@ -220,6 +235,11 @@
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if> <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.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.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> </where>
<if test="dto.orderColumns != null and dto.orderColumns != ''"> <if test="dto.orderColumns != null and dto.orderColumns != ''">
order by ${dto.orderColumns} order by ${dto.orderColumns}
...@@ -242,6 +262,11 @@ ...@@ -242,6 +262,11 @@
<if test="dto.disposotionState!= null and dto.disposotionState!= ''">AND disposotion_state = #{dto.disposotionState} </if> <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.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.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> </where>
</select> </select>
......
...@@ -105,6 +105,11 @@ ...@@ -105,6 +105,11 @@
<if test="station != null"> <if test="station != null">
and station = #{station} and station = #{station}
</if> </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 group by
re.station, re.station,
re.subarray, re.subarray,
...@@ -140,6 +145,11 @@ ...@@ -140,6 +145,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null"> <if test="SUBARRAY != '' and SUBARRAY != null">
AND a.subarray = #{SUBARRAY} AND a.subarray = #{SUBARRAY}
</if> </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 group by
station, station,
equipment_name, equipment_name,
...@@ -173,6 +183,11 @@ ...@@ -173,6 +183,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null"> <if test="SUBARRAY != '' and SUBARRAY != null">
AND a.subarray = #{SUBARRAY} AND a.subarray = #{SUBARRAY}
</if> </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 group by
station, station,
equipment_name, equipment_name,
...@@ -216,6 +231,11 @@ ...@@ -216,6 +231,11 @@
<if test="SUBARRAY != '' and SUBARRAY != null"> <if test="SUBARRAY != '' and SUBARRAY != null">
AND z.subarray = #{SUBARRAY} AND z.subarray = #{SUBARRAY}
</if> </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 group by
`z`.`station`, `z`.`station`,
`z`.`warning_name`, `z`.`warning_name`,
......
package com.yeejoin.amos.boot.module.jxiop.api.feign; 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 com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -17,4 +18,10 @@ public interface IdxFeign { ...@@ -17,4 +18,10 @@ public interface IdxFeign {
FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode, FeignClientResult<Map<String, Object>> healthIndexData(@RequestParam(required = false, value = "parentCode") String parentCode,
@RequestParam(required = false, value = "stationType") String stationType); @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; 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.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult; import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
...@@ -39,4 +40,35 @@ public interface McbWarningFeign { ...@@ -39,4 +40,35 @@ public interface McbWarningFeign {
@PostMapping("/task/updateRawDataByTraceId") @PostMapping("/task/updateRawDataByTraceId")
FeignClientResult<Boolean> updateRawDataByTraceId(@RequestParam(value = "traceId") String traceId, @RequestParam(value = "rawData") String rawData); 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 { ...@@ -97,7 +97,9 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; 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; return result;
} }
...@@ -128,7 +130,9 @@ public class CommonServiceImpl { ...@@ -128,7 +130,9 @@ public class CommonServiceImpl {
// } // }
public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) { public Double getTotalByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double totalvalue = 0.0; 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)); return Double.valueOf(String.format("%.2f", totalvalue));
} }
...@@ -139,7 +143,9 @@ public class CommonServiceImpl { ...@@ -139,7 +143,9 @@ public class CommonServiceImpl {
*/ */
public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) { public Double getAvgvalueByIndicatior(List<Map<String, Object>> mapList, String indicator) {
Double avageValue = 0.0; 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)); return Double.valueOf(String.format("%.2f", avageValue));
} }
...@@ -232,7 +238,11 @@ public class CommonServiceImpl { ...@@ -232,7 +238,11 @@ public class CommonServiceImpl {
stationCacheInfoDto.setStationType(stationBasic.getStationType()); 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.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.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.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.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()); stationCacheInfoDto.setBoosterGatewayId(stationBasic.getBoosterGatewayId());
...@@ -371,7 +381,10 @@ public class CommonServiceImpl { ...@@ -371,7 +381,10 @@ public class CommonServiceImpl {
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; 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; return result;
} }
......
...@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -1936,17 +1936,20 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Double powerOfDay = 0.0000; Double powerOfDay = 0.0000;
Double powerOfMonth = 0.0000; Double powerOfMonth = 0.0000;
Double powerOfAnnual = 0.0000; Double powerOfAnnual = 0.0000;
if(ObjectUtils.isEmpty(query)){ if(result!=null)
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")); {
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")); if(ObjectUtils.isEmpty(query)){
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")); powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
}else { powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfDay = powerOfDay + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
powerOfMonth = powerOfMonth + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); }else {
powerOfAnnual = powerOfAnnual + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)); 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<>(); Map<String, Object> hashMap = new HashMap<>();
hashMap.put("日发电量",powerOfDay); hashMap.put("日发电量",powerOfDay);
hashMap.put("月发电量",powerOfMonth); hashMap.put("月发电量",powerOfMonth);
......
...@@ -30,114 +30,112 @@ import java.util.*; ...@@ -30,114 +30,112 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Service @Service
public class MonitoringServiceImpl { public class MonitoringServiceImpl {
Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class); Logger logger = LoggerFactory.getLogger(MonitoringServiceImpl.class);
@Value("${plannedPowerGenerationTotal:10000}") @Value("${plannedPowerGenerationTotal:10000}")
Long plannedPowerGenerationTotal; Long plannedPowerGenerationTotal;
/** /**
* 区域mapper * 区域mapper
*/ */
@Autowired @Autowired
RegionMapper regionMapper; RegionMapper regionMapper;
@Autowired @Autowired
StationPlanMapper stationPlanMapper; StationPlanMapper stationPlanMapper;
@Autowired @Autowired
IndicatorDataMapper indicatorDataMapper; IndicatorDataMapper indicatorDataMapper;
/** /**
* 场站mapper * 场站mapper
*/ */
@Autowired @Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
/** /**
* 场站坐标mapper * 场站坐标mapper
*/ */
@Autowired @Autowired
StationCoordinateMapper stationCoordinateMapper; StationCoordinateMapper stationCoordinateMapper;
/*** /***
* 设备基础信息中间表数据-热工院 * 设备基础信息中间表数据-热工院
*/ */
@Autowired @Autowired
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl; SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
@Autowired CommonServiceImpl commonServiceImpl;
CommonServiceImpl commonServiceImpl;
// 维护的接口信息
//维护的接口信息 @Autowired
@Autowired MapRegionMapper mapRegionMapper;
MapRegionMapper mapRegionMapper;
@Autowired
@Autowired EmqKeeper emqKeeper;
EmqKeeper emqKeeper;
// @Autowired // @Autowired
// InfluxdbUtil influxdbUtil; // InfluxdbUtil influxdbUtil;
/**
/** * 根据场站编号获取该场站的装机容量
* 根据场站编号获取该场站的装机容量 *
* * @param werks
* @param werks * @return
* @return */
*/ public Double getStationCaPACITYL(String werks) {
public Double getStationCaPACITYL(String werks) { Double installCapacity = 0.0;
Double installCapacity = 0.0; installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks);
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(werks); return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity;
return ObjectUtils.isEmpty(installCapacity) ? 0.00 : installCapacity; }
}
/***
* 获取风站场站
/*** *
* 获取风站场站 */
* public Map<String, String> getStationfs(StationBasic stationBasic) {
* */ String value = "0";
public Map<String, String> getStationfs(StationBasic stationBasic) { Map<String, String> map = new HashMap<>();
String value = "0"; Map<String, List<String>> queryCondtion = new HashMap<>();
Map<String, String> map = new HashMap<>(); if (stationBasic.getStationType().equals("FDZ")) {
Map<String, List<String>> queryCondtion = new HashMap<>(); String gatewayId = stationBasic.getFanGatewayId();
if (stationBasic.getStationType().equals("FDZ")) { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
String gatewayId = stationBasic.getFanGatewayId(); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速")); List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId)); ESEquipments.class);
List<ESEquipments> result2 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速"));
value = String.format("%.2f", commonServiceImpl.getAvagerByEquipmentIndxName(result2, "30秒平均风速")); map.put("name", "风速/辐照度");
map.put("name", "风速/辐照度"); map.put("value", value + "m/s");
map.put("value", value + "m/s"); } else {
} else { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射")); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); ESEquipments.class);
value = String.format("%.2f", commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射")); value = String.format("%.2f",
map.put("name", "风速/辐照度"); commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"));
map.put("value", value + "W/㎡"); map.put("name", "风速/辐照度");
} map.put("value", value + "W/㎡");
}
return map; return map;
} }
/*** /***
* 电站容量 * 电站容量
* */ */
public Map<String, String> getStationrl(StationBasic stationBasic) { public Map<String, String> getStationrl(StationBasic stationBasic) {
Double installCapacity = 0.0; Double installCapacity = 0.0;
installCapacity = this.SjglZsjZsbtzServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber()); installCapacity = this.SjglZsjZsbtzServiceImpl
String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity); .getStationCapactityByStationWerks(stationBasic.getStationNumber());
Map<String, String> map = new HashMap<>(); String value = ObjectUtils.isEmpty(installCapacity) ? "0.00" : String.format("%.2f", installCapacity);
map.put("name", "容量"); Map<String, String> map = new HashMap<>();
map.put("value", value + "MW"); map.put("name", "容量");
return map; map.put("value", value + "MW");
} return map;
}
/** /**
* 根据省份名称查询电站详情 * 根据省份名称查询电站详情
* *
* @param provinceName * @param provinceName
* @return * @return
*/ */
// public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) { // public List<RegionNationWideDto> getNationWideInfo(String provinceName, String type) {
// List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>(); // List<RegionNationWideDto> regionNationWideDtoList = new ArrayList<>();
// List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id")); // List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
...@@ -226,7 +224,6 @@ public class MonitoringServiceImpl { ...@@ -226,7 +224,6 @@ public class MonitoringServiceImpl {
// return regionNationWideDtoList; // return regionNationWideDtoList;
// } // }
// public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) { // public ResultsData getCompletionOfPowerIndicatorsByProvinceName(int current, int size, String provinceName) {
// //
// List<ColModel> colModels = new ArrayList<>(); // List<ColModel> colModels = new ArrayList<>();
...@@ -368,82 +365,95 @@ public class MonitoringServiceImpl { ...@@ -368,82 +365,95 @@ public class MonitoringServiceImpl {
// logger.error("-----------------发送区域实时生产数据消息=================== 失败!"); // logger.error("-----------------发送区域实时生产数据消息=================== 失败!");
// } // }
// } // }
public List<TabDto> getTabsByStationBasicId(String stationBasicId) { public List<TabDto> getTabsByStationBasicId(String stationBasicId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId); StationBasic stationBasic = stationBasicMapper.selectById(stationBasicId);
List<TabDto> tabDtoList = new ArrayList<>(); List<TabDto> tabDtoList = new ArrayList<>();
if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) { if (stationBasic.getStationType().contains("FDZ") && stationBasic.getStationType().length() < 4) {
TabDto tab0 = new TabDto("风机布置图", "0"); TabDto tab0 = new TabDto("风机布置图", "0");
TabDto tab1 = new TabDto("集电线路图", "1"); TabDto tab1 = new TabDto("集电线路图", "1");
TabDto tab2 = new TabDto("运行列表", "2"); TabDto tab2 = new TabDto("运行列表", "2");
TabDto tab3 = new TabDto("升压站监控", "3"); TabDto tab3 = new TabDto("升压站监控", "3");
TabDto tab4 = new TabDto("电量表计", "4"); TabDto tab4 = new TabDto("电量表计", "4");
TabDto tab5 = new TabDto("故障信息", "5"); TabDto tab5 = new TabDto("故障信息", "5");
tabDtoList.add(tab0); tabDtoList.add(tab0);
tabDtoList.add(tab1); tabDtoList.add(tab1);
tabDtoList.add(tab2); tabDtoList.add(tab2);
tabDtoList.add(tab3); tabDtoList.add(tab3);
tabDtoList.add(tab4); tabDtoList.add(tab4);
tabDtoList.add(tab5); tabDtoList.add(tab5);
} else { } else {
TabDto tab6 = new TabDto("光伏区布置图", "6"); TabDto tab6 = new TabDto("光伏区布置图", "6");
TabDto tab7 = new TabDto("集电线路图", "7"); TabDto tab7 = new TabDto("集电线路图", "7");
TabDto tab8 = new TabDto("运行列表", "8"); TabDto tab8 = new TabDto("运行列表", "8");
TabDto tab9 = new TabDto("升压站监控", "9"); TabDto tab9 = new TabDto("升压站监控", "9");
TabDto tab10 = new TabDto("电量表计", "10"); TabDto tab10 = new TabDto("电量表计", "10");
TabDto tab11 = new TabDto("故障信息", "11"); TabDto tab11 = new TabDto("故障信息", "11");
// TabDto tab12 = new TabDto("集中式-离散率", "12"); // TabDto tab12 = new TabDto("集中式-离散率", "12");
// TabDto tab13 = new TabDto("组串式-离散率", "13"); // TabDto tab13 = new TabDto("组串式-离散率", "13");
TabDto tab14 = new TabDto("离散率", "14"); TabDto tab14 = new TabDto("离散率", "14");
tabDtoList.add(tab6); tabDtoList.add(tab6);
tabDtoList.add(tab7); tabDtoList.add(tab7);
tabDtoList.add(tab8); tabDtoList.add(tab8);
tabDtoList.add(tab9); tabDtoList.add(tab9);
tabDtoList.add(tab10); tabDtoList.add(tab10);
tabDtoList.add(tab11); tabDtoList.add(tab11);
// tabDtoList.add(tab12); // tabDtoList.add(tab12);
// tabDtoList.add(tab13); // tabDtoList.add(tab13);
tabDtoList.add(tab14); tabDtoList.add(tab14);
} }
return tabDtoList; return tabDtoList;
} }
public List<MapAreaInfoDto> getAreaInfo() { public List<MapAreaInfoDto> getAreaInfo() {
List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>(); List<MapAreaInfoDto> mapAreaInfoDtoList = new ArrayList<>();
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area")); List<StationBasic> stationBasicList = stationBasicMapper
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name")); .selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1)); List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name"));
mapRegionList.forEach(mapRegion -> { List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
MapAreaInfoDto mapAreaInfoDto = new MapAreaInfoDto(); 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()); ArrayList<String> stringArrayList = mapRegion.getProvince();
List<String> regionNames = regions.stream().map(region -> region.getRegionName()).collect(Collectors.toList()); List<Region> regions = regionList.stream()
List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode())).collect(Collectors.toList()); .filter(region -> stringArrayList.contains(region.getRegionName().substring(0, 2))
List<StationBasic> stationBasicListAll = stationBasicList.stream().filter(stationBasic -> regionCodes.contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0])).collect(Collectors.toList()); || stringArrayList.contains(region.getRegionName().substring(0, 3)))
mapAreaInfoDto.setProvince(regionNames); .collect(Collectors.toList());
// --------------------省份名称处理结束---------------------------- List<String> regionNames = regions.stream().map(region -> region.getRegionName())
//设置片区名称 .collect(Collectors.toList());
mapAreaInfoDto.setAreaName(mapRegion.getName()); List<String> regionCodes = regions.stream().map(region -> String.valueOf(region.getRegionCode()))
//设置片区code .collect(Collectors.toList());
mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode()); List<StationBasic> stationBasicListAll = stationBasicList.stream()
//风电站数量 .filter(stationBasic -> regionCodes
mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count())); .contains(stationBasic.getBelongArea().replace("[", "").replace("]", "").split(",")[0]))
//集中式光伏电站数量 .collect(Collectors.toList());
mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count())); mapAreaInfoDto.setProvince(regionNames);
//分布式光伏电站数量 // --------------------省份名称处理结束----------------------------
mapAreaInfoDto.setDistributedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).count())); // 设置片区名称
//储能光伏电站数量 mapAreaInfoDto.setAreaName(mapRegion.getName());
mapAreaInfoDto.setEnergyStorageStationCount(String.valueOf(stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("CNDZ")).count())); // 设置片区code
//获取装机容量 mapAreaInfoDto.setAreaCode(mapRegion.getAreaCode());
mapAreaInfoDto.setInstalledCapacity(getInstallCapity(stationBasicListAll)); // 风电站数量
//获取当日发电量 mapAreaInfoDto.setWindPowerStationCount(String.valueOf(stationBasicListAll.stream()
mapAreaInfoDto.setElectricityGenerationOfDay(getPowerOfDaily(stationBasicListAll)); .filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).count()));
mapAreaInfoDto.setPosition(mapRegion.getPosition()); // 集中式光伏电站数量
mapAreaInfoDtoList.add(mapAreaInfoDto); mapAreaInfoDto.setCentralizedPhotovoltaicStationCount(String.valueOf(stationBasicListAll.stream()
}); .filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).count()));
// 分布式光伏电站数量
return mapAreaInfoDtoList; 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) { // public List<HomeMapStationInfoDto> getStaitonListInfoByAreaName(String areaName) {
// List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>(); // List<HomeMapStationInfoDto> homeMapStationInfoDtoList = new ArrayList<>();
...@@ -488,160 +498,172 @@ public class MonitoringServiceImpl { ...@@ -488,160 +498,172 @@ public class MonitoringServiceImpl {
// return homeMapStationInfoDtoList; // return homeMapStationInfoDtoList;
// } // }
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) {
public Map<String, Object> getDetailsWindSpeedAlldata(StationBasic stationBasic) { Map<String, Object> map = new HashMap<>();
Map<String, Object> map = new HashMap<>(); List<String> values = new ArrayList<>();
List<String> values = new ArrayList<>(); Map<Date, Double> groupMap = new HashMap<>();
Map<Date, Double> groupMap = new HashMap<>(); List<String> time = new ArrayList<>();
List<String> time = new ArrayList<>(); Map<String, Object> activePowerInfo = new HashMap<>();
Map<String, Object> activePowerInfo = new HashMap<>(); List<IndicatorData> activePowerList = new ArrayList<>();
List<IndicatorData> activePowerList = new ArrayList<>();
// String startTime = DateUtil.today() + " 00:00:00"; // String startTime = DateUtil.today() + " 00:00:00";
// String endTime = DateUtil.today() + " 23:59:59"; // String endTime = DateUtil.today() + " 23:59:59";
Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date()); Date currentDayStartTime = DateUtils.getCurrentDayStartTime(new Date());
Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date()); Date currentDayEndTime = DateUtils.getCurrentDayEndTime(new Date());
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC")); Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("UTC")); sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
String startTime = sdf.format(currentDayStartTime); String startTime = sdf.format(currentDayStartTime);
String endTime = sdf.format(currentDayEndTime); String endTime = sdf.format(currentDayEndTime);
Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber()); Double installedCapacity = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
if ("FDZ".equals(stationBasic.getStationType())) { if ("FDZ".equals(stationBasic.getStationType())) {
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId()); activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
} else { CommonConstans.xiazaoActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId()); } else {
} activePowerList = indicatorDataMapper.selectDataByequipmentIndexNameAndtime(
for (int i = 0; i < activePowerList.size(); i++) { CommonConstans.taiheActivePowerPoint, startTime, endTime, stationBasic.getBoosterGatewayId());
IndicatorData indicatorData = activePowerList.get(i); }
time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm")); for (int i = 0; i < activePowerList.size(); i++) {
if ("FDZ".equals(stationBasic.getStationType())) { IndicatorData indicatorData = activePowerList.get(i);
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF())); time.add(DateUtil.format(indicatorData.getCreatedTime(), "HH:mm"));
} else { if ("FDZ".equals(stationBasic.getStationType())) {
values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF() * CommonConstans.kwToMv)); values.add(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()));
} } else {
} values.add(String.format(CommonConstans.Twodecimalplaces,
String max = String.format(CommonConstans.Twodecimalplaces, values.stream().mapToDouble(Double::parseDouble).max().getAsDouble()); indicatorData.getValueF() * CommonConstans.kwToMv));
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); String max = String.format(CommonConstans.Twodecimalplaces,
activePowerInfo.put("max", max); values.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
activePowerInfo.put("min", min); String min = String.format(CommonConstans.Twodecimalplaces,
activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max))); values.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
activePowerInfo.put("minTime", time.get(values.lastIndexOf(min))); String mean = String.format(CommonConstans.Twodecimalplaces,
activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces, Double.valueOf(values.get(values.size() - 1)) / installedCapacity)); values.stream().mapToDouble(Double::parseDouble).average().getAsDouble());
activePowerInfo.put("mean", mean);
activePowerInfo.put("max", max);
List<Map<String, Object>> seriesData = new ArrayList<>(); activePowerInfo.put("min", min);
Map<String, Object> map3 = new HashMap<>(); activePowerInfo.put("maxTime", time.get(values.lastIndexOf(max)));
Map<String, Object> map1 = new HashMap<>(); activePowerInfo.put("minTime", time.get(values.lastIndexOf(min)));
Map<String, Object> map2 = new HashMap<>(); activePowerInfo.put("load", String.format(CommonConstans.Twodecimalplaces,
map1.put("data", values); Double.valueOf(values.get(values.size() - 1)) / installedCapacity));
seriesData.add(map1);
map.put("seriesData", seriesData); List<Map<String, Object>> seriesData = new ArrayList<>();
map.put("axisData", time); Map<String, Object> map3 = new HashMap<>();
try { Map<String, Object> map1 = new HashMap<>();
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table", JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true); Map<String, Object> map2 = new HashMap<>();
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info", JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true); map1.put("data", values);
} catch (Exception exception) { seriesData.add(map1);
exception.printStackTrace(); map.put("seriesData", seriesData);
} map.put("axisData", time);
return map; try {
} emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_table",
JSON.toJSON(map).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish(stationBasic.getSequenceNbr() + "_Power_info",
public String getInstallCapity(List<StationBasic> stationBasicList) { JSON.toJSON(activePowerInfo).toString().getBytes("UTF-8"), 1, true);
AtomicReference<Double> total = new AtomicReference<>(0.0); } catch (Exception exception) {
stationBasicList.forEach(stationBasic -> { exception.printStackTrace();
if (stationBasic.getStationNumber() != null) { }
try { return map;
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber())); }
} catch (Exception e) {
public String getInstallCapity(List<StationBasic> stationBasicList) {
} AtomicReference<Double> total = new AtomicReference<>(0.0);
} stationBasicList.forEach(stationBasic -> {
}); if (stationBasic.getStationNumber() != null) {
return String.format("%.2f", total.get()); try {
} total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
} catch (Exception e) {
public String getPowerOfDaily(List<StationBasic> stationBasicList) {
}
AtomicReference<Double> total = new AtomicReference<>(0.0); }
stationBasicList.forEach(stationBasic -> { });
if (stationBasic.getFanGatewayId() != null) { return String.format("%.2f", total.get());
try { }
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) { public String getPowerOfDaily(List<StationBasic> stationBasicList) {
} AtomicReference<Double> total = new AtomicReference<>(0.0);
} stationBasicList.forEach(stationBasic -> {
if (stationBasic.getFanGatewayId() != null) {
}); try {
return String.format("%.2f", total.get()); total.updateAndGet(
} v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "日发电量"));
} catch (Exception e) {
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 { return String.format("%.2f", total.get());
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); }
}
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream().collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName())); public List<Map<String, String>> getStaionCategoryInfo(String areaName) {
listMap.keySet().forEach(key -> { List<StationBasic> stationBasicListAll = new ArrayList<>();
Map<String, String> stringStringMap = new HashMap<>(); List<Map<String, String>> result = new ArrayList<>();
stringStringMap.put("name", key); if (!ObjectUtils.isEmpty(areaName)) {
stringStringMap.put("value", String.valueOf(listMap.get(key).size())); stationBasicListAll = getListOfStationBasicByAreaName(areaName);
result.add(stringStringMap); } else {
}); stationBasicListAll = stationBasicMapper
return result; .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
Map<String, List<StationBasic>> listMap = stationBasicListAll.stream()
//获取装机容量 .collect(Collectors.groupingBy(stationBasic -> stationBasic.getStationTypeName()));
public HashMap<String, String> getInstallCapityByAreaName(String areaName) { listMap.keySet().forEach(key -> {
HashMap<String, String> hashMap = new HashMap<>(); Map<String, String> stringStringMap = new HashMap<>();
AtomicReference<Double> total = new AtomicReference<>(0.0); stringStringMap.put("name", key);
List<StationBasic> stationBasicListAll = new ArrayList<>(); stringStringMap.put("value", String.valueOf(listMap.get(key).size()));
if (!ObjectUtils.isEmpty(areaName)) { result.add(stringStringMap);
stationBasicListAll = getListOfStationBasicByAreaName(areaName); });
} else { return result;
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); }
}
stationBasicListAll.forEach(stationBasic -> { // 获取装机容量
total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber())); public HashMap<String, String> getInstallCapityByAreaName(String areaName) {
}); HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("title", String.format("%.2f", total.get())); AtomicReference<Double> total = new AtomicReference<>(0.0);
return hashMap; List<StationBasic> stationBasicListAll = new ArrayList<>();
} if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
//获取有功功率 } else {
public HashMap<String, String> getActivePowerByAreaName(String areaName) { stationBasicListAll = stationBasicMapper
HashMap<String, String> hashMap = new HashMap<>(); .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
AtomicReference<Double> total = new AtomicReference<>(0.0); }
List<StationBasic> stationBasicListAll = new ArrayList<>(); stationBasicListAll.forEach(stationBasic -> {
if (!ObjectUtils.isEmpty(areaName)) { total.updateAndGet(v -> v + getStationCaPACITYL(stationBasic.getStationNumber()));
stationBasicListAll = getListOfStationBasicByAreaName(areaName); });
} else { hashMap.put("title", String.format("%.2f", total.get()));
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); return hashMap;
} }
stationBasicListAll.forEach(stationBasic -> {
total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率")); // 获取有功功率
}); public HashMap<String, String> getActivePowerByAreaName(String areaName) {
//有功功率换算 HashMap<String, String> hashMap = new HashMap<>();
hashMap.put("title", String.format("%.2f", total.get() / 1000)); AtomicReference<Double> total = new AtomicReference<>(0.0);
return hashMap; List<StationBasic> stationBasicListAll = new ArrayList<>();
} if (!ObjectUtils.isEmpty(areaName)) {
stationBasicListAll = getListOfStationBasicByAreaName(areaName);
//获取社会贡献 } else {
stationBasicListAll = stationBasicMapper
/** .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
* @param areaName 片区名称 }
* @param stationId 场站id stationBasicListAll.forEach(stationBasic -> {
* @return 社会贡献列表 total.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(stationBasic.getFanGatewayId(), "有功功率"));
* @deprecated 如果areaName 与 stationID 都不传 则查全国、如果areaName传了 staionID没有传则查片区 如果 areaName 与stationId都传 则取场站id });
*/ // 有功功率换算
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) { // public Page<SocialContributionDto> getSocialContributionDtoList(String areaName, String stationId) {
// AtomicReference<Double> total = new AtomicReference<>(0.0); // AtomicReference<Double> total = new AtomicReference<>(0.0);
// List<StationBasic> stationBasicListAll = new ArrayList<>(); // List<StationBasic> stationBasicListAll = new ArrayList<>();
...@@ -731,20 +753,21 @@ public class MonitoringServiceImpl { ...@@ -731,20 +753,21 @@ public class MonitoringServiceImpl {
// hashMapPage.setRecords(hashMapList); // hashMapPage.setRecords(hashMapList);
// return hashMapPage; // return hashMapPage;
// } // }
public List<StationBasic> getListOfStationBasicByAreaName(String areaName) { public List<StationBasic> getListOfStationBasicByAreaName(String areaName) {
List<StationBasic> stationBasicListAll = new ArrayList<>(); List<StationBasic> stationBasicListAll = new ArrayList<>();
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName)); MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("name", areaName));
//获取片区下的省份名称 // 获取片区下的省份名称
ArrayList<String> stringArrayList = mapRegion.getProvince(); ArrayList<String> stringArrayList = mapRegion.getProvince();
//变量获取所有的场站信息 // 变量获取所有的场站信息
for (int i = 0; i < stringArrayList.size(); i++) { for (int i = 0; i < stringArrayList.size(); i++) {
Region region = regionMapper.selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i))); Region region = regionMapper
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode())); .selectOne(new QueryWrapper<Region>().eq("LEVEL", 1).like("REGION_NAME", stringArrayList.get(i)));
stationBasicListAll.addAll(stationBasicList); List<StationBasic> stationBasicList = stationBasicMapper
} .selectList(new QueryWrapper<StationBasic>().like("belong_area", region.getRegionCode()));
return stationBasicListAll; stationBasicListAll.addAll(stationBasicList);
} }
return stationBasicListAll;
}
// public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) { // public HashMap<String, List<String>> getPowerGenerationTrendsOfCompletionRate(String areaName) {
// List<StationBasic> stationBasicListAll = new ArrayList<>(); // List<StationBasic> stationBasicListAll = new ArrayList<>();
...@@ -774,7 +797,6 @@ public class MonitoringServiceImpl { ...@@ -774,7 +797,6 @@ public class MonitoringServiceImpl {
// return hashMap; // return hashMap;
// } // }
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) { // public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopFive(String areaName) {
// Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5); // Page<HashMap<String, String>> hashMapPage = new Page<>(1, 5);
// List<HashMap<String, String>> mapList = new ArrayList<>(); // List<HashMap<String, String>> mapList = new ArrayList<>();
...@@ -811,18 +833,17 @@ public class MonitoringServiceImpl { ...@@ -811,18 +833,17 @@ public class MonitoringServiceImpl {
// return hashMapPage; // return hashMapPage;
// } // }
public List<String> getXListofRecentOneYear() {
public List<String> getXListofRecentOneYear() { List<String> xList = new ArrayList<>();
List<String> xList = new ArrayList<>(); Calendar calendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(); Date date = new Date();
Date date = new Date(); for (int i = 1; i < 13; i++) {
for (int i = 1; i < 13; i++) { calendar.setTime(date);
calendar.setTime(date); calendar.add(Calendar.MONTH, i - 12);
calendar.add(Calendar.MONTH, i - 12); xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH));
xList.add(String.valueOf(calendar.get(Calendar.YEAR)).substring(2, 4) + "-" + calendar.get(Calendar.MONTH)); }
} return xList;
return xList; }
}
// //
// public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) { // public Page<HashMap<String, String>> getPowerGenerationTrendsOfCompletionTopThree(String tabValue, String areaName) {
...@@ -893,21 +914,23 @@ public class MonitoringServiceImpl { ...@@ -893,21 +914,23 @@ public class MonitoringServiceImpl {
// return page; // return page;
// } // }
@Scheduled(cron = "0/5 * * * * *") @Scheduled(cron = "0/5 * * * * *")
public void getTotalData() { public void getTotalData() {
//计算所有场站年计划完成量 // 计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR); int year = Calendar.getInstance().get(Calendar.YEAR);
int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1; int Moon = Calendar.getInstance().get(Calendar.MONTH) + 1;
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>(); LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear, String.valueOf(year)); query.eq(StationPlan::getYear, String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query); List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum(); double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ")).mapToDouble(StationPlan::getValue).sum(); double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ"))
double gfvalue = yearValue - fdzValue; .mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon))).mapToDouble(StationPlan::getValue).sum();
double moonValue = stationPlans.stream().filter(e -> e.getMonthly().equals(String.valueOf(Moon)))
//查询风电站年计划完成量 .mapToDouble(StationPlan::getValue).sum();
// 查询风电站年计划完成量
// //
// List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto(); // List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
// List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList()); // List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
...@@ -917,142 +940,178 @@ public class MonitoringServiceImpl { ...@@ -917,142 +940,178 @@ public class MonitoringServiceImpl {
// List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper); // List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
// double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum(); // double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
List<StationBasic> stationBasicListAll = stationBasicMapper
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); .selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()); List<StationBasic> fdzList = stationBasicListAll.stream()
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList()); .filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> fbsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList()); List<StationBasic> jzsgfdzList = stationBasicListAll.stream()
List<StationBasic> gfList = stationBasicListAll.stream().filter(stationBasic -> !stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList()); .filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page = new Page<>(1, 10); List<StationBasic> fbsgfdzList = stationBasicListAll.stream()
Page<HashMap<String, String>> page1 = new Page<>(1, 10); .filter(stationBasic -> stationBasic.getStationType().equals("FBSGFDZ")).collect(Collectors.toList());
Page<HashMap<String, String>> page2 = new Page<>(1, 10); List<StationBasic> gfList = stationBasicListAll.stream()
Page<HashMap<String, String>> page3 = new Page<>(1, 10); .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<>(); List<HashMap<String, String>> list = new ArrayList<>();
//装机容量 // 装机容量
HashMap<String, String> stringHashMap = new HashMap<>(); HashMap<String, String> stringHashMap = new HashMap<>();
BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll)); BigDecimal totalInstall = new BigDecimal(getInstallCapity(stationBasicListAll));
// stringHashMap.put("title", totalInstall.toString()); // stringHashMap.put("title", totalInstall.toString());
//stringHashMap.put("data", ""); // stringHashMap.put("data", "");
// list.add(stringHashMap); // list.add(stringHashMap);
//风电站 // 风电站
HashMap<String, String> stringHashMap1 = new HashMap<>(); HashMap<String, String> stringHashMap1 = new HashMap<>();
BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList)); BigDecimal fdzInstall = new BigDecimal(getInstallCapity(fdzList));
stringHashMap1.put("title", fdzInstall.toString()); stringHashMap1.put("title", fdzInstall.toString());
stringHashMap1.put("data", String.valueOf(fdzList.size())); stringHashMap1.put("data", String.valueOf(fdzList.size()));
list.add(stringHashMap1); list.add(stringHashMap1);
//集中式光伏电站 // 集中式光伏电站
HashMap<String, String> stringHashMap2 = new HashMap<>(); HashMap<String, String> stringHashMap2 = new HashMap<>();
BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList)); BigDecimal jzsInstall = new BigDecimal(getInstallCapity(jzsgfdzList));
stringHashMap2.put("title", jzsInstall.toString()); stringHashMap2.put("title", jzsInstall.toString());
stringHashMap2.put("data", String.valueOf(jzsgfdzList.size())); stringHashMap2.put("data", String.valueOf(jzsgfdzList.size()));
list.add(stringHashMap2); list.add(stringHashMap2);
//分布式光伏电站 // 分布式光伏电站
HashMap<String, String> stringHashMap3 = new HashMap<>(); HashMap<String, String> stringHashMap3 = new HashMap<>();
BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList)); BigDecimal fbsInstall = new BigDecimal(getInstallCapity(fbsgfdzList));
stringHashMap3.put("title", fbsInstall.toString()); stringHashMap3.put("title", fbsInstall.toString());
stringHashMap3.put("data", String.valueOf(fbsgfdzList.size())); stringHashMap3.put("data", String.valueOf(fbsgfdzList.size()));
list.add(stringHashMap3); list.add(stringHashMap3);
page.setRecords(list); page.setRecords(list);
BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList)); BigDecimal gfInstall = new BigDecimal(getInstallCapity(gfList));
//----------------------装机容量结束---------------------------------------- //----------------------装机容量结束----------------------------------------
// ----------------装机容量开始----------------------- // ----------------装机容量开始-----------------------
List<HashMap<String, String>> list1 = new ArrayList<>(); List<HashMap<String, String>> list1 = new ArrayList<>();
List<HashMap<String, String>> list2 = new ArrayList<>(); List<HashMap<String, String>> list2 = new ArrayList<>();
List<HashMap<String, String>> list3 = new ArrayList<>(); List<HashMap<String, String>> list3 = new ArrayList<>();
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfMonthFD = 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> powerOfAnnualFD = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfDayGF = 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> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00)); AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> { fdzList.forEach(stationBasic -> {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
ESEquipments.class);
// powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")); // powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
// powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")); // powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
// powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")); // powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); powerOfDayFD.updateAndGet(
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
powerOfAnnualFD.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); gfList.forEach(stationBasic -> {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); Map<String, List<String>> queryCondtion = new HashMap<>();
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)); ESEquipments.class);
}); powerOfDayGF.updateAndGet(
HashMap<String, String> stringHashMap4 = new HashMap<>(); v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get())); powerOfMonthGF.updateAndGet(v -> v
list1.add(stringHashMap4); + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
HashMap<String, String> stringHashMap5 = new HashMap<>(); powerOfAnnualGF.updateAndGet(
stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get())); v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear));
list1.add(stringHashMap5); });
HashMap<String, String> stringHashMap6 = new HashMap<>(); HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get())); stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/"
list1.add(stringHashMap6); + String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get()));
HashMap<String, String> stringHashMap7 = new HashMap<>(); list1.add(stringHashMap4);
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue)); HashMap<String, String> stringHashMap5 = new HashMap<>();
list1.add(stringHashMap7); stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/"
HashMap<String, String> stringHashMap8 = new HashMap<>(); + String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get()));
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(stringHashMap5);
list1.add(stringHashMap8); HashMap<String, String> stringHashMap6 = new HashMap<>();
page1.setRecords(list1); stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/"
HashMap<String, String> stringHashMap9 = new HashMap<>(); + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()));
stringHashMap9.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get())); list1.add(stringHashMap6);
HashMap<String, String> resultMap = new HashMap<>(); HashMap<String, String> stringHashMap7 = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get())); stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() / fdzValue)
list2.add(stringHashMap9); + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() / gfvalue));
HashMap<String, String> stringHashMap10 = new HashMap<>(); list1.add(stringHashMap7);
stringHashMap10.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get())); HashMap<String, String> stringHashMap8 = new HashMap<>();
resultMap.put("Moon", String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get())); stringHashMap8.put("title",
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100)); String.format(CommonConstans.Twodecimalplaces,
list2.add(stringHashMap10); (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/"
HashMap<String, String> stringHashMap11 = new HashMap<>(); + String.format(CommonConstans.Twodecimalplaces,
stringHashMap11.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get())); (powerOfAnnualGF.get() * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
resultMap.put("Year", String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get())); list1.add(stringHashMap8);
list2.add(stringHashMap11); page1.setRecords(list1);
HashMap<String, String> stringHashMap12 = new HashMap<>(); HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100)); stringHashMap9.put("title",
resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100)); String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
list2.add(stringHashMap12); HashMap<String, String> resultMap = new HashMap<>();
page2.setRecords(list2); resultMap.put("Day", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD.get() + powerOfDayGF.get()));
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get()); list2.add(stringHashMap9);
HashMap<String, String> stringHashMap13 = new HashMap<>(); HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap13.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide))); stringHashMap10.put("title",
stringHashMap13.put("unit", "二氧化碳减排量(t)"); String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
list3.add(stringHashMap13); resultMap.put("Moon",
HashMap<String, String> stringHashMap14 = new HashMap<>(); String.format(CommonConstans.Fourdecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get()));
stringHashMap14.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal))); resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces,
stringHashMap14.put("unit", "节约标准煤(t)"); (powerOfMonthFD.get() + powerOfMonthGF.get()) / moonValue * 100));
list3.add(stringHashMap14); list2.add(stringHashMap10);
HashMap<String, String> stringHashMap15 = new HashMap<>(); HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap15.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner))); stringHashMap11.put("title",
stringHashMap15.put("unit", "碳粉尘减排量(t)"); String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
list3.add(stringHashMap15); resultMap.put("Year",
HashMap<String, String> stringHashMap16 = new HashMap<>(); String.format(CommonConstans.Fourdecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get()));
stringHashMap16.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide))); list2.add(stringHashMap11);
stringHashMap16.put("unit", "二氧化硫减排量(t)"); HashMap<String, String> stringHashMap12 = new HashMap<>();
list3.add(stringHashMap16); stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces,
page3.setRecords(list3); (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
try { resultMap.put("NJHWC", String.format(CommonConstans.Twodecimalplaces,
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true); (powerOfAnnualFD.get() + powerOfAnnualGF.get()) / yearValue * 100));
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true); list2.add(stringHashMap12);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true); page2.setRecords(list2);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic", JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true); Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get());
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true); HashMap<String, String> stringHashMap13 = new HashMap<>();
} catch (Exception ex) { 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() { // public List<HashMap<String, Object>> getNationalPowerGenerationData() {
// List<HashMap<String, Object>> resultHashMap = new ArrayList<>(); // List<HashMap<String, Object>> resultHashMap = new ArrayList<>();
...@@ -1076,40 +1135,44 @@ public class MonitoringServiceImpl { ...@@ -1076,40 +1135,44 @@ public class MonitoringServiceImpl {
// return resultHashMap; // return resultHashMap;
// } // }
public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList, String color) { public HashMap<String, Object> getTableByStationListAndTitle(String title, List<StationBasic> stationBasicList,
HashMap<String, Object> hashMap = new HashMap<>(); String color) {
List<String> xData = new ArrayList<>(); HashMap<String, Object> hashMap = new HashMap<>();
List<String> yData = new ArrayList<>(); List<String> xData = new ArrayList<>();
stationBasicList.forEach(stationBasic -> { List<String> yData = new ArrayList<>();
xData.add(stationBasic.getStationName()); stationBasicList.forEach(stationBasic -> {
yData.add(stationBasic.getAddress()); xData.add(stationBasic.getStationName());
}); yData.add(stationBasic.getAddress());
hashMap.put("title", title); });
hashMap.put("color", color); hashMap.put("title", title);
hashMap.put("xData", xData); hashMap.put("color", color);
hashMap.put("yData", yData); hashMap.put("xData", xData);
return hashMap; hashMap.put("yData", yData);
} return hashMap;
}
public List<HashMap<String, Object>> getSelectDataForNational() {
List<HashMap<String, Object>> hashMapList = new ArrayList<>(); public List<HashMap<String, Object>> getSelectDataForNational() {
List<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id")); List<HashMap<String, Object>> hashMapList = new ArrayList<>();
List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1)); List<StationBasic> stationBasicList = stationBasicMapper
regionList.forEach(region -> { .selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area").isNotNull("fan_gateway_id"));
HashMap<String, Object> hashMap = new HashMap<>(); List<Region> regionList = this.regionMapper.selectList(new QueryWrapper<Region>().eq("level", 1));
hashMap.put("label", region.getRegionName()); regionList.forEach(region -> {
hashMap.put("value", region.getRegionCode()); HashMap<String, Object> hashMap = new HashMap<>();
List<HashMap<String, Object>> children = stationBasicList.stream().filter(stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode()))).map(stationBasic -> { hashMap.put("label", region.getRegionName());
HashMap<String, Object> hashMap1 = new HashMap<>(); hashMap.put("value", region.getRegionCode());
hashMap1.put("label", stationBasic.getStationName()); List<HashMap<String, Object>> children = stationBasicList.stream().filter(
hashMap1.put("value", stationBasic.getSequenceNbr()); stationBasic -> stationBasic.getBelongArea().contains(String.valueOf(region.getRegionCode())))
return hashMap1; .map(stationBasic -> {
}).collect(Collectors.toList()); HashMap<String, Object> hashMap1 = new HashMap<>();
hashMap.put("children", children); hashMap1.put("label", stationBasic.getStationName());
hashMapList.add(hashMap); hashMap1.put("value", stationBasic.getSequenceNbr());
}); return hashMap1;
return hashMapList; }).collect(Collectors.toList());
} hashMap.put("children", children);
hashMapList.add(hashMap);
});
return hashMapList;
}
// const data = { // const data = {
// xData: [], // xData: [],
...@@ -1127,234 +1190,298 @@ public class MonitoringServiceImpl { ...@@ -1127,234 +1190,298 @@ public class MonitoringServiceImpl {
// ] // ]
// }; // };
public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) { public HashMap<String, Object> getTheStationPowerCurve(String stationId, String date) {
HashMap<String, Object> result = new HashMap<>(); HashMap<String, Object> result = new HashMap<>();
List<HashMap<String, Object>> hashMapList = new ArrayList<>(); List<HashMap<String, Object>> hashMapList = new ArrayList<>();
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
//x轴数据 // x轴数据
List<String> xdata = new ArrayList<>(); List<String> xdata = new ArrayList<>();
//实时有功功率 // 实时有功功率
List<String> currentPowerYdata = new ArrayList<>(); List<String> currentPowerYdata = new ArrayList<>();
//短期功率预测 // 短期功率预测
List<String> shortPowerYdata = new ArrayList<>(); List<String> shortPowerYdata = new ArrayList<>();
//超短期功率预测 // 超短期功率预测
List<String> superPowerShortYdata = new ArrayList<>(); List<String> superPowerShortYdata = new ArrayList<>();
for (int i = 0; i < 25; i++) { for (int i = 0; i < 25; i++) {
xdata.add(String.format("%02d", i) + ":00"); xdata.add(String.format("%02d", i) + ":00");
currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0)); currentPowerYdata.add(String.format("%.2f", Math.random() * 30.0));
shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0)); shortPowerYdata.add(String.format("%.2f", Math.random() * 40.0));
superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0)); superPowerShortYdata.add(String.format("%.2f", Math.random() * 35.0));
} }
result.put("xData", xdata); result.put("xData", xdata);
HashMap<String, Object> currentPowerHashMap = new HashMap<>(); HashMap<String, Object> currentPowerHashMap = new HashMap<>();
currentPowerHashMap.put("title", "实时有功 " + date); currentPowerHashMap.put("title", "实时有功 " + date);
currentPowerHashMap.put("yData", currentPowerYdata); currentPowerHashMap.put("yData", currentPowerYdata);
result.put("currentPower", currentPowerHashMap); result.put("currentPower", currentPowerHashMap);
HashMap<String, Object> shortPowerHashMap = new HashMap<>(); HashMap<String, Object> shortPowerHashMap = new HashMap<>();
shortPowerHashMap.put("title", "短期功率预测 " + date); shortPowerHashMap.put("title", "短期功率预测 " + date);
shortPowerHashMap.put("yData", currentPowerYdata); shortPowerHashMap.put("yData", currentPowerYdata);
result.put("shortPower", shortPowerHashMap); result.put("shortPower", shortPowerHashMap);
HashMap<String, Object> superShortPowerHashMap = new HashMap<>(); HashMap<String, Object> superShortPowerHashMap = new HashMap<>();
superShortPowerHashMap.put("title", "超短期功率预测 " + date); superShortPowerHashMap.put("title", "超短期功率预测 " + date);
superShortPowerHashMap.put("yData", currentPowerYdata); superShortPowerHashMap.put("yData", currentPowerYdata);
result.put("superShortPower", superShortPowerHashMap); result.put("superShortPower", superShortPowerHashMap);
HashMap<String, Object> footerList = new HashMap<>(); HashMap<String, Object> footerList = new HashMap<>();
String currentMin = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble()); String currentMin = String.format("%.2f",
String shortMin = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble()); currentPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
String supreMin = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble()); String shortMin = String.format("%.2f",
List<String> gz = new ArrayList<>(); shortPowerYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
List<String> sj1 = new ArrayList<>(); String supreMin = String.format("%.2f",
gz.add(currentMin); superPowerShortYdata.stream().mapToDouble(Double::parseDouble).min().getAsDouble());
sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin))); List<String> gz = new ArrayList<>();
gz.add(shortMin); List<String> sj1 = new ArrayList<>();
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin))); gz.add(currentMin);
gz.add(supreMin); sj1.add(xdata.get(currentPowerYdata.indexOf(currentMin)));
sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin))); gz.add(shortMin);
sj1.add(xdata.get(shortPowerYdata.indexOf(shortMin)));
String currentMax = String.format("%.2f", currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble()); gz.add(supreMin);
String shortMax = String.format("%.2f", shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble()); sj1.add(xdata.get(superPowerShortYdata.indexOf(supreMin)));
String supreMax = String.format("%.2f", superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
List<String> zdz = new ArrayList<>(); String currentMax = String.format("%.2f",
List<String> sj2 = new ArrayList<>(); currentPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
zdz.add(currentMax); String shortMax = String.format("%.2f",
zdz.add(shortMax); shortPowerYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
zdz.add(supreMax); String supreMax = String.format("%.2f",
sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax))); superPowerShortYdata.stream().mapToDouble(Double::parseDouble).max().getAsDouble());
sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax))); List<String> zdz = new ArrayList<>();
sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax))); List<String> sj2 = new ArrayList<>();
String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString(); zdz.add(currentMax);
String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString(); zdz.add(shortMax);
String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString(); zdz.add(supreMax);
List<String> pjz = new ArrayList<>(); sj2.add(xdata.get(currentPowerYdata.indexOf(currentMax)));
List<String> fjl = new ArrayList<>(); sj2.add(xdata.get(shortPowerYdata.indexOf(shortMax)));
pjz.add(currentAvg); sj2.add(xdata.get(superPowerShortYdata.indexOf(supreMax)));
pjz.add(shortAvg); String currentAvg = currentPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
pjz.add(supreAvg); String shortAvg = shortPowerYdata.stream().mapToDouble(Double::parseDouble).average().toString();
fjl = Arrays.asList("0.68", "0.89", "0.56"); String supreAvg = superPowerShortYdata.stream().mapToDouble(Double::parseDouble).average().toString();
List<String> pjz = new ArrayList<>();
footerList.put("gz", gz); List<String> fjl = new ArrayList<>();
footerList.put("sj1", sj1); pjz.add(currentAvg);
footerList.put("zdz", zdz); pjz.add(shortAvg);
footerList.put("sj2", sj2); pjz.add(supreAvg);
footerList.put("pjz", pjz); fjl = Arrays.asList("0.68", "0.89", "0.56");
footerList.put("fjl", fjl);
result.put("footerList", footerList); footerList.put("gz", gz);
return result; footerList.put("sj1", sj1);
} footerList.put("zdz", zdz);
footerList.put("sj2", sj2);
public Double keepFourdecimalPlaces(Double param) { footerList.put("pjz", pjz);
return Double.valueOf(String.format("%.4f", param)); footerList.put("fjl", fjl);
} result.put("footerList", footerList);
return result;
public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) { }
HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%"); public Double keepFourdecimalPlaces(Double param) {
returnResult.put("monthValue", "0.0000"); return Double.valueOf(String.format("%.4f", param));
returnResult.put("monthPlanValue", "0.0000"); }
returnResult.put("yearCompleteRate", "0.00%");
returnResult.put("yearValue", "0.0000"); public Map<String, String> getGenPowerInfoForBuDun(String areaCode, String stationId) {
returnResult.put("yearPlanValue", "0.0000"); HashMap<String, String> returnResult = new HashMap<>();
returnResult.put("monthCompleteRate", "0.00%");
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto(); returnResult.put("monthValue", "0.0000");
if (StringUtils.isNotBlank(areaCode)) { returnResult.put("monthPlanValue", "0.0000");
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList()); returnResult.put("yearCompleteRate", "0.00%");
} returnResult.put("yearValue", "0.0000");
if (StringUtils.isNotBlank(stationId)) { returnResult.put("yearPlanValue", "0.0000");
stationCacheInfoDtos = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId)).collect(Collectors.toList());
} List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
//月发电量 if (StringUtils.isNotBlank(areaCode)) {
AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0); stationCacheInfoDtos = stationCacheInfoDtos.stream()
//年发电量 .filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
AtomicReference<Double> annualPower = new AtomicReference<>(0.0); .collect(Collectors.toList());
for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) { }
if (StringUtils.isNotBlank(stationId)) {
if ("FDZ".equals(stationCacheInfoDto.getStationType())) { stationCacheInfoDtos = stationCacheInfoDtos.stream()
Map<String, List<String>> queryCondtion = new HashMap<>(); .filter(stationCacheInfoDto -> stationCacheInfoDto.getStationId().equals(stationId))
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量")); .collect(Collectors.toList());
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, "月发电量"))); AtomicReference<Double> monthlyPower = new AtomicReference<>(0.0);
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); // 年发电量
} else { AtomicReference<Double> annualPower = new AtomicReference<>(0.0);
Map<String, List<String>> queryCondtion = new HashMap<>(); for (StationCacheInfoDto stationCacheInfoDto : stationCacheInfoDtos) {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); if ("FDZ".equals(stationCacheInfoDto.getStationType())) {
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); Map<String, List<String>> queryCondtion = new HashMap<>();
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("月发电量", "年发电量"));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); queryCondtion.put(CommonConstans.QueryStringGateWayId,
} Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
} List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId).collect(Collectors.toList()); ESEquipments.class);
List<StationPlan> stationPlans = stationPlanMapper.selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds)); monthlyPower.updateAndGet(
String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
String currentYear = currentYearAndMonth.split("-")[0]; annualPower.updateAndGet(
Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear)).mapToDouble(i -> i.getValue()).sum(); } else {
Double monthPlanValue = stationPlans.stream().filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly())).mapToDouble(i -> i.getValue()).sum(); Map<String, List<String>> queryCondtion = new HashMap<>();
if (monthlyPower.get() > 0 && monthPlanValue > 0) { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
returnResult.put("monthCompleteRate", String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%"); queryCondtion.put(CommonConstans.QueryStringGateWayId,
returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get())); Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue)); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
} ESEquipments.class);
if (annualPower.get() > 0 && yearPlanValue > 0) { monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(
returnResult.put("yearCompleteRate", String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%"); commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get())); annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(
returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue)); commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
} }
return returnResult; }
} List<String> stationIds = stationCacheInfoDtos.stream().map(StationCacheInfoDto::getStationId)
.collect(Collectors.toList());
public Map<String, Object> getGenPowerInfo(String areaCode) { List<StationPlan> stationPlans = stationPlanMapper
List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto(); .selectList(new QueryWrapper<StationPlan>().in("station_basic_id", stationIds));
if (StringUtils.isNotBlank(areaCode)) { String currentYearAndMonth = DateUtil.format(new Date(), DatePattern.NORM_MONTH_PATTERN);
MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code",areaCode)); String currentYear = currentYearAndMonth.split("-")[0];
List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode)).collect(Collectors.toList()); Integer currentMonth = Integer.valueOf(currentYearAndMonth.split("-")[1]);
stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos; Double yearPlanValue = stationPlans.stream().filter(stationPlan -> stationPlan.getYear().equals(currentYear))
if(!ObjectUtils.isEmpty(mapRegion)){ .mapToDouble(i -> i.getValue()).sum();
stationCacheInfoDtos =filterData; Double monthPlanValue = stationPlans.stream()
} .filter(stationPlan -> currentMonth == Integer.valueOf(stationPlan.getMonthly()))
} .mapToDouble(i -> i.getValue()).sum();
List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()); if (monthlyPower.get() > 0 && monthPlanValue > 0) {
List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()); returnResult.put("monthCompleteRate",
Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream().collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince)); String.format(CommonConstans.Twodecimalplaces, (monthlyPower.get() / monthPlanValue) * 100) + "%");
HashMap<String, Object> returnResult = new HashMap<>(); returnResult.put("monthValue", String.format(CommonConstans.Fourdecimalplaces, monthlyPower.get()));
HashMap<String, Object> pv_interval = new HashMap<>(); returnResult.put("monthPlanValue", String.format(CommonConstans.Fourdecimalplaces, monthPlanValue));
HashMap<String, Object> fan_interval = new HashMap<>(); }
HashMap<String, Double> dayGenCache = new HashMap(); if (annualPower.get() > 0 && yearPlanValue > 0) {
HashMap<String, Double> monthGenCache = new HashMap(); returnResult.put("yearCompleteRate",
returnResult.put("pv_station_count", pvStationList.size()); String.format(CommonConstans.Twodecimalplaces, (annualPower.get() / yearPlanValue) * 100) + "%");
returnResult.put("fan_station_count", fanStationList.size()); returnResult.put("yearValue", String.format(CommonConstans.Fourdecimalplaces, annualPower.get()));
AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00)); returnResult.put("yearPlanValue", String.format(CommonConstans.Fourdecimalplaces, yearPlanValue));
AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00)); }
AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00)); return returnResult;
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)); public Map<String, Object> getGenPowerInfo(String areaCode) {
fanStationList.forEach(stationBasic -> { List<StationCacheInfoDto> stationCacheInfoDtos = commonServiceImpl.getListStationCacheInfoDto();
Map<String, List<String>> queryCondtion = new HashMap<>(); if (StringUtils.isNotBlank(areaCode)) {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量")); MapRegion mapRegion = mapRegionMapper.selectOne(new QueryWrapper<MapRegion>().eq("area_code", areaCode));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); List<StationCacheInfoDto> filterData = stationCacheInfoDtos.stream()
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); .filter(stationCacheInfoDto -> stationCacheInfoDto.getAreaCode().equals(areaCode))
powerOfDayFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); .collect(Collectors.toList());
powerOfMonthFD.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); stationCacheInfoDtos = filterData.size() > 0 ? filterData : stationCacheInfoDtos;
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); if (!ObjectUtils.isEmpty(mapRegion)) {
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); stationCacheInfoDtos = filterData;
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId())); }
}); }
pvStationList.forEach(stationBasic -> { List<StationCacheInfoDto> fanStationList = stationCacheInfoDtos.stream()
Map<String, List<String>> queryCondtion = new HashMap<>(); .filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ"))
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); .collect(Collectors.toList());
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); List<StationCacheInfoDto> pvStationList = stationCacheInfoDtos.stream()
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); .filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ"))
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); .collect(Collectors.toList());
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); Map<String, List<StationCacheInfoDto>> groupByProvince = stationCacheInfoDtos.stream()
dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); .collect(Collectors.groupingBy(StationCacheInfoDto::getBelongProvince));
monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); HashMap<String, Object> returnResult = new HashMap<>();
planOfGF.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId())); HashMap<String, Object> pv_interval = new HashMap<>();
}); HashMap<String, Object> fan_interval = new HashMap<>();
returnResult.put("today_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get())); HashMap<String, Double> dayGenCache = new HashMap();
returnResult.put("today_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get())); HashMap<String, Double> monthGenCache = new HashMap();
returnResult.put("month_pv_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get())); returnResult.put("pv_station_count", pvStationList.size());
returnResult.put("month_fan_power", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get())); returnResult.put("fan_station_count", fanStationList.size());
returnResult.put("month_pv_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthGF.get() / planOfGF.get()) * 100)); AtomicReference<Double> powerOfDayFD = new AtomicReference<>(new Double(0.00));
if(returnResult.get("month_pv_quota_schedule").toString().equals("NaN")){ AtomicReference<Double> powerOfMonthFD = new AtomicReference<>(new Double(0.00));
returnResult.put("month_pv_quota_schedule",0.00f); AtomicReference<Double> powerOfDayGF = new AtomicReference<>(new Double(0.00));
} AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
returnResult.put("month_fan_quota_schedule", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() / planOfFD.get()) * 100)); AtomicReference<Double> planOfFD = new AtomicReference<>(new Double(0.00));
if(returnResult.get("month_fan_quota_schedule").toString().equals("NaN")){ AtomicReference<Double> planOfGF = new AtomicReference<>(new Double(0.00));
returnResult.put("month_fan_quota_schedule",0.00f); fanStationList.forEach(stationBasic -> {
} Map<String, List<String>> queryCondtion = new HashMap<>();
groupByProvince.keySet().forEach(s -> { queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量"));
HashMap<String, Object> fan = new HashMap<>(); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
HashMap<String, Object> pv = new HashMap<>(); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
List<StationCacheInfoDto> list = groupByProvince.get(s); ESEquipments.class);
List<String> fanStationIds = list.stream().filter(stationCacheInfoDto -> stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList()); if (result != null) {
List<String> pvStationIds = list.stream().filter(stationCacheInfoDto -> !stationCacheInfoDto.getStationType().equals("FDZ")).collect(Collectors.toList()).stream().map(stationCacheInfoDto -> stationCacheInfoDto.getStationId()).collect(Collectors.toList()); powerOfDayFD.updateAndGet(
fan.put("station_count", fanStationIds.size()); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
pv.put("station_count", pvStationIds.size()); powerOfMonthFD.updateAndGet(
fan.put("today_power", getTotalPowerFromCache(fanStationIds, dayGenCache)); v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
pv.put("today_power", getTotalPowerFromCache(pvStationIds, dayGenCache)); dayGenCache.put(stationBasic.getStationId(),
fan.put("month_power", getTotalPowerFromCache(fanStationIds, monthGenCache)); keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
pv.put("month_power", getTotalPowerFromCache(pvStationIds, monthGenCache)); monthGenCache.put(stationBasic.getStationId(),
pv_interval.put(s, pv); keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
fan_interval.put(s, fan); }
planOfFD.updateAndGet(v -> v + getPlanGenByStationIdAndMonth(stationBasic.getStationId()));
}); });
returnResult.put("pv_interval", pv_interval); pvStationList.forEach(stationBasic -> {
returnResult.put("fan_interval", fan_interval); Map<String, List<String>> queryCondtion = new HashMap<>();
return returnResult; queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
} queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null,
public Double getPlanGenByStationIdAndMonth(String stationId) { ESEquipments.class);
String[] dates = DateUtil.today().split("-"); if (result != null) {
return stationPlanMapper.getPlanGenByStationIdAndMonth(stationId, dates[0], String.valueOf(Integer.valueOf(dates[1]))); powerOfDayGF.updateAndGet(v -> v
} + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay));
powerOfMonthGF.updateAndGet(v -> v
public Double getTotalPowerFromCache(List<String> keys, HashMap<String, Double> cache) { + commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth));
AtomicReference<Double> result = new AtomicReference<>(0.0); dayGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
keys.forEach(s -> { commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
result.set(result.get() + cache.get(s)); monthGenCache.put(stationBasic.getStationId(), keepFourdecimalPlaces(
}); commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
return keepFourdecimalPlaces(result.get()); }
} 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 @@ ...@@ -15,11 +15,12 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<dependencies> <dependencies>
<!--
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-ugp-api</artifactId> <artifactId>amos-boot-module-ugp-api</artifactId>
<version>${amos-biz-boot.version}</version> <version>${amos-biz-boot.version}</version>
</dependency> </dependency>-->
<dependency> <dependency>
<groupId>com.amosframework.boot</groupId> <groupId>com.amosframework.boot</groupId>
<artifactId>amos-boot-module-common-biz</artifactId> <artifactId>amos-boot-module-common-biz</artifactId>
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
<version>5.7.22</version> <version>5.7.22</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
......
...@@ -13,5 +13,6 @@ import java.util.Map; ...@@ -13,5 +13,6 @@ import java.util.Map;
* @createDate: 2023/11/9 * @createDate: 2023/11/9
*/ */
public interface UserEmpowerMapper extends BaseMapper<StdUserEmpower> { 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; 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.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.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; 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.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; 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.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.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.CompanyModel; import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel; import com.yeejoin.amos.feign.privilege.model.UserOrgTreeModel;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; 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: * @description:
...@@ -37,143 +46,196 @@ import java.util.stream.Collectors; ...@@ -37,143 +46,196 @@ import java.util.stream.Collectors;
@RestController @RestController
@Api(tags = "平台单位部门树") @Api(tags = "平台单位部门树")
@RequestMapping(value = "/companyClient") @RequestMapping(value = "/companyClient")
public class PrivilegeController extends BaseController{ public class PrivilegeController extends BaseController {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired
private UserEmpowerMapper userEmpowerMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/queryOrgTree") @Value("${yth.qg.id}")
@ApiOperation(httpMethod = "GET",value = "查询单位、子单位、部门树", notes = "查询单位、子单位、部门树") private Long qgCompanyId;
public FeignClientResult<Collection<UserOrgTreeModel>> queryOrgTree() {
//获取当前登录人单位 @TycloudOperation(ApiLevel = UserType.AGENCY)
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); @GetMapping(value = "/queryOrgTree")
@ApiOperation(httpMethod = "GET", value = "查询单位、子单位、部门树", notes = "查询单位、子单位、部门树")
Long companyId=reginParams.getCompany().getSequenceNbr(); public FeignClientResult<Collection<UserOrgTreeModel>> queryOrgTree() {
// 获取当前登录人单位
FeignClientResult<Collection<UserOrgTreeModel>> de =Privilege.companyClient.queryOrgTree(companyId); ReginParams reginParams = JSONObject.parseObject(redisUtils
.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(),
return de; ReginParams.class);
}
Long companyId = reginParams.getCompany().getSequenceNbr();
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/subcompany") FeignClientResult<Collection<UserOrgTreeModel>> de = Privilege.companyClient.queryOrgTree(companyId);
@ApiOperation(httpMethod = "GET",value = "查询单位、子单位", notes = "查询单位、子单位")
public ResponseModel< Collection<CompanyModel>> subcompany(String orgCode,String type) { return de;
Long companyId =null; }
if(orgCode!=null){
@TycloudOperation(ApiLevel = UserType.AGENCY)
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient @GetMapping(value = "/subcompany")
.queryByOrgcode(orgCode).getResult(); @ApiOperation(httpMethod = "GET", value = "查询单位、子单位", notes = "查询单位、子单位")
for (Map.Entry<Object, Object> it : l.entrySet()) { public ResponseModel<Collection<CompanyModel>> subcompany(String orgCode, String type) {
// Long companyId =null;
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()), // if(orgCode!=null){
CompanyModel.class); // LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
if (companyModel != null) { // .queryByOrgcode(orgCode).getResult();
companyId = companyModel.getSequenceNbr(); // for (Map.Entry<Object, Object> it : l.entrySet()) {
} //
break; // CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
} // CompanyModel.class);
// if (companyModel != null) {
}else{ // companyId = companyModel.getSequenceNbr();
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); // }
companyId = reginParams.getCompany().getSequenceNbr(); // break;
} // }
//获取当前登录人单位 //
List<ListCompanyModel> data = new ArrayList(); // }else{
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId); // ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId); // companyId = reginParams.getCompany().getSequenceNbr();
CompanyModel companyModel=dat.getResult(); // }
List<CompanyModel> list =new ArrayList<>(); // //获取当前登录人单位
//如果是公司则获取所有片区 // List<ListCompanyModel> data = new ArrayList();
// 86*353*328*364
if(companyModel.getLevel().equals("categroy_leve2")){ // FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
Collection<CompanyModel> companyModelList= de.getResult(); // CompanyModel companyModel=dat.getResult();
companyModelList=companyModelList.stream().filter(companyModel1 ->companyModel1.getCompanyName().contains("区域")).collect(Collectors.toList()); // List<CompanyModel> list =new ArrayList<>();
companyModelList.parallelStream().forEach((companyModel1)->{companyModel1.setChildren(new ArrayList());}); // //如果是公司则获取所有片区
return ResponseHelper.buildResponse(companyModelList); //// 86*353*328*364
} // if(companyModel.getLevel().equals("departmentorcompany")){
//如果是片区则获取片区 // Collection<CompanyModel> companyModelList= de.getResult();
if(companyModel.getLevel().equals("area")){ // companyModelList=companyModelList.stream().filter(companyModel1 ->companyModel1.getCompanyName().contains("区域")).collect(Collectors.toList());
list.add(companyModel); // companyModelList.parallelStream().forEach((companyModel1)->{companyModel1.setChildren(new ArrayList());});
return ResponseHelper.buildResponse(list); // return ResponseHelper.buildResponse(companyModelList);
} // }
if(!"add".equals(type)){ // //如果是片区则获取片区
if(companyModel.getLevel().equals("station")){ // if(companyModel.getLevel().equals("area")){
FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId()); // list.add(companyModel);
list.add(areaInfo.getResult()); // 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")){ // if(companyModel.getLevel().equals("station")){
// FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId()); // FeignClientResult<CompanyModel> areaInfo = Privilege.companyClient.seleteOne(companyModel.getParentId());
// list.add(areaInfo.getResult()); // list.add(areaInfo.getResult());
// } // }
return ResponseHelper.buildResponse(list); String companyLevel = "categroy_leve2";
} String companyName = "";
Long parentId = null;
@TycloudOperation(ApiLevel = UserType.AGENCY) ReginParams reginParams = getSelectedOrgInfo();
@GetMapping(value = "/stationTree") String userId = reginParams.getUserModel().getUserId();
@ApiOperation(httpMethod = "GET",value = "查询所属场站", notes = "查询所属场站") StdUserEmpower stdUserEmpower = userEmpowerMapper
public ResponseModel< Collection<CompanyModel>> stationTree(String orgCode ) { .selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
Long companyId =null; Map<String, String> companyInfo = new HashMap<String, String>();
if(orgCode!=null){ if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!");
} else {
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
.queryByOrgcode(orgCode).getResult(); companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
for (Map.Entry<Object, Object> it : l.entrySet()) { companyLevel = companyInfo.get("level").toString();
companyName = companyInfo.get("companyName").toString();
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()), }
CompanyModel.class); FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(qgCompanyId);
if (companyModel != null) { List<CompanyModel> list = new ArrayList<>();
companyId = companyModel.getSequenceNbr(); // 如果是全国
} if (companyLevel.equals("categroy_leve2")) {
break; Collection<CompanyModel> companyModelList = de.getResult();
} companyModelList = companyModelList.stream()
.filter(companyModel1 -> companyModel1.getCompanyName().contains("区域"))
}else{ .collect(Collectors.toList());
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class); companyModelList.parallelStream().forEach((companyModel1) -> {
companyId = reginParams.getCompany().getSequenceNbr(); companyModel1.setChildren(new ArrayList());
} });
return ResponseHelper.buildResponse(companyModelList);
List<ListCompanyModel> data = new ArrayList(); }
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId); // 如果是片区则获取片区
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId); if (companyLevel.equals("area")||(!"add".equals(type)&&companyLevel.equals("station"))) {
CompanyModel companyModel=dat.getResult(); Collection<CompanyModel> companyModelList = de.getResult();
companyModel.setChildren(de.getResult()); companyModelList = companyModelList.stream()
List<CompanyModel> list =new ArrayList<>(); .filter(companyModel1 -> companyModel1.getCompanyName().contains("区域"))
list.add(companyModel); .collect(Collectors.toList());
return ResponseHelper.buildResponse(list); for (CompanyModel companyModel : companyModelList) {
} if (companyModel.getCompanyName().equals(companyName)) {
list.add(companyModel);
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) break;
@GetMapping(value = "/permissionTree") }
@ApiOperation(httpMethod = "GET",value = "查询所属场站", notes = "查询所属场站") }
public ResponseModel< Collection<CompanyModel>> permissionTree(@RequestParam(required = false,defaultValue = "86*353*328") String orgCode ) { list.parallelStream().forEach((companyModel1) -> {
Long companyId =null; companyModel1.setChildren(new ArrayList());
if(orgCode!=null){ });
LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient return ResponseHelper.buildResponse(list);
.queryByOrgcode(orgCode).getResult(); }
for (Map.Entry<Object, Object> it : l.entrySet()) { return ResponseHelper.buildResponse(list);
}
CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
CompanyModel.class); @TycloudOperation(ApiLevel = UserType.AGENCY)
if (companyModel != null) { @GetMapping(value = "/stationTree")
companyId = companyModel.getSequenceNbr(); @ApiOperation(httpMethod = "GET", value = "查询所属场站", notes = "查询所属场站")
} public ResponseModel<Collection<CompanyModel>> stationTree(String orgCode) {
break; Long companyId = null;
} if (orgCode != null) {
} LinkedHashMap<Object, Object> l = (LinkedHashMap<Object, Object>) Privilege.companyClient
List<ListCompanyModel> data = new ArrayList(); .queryByOrgcode(orgCode).getResult();
FeignClientResult<Collection<CompanyModel>> de = Privilege.companyClient.querySubAgencyTree(companyId); for (Map.Entry<Object, Object> it : l.entrySet()) {
FeignClientResult<CompanyModel> dat = Privilege.companyClient.seleteOne(companyId);
CompanyModel companyModel=dat.getResult(); CompanyModel companyModel = JSONObject.parseObject(JSONObject.toJSONString(it.getValue()),
companyModel.setChildren(de.getResult()); CompanyModel.class);
List<CompanyModel> list =new ArrayList<>(); if (companyModel != null) {
list.add(companyModel); companyId = companyModel.getSequenceNbr();
return ResponseHelper.buildResponse(list); }
} 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 ...@@ -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.username=root
spring.db2.datasource.password=Yeejoin@2020 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 properties:
eureka.instance.hostname=172.16.10.220 eureka.instance.hostname=172.16.10.220
eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://admin:a1234560@${eureka.instance.hostname}:10001/eureka/
......
...@@ -49,7 +49,7 @@ import java.util.stream.Collectors; ...@@ -49,7 +49,7 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class CommonServiceImpl { public class CommonServiceImpl {
// @Autowired // @Autowired
// InfluxdbUtil influxdbUtil; // InfluxdbUtil influxdbUtil;
@Autowired @Autowired
SjglZsjZsbtzMapper sjglZsjZsbtzMapper; SjglZsjZsbtzMapper sjglZsjZsbtzMapper;
...@@ -246,7 +246,7 @@ public class CommonServiceImpl { ...@@ -246,7 +246,7 @@ public class CommonServiceImpl {
} catch (Exception e) { } catch (Exception e) {
return totalvalue; 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) { // public Double getTotalByIndicatiorAndParams(String gatewayId, String indicator, String querySql) {
...@@ -371,10 +371,10 @@ public class CommonServiceImpl { ...@@ -371,10 +371,10 @@ public class CommonServiceImpl {
coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal))); coal.setTitle(String.format("%.2f", (totalSocialContribution * CommonConstans.standardCoal)));
socialContributionDtoList.add(coal); socialContributionDtoList.add(coal);
toner.setUnit(CommonConstans.TAN_FEN_CHEN_ZHUBIANDIYACE); 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); socialContributionDtoList.add(toner);
so2.setUnit(CommonConstans.ER_YANG_HUA_LIU_ZHUBIANDIYACE); 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); socialContributionDtoList.add(so2);
socialContributionDtoPage.setRecords(socialContributionDtoList); socialContributionDtoPage.setRecords(socialContributionDtoList);
socialContributionDtoPage.setTotal(100); socialContributionDtoPage.setTotal(100);
...@@ -390,11 +390,12 @@ public class CommonServiceImpl { ...@@ -390,11 +390,12 @@ public class CommonServiceImpl {
List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>(); List<StationCacheInfoDto> stationCacheInfoDtos = new ArrayList<>();
List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1)); List<Region> regionList = regionMapper.selectList(new QueryWrapper<Region>().eq("LEVEL", 1));
List<MapRegion> mapRegionList = mapRegionMapper.selectList(new QueryWrapper<MapRegion>().isNotNull("name")); 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<StationBasic> stationBasicList = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("belong_area"));
List<SjglZsjZsbtz> sjglZsjZsbtzList = sjglZsjZsbtzMapper.selectList(new QueryWrapper<SjglZsjZsbtz>().isNotNull("CAPACITYL").eq("is_del","0").isNotNull("WERKS")); //.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++) { for (int i = 0; i < stationBasicList.size(); i++) {
StationBasic stationBasic = stationBasicList.get(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 stationCacheInfoDto = new StationCacheInfoDto();
stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString()); stationCacheInfoDto.setStationId(stationBasic.getSequenceNbr().toString());
stationCacheInfoDto.setStationName(stationBasic.getStationName()); stationCacheInfoDto.setStationName(stationBasic.getStationName());
...@@ -560,13 +561,17 @@ public class CommonServiceImpl { ...@@ -560,13 +561,17 @@ public class CommonServiceImpl {
public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getAvagerByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; 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; return result;
} }
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) { public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00; 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; return result;
} }
......
...@@ -26,62 +26,63 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipAlarmEventMapper; ...@@ -26,62 +26,63 @@ import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.EquipAlarmEventMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipDivergenceAlarmEventMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.EquipDivergenceAlarmEventMapper;
@Service @Service
public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, EquipAlarmEvent, EquipAlarmEventMapper> { public class EquipAlarmEventServiceImpl
extends BaseService<EquipAlarmEventDto, EquipAlarmEvent, EquipAlarmEventMapper> {
@Autowired @Autowired
EquipAlarmEventMapper equipAlarmEventMapper; EquipAlarmEventMapper equipAlarmEventMapper;
@Autowired @Autowired
StationBasicMapper stationBasicMapper; StationBasicMapper stationBasicMapper;
@Autowired @Autowired
EquipDivergenceAlarmEventMapper equipDivergenceAlarmEventMapper; EquipDivergenceAlarmEventMapper equipDivergenceAlarmEventMapper;
public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex, String frontModule) { public ResultsData getEventByEquipIndex(String gatewayId, int current, int size, String equipIndex,
List<EquipAlarmEventDto> equipAlarmEvents = new ArrayList<>(); String frontModule) {
LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>(); List<EquipAlarmEventDto> equipAlarmEvents = new ArrayList<>();
if(equipIndex!=null) LambdaQueryWrapper<EquipAlarmEvent> queryWrapper = new LambdaQueryWrapper<>();
{ if (equipIndex != null) {
queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex); queryWrapper.eq(EquipAlarmEvent::getEquipIndex, equipIndex);
} }
queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId); queryWrapper.eq(EquipAlarmEvent::getGatewayId, gatewayId);
if(frontModule!=null) if (frontModule != null) {
{ queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule);
queryWrapper.eq(EquipAlarmEvent::getFrontModule, frontModule); }
} Calendar calendar = Calendar.getInstance();
Calendar calendar = Calendar.getInstance(); calendar.add(Calendar.DAY_OF_MONTH, -7);
calendar.add(Calendar.DAY_OF_MONTH, -7); queryWrapper.gt(EquipAlarmEvent::getCreatedTime, calendar.getTime());
queryWrapper.gt(EquipAlarmEvent::getCreatedTime, calendar.getTime()); int count = equipAlarmEventMapper.selectCount(queryWrapper);
int count = equipAlarmEventMapper.selectCount(queryWrapper);
IPage<EquipAlarmEvent> p = new Page<>(current, size);
IPage<EquipAlarmEvent> p = new Page<>(current, size); equipAlarmEvents = equipAlarmEventMapper.getAlarmEventList(gatewayId, equipIndex, frontModule,
equipAlarmEvents= equipAlarmEventMapper.getAlarmEventList(gatewayId, equipIndex, frontModule, (p.getCurrent()-1)*p.getSize(), p.getSize(),calendar.getTime()); (p.getCurrent() - 1) * p.getSize(), p.getSize(), calendar.getTime());
// equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper); // equipAlarmEvents = equipAlarmEventMapper.selectList(queryWrapper);
// equipAlarmEvents=page.getRecords(); // equipAlarmEvents=page.getRecords();
equipAlarmEvents.forEach(i->{ equipAlarmEvents.forEach(i -> {
if("true".equals(i.getValue())) if ("true".equals(i.getValue())) {
{ i.setValue("合");
i.setValue("合"); } else {
}else i.setValue("分");
{ }
i.setValue("分"); });
} DataGridMock DataGridMock = new DataGridMock(current, count, false, current, equipAlarmEvents);
}); ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName");
DataGridMock DataGridMock = new DataGridMock(current, count, false, current, equipAlarmEvents); ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc");
ColModel colModelEventMovement = new ColModel("equipName", "equipName", "设备名", "设备名", "dataGrid", "equipName"); ColModel colModelEventDesc = new ColModel("createdTime", "createdTime", "告警时间", "告警时间", "dataGrid",
ColModel colModelStationName = new ColModel("alarmDesc", "alarmDesc", "事件描述", "事件描述", "dataGrid", "alarmDesc"); "createdTime");
ColModel colModelEventDesc = new ColModel("createdTime", "createdTime", "告警时间", "告警时间", "dataGrid", "createdTime"); ColModel colModelValueDesc = new ColModel("value", "value", "动作", "动作", "dataGrid", "value");
ColModel colModelValueDesc = new ColModel("value", "value", "动作", "动作", "dataGrid", "value"); List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,
List<ColModel> listColModel = Arrays.asList(colModelEventMovement, colModelStationName, colModelEventDesc,colModelValueDesc); colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData; return resultsData;
} }
public ResultsData getEquipDivergenceEvent(String gatewayId, int current, int size) { public ResultsData getEquipDivergenceEvent(String gatewayId, int current, int size) {
PageHelper.startPage(current, size); PageHelper.startPage(current, size);
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.DAY_OF_MONTH, -2); calendar.add(Calendar.DAY_OF_MONTH, -2);
List<EquipDivergenceAlarmEvent> alarmEventList = equipDivergenceAlarmEventMapper.getEventList(gatewayId, null, null, List<EquipDivergenceAlarmEvent> alarmEventList = equipDivergenceAlarmEventMapper.getEventList(gatewayId, null,
calendar.getTime()); null, calendar.getTime());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar car = Calendar.getInstance(); Calendar car = Calendar.getInstance();
...@@ -91,12 +92,12 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, ...@@ -91,12 +92,12 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
// } else if ("false".equals(i.getValue())) { // } else if ("false".equals(i.getValue())) {
// i.setValue("分"); // i.setValue("分");
// } // }
long mills = i.getCreatedTime() ; long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime()); String time = sdf.format(car.getTime());
if (time.contains("1970")) { if (time.contains("1970-")) {
mills = i.getCreatedTime()/ 1000000; mills = i.getCreatedTime();
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
time = sdf.format(car.getTime()); time = sdf.format(car.getTime());
} }
...@@ -118,5 +119,5 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto, ...@@ -118,5 +119,5 @@ public class EquipAlarmEventServiceImpl extends BaseService<EquipAlarmEventDto,
colModelEventDesc, colModelValueDesc); colModelEventDesc, colModelValueDesc);
ResultsData resultsData = new ResultsData(DataGridMock, listColModel); ResultsData resultsData = new ResultsData(DataGridMock, listColModel);
return resultsData; return resultsData;
} }
} }
...@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -149,7 +149,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired @Autowired
private UserEmpowerMapper userEmpowerMapper; private UserEmpowerMapper userEmpowerMapper;
@Override
public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) { public ResultsData getNationWideInfo(int current, int size, String gateway, String equipmentNumber) {
String table = gateway; String table = gateway;
Map<String, List<String>> queryCodntion = new HashMap<>(); Map<String, List<String>> queryCodntion = new HashMap<>();
...@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -301,14 +301,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) { public TreeDto getTreeInfo(String sequenceNbr, ReginParams reginParams) {
String userId = reginParams.getUserModel().getUserId(); String userId = reginParams.getUserModel().getUserId();
String companyLevel =""; String companyLevel = "";
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH")); StdUserEmpower stdUserEmpower = userEmpowerMapper
.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
if (ObjectUtils.isEmpty(stdUserEmpower)) { if (ObjectUtils.isEmpty(stdUserEmpower)) {
// throw new BadRequest("您当前未配置数据权限!"); // throw new BadRequest("您当前未配置数据权限!");
}else{ } else {
String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0); String permissionOrgCode = stdUserEmpower.getAmosOrgCode().get(0);
Map<String,String> companyInfo= userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode); Map<String, String> companyInfo = userEmpowerMapper.getCompanyInfoByOrgCode(permissionOrgCode);
companyLevel = companyInfo.get("level").toString(); companyLevel = companyInfo.get("level").toString();
} }
StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr); StationBasic stationBasic = stationBasicMapper.selectById(sequenceNbr);
List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class); List<Integer> integers = JSON.parseArray(stationBasic.getBelongArea(), Integer.class);
...@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -350,11 +351,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
gfzTreeDto.setChildren(gfz); gfzTreeDto.setChildren(gfz);
List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto); List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto);
treeDto.setChildren(treeDtos); treeDto.setChildren(treeDtos);
if(companyLevel.equals("station")){ if (companyLevel.equals("station")) {
List<TreeDto> children = stationListByRegionCode.stream().filter(t->t.getCode().equals(sequenceNbr)).collect(Collectors.toList()); List<TreeDto> children = stationListByRegionCode.stream().filter(t -> t.getCode().equals(sequenceNbr))
if(stationBasic.getStationType().equals("FDZ")){ .collect(Collectors.toList());
treeDto = fdzTreeDto; if (stationBasic.getStationType().equals("FDZ")) {
}else { treeDto = fdzTreeDto;
} else {
treeDto = gfzTreeDto; treeDto = gfzTreeDto;
} }
treeDto.setChildren(children); treeDto.setChildren(children);
...@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -372,8 +374,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
return new ArrayList<ESEquipmentsDTO>(); return new ArrayList<ESEquipmentsDTO>();
} }
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态",
Arrays.asList("风机状态", "有功功率", "发电状态", "报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态","30秒平均风速")); "停机状态", "故障状态", "待机状态", "维护状态", "发电机转速", "正常发电状态", "30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
...@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator { ...@@ -2398,6 +2400,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Override @Override
public Map<String, Object> partofWaring3D(String stationId, String equipNum) { public Map<String, Object> partofWaring3D(String stationId, String equipNum) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
if (stationId == null || equipNum == null || "null".equals(stationId) || "equipNum".equals(equipNum)) {
return resultMap;
}
StationBasic stationBasic = stationBasicMapper.selectById(stationId); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
......
...@@ -149,13 +149,19 @@ public class MonitoringServiceImpl { ...@@ -149,13 +149,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")); if(result!=null)
} else if(stationCacheInfoDto.getStationType().contains("GFDZ")){ {
speendOrirradiate = String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"));
}
}else if(stationCacheInfoDto.getStationType().contains("GFDZ")){
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { }else {
speendOrirradiate="0.00"; speendOrirradiate="0.00";
} }
...@@ -246,16 +252,22 @@ public class MonitoringServiceImpl { ...@@ -246,16 +252,22 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速", "日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"))); if(result!=null)
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, (commonServiceImpl.getSumByEquipmentIndxName(result1, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")))); {
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速")));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")));
fdzannualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"))); annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")));
fdzInstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity())); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
...@@ -265,15 +277,21 @@ public class MonitoringServiceImpl { ...@@ -265,15 +277,21 @@ public class MonitoringServiceImpl {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, null); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, null);
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
completionOfPowerIndicatorsDto.setWindSpeedOrIrradiance(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "WTX-801_25_WTX-801_总辐射"))); if(result!=null)
completionOfPowerIndicatorsDto.setActivePower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result1, "南瑞光差保护_313P") * CommonConstans.kwToMv)); {
completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); completionOfPowerIndicatorsDto.setDailyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); completionOfPowerIndicatorsDto.setMonthlyPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); completionOfPowerIndicatorsDto.setAnnualPower(String.format(CommonConstans.Fourdecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)));
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)));
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear))); annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)));
gfzannualPower.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())); gfzinstallCapacity.updateAndGet(v -> v + Double.parseDouble(stationCacheInfoDto.getInstalledCapacity()));
} }
} catch (Exception exception) { } catch (Exception exception) {
...@@ -533,17 +551,20 @@ public class MonitoringServiceImpl { ...@@ -533,17 +551,20 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("30秒平均风速"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
homeMapStationInfoDto.setSpeendOrirradiate(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getAvagerByEquipmentIndxName(result, "30秒平均风速"))); if(result!=null)
//homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(result, "有功功率"))); {
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<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
if(esEquipmentsList!=null)
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"))); {
homeMapStationInfoDto.setCurrentPower(String.format(CommonConstans.Twodecimalplaces, commonServiceImpl.getSumByEquipmentIndxName(esEquipmentsList, "220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")));
}
} else { } else {
// Map<String, List<String>> queryCondtion = new HashMap<>(); // Map<String, List<String>> queryCondtion = new HashMap<>();
// queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率")); // queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率"));
...@@ -559,14 +580,19 @@ public class MonitoringServiceImpl { ...@@ -559,14 +580,19 @@ public class MonitoringServiceImpl {
queryCondtion2.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion2.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion2.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P")); queryCondtion2.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion2, null, ESEquipments.class); 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<>(); Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("WTX-801_25_WTX-801_总辐射"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result1 = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); 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); StationCoordinate stationCoordinate = stationCoordinateList.stream().filter(stationCoordinate1 -> stationCoordinate1.getStationId().equals(stationBasic.getSequenceNbr())).collect(Collectors.toList()).get(0);
//获取场站经纬度 //获取场站经纬度
...@@ -604,13 +630,19 @@ public class MonitoringServiceImpl { ...@@ -604,13 +630,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorDay)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorDay));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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) { } catch (Exception e) {
...@@ -646,13 +678,19 @@ public class MonitoringServiceImpl { ...@@ -646,13 +678,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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; Double finalTotal = total1;
total.updateAndGet(v -> v + finalTotal); total.updateAndGet(v -> v + finalTotal);
...@@ -678,13 +716,19 @@ public class MonitoringServiceImpl { ...@@ -678,13 +716,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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; Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal); monthlyPower.updateAndGet(v -> v + finalTotal);
...@@ -719,17 +763,23 @@ public class MonitoringServiceImpl { ...@@ -719,17 +763,23 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"))); if(result!=null)
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"))); {
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(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, "年发电量")));
}
} else { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
dailyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay))); if(result!=null)
monthlyPower.updateAndGet(v -> v + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth))); {
annualPower.updateAndGet(v -> v + keepFourdecimalPlaces(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)));
}
} }
}); });
HashMap<String, String> dayHashMap = new HashMap<>(); HashMap<String, String> dayHashMap = new HashMap<>();
...@@ -781,13 +831,19 @@ public class MonitoringServiceImpl { ...@@ -781,13 +831,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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; Double finalTotal = total;
monthlyPower.updateAndGet(v -> v + finalTotal); monthlyPower.updateAndGet(v -> v + finalTotal);
...@@ -823,15 +879,28 @@ public class MonitoringServiceImpl { ...@@ -823,15 +879,28 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorMonth)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorMonth));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(finalIndicator));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationCacheInfoDto.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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()); List<StationCacheInfoDto> sorted = stationCacheInfoDtoList.stream().sorted(Comparator.comparing(StationCacheInfoDto::getAddress, Comparator.comparingDouble(Double::parseDouble)).reversed()).collect(Collectors.toList());
sorted.forEach(stationBasic -> { sorted.forEach(stationBasic -> {
...@@ -893,14 +962,19 @@ public class MonitoringServiceImpl { ...@@ -893,14 +962,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get())); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get())); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(indicator.get()));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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())); stationBasic.setAddress(String.format(CommonConstans.Twodecimalplaces, (total * 10) / gfInstall.doubleValue()));
if (stationBasic.getAddress().equals("NaN")) { if (stationBasic.getAddress().equals("NaN")) {
...@@ -1011,9 +1085,12 @@ public class MonitoringServiceImpl { ...@@ -1011,9 +1085,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("日发电量", "月发电量", "年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayFD = powerOfDayFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量")); if(result!=null)
powerOfMonthFD = powerOfMonthFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量")); {
powerOfAnnualFD = powerOfAnnualFD + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量")); 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++) { for (int i = 0; i < gfList.size(); i++) {
StationBasic stationBasic = gfList.get(i); StationBasic stationBasic = gfList.get(i);
...@@ -1021,10 +1098,12 @@ public class MonitoringServiceImpl { ...@@ -1021,10 +1098,12 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, CommonConstans.taiHeGenIndicator);
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
powerOfDayGF = powerOfDayGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorDay)); if(result!=null)
powerOfMonthGF = powerOfMonthGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorMonth)); {
powerOfAnnualGF = powerOfAnnualGF + keepFourdecimalPlaces(commonServiceImpl.getSumByEquipmentIndxName(result, CommonConstans.taiHeGenIndicatorYear)); 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<>(); HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF)); stringHashMap4.put("title", String.format(CommonConstans.Fourdecimalplaces, powerOfDayFD) + "/" + String.format(CommonConstans.Fourdecimalplaces, powerOfDayGF));
...@@ -1093,14 +1172,19 @@ public class MonitoringServiceImpl { ...@@ -1093,14 +1172,19 @@ public class MonitoringServiceImpl {
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("年发电量")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
Map<String, List<String>> queryCondtion = new HashMap<>(); Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear)); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(CommonConstans.taiHeGenIndicatorYear));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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()); List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
...@@ -1314,18 +1398,22 @@ public class MonitoringServiceImpl { ...@@ -1314,18 +1398,22 @@ public class MonitoringServiceImpl {
stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id")); stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
} }
stationBasicListAll.forEach(stationBasic -> { stationBasicListAll.forEach(stationBasic -> {
if (stationBasic.getStationType().equals("FDZ")) { if (stationBasic.getStationType().equals("FDZ")) {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值")); queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("220kV夏雩线212线路测控装置PCS-9705TA有功功率一次值"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class); 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 { } else {
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId())); queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getBoosterGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P")); queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("南瑞光差保护_313P"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class); 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 ...@@ -166,12 +166,12 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
i.setValue("分"); i.setValue("分");
} }
i.setStationName("升压站"); i.setStationName("升压站");
long mills = i.getCreatedTime() ; long mills = i.getCreatedTime()/ 1000000 ;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime()); String time = sdf.format(car.getTime());
if (time.contains("1970")) { if (time.contains("1970-")) {
mills = i.getCreatedTime()/ 1000000; mills = i.getCreatedTime();
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
time = sdf.format(car.getTime()); time = sdf.format(car.getTime());
} }
......
...@@ -64,12 +64,12 @@ public class EquipAlarmEventServiceImpl ...@@ -64,12 +64,12 @@ public class EquipAlarmEventServiceImpl
} else if ("false".equals(i.getValue())) { } else if ("false".equals(i.getValue())) {
i.setValue("分"); i.setValue("分");
} }
long mills = i.getCreatedTime() ; long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
// System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
String time = sdf.format(car.getTime()); String time = sdf.format(car.getTime());
if (time.contains("1970")) { if (time.contains("1970-")) {
mills = i.getCreatedTime()/ 1000000; mills = i.getCreatedTime();
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
time = sdf.format(car.getTime()); 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