use of com.bc.pmpheep.back.bo.DeclarationEtcBO in project pmph by BCSquad.
the class WordHelper method fromDeclarationEtcBOList.
/**
* 从一个或多个专家信息对象中读取数据,转化成若干Word文档
*
* @param materialName
* 教材名称
* @param list
* DeclarationEtcBO实例集合
* @param filter
* 使用可填项的二进制选中
* @param extensions
* 教材扩展项
* @return 包含文档名称和Word格式文档的键值对
* @throws CheckedServiceException
* 已检查的异常
*/
public HashMap<String, XWPFDocument> fromDeclarationEtcBOList(String materialName, List<DeclarationEtcBO> list, String filter, List<MaterialExtension> extensions) throws CheckedServiceException {
InputStream is;
XWPFDocument document;
String path = this.getClass().getClassLoader().getResource("ResumeTemplate.docx").getPath();
HashMap<String, XWPFDocument> map = new HashMap<>(list.size());
for (DeclarationEtcBO bo : list) {
try {
is = new FileInputStream(path);
document = new XWPFDocument(is);
} catch (IOException ex) {
logger.error("读取Word模板文件'ResumeTemplate.docx'时出现错误:{}", ex.getMessage());
throw new CheckedServiceException(CheckedExceptionBusiness.MATERIAL, CheckedExceptionResult.FILE_CREATION_FAILED, "未找到模板文件");
}
if (StringUtil.notEmpty(materialName)) {
List<XWPFRun> runs = document.getParagraphs().get(0).getRuns();
runs.get(0).setText(materialName.concat("申报表"), 0);
}
List<XWPFParagraph> xwpfParagraphs = document.getParagraphs();
List<XWPFTable> tables = document.getTables();
int i = 21;
XWPFTable old = tables.get(19);
for (MaterialExtension extension : extensions) {
XmlCursor cursor = xwpfParagraphs.get(i).getCTP().newCursor();
// ---这个是关键
XWPFParagraph xwpfParagraph = document.insertNewParagraph(cursor);
CTPPr pPPr = xwpfParagraph.getCTP().getPPr() != null ? xwpfParagraph.getCTP().getPPr() : xwpfParagraph.getCTP().addNewPPr();
CTSpacing pSpacing = pPPr.getSpacing() != null ? pPPr.getSpacing() : pPPr.addNewSpacing();
pSpacing.setLine(BigInteger.valueOf(360L));
pSpacing.setBeforeLines(BigInteger.valueOf(100L));
XWPFRun xwpfRun = xwpfParagraph.createRun();
xwpfRun.setText(extension.getExtensionName());
xwpfRun.setFontSize(12);
xwpfRun.setFontFamily("宋体");
xwpfRun.setBold(true);
/* 以下填充扩展项内容 */
cursor = xwpfParagraphs.get(i + 1).getCTP().newCursor();
XWPFTable t = document.insertNewTbl(cursor);
XWPFTableRow row = t.getRow(0);
XWPFTableCell cell = row.getCell(0);
CTTc cttc = cell.getCTTc();
CTTcPr tcpr = cttc.addNewTcPr();
CTTblWidth tcw = tcpr.addNewTcW();
tcw.setType(old.getRow(0).getCell(0).getCTTc().getTcPr().getTcW().getType());
tcw.setW(old.getRow(0).getCell(0).getCTTc().getTcPr().getTcW().getW());
if (old.getRow(0).getCell(0).getCTTc().getTcPr().getGridSpan() != null) {
tcpr.setGridSpan(old.getRow(0).getCell(0).getCTTc().getTcPr().getGridSpan());
}
if (!bo.getDecExtensionVOs().isEmpty()) {
for (DecExtensionVO decExtensionVO : bo.getDecExtensionVOs()) {
if (extension.getId().equals(decExtensionVO.getExtensionId())) {
String content = decExtensionVO.getContent();
if (StringUtil.notEmpty(content)) {
XWPFRun run = cell.getParagraphs().get(0).createRun();
run.setText(content);
}
break;
}
}
}
i++;
}
/* 申报单位 */
String chosenOrgName = bo.getChosenOrgName();
if (StringUtil.notEmpty(chosenOrgName)) {
xwpfParagraphs.get(i).createRun().setText(chosenOrgName);
}
String filename = generateFileName(bo);
fillDeclarationPosition(tables.get(0), bo);
fillDeclarationData(tables.get(1), bo);
fillDecEduExpData(tables.get(2), bo.getDecEduExps());
fillDecWorkExpData(tables.get(3), bo.getDecWorkExps());
fillDecTeachExpData(tables.get(4), bo.getDecTeachExps());
fillDecAchievementData(tables.get(5), bo.getDecAchievement());
fillDecAcadeData(tables.get(6), bo.getDecAcades());
fillDecLastPositionData(tables.get(7), bo.getDecLastPositions());
fillDecNationalPlanData(tables.get(8), bo.getDecNationalPlans());
fillDecTextbookPmphData(tables.get(9), bo.getDecTextbookPmphs());
fillDecTextbookData(tables.get(10), bo.getDecTextbooks());
fillDecMoocDigitalData(tables.get(11), bo.getDecMoocDigital());
fillDecCourseConstructionData(tables.get(12), bo.getDecCourseConstructions());
fillDecResearchData(tables.get(13), bo.getDecResearchs());
fillDecMonographData(tables.get(14), bo.getDecMonographs());
fillDecPublishRewardData(tables.get(15), bo.getPublishRewards());
fillDecSciData(tables.get(16), bo.getDecScis());
fillDecClinicalRewardData(tables.get(17), bo.getDecClinicalRewards());
fillDecAcadeRewardData(tables.get(18), bo.getDecAcadeRewards());
fillDecIntentionData(tables.get(19), bo.getDecIntention());
map.put(filename, removeEmptyTables(document, filter));
map.put(filename, document);
}
return map;
}
use of com.bc.pmpheep.back.bo.DeclarationEtcBO in project pmph by BCSquad.
the class DeclarationServiceImpl method getDeclarationEtcBOs.
@Override
public List<DeclarationEtcBO> getDeclarationEtcBOs(Long materialId) {
List<DeclarationEtcBO> declarationEtcBOs = new ArrayList<>(20);
List<Declaration> declarations = declarationDao.getDeclarationByMaterialId(materialId);
if (CollectionUtil.isEmpty(declarations)) {
return null;
}
int count = 1;
for (Declaration declaration : declarations) {
// 学习经历
ArrayList<DecEduExp> decEduExps = (ArrayList<DecEduExp>) decEduExpDao.getListDecEduExpByDeclarationId(declaration.getId());
// 工作经历
ArrayList<DecWorkExp> decWorkExps = (ArrayList<DecWorkExp>) decWorkExpDao.getListDecWorkExpByDeclarationId(declaration.getId());
// 教学经历
ArrayList<DecTeachExp> decTeachExps = (ArrayList<DecTeachExp>) decTeachExpDao.getListDecTeachExpByDeclarationId(declaration.getId());
// 兼职学术
ArrayList<DecAcade> decAcades = (ArrayList<DecAcade>) decAcadeDao.getListDecAcadeByDeclarationId(declaration.getId());
// 上套教材
ArrayList<DecLastPosition> decLastPositions = (ArrayList<DecLastPosition>) decLastPositionDao.getListDecLastPositionByDeclarationId(declaration.getId());
// 精品课程建设情况
ArrayList<DecCourseConstruction> decCourseConstructions = (ArrayList<DecCourseConstruction>) decCourseConstructionDao.getDecCourseConstructionByDeclarationId(declaration.getId());
// 主编国家级规划
ArrayList<DecNationalPlan> decNationalPlans = (ArrayList<DecNationalPlan>) decNationalPlanDao.getListDecNationalPlanByDeclarationId(declaration.getId());
// 教材编写
ArrayList<DecTextbook> decTextbooks = (ArrayList<DecTextbook>) decTextbookDao.getListDecTextbookByDeclarationId(declaration.getId());
// 作家科研
ArrayList<DecResearch> decResearchs = (ArrayList<DecResearch>) decResearchDao.getListDecResearchByDeclarationId(declaration.getId());
/*
* ArrayList<DecAchievement> decAchievements = (ArrayList<DecAchievement>)
* decAchievementDao .getDecAchievementByDeclarationId(declaration.getId());
*/
DeclarationEtcBO declarationEtcBO = new DeclarationEtcBO();
declarationEtcBO.setRealname("欧阳望月".concat(String.valueOf(count)));
declarationEtcBO.setUsername("Smith");
// declarationEtcBO.setTextbookName("人体解剖学与组织胚胎学");
// declarationEtcBO.setPresetPosition("副主编");
declarationEtcBO.setChosenOrgName("人民卫生出版社");
declarationEtcBO.setSex("女");
declarationEtcBO.setBirthday("1975年11月22日");
declarationEtcBO.setAddress("浙江省金华市婺城区婺州街1188号");
declarationEtcBO.setExperience(23);
declarationEtcBO.setOrgName("金华职业技术学院医学院");
declarationEtcBO.setPosition("教师");
declarationEtcBO.setTitle("教授");
declarationEtcBO.setPostcode("321017");
declarationEtcBO.setHandphone("13857989881");
declarationEtcBO.setEmail("test10001test@163.com");
declarationEtcBO.setFax("01065930013");
declarationEtcBO.setTelephone("010-65930013");
declarationEtcBO.setDecEduExps(decEduExps);
declarationEtcBO.setDecWorkExps(decWorkExps);
declarationEtcBO.setDecTeachExps(decTeachExps);
declarationEtcBO.setDecAcades(decAcades);
declarationEtcBO.setDecLastPositions(decLastPositions);
declarationEtcBO.setDecCourseConstructions(decCourseConstructions);
declarationEtcBO.setDecNationalPlans(decNationalPlans);
declarationEtcBO.setDecTextbooks(decTextbooks);
declarationEtcBO.setDecResearchs(decResearchs);
// declarationEtcBO.setDecAchievement(decAchievements.get(0));
declarationEtcBOs.add(declarationEtcBO);
count++;
if (count > 21) {
break;
}
}
return declarationEtcBOs;
}
use of com.bc.pmpheep.back.bo.DeclarationEtcBO in project pmph by BCSquad.
the class DeclarationServiceImpl method declarationEtcBO.
@Override
public List<DeclarationEtcBO> declarationEtcBO(Long materialId, String textBookids, String realname, String position, String title, String orgName, String unitName, Integer positionType, Integer onlineProgress, Integer offlineProgress) throws CheckedServiceException, IllegalArgumentException, IllegalAccessException {
List<DeclarationEtcBO> declarationEtcBOs = new ArrayList<>();
Gson gson = new Gson();
List<Long> bookIds = gson.fromJson(textBookids, new TypeToken<ArrayList<Long>>() {
}.getType());
List<DeclarationOrDisplayVO> declarationOrDisplayVOs = declarationDao.getDeclarationOrDisplayVOByMaterialId(materialId, bookIds, realname, position, title, orgName, unitName, positionType, onlineProgress, offlineProgress);
List<Long> decIds = new ArrayList<>();
for (DeclarationOrDisplayVO declarationOrDisplayVO : declarationOrDisplayVOs) {
decIds.add(declarationOrDisplayVO.getId());
}
// 学习经历
ArrayList<DecEduExp> decEduExps = (ArrayList<DecEduExp>) decEduExpDao.getListDecEduExpByDeclarationIds(decIds);
// 工作经历
ArrayList<DecWorkExp> decWorkExps = (ArrayList<DecWorkExp>) decWorkExpDao.getListDecWorkExpByDeclarationIds(decIds);
// 教学经历
ArrayList<DecTeachExp> decTeachExps = (ArrayList<DecTeachExp>) decTeachExpDao.getListDecTeachExpByDeclarationIds(decIds);
// 兼职学术
ArrayList<DecAcade> decAcades = (ArrayList<DecAcade>) decAcadeDao.getListDecAcadeByDeclarationIds(decIds);
// 个人成就
ArrayList<DecAchievement> decAchievements = (ArrayList<DecAchievement>) decAchievementDao.getDecAchievementByDeclarationIds(decIds);
// 本套上版教材参编情况
ArrayList<DecLastPosition> decLastPositions = (ArrayList<DecLastPosition>) decLastPositionDao.getListDecLastPositionByDeclarationIds(decIds);
// 精品课程建设情况
ArrayList<DecCourseConstruction> decCourseConstructions = (ArrayList<DecCourseConstruction>) decCourseConstructionDao.getDecCourseConstructionByDeclarationIds(decIds);
// 主编国家级规划
ArrayList<DecNationalPlan> decNationalPlans = (ArrayList<DecNationalPlan>) decNationalPlanDao.getListDecNationalPlanByDeclarationIds(decIds);
// 人卫社教材编写情况表
ArrayList<DecTextbookPmph> decTextbookPmphs = (ArrayList<DecTextbookPmph>) decTextbookPmphDao.getListDecTextbookPmphByDeclarationIds(decIds);
// 其他社教材编写情况
ArrayList<DecTextbook> decTextbooks = (ArrayList<DecTextbook>) decTextbookDao.getListDecTextbookByDeclarationIds(decIds);
// 参加人卫慕课、数字教材编写情况表
ArrayList<DecMoocDigital> decMoocDigitals = (ArrayList<DecMoocDigital>) decMoocDigitalDao.getDecMoocDigitalByDeclarationIds(decIds);
// 作家科研
ArrayList<DecResearch> decResearchs = (ArrayList<DecResearch>) decResearchDao.getListDecResearchByDeclarationIds(decIds);
// 主编学术专著情况
ArrayList<DecMonograph> decMonographList = (ArrayList<DecMonograph>) decMonographDao.getListDecMonographByDeclarationIds(decIds);
// 出版行业获奖情况
ArrayList<DecPublishReward> decPublishRewardList = (ArrayList<DecPublishReward>) decPublishRewardDao.getListDecPublishRewardByDeclarationIds(decIds);
// SCI论文投稿及影响因子情况
ArrayList<DecSci> decSciList = (ArrayList<DecSci>) decSciDao.getListDecSciByDeclarationIds(decIds);
// 临床医学获奖情况
ArrayList<DecClinicalReward> decClinicalRewardList = (ArrayList<DecClinicalReward>) decClinicalRewardDao.getListDecClinicalRewardByDeclarationIds(decIds);
// 学术荣誉授予情况
ArrayList<DecAcadeReward> decAcadeRewardList = (ArrayList<DecAcadeReward>) decAcadeRewardDao.getListDecAcadeRewardByDeclarationIds(decIds);
// 作家扩展项
ArrayList<DecExtensionVO> decExtensionVOs = (ArrayList<DecExtensionVO>) decExtensionDao.getListDecExtensionVOByDeclarationIds(decIds);
// 编写内容意向表
ArrayList<DecIntention> decIntentions = (ArrayList<DecIntention>) decIntentionDao.getDecIntentionByDeclarationIds(decIds);
for (DeclarationOrDisplayVO declarationOrDisplayVO : declarationOrDisplayVOs) {
// 审核进度
String strOnlineProgress = "";
// 纸质表进度
String strOfflineProgress = "";
// 性别
String sex = "";
// 证件类别
String idtype = "";
// 学历
String degree = "";
switch(declarationOrDisplayVO.getIdtype()) {
case 0:
idtype = "身份证";
break;
case 1:
idtype = "护照";
break;
case 2:
idtype = "军官证";
break;
default:
idtype = "出现错误";
break;
}
switch(declarationOrDisplayVO.getDegree()) {
case 0:
degree = "无";
break;
case 1:
degree = "专科";
break;
case 2:
degree = "本科";
break;
case 3:
degree = "硕士";
break;
case 4:
degree = "博士";
break;
default:
degree = "出现错误";
break;
}
switch(declarationOrDisplayVO.getOnlineProgress()) {
case 0:
strOnlineProgress = "未提交";
break;
case 1:
strOnlineProgress = "已提交";
break;
case 2:
strOnlineProgress = "被退回";
break;
case 3:
strOnlineProgress = "已通过";
break;
default:
strOnlineProgress = "出现错误";
break;
}
switch(declarationOrDisplayVO.getSex()) {
case 0:
sex = "保密";
break;
case 1:
sex = "男";
break;
case 2:
sex = "女";
break;
default:
sex = "出现错误";
break;
}
switch(declarationOrDisplayVO.getOfflineProgress()) {
case 0:
strOfflineProgress = "未收到";
break;
case 1:
strOfflineProgress = "被退回";
break;
case 2:
strOfflineProgress = "已收到";
break;
default:
strOfflineProgress = "出现错误";
break;
}
String birthday = "";
if (null != declarationOrDisplayVO.getBirthday()) {
birthday = DateUtil.date2Str(declarationOrDisplayVO.getBirthday(), "yyyy-MM-dd");
}
if (null == declarationOrDisplayVO.getPosition() || "".equals(declarationOrDisplayVO.getPosition())) {
declarationOrDisplayVO.setPosition("无");
}
if (StringUtil.isEmpty(declarationOrDisplayVO.getTextbookName())) {
declarationOrDisplayVO.setTextbookName("");
}
if (StringUtil.isEmpty(declarationOrDisplayVO.getPresetPosition())) {
declarationOrDisplayVO.setPresetPosition("");
}
// 学习经历
List<DecEduExp> decEduExp = new ArrayList<>();
for (DecEduExp exp : decEduExps) {
if (exp.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decEduExp.add(exp);
}
}
// 工作经历
List<DecWorkExp> decWorkExp = new ArrayList<>();
for (DecWorkExp workExp : decWorkExps) {
if (workExp.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decWorkExp.add(workExp);
}
}
// 教学经历
List<DecTeachExp> decTeachExp = new ArrayList<>();
for (DecTeachExp teachExp : decTeachExps) {
if (teachExp.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decTeachExp.add(teachExp);
}
}
// 兼职学术
List<DecAcade> decAcade = new ArrayList<>();
for (DecAcade acade : decAcades) {
if (acade.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decAcade.add(acade);
}
}
// 个人成就
DecAchievement decAchievement = new DecAchievement();
for (DecAchievement achievement : decAchievements) {
if (achievement.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decAchievement = achievement;
break;
}
}
// 上套教材
List<DecLastPosition> decLastPosition = new ArrayList<>();
for (DecLastPosition lastPosition : decLastPositions) {
if (lastPosition.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decLastPosition.add(lastPosition);
}
}
// 精品课程建设情况
List<DecCourseConstruction> decCourseConstruction = new ArrayList<>();
for (DecCourseConstruction construction : decCourseConstructions) {
if (construction.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decCourseConstruction.add(construction);
}
}
// 主编国家级规划
List<DecNationalPlan> decNationalPlan = new ArrayList<>();
for (DecNationalPlan plan : decNationalPlans) {
if (plan.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decNationalPlan.add(plan);
}
}
// 人卫社教材编写
List<DecTextbookPmph> decTextbookPmph = new ArrayList<>();
for (DecTextbookPmph textbookPmph : decTextbookPmphs) {
if (textbookPmph.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decTextbookPmph.add(textbookPmph);
}
}
// 其他社教材编写
List<DecTextbook> decTextbook = new ArrayList<>();
for (DecTextbook textbook : decTextbooks) {
if (textbook.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decTextbook.add(textbook);
}
}
// 参加人卫慕课、数字教材编写情况表
DecMoocDigital decMoocDigital = new DecMoocDigital();
for (DecMoocDigital moocDigital : decMoocDigitals) {
if (moocDigital.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decMoocDigital = moocDigital;
break;
}
}
// 作家科研
List<DecResearch> decResearch = new ArrayList<>();
for (DecResearch research : decResearchs) {
if (research.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decResearch.add(research);
}
}
// 主编学术专著情况
List<DecMonograph> monographs = new ArrayList<>();
for (DecMonograph monograph : decMonographList) {
if (monograph.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
monographs.add(monograph);
}
}
// 出版行业获奖情况
List<DecPublishReward> publishRewards = new ArrayList<>();
for (DecPublishReward publishReward : decPublishRewardList) {
if (publishReward.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
publishRewards.add(publishReward);
}
}
// SCI论文投稿及影响因子情况
List<DecSci> scis = new ArrayList<>();
for (DecSci sci : decSciList) {
if (sci.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
scis.add(sci);
}
}
// 临床医学获奖情况
List<DecClinicalReward> clinicalRewards = new ArrayList<>();
for (DecClinicalReward clinicalReward : decClinicalRewardList) {
if (clinicalReward.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
clinicalRewards.add(clinicalReward);
}
}
// 学术荣誉授予情况
List<DecAcadeReward> acadeRewards = new ArrayList<>();
for (DecAcadeReward acadeReward : decAcadeRewardList) {
if (acadeReward.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
acadeRewards.add(acadeReward);
}
}
// 编写内容意向表
DecIntention decIntention = new DecIntention();
for (DecIntention intention : decIntentions) {
if (intention.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decIntention = intention;
break;
}
}
// 作家扩展项
List<DecExtensionVO> extensionVOs = new ArrayList<>();
for (DecExtensionVO extensionVO : decExtensionVOs) {
if (extensionVO.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
extensionVOs.add(extensionVO);
}
}
String isDispensed = declarationOrDisplayVO.getIsDispensed() ? "是" : "否";
String isUtec = declarationOrDisplayVO.getIsUtec() ? "是" : "否";
String textbookName = declarationOrDisplayVO.getTextbookName() + "第" + declarationOrDisplayVO.getTextbookRound() + "版";
DeclarationEtcBO declarationEtcBO = new DeclarationEtcBO(declarationOrDisplayVO.getRealname(), declarationOrDisplayVO.getUsername(), sex, birthday, declarationOrDisplayVO.getExperience(), declarationOrDisplayVO.getOrgName(), declarationOrDisplayVO.getPosition(), declarationOrDisplayVO.getTitle(), declarationOrDisplayVO.getAddress(), declarationOrDisplayVO.getPostcode(), declarationOrDisplayVO.getTelephone(), declarationOrDisplayVO.getFax(), declarationOrDisplayVO.getHandphone(), degree, declarationOrDisplayVO.getEmail(), idtype, declarationOrDisplayVO.getIdcard(), declarationOrDisplayVO.getExpertise(), isDispensed, isUtec, strOnlineProgress, strOfflineProgress, declarationOrDisplayVO.getOrgNameOne(), (ArrayList<DecEduExp>) decEduExp, (ArrayList<DecWorkExp>) decWorkExp, (ArrayList<DecTeachExp>) decTeachExp, decAchievement, (ArrayList<DecAcade>) decAcade, (ArrayList<DecLastPosition>) decLastPosition, (ArrayList<DecCourseConstruction>) decCourseConstruction, (ArrayList<DecNationalPlan>) decNationalPlan, (ArrayList<DecTextbookPmph>) decTextbookPmph, decMoocDigital, (ArrayList<DecTextbook>) decTextbook, (ArrayList<DecResearch>) decResearch, (ArrayList<DecMonograph>) monographs, (ArrayList<DecPublishReward>) publishRewards, (ArrayList<DecSci>) scis, (ArrayList<DecClinicalReward>) clinicalRewards, (ArrayList<DecAcadeReward>) acadeRewards, (ArrayList<DecExtensionVO>) extensionVOs, decIntention);
List<String> list = new ArrayList<>();
list.add(textbookName);
declarationEtcBO.setTextbookName(list);
List<String> presetPosition = new ArrayList<>();
presetPosition.add(declarationOrDisplayVO.getPresetPosition());
declarationEtcBO.setPresetPosition(presetPosition);
declarationEtcBOs.add(declarationEtcBO);
}
return declarationEtcBOs;
}
use of com.bc.pmpheep.back.bo.DeclarationEtcBO in project pmph by BCSquad.
the class DeclarationServiceImpl method getDeclarationOrDisplayVOByIdOrRealname.
@Override
public List<DeclarationEtcBO> getDeclarationOrDisplayVOByIdOrRealname(List<Long> decIds) throws CheckedServiceException, IllegalArgumentException, IllegalAccessException {
List<DeclarationEtcBO> declarationEtcBOs = new ArrayList<>();
List<DeclarationOrDisplayVO> declarationOrDisplayVOs = declarationDao.getDeclarationOrDisplayVOByIdOrRealname(decIds);
// 学习经历
ArrayList<DecEduExp> decEduExps = (ArrayList<DecEduExp>) decEduExpDao.getListDecEduExpByDeclarationIds(decIds);
// 工作经历
ArrayList<DecWorkExp> decWorkExps = (ArrayList<DecWorkExp>) decWorkExpDao.getListDecWorkExpByDeclarationIds(decIds);
// 教学经历
ArrayList<DecTeachExp> decTeachExps = (ArrayList<DecTeachExp>) decTeachExpDao.getListDecTeachExpByDeclarationIds(decIds);
// 兼职学术
ArrayList<DecAcade> decAcades = (ArrayList<DecAcade>) decAcadeDao.getListDecAcadeByDeclarationIds(decIds);
// 个人成就
ArrayList<DecAchievement> decAchievements = (ArrayList<DecAchievement>) decAchievementDao.getDecAchievementByDeclarationIds(decIds);
// 本套上版教材参编情况
ArrayList<DecLastPosition> decLastPositions = (ArrayList<DecLastPosition>) decLastPositionDao.getListDecLastPositionByDeclarationIds(decIds);
// 精品课程建设情况
ArrayList<DecCourseConstruction> decCourseConstructions = (ArrayList<DecCourseConstruction>) decCourseConstructionDao.getDecCourseConstructionByDeclarationIds(decIds);
// 主编国家级规划
ArrayList<DecNationalPlan> decNationalPlans = (ArrayList<DecNationalPlan>) decNationalPlanDao.getListDecNationalPlanByDeclarationIds(decIds);
// 人卫社教材编写情况表
ArrayList<DecTextbookPmph> decTextbookPmphs = (ArrayList<DecTextbookPmph>) decTextbookPmphDao.getListDecTextbookPmphByDeclarationIds(decIds);
// 其他社教材编写情况
ArrayList<DecTextbook> decTextbooks = (ArrayList<DecTextbook>) decTextbookDao.getListDecTextbookByDeclarationIds(decIds);
// 参加人卫慕课、数字教材编写情况表
ArrayList<DecMoocDigital> decMoocDigitals = (ArrayList<DecMoocDigital>) decMoocDigitalDao.getDecMoocDigitalByDeclarationIds(decIds);
// 作家科研
ArrayList<DecResearch> decResearchs = (ArrayList<DecResearch>) decResearchDao.getListDecResearchByDeclarationIds(decIds);
// 主编学术专著情况
ArrayList<DecMonograph> decMonographList = (ArrayList<DecMonograph>) decMonographDao.getListDecMonographByDeclarationIds(decIds);
// 出版行业获奖情况
ArrayList<DecPublishReward> decPublishRewardList = (ArrayList<DecPublishReward>) decPublishRewardDao.getListDecPublishRewardByDeclarationIds(decIds);
// SCI论文投稿及影响因子情况
ArrayList<DecSci> decSciList = (ArrayList<DecSci>) decSciDao.getListDecSciByDeclarationIds(decIds);
// 临床医学获奖情况
ArrayList<DecClinicalReward> decClinicalRewardList = (ArrayList<DecClinicalReward>) decClinicalRewardDao.getListDecClinicalRewardByDeclarationIds(decIds);
// 学术荣誉授予情况
ArrayList<DecAcadeReward> decAcadeRewardList = (ArrayList<DecAcadeReward>) decAcadeRewardDao.getListDecAcadeRewardByDeclarationIds(decIds);
// 作家扩展项
ArrayList<DecExtensionVO> decExtensionVOs = (ArrayList<DecExtensionVO>) decExtensionDao.getListDecExtensionVOByDeclarationIds(decIds);
// 编写内容意向表
ArrayList<DecIntention> decIntentions = (ArrayList<DecIntention>) decIntentionDao.getDecIntentionByDeclarationIds(decIds);
// materialExtensionService.getMaterialExtensionByMaterialId(materialId);
for (DeclarationOrDisplayVO declarationOrDisplayVO : declarationOrDisplayVOs) {
// 审核进度
String strOnlineProgress = "";
// 纸质表进度
String strOfflineProgress = "";
// 性别
String sex = "";
// 证件类别
String idtype = "";
// 学历
String degree = "";
switch(declarationOrDisplayVO.getIdtype()) {
case 0:
idtype = "身份证";
break;
case 1:
idtype = "护照";
break;
case 2:
idtype = "军官证";
break;
default:
idtype = "出现错误";
break;
}
switch(declarationOrDisplayVO.getDegree()) {
case 0:
degree = "无";
break;
case 1:
degree = "专科";
break;
case 2:
degree = "本科";
break;
case 3:
degree = "硕士";
break;
case 4:
degree = "博士";
break;
default:
degree = "出现错误";
break;
}
switch(declarationOrDisplayVO.getOnlineProgress()) {
case 0:
strOnlineProgress = "未提交";
break;
case 1:
strOnlineProgress = "已提交";
break;
case 2:
strOnlineProgress = "被退回";
break;
case 3:
strOnlineProgress = "已通过";
break;
default:
strOnlineProgress = "出现错误";
break;
}
switch(declarationOrDisplayVO.getSex()) {
case 0:
sex = "保密";
break;
case 1:
sex = "男";
break;
case 2:
sex = "女";
break;
default:
sex = "出现错误";
break;
}
switch(declarationOrDisplayVO.getOfflineProgress()) {
case 0:
strOfflineProgress = "未收到";
break;
case 1:
strOfflineProgress = "被退回";
break;
case 2:
strOfflineProgress = "已收到";
break;
default:
strOfflineProgress = "出现错误";
break;
}
String birthday = "";
if (null != declarationOrDisplayVO.getBirthday()) {
birthday = DateUtil.date2Str(declarationOrDisplayVO.getBirthday(), "yyyy-MM-dd");
}
if (null == declarationOrDisplayVO.getPosition() || "".equals(declarationOrDisplayVO.getPosition())) {
declarationOrDisplayVO.setPosition("无");
}
if (StringUtil.isEmpty(declarationOrDisplayVO.getTextbookName())) {
declarationOrDisplayVO.setTextbookName("");
}
if (StringUtil.isEmpty(declarationOrDisplayVO.getPresetPosition())) {
declarationOrDisplayVO.setPresetPosition("");
}
// 学习经历
List<DecEduExp> decEduExp = new ArrayList<>();
for (DecEduExp exp : decEduExps) {
if (exp.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decEduExp.add(exp);
}
}
// 工作经历
List<DecWorkExp> decWorkExp = new ArrayList<>();
for (DecWorkExp workExp : decWorkExps) {
if (workExp.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decWorkExp.add(workExp);
}
}
// 教学经历
List<DecTeachExp> decTeachExp = new ArrayList<>();
for (DecTeachExp teachExp : decTeachExps) {
if (teachExp.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decTeachExp.add(teachExp);
}
}
// 兼职学术
List<DecAcade> decAcade = new ArrayList<>();
for (DecAcade acade : decAcades) {
if (acade.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decAcade.add(acade);
}
}
// 个人成就
DecAchievement decAchievement = new DecAchievement();
for (DecAchievement achievement : decAchievements) {
if (achievement.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decAchievement = achievement;
break;
}
}
// 上套教材
List<DecLastPosition> decLastPosition = new ArrayList<>();
for (DecLastPosition lastPosition : decLastPositions) {
if (lastPosition.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decLastPosition.add(lastPosition);
}
}
// 精品课程建设情况
List<DecCourseConstruction> decCourseConstruction = new ArrayList<>();
for (DecCourseConstruction construction : decCourseConstructions) {
if (construction.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decCourseConstruction.add(construction);
}
}
// 主编国家级规划
List<DecNationalPlan> decNationalPlan = new ArrayList<>();
for (DecNationalPlan plan : decNationalPlans) {
if (plan.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decNationalPlan.add(plan);
}
}
// 人卫社教材编写
List<DecTextbookPmph> decTextbookPmph = new ArrayList<>();
for (DecTextbookPmph textbookPmph : decTextbookPmphs) {
if (textbookPmph.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decTextbookPmph.add(textbookPmph);
}
}
// 其他社教材编写
List<DecTextbook> decTextbook = new ArrayList<>();
for (DecTextbook textbook : decTextbooks) {
if (textbook.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decTextbook.add(textbook);
}
}
// 参加人卫慕课、数字教材编写情况表
DecMoocDigital decMoocDigital = new DecMoocDigital();
for (DecMoocDigital moocDigital : decMoocDigitals) {
if (moocDigital.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decMoocDigital = moocDigital;
break;
}
}
// 作家科研
List<DecResearch> decResearch = new ArrayList<>();
for (DecResearch research : decResearchs) {
if (research.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decResearch.add(research);
}
}
// 主编学术专著情况
List<DecMonograph> monographs = new ArrayList<>();
for (DecMonograph monograph : decMonographList) {
if (monograph.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
monographs.add(monograph);
}
}
// 出版行业获奖情况
List<DecPublishReward> publishRewards = new ArrayList<>();
for (DecPublishReward publishReward : decPublishRewardList) {
if (publishReward.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
publishRewards.add(publishReward);
}
}
// SCI论文投稿及影响因子情况
List<DecSci> scis = new ArrayList<>();
for (DecSci sci : decSciList) {
if (sci.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
scis.add(sci);
}
}
// 临床医学获奖情况
List<DecClinicalReward> clinicalRewards = new ArrayList<>();
for (DecClinicalReward clinicalReward : decClinicalRewardList) {
if (clinicalReward.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
clinicalRewards.add(clinicalReward);
}
}
// 学术荣誉授予情况
List<DecAcadeReward> acadeRewards = new ArrayList<>();
for (DecAcadeReward acadeReward : decAcadeRewardList) {
if (acadeReward.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
acadeRewards.add(acadeReward);
}
}
// 编写内容意向表
DecIntention decIntention = new DecIntention();
for (DecIntention intention : decIntentions) {
if (intention.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
decIntention = intention;
break;
}
}
// 作家扩展项
List<DecExtensionVO> extensionVOs = new ArrayList<>();
for (DecExtensionVO extensionVO : decExtensionVOs) {
if (extensionVO.getDeclarationId().equals(declarationOrDisplayVO.getId())) {
extensionVOs.add(extensionVO);
}
}
String isDispensed = declarationOrDisplayVO.getIsDispensed() ? "是" : "否";
String isUtec = declarationOrDisplayVO.getIsUtec() ? "是" : "否";
String textbookName = declarationOrDisplayVO.getTextbookName() + "第" + declarationOrDisplayVO.getTextbookRound() + "版";
DeclarationEtcBO declarationEtcBO = new DeclarationEtcBO(declarationOrDisplayVO.getRealname(), declarationOrDisplayVO.getUsername(), sex, birthday, declarationOrDisplayVO.getExperience(), declarationOrDisplayVO.getOrgName(), declarationOrDisplayVO.getPosition(), declarationOrDisplayVO.getTitle(), declarationOrDisplayVO.getAddress(), declarationOrDisplayVO.getPostcode(), declarationOrDisplayVO.getTelephone(), declarationOrDisplayVO.getFax(), declarationOrDisplayVO.getHandphone(), degree, declarationOrDisplayVO.getEmail(), idtype, declarationOrDisplayVO.getIdcard(), declarationOrDisplayVO.getExpertise(), isDispensed, isUtec, strOnlineProgress, strOfflineProgress, declarationOrDisplayVO.getOrgNameOne(), (ArrayList<DecEduExp>) decEduExp, (ArrayList<DecWorkExp>) decWorkExp, (ArrayList<DecTeachExp>) decTeachExp, decAchievement, (ArrayList<DecAcade>) decAcade, (ArrayList<DecLastPosition>) decLastPosition, (ArrayList<DecCourseConstruction>) decCourseConstruction, (ArrayList<DecNationalPlan>) decNationalPlan, (ArrayList<DecTextbookPmph>) decTextbookPmph, decMoocDigital, (ArrayList<DecTextbook>) decTextbook, (ArrayList<DecResearch>) decResearch, (ArrayList<DecMonograph>) monographs, (ArrayList<DecPublishReward>) publishRewards, (ArrayList<DecSci>) scis, (ArrayList<DecClinicalReward>) clinicalRewards, (ArrayList<DecAcadeReward>) acadeRewards, (ArrayList<DecExtensionVO>) extensionVOs, decIntention);
List<String> list = new ArrayList<>();
list.add(textbookName);
declarationEtcBO.setTextbookName(list);
List<String> presetPosition = new ArrayList<>();
presetPosition.add(declarationOrDisplayVO.getPresetPosition());
declarationEtcBO.setPresetPosition(presetPosition);
declarationEtcBO.setMaterialId(declarationOrDisplayVO.getMaterialId());
declarationEtcBOs.add(declarationEtcBO);
}
return declarationEtcBOs;
}
use of com.bc.pmpheep.back.bo.DeclarationEtcBO in project pmph by BCSquad.
the class Front method run.
@Override
public synchronized void run() {
System.out.println("线程开始");
String src = this.getClass().getResource("/").getPath();
src = src.substring(1);
if (!src.endsWith(File.separator)) {
src += File.separator;
}
ZipDownload zipDownload = new ZipDownload();
List<DeclarationEtcBO> declarationEtcBOs = new ArrayList<>();
List<DeclarationOrDisplayVO> declarationOrDisplayVOs = this.declarationService.getDeclarationOrDisplayVOByRealname(this.decIds);
String dest = src + this.id;
zipDownload.setId(this.id);
zipDownload.setState(0);
zipDownload.setMaterialName(declarationOrDisplayVOs.get(0).getOrgNameOne());
zipDownload.setDetail("loading...");
zipDownload.setCreateTime(DateUtil.getCurrentTime());
Const.WORD_EXPORT_MAP.put(this.id, zipDownload);
try {
declarationEtcBOs = this.declarationService.getDeclarationOrDisplayVOByIdOrRealname(this.decIds);
} catch (CheckedServiceException | IllegalArgumentException | IllegalAccessException e) {
logger.warn("数据表格化的时候失败");
}
try {
List<DeclarationEtcBO> list = new ArrayList<>();
for (int i = 0; i < declarationOrDisplayVOs.size(); i++) {
Material material = this.materialService.getMaterialById(declarationOrDisplayVOs.get(i).getMaterialId());
StringBuilder str = new StringBuilder();
str.append(material.getIsEduExpUsed() ? "1" : "0");
str.append(material.getIsWorkExpUsed() ? "1" : "0");
str.append(material.getIsTeachExpUsed() ? "1" : "0");
str.append(material.getIsAchievementUsed() ? "1" : "0");
str.append(material.getIsAcadeUsed() ? "1" : "0");
str.append(material.getIsLastPositionUsed() ? "1" : "0");
str.append(material.getIsNationalPlanUsed() ? "1" : "0");
str.append(material.getIsPmphTextbookUsed() ? "1" : "0");
str.append(material.getIsTextbookUsed() ? "1" : "0");
str.append(material.getIsMoocDigitalUsed() ? "1" : "0");
str.append(material.getIsCourseUsed() ? "1" : "0");
str.append(material.getIsResearchUsed() ? "1" : "0");
str.append(material.getIsMonographUsed() ? "1" : "0");
str.append(material.getIsPublishRewardUsed() ? "1" : "0");
str.append(material.getIsSciUsed() ? "1" : "0");
str.append(material.getIsClinicalRewardUsed() ? "1" : "0");
str.append(material.getIsAcadeRewardUsed() ? "1" : "0");
str.append(material.getIsIntentionUsed() ? "1" : "0");
Integer filter = Integer.parseInt(str.toString(), 2);
List<Textbook> textbooks = this.textbookService.getTextbookByMaterialId(material.getId());
String name = declarationOrDisplayVOs.get(i).getRealname() + "-" + material.getMaterialName();
for (DeclarationEtcBO declarationEtcBO : declarationEtcBOs) {
for (DeclarationEtcBO etcBO : declarationEtcBOs) {
if (declarationEtcBO.getRealname().equals(etcBO.getRealname()) && !declarationEtcBO.getTextbookName().contains(etcBO.getTextbookName().get(0))) {
declarationEtcBO.getTextbookName().add(etcBO.getTextbookName().get(0));
declarationEtcBO.getPresetPosition().add(etcBO.getPresetPosition().get(0));
}
}
if (declarationOrDisplayVOs.get(i).getRealname().equals(declarationEtcBO.getRealname())) {
list.add(declarationEtcBO);
}
}
if (!CollectionUtil.isEmpty(list)) {
StringBuilder sb = new StringBuilder();
sb.append(src);
sb.append(this.id);
sb.append(File.separator);
sb.append(declarationOrDisplayVOs.get(i).getOrgNameOne());
sb.append(File.separator);
sb.append(name);
sb.append(File.separator);
this.wordHelper.export(material.getMaterialName(), sb.toString(), list, str.toString(), this.materialExtensionService.getMaterialExtensionByMaterialId(material.getId()));
list.removeAll(list);
}
}
} catch (Exception e) {
e.printStackTrace();
}
new Thread(zipDownload).start();
try {
this.zipHelper.zip(dest + File.separator + declarationOrDisplayVOs.get(0).getOrgNameOne(), dest + File.separator, true, null);
} catch (Exception e) {
e.getMessage();
}
zipDownload.setState(1);
zipDownload.setDetail("/zip/download?id=" + this.id);
Const.WORD_EXPORT_MAP.put(this.id, zipDownload);
}
Aggregations