Commit 65f41783 authored by lee_mingzhu's avatar lee_mingzhu

remove google gson package and sun package of base64

parent 2dd5a10b
...@@ -112,10 +112,6 @@ ...@@ -112,10 +112,6 @@
<artifactId>mysql-connector-java</artifactId> <artifactId>mysql-connector-java</artifactId>
<version>5.1.35</version> <version>5.1.35</version>
</dependency> </dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.apache.httpcomponents</groupId> <groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId> <artifactId>httpcore</artifactId>
......
package cn.quantgroup.xyqb; package cn.quantgroup.xyqb;
import com.google.gson.Gson;
/** /**
* Created by Miraculous on 15/7/5. * Created by Miraculous on 15/7/5.
...@@ -24,7 +24,6 @@ public interface Constants { ...@@ -24,7 +24,6 @@ public interface Constants {
// 是否启用万能验证码 // 是否启用万能验证码
String CONFIG_CAPTCHA_MAGIC_CODE_ENABLED = "cfg_captcha_magic_code_enabled"; String CONFIG_CAPTCHA_MAGIC_CODE_ENABLED = "cfg_captcha_magic_code_enabled";
Gson GSON = new Gson();
String REDIS_PREFIX_VERIFICATION_CODE = "verificationCode_"; String REDIS_PREFIX_VERIFICATION_CODE = "verificationCode_";
......
...@@ -14,11 +14,11 @@ import cn.quantgroup.xyqb.service.auth.IIdCardService; ...@@ -14,11 +14,11 @@ import cn.quantgroup.xyqb.service.auth.IIdCardService;
import cn.quantgroup.xyqb.service.jr58.Jr58Service; import cn.quantgroup.xyqb.service.jr58.Jr58Service;
import cn.quantgroup.xyqb.service.user.IUserService; import cn.quantgroup.xyqb.service.user.IUserService;
import cn.quantgroup.xyqb.service.user.IUuidPhoneMappingService; import cn.quantgroup.xyqb.service.user.IUuidPhoneMappingService;
import cn.quantgroup.xyqb.util.GZipUtil;
import cn.quantgroup.xyqb.util.JR58GzipUtil; import cn.quantgroup.xyqb.util.JR58GzipUtil;
import cn.quantgroup.xyqb.util.ValidationUtil; import cn.quantgroup.xyqb.util.ValidationUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Strings; import com.google.common.base.Strings;
import com.google.gson.Gson; import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -29,17 +29,13 @@ import org.springframework.context.ApplicationEventPublisherAware; ...@@ -29,17 +29,13 @@ import org.springframework.context.ApplicationEventPublisherAware;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.util.Base64Utils;
import org.springframework.web.bind.MissingServletRequestParameterException; import org.springframework.web.bind.MissingServletRequestParameterException;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.WebRequest; import org.springframework.web.context.request.WebRequest;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.text.ParseException; import java.text.ParseException;
...@@ -232,14 +228,16 @@ public class Jr58Controller implements ApplicationEventPublisherAware { ...@@ -232,14 +228,16 @@ public class Jr58Controller implements ApplicationEventPublisherAware {
LOGGER.error("58金融运营商授权数据导入接口 - authorizationData不能为空"); LOGGER.error("58金融运营商授权数据导入接口 - authorizationData不能为空");
return JsonResult.buildErrorStateResult("58金融运营商授权数据导入接口 - authorizationData不能为空",null); return JsonResult.buildErrorStateResult("58金融运营商授权数据导入接口 - authorizationData不能为空",null);
} }
try { //try {
authorizationDataStr = JR58GzipUtil.bytesTogzip(new BASE64Decoder().decodeBuffer(authorizationData.getAuthorizationData()), "utf-8"); authorizationDataStr = JR58GzipUtil.bytesTogzip(Base64.decodeBase64(authorizationData.getAuthorizationData()), "utf-8");
//authorizationDataStr = JR58GzipUtil.bytesTogzip(new BASE64Decoder().decodeBuffer(authorizationData.getAuthorizationData()), "utf-8");
LOGGER.info("推送的运营商数据authorizationDataStr={}",authorizationDataStr); LOGGER.info("推送的运营商数据authorizationDataStr={}",authorizationDataStr);
} catch (IOException e) { /*} catch (IOException e) {
LOGGER.error("58金融生成借款申请失败,base64转换失败"); LOGGER.error("58金融生成借款申请失败,base64转换失败");
return JsonResult.buildErrorStateResult("58金融导入运营商授权数据失败",null); return JsonResult.buildErrorStateResult("58金融导入运营商授权数据失败",null);
} }*/
authorizationData.setOperator_data(new Gson().fromJson(authorizationDataStr, Jr58Authorization.OperatorData.class)); //authorizationData.setOperator_data(new Gson().fromJson(authorizationDataStr, Jr58Authorization.OperatorData.class));
authorizationData.setOperator_data(JSONObject.parseObject(authorizationDataStr, Jr58Authorization.OperatorData.class));
if(authorizationData == null){ if(authorizationData == null){
LOGGER.error("58金融运营商授权数据导入接口 - 入参不完整"); LOGGER.error("58金融运营商授权数据导入接口 - 入参不完整");
return JsonResult.buildErrorStateResult("58金融运营商授权数据导入 - 入参不完整",null); return JsonResult.buildErrorStateResult("58金融运营商授权数据导入 - 入参不完整",null);
......
package cn.quantgroup.xyqb.event.jr58; package cn.quantgroup.xyqb.event.jr58;
import cn.quantgroup.xyqb.service.http.IHttpService; import cn.quantgroup.xyqb.service.http.IHttpService;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -34,17 +34,17 @@ public class Jr58DataSender { ...@@ -34,17 +34,17 @@ public class Jr58DataSender {
@Async @Async
public void sendUserinfo(String uuid) { public void sendUserinfo(String uuid) {
try { try {
JsonObject json = new JsonObject(); JSONObject json = new JSONObject();
json.addProperty("salaryWay", 0); json.put("salaryWay", 0);
json.addProperty("loanPurpose", "12"); json.put("loanPurpose", "12");
json.addProperty("job", 0); json.put("job", 0);
json.addProperty("account", 1000); json.put("account", 1000);
json.addProperty("salary", 0); json.put("salary", 0);
json.addProperty("hourse", 1); json.put("hourse", 1);
json.addProperty("isShebao", 0); json.put("isShebao", 0);
json.addProperty("education", ""); json.put("education", "");
json.addProperty("isCreditCard", "0"); json.put("isCreditCard", "0");
json.addProperty("isOtherLoanOrg", "0"); json.put("isOtherLoanOrg", "0");
String userinfo = json.toString(); String userinfo = json.toString();
String param = uuid + "|1|" + userinfo; String param = uuid + "|1|" + userinfo;
......
...@@ -4,6 +4,7 @@ import cn.quantgroup.xyqb.exception.ResponseException; ...@@ -4,6 +4,7 @@ import cn.quantgroup.xyqb.exception.ResponseException;
import cn.quantgroup.xyqb.model.JsonResult; import cn.quantgroup.xyqb.model.JsonResult;
import cn.quantgroup.xyqb.service.auth.IAuthApiService; import cn.quantgroup.xyqb.service.auth.IAuthApiService;
import cn.quantgroup.xyqb.service.http.IHttpService; import cn.quantgroup.xyqb.service.http.IHttpService;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -12,7 +13,6 @@ import org.springframework.stereotype.Service; ...@@ -12,7 +13,6 @@ import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
import static cn.quantgroup.xyqb.Constants.GSON;
/** /**
* han-gu-guan * han-gu-guan
...@@ -60,7 +60,8 @@ public class AuthApiServiceImpl implements IAuthApiService { ...@@ -60,7 +60,8 @@ public class AuthApiServiceImpl implements IAuthApiService {
String response = httpService.post(xyqbAuthUrl + "/app/login", parameters); String response = httpService.post(xyqbAuthUrl + "/app/login", parameters);
JsonResult result = GSON.fromJson(response, JsonResult.class); //JsonResult result = GSON.fromJson(response, JsonResult.class);
JsonResult result = JSONObject.parseObject(response, JsonResult.class);
if (result == null || !"0000".equals(result.getCode()) || !"0000".equals(result.getBusinessCode())) { if (result == null || !"0000".equals(result.getCode()) || !"0000".equals(result.getBusinessCode())) {
throw new ResponseException("用户免密登录返回结果错误"); throw new ResponseException("用户免密登录返回结果错误");
} }
......
...@@ -6,6 +6,7 @@ import cn.quantgroup.xyqb.model.jr58.Jr58RegisterResult; ...@@ -6,6 +6,7 @@ import cn.quantgroup.xyqb.model.jr58.Jr58RegisterResult;
import cn.quantgroup.xyqb.service.http.IHttpService; import cn.quantgroup.xyqb.service.http.IHttpService;
import cn.quantgroup.xyqb.service.user.ILkbUserService; import cn.quantgroup.xyqb.service.user.ILkbUserService;
import cn.quantgroup.xyqb.util.PasswordUtil; import cn.quantgroup.xyqb.util.PasswordUtil;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -17,7 +18,6 @@ import org.springframework.stereotype.Service; ...@@ -17,7 +18,6 @@ import org.springframework.stereotype.Service;
import java.util.Map; import java.util.Map;
import static cn.quantgroup.xyqb.Constants.GSON;
/** /**
* @author mengfan.feng * @author mengfan.feng
...@@ -59,7 +59,8 @@ public class LkbUserviceImpl implements ILkbUserService { ...@@ -59,7 +59,8 @@ public class LkbUserviceImpl implements ILkbUserService {
.build(); .build();
String response = httpService.get(clientUrl + registerApp, parameters); String response = httpService.get(clientUrl + registerApp, parameters);
Map<String, String> result = GSON.fromJson(response, Map.class); //Map<String, String> result = GSON.fromJson(response, Map.class);
Map<String, String> result = JSONObject.parseObject(response, Map.class);
if (result == null || "0".equals(result.get("flag"))) { if (result == null || "0".equals(result.get("flag"))) {
LOGGER.warn("向LKB注册用户失败, phoneNo:{}, password:{}", phoneNo, password); LOGGER.warn("向LKB注册用户失败, phoneNo:{}, password:{}", phoneNo, password);
return ""; return "";
...@@ -79,7 +80,8 @@ public class LkbUserviceImpl implements ILkbUserService { ...@@ -79,7 +80,8 @@ public class LkbUserviceImpl implements ILkbUserService {
.build(); .build();
String response = httpService.get(clientUrl + register58jr, parameters); String response = httpService.get(clientUrl + register58jr, parameters);
return GSON.fromJson(response, Jr58RegisterResult.class); //return GSON.fromJson(response, Jr58RegisterResult.class);
return JSONObject.parseObject(response, Jr58RegisterResult.class);
} }
@Override @Override
...@@ -92,7 +94,8 @@ public class LkbUserviceImpl implements ILkbUserService { ...@@ -92,7 +94,8 @@ public class LkbUserviceImpl implements ILkbUserService {
.build(); .build();
String response = httpService.get(clientUrl + userUpdate, parameters); String response = httpService.get(clientUrl + userUpdate, parameters);
Map<String, String> result = GSON.fromJson(response, Map.class); //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"))) { if (result == null || "false".equals(result.get("flag"))) {
LOGGER.warn("向LKB-Client同步用户信息失败, result: {}", result); LOGGER.warn("向LKB-Client同步用户信息失败, result: {}", result);
} }
......
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