Browse Source

Merge remote-tracking branch 'remotes/origin/dev_time_out' into dev_temp

master
jianjun 5 years ago
parent
commit
fff8c88984
  1. 46
      epmet-auth/src/test/java/com/epmet/ThirdPlatformTest.java
  2. 41
      epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java
  3. 4
      epmet-commons/epmet-commons-tools/pom.xml
  4. 33
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/HttpLogInterceptor.java
  5. 432
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/OkHttpUtil.java
  6. 64
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/SSLSocketClient.java
  7. 7
      epmet-module/epmet-ext/epmet-ext-server/pom.xml
  8. 7
      epmet-module/epmet-third/epmet-third-server/pom.xml
  9. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java
  10. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java
  11. 46
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java
  12. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java
  13. 5
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java
  14. 13
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml
  15. 11
      pom.xml

46
epmet-auth/src/test/java/com/epmet/ThirdPlatformTest.java

@ -0,0 +1,46 @@
package com.epmet;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.thirdplat.apiservice.jcet.JcetApiService;
import com.epmet.commons.thirdplat.bean.ThirdPlatUserInfo;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
/**
* descredisson测试类
*/
@Slf4j
@RunWith(value = SpringRunner.class)
@SpringBootTest(classes = {AuthApplication.class})
public class ThirdPlatformTest {
@Autowired
private JcetApiService jcetApiService;
@Test
public void t() {
String ssoTicket = "ssoTicket-5kc8FY7Re2iv7Kfq74G9EWCN7QybBjxB";
for (int i = 0; i < 50; i++) {
getUserINfoByTicket(ssoTicket);
}
}
private void getUserINfoByTicket(String ssoTicket) {
try {
ThirdPlatUserInfo cUserInfoByTicket = jcetApiService.getCUserInfoByTicket(ssoTicket);
log.info("result:{}", JSON.toJSONString(cUserInfoByTicket));
} catch (Exception e) {
log.info("失败:{}", e.getMessage());
if (e.getMessage().contains("Read timed out"))
log.info("失败了");
//break;
}
}
}

41
epmet-commons/epmet-commons-thirdplat/src/main/java/com/epmet/commons/thirdplat/apiservice/jcet/JcetApiService.java

