|
@@ -44,10 +44,7 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
|
|
|
@Autowired
|
|
|
@Qualifier("questionInfoServiceImpl")
|
|
|
private QuestionInfoService questionInfoService;
|
|
|
- @Autowired
|
|
|
- private ModuleDiseaseMappingFacade moduleDiseaseMappingFacade;
|
|
|
- @Autowired
|
|
|
- private ModuleDeptMappingFacade moduleDeptMappingFacade;
|
|
|
+
|
|
|
/**
|
|
|
* 根据questionId删除明细
|
|
|
*
|
|
@@ -75,21 +72,21 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
|
|
|
* @param addModuleInfoVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public Boolean saveOrUpdateInfos(AddModuleInfoVO addModuleInfoVO,Long moduleId){
|
|
|
+ public Boolean saveOrUpdateInfos(AddModuleInfoVO addModuleInfoVO, Long moduleId) {
|
|
|
String userId = UserUtils.getCurrentPrincipleID();
|
|
|
Date now = DateUtil.now();
|
|
|
//如果该模板添加过明细,先删除
|
|
|
UpdateWrapper<ModuleDetail> moduleDetailUpdateWrapper = new UpdateWrapper<>();
|
|
|
moduleDetailUpdateWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .eq("module_id",moduleId)
|
|
|
- .set("is_deleted",IsDeleteEnum.Y.getKey())
|
|
|
- .set("modifier",userId)
|
|
|
- .set("gmt_modified",now);
|
|
|
- this.update(new ModuleDetail(),moduleDetailUpdateWrapper);
|
|
|
+ .eq("module_id", moduleId)
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .set("modifier", userId)
|
|
|
+ .set("gmt_modified", now);
|
|
|
+ this.update(new ModuleDetail(), moduleDetailUpdateWrapper);
|
|
|
//查询自定义标签的id
|
|
|
List<String> textList = new ArrayList<>();
|
|
|
- for(AddModuleDetailVO addModuleDetailVO:addModuleInfoVO.getModelDetils()){
|
|
|
- if(StringUtil.isNotEmpty(addModuleDetailVO.getText())){
|
|
|
+ for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
|
|
|
+ if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
|
|
|
textList.add(addModuleDetailVO.getText());
|
|
|
}
|
|
|
}
|
|
@@ -97,23 +94,23 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
|
|
|
questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
.eq("tag_type", TagTypeEnum.T8.getKey())
|
|
|
.eq("type", addModuleInfoVO.getTextType())
|
|
|
- .in("name",textList);
|
|
|
+ .in("name", textList);
|
|
|
List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
//将标签id放入map
|
|
|
- Map<String,Long> questionIdMap = new HashMap<>();
|
|
|
- for (AddModuleDetailVO addModuleDetailVO: addModuleInfoVO.getModelDetils()) {
|
|
|
- if(StringUtil.isNotEmpty(addModuleDetailVO.getText())){
|
|
|
- questionIdMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getTagName,questionInfo -> questionInfo.getId()));
|
|
|
+ Map<String, Long> questionIdMap = new HashMap<>();
|
|
|
+ for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
|
|
|
+ if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
|
|
|
+ questionIdMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getTagName, questionInfo -> questionInfo.getId()));
|
|
|
}
|
|
|
}
|
|
|
QuestionInfo addquestionInfo = null;
|
|
|
List<QuestionInfo> addQuestionInfoList = new ArrayList<>();
|
|
|
List<String> textExistList = new ArrayList<>();
|
|
|
//循环给questionId赋值,如果遇到赋值失败的则是没有questionID,执行添加
|
|
|
- for (AddModuleDetailVO addModuleDetailVO:addModuleInfoVO.getModelDetils()) {
|
|
|
- if (StringUtil.isNotEmpty(addModuleDetailVO.getText())){
|
|
|
+ for (AddModuleDetailVO addModuleDetailVO : addModuleInfoVO.getModelDetils()) {
|
|
|
+ if (StringUtil.isNotEmpty(addModuleDetailVO.getText())) {
|
|
|
addModuleDetailVO.setQuestionId(questionIdMap.get(addModuleDetailVO.getText()));
|
|
|
- if(addModuleDetailVO.getQuestionId() == null && addModuleDetailVO.getText() != null){
|
|
|
+ if (addModuleDetailVO.getQuestionId() == null && addModuleDetailVO.getText() != null) {
|
|
|
addquestionInfo = new QuestionInfo();
|
|
|
addquestionInfo.setModifier(userId);
|
|
|
addquestionInfo.setCreator(userId);
|
|
@@ -125,7 +122,7 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
|
|
|
addquestionInfo.setType(addModuleInfoVO.getTextType());
|
|
|
addquestionInfo.setSubType(1);
|
|
|
addquestionInfo.setName(addModuleDetailVO.getText());
|
|
|
- if(!textExistList.contains(addModuleDetailVO.getText())){
|
|
|
+ if (!textExistList.contains(addModuleDetailVO.getText())) {
|
|
|
textExistList.add(addModuleDetailVO.getText());
|
|
|
addQuestionInfoList.add(addquestionInfo);
|
|
|
}
|
|
@@ -139,40 +136,40 @@ public class ModuleDetailFacade extends ModuleDetailServiceImpl {
|
|
|
.eq("type", addModuleInfoVO.getTextType())
|
|
|
.eq("tag_type", TagTypeEnum.T8.getKey());
|
|
|
List<QuestionInfo> questionInfoList1 = questionFacade.list(questionInfoQueryWrapper1);
|
|
|
- if(ListUtil.isNotEmpty(questionInfoList1)){
|
|
|
- for (QuestionInfo questionInfo:questionInfoList1) {
|
|
|
- if(StringUtil.isNotEmpty(questionInfo.getTagName())){
|
|
|
- questionIdMap.put(questionInfo.getTagName(),questionInfo.getId());
|
|
|
+ if (ListUtil.isNotEmpty(questionInfoList1)) {
|
|
|
+ for (QuestionInfo questionInfo : questionInfoList1) {
|
|
|
+ if (StringUtil.isNotEmpty(questionInfo.getTagName())) {
|
|
|
+ questionIdMap.put(questionInfo.getTagName(), questionInfo.getId());
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
//二次赋值保证每一个questionId都有值
|
|
|
ModuleDetail moduleDetail = null;
|
|
|
List<ModuleDetail> moduleDetailList = new ArrayList<>();
|
|
|
- for(int i = 0; i < addModuleInfoVO.getModelDetils().size(); i++){
|
|
|
+ for (int i = 0; i < addModuleInfoVO.getModelDetils().size(); i++) {
|
|
|
moduleDetail = new ModuleDetail();
|
|
|
moduleDetail.setModuleId(moduleId);
|
|
|
moduleDetail.setCreator(userId);
|
|
|
moduleDetail.setModifier(userId);
|
|
|
moduleDetail.setGmtCreate(now);
|
|
|
moduleDetail.setGmtModified(now);
|
|
|
- moduleDetail.setOrderNo(i+1);
|
|
|
- if(addModuleInfoVO.getModelDetils().get(i).getRelationModule() != null){
|
|
|
+ moduleDetail.setOrderNo(i + 1);
|
|
|
+ if (addModuleInfoVO.getModelDetils().get(i).getRelationModule() != null) {
|
|
|
moduleDetail.setRelationModule(addModuleInfoVO.getModelDetils().get(i).getRelationModule());
|
|
|
}
|
|
|
- if (StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getText())){
|
|
|
+ if (StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getText())) {
|
|
|
moduleDetail.setQuestionId(questionIdMap.get(addModuleInfoVO.getModelDetils().get(i).getText()));
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
moduleDetail.setQuestionId(addModuleInfoVO.getModelDetils().get(i).getQuestionId());
|
|
|
}
|
|
|
- if(StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getFlag())){
|
|
|
+ if (StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getFlag())) {
|
|
|
moduleDetail.setFlag(addModuleInfoVO.getModelDetils().get(i).getFlag());
|
|
|
}
|
|
|
//判断是否是有效数据
|
|
|
- if(addModuleInfoVO.getModelDetils().get(i).getRelationModule() != null
|
|
|
- || StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getText())
|
|
|
- || StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getFlag())
|
|
|
- || addModuleInfoVO.getModelDetils().get(i).getQuestionId() != null ){
|
|
|
+ if (addModuleInfoVO.getModelDetils().get(i).getRelationModule() != null
|
|
|
+ || StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getText())
|
|
|
+ || StringUtil.isNotEmpty(addModuleInfoVO.getModelDetils().get(i).getFlag())
|
|
|
+ || addModuleInfoVO.getModelDetils().get(i).getQuestionId() != null) {
|
|
|
moduleDetailList.add(moduleDetail);
|
|
|
}
|
|
|
}
|