mirror of
				https://github.com/YunaiV/ruoyi-vue-pro.git
				synced 2025-10-31 10:37:41 +08:00 
			
		
		
		
	| @ -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; | ||||
|  | ||||
| } | ||||
| @ -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; | ||||
|  | ||||
| } | ||||
| @ -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<List<KeFuMessageRespVO>> getKefuMessageList(@Valid AppKeFuMessagePageReqVO pageReqVO) { | ||||
|         List<KeFuMessageDO> pageResult = kefuMessageService.getKeFuMessageList(pageReqVO, getLoginUserId()); | ||||
|         return success(BeanUtils.toBean(pageResult, KeFuMessageRespVO.class)); | ||||
|         List<KeFuMessageDO> list = kefuMessageService.getKeFuMessageList(pageReqVO, getLoginUserId()); | ||||
|  | ||||
|         // 拼接数据 | ||||
|         List<KeFuMessageRespVO> result = BeanUtils.toBean(list, KeFuMessageRespVO.class); | ||||
|         Map<Long, AdminUserRespDTO> 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); | ||||
|     } | ||||
|  | ||||
| } | ||||
| @ -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; | ||||
|  | ||||
| } | ||||
| @ -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 读取 | ||||
|  | ||||
| @ -217,7 +217,7 @@ public interface CombinationActivityConvert { | ||||
|         List<CombinationRecordDO> 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); | ||||
|  | ||||
| @ -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<KeFuMessageDO> { | ||||
|      * @return 消息列表 | ||||
|      */ | ||||
|     default List<KeFuMessageDO> selectList(KeFuMessageListReqVO reqVO) { | ||||
|         return selectList(new LambdaQueryWrapperX<KeFuMessageDO>() | ||||
|                 .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<KeFuMessageDO>() | ||||
|                 .eqIfPresent("conversation_id", reqVO.getConversationId()) | ||||
|                 .ltIfPresent("create_time", reqVO.getCreateTime()) | ||||
|                 .orderByDesc("create_time") | ||||
|                 .limitN(reqVO.getPageSize())); | ||||
|     } | ||||
|  | ||||
|     default List<KeFuMessageDO> selectListByConversationIdAndUserTypeAndReadStatus(Long conversationId, Integer userType, | ||||
|  | ||||
| @ -19,12 +19,8 @@ public interface PointActivityMapper extends BaseMapperX<PointActivityDO> { | ||||
|  | ||||
|     default PageResult<PointActivityDO> selectPage(PointActivityPageReqVO reqVO) { | ||||
|         return selectPage(reqVO, new LambdaQueryWrapperX<PointActivityDO>() | ||||
|                 .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)); | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|  | ||||
| @ -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); | ||||
|         }); | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 芋道源码
					芋道源码