Merge branch 'refs/heads/master' into 支付优化测试
# Conflicts: # yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/storeorder/StoreOrderServiceImpl.java
This commit is contained in:
@ -490,18 +490,20 @@ public class DiningPlatesServiceImpl implements DiningPlatesService {
|
|||||||
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
DiningPlatesDO diningPlatesDO = diningPlatesMapper.selectOne(Wrappers.<DiningPlatesDO>lambdaQuery()
|
||||||
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
.eq(DiningPlatesDO::getDiningPlatesNum, diningPlatesNum)
|
||||||
.eq(DiningPlatesDO::getStoreId, storeId));
|
.eq(DiningPlatesDO::getStoreId, storeId));
|
||||||
LocalDateTime bindingTime = diningPlatesDO.getBindingTime();
|
|
||||||
long seconds = Duration.between(bindingTime, LocalDateTime.now()).getSeconds();
|
|
||||||
if(diningPlatesDO == null ) {
|
if(diningPlatesDO == null ) {
|
||||||
map.put("data", "absent");
|
map.put("data", "absent");
|
||||||
map.put("msg",null);
|
map.put("msg",null);
|
||||||
}else if (diningPlatesDO.getUserId() == null){
|
}else if (diningPlatesDO.getUserId() == null){
|
||||||
map.put("data", "unbind");
|
map.put("data", "unbind");
|
||||||
map.put("msg",null);
|
map.put("msg",null);
|
||||||
}else if (seconds <= 3){
|
}else {
|
||||||
throw exception(DINING_PLATES_TIME);
|
if (diningPlatesDO.getBindingTime()!=null){
|
||||||
}
|
LocalDateTime bindingTime = diningPlatesDO.getBindingTime();
|
||||||
else {
|
long seconds = Duration.between(bindingTime, LocalDateTime.now()).getSeconds();
|
||||||
|
if(seconds <=3){
|
||||||
|
throw exception(DINING_PLATES_TIME);
|
||||||
|
}
|
||||||
|
}
|
||||||
unbind(diningPlatesNum,storeId);
|
unbind(diningPlatesNum,storeId);
|
||||||
map.put("data", "bind");
|
map.put("data", "bind");
|
||||||
map.put("msg","餐盘已解绑");
|
map.put("msg","餐盘已解绑");
|
||||||
|
@ -23,6 +23,7 @@ import cn.iocoder.yudao.module.member.service.amount.DeductionService;
|
|||||||
import cn.iocoder.yudao.module.member.service.card.CardService;
|
import cn.iocoder.yudao.module.member.service.card.CardService;
|
||||||
import cn.iocoder.yudao.module.member.service.storeorderdetail.StoreOrderDetailService;
|
import cn.iocoder.yudao.module.member.service.storeorderdetail.StoreOrderDetailService;
|
||||||
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
import cn.iocoder.yudao.module.member.service.user.MemberUserService;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
@ -65,6 +66,9 @@ public class StoreOrderServiceImpl implements StoreOrderService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private StringRedisTemplate storeOrderRedisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer createStoreOrder(StoreOrderSaveReqVO createReqVO) {
|
public Integer createStoreOrder(StoreOrderSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -168,7 +172,8 @@ public class StoreOrderServiceImpl implements StoreOrderService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public String codePay(StoreOrderDto dto) {
|
public String codePay(StoreOrderDto dto) {
|
||||||
String s = validateJWT(dto.getJwt());
|
|
||||||
|
String s = storeOrderRedisTemplate.opsForValue().get(dto.getJwt());
|
||||||
if (StrUtil.isBlank(s)) {
|
if (StrUtil.isBlank(s)) {
|
||||||
return "二维码过期";
|
return "二维码过期";
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import cn.hutool.core.util.ObjUtil;
|
|||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
@ -915,12 +916,12 @@ public class MemberUserServiceImpl implements MemberUserService {
|
|||||||
if(StrUtil.isNotEmpty(url)){
|
if(StrUtil.isNotEmpty(url)){
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
String encode = DigestUtil.md5Hex(userId.toString()+System.currentTimeMillis());
|
||||||
String jwt = generateJWT(userId); // 1分钟后过期
|
|
||||||
String fileName = "QRCode_" + userId + ".png";
|
String fileName = "QRCode_" + userId + ".png";
|
||||||
String path = QRCodeWithJWTUtil.BASE_PATH+fileName;
|
String path = QRCodeWithJWTUtil.BASE_PATH+fileName;
|
||||||
QRCodeWithJWTUtil.generateQRCode(jwt, 350, 350, path); // 生
|
QRCodeWithJWTUtil.generateQRCode(encode, 350, 350, path); // 生
|
||||||
memberUserRedisTemplate.opsForValue().set(redisKey,path,60, TimeUnit.SECONDS);
|
memberUserRedisTemplate.opsForValue().set(redisKey,path,180, TimeUnit.SECONDS);
|
||||||
|
memberUserRedisTemplate.opsForValue().set(encode,userId.toString(),180, TimeUnit.SECONDS);
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.member.util;
|
package cn.iocoder.yudao.module.member.util;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@ -10,6 +11,7 @@ import cn.hutool.jwt.JWTUtil;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@ -63,4 +65,13 @@ public class QRCodeWithJWTUtil {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String encode = DigestUtil.md5Hex("340"+ System.currentTimeMillis());
|
||||||
|
System.out.println(encode);
|
||||||
|
String fileName = "QRCode_" + "test" + ".png";
|
||||||
|
String path = QRCodeWithJWTUtil.BASE_PATH+fileName;
|
||||||
|
QRCodeWithJWTUtil.generateQRCode(encode, 350, 350, path);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user