parent
99b0eee9d4
commit
1cea6510eb
|
|
@ -0,0 +1,25 @@
|
|||
import request from '@/utils/request'
|
||||
|
||||
// 更新所有区域编码
|
||||
export function rest() {
|
||||
return request({
|
||||
url: '/openapi/area/rest',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//获取所有省级区域
|
||||
export function getProvinceArea() {
|
||||
return request({
|
||||
url: '/openapi/area/getProvinceArea',
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
//根据父ID获取区域
|
||||
export function getAreaByParentId(id) {
|
||||
return request({
|
||||
url: '/openapi/area/getAreaByParentId/'+id,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@ const service = axios.create({
|
|||
// axios中请求配置有baseURL选项,表示请求URL公共部分
|
||||
baseURL: process.env.VUE_APP_BASE_API,
|
||||
// 超时
|
||||
timeout: 20000
|
||||
timeout: 40000
|
||||
})
|
||||
|
||||
// request拦截器
|
||||
|
|
|
|||
|
|
@ -0,0 +1,109 @@
|
|||
<template>
|
||||
<div class="app-container">
|
||||
<el-row :gutter="20">
|
||||
<el-col :span="6">
|
||||
|
||||
<el-button size="mini"
|
||||
type="primary"
|
||||
icon="el-icon-arrow-left"
|
||||
:loading="buttonLoading"
|
||||
@click="getNewsArea()">联网获取最新区域编码
|
||||
</el-button>
|
||||
|
||||
<el-tree
|
||||
ref="tree"
|
||||
:props="props"
|
||||
:data="dataList"
|
||||
lazy
|
||||
:load="loadNode"
|
||||
highlight-current
|
||||
>
|
||||
</el-tree>
|
||||
|
||||
|
||||
</el-col>
|
||||
|
||||
<el-col :span="18">
|
||||
|
||||
</el-col>
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {getAreaByParentId, getProvinceArea, rest} from "@/api/business/openapi/common-data";
|
||||
|
||||
export default {
|
||||
name: "Area",
|
||||
data() {
|
||||
return {
|
||||
props: {
|
||||
label: 'name',
|
||||
children: 'districts',
|
||||
isLeaf: 'leaf'
|
||||
},
|
||||
|
||||
dataList: [],
|
||||
|
||||
buttonLoading: false,
|
||||
};
|
||||
},
|
||||
|
||||
created() {
|
||||
this.getProvinceAreaList()
|
||||
},
|
||||
|
||||
methods: {
|
||||
getProvinceAreaList() {
|
||||
getProvinceArea().then(res => {
|
||||
this.dataList = res.data
|
||||
})
|
||||
},
|
||||
|
||||
|
||||
loadNode(node, resolve) {
|
||||
|
||||
if (node.level === 1 || node.level === 2 || node.level === 3) {
|
||||
getAreaByParentId(node.data.id).then(res => {
|
||||
//处理当前没有子节点时不显示箭头
|
||||
if (node.level === 3) {
|
||||
res.data.forEach(a => {
|
||||
|
||||
a.leaf = true
|
||||
});
|
||||
setTimeout(() => {
|
||||
|
||||
return resolve(res.data);
|
||||
}, 200);
|
||||
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
|
||||
return resolve(res.data);
|
||||
}, 200);
|
||||
}
|
||||
})
|
||||
} else if (node.level === 4) {
|
||||
return resolve([])
|
||||
}
|
||||
},
|
||||
getNewsArea() {
|
||||
this.buttonLoading = true
|
||||
rest().then(res => {
|
||||
getProvinceArea().then(res => {
|
||||
this.dataList = res.data
|
||||
this.buttonLoading = false
|
||||
})
|
||||
|
||||
this.$modal.notifySuccess("获取成功")
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
</style>
|
||||
|
|
@ -4,6 +4,7 @@
|
|||
:props="defaultProps"
|
||||
@node-click="nodeClick"
|
||||
node-key="catId"
|
||||
highlight-current
|
||||
ref="menuTree">
|
||||
</el-tree>
|
||||
</template>
|
||||
|
|
|
|||
|
|
@ -48,6 +48,8 @@ public class ApiConst {
|
|||
|
||||
public static final String GAODE_WEATHER = "高德-天气预报";
|
||||
|
||||
public static final String GAODE_AREA = "高德-区域编码";
|
||||
|
||||
public static final String ROLL_HOLIDAYS = "ROLL-节假日";
|
||||
|
||||
public static final String ROLL_MOBILE_BELONG = "ROLL-手机归属地";
|
||||
|
|
@ -130,6 +132,11 @@ public class ApiConst {
|
|||
*/
|
||||
public static final String GAODE_WEATHER_URL = "https://restapi.amap.com/v3/weather/weatherInfo";
|
||||
|
||||
/**
|
||||
* 接口文档:https://lbs.amap.com/api/webservice/guide/api/district
|
||||
*/
|
||||
public static final String GAODE_AREA_URL = "https://restapi.amap.com/v3/config/district";
|
||||
|
||||
/**
|
||||
* 接口文档:https://www.mxnzp.com/doc/detail?id=1
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,57 @@
|
|||
package com.xjs.area.controller;
|
||||
|
||||
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||
import com.xjs.area.domain.Area;
|
||||
import com.xjs.area.service.AreaService;
|
||||
import com.xjs.web.MyBaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域编码controller
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("area")
|
||||
@Api(tags = "业务模块-区域编码")
|
||||
@Log4j2
|
||||
public class AreaController extends MyBaseController<Area> {
|
||||
|
||||
@Autowired
|
||||
private AreaService areaService;
|
||||
|
||||
@GetMapping("rest")
|
||||
@ApiOperation("更新获取区域编码信息")
|
||||
public AjaxResult restArea() {
|
||||
areaService.truncateArea();
|
||||
areaService.saveArea();
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("getProvinceArea")
|
||||
@ApiOperation("获取所有省级区域")
|
||||
public AjaxResult getProvinceArea() {
|
||||
List<Area> areaList = areaService.getProvinceArea();
|
||||
return AjaxResult.success(areaList);
|
||||
}
|
||||
|
||||
@GetMapping("getAreaByParentId/{pid}")
|
||||
@ApiOperation("根据父ID获取区域")
|
||||
public AjaxResult getAreaByParentId(@PathVariable Long pid) {
|
||||
List<Area> areaList = areaService.getAreaByParentId(pid);
|
||||
return AjaxResult.success(areaList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
package com.xjs.area.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域编码实体类
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
@Data
|
||||
@TableName("api_area")
|
||||
public class Area implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 父id
|
||||
*/
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 城市编码
|
||||
*/
|
||||
private String citycode;
|
||||
|
||||
/**
|
||||
* 区域编码
|
||||
*/
|
||||
private String adcode;
|
||||
|
||||
/**
|
||||
* 行政区名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 区域中心点
|
||||
*/
|
||||
private String center;
|
||||
|
||||
/**
|
||||
* 行政区划级别
|
||||
* <br>
|
||||
* country:国家
|
||||
* <br>
|
||||
* province:省份(直辖市会在province和city显示)
|
||||
* <br>
|
||||
* city:市(直辖市会在province和city显示)
|
||||
* <br>
|
||||
* district:区县
|
||||
* <br>
|
||||
* street:街道
|
||||
*/
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 嵌套自身
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private List<Area> districts;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.xjs.area.factory;
|
||||
|
||||
|
||||
/**
|
||||
* 区域编码工厂接口
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
public interface AreaFactory<R,T> {
|
||||
|
||||
/**
|
||||
* 获取区域编码
|
||||
* @param t 入参
|
||||
* @return 出参
|
||||
*/
|
||||
R getArea(T t);
|
||||
}
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
package com.xjs.area.factory;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.area.domain.Area;
|
||||
import com.xjs.common.client.api.gaode.GaodeAreaFeignClient;
|
||||
import com.xjs.properties.GaodeProperties;
|
||||
import com.xjs.weather.domain.RequestBody;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xjs.consts.ApiConst.*;
|
||||
|
||||
/**
|
||||
* 区域编码工厂接口 高德实现
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
@Component
|
||||
public class GaodeAreaFactoryImpl implements AreaFactory<List<Area>, RequestBody> {
|
||||
|
||||
@Autowired
|
||||
private GaodeProperties gaodeProperties;
|
||||
@Autowired
|
||||
private GaodeAreaFeignClient gaodeAreaFeignClient;
|
||||
|
||||
@Override
|
||||
public List<Area> getArea(RequestBody requestBody) {
|
||||
requestBody.setSubdistrict(4); //设置显示下级行政区级数
|
||||
requestBody.setKey(gaodeProperties.getKey());
|
||||
|
||||
JSONObject jsonObject = gaodeAreaFeignClient.AreaApi(requestBody);
|
||||
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
|
||||
if (INFOCODE_VALUE.equals(jsonObject.getString(INFOCODE))) {
|
||||
JSONObject districts_1 = jsonObject.getJSONArray("districts").getJSONObject(0);
|
||||
JSONArray districts_2 = districts_1.getJSONArray("districts");
|
||||
|
||||
|
||||
return districts_2.toJavaList(Area.class);
|
||||
}
|
||||
}
|
||||
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package com.xjs.area.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.xjs.area.domain.Area;
|
||||
|
||||
/**
|
||||
* 区域编码mapper
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
public interface AreaMapper extends BaseMapper<Area> {
|
||||
|
||||
/**
|
||||
* 清空表数据
|
||||
*
|
||||
*/
|
||||
void truncateArea();
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
package com.xjs.area.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.xjs.area.domain.Area;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域编码service接口
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
public interface AreaService extends IService<Area> {
|
||||
|
||||
/**
|
||||
* 保存区域编码
|
||||
*/
|
||||
void saveArea();
|
||||
|
||||
/**
|
||||
* 清空表数据
|
||||
*/
|
||||
void truncateArea();
|
||||
|
||||
/**
|
||||
* 获取所有省级区域
|
||||
*/
|
||||
List<Area> getProvinceArea();
|
||||
|
||||
/**
|
||||
* 根据父ID获取区域
|
||||
* @param pid 父id
|
||||
* @return areaList
|
||||
*/
|
||||
List<Area> getAreaByParentId(Long pid);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,84 @@
|
|||
package com.xjs.area.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.xjs.area.domain.Area;
|
||||
import com.xjs.area.factory.AreaFactory;
|
||||
import com.xjs.area.mapper.AreaMapper;
|
||||
import com.xjs.area.service.AreaService;
|
||||
import com.xjs.weather.domain.RequestBody;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 区域编码service接口实现
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
@Service
|
||||
public class AreaServiceImpl extends ServiceImpl<AreaMapper, Area> implements AreaService {
|
||||
|
||||
@Autowired
|
||||
private AreaFactory<List<Area>, RequestBody> areaFactory;
|
||||
@Resource
|
||||
private AreaMapper areaMapper;
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveArea() {
|
||||
//校验数据库是否存在值,存在退出
|
||||
long count = super.count();
|
||||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<Area> areas = areaFactory.getArea(new RequestBody());
|
||||
|
||||
//第一层遍历 省
|
||||
for (Area area_1 : areas) {
|
||||
|
||||
area_1.setParentId(0L);
|
||||
super.save(area_1);
|
||||
|
||||
//第二层遍历 市
|
||||
for (Area area_2 : area_1.getDistricts()) {
|
||||
area_2.setParentId(area_1.getId());
|
||||
super.save(area_2);
|
||||
|
||||
//第三层遍历 区/县
|
||||
for (Area area_3 : area_2.getDistricts()) {
|
||||
area_3.setParentId(area_2.getId());
|
||||
super.save(area_3);
|
||||
|
||||
//第四层遍历 乡/镇/街道
|
||||
for (Area area_4 : area_3.getDistricts()) {
|
||||
area_4.setParentId(area_3.getId());
|
||||
super.save(area_4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void truncateArea() {
|
||||
this.areaMapper.truncateArea();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Area> getProvinceArea() {
|
||||
return super.list(new LambdaQueryWrapper<Area>().eq(Area::getParentId, 0L));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Area> getAreaByParentId(Long pid) {
|
||||
return super.list(new LambdaQueryWrapper<Area>().eq(Area::getParentId, pid));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.xjs.common.client.api.gaode;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xjs.annotation.ApiLog;
|
||||
import com.xjs.common.client.factory.GaodeAreaFeignFactory;
|
||||
import com.xjs.weather.domain.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.cloud.openfeign.SpringQueryMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import static com.xjs.consts.ApiConst.GAODE_AREA;
|
||||
import static com.xjs.consts.ApiConst.GAODE_AREA_URL;
|
||||
|
||||
/**
|
||||
* 高德区域编码api feign
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
@FeignClient(contextId = "gaodeAreaFeignClient", name = "gaodeArea", url = GAODE_AREA_URL, fallbackFactory = GaodeAreaFeignFactory.class)
|
||||
public interface GaodeAreaFeignClient {
|
||||
|
||||
@GetMapping()
|
||||
@ApiLog(name = GAODE_AREA,
|
||||
url = GAODE_AREA_URL,
|
||||
method = "Get")
|
||||
JSONObject AreaApi(@SpringQueryMap RequestBody requestBody);
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.xjs.common.client.factory;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.xjs.common.client.api.gaode.GaodeAreaFeignClient;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import static com.xjs.consts.ApiConst.DEMOTE_ERROR;
|
||||
|
||||
/**
|
||||
* 高德区域编码api feign 降级处理
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
@Component
|
||||
@Log4j2
|
||||
public class GaodeAreaFeignFactory implements FallbackFactory<GaodeAreaFeignClient> {
|
||||
|
||||
@Override
|
||||
public GaodeAreaFeignClient create(Throwable cause) {
|
||||
log.error("api模块高德区域编码服务调用失败:{},执行降级处理", cause.getMessage());
|
||||
return res ->{
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put(DEMOTE_ERROR, R.FAIL);
|
||||
return jsonObject;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -11,6 +11,7 @@ import com.xjs.business.warning.domain.ApiRecord;
|
|||
import com.xjs.common.client.api.alapi.AlapiJokeAllFeignClient;
|
||||
import com.xjs.common.client.api.baidu.BaiduAssociationFeignClient;
|
||||
import com.xjs.common.client.api.baidu.BaiduTranslationFeignClient;
|
||||
import com.xjs.common.client.api.gaode.GaodeAreaFeignClient;
|
||||
import com.xjs.common.client.api.gaode.GaodeWeatherFeignClient;
|
||||
import com.xjs.common.client.api.lq.LqAWordFeignClient;
|
||||
import com.xjs.common.client.api.lq.LqDogDiaryFeignClient;
|
||||
|
|
@ -156,6 +157,8 @@ public class CheckApiStatusTask {
|
|||
private BaiduAssociationFeignClient baiduAssociationFeignClient;
|
||||
@Autowired
|
||||
private TimeFeignClient timeFeignClient;
|
||||
@Autowired
|
||||
private GaodeAreaFeignClient gaodeAreaFeignClient;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -369,6 +372,12 @@ public class CheckApiStatusTask {
|
|||
};
|
||||
new Thread(runCheckNetworkTime).start();
|
||||
|
||||
Runnable runCheckGaodeArea = () -> {
|
||||
log.info("线程启动:" + Thread.currentThread().getName());
|
||||
this.checkGaodeArea();
|
||||
};
|
||||
new Thread(runCheckGaodeArea).start();
|
||||
|
||||
//this.checkAlapiJoke();
|
||||
//this.checkBaiduTranslation();
|
||||
//this.checkGaodeWeather();
|
||||
|
|
@ -403,16 +412,28 @@ public class CheckApiStatusTask {
|
|||
//this.checkYouDaoTranslation();
|
||||
//this.checkBaiduAssociation();
|
||||
//this.checkNetworkTime();
|
||||
//this.checkGaodeArea();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查高德区域编码 API
|
||||
*/
|
||||
private void checkGaodeArea() {
|
||||
JSONObject jsonObject = gaodeAreaFeignClient.AreaApi(new RequestBody());
|
||||
if (!jsonObject.containsKey(DEMOTE_ERROR)) {
|
||||
return;
|
||||
}
|
||||
String[] info = this.getAnnotationInfo(GaodeAreaFeignClient.class).get(0);
|
||||
this.selectAndUpdate(info);
|
||||
log.error("检查高德区域编码API异常");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查网络时间 API
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import lombok.experimental.Accessors;
|
|||
|
||||
/**
|
||||
* 高德天气预报接口请求参数
|
||||
*
|
||||
* @author xiejs
|
||||
* @since 2022-01-16
|
||||
*/
|
||||
|
|
@ -28,16 +29,35 @@ public class RequestBody {
|
|||
/**
|
||||
* 气象类型:
|
||||
* 可选值:base/all
|
||||
* base:返回实况天气
|
||||
* all:返回预报天气
|
||||
* base:返回实况天气
|
||||
* all:返回预报天气
|
||||
* <br>
|
||||
* 返回结果控制:
|
||||
* 可选值:base/all
|
||||
* base:不返回行政区边界坐标点;all:只返回当前查询district的边界值,不返回子节点的边界值;
|
||||
*/
|
||||
private String extensions;
|
||||
|
||||
/**
|
||||
*返回格式:
|
||||
* 返回格式:
|
||||
* 可选值:JSON,XML
|
||||
*/
|
||||
private String output = "JSON";
|
||||
|
||||
/**
|
||||
* 子级行政区:
|
||||
* <br>
|
||||
* 可选值:0、1、2、3
|
||||
* <br>
|
||||
* 0:不返回下级行政区;
|
||||
* <br>
|
||||
* 1:返回下一级行政区;
|
||||
* <br>
|
||||
* 2:返回下两级行政区;
|
||||
* <br>
|
||||
* 3:返回下三级行政区;
|
||||
*/
|
||||
private Integer subdistrict;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xjs.area.mapper.AreaMapper">
|
||||
|
||||
<delete id="truncateArea">
|
||||
TRUNCATE TABLE api_area
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package com.xjs.area.factory;
|
||||
|
||||
import com.xjs.XjsOpenApiApp;
|
||||
import com.xjs.area.domain.Area;
|
||||
import com.xjs.weather.domain.RequestBody;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xiejs
|
||||
* @since 2022-03-22
|
||||
*/
|
||||
@SpringBootTest(classes = XjsOpenApiApp.class)
|
||||
class GaodeAreaFactoryImplTest {
|
||||
|
||||
|
||||
@Autowired
|
||||
private AreaFactory<List<Area>, RequestBody> areaFactory;
|
||||
|
||||
@Test
|
||||
void getArea() {
|
||||
List<Area> area = areaFactory.getArea(new RequestBody());
|
||||
System.out.println(area);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue