9 files modified
2 files added
| | |
| | | |
| | | /** |
| | | * 根据角色获取功能集合数据 |
| | | * @param type |
| | | * @param roleName |
| | | * @return |
| | | */ |
| | | @GetMapping("/getFuncList") |
| | | public R getFuncList(String roleName) { |
| | | return R.data(doorplateAddressService.getFuncList(roleName)); |
| | | public R getFuncList(Integer type,String roleName) { |
| | | return R.data(doorplateAddressService.getFuncList(type,roleName)); |
| | | } |
| | | |
| | | /** |
| | | * 获取楼盘相关集合数据 |
| | | * @param name 名称 |
| | | * @param code 编号 |
| | | * @param type 类型 1:社区 2:小区 3:楼栋 4:户室 |
| | | * @return |
| | | */ |
| | | @GetMapping("/getHousesList") |
| | | public R getHousesList(String name,String code,Integer type) { |
| | | return R.data(doorplateAddressService.getHousesList(name,code,type)); |
| | | } |
| | | |
| | | |
| | |
| | | import org.springblade.common.node.TreeNode; |
| | | import org.springblade.modules.doorplateAddress.entity.DoorplateAddressEntity; |
| | | import org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO; |
| | | import org.springblade.modules.doorplateAddress.vo.FuncNode; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | * @return |
| | | */ |
| | | List<TreeNode> getRegionListByGrouyNei(); |
| | | |
| | | /** |
| | | * 根据社区名称查询小区集合 |
| | | * @param name |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<TreeNode> getDistrictList(@Param("name") String name,@Param("code") String code); |
| | | |
| | | /** |
| | | * 根据社区名称查询楼栋集合 |
| | | * @param name |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<TreeNode> getBuildingList(@Param("name") String name,@Param("code") String code); |
| | | |
| | | /** |
| | | * 查询户室及住户相关信息,单元中包含住户 |
| | | * @param name |
| | | * @param code |
| | | * @return |
| | | */ |
| | | List<FuncNode> getUnitHouseholdList(@Param("name") String name, @Param("code") String code); |
| | | } |
| | |
| | | select nei_name as name from jczz_doorplate_address group by nei_name |
| | | </select> |
| | | |
| | | <!--根据社区名称查询小区集合--> |
| | | <select id="getDistrictList" resultType="org.springblade.common.node.TreeNode" > |
| | | select district_code as id,district_name as name from jczz_doorplate_address |
| | | where 1=1 |
| | | and nei_name = #{name} |
| | | and district_name !='' |
| | | and district_code !='' |
| | | group by district_code,district_name |
| | | </select> |
| | | |
| | | <!--根据社区名称查询楼栋集合--> |
| | | <select id="getBuildingList" resultType="org.springblade.common.node.TreeNode" > |
| | | select building_code as id,building_name as name from jczz_doorplate_address |
| | | where 1=1 |
| | | and district_code = #{code} |
| | | and building_code !='' |
| | | and building_name !='' |
| | | group by building_code,building_name |
| | | order by building_name |
| | | </select> |
| | | |
| | | <!--查询户室及住户相关信息,单元中包含住户--> |
| | | <select id="getUnitHouseholdList" resultType="org.springblade.modules.doorplateAddress.vo.FuncNode" > |
| | | select |
| | | jda.unit_code unitCode,jda.floor,jda.house_name as houseNo,jda.address_code addressCode, |
| | | jh.name as realName,jh.role_type as roleType |
| | | from jczz_doorplate_address jda |
| | | left join |
| | | (select house_code,name,role_type from jczz_household where role_type = '业主') jh |
| | | on jda.address_code = jh.house_code |
| | | where 1=1 and floor != '' and house_name != '' |
| | | and building_code = #{code} |
| | | </select> |
| | | |
| | | </mapper> |
| | |
| | | |
| | | /** |
| | | * 根据角色获取功能集合数据 |
| | | * @param type |
| | | * @param roleName |
| | | * @return |
| | | */ |
| | | Object getFuncList(String roleName); |
| | | Object getFuncList(Integer type,String roleName); |
| | | |
| | | /** |
| | | * 获取楼盘相关集合数据 |
| | | * @param name 名称 |
| | | * @param code 编号 |
| | | * @param type 类型 1:社区 2:小区 3:楼栋 4:户室 |
| | | * @return |
| | | */ |
| | | Object getHousesList(String name, String code, Integer type); |
| | | } |
| | |
| | | import org.springblade.modules.doorplateAddress.mapper.DoorplateAddressMapper; |
| | | import org.springblade.modules.doorplateAddress.service.IDoorplateAddressService; |
| | | import org.springblade.modules.doorplateAddress.vo.DoorplateAddressVO; |
| | | import org.springblade.modules.doorplateAddress.vo.FuncNode; |
| | | import org.springblade.modules.house.service.IHouseholdLabelService; |
| | | import org.springblade.modules.house.service.IHouseholdService; |
| | | import org.springblade.modules.place.service.IPlaceService; |
| | |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 门牌地址表(总台账数据) 服务实现类 |
| | |
| | | |
| | | /** |
| | | * 根据角色获取功能集合数据 |
| | | * @param type 1:查区域 2:查场所 3:查房屋 |
| | | * @param roleName |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object getFuncList(String roleName) { |
| | | public Object getFuncList(Integer type,String roleName) { |
| | | List<TreeNode> list = new ArrayList<>(); |
| | | if (null!=roleName && !roleName.equals("")) { |
| | | if (null!=type) { |
| | | // 如果是网格管理员,系统管理员 |
| | | if (roleName.equals("网格管理员") || roleName.equals("系统管理员")){ |
| | | if (type==1){ |
| | | // 查询街道 |
| | | List<TreeNode> townList = baseMapper.getRegionListByGrouyTwon(); |
| | | // 查询社区 |
| | |
| | | return townList; |
| | | } |
| | | // 如果是场所负责人 |
| | | if (roleName.equals("场所负责人")){ |
| | | if (type==2){ |
| | | // 查询场所集合信息 |
| | | list = placeService.selectPlaceNodeList(AuthUtil.getUserId()); |
| | | // 返回 |
| | | return list; |
| | | } |
| | | // 如果是居民 |
| | | if (roleName.equals("居民")){ |
| | | if (type==3){ |
| | | // 查询房屋集合信息 |
| | | list = householdService.selectHouseNodeList(AuthUtil.getUserId()); |
| | | // 返回 |
| | |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 获取楼盘相关集合数据 |
| | | * @param name 名称 |
| | | * @param code 编号 |
| | | * @param type 类型 1:社区 2:小区 3:楼栋 4:户室 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object getHousesList(String name, String code, Integer type) { |
| | | List<TreeNode> list = new ArrayList<>(); |
| | | // 查小区,场所 |
| | | if (type==1){ |
| | | // 根据社区名称查询小区集合 |
| | | list = baseMapper.getDistrictList(name,code); |
| | | } |
| | | // 查楼栋,场所 |
| | | if (type==2){ |
| | | // 根据社区名称查询楼栋集合 |
| | | list = baseMapper.getBuildingList(name,code); |
| | | } |
| | | // 查户室 |
| | | if (type==3){ |
| | | // 查询户室及住户相关信息,单元中包含住户 |
| | | return getUnitHouseholdList(name,code); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 查询户室及住户相关信息,单元中包含住户 |
| | | * @param name |
| | | * @param code |
| | | * @return |
| | | */ |
| | | private List<FuncNode> getUnitHouseholdList(String name, String code) { |
| | | List<FuncNode> list = new ArrayList<>(); |
| | | // 查询户室及住户相关信息,单元中包含住户 |
| | | List<FuncNode> funcNodes = baseMapper.getUnitHouseholdList(name,code); |
| | | // 处理,先按单元分组,再按楼层分组 |
| | | if (funcNodes.size()>0){ |
| | | Map<String, List<FuncNode>> listMap = funcNodes.stream().collect(Collectors.groupingBy(FuncNode::getFloor)); |
| | | List<FuncNode> funcNodeList = new ArrayList<>(); |
| | | listMap.forEach((s, temps) -> { |
| | | FuncNode funcNode = new FuncNode(); |
| | | funcNode.setFloor(s); |
| | | funcNode.setChildren(temps); |
| | | funcNodeList.add(funcNode); |
| | | }); |
| | | FuncNode funcNode = new FuncNode(); |
| | | funcNode.setUnitName("一单元"); |
| | | funcNode.setChildren(funcNodeList); |
| | | list.add(funcNode); |
| | | } |
| | | // 返回 |
| | | return list; |
| | | } |
| | | } |
| | |
| | | package org.springblade.modules.doorplateAddress.vo; |
| | | |
| | | public class FuncNode { |
| | | import lombok.Data; |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class FuncNode implements Serializable { |
| | | |
| | | /** |
| | | * 单元编号 |
| | | */ |
| | | private String unitCode; |
| | | |
| | | /** |
| | | * 单元名称 |
| | | */ |
| | | private String unitName; |
| | | |
| | | /** |
| | | * 楼层 |
| | | */ |
| | | private String floor; |
| | | |
| | | /** |
| | | * 房间号 |
| | | */ |
| | | private String houseNo; |
| | | |
| | | /** |
| | | * 门牌地址编码 |
| | | */ |
| | | private String addressCode; |
| | | |
| | | /** |
| | | * 姓名 |
| | | */ |
| | | private String realName; |
| | | |
| | | /** |
| | | * 角色 |
| | | */ |
| | | private String roleType; |
| | | |
| | | /** |
| | | * 子孙节点 |
| | | */ |
| | | private List<FuncNode> children = new ArrayList<>(); |
| | | |
| | | } |
| | |
| | | import lombok.AllArgsConstructor; |
| | | import javax.validation.Valid; |
| | | |
| | | import org.springblade.core.excel.util.ExcelUtil; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springblade.modules.grid.excel.GridExcel; |
| | | import org.springblade.modules.grid.excel.GridImporter; |
| | | import org.springblade.modules.system.excel.UserExcel; |
| | | import org.springblade.modules.system.excel.UserImporter; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.springblade.modules.grid.entity.GridEntity; |
| | | import org.springblade.modules.grid.vo.GridVO; |
| | | import org.springblade.modules.grid.wrapper.GridWrapper; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | /** |
| | | * 网格表 控制器 |
| | |
| | | return R.status(gridService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | /** |
| | | * 导入网格数据 |
| | | */ |
| | | @PostMapping("/import-grid") |
| | | public R importGrid(MultipartFile file, Integer isCovered) { |
| | | GridImporter gridImporter = new GridImporter(gridService, isCovered == 1); |
| | | ExcelUtil.save(file, gridImporter, GridExcel.class); |
| | | return R.success("操作成功"); |
| | | } |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.grid.excel; |
| | | |
| | | import com.alibaba.excel.annotation.ExcelIgnore; |
| | | import com.alibaba.excel.annotation.ExcelProperty; |
| | | import com.alibaba.excel.annotation.write.style.ColumnWidth; |
| | | import com.alibaba.excel.annotation.write.style.ContentRowHeight; |
| | | import com.alibaba.excel.annotation.write.style.HeadRowHeight; |
| | | import lombok.Data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * UserExcel |
| | | * |
| | | * @author Chill |
| | | */ |
| | | @Data |
| | | @ColumnWidth(25) |
| | | @HeadRowHeight(20) |
| | | @ContentRowHeight(18) |
| | | public class GridExcel implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("租户编号") |
| | | private String tenantId; |
| | | |
| | | @ExcelIgnore |
| | | @ExcelProperty("用户平台") |
| | | private String userType; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("用户平台名称") |
| | | private String userTypeName; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("账户") |
| | | private String account; |
| | | |
| | | @ColumnWidth(10) |
| | | @ExcelProperty("昵称") |
| | | private String name; |
| | | |
| | | @ColumnWidth(10) |
| | | @ExcelProperty("姓名") |
| | | private String realName; |
| | | |
| | | @ExcelProperty("邮箱") |
| | | private String email; |
| | | |
| | | @ColumnWidth(15) |
| | | @ExcelProperty("手机") |
| | | private String phone; |
| | | |
| | | @ExcelIgnore |
| | | @ExcelProperty("角色ID") |
| | | private String roleId; |
| | | |
| | | @ExcelIgnore |
| | | @ExcelProperty("部门ID") |
| | | private String deptId; |
| | | |
| | | @ExcelIgnore |
| | | @ExcelProperty("岗位ID") |
| | | private String postId; |
| | | |
| | | @ExcelProperty("角色名称") |
| | | private String roleName; |
| | | |
| | | @ExcelProperty("部门名称") |
| | | private String deptName; |
| | | |
| | | @ExcelProperty("岗位名称") |
| | | private String postName; |
| | | |
| | | @ColumnWidth(20) |
| | | @ExcelProperty("生日") |
| | | private Date birthday; |
| | | |
| | | } |
| New file |
| | |
| | | /* |
| | | * Copyright (c) 2018-2028, Chill Zhuang All rights reserved. |
| | | * |
| | | * Redistribution and use in source and binary forms, with or without |
| | | * modification, are permitted provided that the following conditions are met: |
| | | * |
| | | * Redistributions of source code must retain the above copyright notice, |
| | | * this list of conditions and the following disclaimer. |
| | | * Redistributions in binary form must reproduce the above copyright |
| | | * notice, this list of conditions and the following disclaimer in the |
| | | * documentation and/or other materials provided with the distribution. |
| | | * Neither the name of the dreamlu.net developer nor the names of its |
| | | * contributors may be used to endorse or promote products derived from |
| | | * this software without specific prior written permission. |
| | | * Author: Chill 庄骞 (smallchill@163.com) |
| | | */ |
| | | package org.springblade.modules.grid.excel; |
| | | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springblade.core.excel.support.ExcelImporter; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.modules.system.service.IUserService; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 网格数据导入类 |
| | | * |
| | | * @author zhongrj |
| | | */ |
| | | @RequiredArgsConstructor |
| | | public class GridImporter implements ExcelImporter<GridExcel> { |
| | | |
| | | private final IGridService gridService; |
| | | private final Boolean isCovered; |
| | | |
| | | @Override |
| | | public void save(List<GridExcel> data) { |
| | | gridService.importGrid(data, isCovered); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.modules.grid.entity.GridEntity; |
| | | import org.springblade.modules.grid.excel.GridExcel; |
| | | import org.springblade.modules.grid.vo.GridVO; |
| | | import org.springblade.core.mp.base.BaseService; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 网格表 服务类 |
| | |
| | | */ |
| | | IPage<GridVO> selectGridPage(IPage<GridVO> page, GridVO grid); |
| | | |
| | | |
| | | /** |
| | | * 网格数导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | void importGrid(List<GridExcel> data, Boolean isCovered); |
| | | } |
| | |
| | | package org.springblade.modules.grid.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.modules.grid.entity.GridEntity; |
| | | import org.springblade.modules.grid.excel.GridExcel; |
| | | import org.springblade.modules.grid.vo.GridVO; |
| | | import org.springblade.modules.grid.mapper.GridMapper; |
| | | import org.springblade.modules.grid.service.IGridService; |
| | | import org.springblade.core.mp.base.BaseServiceImpl; |
| | | import org.springblade.modules.system.entity.User; |
| | | import org.springframework.stereotype.Service; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * 网格表 服务实现类 |
| | |
| | | return page.setRecords(baseMapper.selectGridPage(page, grid)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 网格数导入 |
| | | * @param data |
| | | * @param isCovered |
| | | */ |
| | | @Override |
| | | public void importGrid(List<GridExcel> data, Boolean isCovered) { |
| | | List<GridEntity> list = new ArrayList<>(); |
| | | // 遍历 |
| | | for (GridExcel gridExcel : data) { |
| | | GridEntity gridEntity = Objects.requireNonNull(BeanUtil.copy(gridExcel, GridEntity.class)); |
| | | gridEntity.setCreateUser(AuthUtil.getUserId()); |
| | | gridEntity.setCreateTime(new Date()); |
| | | gridEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | gridEntity.setUpdateTime(new Date()); |
| | | list.add(gridEntity); |
| | | } |
| | | // 批量导入 |
| | | saveBatch(list); |
| | | } |
| | | } |