|
|
@ -4,8 +4,10 @@ import com.baomidou.dynamic.datasource.annotation.DS; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
|
|
|
import com.hnac.gglm.bigmodel.maintenance.entity.AgentLogEntity; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.entity.QuestionAnswerCommentEntity; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.mapper.QuestionAnswerCommentMapper; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.mapper.QuestionAnswerCommentMapper; |
|
|
|
|
|
|
|
import com.hnac.gglm.bigmodel.maintenance.service.AgentLogService; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.service.QuestionAnswerCommentService; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.service.QuestionAnswerCommentService; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerCommentRequest; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; |
|
|
|
import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; |
|
|
@ -29,6 +31,7 @@ import java.util.List; |
|
|
|
@DS("hznlm") |
|
|
|
@DS("hznlm") |
|
|
|
public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswerCommentMapper, QuestionAnswerCommentEntity> implements QuestionAnswerCommentService { |
|
|
|
public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswerCommentMapper, QuestionAnswerCommentEntity> implements QuestionAnswerCommentService { |
|
|
|
private final IUserClient userClient; |
|
|
|
private final IUserClient userClient; |
|
|
|
|
|
|
|
private final AgentLogService agentLogService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public QuestionAnswerCommentEntity getComment(String userId, String questionId) { |
|
|
|
public QuestionAnswerCommentEntity getComment(String userId, String questionId) { |
|
|
@ -54,13 +57,18 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswer |
|
|
|
public Boolean praise(AnswerPraiseRequest req) { |
|
|
|
public Boolean praise(AnswerPraiseRequest req) { |
|
|
|
QuestionAnswerCommentEntity entity = getComment(req.getUserId(), |
|
|
|
QuestionAnswerCommentEntity entity = getComment(req.getUserId(), |
|
|
|
req.getQuestionId()); |
|
|
|
req.getQuestionId()); |
|
|
|
|
|
|
|
Boolean result; |
|
|
|
if (ObjectUtil.isNotEmpty(entity)) { |
|
|
|
if (ObjectUtil.isNotEmpty(entity)) { |
|
|
|
entity.setPraise(req.getPraise()); |
|
|
|
entity.setPraise(req.getPraise()); |
|
|
|
return this.updateById(entity); |
|
|
|
result = this.updateById(entity); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
entity = req.toEntity(); |
|
|
|
entity = req.toEntity(); |
|
|
|
return this.save(entity); |
|
|
|
result = this.save(entity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(req.getPraise()) && ObjectUtil.isNotEmpty(req.getQuestionId())) { |
|
|
|
|
|
|
|
agentLogService.update(Wrappers.<AgentLogEntity>lambdaUpdate().set(AgentLogEntity::getUserConclusion, req.getPraise()).eq(AgentLogEntity::getQId, req.getQuestionId())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|