企业经纬度转换
This commit is contained in:
parent
33f3bffbbd
commit
599c47a03e
|
|
@ -82,6 +82,9 @@ public interface SysEnterpriseMapper extends BaseMapper<SysEnterprise> {
|
|||
/*修改企业信息*/
|
||||
Integer changeEnt(SysEnterprise record);
|
||||
|
||||
/*修改经纬度*/
|
||||
Integer changeLonLat(SysEnterprise record);
|
||||
|
||||
/*修改企业行业*/
|
||||
Integer changeInclass(SysEnterprise record);
|
||||
|
||||
|
|
@ -96,6 +99,10 @@ public interface SysEnterpriseMapper extends BaseMapper<SysEnterprise> {
|
|||
|
||||
/*所有企业*/
|
||||
List<SysEnterprise> findAll();
|
||||
|
||||
/*查询经纬度为空的企业*/
|
||||
List<SysEnterprise> findLon();
|
||||
|
||||
/*所有企业忽略状态*/
|
||||
List<SysEnterprise> findAllNoState();
|
||||
|
||||
|
|
|
|||
|
|
@ -739,6 +739,16 @@
|
|||
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
|
||||
<!--修改企业信息-->
|
||||
<update id="changeLonLat" parameterType="com.rzyc.model.ent.SysEnterprise">
|
||||
update SysEnterprise
|
||||
set Latitude = #{latitude,jdbcType=VARCHAR},
|
||||
SysAddress = #{sysaddress,jdbcType=VARCHAR},
|
||||
Longitude = #{longitude,jdbcType=VARCHAR}
|
||||
where SysEnterpriseId = #{sysenterpriseid,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<!--通过检查id查询企业信息-->
|
||||
<select id="findByCheckId" resultMap="BaseResultMap">
|
||||
SELECT se.* FROM `SysEnterprise` se
|
||||
|
|
@ -773,7 +783,12 @@
|
|||
|
||||
<!--所有企业-->
|
||||
<select id="findAll" resultMap="BaseResultMap">
|
||||
SELECT se.*,org.OrgName FROM SysEnterprise se left join SysOrg org on se.OrgCode = org.OrgCode WHERE se.`IsHide` = '否' AND se.State = '启用'
|
||||
SELECT se.* FROM SysEnterprise se WHERE se.State = '启用'
|
||||
</select>
|
||||
|
||||
<!--所有企业-->
|
||||
<select id="findLon" resultMap="BaseResultMap">
|
||||
SELECT se.* FROM SysEnterprise se WHERE se.State = '启用' and se.Longitude is null
|
||||
</select>
|
||||
|
||||
<select id="findAllNoState" resultMap="BaseResultMap">
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.rzyc.controller;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.common.utils.AMAP.Amap;
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.StringUtils;
|
||||
import com.common.utils.TypeConversion;
|
||||
|
|
@ -21,6 +22,7 @@ import org.springframework.web.bind.annotation.*;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.*;
|
||||
|
||||
@Api(tags = "数据处理")
|
||||
|
|
@ -1106,10 +1108,6 @@ public class DataController extends com.rzyc.controller.BaseController {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
index++;
|
||||
|
||||
}
|
||||
|
|
@ -1123,4 +1121,31 @@ public class DataController extends com.rzyc.controller.BaseController {
|
|||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "企业经纬度", notes = "企业经纬度")
|
||||
@RequestMapping(value = "/entLonlat", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public SingleResult<String> entLonlat()throws Exception{
|
||||
SingleResult<String> result = new SingleResult<>();
|
||||
List<SysEnterprise> sysEnterprises = sysEnterpriseMapper.findLon();
|
||||
for (SysEnterprise enterprise : sysEnterprises){
|
||||
if(StringUtils.isNotBlank(enterprise.getSysaddress())){
|
||||
String address = enterprise.getSysaddress();
|
||||
System.out.println("address --> "+address);
|
||||
address = StringUtils.replaceBlank(address);
|
||||
String lonlat = Amap.getLonLat(address);
|
||||
enterprise.setSysaddress(address);
|
||||
String[] strs = lonlat.split(",");
|
||||
if(null != strs && strs.length == 2){
|
||||
enterprise.setLongitude(strs[0]);
|
||||
enterprise.setLatitude(strs[1]);
|
||||
sysEnterpriseMapper.changeLonLat(enterprise);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class Amap {
|
|||
|
||||
public static void main(String [] args){
|
||||
try {
|
||||
System.out.println(Amap.getAddress(104.06476,30.5702));
|
||||
System.out.println(Amap.getLonLat("新龙县博美乡仁乃村"));
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ public class StringUtils {
|
|||
Matcher m = p.matcher(str);
|
||||
dest = m.replaceAll("");
|
||||
}
|
||||
dest = dest.replaceAll(" ","");
|
||||
return dest;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user