Browse Source

提现

master
cgx 2 months ago
parent
commit
5419d81a9c
10 changed files with 268 additions and 148 deletions
  1. +8
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/vo/Result.java
  2. +2
    -131
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/RedisKey.java
  3. +27
    -3
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/rechargeInfoLog/controller/TbRechargeInfoLogController.java
  4. +5
    -1
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/rechargeInfoLog/service/ITbRechargeInfoLogService.java
  5. +77
    -0
      jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/rechargeInfoLog/service/impl/TbRechargeInfoLogServiceImpl.java
  6. +17
    -7
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/controller/PayController.java
  7. +24
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/model/req/WithawalReq.java
  8. +3
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/service/IPayService.java
  9. +73
    -4
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/service/impl/PayServiceImpl.java
  10. +32
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/SubmitUtil.java

+ 8
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/api/vo/Result.java View File

@ -1,5 +1,6 @@
package org.jeecg.common.api.vo;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -76,7 +77,13 @@ public class Result<T> implements Serializable {
r.setCode(CommonConstant.SC_OK_200);
return r;
}
public static<T> Result<T> OKMsg() {
Result<T> r = new Result<T>();
r.setSuccess(true);
r.setMessage("操作成功");
r.setCode(CommonConstant.SC_OK_200);
return r;
}
public static<T> Result<T> ok(String msg) {
Result<T> r = new Result<T>();
r.setSuccess(true);


+ 2
- 131
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/common/constant/RedisKey.java View File

@ -2,148 +2,19 @@ package org.jeecg.common.constant;
public class RedisKey {
/**
* redis分布式锁-订单支付
*/
public final static String LOCK_KEY = "ORDER_LOCK:";
public final static String ORDER_LOCK_OUTBOUND = "ORDER_LOCK_OUTBOUND:";
public final static String LOCK_KEY_GZHCOUPON = "LOCK_KEY_GZHCOUPON:";
public final static String LOCK_KEY_COUPON = "LOCK_KEY_COUPON:";
/**
* redis分布式锁-订单完工
*/
public final static String ORDER_END_LOCK_KEY = "ORDER_END_LOCK";
/**
* redis分布式锁-订单分账
*/
public final static String ORDER_LEDGER_LOCK_KEY = "ORDER_LEDGER_LOCK:";
/**
* redis防表单重复提交-
*/
public final static String RECHARGE_LOCK_KEY = "RECHARGE_LOCK:";
/**
* redis防表单重复提交-领取赠送券
*/
public final static String RECHARGE_SEND_COUPON_LOCK_KEY = "RECHARGE_SEND_COUPON_LOCK:";
/**
* redis防表单重复提交-超级vip充值
*/
public final static String SUPER_RECHARGE_LOCK_KEY = "SUPER_RECHARGE_LOCK:";
/**
* redis防表单重复提交-保存车辆信息
*/
public final static String SAVE_CAR_NUM_KEY = "SAVE_CAR_NUM:";
/**
* redis昉表单重复提交-登录注册
*/
public final static String LOGIN_SUBMIT = "LOGIN_SUBMIT:";
//用戶上報的位置
public final static String USER_ADDRESS = "SYSTEM:USER:ADDRESS:";
//用戶据門店距離
public final static String ZDISTANCE_SET = "SYSTEM:USER:ZDISTANCE:";
//工位情况
public final static String SYSTEM_STATION = "SYSTEM:STATION:";
//门店情况
public final static String SYSTEM_STORE = "SYSTEM:STORE:";
//在綫用戶
public final static String USER_ONLINE = "SYSTEM:USER:STATUS:ONLINE:";
//在綫用戶查詢語句
public final static String USER_ONLINE_QL = "SYSTEM:USER:STATUS:ONLINE:*";
//纬度
public final static String LONGITUDE = "longitude";
//经度
public final static String LATITUDE = "latitude";
public final static String ADDRESS = "address";
//分割
public final static String KEY_SPLIT = ":";
/**
* 门店基础信息
*/
public static final String MERCHANT_INFO = "MERCHANT:INFO";
//派单系统情况
public static final String SYSTEM_DELIVERY_ORDER_STATE = "SYSTEM:DELIVERY:ORDER:STATE";
//失败订单原因
public static final String SYSTEM_DELIVERY_ORDER_BAD = "SYSTEM:DELIVERY:ORDER:BAD";
//技师取消订单补偿
public static final String SYSTEM_DELIVERY_ORDER_CANCAL = "SYSTEM:DELIVERY:TECHNICIAN:CANCAL";
//技师转单已派
public static final String SYSTEM_DELIVERY_ORDER_TRANSFERD = "SYSTEM:DELIVERY:TECHNICIAN:TRANSFERD";
//系统游标情况 按门店区分 key - int
public static final String SYSTEM_DELIVERY_TECHNICIAN_STATE = "SYSTEM:DELIVERY:TECHNICIAN:";
//系统技师轮询情况 按门店区分 key - keys - in
public static final String SYSTEM_DELIVERY_TECHNICIAN_ONLINE = "SYSTEM:DELIVERY:TECHNICIAN:ONLINE:";
public static final String SYSTEM_DELIVERY_TECHNICIAN_MERCHANT = "SYSTEM_DELIVERY_TECHNICIAN_MERCHANT";
public static final String ORDER_TRANSFERD = "order_transferd";
/**
* 订单编号信息 (目前用于 60分钟过期 触发取消订单用)
*/
public static final String ORDER_INFO_PAY = "ORDER_INFO_PAY:";
public static final String ORDER_CANCEL_TIME = "ORDER_CANCEL_TIME:";
/**
* 订单评价信息 (目前技师完工操作后, 用户不评价, 24小时后 触发默认评价和分账操作)
*/
public static final String ORDER_INFO_EVALUATE = "ORDER_INFO_EVALUATE:";
/**
* 技师接单记录
*/
public static final String TECHNICIAN_ORDER_INFO = "TECHNICIAN:ORDER:INFO";
/**
* 技师转单
*/
public static final String TECHNICIAN_TRANSFER_ORDER = "TECHNICIAN:TRANSFER:ORDER";
//评论开关小程序审核时开启不给评论成功
public final static String COMMENT = "comment";
//门店接单团队的接单顺序
public static final String MERCHANT_ORDER_INDEX = "merchant_order_index:";
//接单团队的在线列表 zset
public static final String MERCHANT_ORDER_OPERATOR_ONLINE = "merchant_order_operator_online:";
public final static String ORDER_START_CHECK = "order_start_check:";
public final static String ORDER_START_CHECK_TIME = "order_start_check_time";
public final static String ADVANCE_ORDER_START_CHECK = "advance_order_start_check:";
public final static String CHECK_NAME = "check_name";
public final static String AUTO_CHECK_ORDER = "auto_check_order";
public final static String AUTO_CHECK_ADVANCE_ORDER = "auto_check_advance_order";
/**后台提现审核防表单重复提交*/
public static final String MER_WITHDRAWAL_AUDIT = "MER_WITHDRAWAL:AUDIT";
public final static String MERCHAT_ACTIVITY_TIME = "merchat_activity_time";
public static final String MER_MEMBER_INFO = "mer_member_info:";
public static final String MER_MERCHANT_INFO = "mer_merchant_info:";
}

+ 27
- 3
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/rechargeInfoLog/controller/TbRechargeInfoLogController.java View File

@ -1,10 +1,20 @@
package org.jeecg.modules.rechargeInfoLog.controller;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.lang.StringUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.RedisKey;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
import org.jeecg.modules.rechargeInfoLog.entity.TbRechargeInfoLog;
import org.jeecg.modules.rechargeInfoLog.service.ITbRechargeInfoLogService;
@ -15,6 +25,7 @@ import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import io.swagger.annotations.Api;
@ -34,7 +45,7 @@ import org.jeecg.common.aspect.annotation.AutoLog;
public class TbRechargeInfoLogController extends JeecgController<TbRechargeInfoLog, ITbRechargeInfoLogService> {
@Autowired
private ITbRechargeInfoLogService tbRechargeInfoLogService;
/**
* 分页列表查询
*
@ -56,8 +67,21 @@ public class TbRechargeInfoLogController extends JeecgController<TbRechargeInfoL
IPage<TbRechargeInfoLog> pageList = tbRechargeInfoLogService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
/**
* 提现审核
* @param id
* @return
*/
@Transactional(rollbackFor = {Exception.class})
@GetMapping(value = "/audit")
public Result<?> audit(@RequestParam(name="id",required=true) String id,@RequestParam(name = "status") boolean status,@RequestParam(name = "checkInfo",required = false) String checkInfo){
Result<?> audit = tbRechargeInfoLogService.audit(id, status, checkInfo);
return Result.OKMsg();
}
/**
* 添加
*
* @param tbRechargeInfoLog


+ 5
- 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/rechargeInfoLog/service/ITbRechargeInfoLogService.java View File

@ -1,14 +1,18 @@
package org.jeecg.modules.rechargeInfoLog.service;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.rechargeInfoLog.entity.TbRechargeInfoLog;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Description: tb_recharge_info_log
* @Author: jeecg-boot
* @Date: 2024-12-12
* @Date: 2024-12-12
* @Version: V1.0
*/
public interface ITbRechargeInfoLogService extends IService<TbRechargeInfoLog> {
Result<?> audit(String id, boolean status, String checkInfo);
}

+ 77
- 0
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/modules/rechargeInfoLog/service/impl/TbRechargeInfoLogServiceImpl.java View File

@ -1,11 +1,22 @@
package org.jeecg.modules.rechargeInfoLog.service.impl;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.RedisKey;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
import org.jeecg.modules.rechargeInfoLog.entity.TbRechargeInfoLog;
import org.jeecg.modules.rechargeInfoLog.mapper.TbRechargeInfoLogMapper;
import org.jeecg.modules.rechargeInfoLog.service.ITbRechargeInfoLogService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Description: tb_recharge_info_log
@ -16,4 +27,70 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service
public class TbRechargeInfoLogServiceImpl extends ServiceImpl<TbRechargeInfoLogMapper, TbRechargeInfoLog> implements ITbRechargeInfoLogService {
@Resource
private RedisUtil redisUtil;
@Resource
private IHanHaiMemberService hanHaiMemberService;
@Transactional
@Override
public Result<?> audit(String id, boolean status, String checkInfo) {
Integer n = (Integer) redisUtil.get(RedisKey.MER_WITHDRAWAL_AUDIT + id);
if(n != null){
throw new JeecgBootException("请勿重复点击!");
}
redisUtil.set(RedisKey.MER_WITHDRAWAL_AUDIT + id,1,5);
TbRechargeInfoLog rechargeInfoLog = this.getById(id);
if(rechargeInfoLog==null) {
throw new JeecgBootException("未找到数据");
}
Long count = this.lambdaQuery()
.eq(TbRechargeInfoLog::getWithdrawalId, rechargeInfoLog.getId())
.count();
if(count != null && count > 0){
throw new JeecgBootException("此提现已处理过不通过,请勿重新点击");
}
HanHaiMember account = hanHaiMemberService.getById(rechargeInfoLog.getMemberId());
TbRechargeInfoLog rechargeInfoLog1 = new TbRechargeInfoLog();
rechargeInfoLog1.setId(rechargeInfoLog.getId());
rechargeInfoLog1.setState(1);
if(!status){
//审核不通过退回余额
rechargeInfoLog1.setState(3);
rechargeInfoLog1.setCheckInfo(checkInfo);
BigDecimal money = rechargeInfoLog.getMoney().add(rechargeInfoLog.getServiceCharge());
HanHaiMember cmMemberAccount2 = new HanHaiMember();
cmMemberAccount2.setId(account.getId());
cmMemberAccount2.setPrice(account.getPrice().add(money));
boolean b = hanHaiMemberService.updateById(cmMemberAccount2);
if(!b){
throw new JeecgBootException("操作失败,请稍后重试");
}
TbRechargeInfoLog merRechargeInfoLog = new TbRechargeInfoLog();
merRechargeInfoLog.setTitle("提现未通过退款");
merRechargeInfoLog.setMoney(money);
merRechargeInfoLog.setUserMoney(account.getPrice());
merRechargeInfoLog.setIsPay(1);
merRechargeInfoLog.setDelFlag(0);
merRechargeInfoLog.setPayTime(new Date());
merRechargeInfoLog.setMemberId(rechargeInfoLog.getMemberId());
merRechargeInfoLog.setType(1);
merRechargeInfoLog.setCheckInfo(checkInfo);
merRechargeInfoLog.setWithdrawalId(rechargeInfoLog.getId());
boolean save = this.save(merRechargeInfoLog);
if(!save){
throw new JeecgBootException("操作失败");
}
}
boolean b = this.updateById(rechargeInfoLog1);
if(!b){
throw new JeecgBootException("操作失败,请稍后重试");
}
return null;
}
}

+ 17
- 7
jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/controller/PayController.java View File

@ -12,6 +12,7 @@ import org.jeecg.modules.bean.RechargeReq;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.userCode.model.req.OrderPayReq;
import org.jeecg.modules.userCode.model.req.RechargeInfoLogReq;
import org.jeecg.modules.userCode.model.req.WithawalReq;
import org.jeecg.modules.userCode.service.IPayService;
import org.jeecg.modules.utils.ValidateTool;
import org.springframework.web.bind.annotation.*;
@ -80,7 +81,6 @@ public class PayController {
}
//TODO 充值支付 交接改动
/**
@ -113,24 +113,34 @@ public class PayController {
}
/**
* 余额日志
*
* @param token
* @param rechargeInfoLogReq
* @return
*/
@ApiOperation("余额日志")
@PostMapping("/log")
public Result<?> rechargeLog(@RequestHeader("X-Access-Token") String token,@RequestBody(required = false) RechargeInfoLogReq rechargeInfoLogReq){
return payService.rechargeLog(token,rechargeInfoLogReq);
public Result<?> rechargeLog(@RequestHeader("X-Access-Token") String token, @RequestBody(required = false) RechargeInfoLogReq rechargeInfoLogReq) {
return payService.rechargeLog(token, rechargeInfoLogReq);
}
/**
* 提现
*
* @param token
* @param withawalReq
* @return
*/
@ApiOperation("提现")
@PostMapping("/withdrawal")
public Result<?> withdrawal(@RequestHeader("X-Access-Token") String token,
WithawalReq withawalReq) {
return payService.withdrawal(token, withawalReq);
}
}

+ 24
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/model/req/WithawalReq.java View File

@ -0,0 +1,24 @@
package org.jeecg.modules.userCode.model.req;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author java996.icu
* @title: WithawalReq
* @projectName merchant
* @description: TODO
* @date 2021/12/13 10:52
* @Version V1.0
*/
@Data
public class WithawalReq {
/**提现金额*/
@ApiModelProperty(value = "提现金额",required = true)
private BigDecimal money;
}

+ 3
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/service/IPayService.java View File

@ -6,6 +6,8 @@ import org.jeecg.common.bestpay.model.PayResponse;
import org.jeecg.modules.bean.RechargeReq;
import org.jeecg.modules.userCode.model.req.OrderPayReq;
import org.jeecg.modules.userCode.model.req.RechargeInfoLogReq;
import org.jeecg.modules.userCode.model.req.WithawalReq;
import org.springframework.web.bind.annotation.RequestHeader;
/**
* @author java996.icu
@ -59,7 +61,7 @@ public interface IPayService {
*/
Result<?> rechargeLog(String token, RechargeInfoLogReq rechargeInfoLogReq);
Result<?> withdrawal(String token,WithawalReq withawalReq);
}

+ 73
- 4
jeecg-boot-module-system/src/main/java/org/jeecg/modules/userCode/service/impl/PayServiceImpl.java View File

@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiOperation;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result;
@ -21,17 +22,24 @@ import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
import org.jeecg.modules.hanHaiMember.service.IHanHaiMemberService;
import org.jeecg.modules.rechargeInfoLog.entity.TbRechargeInfoLog;
import org.jeecg.modules.rechargeInfoLog.service.ITbRechargeInfoLogService;
import org.jeecg.modules.tbConf.entity.TbConf;
import org.jeecg.modules.tbConf.service.ITbConfService;
import org.jeecg.modules.tbOrder.entity.TbOrder;
import org.jeecg.modules.tbOrder.service.ITbOrderService;
import org.jeecg.modules.userCode.mapper.RechargeInfoLogMapper;
import org.jeecg.modules.userCode.model.req.OrderPayReq;
import org.jeecg.modules.userCode.model.req.PayBean;
import org.jeecg.modules.userCode.model.req.RechargeInfoLogReq;
import org.jeecg.modules.userCode.model.req.WithawalReq;
import org.jeecg.modules.userCode.service.IPayService;
import org.jeecg.modules.userRole.service.ITbUserRoleService;
import org.jeecg.modules.utils.SubmitUtil;
import org.jeecg.modules.utils.ValidateTool;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -73,13 +81,17 @@ public class PayServiceImpl implements IPayService {
private RechargeInfoLogMapper rechargeInfoLogMapper;
ExecutorService cachedThreadPool = new ThreadPoolExecutor(32, 32,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue<Runnable>());
@Resource
private ITbOrderService tbOrderService;
@Resource
private RedisUtil redisUtil;
@Resource
private ITbConfService tbConfService;
@Resource
private ITbRechargeInfoLogService tbRechargeInfoLogService;
/**
* 订单支付
@ -289,6 +301,7 @@ public class PayServiceImpl implements IPayService {
*
* @return
*/
@Transactional
@Override
public Result<?> rechargeLog(String token, RechargeInfoLogReq rechargeInfoLogReq) {
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiAccount(token);
@ -317,4 +330,60 @@ public class PayServiceImpl implements IPayService {
}
@Transactional
@Override
public Result<?> withdrawal(String token, WithawalReq withawalReq) {
HanHaiMember account = shiroRealm.checkUserTokenIsEffectHanHaiAccount(token);
SubmitUtil.submit(account, "withdrawal", redisUtil);
QueryWrapper<TbConf> objectQueryWrapper = new QueryWrapper<>();
objectQueryWrapper.eq("name", "withdrawal_min_money");
TbConf one = tbConfService.getOne(objectQueryWrapper);
QueryWrapper<TbConf> withdrawalRate = new QueryWrapper<>();
withdrawalRate.eq("name", "withdrawal_rate");
TbConf withdrawalRates = tbConfService.getOne(withdrawalRate);
//提现最低余额
BigDecimal withawalMinMoney = new BigDecimal(one.getValue());
if (withawalReq.getMoney().compareTo(withawalMinMoney) < 0) {
throw new JeecgBootException("提现金额不能小于" + withawalMinMoney);
}
//获取提现手续费率
BigDecimal withawalServiceRate = new BigDecimal(withdrawalRates.getValue());
BigDecimal serviceCharge = withawalReq.getMoney().multiply(withawalServiceRate);
BigDecimal money = withawalReq.getMoney().subtract(serviceCharge);
if (withawalReq.getMoney().compareTo(account.getPrice()) == 1) {
throw new JeecgBootException("提现金额不可以大于金额");
}
//写入提现日志
TbRechargeInfoLog merRechargeInfoLog = new TbRechargeInfoLog();
merRechargeInfoLog.setTitle("提现");
merRechargeInfoLog.setMoney(money);
merRechargeInfoLog.setUserMoney(account.getPrice());
merRechargeInfoLog.setIsPay(1);
merRechargeInfoLog.setPayTime(new Date());
merRechargeInfoLog.setMemberId(account.getId());
merRechargeInfoLog.setType(0);
merRechargeInfoLog.setServiceCharge(serviceCharge);
merRechargeInfoLog.setRealName(account.getName());
merRechargeInfoLog.setState(0);
boolean save = tbRechargeInfoLogService.save(merRechargeInfoLog);
if (!save) {
throw new JeecgBootException("操作失败,请稍后重试");
}
HanHaiMember hanHaiMember = new HanHaiMember();
hanHaiMember.setId(account.getId());
hanHaiMember.setPrice(account.getPrice().subtract(withawalReq.getMoney()));
boolean b = hanHaiMemberService.updateById(hanHaiMember);
if (!b) {
throw new JeecgBootException("操作失败,请稍后重试");
}
return Result.OKMsg();
}
}

+ 32
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/utils/SubmitUtil.java View File

@ -0,0 +1,32 @@
package org.jeecg.modules.utils;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.util.RedisUtil;
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember;
/**
* @author java996.icu
* @title: SubmitUtil
* @projectName blind-box-api
* @description: TODO
* @date 2021/11/23 16:18
* @Version V1.0
*/
public class SubmitUtil {
public static void submit(HanHaiMember member, String name, RedisUtil redisUtil) {
Long time = (Long) redisUtil.get("submit::" + member.getId() + "::" + name);
if (time != null) {
throw new JeecgBootException("请勿重复点击");
}
redisUtil.set("submit::" + member.getId() + "::" + name, System.currentTimeMillis(), 10);
}
public static void loginSubmit(String phone, String name, RedisUtil redisUtil) {
Long time = (Long) redisUtil.get("submit::" + phone + "::" + name);
if (time != null) {
throw new JeecgBootException("请勿重复点击");
}
redisUtil.set("submit::" + phone + "::" + name, System.currentTimeMillis(), 10);
}
}

Loading…
Cancel
Save