From ef9ebbfaba1f8d9129a22c585506ec8b36cc2610 Mon Sep 17 00:00:00 2001 From: sonjinyon <2476687577@qq.com> Date: Mon, 4 Nov 2024 13:12:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E4=BA=8C=E7=BB=B4?= =?UTF-8?q?=E7=A0=81=E6=94=B9=E6=88=90=E6=AD=A3=E5=BC=8F=E7=89=88=EF=BC=8C?= =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=81=8A=E5=A4=A9=E5=A4=B4=E5=83=8F?= =?UTF-8?q?=E6=81=A2=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/kefu/AppKeFuMessageController.java | 19 +++++++++++++++++++ .../dal/dataobject/kefu/KeFuMessageDO.java | 4 ++++ .../dal/mysql/kefu/KeFuMessageMapper.java | 5 +++++ .../service/kefu/KeFuMessageService.java | 2 ++ .../service/kefu/KeFuMessageServiceImpl.java | 5 +++++ .../social/SocialClientServiceImpl.java | 1 + .../src/main/resources/application-local.yaml | 4 ++-- 7 files changed, 38 insertions(+), 2 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/AppKeFuMessageController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/AppKeFuMessageController.java index 29b8c85..d9d37c4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/AppKeFuMessageController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/AppKeFuMessageController.java @@ -5,6 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; +import cn.iocoder.yudao.module.member.api.user.MemberUserApi; +import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageRespVO; import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessagePageReqVO; import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; @@ -31,6 +33,10 @@ public class AppKeFuMessageController { @Resource private KeFuMessageService kefuMessageService; + @Resource + private MemberUserApi memberUserApi; + + @PostMapping("/send") @Operation(summary = "发送客服消息") @PreAuthenticated @@ -53,6 +59,19 @@ public class AppKeFuMessageController { @PreAuthenticated public CommonResult> getKefuMessagePage(@Valid AppKeFuMessagePageReqVO pageReqVO) { PageResult pageResult = kefuMessageService.getKeFuMessagePage(pageReqVO, getLoginUserId()); + for (int i = 0; i < pageResult.getList().size(); i++) { + KeFuMessageDO keFuMessageDO = pageResult.getList().get(i); + if (keFuMessageDO.getSenderType() == 1){ + MemberUserRespDTO user = memberUserApi.getUser(keFuMessageDO.getSenderId()); + keFuMessageDO.setSenderAvatar(user.getAvatar()); + } + + if (keFuMessageDO.getSenderType() == 2){ + String systemUserAvatar = kefuMessageService.findSystemUserAvatar(keFuMessageDO.getSenderId()); + keFuMessageDO.setSenderAvatar(systemUserAvatar); + } + + } return success(BeanUtils.toBean(pageResult, KeFuMessageRespVO.class)); } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/kefu/KeFuMessageDO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/kefu/KeFuMessageDO.java index b36f3ee..1867694 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/kefu/KeFuMessageDO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/kefu/KeFuMessageDO.java @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.module.promotion.enums.kefu.KeFuMessageContentTypeEnum; import com.baomidou.mybatisplus.annotation.KeySequence; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; @@ -78,4 +79,7 @@ public class KeFuMessageDO extends BaseDO { */ private Boolean readStatus; + + @TableField(exist = false) + private String senderAvatar; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/kefu/KeFuMessageMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/kefu/KeFuMessageMapper.java index f565fd7..1f28cc2 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/kefu/KeFuMessageMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/kefu/KeFuMessageMapper.java @@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; import java.util.Collection; import java.util.List; @@ -46,4 +47,8 @@ public interface KeFuMessageMapper extends BaseMapperX { .orderByDesc(KeFuMessageDO::getCreateTime)); } + + @Select(" SELECT avatar FROM system_users where id = #{id} ") + String findSystemUserAvatar(Long id); + } \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java index 627e8b3..ce21647 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageService.java @@ -59,4 +59,6 @@ public interface KeFuMessageService { */ PageResult getKeFuMessagePage(AppKeFuMessagePageReqVO pageReqVO, Long userId); + String findSystemUserAvatar(Long id); + } \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java index a6e1b8c..b191488 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java @@ -159,6 +159,11 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { return keFuMessageMapper.selectPage(pageReqVO); } + @Override + public String findSystemUserAvatar(Long id) { + return keFuMessageMapper.findSystemUserAvatar(id); + } + private KeFuMessageServiceImpl getSelf() { return SpringUtil.getBean(getClass()); } diff --git a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java index 4f30315..b70b661 100644 --- a/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java +++ b/yudao-module-system/yudao-module-system-biz/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialClientServiceImpl.java @@ -254,6 +254,7 @@ public class SocialClientServiceImpl implements SocialClientService { ObjUtil.defaultIfNull(reqVO.getAutoColor(), SocialWxQrcodeReqDTO.AUTO_COLOR), null, ObjUtil.defaultIfNull(reqVO.getHyaline(), SocialWxQrcodeReqDTO.HYALINE)); + } catch (WxErrorException e) { log.error("[getWxQrcode][reqVO({})) 获得小程序码失败]", reqVO, e); throw exception(SOCIAL_CLIENT_WEIXIN_MINI_APP_QRCODE_ERROR); diff --git a/yudao-server/src/main/resources/application-local.yaml b/yudao-server/src/main/resources/application-local.yaml index 4d15510..2a1eccb 100644 --- a/yudao-server/src/main/resources/application-local.yaml +++ b/yudao-server/src/main/resources/application-local.yaml @@ -57,7 +57,7 @@ spring: # url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例 # url: jdbc:postgresql://127.0.0.1:5432/postgres # OpenGauss 连接的示例 username: root -# password: 123456 + # password: 123456 password: xpower1234 # username: sa # SQL Server 连接的示例 # password: Yudao@2024 # SQL Server 连接的示例 @@ -228,7 +228,7 @@ yudao: enable: false demo: false # 关闭演示模式 wxa-code: - env-version: develop # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop" + env-version: release # 小程序版本: 正式版为 "release";体验版为 "trial";开发版为 "develop" tencent-lbs-key: TVDBZ-TDILD-4ON4B-PFDZA-RNLKH-VVF6E # QQ 地图的密钥 https://lbs.qq.com/service/staticV2/staticGuide/staticDoc justauth: