linwei
2024-02-19 65c2b4299b16b4715fd07df68e03aa2161374ba0
物业评定bug修复
4 files modified
61 ■■■■■ changed files
src/main/java/org/springblade/modules/answerRecord/entity/AnswerRecordEntity.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/answerRecord/service/impl/AnswerRecordServiceImpl.java 28 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/subjectChoices/service/impl/SubjectChoicesServiceImpl.java 29 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/subjectChoices/vo/SubjectChoicesVO.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/answerRecord/entity/AnswerRecordEntity.java
@@ -73,7 +73,7 @@
     */
    @ApiModelProperty(value = "提交的选项id", example = "")
    @TableField("answer_option")
    private String answerOption;
    private Long answerOption;
    /**
     * 本题得分
src/main/java/org/springblade/modules/answerRecord/service/impl/AnswerRecordServiceImpl.java
@@ -17,8 +17,10 @@
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;
@@ -86,22 +88,28 @@
                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);
src/main/java/org/springblade/modules/subjectChoices/service/impl/SubjectChoicesServiceImpl.java
@@ -17,14 +17,17 @@
package org.springblade.modules.subjectChoices.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.common.utils.SpringUtils;
import org.springblade.modules.answerRecord.entity.AnswerRecordEntity;
import org.springblade.modules.answerRecord.service.IAnswerRecordService;
import org.springblade.modules.subjectChoices.dto.SubjectChoicesDTO;
import org.springblade.modules.subjectChoices.entity.SubjectChoicesEntity;
import org.springblade.modules.subjectChoices.mapper.SubjectChoicesMapper;
import org.springblade.modules.subjectChoices.service.ISubjectChoicesService;
import org.springblade.modules.subjectChoices.vo.SubjectChoicesVO;
import org.springblade.modules.subjectOption.vo.SubjectOptionVO;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -42,15 +45,23 @@
    public IPage<SubjectChoicesVO> selectSubjectChoicesPage(IPage<SubjectChoicesVO> page, SubjectChoicesVO subjectChoices) {
        List<SubjectChoicesVO> subjectChoicesVOS = baseMapper.selectSubjectChoicesPage(page, subjectChoices);
        IAnswerRecordService bean = SpringUtils.getBean(IAnswerRecordService.class);
        // for (SubjectChoicesVO subjectChoicesVO : subjectChoicesVOS) {
        //     List<SubjectOptionVO> subjectOptionList = subjectChoicesVO.getSubjectOptionList();
        //     for (SubjectOptionVO subjectOptionVO : subjectOptionList) {
        //         bean.getOne(Wrappers.<AnswerRecordEntity>lambdaQuery().
        //             eq(AnswerRecordEntity::getSubjectOptionId,subjectOptionVO.getId()))
        //         subjectOptionVO.setIds();
        //         subjectOptionVO.setNumbers();
        //     }
        // }
        for (SubjectChoicesVO subjectChoicesVO : subjectChoicesVOS) {
            List<SubjectOptionVO> subjectOptionList = subjectChoicesVO.getSubjectOptionList();
            for (SubjectOptionVO subjectOptionVO : subjectOptionList) {
                AnswerRecordEntity one = bean.getOne(Wrappers.<AnswerRecordEntity>lambdaQuery().
                    eq(AnswerRecordEntity::getAnswerOption, subjectOptionVO.getId())
                    .eq(AnswerRecordEntity::getPropertyId,subjectChoices.getPropertyId()));
                if (one == null) {
                    continue;
                }
                if (one.getSubjectChoicesType().equals(3)) {
                    subjectOptionVO.setNumbers(one.getAnswer());
                } else {
                    subjectChoicesVO.setChooseId(one.getAnswerOption());
                    break;
                }
            }
        }
        return page.setRecords(subjectChoicesVOS);
    }
src/main/java/org/springblade/modules/subjectChoices/vo/SubjectChoicesVO.java
@@ -36,6 +36,8 @@
    private Long propertyId;
    private Long chooseId;
//    private List<SubjectOptionEntity> subjectOptionList;
    private List<SubjectOptionVO> subjectOptionList;