puzhibing
2023-11-25 53e7558400dcacecdce70e39ebfe1727740f9296
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package com.dsh.other.controller;
 
 
import com.dsh.other.entity.StoreEvaluation;
import com.dsh.other.model.StoreDetailsVo;
import com.dsh.other.service.StoreEvaluationService;
import com.dsh.other.util.ResultUtil;
import com.dsh.other.util.TokenUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
 
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
 
@RestController
@RequestMapping("")
public class StoreEvaluationController {
 
 
    @Resource
    private StoreEvaluationService evaluationService;
 
 
    @Resource
    private TokenUtil tokenUtil;
 
 
    @ResponseBody
    @PostMapping("/base/storeEvaluation/saveEvaluation")
    @ApiOperation(value = "联系客服-门店评价", tags = {"APP-探索玩湃"})
    @ApiImplicitParams({
            @ApiImplicitParam(value = "门店id", name = "storeId", required = true, dataType = "int"),
    })
    public ResultUtil getStoreDetails(Integer storeId, String content, double score, String imgs) {
        try {
            Integer uid = tokenUtil.getUserIdFormRedis();
            if (null == uid) {
                return ResultUtil.tokenErr();
            }
            StoreEvaluation storeEvaluation = new StoreEvaluation();
            storeEvaluation.setAppUserId(uid);
            storeEvaluation.setStoreId(storeId);
            storeEvaluation.setScore(score);
            storeEvaluation.setContent(content);
            storeEvaluation.setImgs(imgs);
            storeEvaluation.setState(1);
            storeEvaluation.setInsertTime(new Date());
            evaluationService.save(storeEvaluation);
            return ResultUtil.success();
        } catch (Exception e) {
            return ResultUtil.runErr();
        }
    }
 
}