parent
8612fb5c39
commit
f553524baa
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.system.api;
|
||||
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.system.api.factory.RemoteChannelFallbackFactory;
|
||||
import com.ruoyi.system.api.factory.RemoteCustomerApplyLogFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 用户服务
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@FeignClient(contextId = "remoteChannelService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteChannelFallbackFactory.class)
|
||||
public interface RemoteChannelService
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.ruoyi.system.api.factory;
|
||||
|
||||
|
||||
import com.ruoyi.system.api.RemoteChannelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class RemoteChannelFallbackFactory implements FallbackFactory<RemoteChannelService>
|
||||
{
|
||||
|
||||
@Override
|
||||
public RemoteChannelService create(Throwable throwable)
|
||||
{
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteChannelService()
|
||||
{
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.common.core.constant;
|
||||
|
||||
public class RedisConstant {
|
||||
|
||||
/**
|
||||
* 用户登录缓存
|
||||
*/
|
||||
public final static String APP_CUSTOMER_KEY = CacheConstants.PROJET + ":customer:key:";
|
||||
|
||||
/**
|
||||
* 用户名缓存
|
||||
*/
|
||||
public final static String APP_CUSTOMER_USERNAME_KEY = CacheConstants.PROJET + ":app:customer:username:key:";
|
||||
/**
|
||||
* 渠道ID缓存
|
||||
*/
|
||||
public final static String APP_CUSTOMER_CHANNEL_KEY = CacheConstants.PROJET + ":app:customer:channel:key:";
|
||||
/**
|
||||
* 用户登录缓存
|
||||
*/
|
||||
public final static String APP_CUSTOMER_TOKEN_KEY = CacheConstants.PROJET + ":app:customer:token:key:";
|
||||
|
||||
/**
|
||||
* app用户设备标识
|
||||
*/
|
||||
public final static String APP_DEVICE_IDENTIFICATION = CacheConstants.PROJET + ":app:app:device:identification:";
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.ruoyi.common.core.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 概率计算
|
||||
* @Author: daisi
|
||||
* @Date: 2022/4/2 9:49
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class GuestProbabilityReq implements Serializable {
|
||||
private static final long serialVersionUID = -9096451963988288187L;
|
||||
|
||||
/**
|
||||
* 计划Id
|
||||
*/
|
||||
private Long planId;
|
||||
/**
|
||||
* 排序价格
|
||||
*/
|
||||
private BigDecimal orderPrice;
|
||||
/**
|
||||
* 概率
|
||||
*/
|
||||
private Double guestProbability;
|
||||
/**
|
||||
* 计算结果概率
|
||||
*/
|
||||
private Integer resultGuestProbability;
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package com.ruoyi.common.core.domain.http;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 客户申请记录对象 customer_apply_log
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-09-15
|
||||
*/
|
||||
@Data
|
||||
public class CustomerApplyLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 用户id */
|
||||
@Excel(name = "用户id")
|
||||
private Long customerId;
|
||||
|
||||
/** 商户ID */
|
||||
@Excel(name = "商户ID")
|
||||
private Long merchantId;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long channelId;
|
||||
|
||||
/** 订单状态 0 已申请 1 注册中 2风控中 3下单中 4 下单成功 5已成交 */
|
||||
@Excel(name = "订单状态 0 已申请 1 注册中 2风控中 3下单中 4 下单成功 5已成交 ")
|
||||
private Long orderStatus;
|
||||
|
||||
/** 成交金额 分 */
|
||||
@Excel(name = "成交金额 分")
|
||||
private BigDecimal price;
|
||||
|
||||
}
|
@ -0,0 +1,155 @@
|
||||
package com.ruoyi.common.core.utils;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.GuestProbabilityReq;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 计算助贷计划概率
|
||||
* @Author: daisi
|
||||
* @Date: 2022/4/2 11:10
|
||||
*/
|
||||
@Slf4j
|
||||
public class ProbitUtil {
|
||||
public static GuestProbabilityReq calculatePlanTheProbability(List<GuestProbabilityReq> guestProbabilityReqs) {
|
||||
//按排序价格排序
|
||||
Collections.sort(guestProbabilityReqs, new Comparator<GuestProbabilityReq>() {
|
||||
@Override
|
||||
public int compare(GuestProbabilityReq o1, GuestProbabilityReq o2) {
|
||||
return o2.getOrderPrice().compareTo(o1.getOrderPrice());
|
||||
}
|
||||
});
|
||||
List<GuestProbabilityReq> list = new ArrayList<>(5);
|
||||
for (GuestProbabilityReq guestProbabilityReq : guestProbabilityReqs) {
|
||||
// if (guestProbabilityReq.getOrderPrice().compareTo(guestProbabilityReqs.get(0).getOrderPrice()) == 0) {
|
||||
// list.add(guestProbabilityReq);
|
||||
// }
|
||||
list.add(guestProbabilityReq);
|
||||
}
|
||||
log.info("排序后的数据:{}",list);
|
||||
//重置概率
|
||||
resetTranslate(list);
|
||||
int index = drawGift(list);
|
||||
return guestProbabilityReqs.get(index);
|
||||
}
|
||||
|
||||
private static List<GuestProbabilityReq> resetTranslate(List<GuestProbabilityReq> reqs) {
|
||||
if (reqs.size()!=1){
|
||||
//高值得一部分
|
||||
int count = 0;
|
||||
//获取计数
|
||||
BigDecimal orderPrice = reqs.get(0).getOrderPrice();
|
||||
for (int i = 0; i < reqs.size(); i++) {
|
||||
if (i+1<reqs.size()&&reqs.get(i).getOrderPrice().compareTo(reqs.get(i+1).getOrderPrice())==0&&orderPrice.compareTo(reqs.get(i).getOrderPrice())==0){
|
||||
count++;
|
||||
}
|
||||
}
|
||||
///获取最高的概率
|
||||
BigDecimal bigDecimal = new BigDecimal(reqs.get(0).getGuestProbability().toString());
|
||||
if (count!=0){
|
||||
//用最高的概率除以计数 得到最高价的平均概率
|
||||
BigDecimal divide = bigDecimal.divide(new BigDecimal(count+1),3,BigDecimal.ROUND_DOWN);
|
||||
for (int i = 0; i <= count; i++) {
|
||||
//循环重设最高概率
|
||||
reqs.get(i).setGuestProbability(divide.doubleValue());
|
||||
}
|
||||
}
|
||||
//低值得一部分
|
||||
BigDecimal remTotal = new BigDecimal(1).subtract(bigDecimal);
|
||||
BigDecimal b = remTotal.divide(new BigDecimal((reqs.size()-count-1)==0?1:(reqs.size()-count-1)),3,BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
for (int i = count+1; i < reqs.size(); i++) {
|
||||
reqs.get(i).setGuestProbability(b.doubleValue());
|
||||
}
|
||||
|
||||
}
|
||||
//log.info("重置概率后的概率,{}",reqs);
|
||||
return reqs;
|
||||
}
|
||||
|
||||
public static int drawGift(List<GuestProbabilityReq> guestProbabilityReqList) {
|
||||
if (null != guestProbabilityReqList && guestProbabilityReqList.size() > 0) {
|
||||
List<Double> orgProbList = new ArrayList<Double>(guestProbabilityReqList.size());
|
||||
for (GuestProbabilityReq guest : guestProbabilityReqList) {
|
||||
//按顺序将概率添加到集合中
|
||||
orgProbList.add(guest.getGuestProbability());
|
||||
}
|
||||
return draw(orgProbList);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
public static int draw(List<Double> giftProbList) {
|
||||
List<Double> sortRateList = new ArrayList<Double>();
|
||||
// 计算概率总和
|
||||
Double sumRate = 0D;
|
||||
for (Double prob : giftProbList) {
|
||||
sumRate += prob;
|
||||
}
|
||||
if (sumRate != 0) {
|
||||
double rate = 0D; //概率所占比例
|
||||
for (Double prob : giftProbList) {
|
||||
rate += prob;
|
||||
// 构建一个比例区段组成的集合(避免概率和不为1)
|
||||
sortRateList.add(rate / sumRate);
|
||||
}
|
||||
// 随机生成一个随机数,并排序
|
||||
double random = Math.random();
|
||||
sortRateList.add(random);
|
||||
Collections.sort(sortRateList);
|
||||
// 返回该随机数在比例集合中的索引
|
||||
return sortRateList.indexOf(random);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
//// System.out.println(LocalDateTimeUtils.getStringFromLocalDateTime(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.offset(LocalDateTime.now(), -7, ChronoUnit.DAYS))));
|
||||
//// System.out.println(LocalDateTimeUtils.getStringFromLocalDateTime(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.offset(LocalDateTime.now(), -1, ChronoUnit.DAYS))));
|
||||
// int a=0;
|
||||
// List<GuestProbabilityReq> guestProbabilityReqs = new ArrayList<>();
|
||||
// for (int i = 0; i < 20; i++) {
|
||||
// List<GuestProbabilityReq> list = new ArrayList<>();
|
||||
// GuestProbabilityReq req = new GuestProbabilityReq();
|
||||
// req.setPlanId(1L).setOrderPrice(new BigDecimal(104.00)).setGuestProbability(0.8D);
|
||||
//
|
||||
// GuestProbabilityReq req1 = new GuestProbabilityReq();
|
||||
// req1.setPlanId(2L).setOrderPrice(new BigDecimal(120)).setGuestProbability(0.8D);
|
||||
//
|
||||
// GuestProbabilityReq req2 = new GuestProbabilityReq();
|
||||
// req2.setPlanId(3L).setOrderPrice(new BigDecimal(90)).setGuestProbability(0.8D);
|
||||
//
|
||||
// GuestProbabilityReq req3 = new GuestProbabilityReq();
|
||||
// req3.setPlanId(4L).setOrderPrice(new BigDecimal(110)).setGuestProbability(0.4D);
|
||||
//
|
||||
// GuestProbabilityReq req4 = new GuestProbabilityReq();
|
||||
// req4.setPlanId(5L).setOrderPrice(new BigDecimal(110)).setGuestProbability(0.6D);
|
||||
////
|
||||
//// GuestProbabilityReq req5 = new GuestProbabilityReq();
|
||||
//// req5.setPlanId(6L).setOrderPrice(new BigDecimal(80)).setGuestProbability(0.6D);
|
||||
//
|
||||
// list.add(req);
|
||||
// list.add(req1);
|
||||
// list.add(req2);
|
||||
// list.add(req3);
|
||||
// list.add(req4);
|
||||
//// list.add(req5);
|
||||
//
|
||||
// guestProbabilityReqs.add(calculatePlanTheProbability(list));
|
||||
//
|
||||
// }
|
||||
// int b = 0;
|
||||
// int c = 0;
|
||||
// for (GuestProbabilityReq req:guestProbabilityReqs) {
|
||||
// if (req.getPlanId()==2){
|
||||
// b++;
|
||||
// }else {
|
||||
// c++;
|
||||
// }
|
||||
// }
|
||||
// System.out.println("几率:"+c+" "+b);
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.ruoyi.btc.controller;
|
||||
|
||||
import com.ruoyi.btc.domain.ComPublicHalfDto;
|
||||
import com.ruoyi.btc.service.ISysPublicAllService;
|
||||
import com.ruoyi.btc.service.ISysPublicHalfService;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 半流程API接口写这里
|
||||
*
|
||||
* @author z
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/all/api")
|
||||
@RequiredArgsConstructor
|
||||
public class PublicAllController {
|
||||
private final ISysPublicAllService sysPublicAllService;
|
||||
|
||||
/**
|
||||
* 通用半流程撞库
|
||||
*/
|
||||
@PostMapping("check")
|
||||
public AjaxResult upload(@RequestBody ComPublicHalfDto comPublicHalfDto)
|
||||
{
|
||||
sysPublicAllService.check(comPublicHalfDto);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用半流程撞库
|
||||
*/
|
||||
@PostMapping("input")
|
||||
public AjaxResult input(@RequestBody ComPublicHalfDto comPublicHalfDto)
|
||||
{
|
||||
sysPublicAllService.input(comPublicHalfDto);
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.ruoyi.btc.service;
|
||||
|
||||
import com.ruoyi.btc.domain.ComPublicHalfDto;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
public interface ISysPublicAllService
|
||||
{
|
||||
|
||||
/**
|
||||
* 半流程通用撞库接口
|
||||
* @param comPublicHalfDto
|
||||
*/
|
||||
AjaxResult check(ComPublicHalfDto comPublicHalfDto);
|
||||
|
||||
/**
|
||||
* 半流程通用进件
|
||||
* @param comPublicHalfDto
|
||||
*/
|
||||
AjaxResult input(ComPublicHalfDto comPublicHalfDto);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,249 @@
|
||||
package com.ruoyi.btc.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.btc.domain.ComPublicHalfDto;
|
||||
import com.ruoyi.btc.domain.CustomerInfoDto;
|
||||
import com.ruoyi.btc.service.ISysPublicAllService;
|
||||
import com.ruoyi.common.core.constant.CacheConstants;
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.common.core.domain.http.Channel;
|
||||
import com.ruoyi.common.core.domain.http.Customer;
|
||||
import com.ruoyi.common.core.domain.http.CustomerApplyLog;
|
||||
import com.ruoyi.common.core.domain.http.Merchant;
|
||||
import com.ruoyi.common.core.utils.ProbitUtil;
|
||||
import com.ruoyi.common.core.utils.SecureUtils;
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.ruoyi.common.redis.service.RedisService;
|
||||
import com.ruoyi.system.api.RemoteCustomerApplyLogService;
|
||||
import com.ruoyi.system.api.RemoteCustomerService;
|
||||
import com.ruoyi.system.api.RemoteMerchantService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 本地文件存储
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class SysPublicAllServiceImpl implements ISysPublicAllService
|
||||
{
|
||||
private final RemoteCustomerService remoteCustomerService;
|
||||
private final RemoteMerchantService remoteMerchantService;
|
||||
private final RemoteCustomerApplyLogService remoteCustomerApplyLogService;
|
||||
private final RedisService redisService;
|
||||
|
||||
/**
|
||||
* 半流程通用撞库
|
||||
* @param comPublicHalfDto
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult check(ComPublicHalfDto comPublicHalfDto) {
|
||||
//校验 IP地址是否正常 渠道标识是否存在 数据是否为空
|
||||
|
||||
if (StringUtils.isEmpty(comPublicHalfDto.getChannelSignature())){
|
||||
return AjaxResult.error("渠道标识不能未空");
|
||||
}
|
||||
Channel channel = redisService.getCacheObject(CacheConstants.CHANNEL_SIGN + comPublicHalfDto.getChannelSignature());
|
||||
if (channel==null||channel.getId()==null){
|
||||
return AjaxResult.error("渠道不存在");
|
||||
}
|
||||
if (StringUtils.isEmpty(comPublicHalfDto.getData())){
|
||||
return AjaxResult.error("加密数据不能为空");
|
||||
}
|
||||
//解密为customerInfoDto
|
||||
String s = SecureUtils.AesUtil.AesDecode(comPublicHalfDto.getData(), comPublicHalfDto.getChannelSignature());
|
||||
if (s==null){
|
||||
return AjaxResult.error("解密异常");
|
||||
}
|
||||
CustomerInfoDto customerInfoDto = JSONObject.parseObject(s, CustomerInfoDto.class);
|
||||
//校验数据必传参数是否未传
|
||||
String checkData = checkData(customerInfoDto);
|
||||
if (checkData!=null){
|
||||
return AjaxResult.error(checkData);
|
||||
}
|
||||
//转化字段未数据库中资质字段 并保存 用户未实名状态 一并保存用户申请记录 未申请状态
|
||||
Customer customer = new Customer();
|
||||
BeanUtil.copyProperties(customerInfoDto,customer);
|
||||
customer.setChannelId(channel.getId());
|
||||
customer.setActurlName(customerInfoDto.getNameMd5());
|
||||
customer.setFirstLoginTime(new Date());
|
||||
customer.setLastLoginTime(new Date());
|
||||
customer.setIsAuth(false);
|
||||
customer.setStatus(2);
|
||||
R<Customer> customerInfoByPhoneMd5 = remoteCustomerService.getCustomerInfoByPhoneMd5(customerInfoDto.getPhoneMd5(), SecurityConstants.INNER);
|
||||
if (customerInfoByPhoneMd5.getCode()==200){
|
||||
remoteCustomerService.updateByPhoneMd5(customer,SecurityConstants.INNER);
|
||||
}else {
|
||||
remoteCustomerService.add(customer,SecurityConstants.INNER);
|
||||
}
|
||||
//TODO 暂时不做 目前下游暂时不需要 匹配资质 造轮子 返回多个符合的商户
|
||||
List<Merchant> merchants = matchMerchant(customer);
|
||||
//结束返回上游结果
|
||||
Map<String,Boolean> re = new HashMap<>();
|
||||
if (merchants.size()>0){
|
||||
re.put("data",true);
|
||||
return AjaxResult.success(re);
|
||||
}
|
||||
re.put("data",false);
|
||||
return AjaxResult.success(re);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取前筛符合的商户
|
||||
* @param customer
|
||||
*/
|
||||
private List<Merchant> matchMerchant(Customer customer) {
|
||||
R<List<Merchant>> listR = remoteMerchantService.merchantList(SecurityConstants.INNER);
|
||||
if (listR.getCode()!=200){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
List<Merchant> merchants = new ArrayList<>();
|
||||
for (Merchant merchant:listR.getData()) {
|
||||
//限量判定
|
||||
R<Integer> sum = remoteCustomerApplyLogService.sum(merchant.getId(), SecurityConstants.INNER);
|
||||
if (merchant.getLimitType()==1&&merchant.getLimitNum()<=sum.getData()){
|
||||
continue;
|
||||
}
|
||||
|
||||
if (customer.getAge()<merchant.getAgeLimitStart()||customer.getAge()>merchant.getAgeLimitEnd()){
|
||||
continue;
|
||||
}
|
||||
if (merchant.getChannelLimitType()==1||merchant.getChannelLimitType()==2){
|
||||
|
||||
List<Long> list = Arrays.asList(merchant.getChannelLimit().split(",")).stream().map(val->Long.parseLong(val)).collect(Collectors.toList());
|
||||
if (merchant.getChannelLimitType()==1&& !list.contains(customer.getChannelId())){
|
||||
continue;
|
||||
}
|
||||
if (merchant.getChannelLimitType()==2&& list.contains(customer.getChannelId())){
|
||||
continue;
|
||||
}
|
||||
}
|
||||
merchants.add(merchant);
|
||||
}
|
||||
return merchants;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数
|
||||
* @param customerInfoDto
|
||||
*/
|
||||
private String checkData(CustomerInfoDto customerInfoDto) {
|
||||
if (customerInfoDto.getAge()==null){
|
||||
return "年龄不能为空";
|
||||
}
|
||||
if (StringUtils.isEmpty(customerInfoDto.getPhoneMd5())){
|
||||
return "手机号MD5不能为空";
|
||||
}
|
||||
if (StringUtils.isEmpty(customerInfoDto.getCity())){
|
||||
return "城市不能为空";
|
||||
}
|
||||
if (customerInfoDto.getCityCode()==null){
|
||||
return "城市编码不能为空";
|
||||
}
|
||||
if (customerInfoDto.getSocialSecurity()==null){
|
||||
return "本地社保不能为空";
|
||||
}
|
||||
if (customerInfoDto.getAccumulationFund()==null){
|
||||
return "本地公积金不能为空";
|
||||
}
|
||||
if (customerInfoDto.getCar()==null){
|
||||
return "车产不能为空";
|
||||
}
|
||||
if (customerInfoDto.getHourse()==null){
|
||||
return "房产不能为空";
|
||||
}
|
||||
if (customerInfoDto.getGuarantee()==null){
|
||||
return "房产不能为空";
|
||||
}
|
||||
if (customerInfoDto.getZhiMa()==null){
|
||||
return "芝麻分不能为空";
|
||||
}
|
||||
if (customerInfoDto.getCareer()==null){
|
||||
return "职业不能为空";
|
||||
}
|
||||
if (customerInfoDto.getCreditCard()==null){
|
||||
return "信用卡不能为空";
|
||||
}
|
||||
if (customerInfoDto.getEducation()==null){
|
||||
return "学历不能为空";
|
||||
}
|
||||
if (customerInfoDto.getMonthlyIncome()==null){
|
||||
return "月收入不能为空";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 半流程通用进件
|
||||
* @param comPublicHalfDto
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult input(ComPublicHalfDto comPublicHalfDto) {
|
||||
//校验 IP地址是否正常 渠道标识是否存在 数据是否为空
|
||||
if (StringUtils.isEmpty(comPublicHalfDto.getChannelSignature())){
|
||||
return AjaxResult.error("渠道标识不能未空");
|
||||
}
|
||||
Channel channel = redisService.getCacheObject(CacheConstants.CHANNEL_SIGN + comPublicHalfDto.getChannelSignature());
|
||||
if (channel==null||channel.getId()==null){
|
||||
return AjaxResult.error("渠道不存在");
|
||||
}
|
||||
if (StringUtils.isEmpty(comPublicHalfDto.getData())){
|
||||
return AjaxResult.error("加密数据不能为空");
|
||||
}
|
||||
//解密为customerInfoDto
|
||||
String s = SecureUtils.AesUtil.AesDecode(comPublicHalfDto.getData(), comPublicHalfDto.getChannelSignature());
|
||||
if (s==null){
|
||||
return AjaxResult.error("解密异常");
|
||||
}
|
||||
CustomerInfoDto customerInfoDto = JSONObject.parseObject(s, CustomerInfoDto.class);
|
||||
//校验数据必传参数是否未传
|
||||
String checkData = checkData(customerInfoDto);
|
||||
//转化字段未数据库中资质字段 更新 用户实名状态 一并保存用户申请记录 已申请
|
||||
if (checkData!=null){
|
||||
return AjaxResult.error(checkData);
|
||||
}
|
||||
//转化字段未数据库中资质字段 并保存 用户未实名状态 一并保存用户申请记录 未申请状态
|
||||
Customer customer = new Customer();
|
||||
BeanUtil.copyProperties(customerInfoDto,customer);
|
||||
customer.setChannelId(channel.getId());
|
||||
customer.setActurlName(customerInfoDto.getName());
|
||||
customer.setFirstLoginTime(new Date());
|
||||
customer.setLastLoginTime(new Date());
|
||||
customer.setIsAuth(true);
|
||||
customer.setStatus(1);
|
||||
R<Customer> customerInfoByPhoneMd5 = remoteCustomerService.getCustomerInfoByPhoneMd5(customerInfoDto.getPhoneMd5(), SecurityConstants.INNER);
|
||||
if (customerInfoByPhoneMd5.getCode()==200){
|
||||
remoteCustomerService.updateByPhoneMd5(customer,SecurityConstants.INNER);
|
||||
}else {
|
||||
return AjaxResult.error("今日未撞库");
|
||||
}
|
||||
//匹配资质 造轮子 返回多个符合的商户
|
||||
List<Merchant> merchants = matchMerchant(customer);
|
||||
//TODO 取排序第一的
|
||||
|
||||
//返回渠道绑定的注册页拼接token
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
|
||||
//TODO 下游是H5承接不了上游全流程 暂时不做
|
||||
CustomerApplyLog customerApplyLog = new CustomerApplyLog();
|
||||
customerApplyLog.setCustomerId(customerInfoByPhoneMd5.getData().getId());
|
||||
customerApplyLog.setChannelId(channel.getId());
|
||||
customerApplyLog.setMerchantId(merchants.get(0).getId());
|
||||
customerApplyLog.setOrderStatus(0l);
|
||||
remoteCustomerApplyLogService.add(customerApplyLog);
|
||||
//返回上游信息
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.ruoyi.system.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Minio 配置信息
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "system")
|
||||
@Data
|
||||
public class SystemConfig
|
||||
{
|
||||
/**
|
||||
* 加密密钥
|
||||
*/
|
||||
private String AESkey;
|
||||
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 客户申请记录对象 customer_apply_log
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-09-15
|
||||
*/
|
||||
public class CustomerApplyLog extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** 用户id */
|
||||
@Excel(name = "用户id")
|
||||
private Long customerId;
|
||||
|
||||
/** 商户ID */
|
||||
@Excel(name = "商户ID")
|
||||
private Long merchantId;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Long channelId;
|
||||
|
||||
/** 订单状态 0 已申请 1 注册中 2风控中 3下单中 4 下单成功 5已成交 */
|
||||
@Excel(name = "订单状态 0 已申请 1 注册中 2风控中 3下单中 4 下单成功 5已成交 ")
|
||||
private Long orderStatus;
|
||||
|
||||
/** 成交金额 分 */
|
||||
@Excel(name = "成交金额 分")
|
||||
private BigDecimal price;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setCustomerId(Long customerId)
|
||||
{
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public Long getCustomerId()
|
||||
{
|
||||
return customerId;
|
||||
}
|
||||
public void setMerchantId(Long merchantId)
|
||||
{
|
||||
this.merchantId = merchantId;
|
||||
}
|
||||
|
||||
public Long getMerchantId()
|
||||
{
|
||||
return merchantId;
|
||||
}
|
||||
public void setChannelId(Long channelId)
|
||||
{
|
||||
this.channelId = channelId;
|
||||
}
|
||||
|
||||
public Long getChannelId()
|
||||
{
|
||||
return channelId;
|
||||
}
|
||||
public void setOrderStatus(Long orderStatus)
|
||||
{
|
||||
this.orderStatus = orderStatus;
|
||||
}
|
||||
|
||||
public Long getOrderStatus()
|
||||
{
|
||||
return orderStatus;
|
||||
}
|
||||
public void setPrice(BigDecimal price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public BigDecimal getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("customerId", getCustomerId())
|
||||
.append("merchantId", getMerchantId())
|
||||
.append("channelId", getChannelId())
|
||||
.append("orderStatus", getOrderStatus())
|
||||
.append("price", getPrice())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
Loading…
Reference in new issue