Compare commits
4 Commits
385ceeecb6
...
6153e6e4f1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6153e6e4f1 | ||
|
|
d681635394 | ||
|
|
b9779e7436 | ||
|
|
07a86fbe66 |
@@ -3,6 +3,7 @@ package com.starry.admin.modules.weichat.service;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.starry.admin.common.exception.ServiceException;
|
import com.starry.admin.common.exception.ServiceException;
|
||||||
import com.starry.admin.common.oss.service.IOssFileService;
|
import com.starry.admin.common.oss.service.IOssFileService;
|
||||||
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
|
||||||
@@ -14,9 +15,11 @@ import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
|
|||||||
import com.starry.admin.utils.SecurityUtils;
|
import com.starry.admin.utils.SecurityUtils;
|
||||||
import com.starry.common.utils.ConvertUtil;
|
import com.starry.common.utils.ConvertUtil;
|
||||||
import com.starry.common.utils.IdUtils;
|
import com.starry.common.utils.IdUtils;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
|
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
|
||||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||||
@@ -68,12 +71,16 @@ public class WxOauthService {
|
|||||||
if (item == null) {
|
if (item == null) {
|
||||||
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(userInfo, PlayClerkUserInfoEntity.class);
|
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(userInfo, PlayClerkUserInfoEntity.class);
|
||||||
entity.setAvatar(generateAvatar(userInfo.getHeadImgUrl()));
|
entity.setAvatar(generateAvatar(userInfo.getHeadImgUrl()));
|
||||||
entity.setWeiChatAvatar(generateAvatar(userInfo.getHeadImgUrl()));
|
entity.setWeiChatAvatar(entity.getAvatar());
|
||||||
entity.setId(IdUtils.getUuid());
|
entity.setId(IdUtils.getUuid());
|
||||||
entity.setLevelId(playClerkLevelInfoService.getDefaultLevel().getId());
|
entity.setLevelId(playClerkLevelInfoService.getDefaultLevel().getId());
|
||||||
clerkUserInfoService.create(entity);
|
clerkUserInfoService.create(entity);
|
||||||
return entity.getId();
|
return entity.getId();
|
||||||
} else {
|
} else {
|
||||||
|
if (StrUtil.isEmpty(item.getAvatar())) {
|
||||||
|
clerkUserInfoService.update(Wrappers.lambdaUpdate(PlayClerkUserInfoEntity.class).eq(PlayClerkUserInfoEntity::getId, item.getId())
|
||||||
|
.set(PlayClerkUserInfoEntity::getAvatar, generateAvatar(userInfo.getHeadImgUrl())));
|
||||||
|
}
|
||||||
return item.getId();
|
return item.getId();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,8 +28,6 @@ import org.springframework.util.StringUtils;
|
|||||||
public class WithdrawalServiceImpl extends ServiceImpl<WithdrawalRequestMapper, WithdrawalRequestEntity>
|
public class WithdrawalServiceImpl extends ServiceImpl<WithdrawalRequestMapper, WithdrawalRequestEntity>
|
||||||
implements IWithdrawalService {
|
implements IWithdrawalService {
|
||||||
|
|
||||||
private static final long PAYEE_CONFIRMATION_MAX_MINUTES = 10L;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private IEarningsService earningsService;
|
private IEarningsService earningsService;
|
||||||
@Resource
|
@Resource
|
||||||
@@ -49,13 +47,10 @@ public class WithdrawalServiceImpl extends ServiceImpl<WithdrawalRequestMapper,
|
|||||||
if (payeeProfile == null || !StringUtils.hasText(payeeProfile.getQrCodeUrl())) {
|
if (payeeProfile == null || !StringUtils.hasText(payeeProfile.getQrCodeUrl())) {
|
||||||
throw new CustomException("请先上传支付宝收款码");
|
throw new CustomException("请先上传支付宝收款码");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (payeeProfile.getLastConfirmedAt() == null) {
|
if (payeeProfile.getLastConfirmedAt() == null) {
|
||||||
throw new CustomException("请确认本次使用的收款码");
|
throw new CustomException("请确认本次使用的收款码");
|
||||||
}
|
}
|
||||||
Duration sinceConfirm = Duration.between(payeeProfile.getLastConfirmedAt(), now);
|
|
||||||
if (sinceConfirm.isNegative() || sinceConfirm.toMinutes() > PAYEE_CONFIRMATION_MAX_MINUTES) {
|
|
||||||
throw new CustomException("收款码确认已过期,请重新确认");
|
|
||||||
}
|
|
||||||
|
|
||||||
// pick and reserve lines
|
// pick and reserve lines
|
||||||
List<EarningsLineEntity> lines = earningsService.findWithdrawable(clerkId, amount, now);
|
List<EarningsLineEntity> lines = earningsService.findWithdrawable(clerkId, amount, now);
|
||||||
|
|||||||
Reference in New Issue
Block a user