xiatian 6 kuukautta sitten
vanhempi
commit
547ee41a18

+ 2 - 4
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/controller/CopyDataController.java

@@ -64,13 +64,11 @@ public class CopyDataController extends ControllerSupport {
      *            目标学校
      * @param paperSuff
      *            复制后的目标学校试卷后缀
-     * @param copyAll
-     *            是否全部试卷复制(已经复制过的id有记录)
      */
     @PostMapping(value = "data")
     public void copyData(HttpServletResponse response,
             @RequestPart @NotNull(message = "上传文件不能为空!") MultipartFile dataFile, @RequestParam Long fromRootOrgId,
-            @RequestParam Long toRootOrgId, @RequestParam String paperSuff, @RequestParam Boolean copyAll) {
+            @RequestParam Long toRootOrgId, @RequestParam String paperSuff) {
         User user = getAccessUser();
         if (!user.getRootOrgId().equals(toRootOrgId)) {
             ServletUtil.returnJson("请求失败,没有权限", response);
@@ -105,7 +103,7 @@ public class CopyDataController extends ControllerSupport {
                     courses.add(new CopyDataCourseInfo(coursesMap.get(c), c));
                 }
             }
-            copyDataService.copyData(user, fromRootOrgId, toRootOrgId, courses, paperSuff, copyAll);
+            copyDataService.copyData(user, fromRootOrgId, toRootOrgId, courses, paperSuff);
             ServletUtil.returnJson("请求成功", response);
         } catch (StatusException e) {
             ServletUtil.returnJson("请求失败" + e.getDesc(), response);

+ 1 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/CopyDataService.java

@@ -7,8 +7,7 @@ import cn.com.qmth.examcloud.core.questions.service.bean.CopyDataCourseInfo;
 
 public interface CopyDataService {
 
-    void copyData(User user, Long fromRootOrgId, Long toRootOrgId, List<CopyDataCourseInfo> courses, String paperSuff,
-            Boolean copyAll);
+    void copyData(User user, Long fromRootOrgId, Long toRootOrgId, List<CopyDataCourseInfo> courses, String paperSuff);
 
     // void copyNoReduplicate(User user,String batch);
 

+ 1 - 13
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/bean/CopyDataDto.java

@@ -19,8 +19,6 @@ public class CopyDataDto {
 
     private String paperSuff;
 
-    private Boolean copyAll;
-
     // 原属性对应的新属性id
     private Map<String, Property> souceIdMap = new HashMap<>();
 
@@ -62,15 +60,13 @@ public class CopyDataDto {
         this.course = course;
     }
 
-    public CopyDataDto(CopyDataCourseInfo course, Long fromRootOrgId, Long toRootOrgId, User user, String paperSuff,
-            Boolean copyAll) {
+    public CopyDataDto(CopyDataCourseInfo course, Long fromRootOrgId, Long toRootOrgId, User user, String paperSuff) {
         super();
         this.course = course;
         this.fromRootOrgId = fromRootOrgId;
         this.toRootOrgId = toRootOrgId;
         this.user = user;
         this.paperSuff = paperSuff;
-        this.copyAll = copyAll;
     }
 
     public Map<String, Property> getSouceIdMap() {
@@ -97,14 +93,6 @@ public class CopyDataDto {
         this.paperSuff = paperSuff;
     }
 
-    public Boolean getCopyAll() {
-        return copyAll;
-    }
-
-    public void setCopyAll(Boolean copyAll) {
-        this.copyAll = copyAll;
-    }
-
     public Map<String, String> getSouceIdToQuestionMap() {
         return souceIdToQuestionMap;
     }

+ 1 - 8
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/consumer/CopyDataConsumer.java

@@ -129,14 +129,7 @@ public class CopyDataConsumer extends Consumer<CopyDataDto> {
             fillSouceIdMap(dto);
         }
         for (Paper paper : papers) {
-            if (dto.getCopyAll()) {
-                clonePaper(paper, dto);
-            } else {
-                if (!paperService.existsPaperBySourceId(dto.getToRootOrgId(), dto.getCourse().getCourseCode(),
-                        dto.getPaperType(), paper.getId())) {
-                    clonePaper(paper, dto);
-                }
-            }
+            clonePaper(paper, dto);
             redisClient.expire(copyQuestionDataLock, cacheLockTimeout);
         }
     }

+ 2 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/CopyDataServiceImpl.java

@@ -104,7 +104,7 @@ public class CopyDataServiceImpl implements CopyDataService {
     @Async
     @Override
     public void copyData(User user, Long fromRootOrgId, Long toRootOrgId, List<CopyDataCourseInfo> courses,
-            String paperSuff, Boolean copyAll) {
+            String paperSuff) {
         boolean sucss = true;
         long s1 = System.currentTimeMillis();
         try {
@@ -113,7 +113,7 @@ public class CopyDataServiceImpl implements CopyDataService {
             if (CollectionUtils.isNotEmpty(courses)) {
                 List<CopyDataDto> dtos = new ArrayList<>();
                 for (CopyDataCourseInfo course : courses) {
-                    dtos.add(new CopyDataDto(course, fromRootOrgId, toRootOrgId, user, paperSuff, copyAll));
+                    dtos.add(new CopyDataDto(course, fromRootOrgId, toRootOrgId, user, paperSuff));
                     redisClient.expire(copyQuestionDataLock, cacheLockTimeout);
                 }
                 Map<String, Object> param = new HashMap<>();