|
@@ -1,6 +1,7 @@
|
|
|
package com.hssx.pcbms.service.impl;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.hssx.pcbms.constant.Constant;
|
|
@@ -15,6 +16,7 @@ import com.hssx.pcbms.util.PageUtil;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.expression.spel.ast.Operator;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -24,6 +26,7 @@ import java.text.SimpleDateFormat;
|
|
|
import java.util.Calendar;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* @author 吴涛涛
|
|
@@ -170,6 +173,37 @@ public class ScoreServiceImpl extends ServiceImpl<ScoreMapper, Score> implements
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg del(Score score) {
|
|
|
+ HttpRespMsg msg = new HttpRespMsg();
|
|
|
+ Score Oldscore = scoreMapper.selectOne(new QueryWrapper<Score>().eq("score_id", score.getScoreId()));
|
|
|
+ //清空该建议的评分
|
|
|
+ List<Idea> ideas = ideaMapper.selectList(new QueryWrapper<Idea>().eq("score_id", Oldscore.getScoreId()));
|
|
|
+ //删除建议的评论
|
|
|
+ if(!CollectionUtils.isEmpty(ideas)){
|
|
|
+ ideaCommentMapper.delete(new QueryWrapper<IdeaComment>().in("idea_id",ideas.stream().map(Idea::getId).collect(Collectors.toList())));
|
|
|
+ }
|
|
|
+ //将之前的建议打分全部修改为0
|
|
|
+ Idea idea = new Idea();
|
|
|
+ idea.setScore(0.0);
|
|
|
+ idea.setScoreId(null);//这里是null没法更新
|
|
|
+ ideaMapper.update(idea,new QueryWrapper<Idea>().eq("score_id", Oldscore.getScoreId()));
|
|
|
+ //添加删除打分记录
|
|
|
+ User uidUser = userMapper.selectById(Oldscore.getUid());
|
|
|
+ User operator = userMapper.selectById(Oldscore.getRaterId());
|
|
|
+ ScoringOperateRecord record = new ScoringOperateRecord();
|
|
|
+ record.setContent(Constant.DELETE_SCORE);
|
|
|
+ record.setDeptId(Oldscore.getDeptId());
|
|
|
+ record.setOperatorId(operator.getId());
|
|
|
+ record.setUid(uidUser.getId());
|
|
|
+ record.setUname(uidUser.getName());
|
|
|
+ record.setOperator(operator.getName());
|
|
|
+ record.setScoreId(Oldscore.getScoreId());
|
|
|
+ scoringOperateRecordMapper.insert(record);
|
|
|
+ scoreMapper.delete(new QueryWrapper<Score>().eq("score_id",score.getScoreId()));
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
+
|
|
|
private HttpRespMsg addScore(Date yearMonth, Date nowDate, Integer type, Score score,Score oldScore) {
|
|
|
HttpRespMsg msg = new HttpRespMsg();
|
|
|
//评分上个月
|