cloudroam
2025-01-07 1d0fc6126fb664e81a1a3737d8eaf4a618e7cb0f
src/main/java/com/mzl/flower/web/v2/comment/FlowerCommentController.java
@@ -5,15 +5,16 @@
import com.mzl.flower.base.BaseController;
import com.mzl.flower.base.R;
import com.mzl.flower.base.ReturnDataDTO;
import com.mzl.flower.base.annotation.OperationLog;
import com.mzl.flower.config.exception.ValidationException;
import com.mzl.flower.dto.request.comment.CreateFlowerCommentBatchDTO;
import com.mzl.flower.dto.request.comment.CreateFlowerCommentDTO;
import com.mzl.flower.dto.request.comment.QueryFlowerCommentDTO;
import com.mzl.flower.dto.request.comment.UpdateFlowerCommentDTO;
import com.mzl.flower.dto.request.comment.*;
import com.mzl.flower.dto.response.comment.FlowerCommentVO;
import com.mzl.flower.dto.response.coupon.CouponTemplatePointVO;
import com.mzl.flower.dto.response.coupon.CouponTemplateVO;
import com.mzl.flower.entity.log.OperationRecord;
import com.mzl.flower.entity.payment.Order;
import com.mzl.flower.service.comment.FlowerCommentService;
import com.mzl.flower.service.payment.OrderService;
import com.mzl.flower.utils.ConverterUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -38,6 +39,9 @@
    @Autowired
    private FlowerCommentService flowerCommentService;
    @Autowired
    private OrderService orderService;
    @PostMapping("")
    @ApiOperation(value = "新增", notes = "新增")
@@ -73,6 +77,7 @@
    }
    @DeleteMapping("/{id}")
    @OperationLog(value = "评价删除",type = "flower_comment")
    @ApiOperation(value = "删除", notes = "删除")
    public ResponseEntity<ReturnDataDTO> delete(@PathVariable String id) {
@@ -81,7 +86,10 @@
            throw new ValidationException("评论不存在");
        }
        flowerCommentService.deleteFlowerComment(id);
        return returnData(R.SUCCESS.getCode(), null);
        Order order = orderService.getOrderInfoById(flowerCommentDO.getOrderId());
        String content = "评价删除id:【" + id + "】,订单编号【" + order.getOrderNo() + "】,供应商id:【" + flowerCommentDO.getSupplierId() + "】,评价内容:【" + flowerCommentDO.getComment() + "】";
        OperationRecord operationRecord = getOperationRecord(content);
        return returnData(R.SUCCESS.getCode(), null, operationRecord);
    }
    @GetMapping("/{id}")
@@ -120,6 +128,26 @@
        return returnData(R.SUCCESS.getCode(), flowerCommentService.getSupplierStatis(id));
    }
    @PutMapping("/show/{id}")
    @ApiOperation(value = "显示/隐藏", notes = "显示/隐藏")
    public ResponseEntity<ReturnDataDTO> updateShow(@PathVariable String id,@Validated @RequestBody ShowFlowerCommentDTO dto) {
        // 手动设置id值
        dto.setId(id);
        flowerCommentService.updateShowFlowerComment(dto);
        return returnData(R.SUCCESS.getCode(), null);
    }
    @PutMapping("/replay/{id}")
    @ApiOperation(value = "评论回复", notes = "评论回复")
    public ResponseEntity<ReturnDataDTO> updateReplay(@PathVariable String id,@Validated @RequestBody ReplayFlowerCommentDTO dto) {
        // 手动设置id值
        dto.setId(id);
        flowerCommentService.updateReplayFlowerComment(dto);
        return returnData(R.SUCCESS.getCode(), null);
    }
    private void valid(CreateFlowerCommentDTO dto){
    }