liujunchi před 3 roky
rodič
revize
69b6323409

+ 49 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/EvaluationRecordDto.java

@@ -0,0 +1,49 @@
+package com.yonge.cooleshow.biz.dal.dto;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.math.BigDecimal;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-08-09
+ */
+@ApiModel("参与活动分数")
+public class EvaluationRecordDto {
+
+    @ApiModelProperty("用户id")
+    private Long userId;
+
+    @ApiModelProperty("活动项目")
+    private Long evaluationId;
+
+    @ApiModelProperty("分数")
+    private BigDecimal score;
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public Long getEvaluationId() {
+        return evaluationId;
+    }
+
+    public void setEvaluationId(Long evaluationId) {
+        this.evaluationId = evaluationId;
+    }
+
+    public BigDecimal getScore() {
+        return score;
+    }
+
+    public void setScore(BigDecimal score) {
+        this.score = score;
+    }
+}

+ 0 - 9
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/SysMusicCompareRecordServiceImpl.java

@@ -93,15 +93,6 @@ public class SysMusicCompareRecordServiceImpl extends BaseServiceImpl<Long, SysM
 		
 		sysMusicCompareRecordDao.update(sysMusicCompareRecord);
 
-		// 判断是否为活动评测 活动评测 记录活动记录
-		if (sysMusicCompareRecord.getEvaluationId() != null) {
-			try {
-				activityEvaluationRecordService.saveRecord(sysMusicCompareRecord.getEvaluationId(),sysMusicCompareRecord.getUserId(),sysMusicCompareRecord.getScore());
-			} catch (Exception e) {
-				e.printStackTrace();
-				log.error("活动评测记录保存失败,{}",e.fillInStackTrace());
-			}
-		}
 	}
 
 	@Override

+ 26 - 4
cooleshow-user/user-student/src/main/java/com/yonge/cooleshow/student/controller/StudentActivityController.java

@@ -3,20 +3,24 @@ package com.yonge.cooleshow.student.controller;
 
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
+import com.yonge.cooleshow.biz.dal.dto.ActivityEvaluationRecordDto;
+import com.yonge.cooleshow.biz.dal.dto.EvaluationRecordDto;
+import com.yonge.cooleshow.biz.dal.entity.SysMusicCompareRecord;
+import com.yonge.cooleshow.biz.dal.service.ActivityEvaluationRecordService;
 import com.yonge.cooleshow.biz.dal.service.ActivityPlanService;
 import com.yonge.cooleshow.biz.dal.vo.MusicActivityVo;
 import com.yonge.cooleshow.common.controller.BaseController;
 import com.yonge.cooleshow.common.entity.HttpResponseResult;
+import com.yonge.toolset.base.exception.BizException;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Objects;
 
 
 @Api(tags = "学生活动接口")
@@ -30,6 +34,8 @@ public class StudentActivityController extends BaseController {
     @Autowired
     private ActivityPlanService activityPlanService;
 
+    @Autowired
+    private ActivityEvaluationRecordService activityEvaluationRecordService;
 
     @ApiOperation(value = "评测活动参与项目", notes = "评测项目id")
     @PostMapping(value = "/evaluation/{evaluationId}")
@@ -54,5 +60,21 @@ public class StudentActivityController extends BaseController {
         return succeed(activityPlanService.joinActivity(id, user));
     }
 
+
+    @ApiOperation(value = "保存活动分数")
+    @PostMapping("/evaluationScore")
+    public HttpResponseResult evaluationScore( @RequestBody EvaluationRecordDto record){
+
+        // 判断是否为活动评测 活动评测 记录活动记录
+        if (record.getEvaluationId() != null) {
+            try {
+                activityEvaluationRecordService.saveRecord(record.getEvaluationId(),record.getUserId(),record.getScore());
+            } catch (Exception e) {
+                e.printStackTrace();
+                log.error("活动评测记录保存失败,{}",e.fillInStackTrace());
+            }
+        }
+        return succeed();
+    }
 }