licailing 4 anni fa
parent
commit
49e7b956fb

+ 4 - 2
src/main/h5/src/views/Home.vue

@@ -199,7 +199,9 @@ export default {
   methods: {
     getInfo(performanceApplyId, isFirst = false) {
       this.$http
-        .get("/performanceApply/get/" + performanceApplyId)
+        .get("/performanceApply/get/" + performanceApplyId, {
+          phone: window.localStorage.getItem("loginPhone")
+        })
         .then(res => {
           this.info = res;
           if (
@@ -212,7 +214,7 @@ export default {
             "/person/all",
             {
               size: 100,
-              query: { del: false, performanceApplyId: 895 }
+              query: { del: false, performanceApplyId: performanceApplyId }
             },
             { body: "json" }
           );

+ 8 - 10
src/main/java/com/izouma/wenlvju/service/PerformanceApplyService.java

@@ -157,8 +157,8 @@ public class PerformanceApplyService {
     }
 
     /**
-     *签到
-     *由管理人员先登陆,进行签到
+     * 签到
+     * 由管理人员先登陆,进行签到
      */
     public PerformanceApply signIn(Long id, Long userId) {
         PerformanceApply performanceApply = performanceApplyRepo.findById(id)
@@ -175,15 +175,13 @@ public class PerformanceApplyService {
     }
 
     /**
-     *扫描作品二维码,通过手机号获取身份
+     * 扫描作品二维码,通过手机号获取身份
      */
-    public Map<String, String> getAuth(Long id, String phone) {
-        PerformanceApply performanceApply = performanceApplyRepo.findById(id)
-                .orElseThrow(new BusinessException("无此表演"));
+    public Map<String, String> getAuth(Long id, String phone, String pPhone) {
 
         Map<String, String> map = new HashMap<>();
 
-        if (phone.equals(performanceApply.getPhone())) {
+        if (phone.equals(pPhone)) {
             map.put("phone", phone);
             return map;
         }
@@ -211,7 +209,7 @@ public class PerformanceApplyService {
     }
 
     /**
-     *评分
+     * 评分
      */
     public void score(Long id, double score, Long userId) {
         PerformanceApply apply = performanceApplyRepo.findById(id).orElseThrow(new BusinessException("无此表演"));
@@ -225,7 +223,7 @@ public class PerformanceApplyService {
             throw new BusinessException("节目暂未开始");
         }
         PerformanceScore score1 = performanceScoreRepo.findByPerformanceApplyIdAndUserId(id, userId);
-        if (ObjectUtil.isNotNull(score1)){
+        if (ObjectUtil.isNotNull(score1)) {
             throw new BusinessException("已打分");
         }
 
@@ -248,7 +246,7 @@ public class PerformanceApplyService {
     }
 
     /**
-     *获取相关
+     * 获取相关
      */
     public List<PerformanceApply> related(Long id) {
         PerformanceApply apply = performanceApplyRepo.findById(id).orElseThrow(new BusinessException("无记录"));

+ 5 - 2
src/main/java/com/izouma/wenlvju/web/PerformanceApplyController.java

@@ -51,12 +51,13 @@ public class PerformanceApplyController extends BaseController {
     }
 
     @GetMapping("/get/{id}")
-    public PerformanceApply get(@PathVariable Long id) {
+    public PerformanceApply get(@PathVariable Long id, String phone) {
         PerformanceApply apply = performanceApplyRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         if (ObjectUtil.isNotNull(apply.getArtTypeId())) {
             ArtType artType = artTypeRepo.findById(apply.getArtTypeId()).orElseThrow(new BusinessException("无此专业"));
             apply.setArtType(artType.getName());
         }
+        performanceApplyService.getAuth(id, phone, apply.getPhone());
         return apply;
     }
 
@@ -111,7 +112,9 @@ public class PerformanceApplyController extends BaseController {
     @ApiOperation("获取手机号/token")
     @PostMapping("/getAuth")
     public Map<String, String> getAuth(@RequestParam Long id, @RequestParam String phone) {
-        return performanceApplyService.getAuth(id, phone);
+        PerformanceApply performanceApply = performanceApplyRepo.findById(id)
+                .orElseThrow(new BusinessException("无此表演"));
+        return performanceApplyService.getAuth(id, phone, performanceApply.getPhone());
     }
 
     @ApiOperation("获取当前节目后续列表")

+ 8 - 1
src/test/java/com/izouma/wenlvju/service/PerformanceApplyServiceTest.java

@@ -2,6 +2,9 @@ package com.izouma.wenlvju.service;
 
 
 import com.izouma.wenlvju.ApplicationTests;
+import com.izouma.wenlvju.domain.PerformanceApply;
+import com.izouma.wenlvju.exception.BusinessException;
+import com.izouma.wenlvju.repo.PerformanceApplyRepo;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -9,6 +12,8 @@ public class PerformanceApplyServiceTest extends ApplicationTests {
 
     @Autowired
     private PerformanceApplyService performanceApplyService;
+    @Autowired
+    private PerformanceApplyRepo    performanceApplyRepo;
 
     @Test
     public void test() {
@@ -23,7 +28,9 @@ public class PerformanceApplyServiceTest extends ApplicationTests {
 
     @Test
     public void test2() {
-        System.out.println(performanceApplyService.getAuth(895L, "15150689190"));
+        PerformanceApply performanceApply = performanceApplyRepo.findById(895L)
+                .orElseThrow(new BusinessException("无此表演"));
+        System.out.println(performanceApplyService.getAuth(895L, "15150689190", performanceApply.getPhone()));
     }
 
 }