@ -12,11 +12,13 @@ import com.epmet.commons.thirdplat.properties.JcetThirdplatProps;
import com.epmet.commons.thirdplat.properties.ThirdplatProps;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.net.OkHttpUtil;
import okhttp3.ResponseBody;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.Map;
@ -39,27 +41,44 @@ public class JcetApiService extends AbstractApiService {
* @author wxz
* @date 2021.01.19 10:26
*/
@Override
public ThirdPlatUserInfo getCUserInfoByTicket(String ticket) throws UnsupportedEncodingException {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口开始>>>>>>>>>>>>");
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{}", ticket);
SsoTicketFormDTO ssoTicket = new SsoTicketFormDTO();
ssoTicket.setSsoTicket(ticket);
String domain = jcetThirdplatCendProps.getDomain();
Result<String> result = HttpClientManager.getInstance().sendPost(
domain.concat(JcetConstants.URL_GET_USER_BY_TICKET),
domain.startsWith("https://"),
JSON.toJSONString(ssoTicket),
getHeaders(JSON.toJSONString(ssoTicket).getBytes("utf-8").length, jcetThirdplatCendProps.getAppkey(), jcetThirdplatCendProps.getAppsecret()));
String url = domain.concat(JcetConstants.URL_GET_USER_BY_TICKET);
Map<String, Object> headers = getHeaders(JSON.toJSONString(ssoTicket).getBytes(StandardCharsets.UTF_8).length, jcetThirdplatCendProps.getAppkey(), jcetThirdplatCendProps.getAppsecret());
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口入参 ticket:{},url:{},headers:{}", ticket,url,headers);
Result<String> result = null;
try {
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
//方式1
/*result = HttpClientManager.getInstance().sendPost(
url,
domain.startsWith("https://"),
JSON.toJSONString(ssoTicket),
headers);*/
//方式2
Map<String,Object> param = new HashMap<>();
param.put("ssoTicket",ticket);
headers.put("Content-Type", "application/json;charset=utf-8");
ResponseBody body = OkHttpUtil.getInstance().postData(url, param, headers).body();
if (body != null){
result = new Result<String>().ok(body.string());
}
} catch (Exception e) {
//e.printStackTrace();
logger.warn("请求酒城e通第三方平台异常", e);
}
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口结束<<<<<<<<<<<<");
logger.info("【请求酒城e通第三方平台】getUserInfoByTicket()接口返回:{}", result.getData());
JcetCUserInfoResultDTO resultDTO = parseResult(result, JcetCUserInfoResultDTO.class);

4
epmet-commons/epmet-commons-tools/pom.xml

@ -154,6 +154,10 @@
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
</dependency>
</dependencies>
<build>

33
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/HttpLogInterceptor.java

@ -0,0 +1,33 @@
package com.epmet.commons.tools.utils.net;
import lombok.extern.slf4j.Slf4j;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
/**
* desc:
*
* @author: LiuJanJun
* @date: 2021/4/16 5:02 下午
* @version: 1.0
*/
@Slf4j
class HttpLogInterceptor implements Interceptor {
@Override public Response intercept(Interceptor.Chain chain) throws IOException {
Request request = chain.request();
long t1 = System.nanoTime();
log.info(String.format("Sending request %s on %s%n%s",
request.url(), chain.connection(), request.headers()));
Response response = chain.proceed(request);
long t2 = System.nanoTime();
log.info(String.format("Received response for %s in %.1fms%n%s",
response.request().url(), (t2 - t1) / 1e6d, response.headers()));
return response;
}
}

432
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/OkHttpUtil.java

@ -0,0 +1,432 @@
package com.epmet.commons.tools.utils.net;
import okhttp3.*;
import org.apache.http.client.utils.URIBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.security.SecureRandom;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.*;
import java.util.concurrent.TimeUnit;
public class OkHttpUtil {
private static final Logger logger = LoggerFactory.getLogger(OkHttpUtil.class);
public final static int READ_TIMEOUT = 100;
public final static int CONNECT_TIMEOUT = 60;
public final static int WRITE_TIMEOUT = 60;
public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
public static final String CONTENT_TYPE = "Content-Type";
private static final byte[] LOCKER = new byte[0];
private static OkHttpUtil mInstance;
private OkHttpClient mOkHttpClient;
private OkHttpUtil() {
//todo 由于是静态工具类,只会创建client一次,如果以后需要不同请求不同超时时间,不能这样使用
okhttp3.OkHttpClient.Builder clientBuilder = new okhttp3.OkHttpClient.Builder();
//设置读取超市时间
clientBuilder.readTimeout(READ_TIMEOUT, TimeUnit.SECONDS);
//设置超时连接时间
clientBuilder.connectTimeout(CONNECT_TIMEOUT, TimeUnit.SECONDS);
//设置写入超时时间
clientBuilder.writeTimeout(WRITE_TIMEOUT, TimeUnit.SECONDS);
//支持HTTPS请求,跳过证书验证
clientBuilder.sslSocketFactory(SSLSocketClient.getSSLSocketFactory(), SSLSocketClient.getX509TrustManager())
.hostnameVerifier(SSLSocketClient.getHostnameVerifier());
//clientBuilder.sslSocketFactory(createSSLSocketFactory());
/*clientBuilder.hostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String hostname, SSLSession session) {
return true;
}
});*/
//添加拦截器
clientBuilder.addInterceptor(new HttpLogInterceptor());
mOkHttpClient = clientBuilder.build();
}
/**
* 单例模式获取NetUtils
*
* @return
*/
public static OkHttpUtil getInstance() {
if (mInstance == null) {
synchronized (LOCKER) {
if (mInstance == null) {
mInstance = new OkHttpUtil();
}
}
}
return mInstance;
}
/**
* get请求同步方式获取网络数据是在主线程中执行的需要新起线程将其放到子线程中执行
*
* @param url
* @return
*/
public Response getData(String url) {
return getData(url, null);
}
/**
* get请求同步方式获取网络数据是在主线程中执行的需要新起线程将其放到子线程中执行
*
* @param url
* @return
*/
public Response getData(String url, Map<String, Object> headerMap) {
//1 构造Request
Request.Builder builder = new Request.Builder().get().url(url);
//Request request = builder.get().url(url).build();
//builder = builder.get().url(url);
/*if (headerMap != null && headerMap.isEmpty()) {
for (Map.Entry<String, String> headerEntry : headerMap.entrySet()) {
builder.addHeader(headerEntry.getKey(), headerEntry.getValue());
}
}*/
addHeaders(headerMap,builder);
Request request = builder.build();
//2 将Request封装为Call
Call call = mOkHttpClient.newCall(request);
//3 执行Call,得到response
Response response = null;
try {
response = call.execute();
} catch (IOException e) {
e.printStackTrace();
}
return response;
}
/**
* post form表单 请求同步方式提交数据是在主线程中执行的需要新起线程将其放到子线程中执行
*
* @param url
* @param bodyParams
* @return
*/
/*public Response postFormData(String url, Map<String, String> bodyParams) {
//1构造RequestBody
RequestBody body = setRequestBody(bodyParams);
//2 构造Request
Request.Builder requestBuilder = new Request.Builder();
Request request = requestBuilder.post(body).addHeader(CONTENT_TYPE, HttpContentTypeEnum.FORM.contentTypeValue).url(url).build();
//3 将Request封装为Call
Call call = mOkHttpClient.newCall(request);
//4 执行Call,得到response
Response response = null;
try {
response = call.execute();
} catch (IOException e) {
e.printStackTrace();
}
return response;
}*/
/**
* post方式
*
* @param url 请求url
* @param bodyParams requestbody
* @param headerMap 请求头信息
* @return
* @throws IOException
*/
public Response postData(String url, Map<String, Object> bodyParams, Map<String, Object> headerMap) throws Exception {
//1构造RequestBody
RequestBody body = setRequestBody(bodyParams, headerMap);
//2 构造Request
Request.Builder requestBuilder = new Request.Builder().post(body).url(url);
//requestBuilder = requestBuilder.post(body).url(url);
addHeaders(headerMap, requestBuilder);
Request request = requestBuilder.build();
//Request request = requestBuilder.post(body).addHeader(CONTENT_TYPE, HttpContentTypeEnum.JSON.contentTypeValue).url(url).build();
//3 将Request封装为Call
Call call = mOkHttpClient.newCall(request);
//4 执行Call,得到response
Response response = null;
try {
response = call.execute();
} catch (IOException e) {
e.printStackTrace();
}
return response;
}
/**
* put请求方式
*
* @param url
* @param bodyParams
* @return
*/
public Response putData(String url, Map<String, Object> bodyParams, Map<String, Object> headerMap) throws Exception {
//1构造RequestBody
RequestBody body = setRequestBody(bodyParams, headerMap);
//2 构造Request
Request.Builder requestBuilder = new Request.Builder().put(body).url(url);
addHeaders(headerMap, requestBuilder);
Request request = requestBuilder.build();
//3 将Request封装为Call
Call call = mOkHttpClient.newCall(request);
//4 执行Call,得到response
Response response = null;
try {
response = call.execute();
} catch (IOException e) {
e.printStackTrace();
}
return response;
}
/**
* @param url
* @param bodyParams
* @return
*/
public Response delData(String url, Map<String, Object> bodyParams, Map<String, Object> headerMap) throws Exception {
//1构造RequestBody
RequestBody body = setRequestBody(bodyParams, headerMap);
//2 构造Request
Request.Builder requestBuilder = new Request.Builder().delete(body).url(url);
addHeaders(headerMap, requestBuilder);
Request request = requestBuilder.build();
//3 将Request封装为Call
Call call = mOkHttpClient.newCall(request);
//4 执行Call,得到response
Response response = null;
try {
response = call.execute();
} catch (IOException e) {
e.printStackTrace();
}
return response;
}
/**
* post的请求参数构造RequestBody
*
* @param bodyParams
* @return
*/
private RequestBody setRequestBody(Map<String, Object> bodyParams, Map<String, Object> headerMap) throws Exception {
//判断请求头中是否存在 content-type字段
if (headerMap == null || !headerMap.containsKey(CONTENT_TYPE)) {
throw new Exception("请求头信息配置中无 Content-Type配置,请先配置");
}
Object contentType = headerMap.get(CONTENT_TYPE);
String contentTypeStr = contentType != null?contentType.toString():null;
if ("application/x-www-form-urlencoded".equals(contentTypeStr)) {
//表单提交 就是key-value 都是字符串型
//转换
Map<String, String> strBodyParamMap = new HashMap<>();
if (bodyParams != null && !bodyParams.isEmpty()) {
bodyParams.forEach((key, value) -> {
if (value != null) {
strBodyParamMap.put(key, (String) value);
}
});
}
return buildRequestBodyByMap(strBodyParamMap);
} else {
//json
return buildRequestBodyByJson(com.alibaba.fastjson.JSON.toJSONString(bodyParams));
}
}
/**
* 表单方式提交构建
*
* @param bodyParams
* @return
*/
private RequestBody buildRequestBodyByMap(Map<String, String> bodyParams) {
RequestBody body = null;
okhttp3.FormBody.Builder formEncodingBuilder = new okhttp3.FormBody.Builder();
if (bodyParams != null) {
Iterator<String> iterator = bodyParams.keySet().iterator();
String key = "";
while (iterator.hasNext()) {
key = iterator.next().toString();
formEncodingBuilder.add(key, bodyParams.get(key));
logger.info(" 请求参数:{},请求值:{} ", key, bodyParams.get(key));
}
}
body = formEncodingBuilder.build();
return body;
}
/**
* json方式提交构建
*
* @param jsonStr
* @return
*/
private RequestBody buildRequestBodyByJson(String jsonStr) {
return RequestBody.create(JSON, jsonStr);
}
/**
* 生成安全套接字工厂用于https请求的证书跳过
*
* @return
*/
public SSLSocketFactory createSSLSocketFactory() {
SSLSocketFactory ssfFactory = null;
try {
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, new TrustManager[]{new TrustAllCerts()}, new SecureRandom());
ssfFactory = sc.getSocketFactory();
} catch (Exception e) {
}
return ssfFactory;
}
/**
* 针对json post处理
*
* @param url
* @param json
* @return
* @throws IOException
*/
public String postJson(String url, String json) throws IOException {
RequestBody body = RequestBody.create(JSON, json);
Request request = new Request.Builder()
.url(url)
.post(body)
.build();
Response response = mOkHttpClient.newCall(request).execute();
if (response.isSuccessful()) {
return response.body().string();
} else {
throw new IOException("Unexpected code " + response);
}
}
public void postJsonAsyn(String url, String json, final MyNetCall myNetCall) throws IOException {
RequestBody body = RequestBody.create(JSON, json);
//2 构造Request
Request.Builder requestBuilder = new Request.Builder();
Request request = requestBuilder.post(body).url(url).build();
//3 将Request封装为Call
Call call = mOkHttpClient.newCall(request);
//4 执行Call
call.enqueue(new Callback() {
@Override
public void onFailure(Call call, IOException e) {
myNetCall.failed(call, e);
}
@Override
public void onResponse(Call call, Response response) throws IOException {
myNetCall.success(call, response);
}
});
}
/**
* 自定义网络回调接口
*/
public interface MyNetCall {
void success(Call call, Response response) throws IOException;
void failed(Call call, IOException e);
}
/**
* 构建http get请求将参数拼接到url后面
*
* @param url
* @param para
* @return
* @throws URISyntaxException
* @throws MalformedURLException
*/
public static String buildHttpGet(String url, Map<String, Object> para)
throws URISyntaxException, MalformedURLException {
URIBuilder builder = new URIBuilder(url);
Set<String> set = para.keySet();
for (String key : set) {
builder.setParameter(key, String.valueOf(para.get(key)));
}
return builder.build().toURL().toString();
}
/**
* 添加header信息
*
* @param headerMap
* @param builder
* @return
*/
private static Request.Builder addHeaders(Map<String, Object> headerMap, Request.Builder builder) {
if (headerMap != null && !headerMap.isEmpty()) {
headerMap.forEach((key, value) -> builder.addHeader(key, value == null? null:value.toString()));
}
return builder;
}
/**
* 用于信任所有证书
*/
class TrustAllCerts implements X509TrustManager {
@Override
public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
}
public static void main(String[] args) {
try {
Response data = OkHttpUtil.getInstance().getData("http://218.88.215.93:10011/open-api/app/token?appKey=Y6FKNwWxaeSapJT8&appSecret=e87695b9010dec760f6787a90e32921c");
System.out.println(Objects.requireNonNull(data.body()).string());
System.out.println(Optional.ofNullable(null).get());
} catch (Exception e) {
e.printStackTrace();
}
}
}

64
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/net/SSLSocketClient.java

@ -0,0 +1,64 @@
package com.epmet.commons.tools.utils.net;
import javax.net.ssl.*;
import java.security.KeyStore;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.Arrays;
public class SSLSocketClient {
//获取这个SSLSocketFactory
public static SSLSocketFactory getSSLSocketFactory() {
try {
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, getTrustManager(), new SecureRandom());
return sslContext.getSocketFactory();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
//获取TrustManager
private static TrustManager[] getTrustManager() {
return new TrustManager[]{
new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {
}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {
}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[]{};
}
}
};
}
//获取HostnameVerifier
public static HostnameVerifier getHostnameVerifier() {
return (s, sslSession) -> true;
}
public static X509TrustManager getX509TrustManager() {
X509TrustManager trustManager = null;
try {
TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
trustManagerFactory.init((KeyStore) null);
TrustManager[] trustManagers = trustManagerFactory.getTrustManagers();
if (trustManagers.length != 1 || !(trustManagers[0] instanceof X509TrustManager)) {
throw new IllegalStateException("Unexpected default trust managers:" + Arrays.toString(trustManagers));
}
trustManager = (X509TrustManager) trustManagers[0];
} catch (Exception e) {
e.printStackTrace();
}
return trustManager;
}
}

