huanghongfa
2021-05-20 50e1eb020efe8da670b718d865fa4c1eaa61ee7d
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -1,6 +1,8 @@
package com.panzhihua.service_community.api;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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;
@@ -13,7 +15,9 @@
import com.panzhihua.common.model.vos.community.questnaire.QuestnaireVO;
import com.panzhihua.common.model.vos.community.questnaire.UsersAnswerQuestnaireVO;
import com.panzhihua.common.model.vos.user.ComMngFamilyInfoVO;
import com.panzhihua.common.model.vos.user.SysUserNoticeVO;
import com.panzhihua.common.model.vos.user.UserPhoneVO;
import com.panzhihua.common.service.user.UserService;
import com.panzhihua.common.utlis.ClazzUtils;
import com.panzhihua.common.utlis.IdCard;
import com.panzhihua.common.utlis.IdCardUtil;
@@ -29,6 +33,7 @@
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
@@ -71,7 +76,8 @@
    private ComActMessageService comActMessageService;
    @Resource
    private ComActQuestnaireService comActQuestnaireService;
    @Resource
    private UserService userService;
    @Resource
    private EldersAuthService eldersAuthService;
    @Resource
@@ -458,6 +464,26 @@
        return comActEasyPhotoService.detailEasyPhoto(id, userId);
    }
    /**
     * 随手拍删除
     *
     * @param id     随手拍主键
     * @param userId 登录用户
     * @return 详情内容
     */
    @PostMapping("deleteEasyPhoto")
    public R deleteEasyPhoto(@RequestParam("id") Long id, @RequestParam("userId") Long userId) {
        ComActEasyPhotoDO comActEasyPhotoDO = comActEasyPhotoService.getBaseMapper().selectById(id);
        if(comActEasyPhotoDO==null){
            return R.fail("随手拍不存在");
        }
        comActEasyPhotoDO.setDelTag(1);
        int updateById = comActEasyPhotoService.getBaseMapper().updateById(comActEasyPhotoDO);
        if(updateById==1){
            return R.ok();
        }
        return R.fail();
    }
    /**
     * 分页查询微心愿
     *
@@ -1535,10 +1561,14 @@
    @PostMapping("/eldersauth/getMyfamilyElders/{userId}")
    R<List<ComMngFamilyInfoVO>> getMyfamilyElders(@PathVariable("userId") Long userId){
        List<ComMngFamilyInfoVO> list = comMngPopulationDAO.listFamilyByUserId(userId);
        List<ComMngFamilyInfoVO> sortedList = list.stream().sorted(Comparator.comparing(ComMngFamilyInfoVO::getCreateAt).reversed()).collect(Collectors.toList());
        List<ComMngFamilyInfoVO> listRt = new ArrayList<>();
        list.forEach(rt -> {
            boolean isElders =  rt.getAge()>=80;
            if(isElders){
        sortedList.forEach(rt -> {
            int age = IdCard.IdNOToAge(rt.getIdCard());
            boolean isElders = age >= 80;
            if (isElders) {
                listRt.add(rt);
            }
        });
@@ -1560,7 +1590,8 @@
        if(theFamily==null){
            return R.fail("家庭成员信息错误");
        }
        if(theFamily.getAge()>=80){
        Integer age = IdCard.IdNOToAge(theFamily.getIdCard());
        if(age>=80){
            Long loginUserId = eldersAuthAddByFamilyDTO.getUserId();
            EldersAuthDO eldersAuthDO = new EldersAuthDO();
            eldersAuthDO.setSumitUserId(eldersAuthAddByFamilyDTO.getSumitUserId());
@@ -1571,7 +1602,12 @@
            eldersAuthDO.setVideoUrl(eldersAuthAddByFamilyDTO.getVideoUrl());
            eldersAuthDO.setFamilyUserId(eldersAuthAddByFamilyDTO.getFamilyUserId());
            //根据身份证查询出籍贯 出生日期
            String domicile = "";
            //String domicile = IdCard.domicile(eldersAuthDO.getIdCard());
            String domicile = eldersAuthService.queryDomicile(eldersAuthDO.getIdCard());
            if(StringUtils.isEmpty(domicile)){
                domicile = "暂无";
            }
            Date birthDay = IdCard.birthDay(eldersAuthDO.getIdCard());
            eldersAuthDO.setDomicile(domicile);
            eldersAuthDO.setBirthDay(birthDay);
@@ -1593,7 +1629,30 @@
    @PostMapping("/eldersauth/addFeedback")
    R add(@RequestBody EldersAuthFeedbackAddDTO eldersAuthFeedbackAddDTO){
        ClazzUtils.setIfStringIsEmpty(eldersAuthFeedbackAddDTO);
        return eldersAuthService.addFeedback(eldersAuthFeedbackAddDTO);
        EldersAuthDO eldersAuthDO = eldersAuthService.getBaseMapper().selectById(eldersAuthFeedbackAddDTO.getAuthId());
        if(eldersAuthDO==null){
            return R.fail("认证记录不存在");
        }
        R addR = eldersAuthService.addFeedback(eldersAuthFeedbackAddDTO);
        if(R.isOk(addR)){
            SysUserNoticeVO sysUserNoticeVO=new SysUserNoticeVO();
            sysUserNoticeVO.setUserId(eldersAuthDO.getSumitUserId());
            sysUserNoticeVO.setType(3);
            sysUserNoticeVO.setTitle("高龄认证社区反馈");
            sysUserNoticeVO.setBusinessType(13);
            sysUserNoticeVO.setBusinessTitle(" ");
            sysUserNoticeVO.setBusinessContent("你提交【" +eldersAuthDO.getAuthUserName() + "】的高龄认证,社区反馈:"
                    + eldersAuthFeedbackAddDTO.getFeedBack());
            sysUserNoticeVO.setBusinessId(eldersAuthDO.getId());
            sysUserNoticeVO.setStatus(0);
            sysUserNoticeVO.setBusinessStatus(2);
            R r1 = userService.addNotice(sysUserNoticeVO);
            if (R.isOk(r1)) {
                log.info("新增用户报名党建活动通知成功【{}】", JSONObject.toJSONString(sysUserNoticeVO));
            }
        }
        return addR;
    }