From f675b125138b91600402147e3417c5b68d02295e Mon Sep 17 00:00:00 2001 From: weizhiqiang <> Date: Tue, 28 Jun 2022 17:50:12 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E9=97=AE=E5=8D=B7=E3=80=91=E5=8E=BB?= =?UTF-8?q?=E9=99=A4=E9=87=8D=E5=A4=8D=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/skyeye/common/constans/CheckType.java | 46 --- .../com/skyeye/common/constans/Constants.java | 11 - .../com/skyeye/common/constans/QuType.java | 134 -------- .../impl/CompanyDepartmentServiceImpl.java | 6 +- .../service/impl/ScheduleDayServiceImpl.java | 2 - .../impl/DwSurveyDirectoryServiceImpl.java | 314 +++++------------- 6 files changed, 95 insertions(+), 418 deletions(-) delete mode 100644 skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/CheckType.java delete mode 100644 skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/QuType.java diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/CheckType.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/CheckType.java deleted file mode 100644 index 389c5086..00000000 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/CheckType.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye - ******************************************************************************/ - -package com.skyeye.common.constans; - -public enum CheckType { - - NO("无验证", 0), - EMAIL("Email", 1), - STRLEN("字符长度", 2), - UNSTRCN("禁止中文", 3), - STRCN("仅许中文", 4), - NUM("数值", 5), - TELENUM("电话号码", 6), - PHONENUM("手机号码", 7), - DATE("日期", 8), - IDENTCODE("身份证号", 9), - ZIPCODE("邮政编码", 10), - URL("网址", 11), - TELE_PHONE_NUM("电话或手机号", 12); - - private String name; - private int index; - - private CheckType(String name, int index) { - this.name = name; - this.index = index; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } -} diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java index e9a2a116..6fdecd79 100644 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java +++ b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/Constants.java @@ -25,11 +25,6 @@ public class Constants { ".jpg", ".eot", ".svg", ".ttf", ".woff", ".woff2", ".mp4", ".rmvb", ".avi", "3gp", ".html", ".less", ".otf", ".scss", ".ico", "/upload", "/actuator", "/service", "/talkwebsocket", "/phonetalkwebsocket"}; - /** - * 百分号 - */ - public static final String PERCENT_SIGN = "%"; - /** * 中文 */ @@ -66,12 +61,6 @@ public class Constants { return REDIS_CODEMODEL_EXPLAIN_EXEXPLAIN + "_" + type; } - /** - * 可以设置长些,防止读到运行此次系统检查时的cpu占用率,就不准了 - */ - public static final int PERCENT = 100; - public static final int FAULTLENGTH = 10; - // win系统桌面图片列表的redis的key public static final String SYS_WIN_BG_PIC_REDIS_KEY = "sys_win_bg_pic_redis_key"; diff --git a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/QuType.java b/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/QuType.java deleted file mode 100644 index be0c3530..00000000 --- a/skyeye-promote/skyeye-common/src/main/java/com/skyeye/common/constans/QuType.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright 卫志强 QQ:598748873@qq.com Inc. All rights reserved. 开源地址:https://gitee.com/doc_wei01/skyeye - ******************************************************************************/ -package com.skyeye.common.constans; - -public enum QuType { - - YESNO("是非题", "yesno", 0, "", ""), - RADIO("单选题", "radio", 1, "dw_qu_radio", "qu_id"), - CHECKBOX("多选题", "checkbox", 2, "dw_qu_checkbox", "qu_id"), - FILLBLANK("填空题", "fillblank", 3, "", ""), - - MULTIFILLBLANK("多项填空题", "multifillblank", 4, "dw_qu_multi_fillblank", "qu_id"), // 组合填空题 - ANSWER("多行填空题", "answer", 5, "", ""), // 原问答题 - BIGQU("大题", "bigqu", 6, "", ""), - - ENUMQU("枚举题", "enumqu", 7, "", ""), - SCORE("评分题", "score", 8, "dw_qu_score", "qu_id"), - ORDERQU("排序题", "orderby", 9, "dw_qu_orderby", "qu_id"), - PROPORTION("比重题", "proportion", 10, "", ""), - - CHENRADIO("矩阵单选题", "chenradio", 11, "dw_qu_chen_column,dw_qu_chen_row", "qu_id,qu_id"), - CHENFBK("矩阵填空题", "chenfbk", 12, "dw_qu_chen_column,dw_qu_chen_row", "qu_id,qu_id"), - CHENCHECKBOX("矩阵多选题", "chencheckbox", 13, "dw_qu_chen_column,dw_qu_chen_row", "qu_id,qu_id"), - COMPCHENRADIO("复合矩阵单选题", "compchenradio", 14, "", ""), - - UPLOADFILE("文件上传题", "sendfile", 15, "", ""), - PAGETAG("分页标记", "pagetag", 16, "", ""), - PARAGRAPH("段落说明", "paragraph", 17, "", ""), - CHENSCORE("矩阵评分题", "chenscore", 18, "dw_qu_chen_column,dw_qu_chen_row", "qu_id,qu_id"), - - COMPRADIO("复合单选", "compradio", 19, "", ""), - COMPCHECKBOX("复合多选", "compcheckbox", 20, "", ""); - - private String cnName; - private String actionName; - private int index; - private String tableName; - private String questionId; - - QuType(String cnName, String actionName, int index, String tableName, String questionId) { - this.cnName = cnName; - this.actionName = actionName; - this.index = index; - this.tableName = tableName; - this.questionId = questionId; - } - - public String getCnName() { - return cnName; - } - - public void setCnName(String cnName) { - this.cnName = cnName; - } - - public String getActionName() { - return actionName; - } - - public void setActionName(String actionName) { - this.actionName = actionName; - } - - public int getIndex() { - return index; - } - - public void setIndex(int index) { - this.index = index; - } - - public String getTableName() { - return tableName; - } - - public void setTableName(String tableName) { - this.tableName = tableName; - } - - public String getQuestionId() { - return questionId; - } - - public void setQuestionId(String questionId) { - this.questionId = questionId; - } - - public static String getActionName(int index) { - for (QuType q : QuType.values()) { - if (q.getIndex() == index) { - return q.actionName; - } - } - return null; - } - - public static String getCName(int index) { - for (QuType q : QuType.values()) { - if (q.getIndex() == index) { - return q.cnName; - } - } - return null; - } - - public static String getTableName(int index) { - for (QuType q : QuType.values()) { - if (q.getIndex() == index) { - return q.tableName; - } - } - return null; - } - - public static String getQuestionId(int index) { - for (QuType q : QuType.values()) { - if (q.getIndex() == index) { - return q.questionId; - } - } - return null; - } - - public static int getIndex(String actionName) { - for (QuType q : QuType.values()) { - if (q.getActionName().replaceAll("-", "").equals(actionName.toLowerCase())) { - return q.index; - } - } - return -1; - } - -} diff --git a/skyeye-promote/skyeye-organization/src/main/java/com/skyeye/eve/service/impl/CompanyDepartmentServiceImpl.java b/skyeye-promote/skyeye-organization/src/main/java/com/skyeye/eve/service/impl/CompanyDepartmentServiceImpl.java index d6d186db..098decde 100644 --- a/skyeye-promote/skyeye-organization/src/main/java/com/skyeye/eve/service/impl/CompanyDepartmentServiceImpl.java +++ b/skyeye-promote/skyeye-organization/src/main/java/com/skyeye/eve/service/impl/CompanyDepartmentServiceImpl.java @@ -92,9 +92,11 @@ public class CompanyDepartmentServiceImpl implements CompanyDepartmentService { public void deleteCompanyDepartmentMationById(InputObject inputObject, OutputObject outputObject) throws Exception { Map map = inputObject.getParams(); Map bean = companyDepartmentDao.queryCompanyDepartmentUserMationById(map); - if (Integer.parseInt(bean.get("childsNum").toString()) == 0) {//判断是否有员工 + if (Integer.parseInt(bean.get("childsNum").toString()) == 0) { + // 判断是否有员工 bean = companyDepartmentDao.queryCompanyJobNumMationById(map); - if (Integer.parseInt(bean.get("companyJobNum").toString()) == 0) {//判断是否有职位 + if (Integer.parseInt(bean.get("companyJobNum").toString()) == 0) { + // 判断是否有职位 companyDepartmentDao.deleteCompanyDepartmentMationById(map); } else { outputObject.setreturnMessage("该部门下存在职位,无法直接删除。"); diff --git a/skyeye-promote/skyeye-schedule/src/main/java/com/skyeye/eve/service/impl/ScheduleDayServiceImpl.java b/skyeye-promote/skyeye-schedule/src/main/java/com/skyeye/eve/service/impl/ScheduleDayServiceImpl.java index 6b43c375..2b08874c 100644 --- a/skyeye-promote/skyeye-schedule/src/main/java/com/skyeye/eve/service/impl/ScheduleDayServiceImpl.java +++ b/skyeye-promote/skyeye-schedule/src/main/java/com/skyeye/eve/service/impl/ScheduleDayServiceImpl.java @@ -223,8 +223,6 @@ public class ScheduleDayServiceImpl implements ScheduleDayService { @Transactional(value = "transactionManager") public void deleteScheduleDayMationById(InputObject inputObject, OutputObject outputObject) throws Exception { Map map = inputObject.getParams(); - // 删除缓存中的日程信息 - Map user = inputObject.getLogParams(); // 删除日程信息 scheduleDayDao.deleteScheduleDayMationById(map); // 删除定时任务 diff --git a/skyeye-promote/skyeye-survey/src/main/java/com/skyeye/eve/service/impl/DwSurveyDirectoryServiceImpl.java b/skyeye-promote/skyeye-survey/src/main/java/com/skyeye/eve/service/impl/DwSurveyDirectoryServiceImpl.java index f3d7dd43..226468f9 100644 --- a/skyeye-promote/skyeye-survey/src/main/java/com/skyeye/eve/service/impl/DwSurveyDirectoryServiceImpl.java +++ b/skyeye-promote/skyeye-survey/src/main/java/com/skyeye/eve/service/impl/DwSurveyDirectoryServiceImpl.java @@ -7,19 +7,20 @@ package com.skyeye.eve.service.impl; import cn.hutool.json.JSONUtil; import com.github.pagehelper.Page; import com.github.pagehelper.PageHelper; -import com.skyeye.common.constans.CheckType; -import com.skyeye.common.constans.QuType; import com.skyeye.common.constans.QuartzConstants; import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; import com.skyeye.common.object.PutObject; -import com.skyeye.common.util.DataCommonUtil; import com.skyeye.common.util.DateUtil; import com.skyeye.common.util.IPSeeker; import com.skyeye.common.util.ToolUtil; +import com.skyeye.common.util.question.CheckType; +import com.skyeye.common.util.question.QuType; +import com.skyeye.common.util.question.QuestionUtil; import com.skyeye.eve.dao.DwSurveyDirectoryDao; import com.skyeye.eve.service.DwSurveyDirectoryService; import com.skyeye.quartz.config.QuartzService; +import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -250,45 +251,17 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService { * @throws Exception */ public List> setLogics(String quId, String logicStr, String userId) throws Exception { - //设置问题逻辑 - List> array = JSONUtil.toList(logicStr, null); - //返回前台的逻辑对象 - List> quLogics = new ArrayList<>(); - if (array.size() > 0) { - List> editquLogics = new ArrayList<>(); - for (int i = 0; i < array.size(); i++) { - Map object = array.get(i); - Map bean = new HashMap<>(); - bean.put("cgQuItemId", object.get("cgQuItemId")); - bean.put("skQuId", object.get("skQuId")); - bean.put("logicType", object.get("logicType")); - bean.put("title", object.get("key")); - if (object.containsKey("geLe")) { - bean.put("geLe", object.get("geLe")); - } - if (object.containsKey("scoreNum")) { - bean.put("scoreNum", object.get("scoreNum")); - } - if (ToolUtil.isBlank(object.get("quLogicId").toString())) { - bean.put("ckQuId", quId); - bean.put("visibility", object.get("visibility")); - DataCommonUtil.setCommonData(bean, userId); - quLogics.add(bean); - } else { - bean.put("id", object.get("quLogicId")); - editquLogics.add(bean); - } - } - if (!quLogics.isEmpty()) { - dwSurveyDirectoryDao.addQuestionLogicsMationList(quLogics); - } - if (!editquLogics.isEmpty()) { - dwSurveyDirectoryDao.editQuestionLogicsMationList(editquLogics); - } - quLogics.addAll(editquLogics); - return quLogics; + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); + QuestionUtil.setLogics(quId, logicStr, userId, insertList, editList); + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionLogicsMationList(insertList); } - return quLogics; + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionLogicsMationList(editList); + } + insertList.addAll(editList); + return insertList; } /** @@ -331,37 +304,24 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService { public void addQuScoreMation(InputObject inputObject, OutputObject outputObject) throws Exception { Map map = inputObject.getParams(); map.put("quType", QuType.SCORE.getIndex()); - //添加问题并返回问题id + // 添加问题并返回问题id String quId = compileQuestion(map); - List> score = JSONUtil.toList(map.get("scoreTd").toString(), null);//获取模板绑定信息 + // 获取模板绑定信息 + List> score = JSONUtil.toList(map.get("scoreTd").toString(), null); if (score.size() > 0) { - List> quScore = new ArrayList<>(); - List> editquScore = new ArrayList<>(); + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); String userId = inputObject.getLogParams().get("id").toString(); - for (int i = 0; i < score.size(); i++) { - Map object = score.get(i); - Map bean = new HashMap<>(); - bean.put("orderById", object.get("key")); - bean.put("optionName", object.get("optionValue")); - if (ToolUtil.isBlank(object.get("optionId").toString())) { - bean.put("quId", quId); - bean.put("visibility", 1); - DataCommonUtil.setCommonData(bean, userId); - quScore.add(bean); - } else { - bean.put("id", object.get("optionId")); - editquScore.add(bean); - } + QuestionUtil.setQuestionOptionMation(quId, score, insertList, editList, userId, -1); + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionScoreMationList(insertList); } - if (!quScore.isEmpty()) { - dwSurveyDirectoryDao.addQuestionScoreMationList(quScore); + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionScoreMationList(editList); } - if (!editquScore.isEmpty()) { - dwSurveyDirectoryDao.editQuestionScoreMationList(editquScore); - } - quScore.addAll(editquScore); - map.put("quItems", quScore); + insertList.addAll(editList); + map.put("quItems", insertList); } //设置问题逻辑 @@ -386,32 +346,19 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService { List> orderqu = JSONUtil.toList(map.get("orderquTd").toString(), null);//获取模板绑定信息 if (orderqu.size() > 0) { - List> quOrderqu = new ArrayList<>(); - List> editquOrderqu = new ArrayList<>(); + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); String userId = inputObject.getLogParams().get("id").toString(); - for (int i = 0; i < orderqu.size(); i++) { - Map object = orderqu.get(i); - Map bean = new HashMap<>(); - bean.put("orderById", object.get("key")); - bean.put("optionName", object.get("optionValue")); - if (ToolUtil.isBlank(object.get("optionId").toString())) { - bean.put("quId", quId); - bean.put("visibility", 1); - DataCommonUtil.setCommonData(bean, userId); - quOrderqu.add(bean); - } else { - bean.put("id", object.get("optionId")); - editquOrderqu.add(bean); - } + QuestionUtil.setQuestionOptionMation(quId, orderqu, insertList, editList, userId, -1); + + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionOrderquMationList(insertList); } - if (!quOrderqu.isEmpty()) { - dwSurveyDirectoryDao.addQuestionOrderquMationList(quOrderqu); + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionOrderquMationList(editList); } - if (!editquOrderqu.isEmpty()) { - dwSurveyDirectoryDao.editQuestionOrderquMationList(editquOrderqu); - } - quOrderqu.addAll(editquOrderqu); - map.put("quItems", quOrderqu); + insertList.addAll(editList); + map.put("quItems", insertList); } //设置问题逻辑 @@ -455,40 +402,20 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService { String quId = compileQuestion(map); List> radio = JSONUtil.toList(map.get("radioTd").toString(), null);//获取模板绑定信息 - if (radio.size() > 0) { - List> quRadio = new ArrayList<>(); - List> editquRadio = new ArrayList<>(); + if (CollectionUtils.isNotEmpty(radio)) { + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); String userId = inputObject.getLogParams().get("id").toString(); - for (int i = 0; i < radio.size(); i++) { - Map object = radio.get(i); - Map bean = new HashMap<>(); - bean.put("orderById", object.get("key")); - bean.put("optionName", object.get("optionValue")); - bean.put("isNote", object.get("isNote")); - if (!ToolUtil.isNumeric(object.get("checkType").toString())) { - bean.put("checkType", CheckType.valueOf(object.get("checkType").toString()).getIndex()); - } else { - bean.put("checkType", object.get("checkType").toString()); - } - bean.put("isRequiredFill", object.get("isRequiredFill")); - if (ToolUtil.isBlank(object.get("optionId").toString())) { - bean.put("quId", quId); - bean.put("visibility", 1); - DataCommonUtil.setCommonData(bean, userId); - quRadio.add(bean); - } else { - bean.put("id", object.get("optionId")); - editquRadio.add(bean); - } + QuestionUtil.setQuestionOptionMation(quId, radio, insertList, editList, userId, QuType.RADIO.getIndex()); + + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionRadioMationList(insertList); } - if (!quRadio.isEmpty()) { - dwSurveyDirectoryDao.addQuestionRadioMationList(quRadio); + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionRadioMationList(editList); } - if (!editquRadio.isEmpty()) { - dwSurveyDirectoryDao.editQuestionRadioMationList(editquRadio); - } - quRadio.addAll(editquRadio); - map.put("quItems", quRadio); + insertList.addAll(editList); + map.put("quItems", insertList); } //设置问题逻辑 @@ -508,47 +435,27 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService { public void addQuCheckBoxMation(InputObject inputObject, OutputObject outputObject) throws Exception { Map map = inputObject.getParams(); map.put("quType", QuType.CHECKBOX.getIndex()); - //添加问题并返回问题id + // 添加问题并返回问题id String quId = compileQuestion(map); List> checkbox = JSONUtil.toList(map.get("checkboxTd").toString(), null);//获取模板绑定信息 if (checkbox.size() > 0) { - List> quCheckbox = new ArrayList<>(); - List> editquCheckbox = new ArrayList<>(); + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); String userId = inputObject.getLogParams().get("id").toString(); - for (int i = 0; i < checkbox.size(); i++) { - Map object = checkbox.get(i); - Map bean = new HashMap<>(); - bean.put("orderById", object.get("key")); - bean.put("optionName", object.get("optionValue")); - bean.put("isNote", object.get("isNote")); - if (!ToolUtil.isNumeric(object.get("checkType").toString())) { - bean.put("checkType", CheckType.valueOf(object.get("checkType").toString()).getIndex()); - } else { - bean.put("checkType", object.get("checkType").toString()); - } - bean.put("isRequiredFill", object.get("isRequiredFill")); - if (ToolUtil.isBlank(object.get("optionId").toString())) { - bean.put("quId", quId); - bean.put("visibility", 1); - DataCommonUtil.setCommonData(bean, userId); - quCheckbox.add(bean); - } else { - bean.put("id", object.get("optionId")); - editquCheckbox.add(bean); - } + QuestionUtil.setQuestionOptionMation(quId, checkbox, insertList, editList, userId, QuType.CHECKBOX.getIndex()); + + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionCheckBoxMationList(insertList); } - if (!quCheckbox.isEmpty()) { - dwSurveyDirectoryDao.addQuestionCheckBoxMationList(quCheckbox); + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionCheckBoxMationList(editList); } - if (!editquCheckbox.isEmpty()) { - dwSurveyDirectoryDao.editQuestionCheckBoxMationList(editquCheckbox); - } - quCheckbox.addAll(editquCheckbox); - map.put("quItems", quCheckbox); + insertList.addAll(editList); + map.put("quItems", insertList); } - //设置问题逻辑 + // 设置问题逻辑 map.put("quLogics", setLogics(quId, map.get("logic").toString(), inputObject.getLogParams().get("id").toString())); outputObject.setBean(map); } @@ -570,32 +477,19 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService { List> multiFillblank = JSONUtil.toList(map.get("multiFillblankTd").toString(), null);//获取模板绑定信息 if (multiFillblank.size() > 0) { - List> quMultiFillblank = new ArrayList<>(); - List> editquMultiFillblank = new ArrayList<>(); + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); String userId = inputObject.getLogParams().get("id").toString(); - for (int i = 0; i < multiFillblank.size(); i++) { - Map object = multiFillblank.get(i); - Map bean = new HashMap<>(); - bean.put("orderById", object.get("key")); - bean.put("optionName", object.get("optionValue")); - if (ToolUtil.isBlank(object.get("optionId").toString())) { - bean.put("quId", quId); - bean.put("visibility", 1); - DataCommonUtil.setCommonData(bean, userId); - quMultiFillblank.add(bean); - } else { - bean.put("id", object.get("optionId")); - editquMultiFillblank.add(bean); - } + QuestionUtil.setQuestionOptionMation(quId, multiFillblank, insertList, editList, userId, -1); + + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionMultiFillblankMationList(insertList); } - if (!quMultiFillblank.isEmpty()) { - dwSurveyDirectoryDao.addQuestionMultiFillblankMationList(quMultiFillblank); + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionMultiFillblankMationList(editList); } - if (!editquMultiFillblank.isEmpty()) { - dwSurveyDirectoryDao.editQuestionMultiFillblankMationList(editquMultiFillblank); - } - quMultiFillblank.addAll(editquMultiFillblank); - map.put("quItems", quMultiFillblank); + insertList.addAll(editList); + map.put("quItems", insertList); } //设置问题逻辑 @@ -646,64 +540,38 @@ public class DwSurveyDirectoryServiceImpl implements DwSurveyDirectoryService { String quId = compileQuestion(map); List> column = JSONUtil.toList(map.get("column").toString(), null);//获取模板绑定信息 if (column.size() > 0) { - List> quColumn = new ArrayList<>(); - List> editquColumn = new ArrayList<>(); - for (int i = 0; i < column.size(); i++) { - Map object = column.get(i); - Map bean = new HashMap<>(); - bean.put("orderById", object.get("key")); - bean.put("optionName", object.get("optionValue")); - if (ToolUtil.isBlank(object.get("optionId").toString())) { - bean.put("quId", quId); - bean.put("visibility", 1); - DataCommonUtil.setCommonData(bean, userId); - quColumn.add(bean); - } else { - bean.put("id", object.get("optionId")); - editquColumn.add(bean); - } + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); + QuestionUtil.setQuestionOptionMation(quId, column, insertList, editList, userId, -1); + + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionColumnMationList(insertList); } - if (!quColumn.isEmpty()) { - dwSurveyDirectoryDao.addQuestionColumnMationList(quColumn); + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionColumnMationList(editList); } - if (!editquColumn.isEmpty()) { - dwSurveyDirectoryDao.editQuestionColumnMationList(editquColumn); - } - quColumn.addAll(editquColumn); - map.put("quColumnItems", quColumn); + insertList.addAll(editList); + map.put("quColumnItems", insertList); } List> row = JSONUtil.toList(map.get("row").toString(), null);//获取模板绑定信息 if (row.size() > 0) { - List> quRow = new ArrayList<>(); - List> editquRow = new ArrayList<>(); - for (int i = 0; i < row.size(); i++) { - Map object = row.get(i); - Map bean = new HashMap<>(); - bean.put("orderById", object.get("key")); - bean.put("optionName", object.get("optionValue")); - if (ToolUtil.isBlank(object.get("optionId").toString())) { - bean.put("quId", quId); - bean.put("visibility", 1); - DataCommonUtil.setCommonData(bean, userId); - quRow.add(bean); - } else { - bean.put("id", object.get("optionId")); - editquRow.add(bean); - } + List> insertList = new ArrayList<>(); + List> editList = new ArrayList<>(); + QuestionUtil.setQuestionOptionMation(quId, row, insertList, editList, userId, -1); + + if (!insertList.isEmpty()) { + dwSurveyDirectoryDao.addQuestionRowMationList(insertList); } - if (!quRow.isEmpty()) { - dwSurveyDirectoryDao.addQuestionRowMationList(quRow); + if (!editList.isEmpty()) { + dwSurveyDirectoryDao.editQuestionRowMationList(editList); } - if (!editquRow.isEmpty()) { - dwSurveyDirectoryDao.editQuestionRowMationList(editquRow); - } - quRow.addAll(editquRow); - map.put("quRowItems", quRow); + insertList.addAll(editList); + map.put("quRowItems", insertList); } - //设置问题逻辑 - map.put("quLogics", setLogics(quId, map.get("logic").toString(), inputObject.getLogParams().get("id").toString())); + // 设置问题逻辑 + map.put("quLogics", setLogics(quId, map.get("logic").toString(), userId)); outputObject.setBean(map); }