7
epmet-module/epmet-ext/epmet-ext-server/pom.xml

@ -123,13 +123,6 @@
<!--<version>5.1.1</version>-->
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

7
epmet-module/epmet-third/epmet-third-server/pom.xml

@ -93,13 +93,6 @@
<!--<version>5.1.1</version>-->
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/CustomerGridController.java

@ -104,6 +104,7 @@ public class CustomerGridController {
public Result<CustomerGridDTO> getCustomerGridByGridId(@RequestBody CustomerGridFormDTO customerGridFormDTO) {
return customerGridService.getCustomerGridByGridId(customerGridFormDTO);
}
/**
* @Description 陌生人导览模块调用 根据陌生揽客传入的地区码进行分页查询显示
* @Param ListCustomerGridFormDTO

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/GridController.java

@ -5,8 +5,9 @@ import com.epmet.commons.tools.annotation.RequirePermission;
import com.epmet.commons.tools.enums.RequirePermissionEnum;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.form.*;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.*;
import com.epmet.service.CustomerGridService;
import com.epmet.service.CustomerStaffAgencyService;
@ -165,4 +166,15 @@ public class GridController {
public Result<List<OrgInfoResultDTO>> selectOrgInfo(@RequestBody OrgInfoFormDTO orgInfoFormDTO){
return new Result<List<OrgInfoResultDTO>>().ok(customerGridService.selectOrgInfo(orgInfoFormDTO));
}
/**
* 供epmet-user服务调用 查询客户网格表数据
* @author sun
* @param customerGridFormDTO
* @return
* @throws Exception
*/
@PostMapping("getbaseinfo")
public Result<CustomerGridDTO> getBaseInfo(@RequestBody CustomerGridFormDTO customerGridFormDTO) {
return customerGridService.getBaseInfo(customerGridFormDTO);
}
}

