mitao
2025-04-07 18891c60ab1c06a4acc85d0ec54dee50d1b1a19f
finance-system/src/main/java/com/finance/system/service/impl/TbQuestionServiceImpl.java
@@ -9,6 +9,7 @@
import com.finance.common.utils.CollUtils;
import com.finance.common.utils.DateUtils;
import com.finance.common.utils.StringUtils;
import com.finance.system.constants.QuarterConstant;
import com.finance.system.domain.TbQuestion;
import com.finance.system.dto.QuestionDTO;
import com.finance.system.dto.update.QuestionUpdDTO;
@@ -47,16 +48,19 @@
    public void addQuestion(QuestionDTO dto) throws Exception {
        TbQuestion tbQuestion = BeanUtils.copyBean(dto, TbQuestion.class);
        tbQuestion.setType(dto.getType());
        tbQuestion.setQuarter(DateUtils.getNowQuarter());
        String previousQuarter = DateUtils.getPreviousQuarter();
        previousQuarter = QuarterConstant.CURRENT_QUARTER;
        tbQuestion.setQuarter(previousQuarter);
        this.save(tbQuestion);
        asyncService.subtractScoreWithFixedRules(dto.getDeptAreaCode());
    }
    @Override
    public void editQuestion(QuestionUpdDTO dto) {
    public void editQuestion(QuestionUpdDTO dto) throws Exception {
        TbQuestion tbQuestion = BeanUtils.copyBean(dto, TbQuestion.class);
        tbQuestion.setType(dto.getType());
        this.updateById(tbQuestion);
        asyncService.subtractScoreWithFixedRules(dto.getDeptAreaCode());
    }
    @Override
@@ -89,4 +93,15 @@
        return questionVOPageDTO;
    }
    @Override
    public void delete(Long id) {
        TbQuestion question = this.getById(id);
        try {
            asyncService.subtractScoreWithFixedRules(question.getDeptAreaCode());
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        this.removeById(id);
    }
}