use of com.bc.pmpheep.back.bo.DeclarationEtcBO in project pmph by BCSquad.
the class SpringThread 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();
Material material = this.materialService.getMaterialById(this.materialId);
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(this.materialId);
List<DeclarationEtcBO> declarationEtcBOs = new ArrayList<>();
String dest = src + this.id;
zipDownload.setId(this.id);
zipDownload.setMaterialName(material.getMaterialName());
zipDownload.setState(0);
zipDownload.setDetail("loading...");
zipDownload.setCreateTime(DateUtil.getCurrentTime());
Const.WORD_EXPORT_MAP.put(this.id, zipDownload);
try {
declarationEtcBOs = this.declarationService.declarationEtcBO(this.materialId, this.textBookids, this.realname, this.position, this.title, this.orgName, this.unitName, this.positionType, this.onlineProgress, this.offlineProgress);
} catch (CheckedServiceException | IllegalArgumentException | IllegalAccessException e) {
logger.warn("数据表格化的时候失败");
}
try {
List<DeclarationEtcBO> list = new ArrayList<>();
for (int i = 0; i < textbooks.size(); i++) {
String textbookName = textbooks.get(i).getTextbookName() + "第" + textbooks.get(i).getTextbookRound() + "版";
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 (textbookName.equals(declarationEtcBO.getTextbookName().get(0))) {
list.add(declarationEtcBO);
}
}
if (!CollectionUtil.isEmpty(list)) {
StringBuilder sb = new StringBuilder();
sb.append(src);
sb.append(this.id);
sb.append(File.separator);
sb.append(material.getMaterialName());
sb.append(File.separator);
sb.append((i + 1) + "." + textbookName);
sb.append(File.separator);
this.wordHelper.export(material.getMaterialName(), sb.toString(), list, str.toString(), this.materialExtensionService.getMaterialExtensionByMaterialId(this.materialId));
list.removeAll(list);
}
}
} catch (Exception e) {
e.printStackTrace();
}
new Thread(zipDownload).start();
try {
this.zipHelper.zip(dest + File.separator + material.getMaterialName(), 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);
}
use of com.bc.pmpheep.back.bo.DeclarationEtcBO in project pmph by BCSquad.
the class WordHelperTest method test.
@Test
@Ignore
public void test() throws CheckedServiceException, IllegalArgumentException, IllegalAccessException {
List<DeclarationEtcBO> list = declarationService.declarationEtcBO(2L, null, null, null, null, null, null, null, null, null);
Material material = materialService.getMaterialById(2L);
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");
String src = this.getClass().getResource("/").getPath();
src = src.substring(1);
if (!src.endsWith(File.separator)) {
src += File.separator;
}
wordHelper.export("测试", src, list, str.toString(), materialExtensionService.getMaterialExtensionByMaterialId(2L));
}
Aggregations