puhanshu
2021-09-18 1e3b97098151f2d0471de6e8103b6cdaa6b5099d
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/EldersAuthServiceImpl.java
@@ -595,4 +595,50 @@
        });
        return R.ok();
    }
    @Override
    public R setAuthType(Long communityId, Integer type){
        List<SysConfDO> authConf =
                sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>().eq(SysConfDO::getCommunityId, communityId)
                        .eq(SysConfDO::getCode, "ELDER_AUTH_TYPE_" + communityId).orderByDesc(SysConfDO::getCreateAt));
        if (authConf != null && authConf.size() > 0) {
            SysConfDO first = authConf.get(0);
            first.setValue(type + "");
            int updated = sysConfDao.updateById(first);
            if (updated == 1) {
                return R.ok();
            }
        }
        return R.fail();
    }
    @Override
    public R getAuthType(EldersAuthTypeQueryDTO eldersAuthTypeQueryDTO){
        Long communityId = eldersAuthTypeQueryDTO.getCommunityId();
        List<SysConfDO> confDOList = sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>()
                .eq(SysConfDO::getCommunityId, communityId).eq(SysConfDO::getCode,"ELDER_AUTH_TYPE_" + communityId).orderByDesc(SysConfDO::getCreateAt));
        if (confDOList == null || confDOList.size() == 0) {
            SysConfDO sysConfDO = new SysConfDO();
            sysConfDO.setCode("ELDER_AUTH_TYPE_" + communityId);
            sysConfDO.setName("高龄认证类型");
            sysConfDO.setValue(2 + "");// 核验类型(1.视频认证 2.人脸核验)
            sysConfDO.setDescription("高龄认证默认添加的核验类型");
            sysConfDO.setCommunityId(communityId);
            sysConfDO.setCreateBy(eldersAuthTypeQueryDTO.getUserId());
            int inserted = sysConfDao.insert(sysConfDO);
            if (inserted != 1) {
                throw new ServiceException("添加高龄认证默认添加的核验类型失败");
            }
            confDOList = sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>()
                    .eq(SysConfDO::getCommunityId, communityId)
                    .orderByDesc(SysConfDO::getCreateAt));
        }
        if (confDOList != null && confDOList.size() > 0) {
            SysConfDO latest = confDOList.get(0);
            SysConfVO sysConfVO = new SysConfVO();
            BeanUtils.copyProperties(latest, sysConfVO);
            return R.ok(sysConfVO.getValue());
        }
        return R.ok();
    }
}