|
|
|
@@ -183,7 +183,8 @@ public class TtMerchantPoiController extends DouyinBaseController { |
|
|
|
//return addLocationInfo(mFile,false); |
|
|
|
throw new MallinkException(Result.ERROR,"当前版本无需补齐地理位置信息"); |
|
|
|
}else { |
|
|
|
addLocationInfo(this.getTenantInfo(),mFile,true,"1bdc087fc6f72820dc5c848a033de7f9",request,response); |
|
|
|
File lFile = handlerImportFile(mFile,null,"poiAddLocation"); |
|
|
|
asyncTask.exportExcelPoiDataAddLocationForNew(this.getTenantInfo(),"1bdc087fc6f72820dc5c848a033de7f9",lFile,request,response); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("addLocationInfo error.",e); |
|
|
|
@@ -191,15 +192,6 @@ public class TtMerchantPoiController extends DouyinBaseController { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void addLocationInfo(TenantEntity tenantEntity,MultipartFile mFile,boolean isNew,String gaodeKey, |
|
|
|
HttpServletRequest request, HttpServletResponse response) throws Exception{ |
|
|
|
File lFile = handlerImportFile(mFile,null,"poiAddLocation"); |
|
|
|
if (isNew) { |
|
|
|
asyncTask.exportExcelPoiDataAddLocationForNew(tenantEntity,gaodeKey,lFile,request,response); |
|
|
|
}else { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private File handlerImportFile(MultipartFile mFile,String importKey,String fileNamePre) { |
|
|
|
if (mFile.isEmpty()) { |
|
|
|
throw new MallinkException(Result.ERROR, "上传文件不能为空"); |
|
|
|
@@ -286,32 +278,22 @@ public class TtMerchantPoiController extends DouyinBaseController { |
|
|
|
public void importPoi(@RequestParam("file") MultipartFile mFile,HttpServletRequest request, HttpServletResponse response) { |
|
|
|
try { |
|
|
|
boolean isSaas = this.isGoodLifeSaas(); |
|
|
|
if (!isSaas) { |
|
|
|
processImport(mFile,false,request,response); |
|
|
|
}else { |
|
|
|
processImport(mFile,true,request,response); |
|
|
|
} |
|
|
|
//得到当前用户ID |
|
|
|
final MallUserInfo user = getUser(); |
|
|
|
String userId = "" + user.getId(); |
|
|
|
String importKey = Constant.importPoiPrev + userId; |
|
|
|
File lFile = handlerImportFile(mFile,importKey,"poi"); |
|
|
|
if (isSaas) { |
|
|
|
asyncTask.importExcelPoiDataForNew(lFile, user, importKey,request,response); |
|
|
|
}else { |
|
|
|
asyncTask.importExcelPoiData(lFile, user, importKey,request,response); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("allTreeList error.",e); |
|
|
|
throw new MallinkException(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void processImport(MultipartFile mFile,boolean isNew,HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::importPoi"); |
|
|
|
//得到当前用户ID |
|
|
|
final MallUserInfo user = getUser(); |
|
|
|
String userId = "" + user.getId(); |
|
|
|
String importKey = Constant.importPoiPrev + userId; |
|
|
|
File lFile = handlerImportFile(mFile,importKey,"poi"); |
|
|
|
if (isNew) { |
|
|
|
asyncTask.importExcelPoiDataForNew(lFile, user, importKey,request,response); |
|
|
|
}else { |
|
|
|
asyncTask.importExcelPoiData(lFile, user, importKey,request,response); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@TenantIgnore |
|
|
|
@PostMapping(value = "/importMerchantInitByPoi", consumes = "multipart/*") |
|
|
|
@SystemControllerLog(description = "poi-初始化商户商户") |
|
|
|
@@ -321,25 +303,16 @@ public class TtMerchantPoiController extends DouyinBaseController { |
|
|
|
if (!isSaas) { |
|
|
|
throw new MallinkException(Result.ERROR,"当前版本不支持"); |
|
|
|
}else { |
|
|
|
importMerchantInit(mFile,true,request,response); |
|
|
|
final MallUserInfo user = getUser(); |
|
|
|
String userId = "" + user.getId(); |
|
|
|
String importKey = Constant.importPoiMerchantPrev + userId; |
|
|
|
File lFile = handlerImportFile(mFile,importKey,"poiMerchantInit"); |
|
|
|
asyncTask.importMerchantInit(lFile, user, importKey,request,response); |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
logger.error("importMerchantInitByPoi error.",e); |
|
|
|
throw new MallinkException(Result.ERROR,e.getMessage()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void importMerchantInit(MultipartFile mFile,boolean isNew,HttpServletRequest request, HttpServletResponse response) throws Exception { |
|
|
|
final MallUserInfo user = getUser(); |
|
|
|
String userId = "" + user.getId(); |
|
|
|
String importKey = Constant.importPoiMerchantPrev + userId; |
|
|
|
File lFile = handlerImportFile(mFile,importKey,"poiMerchant"); |
|
|
|
if (isNew) { |
|
|
|
asyncTask.importExcelPoiDataForNew(lFile, user, importKey,request,response); |
|
|
|
}else { |
|
|
|
asyncTask.importExcelPoiData(lFile, user, importKey,request,response); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |