parent
f0ea222f9b
commit
d6c10e03be
@ -0,0 +1,53 @@ |
|||||||
|
package com.bellmann.common.util; |
||||||
|
|
||||||
|
public class HttpClientResult { |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 响应状态码 |
||||||
|
*/ |
||||||
|
private int code; |
||||||
|
|
||||||
|
/** |
||||||
|
* 响应数据 |
||||||
|
*/ |
||||||
|
private String content; |
||||||
|
|
||||||
|
|
||||||
|
public HttpClientResult(){ |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
public HttpClientResult(int code){ |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public HttpClientResult(Integer code, String content){ |
||||||
|
this.code= code; |
||||||
|
this.content = content; |
||||||
|
} |
||||||
|
|
||||||
|
public int getCode() { |
||||||
|
return code; |
||||||
|
} |
||||||
|
|
||||||
|
public void setCode(int code) { |
||||||
|
this.code = code; |
||||||
|
} |
||||||
|
|
||||||
|
public String getContent() { |
||||||
|
return content; |
||||||
|
} |
||||||
|
|
||||||
|
public void setContent(String content) { |
||||||
|
this.content = content; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public String toString() { |
||||||
|
return "HttpClientResult{" + |
||||||
|
"code=" + code + |
||||||
|
", content='" + content + '\'' + |
||||||
|
'}'; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,508 @@ |
|||||||
|
package com.bellmann.common.util; |
||||||
|
|
||||||
|
|
||||||
|
import org.apache.http.HttpEntity; |
||||||
|
import org.apache.http.HttpHost; |
||||||
|
import org.apache.http.HttpStatus; |
||||||
|
import org.apache.http.NameValuePair; |
||||||
|
import org.apache.http.client.config.RequestConfig; |
||||||
|
import org.apache.http.client.entity.UrlEncodedFormEntity; |
||||||
|
import org.apache.http.client.methods.*; |
||||||
|
import org.apache.http.client.utils.URIBuilder; |
||||||
|
import org.apache.http.entity.StringEntity; |
||||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||||
|
import org.apache.http.impl.client.HttpClients; |
||||||
|
import org.apache.http.message.BasicNameValuePair; |
||||||
|
import org.apache.http.util.EntityUtils; |
||||||
|
|
||||||
|
import java.io.IOException; |
||||||
|
import java.io.UnsupportedEncodingException; |
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
public class HttpClientUtil { |
||||||
|
|
||||||
|
|
||||||
|
// 编码格式。发送编码格式统一用UTF-8
|
||||||
|
private static final String ENCODING = "UTF-8"; |
||||||
|
|
||||||
|
// 设置连接超时时间,单位毫秒。
|
||||||
|
private static final int CONNECT_TIMEOUT = 6000; |
||||||
|
|
||||||
|
// 请求获取数据的超时时间(即响应时间),单位毫秒。
|
||||||
|
private static final int SOCKET_TIMEOUT = 6000; |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送get请求;不带请求头和请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doGet(String url) throws Exception { |
||||||
|
return doGet(url, null, null); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送get请求;带请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @param params 请求参数集合 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doGet(String url, Map<String, String> params) throws Exception { |
||||||
|
return doGet(url, null, params); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送get请求;带请求头和请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @param headers 请求头集合 |
||||||
|
* @param params 请求参数集合 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doGet(String url, Map<String, String> headers, Map<String, String> params) throws Exception { |
||||||
|
// 创建httpClient对象
|
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
|
||||||
|
// 创建访问的地址
|
||||||
|
URIBuilder uriBuilder = new URIBuilder(url); |
||||||
|
if (params != null) { |
||||||
|
Set<Map.Entry<String, String>> entrySet = params.entrySet(); |
||||||
|
for (Map.Entry<String, String> entry : entrySet) { |
||||||
|
uriBuilder.setParameter(entry.getKey(), entry.getValue()); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 创建http对象
|
||||||
|
HttpGet httpGet = new HttpGet(uriBuilder.build()); |
||||||
|
/** |
||||||
|
* setConnectTimeout:设置连接超时时间,单位毫秒。 |
||||||
|
* setConnectionRequestTimeout:设置从connect Manager(连接池)获取Connection |
||||||
|
* 超时时间,单位毫秒。这个属性是新加的属性,因为目前版本是可以共享连接池的。 |
||||||
|
* setSocketTimeout:请求获取数据的超时时间(即响应时间),单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。 |
||||||
|
*/ |
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build(); |
||||||
|
httpGet.setConfig(requestConfig); |
||||||
|
|
||||||
|
// 设置请求头
|
||||||
|
packageHeader(headers, httpGet); |
||||||
|
|
||||||
|
// 创建httpResponse对象
|
||||||
|
CloseableHttpResponse httpResponse = null; |
||||||
|
|
||||||
|
try { |
||||||
|
// 执行请求并获得响应结果
|
||||||
|
return getHttpClientResult(httpResponse, httpClient, httpGet); |
||||||
|
} finally { |
||||||
|
// 释放资源
|
||||||
|
release(httpResponse, httpClient); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送post请求;不带请求头和请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
// public static HttpClientResult doPost(String url) throws Exception {
|
||||||
|
// return doPost(url, null, null, null);
|
||||||
|
// }
|
||||||
|
|
||||||
|
/** |
||||||
|
* 发送post请求;带请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @param params 参数集合 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doPost(String url, Map<String, String> params, HttpHost proxy) throws Exception { |
||||||
|
return doPost(url, null, params, proxy); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送post请求;带请求头和请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @param headers 请求头集合 |
||||||
|
* @param params 请求参数集合 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doPost(String url, Map<String, String> headers, Map<String, String> params, HttpHost proxy) throws Exception { |
||||||
|
// 创建httpClient对象
|
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
|
||||||
|
// 创建http对象
|
||||||
|
HttpPost httpPost = new HttpPost(url); |
||||||
|
/** |
||||||
|
* setConnectTimeout:设置连接超时时间,单位毫秒。 |
||||||
|
* setConnectionRequestTimeout:设置从connect Manager(连接池)获取Connection |
||||||
|
* 超时时间,单位毫秒。这个属性是新加的属性,因为目前版本是可以共享连接池的。 |
||||||
|
* setSocketTimeout:请求获取数据的超时时间(即响应时间),单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。 |
||||||
|
*/ |
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT). |
||||||
|
setSocketTimeout(SOCKET_TIMEOUT).setProxy(proxy). |
||||||
|
build(); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
// 设置请求头
|
||||||
|
/*httpPost.setHeader("Cookie", ""); |
||||||
|
httpPost.setHeader("Connection", "keep-alive"); |
||||||
|
httpPost.setHeader("Accept", "application/json"); |
||||||
|
httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9"); |
||||||
|
httpPost.setHeader("Accept-Encoding", "gzip, deflate, br"); |
||||||
|
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");*/ |
||||||
|
packageHeader(headers, httpPost); |
||||||
|
|
||||||
|
// 封装请求参数
|
||||||
|
packageParam(params, httpPost); |
||||||
|
|
||||||
|
// 创建httpResponse对象
|
||||||
|
CloseableHttpResponse httpResponse = null; |
||||||
|
|
||||||
|
try { |
||||||
|
// 执行请求并获得响应结果
|
||||||
|
return getHttpClientResult(httpResponse, httpClient, httpPost); |
||||||
|
} finally { |
||||||
|
// 释放资源
|
||||||
|
release(httpResponse, httpClient); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* http请求 json格式参数 |
||||||
|
* @param url |
||||||
|
* @param headers |
||||||
|
* @param params |
||||||
|
* @param proxy |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doPost(String url, Map<String, String> headers, String params, HttpHost proxy) throws Exception { |
||||||
|
// 创建httpClient对象
|
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
|
||||||
|
// 创建http对象
|
||||||
|
HttpPost httpPost = new HttpPost(url); |
||||||
|
/** |
||||||
|
* setConnectTimeout:设置连接超时时间,单位毫秒。 |
||||||
|
* setConnectionRequestTimeout:设置从connect Manager(连接池)获取Connection |
||||||
|
* 超时时间,单位毫秒。这个属性是新加的属性,因为目前版本是可以共享连接池的。 |
||||||
|
* setSocketTimeout:请求获取数据的超时时间(即响应时间),单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。 |
||||||
|
*/ |
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT). |
||||||
|
setSocketTimeout(SOCKET_TIMEOUT).setProxy(proxy). |
||||||
|
build(); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
// 设置请求头
|
||||||
|
/*httpPost.setHeader("Cookie", ""); |
||||||
|
httpPost.setHeader("Connection", "keep-alive"); |
||||||
|
httpPost.setHeader("Accept", "application/json"); |
||||||
|
httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9"); |
||||||
|
httpPost.setHeader("Accept-Encoding", "gzip, deflate, br"); |
||||||
|
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");*/ |
||||||
|
packageHeader(headers, httpPost); |
||||||
|
|
||||||
|
// 封装请求参数
|
||||||
|
packageJsonParam(params, httpPost); |
||||||
|
|
||||||
|
// 创建httpResponse对象
|
||||||
|
CloseableHttpResponse httpResponse = null; |
||||||
|
|
||||||
|
try { |
||||||
|
// 执行请求并获得响应结果
|
||||||
|
return getHttpClientResult(httpResponse, httpClient, httpPost); |
||||||
|
} finally { |
||||||
|
// 释放资源
|
||||||
|
release(httpResponse, httpClient); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static HttpClientResult doPost(String url, String params, HttpHost proxy) throws Exception { |
||||||
|
// 创建httpClient对象
|
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
|
||||||
|
// 创建http对象
|
||||||
|
HttpPost httpPost = new HttpPost(url); |
||||||
|
/** |
||||||
|
* setConnectTimeout:设置连接超时时间,单位毫秒。 |
||||||
|
* setConnectionRequestTimeout:设置从connect Manager(连接池)获取Connection |
||||||
|
* 超时时间,单位毫秒。这个属性是新加的属性,因为目前版本是可以共享连接池的。 |
||||||
|
* setSocketTimeout:请求获取数据的超时时间(即响应时间),单位毫秒。 如果访问一个接口,多少时间内无法返回数据,就直接放弃此次调用。 |
||||||
|
*/ |
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT). |
||||||
|
setSocketTimeout(SOCKET_TIMEOUT).setProxy(proxy). |
||||||
|
build(); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
// 设置请求头
|
||||||
|
/*httpPost.setHeader("Cookie", ""); |
||||||
|
httpPost.setHeader("Connection", "keep-alive"); |
||||||
|
httpPost.setHeader("Accept", "application/json"); |
||||||
|
httpPost.setHeader("Accept-Language", "zh-CN,zh;q=0.9"); |
||||||
|
httpPost.setHeader("Accept-Encoding", "gzip, deflate, br"); |
||||||
|
httpPost.setHeader("User-Agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36");*/ |
||||||
|
//packageHeader(headers, httpPost);
|
||||||
|
|
||||||
|
// 封装请求参数
|
||||||
|
packageJsonParam(params, httpPost); |
||||||
|
|
||||||
|
// 创建httpResponse对象
|
||||||
|
CloseableHttpResponse httpResponse = null; |
||||||
|
|
||||||
|
try { |
||||||
|
// 执行请求并获得响应结果
|
||||||
|
return getHttpClientResult(httpResponse, httpClient, httpPost); |
||||||
|
} finally { |
||||||
|
// 释放资源
|
||||||
|
release(httpResponse, httpClient); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
public static String doPost(String url, String params){ |
||||||
|
CloseableHttpClient httpclient = HttpClients.createDefault(); |
||||||
|
HttpPost httpPost = new HttpPost(url); |
||||||
|
RequestConfig requestConfig = RequestConfig.custom() |
||||||
|
.setConnectTimeout(2000).setConnectionRequestTimeout(1000) |
||||||
|
.setSocketTimeout(2000).build(); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
httpPost.setHeader("Content-Type", "application/json;charset=UTF-8"); |
||||||
|
String charSet = "UTF-8"; |
||||||
|
StringEntity entity = new StringEntity(params, charSet); |
||||||
|
httpPost.setEntity(entity); |
||||||
|
CloseableHttpResponse response = null; |
||||||
|
try { |
||||||
|
response = httpclient.execute(httpPost); |
||||||
|
int statusCode = response.getStatusLine().getStatusCode(); |
||||||
|
if (statusCode == HttpStatus.SC_OK) { |
||||||
|
HttpEntity responseEntity = response.getEntity(); |
||||||
|
String jsonString = EntityUtils.toString(responseEntity); |
||||||
|
return new String(jsonString.getBytes("ISO-8859-1"),"utf-8"); |
||||||
|
}else{ |
||||||
|
System.out.println("httpUtils doGet error ,code :" + statusCode); |
||||||
|
} |
||||||
|
}catch(Exception e){ |
||||||
|
System.out.println("httpUtils doPost error"+e); |
||||||
|
return null; |
||||||
|
} finally { |
||||||
|
try { |
||||||
|
if (response != null) { |
||||||
|
response.close(); |
||||||
|
} |
||||||
|
httpclient.close(); |
||||||
|
} catch (IOException e) { |
||||||
|
System.out.println(e.getMessage()); |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送put请求;不带请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doPut(String url) throws Exception { |
||||||
|
return doPut(url); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送put请求;带请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @param params 参数集合 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doPut(String url, Map<String, String> params) throws Exception { |
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
HttpPut httpPut = new HttpPut(url); |
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build(); |
||||||
|
httpPut.setConfig(requestConfig); |
||||||
|
|
||||||
|
packageParam(params, httpPut); |
||||||
|
|
||||||
|
CloseableHttpResponse httpResponse = null; |
||||||
|
|
||||||
|
try { |
||||||
|
return getHttpClientResult(httpResponse, httpClient, httpPut); |
||||||
|
} finally { |
||||||
|
release(httpResponse, httpClient); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送delete请求;不带请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doDelete(String url) throws Exception { |
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
HttpDelete httpDelete = new HttpDelete(url); |
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(CONNECT_TIMEOUT).setSocketTimeout(SOCKET_TIMEOUT).build(); |
||||||
|
httpDelete.setConfig(requestConfig); |
||||||
|
|
||||||
|
CloseableHttpResponse httpResponse = null; |
||||||
|
try { |
||||||
|
return getHttpClientResult(httpResponse, httpClient, httpDelete); |
||||||
|
} finally { |
||||||
|
release(httpResponse, httpClient); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 发送delete请求;带请求参数 |
||||||
|
* |
||||||
|
* @param url 请求地址 |
||||||
|
* @param params 参数集合 |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult doDelete(String url, Map<String, String> params) throws Exception { |
||||||
|
if (params == null) { |
||||||
|
params = new HashMap<String, String>(); |
||||||
|
} |
||||||
|
|
||||||
|
params.put("_method", "delete"); |
||||||
|
return doPost(url, params, null); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Description: 封装请求头 |
||||||
|
* |
||||||
|
* @param params |
||||||
|
* @param httpMethod |
||||||
|
*/ |
||||||
|
public static void packageHeader(Map<String, String> params, HttpRequestBase httpMethod) { |
||||||
|
// 封装请求头
|
||||||
|
if (params != null) { |
||||||
|
Set<Map.Entry<String, String>> entrySet = params.entrySet(); |
||||||
|
for (Map.Entry<String, String> entry : entrySet) { |
||||||
|
// 设置到请求头到HttpRequestBase对象中
|
||||||
|
httpMethod.setHeader(entry.getKey(), entry.getValue()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Description: 封装请求参数 |
||||||
|
* |
||||||
|
* @param params |
||||||
|
* @param httpMethod |
||||||
|
* @throws UnsupportedEncodingException |
||||||
|
*/ |
||||||
|
public static void packageParam(Map<String, String> params, HttpEntityEnclosingRequestBase httpMethod) |
||||||
|
throws UnsupportedEncodingException { |
||||||
|
// 封装请求参数
|
||||||
|
if (params != null) { |
||||||
|
List<NameValuePair> nvps = new ArrayList<NameValuePair>(); |
||||||
|
Set<Map.Entry<String, String>> entrySet = params.entrySet(); |
||||||
|
for (Map.Entry<String, String> entry : entrySet) { |
||||||
|
nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); |
||||||
|
} |
||||||
|
|
||||||
|
// 设置到请求的http对象中
|
||||||
|
httpMethod.setEntity(new UrlEncodedFormEntity(nvps, ENCODING)); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 封装json请求参数 |
||||||
|
* @param params |
||||||
|
* @param httpMethod |
||||||
|
* @throws UnsupportedEncodingException |
||||||
|
*/ |
||||||
|
public static void packageJsonParam(String params, HttpEntityEnclosingRequestBase httpMethod) |
||||||
|
throws UnsupportedEncodingException { |
||||||
|
// 封装请求参数
|
||||||
|
if (params != null) { |
||||||
|
|
||||||
|
|
||||||
|
// 设置到请求的http对象中
|
||||||
|
|
||||||
|
StringEntity entity = new StringEntity(params, "UTF-8"); |
||||||
|
httpMethod.setEntity(entity); |
||||||
|
//httpMethod.setEntity(params);
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Description: 获得响应结果 |
||||||
|
* |
||||||
|
* @param httpResponse |
||||||
|
* @param httpClient |
||||||
|
* @param httpMethod |
||||||
|
* @return |
||||||
|
* @throws Exception |
||||||
|
*/ |
||||||
|
public static HttpClientResult getHttpClientResult(CloseableHttpResponse httpResponse, |
||||||
|
CloseableHttpClient httpClient, HttpRequestBase httpMethod) throws Exception { |
||||||
|
// 执行请求
|
||||||
|
httpResponse = httpClient.execute(httpMethod); |
||||||
|
|
||||||
|
// 获取返回结果
|
||||||
|
if (httpResponse != null && httpResponse.getStatusLine() != null) { |
||||||
|
String content = ""; |
||||||
|
if (httpResponse.getEntity() != null) { |
||||||
|
content = EntityUtils.toString(httpResponse.getEntity(), ENCODING); |
||||||
|
} |
||||||
|
return new HttpClientResult(httpResponse.getStatusLine().getStatusCode(), content); |
||||||
|
} |
||||||
|
return new HttpClientResult(HttpStatus.SC_INTERNAL_SERVER_ERROR); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* Description: 释放资源 |
||||||
|
* |
||||||
|
* @param httpResponse |
||||||
|
* @param httpClient |
||||||
|
* @throws IOException |
||||||
|
*/ |
||||||
|
public static void release(CloseableHttpResponse httpResponse, CloseableHttpClient httpClient) throws IOException { |
||||||
|
// 释放资源
|
||||||
|
if (httpResponse != null) { |
||||||
|
httpResponse.close(); |
||||||
|
} |
||||||
|
if (httpClient != null) { |
||||||
|
httpClient.close(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* Description: 封装请求参数 |
||||||
|
* |
||||||
|
* @param params |
||||||
|
* @param httpMethod |
||||||
|
* @throws UnsupportedEncodingException |
||||||
|
*/ |
||||||
|
// public static void packageParam(Map<String, Object> params, HttpEntityEnclosingRequestBase httpMethod)
|
||||||
|
// throws UnsupportedEncodingException {
|
||||||
|
// // 封装请求参数
|
||||||
|
// if (params != null) {
|
||||||
|
// List<NameValuePair> nvps = new ArrayList<NameValuePair>();
|
||||||
|
// Set<Map.Entry<String, Object>> entrySet = params.entrySet();
|
||||||
|
// for (Map.Entry<String, Object> entry : entrySet) {
|
||||||
|
// nvps.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// // 设置到请求的http对象中
|
||||||
|
// httpMethod.setEntity(new UrlEncodedFormEntity(nvps, ENCODING));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,111 @@ |
|||||||
|
package com.bellmann.common.util; |
||||||
|
|
||||||
|
import com.bellmann.model.bo.OrderTempBO; |
||||||
|
import com.zznode.itms.idl.order.OrderInfoStruct; |
||||||
|
import com.zznode.itms.idl.order.OrderServiceStruct; |
||||||
|
import com.zznode.itms.idl.order.OrderType; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* |
||||||
|
* @author |
||||||
|
* |
||||||
|
*/ |
||||||
|
public class OrderUtils { |
||||||
|
|
||||||
|
|
||||||
|
static String orderFinishedPattern = "<?xml version=\"1.0\" encoding=\"GBK\"?>\r\n" + |
||||||
|
"<itms_97_interface>\r\n" + |
||||||
|
" <Order_Remark>SG</Order_Remark> \r\n"+ |
||||||
|
" <Device_WAN>%s</Device_WAN> \r\n" + |
||||||
|
" <Service_code>%s</Service_code> \r\n" + |
||||||
|
" <Order_Type>%s</Order_Type> \r\n " + |
||||||
|
" <itms_97_info> \r\n" + |
||||||
|
" <Order_No>1</Order_No> \r\n" + |
||||||
|
" <Order_LSH>%s</Order_LSH> \r\n" + |
||||||
|
" <Order_Time>%s</Order_Time> \r\n" + |
||||||
|
" <Order_Self>1</Order_Self> \r\n" + |
||||||
|
" <User_Type>%s</User_Type> \r\n" + |
||||||
|
" <Device_ID /> \r\n" + |
||||||
|
" <Ad_account>%s</Ad_account> \r\n" + |
||||||
|
" <User_name>%s</User_name> \r\n" + |
||||||
|
" <User_address>%s</User_address> \r\n" + |
||||||
|
" <User_id>%s</User_id> \r\n" + |
||||||
|
" <Area_code>%s</Area_code> \r\n" + |
||||||
|
" <SubArea_code>%s</SubArea_code> \r\n" + |
||||||
|
" <Contact_person>%s</Contact_person> \r\n" + |
||||||
|
" <Phonenumber>%s</Phonenumber> \r\n" + |
||||||
|
" <Vector_argues> \r\n" + |
||||||
|
" %s</Vector_argues> \r\n"+ |
||||||
|
" <keep_user_info></keep_user_info> \r\n" + |
||||||
|
" </itms_97_info> \r\n" + |
||||||
|
"</itms_97_interface> \r\n" + |
||||||
|
""; |
||||||
|
|
||||||
|
public static String orderInfoStructToXml(OrderInfoStruct orderInfoStruct,String area) { |
||||||
|
|
||||||
|
String subArea = ""; |
||||||
|
if(area.indexOf("_")>0) { |
||||||
|
subArea = area.split("_")[1]; |
||||||
|
area = area.substring(0, area.indexOf("_")); |
||||||
|
} |
||||||
|
|
||||||
|
String xml = orderServiceStructToXml(orderInfoStruct.orderServiceList); |
||||||
|
|
||||||
|
return String.format(orderFinishedPattern, orderInfoStruct.remark3, orderInfoStruct.operRemark, |
||||||
|
getOrderType(orderInfoStruct.orderServiceType.value()),orderInfoStruct.receiveOrderId, orderInfoStruct.orderTime, |
||||||
|
orderInfoStruct.orderCustomerKind.value()==0 ? 1: 0, orderInfoStruct.pppoeAcount, orderInfoStruct.customerNameNew, |
||||||
|
orderInfoStruct.customerAddrNew, orderInfoStruct.userSnNo, area ,subArea ,orderInfoStruct.contactPersonNew, |
||||||
|
"/", xml); |
||||||
|
} |
||||||
|
public static String orderServiceStructToXml(OrderServiceStruct[] list) { |
||||||
|
StringBuilder sb = new StringBuilder(); |
||||||
|
for(OrderServiceStruct service: list) { |
||||||
|
sb.append("^").append(service.argsName).append("=").append(service.argsValueNew); |
||||||
|
} |
||||||
|
System.out.println(sb.substring(1)); |
||||||
|
return sb.substring(1); |
||||||
|
} |
||||||
|
private static String getOrderType(int orderType) { |
||||||
|
//OrderType orderType = null;
|
||||||
|
String result = ""; |
||||||
|
if (OrderType.ORDER_SERVICE_NEW.value() == orderType) { |
||||||
|
result = "Z"; |
||||||
|
} else if (OrderType.ORDER_SERVICE_DELETE.value() == orderType) { |
||||||
|
result = "C"; |
||||||
|
} else if (OrderType.ORDER_SERVICE_RESTORE.value() == orderType) { |
||||||
|
result = "U"; |
||||||
|
} else if (OrderType.ORDER_SERVICE_STOP.value() == orderType) { |
||||||
|
result = "T"; |
||||||
|
} else if (OrderType.ORDER_SERVICE_MODIFY.value() == orderType) { |
||||||
|
result = "X"; |
||||||
|
} |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
public static String formatOrderXml(OrderTempBO order){ |
||||||
|
Map<String, String> areaMap = getArea(order.getDomainDesc()); |
||||||
|
return String.format(orderFinishedPattern, order.getRemark3(), order.getOperateRemark(), |
||||||
|
getOrderType(Integer.parseInt(order.getOrderServiceType())), order.getReceiveOrderId(), |
||||||
|
new Date().getTime(), |
||||||
|
order.getCustomerKind() == 0 ? 1 : 0, order.getPppoe(), |
||||||
|
order.getCustomerNameNew(), order.getCustomerAddrNew(), |
||||||
|
order.getUserSnNo(), areaMap.get("area"), areaMap.get("subArea"), |
||||||
|
order.getContactPersonNew(), "0000", order.getOrderArrays()); |
||||||
|
|
||||||
|
} |
||||||
|
private static Map<String, String> getArea(String area) { |
||||||
|
Map<String,String> retMap = new HashMap<String, String>(); |
||||||
|
String subArea = ""; |
||||||
|
if(area.indexOf("_")>0) { |
||||||
|
subArea = area.split("_")[1]; |
||||||
|
area = area.substring(0, area.indexOf("_")); |
||||||
|
} |
||||||
|
retMap.put("area", area); |
||||||
|
retMap.put("subArea", subArea); |
||||||
|
return retMap; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,49 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
import cn.hutool.core.map.MapUtil; |
||||||
|
import com.bellmann.common.result.Result; |
||||||
|
import com.bellmann.model.form.AddBroadbandForm; |
||||||
|
import com.bellmann.plugin.dupsubmit.annotation.PreventDuplicateSubmit; |
||||||
|
import com.bellmann.security.util.SecurityUtils; |
||||||
|
import com.bellmann.service.BroadbandService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
@Tag(name = "30.宽带上网业务") |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/api/broadband/v1") |
||||||
|
public class BroadbandController { |
||||||
|
|
||||||
|
private final BroadbandService broadbandService; |
||||||
|
@GetMapping("/basic-info") |
||||||
|
@Operation(summary = "开通宽带业务-基本数据") |
||||||
|
public Result<Map<String, Object>> basicInfo(){ |
||||||
|
String receiveOrderId = "PXDD-"+ SecurityUtils.getUsername()+"-"+ System.currentTimeMillis(); |
||||||
|
String receiveOrderLhs = "LHS" + System.currentTimeMillis(); |
||||||
|
Map<String, Object> map = MapUtil |
||||||
|
.builder(new HashMap<String, Object>()) |
||||||
|
.put("receiveOrderId", receiveOrderId) |
||||||
|
.put("receiveOrderLhs", receiveOrderLhs) |
||||||
|
.put("systemDomain", SecurityUtils.getGroupId()) |
||||||
|
.build(); |
||||||
|
return Result.success(map); |
||||||
|
} |
||||||
|
@PostMapping("/add-broadband") |
||||||
|
@Operation(summary = "开通宽带业务") |
||||||
|
@PreventDuplicateSubmit |
||||||
|
public Result<String> addBroadband(@RequestBody AddBroadbandForm form){ |
||||||
|
return broadbandService.addBroadband(form); |
||||||
|
} |
||||||
|
@PostMapping("/update-broadband-mode") |
||||||
|
@Operation(summary = "修改上网模式") |
||||||
|
@PreventDuplicateSubmit |
||||||
|
public Result<String> updateBroadbandMode(@RequestBody AddBroadbandForm form){ |
||||||
|
return broadbandService.updateBroadbandMode(form); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.common.result.PageResult; |
||||||
|
import com.bellmann.common.result.Result; |
||||||
|
import com.bellmann.model.query.SelectQuery; |
||||||
|
import com.bellmann.model.vo.CustomTaskVO; |
||||||
|
import com.bellmann.service.CustomTaskService; |
||||||
|
import com.bellmann.service.DeviceStaticService; |
||||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 自定义任务定制 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-19 |
||||||
|
*/ |
||||||
|
@Tag(name = "29.自定义节点定制") |
||||||
|
@RestController |
||||||
|
@RequiredArgsConstructor |
||||||
|
@RequestMapping("/api/custom-task/v1") |
||||||
|
public class CustomTaskController { |
||||||
|
|
||||||
|
private final CustomTaskService customTaskService; |
||||||
|
|
||||||
|
private final DeviceStaticService deviceStaticService; |
||||||
|
|
||||||
|
@PostMapping("page") |
||||||
|
@Operation(summary = "自定义节点定制-分页数据") |
||||||
|
public PageResult<CustomTaskVO> resourcePage(@RequestBody SelectQuery query){ |
||||||
|
Page<CustomTaskVO> page = customTaskService.tablePage(query); |
||||||
|
return PageResult.success(page); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("/exe/{devId}") |
||||||
|
@Operation(summary = "自定义节点定制-分页数据") |
||||||
|
public Result<String> exeTaskByIds(@PathVariable Long devId,@RequestBody Integer[] ids){ |
||||||
|
deviceStaticService.exeCustomTaskByIds(devId,ids); |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
@ -0,0 +1,21 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/itmsOrderMerger") |
||||||
|
public class ItmsOrderMergerController { |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,21 @@ |
|||||||
|
package com.bellmann.controller; |
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
|
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 前端控制器 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/orderMergerService") |
||||||
|
public class OrderMergerServiceController { |
||||||
|
|
||||||
|
} |
||||||
|
|
@ -0,0 +1,22 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.entity.CustomTask; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import com.bellmann.model.vo.CustomTaskVO; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 自定义任务定制 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-19 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface CustomTaskMapper extends BaseMapper<CustomTask> { |
||||||
|
|
||||||
|
Page<CustomTaskVO> tablePage(Page<CustomTaskVO> page, @Param("column") String column, @Param("value") Object value); |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.bellmann.model.entity.OrderMerger; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface OrderMergerMapper extends BaseMapper<OrderMerger> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,22 @@ |
|||||||
|
package com.bellmann.mapper; |
||||||
|
|
||||||
|
import com.bellmann.model.entity.OrderMergerService; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.apache.ibatis.annotations.Mapper; |
||||||
|
import org.apache.ibatis.annotations.Param; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@Mapper |
||||||
|
public interface OrderMergerServiceMapper extends BaseMapper<OrderMergerService> { |
||||||
|
|
||||||
|
List<OrderMergerService> getPppoePasswordByLogicId(@Param("userSnNo") String userSnNo, @Param("serviceName") String serviceName); |
||||||
|
} |
@ -0,0 +1,11 @@ |
|||||||
|
package com.bellmann.model.bo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
public class OrderServiceArgsBO { |
||||||
|
|
||||||
|
private String argsName; |
||||||
|
|
||||||
|
private String argsValue; |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.bellmann.model.bo; |
||||||
|
|
||||||
|
import lombok.Builder; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Builder |
||||||
|
public class OrderTempBO { |
||||||
|
private String remark3; |
||||||
|
|
||||||
|
private String domainDesc; |
||||||
|
|
||||||
|
private String operateRemark; |
||||||
|
|
||||||
|
private String orderServiceType; |
||||||
|
|
||||||
|
private String receiveOrderId; |
||||||
|
|
||||||
|
private Integer customerKind; |
||||||
|
|
||||||
|
private String pppoe; |
||||||
|
|
||||||
|
private String customerNameNew; |
||||||
|
|
||||||
|
private String customerAddrNew; |
||||||
|
|
||||||
|
private String userSnNo; |
||||||
|
|
||||||
|
private String contactPersonNew; |
||||||
|
|
||||||
|
private String orderArrays; |
||||||
|
} |
@ -0,0 +1,45 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 自定义任务定制 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-19 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@TableName("custom_task") |
||||||
|
public class CustomTask implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@TableId(value = "task_id", type = IdType.AUTO) |
||||||
|
private Integer taskId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义任务名称 |
||||||
|
*/ |
||||||
|
private String customTaskName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 操作组件名称 |
||||||
|
*/ |
||||||
|
private String operationName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 参数,用逗号分隔 |
||||||
|
*/ |
||||||
|
private String parameters; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,98 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@TableName("itms_order_merger") |
||||||
|
public class OrderMerger implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
private Long orderId; |
||||||
|
|
||||||
|
private String receivedOrderId; |
||||||
|
|
||||||
|
private String receivedOrderLhs; |
||||||
|
|
||||||
|
private Date orderDate; |
||||||
|
|
||||||
|
private String orderServiceType; |
||||||
|
|
||||||
|
private String orderRemark; |
||||||
|
|
||||||
|
private Date orderDeadline; |
||||||
|
|
||||||
|
private String customerNameNew; |
||||||
|
|
||||||
|
private String customerNameOld; |
||||||
|
|
||||||
|
private String orderCustomerKind; |
||||||
|
|
||||||
|
private Long systemDomain; |
||||||
|
|
||||||
|
private Long corporationDomain; |
||||||
|
|
||||||
|
private String adNo; |
||||||
|
|
||||||
|
private String pppoeAccount; |
||||||
|
|
||||||
|
private String contactPersonNew; |
||||||
|
|
||||||
|
private String contactPersonOld; |
||||||
|
|
||||||
|
private Date receivedDate; |
||||||
|
|
||||||
|
private String orderStatus; |
||||||
|
|
||||||
|
private Date orderDealDate; |
||||||
|
|
||||||
|
private String orderDoneFlag; |
||||||
|
|
||||||
|
private Date orderDoneDate; |
||||||
|
|
||||||
|
private String dummyFlag; |
||||||
|
|
||||||
|
private String remark; |
||||||
|
|
||||||
|
private String devSnoOui; |
||||||
|
|
||||||
|
private String pppoePassword; |
||||||
|
|
||||||
|
private String customerAddrNew; |
||||||
|
|
||||||
|
private String customerAddrOld; |
||||||
|
|
||||||
|
private String flowType; |
||||||
|
|
||||||
|
private String userSnNo; |
||||||
|
|
||||||
|
private String userSnKey; |
||||||
|
|
||||||
|
private String uniqueUserId; |
||||||
|
|
||||||
|
private String operRemark; |
||||||
|
|
||||||
|
private String remark1; |
||||||
|
|
||||||
|
private String remark2; |
||||||
|
|
||||||
|
private String remark3; |
||||||
|
|
||||||
|
private Long lifetime; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package com.bellmann.model.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = false) |
||||||
|
@TableName("itms_order_merger_service") |
||||||
|
public class OrderMergerService implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
private Long orderId; |
||||||
|
|
||||||
|
private String service; |
||||||
|
|
||||||
|
private Long serviceId; |
||||||
|
|
||||||
|
private String serviceFlag; |
||||||
|
|
||||||
|
private String argsName; |
||||||
|
|
||||||
|
private String argsValueNew; |
||||||
|
|
||||||
|
private String argsValueOld; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package com.bellmann.model.form; |
||||||
|
|
||||||
|
import com.bellmann.model.bo.OrderServiceArgsBO; |
||||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
@Data |
||||||
|
@Schema(description = "开通宽带上网表单") |
||||||
|
public class AddBroadbandForm { |
||||||
|
|
||||||
|
private String receiveOrderId; |
||||||
|
|
||||||
|
private String receiveOrderLhs; |
||||||
|
|
||||||
|
private String operateRemark; |
||||||
|
|
||||||
|
private String orderServiceType; |
||||||
|
|
||||||
|
private String remark3; |
||||||
|
|
||||||
|
private Long systemDomain; |
||||||
|
|
||||||
|
private String adNo; |
||||||
|
|
||||||
|
private String devSnoOui; |
||||||
|
|
||||||
|
private String userSnNo; |
||||||
|
|
||||||
|
private String pppoeAccount; |
||||||
|
|
||||||
|
private String dummyFlag; |
||||||
|
|
||||||
|
private Long corporation; |
||||||
|
|
||||||
|
private String customerNameNew; |
||||||
|
|
||||||
|
private String customerAddrNew; |
||||||
|
|
||||||
|
private String contactPersonNew; |
||||||
|
|
||||||
|
private String phone; |
||||||
|
|
||||||
|
private String orderCustomerKind; |
||||||
|
|
||||||
|
private String remark; |
||||||
|
|
||||||
|
private String serviceName; |
||||||
|
|
||||||
|
private String serviceFlag; |
||||||
|
|
||||||
|
private List<OrderServiceArgsBO> list; |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.bellmann.model.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
|
||||||
|
@Data |
||||||
|
public class CustomTaskVO { |
||||||
|
|
||||||
|
private Integer taskId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 自定义任务名称 |
||||||
|
*/ |
||||||
|
private String customTaskName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 操作组件名称 |
||||||
|
*/ |
||||||
|
private String operationName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,10 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
import com.bellmann.common.result.Result; |
||||||
|
import com.bellmann.model.form.AddBroadbandForm; |
||||||
|
|
||||||
|
public interface BroadbandService { |
||||||
|
Result<String> addBroadband(AddBroadbandForm form); |
||||||
|
|
||||||
|
Result<String> updateBroadbandMode(AddBroadbandForm form); |
||||||
|
} |
@ -0,0 +1,18 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.model.query.SelectQuery; |
||||||
|
import com.bellmann.model.vo.CustomTaskVO; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 自定义任务定制 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-19 |
||||||
|
*/ |
||||||
|
public interface CustomTaskService { |
||||||
|
|
||||||
|
Page<CustomTaskVO> tablePage(SelectQuery query); |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
public interface OrderMergerService{ |
||||||
|
|
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
package com.bellmann.service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
public interface OrderMergerServiceService { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,225 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import cn.hutool.http.HttpStatus; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.bellmann.common.constant.StringUtilsConstants; |
||||||
|
import com.bellmann.common.exception.BusinessException; |
||||||
|
import com.bellmann.common.result.Result; |
||||||
|
import com.bellmann.common.result.ResultCode; |
||||||
|
import com.bellmann.common.util.CommonUtils; |
||||||
|
import com.bellmann.common.util.HttpClientResult; |
||||||
|
import com.bellmann.common.util.HttpClientUtil; |
||||||
|
import com.bellmann.common.util.OrderUtils; |
||||||
|
import com.bellmann.mapper.DomainMapper; |
||||||
|
import com.bellmann.mapper.OrderInfoMapper; |
||||||
|
import com.bellmann.mapper.OrderMergerMapper; |
||||||
|
import com.bellmann.mapper.OrderMergerServiceMapper; |
||||||
|
import com.bellmann.model.bo.OrderServiceArgsBO; |
||||||
|
import com.bellmann.model.bo.OrderTempBO; |
||||||
|
import com.bellmann.model.entity.Domain; |
||||||
|
import com.bellmann.model.entity.OrderMerger; |
||||||
|
import com.bellmann.model.entity.OrderMergerService; |
||||||
|
import com.bellmann.model.form.AddBroadbandForm; |
||||||
|
import com.bellmann.runner.UIService; |
||||||
|
import com.bellmann.service.BroadbandService; |
||||||
|
import com.zznode.itms.api.Utils; |
||||||
|
import com.zznode.itms.idl.order.*; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.*; |
||||||
|
|
||||||
|
@Service |
||||||
|
@RequiredArgsConstructor |
||||||
|
public class BroadbandServiceImpl implements BroadbandService { |
||||||
|
private final OrderInfoMapper orderInfoMapper; |
||||||
|
|
||||||
|
private final DomainMapper domainMapper; |
||||||
|
|
||||||
|
private final OrderMergerServiceMapper orderMergerServiceMapper; |
||||||
|
|
||||||
|
private final OrderMergerMapper orderMergerMapper; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Result<String> addBroadband(AddBroadbandForm form) { |
||||||
|
OrderInfoStruct orderInfoStruct = new OrderInfoStruct(); |
||||||
|
orderInfoStruct.orderId = System.currentTimeMillis(); |
||||||
|
orderInfoStruct.receiveOrderId = form.getReceiveOrderId(); //v
|
||||||
|
orderInfoStruct.receiveOrderLhs = form.getReceiveOrderLhs(); |
||||||
|
orderInfoStruct.orderTime = (new Date()).getTime(); |
||||||
|
orderInfoStruct.orderServiceType = OrderType.from_int(Integer.parseInt(form.getOrderServiceType())); |
||||||
|
orderInfoStruct.order_Status = OrderStatus.from_int(0); |
||||||
|
orderInfoStruct.order_Remark = OrderRemark.from_int(0); |
||||||
|
orderInfoStruct.orderReceiveDate = (new Date()).getTime(); |
||||||
|
String value = orderInfoMapper.getCustomerKindBySn(form.getUserSnNo()); |
||||||
|
if (StringUtils.isNotBlank(form.getUserSnNo())) { |
||||||
|
orderInfoStruct.orderCustomerKind = CustomerType.from_int(Integer.parseInt(form.getOrderCustomerKind())); |
||||||
|
} else if (StringUtils.isNotBlank(value)) { |
||||||
|
orderInfoStruct.orderCustomerKind = CustomerType.from_int(Integer.parseInt(value)); |
||||||
|
} else { |
||||||
|
throw new BusinessException(ResultCode.PLEASE_SELECT_A_CUSTOMER_TYPE); |
||||||
|
} |
||||||
|
orderInfoStruct.orderDone_Flag = OrderDoneFlag.from_int(1); |
||||||
|
orderInfoStruct.dummy_Flag = DummyFlag.from_int(Integer.parseInt(form.getDummyFlag())); |
||||||
|
orderInfoStruct.remark = CommonUtils.convertStringDefault(form.getRemark());//0
|
||||||
|
orderInfoStruct.flowType = "1"; //
|
||||||
|
|
||||||
|
orderInfoStruct.pppoePassword = ""; |
||||||
|
orderInfoStruct.customerNameNew = CommonUtils.convertStringDefault(form.getCustomerNameNew()); |
||||||
|
|
||||||
|
orderInfoStruct.customerNameOld = ""; |
||||||
|
|
||||||
|
orderInfoStruct.systemDomain = form.getSystemDomain(); |
||||||
|
if (form.getCorporation() == null) { |
||||||
|
orderInfoStruct.corpoationDomain = 0; |
||||||
|
} else { |
||||||
|
orderInfoStruct.corpoationDomain = form.getCorporation(); |
||||||
|
} |
||||||
|
orderInfoStruct.contactPersonNew = CommonUtils.convertStringDefault(form.getContactPersonNew()); |
||||||
|
|
||||||
|
|
||||||
|
orderInfoStruct.contactPersonOld = ""; |
||||||
|
|
||||||
|
orderInfoStruct.devOuiSno = Utils.convertStringNull(form.getDevSnoOui()); |
||||||
|
orderInfoStruct.customerAddrNew = CommonUtils.convertStringDefault(form.getCustomerAddrNew()); |
||||||
|
|
||||||
|
orderInfoStruct.customerAddrOld = ""; |
||||||
|
orderInfoStruct.uniqueUserId = form.getUserSnNo() + "^1600000000000"; |
||||||
|
orderInfoStruct.userSnNo = form.getUserSnNo(); |
||||||
|
|
||||||
|
orderInfoStruct.adNo = form.getUserSnNo(); |
||||||
|
orderInfoStruct.pppoeAcount = Utils.convertStringNull(form.getPppoeAccount()); |
||||||
|
orderInfoStruct.userSnKey = ""; |
||||||
|
orderInfoStruct.lifeTime = -999; |
||||||
|
orderInfoStruct.operRemark = form.getOperateRemark(); |
||||||
|
|
||||||
|
orderInfoStruct.remark1 = ""; |
||||||
|
orderInfoStruct.remark2 = ""; |
||||||
|
orderInfoStruct.remark3 = Utils.convertStringNull(form.getRemark3()); |
||||||
|
|
||||||
|
orderInfoStruct.orderServiceList = tranceOrderInfo(form.getList(), form.getUserSnNo(), form.getServiceName(), form.getServiceFlag()); |
||||||
|
|
||||||
|
HttpClientResult result = sendHttpOrder(orderInfoStruct); |
||||||
|
if (result.getCode()== HttpStatus.HTTP_OK){ |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
return Result.failed(result.getContent()); |
||||||
|
} |
||||||
|
|
||||||
|
private HttpClientResult sendHttpOrder(OrderInfoStruct orderInfoStruct) { |
||||||
|
Domain domain = domainMapper.selectOne(new LambdaQueryWrapper<Domain>() |
||||||
|
.eq(Domain::getGroupId, orderInfoStruct.systemDomain) |
||||||
|
); |
||||||
|
String xml = OrderUtils.orderInfoStructToXml(orderInfoStruct, domain.getDescription()); |
||||||
|
System.out.println(xml); |
||||||
|
String orderUrl = UIService.getNbiOrderUrl(); |
||||||
|
Map<String, String> header = new HashMap<String, String>(); |
||||||
|
header.put("content-type", "application/json"); |
||||||
|
try { |
||||||
|
return HttpClientUtil.doPost(orderUrl, header, xml, null); |
||||||
|
} catch (Exception e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
private OrderServiceStruct[] tranceOrderInfo(List<OrderServiceArgsBO> argList, String userSnNo, String servName, String servFlag) { |
||||||
|
List<OrderServiceStruct> list = new ArrayList<>(); |
||||||
|
for (OrderServiceArgsBO args : argList) { |
||||||
|
OrderServiceStruct order = new OrderServiceStruct(); |
||||||
|
order.orderServiceId = StringUtilsConstants.LONG_NULL; |
||||||
|
order.orderId = StringUtilsConstants.LONG_NULL; |
||||||
|
order.servName = Utils.convertStringNull(servName); |
||||||
|
order.servFlag = Utils.convertStringNull(servFlag); |
||||||
|
order.argsName = Utils.convertStringNull(args.getArgsName()); |
||||||
|
order.argsValueNew = Utils.convertStringNull(args.getArgsValue()); |
||||||
|
order.argsValueOld = ""; |
||||||
|
list.add(order); |
||||||
|
} |
||||||
|
OrderServiceStruct[] orderServices = new OrderServiceStruct[list.size()]; |
||||||
|
for (int i = 0; i < list.size(); i++) { |
||||||
|
orderServices[i] = list.get(i); |
||||||
|
} |
||||||
|
return orderServices; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Result<String> updateBroadbandMode(AddBroadbandForm form) { |
||||||
|
List<OrderMergerService> list = orderMergerServiceMapper.getPppoePasswordByLogicId(form.getUserSnNo(),form.getServiceName()); |
||||||
|
if (list.isEmpty()){ |
||||||
|
throw new BusinessException(ResultCode.DATA_NOT_FOUND); |
||||||
|
} |
||||||
|
String mode = ""; |
||||||
|
for (OrderServiceArgsBO args: form.getList()){ |
||||||
|
if ("rg_mode".equalsIgnoreCase(args.getArgsName())){ |
||||||
|
mode = args.getArgsValue(); |
||||||
|
break; |
||||||
|
} |
||||||
|
} |
||||||
|
String adAccount = ""; |
||||||
|
String adPassword = ""; |
||||||
|
String passRemark = ""; |
||||||
|
for (OrderMergerService mergerService: list){ |
||||||
|
if (mergerService.getArgsName().equalsIgnoreCase("ad_password")){ |
||||||
|
adPassword = mergerService.getArgsValueNew(); |
||||||
|
}else if (mergerService.getArgsName().equalsIgnoreCase("pass_remark")){ |
||||||
|
passRemark = mergerService.getArgsValueNew(); |
||||||
|
}else if (mergerService.getArgsName().equalsIgnoreCase("ad_account")){ |
||||||
|
adAccount = mergerService.getArgsValueNew(); |
||||||
|
} |
||||||
|
} |
||||||
|
String serviceArgs = "rg_mode=" + mode + |
||||||
|
"^ad_account=" + adAccount + |
||||||
|
"^ad_password=" + adPassword + |
||||||
|
"^pass_remark=" + passRemark;; |
||||||
|
|
||||||
|
Domain domain = domainMapper.selectOne(new LambdaQueryWrapper<Domain>() |
||||||
|
.eq(Domain::getGroupId, form.getSystemDomain()) |
||||||
|
); |
||||||
|
OrderTempBO build = OrderTempBO |
||||||
|
.builder() |
||||||
|
.orderArrays(serviceArgs) |
||||||
|
.pppoe(adAccount) |
||||||
|
.contactPersonNew(form.getContactPersonNew()) |
||||||
|
.domainDesc(domain.getDescription()) |
||||||
|
.customerNameNew(form.getCustomerNameNew()) |
||||||
|
.operateRemark(form.getOperateRemark()) |
||||||
|
.orderServiceType(form.getOrderServiceType()) |
||||||
|
.receiveOrderId(form.getReceiveOrderId()) |
||||||
|
.remark3(form.getRemark3()) |
||||||
|
.userSnNo(form.getUserSnNo()) |
||||||
|
.customerAddrNew(form.getCustomerAddrNew()).build(); |
||||||
|
|
||||||
|
OrderMerger orderMerger = orderMergerMapper.selectOne(new QueryWrapper<OrderMerger>() |
||||||
|
.eq("user_sn_no", form.getUserSnNo()) |
||||||
|
.select("order_customer_kind") |
||||||
|
); |
||||||
|
String orderCustomerKind = orderMerger.getOrderCustomerKind(); |
||||||
|
if (orderCustomerKind!=null){ |
||||||
|
build.setCustomerKind(Integer.valueOf(orderCustomerKind)); |
||||||
|
} |
||||||
|
String xml = OrderUtils.formatOrderXml(build); |
||||||
|
HttpClientResult result = sendOrderToStartNBI(xml); |
||||||
|
if (result.getCode()== HttpStatus.HTTP_OK){ |
||||||
|
return Result.success(); |
||||||
|
} |
||||||
|
return Result.failed(result.getContent()); |
||||||
|
} |
||||||
|
|
||||||
|
private HttpClientResult sendOrderToStartNBI(String orderXml) { |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
String orderUrl = UIService.getNbiOrderUrl(); |
||||||
|
|
||||||
|
Map<String,String> header = new HashMap<String,String>(); |
||||||
|
header.put("content-type", "application/json"); |
||||||
|
try { |
||||||
|
return HttpClientUtil.doPost(orderUrl, header,orderXml, null); |
||||||
|
} catch (Exception e) { |
||||||
|
throw new RuntimeException(e); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||||
|
import com.bellmann.mapper.CustomTaskMapper; |
||||||
|
import com.bellmann.model.query.SelectQuery; |
||||||
|
import com.bellmann.model.vo.CustomTaskVO; |
||||||
|
import com.bellmann.service.CustomTaskService; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 自定义任务定制 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-19 |
||||||
|
*/ |
||||||
|
@RequiredArgsConstructor |
||||||
|
@Service |
||||||
|
public class CustomTaskServiceImpl implements CustomTaskService { |
||||||
|
|
||||||
|
private final CustomTaskMapper customTaskMapper; |
||||||
|
@Override |
||||||
|
public Page<CustomTaskVO> tablePage(SelectQuery query) { |
||||||
|
int pageNum = query.getPageNum(); |
||||||
|
int pageSize = query.getPageSize(); |
||||||
|
Page<CustomTaskVO> page = new Page<>(pageNum,pageSize); |
||||||
|
|
||||||
|
return customTaskMapper.tablePage(page,query.getSelectName(),query.getSelectValue()); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.bellmann.service.OrderMergerService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class OrderMergerServiceImpl implements OrderMergerService { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
package com.bellmann.service.impl; |
||||||
|
|
||||||
|
import com.bellmann.service.OrderMergerServiceService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author 李小林 |
||||||
|
* @since 2024-07-24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class OrderMergerServiceServiceImpl implements OrderMergerServiceService { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,34 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.bellmann.mapper.CustomTaskMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.CustomTask"> |
||||||
|
<id column="task_id" property="taskId" /> |
||||||
|
<result column="custom_task_name" property="customTaskName" /> |
||||||
|
<result column="operation_name" property="operationName" /> |
||||||
|
<result column="parameters" property="parameters" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!-- 通用查询结果列 --> |
||||||
|
<sql id="Base_Column_List"> |
||||||
|
task_id, custom_task_name, operation_name, parameters |
||||||
|
</sql> |
||||||
|
<select id="tablePage" resultType="com.bellmann.model.vo.CustomTaskVO"> |
||||||
|
SELECT |
||||||
|
TASK_ID, |
||||||
|
CUSTOM_TASK_NAME, |
||||||
|
OPERATION_NAME, |
||||||
|
PARAMETERS |
||||||
|
FROM |
||||||
|
CUSTOM_TASK |
||||||
|
<where> |
||||||
|
<if test="column=='customTaskName' and column!=null and column!=''"> |
||||||
|
and CUSTOM_TASK_NAME = #{value} |
||||||
|
</if> |
||||||
|
<if test="column=='operationName' and column!=null and column!=''"> |
||||||
|
and OPERATION_NAME = #{value} |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
</select> |
||||||
|
</mapper> |
@ -0,0 +1,50 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.bellmann.mapper.OrderMergerMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.OrderMerger"> |
||||||
|
<id column="order_id" property="orderId" /> |
||||||
|
<result column="received_order_id" property="receivedOrderId" /> |
||||||
|
<result column="received_order_lhs" property="receivedOrderLhs" /> |
||||||
|
<result column="order_date" property="orderDate" /> |
||||||
|
<result column="order_service_type" property="orderServiceType" /> |
||||||
|
<result column="order_remark" property="orderRemark" /> |
||||||
|
<result column="order_deadline" property="orderDeadline" /> |
||||||
|
<result column="customer_name_new" property="customerNameNew" /> |
||||||
|
<result column="customer_name_old" property="customerNameOld" /> |
||||||
|
<result column="order_customer_kind" property="orderCustomerKind" /> |
||||||
|
<result column="system_domain" property="systemDomain" /> |
||||||
|
<result column="corporation_domain" property="corporationDomain" /> |
||||||
|
<result column="ad_no" property="adNo" /> |
||||||
|
<result column="pppoe_account" property="pppoeAccount" /> |
||||||
|
<result column="contact_person_new" property="contactPersonNew" /> |
||||||
|
<result column="contact_person_old" property="contactPersonOld" /> |
||||||
|
<result column="received_date" property="receivedDate" /> |
||||||
|
<result column="order_status" property="orderStatus" /> |
||||||
|
<result column="order_deal_date" property="orderDealDate" /> |
||||||
|
<result column="order_done_flag" property="orderDoneFlag" /> |
||||||
|
<result column="order_done_date" property="orderDoneDate" /> |
||||||
|
<result column="dummy_flag" property="dummyFlag" /> |
||||||
|
<result column="remark" property="remark" /> |
||||||
|
<result column="dev_sno_oui" property="devSnoOui" /> |
||||||
|
<result column="pppoe_password" property="pppoePassword" /> |
||||||
|
<result column="customer_addr_new" property="customerAddrNew" /> |
||||||
|
<result column="customer_addr_old" property="customerAddrOld" /> |
||||||
|
<result column="flow_type" property="flowType" /> |
||||||
|
<result column="user_sn_no" property="userSnNo" /> |
||||||
|
<result column="user_sn_key" property="userSnKey" /> |
||||||
|
<result column="unique_user_id" property="uniqueUserId" /> |
||||||
|
<result column="oper_remark" property="operRemark" /> |
||||||
|
<result column="remark1" property="remark1" /> |
||||||
|
<result column="remark2" property="remark2" /> |
||||||
|
<result column="remark3" property="remark3" /> |
||||||
|
<result column="lifetime" property="lifetime" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!-- 通用查询结果列 --> |
||||||
|
<sql id="Base_Column_List"> |
||||||
|
order_id, received_order_id, received_order_lhs, order_date, order_service_type, order_remark, order_deadline, customer_name_new, customer_name_old, order_customer_kind, system_domain, corporation_domain, ad_no, pppoe_account, contact_person_new, contact_person_old, received_date, order_status, order_deal_date, order_done_flag, order_done_date, dummy_flag, remark, dev_sno_oui, pppoe_password, customer_addr_new, customer_addr_old, flow_type, user_sn_no, user_sn_key, unique_user_id, oper_remark, remark1, remark2, remark3, lifetime |
||||||
|
</sql> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,31 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.bellmann.mapper.OrderMergerServiceMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="BaseResultMap" type="com.bellmann.model.entity.OrderMergerService"> |
||||||
|
<id column="order_id" property="orderId" /> |
||||||
|
<result column="service" property="service" /> |
||||||
|
<result column="service_id" property="serviceId" /> |
||||||
|
<result column="service_flag" property="serviceFlag" /> |
||||||
|
<result column="args_name" property="argsName" /> |
||||||
|
<result column="args_value_new" property="argsValueNew" /> |
||||||
|
<result column="args_value_old" property="argsValueOld" /> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
<!-- 通用查询结果列 --> |
||||||
|
<sql id="Base_Column_List"> |
||||||
|
order_id, service, service_id, service_flag, args_name, args_value_new, args_value_old |
||||||
|
</sql> |
||||||
|
|
||||||
|
<select id="getPppoePasswordByLogicId" resultType="com.bellmann.model.entity.OrderMergerService"> |
||||||
|
SELECT |
||||||
|
bb.* |
||||||
|
FROM |
||||||
|
itms_order_merger aa |
||||||
|
INNER JOIN itms_order_merger_service bb ON aa.order_id = bb.order_id |
||||||
|
WHERE |
||||||
|
aa.user_sn_no = #{userSnNo} |
||||||
|
and bb.service = #{serviceName} |
||||||
|
</select> |
||||||
|
</mapper> |
Loading…
Reference in new issue