Merge branch 'test' into dev
This commit is contained in:
commit
d5078718a6
|
|
@ -3,13 +3,11 @@ package com.sqx.modules.discSpinning.controller;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.util.concurrent.RateLimiter;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
import com.sqx.modules.app.entity.UserMoney;
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
|
|
@ -39,11 +37,8 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
|
|
@ -282,29 +277,38 @@ public class DiscSpinningController {
|
|||
double baseRandom = random.nextDouble();
|
||||
if (baseRandom < 0.8) {
|
||||
// 0.8到0.82范围内概率最大(这里示例以当前订单金额为基础,模拟类似0.8的情况)
|
||||
resultAmount = orderAmount + (random.nextDouble() * 0.02);
|
||||
resultAmount = random.nextDouble() * 0.02;
|
||||
} else if (baseRandom < 0.9) {
|
||||
// 0.82 - 0.85范围概率小一些
|
||||
resultAmount = orderAmount + (0.02 + (random.nextDouble() * 0.03));
|
||||
resultAmount = 0.02 + (random.nextDouble() * 0.03);
|
||||
} else if (baseRandom < 0.95) {
|
||||
// 0.85 - 0.9概率更小
|
||||
resultAmount = orderAmount + (0.05 + (random.nextDouble() * 0.05));
|
||||
} else if (baseRandom < 0.99) {
|
||||
resultAmount = 0.05 + (random.nextDouble() * 0.05);
|
||||
} else if (baseRandom < 0.97) {
|
||||
// 0.9 - 1概率更小
|
||||
resultAmount = orderAmount + (0.1 + (random.nextDouble() * 0.1));
|
||||
} else {
|
||||
// 1 - 20概率依次递减
|
||||
// 控制最大金额为80
|
||||
resultAmount = 1 + (random.nextDouble() * (maxAmount - 1));
|
||||
resultAmount = 0.1 + (random.nextDouble() * 0.1);
|
||||
} else if (baseRandom < 0.99) {
|
||||
//1 - 1.3 概率更小
|
||||
resultAmount = 0.2 + (random.nextDouble() * 0.3);
|
||||
}
|
||||
// else {
|
||||
// // 1.3 - 控制最大金额为80
|
||||
// resultAmount = 1 + (random.nextDouble() * (maxAmount - 1));
|
||||
// }
|
||||
if (resultAmount == 0) {
|
||||
resultAmount = 0.01;
|
||||
}
|
||||
resultAmount = orderAmount + resultAmount;
|
||||
if (resultAmount > maxAmount) {
|
||||
resultAmount = maxAmount;
|
||||
}
|
||||
}
|
||||
if (resultAmount > maxAmount) {
|
||||
resultAmount = maxAmount;
|
||||
}
|
||||
result = new DiscSpinning(prize.getName(), 2, new BigDecimal(resultAmount).setScale(2, RoundingMode.HALF_UP));
|
||||
} else {
|
||||
result = prize;
|
||||
break;
|
||||
}
|
||||
// else {
|
||||
// result = prize;
|
||||
// }
|
||||
}
|
||||
}
|
||||
DiscSpinningRecord record = new DiscSpinningRecord(result.getName(), orderId, userId, result.getType(),
|
||||
|
|
|
|||
|
|
@ -362,23 +362,24 @@ public class OrdersServiceImpl extends ServiceImpl<OrdersDao, Orders> implements
|
|||
orders.setPayTime(DateUtils.format(new Date()));
|
||||
|
||||
|
||||
UserEntity byUser = userService.queryByInvitationCode(userEntity.getInviterCode());
|
||||
Map map = inviteService.updateInvite(byUser, DateUtils.format(new Date()), userEntity.getUserId(), orders.getPayMoney());
|
||||
Object oneUserId = map.get("oneUserId");
|
||||
if (oneUserId != null) {
|
||||
orders.setOneUserId(Long.parseLong(String.valueOf(oneUserId)));
|
||||
orders.setOneMoney(new BigDecimal(String.valueOf(map.get("oneMoney"))));
|
||||
}
|
||||
Object twoUserId = map.get("twoUserId");
|
||||
if (twoUserId != null) {
|
||||
orders.setTwoUserId(Long.parseLong(String.valueOf(twoUserId)));
|
||||
orders.setTwoMoney(new BigDecimal(String.valueOf(map.get("twoMoney"))));
|
||||
}
|
||||
Object sysUserId = map.get("sysUserId");
|
||||
if (sysUserId != null) {
|
||||
orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
}
|
||||
// 金豆支付不给佣金
|
||||
// UserEntity byUser = userService.queryByInvitationCode(userEntity.getInviterCode());
|
||||
// Map map = inviteService.updateInvite(byUser, DateUtils.format(new Date()), userEntity.getUserId(), orders.getPayMoney());
|
||||
// Object oneUserId = map.get("oneUserId");
|
||||
// if (oneUserId != null) {
|
||||
// orders.setOneUserId(Long.parseLong(String.valueOf(oneUserId)));
|
||||
// orders.setOneMoney(new BigDecimal(String.valueOf(map.get("oneMoney"))));
|
||||
// }
|
||||
// Object twoUserId = map.get("twoUserId");
|
||||
// if (twoUserId != null) {
|
||||
// orders.setTwoUserId(Long.parseLong(String.valueOf(twoUserId)));
|
||||
// orders.setTwoMoney(new BigDecimal(String.valueOf(map.get("twoMoney"))));
|
||||
// }
|
||||
// Object sysUserId = map.get("sysUserId");
|
||||
// if (sysUserId != null) {
|
||||
// orders.setSysUserId(Long.parseLong(String.valueOf(sysUserId)));
|
||||
// orders.setQdMoney(new BigDecimal(String.valueOf(map.get("qdMoney"))));
|
||||
// }
|
||||
baseMapper.updateById(orders);
|
||||
insertOrders(orders);
|
||||
return Result.success();
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.sqx.modules.pay.controller.app;
|
|||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.entity.UserEntity;
|
||||
|
|
@ -68,6 +69,7 @@ public class WuyouController {
|
|||
this.commonRepository = commonRepository;
|
||||
}
|
||||
|
||||
@Debounce(interval = 1000, value = "#orderId")
|
||||
@ApiOperation("支付订单")
|
||||
@GetMapping("/payOrder/{orderId}")
|
||||
public Result payOrder(HttpServletRequest request, @PathVariable("orderId") Long orderId) {
|
||||
|
|
@ -130,8 +132,8 @@ public class WuyouController {
|
|||
cashOut.setRefund(notifyDto.getMsg());
|
||||
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
cashOut.getUserId(),null,null,"提现失败",4,1,1,
|
||||
new BigDecimal(cashOut.getMoney()),"提现失败存入余额" + cashOut.getMoney() + "元");
|
||||
cashOut.getUserId(), null, null, "提现失败", 4, 1, 1,
|
||||
new BigDecimal(cashOut.getMoney()), "提现失败存入余额" + cashOut.getMoney() + "元");
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, cashOut.getUserId(), Double.parseDouble(cashOut.getMoney()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public class WuyouPay {
|
|||
|
||||
String sign = Encrypt.getParamsSign(params);
|
||||
params.put("sign", sign);
|
||||
params.put("return_url", "https://dj-h5.hnsiyao.cn/pay/success");
|
||||
|
||||
String body = request(Constants.PAY_URL, params, userAgent);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,14 +2,13 @@ package com.sqx.modules.taskCenter.controller;
|
|||
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.annotation.Debounce;
|
||||
import com.sqx.common.utils.Result;
|
||||
import com.sqx.modules.app.annotation.Login;
|
||||
import com.sqx.modules.taskCenter.entity.TaskCenter;
|
||||
import com.sqx.modules.taskCenter.service.TaskCenterService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.sqx.common.utils.DateUtils;
|
||||
import com.sqx.common.utils.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
|
|
@ -19,8 +18,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(value = "任务中心", tags = {"任务中心"})
|
||||
|
|
@ -64,7 +61,7 @@ public class TaskCenterController {
|
|||
@GetMapping("/taskCenter/selectTaskCenter")
|
||||
@ApiOperation("查询任务中心")
|
||||
public Result selectTaskCenter(Integer page, Integer limit) {
|
||||
return Result.success().put("data", taskCenterService.page(new Page<>(page, limit), new QueryWrapper<TaskCenter>().orderByDesc("id")));
|
||||
return Result.success().put("data", taskCenterService.page(new Page<>(page, limit), new QueryWrapper<TaskCenter>().orderByAsc("sort","type")));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public class TaskCenterServiceImpl extends ServiceImpl<TaskCenterDao, TaskCenter
|
|||
@Override
|
||||
public Result queryTaskCenter(Integer page, Integer limit, Long userId) {
|
||||
//任务
|
||||
IPage<TaskCenter> taskPage = baseMapper.selectPage(new Page<>(page, limit), new QueryWrapper<TaskCenter>().eq("shows", 1).orderByDesc("sort"));
|
||||
IPage<TaskCenter> taskPage = baseMapper.selectPage(new Page<>(page, limit), new QueryWrapper<TaskCenter>().eq("shows", 1).orderByAsc("sort","type"));
|
||||
boolean todaySign = true;
|
||||
//月 签到记录
|
||||
QueryWrapper<UserSignRecord> signWrapper = new QueryWrapper<>();
|
||||
|
|
|
|||
Loading…
Reference in New Issue