Commit fabdd69a authored by tangwei's avatar tangwei

解决冲突

parents ed8ce6ab ecbbebc8
......@@ -7,7 +7,9 @@ public enum TaskTypeStationEnum {
经销商审核("经销商审核", "经销商审核"),
电站勘察("电站勘察", "电站勘察"),
电站审核("电站审核", "电站审核"),
合同填报("合同填报", "合同填报");
合同填报("合同填报", "合同填报"),
重置密码("重置密码", "重置密码"),
设置管理员("设置管理员", "设置管理员");
/**
* 名称,描述
*/
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.hygf.api.Enum.HouseholdContractEnum;
......@@ -34,6 +35,7 @@ import java.util.List;
import java.util.stream.Collectors;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -68,7 +70,8 @@ public class HouseholdContractController extends BaseController {
@Autowired
PeasantHouseholdServiceImpl peasantHouseholdServiceImpl;
@Autowired
protected EmqKeeper emqKeeper;
@Value("${dealer.engineering}")
private String engineering;
@Autowired
......@@ -196,7 +199,7 @@ public class HouseholdContractController extends BaseController {
//生成填报任务
ToDoTasks toDoTasks1= new ToDoTasks ( TaskTypeStationEnum.合同填报.getCode(), householdContrac.getSequenceNbr(), "用户"+householdContrac.getPartyA()+"合同盖章",householdContrac.getDealerCode());
toDoTasksServiceImpl.addToDoTasksByRole(engineering,toDoTasks1);
toDoTasksServiceImpl.addToDoTasksByRole(engineering,toDoTasks1,"发起合同成功");
return ResponseHelper.buildResponse(householdContractServiceImpl.updateById(householdContrac));
......@@ -212,8 +215,9 @@ public class HouseholdContractController extends BaseController {
@Transactional
public boolean stampdata(Long sequenceNbr){
HouseholdContract householdContrac= householdContractServiceImpl.getById(sequenceNbr);
HouseholdContract householdContrac=null;
try {
householdContrac= householdContractServiceImpl.getById(sequenceNbr);
householdContrac.setStampStatus(HouseholdContractEnum.盖章状态_已盖章.getCode());
householdContrac.setSigningTime(new Date());
householdContrac.setStatus(HouseholdContractEnum.合同状态_双方已签署.getCode());
......@@ -228,10 +232,19 @@ public class HouseholdContractController extends BaseController {
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成", doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" , JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}catch (Exception e){
e.printStackTrace();
throw new RuntimeException("系统异常");
}
return householdContractServiceImpl.updateById(householdContrac);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......@@ -245,7 +258,9 @@ public class HouseholdContractController extends BaseController {
@Transactional
public boolean canceldata(Long sequenceNbr){
HouseholdContract householdContrac= householdContractServiceImpl.getById(sequenceNbr);
HouseholdContract householdContrac=null;
try {
householdContrac= householdContractServiceImpl.getById(sequenceNbr);
householdContrac.setStatus(HouseholdContractEnum.合同状态_已作废.getCode());
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.合同填报.getCode());
......@@ -255,8 +270,16 @@ public class HouseholdContractController extends BaseController {
if(doTasks!=null){
doTasks.setState("作废");
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已作废", doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" , JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}catch (Exception e){
e.printStackTrace();
throw new RuntimeException("系统异常");
}
return householdContractServiceImpl.updateById(householdContrac);
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.hygf.api.Enum.TaskTypeStationEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.CompanyDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.CompanyDtoUserDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.UserDataDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.PersonnelBusiness;
import com.yeejoin.amos.boot.module.hygf.api.entity.UserMessage;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.UserMessageMapper;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import com.yeejoin.amos.boot.module.standard.api.mapper.PublicAgencyUserMapper;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
......@@ -21,6 +25,7 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.Date;
import java.util.List;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.PersonnelBusinessServiceImpl;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -49,6 +54,10 @@ public class PersonnelBusinessController extends BaseController {
PublicAgencyUserMapper publicAgencyUserMapper;
@Autowired
PersonnelBusinessMapper personnelBusinessMapper;
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
UserMessageMapper userMessageMapper;
/**
* 新增人员业务信息表
*
......@@ -206,12 +215,27 @@ public class PersonnelBusinessController extends BaseController {
@GetMapping(value = "/czPassword")
@ApiOperation(httpMethod = "GET",value = "重置密码", notes = "重置密码")
public ResponseModel<UserDataDto> czPassword(String id) {
PublicAgencyUser publicAgencyUser= publicAgencyUserMapper.selectById(id);
try {
PublicAgencyUser publicAgencyUser= publicAgencyUserMapper.selectById(id);
FeignClientResult data=Privilege.agencyUserClient.restorePassword(publicAgencyUser.getAmosUserId());
LambdaQueryWrapper<PersonnelBusiness> qug=new LambdaQueryWrapper<>();
qug.eq(PersonnelBusiness::getFoundationId,publicAgencyUser.getSequenceNbr());
PersonnelBusiness personnelBusines=personnelBusinessMapper.selectOne(qug);
UserMessage userMessage= new UserMessage( TaskTypeStationEnum.重置密码.getCode(), publicAgencyUser.getSequenceNbr() , publicAgencyUser.getAmosUserId(), new Date(), "您的密码已重置成功,密码为:a1234560,请尽快修改密码。", personnelBusines.getAmosUnitOrgCode());
if(data==null||data.getResult()==null){
throw new BadRequest("修改状态失败!");
}else{
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" , JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}catch (Exception e){
e.printStackTrace();
throw new BadRequest("修改状态失败!");
}
return ResponseHelper.buildResponse(null);
}
......
package com.yeejoin.amos.boot.module.hygf.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
......@@ -17,14 +18,21 @@ import com.qiyuesuo.sdk.v2.utils.Algorithm;
import com.qiyuesuo.sdk.v2.utils.Base64Utils;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.hygf.api.Enum.HouseholdContractEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.TaskTypeStationEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.CallbackDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.ContractDataDto;
import com.yeejoin.amos.boot.module.hygf.api.dto.HouseholdContractDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.HouseholdContract;
import com.yeejoin.amos.boot.module.hygf.api.entity.SealDictionary;
import com.yeejoin.amos.boot.module.hygf.api.entity.ToDoTasks;
import com.yeejoin.amos.boot.module.hygf.api.entity.UserMessage;
import com.yeejoin.amos.boot.module.hygf.api.mapper.HouseholdContractMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.SealDictionaryMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.ToDoTasksMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.UserMessageMapper;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.HouseholdContractServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.QiyuesuoServiceImpl;
import com.yeejoin.amos.boot.module.hygf.biz.service.impl.ToDoTasksServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
......@@ -32,6 +40,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
......@@ -63,10 +72,20 @@ public class QiyuesuoController extends BaseController {
QiyuesuoServiceImpl qiyuesuoService;
@Autowired
HouseholdContractServiceImpl householdContractServiceImpl;
@Autowired
HouseholdContractMapper householdContractMapper;
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
UserMessageMapper userMessageMapper;
@Autowired
ToDoTasksMapper toDoTasksMapper;
@Value("${qiyuesuo.secretKey}")
private String secretKey;
@Autowired
ToDoTasksServiceImpl toDoTasksServiceImpl;
@Value("${dealer.engineering}")
private String engineering;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "post",value = "个人token", notes = "个人token")
......@@ -129,6 +148,13 @@ public class QiyuesuoController extends BaseController {
wrapper.set(HouseholdContract::getStatus,HouseholdContractEnum.合同状态_农户已签署.getCode());
wrapper.eq(HouseholdContract::getContractLockId,CallbackDto.getContractId());
householdContractServiceImpl.update(wrapper);
LambdaQueryWrapper<HouseholdContract> wrapper4 = new LambdaQueryWrapper<>();
wrapper4.eq(HouseholdContract::getContractLockId,CallbackDto.getContractId());
HouseholdContract householdContrac= householdContractMapper.selectOne(wrapper4);
//生成填报任务
ToDoTasks toDoTasks1= new ToDoTasks ( TaskTypeStationEnum.合同填报.getCode(), householdContrac.getSequenceNbr(), "用户"+householdContrac.getPartyA()+"合同盖章",householdContrac.getDealerCode());
toDoTasksServiceImpl.addToDoTasksByRole(engineering,toDoTasks1,"发起合同成功");
}else if("SEAL".equals(CallbackDto.getCallbackType())){
......@@ -139,6 +165,29 @@ public class QiyuesuoController extends BaseController {
wrapper.set(HouseholdContract::getSealedUser,getUserInfo().getRealName());
wrapper.eq(HouseholdContract::getContractLockId,CallbackDto.getContractId());
householdContractServiceImpl.update(wrapper);
LambdaQueryWrapper<HouseholdContract> wrapper4 = new LambdaQueryWrapper<>();
wrapper4.eq(HouseholdContract::getContractLockId,CallbackDto.getContractId());
HouseholdContract contract= householdContractMapper.selectOne(wrapper4);
LambdaQueryWrapper<ToDoTasks> wrapper1 = new LambdaQueryWrapper<>();
wrapper1.eq(ToDoTasks::getType, TaskTypeStationEnum.合同填报.getCode());
wrapper1.eq(ToDoTasks::getState, "待办");
wrapper1.eq(ToDoTasks::getBusinessId, contract.getSequenceNbr());
ToDoTasks doTasks= toDoTasksMapper.selectOne(wrapper1);
if(doTasks!=null){
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成", doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" , JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}
}catch (Exception e){
......
package com.yeejoin.amos.boot.module.hygf.biz.emqx;
package com.yeejoin.amos.boot.module.hygf.biz.x;
import com.alibaba.fastjson.JSONObject;
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.Page;
......@@ -25,6 +26,7 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.service.BaseService;
......@@ -45,7 +47,8 @@ public class DealerReviewServiceImpl extends BaseService<DealerReviewDto, Dealer
private static final String IDX_REQUEST_STATE = "200";
@Autowired
WorkflowFeignClient workflowFeignClient;
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
AmosRequestContext requestContext;
@Autowired
......@@ -98,8 +101,12 @@ public class DealerReviewServiceImpl extends BaseService<DealerReviewDto, Dealer
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" , JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成."+meg, doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}
return fl;
......
......@@ -5,12 +5,15 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.module.hygf.api.Enum.TaskTypeStationEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.PersonnelBusiness;
import com.yeejoin.amos.boot.module.hygf.api.entity.RegionalCompanies;
import com.yeejoin.amos.boot.module.hygf.api.entity.UnitInfo;
import com.yeejoin.amos.boot.module.hygf.api.entity.UserMessage;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PersonnelBusinessMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.UnitInfoMapper;
import com.yeejoin.amos.boot.module.hygf.api.mapper.UserMessageMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IPersonnelBusinessService;
import com.yeejoin.amos.boot.module.standard.api.entity.PublicAgencyUser;
import com.yeejoin.amos.boot.module.standard.api.mapper.PublicAgencyUserMapper;
......@@ -25,6 +28,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -46,11 +50,15 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
PublicAgencyUserMapper publicAgencyUserMapper;
@Autowired
UnitInfoMapper unitInfoMapper;
@Autowired
UserMessageMapper userMessageMapper;
@Value("${dealer.appcode}")
private String appCodes;
@Value("${amos.secret.key}")
String secretKey;
@Autowired
protected EmqKeeper emqKeeper;
@Value("${hygf.user.group.id}")
private long userGroupId;
/**
......@@ -276,6 +284,8 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
@Transactional
public void replace(String id){
try {
//获取当前用户
LambdaQueryWrapper<PublicAgencyUser> qud=new LambdaQueryWrapper<>();
qud.eq(PublicAgencyUser::getSequenceNbr,id);
......@@ -316,6 +326,18 @@ public class PersonnelBusinessServiceImpl extends BaseService<PersonnelBusinessD
//删除旧管理员
Privilege.groupUserClient.deleteGroupUser(userGroupId,publicAgencyUsex.getAmosUserId());
UserMessage userMessage= new UserMessage( TaskTypeStationEnum.设置管理员.getCode(), personnelBusines.getSequenceNbr() , publicAgencyUse.getAmosUserId(), new Date(), "您已成为单位管理员。", personnelBusines.getAmosUnitOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" , JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}catch (Exception e){
e.printStackTrace();
throw new BadRequest("设置失败!");
}
}
......
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
......@@ -24,6 +25,7 @@ import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.annotation.Condition;
import org.typroject.tyboot.core.rdbms.annotation.Operator;
......@@ -69,6 +71,8 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
@Autowired
ToDoTasksMapper toDoTasksMapper;
@Autowired
protected EmqKeeper emqKeeper;
@Autowired
ToDoTasksServiceImpl toDoTasksServiceImpl;
@Autowired
UserMessageMapper userMessageMapper;
......@@ -129,13 +133,21 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
PowerStationNodeEnum powerStationNodeEnum= PowerStationNodeEnum.getNodeByCode(powerStation.getNextProcessNode());
if (flag){
ToDoTasks toDoTasks=null;
if(PowerStationNodeEnum.经销商上传图纸.getCode().equals(powerStationNodeEnum.getCode())||PowerStationNodeEnum.经销商审核.getCode().equals(powerStationNodeEnum.getCode())){
//获取经销商orgcode
PeasantHousehold peasantHouseholdd= peasantHouseholdService.getById(powerStation.getPeasantHouseholdId());
ToDoTasks toDoTasks= new ToDoTasks ( TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户"+name+"电站待"+powerStationNodeEnum.getName(),peasantHouseholdd.getDeveloperCode());
toDoTasks= new ToDoTasks ( TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户"+name+"电站勘察待"+powerStationNodeEnum.getName(),peasantHouseholdd.getDeveloperCode());
if(PowerStationNodeEnum.经销商审核.getCode().equals(powerStationNodeEnum.getCode())){
toDoTasksServiceImpl.addToDoTasksByUserId(peasantHouseholdd.getDeveloperUserId(),toDoTasks,meg);
}else{
toDoTasksServiceImpl.addToDoTasksByRole(powerStation.getNodeRole(),toDoTasks,meg);
}
}else{
toDoTasks= new ToDoTasks ( TaskTypeStationEnum.电站审核.getCode(), powerStation.getSequenceNbr(), "用户"+name+"电站勘察待"+powerStationNodeEnum.getName(),null);
toDoTasksServiceImpl.addToDoTasksByRole(powerStation.getNodeRole(),toDoTasks,meg);
}
}else{
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站审核.getCode());
......@@ -147,8 +159,12 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成."+meg, doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" , JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}
......
......@@ -34,6 +34,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
......@@ -88,7 +89,8 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
UserMessageMapper userMessageMapper;
@Value("${power.station.examine.pageId}")
private long pageId;
@Autowired
protected EmqKeeper emqKeeper;
@Value("${power.station.examine.planId}")
private String planId;
......@@ -114,6 +116,9 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
@Transactional
public SurveyInfoAllDto saveSurveyInfo(SurveyInfoAllDto surveyInfoAllDto,String operationType) {
try {
JSONArray regionName = getRegionName();
List<RegionModel> list = JSONArray.parseArray(regionName.toJSONString(), RegionModel.class);
......@@ -195,10 +200,6 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
}else if(OPERATION_TYPE_APPLY.equals(operationType)){
// 提交审核
submitExamine(peasantHousehold);
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, TaskTypeStationEnum.电站勘察.getCode());
wrapper.eq(ToDoTasks::getState, "待办");
......@@ -208,11 +209,22 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成", doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
}catch (Exception e){
e.printStackTrace();
throw new RuntimeException("系统异常");
}
return surveyInfoAllDto;
}
......
......@@ -20,6 +20,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.HttpClientErrorException;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -44,6 +47,9 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
@Autowired
UserMessageMapper userMessageMapper;
@Autowired
protected EmqKeeper emqKeeper;
final static Logger log = LoggerFactory.getLogger(ToDoTasksServiceImpl.class);
/**
......@@ -77,7 +83,11 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
@Override
@Transactional
public void addToDoTasksByUserId(String userId, ToDoTasks toDoTasks,String meg) {
try {
LambdaQueryWrapper<ToDoTasks> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(ToDoTasks::getType, toDoTasks.getType());
wrapper.eq(ToDoTasks::getState, "待办");
......@@ -87,14 +97,21 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成."+meg, doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
toDoTasks.setAmosUserId(userId);
toDoTasksMapper.insert(toDoTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(toDoTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName()+"待完成", toDoTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}catch (Exception e){
throw new RuntimeException("任务添加失败!");
}
}
@Override
......@@ -113,14 +130,19 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
doTasks.setState("已办");
doTasks.setCompleteTime(new Date());
toDoTasksMapper.updateById(doTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(doTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( doTasks.getType(), doTasks.getBusinessId(), doTasks.getAmosUserId(), new Date(), doTasks.getTaskName()+"已完成."+meg, doTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
synchronized (this) {
if (redisUtils.hasKey("TAKS_" + role)) {
String id = redisUtils.get("TAKS_" + role).toString();
System.out.println(role+"角色人员"+id);
List<TasksRole> listd = toDoTasksMapper.getTasksRole(role,toDoTasks.getAmosOrgCode());
if (listd != null && !listd.isEmpty()) {
......@@ -139,6 +161,7 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
redisUtils.set("TAKS_" + role, idList.get(0));
}
}else {
System.out.println(role+"没有此角色人员");
log.info("没有此角色人员!");
}
......@@ -151,14 +174,17 @@ public class ToDoTasksServiceImpl extends BaseService<ToDoTasksDto,ToDoTasks,ToD
redisUtils.set("TAKS_" + role, idList.get(0));
} else {
System.out.println(role+"没有此角色人员");
log.info("没有此角色人员!");
}
}
toDoTasksMapper.insert(toDoTasks);
emqKeeper.getMqttClient().publish("TASK_MESSAGE" ,JSON.toJSONString(toDoTasks).getBytes(), 2 ,false);
UserMessage userMessage= new UserMessage( toDoTasks.getType(), toDoTasks.getBusinessId(), toDoTasks.getAmosUserId(), new Date(), toDoTasks.getTaskName()+"待完成", toDoTasks.getAmosOrgCode());
userMessageMapper.insert(userMessage);
emqKeeper.getMqttClient().publish("MY_MESSAGE" ,JSON.toJSONString(userMessage).getBytes(), 2 ,false);
}
}catch(Exception e){
......
......@@ -34,6 +34,11 @@ public class TreeDto {
private Integer isOnClick;
/**
* 风机首页-配置页面场景ID
*/
private String sceneId;
/**
* 子节点
*/
private List<TreeDto> children;
......
......@@ -160,7 +160,8 @@
sequence_nbr as code,
station_type as parentCode,
sequence_nbr as id,
'1' as isOnclick
'1' as isOnclick,
scene_id as sceneId
from station_basic
<where>
<if test="regionCode != null and regionCode != ''">
......
......@@ -17,8 +17,8 @@ public class CommonConstans {
// 发电量完成率=(月/年)发电量/(月/年)发电量指标
// 小时数完成率=(月/年)可利用小时/(月/年)可利用小时数指标
// 可利用小时(h)=(日/月/年)发电量(万kW·h)/装机容量(万kW)
// 二氧化碳减排量(万t)=发电量(万kW·h)*0.79
public static final Double carbonDioxide = 0.79;
// 二氧化碳减排量(万t)=发电量(万kW·h)*0.997 * 10 / 10000
public static final Double carbonDioxide = 0.997 * 10 / 10000;
// 节约标准煤(万t)=发电量(万kW·h)*0.29
public static final Double standardCoal = 0.29;
// 炭粉尘减排量(t)=发电量(万kW·h)*0.30
......@@ -75,4 +75,19 @@ public class CommonConstans {
}
};
//es EquipIndexName 查绚关键字
public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword";
//es gatewayId 查绚关键字
public static final String QueryStringGateWayId = "gatewayId.keyword";
public static final String QueryStringFrontMoudle = "frontModule.keyword";
public static final String QueryStringSystemType = "systemType";
public static final String QueryStringEquipmentNumber = "equipmentNumber";
public static final String QueryStringValue = "value";
public static final String QueryStringValueKeyword = "value.keyword";
public static final String QueryStringDataType = "dataType";
public static final String QueryStringDisplayName = "displayName";
public static final String QueryStringIsAlarm = "isAlarm";
public static final String Twodecimalplaces= "%.2f";
public static final String Fourdecimalplaces = "%.4f";
public static final String QueryStringFrontMoudleNotKeyWord = "frontModule";
}
......@@ -241,7 +241,7 @@ public class MonitorFanIdxController extends BaseController {
}
String num = monitorFanIndicator.getFJCount(gatewayId);
columnMap.put("风机台数",num);
columnMap.put("风机台数",Double.valueOf(num).intValue());
Double capacityl = commonServiceImpl.getStationCapactityByStationWerks(stationBasic.getStationNumber());
columnMap.put("装机容量",String.format("%.2f",capacityl));
......@@ -255,17 +255,18 @@ public class MonitorFanIdxController extends BaseController {
List<Map> list = parseArray(json, Map.class);
for (Map map : list) {
String key = map.get("title").toString();
map.put("title", columnMap.get(key)==null?0.00:columnMap.get(key));
map.put("title2",map.get("title"));
if (map.containsKey("action")){
if (key.equals("日利用小时")){
map.put("title", map.get("action").toString().replace("*","日发电量").replace("-","装机容量"));
String format = String.format("%.2f", ((Double.parseDouble(columnMap.get("日发电量").toString())*10)/ (Double.parseDouble(columnMap.get("装机容量").toString()))));
map.put("title", format);
map.put("title2",map.get("title"));
}else {
map.put("title", map.get("action").toString().replace("*",columnMap.get(key).toString()));
map.put("title",String.format("%.2f",Double.parseDouble(columnMap.get(key).toString())/1000));
map.put("title2",map.get("title"));
}
}
map.put("title", columnMap.get(key)==null?0.00:columnMap.get(key));
map.put("title2",map.get("title"));
}
......
......@@ -30,6 +30,7 @@ import org.elasticsearch.search.aggregations.metrics.SumAggregationBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate;
import org.springframework.data.elasticsearch.core.SearchHit;
import org.springframework.data.elasticsearch.core.SearchHits;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.data.elasticsearch.core.query.Query;
......@@ -281,6 +282,47 @@ public class CommonServiceImpl {
return listdata;
}
public Double getSumByEquipmentIndxName(List<ESEquipments> equipments, String indexName) {
Double result = 0.00;
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueDouble).sum();
return result;
}
/**
* 根据查询条件获取列表信息
*
* @param mustQuerCondtion
* @param shouldQuerCondtion
* @param tClass
* @param <T>
* @return
*/
public <T> List<T> getListDataByCondtions(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
for (String key : mustQuerCondtion.keySet()) {
List<String> va = mustQuerCondtion.get(key);
queryBuilder.must(QueryBuilders.termsQuery(key, va));
}
}
if (!ObjectUtils.isEmpty(shouldQuerCondtion)) {
for (String key : shouldQuerCondtion.keySet()) {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, tClass);
if (search.hasSearchHits()) {
List<SearchHit<T>> searchHitList = search.getSearchHits();
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return null;
}
}
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
......@@ -19,6 +21,7 @@ import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MonitorFanIndicatorMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
......@@ -108,6 +111,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired
CommonServiceImpl commonServiceImpl;
@Value("classpath:/json/fanlocation.json")
private Resource fanlocation;
@Value("${pictureUrl}")
String pictureUrl;
......@@ -357,8 +362,28 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
item.setState(status);
});
return equipNumList;
}
public List<ESEquipments> getFanStatusListEs(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("发电状态", "报警状态", "停机状态", "故障状态", "待机状态", "维护状态", "正常发电状态", "实时故障22"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("报警状态"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
Map<String, String> collect = result.stream().collect(Collectors.toMap(ESEquipments::getEquipmentNumber, ESEquipments::getEquipmentIndexName, (item1, item2) -> item1));
equipNumList.forEach(item -> {
String status = ObjectUtils.isEmpty(CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()))) ? "通讯中断" : CommonConstans.fanStatus.get(collect.get(item.getEquipmentNumber()));
item.setAddress(status);
});
return equipNumList;
}
public List<IndexDto> getFanStatusListOptimize(String stationId) {
StationBasic stationBasic = getOneByStationNumber(stationId);
String sqlAll = String.format("SELECT * FROM \"indicators_%s\"",stationBasic.getFanGatewayId());
......@@ -459,17 +484,65 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public IndexDto getFanBasicInfoByEquipNum(String equipNum, String stationId) {
// IndexDto indexDto = new IndexDto();
// StationBasic stationBasic = getOneByStationNumber(stationId);
// String sql = String.format("SELECT equipmentNumber, equipmentSpecificName, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true' order by time desc limit 1", stationBasic.getFanGatewayId(), equipNum);
// List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
// if (CollectionUtils.isNotEmpty(influxDBList)) {
// String equipmentSpecificName = influxDBList.get(0).getEquipmentSpecificName();
// influxDBList.get(0).setEquipmentSpecificName(equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#")));
// String s = StringUtils.substringAfterLast(equipmentSpecificName, "#");
// influxDBList.get(0).setFanName(s);
// indexDto = influxDBList.get(0);
// } else {
// List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId(), equipNum);
// if (CollectionUtils.isEmpty(fanConfigPower)) {
// throw new BadRequest("fan_config_power表数据未维护该风机");
// }
// String equipmentSpecificName = fanConfigPower.get(0).get("equipmentSpecificName");
// String substring = equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#"));
// indexDto.setEquipmentSpecificName(substring);
// indexDto.setFanName(StringUtils.substringAfterLast(equipmentSpecificName, "#"));
// indexDto.setEquipmentIndexName("正常运行");
// String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
// String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
// List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
// List<String> powList = powerNum.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
//
// Date currentDayStartTime = DateUtils.dateAddMinutes(new Date(), -15);
// String time = "";
// try {
// time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
// } catch (ParseException e) {
// e.printStackTrace();
// }
// String timeSql = String.format("select distinct equipmentNumber from \"indicators_%s\" where time >= '%s'", stationBasic.getFanGatewayId(), time);
// List<IndexDto> timeSqlList = influxDButils.getListData(timeSql, IndexDto.class);
// List<String> timeList = timeSqlList.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
//
// if (CollectionUtils.isNotEmpty(powList)) {
// indexDto.setEquipmentIndexName("限功率");
// } else if (!timeList.contains(equipNum)) {
// indexDto.setEquipmentIndexName("通讯中断");
// }
// }
// indexDto.setEquipmentNumber(equipNum);
// return indexDto;
String json = null;
try {
json = IOUtils.toString(fanlocation.getInputStream(), java.lang.String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
e.printStackTrace();
}
JSONArray jsonArray = JSONObject.parseArray(json);
JSONObject jsonObject = (JSONObject) jsonArray.get(Integer.valueOf(equipNum) - 1);
IndexDto indexDto = new IndexDto();
indexDto.setLongitude(String.valueOf(jsonObject.get("longitude")));
indexDto.setLatitude(String.valueOf(jsonObject.get("latitude")));
StationBasic stationBasic = getOneByStationNumber(stationId);
String sql = String.format("SELECT equipmentNumber, equipmentSpecificName, equipmentIndexName FROM \"indicators_%s\" WHERE equipmentNumber = '%s' and equipmentIndexName =~/^报警状态|停机状态|故障状态|待机状态|维护状态|正常发电状态$/ and value = 'true' order by time desc limit 1", stationBasic.getFanGatewayId(), equipNum);
List<IndexDto> influxDBList = influxDButils.getListData(sql, IndexDto.class);
if (CollectionUtils.isNotEmpty(influxDBList)) {
String equipmentSpecificName = influxDBList.get(0).getEquipmentSpecificName();
influxDBList.get(0).setEquipmentSpecificName(equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#")));
String s = StringUtils.substringAfterLast(equipmentSpecificName, "#");
influxDBList.get(0).setFanName(s);
indexDto = influxDBList.get(0);
} else {
List<ESEquipments> fanStatusList = getFanStatusListEs(stationId);
String fanStatus = fanStatusList.stream().filter(esEquipments -> esEquipments.getEquipmentNumber().equals(equipNum)).collect(Collectors.toList()).get(0).getAddress();
indexDto.setEquipmentIndexName(fanStatus);
List<Map<String, String>> fanConfigPower = monitorFanIndicatorregionMapper.getFanConfigPower(stationBasic.getFanGatewayId(), equipNum);
if (CollectionUtils.isEmpty(fanConfigPower)) {
throw new BadRequest("fan_config_power表数据未维护该风机");
......@@ -477,30 +550,6 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String equipmentSpecificName = fanConfigPower.get(0).get("equipmentSpecificName");
String substring = equipmentSpecificName.substring(0, equipmentSpecificName.indexOf("#"));
indexDto.setEquipmentSpecificName(substring);
indexDto.setFanName(StringUtils.substringAfterLast(equipmentSpecificName, "#"));
indexDto.setEquipmentIndexName("正常运行");
String equipmentSpecificNames = fanConfigPower.stream().map(t -> t.get("equipmentSpecificName")).collect(Collectors.joining("|"));
String powerSql = String.format("SELECT equipmentNumber, value FROM \"indicators_%s\" WHERE equipmentSpecificName =~/^%s$/ and value = '9.0'", stationBasic.getFanGatewayId(), equipmentSpecificNames);
List<IndexDto> powerNum = influxDButils.getListData(powerSql, IndexDto.class);
List<String> powList = powerNum.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
Date currentDayStartTime = DateUtils.dateAddMinutes(new Date(), -15);
String time = "";
try {
time = DateUtils.dateFormat(currentDayStartTime, DateUtils.DATE_TIME_PATTERN);
} catch (ParseException e) {
e.printStackTrace();
}
String timeSql = String.format("select distinct equipmentNumber from \"indicators_%s\" where time >= '%s'", stationBasic.getFanGatewayId(), time);
List<IndexDto> timeSqlList = influxDButils.getListData(timeSql, IndexDto.class);
List<String> timeList = timeSqlList.stream().map(IndexDto::getEquipmentNumber).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(powList)) {
indexDto.setEquipmentIndexName("限功率");
} else if (!timeList.contains(equipNum)) {
indexDto.setEquipmentIndexName("通讯中断");
}
}
indexDto.setEquipmentNumber(equipNum);
return indexDto;
}
......
package com.yeejoin.amos.boot.module.jxiop.biz.service.impl;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MapRegion;
import com.yeejoin.amos.boot.module.jxiop.api.entity.Region;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationBasic;
import com.yeejoin.amos.boot.module.jxiop.api.entity.StationCoordinate;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.MapRegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.RegionMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.StationCoordinateMapper;
import com.yeejoin.amos.boot.module.jxiop.api.entity.*;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.*;
import com.yeejoin.amos.boot.module.jxiop.biz.ESDto.ESEquipments;
import com.yeejoin.amos.boot.module.jxiop.biz.constants.CommonConstans;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.*;
import com.yeejoin.amos.component.influxdb.InfluxdbUtil;
import lombok.Data;
......@@ -40,6 +37,8 @@ public class MonitoringServiceImpl {
*/
@Autowired
RegionMapper regionMapper;
@Autowired
StationPlanMapper stationPlanMapper;
/**
* 场站mapper
*/
......@@ -783,6 +782,29 @@ public class MonitoringServiceImpl {
}
public void getTotalData() {
//计算所有场站年计划完成量
int year = Calendar.getInstance().get(Calendar.YEAR);
int Moon = Calendar.getInstance().get(Calendar.MONTH);
LambdaQueryWrapper<StationPlan> query = new LambdaQueryWrapper<>();
query.eq(StationPlan::getYear,String.valueOf(year));
List<StationPlan> stationPlans = stationPlanMapper.selectList(query);
double yearValue = stationPlans.stream().mapToDouble(StationPlan::getValue).sum();
double fdzValue = stationPlans.stream().filter(e -> e.getStationType().equals("FDZ")).mapToDouble(StationPlan::getValue).sum();
double gfvalue = yearValue - fdzValue;
double moonValue = stationPlans.stream().filter(e ->e.getMonthly().equals(Moon)).mapToDouble(StationPlan::getValue).sum();
//查询风电站年计划完成量
//
// List<StationCacheInfoDto> listStationCacheInfoDto = commonServiceImpl.getListStationCacheInfoDto();
// List<String> fdz = listStationCacheInfoDto.stream().filter(e -> e.getStationType().equals("FDZ")).map(StationCacheInfoDto::getStationId).collect(Collectors.toList());
// LambdaQueryWrapper<StationPlan> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.eq(StationPlan::getYear,String.valueOf(year));
// queryWrapper.in(StationPlan::getStationBasicId,fdz);
// List<StationPlan> fdzPlans = stationPlanMapper.selectList(queryWrapper);
// double fdzValue = fdzPlans.stream().mapToDouble(StationPlan::getValue).sum();
List<StationBasic> stationBasicListAll = stationBasicMapper.selectList(new QueryWrapper<StationBasic>().isNotNull("fan_gateway_id"));
List<StationBasic> fdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("FDZ")).collect(Collectors.toList());
List<StationBasic> jzsgfdzList = stationBasicListAll.stream().filter(stationBasic -> stationBasic.getStationType().equals("JZSGFDZ")).collect(Collectors.toList());
......@@ -832,70 +854,84 @@ public class MonitoringServiceImpl {
AtomicReference<Double> powerOfMonthGF = new AtomicReference<>(new Double(0.00));
AtomicReference<Double> powerOfAnnualGF = new AtomicReference<>(new Double(0.00));
fdzList.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
Map<String,List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,Arrays.asList("日发电量","月发电量","年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion,null,ESEquipments.class);
powerOfDayFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualFD.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
});
gfList.forEach(stationBasic -> {
List<Map<String, Object>> mapList;
mapList = influxdbUtil.query("SELECT * FROM indicators_" + stationBasic.getFanGatewayId() + " where frontModule=~/逆变器/ and (equipmentIndexName='日发电量' or equipmentIndexName='月发电量' or equipmentIndexName='年发电量' )");
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "日发电量"));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "月发电量"));
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getTotalByIndicatior(mapList, "年发电量"));
Map<String,List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName,Arrays.asList("日发电量","月发电量","年发电量"));
queryCondtion.put(CommonConstans.QueryStringGateWayId,Arrays.asList(stationBasic.getFanGatewayId()));
Map<String,String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put("frontModule","逆变器");
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion,shouldQueryCondtion,ESEquipments.class);
powerOfDayGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "日发电量"));
powerOfMonthGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "月发电量"));
powerOfAnnualGF.updateAndGet(v -> v + commonServiceImpl.getSumByEquipmentIndxName(result, "年发电量"));
});
HashMap<String, String> stringHashMap4 = new HashMap<>();
stringHashMap4.put("title", String.format("%.2f", powerOfDayFD.get()) + "/" + String.format("%.2f", powerOfDayGF.get()));
stringHashMap4.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfDayGF.get() * CommonConstans.pvGenPoweActor));
list1.add(stringHashMap4);
HashMap<String, String> stringHashMap5 = new HashMap<>();
stringHashMap5.put("title", String.format("%.2f", powerOfMonthFD.get()) + "/" + String.format("%.2f", powerOfMonthGF.get()));
stringHashMap5.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfMonthGF.get() * CommonConstans.pvGenPoweActor));
list1.add(stringHashMap5);
HashMap<String, String> stringHashMap6 = new HashMap<>();
stringHashMap6.put("title", String.format("%.2f", powerOfAnnualFD.get()) + "/" + String.format("%.2f", powerOfAnnualGF.get()));
stringHashMap6.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor));
list1.add(stringHashMap6);
HashMap<String, String> stringHashMap7 = new HashMap<>();
stringHashMap7.put("title", String.format("%.2f", powerOfAnnualFD.get() % 200) + "/" + String.format("%.2f", powerOfAnnualGF.get() % 200));
stringHashMap7.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get()/fdzValue ) + "/" + String.format(CommonConstans.Twodecimalplaces, powerOfAnnualGF.get()*CommonConstans.pvGenPoweActor/gfvalue));
list1.add(stringHashMap7);
HashMap<String, String> stringHashMap8 = new HashMap<>();
stringHashMap8.put("title", String.format("%.2f", powerOfAnnualFD.get() / fdzInstall.doubleValue()) + "/" + String.format("%.2f", powerOfAnnualGF.get() / gfInstall.doubleValue()));
stringHashMap8.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() * CommonConstans.wkwhToMv) / fdzInstall.doubleValue()) + "/" + String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor * CommonConstans.wkwhToMv) / gfInstall.doubleValue()));
list1.add(stringHashMap8);
page1.setRecords(list1);
HashMap<String, String> stringHashMap9 = new HashMap<>();
stringHashMap9.put("title", String.format("%.2f", powerOfDayFD.get() + powerOfDayGF.get()));
stringHashMap9.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get() + powerOfDayGF.get() * CommonConstans.pvGenPoweActor));
HashMap<String, String> resultMap = new HashMap<>();
resultMap.put("Day", String.format(CommonConstans.Twodecimalplaces, powerOfDayFD.get() + powerOfDayGF.get() * CommonConstans.pvGenPoweActor));
list2.add(stringHashMap9);
HashMap<String, String> stringHashMap10 = new HashMap<>();
stringHashMap10.put("title", String.format("%.2f", powerOfMonthFD.get() + powerOfMonthGF.get()));
stringHashMap10.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get() * CommonConstans.pvGenPoweActor));
resultMap.put("Moon", String.format(CommonConstans.Twodecimalplaces, powerOfMonthFD.get() + powerOfMonthGF.get() * CommonConstans.pvGenPoweActor));
resultMap.put("YJHWC", String.format(CommonConstans.Twodecimalplaces, (powerOfMonthFD.get() + powerOfMonthGF.get() * CommonConstans.pvGenPoweActor)/moonValue));
list2.add(stringHashMap10);
HashMap<String, String> stringHashMap11 = new HashMap<>();
stringHashMap11.put("title", String.format("%.2f", powerOfAnnualFD.get() + powerOfAnnualGF.get()));
stringHashMap11.put("title", String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor));
resultMap.put("Year",String.format(CommonConstans.Twodecimalplaces, powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor));
list2.add(stringHashMap11);
HashMap<String, String> stringHashMap12 = new HashMap<>();
stringHashMap12.put("title", String.format("%.2f", (powerOfAnnualFD.get() % 200 + powerOfAnnualGF.get() % 200) / 2));
stringHashMap12.put("title", String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()*CommonConstans.pvGenPoweActor) /yearValue));
resultMap.put("NJHWC",String.format(CommonConstans.Twodecimalplaces, (powerOfAnnualFD.get() + powerOfAnnualGF.get()*CommonConstans.pvGenPoweActor) /yearValue));
list2.add(stringHashMap12);
page2.setRecords(list2);
Double totalAnnual = (powerOfAnnualFD.get() + powerOfAnnualGF.get() * CommonConstans.pvGenPoweActor);
HashMap<String, String> stringHashMap13 = new HashMap<>();
stringHashMap13.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.000832));
stringHashMap13.put("title2", "二氧化碳减排量(万t)");
stringHashMap13.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.carbonDioxide)));
stringHashMap13.put("unit", "二氧化碳减排量(万t)");
list3.add(stringHashMap13);
HashMap<String, String> stringHashMap14 = new HashMap<>();
stringHashMap14.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.0003049));
stringHashMap14.put("title2", "节约标准煤(万t)");
stringHashMap14.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.standardCoal)));
stringHashMap14.put("unit", "节约标准煤(万t)");
list3.add(stringHashMap14);
HashMap<String, String> stringHashMap15 = new HashMap<>();
stringHashMap15.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.00032));
stringHashMap15.put("title2", "碳粉尘减排量(万t)");
stringHashMap15.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.toner * CommonConstans.tToWT)));
stringHashMap15.put("unit", "碳粉尘减排量(万t)");
list3.add(stringHashMap15);
HashMap<String, String> stringHashMap16 = new HashMap<>();
stringHashMap16.put("title1", String.format("%.2f", (powerOfAnnualFD.get() + powerOfAnnualGF.get()) * 0.0016));
stringHashMap16.put("title2", "二氧化硫减排量(万t)");
stringHashMap16.put("title", String.format(CommonConstans.Twodecimalplaces, (totalAnnual * CommonConstans.sulfurDioxide * CommonConstans.tToWT)));
stringHashMap16.put("unit", "二氧化硫减排量(万t)");
list3.add(stringHashMap16);
page3.setRecords(list3);
try {
emqKeeper.getMqttClient().publish("total_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("total_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zjrl_topic", JSON.toJSON(page).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_ssscsj_topic", JSON.toJSON(page1).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zssscsj_topic", JSON.toJSON(page2).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_qgjrdz_topic", JSON.toJSON(resultMap).toString().getBytes("UTF-8"), 1, true);
emqKeeper.getMqttClient().publish("bigscreen_zshgx_topic", JSON.toJSON(page3).toString().getBytes("UTF-8"), 1, true);
} catch (Exception ex) {
}
......
[
{
"euqipmentNumber": "01",
"latitude": "26°19'20.3968",
"longitude": "114°43'01.3487"
},
{
"euqipmentNumber": "02",
"latitude": "26°18'17.3192",
"longitude": "114°43'55.0756"
},
{
"euqipmentNumber": "03",
"latitude": "26°18'34.3219",
"longitude": "114°44'01.4686"
},
{
"euqipmentNumber": "04",
"latitude": "26°18'42.2673",
"longitude": "114°44'10.7522"
},
{
"euqipmentNumber": "05",
"latitude": "26°18'38.0098",
"longitude": "114°44'21.7018"
},
{
"euqipmentNumber": "06",
"latitude": "26°18'34.6466",
"longitude": "114°44'29.9556"
},
{
"euqipmentNumber": "07",
"latitude": "26°18'36.8995",
"longitude": "114°44'39.7470"
},
{
"euqipmentNumber": "08",
"latitude": "26°18'33.5051",
"longitude": "114°44'50.8102"
},
{
"euqipmentNumber": "09",
"longitude": "114°42'38.4597",
"latitude": "26°16'45.3175"
},
{
"euqipmentNumber": "10",
"longitude": "114°42'46.7892",
"latitude": "26°16'34.2193"
},
{
"euqipmentNumber": "11",
"longitude": "114°42'57.3524",
"latitude": "26°16'18.2295"
},
{
"euqipmentNumber": "12",
"longitude": "114°43'44.6453",
"latitude": "26°16'22.9530"
},
{
"euqipmentNumber": "13",
"latitude": "26°16'25.2473",
"longitude": "114°43'55.4240"
},
{
"euqipmentNumber": "14",
"latitude": "26°15'23.8288",
"longitude": "114°42'46.1713"
},
{
"euqipmentNumber": "15",
"latitude": "26°15'18.3501",
"longitude": "114°42'36.4494"
},
{
"euqipmentNumber": "16",
"latitude": "26°15'15.1157",
"longitude": "114°42'24.2207"
},
{
"euqipmentNumber": "17",
"latitude": "26°15'12.3541",
"longitude": "114°42'16.2315"
},
{
"euqipmentNumber": "18",
"latitude": "26°15'07.7590",
"longitude": "114°42'09.1002"
},
{
"euqipmentNumber": "19",
"latitude": "26°15'06.4482",
"longitude": "114°41'59.3730"
},
{
"euqipmentNumber": "20",
"latitude": "26°15'05.7242",
"longitude": "114°41'51.2436"
},
{
"euqipmentNumber": "21",
"latitude": "26°14'54.2353",
"longitude": "114°41'45.1572"
},
{
"euqipmentNumber": "22",
"latitude": "26°14'53.7742",
"longitude": "114°41'35.6931"
},
{
"euqipmentNumber": "23",
"latitude": "26°14'49.6670",
"longitude": "114°41'28.9852"
},
{
"euqipmentNumber": "24",
"latitude": "26°14'52.6637",
"longitude": "114°41'19.3269"
},
{
"euqipmentNumber": "25",
"latitude": "26°14'43.4608",
"longitude": "114°41'12.0974"
},
{
"euqipmentNumber": "26",
"latitude": "26°14'40.3649",
"longitude": "114°41'03.8101"
},
{
"euqipmentNumber": "27",
"latitude": "26°15'33.5730",
"longitude": "114°40'33.7931"
},
{
"euqipmentNumber": "28",
"latitude": "26°15'24.1330",
"longitude": "114°40'51.2196"
},
{
"euqipmentNumber": "29",
"latitude": "26°15'29.4603",
"longitude": "114°40'45.3326"
}
]
\ No newline at end of file
......@@ -86,8 +86,10 @@ public class PrivilegeController extends BaseController{
CompanyModel companyModel=dat.getResult();
List<CompanyModel> list =new ArrayList<>();
//如果是公司则获取所有片区
if(companyModel.getLevel().equals("headquarter")){
// 86*353*328*364
if(companyModel.getLevel().equals("categroy_leve2")){
Collection<CompanyModel> companyModelList= de.getResult();
companyModelList=companyModelList.stream().filter(companyModel1 ->companyModel1.getCompanyName().contains("区域")).collect(Collectors.toList());
companyModelList.parallelStream().forEach((companyModel1)->{companyModel1.setChildren(new ArrayList());});
return ResponseHelper.buildResponse(companyModelList);
}
......
......@@ -79,16 +79,23 @@ public class CommonConstans {
};
//es EquipIndexName 查绚关键字
public static final String QueryStringEquipmentIndexName = "equipmentIndexName.keyword";
//es EquipIndexName 查绚关键字
public static final String QueryStringEquipmentIndexNameNotKeyword = "equipmentIndexName";
//es gatewayId 查绚关键字
public static final String QueryStringGateWayId = "gatewayId.keyword";
public static final String QueryStringFrontMoudle = "frontModule.keyword";
public static final String QueryStringSystemType = "systemType";
public static final String QueryStringSystemTypeKeyword = "systemType.keyword";
public static final String QueryStringEquipmentNumber = "equipmentNumber";
public static final String QueryStringEquipmentNumberKeyword = "equipmentNumber.keyword";
public static final String QueryStringValue = "value";
public static final String QueryStringValueKeyword = "value.keyword";
public static final String QueryStringDataType = "dataType";
public static final String QueryStringDisplayName = "displayName";
public static final String QueryStringDisplayNameKeyword = "displayName.keyword";
public static final String QueryStringIsAlarm = "isAlarm";
public static final String QueryStringIsAlarmKeyword = "isAlarm.keyword";
public static final String Twodecimalplaces= "%.2f";
public static final String Fourdecimalplaces = "%.4f";
public static final String QueryStringFrontMoudleNotKeyWord = "frontModule";
}
......@@ -763,6 +763,7 @@ public class MonitorFanIdxController extends BaseController {
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.solarPowerOperation(gatewayId);
List<Map<String, Object>> collect = statusMonitoring.stream()
.sorted(Comparator.comparing(t -> Integer.parseInt(t.get("sort").toString())))
.skip((long) (current - 1) * size)
.limit(size)
.collect(Collectors.toList());
......@@ -822,4 +823,18 @@ public class MonitorFanIdxController extends BaseController {
Page<Map<String, Object>> result = monitorFanIndicator.nbqStatus(stationBasic.getFanGatewayId());
return ResponseHelper.buildResponse(result);
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "实时告警")
@GetMapping("/getEventByEquipIndex")
public ResponseModel<ResultsData> getEventByEquipIndex(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "equipIndex") String equipIndex,
@RequestParam(value = "frontModule") String frontModule) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
ResultsData resultsData = equipAlarmEventService.getEventByEquipIndex(gatewayId, current, size, equipIndex, frontModule);
return ResponseHelper.buildResponse(resultsData);
}
}
......@@ -464,7 +464,6 @@ public class CommonServiceImpl {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
......@@ -479,6 +478,7 @@ public class CommonServiceImpl {
}
/**
* 根据查询条件获取列表信息
*
......@@ -486,7 +486,7 @@ public class CommonServiceImpl {
* @param shouldQuerCondtion
* @param tClass
* @param <T>
* @param likeMap 模糊字段查询
* @param likeMap 模糊字段查询 key:不能带.keyWords
* @return
*/
public <T> List<T> getListDataByCondtionsAndLike(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass, Map<String, String> likeMap) {
......@@ -519,7 +519,7 @@ public class CommonServiceImpl {
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return null;
return new ArrayList<>();
}
......@@ -566,4 +566,36 @@ public class CommonServiceImpl {
result = equipments.stream().filter(esEquipments -> esEquipments.getEquipmentIndexName().equals(indexName)).mapToDouble(ESEquipments::getValueDouble).sum();
return result;
}
public <T> List<T> getListDataByCondtions(Map<String, List<String>> mustQuerCondtion, Map<String, String> shouldQuerCondtion, Class<T> tClass,Map<String, String> likeQuerCondtion) {
BoolQueryBuilder queryBuilder = QueryBuilders.boolQuery();
if (!ObjectUtils.isEmpty(mustQuerCondtion)) {
for (String key : mustQuerCondtion.keySet()) {
List<String> va = mustQuerCondtion.get(key);
queryBuilder.must(QueryBuilders.termsQuery(key, va));
}
}
if (!ObjectUtils.isEmpty(shouldQuerCondtion)) {
for (String key : shouldQuerCondtion.keySet()) {
queryBuilder.should(QueryBuilders.wildcardQuery(key, shouldQuerCondtion.get(key)));
}
}
if (!ObjectUtils.isEmpty(likeQuerCondtion)) {
for (String key : likeQuerCondtion.keySet()) {
queryBuilder.must(QueryBuilders.wildcardQuery(key, "*"+likeQuerCondtion.get(key)+"*"));
}
}
Query query = new NativeSearchQueryBuilder()
.withQuery(queryBuilder)
.build();
query.setTrackTotalHits(true);
SearchHits search = elasticsearchTemplate.search(query, tClass);
if (search.hasSearchHits()) {
List<SearchHit<T>> searchHitList = search.getSearchHits();
List<T> list = searchHitList.stream().map(hit -> hit.getContent()).collect(Collectors.toList());
return list;
}
return null;
}
}
......@@ -124,15 +124,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String table = gateway;
Map<String,List<String>> queryCodntion = new HashMap<>();
queryCodntion.put(CommonConstans.QueryStringGateWayId,Arrays.asList(gateway));
queryCodntion.put(CommonConstans.QueryStringIsAlarm,Arrays.asList("1"));
List<ESEquipments> alldata = commonServiceImpl.getListDataByCondtions(queryCodntion,null,ESEquipments.class);
queryCodntion.put(CommonConstans.QueryStringIsAlarmKeyword,Arrays.asList("1"));
List<ESEquipments> alldata = commonServiceImpl.getListDataByCondtionsAndLike(queryCodntion,null,ESEquipments.class, null);
List<ESEquipments> waringData = alldata.stream().filter(esEquipments -> !esEquipments.getValue().equals("0.0")&&!esEquipments.getValue().equals(esEquipments.getValueLabel())).collect(Collectors.toList());
if (StringUtils.isNotEmpty(equipmentNumber)) {
waringData= waringData.stream().filter(esEquipments -> esEquipments.getEquipmentNumber().equals(equipmentNumber)).collect(Collectors.toList());
}
List<ESEquipments> lisSort=waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * size),(current*size));
if (CollectionUtils.isNotEmpty(waringData)) {
waringData=waringData.stream().sorted(Comparator.comparing(ESEquipments::getCreatedTime).reversed()).collect(Collectors.toList()).subList(((current - 1) * size),(current*size));
}
//对于查询到的告警信息进行按照时间顺序进行排序
DataGridMock DataGridMock = new DataGridMock(current, !waringData.isEmpty() ? waringData.size() : 0, false, current, lisSort);
DataGridMock DataGridMock = new DataGridMock(current, !waringData.isEmpty() ? waringData.size() : 0, false, current, waringData);
ColModel colModelequipmentNumber = new ColModel("equipmentNumber", "equipmentNumber", "设备", "设备", "dataGrid", "equipmentNumber");
ColModel colModelvalueLabel = new ColModel("valueLabel", "valueLabel", "事件描述", "事件描述", "dataGrid", "valueLabel");
ColModel colModelcreatedTime = new ColModel("createdTime", "createdTime", "发生时间", "发生时间", "dataGrid", "createdTime");
......@@ -184,13 +186,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String sql = "";
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
Map<String, String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put("frontModule", frontModule);
shouldQueryCondtion.put("equipmentNumber", equipNum);
Map<String, String> likeMap = new HashMap<>();
likeMap.put("frontModule", frontModule);
likeMap.put("equipmentNumber", equipNum);
if (StringUtils.isNotEmpty(systemType)) {
shouldQueryCondtion.put("systemType", systemType);
likeMap.put("systemType", systemType);
}
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldQueryCondtion, ESEquipments.class);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
result.stream().forEach(e -> {
e.setValue(String.format(CommonConstans.Twodecimalplaces, e.getValueDouble()));
});
......@@ -222,6 +224,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
treeDto.setId(String.valueOf(region.getSequenceNbr()));
treeDto.setParentCode("0");
treeDto.setIsOnClick(0);
treeDto.setSceneId("987654321");
List<TreeDto> stationListByRegionCode = stationBasicMapper.getStationListByRegionCode(String.valueOf(region.getRegionCode()));
......@@ -230,6 +233,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
fdzTreeDto.setCode("FDZ");
fdzTreeDto.setParentCode(String.valueOf(region.getRegionCode()));
fdzTreeDto.setIsOnClick(0);
fdzTreeDto.setSceneId("12345678910");
List<TreeDto> fdz = stationListByRegionCode.stream().filter(t -> t.getParentCode().contains("FDZ") && t.getParentCode().length() < 4).collect(Collectors.toList());
fdzTreeDto.setChildren(fdz);
......@@ -238,6 +242,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
gfzTreeDto.setCode("GFZ");
gfzTreeDto.setParentCode(String.valueOf(region.getRegionCode()));
gfzTreeDto.setIsOnClick(0);
gfzTreeDto.setSceneId("1234567891011");
List<TreeDto> gfz = stationListByRegionCode.stream().filter(t -> t.getParentCode().contains("GFDZ")).collect(Collectors.toList());
gfzTreeDto.setChildren(gfz);
List<TreeDto> treeDtos = Arrays.asList(fdzTreeDto, gfzTreeDto);
......@@ -280,8 +285,8 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("发电状态"));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("报警状态"));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtions(queryCondtion1, null, ESEquipments.class);
Map<String, String> collect = result.stream().collect(Collectors.toMap(ESEquipments::getEquipmentNumber, ESEquipments::getEquipmentIndexName, (item1, item2) -> item1));
equipNumList.forEach(item -> {
......@@ -356,17 +361,17 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
StationBasic stationBasic = getOneByStationNumber(stationId);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion.put("equipmentNumber", Arrays.asList(equipNum));
Map<String, String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put("frontModule", frontModule);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldQueryCondtion, ESEquipments.class);
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipNum));
Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, frontModule);
List<ESEquipments> result = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
List<String> xList = new ArrayList<>();
List<String> yList = new ArrayList<>();
for (int i = 0; i < result.size(); i++) {
ESEquipments esEquipments = result.get(i);
if (esEquipments.getEquipmentIndexName().contains("温度")) {
xList.add(esEquipments.getEquipmentIndexName());
yList.add(esEquipments.getValue());
yList.add(esEquipments.getValueDouble().toString());
}
}
realTimeTemperatureResult.put("axisData", xList);
......@@ -385,15 +390,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public String getFanDataByType(String stationId, String equipNum, String frontModule, String typeName) {
StationBasic stationBasic = getOneByStationNumber(stationId);
Map<String, String> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringFrontMoudle, frontModule);
Map<String, List<String>> queryCondtion1 = new HashMap<>();
queryCondtion1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(typeName));
queryCondtion1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion1.put(CommonConstans.QueryStringEquipmentNumber, Arrays.asList(equipNum));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtions(queryCondtion1, queryCondtion, ESEquipments.class);
if (CollectionUtils.isNotEmpty(equipNumList) && StringUtils.isNotEmpty(equipNumList.get(0).getValue())) {
return equipNumList.get(0).getValue();
Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, frontModule);
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(typeName));
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(stationBasic.getFanGatewayId()));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipNum));
List<ESEquipments> equipNumList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
if (CollectionUtils.isNotEmpty(equipNumList) && StringUtils.isNotEmpty(equipNumList.get(0).getValueDouble().toString())) {
return equipNumList.get(0).getValueDouble().toString();
} else {
return "0";
}
......@@ -487,7 +492,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumber, Arrays.asList(name));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(name));
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
name = indicatorsDtoList.get(0).getEquipmentSpecificName();
StringBuffer param = new StringBuffer();
......@@ -630,7 +635,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentIndexName());
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(Float.valueOf(indicatorsDto.getValue()));
temporaryData.setValue(indicatorsDto.getValueDouble());
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryDatas.add(temporaryData);
} catch (Exception e) {
......@@ -644,7 +649,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
temporaryData.setCreatedTime(time.split(" ")[1]);
temporaryData.setEquipmentIndexName(indicatorsDto.getEquipmentIndexName());
temporaryData.setGatewayId(indicatorsDto.getGatewayId());
temporaryData.setValue(Float.valueOf(indicatorsDto.getValue()));
temporaryData.setValue(indicatorsDto.getValueDouble());
temporaryData.setEquipmentNumber(indicatorsDto.getEquipmentNumber());
temporaryDatass.add(temporaryData);
} catch (Exception e) {
......@@ -732,14 +737,19 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public List<Map<String, Object>> getStatusGzp(String gatewayId, String systemType, String frontModule, String equipNum) {
String sql = " SELECT displayName ,equipmentNumber , value as state,equipmentIndexName FROM indicators_" + gatewayId + " WHERE frontModule =~/" + frontModule + "/ and systemType = '" + systemType + "'";
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList(systemType));
if (null != equipNum) {
sql = " SELECT displayName , equipmentNumber , value as state,equipmentIndexName FROM indicators_" + gatewayId + " WHERE frontModule =~/" + frontModule + "/ and systemType = '" + systemType + "' and equipmentNumber ='" + equipNum + "'";
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipNum));
}
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, frontModule);
List<ESEquipments> indicatorsDtoList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
List<Map<String, Object>> statusMaps = new ArrayList<>();
for (IndicatorsDto listDatum : listData) {
for (ESEquipments listDatum : indicatorsDtoList) {
Map<String, Object> statusMap = new HashMap<>();
String data = listDatum.getDisplayName();
if (StringUtils.isEmpty(data)) {
......@@ -752,9 +762,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
statusMap.put("data", data);
statusMap.put("state", listDatum.getState().equals("false") ? 1 : 0);
statusMap.put("status", listDatum.getState().equals("false") ? 1 : 0);
statusMap.put("title", listDatum.getState().equals("false") ? "断" : "通");
statusMap.put("state", listDatum.getValue().equals("false") ? 0 : 1);
statusMap.put("status", listDatum.getValue().equals("false") ? 0 : 1);
statusMap.put("title", listDatum.getValue().equals("false") ? "通" : "断");
statusMaps.add(statusMap);
}
return statusMaps;
......@@ -786,18 +796,23 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void getStatusJDX(String gatewayId, String stationId, String frontModule) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldCodtion = new HashMap<>();
shouldCodtion.put("frontModule", frontModule);
shouldCodtion.put(CommonConstans.QueryStringDisplayName, "合位");
List<ESEquipments> listData = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldCodtion, ESEquipments.class);
Map<String, String> likeCodtion = new HashMap<>();
likeCodtion.put(CommonConstans.QueryStringFrontMoudle, frontModule);
likeCodtion.put(CommonConstans.QueryStringDisplayName+".keyword", "合位");
List<ESEquipments> listData = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,likeCodtion);
List<Map<String, Object>> statusMaps = new ArrayList<>();
Map<String, List<ESEquipments>> collect = listData.stream().collect(Collectors.groupingBy(ESEquipments::getFrontModule, LinkedHashMap::new, Collectors.toList()));
for (String s : collect.keySet()) {
Map<String, Object> statusMap = new HashMap<>();
if (frontModule.equals("前光")) {
shouldCodtion.remove(CommonConstans.QueryStringDisplayName);
shouldCodtion.put(CommonConstans.QueryStringSystemType, "模拟量");
List<ESEquipments> value = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldCodtion, ESEquipments.class);
likeCodtion.remove(CommonConstans.QueryStringDisplayName+".keyword");
likeCodtion.put(CommonConstans.QueryStringSystemType+".keyword", "模拟量");
List<ESEquipments> value = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class,likeCodtion);
for (ESEquipments indicatorsDto : value) {
Double aDouble = Double.valueOf(indicatorsDto.getValue());
statusMap.put(indicatorsDto.getDisplayName() + "Value", String.format(CommonConstans.Twodecimalplaces, aDouble));
......@@ -859,7 +874,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
for (ESEquipments listDatum : listData) {
for (ESEquipments indicatorsDto : listData1) {
if (listDatum.getEquipmentNumber().equals(indicatorsDto.getEquipmentNumber())) {
listDatum.setValueLabel(indicatorsDto.getValue());
listDatum.setValueLabel(String.valueOf(indicatorsDto.getValueDouble()/1000));
}
}
......@@ -869,7 +884,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
map.put("title", prefix + listDatum.getEquipmentNumber());
//用于参数传递
map.put("title1", listDatum.getEquipmentNumber());
map.put("windSpeed", listDatum.getValue());
map.put("windSpeed", listDatum.getValueDouble());
map.put("power", listDatum.getValueLabel());
//获取风机状态如果获取到的状态为空-则默认为正常运行状态
String fantStatus = ObjectUtils.isEmpty(fanstatutsHashMap.get(listDatum.getEquipmentNumber())) ? "通讯中断" : fanstatutsHashMap.get(listDatum.getEquipmentNumber());
......@@ -991,9 +1006,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
// queryCondtion.put(CommonConstans.QueryStringFrontMoudle, Arrays.asList("电量表计"));
Map<String, String> shouldCondition = new HashMap<>();
shouldCondition.put( null != stationType ? "frontModule" : CommonConstans.QueryStringFrontMoudle, "电量表计");
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldCondition, ESEquipments.class);
Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, "电量表计");
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtionsAndLike(queryCondtion, null, ESEquipments.class, likeMap);
List<ESEquipments> windSqlList = esEquipmentsList.stream().filter(esEquipments -> !esEquipments.getDisplayName().equals("") && !esEquipments.getDisplayName().equals("检修状态")).collect(Collectors.toList());
Map<String, List<ESEquipments>> maps = windSqlList.stream().collect(Collectors.groupingBy(ESEquipments::getSystemType));
ArrayList<Map<String, String>> resultList = new ArrayList<>();
......@@ -1104,15 +1119,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
if (StringUtils.isNotEmpty(gatewayId)) {
Map<String, List<String>> queryCondition = new HashMap<>();
queryCondition.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondition.put(CommonConstans.QueryStringSystemType, Arrays.asList("模拟量"));
queryCondition.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList("模拟量"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondition, null, ESEquipments.class);
List<ESEquipments> xianData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().equals("220kVⅠ母PT") || esEquipments.getFrontModule().equals("35kVⅠ母PT")).collect(Collectors.toList());
HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> {
if ("220kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("220" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue()));
resultMap.put("220" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValueDouble().toString()));
} else if ("35kVⅠ母PT".equals(item.getFrontModule())) {
resultMap.put("35" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue()));
resultMap.put("35" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValueDouble().toString()));
}
});
List<String> xyxDisplayNameList = Arrays.asList("Ia", "P", "Q", "Ux");
......@@ -1122,9 +1137,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
// 正向总有功正向总无功需要计算
dlbjSqlData.forEach(item -> {
if ("正向总有功".equals(item.getDisplayName())) {
resultMap.put("2000S1", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValue()) / 1000))));
resultMap.put("2000S1", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueDouble().toString()) / 1000))));
} else if ("正向总无功".equals(item.getDisplayName())) {
resultMap.put("2000S2", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValue()) / 1000))));
resultMap.put("2000S2", keepTwoDecimalPlaces(String.valueOf((Double.parseDouble(item.getValueDouble().toString()) / 1000))));
}
});
......@@ -1136,13 +1151,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
resultMap.put("value4", "0.0");
zb1SqlData.forEach(item -> {
if ("档位".equals(item.getDisplayName())) {
resultMap.put("value4", ObjectUtils.isEmpty(item.getValue()) ? "0" : String.format("%.0f", Double.parseDouble(item.getValue())));
resultMap.put("value4", ObjectUtils.isEmpty(item.getValueDouble().toString()) ? "0" : String.format("%.0f", Double.parseDouble(item.getValueDouble().toString())));
} else if ("油面温1".equals(item.getDisplayName())) {
resultMap.put("value1", ObjectUtils.isEmpty(item.getValue()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValue())));
resultMap.put("value1", ObjectUtils.isEmpty(item.getValueDouble().toString()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueDouble().toString())));
} else if ("油面温2".equals(item.getDisplayName())) {
resultMap.put("value2", ObjectUtils.isEmpty(item.getValue()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValue())));
resultMap.put("value2", ObjectUtils.isEmpty(item.getValueDouble().toString()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueDouble().toString())));
} else if ("绕组温度".equals(item.getDisplayName())) {
resultMap.put("value3", ObjectUtils.isEmpty(item.getValue()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValue())));
resultMap.put("value3", ObjectUtils.isEmpty(item.getValueDouble().toString()) ? "0.0" : String.format("%.1f", Double.parseDouble(item.getValueDouble().toString())));
}
});
......@@ -1178,13 +1193,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", keepTwoDecimalPlaces(item.getValue()));
stringStringHashMap.put("value1", keepTwoDecimalPlaces(item.getValueDouble().toString()));
}
if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", keepTwoDecimalPlaces(item.getValue()));
stringStringHashMap.put("value2", keepTwoDecimalPlaces(item.getValueDouble().toString()));
}
if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", keepTwoDecimalPlaces(item.getValue()));
stringStringHashMap.put("value3", keepTwoDecimalPlaces(item.getValueDouble().toString()));
}
});
resultList.add(stringStringHashMap);
......@@ -1218,16 +1233,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
if (StringUtils.isNotEmpty(gatewayId)) {
Map<String, List<String>> queryCondition = new HashMap<>();
queryCondition.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondition.put(CommonConstans.QueryStringSystemType, Arrays.asList("模拟量"));
queryCondition.put(CommonConstans.QueryStringSystemTypeKeyword, Arrays.asList("模拟量"));
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondition, null, ESEquipments.class);
// 10kVⅡ段母线数据
List<ESEquipments> xianData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().equals("35kVⅠ母PT")).collect(Collectors.toList());
List<ESEquipments> xianData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().contains("35kVⅠ母PT")).collect(Collectors.toList());
HashMap<String, Object> resultMap = new HashMap<>();
xianData.forEach(item -> resultMap.put(item.getDisplayName(), keepTwoDecimalPlaces(item.getValue())));
xianData.forEach(item -> resultMap.put(item.getDisplayName(), keepTwoDecimalPlaces(item.getValueDouble().toString())));
List<String> xyxDisplayNameList = Arrays.asList("Ia", "P", "Q");
List<ESEquipments> xyxSqlData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().equals("35kV前万线") && xyxDisplayNameList.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
xyxSqlData.forEach(item -> resultMap.put("35qwx" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValue())));
xyxSqlData.forEach(item -> resultMap.put("35qwx" + item.getDisplayName(), keepTwoDecimalPlaces(item.getValueDouble().toString())));
// 主线路图上各个路线名称
resultMap.put("35qwx", "35kV前万线");
......@@ -1246,6 +1261,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getMajorBoosterStationInfo(gatewayId, "ASC", 5);
ArrayList<Map<String, String>> resultList = new ArrayList<>();
for (Map<String, String> map : boosterStationInfo) {
if (map.get("boosterName").equals("35kVⅠ母PT")) {
continue;
}
List<ESEquipments> listData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getFrontModule().contains(map.get("boosterName")) && xyxDisplayNameList.contains(esEquipments.getDisplayName())).collect(Collectors.toList());
HashMap<String, String> stringStringHashMap = new HashMap<>();
stringStringHashMap.put("value1", "0.0");
......@@ -1253,13 +1271,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
stringStringHashMap.put("value3", "0.0");
listData.forEach(item -> {
if (item.getDisplayName().equals("Ia")) {
stringStringHashMap.put("value1", keepTwoDecimalPlaces(item.getValue()));
stringStringHashMap.put("value1", keepTwoDecimalPlaces(item.getValueDouble().toString()));
}
if (item.getDisplayName().equals("P")) {
stringStringHashMap.put("value2", keepTwoDecimalPlaces(item.getValue()));
stringStringHashMap.put("value2", keepTwoDecimalPlaces(item.getValueDouble().toString()));
}
if (item.getDisplayName().equals("Q")) {
stringStringHashMap.put("value3", keepTwoDecimalPlaces(item.getValue()));
stringStringHashMap.put("value3", keepTwoDecimalPlaces(item.getValueDouble().toString()));
}
});
resultList.add(stringStringHashMap);
......@@ -1313,9 +1331,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public Map<String, Object> getSwitchUrl(String gatewayId, String equipName) {
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldQueryCondtion = new HashMap<>();
shouldQueryCondtion.put(CommonConstans.QueryStringSystemType, "开关");
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, shouldQueryCondtion, ESEquipments.class);
Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringSystemTypeKeyword, "开关");
List<ESEquipments> esEquipmentsList = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class, likeMap);
List<ESEquipments> listData = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getDisplayName().contains("合位")).collect(Collectors.toList());
List<ESEquipments> listDatas = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getDisplayName().contains("远方就地开关")).collect(Collectors.toList());
List<ESEquipments> listDatass = esEquipmentsList.stream().filter(esEquipments -> esEquipments.getDisplayName().contains("接地刀位置")).collect(Collectors.toList());
......@@ -1411,7 +1429,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>();
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumber, Arrays.asList(equipmentNumber));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipmentNumber));
List<ESEquipments> list = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class).subList(0, 1);
if (!ValidationUtil.isEmpty(list)) {
// resultMap.put("equipmentSpecificName", list.get(0).getEquipmentSpecificName());
......@@ -1427,7 +1445,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
} else {
type = "光伏逆变器系统";
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("待机", "故障停机", "告警运行", "限额运行", "停机", "通讯故障", "降额运行", "运行"));
queryCondtion.put(CommonConstans.QueryStringValue, Arrays.asList("true"));
queryCondtion.put(CommonConstans.QueryStringValueKeyword, Arrays.asList("true"));
List<ESEquipments> list1 = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
resultMap.put("status", AlarmDesc.getCode(list1.get(0).getEquipmentIndexName()));
queryEquipNum = "#" + Integer.parseInt(equipNames[0]);
......@@ -1474,15 +1492,12 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
if (null != equipmentNumber) {
listData = esEquipmentsList.stream().filter(esEquipments -> !esEquipments.getEquipmentNumber().contains(equipmentNumber)).collect(Collectors.toList());
}
LinkedHashSet<ESEquipments> data = new LinkedHashSet<>(listData);
List<Map<String, Object>> statusMaps = new ArrayList<>();
for (ESEquipments listDatum : data) {
Map<String, Object> statusMap = new HashMap<>();
statusMap.put("equipmentNumber", listDatum.getEquipmentNumber());
statusMap.put("equipmentSpecificName", listDatum.getEquipmentSpecificName().substring(5).replace("/", " "));
statusMaps.add(statusMap);
}
return statusMaps;
return listData.stream().map(item -> {
HashMap<String, Object> map = new HashMap<>();
map.put("equipmentNumber", item.getEquipmentNumber());
map.put("equipmentSpecificName", item.getEquipmentSpecificName().substring(5).replace("/", " "));
return map;
}).distinct().collect(Collectors.toList());
}
public String keepTwoDecimalPlaces(String value) {
......@@ -1501,11 +1516,11 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
HashMap<String, Object> resultMap = new HashMap<>();
Map<String, List<String>> queryCondtion = new HashMap<>();
queryCondtion.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumber, Arrays.asList(equipmentNumber));
queryCondtion.put(CommonConstans.QueryStringEquipmentNumberKeyword, Arrays.asList(equipmentNumber));
queryCondtion.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList(equipmentIndexName));
List<ESEquipments> list = commonServiceImpl.getListDataByCondtions(queryCondtion, null, ESEquipments.class);
if (!ValidationUtil.isEmpty(list)) {
resultMap.put("value", String.format(CommonConstans.Twodecimalplaces, Double.parseDouble(list.get(0).getValue())));
resultMap.put("value", String.format(CommonConstans.Twodecimalplaces, Double.parseDouble(list.get(0).getValueDouble().toString())));
}
return resultMap;
}
......@@ -1559,15 +1574,15 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
ArrayList<Map<String, Object>> resultList = new ArrayList<>();
Map<String, List<String>> queryConditon = new HashMap<>();
queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldConditon = new HashMap<>();
shouldConditon.put(CommonConstans.QueryStringEquipmentIndexName, "路电流");
List<ESEquipments> list = commonServiceImpl.getListDataByCondtions(queryConditon, shouldConditon, ESEquipments.class);
Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "路电流");
List<ESEquipments> list = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null, ESEquipments.class, likeMap);
Map<String, List<String>> queryConditon1 = new HashMap<>();
queryConditon1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldConditon1 = new HashMap<>();
shouldConditon1.put(CommonConstans.QueryStringEquipmentIndexName, "平均电流");
List<ESEquipments> list1 = commonServiceImpl.getListDataByCondtions(queryConditon, shouldConditon, ESEquipments.class);
Map<String, String> likeMap1 = new HashMap<>();
likeMap1.put(CommonConstans.QueryStringEquipmentIndexNameNotKeyword, "平均电流");
List<ESEquipments> list1 = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null, ESEquipments.class, likeMap1);
if (!ValidationUtil.isEmpty(list)) {
Map<String, List<ESEquipments>> collect = list.stream().collect(Collectors.groupingBy(ESEquipments::getEquipmentNumber));
......@@ -1575,7 +1590,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<ESEquipments> indicatorsDtos = collect.get(s);
HashMap<String, Object> resultMap = new HashMap<>();
Double avageValue = 0.0;
avageValue = indicatorsDtos.stream().filter(e -> !ObjectUtils.isEmpty(e.getValue())).mapToDouble(l -> Double.parseDouble((String) l.getValue())).average().getAsDouble();
avageValue = indicatorsDtos.stream().filter(e -> !ObjectUtils.isEmpty(e.getValueDouble())).mapToDouble(l -> Double.parseDouble(l.getValueDouble().toString())).average().getAsDouble();
avageValue = Double.valueOf(String.format(CommonConstans.Twodecimalplaces, avageValue));
resultMap.put("avg", avageValue);
String[] name = s.split("-");
......@@ -1587,10 +1602,10 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<ESEquipments> dtos = list1.stream().filter(e -> e.getEquipmentNumber().equals(s)).collect(Collectors.toList());
if (!ValidationUtil.isEmpty(dtos)) {
for (ESEquipments esEquipments : indicatorsDtos) {
lsv = lsv + Math.pow(Double.parseDouble(esEquipments.getValue()) - Double.parseDouble(dtos.get(0).getValue()), 2);
lsv = lsv + Math.pow(esEquipments.getValueDouble() - dtos.get(0).getValueDouble(), 2);
}
}
lsv = Math.sqrt(lsv) / Double.parseDouble(dtos.get(0).getValue());
lsv = Math.sqrt(lsv) / dtos.get(0).getValueDouble();
}
......@@ -1623,6 +1638,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
List<ESEquipments> indicatorsDtos = collects.get(s);
Map<String, Object> map = new HashMap<>();
map.put("name", s);
map.put("sort", s.split("-")[0]);
map.put("type", "兆能");//此处暂时未提供数据 待定 暂写死值
map.put("status", "1");//此处暂时未提供数据 待定 暂写死值
indicatorsDtos.forEach(e -> {
......@@ -1696,16 +1712,16 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
Map<String, List<String>> queryConditon = new HashMap<>();
queryConditon.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("总直流功率"));
queryConditon.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldConditon = new HashMap<>();
shouldConditon.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> listData = commonServiceImpl.getListDataByCondtions(queryConditon, shouldConditon, ESEquipments.class);
Map<String, String> likeMap = new HashMap<>();
likeMap.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, "逆变器");
List<ESEquipments> listData = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon, null, ESEquipments.class, likeMap);
Map<String, List<String>> queryConditon1 = new HashMap<>();
queryConditon1.put(CommonConstans.QueryStringEquipmentIndexName, Arrays.asList("有功功率"));
queryConditon1.put(CommonConstans.QueryStringGateWayId, Arrays.asList(gatewayId));
Map<String, String> shouldConditon1 = new HashMap<>();
shouldConditon1.put(CommonConstans.QueryStringFrontMoudle, "逆变器");
List<ESEquipments> listData1 = commonServiceImpl.getListDataByCondtions(queryConditon1, shouldConditon1, ESEquipments.class);
Map<String, String> likeMap1 = new HashMap<>();
likeMap1.put(CommonConstans.QueryStringFrontMoudleNotKeyWord, "逆变器");
List<ESEquipments> listData1 = commonServiceImpl.getListDataByCondtionsAndLike(queryConditon1, null, ESEquipments.class, likeMap1);
// 将两组数据合并成一个集合中 将总直流功率数据 放入 另一个集合的valueLable中
for (ESEquipments listDatum : listData) {
......@@ -1726,7 +1742,7 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
String number = equipNum.substring(equipNum.length() - 1);
map.put("titie", String.valueOf(num));
map.put("titie" + number, equipNum);
map.put("value" + number, String.format(CommonConstans.Twodecimalplaces, Double.parseDouble(esEquipments.getValueDouble().toString())));
map.put("value" + number, String.format(CommonConstans.Twodecimalplaces, esEquipments.getValueDouble()));
map.put("valueLabel" + number, String.format(CommonConstans.Twodecimalplaces, Double.parseDouble(esEquipments.getValueLabel())));
map.put("state" + number, equipStatesMap.get(esEquipments.getEquipmentNumber()));
maps.add(map);
......
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