| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.SysCache; |
| | | import org.springblade.common.param.CommonParamSet; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.place.entity.PlaceEntity; |
| | | import org.springblade.modules.place.entity.PlaceExtEntity; |
| | |
| | | import org.springblade.modules.place.service.IPlacePractitionerService; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | | import org.springblade.modules.place.vo.PlaceExtVO; |
| | | import org.springblade.modules.system.entity.Dept; |
| | | import org.springblade.modules.place.vo.PlaceVO; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Autowired |
| | | private IPlacePractitionerService placePractitionerService; |
| | | |
| | | @Autowired |
| | | private IGridService gridService; |
| | | |
| | | @Autowired |
| | | private IDeptService deptService; |
| | | // @Autowired |
| | | // private IGridService gridService; |
| | | // |
| | | // @Autowired |
| | | // private IDeptService deptService; |
| | | |
| | | /** |
| | | * 自定义查询 |
| | |
| | | */ |
| | | @Override |
| | | public IPage<PlaceExtVO> selectPlaceExtPage(IPage<PlaceExtVO> page, PlaceExtVO placeExt) { |
| | | List<String> list = new ArrayList<>(); |
| | | if (null != placeExt.getRoleName() && !placeExt.getRoleName().equals("")) { |
| | | if (placeExt.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | } |
| | | if (!placeExt.getRoleName().equals("系统管理员")) { |
| | | placeExt.setCreateUser(AuthUtil.getUserId()); |
| | | } |
| | | } |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | if (AuthUtil.getUserAccount().equals("18879306957")) { |
| | | placeExt.setCommunityCode("361102003027"); |
| | | placeExt.setCreateUser(null); |
| | | } |
| | | return page.setRecords(baseMapper.selectPlaceExtPage(page, placeExt, list,regionChildCodesList,isAdministrator)); |
| | | // List<String> list = new ArrayList<>(); |
| | | // String roleName = SpringUtils.getRequestParam("roleName"); |
| | | // String communityCode = SpringUtils.getRequestParam("communityCode"); |
| | | // if (!Strings.isBlank(communityCode)){ |
| | | // // 校验社区编号是否合规 |
| | | // if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) { |
| | | // placeExt.setCommunityCode(communityCode); |
| | | // } |
| | | // } |
| | | // List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | // Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | // // 网格编号集合 |
| | | // List<String> gridCodeList = new ArrayList<>(); |
| | | // // 民警角色 |
| | | // if (!Strings.isBlank(roleName)){ |
| | | // placeExt.setRoleName(roleName); |
| | | // if(roleName.equals("mj")) { |
| | | // regionChildCodesList = SpringUtil.getBean(IPoliceAffairsGridService.class).getCommunityCodeListByUserId(AuthUtil.getUserId()); |
| | | // } |
| | | // if (roleName.equals("wgy")) { |
| | | // gridCodeList = SpringUtil.getBean(IGridService.class).getGridListByUserId(AuthUtil.getUserId()); |
| | | // } |
| | | // } |
| | | // if (AuthUtil.getUserAccount().equals("18879306957")) { |
| | | // placeExt.setCommunityCode("361102003027"); |
| | | // placeExt.setCreateUser(null); |
| | | // } |
| | | CommonParamSet<Object> commonParamSet = new CommonParamSet<>().invoke(PlaceExtVO.class, placeExt); |
| | | |
| | | |
| | | return page.setRecords(baseMapper.selectPlaceExtPage(page, placeExt, commonParamSet.getRegionChildCodesList(), |
| | | commonParamSet.getIsAdministrator(), commonParamSet.getGridCodeList())); |
| | | } |
| | | |
| | | /** |
| | |
| | | updatePlaceInfo(placeExt); |
| | | // 查询对应已存在的从业人员 |
| | | QueryWrapper<PlacePractitionerEntity> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("place_id", placeExt.getPlaceId()); |
| | | wrapper.eq("place_id", placeExt.getPlaceId()).eq("is_deleted", 0); |
| | | List<PlacePractitionerEntity> oldList = placePractitionerService.list(wrapper); |
| | | List<PlacePractitionerEntity> list = placeExt.getPlacePractitioner(); |
| | | // 申明新增,修改,删除集合 |
| | |
| | | List<PlacePractitionerEntity> removeList = new ArrayList<>(); |
| | | // 找出需要新增的,否则组成新集合进行比对 |
| | | for (PlacePractitionerEntity practitionerEntity : list) { |
| | | if (practitionerEntity.getResignationTime() != null) { |
| | | practitionerEntity.setResignationFlag(2); |
| | | } |
| | | practitionerEntity.setPlaceId(placeExt.getPlaceId()); |
| | | if (null == practitionerEntity.getId()) { |
| | | // 新增 |
| | | PlacePractitionerEntity placePractitionerEntity = new PlacePractitionerEntity(); |
| | | |
| | | placePractitionerEntity.setPlaceId(placeExt.getPlaceId()); |
| | | placePractitionerEntity.setName(practitionerEntity.getName()); |
| | | placePractitionerEntity.setTelephone(practitionerEntity.getTelephone()); |
| | | placePractitionerEntity.setTempAddress(practitionerEntity.getTempAddress()); |
| | | addList.add(placePractitionerEntity); |
| | | practitionerEntity.setPlaceId(placeExt.getPlaceId()); |
| | | addList.add(practitionerEntity); |
| | | } else { |
| | | newList.add(practitionerEntity); |
| | | } |
| | |
| | | } |
| | | // 更新 |
| | | placeService.updateById(placeEntity); |
| | | // 警格网格绑定修改 |
| | | if (!Strings.isBlank(placeEntity.getHouseCode()) && !Strings.isBlank(placeEntity.getLng())) { |
| | | PlaceVO placeVO = new PlaceVO(); |
| | | placeVO.setHouseCode(placeEntity.getHouseCode()); |
| | | placeVO.setLng(placeEntity.getLng()); |
| | | placeVO.setLat(placeEntity.getLat()); |
| | | // 网格绑定 |
| | | placeService.policePositionHandle(placeVO); |
| | | // 警务网格绑定 |
| | | placeService.jwGridCodeBind(placeVO); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | // 查询从业人员信息 |
| | | QueryWrapper<PlacePractitionerEntity> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("place_id", placeExt.getPlaceId()); |
| | | queryWrapper.eq("resignation_flag",1); |
| | | detail.setPlacePractitioner(placePractitionerService.list(queryWrapper)); |
| | | } |
| | | // 返回 |
| | |
| | | |
| | | @Override |
| | | public Integer selectCount(Long userId, String neiCode, Integer confirmFlag) { |
| | | return baseMapper.selectCount(userId, neiCode, confirmFlag); |
| | | PlaceExtVO placeExt = new PlaceExtVO(); |
| | | placeExt.setConfirmFlag(confirmFlag); |
| | | placeExt.setNeiCode(neiCode); |
| | | CommonParamSet<Object> commonParamSet = new CommonParamSet<>().invoke(PlaceExtVO.class, placeExt); |
| | | return baseMapper.selectCount(placeExt, commonParamSet.getRegionChildCodesList(), commonParamSet.getIsAdministrator(), commonParamSet.getGridCodeList()); |
| | | } |
| | | } |