| | |
| | | package org.springblade.modules.answerRecord.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.common.constant.CommonConstant; |
| | | import org.springblade.common.utils.SpringUtils; |
| | | import org.springblade.modules.answerRecord.dto.AnswerRecordDTO; |
| | | import org.springblade.modules.answerRecord.entity.AnswerRecordEntity; |
| | |
| | | remove(Wrappers.<AnswerRecordEntity>lambdaQuery() |
| | | .eq(AnswerRecordEntity::getPropertyId, choicesVO.getPropertyId()) |
| | | .eq(AnswerRecordEntity::getSubjectChoicesId, choicesVO.getId())); |
| | | if (subjectOptionVO.getIds() != null) { |
| | | AnswerRecordDTO answerRecordDTO = new AnswerRecordDTO(); |
| | | answerRecordDTO.setPropertyId(choicesVO.getPropertyId()); |
| | | answerRecordDTO.setAnswerOption(subjectOptionVO.getId().toString()); |
| | | answerRecordDTO.setSubjectChoicesId(choicesVO.getId()); |
| | | answerRecordDTO.setSubjectOptionId(subjectOptionVO.getId()); |
| | | objects.add(answerRecordDTO); |
| | | bigDecimal = bigDecimal.add(subjectOptionVO.getScore()); |
| | | // 判断选项的id |
| | | if (subjectOptionVO.getId().equals(choicesVO.getChooseId())) { |
| | | if (CommonConstant.NUMBER_ZERO.equals(choicesVO.getChoicesType().intValue())) { |
| | | AnswerRecordDTO answerRecordDTO = new AnswerRecordDTO(); |
| | | answerRecordDTO.setPropertyId(choicesVO.getPropertyId()); |
| | | answerRecordDTO.setAnswerOption(subjectOptionVO.getId()); |
| | | answerRecordDTO.setSubjectChoicesId(choicesVO.getId()); |
| | | answerRecordDTO.setSubjectChoicesType(1); |
| | | answerRecordDTO.setSubjectOptionId(subjectOptionVO.getId()); |
| | | objects.add(answerRecordDTO); |
| | | bigDecimal = bigDecimal.add(subjectOptionVO.getScore()); |
| | | break; |
| | | } |
| | | } |
| | | if (subjectOptionVO.getNumbers() != null) { |
| | | if (CommonConstant.NUMBER_THREE.equals(choicesVO.getChoicesType().intValue())) { |
| | | AnswerRecordDTO answerRecordDTO = new AnswerRecordDTO(); |
| | | answerRecordDTO.setPropertyId(choicesVO.getPropertyId()); |
| | | answerRecordDTO.setAnswerOption(subjectOptionVO.getId().toString()); |
| | | answerRecordDTO.setAnswerOption(subjectOptionVO.getId()); |
| | | answerRecordDTO.setSubjectChoicesId(choicesVO.getId()); |
| | | answerRecordDTO.setAnswer(subjectOptionVO.getNumbers()); |
| | | answerRecordDTO.setSubjectOptionId(subjectOptionVO.getId()); |
| | | answerRecordDTO.setSubjectChoicesType(3); |
| | | objects.add(answerRecordDTO); |
| | | BigDecimal multiply = BigDecimal.valueOf(subjectOptionVO.getNumbers()).multiply(subjectOptionVO.getScore()); |
| | | bigDecimal = bigDecimal.subtract(multiply); |