+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.controller;
+
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ExcelUtils;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.commons.tools.validator.AssertUtils;
+import com.elink.esua.epdc.commons.tools.validator.ValidatorUtils;
+import com.elink.esua.epdc.commons.tools.validator.group.AddGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.DefaultGroup;
+import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup;
+import com.elink.esua.epdc.dto.CityDTO;
+import com.elink.esua.epdc.dto.epdc.form.CityAreaFormDTO;
+import com.elink.esua.epdc.excel.CityExcel;
+import com.elink.esua.epdc.service.CityService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * 2019版全国5级信息表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2021-10-14
+ */
+@RestController
+@RequestMapping("city")
+public class CityController {
+
+ @Autowired
+ private CityService cityService;
+
+ @GetMapping("page")
+ public Result> page(@RequestParam Map params){
+ PageData page = cityService.page(params);
+ return new Result>().ok(page);
+ }
+
+ @GetMapping("{id}")
+ public Result get(@PathVariable("id") String id){
+ CityDTO data = cityService.get(id);
+ return new Result().ok(data);
+ }
+
+ @PostMapping
+ public Result save(@RequestBody CityDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
+ cityService.save(dto);
+ return new Result();
+ }
+
+ @PutMapping
+ public Result update(@RequestBody CityDTO dto){
+ //效验数据
+ ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
+ cityService.update(dto);
+ return new Result();
+ }
+
+ @DeleteMapping
+ public Result delete(@RequestBody String[] ids){
+ //效验数据
+ AssertUtils.isArrayEmpty(ids, "id");
+ cityService.delete(ids);
+ return new Result();
+ }
+
+ @GetMapping("export")
+ public void export(@RequestParam Map params, HttpServletResponse response) throws Exception {
+ List list = cityService.list(params);
+ ExcelUtils.exportExcelToTarget(response, null, list, CityExcel.class);
+ }
+
+ /**
+ * @describe: 行程上报获取省/市/区/街道/社区信息,通过pid
+ * @author wangtong
+ * @date 2021/10/14 9:35
+ * @params [formDto]
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ */
+ @GetMapping("export")
+ public Result getAreaInfo(@RequestBody CityAreaFormDTO dto) {
+ return cityService.getAreaInfo(dto);
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/CityDao.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/CityDao.java
new file mode 100644
index 0000000..ac2703a
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/dao/CityDao.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.dao;
+
+import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
+import com.elink.esua.epdc.dto.epdc.form.CityAreaFormDTO;
+import com.elink.esua.epdc.entity.CityEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+/**
+ * 2019版全国5级信息表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2021-10-14
+ */
+@Mapper
+public interface CityDao extends BaseDao {
+
+ /**
+ * @describe: 行程上报获取省/市/区/街道/社区信息,通过pid
+ * @author wangtong
+ * @date 2021/10/14 9:35
+ * @params [formDto]
+ * @return com.elink.esua.epdc.commons.tools.utils.Result
+ */
+ List getAreaInfoByPid(CityAreaFormDTO dto);
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/CityEntity.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/CityEntity.java
new file mode 100644
index 0000000..c3bbd4e
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/entity/CityEntity.java
@@ -0,0 +1,111 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+
+import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * 2019版全国5级信息表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2021-10-14
+ */
+@Data
+@EqualsAndHashCode(callSuper=false)
+@TableName("city")
+public class CityEntity extends BaseEpdcEntity {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 区划代码
+ */
+ private Long id;
+
+ /**
+ * 名称
+ */
+ private String name;
+
+ /**
+ * 父级区划代码
+ */
+ private Long pid;
+
+ /**
+ * 省代码
+ */
+ private Long provinceCode;
+
+ /**
+ * 市代码
+ */
+ private Long cityCode;
+
+ /**
+ * 区代码
+ */
+ private Long areaCode;
+
+ /**
+ * 街道代码
+ */
+ private Long streetCode;
+
+ /**
+ * 居委/社区
+ */
+ private Long committeeCode;
+
+ /**
+ * 简称
+ */
+ private String shortName;
+
+ /**
+ * 区号
+ */
+ private String cityNo;
+
+ /**
+ * 纬度
+ */
+ private String lat;
+
+ /**
+ * 经度
+ */
+ private String lng;
+
+ /**
+ * 排序
+ */
+ private Integer sort;
+
+ /**
+ * 级别: 0-国家 ,1-省, 2-市, 3-区/县, 4-街/镇, 5-社区/居委
+ */
+ private Integer level;
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/excel/CityExcel.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/excel/CityExcel.java
new file mode 100644
index 0000000..580ccfe
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/excel/CityExcel.java
@@ -0,0 +1,77 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.excel;
+
+import cn.afterturn.easypoi.excel.annotation.Excel;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 2019版全国5级信息表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2021-10-14
+ */
+@Data
+public class CityExcel {
+
+ @Excel(name = "区划代码")
+ private Long id;
+
+ @Excel(name = "名称")
+ private String name;
+
+ @Excel(name = "父级区划代码")
+ private Long pid;
+
+ @Excel(name = "省代码")
+ private Long provinceCode;
+
+ @Excel(name = "市代码")
+ private Long cityCode;
+
+ @Excel(name = "区代码")
+ private Long areaCode;
+
+ @Excel(name = "街道代码")
+ private Long streetCode;
+
+ @Excel(name = "居委/社区")
+ private Long committeeCode;
+
+ @Excel(name = "简称")
+ private String shortName;
+
+ @Excel(name = "区号")
+ private String cityNo;
+
+ @Excel(name = "纬度")
+ private String lat;
+
+ @Excel(name = "经度")
+ private String lng;
+
+ @Excel(name = "排序")
+ private Integer sort;
+
+ @Excel(name = "级别: 0-国家 ,1-省, 2-市, 3-区/县, 4-街/镇, 5-社区/居委")
+ private Integer level;
+
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/redis/CityRedis.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/redis/CityRedis.java
new file mode 100644
index 0000000..b68f039
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/redis/CityRedis.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.redis;
+
+import com.elink.esua.epdc.commons.tools.redis.RedisUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 2019版全国5级信息表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2021-10-14
+ */
+@Component
+public class CityRedis {
+ @Autowired
+ private RedisUtils redisUtils;
+
+ public void delete(Object[] ids) {
+
+ }
+
+ public void set(){
+
+ }
+
+ public String get(String id){
+ return null;
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/CityService.java b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/CityService.java
new file mode 100644
index 0000000..e068f67
--- /dev/null
+++ b/epdc-cloud-admin/src/main/java/com/elink/esua/epdc/service/CityService.java
@@ -0,0 +1,106 @@
+/**
+ * Copyright 2018 人人开源 https://www.renren.io
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+package com.elink.esua.epdc.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl;
+import com.elink.esua.epdc.commons.tools.page.PageData;
+import com.elink.esua.epdc.commons.tools.utils.ConvertUtils;
+import com.elink.esua.epdc.commons.tools.constant.FieldConstant;
+import com.elink.esua.epdc.commons.tools.utils.Result;
+import com.elink.esua.epdc.dao.CityDao;
+import com.elink.esua.epdc.dto.CityDTO;
+import com.elink.esua.epdc.dto.epdc.form.CityAreaFormDTO;
+import com.elink.esua.epdc.entity.CityEntity;
+import com.elink.esua.epdc.redis.CityRedis;
+import com.elink.esua.epdc.service.CityService;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 2019版全国5级信息表
+ *
+ * @author qu qu@elink-cn.com
+ * @since v1.0.0 2021-10-14
+ */
+@Service
+public class CityServiceImpl extends BaseServiceImpl implements CityService {
+
+ @Autowired
+ private CityRedis cityRedis;
+
+ @Override
+ public PageData page(Map params) {
+ IPage page = baseDao.selectPage(
+ getPage(params, FieldConstant.CREATED_TIME, false),
+ getWrapper(params)
+ );
+ return getPageData(page, CityDTO.class);
+ }
+
+ @Override
+ public List list(Map params) {
+ List entityList = baseDao.selectList(getWrapper(params));
+
+ return ConvertUtils.sourceToTarget(entityList, CityDTO.class);
+ }
+
+ private QueryWrapper getWrapper(Map params){
+ String id = (String)params.get(FieldConstant.ID_HUMP);
+
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
+
+ return wrapper;
+ }
+
+ @Override
+ public CityDTO get(String id) {
+ CityEntity entity = baseDao.selectById(id);
+ return ConvertUtils.sourceToTarget(entity, CityDTO.class);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void save(CityDTO dto) {
+ CityEntity entity = ConvertUtils.sourceToTarget(dto, CityEntity.class);
+ insert(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void update(CityDTO dto) {
+ CityEntity entity = ConvertUtils.sourceToTarget(dto, CityEntity.class);
+ updateById(entity);
+ }
+
+ @Override
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String[] ids) {
+ // 逻辑删除(@TableLogic 注解)
+ baseDao.deleteBatchIds(Arrays.asList(ids));
+ }
+
+ @Override
+ public Result getAreaInfo(CityAreaFormDTO dto) {
+ List result = baseDao.getAreaInfoByPid(dto);
+ return new Result().ok(result);
+ }
+
+}
\ No newline at end of file
diff --git a/epdc-cloud-admin/src/main/resources/mapper/CityDao.xml b/epdc-cloud-admin/src/main/resources/mapper/CityDao.xml
new file mode 100644
index 0000000..ad7bb71
--- /dev/null
+++ b/epdc-cloud-admin/src/main/resources/mapper/CityDao.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file