|
@@ -5,11 +5,16 @@ import cn.hutool.http.HttpRequest;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.slibra.business.domain.TXinyiIndustry;
|
|
|
+import com.slibra.business.domain.TXinyiRobot;
|
|
|
import com.slibra.business.mapper.TXinyiIndustryMapper;
|
|
|
+import com.slibra.business.mapper.TXinyiRobotMapper;
|
|
|
+import com.slibra.common.enums.DataSourceType;
|
|
|
import com.slibra.common.utils.DateUtils;
|
|
|
+import com.slibra.framework.datasource.DynamicDataSourceContextHolder;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import com.slibra.common.utils.StringUtils;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.util.StopWatch;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
@@ -44,6 +49,9 @@ public class RyTask
|
|
|
|
|
|
@Autowired
|
|
|
private TXinyiIndustryMapper xinyiIndustryMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private TXinyiRobotMapper xinyiRobotMapper;
|
|
|
// public final static StopWatch watch = new StopWatch("task");
|
|
|
public static final String[] queryTags = {"信义污水厂JS_COD_Value","信义污水厂JS_PH_Value","信义污水厂JS_SS_Value","信义污水厂JS_ZL_Value","信义污水厂JS_ZA_Value","信义污水厂JS_AD_Value","信义污水厂JS_T_Value","信义污水厂进水泵房液位","信义污水厂出水瞬时流量","信义污水厂升级出水COD","信义污水厂升级出水PH","信义污水厂升级出水SS","信义污水厂升级出水TN","信义污水厂升级出水TP","信义污水厂升级出水氨氮","信义污水厂AIT202_Value","信义污水厂AIT203_Value","信义污水厂AIT207_Value","信义污水厂AIT206_Value","信义污水厂AIT209_Value","信义污水厂AIT210_Value","信义污水厂进水TDS","信义污水厂FT101_Value","信义污水厂SWCHHYHLB1_R_Value","信义污水厂SWCHHYHLB2_R_Value","信义污水厂SWCHHYHLB3_R_Value","信义污水厂SWCHHYHLB4_R_Value","信义污水厂SWCHHYHLB5_R_Value","信义污水厂SWCHHYHLB6_R_Value","信义污水厂SWCWNHLB1_R_Value","信义污水厂SWCWNHLB2_R_Value","信义污水厂SWCWNHLB3_R_Value","信义污水厂SWCWNHLB4_R_Value","信义污水厂SWCWNHLB5_R_Value","信义污水厂GFJ1_R_Value","信义污水厂GFJ2_R_Value","信义污水厂GFJ3_R_Value","信义污水厂GFJ4_R_Value","信义污水厂GFJ5_R_Value","信义污水厂GFJ6_R_Value","信义污水厂GFJ1_KQLL_Value","信义污水厂GFJ2_KQLL_Value","信义污水厂GFJ3_KQLL_Value","信义污水厂GFJ4_KQLL_Value","信义污水厂GFJ5_KQLL_Value","信义污水厂GFJ6_KQLL_Value"};
|
|
|
|
|
@@ -77,7 +85,7 @@ public class RyTask
|
|
|
System.out.println("结束时间:" + end);
|
|
|
|
|
|
// 当前小时加一小时,作为下一个小时的起始时间
|
|
|
- currentHour = currentHour.plusMinutes(10);
|
|
|
+ currentHour = currentHour.plusMinutes(5);
|
|
|
|
|
|
//每个小时查询一次数据
|
|
|
String url = "http://10.0.0.27:4568/api/v1/khquerydata";
|
|
@@ -262,6 +270,28 @@ public class RyTask
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 定时从sqlserver获取数据
|
|
|
+ */
|
|
|
+ public void sqlserverData(){
|
|
|
+
|
|
|
+ //从
|
|
|
+ DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.SLAVE.name());
|
|
|
+ List<TXinyiRobot> tXinyiRobots = xinyiRobotMapper.selectTXinyiRobotList(null);
|
|
|
+ DynamicDataSourceContextHolder.clearDataSourceType();
|
|
|
+ System.out.println(JSON.toJSONString(tXinyiRobots));
|
|
|
+ System.out.println("-------------");
|
|
|
+ //主
|
|
|
+ if(!CollectionUtils.isEmpty(tXinyiRobots)){
|
|
|
+ for (TXinyiRobot tXinyiRobot : tXinyiRobots) {
|
|
|
+ tXinyiRobot.setvDateTime(tXinyiRobot.getvDate() + tXinyiRobot.getvTime());
|
|
|
+ tXinyiRobot.setCreatedTime(new Date());
|
|
|
+ this.xinyiRobotMapper.insertTXinyiRobot(tXinyiRobot);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
public static void main(String[] args) {
|
|
|
LocalDateTime endTime = LocalDateTime.now();
|
|
|
System.out.println("endTime = " + endTime);
|