diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/kefu/vo/message/KeFuMessageListReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/kefu/vo/message/KeFuMessageListReqVO.java index 6368ba4641..511acad6c5 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/kefu/vo/message/KeFuMessageListReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/kefu/vo/message/KeFuMessageListReqVO.java @@ -1,6 +1,8 @@ package cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; import jakarta.validation.constraints.NotNull; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -13,6 +15,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data public class KeFuMessageListReqVO { + private static final Integer PAGE_SIZE = 10; + @Schema(description = "会话编号", example = "12580") @NotNull(message = "会话编号不能为空") private Long conversationId; @@ -21,4 +25,10 @@ public class KeFuMessageListReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime createTime; + @Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") + @NotNull(message = "每页条数不能为空") + @Min(value = 1, message = "每页条数最小值为 1") + @Max(value = 100, message = "每页条数最大值为 100") + private Integer pageSize = PAGE_SIZE; + } \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/activity/PointActivityPageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/activity/PointActivityPageReqVO.java index 89786c2ded..c204041540 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/activity/PointActivityPageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/activity/PointActivityPageReqVO.java @@ -5,11 +5,6 @@ import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; @Schema(description = "管理后台 - 积分商城活动分页 Request VO") @Data @@ -17,20 +12,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @ToString(callSuper = true) public class PointActivityPageReqVO extends PageParam { - @Schema(description = "积分商城活动商品", example = "19509") - private Long spuId; - @Schema(description = "活动状态", example = "2") private Integer status; - @Schema(description = "备注", example = "你说的对") - private String remark; - - @Schema(description = "排序") - private Integer sort; - - @Schema(description = "创建时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime[] createTime; - } \ No newline at end of file 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 fa63095b8c..2f07745061 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 @@ -9,6 +9,8 @@ import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuM import cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message.AppKeFuMessageSendReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; import cn.iocoder.yudao.module.promotion.service.kefu.KeFuMessageService; +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -18,8 +20,12 @@ import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList; +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; @Tag(name = "用户 APP - 客服消息") @@ -30,6 +36,8 @@ public class AppKeFuMessageController { @Resource private KeFuMessageService kefuMessageService; + @Resource + private AdminUserApi adminUserApi; @PostMapping("/send") @Operation(summary = "发送客服消息") @@ -52,8 +60,14 @@ public class AppKeFuMessageController { @Operation(summary = "获得客服消息列表") @PreAuthenticated public CommonResult> getKefuMessageList(@Valid AppKeFuMessagePageReqVO pageReqVO) { - List pageResult = kefuMessageService.getKeFuMessageList(pageReqVO, getLoginUserId()); - return success(BeanUtils.toBean(pageResult, KeFuMessageRespVO.class)); + List list = kefuMessageService.getKeFuMessageList(pageReqVO, getLoginUserId()); + + // 拼接数据 + List result = BeanUtils.toBean(list, KeFuMessageRespVO.class); + Map userMap = adminUserApi.getUserMap(convertSet(filterList(result, + item -> UserTypeEnum.ADMIN.getValue().equals(item.getSenderType())), KeFuMessageRespVO::getSenderId)); + result.forEach(item -> findAndThen(userMap, item.getSenderId(), user -> item.setSenderAvatar(user.getAvatar()))); + return success(result); } } \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/vo/message/AppKeFuMessagePageReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/vo/message/AppKeFuMessagePageReqVO.java index f8396bbb5f..7a55bef1a9 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/vo/message/AppKeFuMessagePageReqVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/kefu/vo/message/AppKeFuMessagePageReqVO.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.promotion.controller.app.kefu.vo.message; import io.swagger.v3.oas.annotations.media.Schema; +import jakarta.validation.constraints.Max; +import jakarta.validation.constraints.Min; +import jakarta.validation.constraints.NotNull; import lombok.Data; import org.springframework.format.annotation.DateTimeFormat; @@ -12,6 +15,8 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ @Data public class AppKeFuMessagePageReqVO { + private static final Integer PAGE_SIZE = 10; + @Schema(description = "会话编号", example = "12580") private Long conversationId; @@ -19,4 +24,10 @@ public class AppKeFuMessagePageReqVO { @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) private LocalDateTime createTime; + @Schema(description = "每页条数,最大值为 100", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") + @NotNull(message = "每页条数不能为空") + @Min(value = 1, message = "每页条数最小值为 1") + @Max(value = 100, message = "每页条数最大值为 100") + private Integer pageSize = PAGE_SIZE; + } \ No newline at end of file diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityRespVO.java index 29f4f97c11..ddcc23b9cb 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityRespVO.java @@ -4,8 +4,6 @@ import com.alibaba.excel.annotation.ExcelProperty; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; -import java.time.LocalDateTime; - @Schema(description = "用户 App - 积分商城活动 Response VO") @Data public class AppPointActivityRespVO { @@ -30,20 +28,6 @@ public class AppPointActivityRespVO { @ExcelProperty("积分商城活动总库存") private Integer totalStock; - // TODO @puhui999:只返回必要的字段,例如说 remark、sort、createTime 应该是不需要的呢。也可以看看别的也不需要哈。 - - @Schema(description = "备注", example = "你说的对") - @ExcelProperty("备注") - private String remark; - - @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("排序") - private Integer sort; - - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) - @ExcelProperty("创建时间") - private LocalDateTime createTime; - // ========== 商品字段 ========== @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 name 读取 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java index 3ee4a8190b..9ea776232f 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java @@ -217,7 +217,7 @@ public interface CombinationActivityConvert { List createRecords = new ArrayList<>(count); for (int i = 0; i < count; i++) { // 基础信息和团长保持一致 - CombinationRecordDO newRecord = convert5(headRecord); + CombinationRecordDO newRecord = convert5(headRecord).setHeadId(headRecord.getId()); // 虚拟信息 newRecord.setCount(0) // 会单独更新下,在后续的 Service 逻辑里 .setUserId(0L).setNickname("").setAvatar("").setOrderId(0L); 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 b86356ce95..a7204193f3 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 @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.promotion.dal.mysql.kefu; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.module.promotion.controller.admin.kefu.vo.message.KeFuMessageListReqVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.kefu.KeFuMessageDO; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -28,11 +28,11 @@ public interface KeFuMessageMapper extends BaseMapperX { * @return 消息列表 */ default List selectList(KeFuMessageListReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(KeFuMessageDO::getConversationId, reqVO.getConversationId()) - .ltIfPresent(KeFuMessageDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(KeFuMessageDO::getCreateTime) - .last("limit 10")); // TODO @puhui999:使用 limitN 哈。然后 10 通过 reqVO 传递。 + return selectList(new QueryWrapperX() + .eqIfPresent("conversation_id", reqVO.getConversationId()) + .ltIfPresent("create_time", reqVO.getCreateTime()) + .orderByDesc("create_time") + .limitN(reqVO.getPageSize())); } default List selectListByConversationIdAndUserTypeAndReadStatus(Long conversationId, Integer userType, diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointActivityMapper.java index d724c32ee5..e8ce531343 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/point/PointActivityMapper.java @@ -19,12 +19,8 @@ public interface PointActivityMapper extends BaseMapperX { default PageResult selectPage(PointActivityPageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(PointActivityDO::getSpuId, reqVO.getSpuId()) .eqIfPresent(PointActivityDO::getStatus, reqVO.getStatus()) - .eqIfPresent(PointActivityDO::getRemark, reqVO.getRemark()) - .eqIfPresent(PointActivityDO::getSort, reqVO.getSort()) - .betweenIfPresent(PointActivityDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(PointActivityDO::getId)); + .orderByDesc(PointActivityDO::getSort)); } /** diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java index 6f5ac3f625..d63b27fafc 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationRecordServiceImpl.java @@ -375,7 +375,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService { CombinationRecordDO updateRecord = new CombinationRecordDO().setId(item.getId()) .setStatus(status.getStatus()).setEndTime(now); if (CombinationRecordStatusEnum.isSuccess(status.getStatus())) { // 虚拟成团完事更改状态成功后还需要把参与人数修改为成团需要人数 - updateRecord.setUserCount(updateRecord.getUserSize()); + updateRecord.setUserCount(records.size()); } updateRecords.add(updateRecord); });