# Conflicts: # dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java # dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/UserLoginService.java # dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/service/impl/UserLoginServiceImpl.java # dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.javamaster
commit
e306d6eb3a
34 changed files with 712 additions and 70 deletions
@ -0,0 +1,8 @@ |
|||||||
|
package com.daqing.financial.hrauth.feign; |
||||||
|
|
||||||
|
/** |
||||||
|
* @auther River |
||||||
|
* @date 2020/10/22 14:04 |
||||||
|
*/ |
||||||
|
public class HrmsFeignService { |
||||||
|
} |
@ -1,14 +1,18 @@ |
|||||||
package com.daqing.financial.hrms.feign; |
package com.daqing.financial.hrms.feign; |
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
import org.springframework.cloud.openfeign.FeignClient; |
import org.springframework.cloud.openfeign.FeignClient; |
||||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||||
|
|
||||||
/** |
/** |
||||||
* 声明这是一个远程调用 |
* 声明这是一个远程调用 |
||||||
* @auther River |
* @auther River |
||||||
* @date 2020/10/12 17:58 |
* @date 2020/10/12 17:58 |
||||||
*/ |
*/ |
||||||
@FeignClient("dq-financial-hrms-auht") |
@FeignClient("dq-financial-hrms-auth") |
||||||
public interface HrmsAuthFeignService { |
public interface HrmsAuthFeignService { |
||||||
|
|
||||||
|
@GetMapping("/hrms/auth/userlogin/getWeChatConfig") |
||||||
|
JSONObject getWeChatConfig(); |
||||||
|
|
||||||
} |
} |
||||||
|
@ -1,61 +1,61 @@ |
|||||||
|
##服务名称 |
||||||
|
#spring.application.name=dq-financial-hrms |
||||||
|
##配置中心地址 |
||||||
|
#spring.cloud.nacos.config.server-addr=192.168.31.142:8848 |
||||||
|
#spring.cloud.nacos.config.namespace=4c56c2f9-b6a3-4e7b-88b8-b1001e86dfd6 |
||||||
|
##spring.cloud.nacos.config.group=prod |
||||||
|
# |
||||||
|
#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
||||||
|
#spring.cloud.nacos.config.ext-config[0].group=dev |
||||||
|
#spring.cloud.nacos.config.ext-config[0].refresh=true |
||||||
|
# |
||||||
|
#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
||||||
|
#spring.cloud.nacos.config.ext-config[1].group=dev |
||||||
|
#spring.cloud.nacos.config.ext-config[1].refresh=true |
||||||
|
# |
||||||
|
#spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
||||||
|
#spring.cloud.nacos.config.ext-config[2].group=dev |
||||||
|
#spring.cloud.nacos.config.ext-config[2].refresh=true |
||||||
|
# |
||||||
|
#spring.redis.host=127.0.0.1 |
||||||
|
#spring.redis.port=6379 |
||||||
|
#spring.redis.password=123456 |
||||||
|
#spring.redis.database=0 |
||||||
|
#spring.redis.timeout=30000 |
||||||
|
#spring.redis.jedis.pool.max-active=8 |
||||||
|
#spring.redis.jedis.pool.max-wait=-1 |
||||||
|
#spring.redis.jedis.pool.max-idle=8 |
||||||
|
#spring.redis.jedis.pool.min-idle=0 |
||||||
|
# |
||||||
|
#spring.servlet.multipart.max-file-size=10MB |
||||||
|
#spring.servlet.multipart.max-request-size=10MB |
||||||
|
|
||||||
|
# 正式环境(prod) |
||||||
#服务名称 |
#服务名称 |
||||||
spring.application.name=dq-financial-hrms |
spring.application.name=dq-financial-hrms |
||||||
#配置中心地址 |
#配置中心地址 |
||||||
spring.cloud.nacos.config.server-addr=192.168.31.142:8848 |
spring.cloud.nacos.config.server-addr=120.78.127.12:8848 |
||||||
spring.cloud.nacos.config.namespace=4c56c2f9-b6a3-4e7b-88b8-b1001e86dfd6 |
spring.cloud.nacos.config.namespace=69614b55-1521-421c-ac58-dbe4a5b01b43 |
||||||
#spring.cloud.nacos.config.group=prod |
#spring.cloud.nacos.config.group=prod |
||||||
|
|
||||||
spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
||||||
spring.cloud.nacos.config.ext-config[0].group=dev |
spring.cloud.nacos.config.ext-config[0].group=prod |
||||||
spring.cloud.nacos.config.ext-config[0].refresh=true |
spring.cloud.nacos.config.ext-config[0].refresh=true |
||||||
|
|
||||||
spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
||||||
spring.cloud.nacos.config.ext-config[1].group=dev |
spring.cloud.nacos.config.ext-config[1].group=prod |
||||||
spring.cloud.nacos.config.ext-config[1].refresh=true |
spring.cloud.nacos.config.ext-config[1].refresh=true |
||||||
|
|
||||||
spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
||||||
spring.cloud.nacos.config.ext-config[2].group=dev |
spring.cloud.nacos.config.ext-config[2].group=prod |
||||||
spring.cloud.nacos.config.ext-config[2].refresh=true |
spring.cloud.nacos.config.ext-config[2].refresh=true |
||||||
|
|
||||||
spring.redis.host=127.0.0.1 |
spring.redis.host=127.0.0.1 |
||||||
spring.redis.port=6379 |
spring.redis.port=6379 |
||||||
spring.redis.password=123456 |
spring.redis.password=dq123456 |
||||||
spring.redis.database=0 |
spring.redis.database=0 |
||||||
spring.redis.timeout=30000 |
spring.redis.timeout=30000 |
||||||
spring.redis.jedis.pool.max-active=8 |
spring.redis.jedis.pool.max-active=8 |
||||||
spring.redis.jedis.pool.max-wait=-1 |
spring.redis.jedis.pool.max-wait=-1 |
||||||
spring.redis.jedis.pool.max-idle=8 |
spring.redis.jedis.pool.max-idle=8 |
||||||
spring.redis.jedis.pool.min-idle=0 |
spring.redis.jedis.pool.min-idle=0 |
||||||
|
|
||||||
spring.servlet.multipart.max-file-size=10MB |
|
||||||
spring.servlet.multipart.max-request-size=10MB |
|
||||||
|
|
||||||
# 正式环境(prod) |
|
||||||
#服务名称 |
|
||||||
#spring.application.name=dq-financial-hrms |
|
||||||
##配置中心地址 |
|
||||||
#spring.cloud.nacos.config.server-addr=120.78.127.12:8848 |
|
||||||
#spring.cloud.nacos.config.namespace=69614b55-1521-421c-ac58-dbe4a5b01b43 |
|
||||||
##spring.cloud.nacos.config.group=prod |
|
||||||
# |
|
||||||
#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml |
|
||||||
#spring.cloud.nacos.config.ext-config[0].group=prod |
|
||||||
#spring.cloud.nacos.config.ext-config[0].refresh=true |
|
||||||
# |
|
||||||
#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml |
|
||||||
#spring.cloud.nacos.config.ext-config[1].group=prod |
|
||||||
#spring.cloud.nacos.config.ext-config[1].refresh=true |
|
||||||
# |
|
||||||
#spring.cloud.nacos.config.ext-config[2].data-id=other.yml |
|
||||||
#spring.cloud.nacos.config.ext-config[2].group=prod |
|
||||||
#spring.cloud.nacos.config.ext-config[2].refresh=true |
|
||||||
|
|
||||||
#spring.redis.host=127.0.0.1 |
|
||||||
#spring.redis.port=6379 |
|
||||||
#spring.redis.password=dq123456 |
|
||||||
#spring.redis.database=0 |
|
||||||
#spring.redis.timeout=30000 |
|
||||||
#spring.redis.jedis.pool.max-active=8 |
|
||||||
#spring.redis.jedis.pool.max-wait=-1 |
|
||||||
#spring.redis.jedis.pool.max-idle=8 |
|
||||||
#spring.redis.jedis.pool.min-idle=0 |
|
@ -0,0 +1,107 @@ |
|||||||
|
package com.daqing.framework.util; |
||||||
|
|
||||||
|
import com.google.gson.Gson; |
||||||
|
import org.apache.http.HttpEntity; |
||||||
|
import org.apache.http.HttpResponse; |
||||||
|
import org.apache.http.client.config.RequestConfig; |
||||||
|
import org.apache.http.client.methods.CloseableHttpResponse; |
||||||
|
import org.apache.http.client.methods.HttpGet; |
||||||
|
import org.apache.http.client.methods.HttpPost; |
||||||
|
import org.apache.http.entity.StringEntity; |
||||||
|
import org.apache.http.impl.client.CloseableHttpClient; |
||||||
|
import org.apache.http.impl.client.HttpClients; |
||||||
|
import org.apache.http.util.EntityUtils; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
|
||||||
|
/** |
||||||
|
* 封装http get post |
||||||
|
*/ |
||||||
|
public class HttpUtils { |
||||||
|
|
||||||
|
private static final Gson gson = new Gson(); |
||||||
|
|
||||||
|
/** |
||||||
|
* get方法 |
||||||
|
* @param url |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static Map<String,Object> doGet(String url){ |
||||||
|
|
||||||
|
Map<String,Object> map = new HashMap<>(); |
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(5000) //连接超时
|
||||||
|
.setConnectionRequestTimeout(5000)//请求超时
|
||||||
|
.setSocketTimeout(5000) |
||||||
|
.setRedirectsEnabled(true) //允许自动重定向
|
||||||
|
.build(); |
||||||
|
|
||||||
|
HttpGet httpGet = new HttpGet(url); |
||||||
|
httpGet.setConfig(requestConfig); |
||||||
|
|
||||||
|
try{ |
||||||
|
HttpResponse httpResponse = httpClient.execute(httpGet); |
||||||
|
if(httpResponse.getStatusLine().getStatusCode() == 200){ |
||||||
|
|
||||||
|
String jsonResult = EntityUtils.toString( httpResponse.getEntity()); |
||||||
|
map = gson.fromJson(jsonResult,map.getClass()); |
||||||
|
} |
||||||
|
|
||||||
|
}catch (Exception e){ |
||||||
|
e.printStackTrace(); |
||||||
|
}finally { |
||||||
|
try { |
||||||
|
httpClient.close(); |
||||||
|
}catch (Exception e){ |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
return map; |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 封装post |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
public static String doPost(String url, String data,int timeout){ |
||||||
|
CloseableHttpClient httpClient = HttpClients.createDefault(); |
||||||
|
//超时设置
|
||||||
|
|
||||||
|
RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(timeout) //连接超时
|
||||||
|
.setConnectionRequestTimeout(timeout)//请求超时
|
||||||
|
.setSocketTimeout(timeout) |
||||||
|
.setRedirectsEnabled(true) //允许自动重定向
|
||||||
|
.build(); |
||||||
|
|
||||||
|
HttpPost httpPost = new HttpPost(url); |
||||||
|
httpPost.setConfig(requestConfig); |
||||||
|
httpPost.addHeader("Content-Type","text/html; chartset=UTF-8"); |
||||||
|
|
||||||
|
if(data != null && data instanceof String){ //使用字符串传参
|
||||||
|
StringEntity stringEntity = new StringEntity(data,"UTF-8"); |
||||||
|
httpPost.setEntity(stringEntity); |
||||||
|
} |
||||||
|
|
||||||
|
try{ |
||||||
|
CloseableHttpResponse httpResponse = httpClient.execute(httpPost); |
||||||
|
HttpEntity httpEntity = httpResponse.getEntity(); |
||||||
|
if(httpResponse.getStatusLine().getStatusCode() == 200){ |
||||||
|
String result = EntityUtils.toString(httpEntity); |
||||||
|
return result; |
||||||
|
} |
||||||
|
|
||||||
|
}catch (Exception e){ |
||||||
|
e.printStackTrace(); |
||||||
|
}finally { |
||||||
|
try{ |
||||||
|
httpClient.close(); |
||||||
|
}catch (Exception e){ |
||||||
|
e.printStackTrace(); |
||||||
|
} |
||||||
|
} |
||||||
|
return null; |
||||||
|
} |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue