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(); } } }