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

完善捞数据的资方id

parent 9deab872
...@@ -60,4 +60,6 @@ public interface QueryBasicLoanStatusDataMapper { ...@@ -60,4 +60,6 @@ public interface QueryBasicLoanStatusDataMapper {
* @return * @return
*/ */
List<String> getMultiOrderuuidList(); List<String> getMultiOrderuuidList();
Integer getAssignFundIdByUserId(String userId);
} }
...@@ -59,4 +59,14 @@ public interface QueryBasicLoanStatusDataService { ...@@ -59,4 +59,14 @@ public interface QueryBasicLoanStatusDataService {
* 获取多订单用户信息列表 * 获取多订单用户信息列表
*/ */
List<String> getMultiOrderUserDataList(String namespace); 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 ...@@ -19,6 +19,7 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
@Autowired @Autowired
QueryBasicLoanStatusDataMapper basicLoanStatusDataMapper; QueryBasicLoanStatusDataMapper basicLoanStatusDataMapper;
/** /**
* 获取所有用户状态 * 获取所有用户状态
* @return 用户状态列表 * @return 用户状态列表
...@@ -162,4 +163,16 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus ...@@ -162,4 +163,16 @@ public class QueryBasicLoanStatusDataServiceImpl implements QueryBasicLoanStatus
SwitchDataSource.dataSourceSwitch("fe", "workflow"); SwitchDataSource.dataSourceSwitch("fe", "workflow");
return basicLoanStatusDataMapper.getMultiOrderuuidList(); 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 { ...@@ -81,6 +81,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
} }
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList); 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); PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize); PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult; return pageResult;
...@@ -97,7 +102,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService { ...@@ -97,7 +102,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
} }
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList); 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)); result.forEach((item) -> item.setFundId(fundId));
}
PageInfo<LoanUser> pageList = new PageInfo<>(result); PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize); PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult; return pageResult;
...@@ -131,7 +140,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService { ...@@ -131,7 +140,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
} }
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList); 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)); result.forEach((item) -> item.setFundId(fundId));
}
PageInfo<LoanUser> pageList = new PageInfo<>(result); PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize); PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult; return pageResult;
...@@ -149,7 +162,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService { ...@@ -149,7 +162,11 @@ public class QueryLoanUserDataServiceImpl implements QueryLoanUserDataService {
} }
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList); 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)); result.forEach((item) -> item.setFundId(fundId));
}
PageInfo<LoanUser> pageList = new PageInfo<>(result); PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize); PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult; return pageResult;
......
...@@ -236,21 +236,22 @@ public class HttpClientUtils { ...@@ -236,21 +236,22 @@ public class HttpClientUtils {
return jsonResult; return jsonResult;
} }
public static JSONObject doPostJson(String url, String params, String headers) { public static JSONObject doPostJson(String url, String params) {
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
HttpPost httpPost = new HttpPost(url); HttpPost httpPost = new HttpPost(url);
if (StringUtils.isNotEmpty(params)) { if (StringUtils.isNotEmpty(params)) {
StringEntity stringEntity = new StringEntity(params, "utf-8"); StringEntity stringEntity = new StringEntity(params, "utf-8");
httpPost.setEntity(stringEntity); httpPost.setEntity(stringEntity);
} }
if (StringUtils.isNotEmpty(headers)) { // if (StringUtils.isNotEmpty(headers)) {
// httpPost.setHeader("Content-Type", "application/json");
// }
httpPost.setHeader("Content-Type", "application/json"); httpPost.setHeader("Content-Type", "application/json");
}
try { try {
CloseableHttpResponse response = client.execute(httpPost); CloseableHttpResponse response = client.execute(httpPost);
HttpEntity responseEntity = response.getEntity(); HttpEntity responseEntity = response.getEntity();
String toString = EntityUtils.toString(responseEntity, "utf-8"); String responseString = EntityUtils.toString(responseEntity, "utf-8");
System.out.println(toString); result = JSONObject.parseObject(responseString);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -273,8 +274,8 @@ public class HttpClientUtils { ...@@ -273,8 +274,8 @@ public class HttpClientUtils {
try { try {
CloseableHttpResponse response = client.execute(httpPost); CloseableHttpResponse response = client.execute(httpPost);
HttpEntity responseEntity = response.getEntity(); HttpEntity responseEntity = response.getEntity();
String responseStr = EntityUtils.toString(responseEntity, "utf-8"); String responseString = EntityUtils.toString(responseEntity, "utf-8");
result = JSONObject.parseObject(responseStr); result = JSONObject.parseObject(responseString);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -87,4 +87,10 @@ ...@@ -87,4 +87,10 @@
SELECT uuid FROM `white_list_config_new` SELECT uuid FROM `white_list_config_new`
</select> </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> </mapper>
\ No newline at end of file
...@@ -3,12 +3,15 @@ package cn.qg.qaplatform.test; ...@@ -3,12 +3,15 @@ package cn.qg.qaplatform.test;
import cn.qg.qaplatform.utils.DBUtils; import cn.qg.qaplatform.utils.DBUtils;
import cn.qg.qaplatform.utils.EncryptUtils; import cn.qg.qaplatform.utils.EncryptUtils;
import cn.qg.qaplatform.utils.HttpClientUtils; import cn.qg.qaplatform.utils.HttpClientUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URISyntaxException; import java.net.URISyntaxException;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -43,6 +46,7 @@ public class xyqb { ...@@ -43,6 +46,7 @@ public class xyqb {
public static String opToken; public static String opToken;
public static Integer money; public static Integer money;
public static Integer assignPeopleNum; public static Integer assignPeopleNum;
public static String fundOpToken;
/** /**
* 标准登录 * 标准登录
...@@ -556,47 +560,101 @@ public class xyqb { ...@@ -556,47 +560,101 @@ public class xyqb {
System.out.println("放款结果通知:" + result) ; 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 { public static void main(String[] args) throws Exception {
login(); // 分配资金方
checkUserId(); loginFundOP();
syncSessionToXyqb(); setFundPlan();
creditSessionSync(); unblockLoan();
realNameVerified(); // login();
authBasicInfo(); // checkUserId();
enterAuthOcr(); // syncSessionToXyqb();
uploadFrontOfIdCard(); // creditSessionSync();
uploadBackOfIdCard(); // realNameVerified();
submitPhotoAuth(); // authBasicInfo();
credit(); // enterAuthOcr();
submitAudit(); // uploadFrontOfIdCard();
queryUserAuditRecord(); // uploadBackOfIdCard();
creditAuthNotify(); // submitPhotoAuth();
Thread.sleep(180000); // credit();
// submitAudit();
// queryUserAuditRecord();
// creditAuthNotify();
// Thread.sleep(180000);
// 绑卡提现 // 绑卡提现
// login(); // login();
// checkUserId(); // checkUserId();
// syncSessionToXyqb(); // syncSessionToXyqb();
loginWithDrawPage(); // loginWithDrawPage();
getUserAccountId(); // getUserAccountId();
bindCard(); // bindCard();
cardAuthSms(); // cardAuthSms();
cardAuthSmsConfirm(); // cardAuthSmsConfirm();
getBindCardList(); // getBindCardList();
createLoan(); // createLoan();
externalQuotaOrderAuditNotify(); // externalQuotaOrderAuditNotify();
modifyContactStatus(); // modifyContactStatus();
//
Thread.sleep(10000); // Thread.sleep(10000);
// 放款 // 放款
loginOP(); // loginOP();
checkWaitingFundingCorpOperatePeople(); // checkWaitingFundingCorpOperatePeople();
modifyWaitingFundingCreatedAt(); // modifyWaitingFundingCreatedAt();
Thread.sleep(10000); // Thread.sleep(10000);
fundsPlanLoanApply(); // fundsPlanLoanApply();
Thread.sleep(10000); // Thread.sleep(10000);
payNotify(); // 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