Commit 968c2a7d authored by tangwei's avatar tangwei

解决冲突

parents 3c912d3b e74cf60d
package com.yeejoin.amos.boot.module.hygf.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 节点信息
* @author DELL
*/
@Getter
@AllArgsConstructor
public enum PowerStationNodeEnum {
经销商审核("经销商审核", "0"),
设计审核("设计审核", "1"),
投融审核("投融审核", "2"),
法务审核("法务审核", "3"),
设计上传图纸("设计上传图纸", "4"),
经销商上传图纸("经销商上传图纸", "5"),
文件审核("文件审核", "6");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
public static PowerStationNodeEnum getNodeByCode(String code) {
PowerStationNodeEnum powerStationNodeEnum = null;
for(PowerStationNodeEnum type: PowerStationNodeEnum.values()) {
if (type.getCode().equals(code)) {
powerStationNodeEnum = type;
break;
}
}
return powerStationNodeEnum;
}
}
package com.yeejoin.amos.boot.module.hygf.api.Enum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 电站审核状态
* @author DELL
*/
@Getter
@AllArgsConstructor
public enum PowerStationProcessStateEnum {
进行中("进行中", "0", "progress"),
通过("通过", "1", "yes"),
不通过("不通过", "2", "no"),
完成("完成", "3", "complete"),
作废("作废", "4", "reject");
/**
* 名称,描述
*/
private String name;
/**
* 编码
*/
private String code;
/**
* 编码
*/
private String describe;
public static PowerStationProcessStateEnum getStateByResult(String code) {
PowerStationProcessStateEnum powerStationProcessStateEnum = null;
for(PowerStationProcessStateEnum type: PowerStationProcessStateEnum.values()) {
if (type.getDescribe().equals(code)) {
powerStationProcessStateEnum = type;
break;
}
}
return powerStationProcessStateEnum;
}
}
......@@ -109,4 +109,10 @@ public class PowerStation extends BaseEntity {
@TableField("node_role")
private String nodeRole;
/**
* 当前流程节点
*/
@TableField("next_process_node")
private String nextProcessNode;
}
package com.yeejoin.amos.boot.module.hygf.api.fegin;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.feign.FeignConfiguration;
import com.yeejoin.amos.boot.biz.common.feign.MultipartSupportConfig;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
......@@ -27,4 +25,10 @@ public interface IdxFeginService {
@RequestParam(value = "tableName", required = false) String tableName,
@RequestBody Map<String, Object> kv) throws Exception;
/**
*通用表单提交 数据填报
*/
@RequestMapping(value = "/report/form/getRecordData/{id}", method = RequestMethod.GET)
FeignClientResult<JSONObject> getRecord(@PathVariable("id") String id);
}
......@@ -3,6 +3,8 @@ package com.yeejoin.amos.boot.module.hygf.api.service;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation;
import java.util.Map;
/**
* 接口类
*
......@@ -18,4 +20,24 @@ public interface IPowerStationService {
*/
boolean savePowerStation(PowerStation powerStation);
/**
* 根据农户id和流程状态获取实例
* @param id 农户id
* @param state 流程状态
* @return 电站实例
*/
PowerStation getObjByNhId(String id, String state);
/**
* 电站审核接口
* @param pageId 表单id
* @param nodeCode 执行节点code
* @param stationId 电站审核记录id
* @param taskId 任务id
* @param planInstanceId 实例id
* @param kv 表单数据
* @return idx表id
*/
String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv);
}
......@@ -9,6 +9,8 @@ import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import java.util.Map;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -113,4 +115,21 @@ public class PowerStationController extends BaseController {
public ResponseModel<List<PowerStationDto>> selectForList() {
return ResponseHelper.buildResponse(powerStationServiceImpl.queryForPowerStationList());
}
/**
* 列表全部数据查询
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST",value = "电站审核", notes = "电站审核")
@PostMapping(value = "/powerStationExamine")
public ResponseModel<String> powerStationExamine(@RequestParam(value = "pageId") long pageId,
@RequestParam(value = "nodeCode") String nodeCode,
@RequestParam(value = "stationId") String stationId,
@RequestParam(value = "taskId") String taskId,
@RequestParam(value = "planInstanceId") String planInstanceId,
@RequestBody Map<String, Object> kv) {
return ResponseHelper.buildResponse(powerStationServiceImpl.powerStationExamine(pageId, nodeCode, stationId, taskId, planInstanceId, kv));
}
}
package com.yeejoin.amos.boot.module.hygf.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationNodeEnum;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto;
import com.yeejoin.amos.boot.module.hygf.api.entity.PowerStation;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
import com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper;
import com.yeejoin.amos.boot.module.hygf.api.service.IPowerStationService;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
import java.util.Map;
/**
* 服务实现类
......@@ -16,7 +24,20 @@ import java.util.List;
* @date 2023-07-15
*/
@Service
@Slf4j
public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerStation, PowerStationMapper> implements IPowerStationService {
@Autowired
IdxFeginService idxFeginService;
@Autowired
IPowerStationService powerStationService;
private static final String IDX_REQUEST_STATE="200";
private static final String VERIFY_RESULT_YES="yes";
private static final String VERIFY_RESULT_NO="no";
/**
* 分页查询
*/
......@@ -34,6 +55,65 @@ public class PowerStationServiceImpl extends BaseService<PowerStationDto, PowerS
@Override
public boolean savePowerStation(PowerStation powerStation) {
return this.save(powerStation);
return this.saveOrUpdate(powerStation);
}
@Override
public PowerStation getObjByNhId(String id, String state) {
LambdaQueryWrapper<PowerStation> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(PowerStation::getProcessStatus, state);
wrapper.eq(PowerStation::getPeasantHouseholdId, id);
return this.baseMapper.selectOne(wrapper);
}
@Override
public String powerStationExamine(long pageId, String nodeCode, String stationId, String taskId, String planInstanceId, Map<String, Object> kv) {
// 1. 业务相关数据落表
PowerStation powerStation = this.baseMapper.selectById(stationId);
PowerStationNodeEnum nodeByCode = PowerStationNodeEnum.getNodeByCode(nodeCode);
if (PowerStationNodeEnum.设计上传图纸.getCode().equals(nodeCode)) {
} else if (PowerStationNodeEnum.经销商上传图纸.getCode().equals(nodeCode)) {
} else {
String result = String.valueOf(kv.get("VERIFY_RESULT"));
if (VERIFY_RESULT_NO.equals(result)) {
powerStation.setProcessStatus(PowerStationProcessStateEnum.不通过.getName());
}
PowerStationProcessStateEnum resultObj = PowerStationProcessStateEnum.getStateByResult(result);
switch (nodeByCode) {
case 设计审核:
powerStation.setTechnologyStatus(resultObj.getName());
break;
case 投融审核:
powerStation.setDesignStatus(resultObj.getName());
break;
case 法务审核:
powerStation.setBusinessStatus(resultObj.getName());
break;
case 文件审核:
if (VERIFY_RESULT_YES.equals(result)) {
powerStation.setProcessStatus(PowerStationProcessStateEnum.完成.getName());
}
break;
default:
break;
}
}
// 2. 更新流程状态
String code = null;
try{
// 3. 工作流执行
FeignClientResult<String> submit = idxFeginService.submit(pageId, taskId, planInstanceId, null, null, null, kv);
if (IDX_REQUEST_STATE.equals(String.valueOf(submit.getStatus()))) {
code = submit.getResult();
log.info("流程执行成功:{}", code);
powerStationService.savePowerStation(powerStation);
}
}catch (Exception e){
log.error("工作流执行失败:{}", e.getMessage());
}
return code;
}
}
\ No newline at end of file
......@@ -2,9 +2,11 @@ package com.yeejoin.amos.boot.module.hygf.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.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.hygf.api.Enum.PowerStationProcessStateEnum;
import com.yeejoin.amos.boot.module.hygf.api.dto.*;
import com.yeejoin.amos.boot.module.hygf.api.entity.*;
import com.yeejoin.amos.boot.module.hygf.api.fegin.IdxFeginService;
......@@ -20,9 +22,11 @@ import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.RegionModel;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
......@@ -67,6 +71,12 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
@Autowired
IPowerStationService powerStationService;
@Value("${power.station.examine.pageId}")
private long pageId;
@Value("${power.station.examine.planId}")
private String planId;
private static final String regionRedis="app_region_redis";
private static final String OPERATION_TYPE_SUBMIT="submit";
private static final String OPERATION_TYPE_APPLY="apply";
......@@ -167,30 +177,55 @@ public class SurveyInformationServiceImpl extends BaseService<SurveyInformationD
if(OPERATION_TYPE_SUBMIT.equals(operationType)){
peasantHousehold.setSurveyOrNot(1);
}else if(OPERATION_TYPE_APPLY.equals(operationType)){
Map<String, Object> objectMap = new HashMap<>();
// 提交审核
submitExamine(peasantHousehold);
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
return surveyInfoAllDto;
}
private void submitExamine(PeasantHousehold peasantHousehold) {
PowerStation powerStation = powerStationService.getObjByNhId(String.valueOf(peasantHousehold.getSequenceNbr()), PowerStationProcessStateEnum.进行中.getCode());
String taskId = null;
Map<String, Object> objectMap = new HashMap<>();
if (ObjectUtils.isNotEmpty(powerStation)) {
// 工作流执行一步
taskId = powerStation.getTaskId();
objectMap.put("approveStatus", "yes");
} else {
// 第一步启动工作流
objectMap.put("approveStatus", "yes");
// 保存并审核
try {
FeignClientResult<String> submit = idxFeginService.submit(1679778420550037506L, null, "c4ed1873-0dc6-4518-a7a9-dbc588ef35e5", null, null, null, objectMap);
if (IDX_REQUEST_STATE.equals(String.valueOf(submit.getStatus()))) {
String code = submit.getResult();
peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1);
// 插入记录表
PowerStation powerStationDto = new PowerStation();
powerStationDto.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo());
powerStationDto.setOwnersName(peasantHousehold.getOwnersName());
powerStationDto.setProjectAddress(peasantHousehold.getProjectAddressName());
powerStationDto.setProcessStatus("进行中");
powerStationService.savePowerStation(powerStationDto);
log.info("启动流程成功:{}", code);
powerStation = new PowerStation();
}
// 保存并审核
try {
FeignClientResult<String> submit = idxFeginService.submit(pageId, taskId, planId, null, null, null, objectMap);
if (IDX_REQUEST_STATE.equals(String.valueOf(submit.getStatus()))) {
peasantHousehold.setSurveyOrNot(2);
peasantHousehold.setReview(1);
String code = submit.getResult();
// 插入记录表
powerStation.setPowerStationCode(peasantHousehold.getPeasantHouseholdNo());
powerStation.setOwnersName(peasantHousehold.getOwnersName());
powerStation.setProjectAddress(peasantHousehold.getProjectAddressName());
powerStation.setPeasantHouseholdId(String.valueOf(peasantHousehold.getSequenceNbr()));
powerStation.setProcessStatus(PowerStationProcessStateEnum.进行中.getCode());
log.info("流程执行成功:{}", code);
// 获取流程信息
FeignClientResult<JSONObject> record = idxFeginService.getRecord(code);
if (IDX_REQUEST_STATE.equals(String.valueOf(record.getStatus()))) {
JSONObject resultObj = record.getResult();
String taskIdNew = String.valueOf(resultObj.get("taskId"));
String processInstanceId = String.valueOf(resultObj.get("processInstanceId"));
powerStation.setTaskId(taskIdNew);
powerStation.setProcessInstanceId(processInstanceId);
}
} catch (Exception e){
e.getMessage();
powerStationService.savePowerStation(powerStation);
}
} catch (Exception e){
e.getMessage();
}
peasantHouseholdServiceImpl.saveOrUpdate(peasantHousehold);
return surveyInfoAllDto;
}
public SurveyInfoAllDto querySurveyInfo(String surveyInformationId,AgencyUserModel userInfo) {
......
......@@ -101,4 +101,9 @@ sms.huawei.templateId=6aaeb4bf916d4db0a1942c598912519e
# 签名通道号
sms.huawei.sender=1069368924410006092
# 签名名称
sms.huawei.signature=华为云短信测试
\ No newline at end of file
sms.huawei.signature=华为云短信测试
# 电站审核pageId
power.station.examine.pageId=1679778420550037506
# 电站审核计划id
power.station.examine.planId=c4ed1873-0dc6-4518-a7a9-dbc588ef35e5
\ No newline at end of file
......@@ -47,6 +47,6 @@ public class MonitorFanIndicator extends BaseEntity {
private String equipmentNumber; //设备编号
@TableField("data_type")
private String dataType; //设备编号
@TableField("picture_name")
private String pictureName; //图片名称用于动态展示图片
}
......@@ -41,4 +41,7 @@ public interface MonitorFanIndicatorMapper extends BaseMapper<MonitorFanIndicato
List<Map<String, String>> getMajorBoosterStationInfo(@Param("gatewayId") String gatewayId,
@Param("sortType") String sortType,
@Param("size") Integer size);
Map<String, String> getMajorBoosterStationInfoBySort(@Param("gatewayId") String gatewayId,
@Param("sort") String sort);
}
......@@ -129,4 +129,22 @@
ORDER BY major_sort ${sortType}
limit #{size}
</select>
<select id="getMajorBoosterStationInfoBySort" resultType="java.util.Map">
select
`sequence_nbr` as id,
`gateway_id` as gatewayId,
`booster_name` as text,
booster_name as boosterName,
`booster_code` as boosterCode,
`sort` as value
from booster_station_info
where
sort = #{sort}
AND gateway_id = #{gatewayId}
limit 1
</select>
</mapper>
......@@ -177,6 +177,7 @@ public class DemoController extends BaseController {
maps2.put("equipmentNumber", "");
maps2.put("frontModule", "");
maps2.put("systemType", "");
maps2.put("pictureName", monitorFanIndicator.getPictureName());
// 升压站的字段显示名称
maps2.put("displayName", monitorFanIndicator.getEquipmentNumber());
if (!ObjectUtils.isEmpty(monitorFanIndicator.getFrontModule())) {
......
package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.jxiop.api.dto.IndexDto;
import com.yeejoin.amos.boot.module.jxiop.api.dto.RunRecord;
import com.yeejoin.amos.boot.module.jxiop.api.dto.TreeDto;
import com.yeejoin.amos.boot.module.jxiop.api.entity.MonitorFanIndicator;
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.StationBasicMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ResultsData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.MonitorFanIndicatorImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.elasticsearch.index.Index;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.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;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
......@@ -61,6 +58,12 @@ public class MonitorFanIdxController extends BaseController {
@Value("${fan.statuts.stattuspath}")
private String fanStatusImagePathPrefix;
@Autowired
MonitorFanIndicatorMapper monitorFanIndicatorMapper;
@Autowired
EmqKeeper emqKeeper;
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "根据设备编号、场站id、前段展示模块、系统类型查询表数据")
@GetMapping("/getFanIdxInfoByPage")
......@@ -76,7 +79,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "左侧树API")
@GetMapping("/getTreeInfo")
public ResponseModel<TreeDto> getTreeInfo(@RequestParam(value = "sequenceNbr", required = true) String sequenceNbr) {
public ResponseModel<TreeDto> getTreeInfo(@RequestParam(value = "sequenceNbr") String sequenceNbr) {
return ResponseHelper.buildResponse(monitorFanIndicator.getTreeInfo(sequenceNbr));
}
......@@ -182,18 +185,15 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机布置图-总概览")
@GetMapping("/overview")
public ResponseModel<IPage<Map<String, Object>>> getData(@RequestParam(value = "stationId", required = true)String stationId) {
public ResponseModel<IPage<Map<String, Object>>> getData(@RequestParam(value = "stationId")String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
String [] sumColumns = new String[]{"日发电量","月发电量","年发电量"};
String [] avgColumns = new String[]{"有功功率","瞬时风速"};
List<String> columnList = Arrays.asList(sumColumns);
List<String> columnLists = Arrays.asList(avgColumns);
String [] columnList = new String[]{"日发电量","月发电量","年发电量"};
String [] columnLists = new String[]{"有功功率","瞬时风速"};
Map<String, Object> columnMap = new HashMap<>();
for (String column : columnList) {
Double result = commonService.getTotalByIndicatior(gatewayId, column);
columnMap.put(column, result);
......@@ -260,7 +260,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "风机详情-风速功率曲线")
@GetMapping("/detailsWindSpeed")
public ResponseModel<Map<String, Object>> getDetailsWindSpeed(@RequestParam(value = "stationId", required = true)String stationId,String name) {
public ResponseModel<Map<String, Object>> getDetailsWindSpeed(@RequestParam(value = "stationId")String stationId,String name) {
name = name + "风机";
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
......@@ -272,7 +272,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "状态监控")
@GetMapping("/statusMonitoring")
public ResponseModel<IPage<Map<String, Object>>> getStatusMonitoring(@RequestParam(value = "stationId", required = true)String stationId,String equipNum,String systemType) {
public ResponseModel<IPage<Map<String, Object>>> getStatusMonitoring(@RequestParam(value = "stationId")String stationId,String equipNum,String systemType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getFanGatewayId();
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusMonitoring(gatewayId, equipNum, systemType);
......@@ -287,9 +287,10 @@ public class MonitorFanIdxController extends BaseController {
@ApiOperation(value = "升压站光字牌/开关-通用")
@GetMapping("/getStatusGzp")
public ResponseModel<IPage<Map<String, Object>>> getStatusGzp(@RequestParam(value = "stationId", required = true)String stationId,String frontModule,String systemType) {
public ResponseModel<IPage<Map<String, Object>>> getStatusGzp(@RequestParam(value = "stationId")String stationId,String frontModule,String systemType) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,systemType,frontModule);
IPage<Map<String,Object>> result = new Page<>();
result.setRecords(statusMonitoring);
......@@ -303,7 +304,7 @@ public class MonitorFanIdxController extends BaseController {
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "集电线路图左侧 集电线列表")
@GetMapping("/jdTree")
public ResponseModel<IPage<Map<String, Object>>> getStatusJDX(@RequestParam(value = "stationId", required = true)String stationId) {
public ResponseModel<IPage<Map<String, Object>>> getStatusJDX(@RequestParam(value = "stationId")String stationId) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
String werks = stationBasic.getStationNumber();
......@@ -433,11 +434,45 @@ public class MonitorFanIdxController extends BaseController {
LambdaQueryWrapper<StationBasic> wrapper = new LambdaQueryWrapper<>();
List<StationBasic> stationBasics = stationBasicMapper.selectList(wrapper);
for (StationBasic stationBasic : stationBasics) {
String gatewayId = stationBasic.getBoosterGatewayId();
monitorFanIndicatorImpl.getSwitchUrlAll(gatewayId);
monitorFanIndicatorImpl.getSwitchUrlAll(stationBasic);
}
return CommonResponseUtil.success();
}
@TycloudOperation(needAuth = false, ApiLevel = UserType.AGENCY)
@ApiOperation(value = "动态面板页面消息")
@GetMapping("/pageTopic")
public ResponseModel<Map<String,Object>> sendPageTopic(
@RequestParam(value = "stationId") String stationId, @RequestParam(value = "equipName") String equipName
) {
StationBasic stationBasic = stationBasicMapper.selectById(stationId);
String gatewayId = stationBasic.getBoosterGatewayId();
Map<String, String> map = monitorFanIndicatorMapper.getMajorBoosterStationInfoBySort(stationId, equipName);
String name = map.get("text").contains("主变")?map.get("text").substring(0,3):map.get("text");
Map<String, Object> switchUrl = monitorFanIndicatorImpl.getSwitchUrl(stationId, name);
List<Map<String, Object>> statusMonitoring = monitorFanIndicator.getStatusGzp(gatewayId ,"光字牌",name);
IPage<Map<String, Object>> result = new Page<>();
switchUrl.put("records",statusMonitoring);
switchUrl.put("current",1);
switchUrl.put("total",100);
List<Map<String, Object>> data = new ArrayList<>();
data.add(switchUrl);
result.setRecords(data);
result.setCurrent(1);
result.setTotal(100);
try {
emqKeeper.getMqttClient().publish(stationId+"/switch/"+equipName, JSON.toJSONString(result).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
}
return CommonResponseUtil.success();
}
}
......@@ -26,9 +26,9 @@ public class IndicatorsDto {
private String distinct;
private String time;
private String displayName;
private String pictureName;
private String title;
public String getTime() {
String[] ts= time.replace(":00Z","").split("T");
......
......@@ -28,19 +28,26 @@ import com.yeejoin.amos.boot.module.jxiop.biz.utils.InfluxDButils;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IMonitorFanIndicator;
import com.yeejoin.amos.component.robot.BadRequest;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.elasticsearch.common.recycler.Recycler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.ParseException;
import java.util.*;
import java.util.stream.Collectors;
import static com.alibaba.fastjson.JSON.parseArray;
/**
* @description:
* @author: tw
......@@ -90,6 +97,13 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
@Autowired
EmqKeeper emqKeeper;
@Value("${pictureUrl}")
String pictureUrl;
@Value("classpath:/json/topic.json")
private Resource topic;
private List<Map> list;
@Override
public void UpdateMonitorFanIndicator(List<IndexDto> list) {
......@@ -854,9 +868,29 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
public void getAnalogQuantityInfo(String gatewayId, String stationId) {
if (StringUtils.isNotEmpty(gatewayId)) {
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getBoosterStationInfo(gatewayId);
List<Map<String, String>> zbList = new ArrayList<>();
// 主变高压侧
Map<String, String> zbGYC = new HashMap<>();
for (Map<String, String> map : boosterStationInfo) {
String sql = String.format("SELECT equipmentIndexName, value, frontModule, unit, displayName FROM \"indicators_%s\" WHERE systemType = '%s' and frontModule =~/%s/ ", gatewayId, "模拟量", map.get("boosterName"));
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
if ("1主变高压侧".equals(map.get("boosterName"))) {
zbGYC = listData.stream().collect(Collectors.toMap(IndicatorsDto::getDisplayName, IndicatorsDto::getValue));
continue;
}
if ("1主变低压侧".equals(map.get("boosterName"))) {
listData.forEach(item -> {
HashMap<String, String> zbMap = new HashMap<>();
zbMap.put("title", item.getDisplayName());
zbMap.put("grade2", item.getValue());
if (StringUtils.isNotEmpty(item.getUnit())) {
zbMap.put("title", String.format("%s(%s)", item.getDisplayName(), item.getUnit()));
}
zbMap.put("titleYuanShi", item.getDisplayName());
zbList.add(zbMap);
});
continue;
}
ArrayList<Map<String, String>> resultList = new ArrayList<>();
listData.forEach(item -> {
HashMap<String, String> stringStringHashMap = new HashMap<>();
......@@ -874,12 +908,25 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
result.setTotal(resultList.size());
try {
log.info("消息内容:{}", JSON.toJSONString(result));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, map.get("boosterCode"), "mnl"), JSON.toJSONString(result).getBytes(),0,false);
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, map.get("value"), "mnl"), JSON.toJSONString(result).getBytes(),2,false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
}
}
Map<String, String> finalZbGYC = zbGYC;
zbList.forEach(item -> item.put("grade1", finalZbGYC.getOrDefault(item.get("titleYuanShi"), "0.0")));
IPage<Map<String, String>> zbResult = new Page<>();
zbResult.setRecords(zbList);
zbResult.setCurrent(1);
zbResult.setTotal(zbList.size());
try {
log.info("主变消息内容:{}", JSON.toJSONString(zbResult));
emqKeeper.getMqttClient().publish(String.format("%s/%s/%s", stationId, 2, "mnl"), JSON.toJSONString(zbResult).getBytes(),2,false);
} catch (MqttException e) {
log.info("消息发送失败");
e.printStackTrace();
}
}
}
......@@ -931,6 +978,21 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
});
// 主线路图上各个路线名称
resultMap.put("xyx", "夏雩线");
resultMap.put("zbgy", "1主变高压侧");
resultMap.put("220mpt", "220kVⅠ母PT");
resultMap.put("jd1", "集电Ⅰ线");
resultMap.put("jd2", "集电Ⅱ线");
resultMap.put("jd3", "集电Ⅲ线");
resultMap.put("jd4", "集电Ⅳ线");
resultMap.put("zbdy", "1主变低压侧");
resultMap.put("dy1", "待用Ⅰ线");
resultMap.put("35mpt", "35kVⅠ母PT");
resultMap.put("1jdb", "1接地变");
resultMap.put("1svg", "1SVG");
resultMap.put("2svg", "2SVG");
//下方重复列表数据
List<Map<String, String>> boosterStationInfo = monitorFanIndicatorregionMapper.getMajorBoosterStationInfo(gatewayId, "ASC", 10);
ArrayList<Map<String, String>> resultList = new ArrayList<>();
......@@ -974,7 +1036,9 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
}
public void getSwitchUrlAll(String gatewayId){
public void getSwitchUrlAll(StationBasic stationBasic){
String gatewayId = stationBasic.getBoosterGatewayId();
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE systemType = '开关' and displayName =~/合位$/";
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
Set<String> names = new HashSet<>();
......@@ -990,27 +1054,65 @@ public class MonitorFanIndicatorImpl implements IMonitorFanIndicator {
}
public void getSwitchUrl(String gatewayId,String equipName){
String sql = "SELECT * FROM indicators_"+gatewayId+" WHERE systemType = '开关' and frontModule =~ /"+equipName+"/ and displayName =~/合位$/";
public Map<String, Object> getSwitchUrl(String gatewayId,String equipName ){
String sql = "SELECT * FROM indicators_" + gatewayId + " WHERE systemType = '开关'" + " and displayName =~/合位$/";
String sql1 = "SELECT * FROM indicators_" + gatewayId + " WHERE systemType = '开关'" + " and displayName =~/远方就地开关$/";
String sql2 = "SELECT * FROM indicators_" + gatewayId + " WHERE systemType = '开关'" + " and displayName =~/接地刀位置$/";
if (StringUtils.isNotEmpty(equipName)) {
sql = "SELECT * FROM indicators_"+gatewayId+" WHERE systemType = '开关' and frontModule =~ /"+equipName+"/ and displayName =~/合位$/";
sql1 = "SELECT * FROM indicators_"+gatewayId+" WHERE systemType = '开关' and frontModule =~ /"+equipName+"/ and displayName =~/远方就地开关$/";
sql2 = "SELECT * FROM indicators_"+gatewayId+" WHERE systemType = '开关' and frontModule =~ /"+equipName+"/ and displayName =~/接地刀位置$/";
}
List<IndicatorsDto> listData = influxDButils.getListData(sql, IndicatorsDto.class);
List<IndicatorsDto> listDatas = influxDButils.getListData(sql1, IndicatorsDto.class);
List<IndicatorsDto> listDatass = influxDButils.getListData(sql2, IndicatorsDto.class);
Map<String, Object> photoUrls = new HashMap<>();
for (IndicatorsDto listDatum : listData) {
for (IndicatorsDto datass : listDatass) {
String url = "";
SwitchPicture switchUrl = switchPictureMapper.getSwitchUrl(gatewayId, listDatum.getDisplayName().split("_")[0]);
if (listDatum.getValue().equals("true")){
url = switchUrl.getOnUrl();
String[] urls = datass.getPictureName().split(",");
if (datass.getValue().equals("true")){
url =pictureUrl+urls[0];
}else {
url = switchUrl.getOffUrl();
url =pictureUrl+ urls[1];;
}
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"url",url);
photoUrls.put(datass.getDisplayName().split("_")[0]+"jddwz",url);
}
for (IndicatorsDto data : listDatas) {
String url = "";
String[] urls = data.getPictureName().split(",");
if (data.getValue().equals("true")){
url =pictureUrl+urls[0];
}else {
url =pictureUrl+ urls[1];;
}
photoUrls.put(data.getDisplayName().split("_")[0]+"yfjdkgurl",url);
}
try {
emqKeeper.getMqttClient().publish(gatewayId+"/switch",JSON.toJSONString(photoUrls).getBytes(),0,false);
} catch (MqttException e) {
e.printStackTrace();
log.error("开关消息发送失败");
for (IndicatorsDto listDatum : listData) {
String url = "";
if (listDatum.getDisplayName().contains("手车工作位置")){
String[] split = listDatum.getPictureName().split(":");
if (listDatum.getValue().equals("true")){
String[] split1 = split[0].split(",");
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"scsurl",pictureUrl+split1[0]);
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"scxurl",pictureUrl+split1[1]);
}else {
String[] split1 = split[1].split(",");
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"scsurl",pictureUrl+split1[0]);
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"scxurl",pictureUrl+split1[1]);
}
}else {
if (listDatum.getValue().equals("true")){
url =pictureUrl+ listDatum.getPictureName();
}else {
url =pictureUrl+ listDatum.getPictureName().replace("red", "green");
}
photoUrls.put(listDatum.getDisplayName().split("_")[0]+"url",url);
}
}
return photoUrls;
}
}
......
......@@ -102,3 +102,5 @@ myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
# ?????????
fan.statuts.stattuspath=upload/jxiop/device_status
pictureUrl=
[
{
"code": "iot",
"emqTopic": "emq.iot.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "sign",
"emqTopic": "emq.sign.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "bussSign",
"emqTopic": "emq.bussSign.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "user",
"emqTopic": "emq.user.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "xf",
"emqTopic": "emq.xf.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "risk",
"emqTopic": "emq.risk.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "equipQrcode",
"emqTopic": "emq.mcb.zxj",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "mcbsubmit",
"emqTopic": "risk.submit",
"akkaTopic": "JKXT2BP-XFZX-Topic"
},
{
"code": "question",
"emqTopic": "warning.issue.question.zd",
"akkaTopic": "JKXT2BP-XFZX-Topic"
},
{
"code": "syncExecute",
"emqTopic": "sync.execute",
"akkaTopic": "JKXT2BP-XFZX-Topic"
},
{
"code": "ccsLoginInfo",
"emqTopic": "ccs-user-login-info",
"akkaTopic": "JKXT2BP-XFZX-Topic"
}
]
\ No newline at end of file
......@@ -90,6 +90,11 @@
<artifactId>kingbase8</artifactId>
<version>8.6.0</version>
</dependency>
<dependency>
<groupId>org.messaginghub</groupId>
<artifactId>pooled-jms</artifactId>
<version>1.0.5</version>
</dependency>
</dependencies>
</project>
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