| | |
| | | import java.util.Set; |
| | | import java.util.stream.Collectors; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | |
| | | private final ISysUserService sysUserService; |
| | | private final AsyncService asyncService; |
| | | @Value("${fdb.quarter}") |
| | | private String quarter; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | 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 = 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 |
| | |
| | | |
| | | 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); |
| | | } |
| | | } |