| | |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.SpringUtil; |
| | | import org.springblade.modules.category.entity.CategoryEntity; |
| | | import org.springblade.modules.category.service.ICategoryService; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService; |
| | | import org.springblade.modules.grid.entity.GridEntity; |
| | |
| | | import org.springblade.modules.house.entity.HouseholdEntity; |
| | | import org.springblade.modules.house.entity.UserHouseLabelEntity; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.label.entity.LabelEntity; |
| | | import org.springblade.modules.place.entity.*; |
| | | import org.springblade.modules.place.excel.NinePlaceExcel; |
| | | import org.springblade.modules.place.excel.PlaceAndRelExcel; |
| | |
| | | import org.springblade.modules.police.service.IPoliceAffairsGridService; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.system.entity.DictBiz; |
| | | import org.springblade.modules.system.entity.Region; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IDictBizService; |
| | |
| | | } |
| | | |
| | | /** |
| | | * 保存场所详情信息 |
| | | * |
| | | * @param placeEntity |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void savePlaceExtInfo(PlaceEntity placeEntity) { |
| | | PlaceExtEntity placeExtEntity = new PlaceExtEntity(); |
| | | placeExtEntity.setPlaceId(placeEntity.getId()); |
| | | // 判断是否已存在,已存在则不新增 |
| | | QueryWrapper<PlaceExtEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("is_deleted", 0) |
| | | .eq("place_id", placeEntity.getId()); |
| | | PlaceExtEntity one = placeExtService.getOne(wrapper); |
| | | if (null == one) { |
| | | placeExtEntity.setPlaceId(placeEntity.getId()); |
| | | // 默认给待完善状态 |
| | | placeExtEntity.setConfirmFlag(4); |
| | | placeExtEntity.setCreateTime(new Date()); |
| | | placeExtEntity.setUpdateTime(new Date()); |
| | | placeExtEntity.setCreateUser(AuthUtil.getUserId()); |
| | | placeExtEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | // 新增场所详情 |
| | | placeExtService.save(placeExtEntity); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 历史场所挂接处理-临时 |
| | | * |
| | | * @param place |
| | |
| | | if (!Strings.isBlank(placeExcel.getPhoneNumber()) && |
| | | !Strings.isBlank(placeExcel.getName())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setPhone(placeExcel.getPhoneNumber()); |
| | | placeVO.setUsername(placeExcel.getName()); |
| | | placeVO.setPrincipalPhone(placeExcel.getPhoneNumber()); |
| | | placeVO.setPrincipal(placeExcel.getName()); |
| | | // 更新场所负责人 |
| | | User user = bindUserHandle(placeVO); |
| | | // 返回 |
| | |
| | | placeEntity.setSource(3); |
| | | //一个一个插入,防止同一个表中有相同的数据 |
| | | save(placeEntity); |
| | | // 插入详情 |
| | | savePlaceExtInfo(placeEntity); |
| | | // 插入标签关系表 |
| | | savPlaceLabelBind(placeExcel, placeEntity); |
| | | // 插入关联数据表 |
| | | PlaceRelEntity placeRelEntity = new PlaceRelEntity(); |
| | | placeRelEntity.setPlaceId(placeEntity.getId()); |
| | | placeRelEntity.setStreetName(placeExcel.getStreetName()); |
| | | QueryWrapper<Region> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("name",placeExcel.getCommunityName()); |
| | | Region region = SpringUtils.getBean(IRegionService.class).getOne(wrapper); |
| | | if (null!=region){ |
| | | placeRelEntity.setCommunityCode(region.getCode()); |
| | | } |
| | | placeRelEntity.setCommunityName(placeExcel.getCommunityName()); |
| | | placeRelEntity.setGridName(placeExcel.getGridName()); |
| | | placeRelEntity.setBuildingName(placeExcel.getBuildingName()); |
| | |
| | | placeEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | //一个一个插入,防止同一个表中有相同的数据 |
| | | updateById(placeEntity); |
| | | // 插入详情 |
| | | savePlaceExtInfo(placeEntity); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public void savPlaceLabelBind(PlaceAndRelExcel placeExcel, PlaceEntity placeEntity) { |
| | | if (!Strings.isBlank(placeExcel.getLabelCode())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setId(placeEntity.getId()); |
| | | placeVO.setLabel(placeExcel.getLabelCode()); |
| | | // 插入标签 |
| | | placeLabelBind(placeVO); |
| | | // 匹配标签 |
| | | QueryWrapper<CategoryEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("level",3).eq("category_name",placeExcel.getLabelCode()).eq("is_deleted",0); |
| | | // 查询 |
| | | List<CategoryEntity> list = SpringUtils.getBean(ICategoryService.class).list(wrapper); |
| | | if (list.size()>0){ |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | CategoryEntity categoryEntity = list.get(0); |
| | | placeVO.setLabel(categoryEntity.getCategoryNo()); |
| | | placeVO.setId(placeEntity.getId()); |
| | | // 插入标签 |
| | | placeLabelBind(placeVO); |
| | | } |
| | | } |
| | | } |
| | | |