Commit b861dac4 authored by wujiang's avatar wujiang

Merge branch 'developer' of http://36.40.66.175:5000/moa/jxdj_zx/amos-boot-zx-biz into developer

parents caad4362 b520ef6e
......@@ -41,6 +41,9 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;
......@@ -75,12 +78,19 @@ public class TdInfoQueryController extends BaseController {
@Autowired
UserEmpowerMapper userEmpowerMapper;
private SimpleDateFormat hhmmss = new SimpleDateFormat("HH:mm:ss");
private SimpleDateFormat mmss = new SimpleDateFormat("mm:ss");
private SimpleDateFormat ss = new SimpleDateFormat("ss");
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/getFanHealthIndexInfo")
@ApiOperation(httpMethod = "POST", value = "分页查询健康指数信息 - 风电", notes = "分页查询健康指数信息 - 风电")
@GatewayIdAutowired
public ResponseModel<Page<FanHealthIndex>> getFanHealthIndexInfo(@RequestBody FanHealthIndexDto dto) throws ParseException {
ReginParams reginParams = getSelectedOrgInfo();
String userId = reginParams.getUserModel().getUserId();
StdUserEmpower stdUserEmpower = userEmpowerMapper.selectOne(new QueryWrapper<StdUserEmpower>().eq("amos_user_id", userId).eq("permission_type", "YTH"));
......@@ -89,14 +99,37 @@ public class TdInfoQueryController extends BaseController {
orgCode = stdUserEmpower.getAmosOrgCode().get(0)+"%";
}
dto.setOrgCode(orgCode);
Date currentDate = new Date();
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按天") && startDate.length() == 10) {
startDate = startDate + " " + hhmmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按小时") && startDate.length() == 13) {
startDate = startDate + ":" + mmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按10分钟") && startDate.length() == 16) {
startDate = startDate + ":" + ss.format(currentDate);
}
Date date = DateUtils.dateParse(startDate, DATE_TIME_PATTERN);
String startDateString = DateUtils.dateFormat(DateUtils.dateAddHours(date, -8), DATE_TIME_PATTERN);
dto.setStartDate(startDateString);
}
if (CharSequenceUtil.isNotEmpty(dto.getEndDate())) {
String endDate = dto.getEndDate();
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按天") && endDate.length() == 10) {
endDate = endDate + " " + hhmmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按小时") && endDate.length() == 13) {
endDate = endDate + ":" + mmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按10分钟") && endDate.length() == 16) {
endDate = endDate + ":" + ss.format(currentDate);
}
Date endDateDate = DateUtils.dateParse(endDate, DATE_TIME_PATTERN);
String endDateString = DateUtils.dateFormat(DateUtils.dateAddHours(endDateDate, -8), DATE_TIME_PATTERN);
dto.setEndDate(endDateString);
......@@ -165,14 +198,39 @@ public class TdInfoQueryController extends BaseController {
orgCode = stdUserEmpower.getAmosOrgCode().get(0)+"%";
}
dto.setOrgCode(orgCode);
Date currentDate = new Date();
if (CharSequenceUtil.isNotEmpty(dto.getStartDate())) {
String startDate = dto.getStartDate();
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按天") && startDate.length() == 10) {
startDate = startDate + " " + hhmmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按小时") && startDate.length() == 13) {
startDate = startDate + ":" + mmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按10分钟") && startDate.length() == 16) {
startDate = startDate + ":" + ss.format(currentDate);
}
Date date = DateUtils.dateParse(startDate, DATE_TIME_PATTERN);
String startDateString = DateUtils.dateFormat(DateUtils.dateAddHours(date, -8), DATE_TIME_PATTERN);
dto.setStartDate(startDateString);
}
if (CharSequenceUtil.isNotEmpty(dto.getEndDate())) {
String endDate = dto.getEndDate();
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按天") && endDate.length() == 10) {
endDate = endDate + " " + hhmmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按小时") && endDate.length() == 13) {
endDate = endDate + ":" + mmss.format(currentDate);
}
if(dto.getAnalysisType() != null && dto.getAnalysisType().equals("按10分钟") && endDate.length() == 16) {
endDate = endDate + ":" + ss.format(currentDate);
}
Date endDateDate = DateUtils.dateParse(endDate, DATE_TIME_PATTERN);
String endDateString = DateUtils.dateFormat(DateUtils.dateAddHours(endDateDate, -8), DATE_TIME_PATTERN);
dto.setEndDate(endDateString);
......
......@@ -16,11 +16,13 @@ import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.*;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import tech.tablesaw.api.ColumnType;
import tech.tablesaw.api.DoubleColumn;
import tech.tablesaw.api.Table;
......@@ -90,6 +92,9 @@ public class KafkaConsumerService {
@Value("${last.month.num:12}")
private Integer lastMonthNum;
@Autowired
EmqKeeper emqKeeper;
ExecutorService service = Executors.newFixedThreadPool(threadNum);
BlockingQueue<PointData> queue = new LinkedBlockingQueue<>();
......@@ -567,6 +572,13 @@ public class KafkaConsumerService {
resultMap.put("processVariable", data1);
resultMap.put("processVariableId", fanPointVarCorrelation.getSequenceNbr());
if (fanPointVarCorrelation.getEquipmentName().equals("升压站")){
try {
emqKeeper.getMqttClient().publish("gkblfx",JSON.toJSONString(resultMap).getBytes(), 2 ,false);
} catch (MqttException e) {
e.printStackTrace();
}
}
String response = HttpUtil.createPost(baseUrlGKHF).body(JSON.toJSONString(resultMap)).execute()
.body();
......@@ -606,7 +618,7 @@ public class KafkaConsumerService {
* @param consumerRecords messages
* @param ack ack
*/
@KafkaListener(id = "GKHFPvConsumer", groupId = "consumerGroup", topics = kafkaTopicConsumerGKHFPv)
@KafkaListener(id = "GKHFPvConsume12r", groupId = "consumerGroup", topics = kafkaTopicConsumerGKHFPv)
public void listenGKHFPv(List<ConsumerRecord<String, String>> consumerRecords, Acknowledgment ack) {
try {
......@@ -653,7 +665,14 @@ public class KafkaConsumerService {
double[] data1 = table.where(selection).doubleColumn("value").asDoubleArray();
resultMap.put("processVariable", data1);
resultMap.put("processVariableId", pvPointVarCorrelation.getSequenceNbr());
if (pvPointVarCorrelation.getEquipmentName().equals("升压站")){
System.out.println("升压站数据进来了");
try {
emqKeeper.getMqttClient().publish("gkblfx",JSON.toJSONString(resultMap).getBytes(), 2 ,false);
} catch (MqttException e) {
e.printStackTrace();
}
}
String response = HttpUtil.createPost(baseUrlGKHF).body(JSON.toJSONString(resultMap)).execute()
.body();
......
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