|
@@ -0,0 +1,49 @@
|
|
|
+package com.chelvc.cloud.admin.controller;
|
|
|
+
|
|
|
+import com.chelvc.framework.base.annotation.ResponseWrapping;
|
|
|
+import com.chelvc.framework.base.context.SessionContextHolder;
|
|
|
+import com.chelvc.framework.redis.config.RedisConfigurer;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 评价管理
|
|
|
+ * @author valley
|
|
|
+ * @date 2024/01/26 00:08
|
|
|
+ **/
|
|
|
+@Slf4j
|
|
|
+@Validated
|
|
|
+@RestController
|
|
|
+@ResponseWrapping
|
|
|
+@PreAuthorize("isScope('EMPLOYEE')")
|
|
|
+public class AssessController {
|
|
|
+
|
|
|
+ private static final String DEFAULT_MSG= "亲爱的顾客,感谢您认可我们的服务,我们会努力做的更好,祝您生活愉快!";
|
|
|
+ @Autowired
|
|
|
+ private RedisConfigurer redis;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @return 获取默认评价内容
|
|
|
+ */
|
|
|
+ @GetMapping("assess/getDefaultMsg")
|
|
|
+ public String getDefaultAssessMsg(){
|
|
|
+ Long userId = SessionContextHolder.getSession().getId();
|
|
|
+ Object obj = redis.redisTemplate().opsForValue().get("assess:defaultAssess " + userId);
|
|
|
+ return obj == null ? DEFAULT_MSG : obj.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param msg 评价内容
|
|
|
+ * 修改默认评价
|
|
|
+ */
|
|
|
+ @PostMapping("assess/saveDefaultMsg")
|
|
|
+ public void getDefaultAssessMsg(String msg){
|
|
|
+ Long userId = SessionContextHolder.getSession().getId();
|
|
|
+ redis.redisTemplate().opsForValue().set("assess:defaultAssess " + userId, msg);
|
|
|
+ }
|
|
|
+}
|