46
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/dao/CustomerGridDao.java

@ -18,7 +18,7 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.CustomerAgencyDTO;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.UserIdAndPidDTO;
import com.epmet.dto.UserIdDTO;
@ -60,11 +60,11 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
List<CustomerGridForStrangerResultDTO> selectRestGridWithoutGivenAreaCode(Map<String, Object> paramsMap);
/**
* @Description 通过gridId查询网格信息网格名称格式 上级组织名称-网格名称
* @param customerGridFormDTO
* @Description 通过gridId查询网格信息网格名称格式 上级组织名称-网格名称
* @author wangc
* @date 2020.04.30 13:57
**/
**/
CustomerGridDTO getCustomerGridByGridId(CustomerGridFormDTO customerGridFormDTO);
/**
@ -156,8 +156,8 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
List<AllGridsByUserIdResultDTO> selectGridByIds(@Param("gridIdList") List<String> gridIdList);
/**
* @Description 获取所属网格
* @param formDTO
* @Description 获取所属网格
* @author zxc
* @date 2020/5/11 18:50
*/
@ -178,12 +178,12 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
List<CustomerGridDTO> selectGridListByIds(@Param("gridIdList") List<String> gridIdList);
/**
* @Description 通过网格Id获取网格所需要的数据权限信息
* @param gridId
* @Description 通过网格Id获取网格所需要的数据权限信息
* @author wangc
* @date 2020.05.13 11:01
**/
CommonDataFilterResultDTO getGridDataFilterMsg(@Param("gridId")String gridId);
CommonDataFilterResultDTO getGridDataFilterMsg(@Param("gridId") String gridId);
/**
* @param agencyId
@ -218,41 +218,55 @@ public interface CustomerGridDao extends BaseDao<CustomerGridEntity> {
List<PublicCustomerGridForStrangerResultDTO> selectThirdRestGridWithoutGivenAreaCode(Map<String, Object> map);
/**
* @Description 查询当前客户已有网格数量
* @param customerId
* @Description 查询当前客户已有网格数量
* @author zxc
* @date 2020/8/12 5:10 下午
*/
Integer selectGridCount(@Param("customerId")String customerId);
Integer selectGridCount(@Param("customerId") String customerId);
/**
* 删除工作人员与网格关联
* @author zhaoqifeng
* @date 2020/8/28 15:32
*
* @param staffId
* @return void
* @author zhaoqifeng
* @date 2020/8/28 15:32
*/
void deleteGridStaff(@Param("staffId") String staffId);
/**
* 查询工作人员所在网格
* @author zhaoqifeng
* @date 2020/8/28 15:41
*
* @param staffId
* @return java.util.List<com.epmet.entity.CustomerGridEntity>
* @author zhaoqifeng
* @date 2020/8/28 15:41
*/
List<CustomerGridEntity> selectGridByStaff(@Param("staffId") String staffId);
List<OrgInfoResultDTO> selectOrgInfoByAgency(@Param("orgIds")List<String> orgIds);
List<OrgInfoResultDTO> selectOrgInfoByGrid(@Param("orgIds")List<String> orgIds);
List<OrgInfoResultDTO> selectOrgInfoByDept(@Param("orgIds")List<String> orgIds);
List<OrgInfoResultDTO> selectOrgInfoByAgency(@Param("orgIds") List<String> orgIds);
List<OrgInfoResultDTO> selectOrgInfoByGrid(@Param("orgIds") List<String> orgIds);
List<OrgInfoResultDTO> selectOrgInfoByDept(@Param("orgIds") List<String> orgIds);
/**
* @param gridId
* @return com.epmet.commons.tools.utils.Result<java.util.List<java.lang.String>>
* @return com.epmet.commons.tools.utils.Result<java.util.List < java.lang.String>>
* @Author zy
* @Description 根据 网格id查询同属于一个社区下的所有网格id
* @Date 2020/12/28 23:16
**/
List<String> selectListGridIdsInCommunity(@Param("gridId") String gridId);
/**
* desc: 根据网格Id获取网格基础信息 单表查询
*
* @param gridId
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerGridDTO>
* @author LiuJanJun
* @date 2021/4/19 11:56 上午
*/
Result<CustomerGridDTO> getGridBaseInfoById(@Param("gridId") String gridId);
}

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/CustomerGridService.java

