Commit 5f87d7d8 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents 46ce4580 24214d63
......@@ -26,6 +26,9 @@ public class SocketConfig {
@Value("${amos.system.socket.port}")
private Integer port;
@Value("${amos.system.socket.hostAndPort}")
private String hostAndPort;
private static final ThreadPoolExecutor threadpool = new ThreadPoolExecutor(15, 15,
10L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
......@@ -46,7 +49,7 @@ public class SocketConfig {
clientSocket.setSoTimeout(10000);
// 创建新线程处理连接
log.info("接收到客户端socket: {}", clientSocket.getRemoteSocketAddress());
threadpool.execute(new ClientHandler(clientSocket));
threadpool.execute(new ClientHandler(clientSocket,hostAndPort));
}
} catch (IOException e) {
throw new RuntimeException(e);
......
......@@ -158,6 +158,7 @@ public class IdxBizFanHealthIndexController extends BaseController {
@ApiOperation(httpMethod = "GET",value = "测点运行趋势图", notes = "测点运行趋势图")
@GetMapping(value = "/getqyt")
public ResponseModel<Object> getqyt(
int type,
String address,
String statioName,
String equipmentName,
......@@ -165,7 +166,10 @@ public class IdxBizFanHealthIndexController extends BaseController {
@RequestParam(value = "startTime", required = false) String startTime,
@RequestParam(value = "endTime", required = false) String endTime
) {
if(address.isEmpty()||statioName.isEmpty()||equipmentName.isEmpty()||arae.isEmpty()){
throw new RuntimeException("片区,场站,设备名称,子系统,分析变量不能为空");
}
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( address,statioName,equipmentName,arae,startTime,endTime));
return ResponseHelper.buildResponse(idxBizFanHealthIndexServiceImpl.getqyt( type,address,statioName,equipmentName,arae,startTime,endTime));
}
}
......@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
......@@ -198,12 +199,12 @@ public class KafkaConsumerService {
List<IdxBizFanPointVarCentralValue> insertList = new ArrayList<>();
for (int i = 0; i < length; i++) {
IdxBizFanPointVarCentralValue idxBizFanPointVarCentralValue = new IdxBizFanPointVarCentralValue();
idxBizFanPointVarCentralValue.setProcess1Min(jsonObject.getJSONArray("process1Min").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess2Min(jsonObject.getJSONArray("process2Min").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess3Min(jsonObject.getJSONArray("process3Min").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess1Max(jsonObject.getJSONArray("process1Max").getDoubleValue(i));
idxBizFanPointVarCentralValue.setPorcess2Max(jsonObject.getJSONArray("process2Max").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess3Max(jsonObject.getJSONArray("process3Max").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess1Min(ObjectUtils.isNull(jsonObject.getJSONArray("process1Min").get(i)) ? null : jsonObject.getJSONArray("process1Min").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess2Min(ObjectUtils.isNull(jsonObject.getJSONArray("process2Min").get(i)) ? null : jsonObject.getJSONArray("process2Min").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess3Min(ObjectUtils.isNull(jsonObject.getJSONArray("process3Min").get(i)) ? null : jsonObject.getJSONArray("process3Min").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess1Max(ObjectUtils.isNull(jsonObject.getJSONArray("process1Max").get(i)) ? null : jsonObject.getJSONArray("process1Max").getDoubleValue(i));
idxBizFanPointVarCentralValue.setPorcess2Max(ObjectUtils.isNull(jsonObject.getJSONArray("process2Max").get(i)) ? null : jsonObject.getJSONArray("process2Max").getDoubleValue(i));
idxBizFanPointVarCentralValue.setProcess3Max(ObjectUtils.isNull(jsonObject.getJSONArray("process3Max").get(i)) ? null : jsonObject.getJSONArray("process3Max").getDoubleValue(i));
idxBizFanPointVarCentralValue.setAnalysisPointId(analysisVariableId);
idxBizFanPointVarCentralValue.setAnalysisPointName(analysisVariable.getPointName());
idxBizFanPointVarCentralValue.setProcessPoint1Id(data1.get("processVariable1Id").toString());
......@@ -212,8 +213,8 @@ public class KafkaConsumerService {
idxBizFanPointVarCentralValue.setProcessPoint2Name(processVariableList.get(1).getPointName());
idxBizFanPointVarCentralValue.setProcessPoint3Id(data1.get("processVariable3Id").toString());
idxBizFanPointVarCentralValue.setProcessPoint3Name(processVariableList.get(2).getPointName());
idxBizFanPointVarCentralValue.setAnalysisStdDev(jsonObject.getJSONArray("stdDev").getDoubleValue(i));
idxBizFanPointVarCentralValue.setAnalysisCenterValue(jsonObject.getJSONArray("centerValue").getDoubleValue(i));
idxBizFanPointVarCentralValue.setAnalysisStdDev(ObjectUtils.isNull(jsonObject.getJSONArray("stdDev").get(i)) ? null : jsonObject.getJSONArray("stdDev").getDoubleValue(i));
idxBizFanPointVarCentralValue.setAnalysisCenterValue(ObjectUtils.isNull(jsonObject.getJSONArray("centerValue").get(i)) ? null : jsonObject.getJSONArray("centerValue").getDoubleValue(i));
idxBizFanPointVarCentralValue.setArae(analysisVariable.getArae());
idxBizFanPointVarCentralValue.setStation(analysisVariable.getStation());
idxBizFanPointVarCentralValue.setSubSystem(analysisVariable.getSubSystem());
......@@ -835,12 +836,12 @@ public class KafkaConsumerService {
List<IdxBizPvPointVarCentralValue> insertList = new ArrayList<>();
for (int i = 0; i < length; i++) {
IdxBizPvPointVarCentralValue idxBizPvPointVarCentralValue = new IdxBizPvPointVarCentralValue();
idxBizPvPointVarCentralValue.setProcess1Min(jsonObject.getJSONArray("process1Min").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess2Min(jsonObject.getJSONArray("process2Min").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess3Min(jsonObject.getJSONArray("process3Min").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess1Max(jsonObject.getJSONArray("process1Max").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess2Max(jsonObject.getJSONArray("process2Max").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess3Max(jsonObject.getJSONArray("process3Max").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess1Min(ObjectUtils.isNull(jsonObject.getJSONArray("process1Min").get(i)) ? null : jsonObject.getJSONArray("process1Min").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess2Min(ObjectUtils.isNull(jsonObject.getJSONArray("process2Min").get(i)) ? null : jsonObject.getJSONArray("process2Min").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess3Min(ObjectUtils.isNull(jsonObject.getJSONArray("process3Min").get(i)) ? null : jsonObject.getJSONArray("process3Min").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess1Max(ObjectUtils.isNull(jsonObject.getJSONArray("process1Max").get(i)) ? null : jsonObject.getJSONArray("process1Max").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess2Max(ObjectUtils.isNull(jsonObject.getJSONArray("process2Max").get(i)) ? null : jsonObject.getJSONArray("process2Max").getDoubleValue(i));
idxBizPvPointVarCentralValue.setProcess3Max(ObjectUtils.isNull(jsonObject.getJSONArray("process3Max").get(i)) ? null : jsonObject.getJSONArray("process3Max").getDoubleValue(i));
idxBizPvPointVarCentralValue.setAnalysisPointId(jsonObject.getString("analysisVariableId"));
idxBizPvPointVarCentralValue.setAnalysisPointIdName(analysisVariable.getPointName());
idxBizPvPointVarCentralValue.setProcessPoint1Id(jsonObject.getString("processVariable1Id"));
......@@ -849,8 +850,8 @@ public class KafkaConsumerService {
idxBizPvPointVarCentralValue.setProcessPoint2IdName(processVariableList.get(1).getPointName());
idxBizPvPointVarCentralValue.setProcessPoint3Id(jsonObject.getString("processVariable3Id"));
idxBizPvPointVarCentralValue.setProcessPoint3IdName(processVariableList.get(2).getPointName());
idxBizPvPointVarCentralValue.setAnalysisStdDev(jsonObject.getJSONArray("stdDev").getDoubleValue(i));
idxBizPvPointVarCentralValue.setAnalysisCenterValue(jsonObject.getJSONArray("centerValue").getDoubleValue(i));
idxBizPvPointVarCentralValue.setAnalysisStdDev(ObjectUtils.isNull(jsonObject.getJSONArray("stdDev").get(i)) ? null : jsonObject.getJSONArray("stdDev").getDoubleValue(i));
idxBizPvPointVarCentralValue.setAnalysisCenterValue(ObjectUtils.isNull(jsonObject.getJSONArray("centerValue").get(i)) ? null : jsonObject.getJSONArray("centerValue").getDoubleValue(i));
idxBizPvPointVarCentralValue.setArae(analysisVariable.getArae());
idxBizPvPointVarCentralValue.setStation(analysisVariable.getStation());
idxBizPvPointVarCentralValue.setSubarray(analysisVariable.getSubarray());
......
......@@ -5,10 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.IdxBizFanHealthIndexDto;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizUxfv;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.*;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizFanPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizPvPointProcessVariableClassificationMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.mapper2.IdxBizUxfvMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.service.IIdxBizFanHealthIndexService;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
......@@ -31,7 +31,10 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
@Autowired
IdxBizUxfvMapper idxBizUxfvMapper;
IdxBizPvPointProcessVariableClassificationMapper idxBizPvPointProcessVariableClassificationMapper;
@Autowired
IdxBizFanPointProcessVariableClassificationMapper idxBizFanPointProcessVariableClassificationMapper;
@Autowired
IndicatorDataMapper indicatorDataMapper;
/**
......@@ -63,18 +66,31 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
public Object getqyt(String address,String statioName,String equipmentName, String arae,String startTime,String endTime){
public Object getqyt(int type,String address,String statioName,String equipmentName, String arae,String startTime,String endTime){
Map<String, Object> map = new HashMap<>();
try {
//获取场站网关
IdxBizUxfv idxBizUxfv= idxBizUxfvMapper.selectOne(
new QueryWrapper<IdxBizUxfv>()
String tdid=null;
if(type==1){
IdxBizPvPointProcessVariableClassification idxBizPvPointProcessVariableClassification= idxBizPvPointProcessVariableClassificationMapper.selectOne(
new QueryWrapper<IdxBizPvPointProcessVariableClassification>()
.eq("INDEX_ADDRESS", address)
.eq("STATION", statioName)
.eq("EQUIPMENT_NAME", equipmentName)
.eq("ARAE", arae)
);
String tdid=address+"_"+idxBizUxfv.getGatewayId();
tdid=address+"_"+idxBizPvPointProcessVariableClassification.getGatewayId();
}else{
IdxBizFanPointProcessVariableClassification idxBizFanPointProcessVariableClassification= idxBizFanPointProcessVariableClassificationMapper.selectOne(
new QueryWrapper<IdxBizFanPointProcessVariableClassification>()
.eq("INDEX_ADDRESS", address)
.eq("STATION", statioName)
.eq("EQUIPMENT_NAME", equipmentName)
.eq("ARAE", arae)
);
tdid=address+"_"+idxBizFanPointProcessVariableClassification.getGatewayId();
}
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
Calendar calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
......@@ -87,8 +103,8 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
startTime = sdf.format(currentDayStartTime);
endTime= sdf.format(currentDayEndTime);
}else{
Date currentDayStartTime =new Date(startTime);
Date currentDayEndTime = new Date(endTime);
Date currentDayStartTime =dateFormat.parse(startTime);
Date currentDayEndTime = dateFormat.parse(endTime);
startTime = sdf.format(currentDayStartTime);
endTime= sdf.format(currentDayEndTime);
}
......@@ -100,13 +116,17 @@ public class IdxBizFanHealthIndexServiceImpl extends BaseService<IdxBizFanHealth
activePowers.add(indicatorDataListActivePowers.get(i).getValue());
axisData.add(DateUtil.format(indicatorDataListActivePowers.get(i).getCreatedTime(), "HH:mm"));
}
List<Map<String, Object>> seriesData = new ArrayList<>();
Map<String, Object> map = new HashMap<>();
Map<String, Object> map2 = new HashMap<>();
map2.put("data", activePowers);
seriesData.add(map2);
map.put("seriesData", seriesData);
// List<Map<String, Object>> seriesData = new ArrayList<>();
// Map<String, Object> map2 = new HashMap<>();
// map2.put("data", activePowers);
// seriesData.add(map2);
map.put("seriesData", activePowers);
map.put("axisData", axisData);
}catch (Exception e){
e.printStackTrace();
throw new RuntimeException();
}
return map;
}
......
......@@ -41,7 +41,7 @@ public interface IndicatorDataMapper extends BaseMapper<IndicatorData> {
List<IndicatorData> selectByIndexNameAndDate(@Param("equipmentIndexName") String equipmentIndexName, @Param("gatewayId") String gatewayId, @Param("date") String date, @Param("limitNum") Integer limitNum);
@Select("select `value`, created_time, `value_f` as valueF from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ")
@Select("select `value`, created_time from iot_data.indicator_data where id =#{id} and ts >= #{startTime} and ts <= #{endTime} ")
List<IndicatorData> selectDataByequipmentIndexNameAndtimeAndEquipmentNumber(@Param("id") String id, @Param("startTime") String startTime, @Param("endTime") String endTime);
......
package com.yeejoin.amos.boot.module.jxiop.biz.tasks;
import cn.hutool.http.HttpUtil;
import com.yeejoin.amos.boot.module.jxiop.api.dto.StationBasicDto;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationBasicServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.StationDataTaskImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @description: 定时获取场站最新数据
* @author: tw
* @createDate: 2023/7/3
*/
@Component
@EnableScheduling
@Slf4j
public class BigScreenTask {
@Autowired
StationDataTaskImpl stationDataTask;
@Autowired
StationBasicServiceImpl stationBasicService;
@Value("${idx.predict.serviceUrl:http://139.9.173.44:8095/jxdj/predict-data}")
private String predictServiceUrl;
/**
* 生成预测数据,平台大屏预测折线图使用,原有iframe集成算法预测数据PC端使用,
* 但是大屏也需使用此功能,由于算法折线图样式与大屏风格不一致,故新画页面查询算法的预测表,
* 但是算法服务只有调用查询,才生成数据,所以必须调用,否则大屏查询无预测数据
*/
@Scheduled(cron = "0 0/20 * * * ?")
public void predictDataCreate() {
List<StationBasicDto> stations = stationBasicService.getBaseMapper().getStationBasicListAll();
stations.forEach(s -> {
try {
String url = String.format("%s?code=%s", predictServiceUrl, s.getProjectOrgCode());
HttpUtil.get(url);
} catch (Exception e) {
log.error("调用算法定时生成大屏评估预测数据失败:机构{},错误信息:{}", s.getProjectOrgCode(), e.getMessage());
}
});
}
}
......@@ -131,3 +131,6 @@ myqueue=amos.privilege.v1.JXIOP.AQSC_FDGL.userBusiness
fan.statuts.stattuspath=upload/jxiop/device_status
pictureUrl=upload/jxiop/syz/
# Ԥ
idx.predict.serviceUrl=http://139.9.173.44:8095/jxdj/predict-data
## DB properties:
spring.datasource.url=jdbc:mysql://172.16.3.18:3306/amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://172.16.3.221:3306/amos_idx_biz?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=Yeejoin@2020
## eureka properties:
eureka.instance.hostname=172.16.3.18
eureka.instance.hostname=172.16.3.221
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:10001/eureka/
## redis properties:
spring.redis.database=1
spring.redis.host=172.16.3.18
spring.redis.host=172.16.3.221
spring.redis.port=6379
spring.redis.password=yeejoin@2020
......@@ -43,13 +43,13 @@ lettuce.timeout=10000
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.18:2883
emqx.broker=tcp://172.16.3.221:2883
emqx.client-user-name=super
emqx.client-password=a123456
emqx.max-inflight=1000
spring.influx.url=http://39.98.246.31:8086
spring.influx.url=http://172.16.3.221:8086
spring.influx.password=Yeejoin@2020
spring.influx.user=root
spring.influx.database=iot_platform
......
......@@ -55,8 +55,11 @@ spring.http.encoding.charset=utf-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
amos.system.socket.hostAndPort=172.16.3.221:10005
amos.system.socket.port=7777
amos.system.user.user-name=qms_sys
amos.system.user.user-name=kgd_gdd
amos.system.user.password=a1234560
amos.system.user.app-key=AMOS_STUDIO
amos.system.user.product=AMOS_STUDIO_WEB
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