| | |
| | | */ |
| | | public static List<DictBiz> getList(String code) { |
| | | String keyPrefix = DICT_LIST.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON); |
| | | return CacheUtil.get(DICT_CACHE, keyPrefix, code, () -> dictService.getList(code)); |
| | | return CacheUtil.get(DICT_CACHE, keyPrefix, code, () -> dictService.getList(code,null)); |
| | | } |
| | | |
| | | } |
| | |
| | | //所有行政区划code |
| | | List<String> allRegionList = new ArrayList<>(); |
| | | deptIdList.forEach(id->{ |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | // 查询对应的区域编号code |
| | | Dept dept = deptService.getById(id); |
| | | if (null!=dept && !Strings.isBlank(dept.getRegionCode()) && !AuthUtil.isAdministrator()){ |
| | | list = getRegionChildCodes(dept.getRegionCode()); |
| | | |
| | | //行政区划不为空添加进集合 |
| | | if (list.size()>0){ |
| | | allRegionList.addAll(list); |
| | |
| | | private void handleDictBiz(List<HouseholdVO> householdList) { |
| | | if (householdList.size()>0){ |
| | | // 查询角色关系字典 |
| | | List<DictBiz> dictBizList = dictBizService.getList("roleRelation"); |
| | | List<DictBiz> dictBizList = dictBizService.getList("roleRelation",null); |
| | | if (dictBizList.size()>0) { |
| | | // 遍历 |
| | | for (HouseholdVO householdVO : householdList) { |
| | |
| | | * |
| | | * @param page |
| | | * @param place |
| | | * @param houseCodeList |
| | | * @param gridCodeList |
| | | * @param regionChildCodesList |
| | | * @param isAdministrator |
| | | * @param isAdministrator |
| | | * @return |
| | | */ |
| | | List<PlaceVO> selectNinePlacePage(IPage page, |
| | | @Param("place") PlaceVO place, |
| | | @Param("houseCodeList") List<String> houseCodeList, |
| | | @Param("gridCodeList") List<String> gridCodeList, |
| | | @Param("regionChildCodesList") List<String> regionChildCodesList, |
| | | @Param("isAdministrator") Integer isAdministrator); |
| | | @Param("isAdministrator") Integer isAdministrator, |
| | | @Param("nineTypeList") List<String> nineTypeList); |
| | | |
| | | |
| | | /** |
| | |
| | | jpe.confirm_flag confirmFlag, |
| | | bus.`name` AS policeName, |
| | | bus.phone AS policePhone, |
| | | IFNULL(jda.address_name,jp.location) addressName, |
| | | jp.location as addressName, |
| | | jpag.pcs_name deptName |
| | | from jczz_place jp |
| | | left join jczz_grid jg on jg.grid_code = jp.grid_code and jg.is_deleted = 0 |
| | | left join blade_user bu on bu.id = jp.principal_user_id and bu.is_deleted = 0 |
| | | left join jczz_place_ext jpe on jpe.place_id=jp.id and jpe.is_deleted = 0 |
| | | LEFT JOIN jczz_police_affairs_grid jpag on jp.jw_grid_code= jpag.jw_grid_code |
| | | left join blade_region br on br.code = jpag.community_code |
| | | LEFT JOIN blade_user bus on bus.id = jpag.police_user_id |
| | | LEFT JOIN jczz_doorplate_address jda on jda.address_code=jp.house_code |
| | | left join ( |
| | | select a.* from jczz_place_poi_label a inner join |
| | | ( |
| | |
| | | <if test="place.policeName!=null and place.policeName!=''"> |
| | | and bus.name like concat('%',#{place.policeName},'%') |
| | | </if> |
| | | |
| | | <if test="place.nineType!=null and place.nineType!=''"> |
| | | and jp.nine_type = #{place.nineType} |
| | | <if test="nineTypeList!=null and nineTypeList.size()>0"> |
| | | and jp.nine_type in |
| | | <foreach collection="nineTypeList" separator="," open="(" close=")" item="nineType"> |
| | | #{nineType} |
| | | </foreach> |
| | | </if> |
| | | |
| | | <if test="place.isFront!=null and place.isFront!=''"> |
| | | and jp.is_front = #{place.isFront} |
| | | </if> |
| | |
| | | <if test="place.isPerfect==2"> |
| | | and jp.status = 2 |
| | | </if> |
| | | <if test="houseCodeList != null and houseCodeList.size()>0"> |
| | | and jp.house_code in |
| | | <foreach collection="houseCodeList" item="houseCode" separator ="," open="(" close=")"> |
| | | #{houseCode} |
| | | </foreach> |
| | | </if> |
| | | <if test="isAdministrator==2"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jg.grid_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | <when test="place.roleName != null and place.roleName != ''"> |
| | | <if test="place.roleName=='wgy'"> |
| | | <choose> |
| | | <when test="gridCodeList !=null and gridCodeList.size()>0"> |
| | | and jp.grid_code in |
| | | <foreach collection="gridCodeList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jp.grid_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | <if test="place.roleName=='mj'"> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | and jpag.community_code in ('') |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | </when> |
| | | <otherwise> |
| | | <choose> |
| | | <when test="regionChildCodesList !=null and regionChildCodesList.size()>0"> |
| | | and |
| | | ( |
| | | jg.grid_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | or |
| | | jpag.community_code in |
| | | <foreach collection="regionChildCodesList" item="code" open="(" close=")" separator=","> |
| | | #{code} |
| | | </foreach> |
| | | ) |
| | | </when> |
| | | <otherwise> |
| | | and |
| | | ( |
| | | jg.grid_code in ('') or jpag.community_code in in ('') |
| | | ) |
| | | </otherwise> |
| | | </choose> |
| | | </otherwise> |
| | | </choose> |
| | | </if> |
| | | order by jp.create_time desc,jp.id desc |
| | |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springblade.modules.system.service.IDeptService; |
| | | import org.springblade.modules.system.service.IDictBizService; |
| | | import org.springblade.modules.system.service.IRegionService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 场所表 服务实现类 |
| | |
| | | |
| | | @Autowired |
| | | private IHouseholdService householdService; |
| | | |
| | | @Autowired |
| | | private IDictBizService dictBizService; |
| | | |
| | | /** |
| | | * 自定义列表查询 |
| | |
| | | */ |
| | | @Override |
| | | public IPage<PlaceVO> selectNinePlacePage(IPage<PlaceVO> page, PlaceVO place) { |
| | | // todo |
| | | List<String> regionChildCodesList = new ArrayList<>();//SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator() == true ? 1 : 2; |
| | | List<String> list = new ArrayList<>(); |
| | | if (null != place.getRoleName() && !place.getRoleName().equals("")) { |
| | | if (place.getRoleName().equals("网格员")) { |
| | | // 查询对应的房屋地址code |
| | | list = gridService.getAddressCodeListByUserId(AuthUtil.getUserId()); |
| | | String roleName = SpringUtils.getRequestParam("roleName"); |
| | | String communityCode = SpringUtils.getRequestParam("communityCode"); |
| | | if (!Strings.isBlank(communityCode)){ |
| | | // 校验社区编号是否合规 |
| | | if(null!=SpringUtils.getBean(IRegionService.class).getById(communityCode)) { |
| | | place.setCommunityCode(communityCode); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectNinePlacePage(page, place, list, regionChildCodesList, isAdministrator); |
| | | List<String> regionChildCodesList = SysCache.getRegionChildCodesByDeptId(AuthUtil.getDeptId()); |
| | | Integer isAdministrator = AuthUtil.isAdministrator()==true?1:2; |
| | | // 网格编号集合 |
| | | List<String> gridCodeList = new ArrayList<>(); |
| | | // 民警角色 |
| | | if (!Strings.isBlank(roleName)){ |
| | | place.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()); |
| | | } |
| | | } |
| | | List<String> strings = new ArrayList<>(); |
| | | if (null!=place.getNineType()){ |
| | | QueryWrapper<DictBiz> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("is_deleted",0).eq("dict_key",place.getNineType()).eq("code","nineType"); |
| | | // 先查询当前 |
| | | DictBiz one = dictBizService.getOne(queryWrapper); |
| | | // 查询本身和子集的key |
| | | List<DictBiz> list = dictBizService.getList("nineType", one.getId()); |
| | | if (list.size()==0){ |
| | | strings.add(place.getNineType().toString()); |
| | | }else { |
| | | strings = list.stream().map(DictBiz::getDictKey).collect(Collectors.toList()); |
| | | } |
| | | } |
| | | List<PlaceVO> placeVOS = baseMapper.selectNinePlacePage(page, place, gridCodeList, regionChildCodesList, isAdministrator,strings); |
| | | // 返回 |
| | | return page.setRecords(placeVOS); |
| | | } |
| | |
| | | private String deptName; |
| | | @ApiModelProperty(value = "地址") |
| | | private String addressName; |
| | | /** |
| | | * 社区编号 |
| | | */ |
| | | private String communityCode; |
| | | |
| | | } |
| | |
| | | @ApiOperationSupport(order = 8) |
| | | @ApiOperation(value = "获取字典", notes = "获取字典") |
| | | public R<List<DictBiz>> dictionary(String code) { |
| | | List<DictBiz> tree = dictService.getList(code); |
| | | List<DictBiz> tree = dictService.getList(code,null); |
| | | return R.data(tree); |
| | | } |
| | | |
| | |
| | | @ApiOperationSupport(order = 9) |
| | | @ApiOperation(value = "获取字典树", notes = "获取字典树") |
| | | public R<List<DictBizVO>> dictionaryTree(String code) { |
| | | List<DictBiz> tree = dictService.getList(code); |
| | | List<DictBiz> tree = dictService.getList(code,null); |
| | | return R.data(DictBizWrapper.build().listNodeVO(tree)); |
| | | } |
| | | |
| | |
| | | * @param code 字典编号 |
| | | * @return |
| | | */ |
| | | List<DictBiz> getList(String code); |
| | | List<DictBiz> getList(String code,Long parentId); |
| | | |
| | | /** |
| | | * 获取树形节点 |
| | |
| | | and parent_id > 0 |
| | | and is_sealed = 0 |
| | | and is_deleted = 0 |
| | | <if test="param2!=null"> |
| | | and parent_id = #{param2} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="tree" resultMap="treeNodeResultMap"> |
| | |
| | | */ |
| | | @MapKey(value = "id") |
| | | Map<String, TreeStringNode> getPoliceTreeList(); |
| | | |
| | | /** |
| | | * 查询公安相关的区域数据 |
| | | * @return |
| | | */ |
| | | List<Region> getPoliceList(); |
| | | } |
| | |
| | | right join jczz_grid jg on jg.community_code = br.village_code and jg.is_deleted = 0 |
| | | where br.ancestors like concat('%',#{regionCode},'%') |
| | | ) |
| | | union all |
| | | ( |
| | | SELECT |
| | | t1.id,t1.parentId,t1.name |
| | | FROM |
| | | ( |
| | | SELECT |
| | | @ids AS ids, |
| | | ( SELECT @ids := GROUP_CONCAT( id ) FROM police_region WHERE FIND_IN_SET( parentId, @ids ) ) AS cids |
| | | FROM |
| | | police_region |
| | | WHERE |
| | | @ids IS NOT NULL |
| | | AND @ids := #{regionCode} |
| | | ) id, |
| | | police_region t1 |
| | | WHERE |
| | | FIND_IN_SET(t1.parentId,ids) |
| | | ) |
| | | </select> |
| | | |
| | | <!--查询公安相关的区域数据--> |
| | | <select id="getPoliceList" resultType="org.springblade.modules.system.entity.Region"> |
| | | SELECT id as code,parentId as parent_code,name,'' as ancestors,null as region_level,1 as sort FROM police_region |
| | | </select> |
| | | |
| | | |
| | |
| | | * @param code 字典编号 |
| | | * @return |
| | | */ |
| | | List<DictBiz> getList(String code); |
| | | List<DictBiz> getList(String code,Long parentId); |
| | | |
| | | /** |
| | | * 新增或修改 |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<DictBiz> getList(String code) { |
| | | return baseMapper.getList(code); |
| | | public List<DictBiz> getList(String code,Long parentId) { |
| | | return baseMapper.getList(code,parentId); |
| | | } |
| | | |
| | | @Override |
| | |
| | | package org.springblade.modules.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.google.common.collect.Lists; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.logging.log4j.util.Strings; |
| | | import org.springblade.common.cache.SysCache; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.springblade.common.cache.RegionCache.*; |
| | | |
| | |
| | | */ |
| | | @Override |
| | | public List<Region> getRegionChild(String regionCode) { |
| | | return baseMapper.getRegionChildList(regionCode); |
| | | // 创建区域对象 |
| | | List<Region> list = new ArrayList<>(); |
| | | // 查询公安相关的区域数据 |
| | | List<Region> regionList = baseMapper.getPoliceList(); |
| | | if (regionList.size()>0) { |
| | | List<Region> policeList = treeRegionList(regionList,regionCode, list); |
| | | list.addAll(policeList); |
| | | } |
| | | // 查询综治区域集合 |
| | | List<Region> regionChildList = baseMapper.getRegionChildList(regionCode); |
| | | list.addAll(regionChildList); |
| | | // 返回 |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取某个父节点下面的所有子节点 |
| | | * @param regionList |
| | | * @param parentCode |
| | | * @param list |
| | | * @return |
| | | */ |
| | | public static List<Region> treeRegionList( List<Region> regionList, String parentCode,List<Region> list){ |
| | | for(Region region: regionList){ |
| | | //遍历出父id等于参数的id,add进子节点集合 |
| | | if(region.getParentCode().equals(parentCode)){ |
| | | list.add(region); |
| | | //递归遍历下一级 |
| | | treeRegionList(regionList,region.getCode(),list); |
| | | } |
| | | } |
| | | return list; |
| | | } |
| | | } |