zhibing.pu
2024-08-12 34d18c08f04de78eccb42b88b7484b0531d263ff
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/controller/TOrderEvaluateController.java
@@ -1,22 +1,21 @@
package com.ruoyi.order.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.order.api.model.TOrderEvaluate;
import com.ruoyi.order.api.query.TOrderEvaluateQuery;
import com.ruoyi.order.api.vo.TOrderEvaluateVO;
import com.ruoyi.order.dto.GetOrderEvaluatePageList;
import com.ruoyi.order.dto.GetOrderEvaluatePageListDTO;
import com.ruoyi.order.service.TOrderEvaluateService;
import com.ruoyi.other.api.feignClient.TEvaluationTagClient;
import com.ruoyi.other.api.vo.TEvaluationTagVO;
import io.swagger.annotations.Api;
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.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
/**
@@ -47,6 +46,62 @@
    public AjaxResult<PageInfo<TOrderEvaluateVO>> pageList(@RequestBody TOrderEvaluateQuery query) {
        return AjaxResult.ok(orderEvaluateService.getTagList(query));
    }
    @GetMapping(value = "/getPageList")
    @ApiOperation(value = "获取充电评价列表", tags = {"管理后台-充电评价"})
    public AjaxResult<PageInfo<GetOrderEvaluatePageListDTO>> getPageList(@RequestBody GetOrderEvaluatePageList pageList){
        PageInfo<GetOrderEvaluatePageListDTO> list = orderEvaluateService.getPageList(pageList);
        return AjaxResult.success(list);
    }
    @DeleteMapping(value = "/delOrderEvaluate")
    @ApiOperation(value = "删除充电评价", tags = {"管理后台-充电评价"})
    public AjaxResult delOrderEvaluate(@PathVariable Long id){
        TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id);
        orderEvaluate.setDelFlag(true);
        orderEvaluateService.updateById(orderEvaluate);
        return AjaxResult.success();
    }
    @PostMapping(value = "/replyEvaluation")
    @ApiOperation(value = "充电评价回复", tags = {"管理后台-充电评价"})
    public AjaxResult replyEvaluation(@PathVariable("id") Long id, @RequestParam("reply") String reply){
        TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id);
        reply = reply.replaceAll("& #40;", "(")
                .replaceAll("& #41;", ")")
                .replaceAll("& #40;", "(")
                .replaceAll("& #41;", ")")
                .replaceAll("& #39;", "'")
                .replaceAll("& lt;", "<")
                .replaceAll("& gt;", ">");
        orderEvaluate.setEvaluationResponse(reply);
        orderEvaluate.setResponseTime(LocalDateTime.now());
        orderEvaluateService.updateById(orderEvaluate);
        return AjaxResult.success();
    }
    @DeleteMapping(value = "/delOrderEvaluateReply")
    @ApiOperation(value = "删除充电评价回复", tags = {"管理后台-充电评价"})
    public AjaxResult delOrderEvaluateReply(@PathVariable Long id){
        TOrderEvaluate orderEvaluate = orderEvaluateService.getById(id);
        orderEvaluate.setEvaluationResponse("");
        orderEvaluateService.updateById(orderEvaluate);
        return AjaxResult.success();
    }
}