Переглянути джерело

定时任务处理维护资产(0)

5 роки тому
батько
коміт
cebd73fedc

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

@@ -31,15 +31,16 @@ public class IdeaCommentController {
 
     /**
      * 添加/修改回复建议(给建议打分)
-     * 参数:ideaId:建议的id,content:回复的内容(没有内容默认传“暂无回复”),responderId:回复人的id,score 建议打分数(-10.0-10.0)
+     * 参数:ideaId:建议的id,content:回复的内容(没有内容默认传“暂无回复”),
+     * responderId:回复人的id,score 建议打分数(-10.0-10.0) scoreId:打分的id
      *  注:修改时 id:回复建议的id(以上参数不修改的不传)
      * @return
      */
     @ApiOperation(value = "添加/修改回复建议", notes = "添加/修改回复建议方法")
     @RequestMapping("/addOrUpdate")
     @ResponseBody
-    public HttpRespMsg addOrUpdate(IdeaComment ideaComment,@RequestParam(required = false) Double score) {
-        HttpRespMsg msg = ideaCommentService.addOrUpdate(ideaComment,score);
+    public HttpRespMsg addOrUpdate(IdeaComment ideaComment,@RequestParam(required = false) Double score,@RequestParam(required = false) Integer scoreId) {
+        HttpRespMsg msg = ideaCommentService.addOrUpdate(ideaComment,score,scoreId);
         return msg;
     }
     /**

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

@@ -14,7 +14,7 @@ import com.hssx.pcbms.util.HttpRespMsg;
  */
 public interface IdeaCommentService extends IService<IdeaComment> {
 
-    HttpRespMsg addOrUpdate(IdeaComment ideaComment,Double score);
+    HttpRespMsg addOrUpdate(IdeaComment ideaComment,Double score,Integer scoreId);
 
     HttpRespMsg del(IdeaComment ideaComment);
 }

+ 11 - 2
pcbms/src/main/java/com/hssx/pcbms/service/impl/IdeaCommentServiceImpl.java

@@ -3,12 +3,15 @@ package com.hssx.pcbms.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.hssx.pcbms.entity.Idea;
 import com.hssx.pcbms.entity.IdeaComment;
+import com.hssx.pcbms.entity.User;
 import com.hssx.pcbms.mapper.IdeaCommentMapper;
 import com.hssx.pcbms.mapper.IdeaMapper;
+import com.hssx.pcbms.mapper.UserMapper;
 import com.hssx.pcbms.service.IdeaCommentService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.hssx.pcbms.util.HttpRespMsg;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import javax.annotation.Resource;
 
@@ -23,18 +26,24 @@ public class IdeaCommentServiceImpl extends ServiceImpl<IdeaCommentMapper, IdeaC
     private IdeaCommentMapper ideaCommentMapper;
     @Resource
     private IdeaMapper ideaMapper;
+    @Resource
+    private UserMapper userMapper;
 
     @Override
-    public HttpRespMsg addOrUpdate(IdeaComment ideaComment,Double score) {
+    public HttpRespMsg addOrUpdate(IdeaComment ideaComment,Double score,Integer scoreId) {
         HttpRespMsg msg = new HttpRespMsg();
         if (null == ideaComment.getId()) {
+            //添加评论
+            User user = userMapper.selectById(ideaComment.getResponderId());
+            ideaComment.setResponder(user.getName());
             ideaCommentMapper.insert(ideaComment);
             Idea idea = new Idea();
-            idea.setId(ideaComment.getId());
             idea.setScore(score);
             idea.setIsEvaluated(1);
+            idea.setScoreId(scoreId);
             ideaMapper.update(idea,new QueryWrapper<Idea>().eq("id",ideaComment.getIdeaId()));
         } else {
+            //修改评论
             Idea idea = ideaMapper.selectOne(new QueryWrapper<Idea>().eq("id", ideaComment.getIdeaId()));
             if (idea != null) {
                 ideaCommentMapper.updateById(ideaComment);