Browse Source

java脚本能力

xushili 9 months ago
parent
commit
1f77e44a85
61 changed files with 1321 additions and 587 deletions
  1. 3 10
      ruoyi-admin/src/main/java/com/ruoyi/RuoYiApp.java
  2. 8 13
      ruoyi-admin/src/main/java/com/ruoyi/web/runner/LoadDataSourceRunner.java
  3. 19 5
      ruoyi-admin/src/main/resources/application-druid.yml
  4. 1 1
      ruoyi-admin/src/main/resources/application.yml
  5. 378 0
      ruoyi-admin/src/test/java/com/ruoyi/JavaFunctionJobHandler.java
  6. 28 0
      ruoyi-admin/src/test/java/com/ruoyi/JavaGlueJobHandler.java
  7. 61 58
      ruoyi-admin/src/test/java/com/ruoyi/UcpAppTests.java
  8. 3 1
      ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java
  9. 4 4
      ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml
  10. 6 0
      ruoyi-quartz/pom.xml
  11. 8 8
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java
  12. 1 1
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java
  13. 146 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/glue/GlueFactory.java
  14. 53 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/glue/GlueTypeEnum.java
  15. 92 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/glue/impl/SpringGlueFactory.java
  16. 42 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/IJobHandler.java
  17. 49 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/impl/GlueJobHandler.java
  18. 63 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/impl/MethodJobHandler.java
  19. 15 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/impl/MyJobHandler.java
  20. 8 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ChangedSave.java
  21. 37 0
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java
  22. 1 1
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java
  23. 1 1
      ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java
  24. 2 2
      ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml
  25. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml
  26. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml
  27. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml
  28. 2 2
      ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
  29. 15 0
      universal-computing-platform/pom.xml
  30. 15 22
      universal-computing-platform/src/main/java/com/ruoyi/ucp/glue/GlueFactory.java
  31. 0 0
      universal-computing-platform/src/main/glue/GlueTypeEnum.java
  32. 3 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/glue/impl/SpringGlueFactory.java
  33. 0 0
      universal-computing-platform/src/main/handler/IJobHandler.java
  34. 0 0
      universal-computing-platform/src/main/handler/impl/GlueJobHandler.java
  35. 0 0
      universal-computing-platform/src/main/handler/impl/MethodJobHandler.java
  36. 31 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/config/RedisConfig.java
  37. 0 16
      universal-computing-platform/src/main/java/com/ruoyi/ucp/controller/SysFunController.java
  38. 6 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/DoubleStatData.java
  39. 1 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/Formula.java
  40. 3 61
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/LineInfoDay.java
  41. 10 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/Method.java
  42. 9 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/PointData.java
  43. 6 105
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/PointInfo.java
  44. 46 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StateAi.java
  45. 7 70
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoDay.java
  46. 3 74
      universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoHour.java
  47. 4 4
      universal-computing-platform/src/main/java/com/ruoyi/ucp/feign/AdapterApi.java
  48. 0 23
      universal-computing-platform/src/main/java/com/ruoyi/ucp/handler/impl/MyJobHandler.java
  49. 16 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/StateAiMapper.java
  50. 18 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IStateAiService.java
  51. 2 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IStationInfoDayService.java
  52. 7 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/LineInfoDayServiceImpl.java
  53. 3 1
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/PointInfoServiceImpl.java
  54. 30 0
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StateAiServiceImpl.java
  55. 14 6
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoDayServiceImpl.java
  56. 11 2
      universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoHourServiceImpl.java
  57. 4 10
      universal-computing-platform/src/main/java/com/ruoyi/ucp/util/MyTask.java
  58. 10 10
      universal-computing-platform/src/main/resources/application-druid.yml
  59. 0 21
      universal-computing-platform/src/test/java/com/ruoyi/ucp/JavaFunctionJobHandler.java
  60. 0 41
      universal-computing-platform/src/test/java/com/ruoyi/ucp/JavaGlueJobHandler.java
  61. 10 5
      universal-computing-platform/src/test/java/com/ruoyi/ucp/UcpAppTests.java

+ 3 - 10
ruoyi-admin/src/main/java/com/ruoyi/RuoYiApp.java

@@ -5,6 +5,7 @@ import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 
 /**
  * 启动程序
@@ -12,21 +13,13 @@ import org.springframework.cache.annotation.EnableCaching;
  * @author ruoyi
  */
 @MapperScan("com.ruoyi.*.mapper")
+//@EnableFeignClients
 @SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
 @EnableCaching
 public class RuoYiApp {
     public static void main(String[] args) {
         // System.setProperty("spring.devtools.restart.enabled", "false");
         SpringApplication.run(RuoYiApp.class, args);
-        System.out.println("(♥◠‿◠)ノ゙  若依启动成功   ლ(´ڡ`ლ)゙  \n" +
-                " .-------.       ____     __        \n" +
-                " |  _ _   \\      \\   \\   /  /    \n" +
-                " | ( ' )  |       \\  _. /  '       \n" +
-                " |(_ o _) /        _( )_ .'         \n" +
-                " | (_,_).' __  ___(_ o _)'          \n" +
-                " |  |\\ \\  |  ||   |(_,_)'         \n" +
-                " |  | \\ `'   /|   `-'  /           \n" +
-                " |  |  \\    /  \\      /           \n" +
-                " ''-'   `'-'    `-..-'              ");
+        System.out.println("(♥◠‿◠)ノ゙  启动成功   ლ(´ڡ`ლ)゙  ");
     }
 }

+ 8 - 13
ruoyi-admin/src/main/java/com/ruoyi/web/runner/LoadDataSourceRunner.java

@@ -3,21 +3,18 @@ package com.ruoyi.web.runner;
 import cn.hutool.core.bean.BeanUtil;
 import com.alibaba.druid.pool.DruidDataSource;
 import com.ruoyi.framework.datasource.DynamicDataSource;
+import com.ruoyi.quartz.glue.GlueFactory;
+import com.ruoyi.quartz.handler.impl.MyJobHandler;
 import com.ruoyi.ucp.entity.Formula;
 import com.ruoyi.ucp.entity.Method;
 import com.ruoyi.ucp.entity.UcpDataSource;
 import com.ruoyi.ucp.feign.AdapterApi;
-import com.ruoyi.ucp.glue.GlueFactory;
-import com.ruoyi.ucp.handler.IJobHandler;
-import com.ruoyi.ucp.handler.impl.MyJobHandler;
-import com.ruoyi.ucp.mapper.TurbineInfoMapper;
+import com.ruoyi.quartz.handler.IJobHandler;
 import com.ruoyi.ucp.service.*;
 import org.springframework.boot.CommandLineRunner;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
 import java.util.List;
 
 @Component
