use of com.bc.pmpheep.back.po.SurveyQuestion in project pmph by BCSquad.
the class MigrationPlus method survey.
protected void survey() {
SurveyType surveyType = new SurveyType("学生", 1);
surveyTypeService.addSurveyType(surveyType);
SurveyType surveyType2 = new SurveyType("教师", 2);
surveyTypeService.addSurveyType(surveyType2);
SurveyType surveyType3 = new SurveyType("医生", 3);
surveyTypeService.addSurveyType(surveyType3);
// 查询武震的new_pk
String sql = "select * from sys_user where userid = '1496375695709123-789241'";
List<Map<String, Object>> maps = JdbcHelper.getJdbcTemplate().queryForList(sql);
Map<String, Object> map = maps.get(0);
Long id = (Long) map.get("new_pk");
SurveyTemplate surveyTemplate = new SurveyTemplate("人卫e教平台满意度问卷模板", 999, id, "该问卷只针对教师", surveyType2.getId(), false);
surveyTemplateService.addSurveyTemplate(surveyTemplate);
Survey survey = new Survey("人卫e教平台满意度问卷模板", "希望您能抽出几分钟时间,将您的感受和建议告诉我们,我们非常重视每位教师的宝贵意见,期待您的参与!", "该问卷只针对教师", surveyTemplate.getId(), surveyType2.getId(), id, null, null, 999, (short) 0);
surveyService.addSurvey(survey);
SurveyQuestion surveyQuestion = new SurveyQuestion(0L, "您是否使用过人卫e教平台网站?", (short) 1, 1, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion);
SurveyQuestionOption surveyQuestionOption = new SurveyQuestionOption(surveyQuestion.getId(), "是", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption);
SurveyQuestionOption surveyQuestionOption2 = new SurveyQuestionOption(surveyQuestion.getId(), "否", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption2);
SurveyQuestion surveyQuestion2 = new SurveyQuestion(0L, "您使用人卫e教平台网站的目的是?", (short) 2, 2, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion2);
SurveyQuestionOption surveyQuestionOption3 = new SurveyQuestionOption(surveyQuestion2.getId(), "工作需要", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption3);
SurveyQuestionOption surveyQuestionOption4 = new SurveyQuestionOption(surveyQuestion2.getId(), "获取生活信息,扩展视野受", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption4);
SurveyQuestionOption surveyQuestionOption5 = new SurveyQuestionOption(surveyQuestion2.getId(), "关注名人动态", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption5);
SurveyQuestionOption surveyQuestionOption6 = new SurveyQuestionOption(surveyQuestion2.getId(), "寻找知趣相投的群体", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption6);
SurveyQuestionOption surveyQuestionOption7 = new SurveyQuestionOption(surveyQuestion2.getId(), "展现自己多彩的生活", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption7);
SurveyQuestionOption surveyQuestionOption8 = new SurveyQuestionOption(surveyQuestion2.getId(), "其他", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption8);
SurveyQuestion surveyQuestion3 = new SurveyQuestion(0L, "您在人卫e教平台网站上主要做什么?", (short) 2, 3, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion3);
SurveyQuestionOption surveyQuestionOption9 = new SurveyQuestionOption(surveyQuestion3.getId(), "教材申报", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption9);
SurveyQuestionOption surveyQuestionOption10 = new SurveyQuestionOption(surveyQuestion3.getId(), "查看图书", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption10);
SurveyQuestionOption surveyQuestionOption11 = new SurveyQuestionOption(surveyQuestion3.getId(), "图书纠错", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption11);
SurveyQuestionOption surveyQuestionOption12 = new SurveyQuestionOption(surveyQuestion3.getId(), "选题申报", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption12);
SurveyQuestionOption surveyQuestionOption13 = new SurveyQuestionOption(surveyQuestion3.getId(), "评论图书", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption13);
SurveyQuestionOption surveyQuestionOption14 = new SurveyQuestionOption(surveyQuestion3.getId(), "其他", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption14);
SurveyQuestion surveyQuestion4 = new SurveyQuestion(0L, "您使用人卫e教平台网站的频率是?", (short) 1, 4, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion4);
SurveyQuestionOption surveyQuestionOption15 = new SurveyQuestionOption(surveyQuestion4.getId(), "几乎每天都会使用", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption15);
SurveyQuestionOption surveyQuestionOption16 = new SurveyQuestionOption(surveyQuestion4.getId(), "每个星期都会使用", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption16);
SurveyQuestionOption surveyQuestionOption17 = new SurveyQuestionOption(surveyQuestion4.getId(), "每个月都会使用", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption17);
SurveyQuestionOption surveyQuestionOption18 = new SurveyQuestionOption(surveyQuestion4.getId(), "很少使用", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption18);
SurveyQuestion surveyQuestion5 = new SurveyQuestion(0L, "到目前为止,您使用人卫e教平台网站有多久了?", (short) 1, 5, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion5);
SurveyQuestionOption surveyQuestionOption19 = new SurveyQuestionOption(surveyQuestion5.getId(), "不到1个月", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption19);
SurveyQuestionOption surveyQuestionOption20 = new SurveyQuestionOption(surveyQuestion5.getId(), "1-3个月(含3个月)", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption20);
SurveyQuestionOption surveyQuestionOption21 = new SurveyQuestionOption(surveyQuestion5.getId(), "3-6个月(含6个月)", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption21);
SurveyQuestionOption surveyQuestionOption22 = new SurveyQuestionOption(surveyQuestion5.getId(), "6-12个月(含12个月)", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption22);
SurveyQuestionOption surveyQuestionOption23 = new SurveyQuestionOption(surveyQuestion5.getId(), "1-2年(含2年)", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption23);
SurveyQuestionOption surveyQuestionOption24 = new SurveyQuestionOption(surveyQuestion5.getId(), "2年以上", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption24);
SurveyQuestion surveyQuestion6 = new SurveyQuestion(0L, "您的性别是", (short) 1, 6, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion6);
SurveyQuestionOption surveyQuestionOption25 = new SurveyQuestionOption(surveyQuestion6.getId(), "男", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption25);
SurveyQuestionOption surveyQuestionOption26 = new SurveyQuestionOption(surveyQuestion6.getId(), "女", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption26);
SurveyQuestion surveyQuestion7 = new SurveyQuestion(0L, "您的学历是", (short) 1, 7, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion7);
SurveyQuestionOption surveyQuestionOption27 = new SurveyQuestionOption(surveyQuestion7.getId(), "本科", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption27);
SurveyQuestionOption surveyQuestionOption28 = new SurveyQuestionOption(surveyQuestion7.getId(), "硕士及以上", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption28);
SurveyQuestion surveyQuestion8 = new SurveyQuestion(0L, "您对人卫e教平台网站的发展还有哪些期待", (short) 5, 8, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion8);
SurveyQuestionOption surveyQuestionOption29 = new SurveyQuestionOption(surveyQuestion8.getId(), "期待", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption29);
SurveyQuestion surveyQuestion9 = new SurveyQuestion(0L, "您对人卫e教平台网站的发展还有哪些建议", (short) 5, 9, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion9);
SurveyQuestionOption surveyQuestionOption30 = new SurveyQuestionOption(surveyQuestion9.getId(), "建议", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption30);
SurveyQuestion surveyQuestion10 = new SurveyQuestion(0L, "您对人卫e教平台网站的态度是", (short) 4, 10, null, true);
surveyQuestionService.addSurveyQuestion(surveyQuestion10);
SurveyQuestionOption surveyQuestionOption31 = new SurveyQuestionOption(surveyQuestion10.getId(), "态度", false, null);
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption31);
SurveyTemplateQuestion surveyTemplateQuestion = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion);
SurveyTemplateQuestion surveyTemplateQuestion2 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion2.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion2);
SurveyTemplateQuestion surveyTemplateQuestion3 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion3.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion3);
SurveyTemplateQuestion surveyTemplateQuestion4 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion4.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion4);
SurveyTemplateQuestion surveyTemplateQuestion5 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion5.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion5);
SurveyTemplateQuestion surveyTemplateQuestion6 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion6.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion6);
SurveyTemplateQuestion surveyTemplateQuestion7 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion7.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion7);
SurveyTemplateQuestion surveyTemplateQuestion8 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion8.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion8);
SurveyTemplateQuestion surveyTemplateQuestion9 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion9.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion9);
SurveyTemplateQuestion surveyTemplateQuestion10 = new SurveyTemplateQuestion(surveyTemplate.getId(), surveyQuestion10.getId());
surveyTemplateQuestionService.addSurveyTemplateQuestion(surveyTemplateQuestion10);
}
use of com.bc.pmpheep.back.po.SurveyQuestion in project pmph by BCSquad.
the class SurveyServiceImpl method addQuestionAndOption.
/**
* <pre>
* 功能描述:添加问题及问题选项
* 使用示范:
*
* @param surveyQuestionListVO
* @return
* </pre>
*/
private List<Long> addQuestionAndOption(List<SurveyQuestionListVO> surveyQuestionListVO) {
List<Long> questionIds = new ArrayList<Long>(surveyQuestionListVO.size());
for (SurveyQuestionListVO surveyQuestionLists : surveyQuestionListVO) {
// 遍历获取问题的集合
SurveyQuestion surveyQuestion = new SurveyQuestion(surveyQuestionLists.getTitle(), surveyQuestionLists.getType(), surveyQuestionLists.getSort(), // 问题实体
surveyQuestionLists.getDirection());
SurveyQuestion surveyQuestions = // 先保存问题
surveyQuestionService.addSurveyQuestion(surveyQuestion);
if (ObjectUtil.isNull(surveyQuestions)) {
throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.NULL_PARAM, "新增数据为空");
}
// 获取数据库新生成的问题id
Long newId = surveyQuestions.getId();
questionIds.add(newId);
if (Const.SURVEY_QUESTION_TYPE_1 == surveyQuestionLists.getType() || Const.SURVEY_QUESTION_TYPE_2 == surveyQuestionLists.getType()) {
List<SurveyQuestionOption> surveyQuestionOptionList = // 获取问题选项list
surveyQuestionLists.getSurveyQuestionOptionList();
for (SurveyQuestionOption surveyQuestionOptions : surveyQuestionOptionList) {
// 遍历问题选项
SurveyQuestionOption surveyQuestionOption = new SurveyQuestionOption(newId, surveyQuestionOptions.getOptionContent(), surveyQuestionOptions.getIsOther(), // 问题选项实体
surveyQuestionOptions.getRemark());
// 再保存问题选项
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption);
}
}
}
return questionIds;
}
use of com.bc.pmpheep.back.po.SurveyQuestion in project pmph by BCSquad.
the class SurveyTemplateServiceImpl method addQuestionAndOption.
/**
* <pre>
* 功能描述:添加问题及问题选项
* 使用示范:
*
* @param surveyQuestionListVO
* @return
* </pre>
*/
private List<Long> addQuestionAndOption(List<SurveyQuestionListVO> surveyQuestionListVO) {
List<Long> questionIds = new ArrayList<Long>(surveyQuestionListVO.size());
for (SurveyQuestionListVO surveyQuestionLists : surveyQuestionListVO) {
// 遍历获取问题的集合
SurveyQuestion surveyQuestion = new SurveyQuestion(surveyQuestionLists.getTitle(), surveyQuestionLists.getType(), surveyQuestionLists.getSort(), // 问题实体
surveyQuestionLists.getDirection());
SurveyQuestion surveyQuestions = // 先保存问题
surveyQuestionService.addSurveyQuestion(surveyQuestion);
if (ObjectUtil.isNull(surveyQuestions)) {
throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.NULL_PARAM, "新增数据为空");
}
// 获取数据库新生成的问题id
Long newId = surveyQuestions.getId();
questionIds.add(newId);
if (Const.SURVEY_QUESTION_TYPE_1 == surveyQuestionLists.getType() || Const.SURVEY_QUESTION_TYPE_2 == surveyQuestionLists.getType()) {
List<SurveyQuestionOption> surveyQuestionOptionList = // 获取问题选项list
surveyQuestionLists.getSurveyQuestionOptionList();
for (SurveyQuestionOption surveyQuestionOptions : surveyQuestionOptionList) {
// 遍历问题选项
SurveyQuestionOption surveyQuestionOption = new SurveyQuestionOption(newId, surveyQuestionOptions.getOptionContent(), surveyQuestionOptions.getIsOther(), // 问题选项实体
surveyQuestionOptions.getRemark());
// 再保存问题选项
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption);
}
}
}
return questionIds;
}
use of com.bc.pmpheep.back.po.SurveyQuestion in project pmph by BCSquad.
the class SurveyQuestionServiceImpl method addSurveyQuestionListVOList.
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })
public Integer addSurveyQuestionListVOList(String jsonSurveyQuestion) throws CheckedServiceException {
if (ObjectUtil.isNull(jsonSurveyQuestion)) {
throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.NULL_PARAM, "参数为空");
}
// json字符串转List对象集合
List<SurveyQuestionListVO> SurveyQuestionListVO = new JsonUtil().getArrayListObjectFromStr(SurveyQuestionListVO.class, jsonSurveyQuestion);
if (CollectionUtil.isEmpty(SurveyQuestionListVO)) {
throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.NULL_PARAM, "参数为空");
}
int count = 0;
for (SurveyQuestionListVO SurveyQuestionLists : SurveyQuestionListVO) {
// 遍历获取问题的集合
// 获取问题id
Long id = SurveyQuestionLists.getId();
if (ObjectUtil.notNull(id)) {
// 如果id不为空,则先删除
deleteSurveyQuestionById(id);
surveyQuestionOptionService.deleteSurveyQuestionOptionByQuestionId(id);
}
SurveyQuestion surveyQuestion = new SurveyQuestion(null, SurveyQuestionLists.getCategoryId(), SurveyQuestionLists.getTitle(), SurveyQuestionLists.getType(), SurveyQuestionLists.getSort(), SurveyQuestionLists.getDirection(), // 问题实体
SurveyQuestionLists.getIsAnswer());
// 先保存问题
SurveyQuestion surveyQuestions = addSurveyQuestion(surveyQuestion);
if (ObjectUtil.isNull(surveyQuestions)) {
throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.NULL_PARAM, "新增数据为空");
}
// 获取数据库新生成的问题id
Long newId = surveyQuestions.getId();
List<SurveyQuestionOption> surveyQuestionOptionList = // 获取问题选项list
SurveyQuestionLists.getSurveyQuestionOptionList();
for (SurveyQuestionOption surveyQuestionOptions : surveyQuestionOptionList) {
// 遍历问题选项
SurveyQuestionOption surveyQuestionOption = new SurveyQuestionOption(newId, surveyQuestionOptions.getOptionContent(), surveyQuestionOptions.getIsOther(), // 问题选项实体
surveyQuestionOptions.getRemark());
// 再保存问题选项
surveyQuestionOptionService.addSurveyQuestionOption(surveyQuestionOption);
}
count++;
}
return count;
}
use of com.bc.pmpheep.back.po.SurveyQuestion in project pmph by BCSquad.
the class SurveyQuestionServiceTest method listSurveyQuestion.
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
@Test
@Rollback(Const.ISROLLBACK)
public void listSurveyQuestion() {
SurveyQuestion surveyQuestion = this.addSurveyQuestions();
PageParameter pageParameter = new PageParameter<>();
PageResult pageResult = new PageResult<>();
SurveyQuestionVO surveyQuestionVO = new SurveyQuestionVO();
pageParameter.setParameter(surveyQuestionVO);
pageParameter.setPageSize(10);
pageResult = surveyQuestionService.listSurveyQuestion(pageParameter);
Assert.assertNotNull("分页数据失败", pageResult);
}
Aggregations