| 
				
			 | 
			
			
				@@ -14,8 +14,10 @@ import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
			| 
				
					14
				
			 | 
			
				
					14
				
			 | 
			
			
				 import javax.annotation.Resource; 
			 | 
		
	
		
			
			| 
				
					15
				
			 | 
			
				
					15
				
			 | 
			
			
				 import javax.sql.DataSource; 
			 | 
		
	
		
			
			| 
				
					16
				
			 | 
			
				
					16
				
			 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					17
				
			 | 
			
			
				+import java.util.ArrayList; 
			 | 
		
	
		
			
			| 
				
					17
				
			 | 
			
				
					18
				
			 | 
			
			
				 import java.util.List; 
			 | 
		
	
		
			
			| 
				
					18
				
			 | 
			
				
					19
				
			 | 
			
			
				 import java.util.Map; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					20
				
			 | 
			
			
				+import java.util.stream.Collectors; 
			 | 
		
	
		
			
			| 
				
					19
				
			 | 
			
				
					21
				
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
					20
				
			 | 
			
				
					22
				
			 | 
			
			
				 /** 
			 | 
		
	
		
			
			| 
				
					21
				
			 | 
			
				
					23
				
			 | 
			
			
				  * class name: BaseDataController 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -36,8 +38,11 @@ public class BaseDataController { 
			 | 
		
	
		
			
			| 
				
					36
				
			 | 
			
				
					38
				
			 | 
			
			
				     @Resource(name = "centralbase") 
			 | 
		
	
		
			
			| 
				
					37
				
			 | 
			
				
					39
				
			 | 
			
			
				     DataSource baseDataSource; 
			 | 
		
	
		
			
			| 
				
					38
				
			 | 
			
				
					40
				
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					41
				
			 | 
			
			
				+    @Resource(name = "gtsj") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					42
				
			 | 
			
			
				+    DataSource gtsjDataSource; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					43
				
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
					39
				
			 | 
			
				
					44
				
			 | 
			
			
				     @PostMapping("/saveDataToStatusDaily") 
			 | 
		
	
		
			
			| 
				
					40
				
			 | 
			
				
			 | 
			
			
				-    @ApiOperation("从 A2 获取 数据插入到 centrlBase-StatusDaily 中") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					45
				
			 | 
			
			
				+    @ApiOperation("从 A2 获取 数据插入到 centrlBase-StatusDaily 中,只需要传入查询时间") 
			 | 
		
	
		
			
			| 
				
					41
				
			 | 
			
				
					46
				
			 | 
			
			
				     public JSONObject saveDataToStatusDaily(@RequestBody BaseDataBody baseDataBody) { 
			 | 
		
	
		
			
			| 
				
					42
				
			 | 
			
				
					47
				
			 | 
			
			
				         JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
			| 
				
					43
				
			 | 
			
				
					48
				
			 | 
			
			
				         int insertCount = 0; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -122,7 +127,7 @@ public class BaseDataController { 
			 | 
		
	
		
			
			| 
				
					122
				
			 | 
			
				
					127
				
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
					123
				
			 | 
			
				
					128
				
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				
					124
				
			 | 
			
				
					129
				
			 | 
			
			
				     @PostMapping("/saveDataToVolDaily") 
			 | 
		
	
		
			
			| 
				
					125
				
			 | 
			
				
			 | 
			
			
				-    @ApiOperation("从 A2 获取 数据插入到 centrlBase-VolDaily 中") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					130
				
			 | 
			
			
				+    @ApiOperation("从 A2 获取 数据插入到 centrlBase-VolDaily 中,只需要传入查询时间") 
			 | 
		
	
		
			
			| 
				
					126
				
			 | 
			
				
					131
				
			 | 
			
			
				     public JSONObject saveVolDaily(@RequestBody BaseDataBody baseDataBody) { 
			 | 
		
	
		
			
			| 
				
					127
				
			 | 
			
				
					132
				
			 | 
			
			
				         JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
			| 
				
					128
				
			 | 
			
				
					133
				
			 | 
			
			
				         int insertCount = 0; 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -198,4 +203,63 @@ public class BaseDataController { 
			 | 
		
	
		
			
			| 
				
					198
				
			 | 
			
				
					203
				
			 | 
			
			
				         jdbcTemplate = new JdbcTemplate(baseDataSource); 
			 | 
		
	
		
			
			| 
				
					199
				
			 | 
			
				
					204
				
			 | 
			
			
				         return jdbcTemplate.update(sql); 
			 | 
		
	
		
			
			| 
				
					200
				
			 | 
			
				
					205
				
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					206
				
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					207
				
			 | 
			
			
				+    @PostMapping("/getNeedRunTimeData") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					208
				
			 | 
			
			
				+    @ApiOperation("查询天安的数据库 只需要传过来 需要查询的sql 就行") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					209
				
			 | 
			
			
				+    public JSONObject getNeedRunTimeData(@RequestBody BaseDataBody baseDataBody){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					210
				
			 | 
			
			
				+        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					211
				
			 | 
			
			
				+        jdbcTemplate = new JdbcTemplate(gtsjDataSource); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					212
				
			 | 
			
			
				+        try{ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					213
				
			 | 
			
			
				+            List<Map<String, Object>> list = jdbcTemplate.queryForList(baseDataBody.getSql()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					214
				
			 | 
			
			
				+            jsonObject.put("RunTimedata",list); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					215
				
			 | 
			
			
				+        }catch (Exception e){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					216
				
			 | 
			
			
				+            jsonObject.put("error",e.getMessage()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					217
				
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					218
				
			 | 
			
			
				+         return jsonObject; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					219
				
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					220
				
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					221
				
			 | 
			
			
				+    @PostMapping("/getNeedA2Data") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					222
				
			 | 
			
			
				+    @ApiOperation("查询A2数据库 只需要传过来 需要查询的sql 就行") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					223
				
			 | 
			
			
				+    public JSONObject getNeedA2Data(@RequestBody BaseDataBody baseDataBody){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					224
				
			 | 
			
			
				+        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					225
				
			 | 
			
			
				+        jdbcTemplate = new JdbcTemplate(oracleDataSource); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					226
				
			 | 
			
			
				+        try{ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					227
				
			 | 
			
			
				+            List<Map<String, Object>> list = jdbcTemplate.queryForList(baseDataBody.getSql()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					228
				
			 | 
			
			
				+            jsonObject.put("A2data",list); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					229
				
			 | 
			
			
				+        }catch (Exception e){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					230
				
			 | 
			
			
				+            jsonObject.put("error",e.getMessage()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					231
				
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					232
				
			 | 
			
			
				+        return jsonObject; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					233
				
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					234
				
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					235
				
			 | 
			
			
				+    @PostMapping("/getA2WellSorceData") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					236
				
			 | 
			
			
				+    @ApiOperation("查询A2数据库 并且和 wellSource 做对比 只填写需要查询A2Data 的时间就行") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					237
				
			 | 
			
			
				+    public JSONObject getA2WellSorceData(@RequestBody BaseDataBody baseDataBody){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					238
				
			 | 
			
			
				+        JSONObject jsonObject = new JSONObject(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					239
				
			 | 
			
			
				+        jdbcTemplate = new JdbcTemplate(oracleDataSource); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					240
				
			 | 
			
			
				+        try{ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					241
				
			 | 
			
			
				+            String sql = "select  distinct jh  from DBA01 where rq  = to_date('"+baseDataBody.getDate()+"','yyyy-MM-dd') and qyrq is not null "; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					242
				
			 | 
			
			
				+            List<Map<String, Object>>  A2DataList = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					243
				
			 | 
			
			
				+            List<Map<String, Object>>  wellSourceList = getWellSource(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					244
				
			 | 
			
			
				+            Object collect = A2DataList.stream().filter(item -> !wellSourceList.contains(item)).collect(Collectors.toList()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					245
				
			 | 
			
			
				+            Object collect1 = wellSourceList.stream().filter(item -> !A2DataList.contains(item)).collect(Collectors.toList()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					246
				
			 | 
			
			
				+            jsonObject.put("wellSource 中不存在 A2 的井号为",collect); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					247
				
			 | 
			
			
				+            jsonObject.put("A2 中不存在 wellSource 的井号为",collect1); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					248
				
			 | 
			
			
				+        }catch (Exception e){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					249
				
			 | 
			
			
				+            jsonObject.put("error",e.getMessage()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					250
				
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					251
				
			 | 
			
			
				+        return jsonObject; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					252
				
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					253
				
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					254
				
			 | 
			
			
				+    public List<Map<String, Object>>  getWellSource(){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					255
				
			 | 
			
			
				+        List<Map<String, Object>>  list = new ArrayList<>(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					256
				
			 | 
			
			
				+        try{ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					257
				
			 | 
			
			
				+            jdbcTemplate = new JdbcTemplate(baseDataSource); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					258
				
			 | 
			
			
				+            String sql = " select distinct well_id from centralbase.cb_cd_well_source "; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					259
				
			 | 
			
			
				+            list = jdbcTemplate.queryForList(sql); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					260
				
			 | 
			
			
				+        }catch (Exception e){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					261
				
			 | 
			
			
				+            e.printStackTrace(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					262
				
			 | 
			
			
				+        } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					263
				
			 | 
			
			
				+        return list; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				
					264
				
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
					201
				
			 | 
			
				
					265
				
			 | 
			
			
				 } 
			 |