7c48c5286fc87a51b4ec9eb89bf78ecdf5baa944.svn-base
9.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
package com.thinkgem.jeesite.modules.reg.web.httprest.httpRestController;
import java.io.File;
import java.io.InputStreamReader;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FileUtils;
import org.codehaus.jackson.JsonParser.Feature;
import org.codehaus.jackson.map.ObjectMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.bitservice.adi.WSEndpointServiceLocator;
import com.bitservice.adi.WSService;
import com.google.common.collect.Maps;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.mapper.JsonMapper;
import com.thinkgem.jeesite.common.service.ServiceException;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.act.web.ActTaskController;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusSlsq;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseHService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusRightsService;
import com.thinkgem.jeesite.modules.reg.service.bus.RegBusSlsqService;
import com.thinkgem.jeesite.modules.reg.service.qjxt.InterfacelogService;
import com.thinkgem.jeesite.modules.reg.utils.Base64;
import com.thinkgem.jeesite.modules.reg.web.bus.registlog.JrrzService;
import com.thinkgem.jeesite.modules.reg.web.bus.registlog.JrrzServiceService;
import com.thinkgem.jeesite.modules.reg.web.httprest.httpRestService.HttpRestToService;
import com.thinkgem.jeesite.modules.reg.web.httprest.utils.DatatypeUtil;
/**
* 一窗受理接口类
* @author LENOVO
*2018-11-10
*/
@Controller
@RequestMapping(value="/rest/v1.0")
public class HttpRestTest extends BaseController{
protected Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private RegBaseHService regBaseHService;
@Autowired
private RegBusRightsService regBusRightsService;
@Autowired
private HttpRestToService httpresttoservice;
@Autowired
private InterfacelogService interfacelogService;
@Autowired
private ActTaskController actTaskController;
@Autowired
private HttpRestPush restPush;
/**
* 日志上报
* @param request
* @param response
* @param handler
* @return
* @throws Exception
*/
@RequestMapping(value = "/bdcrzsb/rzsb", method = RequestMethod.POST)
public void rzsb(HttpServletRequest request,HttpServletResponse response) throws Exception{
String msg = "";
try{
String jsonstr = DatatypeUtil.reqReceive(request);
logger.info("传入参数{}",jsonstr);
//日期
Date date = new Date();
SimpleDateFormat myFmt = new SimpleDateFormat("yyyyMMdd");
String accessDate = myFmt.format(date);
System.out.println("开始发送"+"********");
JrrzServiceService jrrzsservice = new JrrzServiceService();
JrrzService jrrzsb = jrrzsservice.getJrrzServicePort();
msg = jrrzsb.exchangeInfo(jsonstr.toString());
System.out.println("结束发送"+"********");
String filePath=Global.getUserfilesBaseDir() + Global.LOGBOOK_URL+accessDate+System.currentTimeMillis()+".txt";
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
FileUtils.writeStringToFile(new File(filePath), jsonstr.toString()+"\n"+msg+"\n"+"当前上报日志日期为:"+df.format(new Date())+",返回结果为:"+msg, "UTF-8");
} catch (Exception e) {
System.out.println("日志上报失败 :"+e.getMessage());
logger.error(DatatypeUtil.errorTrackSpace(e));
}
renderString(response, msg);
}
/**
* 测试方法 登记缮证登薄后将该不动产单元状态推送给一窗
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(value = "/ycsl/dbxx", method = RequestMethod.POST)
public void dbxx(HttpServletRequest request,HttpServletResponse response) throws Exception{
String url = "http://" + request.getServerName() //服务器地址
+ ":"+ request.getServerPort() //端口号
+ request.getContextPath() //项目名称
+ request.getServletPath(); //请求页面或其他地址
Map resmap = Maps.newHashMap();
Map head = Maps.newHashMap();
Map data = Maps.newHashMap();
String jsonstr = "";
Exception exception = null;
try{
jsonstr = DatatypeUtil.reqReceive(request);
logger.info("传入参数{}",jsonstr);
head.put("regionCode", "0000");
head.put("msg", "成功");
}catch(ServiceException s){
head.put("regionCode", "1000");
head.put("msg", "业务错误,"+s.getMessage());
exception = s;
s.printStackTrace();
}catch(Exception e){
head.put("regionCode", "2000");
head.put("msg", "代码未知错误");
exception = e;
e.printStackTrace();
}finally {
resmap.put("head", head);
resmap.put("data", data);
}
interfacelogService.saveUsByProperty(url, "一窗受理", jsonstr, JsonMapper.toJsonString(resmap), exception);
renderString(response, resmap);
}
/**
* 测试方法 获取业务办理状态接口
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(value = "/ycsl/getywzt", method = RequestMethod.POST)
public void getywzt(HttpServletRequest request,HttpServletResponse response) throws Exception{
String url = "http://" + request.getServerName() //服务器地址
+ ":"+ request.getServerPort() //端口号
+ request.getContextPath() //项目名称
+ request.getServletPath(); //请求页面或其他地址
Map resmap = Maps.newHashMap();
Map head = Maps.newHashMap();
Map data = Maps.newHashMap();
String jsonstr = "";
Exception exception = null;
try{
jsonstr = DatatypeUtil.reqReceive(request);
logger.info("传入参数{}",jsonstr);
head.put("regionCode", "0000");
head.put("msg", "成功");
}catch(ServiceException s){
head.put("regionCode", "1000");
head.put("msg", "业务错误,"+s.getMessage());
exception = s;
s.printStackTrace();
}catch(Exception e){
head.put("regionCode", "2000");
head.put("msg", "代码未知错误");
exception = e;
e.printStackTrace();
}finally {
resmap.put("head", head);
resmap.put("data", data);
}
interfacelogService.saveUsByProperty(url, "一窗受理", jsonstr, JsonMapper.toJsonString(resmap), exception);
renderString(response, resmap);
}
/**
* 测试方法 获取业务办理状态接口
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(value = "/ycsl/gettoken", method = RequestMethod.POST)
public void gettoken(HttpServletRequest request,HttpServletResponse response) throws Exception{
String url = "http://" + request.getServerName() //服务器地址
+ ":"+ request.getServerPort() //端口号
+ request.getContextPath() //项目名称
+ request.getServletPath(); //请求页面或其他地址
Map resmap = Maps.newHashMap();
Map head = Maps.newHashMap();
Map data = Maps.newHashMap();
String jsonstr = "";
Exception exception = null;
head.put("regionCode", "");
head.put("orgid", "");
try{
jsonstr = DatatypeUtil.reqReceive(request);
logger.info("传入参数{}",jsonstr);
head.put("statusCode", "0000");
head.put("msg", "成功");
data.put("token", UUID.randomUUID().toString());
}catch(ServiceException s){
head.put("statusCode", "1000");
head.put("msg", "业务错误,"+s.getMessage());
exception = s;
s.printStackTrace();
}catch(Exception e){
head.put("statusCode", "2000");
head.put("msg", "代码未知错误");
exception = e;
e.printStackTrace();
}finally {
resmap.put("head", head);
resmap.put("data", data);
}
interfacelogService.saveUsByProperty(url, "一窗受理", jsonstr, JsonMapper.toJsonString(resmap), exception);
renderString(response, resmap);
}
/**
* 测试方法 接口主要用于登记系退件情况,登记发现业务内容有错误,发起退件请求,一窗进行响应,并进行退件逻辑处理
* @param request
* @param response
* @throws Exception
*/
@RequestMapping(value = "/ycsl/sjth", method = RequestMethod.POST)
public void sjth(HttpServletRequest request,HttpServletResponse response) throws Exception{
String url = "http://" + request.getServerName() //服务器地址
+ ":"+ request.getServerPort() //端口号
+ request.getContextPath() //项目名称
+ request.getServletPath(); //请求页面或其他地址
Map resmap = Maps.newHashMap();
Map head = Maps.newHashMap();
Map data = Maps.newHashMap();
String jsonstr = "";
Exception exception = null;
try{
jsonstr = DatatypeUtil.reqReceive(request);
logger.info("传入参数{}",jsonstr);
head.put("regionCode", "0000");
head.put("msg", "成功");
}catch(ServiceException s){
head.put("regionCode", "1000");
head.put("msg", "业务错误,"+s.getMessage());
exception = s;
s.printStackTrace();
}catch(Exception e){
head.put("regionCode", "2000");
head.put("msg", "代码未知错误");
exception = e;
e.printStackTrace();
}finally {
resmap.put("head", head);
resmap.put("data", data);
}
interfacelogService.saveUsByProperty(url, "一窗受理", jsonstr, JsonMapper.toJsonString(resmap), exception);
renderString(response, resmap);
}
}