mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-29 04:51:58 +08:00
2024-09-16 半流程
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,10 +5,7 @@ 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.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 半流程API接口写这里
|
||||
@@ -46,10 +43,10 @@ public class PublicHalfController{
|
||||
/**
|
||||
* 通用半流程撞库
|
||||
*/
|
||||
@PostMapping("checkOrder")
|
||||
public AjaxResult checkOrder(@RequestBody ComPublicHalfDto comPublicHalfDto)
|
||||
@GetMapping("checkOrder")
|
||||
public AjaxResult checkOrder(@RequestParam("phoneMD5")String phoneMd5,@RequestParam("channelSign")String channelSign)
|
||||
{
|
||||
sysPublicHalfService.checkOrder(comPublicHalfDto);
|
||||
sysPublicHalfService.checkOrder(phoneMd5,channelSign);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -6,14 +6,20 @@ import lombok.Data;
|
||||
public class CustomerInfoDto {
|
||||
//手机号码(Md5)
|
||||
private String phoneMd5;
|
||||
//手机号
|
||||
private String phone;
|
||||
//性别 0 男 1 女
|
||||
private Integer sex;
|
||||
//手机号码(Md5)
|
||||
private String nameMd5;
|
||||
//姓名
|
||||
private String name;
|
||||
//年龄
|
||||
private Integer age;
|
||||
//手身份证md5
|
||||
private String idCardMd5;
|
||||
//身份证好
|
||||
private String idCard;
|
||||
//所在城市
|
||||
private String city;
|
||||
//所在城市代码
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.btc.service;
|
||||
|
||||
import com.ruoyi.btc.domain.ComPublicHalfDto;
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* 文件上传接口
|
||||
@@ -25,8 +26,8 @@ public interface ISysPublicHalfService
|
||||
|
||||
/**
|
||||
* 渠道查询订单是否成功
|
||||
* @param comPublicHalfDto
|
||||
* @param
|
||||
*/
|
||||
AjaxResult checkOrder(ComPublicHalfDto comPublicHalfDto);
|
||||
AjaxResult checkOrder(String phoneMd5, String channelSign);
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
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;
|
||||
@@ -10,7 +11,9 @@ 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;
|
||||
@@ -20,6 +23,7 @@ import com.ruoyi.system.api.RemoteCustomerService;
|
||||
import com.ruoyi.system.api.RemoteMerchantService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -186,21 +190,66 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService
|
||||
@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<>();
|
||||
if (CollectionUtil.isEmpty(merchants)){
|
||||
map.put("url","");
|
||||
map.put("regist",false);
|
||||
result.put("data",map);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
String url = channel.getHtmlLocation() + "token="+remoteCustomerService.getCustomerToken(customer.getPhone());
|
||||
map.put("url",url);
|
||||
map.put("regist",true);
|
||||
result.put("data",map);
|
||||
CustomerApplyLog customerApplyLog = new CustomerApplyLog();
|
||||
customerApplyLog.setCustomerId(customerInfoByPhoneMd5.getData().getId());
|
||||
customerApplyLog.setChannelId(channel.getId());
|
||||
customerApplyLog.setOrderStatus(0l);
|
||||
remoteCustomerApplyLogService.add(customerApplyLog);
|
||||
//返回上游信息
|
||||
return null;
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -208,14 +257,25 @@ public class SysPublicHalfServiceImpl implements ISysPublicHalfService
|
||||
* @param comPublicHalfDto
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult checkOrder(ComPublicHalfDto comPublicHalfDto) {
|
||||
public AjaxResult checkOrder(String phoneMd5, String channelSign) {
|
||||
//根据手机号MD5渠道标识 查询是否成功
|
||||
|
||||
R<Customer> customerInfoByPhoneMd5 = remoteCustomerService.getCustomerInfoByPhoneMd5(phoneMd5, SecurityConstants.INNER);
|
||||
Channel channel = redisService.getCacheObject(CacheConstants.CHANNEL_ID + customerInfoByPhoneMd5.getData().getChannelId());
|
||||
R<Boolean> booleanR = remoteCustomerApplyLogService.customerApply(customerInfoByPhoneMd5.getData().getId(), SecurityConstants.INNER);
|
||||
//失败直接失败
|
||||
|
||||
if (!booleanR.getData()){
|
||||
return AjaxResult.success("用户未申请","false");
|
||||
}
|
||||
//成功抽奖 按扣量比抽
|
||||
|
||||
//成功数
|
||||
double succ = channel.getScore()*0.01;
|
||||
//扣量数
|
||||
double socre = 1-(channel.getScore()*0.01);
|
||||
List<Double> drow = new ArrayList<>();
|
||||
drow.add(succ);
|
||||
drow.add(socre);
|
||||
int draw = ProbitUtil.draw(drow);
|
||||
//返回是否成功
|
||||
return null;
|
||||
return draw==0?AjaxResult.success("用户已申请",true):AjaxResult.success("用户未申请","false");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user