Commit 2775dbbad1ab63d07c7571f90d19c1c4a505ce37
Committed by
Gitee
!1126 【功能完善】商城: 客服
Merge pull request !1126 from puhui999/develop
Showing
8 changed files
with
52 additions
and
8 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/history/ProductBrowseHistoryController.java
| @@ -51,7 +51,8 @@ public class ProductBrowseHistoryController { | @@ -51,7 +51,8 @@ public class ProductBrowseHistoryController { | ||
| 51 | convertSet(pageResult.getList(), ProductBrowseHistoryDO::getSpuId)); | 51 | convertSet(pageResult.getList(), ProductBrowseHistoryDO::getSpuId)); |
| 52 | return success(BeanUtils.toBean(pageResult, ProductBrowseHistoryRespVO.class, | 52 | return success(BeanUtils.toBean(pageResult, ProductBrowseHistoryRespVO.class, |
| 53 | vo -> Optional.ofNullable(spuMap.get(vo.getSpuId())) | 53 | vo -> Optional.ofNullable(spuMap.get(vo.getSpuId())) |
| 54 | - .ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice())))); | 54 | + .ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice()) |
| 55 | + .setSalesCount(spu.getSalesCount()).setStock(spu.getStock())))); | ||
| 55 | } | 56 | } |
| 56 | 57 | ||
| 57 | } | 58 | } |
| 58 | \ No newline at end of file | 59 | \ No newline at end of file |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/history/vo/ProductBrowseHistoryRespVO.java
| 1 | package cn.iocoder.yudao.module.product.controller.admin.history.vo; | 1 | package cn.iocoder.yudao.module.product.controller.admin.history.vo; |
| 2 | 2 | ||
| 3 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; | 3 | import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; |
| 4 | -import com.alibaba.excel.annotation.ExcelProperty; | ||
| 5 | import io.swagger.v3.oas.annotations.media.Schema; | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| 6 | import lombok.Data; | 5 | import lombok.Data; |
| 7 | 6 | ||
| 8 | -import java.time.LocalDateTime; | ||
| 9 | - | ||
| 10 | import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | 7 | import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; |
| 11 | 8 | ||
| 12 | @Schema(description = "管理后台 - 商品浏览记录 Response VO") | 9 | @Schema(description = "管理后台 - 商品浏览记录 Response VO") |
| @@ -31,4 +28,10 @@ public class ProductBrowseHistoryRespVO { | @@ -31,4 +28,10 @@ public class ProductBrowseHistoryRespVO { | ||
| 31 | @Schema(description = "商品单价", example = "100") | 28 | @Schema(description = "商品单价", example = "100") |
| 32 | private Integer price; | 29 | private Integer price; |
| 33 | 30 | ||
| 31 | + @Schema(description = "商品销量", example = "100") | ||
| 32 | + private Integer salesCount; | ||
| 33 | + | ||
| 34 | + @Schema(description = "库存", example = "100") | ||
| 35 | + private Integer stock; | ||
| 36 | + | ||
| 34 | } | 37 | } |
| 35 | \ No newline at end of file | 38 | \ No newline at end of file |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/history/AppProductBrowseHistoryController.java
| @@ -71,7 +71,8 @@ public class AppProductBrowseHistoryController { | @@ -71,7 +71,8 @@ public class AppProductBrowseHistoryController { | ||
| 71 | Map<Long, ProductSpuDO> spuMap = convertMap(productSpuService.getSpuList(spuIds), ProductSpuDO::getId); | 71 | Map<Long, ProductSpuDO> spuMap = convertMap(productSpuService.getSpuList(spuIds), ProductSpuDO::getId); |
| 72 | return success(BeanUtils.toBean(pageResult, AppProductBrowseHistoryRespVO.class, | 72 | return success(BeanUtils.toBean(pageResult, AppProductBrowseHistoryRespVO.class, |
| 73 | vo -> Optional.ofNullable(spuMap.get(vo.getSpuId())) | 73 | vo -> Optional.ofNullable(spuMap.get(vo.getSpuId())) |
| 74 | - .ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice())))); | 74 | + .ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice()) |
| 75 | + .setSalesCount(spu.getSalesCount()).setStock(spu.getStock())))); | ||
| 75 | } | 76 | } |
| 76 | 77 | ||
| 77 | } | 78 | } |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/history/vo/AppProductBrowseHistoryRespVO.java
| @@ -26,4 +26,11 @@ public class AppProductBrowseHistoryRespVO { | @@ -26,4 +26,11 @@ public class AppProductBrowseHistoryRespVO { | ||
| 26 | @Schema(description = "商品单价", example = "100") | 26 | @Schema(description = "商品单价", example = "100") |
| 27 | private Integer price; | 27 | private Integer price; |
| 28 | 28 | ||
| 29 | + @Schema(description = "商品销量", example = "100") | ||
| 30 | + private Integer salesCount; | ||
| 31 | + | ||
| 32 | + @Schema(description = "库存", example = "100") | ||
| 33 | + private Integer stock; | ||
| 34 | + | ||
| 35 | + | ||
| 29 | } | 36 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/kefu/KeFuConversationController.java
| @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | @@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | ||
| 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 6 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 7 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationRespVO; | 7 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationRespVO; |
| 8 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationUpdatePinnedReqVO; | 8 | import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationUpdatePinnedReqVO; |
| 9 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO; | ||
| 9 | import cn.iocoder.yudao.module.promotion.service.kefu.KeFuConversationService; | 10 | import cn.iocoder.yudao.module.promotion.service.kefu.KeFuConversationService; |
| 10 | import io.swagger.v3.oas.annotations.Operation; | 11 | import io.swagger.v3.oas.annotations.Operation; |
| 11 | import io.swagger.v3.oas.annotations.Parameter; | 12 | import io.swagger.v3.oas.annotations.Parameter; |
| @@ -34,6 +35,25 @@ public class KeFuConversationController { | @@ -34,6 +35,25 @@ public class KeFuConversationController { | ||
| 34 | @Resource | 35 | @Resource |
| 35 | private MemberUserApi memberUserApi; | 36 | private MemberUserApi memberUserApi; |
| 36 | 37 | ||
| 38 | + @GetMapping("/get") | ||
| 39 | + @Operation(summary = "获得客服会话") | ||
| 40 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:query')") | ||
| 42 | + public CommonResult<KeFuConversationRespVO> getConversation(@RequestParam("id") Long id) { | ||
| 43 | + KeFuConversationDO conversation = conversationService.getConversation(id); | ||
| 44 | + if (conversation == null) { | ||
| 45 | + return success(null); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + // 拼接数据 | ||
| 49 | + KeFuConversationRespVO result = BeanUtils.toBean(conversation, KeFuConversationRespVO.class); | ||
| 50 | + MemberUserRespDTO memberUser = memberUserApi.getUser(conversation.getUserId()); | ||
| 51 | + if (memberUser != null) { | ||
| 52 | + result.setUserAvatar(memberUser.getAvatar()).setUserNickname(memberUser.getNickname()); | ||
| 53 | + } | ||
| 54 | + return success(result); | ||
| 55 | + } | ||
| 56 | + | ||
| 37 | @PutMapping("/update-conversation-pinned") | 57 | @PutMapping("/update-conversation-pinned") |
| 38 | @Operation(summary = "置顶/取消置顶客服会话") | 58 | @Operation(summary = "置顶/取消置顶客服会话") |
| 39 | @PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:update')") | 59 | @PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:update')") |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuConversationService.java
| @@ -14,6 +14,14 @@ import java.util.List; | @@ -14,6 +14,14 @@ import java.util.List; | ||
| 14 | public interface KeFuConversationService { | 14 | public interface KeFuConversationService { |
| 15 | 15 | ||
| 16 | /** | 16 | /** |
| 17 | + * 获得客服会话 | ||
| 18 | + * | ||
| 19 | + * @param id 编号 | ||
| 20 | + * @return 客服会话 | ||
| 21 | + */ | ||
| 22 | + KeFuConversationDO getConversation(Long id); | ||
| 23 | + | ||
| 24 | + /** | ||
| 17 | * 【管理员】删除客服会话 | 25 | * 【管理员】删除客服会话 |
| 18 | * | 26 | * |
| 19 | * @param id 编号 | 27 | * @param id 编号 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuConversationServiceImpl.java
| @@ -31,6 +31,11 @@ public class KeFuConversationServiceImpl implements KeFuConversationService { | @@ -31,6 +31,11 @@ public class KeFuConversationServiceImpl implements KeFuConversationService { | ||
| 31 | private KeFuConversationMapper conversationMapper; | 31 | private KeFuConversationMapper conversationMapper; |
| 32 | 32 | ||
| 33 | @Override | 33 | @Override |
| 34 | + public KeFuConversationDO getConversation(Long id) { | ||
| 35 | + return conversationMapper.selectById(id); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @Override | ||
| 34 | public void deleteKefuConversation(Long id) { | 39 | public void deleteKefuConversation(Long id) { |
| 35 | // 校验存在 | 40 | // 校验存在 |
| 36 | validateKefuConversationExists(id); | 41 | validateKefuConversationExists(id); |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/kefu/KeFuMessageServiceImpl.java
| @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.promotion.service.kefu; | @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.promotion.service.kefu; | ||
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | import cn.hutool.core.util.ObjUtil; | 4 | import cn.hutool.core.util.ObjUtil; |
| 5 | -import cn.hutool.core.util.StrUtil; | ||
| 6 | import cn.hutool.extra.spring.SpringUtil; | 5 | import cn.hutool.extra.spring.SpringUtil; |
| 7 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; | 6 | import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; |
| 8 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| @@ -113,9 +112,9 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { | @@ -113,9 +112,9 @@ public class KeFuMessageServiceImpl implements KeFuMessageService { | ||
| 113 | // 2.3 发送消息通知会员,管理员已读 -> 会员更新发送的消息状态 | 112 | // 2.3 发送消息通知会员,管理员已读 -> 会员更新发送的消息状态 |
| 114 | KeFuMessageDO keFuMessage = getFirst(filterList(messageList, message -> UserTypeEnum.MEMBER.getValue().equals(message.getSenderType()))); | 113 | KeFuMessageDO keFuMessage = getFirst(filterList(messageList, message -> UserTypeEnum.MEMBER.getValue().equals(message.getSenderType()))); |
| 115 | assert keFuMessage != null; // 断言避免警告 | 114 | assert keFuMessage != null; // 断言避免警告 |
| 116 | - getSelf().sendAsyncMessageToMember(keFuMessage.getSenderId(), KEFU_MESSAGE_ADMIN_READ, StrUtil.EMPTY); | 115 | + getSelf().sendAsyncMessageToMember(keFuMessage.getSenderId(), KEFU_MESSAGE_ADMIN_READ, conversation.getId()); |
| 117 | // 2.4 通知所有管理员消息已读 | 116 | // 2.4 通知所有管理员消息已读 |
| 118 | - getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_ADMIN_READ, StrUtil.EMPTY); | 117 | + getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_ADMIN_READ, conversation.getId()); |
| 119 | } | 118 | } |
| 120 | 119 | ||
| 121 | private void validateReceiverExist(Long receiverId, Integer receiverType) { | 120 | private void validateReceiverExist(Long receiverId, Integer receiverType) { |