|
|
@@ -4,10 +4,18 @@ import com.chinaitop.depot.device.mapper.DSbxxsjyMapper;
|
|
4
|
4
|
import com.chinaitop.depot.device.model.DSbxxsjy;
|
|
5
|
5
|
import com.chinaitop.depot.device.model.DSbxxsjyExample;
|
|
6
|
6
|
import com.chinaitop.depot.device.service.DSblxxjyService;
|
|
|
7
|
+import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
8
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
9
|
+
|
|
|
10
|
+import org.springframework.context.annotation.Bean;
|
|
7
|
11
|
import org.springframework.stereotype.Service;
|
|
|
12
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
13
|
+import org.springframework.util.MultiValueMap;
|
|
|
14
|
+import org.springframework.web.client.RestTemplate;
|
|
8
|
15
|
|
|
9
|
16
|
import javax.annotation.Resource;
|
|
10
|
17
|
import java.util.List;
|
|
|
18
|
+import java.util.Map;
|
|
11
|
19
|
|
|
12
|
20
|
/**
|
|
13
|
21
|
* @author qingsong.han
|
|
|
@@ -18,6 +26,14 @@ import java.util.List;
|
|
18
|
26
|
public class DSblxxjyServiceImpl implements DSblxxjyService {
|
|
19
|
27
|
@Resource
|
|
20
|
28
|
private DSbxxsjyMapper sbxxsjyMapper;
|
|
|
29
|
+
|
|
|
30
|
+ @Resource
|
|
|
31
|
+ private RestTemplate restTemplate;
|
|
|
32
|
+
|
|
|
33
|
+ @Bean
|
|
|
34
|
+ public RestTemplate restTemplate() {
|
|
|
35
|
+ return new RestTemplate();
|
|
|
36
|
+ }
|
|
21
|
37
|
|
|
22
|
38
|
@Override
|
|
23
|
39
|
public List<DSbxxsjy> getList(DSbxxsjyExample example) {
|
|
|
@@ -27,6 +43,8 @@ public class DSblxxjyServiceImpl implements DSblxxjyService {
|
|
27
|
43
|
@Override
|
|
28
|
44
|
public void save(DSbxxsjy dSbxxsjy) {
|
|
29
|
45
|
sbxxsjyMapper.insert(dSbxxsjy);
|
|
|
46
|
+ this.gjjjk(dSbxxsjy.getSbbh(),"","i");
|
|
|
47
|
+
|
|
30
|
48
|
}
|
|
31
|
49
|
|
|
32
|
50
|
@Override
|
|
|
@@ -35,6 +53,8 @@ public class DSblxxjyServiceImpl implements DSblxxjyService {
|
|
35
|
53
|
DSbxxsjyExample.Criteria criteria = example.createCriteria();
|
|
36
|
54
|
criteria.andSbbhEqualTo(dSbxxsjy.getSbbh());
|
|
37
|
55
|
sbxxsjyMapper.updateByExampleSelective(dSbxxsjy,example);
|
|
|
56
|
+
|
|
|
57
|
+ this.gjjjk(dSbxxsjy.getSbbh(),"","u");
|
|
38
|
58
|
}
|
|
39
|
59
|
|
|
40
|
60
|
@Override
|
|
|
@@ -44,5 +64,42 @@ public class DSblxxjyServiceImpl implements DSblxxjyService {
|
|
44
|
64
|
criteria.andSbbhEqualTo(sbbh);
|
|
45
|
65
|
criteria.andSzdwdmEqualTo(s);
|
|
46
|
66
|
sbxxsjyMapper.deleteByExample(example);
|
|
|
67
|
+
|
|
|
68
|
+ this.gjjjk(sbbh,s,"d");
|
|
|
69
|
+
|
|
|
70
|
+ }
|
|
|
71
|
+
|
|
|
72
|
+
|
|
|
73
|
+ /**
|
|
|
74
|
+ * 国家局数据
|
|
|
75
|
+ */
|
|
|
76
|
+ public void gjjjk(String sbbh, String orgId,String czbz) {
|
|
|
77
|
+
|
|
|
78
|
+ Map<String, Object> gjjMap = sbxxsjyMapper.getSbGjjDate(sbbh);
|
|
|
79
|
+ gjjMap.put("czbz",czbz);
|
|
|
80
|
+ gjjMap.put("is_upload", 0);
|
|
|
81
|
+ String tableName = "ODS_UP_SBXXJK";
|
|
|
82
|
+
|
|
|
83
|
+ /**
|
|
|
84
|
+ * restTemplate调用
|
|
|
85
|
+ */
|
|
|
86
|
+ String url = "http://localhost:9022/recPublish/sendMessage";//
|
|
|
87
|
+ // 发送post请求,并打印结果,以String类型接收响应结果JSON字符串
|
|
|
88
|
+ MultiValueMap<String, Object> sendMap = new LinkedMultiValueMap<>();
|
|
|
89
|
+ //Map<String, Object> sendMap = new HashMap<String, Object>();
|
|
|
90
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
91
|
+ String jsonMap;
|
|
|
92
|
+ try {
|
|
|
93
|
+ jsonMap = objectMapper.writeValueAsString(gjjMap);
|
|
|
94
|
+ sendMap.add("gjjMapJson",jsonMap);
|
|
|
95
|
+ } catch (JsonProcessingException e) {
|
|
|
96
|
+ // TODO Auto-generated catch block
|
|
|
97
|
+ e.printStackTrace();
|
|
|
98
|
+ }
|
|
|
99
|
+ sendMap.add("tableName", tableName);
|
|
|
100
|
+ //sendMap.add("orgId",111);
|
|
|
101
|
+
|
|
|
102
|
+ String result = (String) restTemplate.postForObject(url, sendMap, String.class);
|
|
47
|
103
|
}
|
|
|
104
|
+
|
|
48
|
105
|
}
|