yanghui
2022-11-04 06180fa3c8ee17d731561b88897fa18b9f8cf228
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComSanShuoExpertServiceImpl.java
@@ -107,6 +107,10 @@
                    e.printStackTrace();
                }
                //生成后台账号
                //如果是普达社区专家则不生成后台账号
                if (nonNull(expert.getCommunityId()) && !expert.getCommunityId().equals(10172)){
                   return R.ok();
                }
                AdministratorsUserVO user=new AdministratorsUserVO();
                user.setUserId(Snowflake.getId());
                user.setAccount(comSanshuoExpertDTO.getAccount());
@@ -115,7 +119,8 @@
                user.setType(11);
                user.setImageUrl(comSanshuoExpertDTO.getAvatar());
                user.setPhone(comSanshuoExpertDTO.getPhone());
                return R.ok(userService.sanShuoAddUser(user));
                userService.sanShuoAddUser(user);
                return R.ok();
            }
        }else {
            ComSanshuoExpert expert=new ComSanshuoExpert();
@@ -178,6 +183,10 @@
                }else if (loginUserInfo.getType().equals(12)){
                    range=2;
                    id=comSanshuoIndustryCenterDao.selectOne(new QueryWrapper<ComSanshuoIndustryCenter>().lambda().eq(ComSanshuoIndustryCenter::getAccount,loginUserInfo.getAccount() )).getId();
                }else if (loginUserInfo.getType().equals(3)){
                    //社区后台账号
                    range=4;
                    id=loginUserInfo.getCommunityId();
                }
            }
        }
@@ -355,17 +364,15 @@
            Integer count = comEventMapper.selectCount(new QueryWrapper<ComEvent>().lambda().eq(ComEvent::getSpecialistId, comSanshuoExpert.getId()).eq(ComEvent::getEventProcessStatus, 6));
            Integer successCount = comEventMapper.selectCount(new QueryWrapper<ComEvent>().lambda().eq(ComEvent::getSpecialistId, comSanshuoExpert.getId()).eq(ComEvent::getEventProcessStatus, 6).eq(ComEvent::getEventResult, 2));
            comSanshuoExpert.setCount(count);
            if (nonNull(count) && !count.equals(0)){
                comSanshuoExpert.setCount(count);
                if (nonNull(successCount) && !count.equals(successCount)){
                    //计算成功率
                    comSanshuoExpert.setRate(NumberUtil.div(successCount, count,2));
                }else {
                    comSanshuoExpert.setRate(new BigDecimal(0));
            if (nonNull(successCount) && nonNull(count)){
                if (!successCount.equals(0) && !count.equals(0)){
                        //计算成功率
                        comSanshuoExpert.setRate(NumberUtil.div(successCount, count,2));
                }
            }else {
                comSanshuoExpert.setCount(0);
                comSanshuoExpert.setRate(new BigDecimal(0));
            }
        }
        return R.ok(comSanshuoExperts);
    }