Browse Source

添加问题类型字段

tags/v1.2.0^2
chengwang 1 year ago
parent
commit
6a3661a9b8
3 changed files with 32 additions and 6 deletions
  1. +5
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/QuestionType.java
  2. +22
    -6
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java
  3. +5
    -0
      tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/QuestionType.java

+ 5
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/QuestionType.java View File

@@ -42,4 +42,9 @@ public class QuestionType extends BaseEntity {
* 事故问题:0:否;1:是
*/
private Integer accidentQuestion;

/**
* 是否展示问题 0:否;1是
*/
private Integer isShow;
}

+ 22
- 6
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/third/dsp/DspCallbackServiceImpl.java View File

@@ -18,6 +18,7 @@ import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.exception.ServiceException;
import com.tuoheng.common.core.utils.*;
import lombok.extern.slf4j.Slf4j;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
@@ -263,6 +264,12 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
inspectionFile.setGaodeAddress(gaodeAddress_live);
}
}

Map<String, QuestionType> questionTypeMap = getStringQuestionTypeMap();
QuestionType questionType = questionTypeMap.get(inspectionFile.getQuestionCode());
if(0 == questionType.getIsShow()){
inspectionFile.setMark(MarkEnum.NOTVALID.getCode());
}
return inspectionFile;
}).collect(Collectors.toList());

@@ -289,12 +296,7 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
private Boolean saveAccidentData(List<InspectionFile> inspectionFileList) {
log.info("调用保存应急数据方法,应急数据入库开始....");
List<Accident> accidentList = new ArrayList<>();
List<QuestionType> questionTypeList = questionTypeMapper.selectList(Wrappers.<QuestionType>lambdaQuery()
.eq(QuestionType::getMark, MarkEnum.VALID.getCode()));
Map<String, QuestionType> questionTypeMap = new HashMap<>();
for (QuestionType type : questionTypeList) {
questionTypeMap.put(type.getCode(), type);
}
Map<String, QuestionType> questionTypeMap = getStringQuestionTypeMap();
for (InspectionFile inspectionFile : inspectionFileList) {
QuestionType questionType = questionTypeMap.get(inspectionFile.getQuestionCode());
if (0 == questionType.getAccidentQuestion()) {
@@ -355,6 +357,20 @@ public class DspCallbackServiceImpl implements IDspCallbackService {
return accidentService.saveBatch(accidentList);
}

/**
* 根据问题类型封装成map
* @return
*/
private Map<String, QuestionType> getStringQuestionTypeMap() {
List<QuestionType> questionTypeList = questionTypeMapper.selectList(Wrappers.<QuestionType>lambdaQuery()
.eq(QuestionType::getMark, MarkEnum.VALID.getCode()));
Map<String, QuestionType> questionTypeMap = new HashMap<>();
for (QuestionType type : questionTypeList) {
questionTypeMap.put(type.getCode(), type);
}
return questionTypeMap;
}

/**
* 获取飞行坐标
*

+ 5
- 0
tuoheng-service/tuoheng-miniprogram/src/main/java/com/tuoheng/miniprogram/entity/QuestionType.java View File

@@ -44,4 +44,9 @@ public class QuestionType extends BaseEntity {
*/
private Integer accidentQuestion;

/**
* 是否展示问题 0:否;1是
*/
private Integer isShow;

}

Loading…
Cancel
Save