15b8bfaf by zenglele

预查封 查封推送

1 parent ede126ed
...@@ -240,6 +240,12 @@ ...@@ -240,6 +240,12 @@
240 <artifactId>minio</artifactId> 240 <artifactId>minio</artifactId>
241 <version>8.3.4</version> 241 <version>8.3.4</version>
242 </dependency> 242 </dependency>
243 <!-- http -->
244 <dependency>
245 <groupId>org.apache.httpcomponents</groupId>
246 <artifactId>httpclient</artifactId>
247 <version>4.5.2</version>
248 </dependency>
243 249
244 <dependency> 250 <dependency>
245 <groupId>com.google.zxing</groupId> 251 <groupId>com.google.zxing</groupId>
...@@ -250,7 +256,7 @@ ...@@ -250,7 +256,7 @@
250 <dependency> 256 <dependency>
251 <groupId>com.oracle</groupId> 257 <groupId>com.oracle</groupId>
252 <artifactId>ojdbc6</artifactId> 258 <artifactId>ojdbc6</artifactId>
253 <version>${oracle.version}</version> 259 <version>11.2.0.3</version>
254 </dependency> 260 </dependency>
255 261
256 <dependency> 262 <dependency>
......
1 package com.pashanhoo.common;
2
3 import com.google.common.collect.Lists;
4
5 import org.apache.http.HttpEntity;
6 import org.apache.http.HttpResponse;
7 import org.apache.http.NameValuePair;
8 import org.apache.http.client.config.RequestConfig;
9 import org.apache.http.client.entity.UrlEncodedFormEntity;
10 import org.apache.http.client.methods.CloseableHttpResponse;
11 import org.apache.http.client.methods.HttpGet;
12 import org.apache.http.client.methods.HttpPost;
13 import org.apache.http.impl.client.CloseableHttpClient;
14 import org.apache.http.impl.client.HttpClientBuilder;
15 import org.apache.http.message.BasicNameValuePair;
16 import org.apache.http.util.EntityUtils;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
19
20 import java.io.File;
21 import java.io.FileOutputStream;
22 import java.io.IOException;
23 import java.io.OutputStream;
24 import java.net.URI;
25 import java.util.Iterator;
26 import java.util.LinkedHashMap;
27 import java.util.List;
28 import java.util.Map;
29
30 public class HttpUtil {
31
32 public HttpUtil() {
33 }
34
35
36 public static String getReturnResByUrl(String url, Map<String, String> params,
37 Map<String, String> headers, String encode) throws IOException {
38 Logger logger = LoggerFactory.getLogger(HttpUtil.class);
39 CloseableHttpClient client = HttpClientBuilder.create().build();
40 String res = "";
41 HttpPost httppost = new HttpPost(url);
42 if (encode == null) {
43 encode = "utf-8";
44 }
45 Integer URLOUTTIME = 0;
46 RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(URLOUTTIME)
47 .setConnectTimeout(URLOUTTIME).setSocketTimeout(URLOUTTIME).build();
48 httppost.setConfig(requestConfig);
49 // 设置header
50 if (headers != null && headers.size() > 0) {
51 for (Map.Entry<String, String> entry : headers.entrySet()) {
52 httppost.setHeader(entry.getKey(), entry.getValue());
53 }
54 }
55
56 List<NameValuePair> urlParameters = Lists.newArrayList();
57 if (params != null && params.size() > 0) {
58 Iterator<String> it = params.keySet().iterator();
59 while (it.hasNext()) {
60 String key = it.next();
61 urlParameters.add(new BasicNameValuePair(key, params.get(key)));
62 }
63 httppost.setEntity(new UrlEncodedFormEntity(urlParameters, encode));
64 }
65
66
67 CloseableHttpResponse response = client.execute(httppost);
68 if (response.getStatusLine().getStatusCode() == 200) {
69 res = EntityUtils.toString(response.getEntity(), encode);
70 }
71 logger.info("http post back:" + res);
72 httppost.releaseConnection();
73 response.close();
74 client.close();
75 return res;
76
77 }
78
79
80 public static String get(String url, List<NameValuePair> params, Map<String, String> headers)
81 {
82 String body = null;
83 try
84 {
85 HttpGet httpget = new HttpGet(url);
86
87 String str = EntityUtils.toString(new UrlEncodedFormEntity(params, "UTF-8"));
88 String f = url.indexOf("?") > -1 ? "&" : "?";
89 httpget.setURI(new URI(httpget.getURI().toString() + f + str));
90
91 CloseableHttpClient hc = HttpClientBuilder.create().build();
92 if ((headers != null) && (headers.size() > 0)) {
93 for (Map.Entry entry : headers.entrySet()) {
94 httpget.setHeader((String)entry.getKey(), (String)entry.getValue());
95 }
96 }
97 Object httpresponse = hc.execute(httpget);
98 if (((HttpResponse)httpresponse).getStatusLine().getStatusCode() == 200)
99 {
100 HttpEntity entity = ((HttpResponse)httpresponse).getEntity();
101 body = EntityUtils.toString(entity);
102 if (entity != null)
103 entity.consumeContent();
104 }
105 else
106 {
107 httpget.abort();
108 }
109 }
110 catch (Exception e) {
111 e.printStackTrace();
112 }
113 return body;
114 }
115 }
...@@ -12,11 +12,11 @@ public class QysTask { ...@@ -12,11 +12,11 @@ public class QysTask {
12 @Autowired 12 @Autowired
13 private EciService eciService; 13 private EciService eciService;
14 14
15 @Scheduled(cron="0 0/10 * * * ?") 15 /* @Scheduled(cron="0 0/10 * * * ?")
16 public void accessCreateContract() { 16 public void accessCreateContract() {
17 System.out.println("===========创建合同定时任务进来了========="); 17 System.out.println("===========创建合同定时任务进来了=========");
18 eciService.accessCreateContract(); 18 eciService.accessCreateContract();
19 System.out.println("===========创建合同定时任务走了========="); 19 System.out.println("===========创建合同定时任务走了=========");
20 } 20 }*/
21 21
22 } 22 }
......
...@@ -30,4 +30,19 @@ public class ZhjTask { ...@@ -30,4 +30,19 @@ public class ZhjTask {
30 System.out.println("===========每天晚上九点定时任务走了========="); 30 System.out.println("===========每天晚上九点定时任务走了=========");
31 } 31 }
32 32
33
34 @Scheduled(cron="0 0 18 * * ? ")
35 public void executeYcfInfo() {
36 System.out.println("===========每天晚上九点定时任务进来了=========");
37 zhjDatasSynService.synYcfInfo();
38 System.out.println("===========每天晚上九点定时任务走了=========");
39 }
40
41
42 @Scheduled(cron="0 0 22 * * ? ")
43 public void executeCfInfo() {
44 System.out.println("===========每天晚上九点定时任务进来了=========");
45 zhjDatasSynService.synCfInfo();
46 System.out.println("===========每天晚上九点定时任务走了=========");
47 }
33 } 48 }
......
...@@ -22,6 +22,10 @@ public interface SynZhjInfoMapper extends BaseMapper<SynZhjInfoDo> { ...@@ -22,6 +22,10 @@ public interface SynZhjInfoMapper extends BaseMapper<SynZhjInfoDo> {
22 22
23 List<Map> getQymxfcdyxx(); 23 List<Map> getQymxfcdyxx();
24 24
25 List<Map> getYCFBdcxx();
26
27 List<Map> getCFBdcxx();
28
25 29
26 30
27 } 31 }
......
...@@ -21,6 +21,6 @@ public interface ZhjDatasSynService extends IService<RegBusBdcqzsdjxxDo> { ...@@ -21,6 +21,6 @@ public interface ZhjDatasSynService extends IService<RegBusBdcqzsdjxxDo> {
21 21
22 public void synQyInfo(); 22 public void synQyInfo();
23 23
24 24 public void synYcfInfo();
25 25 public void synCfInfo();
26 } 26 }
......
...@@ -2,6 +2,7 @@ package com.pashanhoo.zhj.service.impl; ...@@ -2,6 +2,7 @@ package com.pashanhoo.zhj.service.impl;
2 2
3 import com.alibaba.fastjson.JSONObject; 3 import com.alibaba.fastjson.JSONObject;
4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 4 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
5 import com.pashanhoo.common.HttpUtil;
5 import com.pashanhoo.zhj.entity.RegBusBdcqzsdjxxDo; 6 import com.pashanhoo.zhj.entity.RegBusBdcqzsdjxxDo;
6 import com.pashanhoo.zhj.entity.SynZhjInfoDo; 7 import com.pashanhoo.zhj.entity.SynZhjInfoDo;
7 import com.pashanhoo.zhj.mapper.RegBusBdcqzsdjxxMapper; 8 import com.pashanhoo.zhj.mapper.RegBusBdcqzsdjxxMapper;
...@@ -11,6 +12,7 @@ import org.slf4j.Logger; ...@@ -11,6 +12,7 @@ import org.slf4j.Logger;
11 import org.slf4j.LoggerFactory; 12 import org.slf4j.LoggerFactory;
12 import org.springframework.beans.factory.annotation.Autowired; 13 import org.springframework.beans.factory.annotation.Autowired;
13 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
15 import org.springframework.util.StringUtils;
14 16
15 import java.io.*; 17 import java.io.*;
16 import java.net.HttpURLConnection; 18 import java.net.HttpURLConnection;
...@@ -42,6 +44,10 @@ public class ZhjDatasSynServiceImpl extends ServiceImpl<RegBusBdcqzsdjxxMapper, ...@@ -42,6 +44,10 @@ public class ZhjDatasSynServiceImpl extends ServiceImpl<RegBusBdcqzsdjxxMapper,
42 private String appkey="3cd832c411238faa1df46d532a21bfcd"; 44 private String appkey="3cd832c411238faa1df46d532a21bfcd";
43 private String appSecret="ee7612083f63c2ce0d016c2aefd0a8d2"; 45 private String appSecret="ee7612083f63c2ce0d016c2aefd0a8d2";
44 46
47 //查封信息认证令牌
48 private String cfappkey="efd3cca4d0734cc0b99f06fbba303efb";
49 private String cfappSecret="255e3cbe16fe44c7ac9074aeff52c384";
50
45 public void send_bdcYwInfo() { 51 public void send_bdcYwInfo() {
46 List<SynZhjInfoDo> selectAllListInfo=synZhjInfoMapper.selectAllInfo(); 52 List<SynZhjInfoDo> selectAllListInfo=synZhjInfoMapper.selectAllInfo();
47 if(selectAllListInfo!=null && selectAllListInfo.size()>0){ 53 if(selectAllListInfo!=null && selectAllListInfo.size()>0){
...@@ -517,4 +523,100 @@ public class ZhjDatasSynServiceImpl extends ServiceImpl<RegBusBdcqzsdjxxMapper, ...@@ -517,4 +523,100 @@ public class ZhjDatasSynServiceImpl extends ServiceImpl<RegBusBdcqzsdjxxMapper,
517 } 523 }
518 524
519 525
526
527 /*推送查封信息*/
528 @Override
529 public void synYcfInfo() {
530 //预查封推送执行
531 new Thread(new Runnable() {
532 @Override
533 public void run() {
534 System.out.println("===============当前线程是:"+Thread.currentThread().getName());
535 synYcfBDCXX();
536 }
537 }).start();
538
539 }
540
541
542
543 /*推送查封信息*/
544 @Override
545 public void synCfInfo() {
546 //组装中小微企业基本信息
547 new Thread(new Runnable() {
548 @Override
549 public void run() {
550 System.out.println("===============当前线程是:"+Thread.currentThread().getName());
551 getCFBdcxx();
552 }
553 }).start();
554
555 }
556
557
558 //907 房屋预查封 905 房屋查封登记
559
560 public void synYcfBDCXX() {
561 List<Map> list=synZhjInfoMapper.getYCFBdcxx();
562 if(list!=null && list.size()>0) {
563 for (int j = 0; j < list.size(); j++) {
564 try {
565
566 String url=zhjurl+"/dclp/hzapi/token?appKey="+cfappkey+"&appSecret="+cfappSecret;
567 Map map1=doGetForNew(url);
568 if(map1!=null && (Integer)map1.get("code")==200) {
569 final Map map2 = (Map) map1.get("data");
570 final String token = (String) map2.get("token");
571 Map<String, String> map = list.get(j);
572 if (((String) map.get("ISCHAFENG"))!=null) {
573 if (Integer.valueOf((String) map.get("ISCHAFENG")) >= 100) {
574 map.put("ISCHAFENG", "1");
575 }
576 }
577 Map<String, String> headers = new HashMap<>();
578 headers.put("X-Access-Token", token);
579
580 String url1 = zhjurl + "/dclp/hzapi/YCFXX";
581 HttpUtil.getReturnResByUrl(url1, map, headers, "utf-8");
582 }
583 } catch (Exception ex) {
584 ex.printStackTrace();
585 }
586 }
587 }
588 }
589
590
591
592
593 public void getCFBdcxx() {
594 List<Map> list=synZhjInfoMapper.getCFBdcxx();
595 if(list!=null && list.size()>0) {
596 for (int j = 0; j < list.size(); j++) {
597 try {
598 String url=zhjurl+"/dclp/hzapi/token?appKey="+cfappkey+"&appSecret="+cfappSecret;
599 Map map1=doGetForNew(url);
600 if(map1!=null && (Integer)map1.get("code")==200) {
601 final Map map2 = (Map) map1.get("data");
602 final String token = (String) map2.get("token");
603 Map<String, String> map = list.get(j);
604 if (((String) map.get("ISCHAFENG")) != null) {
605 if (Integer.valueOf((String) map.get("ISCHAFENG")) >= 100) {
606 map.put("ISCHAFENG", "1");
607 }
608 }
609 Map<String, String> headers = new HashMap<>();
610 headers.put("X-Access-Token", token);
611
612
613 String url1 = zhjurl + "/dclp/hzapi/CFXX";
614 HttpUtil.getReturnResByUrl(url1, map, headers, "utf-8");
615 }
616 } catch (Exception ex) {
617 ex.printStackTrace();
618 }
619 }
620 }
621 }
520 } 622 }
......
1 spring: 1 spring:
2 profiles: 2 profiles:
3 active: test 3 active: dev
......
...@@ -69,4 +69,62 @@ ...@@ -69,4 +69,62 @@
69 ) 69 )
70 group by dyqr, DYQRZJH, bdcqzh, bdcdyh, QLLX, DYR, DYDJSJ 70 group by dyqr, DYQRZJH, bdcqzh, bdcdyh, QLLX, DYR, DYDJSJ
71 </select> 71 </select>
72
73
74 <select id="getYCFBdcxx" resultType="java.util.Map">
75 SELECT DISTINCT
76 q.qlrMc qlrny,
77 q.ZJH qlrsfzh,
78 a.BDCQZH bdcqzsh,
79 to_char(c.CFQSSJ,'yyyy-MM-dd HH24:mi:ss') cfrq,
80 c.CFJG cfjg,
81 c.CFWH,
82 c.BDCDYH ,to_char(c.JFDJSJ,'yyyy-MM-dd HH24:mi:ss') CHAFENGTIME,
83 h.ISCHAFENG ISCHAFENG
84 FROM
85 REG_BUS_BDCQZSDJXX a,
86 reg_bus_cfdj c,
87 reg_bus_qlr q,
88 reg_base_H h
89 WHERE
90 a.ywh = c.ywh
91 AND a.BDCDYH = c.BDCDYH
92 AND a.ywh = q.ywh
93 AND a.djlx = '907'
94 AND a.DEL_FLAG = '0'
95 AND a.ISLOGOUT = '1'
96 and h.BDCDYH=a.BDCDYH
97 and to_char(c.UPDATE_DATE,'yyyy-MM-dd')= to_char(SYSDATE,'yyyy-MM-dd')
98 ORDER BY
99 cfrq ASC
100 </select>
101
102
103 <select id="getCFBdcxx" resultType="java.util.Map">
104 SELECT DISTINCT
105 q.qlrMc qlrny,
106 q.ZJH qlrsfzh,
107 a.BDCQZH bdcqzsh,
108 to_char(c.CFQSSJ,'yyyy-MM-dd HH24:mi:ss') cfrq,
109 c.CFJG cfjg,
110 c.CFWH,
111 c.BDCDYH ,to_char(c.JFDJSJ,'yyyy-MM-dd HH24:mi:ss') CHAFENGTIME,
112 h.ISCHAFENG ISCHAFENG
113 FROM
114 REG_BUS_BDCQZSDJXX a,
115 reg_bus_cfdj c,
116 reg_bus_qlr q,
117 reg_base_H h
118 WHERE
119 a.ywh = c.ywh
120 AND a.BDCDYH = c.BDCDYH
121 AND a.ywh = q.ywh
122 AND a.djlx = '905'
123 AND a.DEL_FLAG = '0'
124 AND a.ISLOGOUT = '1'
125 and h.BDCDYH=a.BDCDYH
126 and to_char(c.UPDATE_DATE,'yyyy-MM-dd')= to_char(SYSDATE,'yyyy-MM-dd')
127 ORDER BY
128 cfrq ASC
129 </select>
72 </mapper> 130 </mapper>
......