|
@@ -9,7 +9,6 @@ import com.qmth.themis.business.enums.*;
|
|
|
import com.qmth.themis.business.service.*;
|
|
|
import com.qmth.themis.business.util.JacksonUtil;
|
|
|
import com.qmth.themis.business.util.ServletUtil;
|
|
|
-import com.qmth.themis.common.contanst.Constants;
|
|
|
import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
import com.qmth.themis.common.util.Result;
|
|
@@ -21,10 +20,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @Description: 考试试卷 前端控制器
|
|
@@ -84,15 +80,15 @@ public class TEExamPaperController {
|
|
|
}
|
|
|
try {
|
|
|
TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
|
|
|
+ List<TEExamPaper> teExamPaperUpdate = new ArrayList<>();
|
|
|
teExamPaperList.forEach(s -> {
|
|
|
- if (Objects.nonNull(s.getId())) {
|
|
|
- s.setUpdateId(tbUser.getId());
|
|
|
- } else {
|
|
|
- s.setId(Constants.idGen.next());
|
|
|
- s.setCreateId(tbUser.getId());
|
|
|
- }
|
|
|
+ TEExamPaper teExamPaper = teExamPaperService.getById(s.getId());
|
|
|
+ teExamPaper.setWeight(s.getWeight());
|
|
|
+ teExamPaper.setAudioPlayCount(s.getAudioPlayCount());
|
|
|
+ teExamPaper.setUpdateId(tbUser.getId());
|
|
|
+ teExamPaperUpdate.add(teExamPaper);
|
|
|
});
|
|
|
- teExamPaperService.saveOrUpdateBatch(teExamPaperList);
|
|
|
+ teExamPaperService.updateBatchById(teExamPaperUpdate);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
if (e instanceof DuplicateKeyException) {
|