parent
de021d28cb
commit
2e344200e2
|
|
@ -51,4 +51,21 @@ public class UserAddress implements Serializable {
|
|||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "country")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "省")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "省编码")
|
||||
private String provinceCode;
|
||||
|
||||
@ApiModelProperty(value = "市编码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty(value = "countryCode")
|
||||
private String countryCode;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.wyh.common.validator;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class GaodeDO {
|
||||
private String longitude;
|
||||
private String latitude;
|
||||
}
|
||||
|
|
@ -25,7 +25,6 @@ public class SalesmanCreateValidate implements Serializable {
|
|||
@ApiModelProperty(value = "负责地区")
|
||||
private String address;
|
||||
|
||||
@NotNull(message = "coordinate参数缺失")
|
||||
@ApiModelProperty(value = "坐标")
|
||||
private String coordinate;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ public class SalesmanUpdateValidate implements Serializable {
|
|||
@ApiModelProperty(value = "负责地区")
|
||||
private String address;
|
||||
|
||||
@NotNull(message = "coordinate参数缺失")
|
||||
@ApiModelProperty(value = "坐标")
|
||||
private String coordinate;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,4 +38,22 @@ public class UserAddressCreateValidate implements Serializable {
|
|||
private Integer isDefault;
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty(value = "country")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "省")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "省编码")
|
||||
private String provinceCode;
|
||||
|
||||
@ApiModelProperty(value = "市编码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty(value = "countryCode")
|
||||
private String countryCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,4 +48,23 @@ public class UserAddressUpdateValidate implements Serializable {
|
|||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer userId;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "country")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "省")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "省编码")
|
||||
private String provinceCode;
|
||||
|
||||
@ApiModelProperty(value = "市编码")
|
||||
private String cityCode;
|
||||
|
||||
@ApiModelProperty(value = "countryCode")
|
||||
private String countryCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,51 @@
|
|||
package com.wyh.common.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public class GaoDeDTO {
|
||||
@JsonProperty("info")
|
||||
private String info;
|
||||
@JsonProperty("infocode")
|
||||
private String infocode;
|
||||
@JsonProperty("regeocode")
|
||||
private RegeocodeDTO regeocode;
|
||||
@JsonProperty("status")
|
||||
private String status;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class RegeocodeDTO {
|
||||
@JsonProperty("addressComponent")
|
||||
private AddressComponentDTO addressComponent;
|
||||
@JsonProperty("formatted_address")
|
||||
private String formattedAddress;
|
||||
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
public static class AddressComponentDTO {
|
||||
@JsonProperty("adcode")
|
||||
private String adcode;
|
||||
@JsonProperty("city")
|
||||
private Object city;
|
||||
@JsonProperty("citycode")
|
||||
private String citycode;
|
||||
@JsonProperty("country")
|
||||
private String country;
|
||||
@JsonProperty("district")
|
||||
private Object district;
|
||||
|
||||
@JsonProperty("province")
|
||||
private String province;
|
||||
@JsonProperty("towncode")
|
||||
private String towncode;
|
||||
@JsonProperty("township")
|
||||
private String township;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,18 +6,16 @@ import com.wyh.common.aop.NotLogin;
|
|||
import com.wyh.common.core.AjaxResult;
|
||||
import com.wyh.common.util.ChangeChinesePinyinUtil;
|
||||
import com.wyh.common.util.HttpUtils;
|
||||
import com.wyh.common.vo.AreaTreeVO;
|
||||
import com.wyh.common.vo.ResponseDataVo;
|
||||
import com.wyh.common.vo.WxCityForClientVO;
|
||||
import com.wyh.common.vo.WxMainCitysForClientVO;
|
||||
import com.wyh.common.vo.*;
|
||||
import com.wyh.front.service.IIndexService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
@ -25,7 +23,7 @@ import java.util.Map;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "城市分类(首字母)")
|
||||
@Api(tags = "地址相关")
|
||||
@RequestMapping("front/cpsp")
|
||||
public class CpspController {
|
||||
|
||||
|
|
@ -36,6 +34,7 @@ public class CpspController {
|
|||
|
||||
@NotLogin
|
||||
@GetMapping("/getCity")
|
||||
@ApiOperation(value = "城市分类(首字母)")
|
||||
public Map<String,List<WxMainCitysForClientVO>> getCity(){
|
||||
String url="https://restapi.amap.com/v3/config/district";
|
||||
|
||||
|
|
@ -77,8 +76,51 @@ public class CpspController {
|
|||
|
||||
@NotLogin
|
||||
@GetMapping("/getAddressTree")
|
||||
@ApiOperation(value = "地址树")
|
||||
public AjaxResult<List<AreaTreeVO>> getAddressTree(){
|
||||
List<AreaTreeVO> list = iIndexservice.getAddressTree();
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
|
||||
@NotLogin
|
||||
@GetMapping("/getabcInfo")
|
||||
@ApiOperation(value = "根据经纬度获取地址")
|
||||
public AjaxResult<Map<String,String>> getabcInfo(
|
||||
@NotNull @Valid @RequestParam("longitude") String longitude,
|
||||
@NotNull @Valid @RequestParam("latitude") String latitude
|
||||
){
|
||||
|
||||
Map<String, String> map = new HashMap<>();
|
||||
try {
|
||||
String apiKey = "6921542276811edc857184b87bf4fb0e";
|
||||
GaoDeDTO gaoDeDTO = new Gson().fromJson(HttpUtils.sendGet("https://restapi.amap.com/v3/geocode/regeo?key=" + apiKey + "&location=" +longitude + "," +latitude), GaoDeDTO.class);
|
||||
GaoDeDTO.RegeocodeDTO.AddressComponentDTO addressComponent = gaoDeDTO.getRegeocode().getAddressComponent();
|
||||
String province = addressComponent.getProvince();
|
||||
String cityStr = getStringFromObject(addressComponent.getCity());
|
||||
String districtStr = getStringFromObject(addressComponent.getDistrict());
|
||||
map.put("province",province);
|
||||
map.put("city",cityStr);
|
||||
map.put("district",districtStr);
|
||||
return AjaxResult.success(map);
|
||||
} catch (Exception e) {
|
||||
map.put("message","地址解析失败");
|
||||
return AjaxResult.failed(map);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 从对象中获取字符串
|
||||
private static String getStringFromObject(Object obj) {
|
||||
if (obj instanceof String) {
|
||||
return " " + (String) obj;
|
||||
} else if (obj instanceof List) {
|
||||
List<String> list = (List<String>) obj;
|
||||
if (!list.isEmpty()) {
|
||||
return " " + list.get(0);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,12 @@
|
|||
ref="popupRef"
|
||||
:title="popupTitle"
|
||||
:async="true"
|
||||
width="550px"
|
||||
width="1000px"
|
||||
:clickModalClose="true"
|
||||
@confirm="handleSubmit"
|
||||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="84px" :rules="formRules">
|
||||
<el-form ref="formRef" :model="formData" label-width="110px" :rules="formRules">
|
||||
<el-form-item label="手机号" prop="mobile">
|
||||
<el-input v-model="formData.mobile" placeholder="请输入手机号" />
|
||||
</el-form-item>
|
||||
|
|
@ -22,6 +22,16 @@
|
|||
<el-form-item label="坐标" prop="coordinate">
|
||||
<el-input v-model="formData.coordinate" placeholder="请输入坐标" />
|
||||
</el-form-item>
|
||||
<el-form-item label="搜索" >
|
||||
<el-select v-model="formData.search" filterable remote clearable
|
||||
style="width: 370px"
|
||||
placeholder="请输入关键字搜索" :remote-method="remoteMethod" @change="selectOne">
|
||||
<el-option v-for="item in formData.results" :label="item.name" :value="item.name"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<div style="align-content: center; margin-left: 100px">
|
||||
<MapContainer ref="refMap" :search="formData.search" v-model:results="formData.results" />
|
||||
</div>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
|
|
@ -32,12 +42,15 @@ import { salesmanEdit, salesmanAdd, salesmanDetail } from '@/api/salesman'
|
|||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type { PropType } from 'vue'
|
||||
import MapContainer from "@/components/map/MapContainer.vue";
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
default: () => ({})
|
||||
}
|
||||
})
|
||||
const mapValue = ref<any>(null)
|
||||
const refMap = ref<any>(null)
|
||||
const emit = defineEmits(['success', 'close'])
|
||||
const formRef = shallowRef<FormInstance>()
|
||||
const popupRef = shallowRef<InstanceType<typeof Popup>>()
|
||||
|
|
@ -52,6 +65,8 @@ const formData = reactive({
|
|||
name: '',
|
||||
address: '',
|
||||
coordinate: '',
|
||||
search: '',
|
||||
results: []
|
||||
})
|
||||
|
||||
const formRules = {
|
||||
|
|
@ -83,13 +98,6 @@ const formRules = {
|
|||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
coordinate: [
|
||||
{
|
||||
required: true,
|
||||
message: '请输入坐标',
|
||||
trigger: ['blur']
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
const handleSubmit = async () => {
|
||||
|
|
@ -122,6 +130,34 @@ const getDetail = async (row: Record<string, any>) => {
|
|||
setFormData(data)
|
||||
}
|
||||
|
||||
function remoteMethod(str) {
|
||||
refMap.value.search(str, (tips) => {
|
||||
console.log('%c ======tips======', 'font-size:14px; color:#22ff22;', tips)
|
||||
formData.results = tips
|
||||
console.log('%c ======formData======', 'font-size:14px; color:#22ff22;', formData)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
function selectOne(res ){
|
||||
console.log('%c ======res======', 'font-size:14px; color:#22ff22;', res)
|
||||
refMap.value.selectOne(res)
|
||||
mapValue.value = handlePut(res)
|
||||
console.log('%c ======mapValue======', 'font-size:14px; color:#22ff22;', mapValue)
|
||||
formData.address = res
|
||||
}
|
||||
|
||||
const handlePut = (result) => {
|
||||
formData.results.forEach((item: any) => {
|
||||
if (result === item.name) {
|
||||
let location = item.location ? item.location : "";
|
||||
console.log('%c ======item======', 'font-size:14px; color:#22ff22;', item)
|
||||
console.log('%c ======location======', 'font-size:14px; color:#22ff22;', location.lat + ',' + location.lng)
|
||||
formData.coordinate = (location.lat ? location.lat : '') + ',' + (location.lng ? location.lng : '')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const handleClose = () => {
|
||||
emit('close')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,16 @@
|
|||
@close="handleClose"
|
||||
>
|
||||
<el-form ref="formRef" :model="formData" label-width="110px" style="width: 800px" :rules="formRules">
|
||||
<el-form-item label="所属属性" prop="infoId">
|
||||
<el-select
|
||||
v-model="formData.infoId"
|
||||
class="flex-1"
|
||||
clearable
|
||||
placeholder="请选择方案属性"
|
||||
>
|
||||
<el-option v-for="item in optionDataList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="集成方案名称" prop="name">
|
||||
<el-input v-model="formData.name" placeholder="请输入集成方案名称" />
|
||||
</el-form-item>
|
||||
|
|
@ -40,16 +50,6 @@
|
|||
<el-radio :label="0">否</el-radio>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="所属id" prop="infoId">
|
||||
<el-select
|
||||
v-model="formData.infoId"
|
||||
class="flex-1"
|
||||
clearable
|
||||
placeholder="请选择方案属性"
|
||||
>
|
||||
<el-option v-for="item in optionDataList" :key="item.id" :label="item.name" :value="item.id"></el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
</popup>
|
||||
</div>
|
||||
|
|
@ -60,8 +60,6 @@ import { schmeEdit, schmeAdd, schmeDetail } from '@/api/schme'
|
|||
import Popup from '@/components/popup/index.vue'
|
||||
import feedback from '@/utils/feedback'
|
||||
import type { PropType } from 'vue'
|
||||
import {useDictOptions} from "@/hooks/useDictOptions";
|
||||
import {infoLists} from "@/api/info";
|
||||
defineProps({
|
||||
dictData: {
|
||||
type: Object as PropType<Record<string, any[]>>,
|
||||
|
|
@ -171,7 +169,7 @@ const open = (type = 'add') => {
|
|||
mode.value = type
|
||||
popupRef.value?.open()
|
||||
}
|
||||
const getNewsCateList = async () => {
|
||||
const getoptionDataList = async () => {
|
||||
const res: any = await listAll()
|
||||
optionDataList.value = res || []
|
||||
}
|
||||
|
|
@ -201,5 +199,5 @@ defineExpose({
|
|||
getDetail
|
||||
})
|
||||
|
||||
getNewsCateList()
|
||||
getoptionDataList()
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
export default () => ({
|
||||
title: '个人中心广告图',
|
||||
name: 'user-banner',
|
||||
content: {
|
||||
enabled: 1,
|
||||
data: [
|
||||
{
|
||||
image: '',
|
||||
name: '',
|
||||
link: {}
|
||||
}
|
||||
]
|
||||
},
|
||||
styles: {}
|
||||
})
|
||||
Loading…
Reference in New Issue