Search in sources :

Example 16 with Material

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

the class MigrationStageFour method addMaterialCommunity.

protected void addMaterialCommunity() {
    // 保存教材社区相关的信息
    for (Material material : materials) {
        MaterialExtra materialExtra = materialExtraService.getMaterialExtraByMaterialId(material.getId());
        if (null == materialExtra) {
            materialExtra = new MaterialExtra();
        }
        String detail = "<p>简介:驱蚊器</p>" + "<p><br/></p>" + "<p>邮寄地址:驱蚊器翁</p>" + "<p><br/></p>" + "<p>联&nbsp;系&nbsp;人:陈慧 (电话:18610032992,Emali:147258369@qq.com)</p>" + "<p><br/>/p>";
        detail = detail + "<p>简介:" + null == materialExtra.getNotice() ? "" : materialExtra.getNotice() + "</p>";
        detail = detail + "<p><br/></p><p>邮寄地址:" + material.getMailAddress() + "</p>";
        List<MaterialContact> materialContacts = materialContactService.listMaterialContactByMaterialId(material.getId());
        for (MaterialContact materialContact : materialContacts) {
            detail = detail + "<p><br/></p><p>联&nbsp;系&nbsp;人:" + materialContact.getContactUserName() + " (电话:" + materialContact.getContactPhone() + ",Emali:" + materialContact.getContactEmail() + ")</p>";
        }
        Content content = new Content(detail);
        content = contentService.add(content);
        CmsContent cmsContent = new CmsContent();
        cmsContent.setParentId(0L);
        cmsContent.setPath("0");
        cmsContent.setMid(content.getId());
        cmsContent.setCategoryId(3L);
        cmsContent.setTitle(material.getMaterialName());
        cmsContent.setAuthorType(new Short("0"));
        cmsContent.setAuthorId(material.getFounderId());
        cmsContent.setIsPublished(material.getIsPublished());
        cmsContent.setAuthStatus(material.getIsPublished() ? new Short("2") : new Short("0"));
        cmsContent.setAuthDate(DateUtil.date2Str(material.getGmtUpdate() == null ? material.getGmtCreate() : material.getGmtUpdate()));
        cmsContent.setAuthUserId(material.getFounderId());
        cmsContent.setGmtCreate(material.getGmtCreate());
        cmsContent.setGmtUpdate(material.getGmtUpdate() == null ? material.getGmtCreate() : material.getGmtUpdate());
        cmsContent.setIsMaterialEntry(true);
        cmsContent.setMaterialId(material.getId());
        cmsContentService.addCmsContent(cmsContent);
    }
}
Also used : CmsContent(com.bc.pmpheep.back.po.CmsContent) CmsContent(com.bc.pmpheep.back.po.CmsContent) Content(com.bc.pmpheep.general.po.Content) MaterialContact(com.bc.pmpheep.back.po.MaterialContact) Material(com.bc.pmpheep.back.po.Material) MaterialExtra(com.bc.pmpheep.back.po.MaterialExtra)

Example 17 with Material

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

the class MigrationStageFour method material.

