Commit 1a6b9fba authored by 黎博's avatar 黎博

完善捞数据的资方id

parent 9deab872
......@@ -60,4 +60,6 @@ public interface QueryBasicLoanStatusDataMapper {
* @return
*/
List<String> getMultiOrderuuidList();
Integer getAssignFundIdByUserId(String userId);
}
......@@ -59,4 +59,14 @@ public interface QueryBasicLoanStatusDataService {
* 获取多订单用户信息列表
*/
List<String> getMultiOrderUserDataList(String namespace);
/**
* 根据userId获取资金方id
*/
Integer getAssignFundIdByUserId(String namespace, String userId);
/**
* 根据手机号查询用户信息
*/
LoanUser getUserInfoByPhoneNo(String namespace, String phoneNo);
}
......@@ -19,6 +19,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
@Autowired
QueryBasicLoanStatusDataMapper basicLoanStatusDataMapper;
/**
* 获取所有用户状态
* @return 用户状态列表
......@@ -162,4 +163,16 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
SwitchDataSource.dataSourceSwitch("fe", "workflow");
return basicLoanStatusDataMapper.getMultiOrderuuidList();
}
@Override
public Integer getAssignFundIdByUserId(String namespace, String userId) {
SwitchDataSource.dataSourceSwitch(namespace, "xyqb");
return basicLoanStatusDataMapper.getAssignFundIdByUserId(userId);
}
@Override
public LoanUser getUserInfoByPhoneNo(String namespace, String phoneNo) {
SwitchDataSource.dataSourceSwitch(namespace, "xyqb");
return null;
}
}
......@@ -81,6 +81,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
if (fundId == null) {
result.forEach((item) -> item.setFundId(basicLoanStatusDataService.getAssignFundIdByUserId(namespace, item.getUserId())));
} else {
result.forEach((item) -> item.setFundId(fundId));
}
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
......@@ -97,7 +102,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
if (fundId == null) {
result.forEach((item) -> item.setFundId(basicLoanStatusDataService.getAssignFundIdByUserId(namespace, item.getUserId())));
} else {
result.forEach((item) -> item.setFundId(fundId));
}
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
......@@ -131,7 +140,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
if (fundId == null) {
result.forEach((item) -> item.setFundId(basicLoanStatusDataService.getAssignFundIdByUserId(namespace, item.getUserId())));
} else {
result.forEach((item) -> item.setFundId(fundId));
}
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
......@@ -149,7 +162,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
}
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
if (fundId == null) {
result.forEach((item) -> item.setFundId(basicLoanStatusDataService.getAssignFundIdByUserId(namespace, item.getUserId())));
} else {
result.forEach((item) -> item.setFundId(fundId));
}
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
......
......@@ -236,21 +236,22 @@ public class HttpClientUtils {
return jsonResult;
}
public static JSONObject doPostJson(String url, String params, String headers) {
public static JSONObject doPostJson(String url, String params) {
JSONObject result = new JSONObject();
HttpPost httpPost = new HttpPost(url);
if (StringUtils.isNotEmpty(params)) {
StringEntity stringEntity = new StringEntity(params, "utf-8");
httpPost.setEntity(stringEntity);
}
if (StringUtils.isNotEmpty(headers)) {
// if (StringUtils.isNotEmpty(headers)) {
// httpPost.setHeader("Content-Type", "application/json");
// }
httpPost.setHeader("Content-Type", "application/json");
}
try {
CloseableHttpResponse response = client.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
String toString = EntityUtils.toString(responseEntity, "utf-8");
System.out.println(toString);
String responseString = EntityUtils.toString(responseEntity, "utf-8");
result = JSONObject.parseObject(responseString);
} catch (IOException e) {
e.printStackTrace();
}
......@@ -273,8 +274,8 @@ public class HttpClientUtils {
try {
CloseableHttpResponse response = client.execute(httpPost);
HttpEntity responseEntity = response.getEntity();
String responseStr = EntityUtils.toString(responseEntity, "utf-8");
result = JSONObject.parseObject(responseStr);
String responseString = EntityUtils.toString(responseEntity, "utf-8");
result = JSONObject.parseObject(responseString);
} catch (IOException e) {
e.printStackTrace();
}
......
......@@ -87,4 +87,10 @@
SELECT uuid FROM `white_list_config_new`
</select>
<!-- 获取资方id -->
<select id="getAssignFundIdByUserId" resultType="java.lang.Integer">
SELECT `funding_corp_id` as `fundId` FROM `assign_funding_record`
WHERE `user_id` = #{userId} order by id desc limit 0,1
</select>
</mapper>
\ No newline at end of file
......@@ -3,12 +3,15 @@ package cn.qg.qaplatform.test;
import cn.qg.qaplatform.utils.DBUtils;
import cn.qg.qaplatform.utils.EncryptUtils;
import cn.qg.qaplatform.utils.HttpClientUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal;
import java.net.URISyntaxException;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
......@@ -43,6 +46,7 @@ public class xyqb {
public static String opToken;
public static Integer money;
public static Integer assignPeopleNum;
public static String fundOpToken;
/**
* 标准登录
......@@ -556,47 +560,101 @@ public class xyqb {
System.out.println("放款结果通知:" + result) ;
}
/**
* 登录资金方OP
*/
public static void loginFundOP() {
String url = "http://opapi-" + namespace + ".liangkebang.net" + "/user/login";
Map<String, Object> map = new HashMap<>();
map.put("auth", "dXNlcj1xYSZwYXNzd29yZD1xYXRlc3Q=");
String params = JSON.toJSONString(map);
JSONObject result = HttpClientUtils.doPostJson(url, params);
Map data = (Map) result.get("data");
fundOpToken = data.get("token").toString();
System.out.println("返回结果为:" + result);
}
/**
* 分配资产计划
*/
public static void setFundPlan() {
String url = "http://opapi-" + namespace + ".liangkebang.net" + "/clotho/funds/plan/funding/plan/save";
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String today = formatter.format(date);
Map<String, Object> params = new HashMap<>();
params.put("fundCorpId", fundId);
params.put("planDate", today);
params.put("maxAssignAmount", 10000000);
params.put("maxLoanAmount", 10000000);
params.put("maxLoanPeople", 100);
params.put("maxAssignPeople", 100);
params.put("priorityLevel", 1);
Map<String, Object> headers = new HashMap<>();
headers.put("x-auth-token", fundOpToken);
JSONObject result = HttpClientUtils.doPost(url, params, headers);
System.out.println("分配资金方的结果为:" + result);
}
/**
* 打开推送放款
*/
public static void unblockLoan() {
String url = "http://opapi-" + namespace + ".liangkebang.net" + "/clotho/funds/plan/funding/switch/" + fundId + "/loan/auto_lock";
Map<String, Object> params = new HashMap<>();
params.put("to", true);
Map<String, Object> headers = new HashMap<>();
headers.put("x-auth-token", fundOpToken);
JSONObject result = HttpClientUtils.doPost(url, params, headers);
System.out.println("推送放款Enable:" + result);
}
public static void main(String[] args) throws Exception {
login();
checkUserId();
syncSessionToXyqb();
creditSessionSync();
realNameVerified();
authBasicInfo();
enterAuthOcr();
uploadFrontOfIdCard();
uploadBackOfIdCard();
submitPhotoAuth();
credit();
submitAudit();
queryUserAuditRecord();
creditAuthNotify();
Thread.sleep(180000);
// 分配资金方
loginFundOP();
setFundPlan();
unblockLoan();
// login();
// checkUserId();
// syncSessionToXyqb();
// creditSessionSync();
// realNameVerified();
// authBasicInfo();
// enterAuthOcr();
// uploadFrontOfIdCard();
// uploadBackOfIdCard();
// submitPhotoAuth();
// credit();
// submitAudit();
// queryUserAuditRecord();
// creditAuthNotify();
// Thread.sleep(180000);
// 绑卡提现
// login();
// checkUserId();
// syncSessionToXyqb();
loginWithDrawPage();
getUserAccountId();
bindCard();
cardAuthSms();
cardAuthSmsConfirm();
getBindCardList();
createLoan();
externalQuotaOrderAuditNotify();
modifyContactStatus();
Thread.sleep(10000);
// loginWithDrawPage();
// getUserAccountId();
// bindCard();
// cardAuthSms();
// cardAuthSmsConfirm();
// getBindCardList();
// createLoan();
// externalQuotaOrderAuditNotify();
// modifyContactStatus();
//
// Thread.sleep(10000);
// 放款
loginOP();
checkWaitingFundingCorpOperatePeople();
modifyWaitingFundingCreatedAt();
Thread.sleep(10000);
fundsPlanLoanApply();
Thread.sleep(10000);
payNotify();
// loginOP();
// checkWaitingFundingCorpOperatePeople();
// modifyWaitingFundingCreatedAt();
// Thread.sleep(10000);
// fundsPlanLoanApply();
// Thread.sleep(10000);
// payNotify();
}
}
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