Commit 4bc03834 authored by 黎博's avatar 黎博

新增查数据相关刚发

parent fe0b4108
package cn.quantgroup.qaplatform.common.aspect; package cn.quantgroup.qaplatform.common.aspect;
import cn.quantgroup.qaplatform.utils.JsonTransUtil; import cn.quantgroup.qaplatform.utils.JsonTransUtils;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import org.aspectj.lang.JoinPoint; import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.Signature; import org.aspectj.lang.Signature;
...@@ -57,7 +57,7 @@ public class LogAspect { ...@@ -57,7 +57,7 @@ public class LogAspect {
logMap.put("class", joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()); logMap.put("class", joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName());
logMap.put("requestParams", getParameter(method, joinPoint.getArgs())); logMap.put("requestParams", getParameter(method, joinPoint.getArgs()));
// 记录下请求内容 // 记录下请求内容
logger.info("请求信息:" + JsonTransUtil.mapToJson(logMap)); logger.info("请求信息:" + JsonTransUtils.mapToJson(logMap));
} }
/** /**
...@@ -69,7 +69,7 @@ public class LogAspect { ...@@ -69,7 +69,7 @@ public class LogAspect {
@AfterReturning(returning = "ret", pointcut = "apiLog()") @AfterReturning(returning = "ret", pointcut = "apiLog()")
public void doAfterReturning(Object ret) throws Throwable { public void doAfterReturning(Object ret) throws Throwable {
// 处理完请求,返回内容 // 处理完请求,返回内容
logger.info("返回结果:" + JsonTransUtil.objToJson(ret)); logger.info("返回结果:" + JsonTransUtils.objToJson(ret));
} }
/** /**
......
...@@ -25,10 +25,6 @@ public interface BasicLoanStatusDataMapper { ...@@ -25,10 +25,6 @@ public interface BasicLoanStatusDataMapper {
*/ */
Object queryIfPhoneExist(String phone); Object queryIfPhoneExist(String phone);
/**
* 查询审核中的user_id
*/
List<String> getReviewPassedUserIdList();
/** /**
* 根据userIdList获取用户信息列表 * 根据userIdList获取用户信息列表
...@@ -37,4 +33,17 @@ public interface BasicLoanStatusDataMapper { ...@@ -37,4 +33,17 @@ public interface BasicLoanStatusDataMapper {
*/ */
List<LoanUser> getUserDataListByUserIdList(List<String> userIdList); List<LoanUser> getUserDataListByUserIdList(List<String> userIdList);
/**
* 根据审核状态获取用户Id列表
* @param status 0-审核中,1-审核拒绝,2-审核通过
* @return
*/
List<String> getAuditStatusUserIdList(Integer status);
/**
* 根据借款状态获取用户列表
* @param status 20-放款中,15-放款成功,23-放款失败
* @return
*/
List<String> getLoanStatusUserIdList(Integer status);
} }
...@@ -36,12 +36,17 @@ public interface BasicLoanStatusDataService { ...@@ -36,12 +36,17 @@ public interface BasicLoanStatusDataService {
boolean queryIfPhoneExist(String namespace, String phone); boolean queryIfPhoneExist(String namespace, String phone);
/** /**
* 获取审核中用户的userid * 获取审核状态的用户Id列表
*/ */
List<String> getReviewPassedUserIdList(String namespace); List<String> getAuditStatusUserIdList(String namespace, Integer status);
/** /**
* 根据userIdList获取用户信息列表 * 根据userIdList获取用户信息列表
*/ */
List<LoanUser> getUserDataListByUserIdList(String namespace, List<String> userIdList); List<LoanUser> getUserDataListByUserIdList(String namespace, List<String> userIdList);
/**
* 获取不同放款状态的用户
*/
List<String> getLoanStatusUserIdList(String namespace, Integer status);
} }
...@@ -87,13 +87,24 @@ public class BasicLoanStatusDataServiceImpl implements BasicLoanStatusDataServic ...@@ -87,13 +87,24 @@ public class BasicLoanStatusDataServiceImpl implements BasicLoanStatusDataServic
} }
/** /**
* 获取审核中用户的user_id列表 * 根据审核状态获取用户Id列表
* @param namespace
* @param status 0-审核中,1-审核成功,2-审核拒绝
* @return * @return
*/ */
@Override @Override
public List<String> getReviewPassedUserIdList(String namespace) { public List<String> getAuditStatusUserIdList(String namespace, Integer status) {
SwitchDataSource.dataSourceSwitch(namespace, "xyqb"); SwitchDataSource.dataSourceSwitch(namespace, "xyqb");
return loanStatusDataMapper.getReviewPassedUserIdList(); if (status == 0) {
return loanStatusDataMapper.getAuditStatusUserIdList(0);
}
if (status == 1) {
return loanStatusDataMapper.getAuditStatusUserIdList(2);
}
if (status == 2) {
return loanStatusDataMapper.getAuditStatusUserIdList(1);
}
return null;
} }
/** /**
...@@ -108,4 +119,25 @@ public class BasicLoanStatusDataServiceImpl implements BasicLoanStatusDataServic ...@@ -108,4 +119,25 @@ public class BasicLoanStatusDataServiceImpl implements BasicLoanStatusDataServic
List<LoanUser> result = loanStatusDataMapper.getUserDataListByUserIdList(userIdList); List<LoanUser> result = loanStatusDataMapper.getUserDataListByUserIdList(userIdList);
return result; return result;
} }
/**
* 获取不同放款状态的用户
* @param namespace
* @param status 0-放款中,1-放款成功,2-放款失败
* @return
*/
@Override
public List<String> getLoanStatusUserIdList(String namespace, Integer status) {
SwitchDataSource.dataSourceSwitch(namespace, "xyqb");
if (status == 0) {
return loanStatusDataMapper.getLoanStatusUserIdList(20);
}
if (status == 1) {
return loanStatusDataMapper.getLoanStatusUserIdList(15);
}
if (status == 2) {
return loanStatusDataMapper.getLoanStatusUserIdList(23);
}
return null;
}
} }
...@@ -4,7 +4,7 @@ import cn.quantgroup.qaplatform.config.DynamicDataSource; ...@@ -4,7 +4,7 @@ import cn.quantgroup.qaplatform.config.DynamicDataSource;
import cn.quantgroup.qaplatform.domain.LoanUser; import cn.quantgroup.qaplatform.domain.LoanUser;
import cn.quantgroup.qaplatform.service.BasicLoanStatusDataService; import cn.quantgroup.qaplatform.service.BasicLoanStatusDataService;
import cn.quantgroup.qaplatform.service.LoanUserDataService; import cn.quantgroup.qaplatform.service.LoanUserDataService;
import cn.quantgroup.qaplatform.utils.RandomDataUtil; import cn.quantgroup.qaplatform.utils.RandomDataUtils;
import cn.quantgroup.qaplatform.utils.page.PageResult; import cn.quantgroup.qaplatform.utils.page.PageResult;
import cn.quantgroup.qaplatform.utils.page.PageUtil; import cn.quantgroup.qaplatform.utils.page.PageUtil;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
...@@ -41,7 +41,7 @@ public class LoadUserDataServiceImpl implements LoanUserDataService { ...@@ -41,7 +41,7 @@ public class LoadUserDataServiceImpl implements LoanUserDataService {
if (status == 0) { if (status == 0) {
int count = 0; int count = 0;
do { do {
String phone = RandomDataUtil.createMobile(); String phone = RandomDataUtils.createMobile();
LoanUser loanUser = new LoanUser(); LoanUser loanUser = new LoanUser();
if (!basicLoanStatusDataService.queryIfPhoneExist(namespace, phone)) { if (!basicLoanStatusDataService.queryIfPhoneExist(namespace, phone)) {
loanUser.setPhoneNo(phone); loanUser.setPhoneNo(phone);
...@@ -66,12 +66,72 @@ public class LoadUserDataServiceImpl implements LoanUserDataService { ...@@ -66,12 +66,72 @@ public class LoadUserDataServiceImpl implements LoanUserDataService {
return pageResult; return pageResult;
} }
/**
* 2-审核中
*/
if (status == 2) {
List<String> userIdList = basicLoanStatusDataService.getAuditStatusUserIdList(namespace, 0);
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
}
/** /**
* 3-审核通过 * 3-审核通过
*/ */
if (status == 3) { if (status == 3) {
List<String> userIdList = basicLoanStatusDataService.getReviewPassedUserIdList(namespace); List<String> userIdList = basicLoanStatusDataService.getAuditStatusUserIdList(namespace, 1);
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
}
/**
* 4-审核拒绝
*/
if (status == 4) {
List<String> userIdList = basicLoanStatusDataService.getAuditStatusUserIdList(namespace, 2);
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
}
/**
* 5-放款中
*/
if (status == 5) {
List<String> userIdList = basicLoanStatusDataService.getLoanStatusUserIdList(namespace, 0);
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
}
/**
* 6-放款成功
*/
if (status == 6) {
List<String> userIdList = basicLoanStatusDataService.getLoanStatusUserIdList(namespace, 1);
PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
PageInfo<LoanUser> pageList = new PageInfo<>(result);
PageResult pageResult = PageUtil.getPageResult(pageList, pageNum, pageSize);
return pageResult;
}
/**
* 7-放款失败
*/
if (status == 7) {
List<String> userIdList = basicLoanStatusDataService.getLoanStatusUserIdList(namespace, 2);
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList); result = basicLoanStatusDataService.getUserDataListByUserIdList(namespace, userIdList);
PageInfo<LoanUser> pageList = new PageInfo<>(result); PageInfo<LoanUser> pageList = new PageInfo<>(result);
......
package cn.quantgroup.qaplatform.utils;
import sun.misc.MessageUtils;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
public class EnumUtils {
}
...@@ -21,7 +21,7 @@ import java.net.URISyntaxException; ...@@ -21,7 +21,7 @@ import java.net.URISyntaxException;
import java.util.*; import java.util.*;
@Slf4j @Slf4j
public class HttpClientUtil { public class HttpClientUtils {
private static CloseableHttpClient client = HttpClients.createDefault(); private static CloseableHttpClient client = HttpClients.createDefault();
...@@ -133,7 +133,7 @@ public class HttpClientUtil { ...@@ -133,7 +133,7 @@ public class HttpClientUtil {
CloseableHttpResponse response = client.execute(post); CloseableHttpResponse response = client.execute(post);
HttpEntity responseEntity = response.getEntity(); HttpEntity responseEntity = response.getEntity();
String responseString = EntityUtils.toString(responseEntity, "utf-8"); String responseString = EntityUtils.toString(responseEntity, "utf-8");
resultMap = JsonTransUtil.strToMap(responseString); resultMap = JsonTransUtils.strToMap(responseString);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -176,7 +176,7 @@ public class HttpClientUtil { ...@@ -176,7 +176,7 @@ public class HttpClientUtil {
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 responseStr = EntityUtils.toString(responseEntity, "utf-8");
resultMap = JsonTransUtil.strToMap(responseStr); resultMap = JsonTransUtils.strToMap(responseStr);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
......
...@@ -8,7 +8,7 @@ import java.util.Map; ...@@ -8,7 +8,7 @@ import java.util.Map;
/** /**
* json转换工具类 * json转换工具类
*/ */
public class JsonTransUtil { public class JsonTransUtils {
/** /**
* json转换成对象 * json转换成对象
......
...@@ -5,7 +5,7 @@ import java.util.Random; ...@@ -5,7 +5,7 @@ import java.util.Random;
/** /**
* 生成随机数据的工具类 * 生成随机数据的工具类
*/ */
public class RandomDataUtil { public class RandomDataUtils {
//中国移动 //中国移动
public static final String[] CHINA_MOBILE = { public static final String[] CHINA_MOBILE = {
"134", "135", "136", "137", "138", "139", "150", "151", "152", "157", "158", "159", "134", "135", "136", "137", "138", "139", "150", "151", "152", "157", "158", "159",
......
...@@ -18,18 +18,11 @@ ...@@ -18,18 +18,11 @@
</foreach> </foreach>
</select> </select>
<!-- 判断手机号是否在库里 -->
<select id="queryIfPhoneExist" resultType="object"> <select id="queryIfPhoneExist" resultType="object">
SELECT * FROM `user` where phone_no = #{phone} SELECT * FROM `user` where phone_no = #{phone}
</select> </select>
<!-- 获取审核通过用户列表 -->
<select id="getReviewPassedUserIdList" resultType="java.lang.String">
SELECT `user_id` FROM `apply_funding_risk_record`
<where>
`apply_status` = 2
</where>
</select>
<!-- 根据userIdList获取用户信息List --> <!-- 根据userIdList获取用户信息List -->
<select id="getUserDataListByUserIdList" resultType="cn.quantgroup.qaplatform.domain.LoanUser"> <select id="getUserDataListByUserIdList" resultType="cn.quantgroup.qaplatform.domain.LoanUser">
SELECT `id` as userId, `uuid`, `phone_no` as phoneNo, `registered_from` as registeredFrom, `enable`, `created_at` as createdAt FROM `user` SELECT `id` as userId, `uuid`, `phone_no` as phoneNo, `registered_from` as registeredFrom, `enable`, `created_at` as createdAt FROM `user`
...@@ -39,4 +32,20 @@ ...@@ -39,4 +32,20 @@
</foreach> </foreach>
</select> </select>
<!-- 获取不同放款状态的用户Id列表 xyqb库 -->
<select id="getLoanStatusUserIdList" resultType="java.lang.String">
SELECT `user_id` FROM `loan_application_history`
<where>
`progress` = #{status}
</where>
</select>
<!-- 根据不同审核状态返回用户Id列表 -->
<select id="getAuditStatusUserIdList" resultType="java.lang.String">
SELECT `user_id` FROM apply_quota_record
<where>
`apply_status` = #{status}
</where>
</select>
</mapper> </mapper>
\ No newline at end of file
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