protected void material() {
    String tableName = "teach_material";
    String sql = "select " + "a.materid, " + "a.matername, " + "a.teachround round, " + "i.new_pk  booktypesid, " + "a.showenddate, " + "a.enddate, " + "a.agedeaddate, " + "a.mailaddress, " + "CASE WHEN a.flowtype=10 THEN '0' ELSE '1' END is_published," + "CASE WHEN a.flowtype=12 THEN '1' ELSE '0' END is_all_textbook_published, " + "j.new_pk DepartmentId , " + "d.newuserid director, " + "a.isbookmulti, " + "a.ispositionmulti, " + "a.isuselearnexp, " + "a.isfilllearnexp, " + "a.isuseworkexp, " + "a.isfillworkexp, " + "a.isuseteachexp, " + "a.isfillteachexp, " + "a.isuseacadeexp, " + "a.isfillacadeexp, " + "a.isusematerpartexp, " + "a.isfillmaterpartexp, " + "a.isusecountry, " + "a.isfillcountry, " + "a.isuseprovexce, " + "a.isfillprovexce, " + "a.isuseschoolconstr, " + "a.isfillschoolconstr, " + "a.isuseeditormater, " + "a.isfilleditormater, " + "a.isusematerwrite, " + "a.isfillmaterwrite, " + "a.isuseothermaterwrite, " + "a.isfillothermaterwrite, " + "a.isusescientresearch, " + "a.isfillscientresearch, " + "if(a.isdelete =1 ,true,false) isdelete, " + "a.createdate, " + "g.new_pk founder_id, " + "a.updatedate, " + // 如果更新者为空那么默认创建者
    "ifnull(h.new_pk,g.new_pk) mender_id  " + "from teach_material a  " + "LEFT JOIN ( " + "select DISTINCT e.materid,d.rolename,a.userid,a.new_pk newuserid,f.new_pk neworgid from sys_user  a " + "LEFT JOIN  sys_userorganize b on b.userid=a.userid " + "LEFT JOIN  sys_userrole   c on   c.userid =a.userid  " + "LEFT JOIN  sys_role   d  on d.roleid =c.roleid " + "LEFT JOIN teach_material e on e.createorgid = b.orgid  " + "LEFT JOIN ba_organize f on f.orgid = b.orgid " + "where d.rolename like '%主任%' and e.materid is not null  GROUP BY e.materid " + ") d on d.materid = a.materid " + "LEFT JOIN sys_user g on g.userid = a.createuserid " + "LEFT JOIN sys_user h on h.userid = a.updateuserid  " + "LEFT JOIN sys_booktypes i on i.BookTypesID = a. booktypesid  " + "LEFT JOIN ba_organize j on a.createorgid = j.orgid " + "LEFT JOIN site_article k ON a.materid = k.materid " + "WHERE true GROUP BY a.materid ;";
    // 增加new_pk字段
    JdbcHelper.addColumn(tableName);
    List<Map<String, Object>> maps = JdbcHelper.getJdbcTemplate().queryForList(sql);
    List<Map<String, Object>> excel = new LinkedList<>();
    Map<String, Object> result = new LinkedHashMap<>();
    int count = 0;
    int correctCount = 0;
    int[] state = { 0, 0, 0 };
    StringBuilder reason = new StringBuilder();
    StringBuilder dealWith = new StringBuilder();
    // 模块名称
    excptionList.add(new Object[] { "教材" });
    // 模块标题
    excptionList.add(new Object[] { "教材名称", "问题", "原因分析", "处理方式" });
    int excptionListOldSize = excptionList.size();
    for (Map<String, Object> oldMaterial : maps) {
        StringBuilder exception = new StringBuilder();
        String materialId = String.valueOf(oldMaterial.get("materid"));
        String matername = (String) oldMaterial.get("matername");
        if (StringUtil.isEmpty(matername)) {
            oldMaterial.put(SQLParameters.EXCEL_EX_HEADER, exception.append("教材名称为空。"));
            excel.add(oldMaterial);
            if (state[0] == 0) {
                reason.append("找不到教材名称。");
                dealWith.append("放弃迁移。");
                state[0] = 1;
            }
            continue;
        }
        String mailaddress = (String) oldMaterial.get("mailaddress");
        if (StringUtil.isEmpty(mailaddress)) {
            oldMaterial.put(SQLParameters.EXCEL_EX_HEADER, exception.append("邮寄地址为空。"));
            excel.add(oldMaterial);
            if (state[1] == 0) {
                reason.append("找不到邮寄地址。");
                dealWith.append("放弃迁移。");
                state[1] = 1;
            }
            continue;
        }
        Long departmentId = (Long) oldMaterial.get("DepartmentId");
        if (ObjectUtil.isNull(departmentId)) {
            // oldMaterial.put(SQLParameters.EXCEL_EX_HEADER, exception.append("创建部门为空。"));
            // excel.add(oldMaterial);
            // continue;
            departmentId = 0L;
        }
        Long director = (Long) oldMaterial.get("director");
        if (ObjectUtil.isNull(director)) {
            // oldMaterial.put(SQLParameters.EXCEL_EX_HEADER, exception.append("主任为空。"));
            // excel.add(oldMaterial);
            // continue;
            director = 0L;
        }
        Long founder_id = (Long) oldMaterial.get("founder_id");
        if (ObjectUtil.isNull(founder_id)) {
            // oldMaterial.put(SQLParameters.EXCEL_EX_HEADER, exception.append("创建人为空。"));
            // excel.add(oldMaterial);
            // continue;
            founder_id = 0L;
            // 设置成wuz
            PmphUser pmphUser = pmphUserService.getPmphUser("wuz");
            if (null != pmphUser && null != pmphUser.getId()) {
                founder_id = pmphUser.getId();
            }
            if (null != pmphUser.getDepartmentId()) {
                departmentId = pmphUser.getDepartmentId();
            }
        }
        Integer round = (Integer) oldMaterial.get("round");
        if (ObjectUtil.isNull(round)) {
            // 没有轮次的设置默认值为0。
            // oldMaterial.put(SQLParameters.EXCEL_EX_HEADER,
            // exception.append("轮次为空,设默认值1。"));
            // excel.add(oldMaterial);
            // ------------------------------------------------------------------------------------------
            Matcher m = Pattern.compile("第(.*?)轮").matcher(matername);
            round = m.find() ? SystemMessageService.rank(m.group(1)) : 0;
            if (null == round) {
                round = 0;
                excptionList.add(new Object[] { matername, "教材没有对应的轮次", "原专家库没有轮次信息", "导入新库表,设默认值0" });
            }
        }
        Long booktypesid = (Long) oldMaterial.get("booktypesid");
        if (ObjectUtil.isNull(booktypesid)) {
            oldMaterial.put(SQLParameters.EXCEL_EX_HEADER, exception.append("架构为空,设为默认0。"));
            excel.add(oldMaterial);
            booktypesid = 0L;
            if (state[2] == 0) {
                reason.append("找不到教材架构。");
                dealWith.append("设为默认值0迁入数据库。");
                state[2] = 1;
            }
            excptionList.add(new Object[] { matername, "教材没有分类", "原专家库没有分类信息", "导入新库表,设为默认0" });
        }
        Long mender_id = (Long) oldMaterial.get("mender_id");
        if (ObjectUtil.isNull(mender_id)) {
            // oldMaterial.put(SQLParameters.EXCEL_EX_HEADER,
            // exception.append("修改人为空,设置默认为创建者。"));
            // excel.add(oldMaterial);
            mender_id = founder_id;
        }
        Material material = new Material();
        material.setMaterialName(matername);
        material.setMaterialRound(round);
        material.setMaterialType(booktypesid);
        material.setDeadline((Timestamp) oldMaterial.get("showenddate"));
        material.setActualDeadline((Timestamp) oldMaterial.get("enddate"));
        material.setAgeDeadline((Timestamp) oldMaterial.get("agedeaddate"));
        material.setMailAddress(mailaddress);
        material.setDepartmentId(departmentId);
        // director,
        material.setDirector(director);
        // is_multi_books,
        material.setIsMultiBooks("1".equals(String.valueOf(oldMaterial.get("isbookmulti"))));
        // is_multi_position,
        material.setIsMultiPosition("1".equals(String.valueOf(oldMaterial.get("ispositionmulti"))));
        // is_edu_exp_used,
        material.setIsEduExpUsed("1".equals(String.valueOf(oldMaterial.get("isuselearnexp"))));
        // is_edu_exp_required,
        material.setIsEduExpRequired("1".equals(String.valueOf(oldMaterial.get("isfilllearnexp"))));
        // is_work_exp_used,
        material.setIsWorkExpUsed("1".equals(String.valueOf(oldMaterial.get("isuseworkexp"))));
        // is_work_exp_required,
        material.setIsWorkExpRequired("1".equals(String.valueOf(oldMaterial.get("isfillworkexp"))));
        // is_teach_exp_used,
        material.setIsTeachExpUsed("1".equals(String.valueOf(oldMaterial.get("isuseteachexp"))));
        // is_teach_exp_required,
        material.setIsTeachExpRequired("1".equals(String.valueOf(oldMaterial.get("isfillteachexp"))));
        // is_acade_used,
        material.setIsAcadeUsed("1".equals(String.valueOf(oldMaterial.get("isuseacadeexp"))));
        // is_acade_required,
        material.setIsAcadeRequired("1".equals(String.valueOf(oldMaterial.get("isfillacadeexp"))));
        // is_last_position_used,
        material.setIsLastPositionUsed("1".equals(String.valueOf(oldMaterial.get("isusematerpartexp"))));
        // is_last_position_required,
        material.setIsLastPositionRequired("1".equals(String.valueOf(oldMaterial.get("isfillmaterpartexp"))));
        material.setIsCourseUsed("1".equals(String.valueOf(oldMaterial.get("isusecountry"))) || "1".equals(String.valueOf(oldMaterial.get("isuseprovexce"))) || // is_course_used,
        "1".equals(String.valueOf(oldMaterial.get("isuseschoolconstr"))));
        material.setIsCourseRequired("1".equals(String.valueOf(oldMaterial.get("isfillcountry"))) || "1".equals(String.valueOf(oldMaterial.get("isfillprovexce"))) || // is_course_required,
        "1".equals(String.valueOf(oldMaterial.get("isfillschoolconstr"))));
        // is_national_plan_used,
        material.setIsNationalPlanUsed("1".equals(String.valueOf(oldMaterial.get("isuseeditormater"))));
        // is_national_plan_required,
        material.setIsNationalPlanRequired("1".equals(String.valueOf(oldMaterial.get("isfilleditormater"))));
        // is_textbook_writer_used,
        material.setIsTextbookUsed("1".equals(String.valueOf(oldMaterial.get("isusematerwrite"))));
        // is_textbook_writer_required,
        material.setIsTextbookRequired("1".equals(String.valueOf(oldMaterial.get("isfillmaterwrite"))));
        // is_other_textbook_used,
        material.setIsPmphTextbookUsed("1".equals(String.valueOf(oldMaterial.get("isuseothermaterwrite"))));
        // is_other_textbook_required,
        material.setIsPmphTextbookRequired("1".equals(String.valueOf(oldMaterial.get("isfillothermaterwrite"))));
        // is_research_used,
        material.setIsResearchUsed("1".equals(String.valueOf(oldMaterial.get("isusescientresearch"))));
        // is_research_required,
        material.setIsResearchRequired("1".equals(String.valueOf(oldMaterial.get("isfillscientresearch"))));
        // is_published,
        material.setIsPublished("1".equals(String.valueOf(oldMaterial.get("is_published"))));
        // is_public
        material.setIsPublic(true);
        material.setIsAllTextbookPublished(// is_all_textbook_published
        "1".equals(String.valueOf(oldMaterial.get("is_all_textbook_published"))));
        // is_force_end
        material.setIsForceEnd(false);
        // is_deleted,
        material.setIsDeleted("1".equals(String.valueOf(oldMaterial.get("isdelete"))));
        // gmt_create,
        material.setGmtCreate((Timestamp) oldMaterial.get("createdate"));
        // founder_id,
        material.setFounderId(founder_id);
        // gmt_update,
        material.setGmtUpdate((Timestamp) oldMaterial.get("updatedate"));
        // 修改者
        Long mender_Id = (Long) oldMaterial.get("mender_id");
        mender_Id = mender_Id == null ? material.getFounderId() : mender_Id;
        // mender_id
        material.setMenderId(mender_Id);
        // 主编学术专著情况
        material.setIsMonographUsed(false);
        // 主编学术专著情况必填
        material.setIsMonographRequired(false);
        // 出版行业获奖情况
        material.setIsPublishRewardUsed(false);
        // 出版行业获奖情况必填
        material.setIsPublishRewardRequired(false);
        // SCI论文投稿及影响因子
        material.setIsSciUsed(false);
        // SCI论文投稿及影响因子必填
        material.setIsSciRequired(false);
        // 临床医学获奖情况
        material.setIsClinicalRewardUsed(false);
        // 临床医学获奖情况必填
        material.setIsClinicalRewardRequired(false);
        // 学术荣誉授予情况
        material.setIsAcadeRewardUsed(false);
        // 学术荣誉授予情况必填
        material.setIsAcadeRewardRequired(false);
        // 设置权限
        material.setProjectPermission(Integer.valueOf("11110011", 2));
        material.setPlanPermission(Integer.valueOf("00010000", 2));
        material = materialService.addMaterial(material);
        count++;
        long pk = material.getId();
        // 更新旧表中new_pk字段
        JdbcHelper.updateNewPrimaryKey(tableName, pk, "materid", materialId);
        if (null == oldMaterial.get("exception")) {
            correctCount++;
        }
        // 保存教材,为下面保存教材社区做准备
        materials.add(material);
    }
    // 没有错误数据
    if (excptionList.size() == excptionListOldSize) {
        excptionList.remove(excptionList.size() - 1);
        excptionList.remove(excptionList.size() - 1);
    } else {
        // 插入一个空行
        excptionList.add(new String[] { "" });
    }
    if (excel.size() > 0) {
        try {
            excelHelper.exportFromMaps(excel, "教材信息表", "material");
        } catch (IOException ex) {
            logger.error("异常数据导出到Excel失败", ex);
        }
    }
    if (correctCount != maps.size()) {
        result.put(SQLParameters.EXCEL_HEADER_TABLENAME, "material");
        result.put(SQLParameters.EXCEL_HEADER_DESCRIPTION, "教材信息表");
        result.put(SQLParameters.EXCEL_HEADER_SUM_DATA, maps.size());
        result.put(SQLParameters.EXCEL_HEADER_MIGRATED_DATA, count);
        result.put(SQLParameters.EXCEL_HEADER_CORECT_DATA, correctCount);
        result.put(SQLParameters.EXCEL_HEADER_TRANSFERED_DATA, count - correctCount);
        result.put(SQLParameters.EXCEL_HEADER_NO_MIGRATED_DATA, maps.size() - count);
        result.put(SQLParameters.EXCEL_HEADER_EXCEPTION_REASON, reason.toString());
        result.put(SQLParameters.EXCEL_HEADER_DEAL_WITH, dealWith.toString());
        SQLParameters.STATISTICS_RESULT.add(result);
    }
    logger.info("'{}'表迁移完成,异常条目数量:{}", tableName, excel.size());
    logger.info("原数据库中共有{}条数据,迁移了{}条数据", maps.size(), count);
    // 记录信息
    Map<String, Object> msg = new HashMap<String, Object>();
    msg.put("result", "" + tableName + " 表迁移完成" + count + "/" + maps.size());
    SQLParameters.STATISTICS.add(msg);
}
Also used : PmphUser(com.bc.pmpheep.back.po.PmphUser) Matcher(java.util.regex.Matcher) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Material(com.bc.pmpheep.back.po.Material) IOException(java.io.IOException) LinkedList(java.util.LinkedList) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap)

Example 18 with Material

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

the class MigrationStageTen method materialNotice.

public void materialNotice() {
    List<Material> materials = materialService.getListMaterial("轮");
    List<CmsCategory> categorys = cmsCategoryService.getCmsCategoryListByCategoryName("公告");
    Long categoryId = categorys.get(0).getId();
    final String html = "<p><strong><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">$f</span></strong>$d</p>";
    final String htmlS1 = "<p><strong><span style=\"box-sizing: border-box; margin: 0px; padding: 0px;\">$d</span></strong></p>";
    final String htmlS2 = "<p style=\"box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; padding: 0px;\">$d</p>";
    for (Material material : materials) {
        CmsContent cmsContent = new CmsContent();
        cmsContent.setParentId(0L);
        cmsContent.setCategoryId(categoryId);
        cmsContent.setPath("0");
        cmsContent.setTitle(material.getMaterialName());
        cmsContent.setAuthorType((short) 0);
        cmsContent.setMaterialId(material.getId());
        /* 生成通知内容 */
        StringBuilder sb = new StringBuilder();
        String str = html.replace("$f", "截止日期:");
        str = str.replace("$d", sdf.format(material.getDeadline()));
        sb.append(str);
        /* 获取教材联系人 */
        List<MaterialContact> contacts = materialContactService.listMaterialContactByMaterialId(categoryId);
        if (CollectionUtil.isNotEmpty(contacts)) {
            str = htmlS1.replace("$f", "联系人:");
            sb.append(str);
            for (MaterialContact contact : contacts) {
                /* 裴中惠&nbsp;(电话:010-59787110&nbsp;,&nbsp;Email:pzh@pmph.com) */
                StringBuilder builder = new StringBuilder(contact.getContactUserName());
                builder.append("&nbsp;(电话:");
                builder.append(contact.getContactPhone());
                builder.append("&nbsp;,&nbsp;Email:");
                builder.append(contact.getContactEmail());
                builder.append(")");
                str = htmlS2.replace("$d", builder.toString());
                sb.append(str);
            }
        }
        str = html.replace("$f", "邮寄地址:");
        str = str.replace("$d", material.getMailAddress());
        sb.append(str);
        /* 获取通知内容和备注 */
        MaterialExtra extra = materialExtraService.getMaterialExtraByMaterialId(material.getId());
        str = htmlS1.replace("$d", "简&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;介:");
        sb.append(str);
        if (null != extra) {
        // str = htmlS2.replace("$d", extra.getNotice()) /* 存入MongoDB */
        }
        Content content = new Content(sb.toString());
        content = contentService.add(content);
        cmsContent.setMid(content.getId());
    }
}
Also used : CmsContent(com.bc.pmpheep.back.po.CmsContent) CmsContent(com.bc.pmpheep.back.po.CmsContent) Content(com.bc.pmpheep.general.po.Content) MaterialContact(com.bc.pmpheep.back.po.MaterialContact) Material(com.bc.pmpheep.back.po.Material) CmsCategory(com.bc.pmpheep.back.po.CmsCategory) MaterialExtra(com.bc.pmpheep.back.po.MaterialExtra)

Example 19 with Material

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

the class DeclarationServiceImpl method exportExcel.

@Override
public ApplicationVO exportExcel(Long declarationId) {
    // 专家信息显示实体
    ApplicationVO applicationVO = new ApplicationVO();
    // 作家申报
    List<DecPositionDisplayVO> decPositionList = decPositionDao.listDecPositionsOrBook(declarationId);
    for (DecPositionDisplayVO decPositions : decPositionList) {
        String syllabusId = decPositions.getSyllabusId();
        if (StringUtil.notEmpty(syllabusId)) {
            // 下载路径
            String syllabusIds = RouteUtil.MONGODB_FILE + syllabusId;
            decPositions.setSyllabusId(syllabusIds);
        }
        switch(decPositions.getPresetPosition()) {
            case 1:
                decPositions.setShowPosition("编委");
                break;
            case 2:
                decPositions.setShowPosition("副主编");
                break;
            case 3:
                decPositions.setShowPosition("副主编,编委");
                break;
            case 4:
                decPositions.setShowPosition("主编");
                break;
            case 5:
                decPositions.setShowPosition("主编,编委");
                break;
            case 6:
                decPositions.setShowPosition("主编,副主编");
                break;
            case 7:
                decPositions.setShowPosition("主编,副主编,编委");
                break;
            case 8:
                decPositions.setShowPosition("数字编委");
                break;
            case 9:
                decPositions.setShowPosition("编委,数字编委");
                break;
            case 10:
                decPositions.setShowPosition("副主编,数字编委");
                break;
            case 11:
                decPositions.setShowPosition("副主编,编委,数字编委");
                break;
            case 12:
                decPositions.setShowPosition("主编,数字编委");
                break;
            case 13:
                decPositions.setShowPosition("主编,编委,数字编委");
                break;
            case 14:
                decPositions.setShowPosition("主编,副主编,数字编委");
                break;
            case 15:
                decPositions.setShowPosition("主编,副主编,编委,数字编委");
                break;
            default:
                break;
        }
        if (decPositions.getChosenPosition() != 0) {
            switch(decPositions.getChosenPosition()) {
                case 1:
                    decPositions.setShowChosenPosition("编委");
                    break;
                case 2:
                    decPositions.setShowChosenPosition("副主编");
                    break;
                case 3:
                    decPositions.setShowChosenPosition("副主编,编委");
                    break;
                case 4:
                    decPositions.setShowChosenPosition("主编");
                    break;
                case 5:
                    decPositions.setShowChosenPosition("主编,编委");
                    break;
                case 6:
                    decPositions.setShowChosenPosition("主编,副主编");
                    break;
                case 7:
                    decPositions.setShowChosenPosition("主编,副主编,编委");
                    break;
                case 8:
                    decPositions.setShowChosenPosition("数字编委");
                    break;
                case 9:
                    decPositions.setShowChosenPosition("编委,数字编委");
                    break;
                case 10:
                    decPositions.setShowChosenPosition("副主编,数字编委");
                    break;
                case 11:
                    decPositions.setShowChosenPosition("副主编,编委,数字编委");
                    break;
                case 12:
                    decPositions.setShowChosenPosition("主编,数字编委");
                    break;
                case 13:
                    decPositions.setShowChosenPosition("主编,编委,数字编委");
                    break;
                case 14:
                    decPositions.setShowChosenPosition("主编,副主编,数字编委");
                    break;
                case 15:
                    decPositions.setShowChosenPosition("主编,副主编,编委,数字编委");
                    break;
                default:
                    break;
            }
        }
    }
    // 作家遴选
    List<DecPositionPublishedVO> decPositionPublishedVOs = decPositionPublishedDao.listDecPositionDisplayOrPosition(declarationId);
    for (DecPositionPublishedVO decPositionPublished : decPositionPublishedVOs) {
        if (decPositionPublished.getChosenPosition() != 0) {
            switch(decPositionPublished.getChosenPosition()) {
                case 1:
                    decPositionPublished.setShowChosenPosition("编委");
                    break;
                case 2:
                    decPositionPublished.setShowChosenPosition("副主编");
                    break;
                case 3:
                    decPositionPublished.setShowChosenPosition("副主编,编委");
                    break;
                case 4:
                    decPositionPublished.setShowChosenPosition("主编");
                    break;
                case 5:
                    decPositionPublished.setShowChosenPosition("主编,编委");
                    break;
                case 6:
                    decPositionPublished.setShowChosenPosition("主编,副主编");
                    break;
                case 7:
                    decPositionPublished.setShowChosenPosition("主编,副主编,编委");
                    break;
                case 8:
                    decPositionPublished.setShowChosenPosition("数字编委");
                    break;
                case 9:
                    decPositionPublished.setShowChosenPosition("编委,数字编委");
                    break;
                case 10:
                    decPositionPublished.setShowChosenPosition("副主编,数字编委");
                    break;
                case 11:
                    decPositionPublished.setShowChosenPosition("副主编,编委,数字编委");
                    break;
                case 12:
                    decPositionPublished.setShowChosenPosition("主编,数字编委");
                    break;
                case 13:
                    decPositionPublished.setShowChosenPosition("主编,编委,数字编委");
                    break;
                case 14:
                    decPositionPublished.setShowChosenPosition("主编,副主编,数字编委");
                    break;
                case 15:
                    decPositionPublished.setShowChosenPosition("主编,副主编,编委,数字编委");
                    break;
                default:
                    break;
            }
        }
    }
    // 作家申报表
    DeclarationOrDisplayVO declaration = declarationDao.getDeclarationByIdOrOrgName(declarationId);
    WriterUser user = writerUserService.get(declaration.getUserId());
    if (user != null) {
        declaration.setUsername(user.getUsername());
    }
    // 作家学习经历
    List<DecEduExp> decEduExpList = decEduExpDao.getListDecEduExpByDeclarationId(declarationId);
    // 作家工作经历
    List<DecWorkExp> decWorkExpList = decWorkExpDao.getListDecWorkExpByDeclarationId(declarationId);
    // 作家教学经历
    List<DecTeachExp> decTeachExpList = decTeachExpDao.getListDecTeachExpByDeclarationId(declarationId);
    // 作家个人成就
    DecAchievement decAchievement = decAchievementDao.getDecAchievementByDeclarationId(declarationId);
    // 作家兼职学术
    List<DecAcade> decAcadeList = decAcadeDao.getListDecAcadeByDeclarationId(declarationId);
    // 作家本套上版教材参编情况
    List<DecLastPosition> decLastPositionList = decLastPositionDao.getListDecLastPositionByDeclarationId(declarationId);
    // 作家主编国家级规划教材情况
    List<DecNationalPlan> decNationalPlanList = decNationalPlanDao.getListDecNationalPlanByDeclarationId(declarationId);
    // 人卫社教材编写情况表
    List<DecTextbookPmph> decTextbookPmphList = decTextbookPmphDao.getListDecTextbookPmphByDeclarationId(declarationId);
    // 其他社教材编写情况
    List<DecTextbook> decTextbookList = decTextbookDao.getListDecTextbookByDeclarationId(declarationId);
    // 参加人卫慕课、数字教材编写情况表
    DecMoocDigital decMoocDigital = decMoocDigitalDao.getDecMoocDigitalByDeclarationId(declarationId);
    // 作家精品课程建设情况
    List<DecCourseConstruction> decCourseConstruction = decCourseConstructionDao.getDecCourseConstructionByDeclarationId(declarationId);
    // 作家科研情况
    List<DecResearch> decResearchList = decResearchDao.getListDecResearchByDeclarationId(declarationId);
    // 主编学术专著情况
    List<DecMonograph> decMonographList = decMonographDao.getListDecMonographByDeclarationId(declarationId);
    // 出版行业获奖情况
    List<DecPublishReward> decPublishRewardList = decPublishRewardDao.getListDecPublishRewardByDeclarationId(declarationId);
    // SCI论文投稿及影响因子情况
    List<DecSci> decSciList = decSciDao.getListDecSciByDeclarationId(declarationId);
    // 临床医学获奖情况
    List<DecClinicalReward> decClinicalRewardList = decClinicalRewardDao.getListDecClinicalRewardByDeclarationId(declarationId);
    // 学术荣誉授予情况
    List<DecAcadeReward> decAcadeRewardList = decAcadeRewardDao.getListDecAcadeRewardByDeclarationId(declarationId);
    // 作家扩展项
    List<DecExtensionVO> decExtensionList = decExtensionDao.getListDecExtensionByDeclarationId(declarationId);
    // 编写内容意向表
    DecIntention decIntention = decIntentionDao.getDecIntentionByDeclarationId(declarationId);
    // 是否选择必填
    Material material = materialService.getMaterialById(declaration.getMaterialId());
    // 把查询出来的信息添加进applicationVO
    applicationVO.setDecPositionList(decPositionList);
    applicationVO.setDecPositionPublishedVOs(decPositionPublishedVOs);
    applicationVO.setDeclaration(declaration);
    applicationVO.setDecEduExpList(decEduExpList);
    applicationVO.setDecWorkExpList(decWorkExpList);
    applicationVO.setDecTeachExpList(decTeachExpList);
    applicationVO.setDecAchievement(decAchievement);
    applicationVO.setDecAcadeList(decAcadeList);
    applicationVO.setDecLastPositionList(decLastPositionList);
    applicationVO.setDecNationalPlanList(decNationalPlanList);
    applicationVO.setDecTextbookPmphList(decTextbookPmphList);
    applicationVO.setDecTextbookList(decTextbookList);
    applicationVO.setDecMoocDigital(decMoocDigital);
    applicationVO.setDecCourseConstruction(decCourseConstruction);
    applicationVO.setDecResearchList(decResearchList);
    applicationVO.setDecMonographList(decMonographList);
    applicationVO.setDecPublishRewardList(decPublishRewardList);
    applicationVO.setDecSciList(decSciList);
    applicationVO.setDecClinicalRewardList(decClinicalRewardList);
    applicationVO.setDecAcadeRewardList(decAcadeRewardList);
    applicationVO.setDecExtensionList(decExtensionList);
    applicationVO.setDecIntention(decIntention);
    applicationVO.setMaterial(material);
    return applicationVO;
}
Also used : DecMonograph(com.bc.pmpheep.back.po.DecMonograph) DecEduExp(com.bc.pmpheep.back.po.DecEduExp) DecTextbookPmph(com.bc.pmpheep.back.po.DecTextbookPmph) DecAchievement(com.bc.pmpheep.back.po.DecAchievement) DecSci(com.bc.pmpheep.back.po.DecSci) DecPositionPublishedVO(com.bc.pmpheep.back.vo.DecPositionPublishedVO) DecClinicalReward(com.bc.pmpheep.back.po.DecClinicalReward) DeclarationOrDisplayVO(com.bc.pmpheep.back.vo.DeclarationOrDisplayVO) WriterUser(com.bc.pmpheep.back.po.WriterUser) DecMoocDigital(com.bc.pmpheep.back.po.DecMoocDigital) DecTextbook(com.bc.pmpheep.back.po.DecTextbook) DecLastPosition(com.bc.pmpheep.back.po.DecLastPosition) DecPublishReward(com.bc.pmpheep.back.po.DecPublishReward) DecExtensionVO(com.bc.pmpheep.back.vo.DecExtensionVO) DecAcade(com.bc.pmpheep.back.po.DecAcade) Material(com.bc.pmpheep.back.po.Material) DecIntention(com.bc.pmpheep.back.po.DecIntention) DecPositionDisplayVO(com.bc.pmpheep.back.vo.DecPositionDisplayVO) DecCourseConstruction(com.bc.pmpheep.back.po.DecCourseConstruction) DecTeachExp(com.bc.pmpheep.back.po.DecTeachExp) DecWorkExp(com.bc.pmpheep.back.po.DecWorkExp) DecResearch(com.bc.pmpheep.back.po.DecResearch) ApplicationVO(com.bc.pmpheep.back.vo.ApplicationVO) DecNationalPlan(com.bc.pmpheep.back.po.DecNationalPlan) DecAcadeReward(com.bc.pmpheep.back.po.DecAcadeReward)

Example 20 with Material

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

the class MaterialExtraServiceImpl method getMaterialExtraAndNoticeDetail.

/**
 * <pre>
 * 功能描述:根据教材ID查询教材通知详情及附件
 * 使用示范:
 *
 * @param materialId 教材ID
 * @return Map<String, Object> 集合
 * @throws CheckedServiceException
 * </pre>
 *
 * @throws UnsupportedEncodingException
 */
@Override
public Map<String, Object> getMaterialExtraAndNoticeDetail(Long materialId) throws CheckedServiceException {
    if (ObjectUtil.isNull(materialId)) {
        throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL_EXTRA, CheckedExceptionResult.NULL_PARAM, "教材主键为空");
    }
    Map<String, Object> resultMap = new HashMap<String, Object>();
    // 教材通知备注
    MaterialExtra materialExtra = null;
    // MongoDB中教材通知
    String contentText = null;
    // 联系人
    List<MaterialContact> materialContacts = null;
    // 教材通知附件
    List<MaterialNoticeAttachment> materialNoticeAttachments = null;
    // 教材备注附件
    List<MaterialNoteAttachment> materialNoteAttachments = null;
    // 教材
    Material material = materialService.getMaterialById(materialId);
    if (ObjectUtil.notNull(material)) {
        // 联系人
        materialContacts = materialContactService.listMaterialContactByMaterialId(materialId);
        materialExtra = this.getMaterialExtraByMaterialId(materialId);
        if (ObjectUtil.notNull(materialExtra)) {
            Long materialExtraId = materialExtra.getId();
            // 教材通知附件
            materialNoticeAttachments = materialNoticeAttachmentService.getMaterialNoticeAttachmentsByMaterialExtraId(materialExtraId);
            // 教材备注附件
            materialNoteAttachments = materialNoteAttachmentService.getMaterialNoteAttachmentByMaterialExtraId(materialExtraId);
        }
        // 判断内容是否已经发布或审核通过
        String fileNoticeDownLoadType = null;
        String fileNoteDownLoadType = null;
        if (Const.TRUE.booleanValue() == material.getIsPublished().booleanValue()) {
            fileNoticeDownLoadType = Const.MATERIAL_NOTICE_FILE_DOWNLOAD;
            fileNoteDownLoadType = Const.MATERIAL_NOTE_FILE_DOWNLOAD;
        } else {
            fileNoticeDownLoadType = Const.FILE_DOWNLOAD;
            fileNoteDownLoadType = Const.FILE_DOWNLOAD;
        }
        CmsContent cmsContent = cmsContentService.getCmsContentByMaterialId(materialId);
        if (ObjectUtil.notNull(cmsContent)) {
            Content content = contentService.get(cmsContent.getMid());
            if (ObjectUtil.notNull(content)) {
                contentText = content.getContent();
            }
        }
        if (CollectionUtil.isNotEmpty(materialNoticeAttachments)) {
            for (MaterialNoticeAttachment materialNoticeAttachment : materialNoticeAttachments) {
                String attachment = materialNoticeAttachment.getAttachment();
                // 拼接附件下载路径
                materialNoticeAttachment.setAttachment(fileNoticeDownLoadType + attachment);
            }
        }
        if (CollectionUtil.isNotEmpty(materialNoteAttachments)) {
            for (MaterialNoteAttachment materialNoteAttachment : materialNoteAttachments) {
                String attachment = materialNoteAttachment.getAttachment();
                // 拼接附件下载路径
                materialNoteAttachment.setAttachment(fileNoteDownLoadType + attachment);
            }
        }
    }
    // 教材
    resultMap.put("materialName", material);
    // 联系人
    resultMap.put("materialContacts", materialContacts);
    // 教材通知备注
    resultMap.put("materialExtra", materialExtra);
    // MongoDB中教材通知
    resultMap.put("content", contentText);
    // 教材通知附件
    resultMap.put("materialNoticeAttachments", materialNoticeAttachments);
    // 教材备注附件
    resultMap.put("materialNoteAttachments", materialNoteAttachments);
    return resultMap;
}
Also used : MaterialNoticeAttachment(com.bc.pmpheep.back.po.MaterialNoticeAttachment) CmsContent(com.bc.pmpheep.back.po.CmsContent) HashMap(java.util.HashMap) MaterialNoteAttachment(com.bc.pmpheep.back.po.MaterialNoteAttachment) MaterialContact(com.bc.pmpheep.back.po.MaterialContact) CheckedServiceException(com.bc.pmpheep.service.exception.CheckedServiceException) Material(com.bc.pmpheep.back.po.Material) CmsContent(com.bc.pmpheep.back.po.CmsContent) Content(com.bc.pmpheep.general.po.Content) MaterialExtra(com.bc.pmpheep.back.po.MaterialExtra)

Aggregations

Material (com.bc.pmpheep.back.po.Material)37 CheckedServiceException (com.bc.pmpheep.service.exception.CheckedServiceException)30 ArrayList (java.util.ArrayList)18 Textbook (com.bc.pmpheep.back.po.Textbook)12 PmphUser (com.bc.pmpheep.back.po.PmphUser)11 Declaration (com.bc.pmpheep.back.po.Declaration)10 HashMap (java.util.HashMap)8 UserMessage (com.bc.pmpheep.back.po.UserMessage)7 Gson (com.google.gson.Gson)7 IOException (java.io.IOException)7 LogDetail (com.bc.pmpheep.annotation.LogDetail)6 CmsContent (com.bc.pmpheep.back.po.CmsContent)6 MaterialExtra (com.bc.pmpheep.back.po.MaterialExtra)6 MaterialProjectEditorVO (com.bc.pmpheep.back.vo.MaterialProjectEditorVO)6 Message (com.bc.pmpheep.general.po.Message)6 WebScocketMessage (com.bc.pmpheep.websocket.WebScocketMessage)6 BufferedOutputStream (java.io.BufferedOutputStream)6 OutputStream (java.io.OutputStream)6 UnsupportedEncodingException (java.io.UnsupportedEncodingException)6 Workbook (org.apache.poi.ss.usermodel.Workbook)6