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 { ...@@ -74,4 +74,7 @@ public class BasicGridAcceptanceDto extends BaseDto {
private Long fonGridId; private Long fonGridId;
// 电站安装规模(kW)
private String scale;
} }
...@@ -158,6 +158,12 @@ public class HygfIcbcRecordDTO { ...@@ -158,6 +158,12 @@ public class HygfIcbcRecordDTO {
* */ * */
@ApiModelProperty(value = "区域公司名称") @ApiModelProperty(value = "区域公司名称")
private String regionalCompaniesName; private String regionalCompaniesName;
/*
* 商务信息-电站安装规模
* */
@ApiModelProperty(value = "电站安装规模(kW)")
private String scale;
} }
} }
\ No newline at end of file
...@@ -94,4 +94,7 @@ public class PowerStationDto extends BaseDto { ...@@ -94,4 +94,7 @@ public class PowerStationDto extends BaseDto {
@ApiModelProperty(value = "合同状态") @ApiModelProperty(value = "合同状态")
private String status; private String status;
@ApiModelProperty(value = "电站安装规模")
private String scale;
} }
...@@ -83,4 +83,7 @@ public class WorkOrderPage { ...@@ -83,4 +83,7 @@ public class WorkOrderPage {
private String auditIdea ; private String auditIdea ;
@ApiModelProperty(value = "实例id") @ApiModelProperty(value = "实例id")
private String instanceId ; private String instanceId ;
@ApiModelProperty(value = "电站安装规模")
private String scale ;
} }
...@@ -257,4 +257,7 @@ public class HouseholdContract extends BaseEntity { ...@@ -257,4 +257,7 @@ public class HouseholdContract extends BaseEntity {
//查询一个农户拥有的合同是否全是已废弃 //查询一个农户拥有的合同是否全是已废弃
@TableField(exist = false) @TableField(exist = false)
private Boolean isAllDisuse; private Boolean isAllDisuse;
@TableField(exist = false)
private String scale;
} }
...@@ -215,4 +215,10 @@ public class PeasantHousehold extends BaseEntity { ...@@ -215,4 +215,10 @@ public class PeasantHousehold extends BaseEntity {
*/ */
@TableField(exist = false) @TableField(exist = false)
private Integer isAllRevoke; private Integer isAllRevoke;
/**
* 商务信息安装规模
*/
@TableField(exist = false)
private String scale;
} }
...@@ -19,4 +19,6 @@ public interface HouseholdContractMapper extends BaseMapper<HouseholdContract> { ...@@ -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") @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); IPage<HouseholdContract> selectPage(@Param("dto") HouseholdContractPageDto dto);
String getHygfCommercialScale(String peasantHouseholdNumber);
} }
...@@ -50,4 +50,6 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> { ...@@ -50,4 +50,6 @@ public interface PeasantHouseholdMapper extends BaseMapper<PeasantHousehold> {
void deleteHphByNo(String peasantHouseholdNo); void deleteHphByNo(String peasantHouseholdNo);
void deleteHhcByNo(String peasantHouseholdNo); void deleteHhcByNo(String peasantHouseholdNo);
String getHygfCommercialScale(Long surveyInformationId);
} }
...@@ -53,4 +53,10 @@ ...@@ -53,4 +53,10 @@
ORDER BY hygf_household_contract.rec_date DESC, hygf_household_contract.${orderBy} ${dto.isAsc} ORDER BY hygf_household_contract.rec_date DESC, hygf_household_contract.${orderBy} ${dto.isAsc}
</if> </if>
</select> </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> </mapper>
...@@ -133,4 +133,8 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb ...@@ -133,4 +133,8 @@ on hygf_document_station.preparation_money_id=hygf_preparation_money.sequence_nb
<select id="deleteHhcByNo"> <select id="deleteHhcByNo">
DELETE FROM hygf_household_contract WHERE peasant_household_number=#{peasantHouseholdNo} DELETE FROM hygf_household_contract WHERE peasant_household_number=#{peasantHouseholdNo}
</select> </select>
<select id="getHygfCommercialScale" resultType="String">
select scale from hygf_commercial where survey_information_id=${surveyInformationId}
</select>
</mapper> </mapper>
...@@ -12,6 +12,7 @@ import com.yeejoin.amos.boot.module.hygf.api.entity.HygfReplenishment; ...@@ -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.PeasantHousehold;
import com.yeejoin.amos.boot.module.hygf.api.entity.PreparationMoney; 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.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.PersonnelBusinessMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PreparationMoneyMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.PreparationMoneyMapper;
import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil; import com.yeejoin.amos.boot.module.hygf.api.util.CommonResponseNewUtil;
...@@ -53,6 +54,8 @@ public class PreparationMoneyController extends BaseController { ...@@ -53,6 +54,8 @@ public class PreparationMoneyController extends BaseController {
PreparationMoneyServiceImpl preparationMoneyServiceImpl; PreparationMoneyServiceImpl preparationMoneyServiceImpl;
@Autowired @Autowired
PreparationMoneyMapper preparationMoneyMapper; PreparationMoneyMapper preparationMoneyMapper;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired @Autowired
DesignInformationServiceImpl designInformationService; DesignInformationServiceImpl designInformationService;
@Autowired @Autowired
...@@ -226,6 +229,16 @@ public class PreparationMoneyController extends BaseController { ...@@ -226,6 +229,16 @@ public class PreparationMoneyController extends BaseController {
) { ) {
List<PeasantHousehold> list=preparationMoneyMapper.getPeasantHouseholdData(sequenceNbr,ownersName); 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<>(); Page<PeasantHousehold> pagenew = new Page<>();
pagenew.setRecords(list); pagenew.setRecords(list);
pagenew.setTotal(list.size()); pagenew.setTotal(list.size());
......
...@@ -9,10 +9,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController; ...@@ -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.config.UserLimits;
import com.yeejoin.amos.boot.module.hygf.api.dto.*; 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.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper; import com.yeejoin.amos.boot.module.hygf.api.mapper.*;
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.biz.service.impl.WorkOrderServiceImpl; import com.yeejoin.amos.boot.module.hygf.biz.service.impl.WorkOrderServiceImpl;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -47,6 +44,8 @@ public class WorkOrderController extends BaseController { ...@@ -47,6 +44,8 @@ public class WorkOrderController extends BaseController {
WorkOrderPowerStationMapper workOrderPowerStationMapper; WorkOrderPowerStationMapper workOrderPowerStationMapper;
@Autowired @Autowired
WorkOrderMapper workOrderMapper; WorkOrderMapper workOrderMapper;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired @Autowired
PersonnelBusinessMapper personnelBusinessMapper; PersonnelBusinessMapper personnelBusinessMapper;
...@@ -225,6 +224,8 @@ public class WorkOrderController extends BaseController { ...@@ -225,6 +224,8 @@ public class WorkOrderController extends BaseController {
if (workOrder.getType().equals("3") && workOrderPowerStationNodes != null){ if (workOrder.getType().equals("3") && workOrderPowerStationNodes != null){
workOrderPagePage.getRecords().forEach(e->{ workOrderPagePage.getRecords().forEach(e->{
if (workOrderPowerStationNodes.contains(e.getWorkOrderPowerStationNode()) && (roleIds.contains(areaId) ||roleIds.contains(designId) || roleIds.contains(engineeringId)) ){ if (workOrderPowerStationNodes.contains(e.getWorkOrderPowerStationNode()) && (roleIds.contains(areaId) ||roleIds.contains(designId) || roleIds.contains(engineeringId)) ){
if (workOrderPowerStationNodes.contains(e.getWorkOrderPowerStationNode())){
e.setIsAudit("0"); e.setIsAudit("0");
} }
else { else {
...@@ -233,6 +234,12 @@ public class WorkOrderController extends BaseController { ...@@ -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); return ResponseHelper.buildResponse(workOrderPagePage);
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
......
...@@ -70,6 +70,8 @@ public class BasicGridAcceptanceServiceImpl ...@@ -70,6 +70,8 @@ public class BasicGridAcceptanceServiceImpl
@Autowired @Autowired
PeasantHouseholdMapper peasantHouseholdMapper; PeasantHouseholdMapper peasantHouseholdMapper;
@Autowired @Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
private CommonServiceImpl commonService; private CommonServiceImpl commonService;
@Autowired @Autowired
RectificationOrderAuditingServiceImpl rectificationOrderAuditingService; RectificationOrderAuditingServiceImpl rectificationOrderAuditingService;
...@@ -112,6 +114,15 @@ public class BasicGridAcceptanceServiceImpl ...@@ -112,6 +114,15 @@ public class BasicGridAcceptanceServiceImpl
pageNew.setCurrent(current); pageNew.setCurrent(current);
pageNew.setTotal(page.getTotal()); pageNew.setTotal(page.getTotal());
pageNew.setSize(size); 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()); pageNew.setRecords(page.getList());
return pageNew; return pageNew;
} }
......
...@@ -93,6 +93,16 @@ public class HouseholdContractServiceImpl extends BaseService<HouseholdContractD ...@@ -93,6 +93,16 @@ public class HouseholdContractServiceImpl extends BaseService<HouseholdContractD
// } // }
IPage<HouseholdContract> warningQuestionInfoIPage = householdContractMapper.selectPage(dto); 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; return warningQuestionInfoIPage;
} }
......
...@@ -22,6 +22,8 @@ import javax.annotation.Resource; ...@@ -22,6 +22,8 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; 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.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -62,6 +64,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -62,6 +64,9 @@ import lombok.extern.slf4j.Slf4j;
@Service @Service
@Slf4j @Slf4j
public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbcRecord, HygfIcbcRecordMapper> public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbcRecord, HygfIcbcRecordMapper>
implements IHygfIcbcService { implements IHygfIcbcService {
private static final String trxChannel = "05"; // 05表示小程序 private static final String trxChannel = "05"; // 05表示小程序
...@@ -126,6 +131,9 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc ...@@ -126,6 +131,9 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
@Resource(type = HygfIcbcRecordMapper.class) @Resource(type = HygfIcbcRecordMapper.class)
private HygfIcbcRecordMapper hygfIcbcRecordMapper; private HygfIcbcRecordMapper hygfIcbcRecordMapper;
@Resource(type = HouseholdContractMapper.class)
private HouseholdContractMapper householdContractMapper;
@Resource(type = HygfIcbcRequestMapper.class) @Resource(type = HygfIcbcRequestMapper.class)
private HygfIcbcRequestMapper hygfIcbcRequestMapper; private HygfIcbcRequestMapper hygfIcbcRequestMapper;
...@@ -411,6 +419,15 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc ...@@ -411,6 +419,15 @@ public class HygfIcbcServiceImpl extends BaseService<HygfIcbcRecordDTO, HygfIcbc
Map<String, List<PeasantHousehold>> peasantHouseholdMap = peasantHouseholds.stream() Map<String, List<PeasantHousehold>> peasantHouseholdMap = peasantHouseholds.stream()
.collect(Collectors.groupingBy(PeasantHousehold::getAmosUserId));// 根据农户 ID 分组 .collect(Collectors.groupingBy(PeasantHousehold::getAmosUserId));// 根据农户 ID 分组
List<PeasantHousehold> peasantHouseholdList = peasantHouseholdMap.get(amosUserId); 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( hygfIcbcRecordDTO.setPeasantHouseholds(
Bean.toModels(peasantHouseholdList, HygfIcbcRecordDTO.IcbcPeasantHousehold.class)); Bean.toModels(peasantHouseholdList, HygfIcbcRecordDTO.IcbcPeasantHousehold.class));
return hygfIcbcRecordDTO; return hygfIcbcRecordDTO;
......
...@@ -271,6 +271,16 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -271,6 +271,16 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto
pagenew.setCurrent(current); pagenew.setCurrent(current);
pagenew.setTotal(objectPageInfo.getTotal()); pagenew.setTotal(objectPageInfo.getTotal());
pagenew.setSize(size); 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); pagenew.setRecords(newRecords);
return pagenew; return pagenew;
...@@ -914,6 +924,18 @@ public class PeasantHouseholdServiceImpl extends BaseService<PeasantHouseholdDto ...@@ -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.getRegionalCompaniesName()),"regional_companies_name", "%"+peasantHouseholdPageDto.getRegionalCompaniesName()+"%");
queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getDeveloperName()),"developer_name", "%"+peasantHouseholdPageDto.getDeveloperName()+"%"); queryWrapper.like(StrUtil.isNotEmpty(peasantHouseholdPageDto.getDeveloperName()),"developer_name", "%"+peasantHouseholdPageDto.getDeveloperName()+"%");
queryWrapper.orderByDesc("rec_date"); 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
...@@ -94,7 +94,7 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -94,7 +94,7 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
private RedisLockUtil redisLockUtil; private RedisLockUtil redisLockUtil;
public Page<PowerStationDto> queryForPowerStationUserRoles(Page<PowerStationDto> page, String powerStationCode, public Page<PowerStationDto> queryForPowerStationUserRoles(Page<PowerStationDto> page, String powerStationCode,
String ownersName, AgencyUserModel userInfo, String serviceAgent, String regionalCompaniesName, String processStatus) { String ownersName, AgencyUserModel userInfo, String serviceAgent, String regionalCompaniesName, String processStatus) {
// Map<Long, List<RoleModel>> orgRoles = userInfo.getOrgRoles(); // Map<Long, List<RoleModel>> orgRoles = userInfo.getOrgRoles();
// Collection<List<RoleModel>> roleModels = orgRoles.values(); // Collection<List<RoleModel>> roleModels = orgRoles.values();
// if(roleModels !=null){ // if(roleModels !=null){
...@@ -118,13 +118,26 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -118,13 +118,26 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
// return // return
// this.queryForPowerStationPage(page,powerStationCode,ownersName,serviceAgent); // 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;
} }
// 查询电站审核记录 // 查询电站审核记录
public Page<PowerStationDto> queryPage(int current, int size, String powerStationCode, String ownersName, public Page<PowerStationDto> queryPage(int current, int size, String powerStationCode, String ownersName,
String serviceAgent,String regionalCompaniesName,String processStatus) { String serviceAgent,String regionalCompaniesName,String processStatus) {
PageHelper.startPage(current, size); PageHelper.startPage(current, size);
List<PowerStationDto> list = powerStationMapper.queryPage(powerStationCode, ownersName, serviceAgent,regionalCompaniesName,processStatus); List<PowerStationDto> list = powerStationMapper.queryPage(powerStationCode, ownersName, serviceAgent,regionalCompaniesName,processStatus);
...@@ -241,7 +254,7 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -241,7 +254,7 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
@Override @Override
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId,
String planInstanceId, Map<String, Object> kv) { String planInstanceId, Map<String, Object> kv) {
String lockName = String.format("LockName:powerStationExamine:%s", stationId); String lockName = String.format("LockName:powerStationExamine:%s", stationId);
Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1); Boolean isLocked = redisLockUtil.tryLock(lockName, lockName, 10, 1);
if (BooleanUtils.isNotTrue(isLocked)) { if (BooleanUtils.isNotTrue(isLocked)) {
...@@ -266,33 +279,33 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -266,33 +279,33 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
} }
PowerStationProcessStateEnum resultObj = PowerStationProcessStateEnum.getStateByResult(result); PowerStationProcessStateEnum resultObj = PowerStationProcessStateEnum.getStateByResult(result);
switch (nodeByCode) { switch (nodeByCode) {
case 设计审核: case 设计审核:
powerStation.setTechnologyStatus(resultObj.getName()); powerStation.setTechnologyStatus(resultObj.getName());
break; break;
case 投融审核: case 投融审核:
powerStation.setDesignStatus(resultObj.getName()); powerStation.setDesignStatus(resultObj.getName());
break; break;
case 法务审核: case 法务审核:
powerStation.setBusinessStatus(resultObj.getName()); powerStation.setBusinessStatus(resultObj.getName());
if (VERIFY_RESULT_YES.equals(result)) { if (VERIFY_RESULT_YES.equals(result)) {
LambdaUpdateWrapper<HouseholdContract> lambdaUw = new LambdaUpdateWrapper<>(); LambdaUpdateWrapper<HouseholdContract> lambdaUw = new LambdaUpdateWrapper<>();
lambdaUw.eq(HouseholdContract::getPeasantHouseholdId, powerStation.getPeasantHouseholdId()); lambdaUw.eq(HouseholdContract::getPeasantHouseholdId, powerStation.getPeasantHouseholdId());
lambdaUw.set(HouseholdContract::getSurveyStatus, HouseholdContractEnum.勘察状态_已勘察.getCode()); lambdaUw.set(HouseholdContract::getSurveyStatus, HouseholdContractEnum.勘察状态_已勘察.getCode());
householdContractServiceImpl.update(lambdaUw); householdContractServiceImpl.update(lambdaUw);
} }
break; break;
case 文件审核: case 文件审核:
if (VERIFY_RESULT_YES.equals(result)) { if (VERIFY_RESULT_YES.equals(result)) {
flag = false; flag = false;
powerStation.setProcessStatus(PowerStationProcessStateEnum.完成.getName()); powerStation.setProcessStatus(PowerStationProcessStateEnum.完成.getName());
} }
powerStation.setDrawingReview(resultObj.getName()); powerStation.setDrawingReview(resultObj.getName());
break; break;
default: default:
break; break;
} }
} }
meg = "任务明细:" + nodeByCode + (VERIFY_RESULT_YES.equals(result) ? "通过" : "不通过"); meg = "任务明细:" + nodeByCode + (VERIFY_RESULT_YES.equals(result) ? "通过" : "不通过");
...@@ -462,45 +475,45 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS ...@@ -462,45 +475,45 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
public WorkDto getNodeInfoCode(String flowTaskId) { public WorkDto getNodeInfoCode(String flowTaskId) {
WorkDto workDto = null; WorkDto workDto = null;
FeignClientResult<JSONObject> jSONObject = workflowFeignClient.getNodeInfo(flowTaskId); FeignClientResult<JSONObject> jSONObject = workflowFeignClient.getNodeInfo(flowTaskId);
if (IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.getStatus()))) { if (IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.getStatus()))) {
JSONObject js = jSONObject.getResult(); JSONObject js = jSONObject.getResult();
if (js == null) { if (js == null) {
throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!"); throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
}
LinkedHashMap taskInfo = js.get("taskInfo") != null ? (LinkedHashMap) js.get("taskInfo") : null;
String nextProcessNode = taskInfo != null ? taskInfo.get("taskDefinitionKey").toString() : null;
List<LinkedHashMap> executor = js.get("executor") != null ? (List<LinkedHashMap>) js.get("executor")
: null;
String nodeRole = null;
if (!executor.isEmpty()) {
List<String> idList = executor.stream().map(e -> e.get("groupId").toString())
.collect(Collectors.toList());
nodeRole = StringUtils.join(idList, ",");
}
LinkedHashMap extensionInfo = js.get("extensionInfo") != null ? (LinkedHashMap) js.get("extensionInfo")
: null;
String nodeRouting = extensionInfo != null ? extensionInfo.get("nodeRole").toString() : null;
workDto = new WorkDto(nodeRouting, nodeRole, nextProcessNode);
} }
LinkedHashMap taskInfo = js.get("taskInfo") != null ? (LinkedHashMap) js.get("taskInfo") : null;
String nextProcessNode = taskInfo != null ? taskInfo.get("taskDefinitionKey").toString() : null;
List<LinkedHashMap> executor = js.get("executor") != null ? (List<LinkedHashMap>) js.get("executor")
: null;
String nodeRole = null;
if (!executor.isEmpty()) {
List<String> idList = executor.stream().map(e -> e.get("groupId").toString())
.collect(Collectors.toList());
nodeRole = StringUtils.join(idList, ",");
}
LinkedHashMap extensionInfo = js.get("extensionInfo") != null ? (LinkedHashMap) js.get("extensionInfo")
: null;
String nodeRouting = extensionInfo != null ? extensionInfo.get("nodeRole").toString() : null;
workDto = new WorkDto(nodeRouting, nodeRole, nextProcessNode);
}
return workDto; return workDto;
} }
public String getTaskNoAuth(String processInstanceId) { public String getTaskNoAuth(String processInstanceId) {
String flowTaskId = null; String flowTaskId = null;
JSONObject jSONObject = workflowFeignClient.getTaskNoAuth(processInstanceId); JSONObject jSONObject = workflowFeignClient.getTaskNoAuth(processInstanceId);
if (IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.get("code")))) { if (IDX_REQUEST_STATE.equals(String.valueOf(jSONObject.get("code")))) {
LinkedHashMap jsd = jSONObject.get("data") != null ? (LinkedHashMap) jSONObject.get("data") : null; LinkedHashMap jsd = jSONObject.get("data") != null ? (LinkedHashMap) jSONObject.get("data") : null;
flowTaskId = jsd != null ? jsd.get("id").toString() : null; flowTaskId = jsd != null ? jsd.get("id").toString() : null;
} }
if (flowTaskId == null) { if (flowTaskId == null) {
throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!"); throw new BaseException("获取工作流节点失败!", "400", "获取工作流节点失败!");
} }
return flowTaskId; return flowTaskId;
} }
......
...@@ -101,7 +101,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W ...@@ -101,7 +101,8 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper; PowerStationEngineeringInfoMapper powerStationEngineeringInfoMapper;
@Autowired @Autowired
PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService; PowerStationEngineeringInfoServiceImpl powerStationEngineeringInfoService;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired @Autowired
HygfOnGridMapper hygfOnGridMapper; HygfOnGridMapper hygfOnGridMapper;
@Autowired @Autowired
...@@ -279,6 +280,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W ...@@ -279,6 +280,9 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
for (PeasantHousehold documentStation : lih) { for (PeasantHousehold documentStation : lih) {
ids.add(documentStation.getSequenceNbr()); ids.add(documentStation.getSequenceNbr());
} }
QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>(); QueryWrapper<DesignInformation> designInformationQueryWrapper = new QueryWrapper<>();
designInformationQueryWrapper.in("peasant_household_id", ids); designInformationQueryWrapper.in("peasant_household_id", ids);
List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper); List<DesignInformation> li = designInformationMapper.selectList(designInformationQueryWrapper);
...@@ -306,6 +310,13 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W ...@@ -306,6 +310,13 @@ public class WorkOrderServiceImpl extends BaseService<WorkOrderDto, WorkOrder, W
} }
} }
List<PeasantHousehold> list = workOrderPowerStationMapper.selectPeasantHousehold(sequenceNbr, null); 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<>(); Map<String, Object> map = new HashMap<>();
designInformation.setAssembly(assembly); designInformation.setAssembly(assembly);
designInformation.setInverter(inverter); designInformation.setInverter(inverter);
......
...@@ -724,7 +724,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper; ...@@ -724,7 +724,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@RequestParam(value = "stationId", required = true) String stationId, @RequestParam(value = "stationId", required = true) String stationId,
@RequestParam(value = "tableName2", required = false) String tableName2) { @RequestParam(value = "tableName2", required = false) String tableName2) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId); 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()); int num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(), tableName2,stationBasic.getBoosterGatewayId());
...@@ -742,7 +742,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper; ...@@ -742,7 +742,7 @@ private FanHealthIndexDayMapper fanHealthIndexDayMapper;
@RequestParam(value = "stationId") String stationId) { @RequestParam(value = "stationId") String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(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; FeignClientResult<List<String>> sevenEntityMcb = null;
try { try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc); sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
......
...@@ -334,6 +334,7 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -334,6 +334,7 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
LambdaQueryWrapper<PvHealthIndex> pvwrapper = new LambdaQueryWrapper<PvHealthIndex>(); LambdaQueryWrapper<PvHealthIndex> pvwrapper = new LambdaQueryWrapper<PvHealthIndex>();
pvwrapper.eq(PvHealthIndex::getAnalysisObjType, "场站").and( pvwrapper.eq(PvHealthIndex::getAnalysisObjType, "场站").and(
qw->qw.eq(PvHealthIndex::getGatewayId, fanGatewayId).or().eq(PvHealthIndex::getGatewayId, syzGatewayId)); qw->qw.eq(PvHealthIndex::getGatewayId, fanGatewayId).or().eq(PvHealthIndex::getGatewayId, syzGatewayId));
pvwrapper.eq(PvHealthIndex::getAnalysisType, "按10分钟");
pvwrapper.orderByDesc(PvHealthIndex::getTs); pvwrapper.orderByDesc(PvHealthIndex::getTs);
pvwrapper.last("limit 15"); pvwrapper.last("limit 15");
List<PvHealthIndex> pvHealthIndexList = pvHealthIndexMapper.selectList(pvwrapper); List<PvHealthIndex> pvHealthIndexList = pvHealthIndexMapper.selectList(pvwrapper);
...@@ -771,8 +772,25 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -771,8 +772,25 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@ApiOperation(value = "风站 左侧风机信息列表") @ApiOperation(value = "风站 左侧风机信息列表")
@GetMapping("/getFanInfoByPage") @GetMapping("/getFanInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getFanInfoByPage( public ResponseModel<Page<Map<String, Object>>> getFanInfoByPage(
@RequestParam(value = "stationId", required = false) String stationId) { @RequestParam(value = "stationId", required = false) String stationId,
return ResponseHelper.buildResponse(fanInfoByPage(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) { private Page<Map<String, Object>> fanInfoByPage(String stationId) {
...@@ -914,6 +932,10 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -914,6 +932,10 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
item.put("healthIndex", equipmentHealthScore); item.put("healthIndex", equipmentHealthScore);
}); });
pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString())); 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<>(); Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size()); mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size()); mapPage.setTotal(pointNameList.size());
...@@ -926,8 +948,22 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -926,8 +948,22 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@ApiOperation(value = "光伏 左侧风机信息列表") @ApiOperation(value = "光伏 左侧风机信息列表")
@GetMapping("/getPvInfoByPage") @GetMapping("/getPvInfoByPage")
public ResponseModel<Page<Map<String, Object>>> getPvInfoByPage( public ResponseModel<Page<Map<String, Object>>> getPvInfoByPage(
@RequestParam(value = "stationId", required = false) String stationId) { @RequestParam(value = "stationId", required = false) String stationId,
return ResponseHelper.buildResponse(pvInfoByPage(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) { private Page<Map<String, Object>> pvInfoByPage(String stationId) {
...@@ -1052,6 +1088,10 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1052,6 +1088,10 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
item.put("healthIndex", equipmentHealthScore); item.put("healthIndex", equipmentHealthScore);
}); });
pointNameList.sort(Comparator.comparing(o -> o.get("sort").toString())); 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<>(); Page<Map<String, Object>> mapPage = new Page<>();
mapPage.setSize(pointNameList.size()); mapPage.setSize(pointNameList.size());
mapPage.setTotal(pointNameList.size()); mapPage.setTotal(pointNameList.size());
...@@ -1112,10 +1152,31 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1112,10 +1152,31 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@RequestParam(value = "indexAddress", required = false) String indexAddress, @RequestParam(value = "indexAddress", required = false) String indexAddress,
@RequestParam(value = "tableName", required = true) String tableName, @RequestParam(value = "tableName", required = true) String tableName,
@RequestParam(value = "stationId", required = true) String stationId, @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); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName, // String nameByIndexAddress = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(indexAddress, tableName,
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId()); // stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
int num = 0; int num = 0;
if (StringUtils.isNotEmpty(tableName2)) { if (StringUtils.isNotEmpty(tableName2)) {
num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(), num = idxBizFanHealthIndexMapper.getIsWarningByPointId(indexAddress, stationBasic.getFanGatewayId(),
...@@ -1134,11 +1195,17 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1134,11 +1195,17 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
public ResponseModel<Map<String, String>> getRiskHandleByVarDesc( public ResponseModel<Map<String, String>> getRiskHandleByVarDesc(
@RequestParam(value = "varDesc", required = false) String varDesc, @RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName, @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); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName, if(equipmentName.contains("升压站")){
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId()); varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getBoosterGatewayId());
}else {
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId());
}
FeignClientResult<List<String>> sevenEntityMcb = null; FeignClientResult<List<String>> sevenEntityMcb = null;
try { try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc); sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
...@@ -1643,20 +1710,68 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1643,20 +1710,68 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
return ResponseHelper.buildResponse(map); 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) @TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风站/光伏 右下实时趋势") @ApiOperation(value = "风站/光伏 右下实时趋势")
@GetMapping("/getTrendInfoByAddressBy1118") @GetMapping("/getTrendInfoByAddressBy1118")
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118( public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118(
@RequestParam(value = "indexAddress", required = false) String indexAddress, @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); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
LambdaQueryWrapper<FanHealthIndex> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<FanHealthIndex> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(FanHealthIndex::getIndexAddress, indexAddress).and( lambdaQueryWrapper.eq(FanHealthIndex::getIndexAddress, indexAddress);
qw->qw.eq(FanHealthIndex::getGatewayId, stationBasic.getFanGatewayId()).or().eq(FanHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId())); if(equipmentName.contains("升压站")){
lambdaQueryWrapper.eq(FanHealthIndex::getAnalysisObjType, "测点"); lambdaQueryWrapper.eq(FanHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId());
}else {
lambdaQueryWrapper.eq(FanHealthIndex::getGatewayId, stationBasic.getFanGatewayId());
}
lambdaQueryWrapper.eq(FanHealthIndex::getAnalysisObjType, "测点");
lambdaQueryWrapper.orderByDesc(FanHealthIndex::getTs); lambdaQueryWrapper.orderByDesc(FanHealthIndex::getTs);
lambdaQueryWrapper.eq(FanHealthIndex::getAnalysisType, "按10分钟"); lambdaQueryWrapper.eq(FanHealthIndex::getAnalysisType, "按10分钟");
lambdaQueryWrapper.last("limit 15"); lambdaQueryWrapper.last("limit 15");
...@@ -1692,13 +1807,20 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1692,13 +1807,20 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
@GetMapping("/getTrendInfoByAddressBy1118Pv") @GetMapping("/getTrendInfoByAddressBy1118Pv")
public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118Pv( public ResponseModel<Map<String, Object>> getTrendInfoByAddressBy1118Pv(
@RequestParam(value = "indexAddress", required = false) String indexAddress, @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); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
LambdaQueryWrapper<PvHealthIndex> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PvHealthIndex> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PvHealthIndex::getIndexAddress, indexAddress).and( lambdaQueryWrapper.eq(PvHealthIndex::getIndexAddress, indexAddress);
qw->qw.eq(PvHealthIndex::getGatewayId, stationBasic.getFanGatewayId()).or().eq(PvHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId())); if(equipmentName.contains("升压站")){
lambdaQueryWrapper.eq(PvHealthIndex::getGatewayId, stationBasic.getBoosterGatewayId());
}else {
lambdaQueryWrapper.eq(PvHealthIndex::getGatewayId, stationBasic.getFanGatewayId());
}
lambdaQueryWrapper.eq(PvHealthIndex::getAnalysisObjType, "测点"); lambdaQueryWrapper.eq(PvHealthIndex::getAnalysisObjType, "测点");
lambdaQueryWrapper.orderByDesc(PvHealthIndex::getTs); lambdaQueryWrapper.orderByDesc(PvHealthIndex::getTs);
lambdaQueryWrapper.eq(PvHealthIndex::getAnalysisType, "按10分钟"); lambdaQueryWrapper.eq(PvHealthIndex::getAnalysisType, "按10分钟");
...@@ -1736,11 +1858,24 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1736,11 +1858,24 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
public ResponseModel<Map<String, String>> getRiskHandleByVarDescBy1118( public ResponseModel<Map<String, String>> getRiskHandleByVarDescBy1118(
@RequestParam(value = "varDesc", required = false) String varDesc, @RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName, @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); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper Map<String, Object> healthIndexMap = null;
.getHealthIndexByIndexAddress(stationBasic.getFanGatewayId(), varDesc,stationBasic.getBoosterGatewayId()); 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)) { if (ObjectUtils.isEmpty(healthIndexMap)) {
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("content", "正常运行"); stringStringHashMap.put("content", "正常运行");
...@@ -1757,9 +1892,6 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1757,9 +1892,6 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
stringStringHashMap.put("content", "正常运行"); stringStringHashMap.put("content", "正常运行");
return ResponseHelper.buildResponse(stringStringHashMap); return ResponseHelper.buildResponse(stringStringHashMap);
} }
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
FeignClientResult<List<String>> sevenEntityMcb = null; FeignClientResult<List<String>> sevenEntityMcb = null;
try { try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc); sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
...@@ -1787,11 +1919,23 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1787,11 +1919,23 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
public ResponseModel<Map<String, String>> getRiskHandleByVarDescBy1118Pv( public ResponseModel<Map<String, String>> getRiskHandleByVarDescBy1118Pv(
@RequestParam(value = "varDesc", required = false) String varDesc, @RequestParam(value = "varDesc", required = false) String varDesc,
@RequestParam(value = "tableName", required = true) String tableName, @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); StationBasic stationBasic = stationBasicMapper.selectById(stationId);
Map<String, Object> healthIndexMap = idxBizFanHealthIndexMapper Map<String, Object> healthIndexMap = null;
.getHealthIndexByIndexAddressPv(stationBasic.getFanGatewayId(), varDesc,stationBasic.getBoosterGatewayId()); 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)) { if (ObjectUtils.isEmpty(healthIndexMap)) {
HashMap<String, String> stringStringHashMap = new HashMap<>(); HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("content", "正常运行"); stringStringHashMap.put("content", "正常运行");
...@@ -1808,9 +1952,6 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl ...@@ -1808,9 +1952,6 @@ public class TDBigScreenAnalyseController extends BaseController implements Appl
stringStringHashMap.put("content", "正常运行"); stringStringHashMap.put("content", "正常运行");
return ResponseHelper.buildResponse(stringStringHashMap); return ResponseHelper.buildResponse(stringStringHashMap);
} }
varDesc = idxBizFanHealthIndexMapper.getPointNameByIndexAddress(varDesc, tableName,
stationBasic.getFanGatewayId(),stationBasic.getBoosterGatewayId());
FeignClientResult<List<String>> sevenEntityMcb = null; FeignClientResult<List<String>> sevenEntityMcb = null;
try { try {
sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc); sevenEntityMcb = riskWarningFeign.getRiskHandleByVarDesc(varDesc);
......
...@@ -101,7 +101,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -101,7 +101,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
@Param("equipmentName") String equipmentName,@Param("syzGatewayId") String syzGatewayId); @Param("equipmentName") String equipmentName,@Param("syzGatewayId") String syzGatewayId);
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("syzGatewayId") String syzGatewayId); @Param("gatewayId") String gatewayId);
List<FullViewRecallDataDTO> getFullViewRecall(@Param("gatewayIds") List<String> gatewayIds); List<FullViewRecallDataDTO> getFullViewRecall(@Param("gatewayIds") List<String> gatewayIds);
...@@ -152,7 +152,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -152,7 +152,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
Map<String, Object> getPvEquipStatusByStation(String station); Map<String, Object> getPvEquipStatusByStation(String station);
String getRecDateByIndexAddress(@Param("fanGatewayId") String fanGatewayId, 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, List<Map<String, Object>> getInfoListByTableName(@Param("fanGatewayId") String fanGatewayId,
@Param("indexAddress") String indexAddress, @Param("tableName") String tableName, @Param("indexAddress") String indexAddress, @Param("tableName") String tableName,
...@@ -164,7 +164,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn ...@@ -164,7 +164,7 @@ public interface IdxBizFanHealthIndexMapper extends BaseMapper<IdxBizFanHealthIn
List<Map<String, Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE, String startTimeTop, List<Map<String, Object>> queryIndexByArae(String ARAE, String ANALYSISTYPE, String startTimeTop,
String endTimeTop); 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 { ...@@ -62,7 +62,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "5"); idxBizFanWeightQueryWrapper.eq("type", "5");
idxBizFanWeightQueryWrapper.isNotNull("value"); idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper); 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())); 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<>(); List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
...@@ -120,7 +120,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService { ...@@ -120,7 +120,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "5"); idxBizFanWeightQueryWrapper.eq("type", "5");
idxBizFanWeightQueryWrapper.isNotNull("value"); idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper); 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())); 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<>(); List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
...@@ -173,7 +173,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService { ...@@ -173,7 +173,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "4"); idxBizFanWeightQueryWrapper.eq("type", "4");
idxBizFanWeightQueryWrapper.isNotNull("value"); idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper); 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())); 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<>(); List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
...@@ -225,7 +225,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService { ...@@ -225,7 +225,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "3"); idxBizFanWeightQueryWrapper.eq("type", "3");
idxBizFanWeightQueryWrapper.isNotNull("value"); idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper); 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())); Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>(); List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
...@@ -276,7 +276,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService { ...@@ -276,7 +276,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "2"); idxBizFanWeightQueryWrapper.eq("type", "2");
idxBizFanWeightQueryWrapper.isNotNull("value"); idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper); 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())); Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>(); List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
...@@ -325,7 +325,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService { ...@@ -325,7 +325,7 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
idxBizFanWeightQueryWrapper.eq("type", "1"); idxBizFanWeightQueryWrapper.eq("type", "1");
idxBizFanWeightQueryWrapper.isNotNull("value"); idxBizFanWeightQueryWrapper.isNotNull("value");
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(idxBizFanWeightQueryWrapper); 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())); Map<String, List<FanHealthIndex>> fanHealthIndicesZxtMap = fanHealthIndicesZxt.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getOrgCode()));
List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>(); List<FanHealthIndex> fanHealthIndicesZxtNews = new ArrayList<>();
...@@ -354,11 +354,11 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService { ...@@ -354,11 +354,11 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
public List<HealthIndexDTO> getInfoListByGroupByQy(String startTime, String fanTableName, String pvTableName, String analysisObjectType) { public List<HealthIndexDTO> getInfoListByGroupByQy(String startTime, String fanTableName, String pvTableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.getInfoList(startTime, fanTableName, analysisObjectType); List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.getInfoList(startTime, fanTableName, analysisObjectType);
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(new QueryWrapper<IdxBizFanWeight>().eq("type", "2").isNotNull("value")); 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<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoList(startTime, pvTableName, analysisObjectType);
List<IdxBizPvWeight> pvIdxBizFanWeights = idxBizPvWeightMapper.selectList(new QueryWrapper<IdxBizPvWeight>().eq("type", "2").isNotNull("value")); 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<>(); List<HealthIndexDTO> healthIndexDTOS = new ArrayList<>();
healthIndexDTOS.addAll(fanHealthIndices.stream().map(this::toHealthIndexDTO).collect(Collectors.toList())); healthIndexDTOS.addAll(fanHealthIndices.stream().map(this::toHealthIndexDTO).collect(Collectors.toList()));
...@@ -396,11 +396,11 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService { ...@@ -396,11 +396,11 @@ public class FanHealthIndexServiceImpl implements IFanHealthIndexService {
public List<HealthIndexDTO> getInfoListByGroupByQg(String startTime, String fanTableName, String pvTableName, String analysisObjectType) { public List<HealthIndexDTO> getInfoListByGroupByQg(String startTime, String fanTableName, String pvTableName, String analysisObjectType) {
List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.getInfoList(startTime, fanTableName, analysisObjectType); List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.getInfoList(startTime, fanTableName, analysisObjectType);
List<IdxBizFanWeight> idxBizFanWeights = idxBizFanWeightMapper.selectList(new QueryWrapper<IdxBizFanWeight>().eq("type", "1").isNotNull("value")); 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<PvHealthIndex> pvHealthIndices = pvHealthIndexMapper.getInfoList(startTime, pvTableName, analysisObjectType);
List<IdxBizPvWeight> pvIdxBizFanWeights = idxBizPvWeightMapper.selectList(new QueryWrapper<IdxBizPvWeight>().eq("type", "1").isNotNull("value")); 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<>(); List<HealthIndexDTO> healthIndexDTOS = new ArrayList<>();
healthIndexDTOS.addAll(fanHealthIndices.stream().map(this::toHealthIndexDTO).collect(Collectors.toList())); healthIndexDTOS.addAll(fanHealthIndices.stream().map(this::toHealthIndexDTO).collect(Collectors.toList()));
......
...@@ -50,7 +50,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService { ...@@ -50,7 +50,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "5"); queryWrapper.eq("type", "5");
queryWrapper.isNotNull("value"); queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper); 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())); 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<>(); List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
...@@ -111,7 +111,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService { ...@@ -111,7 +111,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "5"); queryWrapper.eq("type", "5");
queryWrapper.isNotNull("value"); queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper); 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())); 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<>(); List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
...@@ -165,7 +165,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService { ...@@ -165,7 +165,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "4"); queryWrapper.eq("type", "4");
queryWrapper.isNotNull("value"); queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper); 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())); 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<>(); List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
...@@ -218,7 +218,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService { ...@@ -218,7 +218,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "3"); queryWrapper.eq("type", "3");
queryWrapper.isNotNull("value"); queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper); 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())); Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getStation() + o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>(); List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
...@@ -270,7 +270,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService { ...@@ -270,7 +270,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "2"); queryWrapper.eq("type", "2");
queryWrapper.isNotNull("value"); queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper); 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())); Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getArea() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>(); List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
...@@ -320,7 +320,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService { ...@@ -320,7 +320,7 @@ public class PvHealthIndexServiceImpl implements IPvHealthIndexService {
queryWrapper.eq("type", "1"); queryWrapper.eq("type", "1");
queryWrapper.isNotNull("value"); queryWrapper.isNotNull("value");
List<IdxBizPvWeight> idxBizFanWeights = idxBizPvWeightMapper.selectList(queryWrapper); 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())); Map<String, List<PvHealthIndex>> healthIndicesMap = pvHealthIndices.stream().collect(Collectors.groupingBy(o -> o.getAnalysisObjType() + o.getOrgCode()));
List<PvHealthIndex> pvHealthIndexList = new ArrayList<>(); List<PvHealthIndex> pvHealthIndexList = new ArrayList<>();
......
...@@ -757,7 +757,7 @@ FROM ( ...@@ -757,7 +757,7 @@ FROM (
select POINT_NAME select POINT_NAME
from ${tableName} from ${tableName}
where INDEX_ADDRESS = #{varDesc} where INDEX_ADDRESS = #{varDesc}
AND (GATEWAY_ID = #{gatewayId} or GATEWAY_ID = #{syzGatewayId}) AND GATEWAY_ID = #{gatewayId}
limit 1 limit 1
...@@ -1354,7 +1354,7 @@ FROM ( ...@@ -1354,7 +1354,7 @@ FROM (
WHERE WHERE
INDEX_ADDRESS = #{indexAddress} INDEX_ADDRESS = #{indexAddress}
AND DISPOSOTION_STATE = '待确认' AND DISPOSOTION_STATE = '待确认'
AND (GATEWAY_ID = #{fanGatewayId} or GATEWAY_ID = #{syzGatewayId}) AND GATEWAY_ID = #{fanGatewayId}
ORDER BY ORDER BY
sort DESC, sort DESC,
REC_DATE DESC REC_DATE DESC
...@@ -1770,7 +1770,7 @@ TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1 ...@@ -1770,7 +1770,7 @@ TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
from fan_health_index_latest_data from fan_health_index_latest_data
where where
INDEX_ADDRESS = #{indexAddress} INDEX_ADDRESS = #{indexAddress}
AND (GATEWAY_ID = #{gatewayId} or GATEWAY_ID = #{syzGatewayId}) AND GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点' and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按天' and ANALYSIS_TYPE = '按天'
limit 1 limit 1
...@@ -1782,7 +1782,7 @@ TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1 ...@@ -1782,7 +1782,7 @@ TIMESTAMPDIFF( MINUTE, #{startTime} , #{endTime})/10 >= @s-1
from pv_health_index_latest_data from pv_health_index_latest_data
where where
INDEX_ADDRESS = #{indexAddress} INDEX_ADDRESS = #{indexAddress}
AND (GATEWAY_ID = #{gatewayId} or GATEWAY_ID = #{syzGatewayId}) AND GATEWAY_ID = #{gatewayId}
and ANALYSIS_OBJ_TYPE = '测点' and ANALYSIS_OBJ_TYPE = '测点'
and ANALYSIS_TYPE = '按天' and ANALYSIS_TYPE = '按天'
limit 1 limit 1
......
...@@ -86,6 +86,7 @@ public class Constants { ...@@ -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 get_quota_complate_info="method=scene_screen.large_screen.get_quota_complate_info";
public static final String resovleRule_data = "data"; public static final String resovleRule_data = "data";
public static final String areaChinese="区域"; 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; ...@@ -19,6 +19,10 @@ import java.util.stream.Collectors;
import javax.annotation.PostConstruct; 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.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.Aggregations; import org.elasticsearch.search.aggregations.Aggregations;
...@@ -26,9 +30,11 @@ import org.elasticsearch.search.aggregations.bucket.terms.Terms; ...@@ -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.ParsedAvg;
import org.elasticsearch.search.aggregations.metrics.ParsedSum; import org.elasticsearch.search.aggregations.metrics.ParsedSum;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.*;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
...@@ -50,6 +56,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.dto.StationCacheInfoDto; ...@@ -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.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil; import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
/** /**
* @description: * @description:
...@@ -58,6 +65,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil; ...@@ -58,6 +65,7 @@ import com.yeejoin.amos.boot.module.jxiop.biz.utils.DateUtil;
*/ */
@Service @Service
//@RequiredArgsConstructor //@RequiredArgsConstructor
@Slf4j
public class LargeScreenImpl { public class LargeScreenImpl {
@Autowired @Autowired
CommonServiceImpl commonServiceImpl; CommonServiceImpl commonServiceImpl;
...@@ -75,6 +83,10 @@ public class LargeScreenImpl { ...@@ -75,6 +83,10 @@ public class LargeScreenImpl {
SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl; SjglZsjZsbtzServiceImpl SjglZsjZsbtzServiceImpl;
@Autowired @Autowired
private HttpRequestUtil httpRequestUtil; private HttpRequestUtil httpRequestUtil;
@Autowired
AmosRequestContext amosRequestContext;
@Autowired
RestTemplate restTemplate;
private final String SS = "瞬时风速"; private final String SS = "瞬时风速";
private final String ZFS = "WTX-801_25_WTX-801_总辐射"; private final String ZFS = "WTX-801_25_WTX-801_总辐射";
...@@ -149,10 +161,13 @@ public class LargeScreenImpl { ...@@ -149,10 +161,13 @@ public class LargeScreenImpl {
// Constants.REQUEST_GET, "", Constants.resovleRule_data); // Constants.REQUEST_GET, "", Constants.resovleRule_data);
// } // }
mapdta.put("SS", data.getDouble("average_wind_speed")); mapdta.put("SS", data.getDouble("average_wind_speed"));
mapdta.put("ZFS", data.getDouble("avg_irradiance")); // mapdta.put("ZFS", data.getDouble("avg_irradiance"));
mapdta.put("ZFSLJ", data.getDouble("sum_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); // AtomicReference<Double> dailyPower = new AtomicReference<>(0.0);
// //月发电量 // //月发电量
...@@ -242,7 +257,62 @@ public class LargeScreenImpl { ...@@ -242,7 +257,62 @@ public class LargeScreenImpl {
return mapdta; 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 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
//@PostConstruct //@PostConstruct
private void sendQYYXZBMqtt() { private void sendQYYXZBMqtt() {
...@@ -440,8 +510,11 @@ public class LargeScreenImpl { ...@@ -440,8 +510,11 @@ public class LargeScreenImpl {
// "", Constants.resovleRule_data); // "", Constants.resovleRule_data);
// } // }
mapdta.put("SS", data.getString("average_wind_speed")); mapdta.put("SS", data.getString("average_wind_speed"));
mapdta.put("ZFS", data.getString("avg_irradiance")); // mapdta.put("ZFS", data.getString("avg_irradiance"));
mapdta.put("ZFSLJ", data.getString("sum_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 { try {
System.out.println(JSON.toJSONString(mapdta)); System.out.println(JSON.toJSONString(mapdta));
...@@ -458,7 +531,7 @@ public class LargeScreenImpl { ...@@ -458,7 +531,7 @@ public class LargeScreenImpl {
} }
// 全国发电趋势 // 全国发电趋势
@Scheduled(cron = "0/10 * * * * ? ") // @Scheduled(cron = "0/10 * * * * ? ")
public SeriesData getSeriesDataqg() { public SeriesData getSeriesDataqg() {
// 获取今年当月 日发电趋势 // 获取今年当月 日发电趋势
...@@ -634,7 +707,7 @@ public class LargeScreenImpl { ...@@ -634,7 +707,7 @@ public class LargeScreenImpl {
} }
//全国月发电量趋势 //全国月发电量趋势
@Scheduled(cron = "0/10 * * * * ?") @Scheduled(cron = "0/10 * * * * ?")
public Map<String, Object> gettimedateyfd() { public Map<String, Object> gettimedateyfd() {
...@@ -838,7 +911,7 @@ public class LargeScreenImpl { ...@@ -838,7 +911,7 @@ public class LargeScreenImpl {
} }
public Map<String, Object> gettimedateqyyfdqs(Date date, List<String> gatewayId, String areaCode, public Map<String, Object> gettimedateqyyfdqs(Date date, List<String> gatewayId, String areaCode,
List<String> idsStationId) { List<String> idsStationId) {
SimpleDateFormat myFmt2 = new SimpleDateFormat("yyyy"); SimpleDateFormat myFmt2 = new SimpleDateFormat("yyyy");
String monthy = myFmt2.format(date); String monthy = myFmt2.format(date);
...@@ -979,7 +1052,7 @@ public class LargeScreenImpl { ...@@ -979,7 +1052,7 @@ public class LargeScreenImpl {
// CommonConstans.kwToMv; // CommonConstans.kwToMv;
Double vl = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF())) Double vl = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()))
+ Double.valueOf(String.format(CommonConstans.Twodecimalplaces, + Double.valueOf(String.format(CommonConstans.Twodecimalplaces,
indicatorData2.getValueF() * CommonConstans.kwToMv)); indicatorData2.getValueF() * CommonConstans.kwToMv));
values.add(String.format(CommonConstans.Twodecimalplaces, vl)); values.add(String.format(CommonConstans.Twodecimalplaces, vl));
} }
...@@ -1084,7 +1157,7 @@ public class LargeScreenImpl { ...@@ -1084,7 +1157,7 @@ public class LargeScreenImpl {
// CommonConstans.kwToMv; // CommonConstans.kwToMv;
Double vl = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF())) Double vl = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, indicatorData.getValueF()))
+ Double.valueOf(String.format(CommonConstans.Twodecimalplaces, + Double.valueOf(String.format(CommonConstans.Twodecimalplaces,
indicatorData2.getValueF() * CommonConstans.kwToMv)); indicatorData2.getValueF() * CommonConstans.kwToMv));
values.add(String.format(CommonConstans.Twodecimalplaces, vl)); values.add(String.format(CommonConstans.Twodecimalplaces, vl));
} }
......
...@@ -610,7 +610,7 @@ public class MonitorServiceImpl implements MonitorService { ...@@ -610,7 +610,7 @@ public class MonitorServiceImpl implements MonitorService {
// } // }
// return mapdta; // return mapdta;
// } // }
@Scheduled(cron = "0/10 * * * * ?") // @Scheduled(cron = "0/10 * * * * ?")
private void sendQYYXZBMqtt() { private void sendQYYXZBMqtt() {
List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null); List<CoreValuesDto> coreValuesDtos = coreCommonService.getValuesByStationNamesAndPointsNames(null, null);
List<StationCacheInfoDto> stationCacheInfoDtoList = getListStationCacheInfoDto(); 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