@@ -43,8 +40,6 @@ public class LoadDataSourceRunner implements CommandLineRunner {
     private ILineInfoDayService lineInfoDayService;
     @Resource
     private IFormulaService formulaService;
-    @Resource
-    private MyJobHandler myJobHandler;
 
     @Override
     public void run(String... args) {
@@ -60,18 +55,18 @@ public class LoadDataSourceRunner implements CommandLineRunner {
 
         List<Method> methods = methodService.list();
         List<Formula> formulas = formulaService.list();
-        String functionCode = "";
+        String functionCode = GlueFactory.getFunctionTemplate();
         try {
             for (Method method : methods) {
                 //engine.eval(method.getMethodExpression());
-                functionCode = GlueFactory.getFunctionTemplate()
-                        .replace("//此处加公式", method.getMethodExpression()+"\n//此处加公式");
+                functionCode = functionCode
+                        .replace("//此处加公式", method.getMethodExpression() + "\n//此处加公式");
             }
             for (Formula formula : formulas) {
-                functionCode = functionCode.replace("//此处加公式", formula.getFormulaExpression()+"\n//此处加公式");
+                functionCode = functionCode.replace("//此处加公式", formula.getFormulaExpression() + "\n//此处加公式");
             }
             IJobHandler jobHandler = GlueFactory.getInstance().loadNewInstance(functionCode);
-            myJobHandler.setJobHandler(jobHandler);
+            MyJobHandler.jobHandler = jobHandler;
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 19 - 5
ruoyi-admin/src/main/resources/application-druid.yml

@@ -5,9 +5,17 @@ spring:
     driver-class-name: org.postgresql.Driver                # pgsql驱动包
     druid:
       master:
-        url: jdbc:postgresql://123.60.219.66:5432/ry-vue
-        username: postgres
-        password: gyeepd@123
+        url: jdbc:postgresql://192.168.126.128:5432/calc_hub
+        username: gfhd
+        password: zghww693
+      taos:
+        url: jdbc:TAOS-RS://192.168.126.128:6041/jsfw_db?charset=UTF-8&locale=en_US.UTF-8&timezone=UTC-8
+        username: root
+        password: taosdata
+        driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
+#        url: jdbc:postgresql://123.60.219.66:5432/ry-vue
+#        username: postgres
+#        password: gyeepd@123
 #        url: jdbc:postgresql://172.16.12.102:5432/calc_hub
 #        username: postgres
 #        password: GYee@#56
@@ -16,9 +24,15 @@ spring:
 #        password: zghww693
 #        driver-class-name: com.mysql.cj.jdbc.Driver
       slave:
-        url: jdbc:postgresql://123.60.219.66:5432/power_lcm
+#        url: jdbc:postgresql://192.168.126.128:5432/postgres
+#        username: gfhd
+#        password: zghww693
+        url: jdbc:postgresql://192.168.2.232:5432/power_lcm
         username: postgres
-        password: gyeepd@123
+        password: gd123
+#        url: jdbc:postgresql://123.60.219.66:5432/power_lcm
+#        username: postgres
+#        password: gyeepd@123
 #        url: jdbc:postgresql://172.16.12.102:5432/power_lcm
 #        username: postgres
 #        password: GYee@#56

+ 1 - 1
ruoyi-admin/src/main/resources/application.yml

@@ -108,7 +108,7 @@ token:
   # 令牌密钥
   secret: abcdefghijklmnopqrstuvwxyz
   # 令牌有效期(默认30分钟)
-  expireTime: 30
+  expireTime: 60
 
 # MyBatis配置
 #mybatis:

+ 378 - 0
ruoyi-admin/src/test/java/com/ruoyi/JavaFunctionJobHandler.java

@@ -0,0 +1,378 @@
+package com.ruoyi;
+
+import cn.hutool.core.date.DateTime;
+import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.ruoyi.quartz.handler.IJobHandler;
+import com.ruoyi.quartz.task.ChangedSave;
+import com.ruoyi.ucp.entity.*;
+import com.ruoyi.ucp.feign.AdapterApi;
+import com.ruoyi.ucp.service.*;
+import org.springframework.data.redis.core.RedisTemplate;
+
+import javax.annotation.Resource;
+import java.net.URI;
+import java.util.*;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+public class JavaFunctionJobHandler extends IJobHandler {
+
+    @Resource
+    private AdapterApi adapter;
+    @Resource
+    private IPointInfoService pointService;
+    @Resource
+    private IStationInfoHourService stationInfoHourService;
+    @Resource
+    private IStationInfoDayService stationInfoDayService;
+    @Resource
+    private ILineInfoDayService lineInfoDayService;
+    @Resource
+    private IStateAiService stateAiService;
+    @Resource
+    private RedisTemplate redisTemplate;
+
+    @Override
+    public void execute() throws Exception {
+
+    }
+
+    @Override
+    public IJobHandler getFunctionHandler() {
+        return null;
+    }
+
+    @Override
+    public void setFunctionHandler(IJobHandler jobHandler) {
+
+    }
+
+    public void calcAQTS(Date date) {
+        QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select("min(record_date) record_date");
+        StationInfoDay one = stationInfoDayService.getOne(wrapper);
+        wrapper = new QueryWrapper<>();
+        wrapper.eq("record_date", one.getRecordDate());
+        //最早时间的列表
+        List<StationInfoDay> list = stationInfoDayService.list(wrapper);
+        List<StationInfoDay> today = getStationinfoByDate(date);
+        if (today.isEmpty()) {
+            for (StationInfoDay infoDay : list) {
+                StationInfoDay day = new StationInfoDay();
+                day.setStationId(infoDay.getStationId());
+                day.setRecordDate(date);
+                day.setAqts(infoDay.getAqts() + (int) DateUtil.betweenDay(infoDay.getRecordDate(), date, true));
+                today.add(day);
+            }
+        } else {
+            Map<String, StationInfoDay> collect = list.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
+            for (StationInfoDay day : today) {
+                StationInfoDay day1 = collect.get(day.getStationId());
+                day.setAqts(day1.getAqts() + (int) DateUtil.betweenDay(day1.getRecordDate(), date, true));
+            }
+        }
+        stationInfoDayService.saveOrUpdateBatch(today);
+    }
+
+    public List<StationInfoDay> getStationinfoByDate(Date date) {
+        QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.eq("record_date", date);
+        return stationInfoDayService.list(wrapper);
+    }
+
+    public URI taosGoldenUriTest() {
+        return URI.create("http://127.0.0.1:8011/ts");
+    }
+
+    public URI taosUri() {
+        return URI.create("http://172.16.12.101:8012/ts");
+    }
+
+    public void calcStationHourRFDL(Date hour) {
+        PointInfo pointInfo = new PointInfo();
+        pointInfo.setInstitutionType("station");
+        pointInfo.setUniformCode("RFDLSYZ");
+        List<PointInfo> entity = pointService.getByEntity(pointInfo);
+        Map<String, PointData> section = adapter.getHistorySection(taosGoldenUriTest()
+                , pointInfos2Keys(entity), hour.getTime());
+        List<StationInfoHour> byHours = getStationinfoByHour(hour);
+        if (byHours.isEmpty()) {
+            for (PointInfo point : entity) {
+                StationInfoHour info = new StationInfoHour();
+                info.setStationId(point.getStationId());
+                info.setRecordDate(DateUtil.beginOfHour(hour));
+                info.setRfdl(section.get(point.getPointKey()).getDoubleValue());
+                byHours.add(info);
+            }
+        } else {
+            Map<String, String> collect = entity.stream().collect(Collectors.toMap(PointInfo::getStationId, PointInfo::getPointKey));
+            for (StationInfoHour byHour : byHours) {
+                byHour.setRfdl(section.get(collect.get(byHour.getStationId())).getDoubleValue());
+            }
+        }
+        stationInfoHourService.saveOrUpdateBatch(byHours);
+    }
+
+    public List<StationInfoHour> getStationinfoByHour(Date hour) {
+        QueryWrapper<StationInfoHour> wrapper = new QueryWrapper<>();
+        wrapper.eq("record_date", DateUtil.beginOfHour(hour));
+        return stationInfoHourService.list(wrapper);
+    }
+
+    public String pointInfos2Keys(List<PointInfo> entity) {
+        return entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
+    }
+
+    public void calcStationHourPJGL(Date hour) {
+        PointInfo pointInfo = new PointInfo();
+        pointInfo.setInstitutionType("station");
+        pointInfo.setUniformCode("SSZGL");
+        List<PointInfo> entity = pointService.getByEntity(pointInfo);
+        List<StationInfoHour> byHours = getStationinfoByHour(hour);
+        Map<String, StationInfoHour> collect = new HashMap<>();
+        if (byHours.size() > 0) {
+            collect = byHours.stream().collect(
+                    Collectors.toMap(StationInfoHour::getStationId, Function.identity()));
+        }
+        List<DoubleStatData> stat;
+        List<StationInfoHour> byHours2 = new ArrayList<>();
+        for (PointInfo point : entity) {
+            stat = adapter.getHistoryStat(taosGoldenUriTest(),
+                    point.getPointKey(), DateUtil.offsetHour(hour, -1).getTime(), hour.getTime());
+            if (byHours.isEmpty()) {
+                StationInfoHour info = new StationInfoHour();
+                info.setStationId(point.getStationId());
+                info.setRecordDate(DateUtil.beginOfHour(hour));
+                if (stat.isEmpty()) info.setPjgl(0.0);
+                info.setPjgl(stat.get(0).getAvg().getDoubleValue());
+                byHours2.add(info);
+            } else {
+                collect.get(point.getStationId()).setPjgl(stat.get(0).getAvg().getDoubleValue());
+            }
+        }
+        stationInfoHourService.saveOrUpdateBatch(byHours.isEmpty() ? byHours2 : byHours);
+    }
+
+    public void calcLineDjlRfdl(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+        //date当天零点加三分钟
+        DateTime time2 = DateUtil.offsetMinute(time, 3);
+        //date昨天零点加三分钟
+        DateTime time1 = DateUtil.offsetMinute(time0, 3);
+
+        PointInfo pi = new PointInfo();
+        pi.setUniformCode("Z-ZXYG-JX");
+        pi.setLineId("all");
+        List<PointInfo> entity = pointService.getByEntity(pi);
+        String keys = pointInfos2Keys(entity);
+        Map<String, PointData> latest2 = adapter.getHistorySection(taosGoldenUriTest(), keys, time2.getTime());
+        Map<String, PointData> latest1 = adapter.getHistorySection(taosGoldenUriTest(), keys, time1.getTime());
+
+        List<LineInfoDay> byDate = getLineinfoByDate(time0.toJdkDate());
+        Map<String, LineInfoDay> collect = new HashMap<>();
+        if (byDate.size() > 0) {
+            collect = byDate.stream().collect(Collectors.toMap(LineInfoDay::getLineId, Function.identity()));
+        }
+
+        List<LineInfoDay> list = new ArrayList<>();
+        for (PointInfo info : entity) {
+            LineInfoDay day;
+            if (byDate.isEmpty()) {
+                day = new LineInfoDay();
+                day.setStationId(info.getStationId());
+                day.setProjectId(info.getProjectId());
+                day.setLineId(info.getLineId());
+                day.setRecordDate(time0.toJdkDate());
+            } else {
+                day = collect.get(info.getLineId());
+            }
+            day.setRfdl((int) ((latest2.get(info.getPointKey()).getDoubleValue() -
+                    latest1.get(info.getPointKey()).getDoubleValue()) * info.getCoef()));
+            list.add(day);
+        }
+        lineInfoDayService.saveOrUpdateBatch(list);
+    }
+
+    public List<LineInfoDay> getLineinfoByDate(Date date) {
+        QueryWrapper<LineInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.eq("record_date", date);
+        return lineInfoDayService.list(wrapper);
+    }
+
+    public void calcStationSwGwCyDl(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+        //date当天零点加三分钟
+        DateTime time2 = DateUtil.offsetMinute(time, 3);
+        //date昨天零点加三分钟
+        DateTime time1 = DateUtil.offsetMinute(time0, 3);
+
+        PointInfo swdlPi = new PointInfo();
+        swdlPi.setUniformCode("Z-ZXYG-CX");
+        PointInfo gwdlPi = new PointInfo();
+        gwdlPi.setUniformCode("Z-FXYG-CX");
+        PointInfo cydlPi = new PointInfo();
+        cydlPi.setUniformCode("Z-ZXYG-ZYB");
+
+        List<PointInfo> swdlEt = pointService.getByEntity(swdlPi);
+        List<PointInfo> gwdlEt = pointService.getByEntity(gwdlPi);
+        Map<String, PointInfo> gwdlMap = gwdlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+        List<PointInfo> cydlEt = pointService.getByEntity(cydlPi);
+        Map<String, PointInfo> cydlMap = cydlEt.stream().collect(Collectors.toMap(PointInfo::getStationId, Function.identity()));
+
+        String swdlK = pointInfos2Keys(swdlEt);
+        String gwdlK = pointInfos2Keys(gwdlEt);
+        String cydlK = pointInfos2Keys(cydlEt);
+
+        Map<String, PointData> swdlL2 = adapter.getHistorySection(taosGoldenUriTest(), swdlK, time2.getTime());
+        Map<String, PointData> swdlL1 = adapter.getHistorySection(taosGoldenUriTest(), swdlK, time1.getTime());
+        Map<String, PointData> gwdlL2 = adapter.getHistorySection(taosGoldenUriTest(), gwdlK, time2.getTime());
+        Map<String, PointData> gwdlL1 = adapter.getHistorySection(taosGoldenUriTest(), gwdlK, time1.getTime());
+        Map<String, PointData> cydlL2 = adapter.getHistorySection(taosGoldenUriTest(), cydlK, time2.getTime());
+        Map<String, PointData> cydlL1 = adapter.getHistorySection(taosGoldenUriTest(), cydlK, time1.getTime());
+
+        List<StationInfoDay> byDate = getStationinfoByDate(time0.toJdkDate());
+        Map<String, StationInfoDay> collect = new HashMap<>();
+        if (byDate.size() > 0) {
+            collect = byDate.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
+        }
+        StationInfoDay infoDay;
+        String stationId;
+        PointInfo gwdlKey, cydlKey;
+        List<StationInfoDay> infoDays = new ArrayList<>();
+        for (PointInfo info : swdlEt) {
+            stationId = info.getStationId();
+            if (byDate.isEmpty()) {
+                infoDay = new StationInfoDay();
+                infoDay.setStationId(stationId);
+                infoDay.setRecordDate(time0.toJdkDate());
+            } else {
+                infoDay = collect.get(stationId);
+            }
+            infoDay.setSwdl((int) ((swdlL2.get(info.getPointKey()).getDoubleValue() -
+                    swdlL1.get(info.getPointKey()).getDoubleValue()) * info.getCoef()));
+            gwdlKey = gwdlMap.get(stationId);
+            infoDay.setGwdl((int) ((gwdlL2.get(gwdlKey.getPointKey()).getDoubleValue() -
+                    gwdlL1.get(gwdlKey.getPointKey()).getDoubleValue()) * gwdlKey.getCoef()));
+            cydlKey = cydlMap.get(stationId);
+            infoDay.setCydl((int) ((cydlL2.get(cydlKey.getPointKey()).getDoubleValue() -
+                    cydlL1.get(cydlKey.getPointKey()).getDoubleValue()) * cydlKey.getCoef()));
+            infoDays.add(infoDay);
+        }
+        stationInfoDayService.saveOrUpdateBatch(infoDays);
+    }
+
+    public void calcStationZhcydl(Date date) {
+        //date当天零点
+        DateTime time = DateUtil.beginOfDay(date);
+        //date昨天零点
+        DateTime time0 = DateUtil.offsetDay(time, -1);
+
+        QueryWrapper<LineInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.select("sum(rfdl) rfdl,station_id").eq("record_date", time0.toJdkDate())
+                .groupBy("station_id");
+        List<LineInfoDay> list = lineInfoDayService.list(wrapper);
+        List<StationInfoDay> byDate = getStationinfoByDate(time0.toJdkDate());
+
+        Map<String, StationInfoDay> collect = new HashMap<>();
+        if (byDate.size() > 0) {
+            collect = byDate.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
+        }
+
+        StationInfoDay infoDay;
+        List<StationInfoDay> infoDays = new ArrayList<>();
+        for (LineInfoDay day : list) {
+            if (byDate.isEmpty()) {
+                infoDay = new StationInfoDay();
+                infoDay.setStationId(day.getStationId());
+                infoDay.setRecordDate(time0.toJdkDate());
+            } else {
+                infoDay = collect.get(day.getStationId());
+            }
+            infoDay.setRfdl(day.getRfdl());
+            infoDay.setZhcydl(infoDay.getRfdl() + infoDay.getGwdl() - infoDay.getSwdl());
+            infoDays.add(infoDay);
+        }
+        stationInfoDayService.saveOrUpdateBatch(infoDays);
+    }
+
+    //此处加公式
+    public void calcTurbineSsztAi(Date date) {
+        PointInfo pi = new PointInfo();
+        pi.setUniformCode("AI422");
+        pi.setInstitutionType("state");
+        List<PointInfo> entity = pointService.getByEntity(pi);
+        Map<String, PointInfo> collect = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+        String keys = pointInfos2Keys(entity);
+
+        PointInfo pimx = new PointInfo();
+        pimx.setUniformCode("MXZT");
+        pimx.setInstitutionType("turbine");
+        List<PointInfo> entityMx = pointService.getByEntity(pimx);
+        Map<String, PointInfo> collectMX = entityMx.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+        PointInfo pisb = new PointInfo();
+        pisb.setUniformCode("SBZT");
+        pisb.setInstitutionType("turbine");
+        List<PointInfo> entitySB = pointService.getByEntity(pimx);
+        Map<String, PointInfo> collectSB = entitySB.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+
+        Map<String, PointData> latest = adapter.getLatest(taosGoldenUriTest(), keys);
+        List<StateAi> list = stateAiService.list();
+        Map<String, Map<Integer, Integer>> collectAi = list.stream().collect(Collectors.groupingBy(StateAi::getModel, Collectors.toMap(StateAi::getOriginalState, StateAi::getMappingState)));
+
+        List<PointData> pointDatas = new ArrayList<>();
+        int i1;
+        for (PointInfo info : entity) {
+            PointData data = latest.get(info.getPointKey());
+            data.setTagName(collectMX.get(info.getTurbineId()).getPointKey());
+            i1 = (int) data.getDoubleValue();
+            //缓存值
+            Integer i2 = ChangedSave.map.get(info.getPointKey());
+            if (i2 != null && i1 == i2) continue;
+            ChangedSave.map.put(info.getPointKey(), i1);
+            Integer i = collectAi.get(info.getSpare()).get(i1);
+            data.setDoubleValue(i);
+            pointDatas.add(data);
+        }
+        adapter.writeHistoryBatch(taosGoldenUriTest(), pointDatas);
+
+        //redisTemplate.opsForHash().put("state_point",key,value);
+
+    }
+    public void calcStationXd(){
+        DateTime time = DateUtil.date();
+        DateTime time5 = DateUtil.offsetMinute(DateUtil.date(), -5);
+        //限电状态
+        PointInfo pi = new PointInfo();
+        pi.setUniformCode("AGC009");
+        pi.setInstitutionType("booster");
+        List<PointInfo> entity = pointService.getByEntity(pi);
+        Map<String, PointInfo> collect = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+        String keys = pointInfos2Keys(entity);
+
+        //自算功率
+        PointInfo piZg = new PointInfo();
+        piZg.setUniformCode("AGC010");
+        piZg.setInstitutionType("booster");
+        List<PointInfo> entityZg = pointService.getByEntity(piZg);
+        Map<String, PointInfo> collectZg = entityZg.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+        String keysZg = pointInfos2Keys(entityZg);
+
+        Map<String, PointData> latest = adapter.getLatest(taosGoldenUriTest(), keys);
+        List<DoubleStatData> statZg = adapter.getHistoryStat(taosGoldenUriTest(), keysZg, time5.getTime(), time.getTime());
+
+        for (PointInfo info : entity) {
+            PointData xdzt = latest.get(info.getPointKey());
+            //如果场站限电状态为0
+            if(xdzt==null||xdzt.getDoubleValue()==0.0){
+
+            }
+        }
+    }
+}

+ 28 - 0
ruoyi-admin/src/test/java/com/ruoyi/JavaGlueJobHandler.java

@@ -0,0 +1,28 @@
+package com.ruoyi;
+
+import cn.hutool.core.date.DateUtil;
+import com.ruoyi.quartz.handler.IJobHandler;
+
+import java.util.Date;
+
+public class JavaGlueJobHandler extends IJobHandler {
+
+    private IJobHandler task;
+
+    @Override
+    public void execute() throws Exception {
+//此处加运行方法
+        Date date = DateUtil.date().toJdkDate();
+        //task.calcAQTS(date);
+    }
+
+    @Override
+    public IJobHandler getFunctionHandler() {
+        return task;
+    }
+
+    @Override
+    public void setFunctionHandler(IJobHandler jobHandler) {
+        this.task = jobHandler;
+    }
+}

+ 61 - 58
ruoyi-admin/src/test/java/com/ruoyi/UcpAppTests.java

@@ -2,31 +2,28 @@ package com.ruoyi;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
-import com.ruoyi.RuoYiApp;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ruoyi.ucp.entity.*;
 import com.ruoyi.ucp.feign.AdapterApi;
-import com.ruoyi.ucp.mapper.TurbineInfoMapper;
 import com.ruoyi.ucp.service.*;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.test.context.junit4.SpringRunner;
 
 import javax.annotation.Resource;
 import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
 import java.net.URI;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 @SpringBootTest//classes = RuoYiApp.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT
 @RunWith(SpringRunner.class)
 public class UcpAppTests {
 
-
     @Resource
     private AdapterApi adapter;
     @Resource
@@ -38,64 +35,70 @@ public class UcpAppTests {
     @Resource
     private IMethodService methodService;
     @Resource
-    private ScriptEngine engine;
-    @Resource
     private ILineInfoDayService lineInfoDayService;
+    @Resource
+    private IStateAiService stateAiService;
+    @Resource
+    private RedisTemplate redisTemplate;
 
     @Test
     public void test() {
-        TurbineInfo info = new TurbineInfo();
-        info.setName("pro_basic_equipment_point");
-        info.setUniformCode("");
-        //List<LinkedHashMap<String, Object>> byInfo = turbineInfoMapper.getByInfo(info);
-        System.out.println();
+        Date date = DateUtil.date().toJdkDate();
+        calcTurbineSsztAi(date);
     }
 
-    @Test
-    public void contextLoads() {
-        //Date day = DateUtil.beginOfHour(DateUtil.date()).toJdkDate();
-        //ScriptEngine engine = new ScriptEngineManager().getEngineByName("nashorn");
-        String pi = "var map = new Map();  \n" +
-                "map.set('key1', 'value1');  \n" +
-                "map.set('key2', 'value2');  \n" +
-                "var value1 = map.get('key1');" ;
-        try {
-            //List<PointData> historySnap = adapter.getHistorySnap(URI.create("http://127.0.0.1:8011/ts"),"NEM_SXJSFW.SX_XXXX_XXX_X_XX_XX_XXXX_FCC_CI134", 1706166626000L,
-            //        1706168006283L, 30);
-            /*engine.put("adapter", adapter);
-            engine.put("pointService", pointService);
-            engine.put("stationInfoDayService", stationInfoDayService);
-            engine.put("stationInfoHourService", stationInfoHourService);
-            List<Method> methods = methodService.list();
-            try {
-                for (Method method : methods) {
-                    engine.eval(method.getMethodExpression());
-                }
-            } catch (ScriptException e) {
-                e.printStackTrace();
-            }*/
-
-            engine.eval(pi);
-            //engine.eval(k);
-            Object eval = engine.eval("map");
-            Object eval2 = engine.eval("latest1");
-            Object eval3 = engine.eval("entity");
-            Object lineInfoDays = engine.eval("lineInfoDays");
-            System.out.println();
+    public void calcTurbineSsztAi(Date date) {
+
+        Map<Object, Object> stateai = redisTemplate.opsForHash().entries("stateai");
+        stateai.put("eee", 3);
+        Object oo = stateai.get("eee");
+        Integer o = (Integer) stateai.get("rrr");
+        if(1==o){
 
-            PointInfo info = new PointInfo();
-            //info.setTableName("pro_basic_equipment_point");
-            //info.setStationId("GJNY_SXGS_XZ_FDC_STA");
-            info.setUniformCode("RFDL");
-            info.setStationId("all");
-            List<PointInfo> entity = pointService.getByEntity(info);
-            String collect = entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
-            Map<String,PointData> latest = adapter.getHistorySection(URI.create("http://172.16.12.101:8012/ts"), collect,System.currentTimeMillis());
-            //adapter.writeHistoryBatch(URI.create("http://172.16.12.101:8012/ts"), latest);
-            //List<LinkedHashMap<String, Object>> byInfo = mapper.getByInfo(info);
             System.out.println();
-        } catch (Exception e) {
-            throw new RuntimeException(e);
         }
+
+        PointInfo pi = new PointInfo();
+        pi.setUniformCode("AI422");
+        pi.setInstitutionType("state");
+        List<PointInfo> entity = pointService.getByEntity(pi);
+        Map<String, PointInfo> collect = entity.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+        String keys = pointInfos2Keys(entity);
+
+        PointInfo pimx = new PointInfo();
+        pimx.setUniformCode("MXZT");
+        pimx.setInstitutionType("turbine");
+        List<PointInfo> entityMx = pointService.getByEntity(pimx);
+        Map<String, PointInfo> collectMX = entityMx.stream().collect(Collectors.toMap(PointInfo::getTurbineId, Function.identity()));
+
+        Map<String, PointData> latest = adapter.getLatest(taosGoldenUriTest(), keys);
+        List<StateAi> list = stateAiService.list();
+        Map<String,Map<Integer,Integer>> collectAi = list.stream().collect(Collectors.groupingBy(StateAi::getModel,Collectors.toMap(StateAi::getOriginalState,StateAi::getMappingState)));
+
+        List<PointData> pointDatas = new ArrayList<>();
+        for (PointInfo info : entity) {
+            PointData data = latest.get(info.getPointKey());
+            data.setTagName(collectMX.get(info.getTurbineId()).getPointKey());
+            Integer i = collectAi.get(info.getSpare()).get((int)data.getDoubleValue());
+            data.setDoubleValue(i);
+            pointDatas.add(data);
+        }
+        adapter.writeHistoryBatch(taosGoldenUriTest(), pointDatas);
+
+        //redisTemplate.opsForHash().put("state_point",key,value);
+
+    }
+
+    public String pointInfos2Keys(List<PointInfo> entity){
+        return entity.stream().map(PointInfo::getPointKey).collect(Collectors.joining(","));
+    }
+    public URI taosGoldenUriTest(){
+        return URI.create("http://127.0.0.1:8011/ts");
+    }
+
+    public List<StationInfoDay> getStationinfoByDate(Date date) {
+        QueryWrapper<StationInfoDay> wrapper = new QueryWrapper<>();
+        wrapper.eq("record_date", date);
+        return stationInfoDayService.list(wrapper);
     }
 }

+ 3 - 1
ruoyi-common/src/main/java/com/ruoyi/common/enums/DataSourceType.java

@@ -15,5 +15,7 @@ public enum DataSourceType
     /**
      * 从库
      */
-    SLAVE
+    SLAVE,
+
+    TAOS
 }

+ 4 - 4
ruoyi-generator/src/main/resources/mapper/generator/GenTableMapper.xml

@@ -67,10 +67,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				AND to_char(create_time, 'YYYYMMDD') &gt;= to_char(#{params.beginTime}, 'YYYYMMDD')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				AND to_char(create_time, 'YYYYMMDD') &lt;= date_format(#{params.endTime},'%y%m%d')
 			</if>
 		</where>
 	</select>
@@ -87,10 +87,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND lower(table_comment) like lower(concat('%', #{tableComment}, '%'))
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			AND date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			AND to_char(create_time, 'YYYYMMDD') &gt;= to_char(#{params.beginTime}, 'YYYYMMDD')
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			AND date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			AND to_char(create_time, 'YYYYMMDD') &lt;= date_format(#{params.endTime},'%y%m%d')
 		</if>
         order by create_time desc
 	</select>

+ 6 - 0
ruoyi-quartz/pom.xml

@@ -34,6 +34,12 @@
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-common</artifactId>
         </dependency>
+        <!-- groovy-all -->
+        <dependency>
+            <groupId>org.apache.groovy</groupId>
+            <artifactId>groovy</artifactId>
+            <version>4.0.18</version>
+        </dependency>
 
     </dependencies>
 

+ 8 - 8
ruoyi-quartz/src/main/java/com/ruoyi/quartz/controller/SysJobController.java

@@ -102,10 +102,10 @@ public class SysJobController extends BaseController
         {
             return error("新增任务'" + job.getJobName() + "'失败,目标字符串存在违规");
         }
-        else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
-        {
-            return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
-        }
+        //else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
+        //{
+        //    return error("新增任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
+        //}
         job.setCreateBy(getUsername());
         return toAjax(jobService.insertJob(job));
     }
@@ -138,10 +138,10 @@ public class SysJobController extends BaseController
         {
             return error("修改任务'" + job.getJobName() + "'失败,目标字符串存在违规");
         }
-        else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
-        {
-            return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
-        }
+        //else if (!ScheduleUtils.whiteList(job.getInvokeTarget()))
+        //{
+        //    return error("修改任务'" + job.getJobName() + "'失败,目标字符串不在白名单内");
+        //}
         job.setUpdateBy(getUsername());
         return toAjax(jobService.updateJob(job));
     }

+ 1 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java

@@ -87,7 +87,7 @@ public class SysJob extends BaseEntity
     }
 
     @NotBlank(message = "调用目标字符串不能为空")
-    @Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符")
+    //@Size(min = 0, max = 500, message = "调用目标字符串长度不能超过500个字符")
     public String getInvokeTarget()
     {
         return invokeTarget;

+ 146 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/glue/GlueFactory.java

@@ -0,0 +1,146 @@
+package com.ruoyi.quartz.glue;
+
+import com.ruoyi.quartz.glue.impl.SpringGlueFactory;
+import com.ruoyi.quartz.handler.IJobHandler;
+import groovy.lang.GroovyClassLoader;
+
+import javax.annotation.Resource;
+import java.math.BigInteger;
+import java.security.MessageDigest;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
+/**
+ * glue factory, product class/object by name
+ *
+ * @author xuxueli 2016-1-2 20:02:27
+ */
+public class GlueFactory {
+
+	private static GlueFactory glueFactory = new SpringGlueFactory();
+
+	public static GlueFactory getInstance(){
+		return glueFactory;
+	}
+
+	public static String getFunctionTemplate(){
+		String FunctionTemplate = "package com.ruoyi;\n" +
+				"\n" +
+				"import cn.hutool.core.date.DateTime;\n" +
+				"import cn.hutool.core.date.DateUtil;\n" +
+				"import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;\n" +
+				"import com.ruoyi.quartz.handler.IJobHandler;\n" +
+				"import com.ruoyi.ucp.entity.*;\n" +
+				"import com.ruoyi.ucp.feign.AdapterApi;\n" +
+				"import com.ruoyi.ucp.service.*;\n" +
+				"import org.springframework.data.redis.core.RedisTemplate;\n" +
+				"\n" +
+				"import javax.annotation.Resource;\n" +
+				"import java.net.URI;\n" +
+				"import java.util.*;\n" +
+				"import java.util.function.Function;\n" +
+				"import java.util.stream.Collectors;\n" +
+				"\n" +
+				"public class JavaFunctionJobHandler extends IJobHandler {\n" +
+				"\n" +
+				"    @Resource\n" +
+				"    private AdapterApi adapter;\n" +
+				"    @Resource\n" +
+				"    private IPointInfoService pointService;\n" +
+				"    @Resource\n" +
+				"    private IStationInfoHourService stationInfoHourService;\n" +
+				"    @Resource\n" +
+				"    private IStationInfoDayService stationInfoDayService;\n" +
+				"    @Resource\n" +
+				"    private ILineInfoDayService lineInfoDayService;\n" +
+				"    @Resource\n" +
+				"    private IStateAiService stateAiService;\n" +
+				"    @Resource\n" +
+				"    private RedisTemplate redisTemplate;" +
+				"\n" +
+				"    @Override\n" +
+				"    public void execute() throws Exception {\n" +
+				"\n" +
+				"    }\n" +
+				"\n" +
+				"    @Override\n" +
+				"    public IJobHandler getFunctionHandler() {\n" +
+				"        return null;\n" +
+				"    }\n" +
+				"\n" +
+				"    @Override\n" +
+				"    public void setFunctionHandler(IJobHandler jobHandler) {\n" +
+				"\n" +
+				"    }\n" +
+				"//此处加公式\n" +
+				"}";
+		return FunctionTemplate;
+	}
+
+	public static void refreshInstance(int type){
+		if (type == 0) {
+			glueFactory = new GlueFactory();
+		} else if (type == 1) {
+			glueFactory = new SpringGlueFactory();
+		}
+	}
+
+
+	/**
+	 * groovy class loader
+	 */
+	private GroovyClassLoader groovyClassLoader = new GroovyClassLoader();
+	private ConcurrentMap<String, Class<?>> CLASS_CACHE = new ConcurrentHashMap<>();
+
+	/**
+	 * load new instance, prototype
+	 *
+	 * @param codeSource
+	 * @return
+	 * @throws Exception
+	 */
+	public IJobHandler loadNewInstance(String codeSource) throws Exception{
+		if (codeSource!=null && codeSource.trim().length()>0) {
+			Class<?> clazz = getCodeSourceClass(codeSource);
+			if (clazz != null) {
+				Object instance = clazz.newInstance();
+				if (instance!=null) {
+					if (instance instanceof IJobHandler) {
+						this.injectService(instance);
+						return (IJobHandler) instance;
+					} else {
+						throw new IllegalArgumentException(">>>>>>>>>>> xxl-glue, loadNewInstance error, "
+								+ "cannot convert from instance["+ instance.getClass() +"] to IJobHandler");
+					}
+				}
+			}
+		}
+		throw new IllegalArgumentException(">>>>>>>>>>> xxl-glue, loadNewInstance error, instance is null");
+	}
+	private Class<?> getCodeSourceClass(String codeSource){
+		try {
+			// md5
+			byte[] md5 = MessageDigest.getInstance("MD5").digest(codeSource.getBytes());
+			String md5Str = new BigInteger(1, md5).toString(16);
+
+			Class<?> clazz = CLASS_CACHE.get(md5Str);
+			if(clazz == null){
+				clazz = groovyClassLoader.parseClass(codeSource);
+				CLASS_CACHE.putIfAbsent(md5Str, clazz);
+			}
+			return clazz;
+		} catch (Exception e) {
+			return groovyClassLoader.parseClass(codeSource);
+		}
+	}
+
+	/**
+	 * inject service of bean field
+	 *
+	 * @param instance
+	 */
+	public void injectService(Object instance) {
+		// do something
+	}
+
+}

+ 53 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/glue/GlueTypeEnum.java

@@ -0,0 +1,53 @@
+package com.ruoyi.quartz.glue;
+
+/**
+ * Created by xuxueli on 17/4/26.
+ */
+public enum GlueTypeEnum {
+
+    BEAN("BEAN", false, null, null),
+    GLUE_GROOVY("GLUE(Java)", false, null, null),
+    GLUE_SHELL("GLUE(Shell)", true, "bash", ".sh"),
+    GLUE_PYTHON("GLUE(Python)", true, "python", ".py"),
+    GLUE_PHP("GLUE(PHP)", true, "php", ".php"),
+    GLUE_NODEJS("GLUE(Nodejs)", true, "node", ".js"),
+    GLUE_POWERSHELL("GLUE(PowerShell)", true, "powershell", ".ps1");
+
+    private String desc;
+    private boolean isScript;
+    private String cmd;
+    private String suffix;
+
+    private GlueTypeEnum(String desc, boolean isScript, String cmd, String suffix) {
+        this.desc = desc;
+        this.isScript = isScript;
+        this.cmd = cmd;
+        this.suffix = suffix;
+    }
+
+    public String getDesc() {
+        return desc;
+    }
+
+    public boolean isScript() {
+        return isScript;
+    }
+
+    public String getCmd() {
+        return cmd;
+    }
+
+    public String getSuffix() {
+        return suffix;
+    }
+
+    public static GlueTypeEnum match(String name){
+        for (GlueTypeEnum item: GlueTypeEnum.values()) {
+            if (item.name().equals(name)) {
+                return item;
+            }
+        }
+        return null;
+    }
+
+}

+ 92 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/glue/impl/SpringGlueFactory.java

@@ -0,0 +1,92 @@
+package com.ruoyi.quartz.glue.impl;
+
+import com.ruoyi.quartz.glue.GlueFactory;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+/**
+ * @author xuxueli 2018-11-01
+ */
+@Component
+public class SpringGlueFactory extends GlueFactory implements ApplicationContextAware {
+    private static Logger logger = LoggerFactory.getLogger(SpringGlueFactory.class);
+
+    /**
+     * inject action of spring
+     * @param instance
+     */
+    @Override
+    public void injectService(Object instance){
+        if (instance==null) {
+            return;
+        }
+
+        //if (XxlJobSpringExecutor.getApplicationContext() == null) {
+        //    return;
+        //}
+
+        Field[] fields = instance.getClass().getDeclaredFields();
+        for (Field field : fields) {
+            if (Modifier.isStatic(field.getModifiers())) {
+                continue;
+            }
+
+            Object fieldBean = null;
+            // with bean-id, bean could be found by both @Resource and @Autowired, or bean could only be found by @Autowired
+
+            if (AnnotationUtils.getAnnotation(field, Resource.class) != null) {
+                try {
+                    Resource resource = AnnotationUtils.getAnnotation(field, Resource.class);
+                    if (resource.name()!=null && resource.name().length()>0){
+                        fieldBean = SpringGlueFactory.getApplicationContext().getBean(resource.name());
+                    } else {
+                        fieldBean = SpringGlueFactory.getApplicationContext().getBean(field.getName());
+                    }
+                } catch (Exception e) {
+                    //e.printStackTrace();
+                }
+                if (fieldBean==null ) {
+                    fieldBean = SpringGlueFactory.getApplicationContext().getBean(field.getType());
+                }
+            } else if (AnnotationUtils.getAnnotation(field, Autowired.class) != null) {
+                Qualifier qualifier = AnnotationUtils.getAnnotation(field, Qualifier.class);
+                if (qualifier!=null && qualifier.value()!=null && qualifier.value().length()>0) {
+                    fieldBean = SpringGlueFactory.getApplicationContext().getBean(qualifier.value());
+                } else {
+                    fieldBean = SpringGlueFactory.getApplicationContext().getBean(field.getType());
+                }
+            }
+
+            if (fieldBean!=null) {
+                field.setAccessible(true);
+                try {
+                    field.set(instance, fieldBean);
+                } catch (IllegalArgumentException e) {
+                    logger.error(e.getMessage(), e);
+                } catch (IllegalAccessException e) {
+                    logger.error(e.getMessage(), e);
+                }
+            }
+        }
+    }
+    private static ApplicationContext applicationContext;
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        SpringGlueFactory.applicationContext = applicationContext;
+    }
+
+    public static ApplicationContext getApplicationContext() {
+        return applicationContext;
+    }
+}

+ 42 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/IJobHandler.java

@@ -0,0 +1,42 @@
+package com.ruoyi.quartz.handler;
+
+/**
+ * job handler
+ *
+ * @author xuxueli 2015-12-19 19:06:38
+ */
+public abstract class IJobHandler {
+
+
+	/**
+	 * execute handler, invoked when executor receives a scheduling request
+	 *
+	 * @throws Exception
+	 */
+	public abstract void execute() throws Exception;
+
+
+	/*@Deprecated
+	public abstract ReturnT<String> execute(String param) throws Exception;*/
+
+	/**
+	 * init handler, invoked when JobThread init
+	 */
+	public void init() throws Exception {
+		// do something
+	}
+
+
+	/**
+	 * destroy handler, invoked when JobThread destroy
+	 */
+	public void destroy() throws Exception {
+		// do something
+	}
+
+	public abstract IJobHandler getFunctionHandler();
+
+	public abstract void setFunctionHandler(IJobHandler jobHandler);
+
+
+}

+ 49 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/impl/GlueJobHandler.java

@@ -0,0 +1,49 @@
+package com.ruoyi.quartz.handler.impl;
+
+
+import com.ruoyi.quartz.handler.IJobHandler;
+
+/**
+ * glue job handler
+ *
+ * @author xuxueli 2016-5-19 21:05:45
+ */
+public class GlueJobHandler extends IJobHandler {
+
+	private long glueUpdatetime;
+	private IJobHandler jobHandler;
+	private IJobHandler functionHandler;
+	public GlueJobHandler(IJobHandler jobHandler, long glueUpdatetime) {
+		this.jobHandler = jobHandler;
+		this.glueUpdatetime = glueUpdatetime;
+	}
+	public long getGlueUpdatetime() {
+		return glueUpdatetime;
+	}
+
+	@Override
+	public void execute() throws Exception {
+		//XxlJobHelper.log("----------- glue.version:"+ glueUpdatetime +" -----------");
+		jobHandler.execute();
+	}
+
+	@Override
+	public void init() throws Exception {
+		this.jobHandler.init();
+	}
+
+	@Override
+	public void destroy() throws Exception {
+		this.jobHandler.destroy();
+	}
+
+	@Override
+	public IJobHandler getFunctionHandler() {
+		return null;
+	}
+
+	@Override
+	public void setFunctionHandler(IJobHandler jobHandler) {
+
+	}
+}

+ 63 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/impl/MethodJobHandler.java

@@ -0,0 +1,63 @@
+package com.ruoyi.quartz.handler.impl;
+
+import com.ruoyi.quartz.handler.IJobHandler;
+
+import java.lang.reflect.Method;
+
+/**
+ * @author xuxueli 2019-12-11 21:12:18
+ */
+public class MethodJobHandler extends IJobHandler {
+
+    private final Object target;
+    private final Method method;
+    private Method initMethod;
+    private Method destroyMethod;
+
+    public MethodJobHandler(Object target, Method method, Method initMethod, Method destroyMethod) {
+        this.target = target;
+        this.method = method;
+
+        this.initMethod = initMethod;
+        this.destroyMethod = destroyMethod;
+    }
+
+    @Override
+    public void execute() throws Exception {
+        Class<?>[] paramTypes = method.getParameterTypes();
+        if (paramTypes.length > 0) {
+            method.invoke(target, new Object[paramTypes.length]);       // method-param can not be primitive-types
+        } else {
+            method.invoke(target);
+        }
+    }
+
+    @Override
+    public void init() throws Exception {
+        if(initMethod != null) {
+            initMethod.invoke(target);
+        }
+    }
+
+    @Override
+    public void destroy() throws Exception {
+        if(destroyMethod != null) {
+            destroyMethod.invoke(target);
+        }
+    }
+
+    @Override
+    public IJobHandler getFunctionHandler() {
+        return null;
+    }
+
+    @Override
+    public void setFunctionHandler(IJobHandler jobHandler) {
+
+    }
+
+    @Override
+    public String toString() {
+        return super.toString()+"["+ target.getClass() + "#" + method.getName() +"]";
+    }
+}

+ 15 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/handler/impl/MyJobHandler.java

@@ -0,0 +1,15 @@
+package com.ruoyi.quartz.handler.impl;
+
+import com.ruoyi.quartz.handler.IJobHandler;
+import org.springframework.stereotype.Component;
+
+/**
+ * glue job handler
+ *
+ * @author xuxueli 2016-5-19 21:05:45
+ */
+@Component
+public class MyJobHandler {
+
+	public static IJobHandler jobHandler;
+}

+ 8 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/ChangedSave.java

@@ -0,0 +1,8 @@
+package com.ruoyi.quartz.task;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class ChangedSave {
+    public static Map<String, Integer> map = new ConcurrentHashMap<>();
+}

+ 37 - 0
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/JobInvokeUtil.java

@@ -7,6 +7,9 @@ import java.util.List;
 import com.ruoyi.common.utils.StringUtils;
 import com.ruoyi.common.utils.spring.SpringUtils;
 import com.ruoyi.quartz.domain.SysJob;
+import com.ruoyi.quartz.glue.GlueFactory;
+import com.ruoyi.quartz.handler.IJobHandler;
+import com.ruoyi.quartz.handler.impl.MyJobHandler;
 
 /**
  * 任务执行工具
@@ -39,6 +42,40 @@ public class JobInvokeUtil
         }
     }
 
+    public static void invokeMethod2(SysJob sysJob) throws Exception
+    {
+        String javaCode = getJavaGlue().replace("//此处加运行方法", sysJob.getInvokeTarget());
+        IJobHandler jobHandler = GlueFactory.getInstance().loadNewInstance(javaCode);
+        jobHandler.setFunctionHandler(MyJobHandler.jobHandler);
+        jobHandler.execute();
+    }
+
+    private static String getJavaGlue(){
+        String JavaGlue = "package com.ruoyi.quartz;\n" +
+                "import com.ruoyi.quartz.handler.IJobHandler;\n" +
+                "import cn.hutool.core.date.DateUtil;\n" +
+                "public class JavaGlueJobHandler extends IJobHandler {\n" +
+                "\n" +
+                "    private IJobHandler task;\n" +
+                "\n" +
+                "    @Override\n" +
+                "    public void execute() throws Exception {\n" +
+                "//此处加运行方法\n" +
+                "    }\n" +
+                "\n" +
+                "    @Override\n" +
+                "    public IJobHandler getFunctionHandler() {\n" +
+                "        return task;\n" +
+                "    }\n" +
+                "\n" +
+                "    @Override\n" +
+                "    public void setFunctionHandler(IJobHandler jobHandler) {\n" +
+                "        this.task = jobHandler;\n" +
+                "    }\n" +
+                "}";
+        return JavaGlue;
+    }
+
     /**
      * 调用任务方法
      *

+ 1 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzDisallowConcurrentExecution.java

@@ -16,6 +16,6 @@ public class QuartzDisallowConcurrentExecution extends AbstractQuartzJob
     @Override
     protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception
     {
-        JobInvokeUtil.invokeMethod(sysJob);
+        JobInvokeUtil.invokeMethod2(sysJob);
     }
 }

+ 1 - 1
ruoyi-quartz/src/main/java/com/ruoyi/quartz/util/QuartzJobExecution.java

@@ -14,6 +14,6 @@ public class QuartzJobExecution extends AbstractQuartzJob
     @Override
     protected void doExecute(JobExecutionContext context, SysJob sysJob) throws Exception
     {
-        JobInvokeUtil.invokeMethod(sysJob);
+        JobInvokeUtil.invokeMethod2(sysJob);
     }
 }

+ 2 - 2
ruoyi-quartz/src/main/resources/mapper/quartz/SysJobLogMapper.xml

@@ -36,10 +36,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND invoke_target like concat('%', #{invokeTarget}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				and create_time &gt;= TO_TIMESTAMP(#{params.beginTime},'YYYY-MM-DD HH24:MI:SS')
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				and create_time &lt;= TO_TIMESTAMP(#{params.endTime},'YYYY-MM-DD HH24:MI:SS')
 			</if>
 		</where>
 	</select>

+ 2 - 2
ruoyi-system/src/main/resources/mapper/system/SysConfigMapper.xml

@@ -51,10 +51,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND config_key like concat('%', #{configKey}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				and create_time &gt;= #{params.beginTime,jdbcType=DATE}
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				and create_time &lt;= #{params.endTime,jdbcType=DATE}
 			</if>
 		</where>
     </select>

+ 2 - 2
ruoyi-system/src/main/resources/mapper/system/SysDictTypeMapper.xml

@@ -33,10 +33,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND dict_type like concat('%', #{dictType}, '%')
 			</if>
 			<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-				and date_format(create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+				and create_time &gt;= #{params.beginTime,jdbcType=DATE}
 			</if>
 			<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-				and date_format(create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+				and create_time &lt;= #{params.endTime,jdbcType=DATE}
 			</if>
 	    </where>
 	</select>

+ 2 - 2
ruoyi-system/src/main/resources/mapper/system/SysRoleMapper.xml

@@ -46,10 +46,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND r.role_key like concat('%', #{roleKey}, '%')
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			and date_format(r.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			and r.create_time &gt;= #{params.beginTime,jdbcType=DATE}
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			and date_format(r.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			and r.create_time &lt;= #{params.endTime,jdbcType=DATE}
 		</if>
 		<!-- 数据范围过滤 -->
 		${params.dataScope}

+ 2 - 2
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -77,10 +77,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 			AND u.phonenumber like concat('%', #{phonenumber}, '%')
 		</if>
 		<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
+			AND u.create_time &gt;= #{params.beginTime,jdbcType=DATE}
 		</if>
 		<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
-			AND date_format(u.create_time,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
+			AND u.create_time &lt;= #{params.endTime,jdbcType=DATE}
 		</if>
 		<if test="deptId != null and deptId != 0">
 			AND (u.dept_id = #{deptId} OR u.dept_id IN ( SELECT t.dept_id FROM sys_dept t WHERE find_in_set(#{deptId}, ancestors) ))

+ 15 - 0
universal-computing-platform/pom.xml

@@ -86,6 +86,21 @@
             <artifactId>groovy</artifactId>
             <version>4.0.18</version>
         </dependency>
+        <dependency>
+            <groupId>com.taosdata.jdbc</groupId>
+            <artifactId>taos-jdbcdriver</artifactId>
+            <version>2.0.39</version>
+        </dependency>
+        <!--Redis依赖-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <!--连接池依赖-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
 
         <!--<dependency>
             <groupId>com.baomidou</groupId>

+ 15 - 22
universal-computing-platform/src/main/java/com/ruoyi/ucp/glue/GlueFactory.java

@@ -22,9 +22,13 @@ public class GlueFactory {
 		return glueFactory;
 	}
 
-	public static String getJavaGlue(){
-		String JavaGlue = "package com.ruoyi.ucp;\n" +
+	public static String getFunctionTemplate(){
+		String FunctionTemplate = "package com.ruoyi.ucp;\n" +
 				"\n" +
+				"import cn.hutool.core.date.DateUtil;\n" +
+				"import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;\n" +
+				"import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;\n" +
+				"import com.ruoyi.ucp.entity.StationInfoDay;\n" +
 				"import com.ruoyi.ucp.feign.AdapterApi;\n" +
 				"import com.ruoyi.ucp.handler.IJobHandler;\n" +
 				"import com.ruoyi.ucp.service.ILineInfoDayService;\n" +
@@ -33,8 +37,13 @@ public class GlueFactory {
 				"import com.ruoyi.ucp.service.IStationInfoHourService;\n" +
 				"\n" +
 				"import javax.annotation.Resource;\n" +
+				"import java.util.Date;\n" +
+				"import java.util.List;\n" +
+				"import java.util.Map;\n" +
+				"import java.util.function.Function;\n" +
+				"import java.util.stream.Collectors;\n" +
 				"\n" +
-				"public class JavaGlueJobHandler extends IJobHandler{\n" +
+				"public class JavaFunctionJobHandler  extends IJobHandler {\n" +
 				"\n" +
 				"    @Resource\n" +
 				"    private AdapterApi adapter;\n" +
@@ -47,38 +56,22 @@ public class GlueFactory {
 				"    @Resource\n" +
 				"    private ILineInfoDayService lineInfoDayService;\n" +
 				"\n" +
-				"    private IJobHandler jobHandler;\n" +
-				"\n" +
 				"    @Override\n" +
 				"    public void execute() throws Exception {\n" +
-				"        //此处运行方法\n" +
+				"\n" +
 				"    }\n" +
 				"\n" +
 				"    @Override\n" +
 				"    public IJobHandler getFunctionHandler() {\n" +
-				"        return jobHandler;\n" +
+				"        return null;\n" +
 				"    }\n" +
 				"\n" +
 				"    @Override\n" +
 				"    public void setFunctionHandler(IJobHandler jobHandler) {\n" +
-				"        this.jobHandler = jobHandler;\n" +
-				"    }\n" +
-				"}\n";
-		return JavaGlue;
-	}
-
-	public static String getFunctionTemplate(){
-		String FunctionTemplate = "package com.ruoyi.ucp;\n" +
-				"\n" +
-				"import com.ruoyi.ucp.handler.IJobHandler;\n" +
-				"\n" +
-				"public class JavaFunctionJobHandler  extends IJobHandler {\n" +
-				"    @Override\n" +
-				"    public void execute() throws Exception {\n" +
 				"\n" +
 				"    }\n" +
 				"    //此处加公式\n" +
-				"}\n";
+				"}";
 		return FunctionTemplate;
 	}
 

universal-computing-platform/src/main/java/com/ruoyi/ucp/glue/GlueTypeEnum.java → universal-computing-platform/src/main/glue/GlueTypeEnum.java


+ 3 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/glue/impl/SpringGlueFactory.java

@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationContextAware;
 import org.springframework.core.annotation.AnnotationUtils;
+import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
 import java.lang.reflect.Field;
@@ -17,10 +18,10 @@ import java.lang.reflect.Modifier;
 /**
  * @author xuxueli 2018-11-01
  */
+@Component
 public class SpringGlueFactory extends GlueFactory implements ApplicationContextAware {
     private static Logger logger = LoggerFactory.getLogger(SpringGlueFactory.class);
 
-
     /**
      * inject action of spring
      * @param instance
@@ -53,6 +54,7 @@ public class SpringGlueFactory extends GlueFactory implements ApplicationContext
                         fieldBean = SpringGlueFactory.getApplicationContext().getBean(field.getName());
                     }
                 } catch (Exception e) {
+                    //e.printStackTrace();
                 }
                 if (fieldBean==null ) {
                     fieldBean = SpringGlueFactory.getApplicationContext().getBean(field.getType());

universal-computing-platform/src/main/java/com/ruoyi/ucp/handler/IJobHandler.java → universal-computing-platform/src/main/handler/IJobHandler.java


universal-computing-platform/src/main/java/com/ruoyi/ucp/handler/impl/GlueJobHandler.java → universal-computing-platform/src/main/handler/impl/GlueJobHandler.java


universal-computing-platform/src/main/java/com/ruoyi/ucp/handler/impl/MethodJobHandler.java → universal-computing-platform/src/main/handler/impl/MethodJobHandler.java


+ 31 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/config/RedisConfig.java

@@ -0,0 +1,31 @@
+/*
+package com.ruoyi.ucp.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.RedisSerializer;
+
+@Configuration
+public class RedisConfig {
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
+        // 创建Template
+        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+        // 设置连接工厂
+        redisTemplate.setConnectionFactory(redisConnectionFactory);
+        // 设置序列化工具
+        GenericJackson2JsonRedisSerializer jsonRedisSerializer =
+                new GenericJackson2JsonRedisSerializer();
+        // key和 hashKey采用 string序列化
+        redisTemplate.setKeySerializer(RedisSerializer.string());
+        redisTemplate.setHashKeySerializer(RedisSerializer.string());
+        // value和 hashValue采用 JSON序列化
+        redisTemplate.setValueSerializer(jsonRedisSerializer);
+        redisTemplate.setHashValueSerializer(jsonRedisSerializer);
+        return redisTemplate;
+    }
+}
+*/

+ 0 - 16
universal-computing-platform/src/main/java/com/ruoyi/ucp/controller/SysFunController.java

@@ -1,16 +0,0 @@
-package com.ruoyi.ucp.controller;
-
-import com.ruoyi.common.core.controller.BaseController;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * 调度任务信息操作处理
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/monitor/job")
-public class SysFunController extends BaseController {
-
-}

+ 6 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/DoubleStatData.java

@@ -1,5 +1,8 @@
 package com.ruoyi.ucp.entity;
 
+/**
+ * @author songwb<songwb@aliyun.com>
+ */
 public class DoubleStatData {
 
     private PointData avg;
@@ -12,6 +15,9 @@ public class DoubleStatData {
         this.min = min;
     }
 
+    public DoubleStatData() {
+    }
+
     public PointData getAvg() {
         return avg;
     }

+ 1 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/Formula.java

@@ -23,4 +23,5 @@ public class Formula implements Serializable {
     private String formulaDescribe;
     private String formulaExpression;
     private String formulaName;
+    private String paramDescribe;
 }

+ 3 - 61
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/LineInfoDay.java

@@ -3,6 +3,7 @@ package com.ruoyi.ucp.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -15,6 +16,7 @@ import java.util.Date;
  * @author gfhd
  * @since 2024-03-21
  */
+@Data
 @TableName("line_info_day")
 public class LineInfoDay implements Serializable {
 
@@ -31,65 +33,5 @@ public class LineInfoDay implements Serializable {
 
     private Date recordDate;
 
-    private Double rfdl;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getStationId() {
-        return stationId;
-    }
-
-    public void setStationId(String stationId) {
-        this.stationId = stationId;
-    }
-
-    public String getProjectId() {
-        return projectId;
-    }
-
-    public void setProjectId(String projectId) {
-        this.projectId = projectId;
-    }
-
-    public String getLineId() {
-        return lineId;
-    }
-
-    public void setLineId(String lineId) {
-        this.lineId = lineId;
-    }
-
-    public Date getRecordDate() {
-        return recordDate;
-    }
-
-    public void setRecordDate(Date recordDate) {
-        this.recordDate = recordDate;
-    }
-
-    public Double getRfdl() {
-        return rfdl;
-    }
-
-    public void setRfdl(Double rfdl) {
-        this.rfdl = rfdl;
-    }
-
-    @Override
-    public String toString() {
-        return "LineInfoDay{" +
-            "id = " + id +
-            ", stationId = " + stationId +
-            ", projectId = " + projectId +
-            ", lineId = " + lineId +
-            ", recordDate = " + recordDate +
-            ", rfdl = " + rfdl +
-        "}";
-    }
+    private Integer rfdl;
 }

+ 10 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/Method.java

@@ -22,8 +22,18 @@ public class Method implements Serializable {
     private String methodDescribe;
     private String methodExpression;
     private String methodName;
+
+    private String paramDescribe;
     private String returnDescribe;
 
+    public String getParamDescribe() {
+        return paramDescribe;
+    }
+
+    public void setParamDescribe(String paramDescribe) {
+        this.paramDescribe = paramDescribe;
+    }
+
     public Integer getId() {
         return id;
     }

+ 9 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/PointData.java

@@ -24,7 +24,7 @@ public class PointData {
     private long longValue;
 
 //    private long value;
-
+private double actualValue;
     public double getValue() {
         if (booleanValue) {
             return 1;
@@ -33,4 +33,12 @@ public class PointData {
         }
         return doubleValue;
     }
+
+    public void setActualValue(double actualValue) {
+        this.doubleValue = actualValue;
+    }
+
+    public double getActualValue() {
+        return doubleValue;
+    }
 }

+ 6 - 105
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/PointInfo.java

@@ -3,6 +3,7 @@ package com.ruoyi.ucp.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.util.Date;
@@ -15,6 +16,7 @@ import java.util.Date;
  * @author gfhd
  * @since 2024-03-01
  */
+@Data
 @TableName("point_info")
 public class PointInfo implements Serializable {
 
@@ -22,117 +24,16 @@ public class PointInfo implements Serializable {
 
     @TableId(value = "id", type = IdType.AUTO)
     private Long id;
-
     private Double coef;
-
     private String lineId;
-
     private String name;
-
     private String pointKey;
-
     private String projectId;
-
     private String stationId;
-
     private String turbineId;
-
     private String uniformCode;
-
-    private Date recordDate;
-
-    public Date getRecordDate() {
-        return recordDate;
-    }
-
-    public void setRecordDate(Date recordDate) {
-        this.recordDate = recordDate;
-    }
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public Double getCoef() {
-        return coef;
-    }
-
-    public void setCoef(Double coef) {
-        this.coef = coef;
-    }
-
-    public String getLineId() {
-        return lineId;
-    }
-
-    public void setLineId(String lineId) {
-        this.lineId = lineId;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getPointKey() {
-        return pointKey;
-    }
-
-    public void setPointKey(String pointKey) {
-        this.pointKey = pointKey;
-    }
-
-    public String getProjectId() {
-        return projectId;
-    }
-
-    public void setProjectId(String projectId) {
-        this.projectId = projectId;
-    }
-
-    public String getStationId() {
-        return stationId;
-    }
-
-    public void setStationId(String stationId) {
-        this.stationId = stationId;
-    }
-
-    public String getTurbineId() {
-        return turbineId;
-    }
-
-    public void setTurbineId(String turbineId) {
-        this.turbineId = turbineId;
-    }
-
-    public String getUniformCode() {
-        return uniformCode;
-    }
-
-    public void setUniformCode(String uniformCode) {
-        this.uniformCode = uniformCode;
-    }
-
-    @Override
-    public String toString() {
-        return "PointInfo{" +
-            "id = " + id +
-            ", coef = " + coef +
-            ", lineId = " + lineId +
-            ", name = " + name +
-            ", pointKey = " + pointKey +
-            ", projectId = " + projectId +
-            ", stationId = " + stationId +
-            ", turbineId = " + turbineId +
-            ", uniformCode = " + uniformCode +
-        "}";
-    }
+    private String institutionType;
+    private String spare;
+    private String boosterId;
+    private Double spare2;
 }

+ 46 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StateAi.java

@@ -0,0 +1,46 @@
+package com.ruoyi.ucp.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-05-16
+ */
+@Data
+@TableName("state_ai")
+public class StateAi implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 编号
+     */
+    private Short id;
+
+    /**
+     * 机型
+     */
+    private String model;
+
+    /**
+     * 原来状态
+     */
+    private Integer originalState;
+
+    /**
+     * 映射状态
+     */
+    private Integer mappingState;
+
+    /**
+     * 场站
+     */
+    private String stationId;
+}

+ 7 - 70
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoDay.java

@@ -3,6 +3,7 @@ package com.ruoyi.ucp.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.time.LocalDate;
@@ -16,6 +17,7 @@ import java.util.Date;
  * @author gfhd
  * @since 2024-03-05
  */
+@Data
 @TableName("station_info_day")
 public class StationInfoDay implements Serializable {
 
@@ -26,82 +28,17 @@ public class StationInfoDay implements Serializable {
 
     private String stationId;
 
-    private String projectId;
-
-    private String lineId;
-
-    private String turbineId;
-
     private Date recordDate;
 
     private Integer aqts;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getStationId() {
-        return stationId;
-    }
-
-    public void setStationId(String stationId) {
-        this.stationId = stationId;
-    }
-
-    public String getProjectId() {
-        return projectId;
-    }
-
-    public void setProjectId(String projectId) {
-        this.projectId = projectId;
-    }
-
-    public String getLineId() {
-        return lineId;
-    }
-
-    public void setLineId(String lineId) {
-        this.lineId = lineId;
-    }
-
-    public String getTurbineId() {
-        return turbineId;
-    }
-
-    public void setTurbineId(String turbineId) {
-        this.turbineId = turbineId;
-    }
-
-    public Date getRecordDate() {
-        return recordDate;
-    }
+    private Integer swdl;
 
-    public void setRecordDate(Date recordDate) {
-        this.recordDate = recordDate;
-    }
+    private Integer gwdl;
 
-    public Integer getAqts() {
-        return aqts;
-    }
+    private Integer cydl;
 
-    public void setAqts(Integer aqts) {
-        this.aqts = aqts;
-    }
+    private Integer rfdl;
 
-    @Override
-    public String toString() {
-        return "StationInfoDay{" +
-            "id = " + id +
-            ", stationId = " + stationId +
-            ", projectId = " + projectId +
-            ", lineId = " + lineId +
-            ", turbineId = " + turbineId +
-            ", recordDate = " + recordDate +
-            ", aqts = " + aqts +
-        "}";
-    }
+    private Integer zhcydl;
 }

+ 3 - 74
universal-computing-platform/src/main/java/com/ruoyi/ucp/entity/StationInfoHour.java

@@ -3,6 +3,7 @@ package com.ruoyi.ucp.entity;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 import java.io.Serializable;
 import java.time.LocalDate;
@@ -17,6 +18,7 @@ import java.util.Date;
  * @since 2024-03-05
  */
 @TableName("station_info_hour")
+@Data
 public class StationInfoHour implements Serializable {
 
     private static final long serialVersionUID = 1L;
@@ -25,82 +27,9 @@ public class StationInfoHour implements Serializable {
 
     private String stationId;
 
-    private String projectId;
-
-    private String lineId;
-
-    private String turbineId;
-
     private Date recordDate;
 
     private Double rfdl;
 
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getStationId() {
-        return stationId;
-    }
-
-    public void setStationId(String stationId) {
-        this.stationId = stationId;
-    }
-
-    public String getProjectId() {
-        return projectId;
-    }
-
-    public void setProjectId(String projectId) {
-        this.projectId = projectId;
-    }
-
-    public String getLineId() {
-        return lineId;
-    }
-
-    public void setLineId(String lineId) {
-        this.lineId = lineId;
-    }
-
-    public String getTurbineId() {
-        return turbineId;
-    }
-
-    public void setTurbineId(String turbineId) {
-        this.turbineId = turbineId;
-    }
-
-    public Date getRecordDate() {
-        return recordDate;
-    }
-
-    public void setRecordDate(Date recordDate) {
-        this.recordDate = recordDate;
-    }
-
-    public Double getRfdl() {
-        return rfdl;
-    }
-
-    public void setRfdl(Double rfdl) {
-        this.rfdl = rfdl;
-    }
-
-    @Override
-    public String toString() {
-        return "StationInfoHour{" +
-            "id = " + id +
-            ", stationId = " + stationId +
-            ", projectId = " + projectId +
-            ", lineId = " + lineId +
-            ", turbineId = " + turbineId +
-            ", recordDate = " + recordDate +
-            ", rfdl = " + rfdl +
-        "}";
-    }
+    private Double pjgl;
 }

+ 4 - 4
universal-computing-platform/src/main/java/com/ruoyi/ucp/feign/AdapterApi.java

@@ -34,8 +34,8 @@ public interface AdapterApi {
     @GetMapping("/history/stat")
     List<DoubleStatData> getHistoryStat(URI baseUri, @RequestParam("tagName") String tagName,
                                         @RequestParam("startTs") long startTs,
-                                        @RequestParam("endTs") long endTs,
-                                        @RequestParam("interval") int interval);
+                                        @RequestParam("endTs") long endTs);
+                                        //@RequestParam("interval") int interval);
 
     @GetMapping("/history/section")
     Map<String,PointData> getHistorySection(URI baseUri, @RequestParam("tagNames") String tagNames,
@@ -45,9 +45,9 @@ public interface AdapterApi {
     List<PointData> getHistorySection2(URI baseUri, @RequestParam("tagName") String tagName,
                                              @RequestParam("ts") long ts);
 
-    @PostMapping("/latest2")
+    @PostMapping("/latest")
     Boolean writeHistory(URI baseUri, @RequestBody PointData tsData);
 
-    @PostMapping("/latest/batch2")
+    @PostMapping("/latest/batch")
     Boolean writeHistoryBatch(URI baseUri, @RequestBody List<PointData> tsData);
 }

+ 0 - 23
universal-computing-platform/src/main/java/com/ruoyi/ucp/handler/impl/MyJobHandler.java

@@ -1,23 +0,0 @@
-package com.ruoyi.ucp.handler.impl;
-
-import com.ruoyi.ucp.handler.IJobHandler;
-import org.springframework.stereotype.Component;
-
-/**
- * glue job handler
- *
- * @author xuxueli 2016-5-19 21:05:45
- */
-@Component
-public class MyJobHandler {
-
-	private IJobHandler jobHandler;
-
-	public IJobHandler getJobHandler() {
-		return jobHandler;
-	}
-
-	public void setJobHandler(IJobHandler jobHandler) {
-		this.jobHandler = jobHandler;
-	}
-}

+ 16 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/mapper/StateAiMapper.java

@@ -0,0 +1,16 @@
+package com.ruoyi.ucp.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ruoyi.ucp.entity.StateAi;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-05-16
+ */
+public interface StateAiMapper extends BaseMapper<StateAi> {
+
+}

+ 18 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IStateAiService.java

@@ -0,0 +1,18 @@
+package com.ruoyi.ucp.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.ucp.entity.StateAi;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-05-16
+ */
+public interface IStateAiService extends IService<StateAi> {
+    List<StateAi> list();
+}

+ 2 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/IStationInfoDayService.java

@@ -1,6 +1,8 @@
 package com.ruoyi.ucp.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
 import com.ruoyi.ucp.entity.LineInfoDay;
 import com.ruoyi.ucp.entity.PointInfo;
 import com.ruoyi.ucp.entity.StationInfoDay;

+ 7 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/LineInfoDayServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ucp.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
@@ -48,7 +49,7 @@ public class LineInfoDayServiceImpl extends ServiceImpl<LineInfoDayMapper, LineI
             else
                 wrapper.eq(LineInfoDay::getStationId, pointInfo.getStationId());
         }
-        wrapper.eq(pointInfo.getRecordDate() != null, LineInfoDay::getRecordDate, pointInfo.getRecordDate());
+        //wrapper.eq(pointInfo.getRecordDate() != null, LineInfoDay::getRecordDate, pointInfo.getRecordDate());
         List<LineInfoDay> lineInfoDays = baseMapper.selectList(wrapper);
 
         return lineInfoDays.stream().collect(Collectors.toMap(LineInfoDay::getLineId, Function.identity()));
@@ -58,4 +59,9 @@ public class LineInfoDayServiceImpl extends ServiceImpl<LineInfoDayMapper, LineI
     public boolean saveOrUpdateBatch(Collection<LineInfoDay> entityList) {
         return super.saveOrUpdateBatch(entityList);
     }
+
+    @Override
+    public List<LineInfoDay> list(Wrapper<LineInfoDay> queryWrapper) {
+        return super.list(queryWrapper);
+    }
 }

+ 3 - 1
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/PointInfoServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ucp.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
@@ -25,9 +26,10 @@ import java.util.List;
 public class PointInfoServiceImpl extends ServiceImpl<PointInfoMapper, PointInfo> implements IPointInfoService {
 
     @Override
-    @Cacheable(value = "pointinfo", key = "#pointInfo.stationId + ':' + #pointInfo.projectId + ':' + #pointInfo.lineId + ':' + #pointInfo.turbineId + ':' + #pointInfo.uniformCode")
+    @Cacheable(value = "pointinfo", key = "#pointInfo.institutionType + ':' + #pointInfo.stationId + ':' + #pointInfo.projectId + ':' + #pointInfo.lineId + ':' + #pointInfo.turbineId + ':' + #pointInfo.uniformCode")
     public List<PointInfo> getByEntity(PointInfo pointInfo) {
         LambdaQueryWrapper<PointInfo> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(pointInfo.getInstitutionType() !=null, PointInfo::getInstitutionType, pointInfo.getInstitutionType());
         if (pointInfo.getTurbineId() != null) {
             if ("all".equals(pointInfo.getTurbineId()))
                 wrapper.ne(PointInfo::getTurbineId,"");

+ 30 - 0
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StateAiServiceImpl.java

@@ -0,0 +1,30 @@
+package com.ruoyi.ucp.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.common.annotation.DataSource;
+import com.ruoyi.common.enums.DataSourceType;
+import com.ruoyi.ucp.entity.StateAi;
+import com.ruoyi.ucp.mapper.StateAiMapper;
+import com.ruoyi.ucp.service.IStateAiService;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author gfhd
+ * @since 2024-05-16
+ */
+@Service
+@DataSource(DataSourceType.TAOS)
+public class StateAiServiceImpl extends ServiceImpl<StateAiMapper, StateAi> implements IStateAiService {
+    @Override
+    @Cacheable("stateailist")
+    public List<StateAi> list() {
+        return super.list();
+    }
+}

+ 14 - 6
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoDayServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ucp.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
@@ -10,6 +11,7 @@ import com.ruoyi.ucp.entity.StationInfoDay;
 import com.ruoyi.ucp.mapper.StationInfoDayMapper;
 import com.ruoyi.ucp.service.IStationInfoDayService;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
 import java.util.List;
@@ -33,19 +35,25 @@ public class StationInfoDayServiceImpl extends ServiceImpl<StationInfoDayMapper,
     public Map<String, StationInfoDay> getByEntity(PointInfo pointInfo) {
         LambdaQueryWrapper<StationInfoDay> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(pointInfo.getStationId() != null,StationInfoDay::getStationId, pointInfo.getStationId());
-        wrapper.eq(pointInfo.getRecordDate() != null, StationInfoDay::getRecordDate, pointInfo.getRecordDate());
+        //wrapper.eq(pointInfo.getRecordDate() != null, StationInfoDay::getRecordDate, pointInfo.getRecordDate());
         List<StationInfoDay> stationInfoDays = baseMapper.selectList(wrapper);
 
-        return stationInfoDays.stream().collect(Collectors.toMap(StationInfoDay::getLineId, Function.identity()));
+        return stationInfoDays.stream().collect(Collectors.toMap(StationInfoDay::getStationId, Function.identity()));
     }
 
     @Override
-    public boolean saveBatch(Collection<StationInfoDay> entityList) {
-        return super.saveBatch(entityList);
+    @Transactional
+    public boolean saveOrUpdateBatch(Collection<StationInfoDay> entityList) {
+        return super.saveOrUpdateBatch(entityList);
     }
 
     @Override
-    public boolean saveOrUpdateBatch(Collection<StationInfoDay> entityList) {
-        return super.saveOrUpdateBatch(entityList);
+    public StationInfoDay getOne(Wrapper<StationInfoDay> queryWrapper) {
+        return super.getOne(queryWrapper);
+    }
+
+    @Override
+    public List<StationInfoDay> list(Wrapper<StationInfoDay> queryWrapper) {
+        return super.list(queryWrapper);
     }
 }

+ 11 - 2
universal-computing-platform/src/main/java/com/ruoyi/ucp/service/impl/StationInfoHourServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruoyi.ucp.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.Wrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.annotation.DataSource;
 import com.ruoyi.common.enums.DataSourceType;
@@ -7,8 +8,10 @@ import com.ruoyi.ucp.entity.StationInfoHour;
 import com.ruoyi.ucp.mapper.StationInfoHourMapper;
 import com.ruoyi.ucp.service.IStationInfoHourService;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.util.Collection;
+import java.util.List;
 
 /**
  * <p>
@@ -21,8 +24,14 @@ import java.util.Collection;
 @Service
 @DataSource(DataSourceType.SLAVE)
 public class StationInfoHourServiceImpl extends ServiceImpl<StationInfoHourMapper, StationInfoHour> implements IStationInfoHourService {
+
+    @Override
+    public boolean saveOrUpdateBatch(Collection<StationInfoHour> entityList) {
+        return super.saveOrUpdateBatch(entityList);
+    }
+
     @Override
-    public boolean saveBatch(Collection<StationInfoHour> entityList) {
-        return super.saveBatch(entityList);
+    public List<StationInfoHour> list(Wrapper<StationInfoHour> queryWrapper) {
+        return super.list(queryWrapper);
     }
 }

+ 4 - 10
universal-computing-platform/src/main/java/com/ruoyi/ucp/util/MyTask.java

@@ -1,9 +1,5 @@
 package com.ruoyi.ucp.util;
 
-import com.ruoyi.ucp.glue.GlueFactory;
-import com.ruoyi.ucp.handler.IJobHandler;
-import com.ruoyi.ucp.handler.impl.GlueJobHandler;
-import com.ruoyi.ucp.handler.impl.MyJobHandler;
 import com.ruoyi.ucp.service.IFormulaService;
 import org.springframework.stereotype.Component;
 
@@ -20,15 +16,13 @@ import javax.script.ScriptException;
 public class MyTask {
     //@Resource
     //private ScriptEngine engine;
-    @Resource
-    private MyJobHandler myJobHandler;
 
     public void myParams(String params) {
         try {
-            String javaCode = GlueFactory.getJavaGlue().replace("//此处加运行方法", "jobHandler." + params + "();");
-            IJobHandler jobHandler = GlueFactory.getInstance().loadNewInstance(javaCode);
-            jobHandler.setFunctionHandler(myJobHandler.getJobHandler());
-            jobHandler.execute();
+            //String javaCode = GlueFactory.getJavaGlue().replace("//此处加运行方法", "jobHandler." + params + "();");
+            //IJobHandler jobHandler = GlueFactory.getInstance().loadNewInstance(javaCode);
+            //jobHandler.setFunctionHandler(MyJobHandler.jobHandler);
+            //jobHandler.execute();
             System.out.println("执行有参方法:" + params);
         } catch (Exception e) {
             e.printStackTrace();

+ 10 - 10
universal-computing-platform/src/main/resources/application-druid.yml

@@ -3,20 +3,20 @@ spring:
   datasource:
     type: com.alibaba.druid.pool.DruidDataSource            # 当前数据源操作类型
     driver-class-name: org.postgresql.Driver                # pgsql驱动包
-    url: jdbc:postgresql://123.60.219.66:5432/postgres
-    username: postgres
-    password: gyeepd@123
+#    url: jdbc:postgresql://123.60.219.66:5432/postgres
+#    username: postgres
+#    password: gyeepd@123
     druid:
       master:
-        url: jdbc:postgresql://123.60.219.66:5432/postgres
-        username: postgres
-        password: gyeepd@123
-        driver-class-name: org.postgresql.Driver
+        url: jdbc:postgresql://192.168.126.128:5432/calc_hub
+        username: gfhd
+        password: zghww693
+#        driver-class-name: org.postgresql.Driver
       slave:
-        url: jdbc:postgresql://123.60.219.66:5432/power_lcm
+        url: jdbc:postgresql://192.168.2.232:5432/power_lcm
         username: postgres
-        password: gyeepd@123
-        driver-class-name: org.postgresql.Driver
+        password: gd123
+#        driver-class-name: org.postgresql.Driver
       # 初始连接数
       initialSize: 5
       # 最小连接池数量

+ 0 - 21
universal-computing-platform/src/test/java/com/ruoyi/ucp/JavaFunctionJobHandler.java

@@ -1,21 +0,0 @@
-package com.ruoyi.ucp;
-
-import com.ruoyi.ucp.handler.IJobHandler;
-
-public class JavaFunctionJobHandler  extends IJobHandler {
-    @Override
-    public void execute() throws Exception {
-
-    }
-
-    @Override
-    public IJobHandler getFunctionHandler() {
-        return null;
-    }
-
-    @Override
-    public void setFunctionHandler(IJobHandler jobHandler) {
-
-    }
-    //此处加公式
-}

+ 0 - 41
universal-computing-platform/src/test/java/com/ruoyi/ucp/JavaGlueJobHandler.java

@@ -1,41 +0,0 @@
-package com.ruoyi.ucp;
-
-import com.ruoyi.ucp.feign.AdapterApi;
-import com.ruoyi.ucp.handler.IJobHandler;
-import com.ruoyi.ucp.service.ILineInfoDayService;
-import com.ruoyi.ucp.service.IPointInfoService;
-import com.ruoyi.ucp.service.IStationInfoDayService;
-import com.ruoyi.ucp.service.IStationInfoHourService;
-
-import javax.annotation.Resource;
-
-public class JavaGlueJobHandler extends IJobHandler{
-
-    @Resource
-    private AdapterApi adapter;
-    @Resource
-    private IPointInfoService pointService;
-    @Resource
-    private IStationInfoHourService stationInfoHourService;
-    @Resource
-    private IStationInfoDayService stationInfoDayService;
-    @Resource
-    private ILineInfoDayService lineInfoDayService;
-
-    private IJobHandler jobHandler;
-
-    @Override
-    public void execute() throws Exception {
-        //此处运行方法
-    }
-
-    @Override
-    public IJobHandler getFunctionHandler() {
-        return jobHandler;
-    }
-
-    @Override
-    public void setFunctionHandler(IJobHandler jobHandler) {
-        this.jobHandler = jobHandler;
-    }
-}

+ 10 - 5
universal-computing-platform/src/test/java/com/ruoyi/ucp/UcpAppTests.java

@@ -1,12 +1,16 @@
 package com.ruoyi.ucp;
 
 import cn.hutool.core.date.DateUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ruoyi.ucp.entity.PointData;
 import com.ruoyi.ucp.entity.PointInfo;
+import com.ruoyi.ucp.entity.StationInfoDay;
 import com.ruoyi.ucp.entity.TurbineInfo;
 import com.ruoyi.ucp.feign.AdapterApi;
 import com.ruoyi.ucp.mapper.TurbineInfoMapper;
 import com.ruoyi.ucp.service.IPointInfoService;
+import com.ruoyi.ucp.service.IStationInfoDayService;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
 
@@ -17,6 +21,9 @@ import javax.script.ScriptException;
 import java.net.URI;
 import java.util.LinkedHashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 @SpringBootTest
 class UcpAppTests {
@@ -61,12 +68,10 @@ class UcpAppTests {
         }
     }
 
+    @Resource
+    private IStationInfoDayService stationInfoDayService;
     @Test
     public void test() {
-        TurbineInfo info = new TurbineInfo();
-        info.setName(                          "pro_basic_equipment_point");
-        info.setUniformCode("");
-        //List<LinkedHashMap<String, Object>> byInfo = turbineInfoMapper.getByInfo(info);
-        System.out.println();
+
     }
 }