| | |
| | | if (null != houseParam.getRoleName() && !houseParam.getRoleName().equals("")) { |
| | | if (houseParam.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | stringList = gridService.getAddressCodeListByUserId(AuthUtil.getUserId(),null); |
| | | } |
| | | } |
| | | return stringList; |
| | |
| | | } |
| | | // 新增 |
| | | save(houseEntity); |
| | | }else { |
| | | // 更新 |
| | | one.setHouseName(houseAndHoldExcel.getHouseName()); |
| | | one.setAddress(houseAndHoldExcel.getHouseName()); |
| | | one.setDistrictName(houseAndHoldExcel.getDistrictName()); |
| | | one.setUnit(houseAndHoldExcel.getUnit()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getFloor())) { |
| | | one.setFloor(houseAndHoldExcel.getFloor()); |
| | | } |
| | | one.setRoom(houseAndHoldExcel.getRoom()); |
| | | one.setBuilding(houseAndHoldExcel.getBuilding()); |
| | | one.setArea(houseAndHoldExcel.getArea()); |
| | | one.setPropertyPrice(houseAndHoldExcel.getPropertyPrice()); |
| | | // 更新 |
| | | updateById(one); |
| | | } |
| | | } |
| | | |
| | |
| | | QueryWrapper<HouseholdEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("house_code", houseAndHoldExcel.getHouseCode()) |
| | | .eq("is_deleted", 0) |
| | | .eq("phone_number", houseAndHoldExcel.getPhoneNumber()) |
| | | .eq("name", houseAndHoldExcel.getName()); |
| | | HouseholdEntity one = householdService.getOne(wrapper); |
| | | // 不存在则插入,存在则不操作 |
| | |
| | | householdEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | householdEntity.setName(houseAndHoldExcel.getName()); |
| | | householdEntity.setPhoneNumber(houseAndHoldExcel.getPhoneNumber()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getRoleType())) { |
| | | householdEntity.setRoleType(Integer.parseInt(houseAndHoldExcel.getRoleType())); |
| | | } |
| | | // 与角色关系 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getRelationship())) { |
| | | householdEntity.setRelationship(Integer.parseInt(houseAndHoldExcel.getRelationship())); |
| | |
| | | if (!Strings.isBlank(houseAndHoldExcel.getGender())) { |
| | | householdEntity.setGender(Short.parseShort(houseAndHoldExcel.getGender())); |
| | | } |
| | | householdEntity.setIdCard(houseAndHoldExcel.getIdCard()); |
| | | // 居民身份证 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getIdCard())) { |
| | | // 身份证类型为居民身份证 |
| | | householdEntity.setCardType(111); |
| | | householdEntity.setIdCard(houseAndHoldExcel.getIdCard()); |
| | | } |
| | | // 党员 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getPartyEmber())) { |
| | | householdEntity.setPartyEmber(Integer.parseInt(houseAndHoldExcel.getPartyEmber())); |
| | |
| | | householdEntity.setEmployer(houseAndHoldExcel.getEmployer()); |
| | | householdEntity.setOccupation(houseAndHoldExcel.getOccupation()); |
| | | householdEntity.setCmpyRegAddr(houseAndHoldExcel.getCmpyRegAddr()); |
| | | // 外出 |
| | | householdEntity.setGoOutReason(houseAndHoldExcel.getGoOutReason()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getGoOutTime())) { |
| | | try { |
| | |
| | | if (!Strings.isBlank(houseAndHoldExcel.getMaritalStatus())) { |
| | | householdEntity.setMaritalStatus(Integer.parseInt(houseAndHoldExcel.getMaritalStatus())); |
| | | } |
| | | // 车牌号 |
| | | householdEntity.setCardNumber(houseAndHoldExcel.getCardNumber()); |
| | | // 其他联系方式 |
| | | householdEntity.setOtherContact(houseAndHoldExcel.getOtherContact()); |
| | | if (Strings.isBlank(householdEntity.getHouseCode())) { |
| | | if (!Strings.isBlank(householdEntity.getHomeAdcode())) { |
| | | // 暂时不处理,导入数据目前都有house_code |
| | | String adCode = shiftResidentHomeAdcode(houseAndHoldExcel.getHomeAdcode()); |
| | | // 转换行政区code |
| | |
| | | // 新增 |
| | | boolean save = householdService.save(householdEntity); |
| | | if (save) { |
| | | String labelId = houseAndHoldExcel.getLabelId(); |
| | | if (StringUtils.isBlank(labelId)) { |
| | | return; |
| | | } |
| | | String[] split = labelId.split(","); |
| | | IUserHouseLabelService bean = SpringUtils.getBean(IUserHouseLabelService.class); |
| | | ILabelService bean1 = SpringUtils.getBean(ILabelService.class); |
| | | for (String s : split) { |
| | | LabelEntity one1 = bean1.getOne(Wrappers.<LabelEntity>lambdaQuery().eq(LabelEntity::getLabelName, s)); |
| | | if (one1 != null) { |
| | | UserHouseLabelEntity userHouseLabelEntity = new UserHouseLabelEntity(); |
| | | userHouseLabelEntity.setLabelId(BigDecimal.valueOf(one1.getId()).longValue()); |
| | | userHouseLabelEntity.setHouseholdId(householdEntity.getId()); |
| | | // 设置默认的绿色 |
| | | userHouseLabelEntity.setColor("green"); |
| | | userHouseLabelEntity.setLableType(1); |
| | | userHouseLabelEntity.setLabelName(s); |
| | | userHouseLabelEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | bean.save(userHouseLabelEntity); |
| | | } |
| | | } |
| | | householdLabelHandle(houseAndHoldExcel, householdEntity); |
| | | } |
| | | } else { |
| | | // 更新 |
| | | one.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | one.setName(houseAndHoldExcel.getName()); |
| | | one.setPhoneNumber(houseAndHoldExcel.getPhoneNumber()); |
| | | if (!Strings.isBlank(houseAndHoldExcel.getRoleType())) { |
| | | one.setRoleType(Integer.parseInt(houseAndHoldExcel.getRoleType())); |
| | | } |
| | | // 与角色关系 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getRelationship())) { |
| | | one.setRelationship(Integer.parseInt(houseAndHoldExcel.getRelationship())); |
| | |
| | | if (!Strings.isBlank(houseAndHoldExcel.getGender())) { |
| | | one.setGender(Short.parseShort(houseAndHoldExcel.getGender())); |
| | | } |
| | | one.setIdCard(houseAndHoldExcel.getIdCard()); |
| | | // 居民身份证 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getIdCard())) { |
| | | // 身份证类型为居民身份证 |
| | | one.setCardType(111); |
| | | one.setIdCard(houseAndHoldExcel.getIdCard()); |
| | | } |
| | | // 党员 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getPartyEmber())) { |
| | | one.setPartyEmber(Integer.parseInt(houseAndHoldExcel.getPartyEmber())); |
| | | } |
| | | // one.setHkmtPass(houseAndHoldExcel.getHkmtPass()); |
| | | // one.setPassport(houseAndHoldExcel.getPassport()); |
| | | // 民族 |
| | | if (!Strings.isBlank(houseAndHoldExcel.getEthnicity())) { |
| | | one.setEthnicity(Integer.parseInt(houseAndHoldExcel.getEthnicity())); |
| | |
| | | } |
| | | one.setCardNumber(houseAndHoldExcel.getCardNumber()); |
| | | one.setOtherContact(houseAndHoldExcel.getOtherContact()); |
| | | if (Strings.isBlank(one.getHouseCode())) { |
| | | if (!Strings.isBlank(one.getHomeAdcode())) { |
| | | // 暂时不处理,导入数据目前都有house_code |
| | | String adCode = shiftResidentHomeAdcode(houseAndHoldExcel.getHomeAdcode()); |
| | | // 转换行政区code |
| | |
| | | // 新增 |
| | | boolean update = householdService.updateById(one); |
| | | if (update) { |
| | | String labelId = houseAndHoldExcel.getLabelId(); |
| | | if (StringUtils.isBlank(labelId)) { |
| | | return; |
| | | // 住户标签处理 |
| | | householdLabelHandle(houseAndHoldExcel,one); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 住户标签处理 |
| | | * @param houseAndHoldExcel |
| | | * @param householdEntity |
| | | */ |
| | | public void householdLabelHandle(HouseAndHoldExcel houseAndHoldExcel, HouseholdEntity householdEntity) { |
| | | String labelId = houseAndHoldExcel.getLabelId(); |
| | | if (!StringUtils.isBlank(labelId)) { |
| | | String[] split = labelId.split(","); |
| | | IUserHouseLabelService bean = SpringUtils.getBean(IUserHouseLabelService.class); |
| | | ILabelService bean1 = SpringUtils.getBean(ILabelService.class); |
| | | for (String s : split) { |
| | | LabelEntity one1 = bean1.getOne(Wrappers.<LabelEntity>lambdaQuery().eq(LabelEntity::getLabelName, s)); |
| | | if (one1 != null) { |
| | | UserHouseLabelEntity userHouseLabelEntity = new UserHouseLabelEntity(); |
| | | userHouseLabelEntity.setLabelId(BigDecimal.valueOf(one1.getId()).longValue()); |
| | | userHouseLabelEntity.setHouseholdId(householdEntity.getId()); |
| | | // 设置默认的绿色 |
| | | userHouseLabelEntity.setColor("green"); |
| | | userHouseLabelEntity.setLableType(1); |
| | | userHouseLabelEntity.setLabelName(s); |
| | | userHouseLabelEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | bean.save(userHouseLabelEntity); |
| | | } |
| | | String[] split = labelId.split(","); |
| | | IUserHouseLabelService bean = SpringUtils.getBean(IUserHouseLabelService.class); |
| | | ILabelService bean1 = SpringUtils.getBean(ILabelService.class); |
| | | for (String s : split) { |
| | | LabelEntity one1 = bean1.getOne(Wrappers.<LabelEntity>lambdaQuery().eq(LabelEntity::getLabelName, s)); |
| | | if (one1 != null) { |
| | | UserHouseLabelEntity userHouseLabelEntity = new UserHouseLabelEntity(); |
| | | userHouseLabelEntity.setLabelId(BigDecimal.valueOf(one1.getId()).longValue()); |
| | | userHouseLabelEntity.setHouseholdId(one.getId()); |
| | | userHouseLabelEntity.setLableType(1); |
| | | userHouseLabelEntity.setLabelName(s); |
| | | // 设置默认的绿色 |
| | | userHouseLabelEntity.setColor("green"); |
| | | userHouseLabelEntity.setHouseCode(houseAndHoldExcel.getHouseCode()); |
| | | bean.save(userHouseLabelEntity); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 住户业主信息处理,将业主人员插入到用户表 |
| | | * |
| | | * @return |
| | | */ |
| | | public void userHandle(HouseholdEntity householdEntity) { |
| | | if (!Strings.isBlank(householdEntity.getPhoneNumber())) { |
| | | // 根据手机号查询对应账号和手机号的用户信息 |
| | | List<User> userList = userService.getUserListByPhoneOrAccount(householdEntity.getPhoneNumber()); |
| | | if (userList.size() > 0) { |
| | | User user = userList.get(0); |
| | | householdEntity.setAssociatedUserId(user.getId()); |
| | | // 更新 |
| | | householdService.updateById(householdEntity); |
| | | // 判断用户是否包含了居民角色,不包含则需更新 |
| | | if (!user.getRoleId().contains("1717429059648606209")) { |
| | | user.setRoleId(user.getRoleId() + ",1717429059648606209"); |
| | | //更新 |
| | | userService.updateById(user); |
| | | } |
| | | } else { |
| | | // 插入用户信息 |
| | | //如果用户不存在,则新增一个用户 |
| | | User newUser = new User(); |
| | | newUser.setAccount(householdEntity.getPhoneNumber()); |
| | | newUser.setPhone(householdEntity.getPhoneNumber()); |
| | | newUser.setName(householdEntity.getName()); |
| | | newUser.setRealName(householdEntity.getName()); |
| | | // 社区群众部门 |
| | | newUser.setDeptId("1727979636479037441"); |
| | | // 目前暂定居民角色, |
| | | newUser.setRoleId("1717429059648606209"); |
| | | //默认密码为 123456 |
| | | newUser.setPassword("123456"); |
| | | // 用户新增 |
| | | boolean submit = userService.submit(newUser); |
| | | // 更新绑定用户信息 |
| | | householdEntity.setAssociatedUserId(newUser.getId()); |
| | | // 更新 |
| | | householdService.updateById(householdEntity); |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 房屋画像统计-按房屋标签统计 |
| | | * @param house |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<Map<String,Object>> getHouseLabelStatistic(HouseVO house) { |
| | | CommonParamSet commonParamSet = new CommonParamSet<>().invoke(HouseVO.class, house); |
| | | // 按房屋标签统计 |
| | | List<Map<String,Object>> list = baseMapper.getHouseLabelStatistic(house, |
| | | commonParamSet.getIsAdministrator(), |
| | | commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getGridCodeList()); |
| | | // 返回 |
| | | return list; |
| | | } |
| | | } |