101captain
2021-09-03 29558b92fd0267b341aab6146175b97a1abedc5d
高龄老人bug修改
3个文件已修改
168 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java 151 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComEldersAuthElderlyDO.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/EldersAuthServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -10,6 +10,9 @@
import javax.annotation.Resource;
import cn.hutool.core.date.DateUtil;
import com.panzhihua.service_community.model.dos.*;
import com.panzhihua.service_community.service.*;
import org.springframework.beans.BeanUtils;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
@@ -85,32 +88,6 @@
import com.panzhihua.service_community.dao.ComActActSignDAO;
import com.panzhihua.service_community.dao.ComEldersAuthHistoryRecordMapper;
import com.panzhihua.service_community.dao.ComMngPopulationDAO;
import com.panzhihua.service_community.model.dos.ComActActEvaluateDO;
import com.panzhihua.service_community.model.dos.ComActActPrizeDO;
import com.panzhihua.service_community.model.dos.ComActDynDO;
import com.panzhihua.service_community.model.dos.ComActEasyPhotoDO;
import com.panzhihua.service_community.model.dos.ComActMicroWishDO;
import com.panzhihua.service_community.model.dos.ComEldersAuthHistoryRecordDO;
import com.panzhihua.service_community.model.dos.ComEldersAuthUserDO;
import com.panzhihua.service_community.model.dos.ComMngStructAreaDO;
import com.panzhihua.service_community.model.dos.EldersAuthDO;
import com.panzhihua.service_community.service.ComActActEvaluateService;
import com.panzhihua.service_community.service.ComActActPrizeService;
import com.panzhihua.service_community.service.ComActActivityService;
import com.panzhihua.service_community.service.ComActDynService;
import com.panzhihua.service_community.service.ComActEasyPhotoActivityService;
import com.panzhihua.service_community.service.ComActEasyPhotoService;
import com.panzhihua.service_community.service.ComActMessageService;
import com.panzhihua.service_community.service.ComActMicroWishService;
import com.panzhihua.service_community.service.ComActQuestnaireService;
import com.panzhihua.service_community.service.ComActService;
import com.panzhihua.service_community.service.ComEldersAuthUserService;
import com.panzhihua.service_community.service.ComMngStructAreaDistrictService;
import com.panzhihua.service_community.service.ComMngStructAreaService;
import com.panzhihua.service_community.service.ComMngStructHouseService;
import com.panzhihua.service_community.service.ComMngStructOtherBuildService;
import com.panzhihua.service_community.service.ComMngVolunteerMngService;
import com.panzhihua.service_community.service.EldersAuthService;
import cn.hutool.core.util.IdcardUtil;
import lombok.extern.slf4j.Slf4j;
@@ -167,6 +144,8 @@
    private ComActEasyPhotoActivityService comActEasyPhotoActivityService;
    @Resource
    private ComActActEvaluateService comActActEvaluateService;
    @Resource
    private ComEldersAuthElderlyService comEldersAuthElderlyService;
    /**
     * 新增社区活动
@@ -2121,67 +2100,71 @@
        if (authUserDO == null) {
            return R.fail("未查询到老人信息");
        }
        Long elderId = authUserDO.getId();
        boolean canReAuthThisMonth = comEldersAuthUserService.checkReAuthAgain(elderId);
        if (!canReAuthThisMonth) {
            return R.fail("当月已认证,不能再次进行认证");
        }
        //根据身份证获取出生日期并获取岁数
        String idCard = authUserDO.getIdCard();
        Long loginUserId = eldersAuthAddByFamilyDTO.getUserId();
        EldersAuthDO eldersAuthDO = new EldersAuthDO();
        eldersAuthDO.setSumitUserId(loginUserId);
        eldersAuthDO.setCreateBy(loginUserId);
        eldersAuthDO.setCreateAt(new Date());
        eldersAuthDO.setIdCard(idCard);
        eldersAuthDO.setAuthUserName(authUserDO.getName());
        eldersAuthDO.setVideoUrl(eldersAuthAddByFamilyDTO.getVideoUrl());
        eldersAuthDO.setFamilyUserId(authUserDO.getId());
        eldersAuthDO.setAge(IdcardUtil.getAgeByIdCard(idCard));
        // 根据身份证查询出籍贯 出生日期
        // String domicile = IdCard.domicile(eldersAuthDO.getIdCard());
        String domicile = eldersAuthService.queryDomicile(eldersAuthDO.getIdCard());
        if (StringUtils.isEmpty(domicile)) {
            domicile = "暂无";
        }
        Date birthDay = IdCard.birthDay(idCard);
        eldersAuthDO.setDomicile(domicile);
        eldersAuthDO.setBirthDay(birthDay);
        int add = eldersAuthService.getBaseMapper().insert(eldersAuthDO);
        if (add == 1) {
            // 设置认证成功
            Long familyUserId = eldersAuthDO.getFamilyUserId();
            ComEldersAuthUserDO comEldersAuthUserDO = new ComEldersAuthUserDO();
            comEldersAuthUserDO.setId(familyUserId);
            comEldersAuthUserDO.setIsAuth(1);
            boolean updated = comEldersAuthUserService.updateById(comEldersAuthUserDO);
            if (!updated) {
                throw new ServiceException("添加认证失败,更新认证状态");
            }
            // 认证成功 添加认证记录
            List<ComEldersAuthHistoryRecordDO> authHistoryRecordDOList =
                comEldersAuthHistoryRecordMapper.selectList(new QueryWrapper<ComEldersAuthHistoryRecordDO>().lambda()
                    .eq(ComEldersAuthHistoryRecordDO::getIdCard, idCard)
                    .ge(ComEldersAuthHistoryRecordDO::getCreateAt, DateUtils.getFirstDayOfMonth()));
            if (authHistoryRecordDOList.isEmpty()) {
                ComEldersAuthHistoryRecordDO authHistoryRecordDO = new ComEldersAuthHistoryRecordDO();
                authHistoryRecordDO.setUserId(eldersAuthAddByFamilyDTO.getFamilyUserId());
                authHistoryRecordDO.setAuthId(eldersAuthDO.getId());
                BeanUtils.copyProperties(eldersAuthDO, authHistoryRecordDO);
                authHistoryRecordDO.setId(null);
                authHistoryRecordDO.setBrithday(AgeUtils.getAgeFormatBirthday(IdcardUtil.getBirthByIdCard(idCard)));
                authHistoryRecordDO.setAge(IdcardUtil.getAgeByIdCard(idCard));
                authHistoryRecordDO.setIsAuth(1);
                authHistoryRecordDO.setDomicile(domicile);
                comEldersAuthHistoryRecordMapper.insert(authHistoryRecordDO);
            }
            return R.ok(eldersAuthDO.getId());
        }
        long year=DateUtil.betweenYear(birthDay,DateUtil.date(),true);
        if(authUserDO.getBigAgeId()!=null){
            ComEldersAuthElderlyDO comEldersAuthElderlyDO=comEldersAuthElderlyService.getById(authUserDO.getBigAgeId());
            if(comEldersAuthElderlyDO!=null&&comEldersAuthElderlyDO.getIsExist()==ComEldersAuthElderlyDO.isExist.yes&&comEldersAuthElderlyDO.getIsBigAge()==ComEldersAuthElderlyDO.isBigAge.yes&&year>=80){
                Long elderId = authUserDO.getId();
                boolean canReAuthThisMonth = comEldersAuthUserService.checkReAuthAgain(elderId);
                if (!canReAuthThisMonth) {
                    return R.fail("当月已认证,不能再次进行认证");
                }
                Long loginUserId = eldersAuthAddByFamilyDTO.getUserId();
                EldersAuthDO eldersAuthDO = new EldersAuthDO();
                eldersAuthDO.setSumitUserId(loginUserId);
                eldersAuthDO.setCreateBy(loginUserId);
                eldersAuthDO.setCreateAt(new Date());
                eldersAuthDO.setIdCard(idCard);
                eldersAuthDO.setAuthUserName(authUserDO.getName());
                eldersAuthDO.setVideoUrl(eldersAuthAddByFamilyDTO.getVideoUrl());
                eldersAuthDO.setFamilyUserId(authUserDO.getId());
                eldersAuthDO.setAge(IdcardUtil.getAgeByIdCard(idCard));
                // 根据身份证查询出籍贯 出生日期
                // String domicile = IdCard.domicile(eldersAuthDO.getIdCard());
                String domicile = eldersAuthService.queryDomicile(eldersAuthDO.getIdCard());
                if (StringUtils.isEmpty(domicile)) {
                    domicile = "暂无";
                }
                eldersAuthDO.setDomicile(domicile);
                eldersAuthDO.setBirthDay(birthDay);
                int add = eldersAuthService.getBaseMapper().insert(eldersAuthDO);
                if (add == 1) {
                    // 设置认证成功
                    Long familyUserId = eldersAuthDO.getFamilyUserId();
                    ComEldersAuthUserDO comEldersAuthUserDO = new ComEldersAuthUserDO();
                    comEldersAuthUserDO.setId(familyUserId);
                    comEldersAuthUserDO.setIsAuth(1);
                    boolean updated = comEldersAuthUserService.updateById(comEldersAuthUserDO);
                    if (!updated) {
                        throw new ServiceException("添加认证失败,更新认证状态");
                    }
                    // 认证成功 添加认证记录
                    List<ComEldersAuthHistoryRecordDO> authHistoryRecordDOList =
                            comEldersAuthHistoryRecordMapper.selectList(new QueryWrapper<ComEldersAuthHistoryRecordDO>().lambda()
                                    .eq(ComEldersAuthHistoryRecordDO::getIdCard, idCard)
                                    .ge(ComEldersAuthHistoryRecordDO::getCreateAt, DateUtils.getFirstDayOfMonth()));
                    if (authHistoryRecordDOList.isEmpty()) {
                        ComEldersAuthHistoryRecordDO authHistoryRecordDO = new ComEldersAuthHistoryRecordDO();
                        authHistoryRecordDO.setUserId(eldersAuthAddByFamilyDTO.getFamilyUserId());
                        authHistoryRecordDO.setAuthId(eldersAuthDO.getId());
                        BeanUtils.copyProperties(eldersAuthDO, authHistoryRecordDO);
                        authHistoryRecordDO.setId(null);
                        authHistoryRecordDO.setBrithday(AgeUtils.getAgeFormatBirthday(IdcardUtil.getBirthByIdCard(idCard)));
                        authHistoryRecordDO.setAge(IdcardUtil.getAgeByIdCard(idCard));
                        authHistoryRecordDO.setIsAuth(1);
                        authHistoryRecordDO.setDomicile(domicile);
                        comEldersAuthHistoryRecordMapper.insert(authHistoryRecordDO);
                    }
                    return R.ok(eldersAuthDO.getId());
                }
        return R.fail();
            }
            return R.fail("不满足认证条件");
        }
        return R.fail("未查询到高龄老人库数据");
    }
    /**
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComEldersAuthElderlyDO.java
@@ -81,4 +81,19 @@
     */
    private Long updateBy;
    /**
     * 是否健在(1.是 2.否) 列: is_exist
     */
    public interface isExist{
        int yes=1;
        int no=2;
    }
    /**
     * 是否办理高龄津贴(1.是 2.否) 列: is_exist
     */
    public interface isBigAge{
        int yes=1;
        int no=2;
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/EldersAuthServiceImpl.java
@@ -247,7 +247,7 @@
    public R communityAuthType(EldersAuthTypeQueryDTO eldersAuthTypeQueryDTO) {
        Long communityId = eldersAuthTypeQueryDTO.getCommunityId();
        List<SysConfDO> confDOList = sysConfDao.selectList(new LambdaQueryWrapper<SysConfDO>()
            .eq(SysConfDO::getCommunityId, communityId).orderByDesc(SysConfDO::getCreateAt));
            .eq(SysConfDO::getCommunityId, communityId).eq(SysConfDO::getCode,"ELDER_AUTH_TYPE").orderByDesc(SysConfDO::getCreateAt));
        if (confDOList == null || confDOList.size() == 0) {
            SysConfDO sysConfDO = new SysConfDO();
            sysConfDO.setCode("ELDER_AUTH_TYPE");