订单评价和投诉

This commit is contained in:
admin
2024-05-08 23:45:51 +08:00
parent 61e777c41e
commit aa68b33ca5
17 changed files with 568 additions and 46 deletions

View File

@@ -1,11 +1,14 @@
package com.starry.admin.modules.custom.module.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.starry.admin.common.conf.StringTypeHandler;
import com.starry.common.domain.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;
/**
* 顾客留言对象 play_custom_leave_msg
@@ -15,7 +18,7 @@ import java.util.Date;
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("play_custom_leave_msg")
@TableName(value = "play_custom_leave_msg", autoResultMap = true)
public class PlayCustomLeaveMsgEntity extends BaseEntity<PlayCustomLeaveMsgEntity> {
@@ -42,7 +45,8 @@ public class PlayCustomLeaveMsgEntity extends BaseEntity<PlayCustomLeaveMsgEntit
/**
* 图片
*/
private String images;
@TableField(typeHandler = StringTypeHandler.class)
private List<String> images;
/**
* 留言时间

View File

@@ -22,6 +22,15 @@ public interface IPlayCustomLeaveMsgService extends IService<PlayCustomLeaveMsgE
PlayCustomLeaveMsgEntity selectPlayCustomLeaveMsgById(String id);
/**
* 查询当前用户不允许留言的原因
*
* @param customId 顾客ID
* @return 没有权限原因
*/
String queryNoMessagesAllowedReason(String customId);
/**
* 分页查询顾客留言列表
*

View File

@@ -7,15 +7,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import com.starry.admin.common.conf.ThreadLocalRequestDetail;
import com.starry.admin.common.exception.CustomException;
import com.starry.admin.modules.custom.mapper.PlayCustomLeaveMsgMapper;
import com.starry.admin.modules.custom.module.entity.PlayCustomLeaveMsgEntity;
import com.starry.admin.modules.custom.module.entity.PlayCustomUserInfoEntity;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgQueryVo;
import com.starry.admin.modules.custom.module.vo.PlayCustomLeaveMsgReturnVo;
import com.starry.admin.modules.custom.service.IPlayCustomLeaveMsgService;
import com.starry.common.utils.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Arrays;
/**
@@ -61,7 +66,31 @@ public class PlayCustomLeaveMsgServiceImpl extends ServiceImpl<PlayCustomLeaveMs
@Override
public IPage<PlayCustomLeaveMsgEntity> selectPlayCustomLeaveMsgByPage(PlayCustomLeaveMsgEntity playCustomLeaveMsg) {
Page<PlayCustomLeaveMsgEntity> page = new Page<>(1, 10);
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<PlayCustomLeaveMsgEntity>());
return this.baseMapper.selectPage(page, new LambdaQueryWrapper<>());
}
/**
* 查询当前用户不允许留言的原因
* 1、一个人在同一天只能留言一次
*
* @param customId 顾客ID
* @return 当前用户不允许留言的原因
*/
@Override
public String queryNoMessagesAllowedReason(String customId) {
// 1、一个人在同一天只能留言一次
LocalDateTime now = LocalDateTime.now();
LocalDateTime start = LocalDateTime.of(now.toLocalDate(), LocalTime.MIN);
LocalDateTime end = LocalDateTime.of(now.toLocalDate(), LocalTime.MAX);
LambdaQueryWrapper<PlayCustomLeaveMsgEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PlayCustomLeaveMsgEntity::getCustomId, customId);
lambdaQueryWrapper.between(PlayCustomLeaveMsgEntity::getMsgTime, start, end);
if (this.baseMapper.selectOne(lambdaQueryWrapper) != null) {
return "一天只能留言一次";
}
// 2、
// 3、
return "";
}
/**
@@ -72,6 +101,10 @@ public class PlayCustomLeaveMsgServiceImpl extends ServiceImpl<PlayCustomLeaveMs
*/
@Override
public boolean create(PlayCustomLeaveMsgEntity playCustomLeaveMsg) {
String noMessagesAllowedReason = this.queryNoMessagesAllowedReason(ThreadLocalRequestDetail.getCustomUserInfo().getId());
if (StringUtils.isNotEmpty(noMessagesAllowedReason)) {
throw new CustomException(noMessagesAllowedReason);
}
if (StrUtil.isBlankIfStr(playCustomLeaveMsg.getId())) {
playCustomLeaveMsg.setId(IdUtil.fastSimpleUUID());
}