From 8b150e18f00be5980c93b87970798db573c32a1a Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期二, 18 十月 2022 21:11:24 +0800
Subject: [PATCH] update

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java
index 604e5ce..e19edd1 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java
@@ -6,11 +6,13 @@
 import cn.hutool.crypto.digest.MD5;
 import cn.hutool.extra.pinyin.PinyinUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.common.model.dtos.community.sanshuo.ComSanshuoExpertDTO;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.model.vos.R;
+import com.panzhihua.common.model.vos.sanshuo.ComSanshuoExpertVO;
 import com.panzhihua.common.model.vos.sanshuo.ExpertRangeVO;
 import com.panzhihua.common.model.vos.sanshuo.ExpertShowVO;
 import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
@@ -174,7 +176,16 @@
             id=null;
             range=null;
         }
-        return R.ok(comSanshuoExpertDao.expertPage(new Page(page,size),keyWord,range,id,level));
+        IPage<ComSanshuoExpertVO> comSanshuoExpertVOIPage = comSanshuoExpertDao.expertPage(new Page(page, size), keyWord, range, id, level);
+        for (ComSanshuoExpertVO record : comSanshuoExpertVOIPage.getRecords()) {
+            //获取调解次数和成功率
+            record.setCount(comEventMapper.selectCount(new QueryWrapper<ComEvent>().lambda().eq(ComEvent::getSpecialistId, record.getId())));
+            record.setSuccessCount(comEventMapper.selectCount(new QueryWrapper<ComEvent>().lambda().eq(ComEvent::getSpecialistId, record.getId()).eq(ComEvent::getEventResult,2 )));
+            if (nonNull(record.getCount()) && nonNull(record.getSuccessCount())){
+                record.setRate(NumberUtil.div(record.getSuccessCount(), record.getCount(),2));
+            }
+        }
+        return R.ok();
     }
 
     /**

--
Gitblit v1.7.1