1
huanghongfa
2021-09-18 55b91c9938a8eaa4a96910f6fce633c7bcdaa85f
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/EldersAuthServiceImpl.java
@@ -7,6 +7,9 @@
import javax.annotation.Resource;
import com.panzhihua.common.model.dtos.community.elder.ElderAuthStatisticHeaderDTO;
import com.panzhihua.common.model.dtos.community.elder.PageElderAuthStatisticDTO;
import com.panzhihua.common.model.dtos.community.elder.SignElderAuthStatisticDTO;
import com.panzhihua.common.model.vos.elders.ComEldersAuthHistoryVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
@@ -251,10 +254,10 @@
    public R communityAuthType(EldersAuthTypeQueryDTO eldersAuthTypeQueryDTO) {
        Long communityId = eldersAuthTypeQueryDTO.getCommunityId();
        List<SysConfDO> confDOList = sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>()
            .eq(SysConfDO::getCommunityId, communityId).eq(SysConfDO::getCode,"ELDER_AUTH_TYPE").orderByDesc(SysConfDO::getCreateAt));
            .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");
            sysConfDO.setCode("ELDER_AUTH_TYPE_" + communityId);
            sysConfDO.setName("高龄认证类型");
            sysConfDO.setValue(2 + "");// 核验类型(1.视频认证 2.人脸核验)
            sysConfDO.setDescription("高龄认证默认添加的核验类型");
@@ -543,7 +546,7 @@
            if(resultMap != null){
                ComEldersAuthStatisticsDO authStatisticsDO = new ComEldersAuthStatisticsDO();
                authStatisticsDO.setCommunityId(act.getCommunityId());
                authStatisticsDO.setMonth(DateUtils.getMonth(nowDate));
                authStatisticsDO.setMonth(DateUtils.getMonth(nowDate) + 1);
                authStatisticsDO.setYear(DateUtils.getYear(nowDate));
                authStatisticsDO.setCreateAt(nowDate);
                authStatisticsDO.setSum(Integer.parseInt(resultMap.get("oldCount").toString()));
@@ -595,4 +598,88 @@
        });
        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();
    }
    /**
     * 高龄认证统计-分页查询
     * @param pageElderAuthStatisticDTO 请求参数
     * @return  高龄认证统计列表
     */
    @Override
    public R pageAuthStatisticAdmin(PageElderAuthStatisticDTO pageElderAuthStatisticDTO){
        return R.ok(comEldersAuthHistoryRecordMapper.pageAuthStatisticAdmin(new Page(pageElderAuthStatisticDTO.getPageNum(),pageElderAuthStatisticDTO.getPageSize()),pageElderAuthStatisticDTO));
    }
    /**
     * 高龄认证统计-标记
     * @param signElderAuthStatisticDTO 请求参数
     * @return  标记结果
     */
    @Override
    public R signAuthStatisticAdmin(SignElderAuthStatisticDTO signElderAuthStatisticDTO){
        ComEldersAuthHistoryRecordDO authHistoryRecordDO = comEldersAuthHistoryRecordMapper.selectById(signElderAuthStatisticDTO.getId());
        if(authHistoryRecordDO == null){
            return R.fail("未查询到该记录");
        }
        authHistoryRecordDO.setMark(signElderAuthStatisticDTO.getMark());
        if(comEldersAuthHistoryRecordMapper.updateById(authHistoryRecordDO) > 0){
            return R.ok();
        }
        return R.fail();
    }
    /**
     * 高龄认证统计-统计表头数据
     * @param statisticHeaderDTO 请求参数
     * @return  统计表头数据
     */
    @Override
    public R getAuthHeaderStatisticAdmin(ElderAuthStatisticHeaderDTO statisticHeaderDTO){
        return R.ok(comEldersAuthHistoryRecordMapper.getAuthHeaderStatisticAdmin(statisticHeaderDTO));
    }
}