fix: 用æ店员头像bug

This commit is contained in:
huchuansai
2025-10-16 16:56:44 +08:00
parent 0725c94bbe
commit 07a86fbe66

View File

@@ -3,6 +3,7 @@ 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;
@@ -14,9 +15,11 @@ 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;
@@ -68,12 +71,16 @@ public class WxOauthService {
if (item == null) {
PlayClerkUserInfoEntity entity = ConvertUtil.entityToVo(userInfo, PlayClerkUserInfoEntity.class);
entity.setAvatar(generateAvatar(userInfo.getHeadImgUrl()));
entity.setWeiChatAvatar(generateAvatar(userInfo.getHeadImgUrl()));
entity.setWeiChatAvatar(entity.getAvatar());
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();
}
}