Commit 8c66a79b authored by chenzhao's avatar chenzhao

Merge branch 'developer' into developer_bw

# Conflicts: # amos-boot-system-jxiop/amos-boot-module-hygf-api/src/main/java/com/yeejoin/amos/boot/module/hygf/api/dto/BasicGridAcceptanceDto.java # amos-boot-system-jxiop/amos-boot-module-hygf-biz/src/main/java/com/yeejoin/amos/boot/module/hygf/biz/controller/WorkOrderController.java
parents 78917e80 13501e0c
......@@ -74,4 +74,7 @@ public class BasicGridAcceptanceDto extends BaseDto {
private Long fonGridId;
// 电站安装规模(kW)
private String scale;
}
......@@ -158,6 +158,12 @@ public class HygfIcbcRecordDTO {
* */
@ApiModelProperty(value = "区域公司名称")
private String regionalCompaniesName;
/*
* 商务信息-电站安装规模
* */
@ApiModelProperty(value = "电站安装规模(kW)")
private String scale;
}
}
\ No newline at end of file
......@@ -94,4 +94,7 @@ public class PowerStationDto extends BaseDto {
@ApiModelProperty(value = "合同状态")
private String status;
@ApiModelProperty(value = "电站安装规模")
private String scale;
}
......@@ -83,4 +83,7 @@ public class WorkOrderPage {
private String auditIdea ;
@ApiModelProperty(value = "实例id")
private String instanceId ;
@ApiModelProperty(value = "电站安装规模")
private String scale ;
}
......@@ -257,4 +257,7 @@ public class HouseholdContract extends BaseEntity {
//查询一个农户拥有的合同是否全是已废弃
@TableField(exist = false)
private Boolean isAllDisuse;
@TableField(exist = false)
private String scale;
}
......@@ -215,4 +215,10 @@ public class PeasantHousehold extends BaseEntity {
*/
@TableField(exist = false)
private Integer isAllRevoke;
/**
* 商务信息安装规模
*/
@TableField(exist = false)
private String scale;
}
......@@ -19,4 +19,6 @@ public interface HouseholdContractMapper extends BaseMapper<HouseholdContract> {
@UserEmpower(field ={"hygf_household_contract.regional_companies_code"} ,dealerField={"dealer_code","hygf_household_contract.regional_companies_code","developer_user_id"} ,fieldConditions ={"eq","in","eq"} ,relationship="and")
IPage<HouseholdContract> selectPage(@Param("dto") HouseholdContractPageDto dto);
String getHygfCommercialScale(String peasantHouseholdNumber);
}
......@@ -50,4 +50,6 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
void deleteHphByNo(String peasantHouseholdNo);
void deleteHhcByNo(String peasantHouseholdNo);
String getHygfCommercialScale(Long surveyInformationId);
}
......@@ -53,4 +53,10 @@
ORDER BY hygf_household_contract.rec_date DESC, hygf_household_contract.${orderBy} ${dto.isAsc}
</if>
</select>
<select id="getHygfCommercialScale" resultType="String">
select scale from hygf_commercial where survey_information_id = (select survey_information_id from hygf_peasant_household where peasant_household_no = #{peasantHouseholdNumber} )
</select>
</mapper>
......@@ -133,4 +133,8 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
<select id="deleteHhcByNo">
DELETE FROM hygf_household_contract WHERE peasant_household_number=#{peasantHouseholdNo}
</select>
<select id="getHygfCommercialScale" resultType="String">
select scale from hygf_commercial where survey_information_id=${surveyInformationId}
</select>
</mapper>
......@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.HygfReplenishment;
import com.yeejoin.amos.boot.module.hygf.api.entity.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney;
import com.yeejoin.amos.boot.module.hygf.api.mapper.DocumentStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PreparationMoneyMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
......@@ -54,6 +55,8 @@ public class PreparationMoneyController extends BaseController {
@Autowired
PreparationMoneyMapper preparationMoneyMapper;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
DesignInformationServiceImpl designInformationService;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
......@@ -226,6 +229,16 @@ public class PreparationMoneyController extends BaseController {
) {
List<PeasantHousehold> list=preparationMoneyMapper.getPeasantHouseholdData(sequenceNbr,ownersName);
if(list != null && list.size() > 0) {
list.forEach(e -> {
if(e.getPeasantHouseholdNo() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
}
});
}
Page<PeasantHousehold> pagenew = new Page<>();
pagenew.setRecords(list);
pagenew.setTotal(list.size());
......
......@@ -9,10 +9,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationConstructionDataMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.WorkOrderMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.WorkOrderPowerStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.WorkOrderServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -47,6 +44,8 @@ public class WorkOrderController extends BaseController {
WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired
WorkOrderMapper workOrderMapper;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
......@@ -225,6 +224,8 @@ public class WorkOrderController extends BaseController {
if (workOrder.getType().equals("3") && workOrderPowerStationNodes != null){
workOrderPagePage.getRecords().forEach(e->{
if (workOrderPowerStationNodes.contains(e.getWorkOrderPowerStationNode()) && (roleIds.contains(areaId) ||roleIds.contains(designId) || roleIds.contains(engineeringId)) ){
if (workOrderPowerStationNodes.contains(e.getWorkOrderPowerStationNode())){
e.setIsAudit("0");
}
else {
......@@ -233,6 +234,12 @@ public class WorkOrderController extends BaseController {
});
}
workOrderPagePage.getRecords().forEach(e->{
if(e.getPeasantHouseholdNo() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
}
});
return ResponseHelper.buildResponse(workOrderPagePage);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -70,6 +70,8 @@ public class BasicGridAcceptanceServiceImpl
@Autowired
PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
private CommonServiceImpl commonService;
@Autowired
RectificationOrderAuditingServiceImpl rectificationOrderAuditingService;
......@@ -112,6 +114,15 @@ public class BasicGridAcceptanceServiceImpl
pageNew.setCurrent(current);
pageNew.setTotal(page.getTotal());
pageNew.setSize(size);
if(page.getList() != null && page.getList().size() > 0) {
page.getList().forEach(e -> {
if(e.getPeasantHouseholdNo() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
}
});
}
pageNew.setRecords(page.getList());
return pageNew;
}
......
......@@ -93,6 +93,16 @@ public class HouseholdContractServiceImpl extends BaseService<HouseholdContractD
// }
IPage<HouseholdContract> warningQuestionInfoIPage = householdContractMapper.selectPage(dto);
if(warningQuestionInfoIPage.getRecords() != null && warningQuestionInfoIPage.getRecords().size() > 0) {
warningQuestionInfoIPage.getRecords().forEach(e -> {
if(e.getPeasantHouseholdNumber() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNumber()));
}
});
}
return warningQuestionInfoIPage;
}
......
......@@ -22,6 +22,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -62,6 +64,9 @@ import lombok.extern.slf4j.Slf4j;
@Service
@Slf4j
public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbcRecord, HygfIcbcRecordMapper>
implements IHygfIcbcService {
private static final String trxChannel = "05"; // 05表示小程序
......@@ -126,6 +131,9 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
@Resource(type = HygfIcbcRecordMapper.class)
private HygfIcbcRecordMapper hygfIcbcRecordMapper;
@Resource(type = HouseholdContractMapper.class)
private HouseholdContractMapper householdContractMapper;
@Resource(type = HygfIcbcRequestMapper.class)
private HygfIcbcRequestMapper hygfIcbcRequestMapper;
......@@ -411,6 +419,15 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
Map<String, List<PeasantHousehold>> peasantHouseholdMap = peasantHouseholds.stream()
.collect(Collectors.groupingBy(PeasantHousehold::getAmosUserId));// 根据农户 ID 分组
List<PeasantHousehold> peasantHouseholdList = peasantHouseholdMap.get(amosUserId);
if(peasantHouseholdList != null && peasantHouseholdList.size() > 0) {
peasantHouseholdList.forEach(e -> {
if(e.getSurveyInformationId() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
}
});
}
hygfIcbcRecordDTO.setPeasantHouseholds(
Bean.toModels(peasantHouseholdList, HygfIcbcRecordDTO.IcbcPeasantHousehold.class));
return hygfIcbcRecordDTO;
......
......@@ -271,6 +271,16 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
pagenew.setCurrent(current);
pagenew.setTotal(objectPageInfo.getTotal());
pagenew.setSize(size);
if(newRecords != null && newRecords.size() > 0) {
newRecords.forEach(e -> {
if(e.getSurveyInformationId() != null) {
e.setScale(peasantHouseholdMapper.getHygfCommercialScale(e.getSurveyInformationId()));
}
});
}
pagenew.setRecords(newRecords);
return pagenew;
......@@ -914,6 +924,18 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getRegionalCompaniesName()),"regional_companies_name", "%"+peasantHouseholdPageDto.getRegionalCompaniesName()+"%");
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getDeveloperName()),"developer_name", "%"+peasantHouseholdPageDto.getDeveloperName()+"%");
queryWrapper.orderByDesc("rec_date");
return this.baseMapper.selectPage(new Page<>(peasantHouseholdPageDto.getCurrent(),peasantHouseholdPageDto.getSize()),queryWrapper);
IPage<PeasantHousehold> peasantHouseholdIPage = this.baseMapper.selectPage(new Page<>(peasantHouseholdPageDto.getCurrent(), peasantHouseholdPageDto.getSize()), queryWrapper);
if(peasantHouseholdIPage.getRecords() != null && peasantHouseholdIPage.getRecords().size() > 0) {
peasantHouseholdIPage.getRecords().forEach(e -> {
if(e.getSurveyInformationId() != null) {
e.setScale(peasantHouseholdMapper.getHygfCommercialScale(e.getSurveyInformationId()));
}
});
}
return peasantHouseholdIPage;
}
}
\ No newline at end of file
......@@ -118,8 +118,21 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
// return
// this.queryForPowerStationPage(page,powerStationCode,ownersName,serviceAgent);
return this.queryPage((int) page.getCurrent(), (int) page.getSize(), powerStationCode, ownersName,
serviceAgent,regionalCompaniesName,processStatus);
Page<PowerStationDto> powerStationDtoPage = this.queryPage((int) page.getCurrent(), (int) page.getSize(), powerStationCode, ownersName,
serviceAgent, regionalCompaniesName, processStatus);
if(powerStationDtoPage.getRecords() != null && powerStationDtoPage.getRecords().size() > 0) {
powerStationDtoPage.getRecords().forEach(e -> {
if(e.getPowerStationCode() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPowerStationCode()));
}
});
}
return powerStationDtoPage;
}
// 查询电站审核记录
......
......@@ -101,7 +101,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired
PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
HygfOnGridMapper hygfOnGridMapper;
@Autowired
......@@ -279,6 +280,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
for (PeasantHousehold documentStation : lih) {
ids.add(documentStation.getSequenceNbr());
}
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.in("peasant_household_id", ids);
List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper);
......@@ -306,6 +310,13 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
}
}
List<PeasantHousehold> list = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null);
if(list != null && list.size() > 0) {
list.forEach(e -> {
if(e.getPeasantHouseholdNo() != null) {
e.setScale(householdContractMapper.getHygfCommercialScale(e.getPeasantHouseholdNo()));
}
});
}
Map<String, Object> map = new HashMap<>();
designInformation.setAssembly(assembly);
designInformation.setInverter(inverter);
......
......@@ -724,7 +724,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@RequestParam(value = "stationId", required = true) String stationId,
@RequestParam(value = "tableName2", required = false) String tableName2) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName, stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName, stationBasic.getFanGatewayId());
int num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(), tableName2,stationBasic.getBoosterGatewayId());
......@@ -742,7 +742,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@RequestParam(value = "stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName, stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName, stationBasic.getFanGatewayId());
FeignClientResult<List<String>> sevenEntityMcb = null;
try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
......
......@@ -334,6 +334,7 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
LambdaQueryWrapper<PvHealthIndex> pvwrapper = new LambdaQueryWrapper<PvHealthIndex>();
pvwrapper.eq(PvHealthIndex::getAnalysisObjType, "场站").and(
qw->qw.eq(PvHealthIndex::getGatewayId, fanGatewayId).or().eq(PvHealthIndex::getGatewayId, syzGatewayId));
pvwrapper.eq(PvHealthIndex::getAnalysisType, "按10分钟");
pvwrapper.orderByDesc(PvHealthIndex::getTs);
pvwrapper.last("limit 15");
List<PvHealthIndex> pvHealthIndexList = pvHealthIndexMapper.selectList(pvwrapper);
......@@ -771,8 +772,25 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@ApiOperation(value = "风站 左侧风机信息列表")
@GetMapping("/getFanInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getFanInfoByPage(
@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(fanInfoByPage(stationId));
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName) {
Page<Map<String, Object>> mapPage = fanInfoByPage(stationId);
if(StrUtil.isNotEmpty(equipmentName)){
List<Map<String, Object>> records = mapPage.getRecords();
if(CollectionUtil.isNotEmpty(records)){
for (Map<String, Object> record : records) {
String equipmentNameSimple =(String) record.get("equipmentNameSimple");
Map<String, Object> subSystemInfo = subSystemInfo(equipmentNameSimple, String.valueOf(stationId));
List axisData = (List)subSystemInfo.get("axisData");
if(CollectionUtil.isNotEmpty(axisData)){
String subSystemDefault = (String) axisData.get(0);
record.put("subSystemDefault",subSystemDefault);
}
}
}
}
return ResponseHelper.buildResponse(mapPage);
}
private Page<Map<String, Object>> fanInfoByPage(String stationId) {
......@@ -914,6 +932,10 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
item.put("healthIndex", equipmentHealthScore);
});
pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString()));
for (int i = 0; i < pointNameList.size(); i++) {
Map<String, Object> stringObjectMap = pointNameList.get(i);
stringObjectMap.put("index",i);
}
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
......@@ -926,8 +948,22 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@ApiOperation(value = "光伏 左侧风机信息列表")
@GetMapping("/getPvInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getPvInfoByPage(
@RequestParam(value = "stationId", required = false) String stationId) {
return ResponseHelper.buildResponse(pvInfoByPage(stationId));
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "subarray", required = false) String subarray) {
Page<Map<String, Object>> mapPage = pvInfoByPage(stationId);
if(StrUtil.isNotEmpty(subarray)){
List<Map<String, Object>> records = mapPage.getRecords();
if(CollectionUtil.isNotEmpty(records)){
for (Map<String, Object> record : records) {
Map<String, Object> subSystemInfo = pvSubSystemInfo((String)record.get("subarray"), String.valueOf(stationId));
List axisData = (List)subSystemInfo.get("axisData");
if(CollectionUtil.isNotEmpty(axisData)) {
record.put("subarrayDefault",axisData.get(0));
}
}
}
}
return ResponseHelper.buildResponse(mapPage);
}
private Page<Map<String, Object>> pvInfoByPage(String stationId) {
......@@ -1052,6 +1088,10 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
item.put("healthIndex", equipmentHealthScore);
});
pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString()));
for (int i = 0; i < pointNameList.size(); i++) {
Map<String, Object> stringObjectMap = pointNameList.get(i);
stringObjectMap.put("index",i);
}
Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size());
......@@ -1112,10 +1152,31 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId", required = true) String stationId,
@RequestParam(value = "tableName2", required = false) String tableName2) {
@RequestParam(value = "tableName2", required = false) String tableName2,
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "index", required = false) String index,
@RequestParam(value = "flag",required = false)String flag) {
String nameByIndexAddress="";
Page<Map<String, Object>> mapPage= null;
if("PV".equals(flag)){
//为了页面联动效果
mapPage = pvSubSystemPointInfo(equipmentName, stationId);
}else if("FAN".equals(flag)){
mapPage = subSystemPointInfo(subSystem, stationId, equipmentName);
}
List<Map<String, Object>> records = mapPage.getRecords();
if(CollectionUtil.isNotEmpty(records) && StrUtil.isNotEmpty(index)){
for (Map<String, Object> record : records) {
if(index.equals(String.valueOf(record.get("index")))){
indexAddress=(String) record.get("indexAddress");
nameByIndexAddress = (String) record.get("pointName");
}
}
}
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName,
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
// String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName,
// stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
int num = 0;
if (StringUtils.isNotEmpty(tableName2)) {
num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(),
......@@ -1134,11 +1195,17 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
public ResponseModel<Map<String, String>> getRiskHandleByVarDesc(
@RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId") String stationId) {
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
if(equipmentName.contains("升压站")){
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
stationBasic.getBoosterGatewayId());
}else {
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId());
}
FeignClientResult<List<String>> sevenEntityMcb = null;
try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
......@@ -1643,20 +1710,68 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
return ResponseHelper.buildResponse(map);
}
/**
* 获取风电IndexAddress
* @param subSystem
* @param stationId
* @param equipmentName
* @return
*/
private String getFanIndexAddress(String subSystem,String stationId,String equipmentName,String index, String indexAddress){
//为了页面联动效果
Page<Map<String, Object>> mapPage = subSystemPointInfo(subSystem, stationId, equipmentName);
List<Map<String, Object>> records = mapPage.getRecords();
if(CollectionUtil.isNotEmpty(records) && StrUtil.isNotEmpty(index)){
for (Map<String, Object> record : records) {
if(index.equals(String.valueOf(record.get("index")))){
indexAddress = (String) record.get("indexAddress");
}
}
}
return indexAddress;
}
/**
* 获取光伏IndexAddress
* @param stationId
* @param equipmentName
* @return
*/
private String getPvIndexAddress(String stationId,String equipmentName,String index, String indexAddress){
//为了页面联动效果
Page<Map<String, Object>> mapPage = pvSubSystemPointInfo(equipmentName, stationId);
List<Map<String, Object>> records = mapPage.getRecords();
if(CollectionUtil.isNotEmpty(records) && StrUtil.isNotEmpty(index)){
for (Map<String, Object> record : records) {
if(index.equals(String.valueOf(record.get("index")))){
indexAddress = (String) record.get("indexAddress");
}
}
}
return indexAddress;
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddressBy1118")
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118(
@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) {
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "index", required = false) String index) {
indexAddress= getFanIndexAddress(subSystem,stationId,equipmentName,index,indexAddress);
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
LambdaQueryWrapper<FanHealthIndex> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(FanHealthIndex::getIndexAddress, indexAddress).and(
qw->qw.eq(FanHealthIndex::getGatewayId, stationBasic.getFanGatewayId()).or().eq(FanHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId()));
lambdaQueryWrapper.eq(FanHealthIndex::getIndexAddress, indexAddress);
if(equipmentName.contains("升压站")){
lambdaQueryWrapper.eq(FanHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId());
}else {
lambdaQueryWrapper.eq(FanHealthIndex::getGatewayId, stationBasic.getFanGatewayId());
}
lambdaQueryWrapper.eq(FanHealthIndex::getAnalysisObjType, "测点");
lambdaQueryWrapper.orderByDesc(FanHealthIndex::getTs);
lambdaQueryWrapper.eq(FanHealthIndex::getAnalysisType, "按10分钟");
lambdaQueryWrapper.last("limit 15");
......@@ -1692,13 +1807,20 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@GetMapping("/getTrendInfoByAddressBy1118Pv")
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118Pv(
@RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "stationId", required = false) String stationId) {
@RequestParam(value = "stationId", required = false) String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "index", required = false) String index) {
indexAddress = getPvIndexAddress(stationId,equipmentName,index,indexAddress);
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
LambdaQueryWrapper<PvHealthIndex> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvHealthIndex::getIndexAddress, indexAddress).and(
qw->qw.eq(PvHealthIndex::getGatewayId, stationBasic.getFanGatewayId()).or().eq(PvHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId()));
lambdaQueryWrapper.eq(PvHealthIndex::getIndexAddress, indexAddress);
if(equipmentName.contains("升压站")){
lambdaQueryWrapper.eq(PvHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId());
}else {
lambdaQueryWrapper.eq(PvHealthIndex::getGatewayId, stationBasic.getFanGatewayId());
}
lambdaQueryWrapper.eq(PvHealthIndex::getAnalysisObjType, "测点");
lambdaQueryWrapper.orderByDesc(PvHealthIndex::getTs);
lambdaQueryWrapper.eq(PvHealthIndex::getAnalysisType, "按10分钟");
......@@ -1736,11 +1858,24 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
public ResponseModel<Map<String, String>> getRiskHandleByVarDescBy1118(
@RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId") String stationId) {
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "subSystem", required = false) String subSystem,
@RequestParam(value = "index", required = false) String index) {
varDesc= getFanIndexAddress(subSystem,stationId,equipmentName,index,varDesc);
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddress(stationBasic.getFanGatewayId(), varDesc,stationBasic.getBoosterGatewayId());
Map<String, Object> healthIndexMap = null;
if(equipmentName.contains("升压站")){
healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddress(stationBasic.getBoosterGatewayId(), varDesc);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getBoosterGatewayId());
}else {
healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddress(stationBasic.getFanGatewayId(), varDesc);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId());
}
if (ObjectUtils.isEmpty(healthIndexMap)) {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("content", "正常运行");
......@@ -1757,9 +1892,6 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
stringStringHashMap.put("content", "正常运行");
return ResponseHelper.buildResponse(stringStringHashMap);
}
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
FeignClientResult<List<String>> sevenEntityMcb = null;
try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
......@@ -1787,11 +1919,23 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
public ResponseModel<Map<String, String>> getRiskHandleByVarDescBy1118Pv(
@RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId") String stationId) {
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "equipmentName", required = false) String equipmentName,
@RequestParam(value = "index", required = false) String index) {
varDesc= getPvIndexAddress(stationId,equipmentName,index,varDesc);
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddressPv(stationBasic.getFanGatewayId(), varDesc,stationBasic.getBoosterGatewayId());
Map<String, Object> healthIndexMap = null;
if(equipmentName.contains("升压站")){
healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddressPv(stationBasic.getBoosterGatewayId(), varDesc);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getBoosterGatewayId());
}else {
healthIndexMap = idxBizFanHealthIndexMapper
.getHealthIndexByIndexAddressPv(stationBasic.getFanGatewayId(), varDesc);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId());
}
if (ObjectUtils.isEmpty(healthIndexMap)) {
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("content", "正常运行");
......@@ -1808,9 +1952,6 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
stringStringHashMap.put("content", "正常运行");
return ResponseHelper.buildResponse(stringStringHashMap);
}
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
FeignClientResult<List<String>> sevenEntityMcb = null;
try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
......
......@@ -101,7 +101,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
@Param("equipmentName") String equipmentName,@Param("syzGatewayId") String syzGatewayId);
String getPointNameByIndexAddress(@Param("varDesc") String varDesc, @Param("tableName") String tableName,
@Param("gatewayId") String gatewayId,@Param("syzGatewayId") String syzGatewayId);
@Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall(@Param("gatewayIds") List<String> gatewayIds);
......@@ -152,7 +152,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
Map<String, Object> getPvEquipStatusByStation(String station);
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress, @Param("tableName") String tableName,@Param("syzGatewayId") String syzGatewayId);
@Param("indexAddress") String indexAddress, @Param("tableName") String tableName);
List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress, @Param("tableName") String tableName,
......@@ -164,7 +164,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE, String startTimeTop,
String endTimeTop);
Map<String, Object> getHealthIndexByIndexAddress(@Param("gatewayId") String gatewayId, @Param("indexAddress") String indexAddress,@Param("syzGatewayId") String syzGatewayId);
Map<String, Object> getHealthIndexByIndexAddress(@Param("gatewayId") String gatewayId, @Param("indexAddress") String indexAddress);
Map<String, Object> getHealthIndexByIndexAddressPv(@Param("gatewayId") String gatewayId, @Param("indexAddress") String indexAddress,@Param("syzGatewayId") String syzGatewayId);
Map<String, Object> getHealthIndexByIndexAddressPv(@Param("gatewayId") String gatewayId, @Param("indexAddress") String indexAddress);
}
......@@ -62,7 +62,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "5");
idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizFanWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getGatewayId() + o.getIndexAddress() + o.getStation() + o.getAnalysisObjType() + o.getAnalysisObjSeq() + o.getWeight() + o.getArea() + o.getSubSystem() + o.getEquipmentName() + o.getNumber() + o.getPointName() + o.getKks() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
......@@ -120,7 +120,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "5");
idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizFanWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getGatewayId() + o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getSubSystem() + o.getEquipmentName() + o.getNumber() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
......@@ -173,7 +173,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "4");
idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray(), IdxBizFanWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getGatewayId() + o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getNumber() + o.getEquipmentName() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
......@@ -225,7 +225,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "3");
idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName(), IdxBizFanWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
......@@ -276,7 +276,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "2");
idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation(), IdxBizFanWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
......@@ -325,7 +325,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "1");
idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae(), IdxBizFanWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
......@@ -354,11 +354,11 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
public List<HealthIndexDTO> getInfoListByGroupByQy(String startTime, String fanTableName, String pvTableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.getInfoList(startTime, fanTableName, analysisObjectType);
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(new QueryWrapper<IdxBizFanWeight>().eq("type", "2").isNotNull("value"));
Map<String, Float> fanWeightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> "fan" + o.getArae() + o.getStation(), IdxBizFanWeight::getValue));
Map<String, Float> fanWeightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> "fan" + o.getArae() + o.getStation(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoList(startTime, pvTableName, analysisObjectType);
List<IdxBizPvWeight> pvIdxBizFanWeights = idxBizPvWeightMapper.selectList(new QueryWrapper<IdxBizPvWeight>().eq("type", "2").isNotNull("value"));
Map<String, Float> pvWeightMap = pvIdxBizFanWeights.stream().collect(Collectors.toMap(o -> "pv" + o.getArae() + o.getStation(), IdxBizPvWeight::getValue));
Map<String, Float> pvWeightMap = pvIdxBizFanWeights.stream().collect(Collectors.toMap(o -> "pv" + o.getArae() + o.getStation(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
List<HealthIndexDTO> healthIndexDTOS = new ArrayList<>();
healthIndexDTOS.addAll(fanHealthIndices.stream().map(this::toHealthIndexDTO).collect(Collectors.toList()));
......@@ -396,11 +396,11 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
public List<HealthIndexDTO> getInfoListByGroupByQg(String startTime, String fanTableName, String pvTableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.getInfoList(startTime, fanTableName, analysisObjectType);
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(new QueryWrapper<IdxBizFanWeight>().eq("type", "1").isNotNull("value"));
Map<String, Float> fanWeightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> "fan" + o.getArae(), IdxBizFanWeight::getValue));
Map<String, Float> fanWeightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> "fan" + o.getArae(), IdxBizFanWeight::getValue,(item1, item2) -> item1));
List<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoList(startTime, pvTableName, analysisObjectType);
List<IdxBizPvWeight> pvIdxBizFanWeights = idxBizPvWeightMapper.selectList(new QueryWrapper<IdxBizPvWeight>().eq("type", "1").isNotNull("value"));
Map<String, Float> pvWeightMap = pvIdxBizFanWeights.stream().collect(Collectors.toMap(o -> "pv" + o.getArae(), IdxBizPvWeight::getValue));
Map<String, Float> pvWeightMap = pvIdxBizFanWeights.stream().collect(Collectors.toMap(o -> "pv" + o.getArae(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
List<HealthIndexDTO> healthIndexDTOS = new ArrayList<>();
healthIndexDTOS.addAll(fanHealthIndices.stream().map(this::toHealthIndexDTO).collect(Collectors.toList()));
......
......@@ -50,7 +50,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "5");
queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizPvWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getGatewayId() + o.getIndexAddress() + o.getStation() + o.getAnalysisObjType() + o.getAnalysisObjSeq() + o.getWeight() + o.getArea() + o.getSubarray() + o.getManufacturer() + o.getEquipmentName() + o.getPointName() + o.getDeviceType() + o.getKks() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
......@@ -111,7 +111,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "5");
queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizPvWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray() + o.getPointName(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getGatewayId() + o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getSubarray() + o.getOrgCode() + o.getEquipmentName()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
......@@ -165,7 +165,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "4");
queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray(), IdxBizPvWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName() + o.getSubarray(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getGatewayId() + o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getSubarray() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
......@@ -218,7 +218,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "3");
queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName(), IdxBizPvWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation() + o.getEquipmentName(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
......@@ -270,7 +270,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "2");
queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation(), IdxBizPvWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae() + o.getStation(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
......@@ -320,7 +320,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "1");
queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper);
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae(), IdxBizPvWeight::getValue));
Map<String, Float> weightMap = idxBizFanWeights.stream().collect(Collectors.toMap(o -> o.getArae(), IdxBizPvWeight::getValue,(item1, item2) -> item1));
// 开始计算加权平均
Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
......
......@@ -757,7 +757,7 @@ FROM (
select POINT_NAME
from ${tableName}
where INDEX_ADDRESS = #{varDesc}
AND (GATEWAY_ID = #{gatewayId} or GATEWAY_ID = #{syzGatewayId})
AND GATEWAY_ID = #{gatewayId}
limit 1
......@@ -1354,7 +1354,7 @@ FROM (
WHERE
INDEX_ADDRESS = #{indexAddress}
AND DISPOSOTION_STATE = '待确认'
AND (GATEWAY_ID = #{fanGatewayId} or GATEWAY_ID = #{syzGatewayId})
AND GATEWAY_ID = #{fanGatewayId}
ORDER BY
sort DESC,
REC_DATE DESC
......@@ -1770,7 +1770,7 @@ TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
from fan_health_index_latest_data
where
INDEX_ADDRESS = #{indexAddress}
AND (GATEWAY_ID = #{gatewayId} or GATEWAY_ID = #{syzGatewayId})
AND GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按天'
limit 1
......@@ -1782,7 +1782,7 @@ TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
from pv_health_index_latest_data
where
INDEX_ADDRESS = #{indexAddress}
AND (GATEWAY_ID = #{gatewayId} or GATEWAY_ID = #{syzGatewayId})
AND GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按天'
limit 1
......
......@@ -86,6 +86,7 @@ public class Constants {
public static final String get_quota_complate_info="method=scene_screen.large_screen.get_quota_complate_info";
public static final String resovleRule_data = "data";
public static final String areaChinese="区域";
public static final String get_big_screen_point_url="http://iiet-jepcc.powerchina.cn:8088/core/datastorage/gateway/point/list?groupId=1827987484823289857&dataType=analog";
}
......@@ -19,6 +19,10 @@ import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSONArray;
import com.yeejoin.amos.component.robot.AmosRequestContext;
import lombok.extern.slf4j.Slf4j;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.Aggregations;
......@@ -26,9 +30,11 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.metrics.ParsedAvg;
import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper;
import com.alibaba.fastjson.JSON;
......@@ -50,6 +56,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/**
* @description:
......@@ -58,6 +65,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil;
*/
@Service
//@RequiredArgsConstructor
@Slf4j
public class LargeScreenImpl {
@Autowired
CommonServiceImpl commonServiceImpl;
......@@ -75,6 +83,10 @@ public class LargeScreenImpl {
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired
private HttpRequestUtil httpRequestUtil;
@Autowired
AmosRequestContext amosRequestContext;
@Autowired
RestTemplate restTemplate;
private final String SS = "瞬时风速";
private final String ZFS = "WTX-801_25_WTX-801_总辐射";
......@@ -149,10 +161,13 @@ public class LargeScreenImpl {
// Constants.REQUEST_GET, "", Constants.resovleRule_data);
// }
mapdta.put("SS", data.getDouble("average_wind_speed"));
mapdta.put("ZFS", data.getDouble("avg_irradiance"));
mapdta.put("ZFSLJ", data.getDouble("sum_irradiance"));
// mapdta.put("ZFS", data.getDouble("avg_irradiance"));
// mapdta.put("ZFSLJ", data.getDouble("sum_irradiance"));
}
//平均辐照度和利用小时数采用合成测点的值
Map<String, Double> pointValue = getPointValue();
mapdta.put("ZFS", pointValue.get("ZFS"));
mapdta.put("ZFSLJ", pointValue.get("ZFSLJ"));
// //日发电量
// AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
// //月发电量
......@@ -242,7 +257,62 @@ public class LargeScreenImpl {
return mapdta;
}
/**
* 获取平均辐照度和利用小时数
* @return
*/
private Map<String,Double> getPointValue() {
Map<String,Double> resultMap=new HashMap();
JSONObject jsonObject = sendCoreGetRequest(Constants.get_big_screen_point_url);
if (!Objects.isNull(jsonObject)) {
if (jsonObject.getInteger("status") == HttpStatus.OK.value()) {
JSONArray resultJsonArray = jsonObject.getJSONArray("result");
if (CollectionUtil.isNotEmpty(resultJsonArray)) {
for (Object o : resultJsonArray) {
if (o instanceof Map) {
Map map = (Map) o;
JSONObject result = new JSONObject(map);
String pointName = (String) map.get("pointName");
if ("大屏监控平均辐照度".equals(pointName)) {
resultMap.put("ZFS",result.getDouble("value"));
}
if ("大屏监控利用小时数".equals(pointName)) {
resultMap.put("ZFSLJ",result.getDouble("value"));
}
}
}
}
}
}
return resultMap;
}
/**
* 发送GET请求
* @param url
* @return
*/
private JSONObject sendCoreGetRequest(String url) {
HttpHeaders headers = new HttpHeaders();
headers.set("Token", amosRequestContext.getToken());
headers.set("Product", amosRequestContext.getProduct());
headers.set("Appkey", amosRequestContext.getAppKey());
HttpEntity entity = new HttpEntity<>(headers);
log.info("发送GET请求,请求地址{}", url);
try {
ResponseEntity<JSONObject> response = restTemplate.exchange(url, HttpMethod.GET, entity, JSONObject.class);
if (HttpStatus.OK == response.getStatusCode()) {
log.info("发送请求成功,请求返回体{}", response.getBody());
return response.getBody();
} else {
throw new BadRequest("返回接口异常,失败原因[" + response + "]");
}
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new BadRequest("发送GET请求失败,失败原因[" + e.getMessage() + "]");
}
}
@Scheduled(cron = "0/10 * * * * ?")
//@PostConstruct
private void sendQYYXZBMqtt() {
......@@ -440,8 +510,11 @@ public class LargeScreenImpl {
// "", Constants.resovleRule_data);
// }
mapdta.put("SS", data.getString("average_wind_speed"));
mapdta.put("ZFS", data.getString("avg_irradiance"));
mapdta.put("ZFSLJ", data.getString("sum_irradiance"));
// mapdta.put("ZFS", data.getString("avg_irradiance"));
// mapdta.put("ZFSLJ", data.getString("sum_irradiance"));
Map<String, Double> pointValue = getPointValue();
mapdta.put("ZFS", String.valueOf(pointValue.get("ZFS")));
mapdta.put("ZFSLJ", String.valueOf(pointValue.get("ZFSLJ")));
try {
System.out.println(JSON.toJSONString(mapdta));
......@@ -458,7 +531,7 @@ public class LargeScreenImpl {
}
// 全国发电趋势
@Scheduled(cron = "0/10 * * * * ? ")
// @Scheduled(cron = "0/10 * * * * ? ")
public SeriesData getSeriesDataqg() {
// 获取今年当月 日发电趋势
......@@ -634,7 +707,7 @@ public class LargeScreenImpl {
}
//全国月发电量趋势
//全国月发电量趋势
@Scheduled(cron = "0/10 * * * * ?")
public Map<String, Object> gettimedateyfd() {
......
......@@ -610,7 +610,7 @@ public class MonitorServiceImpl implements MonitorService {
// }
// return mapdta;
// }
@Scheduled(cron = "0/10 * * * * ?")
// @Scheduled(cron = "0/10 * * * * ?")
private void sendQYYXZBMqtt() {
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
List<StationCacheInfoDto> stationCacheInfoDtoList = getListStationCacheInfoDto();
......
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