licailing 4 vuotta sitten
vanhempi
commit
73702d416f

+ 20 - 0
src/main/java/com/izouma/wenlvju/service/PerformanceApplyService.java

@@ -1,5 +1,7 @@
 package com.izouma.wenlvju.service;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.izouma.wenlvju.domain.ArtType;
 import com.izouma.wenlvju.domain.Organization;
 import com.izouma.wenlvju.domain.Performance;
@@ -12,6 +14,7 @@ import com.izouma.wenlvju.repo.OrganizationRepo;
 import com.izouma.wenlvju.repo.PerformanceApplyRepo;
 import com.izouma.wenlvju.repo.PerformanceRepo;
 import com.izouma.wenlvju.utils.JpaUtils;
+import com.izouma.wenlvju.utils.ObjUtils;
 import lombok.AllArgsConstructor;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
@@ -155,6 +158,23 @@ public class PerformanceApplyService {
         return applyList;
     }
 
+
+    public void saveArrangement(String applies) {
+        List<PerformanceApply> applyList = JSONObject.parseArray(applies, PerformanceApply.class);
+        List<Long> ids = applyList.stream().map(PerformanceApply::getId).collect(Collectors.toList());
+        Map<Long, PerformanceApply> applyMap = performanceApplyRepo.findAllById(ids)
+                .stream()
+                .collect(Collectors.toMap(PerformanceApply::getId, apply -> apply));
+
+        applyList.forEach(list -> {
+            PerformanceApply apply = applyMap.get(list.getId());
+            if (ObjectUtil.isNull(apply)){
+                ObjUtils.merge(apply, list);
+                performanceApplyRepo.save(apply);
+            }
+        });
+    }
+
     /*
     自动评奖
      */

+ 7 - 1
src/main/java/com/izouma/wenlvju/web/PerformanceApplyController.java

@@ -68,7 +68,13 @@ public class PerformanceApplyController extends BaseController {
     @PostMapping("/autoArrangement")
     @ApiOperation("自动编排")
     public List<PerformanceApply> autoArrangement(@RequestParam Long performanceId) {
-       return performanceApplyService.autoArrangement1(performanceId);
+        return performanceApplyService.autoArrangement1(performanceId);
+    }
+
+    @PostMapping("/saveArrangement")
+    @ApiOperation("保存编排")
+    public void saveArrangement(String applies) {
+        performanceApplyService.saveArrangement(applies);
     }
 
     @PostMapping("/autoAwards")

+ 1 - 1
src/main/vue/src/plugins/http.js

@@ -5,7 +5,7 @@ import qs from 'qs';
 let baseUrl = 'http://localhost:8080';
 switch (process.env.NODE_ENV) {
     case 'development':
-        baseUrl = 'http://localhost:8080';
+        baseUrl = 'http://localhost:8090';
         // baseUrl = 'http://wlj.izouma.com';
         break;
     case 'test':

+ 2 - 2
src/main/vue/src/views/PerformanceApplyList2.vue

@@ -319,8 +319,8 @@ export default {
         autoArrangement() {
             this.loading = true;
             this.$http
-                .post('/performanceApply/autoArrangement', {
-                    performanceId: Number(this.$route.query.perforId)
+                .post('/performanceApply/saveArrangement', {
+                    applies: ''
                 })
                 .then(res => {
                     this.loading = false;