Search in sources :

Example 1 with SurveyType

use of com.bc.pmpheep.back.po.SurveyType 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);
}
Also used : SurveyQuestionOption(com.bc.pmpheep.back.po.SurveyQuestionOption) SurveyType(com.bc.pmpheep.back.po.SurveyType) Survey(com.bc.pmpheep.back.po.Survey) SurveyTemplate(com.bc.pmpheep.back.po.SurveyTemplate) SurveyTemplateQuestion(com.bc.pmpheep.back.po.SurveyTemplateQuestion) Map(java.util.Map) SurveyQuestion(com.bc.pmpheep.back.po.SurveyQuestion)

Example 2 with SurveyType

use of com.bc.pmpheep.back.po.SurveyType in project pmph by BCSquad.

the class SurveyTypeServiceImpl method addSurveyType.

@Override
public SurveyType addSurveyType(SurveyType surveyType) throws CheckedServiceException {
    if (ObjectUtil.isNull(surveyType)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.NULL_PARAM, "参数为空");
    }
    if (StringUtil.isEmpty(surveyType.getSurveyName())) {
        throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.NULL_PARAM, "问卷调查类型名称为空");
    }
    SurveyType st = this.getSurveyTypeByName(surveyType.getSurveyName());
    if (ObjectUtil.notNull(st)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.QUESTIONNAIRE_SURVEY, CheckedExceptionResult.ILLEGAL_PARAM, "对象名称已存在");
    }
    surveyTypeDao.addSurveyType(surveyType);
    return surveyType;
}
Also used : SurveyType(com.bc.pmpheep.back.po.SurveyType) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException)

Aggregations

SurveyType (com.bc.pmpheep.back.po.SurveyType)2 Survey (com.bc.pmpheep.back.po.Survey)1 SurveyQuestion (com.bc.pmpheep.back.po.SurveyQuestion)1 SurveyQuestionOption (com.bc.pmpheep.back.po.SurveyQuestionOption)1 SurveyTemplate (com.bc.pmpheep.back.po.SurveyTemplate)1 SurveyTemplateQuestion (com.bc.pmpheep.back.po.SurveyTemplateQuestion)1 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)1 Map (java.util.Map)1