Commit 689d9332 authored by lilongyang's avatar lilongyang

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

parents 621a7765 71ebceb0
...@@ -39,7 +39,7 @@ public class HandleESMessage2TDService { ...@@ -39,7 +39,7 @@ public class HandleESMessage2TDService {
/** /**
* 十分钟拉取ES数据存入TdEngine * 十分钟拉取ES数据存入TdEngine
*/ */
@Scheduled(cron = "0 */2 * * * ?") @Scheduled(cron = "0 */10 * * * ?")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void syncEsData2TDEngine() throws Exception { public void syncEsData2TDEngine() throws Exception {
SimpleDateFormat format = new SimpleDateFormat(datePattern); SimpleDateFormat format = new SimpleDateFormat(datePattern);
...@@ -56,7 +56,7 @@ public class HandleESMessage2TDService { ...@@ -56,7 +56,7 @@ public class HandleESMessage2TDService {
try { try {
HashMap<String, String> syncFlag = new HashMap<>(); HashMap<String, String> syncFlag = new HashMap<>();
syncFlag.put("sync_flag", "success"); syncFlag.put("sync_flag", "success");
emqKeeper.getMqttClient().publish("sync_esdata_to_tdengine_notice1", JSON.toJSONString(syncFlag).getBytes(), 0, false); emqKeeper.getMqttClient().publish("sync_esdata_to_tdengine_notice", JSON.toJSONString(syncFlag).getBytes(), 0, false);
log.info("同步ES数据至发发送消息给业务发送通知成功!"); log.info("同步ES数据至发发送消息给业务发送通知成功!");
} catch (Exception exception) { } catch (Exception exception) {
log.info("同步ES数据至发发送消息给业务发送通知失败!"); log.info("同步ES数据至发发送消息给业务发送通知失败!");
......
...@@ -287,7 +287,7 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe ...@@ -287,7 +287,7 @@ public class TanYinDataAcquisitionServiceImpl implements TanYinDataAcquisitionSe
jpStation.setAccumulatedPower(Double.parseDouble(tanYinStationInfo.getTotalPower())); jpStation.setAccumulatedPower(Double.parseDouble(tanYinStationInfo.getTotalPower()));
// 并网类型 // 并网类型
// jpStation.setSnCode(golangStationDetail.getNmicode()); // jpStation.setSnCode(golangStationDetail.getNmicode());
// jpStation.setPrice(); jpStation.setPrice(0.45);
// jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule())) ? 0 : Math.toIntExact(golangStationDetail.getModule())); // jpStation.setModuleCount(ObjectUtils.isEmpty(Math.toIntExact(golangStationDetail.getModule())) ? 0 : Math.toIntExact(golangStationDetail.getModule()));
jpStation.setOnGridType(TanYinConstant.intoNetWorkStatus.get("0")); // 没有该字段默认写死 jpStation.setOnGridType(TanYinConstant.intoNetWorkStatus.get("0")); // 没有该字段默认写死
// 去tanyin_customer_info 查询并网时间 // 去tanyin_customer_info 查询并网时间
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper"> <mapper namespace="com.yeejoin.amos.boot.module.hygf.api.mapper.PowerStationMapper">
<select id="queryPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto"> <select id="queryPage" resultType="com.yeejoin.amos.boot.module.hygf.api.dto.PowerStationDto">
select * from (select DISTINCT select DISTINCT
hygf_power_station.*, hygf_power_station.*,
b.initiate_status, b.initiate_status,
b.contract_lock_id, b.contract_lock_id,
...@@ -34,6 +34,5 @@ ...@@ -34,6 +34,5 @@
</if> </if>
<!-- GROUP BY hygf_peasant_household.sequence_nbr--> <!-- GROUP BY hygf_peasant_household.sequence_nbr-->
ORDER BY hygf_power_station.rec_date desc ORDER BY hygf_power_station.rec_date desc
) a
</select> </select>
</mapper> </mapper>
...@@ -30,10 +30,8 @@ import org.springframework.scheduling.annotation.EnableScheduling; ...@@ -30,10 +30,8 @@ import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import java.net.InetAddress; import java.net.InetAddress;
/** /**
* <pre> * <pre>
* 智信能源科技服务启动类 * 智信能源科技服务启动类
...@@ -51,17 +49,19 @@ import java.net.InetAddress; ...@@ -51,17 +49,19 @@ import java.net.InetAddress;
@EnableScheduling @EnableScheduling
@MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*", @MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*", "org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.**.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper","com.yeejoin.amos.boot.module.common.biz.*","com.yeejoin.amos.boot.module.jxiop.api.mapper","com.yeejoin.amos.boot.module.jxiop.biz.tdmapper","com.yeejoin.amos.boot.module.jxiop.biz.mapper5" }) "com.yeejoin.amos.boot.module.**.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper",
"com.yeejoin.amos.boot.module.common.biz.*", "com.yeejoin.amos.boot.module.jxiop.api.mapper",
"com.yeejoin.amos.boot.module.jxiop.biz.tdmapper", "com.yeejoin.amos.boot.module.jxiop.biz.mapper5" })
@ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" }) @ComponentScan(basePackages = { "org.typroject", "com.yeejoin.amos" })
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class}) @SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DruidDataSourceAutoConfigure.class })
//@SpringBootApplication //@SpringBootApplication
public class AmosJxiopAnalyseApplication { public class AmosJxiopAnalyseApplication {
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
//本地是否执行健康指数算法开关 // 本地是否执行健康指数算法开关
@Value("${openHealth:false}") @Value("${openHealth:false}")
Boolean openHealth; Boolean openHealth;
@Autowired @Autowired
private SyncESDataToTdengineMqttListener syncESDataToTdengineMqttListener; private SyncESDataToTdengineMqttListener syncESDataToTdengineMqttListener;
@Autowired @Autowired
private SyncDasSuccessMqttListener syncDasSuccessMqttListener; private SyncDasSuccessMqttListener syncDasSuccessMqttListener;
...@@ -76,17 +76,18 @@ public class AmosJxiopAnalyseApplication { ...@@ -76,17 +76,18 @@ public class AmosJxiopAnalyseApplication {
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
logger.info("\n----------------------------------------------------------\n\t" logger.info("\n----------------------------------------------------------\n\t"
+ "Application Amos-Biz-Boot-Jxiop-Montior is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + "Application Amos-Biz-Boot-Jxiop-Montior is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip
+ path + "/doc.html\n" + "----------------------------------------------------------"); + ":" + port + path + "/doc.html\n" + "----------------------------------------------------------");
} }
@Bean @Bean
public void initMqtt() throws Exception { public void initMqtt() throws Exception {
if (openHealth) { if (!openHealth) {
//订阅固化周期性数据成功的消息 return;
emqKeeper.subscript("sync_esdata_to_tdengine_notice", 1, syncESDataToTdengineMqttListener);
//订阅业务固化同步数据成功消息
emqKeeper.subscript("sync_iotdata_to_tdengine_notice", 1, syncDasSuccessMqttListener);
} }
// 订阅固化周期性数据成功的消息
emqKeeper.subscript("sync_esdata_to_tdengine_notice", 1, syncESDataToTdengineMqttListener);
// 订阅业务固化同步数据成功消息
emqKeeper.subscript("sync_iotdata_to_tdengine_notice", 1, syncDasSuccessMqttListener);
} }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-08-15
*/
@Data
@Accessors(chain = true)
@TableName("fan_health_index_latest_data")
public class IdxBizFanHealthIndexLatest {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "SEQUENCE_NBR", type = IdType.ID_WORKER_STR)
private String sequenceNbr;
/**
*
*/
@TableField("REC_DATE")
private Date recDate;
/**
* 分析维度类型
*/
@TableField("ANALYSIS_OBJ_TYPE")
private String analysisObjType;
/**
* 分析维度seq
*/
@TableField("ANALYSIS_OBJ_SEQ")
private String analysisObjSeq;
/**
*
*/
@TableField("WEIGTH")
private Double weigth;
/**
*
*/
@TableField("HEALTH_INDEX")
private Double healthIndex;
/**
* 健康等级
*/
@TableField("HEALTH_LEVEL")
private String healthLevel;
/**
*
*/
@TableField("ANALYSIS_TYPE")
private String analysisType;
/**
*
*/
@TableField("ANALYSIS_START_TIME")
private Date analysisStartTime;
/**
*
*/
@TableField("ANALYSIS_END_TIME")
private Date analysisEndTime;
/**
* 片区
*/
@TableField("ARAE")
private String arae;
/**
* 场站
*/
@TableField("STATION")
private String station;
/**
* 子系统
*/
@TableField("SUB_SYSTEM")
private String subSystem;
/**
* 型号
*/
@TableField("NUMBER")
private String number;
/**
* 设备名称
*/
@TableField("EQUIPMENT_NAME")
private String equipmentName;
/**
*
*/
@TableField("GATEWAY_ID")
private String gatewayId;
/**
* 点表地址
*/
@TableField("INDEX_ADDRESS")
private String indexAddress;
@TableField("ANOMALY")
private Double ANOMALY;
/**
* 分析变量名称
*/
@TableField("POINT_NAME")
private String pointName;
@TableField("ANALYSIS_TIME")
private String ANALYSISTIME;
/**
* KKS码
*/
@TableField("KKS")
private String kks;
}
package com.yeejoin.amos.boot.module.jxiop.biz.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-08-15
*/
@Data
@Accessors(chain = true)
@TableName("pv_health_index_latest_data")
public class IdxBizPvHealthIndexLatest{
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId(value = "SEQUENCE_NBR", type = IdType.ID_WORKER_STR)
private String sequenceNbr;
/**
*
*/
@TableField("REC_DATE")
private Date recDate;
/**
* 分析维度类型
*/
@TableField("ANALYSIS_OBJ_TYPE")
private String analysisObjType;
/**
* 分析维度seq
*/
@TableField("ANALYSIS_OBJ_SEQ")
private String analysisObjSeq;
/**
*
*/
@TableField("WEIGTH")
private Double weigth;
/**
*
*/
@TableField("HEALTH_INDEX")
private Double healthIndex;
/**
* 健康等级
*/
@TableField("HEALTH_LEVEL")
private String healthLevel;
/**
* 分析周期
*/
@TableField("ANALYSIS_TYPE")
private String analysisType;
/**
*
*/
@TableField("ANALYSIS_START_TIME")
private Date analysisStartTime;
/**
*
*/
@TableField("ANALYSIS_END_TIME")
private Date analysisEndTime;
/**
* 片区
*/
@TableField("ARAE")
private String arae;
/**
* 场站
*/
@TableField("STATION")
private String station;
/**
* 子阵
*/
@TableField("SUBARRAY")
private String subarray;
/**
* 厂商
*/
@TableField("MANUFACTURER")
private String manufacturer;
/**
* 设备类型
*/
@TableField("DEVICE_TYPE")
private String deviceType;
/**
* 网关ID
*/
@TableField("GATEWAY_ID")
private String gatewayId;
/**
* 点表地址
*/
@TableField("INDEX_ADDRESS")
private String indexAddress;
/**
* 设备名称
*/
@TableField("EQUIPMENT_NAME")
private String equipmentName;
@TableField("ANOMALY")
private Double ANOMALY;
/**
* 分析变量名称
*/
@TableField("POINT_NAME")
private String pointName;
@TableField("ANALYSIS_TIME")
private String ANALYSISTIME;
/**
* KKS码
*/
@TableField("KKS")
private String kks;
}
...@@ -2,9 +2,14 @@ package com.yeejoin.amos.boot.module.jxiop.biz.listener; ...@@ -2,9 +2,14 @@ package com.yeejoin.amos.boot.module.jxiop.biz.listener;
import java.text.ParseException; import java.text.ParseException;
import java.util.Date; import java.util.Date;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CountDownLatch; import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors; import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import javax.annotation.PostConstruct;
import org.eclipse.paho.client.mqttv3.MqttMessage; import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -13,6 +18,7 @@ import org.typroject.tyboot.component.emq.EmqxListener; ...@@ -13,6 +18,7 @@ import org.typroject.tyboot.component.emq.EmqxListener;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl;
...@@ -28,12 +34,24 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener { ...@@ -28,12 +34,24 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
@Autowired @Autowired
private CommonServiceImpl commonServiceImpl; private CommonServiceImpl commonServiceImpl;
@Autowired @Autowired
private TdengineTimeServiceImpl tdengineTimeService; private TdengineTimeServiceImpl tdengineTimeService;
@Autowired
private RedisUtils redisUtils;
private final static String JXIOP_ANALYSE_TIME = "JXIOP_ANALYSE_TIME";
@PostConstruct
public void test() {
// 每次启动清空redis
//redisUtils.set(JXIOP_ANALYSE_TIME, "2024-07-30 13:40:00");
redisUtils.del(JXIOP_ANALYSE_TIME);
}
@Override @Override
public void processMessage(String topic, MqttMessage mqttMessage) throws InterruptedException, ParseException { public void processMessage(String topic, MqttMessage mqttMessage) throws ParseException {
log.info(topic + "收到数据同步成功,开始计算健康指数!"); log.info(topic + "收到数据同步成功,开始计算健康指数!");
byte[] payload = mqttMessage.getPayload(); byte[] payload = mqttMessage.getPayload();
String str = new String(payload); String str = new String(payload);
...@@ -41,31 +59,77 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener { ...@@ -41,31 +59,77 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
JSONObject jsonObject = JSONObject.parseObject(msg); JSONObject jsonObject = JSONObject.parseObject(msg);
String flag = jsonObject.get("sync_flag").toString(); String flag = jsonObject.get("sync_flag").toString();
if ("success".equals(flag)) { if ("success".equals(flag)) {
Date time = new Date(); Date time = new Date();
time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10); time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10);
String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00"); String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00");
time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00"); time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00");
if (redisUtils.get(JXIOP_ANALYSE_TIME) != null) {
ExecutorService excutorService = Executors.newFixedThreadPool(4); // 如果相差20分钟 按10分钟处理 可能装备发消息晚了
int taskCount = 2; String lastformat = String.valueOf(redisUtils.get(JXIOP_ANALYSE_TIME));
final CountDownLatch latch = new CountDownLatch(taskCount); Date oldTime = DateUtil.parse(lastformat, "yyyy-MM-dd HH:mm:00");
excutorService.submit(()->{ long diffInMillies = Math.abs(time.getTime() - oldTime.getTime());
commonServiceImpl.healthWarningMinuteByFan(); long diffInMinutes = TimeUnit.MINUTES.convert(diffInMillies, TimeUnit.MILLISECONDS);
latch.countDown(); if (diffInMinutes == 20) {
}); time = DateUtil.offsetMinute(time, -10);
excutorService.submit(()->{ format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00");
commonServiceImpl.healthWarningMinuteByPv(); }
latch.countDown(); }
}); redisUtils.set(JXIOP_ANALYSE_TIME, format);
System.out.println(format);
System.out.println("等待所有任务完成.."); final Date timeF = time;
latch.await();
System.out.println("所有任务完成");
//区域 全域最后统一生成 CompletableFuture<String> fan=CompletableFuture.supplyAsync(()->{
tdengineTimeService.insertMomentDataAll(format); commonServiceImpl.healthWarningMinuteByFan(timeF);
String fanResult = "风电任务完成..";
System.out.println(fanResult);
return fanResult;
});
CompletableFuture<String> pv=CompletableFuture.supplyAsync(()->{
commonServiceImpl.healthWarningMinuteByPv(timeF);
String pvResult = "光伏任务完成..";
System.out.println(pvResult);
return pvResult;
});
try {
String fanResult = fan.get();
String pvResult = pv.get();
// 区域 全域最后统一生成
tdengineTimeService.insertMomentDataAll(format);
} catch (InterruptedException | ExecutionException e) {
System.out.println("任务执行异常");
e.printStackTrace();
}
//
// ExecutorService excutorService = Executors.newFixedThreadPool(10);
// int taskCount = 2;
// final CountDownLatch latch = new CountDownLatch(taskCount);
// excutorService.submit(() -> {
// commonServiceImpl.healthWarningMinuteByFan(timeF);
// System.out.println("风电任务完成..");
// latch.countDown();
// });
// excutorService.submit(() -> {
// commonServiceImpl.healthWarningMinuteByPv(timeF);
// System.out.println("光伏任务完成..");
// latch.countDown();
// });
//
// try {
// System.out.println("等待所有任务完成..");
// latch.await();
// System.out.println("所有任务完成");
// } catch (InterruptedException e) {
// System.out.println("任务执行异常");
// e.printStackTrace();
// Thread.currentThread().interrupt();
// }
// // 结束线程池
// excutorService.shutdown();
// 区域 全域最后统一生成
// tdengineTimeService.insertMomentDataAll(format);
// // 开始异步计算光伏的健康指数算法 // // 开始异步计算光伏的健康指数算法
// new Thread(() -> { // new Thread(() -> {
// // 调用光伏的健康指数算法 // // 调用光伏的健康指数算法
...@@ -77,19 +141,19 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener { ...@@ -77,19 +141,19 @@ public class SyncESDataToTdengineMqttListener extends EmqxListener {
// commonServiceImpl.healthWarningMinuteByFan(); // commonServiceImpl.healthWarningMinuteByFan();
// }).start(); // }).start();
} }
if ("pvsuccess".equals(flag)) { // if ("pvsuccess".equals(flag)) {
// 开始异步计算光伏的健康指数算法 // // 开始异步计算光伏的健康指数算法
new Thread(() -> { // new Thread(() -> {
// 调用光伏的健康指数算法 // // 调用光伏的健康指数算法
commonServiceImpl.healthWarningMinuteByPv(); // commonServiceImpl.healthWarningMinuteByPv();
}).start(); // }).start();
} // }
if ("fansuccess".equals(flag)) { // if ("fansuccess".equals(flag)) {
// 开始异步计算光伏的健康指数算法 // // 开始异步计算光伏的健康指数算法
new Thread(() -> { // new Thread(() -> {
// 调用光伏的健康指数算法 // // 调用光伏的健康指数算法
commonServiceImpl.healthWarningMinuteByFan(); // commonServiceImpl.healthWarningMinuteByFan();
}).start(); // }).start();
} // }
} }
} }
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndexLatest;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-08-15
*/
public interface IdxBizFanHealthIndexLatestMapper extends BaseMapper<IdxBizFanHealthIndexLatest> {
}
package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizPvHealthIndexLatest;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-08-15
*/
public interface IdxBizPvHealthIndexLatestMapper extends BaseMapper<IdxBizPvHealthIndexLatest> {
}
...@@ -1828,15 +1828,15 @@ public class CommonServiceImpl { ...@@ -1828,15 +1828,15 @@ public class CommonServiceImpl {
// @Scheduled(cron = "0 0/10 * * * ?") // @Scheduled(cron = "0 0/10 * * * ?")
// @Async("async") // @Async("async")
public void healthWarningMinuteByFan() { public void healthWarningMinuteByFan(Date time) {
if (!openHealth) { if (!openHealth) {
return; return;
} }
Date time = new Date(); // Date time = new Date();
time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10); // time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10);
String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00"); String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00");
time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00"); // time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00");
logger.info("风机---------------------健康指数时间----" + time); logger.info("风机---------------------健康指数时间----" + time);
// Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper List<IdxBizFanPointProcessVariableClassificationDto> data = idxBizFanPointProcessVariableClassificationMapper
...@@ -2455,15 +2455,15 @@ public class CommonServiceImpl { ...@@ -2455,15 +2455,15 @@ public class CommonServiceImpl {
// @Scheduled(cron = "0 0/10 * * * ?") // @Scheduled(cron = "0 0/10 * * * ?")
// @Async("async") // @Async("async")
public void healthWarningMinuteByPv() { public void healthWarningMinuteByPv(Date time) {
if (!openHealth) { if (!openHealth) {
return; return;
} }
// Calendar calendar = Calendar.getInstance(); // Calendar calendar = Calendar.getInstance();
Date time = new Date(); // Date time = new Date();
time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10); // time = DateUtil.offsetMinute(time, -DateUtil.minute(time) % 10);
String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00"); String format = DateUtil.format(time, "yyyy-MM-dd HH:mm:00");
time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00"); //time = DateUtil.parse(format, "yyyy-MM-dd HH:mm:00");
logger.info("光伏---------------------健康指数时间----" + time); logger.info("光伏---------------------健康指数时间----" + time);
List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper List<IdxBizPvPointProcessVariableClassificationDto> data = idxBizPvPointProcessVariableClassificationMapper
.getInfluxDBData(); .getInfluxDBData();
......
...@@ -558,8 +558,8 @@ FROM ( ...@@ -558,8 +558,8 @@ FROM (
<select id="getPointNameListBySumSystem" resultType="java.util.Map"> <select id="getPointNameListBySumSystem" resultType="java.util.Map">
SELECT SELECT
POINT_NAME as pointName, POINT_NAME as pointName,
INDEX_ADDRESS as indexAddress, max(INDEX_ADDRESS) as indexAddress,
STATION AS station max(STATION) AS station
FROM FROM
idx_biz_fan_point_process_variable_classification idx_biz_fan_point_process_variable_classification
<where> <where>
......
...@@ -11,13 +11,20 @@ ...@@ -11,13 +11,20 @@
FROM FROM
( (
SELECT SELECT
DATE_FORMAT( DATE_ADD(( DATE( DATE_ADD( now(), INTERVAL - 7 DAY ))), INTERVAL @s DAY ), '%Y-%m-%d' ) AS date, DATE_FORMAT(get_time_sub(6,'DAY'), '%Y-%m-%d' ) AS date UNION ALL
@s := @s + 1 AS `index` SELECT
FROM DATE_FORMAT(get_time_sub(5,'DAY'), '%Y-%m-%d' ) AS date UNION ALL
mysql.help_topic, SELECT
( SELECT @s := 1 ) temp DATE_FORMAT(get_time_sub(4,'DAY'), '%Y-%m-%d' ) AS date UNION ALL
WHERE SELECT
DATEDIFF( now(), DATE( DATE_ADD( now(), INTERVAL - 7 DAY )) ) >= @s ) a DATE_FORMAT(get_time_sub(3,'DAY'), '%Y-%m-%d' ) AS date UNION ALL
SELECT
DATE_FORMAT(get_time_sub(2,'DAY'), '%Y-%m-%d' ) AS date UNION ALL
SELECT
DATE_FORMAT(get_time_sub(1,'DAY'), '%Y-%m-%d' ) AS date UNION ALL
SELECT
DATE_FORMAT( CURDATE(), '%Y-%m-%d' ) AS date
) a
LEFT JOIN LEFT JOIN
( SELECT * FROM station_qr_code_statistics ( SELECT * FROM station_qr_code_statistics
<where> <where>
......
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