|
|
|
@@ -8,6 +8,7 @@ import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
|
|
|
import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; |
|
|
|
import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; |
|
|
|
|
|
|
|
import com.aliyun.openservices.shade.org.apache.commons.lang3.StringUtils; |
|
|
|
import com.iformall.common.ErrorCode; |
|
|
|
import com.iformall.domain.po.MallUserInfo; |
|
|
|
import com.iformall.domain.po.WxTags; |
|
|
|
@@ -239,7 +240,7 @@ public class AsyncTask { |
|
|
|
public void exportExcelPoiDataAddLocationForNew(String gaodeKey,File file,HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
ImportParams params = new ImportParams(); |
|
|
|
// 需要验证 |
|
|
|
String[] headers = new String[]{"门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注", "富茂系统商户ID", "富茂系统商户名称"}; |
|
|
|
String[] headers = new String[]{"富茂系统商户ID", "富茂系统商户名称","门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注"}; |
|
|
|
params.setImportFields(headers); |
|
|
|
IExcelDataHandler<MerchantPoiTNew> handler = new AsyncTask.PoiNewExcelHandler(); |
|
|
|
handler.setNeedHandlerFields(new String[]{"门店名称", "门店ID", "城市", "详细地址"}); |
|
|
|
@@ -265,34 +266,38 @@ public class AsyncTask { |
|
|
|
List<MerchantPoiTNew> successList = datalist.getList(); |
|
|
|
//List<MerchantPoiTNew> failList = datalist.getFailList(); |
|
|
|
if(null != successList && successList.size() > 0 ) { |
|
|
|
List<MerchantPoiTNew> tlist = new ArrayList<MerchantPoiTNew>(); |
|
|
|
try { |
|
|
|
successList.parallelStream().forEach(poiBase -> { |
|
|
|
try { |
|
|
|
GaoDePoiInfo gaodeInfo = ttMerchantPoiService.queryGaoDePoiInfo(gaodeKey, poiBase.getPoiCity()+poiBase.getPoiAddress()); |
|
|
|
if (null != gaodeInfo) { |
|
|
|
if (gaodeInfo.isSuccess()) { |
|
|
|
poiBase.setProvince(gaodeInfo.getProvince()); |
|
|
|
poiBase.setCity(gaodeInfo.getCity()); |
|
|
|
poiBase.setAddress(poiBase.getPoiAddress()); |
|
|
|
poiBase.setLongitude(gaodeInfo.getLongitude()); |
|
|
|
poiBase.setLatitude(gaodeInfo.getLatitude()); |
|
|
|
poiBase.setGaodeRemark("匹配成功"); |
|
|
|
}else { |
|
|
|
poiBase.setGaodeRemark("匹配失败,"+gaodeInfo.getErrMsg()); |
|
|
|
} |
|
|
|
}else { |
|
|
|
poiBase.setGaodeRemark("未匹配到信息"); |
|
|
|
} |
|
|
|
tlist.add(poiBase); |
|
|
|
if (StringUtils.isNotBlank(poiBase.getProvince()) && StringUtils.isNotBlank(poiBase.getCity()) |
|
|
|
&& StringUtils.isNotBlank(poiBase.getAddress()) && null != poiBase.getLongitude() && null != poiBase.getLatitude()) { |
|
|
|
//do nothing |
|
|
|
}else { |
|
|
|
GaoDePoiInfo gaodeInfo = ttMerchantPoiService.queryGaoDePoiInfo(gaodeKey, poiBase.getPoiCity()+poiBase.getPoiAddress()); |
|
|
|
if (null != gaodeInfo) { |
|
|
|
if (gaodeInfo.isSuccess()) { |
|
|
|
poiBase.setProvince(gaodeInfo.getProvince()); |
|
|
|
poiBase.setCity(gaodeInfo.getCity()); |
|
|
|
poiBase.setAddress(poiBase.getPoiAddress()); |
|
|
|
poiBase.setLongitude(gaodeInfo.getLongitude()); |
|
|
|
poiBase.setLatitude(gaodeInfo.getLatitude()); |
|
|
|
poiBase.setGaodeRemark("匹配成功"); |
|
|
|
}else { |
|
|
|
poiBase.setGaodeRemark("匹配失败,"+gaodeInfo.getErrMsg()); |
|
|
|
} |
|
|
|
}else { |
|
|
|
poiBase.setGaodeRemark("未匹配到信息"); |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (UnknownSessionException ue) { |
|
|
|
logger.error("session :"+ue.getMessage()); |
|
|
|
poiBase.setGaodeRemark("查询高德API失败"); |
|
|
|
} |
|
|
|
}); |
|
|
|
ExportParams exportParams = new ExportParams(); |
|
|
|
//exportParams.setCreateHeadRows(true); |
|
|
|
//exportParams.setExclusions(headers); |
|
|
|
Workbook workBook = ExcelExportUtil.exportExcel(exportParams, MerchantPoiTNew.class, tlist); |
|
|
|
Workbook workBook = ExcelExportUtil.exportExcel(exportParams, MerchantPoiTNew.class, successList); |
|
|
|
exportExcel(request, response, workBook, "POI匹配模版-高德.xls"); |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("更新地理信息失败:"+e.getMessage(),e); |
|
|
|
@@ -316,10 +321,10 @@ public class AsyncTask { |
|
|
|
public void importExcelPoiDataForNew(File file, MallUserInfo user, String importKey) { |
|
|
|
ImportParams params = new ImportParams(); |
|
|
|
// 需要验证 |
|
|
|
String[] headers = new String[]{"门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注", "富茂系统商户ID", "富茂系统商户名称"}; |
|
|
|
String[] headers = new String[]{"富茂系统商户ID", "富茂系统商户名称","门店名称", "门店ID", "城市", "详细地址","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注"}; |
|
|
|
params.setImportFields(headers); |
|
|
|
IExcelDataHandler<MerchantPoiTNew> handler = new AsyncTask.PoiNewExcelHandler(); |
|
|
|
handler.setNeedHandlerFields(new String[]{"富茂商户ID","来客门店ID","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度"}); |
|
|
|
handler.setNeedHandlerFields(new String[]{"富茂系统商户ID","门店ID","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度"}); |
|
|
|
params.setNeedVerify(true); |
|
|
|
|
|
|
|
ExcelImportResult<MerchantPoiTNew> datalist = null; |
|
|
|
|