Browse Source

消息列表,打分记录

5 năm trước cách đây
mục cha
commit
33f5282402

+ 3 - 3
pcbms/src/main/java/com/hssx/pcbms/controller/IdeaController.java

@@ -88,14 +88,14 @@ public class IdeaController {
     /**
      * 打分根据年月去获取他的建议列表
      * 参数:
-     * uid:用户id,time:时间 如:2019-8
+     * uid:用户id,time:时间 如:2019-8,scoreId:打分id
      * @return
      */
     @ApiOperation(value = "打分根据年月去获取他的建议列表", notes = "打分根据年月去获取他的建议列表方法")
     @RequestMapping("/ideaListByTime")
     @ResponseBody
-    public HttpRespMsg ideaListByTime(Idea idea,String time) {
-        HttpRespMsg msg = ideaService.ideaListByTime(idea,time);
+    public HttpRespMsg ideaListByTime(Idea idea,String time,String scoreId) {
+        HttpRespMsg msg = ideaService.ideaListByTime(idea,time,scoreId);
         return msg;
     }
 

+ 1 - 1
pcbms/src/main/java/com/hssx/pcbms/service/IdeaService.java

@@ -22,7 +22,7 @@ public interface IdeaService extends IService<Idea> {
 
     HttpRespMsg ideaList(Idea idea,PageUtil page);
 
-    HttpRespMsg ideaListByTime(Idea idea,String time);
+    HttpRespMsg ideaListByTime(Idea idea,String time,String scoreId);
 
     HttpRespMsg getAdviceScore(IdeaVO ideaVO);
 

+ 12 - 1
pcbms/src/main/java/com/hssx/pcbms/service/impl/IdeaServiceImpl.java

@@ -5,9 +5,11 @@ import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.hssx.pcbms.entity.Idea;
 import com.hssx.pcbms.entity.IdeaComment;
+import com.hssx.pcbms.entity.Score;
 import com.hssx.pcbms.entity.vo.IdeaVO;
 import com.hssx.pcbms.mapper.IdeaCommentMapper;
 import com.hssx.pcbms.mapper.IdeaMapper;
+import com.hssx.pcbms.mapper.ScoreMapper;
 import com.hssx.pcbms.service.IdeaService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.pcbms.util.HttpRespMsg;
@@ -28,6 +30,8 @@ public class IdeaServiceImpl extends ServiceImpl<IdeaMapper, Idea> implements Id
     private IdeaMapper ideaMapper;
     @Resource
     private IdeaCommentMapper ideaCommentMapper;
+    @Resource
+    private ScoreMapper scoreMapper;
 
     @Override
     public HttpRespMsg add(Idea idea) {
@@ -77,9 +81,16 @@ public class IdeaServiceImpl extends ServiceImpl<IdeaMapper, Idea> implements Id
     }
 
     @Override
-    public HttpRespMsg ideaListByTime(Idea idea, String time) {
+    public HttpRespMsg ideaListByTime(Idea idea, String time,String scoreId) {
         HttpRespMsg msg = new HttpRespMsg();
         List<IdeaVO> list =  ideaMapper.getIdeaListByUid(idea,time);
+        Score score = scoreMapper.selectOne(new QueryWrapper<Score>().eq("score_id",scoreId));
+        double sum = 0.0;
+        if(list.size()>0){
+            sum = list.stream().mapToDouble(IdeaVO::getScore).sum();
+        }
+        score.setTotal(score.getPersonalScore()+sum);
+        scoreMapper.update(score,new QueryWrapper<Score>().eq("score_id",scoreId));
         msg.data = list;
         return msg;
     }