区域解析符合前段规范
This commit is contained in:
parent
9a97ad4aad
commit
c4ce766ae7
|
|
@ -75,7 +75,7 @@ public class WxPayController extends BaseController {
|
||||||
divMembers.add(new DivMember("C7D101", String.valueOf(financialMaster.getPayMoney()), true));
|
divMembers.add(new DivMember("C7D101", String.valueOf(financialMaster.getPayMoney()), true));
|
||||||
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
// TODO 订单里需要补充支付金额、tittle、简要描述、分账信息、description
|
||||||
PayParam payParam = new PayParam(orderMaster.getCode() + "_" + System.currentTimeMillis(),
|
PayParam payParam = new PayParam(orderMaster.getCode() + "_" + System.currentTimeMillis(),
|
||||||
"0.01", "工圈子居家设备", "工圈子居家设备购买付费");
|
String.valueOf(financialMaster.getPayMoney()), "工圈子居家设备", "工圈子居家设备购买付费");
|
||||||
map = adapayService.wxLitePay(orderMaster.getDeptId(), payParam, expend, null, null);
|
map = adapayService.wxLitePay(orderMaster.getDeptId(), payParam, expend, null, null);
|
||||||
} catch (BaseAdaPayException e) {
|
} catch (BaseAdaPayException e) {
|
||||||
logger.error("获取微信用户信息失败", e);
|
logger.error("获取微信用户信息失败", e);
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,9 @@ import com.ghy.common.core.controller.BaseController;
|
||||||
import com.ghy.common.core.domain.AjaxResult;
|
import com.ghy.common.core.domain.AjaxResult;
|
||||||
import com.ghy.common.utils.ExceptionUtil;
|
import com.ghy.common.utils.ExceptionUtil;
|
||||||
import com.ghy.common.utils.http.HttpUtils;
|
import com.ghy.common.utils.http.HttpUtils;
|
||||||
|
import com.ghy.framework.web.domain.server.Sys;
|
||||||
|
import com.ghy.system.domain.SysArea;
|
||||||
|
import com.ghy.system.service.ISysAreaService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
@ -25,14 +28,38 @@ public class BaiduController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BaiduConfig baiduConfig;
|
private BaiduConfig baiduConfig;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysAreaService iSysAreaService;
|
||||||
|
|
||||||
@PostMapping("/getLocation")
|
@PostMapping("/getLocation")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult getLocationByLot(@RequestBody JSONObject jsonObject){
|
public AjaxResult getLocationByLot(@RequestBody JSONObject jsonObject){
|
||||||
try {
|
try {
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
|
||||||
String location = jsonObject.getString("location");
|
String location = jsonObject.getString("location");
|
||||||
String url = baiduConfig.getUrl().replace("#AK#", baiduConfig.getAk()) + location;
|
String url = baiduConfig.getUrl().replace("#AK#", baiduConfig.getAk()) + location;
|
||||||
String result = HttpUtils.sendGet(url);
|
String result = HttpUtils.sendGet(url);
|
||||||
return AjaxResult.success(result);
|
result = result.replaceAll("\n", "").replaceAll("\t", "");
|
||||||
|
JSONObject resultJson = JSONObject.parseObject(result);
|
||||||
|
if("0".equals(resultJson.getString("status"))){
|
||||||
|
JSONObject addressJson = resultJson.getJSONObject("result").getJSONObject("addressComponent");
|
||||||
|
String provinceName = addressJson.getString("province");
|
||||||
|
logger.info("provinceName :" + provinceName);
|
||||||
|
SysArea provinceArea = iSysAreaService.selectByName(provinceName, "");
|
||||||
|
String cityName = addressJson.getString("city");
|
||||||
|
logger.info("cityName :" + cityName);
|
||||||
|
SysArea cityArea = iSysAreaService.selectByName(cityName, provinceArea.getAreaCode());
|
||||||
|
String countryName = addressJson.getString("district");
|
||||||
|
logger.info("countryName :" + countryName);
|
||||||
|
SysArea countryArea = iSysAreaService.selectByName(countryName, cityArea.getAreaCode());
|
||||||
|
json.put("provinceArea", provinceArea);
|
||||||
|
json.put("cityArea", cityArea);
|
||||||
|
json.put("countryArea", countryArea);
|
||||||
|
}else {
|
||||||
|
return AjaxResult.error("Api服务异常!");
|
||||||
|
}
|
||||||
|
return AjaxResult.success(json);
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.error(e.getMessage());
|
logger.error(e.getMessage());
|
||||||
|
|
@ -40,4 +67,8 @@ public class BaiduController extends BaseController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String result = " {\"status\":0,\"result\":{\"location\":{\"lng\":113.29950224957551,\"lat\":23.019282373814027},\"formatted_address\":\"广东省广州市番禺区安平路\",\"business\":\"大石\",\"addressComponent\":{\"country\":\"中国\",\"country_code\":0,\"country_code_iso\":\"CHN\",\"country_code_iso2\":\"CN\",\"province\":\"广东省\",\"city\":\"广州市\",\"city_level\":2,\"district\":\"番禺区\",\"town\":\"\",\"town_code\":\"\",\"distance\":\"\",\"direction\":\"\",\"adcode\":\"440113\",\"street\":\"安平路\",\"street_number\":\"\"},\"pois\":[],\"roads\":[],\"poiRegions\":[],\"sematic_description\":\"\",\"cityCode\":257}}\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package com.ghy.system.mapper;
|
package com.ghy.system.mapper;
|
||||||
|
|
||||||
import com.ghy.system.domain.SysArea;
|
import com.ghy.system.domain.SysArea;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
@ -46,4 +47,10 @@ public interface SysAreaMapper {
|
||||||
*/
|
*/
|
||||||
public int insertSysArea(SysArea sysArea);
|
public int insertSysArea(SysArea sysArea);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param sysArea 区域
|
||||||
|
* @return 区域实体
|
||||||
|
*/
|
||||||
|
public SysArea selectByName(SysArea sysArea);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,4 +60,11 @@ public interface ISysAreaService {
|
||||||
*/
|
*/
|
||||||
int selectAreaCount(Long areaId);
|
int selectAreaCount(Long areaId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name 区域名称
|
||||||
|
* @param parentCode 父级id
|
||||||
|
* @return 区域实体
|
||||||
|
*/
|
||||||
|
SysArea selectByName(String name, String parentCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,6 +79,14 @@ public class SysAreaServiceImpl implements ISysAreaService {
|
||||||
return sysAreaMapper.selectSysAreaList(info).size();
|
return sysAreaMapper.selectSysAreaList(info).size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public SysArea selectByName(String name, String parentCode) {
|
||||||
|
SysArea sysArea = new SysArea();
|
||||||
|
sysArea.setAreaName(name);
|
||||||
|
sysArea.setParentCode(parentCode);
|
||||||
|
return sysAreaMapper.selectByName(sysArea);
|
||||||
|
}
|
||||||
|
|
||||||
public int countUseSysAreaById(SysArea sysArea){
|
public int countUseSysAreaById(SysArea sysArea){
|
||||||
//TODO 校验区域是否使用
|
//TODO 校验区域是否使用
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
||||||
|
|
@ -133,4 +133,19 @@
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
<select id="selectByName" resultMap="SysAreaResult">
|
||||||
|
<include refid="selectSysArea" />
|
||||||
|
<where>
|
||||||
|
<if test="">
|
||||||
|
and area_name like concat('%', #{areaName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="parentCode==null">
|
||||||
|
and parent_code is null
|
||||||
|
</if>
|
||||||
|
<if test="parentCode!=null">
|
||||||
|
and parent_code = #{parentCode}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue