Browse Source

update config

xsr 4 months ago
parent
commit
397d1ffbc2

+ 3 - 1
src/main/java/com/gct/aoid/config/FeignConfig.java

@@ -31,6 +31,8 @@ public class FeignConfig implements RequestInterceptor {
31
     private String tokeAuthUrl;
31
     private String tokeAuthUrl;
32
     private static String token;
32
     private static String token;
33
 
33
 
34
+    private static String lockStr = "token";
35
+
34
     @Bean(name = "restTemplate")
36
     @Bean(name = "restTemplate")
35
     RestTemplate getRestTemplate() {
37
     RestTemplate getRestTemplate() {
36
         return new RestTemplate();
38
         return new RestTemplate();
@@ -39,7 +41,7 @@ public class FeignConfig implements RequestInterceptor {
39
     @Override
41
     @Override
40
     public void apply(RequestTemplate requestTemplate) {
42
     public void apply(RequestTemplate requestTemplate) {
41
         if (StringUtil.isBlankOrEmpty(token)) {
43
         if (StringUtil.isBlankOrEmpty(token)) {
42
-            synchronized (token) {
44
+            synchronized (lockStr) {
43
                 if (StringUtil.isBlankOrEmpty(token)) {
45
                 if (StringUtil.isBlankOrEmpty(token)) {
44
                     List<String> hostList = Arrays.asList(tokeAuthUrl.split(","));
46
                     List<String> hostList = Arrays.asList(tokeAuthUrl.split(","));
45
                     //手动获取RestTemplate 实例
47
                     //手动获取RestTemplate 实例

+ 2 - 0
src/main/java/com/gct/aoid/controller/AoidDailyYieldController.java

@@ -266,5 +266,7 @@ public class AoidDailyYieldController {
266
 //        System.out.println("do run");
266
 //        System.out.println("do run");
267
 //        System.exit(0);
267
 //        System.exit(0);
268
 //    }
268
 //    }
269
+
270
+
269
 }
271
 }
270
 
272
 

+ 2 - 1
src/main/java/com/gct/aoid/service/impl/CalDiagramProductionService.java

@@ -1405,6 +1405,8 @@ public class CalDiagramProductionService {
1405
 
1405
 
1406
         }
1406
         }
1407
 
1407
 
1408
+
1409
+
1408
         //endregion
1410
         //endregion
1409
         //region step 2:
1411
         //region step 2:
1410
         AoidMsgValue.DiagnoseResult diagnoseResult = msg.getDiagnoseResult();
1412
         AoidMsgValue.DiagnoseResult diagnoseResult = msg.getDiagnoseResult();
@@ -1494,7 +1496,6 @@ public class CalDiagramProductionService {
1494
         //endregion
1496
         //endregion
1495
     }
1497
     }
1496
 
1498
 
1497
-
1498
     public class ProDataForCalProductionValue {
1499
     public class ProDataForCalProductionValue {
1499
 
1500
 
1500
         private Double bj;
1501
         private Double bj;

+ 1 - 1
src/main/resources/application-dev.yml

@@ -94,7 +94,7 @@ gct:
94
         access-key: warn-msg-v1
94
         access-key: warn-msg-v1
95
         secret-key: warn-msg-v1
95
         secret-key: warn-msg-v1
96
     aoid:
96
     aoid:
97
-      enable: false
97
+      enable: true
98
       topic: aoid-msg3
98
       topic: aoid-msg3
99
       tags: v3
99
       tags: v3
100
       log-file-path: /home/lloyd/Desktop/log/task-aoid.json
100
       log-file-path: /home/lloyd/Desktop/log/task-aoid.json

+ 5 - 5
src/main/resources/application-test.yml

@@ -20,7 +20,7 @@ spring:
20
   cloud:
20
   cloud:
21
     nacos:
21
     nacos:
22
       ## 指定nacos server地址
22
       ## 指定nacos server地址
23
-      server-addr: 192.168.31.252
23
+      server-addr: 192.168.31.101
24
     #      discovery:
24
     #      discovery:
25
     #        namespace: bcff0d3d-a340-448c-a2c8-4a195276807e
25
     #        namespace: bcff0d3d-a340-448c-a2c8-4a195276807e
26
     #        group: DEV_GROUP
26
     #        group: DEV_GROUP
@@ -39,7 +39,7 @@ spring:
39
   datasource:
39
   datasource:
40
     ## Hikari连接池的设置 Hikari 时间单位都是毫秒
40
     ## Hikari连接池的设置 Hikari 时间单位都是毫秒
41
     type: com.zaxxer.hikari.HikariDataSource
41
     type: com.zaxxer.hikari.HikariDataSource
42
-    url: jdbc:postgresql://192.168.31.252:54321/calliquid
42
+    url: jdbc:postgresql://192.168.31.101:54321/calliquid
43
     username: root
43
     username: root
44
     password: 123456
44
     password: 123456
45
     driver-class-name: org.postgresql.Driver
45
     driver-class-name: org.postgresql.Driver
@@ -94,7 +94,7 @@ gct:
94
         access-key: warn-msg-v1
94
         access-key: warn-msg-v1
95
         secret-key: warn-msg-v1
95
         secret-key: warn-msg-v1
96
     aoid:
96
     aoid:
97
-      enable: false
97
+      enable: true
98
       topic: aoid-msg3
98
       topic: aoid-msg3
99
       tags: v3
99
       tags: v3
100
       log-file-path: /home/lloyd/Desktop/log/task-aoid.json
100
       log-file-path: /home/lloyd/Desktop/log/task-aoid.json
@@ -102,7 +102,7 @@ gct:
102
         group: aoid3
102
         group: aoid3
103
         access-key: aoid-msg-v3
103
         access-key: aoid-msg-v3
104
         secret-key: aoid-msg-v3
104
         secret-key: aoid-msg-v3
105
-      name-server: 192.168.31.252:9876
105
+      name-server: 192.168.31.101:9876
106
       consumer:
106
       consumer:
107
         group: aoid3
107
         group: aoid3
108
         access-key: aoid-msg-v3
108
         access-key: aoid-msg-v3
@@ -181,7 +181,7 @@ feign:
181
         ReadTimeOut: 50000
181
         ReadTimeOut: 50000
182
 #token 认证中心主机地址
182
 #token 认证中心主机地址
183
 auth:
183
 auth:
184
-  hostList: 192.168.31.252:9001
184
+  hostList: 192.168.31.101:9001
185
 
185
 
186
 mybatis-plus:
186
 mybatis-plus:
187
   global-config:
187
   global-config:

+ 1 - 1
src/main/resources/bootstrap.yml

@@ -1,7 +1,7 @@
1
 spring:
1
 spring:
2
   ## 切换配置文件
2
   ## 切换配置文件
3
   profiles:
3
   profiles:
4
-    active: dev   # dev 开发环境    /   pro  生产环境    / test   测试环境
4
+    active: test   # dev 开发环境    /   pro  生产环境    / test   测试环境
5
 
5
 
6
   application:
6
   application:
7
     name: production-calculation
7
     name: production-calculation

+ 3 - 81
src/test/java/com/gct/aoid/MyTest.java

@@ -15,6 +15,7 @@ import com.gct.aoid.service.AoidDailyYieldService;
15
 import com.gct.aoid.service.AoidSinglegtYieldService;
15
 import com.gct.aoid.service.AoidSinglegtYieldService;
16
 import com.gct.aoid.service.EnableOrPauseService;
16
 import com.gct.aoid.service.EnableOrPauseService;
17
 import com.gct.aoid.service.LiqProdDailyCalService;
17
 import com.gct.aoid.service.LiqProdDailyCalService;
18
+import com.gct.aoid.service.impl.AoidDailyYieldServiceImpl;
18
 import com.gct.aoid.service.impl.CalDiagramProductionService;
19
 import com.gct.aoid.service.impl.CalDiagramProductionService;
19
 import com.gct.aoid.service.impl.CalibrationParameterService;
20
 import com.gct.aoid.service.impl.CalibrationParameterService;
20
 import com.gct.common.util.DateTimeUtil;
21
 import com.gct.common.util.DateTimeUtil;
@@ -46,92 +47,13 @@ import java.util.stream.Collectors;
46
 @RunWith(SpringRunner.class)
47
 @RunWith(SpringRunner.class)
47
 @ContextConfiguration
48
 @ContextConfiguration
48
 public class MyTest {
49
 public class MyTest {
49
-    @Autowired
50
-    CalDiagramProductionService calDiagramProductionService ;
51
-    @Autowired
52
-    BaseDataClient client;
53
-    @Autowired
54
-    DiagnoseClient diagnoseClient;
55
-    @Autowired
56
-    AoidSinglegtYieldService aoidSinglegtYieldService;
57
-    @Autowired
58
-    AoidDailyYieldService aoidDailyYieldService;
59
-    @Autowired
60
-    AoidSinglegtYieldController aoidSinglegtYieldController;
61
-    @Autowired
62
-    AoidSinglegtYieldMapper aoidSinglegtYieldMapper;
63
-    @Autowired
64
-    LiqProdDailyCalService liqProdDailyCalService;
65
-//    @Autowired
66
-//    SumDataTaskMapper sumDataTaskMapper;
67
-//    @Autowired
68
-//    AoidParamSettingService aoidParamSettingService;
69
-//    @Autowired
70
-//    AoidLiquidAbnormalService aoidLiquidAbnormalService;
71
-//    private static final  Logger reload = (Logger) LoggerFactory.getLogger("reload");
72
-//    @Test
73
-//    public void test() {
74
-//        List<AoidParamSetting> aoidParamSetting = aoidParamSettingService.getAoidParamSetting();
75
-//        aoidLiquidAbnormalService.addAoidLiquidAbnormalNew(DateTimeUtil.formatDateTime("2021-08-18 00:00:00"),aoidParamSetting);
76
-//    }
77
-@Autowired
78
-    EnableOrPauseService enableOrPauseService;
79
-
80
-    @Test
81
-    public void test1() throws InvocationTargetException, IllegalAccessException, InstantiationException, NoSuchMethodException {
82
-        String[] x = {"27"};
83
-        String starDate = "2022-07-05";
84
-        String time = "16:00:00";
85
-        liqProdDailyCalService.calculate(x,starDate,time);
86
-    }
87
 
50
 
88
     @Autowired
51
     @Autowired
89
-    AoidSinglegtYieldMapper singlegtYieldMapper;
90
-    @Test
91
-    //@Scheduled
92
-    public void test2(){
93
-        LiqWarringVo liqWarringVo = new LiqWarringVo()
94
-                .setWellId("CHW04").setPordDate("2021-08-17 00:00:00");
95
-
96
-        System.out.println(aoidDailyYieldService.getLiqWarring(liqWarringVo));
97
-    }
98
-
52
+    AoidDailyYieldServiceImpl aoidDailyYieldService;
99
 
53
 
100
     @Autowired
54
     @Autowired
101
-    CalibrationParameterService calibrationParameterService;
102
-
103
-    @Test
104
-    public void testXs(){
105
-        double sumArea = 0;
106
-        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
107
-        List<AoidSinglegtYield> results = aoidSinglegtYieldService.list(new QueryWrapper<AoidSinglegtYield>().eq("well_id", "车峰15")
108
-                .between("prod_date", LocalDateTime.parse("2022-10-03 16:00:00",df)
109
-                        , LocalDateTime.parse("2022-10-04 16:00:00",df)));
110
-        String[] sgts = results.stream().map(AoidSinglegtYield::getSgt).collect(Collectors.toList()).toArray(new String[]{});
111
-
112
-        for (int y = 0; y < sgts.length; y++) {
55
+    AoidSinglegtYieldService aoidSinglegtYieldService;
113
 
56
 
114
-            List<List<Double>> sgtList = new ArrayList<>();
115
-            if (Objects.nonNull(sgts[y])) {
116
-                sgtList = SGTUtil.encodeToUseList(sgts[y]);
117
-                if (Objects.nonNull(sgtList) && sgtList.size() > 1) {
118
-                    sgtList.remove(sgtList.size() - 1);
119
-                    sgtList.add(sgtList.get(0));
120
-                }
121
-                Double[][] sgtValue = JSONObject.parseObject(sgtList.toString(), Double[][].class);
122
-                double areaReal = CardAreaAlgorithm.calArea(sgtValue);
123
-                if (areaReal>0)
124
-                {
125
-                    sumArea += areaReal;
126
-                }
127
-            }
128
 
57
 
129
-        }
130
-        double areaAvg = sumArea/sgts.length;
131
-        if (areaAvg<200)
132
-        {
133
-            System.out.println(calibrationParameterService.coefficientValue(0,results));
134
-        }
135
-    }
136
     
58
     
137
 }
59
 }