Commit 83d49e0e authored by xiaoguang.xu's avatar xiaoguang.xu

feat : 1. 升级undertow, 2. 去掉无用的lkb访问, 3. 去掉无用的model 访问

parent cc07c444
......@@ -86,6 +86,16 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-undertow</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......
......@@ -134,7 +134,7 @@ public class HttpConfig {
connectionManager.setDefaultMaxPerRoute(2000);
// retry handler
HttpRequestRetryHandler retryHandler = new StandardHttpRequestRetryHandler(3, false);
HttpRequestRetryHandler retryHandler = new StandardHttpRequestRetryHandler();
// keep alive strategy
ConnectionKeepAliveStrategy keepAliveStrategy = new DefaultConnectionKeepAliveStrategy();
......
package cn.quantgroup.xyqb.exception;
/**
* Created by Miraculous on 15/7/29.
*/
public class ResubmissionException extends RuntimeException {
private static final long serialVersionUID = -1L;
public ResubmissionException() {
super("不能重复提交表单");
}
}
......@@ -6,23 +6,6 @@ package cn.quantgroup.xyqb.service.user;
*/
public interface ILkbUserService {
/**
* App用户注册
*
* @param phoneNo
* @param password
* @return
*/
String registerApp(String phoneNo, String password);
/**
* 同步用户信息
*
* @param uuid
* @param name
* @param idNo
*/
void userUpdate(String uuid, String name, String idNo);
/**
* 同步用戶信息
......
......@@ -5,8 +5,6 @@ import cn.quantgroup.xyqb.service.http.IHttpService;
import cn.quantgroup.xyqb.service.user.ILkbUserService;
import cn.quantgroup.xyqb.util.JsonUtil;
import cn.quantgroup.xyqb.util.PasswordUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Maps;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
......@@ -14,7 +12,6 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import java.util.Map;
......@@ -39,54 +36,6 @@ public class LkbUserviceImpl implements ILkbUserService {
@Value("${lkb.client.url}")
private String clientUrl;
@Value("${lkb.client.user.register.app}")
private String registerApp;
@Value("${lkb.client.user.update}")
private String userUpdate;
@Value("${lkb.client.user.push}")
private String userPushPath;
@Override
public String registerApp(String phoneNo, String password) {
String timeunit = System.currentTimeMillis() + "";
String token = PasswordUtil.MD5(String.format(TOKEN_PATTERN, timeunit));
Map<String, String> parameters = ImmutableMap.<String, String>builder()
.put("appId", Constants.Channel.LKB_CODE)
.put("timeunit", timeunit)
.put("token", token)
.put("userName", phoneNo)
.put("password", password)
.build();
String response = httpService.get(clientUrl + registerApp, parameters);
Map<String, String> result = JSONObject.parseObject(response, Map.class);
if (result == null || "0".equals(result.get("flag"))) {
LOGGER.warn("向LKB注册用户失败, phoneNo:{}, password:{}", phoneNo, password);
return "";
}
return result.get("uid");
}
@Override
@Async
public void userUpdate(String uuid, String name, String idNo) {
Map<String, String> parameters = ImmutableMap.<String, String>builder()
.put("userId", uuid)
.put("realName", name)
.put("idcard", idNo)
.build();
String response = httpService.get(clientUrl + userUpdate, parameters);
//Map<String, String> result = GSON.fromJson(response, Map.class);
Map<String, String> result = JSONObject.parseObject(response, Map.class);
if (result == null || "false".equals(result.get("flag"))) {
LOGGER.warn("向LKB-Client同步用户信息失败, result: {}", result);
}
}
@Override
public boolean pushUser(String uuid, String phoneNo, String name, String idNo) {
String timeunit = System.currentTimeMillis() + "";
......@@ -103,7 +52,7 @@ public class LkbUserviceImpl implements ILkbUserService {
if (StringUtils.isNotBlank(idNo)) {
parameters.put("idCardNo", idNo);
}
String response = httpService.post(clientUrl + userPushPath, parameters);
String response = httpService.post(clientUrl + "/user/push.json", parameters);
Optional<Map> resultOptional = JsonUtil.fromJson(response, Map.class);
if (!resultOptional.isPresent() || !"0000".equals(resultOptional.get().get("code"))) {
LOGGER.error("[lkb_user_push]向LKB同步用户失败,phoneNo:{},response={}", phoneNo, response);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment