java freemarker 图片_Java Web用Freemarker生成带图片的Word文档

@RequestMapping(value = "/exportDoc")public void exportDoc(String resumeId,HttpServletResponse response,HttpServletRequest request) throwsException{

User u=SessionUtils.getUser(request.getSession());

Map dataMap = new HashMap();//要填入模本的数据文件

ResumeBasicInformationQueryParam resumeParam=newResumeBasicInformationQueryParam();

resumeParam.setUuid(resumeId);

WorkExperienceParam workExperienceParam=newWorkExperienceParam();

workExperienceParam.setResumeId(resumeId);

EducationBackgroundParam educationParam=newEducationBackgroundParam();

educationParam.setResumeId(resumeId);

SkillEvaluationParam skillParam=newSkillEvaluationParam();

skillParam.setResumeId(resumeId);

ProjectExperienceParam projectParam=newProjectExperienceParam();

projectParam.setResumeId(resumeId);

LanguageabilityParam languageParam=newLanguageabilityParam();

languageParam.setResumeId(resumeId);

TrainingExperienceParam trainParam=newTrainingExperienceParam();

trainParam.setResumeId(resumeId);//验证导出用户是否可以看到简历姓名

ResumeHandleParam handleParam=newResumeHandleParam();

handleParam.setResumeIds("'"+resumeParam.getUuid()+"'");

handleParam.setCorpId(SessionUtils.getCorpId(request.getSession()));int count = 0;

count=resumeHandleService.checkEnshrine(handleParam);

ResumeBasicInformationResp rbIfonResp= newResumeBasicInformationResp();//查询当前登录用户的简历基本信息

List resumeBasicList =resumeBasicInformationService.getResumeBasic(resumeParam);if(resumeBasicList.size()>0){

rbIfonResp= resumeBasicList.get(0);//性别

if("1".equals(rbIfonResp.getGender())){

rbIfonResp.setGender("男");

}else{

rbIfonResp.setGender("女");

}//婚姻状况

if("1".equals(rbIfonResp.getMaritalStatus())){

rbIfonResp.setGender("已婚");

}else if("2".equals(rbIfonResp.getMaritalStatus())){

rbIfonResp.setGender("未婚");

}else{

rbIfonResp.setGender("保密");

}//姓名、邮箱、电话是否可见

if(count==0){ //没有将该简历放入简历库、没有投递该企业,若简历设置了不可见,则企业看不到

if("1".equals(rbIfonResp.getNamePrivacy()) && rbIfonResp.getName()!=""){

String name= rbIfonResp.getName().substring(0, 1)+" *";

rbIfonResp.setName(name);

}if("1".equals(rbIfonResp.getEmailPrivacy()) && rbIfonResp.getEmail()!=""){int pos = rbIfonResp.getEmail().indexOf("@");

String result=rbIfonResp.getEmail().substring(pos, rbIfonResp.getEmail().length());

rbIfonResp.setEmail("****"+result);

}if("1".equals(rbIfonResp.getTelPrivacy()) && rbIfonResp.getTelephone()!=""){

String telephone= rbIfonResp.getTelephone().substring(0, 3) + "****" + rbIfonResp.getTelephone().substring(7, 11) ;

rbIfonResp.setTelephone(telephone);

}

}

}

dataMap.put("rbIfonResp", rbIfonResp);//dataMap.put("resumeList", resumeBasicList);//工作经历信息

List workExperienceList=workExperienceService.selectWorkExperience(workExperienceParam);

dataMap.put("workExperienceList", workExperienceList);//教育经历信息

List educationList=educationService.selectEducation(educationParam);

dataMap.put("educationList", educationList);//技能评价信息

List skillList=skillService.selectSkillEvaluation(skillParam);

dataMap.put("skillList", skillList);//项目经验信息

List projectList=projectService.selectProject(projectParam);

dataMap.put("projectList", projectList);//语言能力信息

List languageList=languageService.selectLanguage(languageParam);

dataMap.put("languageList", languageList);//培训经历

List trainList=trainingService.selectTrainingExperience(trainParam);

dataMap.put("trainList", trainList);//作品展示

WorkAttachmentParam waParam = newWorkAttachmentParam();

waParam.setResumeId(resumeId);

waParam.setWorkType("1"); //类型:1-作品;2-附件

List workAttachemntList =workAttachmentService.selectWorkAttachment(waParam);//作品路径

String resourceUrl = "";//项目路径

String url = FileManagerUtils.getFilePath(null) + "/";if(workAttachemntList!=null && workAttachemntList.size()>0){for(int i=0;i

resourceUrl= url +workAttachemntList.get(i).getResourceUrl();//先将网络图片下载到本地,再将本地图片转换成BASE64字符串

workAttachemntList.get(i).setResourceUrl(getImageString(resourceUrl));

workAttachemntList.get(i).setIndex(i);

}

}

dataMap.put("workAttachemntList", workAttachemntList);

ExportDoc exportDoc= newExportDoc();

exportDoc.create(dataMap,response);

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值