From 80b61cf67091b8836157ec4eed49d5c47ab02142 Mon Sep 17 00:00:00 2001
From: tangxiaobao <303826152@qq.com>
Date: 星期二, 14 九月 2021 10:57:43 +0800
Subject: [PATCH] 身份认证新增认证方式字段

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java
index 8ae01fd..2892855 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComPensionAuthRecordServiceImpl.java
@@ -1,9 +1,12 @@
 package com.panzhihua.service_community.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 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.panzhihua.common.enums.PopulHouseUseEnum;
+import com.panzhihua.common.exceptions.ServiceException;
+import com.panzhihua.common.model.dtos.community.EldersAuthTypeQueryDTO;
 import com.panzhihua.common.model.dtos.community.PageElderAuthRecordsDTO;
 import com.panzhihua.common.model.helper.AESUtil;
 import com.panzhihua.common.model.vos.R;
@@ -52,6 +55,8 @@
     private ComActDAO comActDAO;
     @Resource
     private ComPensionAuthStatisticsDAO comPensionAuthStatisticsDAO;
+    @Resource
+    private SysConfMapper sysConfDao;
     @Value("${domain.aesKey:}")
     private String aesKey;
 
@@ -250,6 +255,52 @@
     }
 
     @Override
+    public R setPensionAuthType(Long communityId, Integer type) {
+        List<SysConfDO> authConf =
+                sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>().eq(SysConfDO::getCommunityId, communityId)
+                        .eq(SysConfDO::getCode, "PENSION_AUTH_TYPE").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 communityPensionAuthType(EldersAuthTypeQueryDTO eldersAuthTypeQueryDTO) {
+        Long communityId = eldersAuthTypeQueryDTO.getCommunityId();
+        List<SysConfDO> confDOList = sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>()
+                .eq(SysConfDO::getCommunityId, communityId).eq(SysConfDO::getCode,"PENSION_AUTH_TYPE").orderByDesc(SysConfDO::getCreateAt));
+        if (confDOList == null || confDOList.size() == 0) {
+            SysConfDO sysConfDO = new SysConfDO();
+            sysConfDO.setCode("PENSION_AUTH_TYPE");
+            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();
+    }
+
+    @Override
     public R timedTaskPensionAuthStatisticsJobHandler() {
         Date nowDate = new Date();
         int month = DateUtils.getMonth(nowDate) + 1;

--
Gitblit v1.7.1