@ -23,17 +23,8 @@ import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.CustomerGridDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.AddGridResultDTO;
import com.epmet.dto.form.CommonAgencyIdFormDTO;
import com.epmet.dto.form.CustomerGridFormDTO;
import com.epmet.dto.form.ListCustomerGridFormDTO;
import com.epmet.dto.form.SelectGridNameByGridIdFormDTO;
import com.epmet.dto.result.CustomerGridForStrangerResultDTO;
import com.epmet.dto.result.SelectGridNameByGridIdResultDTO;
import com.epmet.dto.result.GridInfoResultDTO;
import com.epmet.dto.result.*;
import com.epmet.entity.CustomerGridEntity;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
import java.util.Map;
@ -286,4 +277,14 @@ public interface CustomerGridService extends BaseService<CustomerGridEntity> {
* @Date 2020/12/28 23:16
**/
List<String> listGridIdsInCommunity(String gridId);
/**
* desc: 获取网格基础数据单表查询
*
* @param customerGridFormDTO
* @return com.epmet.commons.tools.utils.Result<com.epmet.dto.CustomerGridDTO>
* @author LiuJanJun
* @date 2021/4/19 11:53 上午
*/
Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO);
}

5
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/CustomerGridServiceImpl.java

@ -701,4 +701,9 @@ public class CustomerGridServiceImpl extends BaseServiceImpl<CustomerGridDao, Cu
public List<String> listGridIdsInCommunity(String gridId) {
return baseDao.selectListGridIdsInCommunity(gridId);
}
@Override
public Result<CustomerGridDTO> getBaseInfo(CustomerGridFormDTO customerGridFormDTO) {
return baseDao.getGridBaseInfoById(customerGridFormDTO.getGridId());
}
}

13
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/CustomerGridDao.xml

@ -600,4 +600,17 @@
</if>
) AND DEL_FLAG = 0
</select>
<select id="getGridBaseInfoById" resultType="com.epmet.dto.CustomerGridDTO">
SELECT
cg.ID AS orgId,
cg.GRID_NAME AS orgName,
cg.PID AS agencyId,
ca.PID,
ca.PIDS,
ca.ORGANIZATION_NAME
FROM customer_grid cg
WHERE
cg.ID = #{gridId}
AND cg.DEL_FLAG = '0'
</select>
</mapper>

11
pom.xml

@ -92,6 +92,17 @@
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>1.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib</artifactId>
<version>1.3.70</version>
</dependency>
</dependencies>
</dependencyManagement>

Loading…
Cancel
Save