- 在微信店员评价查询接口中强制设置hidden=0 - 确保顾客端只能看到管理员未隐藏的评价 - 优化日志配置,减少SQL日志输出
This commit is contained in:
@@ -2,6 +2,7 @@ package com.starry.admin.modules.order.module.entity;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.starry.common.domain.BaseEntity;
|
import com.starry.common.domain.BaseEntity;
|
||||||
|
import com.starry.common.enums.EvaluateHiddenState;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -74,6 +75,7 @@ public class PlayOrderEvaluateInfoEntity extends BaseEntity<PlayOrderEvaluateInf
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据是否隐藏(0:显示,1:隐藏)
|
* 数据是否隐藏(0:显示,1:隐藏)
|
||||||
|
* @see EvaluateHiddenState
|
||||||
*/
|
*/
|
||||||
private String hidden;
|
private String hidden;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.starry.admin.modules.order.module.vo;
|
package com.starry.admin.modules.order.module.vo;
|
||||||
|
|
||||||
|
import com.starry.common.enums.EvaluateHiddenState;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
@@ -24,9 +25,10 @@ public class PlayOrderEvaluateEditStateVo {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 数据是否隐藏(0:显示,1:隐藏)
|
* 数据是否隐藏(0:显示,1:隐藏)
|
||||||
|
* @see EvaluateHiddenState
|
||||||
*/
|
*/
|
||||||
@NotBlank(message = "是否隐藏不能为空")
|
@NotBlank(message = "是否隐藏不能为空")
|
||||||
@Pattern(regexp = "[01]", message = "是否隐藏数据错误,只能位0或者1")
|
@Pattern(regexp = "[01]", message = "是否隐藏数据错误,只能位0或者1")
|
||||||
@ApiModelProperty(value = "是否隐藏", required = true, example = "1", notes = "数据是否隐藏,0:显示,1:隐藏")
|
@ApiModelProperty(value = "是否隐藏", required = true, example = "1", notes = "数据是否隐藏,0:显示,1:隐藏。使用 EvaluateHiddenState 枚举值")
|
||||||
private String hidden;
|
private String hidden;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import com.starry.admin.modules.order.module.vo.PlayOrderEvaluateReturnVo;
|
|||||||
import com.starry.admin.modules.order.service.IPlayOrderEvaluateInfoService;
|
import com.starry.admin.modules.order.service.IPlayOrderEvaluateInfoService;
|
||||||
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
import com.starry.admin.modules.personnel.service.IPlayPersonnelGroupInfoService;
|
||||||
import com.starry.admin.utils.SecurityUtils;
|
import com.starry.admin.utils.SecurityUtils;
|
||||||
|
import com.starry.common.enums.EvaluateHiddenState;
|
||||||
import com.starry.common.utils.IdUtils;
|
import com.starry.common.utils.IdUtils;
|
||||||
import com.starry.common.utils.StringUtils;
|
import com.starry.common.utils.StringUtils;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|||||||
@@ -553,6 +553,8 @@ public class WxClerkController {
|
|||||||
@PostMapping("/user/queryEvaluateByPage")
|
@PostMapping("/user/queryEvaluateByPage")
|
||||||
public R queryEvaluateById(@Validated @RequestBody PlayOrderEvaluateQueryVo vo) {
|
public R queryEvaluateById(@Validated @RequestBody PlayOrderEvaluateQueryVo vo) {
|
||||||
clerkUserInfoService.selectById(vo.getClerkId());
|
clerkUserInfoService.selectById(vo.getClerkId());
|
||||||
|
// Force filter to show only visible evaluations (hidden = "0") for WeChat client
|
||||||
|
vo.setHidden(com.starry.common.enums.EvaluateHiddenState.VISIBLE.getCode());
|
||||||
return R.ok(playOrderEvaluateInfoService.selectByPage(vo));
|
return R.ok(playOrderEvaluateInfoService.selectByPage(vo));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.starry.common.enums;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评价隐藏状态枚举,集中维护状态代码及含义。
|
||||||
|
* 用于订单评价、打赏等记录的显示/隐藏控制。
|
||||||
|
*/
|
||||||
|
@ApiModel(value = "评价隐藏状态", description = "评价隐藏状态枚举,避免魔法值")
|
||||||
|
public enum EvaluateHiddenState {
|
||||||
|
|
||||||
|
VISIBLE("0", "显示"),
|
||||||
|
HIDDEN("1", "隐藏");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
EvaluateHiddenState(String code, String description) {
|
||||||
|
this.code = code;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从代码获取枚举实例
|
||||||
|
*
|
||||||
|
* @param code 状态代码
|
||||||
|
* @return 对应的枚举实例
|
||||||
|
*/
|
||||||
|
@JsonCreator
|
||||||
|
public static EvaluateHiddenState fromCode(String code) {
|
||||||
|
if (code == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (EvaluateHiddenState state : EvaluateHiddenState.values()) {
|
||||||
|
if (state.code.equals(code)) {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Unknown EvaluateHiddenState code: " + code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为显示状态
|
||||||
|
*
|
||||||
|
* @param code 状态代码
|
||||||
|
* @return true: 显示, false: 隐藏或未知
|
||||||
|
*/
|
||||||
|
public static boolean isVisible(String code) {
|
||||||
|
return VISIBLE.code.equals(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为隐藏状态
|
||||||
|
*
|
||||||
|
* @param code 状态代码
|
||||||
|
* @return true: 隐藏, false: 显示或未知
|
||||||
|
*/
|
||||||
|
public static boolean isHidden(String code) {
|
||||||
|
return HIDDEN.code.equals(code);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 切换显示/隐藏状态
|
||||||
|
*
|
||||||
|
* @param currentCode 当前状态代码
|
||||||
|
* @return 切换后的状态代码
|
||||||
|
*/
|
||||||
|
public static String toggle(String currentCode) {
|
||||||
|
return isHidden(currentCode) ? VISIBLE.code : HIDDEN.code;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user