xyh
2021-06-14 d6e86197a5a857c697465fb97a488c7327c9cb3b
家庭关系拦截判断
3个文件已修改
290 ■■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngBuildingExcelListen.java 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java 141 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngBuildingExcelListen.java
@@ -11,6 +11,7 @@
import com.panzhihua.common.service.community.CommunityService;
import com.panzhihua.common.service.grid.GridService;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.common.utlis.StringUtils;
import lombok.extern.slf4j.Slf4j;
import java.text.SimpleDateFormat;
@@ -73,6 +74,7 @@
     */
    private void saveData() {
        try {
            int index = 2;
            ArrayList<ComMngBuildingExcelVO> voList = Lists.newArrayList();
            List<ComMngPopulationImportErrorVO> populationImportErrorVOList = new ArrayList<>();
            for (int i = 1; i < list.size(); i++) {
@@ -81,71 +83,97 @@
                vo.setId(Snowflake.getId());
                vo.setUseType(oneData.get(1));
                vo.setBuildType(oneData.get(2));
                vo.setAlley(oneData.get(3));
                if (StringUtils.isEmpty(oneData.get(oneData.get(3)))) {
                    ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
                    importErrorVO.setErrorMsg("街路巷不能为空");
                    importErrorVO.setErrorPosition("第" + index + "行");
                    populationImportErrorVOList.add(importErrorVO);
                    vo.setAlley(oneData.get(3));
                }
                vo.setVillageName(oneData.get(4));
                vo.setDoorNo(oneData.get(5));
                vo.setName(oneData.get(6));
                vo.setGridName(oneData.get(15));
                vo.setGridId(oneData.get(15));
                try {
                    vo.setUnitTotal(oneData.get(7) == null ? 0 : Integer.valueOf(oneData.get(7)));
                } catch (Exception e) {
                    vo.setUnitTotal(0);
                }
                try {
                    vo.setBuildFloorSum(oneData.get(8) == null ? 0 : Integer.valueOf(oneData.get(8)));
                } catch (Exception e) {
                    vo.setBuildFloorSum(0);
                }
                    if (StringUtils.isEmpty(oneData.get(oneData.get(5)))) {
                        ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
                        importErrorVO.setErrorMsg("门牌号不能为空");
                        importErrorVO.setErrorPosition("第" + index + "行");
                        populationImportErrorVOList.add(importErrorVO);
                        vo.setDoorNo(oneData.get(5));
                    }
                    if (StringUtils.isEmpty(oneData.get(oneData.get(5)))) {
                        ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
                        importErrorVO.setErrorMsg("楼栋号不能为空");
                        importErrorVO.setErrorPosition("第" + index + "行");
                        populationImportErrorVOList.add(importErrorVO);
                        vo.setName(oneData.get(6));
                    }
                    try {
                        vo.setUnitTotal(oneData.get(7) == null ? 0 : Integer.valueOf(oneData.get(7)));
                    } catch (Exception e1) {
                        vo.setUnitTotal(0);
                    }
                    try {
                        vo.setBuildFloorSum(oneData.get(8) == null ? 0 : Integer.valueOf(oneData.get(8)));
                    } catch (Exception e1) {
                        vo.setBuildFloorSum(0);
                    }
                try {
                    vo.setEveryFloorSum(oneData.get(9) == null ? 0 : Integer.valueOf(oneData.get(9)));
                } catch (Exception e) {
                    vo.setEveryFloorSum(0);
                    try {
                        vo.setEveryFloorSum(oneData.get(9) == null ? 0 : Integer.valueOf(oneData.get(9)));
                    } catch (Exception e1) {
                        vo.setEveryFloorSum(0);
                    }
                    try {
                        vo.setBuildUserSum(oneData.get(10) == null ? 0 : Integer.valueOf(oneData.get(10)));
                    } catch (Exception e1) {
                        vo.setBuildUserSum(0);
                    }
                    try {
                        vo.setElevatorTotal(oneData.get(11) == null ? 0 : Integer.valueOf(oneData.get(11)));
                    } catch (Exception e1) {
                        vo.setElevatorTotal(0);
                    }
                    vo.setPropertyCompanyName(oneData.get(12));
                    try {
                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
                        vo.setBuildDate(sdf.parse(oneData.get(13)));
                    } catch (Exception e1) {
                    }
                    vo.setRemark(oneData.get(14));
                    vo.setGridId(oneData.get(15));
                    vo.setGridName(oneData.get(15));
                    voList.add(vo);
                    index++;
                }
                try {
                    vo.setBuildUserSum(oneData.get(10) == null ? 0 : Integer.valueOf(oneData.get(10)));
                } catch (Exception e) {
                    vo.setBuildUserSum(0);
                }
                try {
                    vo.setElevatorTotal(oneData.get(11) == null ? 0 : Integer.valueOf(oneData.get(11)));
                } catch (Exception e) {
                    vo.setElevatorTotal(0);
                }
                vo.setPropertyCompanyName(oneData.get(12));
                try {
                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
                    vo.setBuildDate(sdf.parse(oneData.get(13)));
                } catch (Exception e) {
                }
                vo.setRemark(oneData.get(14));
                vo.setGridId(oneData.get(15));
                voList.add(vo);
            }
            //根据list中的IdCard城市来去重
//            List<ComMngBuildingExcelVO> newVoList = voList.stream().filter(ListUtils.distinctByKey(ComMngBuildingExcelVO::getName)).collect(Collectors.toList());
            R r = communityService.listSaveBuildingExcelVO(voList, communityId);
            if (!R.isOk(r)) {
                String errMsg = r.getMsg();
                List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg, ComMngPopulationImportErrorVO.class);
                if (!errorList.isEmpty()) {
                    populationImportErrorVOList.addAll(errorList);
                }
                throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
            } else {
                if (!populationImportErrorVOList.isEmpty()) {
                R r = communityService.listSaveBuildingExcelVO(voList, communityId);
                if (!R.isOk(r)) {
                    String errMsg = r.getMsg();
                    List<ComMngPopulationImportErrorVO> errorList = JSON.parseArray(errMsg, ComMngPopulationImportErrorVO.class);
                    if (!errorList.isEmpty()) {
                        populationImportErrorVOList.addAll(errorList);
                    }
                    throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
                } else {
                    if (!populationImportErrorVOList.isEmpty()) {
                        throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
                    }
                }
            }
        } catch (NumberFormatException e) {
            }
        }catch (NumberFormatException e){
            e.printStackTrace();
        }
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/listen/ComMngPopulationServeExcelListen.java
@@ -168,27 +168,8 @@
                    vo.setIsRent(isOk);
                }
                if(StringUtils.isNotEmpty(oneData.get(5))){
                    String ra = oneData.get(5);
                    if(Objects.equals(ra,"女儿")){
                        ra = "女";
                    }else if(Objects.equals(ra,"儿子")){
                        ra = "子";
                    }else if(Objects.equals(ra,"大女")){
                        ra = "长女";
                    }else if(Objects.equals(ra,"二女")){
                        ra = "次女";
                    }else if(Objects.equals(ra,"非亲属")){
                        ra = "其他";
                    }else if(Objects.equals(ra,"姐")){
                        ra = "姐姐";
                    }else if(Objects.equals(ra,"户主")){
                        ra = "本人";
                    }else if(Objects.equals(ra,"妻子")){
                        ra = "妻";
                    }else if(Objects.equals(ra,"哥") || Objects.equals(ra,"哥哥")){
                        ra = "兄";
                    }
                    String ra = convertRelation(oneData.get(5));
                    String relation = dictMap.get(ra);
                    if(StringUtils.isEmpty(relation)){
@@ -302,25 +283,7 @@
                    vo.setCultureLevel(PopulCultureLevelEnum.getCodeByName(oneData.get(18)));
                }
                if(StringUtils.isNotEmpty(oneData.get(19))){
                    String ma = oneData.get(19);
                    if(Objects.equals("已",ma)){
                        ma = "已婚";
                    }else if(Objects.equals("未",ma)){
                        ma = "未婚";
                    }else if(Objects.equals("初",ma)){
                        ma = "初婚";
                    }else if(Objects.equals("再",ma)){
                        ma = "再婚";
                    }else if(Objects.equals("复",ma)){
                        ma = "复婚";
                    }else if(Objects.equals("丧",ma)){
                        ma = "丧偶";
                    }else if(Objects.equals("离",ma)){
                        ma = "离婚";
                    }else if(Objects.equals("分",ma)){
                        ma = "分居";
                    }
                    String ma = convertMarriage(oneData.get(19));
                    Integer isOk = PopulMarriageEnum.getCodeByName(ma);
                    if(isOk.equals(-1)){
                        vo.setMarriageStr(ma);
@@ -422,4 +385,104 @@
            throw new ServiceException("500", JSON.toJSONString(populationImportErrorVOList));
        }
    }
    private String convertMarriage(String ma) {
        if(Objects.equals("已",ma) || Objects.equals("一",ma)){
            ma = "已婚";
        }else if(Objects.equals("未",ma) || Objects.equals("未婚婚",ma)){
            ma = "未婚";
        }else if(Objects.equals("初",ma)){
            ma = "初婚";
        }else if(Objects.equals("再",ma)){
            ma = "再婚";
        }else if(Objects.equals("复",ma)){
            ma = "复婚";
        }else if(Objects.equals("丧",ma) || Objects.equals("丧偶偶",ma)){
            ma = "丧偶";
        }else if(Objects.equals("离",ma) || Objects.equals("离异",ma) || Objects.equals("离异婚",ma)){
            ma = "离婚";
        }else if(Objects.equals("分",ma)){
            ma = "分居";
        }
        return ma;
    }
    private String convertRelation(String ra) {
        if(ra.contains("户主")){
            ra = "户主";
        }else if(Objects.equals(ra,"女儿")){
            ra = "女";
        }else if(Objects.equals(ra,"儿子") || Objects.equals(ra,"儿")){
            ra = "子";
        }else if(Objects.equals(ra,"大女")){
            ra = "长女";
        }else if(Objects.equals(ra,"二女") || Objects.equals(ra,"此女")){
            ra = "次女";
        }else if(Objects.equals(ra,"二子")){
            ra = "次子";
        }else if(Objects.equals(ra,"长男") || ra.contains("长子")){
            ra = "长子";
        }else if(Objects.equals(ra,"非亲属") || ra.contains("女友")  || ra.contains("女朋友")
                    || ra.contains("男友") || ra.contains("男朋友")){
            ra = "其他";
        }else if(Objects.equals(ra,"姐")){
            ra = "姐姐";
        }else if(Objects.equals(ra,"户主")){
            ra = "本人";
        }else if(Objects.equals(ra,"妻子") || Objects.equals(ra,"媳妇")){
            ra = "妻";
        }else if(Objects.equals(ra,"哥") || Objects.equals(ra,"哥哥")){
            ra = "兄";
        }else if(Objects.equals(ra,"丈夫")){
            ra = "夫";
        }else if(Objects.equals(ra,"丈母娘")){
            ra = "岳母";
        }else if(Objects.equals(ra,"继子") || Objects.equals(ra,"养子")){
            ra = "养子或继子";
        }else if(Objects.equals(ra,"继女") || Objects.equals(ra,"养女")){
            ra = "养女或继女";
        }else if(ra.contains("儿媳")||ra.contains("长媳")){
            ra = "儿媳";
        }else if(Objects.equals(ra,"三姨") || Objects.equals(ra,"姨姨")){
            ra = "姨母";
        }else if(Objects.equals(ra,"二外孙女")){
            ra = "外孙女";
        }else if(Objects.equals(ra,"外孙")){
            ra = "外孙子";
        }else if(Objects.equals(ra,"侄儿")){
            ra = "侄子";
        }else if(ra.contains("表")){
            ra = "表兄弟、表姐妹";
        }else if(Objects.equals(ra,"继父") || Objects.equals(ra,"养父")){
            ra = "继父或养父";
        }else if(Objects.equals(ra,"父")){
            ra = "父亲";
        }else if(Objects.equals(ra,"弟弟")){
            ra = "弟";
        }else if(Objects.equals(ra,"孙")){
            ra = "孙子";
        }else if(Objects.equals(ra,"孙媳妇") || Objects.equals(ra,"外孙媳妇")){
            ra = "孙媳妇或外孙媳妇";
        }else if(Objects.equals(ra,"妹")){
            ra = "妹妹";
        }else if(Objects.equals(ra,"祖父母")){
            ra = "祖父母或外祖父母";
        }else if(Objects.equals(ra,"姐妹") || Objects.equals(ra,"兄弟")){
            ra = "兄弟姐妹";
        }else if(Objects.equals(ra,"其他姐妹") || Objects.equals(ra,"其他兄弟")){
            ra = "其他兄弟姐妹";
        }else if(Objects.equals(ra,"奶奶")){
            ra = "祖母";
        }else if(Objects.equals(ra,"爷爷")){
            ra = "祖父";
        }else if(Objects.equals(ra,"爷爷")){
            ra = "祖父";
        }else if(ra.contains("堂")){
            ra = "堂兄弟、堂姐妹";
        }
        return ra;
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActBuildingServiceImpl.java
@@ -8,6 +8,7 @@
import com.panzhihua.common.model.vos.community.ComMngBuildingExcelVO;
import com.panzhihua.common.model.vos.community.ComMngPopulationImportErrorVO;
import com.panzhihua.common.utlis.Snowflake;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.ComActDAO;
import com.panzhihua.service_community.dao.ComActVillageDAO;
import com.panzhihua.service_community.dao.ComMngBuildingDAO;
@@ -42,9 +43,11 @@
    @Override
    public R batchSaveBuilding(List<ComMngBuildingExcelVO> newVoList, Long communityId) {
        ArrayList<ComMngBuildingDO> list = Lists.newArrayList();
        int index = 2;
        List<GridBuildRelationDO> keyList = new ArrayList<>();
        List<ComMngPopulationImportErrorVO> errorList = new ArrayList<>();
        ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
        importErrorVO.setErrorMsg("重复楼栋");
        StringBuilder sb = new StringBuilder();
        for(ComMngBuildingExcelVO vo:newVoList){
            ComMngVillageDO comMngVillageDO = comActVillageDAO.selectOne(new QueryWrapper<ComMngVillageDO>().eq("alley",vo.getAlley()).eq("house_num",vo.getDoorNo()).eq("community_id",communityId));
            if(comMngVillageDO == null){
@@ -52,10 +55,7 @@
            }
            List<ComMngBuildingDO> buildingDOList = this.baseMapper.selectList(new QueryWrapper<ComMngBuildingDO>().eq("street_id",comMngVillageDO.getStreetId()).eq("act_id",communityId).eq("village_id",comMngVillageDO.getVillageId()).eq("name",vo.getName()));
            if(buildingDOList.size() > 0){
                ComMngPopulationImportErrorVO importErrorVO = new ComMngPopulationImportErrorVO();
                importErrorVO.setErrorMsg("重复楼栋");
                importErrorVO.setErrorPosition("第" + index + "行");
                errorList.add(importErrorVO);
                sb.append("街路巷:").append(vo.getAlley()).append(",门牌号:").append(vo.getDoorNo()).append(",楼栋号:").append(vo.getName()).append(";");
                continue;
            }
            ComMngBuildingDO comMngBuildingDO = new ComMngBuildingDO();
@@ -65,11 +65,10 @@
            comMngBuildingDO.setVillageId(comMngVillageDO.getVillageId());
            ComActDO actDO = comActDAO.selectById(comMngVillageDO.getCommunityId());
            StringBuilder path = new StringBuilder();
            path.append(vo.getAlley()).append(">").append(actDO.getName()).append(vo.getVillageName()).append(">").append(vo.getName());
            path.append(vo.getAlley()).append(">").append(actDO.getName()).append(comMngVillageDO.getHouseNum()).append(">").append(vo.getName());
            comMngBuildingDO.setPath(path.toString());
            comMngBuildingDO.setGridId(vo.getGridId());
            list.add(comMngBuildingDO);
            index ++;
            GridBuildRelationDO gridBuildRelation = getGridBuildRelationDO(communityId, comMngVillageDO.getStreetId(), vo, comMngBuildingDO);
            keyList.add(gridBuildRelation);
        }
@@ -77,8 +76,8 @@
        if(list.size()>0){
            this.saveBatch(list);
        }
        if(errorList.size() > 0){
        if(sb.length() > 0 && !StringUtils.isEmpty(sb.toString())){
            errorList.add(importErrorVO);
            return R.fail(JSON.toJSONString(errorList));
        }
        gridBuildRelationService.saveBatchGridBuildRelation(keyList);