Selaa lähdekoodia

志愿联测整

mingfu 1 päivä sitten
vanhempi
commit
535536b63d

+ 3 - 3
ie-admin/src/main/java/com/ruoyi/web/controller/ie/VoluntaryController.java

@@ -87,7 +87,7 @@ public class VoluntaryController extends BaseController {
 
     @GetMapping("voluntary/getVoluntaryList")
     @ApiOperation("查询志愿列表")
-    public R<List<VoluntaryDto.VoluntaryRecord>> voluntaryList(@ApiParam @RequestParam Integer pageNum, @ApiParam @RequestParam Integer pageSize) { // 我的志愿表 // 后台填充快照缺省
+    public R<List<VoluntaryDto.VoluntaryRecord>> voluntaryList() { // 我的志愿表 // 后台填充快照缺省
         List<VoluntaryDto.VoluntaryRecord> list = voluntaryService.getVoluntaryList2();
         return R.ok(list);
     }
@@ -100,14 +100,14 @@ public class VoluntaryController extends BaseController {
     }
 
     @Log(title = "志愿删除院校", businessType = BusinessType.DELETE)
-    @DeleteMapping("voluntary/removeVoluntaryByUniversity/{universityId}")
+    @PostMapping("voluntary/removeVoluntaryByUniversity/{universityId}")
     public AjaxResult removeVoluntaryByUniversity(@PathVariable Long universityId)
     {
         return toAjax(voluntaryService.removeVoluntaryByUniversity(SecurityUtils.getLoginUser().getUserId(), universityId));
     }
 
     @Log(title = "志愿删除专业", businessType = BusinessType.DELETE)
-    @DeleteMapping("voluntary/removeVoluntaryByMajor/{majorId}")
+    @PostMapping("voluntary/removeVoluntaryByMajor/{majorId}")
     public AjaxResult removeVoluntaryByMajor(@PathVariable Long majorId)
     {
         return toAjax(voluntaryService.removeVoluntaryByMajor(SecurityUtils.getLoginUser().getUserId(), majorId));

+ 7 - 3
ie-admin/src/main/java/com/ruoyi/web/service/VoluntaryService.java

@@ -1607,7 +1607,6 @@ public class VoluntaryService {
         }
         VoluntaryDto.VoluntaryRecord voluntaryRecord = optionalVoluntary.get();
         List<VoluntaryDto.VoluntaryMajorRecord> newRecordList = Lists.newArrayList();
-        voluntaryRecord.setMajors(newRecordList);
         for(VoluntaryDto.VoluntaryMajorRecord r : voluntaryRecord.getMajors()) {
             if(r.getMajorId().equals(majorId)) {
                continue;
@@ -1615,7 +1614,12 @@ public class VoluntaryService {
             r.setRank(newRecordList.size());
             newRecordList.add(r);
         }
-        updateWishRecord(wishRecord, voluntaryRecordList);
+        if(newRecordList.isEmpty()) {
+            updateWishRecord(wishRecord, voluntaryRecordList.stream().filter(t -> !t.getUniversityId().equals(plan.getUniversityId())).collect(Collectors.toList()));
+        } else {
+            voluntaryRecord.setMajors(newRecordList);
+            updateWishRecord(wishRecord, voluntaryRecordList);
+        }
         return true;
     }
 
@@ -1630,7 +1634,7 @@ public class VoluntaryService {
         voluntaryRecord = optionalVoluntary.get();
         Integer rank;
         for(VoluntaryDto.VoluntaryMajorRecord record : voluntaryRecord.getMajors()) {
-            if(null == (rank = majorRankMap.remove(record.getUniversityId()))) {
+            if(null == (rank = majorRankMap.remove(record.getMajorId()))) {
                 throw new RuntimeException("错误的专业计划ID");
             }
             record.setRank(rank);