| | |
| | | package org.dromara.demo.service.impl; |
| | | |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import jakarta.servlet.http.HttpServletResponse; |
| | | import lombok.Data; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.dromara.common.core.enums.UserStatus; |
| | | import org.dromara.common.core.constant.SystemConstants; |
| | | import org.dromara.common.core.utils.StreamUtils; |
| | | import org.dromara.common.excel.core.DropDownOptions; |
| | | import org.dromara.common.excel.utils.ExcelUtil; |
| | |
| | | // 模拟数据库中的一条数据 |
| | | ExportDemoVo everyRowData = new ExportDemoVo(); |
| | | everyRowData.setNickName("用户-" + i); |
| | | everyRowData.setUserStatus(UserStatus.OK.getCode()); |
| | | everyRowData.setUserStatus(SystemConstants.NORMAL); |
| | | everyRowData.setGender("1"); |
| | | everyRowData.setPhoneNumber(String.format("175%08d", i)); |
| | | everyRowData.setEmail(String.format("175%08d", i) + "@163.com"); |
| | |
| | | List<DemoCityData> provinceList = new ArrayList<>(); |
| | | |
| | | // 实际业务中一般采用数据库读取的形式,这里直接拼接创建 |
| | | provinceList.add(new DemoCityData(0, null, "安徽省")); |
| | | provinceList.add(new DemoCityData(1, null, "江苏省")); |
| | | provinceList.add(new DemoCityData(0, null, "P100000")); |
| | | provinceList.add(new DemoCityData(1, null, "P200000")); |
| | | provinceList.add(new DemoCityData(2, null, "P300000")); |
| | | |
| | | return provinceList; |
| | | } |
| | |
| | | List<DemoCityData> cityList = new ArrayList<>(); |
| | | |
| | | // 实际业务中一般采用数据库读取的形式,这里直接拼接创建 |
| | | cityList.add(new DemoCityData(0, 0, "合肥市")); |
| | | cityList.add(new DemoCityData(1, 0, "芜湖市")); |
| | | cityList.add(new DemoCityData(2, 1, "南京市")); |
| | | cityList.add(new DemoCityData(3, 1, "无锡市")); |
| | | cityList.add(new DemoCityData(4, 1, "徐州市")); |
| | | cityList.add(new DemoCityData(0, 0, "C110000")); |
| | | cityList.add(new DemoCityData(1, 0, "C120000")); |
| | | cityList.add(new DemoCityData(2, 1, "C210000")); |
| | | cityList.add(new DemoCityData(3, 1, "C220000")); |
| | | cityList.add(new DemoCityData(4, 1, "C230000")); |
| | | |
| | | selectParentData(provinceList, cityList); |
| | | |
| | |
| | | private List<DemoCityData> getAreaList(List<DemoCityData> cityList) { |
| | | List<DemoCityData> areaList = new ArrayList<>(); |
| | | |
| | | int minCount = 500; |
| | | int maxCount = 10000; |
| | | |
| | | // 实际业务中一般采用数据库读取的形式,这里直接拼接创建 |
| | | areaList.add(new DemoCityData(0, 0, "瑶海区")); |
| | | areaList.add(new DemoCityData(1, 0, "庐江区")); |
| | | areaList.add(new DemoCityData(2, 1, "南宁县")); |
| | | areaList.add(new DemoCityData(3, 1, "镜湖区")); |
| | | areaList.add(new DemoCityData(4, 2, "玄武区")); |
| | | areaList.add(new DemoCityData(5, 2, "秦淮区")); |
| | | areaList.add(new DemoCityData(6, 3, "宜兴市")); |
| | | areaList.add(new DemoCityData(7, 3, "新吴区")); |
| | | areaList.add(new DemoCityData(8, 4, "鼓楼区")); |
| | | areaList.add(new DemoCityData(9, 4, "丰县")); |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 0, String.format("A11%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 1, String.format("A12%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 2, String.format("A21%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 3, String.format("A22%04d", i))); |
| | | } |
| | | |
| | | for (int i = 0; i < RandomUtil.randomInt(minCount, maxCount); i++) { |
| | | areaList.add(new DemoCityData(areaList.size(), 4, String.format("A23%04d", i))); |
| | | } |
| | | |
| | | selectParentData(cityList, areaList); |
| | | |