|
@@ -12,9 +12,6 @@ import com.google.common.collect.Lists;
|
|
|
import com.itextpdf.text.DocumentException;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.excel.BasicClazzImportDto;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.excel.BasicCourseImportDto;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.excel.BasicStudentImportDto;
|
|
|
import com.qmth.distributed.print.business.bean.params.SerialNumberParams;
|
|
|
import com.qmth.distributed.print.business.cache.CreatePdfCacheUtil;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
@@ -24,8 +21,7 @@ import com.qmth.distributed.print.business.templete.service.TaskLogicService;
|
|
|
import com.qmth.distributed.print.business.util.CreatePdfUtil;
|
|
|
import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
|
|
|
import com.qmth.teachcloud.common.annotation.ExcelDBFieldDesc;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.excel.DescribeImportDto;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.excel.SysUserImportDto;
|
|
|
+import com.qmth.teachcloud.common.bean.dto.excel.*;
|
|
|
import com.qmth.teachcloud.common.bean.params.ArraysParams;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicAttachment;
|
|
@@ -1105,7 +1101,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
public Map<String, Object> executeImportBasicStudentLogic(Map<String, Object> map) throws Exception {
|
|
|
InputStream inputStream = (InputStream) map.get("inputStream");
|
|
|
System.out.println(inputStream);
|
|
|
- List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicStudentImportDto.class,DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
+ List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicStudentImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
|
Map<String, String> checkCodeMap = new HashMap<>();
|
|
|
Map<String, String> checkPhoneMap = new HashMap<>();
|
|
@@ -1113,7 +1109,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
|
|
|
List<Object> basicStudentImportDtoList = excelMap.get(i);
|
|
|
assert basicStudentImportDtoList != null;
|
|
|
- if (basicStudentImportDtoList.get(0) instanceof DescribeImportDto){
|
|
|
+ if (basicStudentImportDtoList.get(0) instanceof DescribeImportDto) {
|
|
|
continue;
|
|
|
}
|
|
|
for (int y = 0; y < Objects.requireNonNull(basicStudentImportDtoList).size(); y++) {
|
|
@@ -1131,7 +1127,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
checkCodeMap.put(studentCode, studentName);
|
|
|
}
|
|
|
// 如果电话有值则检验电话excel中唯一性
|
|
|
- if (SystemConstant.strNotNull(phoneNumber)){
|
|
|
+ if (SystemConstant.strNotNull(phoneNumber)) {
|
|
|
if (checkPhoneMap.containsKey(phoneNumber)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("导入的excel中包含在重复的【电话号码】:" + phoneNumber);
|
|
|
} else {
|
|
@@ -1274,14 +1270,14 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
public Map<String, Object> executeImportBasicClazzLogic(Map<String, Object> map) throws Exception {
|
|
|
InputStream inputStream = (InputStream) map.get("inputStream");
|
|
|
System.out.println(inputStream);
|
|
|
- List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicClazzImportDto.class,DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
+ List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicClazzImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
List<ExcelError> excelErrorTemp = new ArrayList<>();
|
|
|
Map<String, String> checkNameMap = new HashMap<>();
|
|
|
for (int i = 0; i < finalExcelList.size(); i++) {
|
|
|
LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
|
|
|
List<Object> basicClazzImportDtoList = excelMap.get(i);
|
|
|
assert basicClazzImportDtoList != null;
|
|
|
- if (basicClazzImportDtoList.get(0) instanceof DescribeImportDto){
|
|
|
+ if (basicClazzImportDtoList.get(0) instanceof DescribeImportDto) {
|
|
|
continue;
|
|
|
}
|
|
|
for (int y = 0; y < Objects.requireNonNull(basicClazzImportDtoList).size(); y++) {
|
|
@@ -1311,6 +1307,29 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
return basicClazzService.executeBasicClazzImportLogic(finalList, map);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 处理命题统计导入数据
|
|
|
+ *
|
|
|
+ * @param map 数据源
|
|
|
+ * @return
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public Map<String, Object> executeImportStatisticsLogic(Map<String, Object> map) throws Exception {
|
|
|
+ InputStream inputStream = (InputStream) map.get("inputStream");
|
|
|
+ List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(StatisticsImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
+ // 只允许导入一个sheet
|
|
|
+ if (finalExcelList.size() > 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("excel中只允许有一个sheet");
|
|
|
+ }
|
|
|
+ if (finalExcelErrorList.size() > 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(JSONObject.toJSONString(finalExcelErrorList));
|
|
|
+ }
|
|
|
+ return finalExcelList;
|
|
|
+ });
|
|
|
+ return map;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
public String createTempNumber(SerialNumberParams serialNumberParams) {
|
|
|
return convertUtil.getIncre(serialNumberParams.getPrefix(), serialNumberParams.getModel(), serialNumberParams.getDigit());
|