| | |
| | | package org.springblade.es.service; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.elasticsearch.action.admin.indices.delete.DeleteIndexRequest; |
| | |
| | | import org.springblade.es.vo.EsParam; |
| | | import org.springblade.modules.article.entity.Article; |
| | | import org.springblade.modules.article.service.ArticleService; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService; |
| | | import org.springblade.modules.grid.service.IGridRangeService; |
| | | import org.springblade.modules.house.entity.HouseEntity; |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | |
| | | |
| | | @Autowired |
| | | private IGridRangeService gridRangeService; |
| | | |
| | | @Autowired |
| | | private IDoorplateAddressService doorplateAddressService; |
| | | |
| | | @Value("${elasticsearch.sync}") |
| | | private boolean elasticsearchSync; |
| | |
| | | "name", household.getName(), |
| | | "phone", household.getPhoneNumber(), |
| | | "idCard", household.getIdCard(), |
| | | "content", household.getCurrentAddress(), |
| | | "relationship", household.getRelationship().toString(), |
| | | "content", getAddress(household), |
| | | "communityCode", householdService.getCommunityCode(household.getId()) |
| | | ); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取房屋地址 |
| | | * @param household |
| | | * @return |
| | | */ |
| | | public String getAddress(HouseholdEntity household) { |
| | | if (!Strings.isBlank(household.getHouseCode())){ |
| | | // 查询对应的房屋地址 |
| | | QueryWrapper<DoorplateAddressEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("address_code",household.getHouseCode()); |
| | | List<DoorplateAddressEntity> list = doorplateAddressService.list(queryWrapper); |
| | | if (list.size()>0){ |
| | | return list.get(0).getAddressName(); |
| | | } |
| | | // 房屋查不到的情况 |
| | | if (!Strings.isBlank(household.getCurrentAddress())){ |
| | | return household.getCurrentAddress(); |
| | | } |
| | | }else { |
| | | return household.getCurrentAddress(); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | setHouseMap((HouseEntity) item, data); |
| | | } |
| | | if (esParam.getTableName().equals("jczz_household")) { |
| | | setHousehouldMap((HouseholdEntity) item, data); |
| | | setHouseholdMap((HouseholdEntity) item, data); |
| | | } |
| | | Map<String, Object> param = new HashMap<String, Object>(); |
| | | param.put("data", data); |
| | |
| | | * @param item |
| | | * @param data |
| | | */ |
| | | private void setHousehouldMap(HouseholdEntity item, Map<String, Object> data) { |
| | | private void setHouseholdMap(HouseholdEntity item, Map<String, Object> data) { |
| | | data.put("communityCode",householdService.getCommunityCode(item.getId())); |
| | | data.put("tableId",item.getId()); |
| | | data.put("title",item.getName()); |
| | | data.put("relationship",item.getRelationship()); |
| | | data.put("name",item.getName()); |
| | | data.put("phone",item.getPhoneNumber()); |
| | | data.put("idCard",item.getIdCard()); |
| | | data.put("content",item.getCurrentAddress()); |
| | | data.put("content",getAddress(item)); |
| | | } |
| | | |
| | | /** |