|
@@ -5,6 +5,7 @@ import cn.afterturn.easypoi.excel.entity.ImportParams;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.koobietech.eas.common.constant.FileType;
|
|
import com.koobietech.eas.common.constant.FileType;
|
|
import com.koobietech.eas.common.constant.Gender;
|
|
import com.koobietech.eas.common.constant.Gender;
|
|
|
|
+import com.koobietech.eas.common.constant.UniversityCode;
|
|
import com.koobietech.eas.common.exception.EasException;
|
|
import com.koobietech.eas.common.exception.EasException;
|
|
import com.koobietech.eas.common.utils.ArchiveManager;
|
|
import com.koobietech.eas.common.utils.ArchiveManager;
|
|
import com.koobietech.eas.common.utils.DateManager;
|
|
import com.koobietech.eas.common.utils.DateManager;
|
|
@@ -26,6 +27,8 @@ import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
|
import org.apache.poi.xwpf.usermodel.XWPFTable;
|
|
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
|
import org.apache.poi.xwpf.usermodel.XWPFTableCell;
|
|
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
|
|
import org.apache.poi.xwpf.usermodel.XWPFTableRow;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
import org.springframework.security.crypto.password.PasswordEncoder;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -39,6 +42,8 @@ import java.util.*;
|
|
@Service
|
|
@Service
|
|
public class EasStuProfileServiceImpl implements EasStuProfileService {
|
|
public class EasStuProfileServiceImpl implements EasStuProfileService {
|
|
|
|
|
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(EasStuProfileServiceImpl.class);
|
|
|
|
+
|
|
private static final String TEMPLATE_PATH = "temp/StuRegistTemp.docx";
|
|
private static final String TEMPLATE_PATH = "temp/StuRegistTemp.docx";
|
|
private static final String PHOTO_PATH = "temp/kun.jpeg";
|
|
private static final String PHOTO_PATH = "temp/kun.jpeg";
|
|
@Resource
|
|
@Resource
|
|
@@ -84,7 +89,8 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
|
|
|
|
|
|
}
|
|
}
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
- return false;
|
|
|
|
|
|
+ logger.error(e.getMessage());
|
|
|
|
+ throw new EasException("生成档案失败", 8003);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
@@ -153,12 +159,14 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
} catch (Exception ignored){
|
|
} catch (Exception ignored){
|
|
- ignored.printStackTrace();
|
|
|
|
|
|
+ logger.error(ignored.getMessage());
|
|
} finally {
|
|
} finally {
|
|
if (inputStream != null) {
|
|
if (inputStream != null) {
|
|
try {
|
|
try {
|
|
inputStream.close();
|
|
inputStream.close();
|
|
- } catch (IOException ignored) {}
|
|
|
|
|
|
+ } catch (IOException ignored) {
|
|
|
|
+ logger.error(ignored.getMessage());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return false;
|
|
return false;
|
|
@@ -185,8 +193,6 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
|
|
|
|
|
|
// 保存学员档案文件
|
|
// 保存学员档案文件
|
|
ArchivesDto archivesDto = easArchivesFilesService.saveArchiveStudentsFile(easArcTlsStudents.getStudentIdnumber(), doc);
|
|
ArchivesDto archivesDto = easArchivesFilesService.saveArchiveStudentsFile(easArcTlsStudents.getStudentIdnumber(), doc);
|
|
- String filePath = archivesDto.getPath();
|
|
|
|
- String arcType = archivesDto.getFileType();
|
|
|
|
|
|
|
|
// 设置时间和有效期
|
|
// 设置时间和有效期
|
|
Date createTime = DateManager.convertToYearMonthDayToDate(new Date());
|
|
Date createTime = DateManager.convertToYearMonthDayToDate(new Date());
|
|
@@ -201,8 +207,8 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
|
|
EasArcArchives easArcArchives = new EasArcArchives();
|
|
EasArcArchives easArcArchives = new EasArcArchives();
|
|
easArcArchives.setArchiveNumber(archiveCode);
|
|
easArcArchives.setArchiveNumber(archiveCode);
|
|
easArcArchives.setStudentNumber(easArcTlsStudents.getStudentNumber());
|
|
easArcArchives.setStudentNumber(easArcTlsStudents.getStudentNumber());
|
|
- easArcArchives.setFilePath(filePath);
|
|
|
|
- easArcArchives.setArctype(arcType);
|
|
|
|
|
|
+ easArcArchives.setFilePath(archivesDto.getPath());
|
|
|
|
+ easArcArchives.setArctype(archivesDto.getFileType());
|
|
easArcArchives.setCreateTime(createTime);
|
|
easArcArchives.setCreateTime(createTime);
|
|
easArcArchives.setModifyTime(modifyTime);
|
|
easArcArchives.setModifyTime(modifyTime);
|
|
easArcArchives.setValidityTime(validityTime);
|
|
easArcArchives.setValidityTime(validityTime);
|
|
@@ -239,7 +245,7 @@ public class EasStuProfileServiceImpl implements EasStuProfileService {
|
|
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
|
String year = String.valueOf(calendar.get(Calendar.YEAR));
|
|
|
|
|
|
return ArchiveManager.generateStudentCode("",
|
|
return ArchiveManager.generateStudentCode("",
|
|
- easArcTlsStudents.getStudentIdnumber(), easArcTlsStudents.getUniversity(), year);
|
|
|
|
|
|
+ easArcTlsStudents.getStudentIdnumber(), String.valueOf(UniversityCode.getCode(easArcTlsStudents.getUniversity().trim())), year);
|
|
}
|
|
}
|
|
|
|
|
|
private String convertToGender(String gender) {
|
|
private String convertToGender(String gender) {
|