|
@@ -7,20 +7,29 @@
|
|
|
|
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit;
|
|
package cn.com.qmth.examcloud.core.oe.admin.service.bean.examaudit;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.AuditStatus;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
|
|
|
|
-import cn.com.qmth.examcloud.core.oe.admin.dao.enums.IsSuccess;
|
|
|
|
-import com.google.common.collect.Lists;
|
|
|
|
-import com.mysql.cj.util.StringUtils;
|
|
|
|
-import org.apache.commons.beanutils.BeanUtils;
|
|
|
|
-import org.springframework.data.domain.Page;
|
|
|
|
-
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
+import org.apache.commons.beanutils.BeanUtils;
|
|
|
|
+import org.apache.commons.beanutils.ConvertUtils;
|
|
|
|
+import org.apache.commons.beanutils.converters.BigDecimalConverter;
|
|
|
|
+import org.apache.commons.beanutils.converters.DoubleConverter;
|
|
|
|
+import org.apache.commons.beanutils.converters.IntegerConverter;
|
|
|
|
+import org.apache.commons.beanutils.converters.LongConverter;
|
|
|
|
+import org.apache.commons.beanutils.converters.ShortConverter;
|
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
|
+
|
|
|
|
+import com.google.common.collect.Lists;
|
|
|
|
+import com.mysql.cj.util.StringUtils;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.AuditStatus;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.CourseLevel;
|
|
|
|
+import cn.com.qmth.examcloud.core.oe.admin.dao.enums.IsSuccess;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 类信息转换
|
|
* 类信息转换
|
|
*
|
|
*
|
|
@@ -28,72 +37,83 @@ import java.util.Map;
|
|
* @since: 2018/8/21
|
|
* @since: 2018/8/21
|
|
*/
|
|
*/
|
|
public class ExamAuditEntityConvert {
|
|
public class ExamAuditEntityConvert {
|
|
|
|
+ static {
|
|
|
|
+ ConvertUtils.register(new LongConverter(null), Long.class);
|
|
|
|
+ ConvertUtils.register(new ShortConverter(null), Short.class);
|
|
|
|
+ ConvertUtils.register(new IntegerConverter(null), Integer.class);
|
|
|
|
+ ConvertUtils.register(new DoubleConverter(null), Double.class);
|
|
|
|
+ ConvertUtils.register(new BigDecimalConverter(null), BigDecimal.class);
|
|
|
|
+ }
|
|
|
|
|
|
- public static List<ExamAuditInfo> of(List<HashMap> maps) {
|
|
|
|
- if (maps == null || maps.size() == 0) {
|
|
|
|
- return Lists.newArrayList();
|
|
|
|
- }
|
|
|
|
- List<ExamAuditInfo> list = new ArrayList<>();
|
|
|
|
- for (Map map : maps) {
|
|
|
|
- try {
|
|
|
|
- //转换Map数据
|
|
|
|
- ExamAuditInfo info = new ExamAuditInfo();
|
|
|
|
- BeanUtils.populate(info, map);
|
|
|
|
- //转换枚举名称
|
|
|
|
- info.setCourseLevel(CourseLevel.getCourseLevelTitle(info.getCourseLevel()));
|
|
|
|
- info.setStatus(AuditStatus.getTitle(info.getStatus()));
|
|
|
|
- IsSuccess result = IsSuccess.strToEnum(info.getFaceVerifyResult());
|
|
|
|
- if (result != null) {
|
|
|
|
- info.setFaceVerifyResult(result.getDesc());
|
|
|
|
- }
|
|
|
|
|
|
+ public static List<ExamAuditInfo> of(List<HashMap> maps) {
|
|
|
|
+ if (maps == null || maps.size() == 0) {
|
|
|
|
+ return Lists.newArrayList();
|
|
|
|
+ }
|
|
|
|
+ List<ExamAuditInfo> list = new ArrayList<>();
|
|
|
|
+ for (Map map : maps) {
|
|
|
|
+ try {
|
|
|
|
+ // 转换Map数据
|
|
|
|
+ ExamAuditInfo info = new ExamAuditInfo();
|
|
|
|
+ BeanUtils.populate(info, map);
|
|
|
|
+ // 转换枚举名称
|
|
|
|
+ info.setCourseLevel(CourseLevel.getCourseLevelTitle(info.getCourseLevel()));
|
|
|
|
+ info.setStatus(AuditStatus.getTitle(info.getStatus()));
|
|
|
|
+ IsSuccess result = IsSuccess.strToEnum(info.getFaceVerifyResult());
|
|
|
|
+ if (result != null) {
|
|
|
|
+ info.setFaceVerifyResult(result.getDesc());
|
|
|
|
+ }
|
|
|
|
|
|
- // DisciplineType disciplineType = DisciplineType.tramsformByType(info.getDisciplineType());
|
|
|
|
- // if (disciplineType != null) {
|
|
|
|
- // info.setDisciplineType(disciplineType.getName());
|
|
|
|
- // }
|
|
|
|
|
|
+ // DisciplineType disciplineType =
|
|
|
|
+ // DisciplineType.tramsformByType(info.getDisciplineType());
|
|
|
|
+ // if (disciplineType != null) {
|
|
|
|
+ // info.setDisciplineType(disciplineType.getName());
|
|
|
|
+ // }
|
|
|
|
|
|
- list.add(info);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- throw new ExamCloudRuntimeException(e.getMessage(), e.getCause());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return list;
|
|
|
|
- }
|
|
|
|
|
|
+ list.add(info);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new ExamCloudRuntimeException(e.getMessage(), e.getCause());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
|
|
- public static List<ExamAuditExcel> ofExcel(Page<ExamAuditInfo> page) {
|
|
|
|
- List<ExamAuditExcel> list = new ArrayList<>();
|
|
|
|
- if (page == null || page.getContent() == null) {
|
|
|
|
- return list;
|
|
|
|
- }
|
|
|
|
- page.getContent().forEach(e -> {
|
|
|
|
- ExamAuditExcel excel = new ExamAuditExcel();
|
|
|
|
- excel.setExamRecordDataId(e.getExamRecordDataId());
|
|
|
|
- /*DisciplineType disciplineType = DisciplineType.tramsformByType(e.getDisciplineType());
|
|
|
|
- if(disciplineType!=null){
|
|
|
|
- excel.setDisciplineType(disciplineType.getName());
|
|
|
|
- }*/
|
|
|
|
- excel.setOrgName(e.getOrgName());
|
|
|
|
- excel.setDisciplineType(e.getDisciplineType());
|
|
|
|
- excel.setExamName(e.getExamName());
|
|
|
|
- excel.setStudentCode(e.getStudentCode());
|
|
|
|
- excel.setStudentName(e.getStudentName());
|
|
|
|
- excel.setCourseCode(e.getCourseCode());
|
|
|
|
- excel.setCourseName(e.getCourseName());
|
|
|
|
- excel.setCourseLevel(e.getCourseLevel());
|
|
|
|
- excel.setFaceSuccessCount(e.getFaceSuccessCount());
|
|
|
|
- excel.setFaceStrangerCount(e.getFaceStrangerCount());
|
|
|
|
- excel.setFaceTotalCount(e.getFaceTotalCount());
|
|
|
|
- excel.setFaceSuccessPercent(e.getFaceSuccessPercent());
|
|
|
|
- if (!StringUtils.isNullOrEmpty(e.getDisciplineDetail()) && e.getDisciplineDetail().indexOf("&&") != -1) {
|
|
|
|
- excel.setDisciplineDetail(e.getDisciplineDetail().replace("&&", "\r\n"));
|
|
|
|
- } else {
|
|
|
|
- excel.setDisciplineDetail(e.getDisciplineDetail());
|
|
|
|
- }
|
|
|
|
- excel.setObjectiveScore(Double.valueOf(e.getObjectiveScore()));
|
|
|
|
- excel.setIp(e.getIp());
|
|
|
|
- list.add(excel);
|
|
|
|
- });
|
|
|
|
- return list;
|
|
|
|
- }
|
|
|
|
|
|
+ public static List<ExamAuditExcel> ofExcel(Page<ExamAuditInfo> page) {
|
|
|
|
+ List<ExamAuditExcel> list = new ArrayList<>();
|
|
|
|
+ if (page == null || page.getContent() == null) {
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
+ page.getContent().forEach(e -> {
|
|
|
|
+ ExamAuditExcel excel = new ExamAuditExcel();
|
|
|
|
+ excel.setExamRecordDataId(e.getExamRecordDataId());
|
|
|
|
+ /*
|
|
|
|
+ * DisciplineType disciplineType =
|
|
|
|
+ * DisciplineType.tramsformByType(e.getDisciplineType());
|
|
|
|
+ * if(disciplineType!=null){ excel.setDisciplineType(disciplineType.getName());
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ excel.setExamStageOrder(e.getExamStageOrder());
|
|
|
|
+ excel.setOrgName(e.getOrgName());
|
|
|
|
+ excel.setDisciplineType(e.getDisciplineType());
|
|
|
|
+ excel.setExamName(e.getExamName());
|
|
|
|
+ excel.setStudentCode(e.getStudentCode());
|
|
|
|
+ excel.setStudentName(e.getStudentName());
|
|
|
|
+ excel.setCourseCode(e.getCourseCode());
|
|
|
|
+ excel.setCourseName(e.getCourseName());
|
|
|
|
+ excel.setCourseLevel(e.getCourseLevel());
|
|
|
|
+ excel.setFaceSuccessCount(e.getFaceSuccessCount());
|
|
|
|
+ excel.setFaceStrangerCount(e.getFaceStrangerCount());
|
|
|
|
+ excel.setFaceTotalCount(e.getFaceTotalCount());
|
|
|
|
+ excel.setFaceSuccessPercent(e.getFaceSuccessPercent());
|
|
|
|
+ if (!StringUtils.isNullOrEmpty(e.getDisciplineDetail()) && e.getDisciplineDetail().indexOf("&&") != -1) {
|
|
|
|
+ excel.setDisciplineDetail(e.getDisciplineDetail().replace("&&", "\r\n"));
|
|
|
|
+ } else {
|
|
|
|
+ excel.setDisciplineDetail(e.getDisciplineDetail());
|
|
|
|
+ }
|
|
|
|
+ excel.setObjectiveScore(Double.valueOf(e.getObjectiveScore()));
|
|
|
|
+ excel.setIp(e.getIp());
|
|
|
|
+ list.add(excel);
|
|
|
|
+ });
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|