|
@@ -3,6 +3,7 @@ package com.keao.edu.user.service.impl;
|
|
import com.keao.edu.auth.api.client.SysUserFeignService;
|
|
import com.keao.edu.auth.api.client.SysUserFeignService;
|
|
import com.keao.edu.auth.api.entity.SysUser;
|
|
import com.keao.edu.auth.api.entity.SysUser;
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
import com.keao.edu.common.dal.BaseDAO;
|
|
|
|
+import com.keao.edu.common.entity.UploadReturnBean;
|
|
import com.keao.edu.common.exception.BizException;
|
|
import com.keao.edu.common.exception.BizException;
|
|
import com.keao.edu.common.page.PageInfo;
|
|
import com.keao.edu.common.page.PageInfo;
|
|
import com.keao.edu.common.page.QueryInfo;
|
|
import com.keao.edu.common.page.QueryInfo;
|
|
@@ -13,24 +14,24 @@ import com.keao.edu.user.dao.ExamSongDao;
|
|
import com.keao.edu.user.dao.SubjectDao;
|
|
import com.keao.edu.user.dao.SubjectDao;
|
|
import com.keao.edu.user.entity.ExamSong;
|
|
import com.keao.edu.user.entity.ExamSong;
|
|
import com.keao.edu.user.entity.Subject;
|
|
import com.keao.edu.user.entity.Subject;
|
|
-import com.keao.edu.user.entity.Teacher;
|
|
|
|
import com.keao.edu.user.enums.SongTypeEnum;
|
|
import com.keao.edu.user.enums.SongTypeEnum;
|
|
-import com.keao.edu.user.enums.TeacherSettlementTypeEnum;
|
|
|
|
import com.keao.edu.user.page.ExamSongQueryInfo;
|
|
import com.keao.edu.user.page.ExamSongQueryInfo;
|
|
import com.keao.edu.user.service.ExamSongService;
|
|
import com.keao.edu.user.service.ExamSongService;
|
|
|
|
+import com.keao.edu.user.service.UploadFileService;
|
|
import com.keao.edu.util.collection.MapUtil;
|
|
import com.keao.edu.util.collection.MapUtil;
|
|
import com.keao.edu.util.excel.POIUtil;
|
|
import com.keao.edu.util.excel.POIUtil;
|
|
import com.keao.edu.util.iniFile.IniFileEntity;
|
|
import com.keao.edu.util.iniFile.IniFileEntity;
|
|
import com.keao.edu.util.iniFile.IniFileUtil;
|
|
import com.keao.edu.util.iniFile.IniFileUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.apache.poi.ss.usermodel.PictureData;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.core.io.ClassPathResource;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
+import java.io.ByteArrayInputStream;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
-import java.math.BigDecimal;
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -44,6 +45,8 @@ public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> impl
|
|
private SysUserFeignService sysUserFeignService;
|
|
private SysUserFeignService sysUserFeignService;
|
|
@Autowired
|
|
@Autowired
|
|
private SubjectDao subjectDao;
|
|
private SubjectDao subjectDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private UploadFileService uploadFileService;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public BaseDAO<Integer, ExamSong> getDAO() {
|
|
public BaseDAO<Integer, ExamSong> getDAO() {
|
|
@@ -142,13 +145,13 @@ public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> impl
|
|
throw new BizException("专业不能为空");
|
|
throw new BizException("专业不能为空");
|
|
}
|
|
}
|
|
String[] subjects = row.get(s).toString().split(",");
|
|
String[] subjects = row.get(s).toString().split(",");
|
|
- String subjectIds = "";
|
|
|
|
|
|
+ StringBuilder subjectIds = new StringBuilder();
|
|
for (String subject : subjects) {
|
|
for (String subject : subjects) {
|
|
boolean has = false;
|
|
boolean has = false;
|
|
for (Subject subSubject : subSubjects) {
|
|
for (Subject subSubject : subSubjects) {
|
|
if (subject.equals(subSubject.getName())) {
|
|
if (subject.equals(subSubject.getName())) {
|
|
has = true;
|
|
has = true;
|
|
- subjectIds = subjectIds + "," + subSubject.getId();
|
|
|
|
|
|
+ subjectIds.append(",").append(subSubject.getId());
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -159,6 +162,22 @@ public class ExamSongServiceImpl extends BaseServiceImpl<Integer, ExamSong> impl
|
|
objectMap.put("subjectList", subjectIds.substring(1));
|
|
objectMap.put("subjectList", subjectIds.substring(1));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ StringBuilder pics = new StringBuilder();
|
|
|
|
+ if (column.getValue().equals("fileUrlList")) {
|
|
|
|
+ List<PictureData> pictureDataList = (ArrayList<PictureData>) row.get(s);
|
|
|
|
+ for (PictureData pictureData : pictureDataList) {
|
|
|
|
+ InputStream in = new ByteArrayInputStream(pictureData.getData());
|
|
|
|
+ UploadReturnBean bean = uploadFileService.uploadFile(in, pictureData.suggestFileExtension());
|
|
|
|
+ if (!bean.isStatus()) {
|
|
|
|
+ throw new BizException(objectMap.get("songName") + bean.getMessage());
|
|
|
|
+ }
|
|
|
|
+ pics.append(",").append(bean.getUrl());
|
|
|
|
+ }
|
|
|
|
+ if (pics.length() > 0) {
|
|
|
|
+ objectMap.put("fileUrlList", pics.substring(1));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (column.getValue().equals("type")) {
|
|
if (column.getValue().equals("type")) {
|
|
for (SongTypeEnum songType : SongTypeEnum.values()) {
|
|
for (SongTypeEnum songType : SongTypeEnum.values()) {
|
|
if (songType.getMsg().equals(row.get(s).toString())) {
|
|
if (songType.getMsg().equals(row.get(s).toString())) {
|