Compare commits

..

2 Commits

Author SHA1 Message Date
irving
385ceeecb6 adjust logic, avoide race condition
Some checks failed
Build and Push Backend / docker (push) Failing after 6s
2025-10-18 20:56:55 -04:00
irving
584780a812 feat: 店员收益明细支持条件筛选并返回订单信息 2025-10-18 20:48:39 -04:00
2 changed files with 7 additions and 9 deletions

View File

@@ -3,7 +3,6 @@ package com.starry.admin.modules.weichat.service;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.starry.admin.common.exception.ServiceException;
import com.starry.admin.common.oss.service.IOssFileService;
import com.starry.admin.modules.clerk.module.entity.PlayClerkUserInfoEntity;
@@ -15,11 +14,9 @@ import com.starry.admin.modules.custom.service.IPlayCustomUserInfoService;
import com.starry.admin.utils.SecurityUtils;
import com.starry.common.utils.ConvertUtil;
import com.starry.common.utils.IdUtils;
import java.io.InputStream;
import java.util.Date;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
@@ -71,16 +68,12 @@ public class WxOauthService {
if (item == null) {
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(userInfo, PlayClerkUserInfoEntity.class);
entity.setAvatar(generateAvatar(userInfo.getHeadImgUrl()));
entity.setWeiChatAvatar(entity.getAvatar());
entity.setWeiChatAvatar(generateAvatar(userInfo.getHeadImgUrl()));
entity.setId(IdUtils.getUuid());
entity.setLevelId(playClerkLevelInfoService.getDefaultLevel().getId());
clerkUserInfoService.create(entity);
return entity.getId();
} 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();
}
}

View File

@@ -28,6 +28,8 @@ import org.springframework.util.StringUtils;
public class WithdrawalServiceImpl extends ServiceImpl<WithdrawalRequestMapper, WithdrawalRequestEntity>
implements IWithdrawalService {
private static final long PAYEE_CONFIRMATION_MAX_MINUTES = 10L;
@Resource
private IEarningsService earningsService;
@Resource
@@ -47,10 +49,13 @@ public class WithdrawalServiceImpl extends ServiceImpl<WithdrawalRequestMapper,
if (payeeProfile == null || !StringUtils.hasText(payeeProfile.getQrCodeUrl())) {
throw new CustomException("请先上传支付宝收款码");
}
if (payeeProfile.getLastConfirmedAt() == null) {
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
List<EarningsLineEntity> lines = earningsService.findWithdrawable(clerkId, amount, now);