commit
2775dbbad1
|
@ -51,7 +51,8 @@ public class ProductBrowseHistoryController {
|
||||||
convertSet(pageResult.getList(), ProductBrowseHistoryDO::getSpuId));
|
convertSet(pageResult.getList(), ProductBrowseHistoryDO::getSpuId));
|
||||||
return success(BeanUtils.toBean(pageResult, ProductBrowseHistoryRespVO.class,
|
return success(BeanUtils.toBean(pageResult, ProductBrowseHistoryRespVO.class,
|
||||||
vo -> Optional.ofNullable(spuMap.get(vo.getSpuId()))
|
vo -> Optional.ofNullable(spuMap.get(vo.getSpuId()))
|
||||||
.ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice()))));
|
.ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice())
|
||||||
|
.setSalesCount(spu.getSalesCount()).setStock(spu.getStock()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,12 +1,9 @@
|
||||||
package cn.iocoder.yudao.module.product.controller.admin.history.vo;
|
package cn.iocoder.yudao.module.product.controller.admin.history.vo;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 商品浏览记录 Response VO")
|
@Schema(description = "管理后台 - 商品浏览记录 Response VO")
|
||||||
|
@ -31,4 +28,10 @@ public class ProductBrowseHistoryRespVO {
|
||||||
@Schema(description = "商品单价", example = "100")
|
@Schema(description = "商品单价", example = "100")
|
||||||
private Integer price;
|
private Integer price;
|
||||||
|
|
||||||
|
@Schema(description = "商品销量", example = "100")
|
||||||
|
private Integer salesCount;
|
||||||
|
|
||||||
|
@Schema(description = "库存", example = "100")
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
}
|
}
|
|
@ -71,7 +71,8 @@ public class AppProductBrowseHistoryController {
|
||||||
Map<Long, ProductSpuDO> spuMap = convertMap(productSpuService.getSpuList(spuIds), ProductSpuDO::getId);
|
Map<Long, ProductSpuDO> spuMap = convertMap(productSpuService.getSpuList(spuIds), ProductSpuDO::getId);
|
||||||
return success(BeanUtils.toBean(pageResult, AppProductBrowseHistoryRespVO.class,
|
return success(BeanUtils.toBean(pageResult, AppProductBrowseHistoryRespVO.class,
|
||||||
vo -> Optional.ofNullable(spuMap.get(vo.getSpuId()))
|
vo -> Optional.ofNullable(spuMap.get(vo.getSpuId()))
|
||||||
.ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice()))));
|
.ifPresent(spu -> vo.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setPrice(spu.getPrice())
|
||||||
|
.setSalesCount(spu.getSalesCount()).setStock(spu.getStock()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,4 +26,11 @@ public class AppProductBrowseHistoryRespVO {
|
||||||
@Schema(description = "商品单价", example = "100")
|
@Schema(description = "商品单价", example = "100")
|
||||||
private Integer price;
|
private Integer price;
|
||||||
|
|
||||||
|
@Schema(description = "商品销量", example = "100")
|
||||||
|
private Integer salesCount;
|
||||||
|
|
||||||
|
@Schema(description = "库存", example = "100")
|
||||||
|
private Integer stock;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationRespVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationRespVO;
|
||||||
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationUpdatePinnedReqVO;
|
import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.conversation.KeFuConversationUpdatePinnedReqVO;
|
||||||
|
import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuConversationDO;
|
||||||
import cn.iocoder.yudao.module.promotion.service.kefu.KeFuConversationService;
|
import cn.iocoder.yudao.module.promotion.service.kefu.KeFuConversationService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
@ -34,6 +35,25 @@ public class KeFuConversationController {
|
||||||
@Resource
|
@Resource
|
||||||
private MemberUserApi memberUserApi;
|
private MemberUserApi memberUserApi;
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得客服会话")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:query')")
|
||||||
|
public CommonResult<KeFuConversationRespVO> getConversation(@RequestParam("id") Long id) {
|
||||||
|
KeFuConversationDO conversation = conversationService.getConversation(id);
|
||||||
|
if (conversation == null) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 拼接数据
|
||||||
|
KeFuConversationRespVO result = BeanUtils.toBean(conversation, KeFuConversationRespVO.class);
|
||||||
|
MemberUserRespDTO memberUser = memberUserApi.getUser(conversation.getUserId());
|
||||||
|
if (memberUser != null) {
|
||||||
|
result.setUserAvatar(memberUser.getAvatar()).setUserNickname(memberUser.getNickname());
|
||||||
|
}
|
||||||
|
return success(result);
|
||||||
|
}
|
||||||
|
|
||||||
@PutMapping("/update-conversation-pinned")
|
@PutMapping("/update-conversation-pinned")
|
||||||
@Operation(summary = "置顶/取消置顶客服会话")
|
@Operation(summary = "置顶/取消置顶客服会话")
|
||||||
@PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:update')")
|
@PreAuthorize("@ss.hasPermission('promotion:kefu-conversation:update')")
|
||||||
|
|
|
@ -13,6 +13,14 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface KeFuConversationService {
|
public interface KeFuConversationService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得客服会话
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 客服会话
|
||||||
|
*/
|
||||||
|
KeFuConversationDO getConversation(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 【管理员】删除客服会话
|
* 【管理员】删除客服会话
|
||||||
*
|
*
|
||||||
|
|
|
@ -30,6 +30,11 @@ public class KeFuConversationServiceImpl implements KeFuConversationService {
|
||||||
@Resource
|
@Resource
|
||||||
private KeFuConversationMapper conversationMapper;
|
private KeFuConversationMapper conversationMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeFuConversationDO getConversation(Long id) {
|
||||||
|
return conversationMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteKefuConversation(Long id) {
|
public void deleteKefuConversation(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
|
|
|
@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.promotion.service.kefu;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.util.ObjUtil;
|
import cn.hutool.core.util.ObjUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
import cn.iocoder.yudao.framework.common.enums.UserTypeEnum;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
|
@ -113,9 +112,9 @@ public class KeFuMessageServiceImpl implements KeFuMessageService {
|
||||||
// 2.3 发送消息通知会员,管理员已读 -> 会员更新发送的消息状态
|
// 2.3 发送消息通知会员,管理员已读 -> 会员更新发送的消息状态
|
||||||
KeFuMessageDO keFuMessage = getFirst(filterList(messageList, message -> UserTypeEnum.MEMBER.getValue().equals(message.getSenderType())));
|
KeFuMessageDO keFuMessage = getFirst(filterList(messageList, message -> UserTypeEnum.MEMBER.getValue().equals(message.getSenderType())));
|
||||||
assert keFuMessage != null; // 断言避免警告
|
assert keFuMessage != null; // 断言避免警告
|
||||||
getSelf().sendAsyncMessageToMember(keFuMessage.getSenderId(), KEFU_MESSAGE_ADMIN_READ, StrUtil.EMPTY);
|
getSelf().sendAsyncMessageToMember(keFuMessage.getSenderId(), KEFU_MESSAGE_ADMIN_READ, conversation.getId());
|
||||||
// 2.4 通知所有管理员消息已读
|
// 2.4 通知所有管理员消息已读
|
||||||
getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_ADMIN_READ, StrUtil.EMPTY);
|
getSelf().sendAsyncMessageToAdmin(KEFU_MESSAGE_ADMIN_READ, conversation.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateReceiverExist(Long receiverId, Integer receiverType) {
|
private void validateReceiverExist(Long receiverId, Integer receiverType) {
|
||||||
|
|
Loading…
Reference in New Issue