|
|
@@ -47,6 +47,7 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
|
|
|
private final LifeUserMapper lifeUserMapper;
|
|
|
private final LawyerUserMapper lawyerUserMapper;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public R<CommentAppeal> submitAppeal(CommentAppeal commentAppeal) {
|
|
|
log.info("CommentAppealServiceImpl.submitAppeal?commentAppeal={}", commentAppeal);
|
|
|
@@ -79,6 +80,10 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
|
|
|
boolean result = this.save(commentAppeal);
|
|
|
if (result) {
|
|
|
log.info("提交申诉成功,id={}", commentAppeal.getId());
|
|
|
+
|
|
|
+ // 发送通知给评价用户,告知其评价被申诉了
|
|
|
+ sendSubmitAppealNotification(commentAppeal);
|
|
|
+
|
|
|
return R.data(commentAppeal, "申诉提交成功");
|
|
|
} else {
|
|
|
return R.fail("申诉提交失败");
|
|
|
@@ -159,6 +164,57 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 发送提交申诉通知(给评价用户)
|
|
|
+ *
|
|
|
+ * @param appeal 申诉记录
|
|
|
+ */
|
|
|
+ private void sendSubmitAppealNotification(CommentAppeal appeal) {
|
|
|
+ try {
|
|
|
+ // 查询律师用户信息
|
|
|
+ LambdaQueryWrapper<LawyerUser> lawyerUser = new LambdaQueryWrapper<>();
|
|
|
+ lawyerUser.eq(LawyerUser :: getId, appeal.getLawyerUserId());
|
|
|
+ LawyerUser lifeUser = lawyerUserMapper.selectOne(lawyerUser);
|
|
|
+ if (lifeUser == null) {
|
|
|
+ log.warn("评价用户不存在,userId={}", lifeUser.getId());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<OrderReview> orderReviewLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ orderReviewLambdaQueryWrapper.eq(OrderReview :: getId, appeal.getCommentId());
|
|
|
+ OrderReview orderReview = orderReviewMapper.selectOne(orderReviewLambdaQueryWrapper);
|
|
|
+ String orderNumber = "";
|
|
|
+ if(orderReview != null){
|
|
|
+ orderNumber = orderReview.getOrderNumber();
|
|
|
+ }
|
|
|
+ String receiverId = "user_" + lifeUser.getPhone();
|
|
|
+ String message = String.format("您提交的差评申诉信息,订单编号为"+ orderNumber +",已提交至平台审核,1-3个工作日会发送您审核结果,请注意查收。触发条件:提交信息成功。");
|
|
|
+
|
|
|
+ LifeNotice lifeNotice = new LifeNotice();
|
|
|
+ lifeNotice.setReceiverId(receiverId);
|
|
|
+ lifeNotice.setBusinessId(appeal.getId());
|
|
|
+ lifeNotice.setTitle("申诉通知");
|
|
|
+ lifeNotice.setSenderId("system");
|
|
|
+ lifeNotice.setIsRead(0);
|
|
|
+ lifeNotice.setNoticeType(1);
|
|
|
+ lifeNotice.setDeleteFlag(0);
|
|
|
+
|
|
|
+ com.alibaba.fastjson2.JSONObject jsonObject = new com.alibaba.fastjson2.JSONObject();
|
|
|
+ jsonObject.put("message", message);
|
|
|
+ jsonObject.put("orderNumber", orderReview.getOrderNumber());
|
|
|
+ jsonObject.put("appealId", appeal.getId());
|
|
|
+ jsonObject.put("status", "pending"); // 待审核状态
|
|
|
+ lifeNotice.setContext(jsonObject.toJSONString());
|
|
|
+
|
|
|
+ lifeNoticeMapper.insert(lifeNotice);
|
|
|
+
|
|
|
+ // 发送 WebSocket 消息
|
|
|
+ sendWebSocketNotification(receiverId, lifeNotice);
|
|
|
+ log.info("提交申诉通知发送成功,receiverId={}, appealId={}", receiverId, appeal.getId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("发送提交申诉通知失败,appealId={}, error={}", appeal.getId(), e.getMessage(), e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 发送审核通知
|
|
|
*
|
|
|
* @param appeal 申诉记录
|
|
|
@@ -471,7 +527,7 @@ public class CommentAppealServiceImpl extends ServiceImpl<CommentAppealMapper, C
|
|
|
|
|
|
@Override
|
|
|
public List<CommentAppealVo> getAppealHistory(Integer pageNum, Integer pageSize, Integer status, Integer lawyerUserId) {
|
|
|
- log.info("CommentAppealServiceImpl.getAppealHistory?pageNum={}, pageSize={}, status={}, userId={}",
|
|
|
+ log.info("CommentAppealServiceImpl.getAppealHistory?pageNum={}, pageSize={}, status={}, lawyerUserId={}",
|
|
|
pageNum, pageSize, status, lawyerUserId);
|
|
|
List<CommentAppealVo> appealList = new ArrayList<>();
|
|
|
//status 3 查全部
|