guyue
2025-08-12 ff1fec7eae681e89e607fd441d2597ab67b5ed2a
src/main/java/com/linghu/controller/KeywordController.java
@@ -1,6 +1,7 @@
package com.linghu.controller;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.linghu.config.FinalStatus;
import com.linghu.listener.KeywordExcelListener;
import com.linghu.model.common.ResponseResult;
@@ -18,6 +19,7 @@
import com.linghu.model.vo.ResultListVO;
import com.linghu.service.KeywordService;
import com.linghu.service.OrderService;
import com.linghu.service.ReferenceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -47,6 +49,9 @@
    @Autowired
    private ReferenceService referenceService;
    @Autowired
    private OrderService orderService;
    /**
     * 关键词统计 EChart图
@@ -211,7 +216,17 @@
        if(FinalStatus.SUBMITTED.getValue().equals(keyword.getStatus())){
            return ResponseResult.error("关键词已开始采集或不允许删除!");
        }
        keywordService.removeById(keywordId);
        //找到订单
        Orders order = orderService.getById(keyword.getOrder_id());
        //更新关键词数量
        LambdaQueryWrapper<Keyword> queryKeywordsQueryWrapper =  new LambdaQueryWrapper<>();
        queryKeywordsQueryWrapper.eq(Keyword::getOrder_id, keyword.getOrder_id());
        int count1 = (int) keywordService.count(queryKeywordsQueryWrapper);
        order.setKeyword_num(count1);
        orderService.updateById(order);
        return ResponseResult.success("删除成功");
    }