From fb436c10dde6f3627fd185a5385770ea31343aeb Mon Sep 17 00:00:00 2001 From: lin <642018748@qq.com> Date: Tue, 11 Jul 2023 16:28:09 +0800 Subject: [PATCH] fix bug --- .../basic/TtMerchantPoiController.java | 34 +- .../iformall/controller/mem/AsyncTask.java | 88 ++-- .../com/iformall/domain/vo/MerchantPoiT.java | 4 + .../iformall/domain/vo/MerchantPoiTNew.java | 26 +- .../service/TtMerchantPoiService.java | 4 +- .../impl/TtMerchantPoiServiceImpl.java | 473 +----------------- .../park/impl/ketuo/KeTuoParkService.java | 15 +- 7 files changed, 96 insertions(+), 548 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java index 9c6c83645..dda785525 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/basic/TtMerchantPoiController.java @@ -329,13 +329,13 @@ public class TtMerchantPoiController extends DouyinBaseController { @TenantIgnore @PostMapping(value = "/importPoi", consumes = "multipart/*") @SystemControllerLog(description = "poi-导入数据") - public ResultData importPoi(@RequestParam("file") MultipartFile mFile) { + public void importPoi(@RequestParam("file") MultipartFile mFile,HttpServletRequest request, HttpServletResponse response) { try { boolean isSaas = this.isGoodLifeSaas(); if (!isSaas) { - return processImport(mFile,false); + processImport(mFile,false,request,response); }else { - return processImport(mFile,true); + processImport(mFile,true,request,response); } } catch (Exception e) { logger.error("allTreeList error.",e); @@ -343,7 +343,7 @@ public class TtMerchantPoiController extends DouyinBaseController { } } - private ResultData processImport(MultipartFile mFile,boolean isNew) { + private void processImport(MultipartFile mFile,boolean isNew,HttpServletRequest request, HttpServletResponse response) throws Exception { logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::importPoi"); if (mFile.isEmpty()) { throw new MallinkException(Result.ERROR, "上传文件不能为空"); @@ -356,14 +356,10 @@ public class TtMerchantPoiController extends DouyinBaseController { //查询当前用户得到的值是否为空,为空继续,不为空,返回模板正在导入 Boolean allCount = stringRedisTemplate.opsForHash().hasKey(importKey, "allCount"); if (allCount) { - return new ResultData(Result.SUCCESS, "模板正在导入"); + throw new MallinkException(Result.SUCCESS, "模板正在导入"); } stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", 0 + ""); - stringRedisTemplate.expire(importKey,30, TimeUnit.MINUTES); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allSuccessCount", 0 + ""); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "processCount", ""); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", ""); String fpath = fmUploadDir; File targetFile = new File(fpath); @@ -391,9 +387,8 @@ public class TtMerchantPoiController extends DouyinBaseController { } catch (Exception e) { stringRedisTemplate.expire(importKey,3,TimeUnit.SECONDS); stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", "1"); - logger.error(e.getMessage()); - return new ResultData(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); + logger.error("poi import error.",e); + throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); } finally { if (fos != null) { try { @@ -401,9 +396,8 @@ public class TtMerchantPoiController extends DouyinBaseController { } catch (IOException e) { stringRedisTemplate.expire(importKey,3,TimeUnit.SECONDS); stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", "1"); - logger.error(e.getMessage()); - return new ResultData(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); + logger.error("poi import error.",e); + throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); } } if (fs != null) { @@ -412,19 +406,17 @@ public class TtMerchantPoiController extends DouyinBaseController { } catch (IOException e) { stringRedisTemplate.expire(importKey,3,TimeUnit.SECONDS); stringRedisTemplate.opsForHash().putIfAbsent(importKey, "allCount", "1"); - stringRedisTemplate.opsForHash().putIfAbsent(importKey, "failCount", "1"); - logger.error(e.getMessage()); - return new ResultData(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); + logger.error("poi import error.",e); + throw new MallinkException(ErrorCode.MEM_IMPORT_ERR.getCode(), "模板上传失败"); } } } if (isNew) { - asyncTask.importExcelPoiDataForNew(lFile, user, importKey); + asyncTask.importExcelPoiDataForNew(lFile, user, importKey,request,response); }else { - asyncTask.importExcelPoiData(lFile, user, importKey); + asyncTask.importExcelPoiData(lFile, user, importKey,request,response); } - return new ResultData(Result.SUCCESS, "模板正在导入"); } } diff --git a/mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java b/mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java index 63464be4d..67d7bd7ec 100644 --- a/mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java +++ b/mallinkAdmin/src/main/java/com/iformall/controller/mem/AsyncTask.java @@ -4,6 +4,7 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.ExcelImportUtil; import cn.afterturn.easypoi.excel.entity.ExportParams; import cn.afterturn.easypoi.excel.entity.ImportParams; +import cn.afterturn.easypoi.excel.entity.enmus.ExcelType; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import cn.afterturn.easypoi.handler.impl.ExcelDataHandlerDefaultImpl; import cn.afterturn.easypoi.handler.inter.IExcelDataHandler; @@ -187,11 +188,11 @@ public class AsyncTask { } @Async - public void importExcelPoiData(File file, MallUserInfo user, String importKey) { + public void importExcelPoiData(File file, MallUserInfo user, String importKey,HttpServletRequest request, HttpServletResponse response) { ImportParams params = new ImportParams(); // 需要验证 params.setImportFields(new String[]{"服务商POI_ID", "POI名称", "省份", "城市", "地址", "经度", "纬度", "高德ID(非必填)", - "已匹配POI_ID", "已匹配POI名称", "已匹配POI省份", "已匹配POI城市", "已匹配POI地址", "未匹配原因", "其他信息"}); + "已匹配POI_ID", "已匹配POI名称", "已匹配POI省份", "已匹配POI城市", "已匹配POI地址", "未匹配原因", "其他信息","POI导入结果"}); IExcelDataHandler handler = new AsyncTask.PoiExcelHandler(); handler.setNeedHandlerFields(new String[]{"服务商POI_ID","已匹配POI_ID"}); params.setNeedVerify(true); @@ -201,8 +202,8 @@ public class AsyncTask { try { datalist = ExcelImportUtil.importExcelMore(file, MerchantPoiT.class, params); } catch (Exception e) { - set_redis_value(importKey, "1", "0", "0", "1", true); - logger.error(e.getMessage()); + logger.error(e.getMessage(),e); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); // 删除缓存文件 file.delete(); return; @@ -211,24 +212,13 @@ public class AsyncTask { file.delete(); if(datalist == null) { - logger.error("导入模板失败: 模板数据解析失败"); - set_redis_value(importKey, "1", "0", "0", "1", true); + logger.error("导入模板失败: 模板数据解析失败"); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); return; } List successList = datalist.getList(); - List failList = datalist.getFailList(); - - logger.info("验证通过的数量: " + successList.size()); - logger.info("验证未通过的数量: " + failList.size()); - - int total = successList.size() + failList.size(); - int all_success = successList.size(); - int all_fail = failList.size(); - - //添加到redis里 - set_redis_value(importKey, "" + total, "" + all_success, "0", "" + all_fail, total == all_fail); - + if(successList.size() > 0) { try { successList.parallelStream().forEach(poiBase -> { @@ -238,10 +228,14 @@ public class AsyncTask { logger.error("session :"+ue.getMessage()); } }); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workBook = ExcelExportUtil.exportExcel(exportParams, MerchantPoiT.class, successList); + exportExcel(request, response, workBook, "POI导入-结果.xlsx"); } catch (Exception e) { - set_redis_value(importKey, "1", "0", "0", "1", true); - e.printStackTrace(); - logger.error("导入模板失败:"+e.getMessage()); + logger.error("导入模板失败:"+e.getMessage(),e); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); } } } @@ -249,7 +243,7 @@ public class AsyncTask { public void exportExcelPoiDataAddLocationForNew(TenantEntity tenantEntity,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", "富茂系统商户名称","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注","POI导入日志"}; params.setImportFields(headers); IExcelDataHandler handler = new AsyncTask.PoiNewExcelHandler(); handler.setNeedHandlerFields(new String[]{"门店名称", "门店ID", "城市", "详细地址"}); @@ -312,9 +306,13 @@ public class AsyncTask { if (StringUtils.isNotBlank(poiId) && null != poiMerchantIdMap) { Long merchantId = poiMerchantIdMap.get(poiId); if (null != merchantId) { - poiBase.setMerchantId(String.valueOf(merchantId)); + if (merchantId > 0 ) { + poiBase.setMerchantId(String.valueOf(merchantId)); + }else { + poiBase.setMerchantId("多个商户已匹配该POI,请手动输入"); + } } - if (null != merchantMap && null != merchantId) { + if (null != merchantMap && null != merchantId && merchantId > 0) { WxMerchant m = merchantMap.get(merchantId); if (null != m) { poiBase.setMerchantName(m.getName()); @@ -328,8 +326,7 @@ public class AsyncTask { } }); ExportParams exportParams = new ExportParams(); - //exportParams.setCreateHeadRows(true); - //exportParams.setExclusions(headers); + exportParams.setType(ExcelType.XSSF); Workbook workBook = ExcelExportUtil.exportExcel(exportParams, MerchantPoiTNew.class, successList); exportExcel(request, response, workBook, "POI匹配模版-高德.xlsx"); } catch (Exception e) { @@ -352,13 +349,13 @@ public class AsyncTask { } @Async - public void importExcelPoiDataForNew(File file, MallUserInfo user, String importKey) { + public void importExcelPoiDataForNew(File file, MallUserInfo user, String importKey,HttpServletRequest request, HttpServletResponse response) { ImportParams params = new ImportParams(); // 需要验证 - String[] headers = new String[]{"门店名称", "门店ID", "城市", "详细地址","富茂系统商户ID", "富茂系统商户名称","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注","管理员手机号"}; + String[] headers = new String[]{"门店名称", "门店ID", "城市", "详细地址","管理员手机号","富茂系统商户ID", "富茂系统商户名称","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度","高德匹配备注","POI导入日志"}; params.setImportFields(headers); IExcelDataHandler handler = new AsyncTask.PoiNewExcelHandler(); - handler.setNeedHandlerFields(new String[]{"门店ID","富茂系统商户ID","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度"}); + handler.setNeedHandlerFields(new String[]{"门店ID","富茂系统省份", "富茂系统城市", "富茂系统地址","富茂系统经度", "富茂系统纬度"}); params.setNeedVerify(true); ExcelImportResult datalist = null; @@ -366,8 +363,8 @@ public class AsyncTask { try { datalist = ExcelImportUtil.importExcelMore(file, MerchantPoiTNew.class, params); } catch (Exception e) { - set_redis_value(importKey, "1", "0", "0", "1", true); - logger.error(e.getMessage()); + logger.error("importExcelPoiDataForNew error.",e); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); // 删除缓存文件 file.delete(); return; @@ -377,36 +374,29 @@ public class AsyncTask { if(datalist == null) { logger.error("导入模板失败: 模板数据解析失败"); - set_redis_value(importKey, "1", "0", "0", "1", true); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); return; } List successList = datalist.getList(); - List failList = datalist.getFailList(); - - logger.info("验证通过的数量: " + successList.size()); - logger.info("验证未通过的数量: " + failList.size()); - - int total = successList.size() + failList.size(); - int all_success = successList.size(); - int all_fail = failList.size(); - - //添加到redis里 - set_redis_value(importKey, "" + total, "" + all_success, "0", "" + all_fail, total == all_fail); - if(successList.size() > 0) { try { successList.parallelStream().forEach(poiBase -> { try { - ttMerchantPoiService.importOnePoiNew(user,importKey, poiBase); + ttMerchantPoiService.importOnePoiNew(user, poiBase); } catch (UnknownSessionException ue) { - logger.error("session :"+ue.getMessage()); + logger.error("session :"+ue.getMessage(),ue); } }); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); + ExportParams exportParams = new ExportParams(); + exportParams.setType(ExcelType.XSSF); + Workbook workBook = ExcelExportUtil.exportExcel(exportParams, MerchantPoiTNew.class, successList); + exportExcel(request, response, workBook, "POI匹配模版-高德.xlsx"); + } catch (Exception e) { - set_redis_value(importKey, "1", "0", "0", "1", true); - e.printStackTrace(); - logger.error("导入模板失败:"+e.getMessage()); + logger.error("导入模板失败:"+e.getMessage(),e); + stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); } } } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiT.java b/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiT.java index 9a262d161..3ce7bdae8 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiT.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiT.java @@ -66,5 +66,9 @@ public class MerchantPoiT implements Serializable { @Excel(name = "其他信息", width = 20, orderNum = "15") @io.swagger.annotations.ApiModelProperty(value="其他信息",name="extra") private String extra; + + @Excel(name = "POI导入结果", width = 20, orderNum = "16") + @io.swagger.annotations.ApiModelProperty(value="POI导入结果",name="importRemark") + private String importRemark; } diff --git a/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiTNew.java b/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiTNew.java index 90731246c..87f030135 100644 --- a/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiTNew.java +++ b/mallinkService/src/main/java/com/iformall/domain/vo/MerchantPoiTNew.java @@ -24,32 +24,34 @@ public class MerchantPoiTNew implements Serializable { @Excel(name = "详细地址", width = 20, orderNum = "4") @io.swagger.annotations.ApiModelProperty(value="来客门店详细地址",name="poiAddress") private String poiAddress; - @Excel(name="富茂系统商户ID",width = 20,orderNum = "5") + @Excel(name = "管理员手机号", width = 20, orderNum = "5") + @io.swagger.annotations.ApiModelProperty(value="管理员手机号",name="phone") + private String phone; + @Excel(name="富茂系统商户ID",width = 20,orderNum = "6") @io.swagger.annotations.ApiModelProperty(value="富茂系统商户ID",name="merchantId") private String merchantId; - @Excel(name="富茂系统商户名称",width = 20,orderNum = "6") + @Excel(name="富茂系统商户名称",width = 20,orderNum = "7") @io.swagger.annotations.ApiModelProperty(value="富茂系统商户名称",name="merchantName") private String merchantName; - @Excel(name = "富茂系统省份", width = 20, orderNum = "7") + @Excel(name = "富茂系统省份", width = 20, orderNum = "8") @io.swagger.annotations.ApiModelProperty(value="富茂系统省份",name="province") private String province; - @Excel(name = "富茂系统城市", width = 20, orderNum = "8") + @Excel(name = "富茂系统城市", width = 20, orderNum = "9") @io.swagger.annotations.ApiModelProperty(value="富茂系统城市",name="city") private String city; - @Excel(name = "富茂系统地址", width = 20, orderNum = "9") + @Excel(name = "富茂系统地址", width = 20, orderNum = "10") @io.swagger.annotations.ApiModelProperty(value="富茂系统地址",name="address") private String address; - @Excel(name="富茂系统经度",width = 20,orderNum = "10") + @Excel(name="富茂系统经度",width = 20,orderNum = "11") @io.swagger.annotations.ApiModelProperty(value="富茂系统经度",name="longitude") private BigDecimal longitude; - @Excel(name = "富茂系统纬度", width = 20, orderNum = "11") + @Excel(name = "富茂系统纬度", width = 20, orderNum = "12") @io.swagger.annotations.ApiModelProperty(value="富茂系统纬度",name="latitude") private BigDecimal latitude; - @Excel(name = "高德匹配备注", width = 20, orderNum = "12") + @Excel(name = "高德匹配备注", width = 20, orderNum = "13") @io.swagger.annotations.ApiModelProperty(value="高德匹配备注",name="gaodeRemark") private String gaodeRemark; - @Excel(name = "管理员手机号", width = 20, orderNum = "13") - @io.swagger.annotations.ApiModelProperty(value="管理员手机号",name="phone") - private String phone; - + @Excel(name = "POI导入日志", width = 20, orderNum = "14") + @io.swagger.annotations.ApiModelProperty(value="POI导入日志",name="importRemark") + private String importRemark; } diff --git a/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java b/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java index ded3cee1c..fb75ada92 100644 --- a/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java +++ b/mallinkService/src/main/java/com/iformall/service/TtMerchantPoiService.java @@ -64,9 +64,9 @@ public interface TtMerchantPoiService { // ResultData spuStockSync(TenantEntity tenantInfo, Long couponChannelId); - void importOneMem(MallUserInfo user, String importKey, MerchantPoiT poiBase); + void importOneMem(MallUserInfo user, MerchantPoiT poiBase); - void importOnePoiNew(MallUserInfo user, String importKey, MerchantPoiTNew poiBase); + void importOnePoiNew(MallUserInfo user, MerchantPoiTNew poiBase); void exportTemplate(HttpServletRequest request, HttpServletResponse response,boolean isNew); diff --git a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java index d0b98893c..47581d95b 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java @@ -556,15 +556,13 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { } @Override - public void importOneMem(MallUserInfo user, String importKey, MerchantPoiT poiBase) { + public void importOneMem(MallUserInfo user, MerchantPoiT poiBase) { if (StringUtils.isBlank(poiBase.getMerchantId())) { - stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); - logger.error("服务商POI_ID为空", poiBase.toString()); + poiBase.setImportRemark("导入失败.服务商POI_ID为空"); return; } if (StringUtils.isBlank(poiBase.getPoiId())) { - stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); - logger.error("已匹配POI_ID为空", poiBase.toString()); + poiBase.setImportRemark("导入失败.已匹配POI_ID为空"); return; } @@ -598,31 +596,27 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { }else{ ttMerchantPoiMapper.updateById(merchantPoi); } + poiBase.setImportRemark("导入成功"); } catch (Exception e) { - stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); - logger.error(e.getMessage()); + logger.error("importOneMem error.",e); + poiBase.setImportRemark("导入失败."+e.getMessage()); return; } - - stringRedisTemplate.opsForHash().increment(importKey,"processCount",1); - stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); - } @Override - public void importOnePoiNew(MallUserInfo user, String importKey, MerchantPoiTNew poiBase) { - if (StringUtils.isBlank(poiBase.getMerchantId())) { - stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); - return; - } + public void importOnePoiNew(MallUserInfo user, MerchantPoiTNew poiBase){ if (StringUtils.isBlank(poiBase.getPoiId())) { - stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); - return; + poiBase.setImportRemark("导入失败.门店ID为空"); + return; } try { + TtMerchantPoi merchantPoi = null; + if (StringUtils.isNotBlank(poiBase.getMerchantId())) { + merchantPoi = ttMerchantPoiMapper.selectById(Long.parseLong(poiBase.getMerchantId())); + } Date now = new Date(); - TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(Long.parseLong(poiBase.getMerchantId())); if(merchantPoi == null){ merchantPoi = new TtMerchantPoi(); } @@ -640,6 +634,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { merchantPoi.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); merchantPoi.setLastSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); merchantPoi.setUpdateDate(now); + if(merchantPoi.getId() == null){ merchantPoi.setId(Long.parseLong(poiBase.getMerchantId())); merchantPoi.setCreateDate(now); @@ -647,57 +642,14 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { }else{ ttMerchantPoiMapper.updateById(merchantPoi); } + poiBase.setImportRemark("导入成功"); } catch (Exception e) { - stringRedisTemplate.opsForHash().increment(importKey, "processCount", 1); - logger.error(e.getMessage()); + logger.error(e.getMessage(),e); + poiBase.setImportRemark("导入失败."+e.getMessage()); return; } - - stringRedisTemplate.opsForHash().increment(importKey,"processCount",1); - stringRedisTemplate.expire(importKey,10, TimeUnit.SECONDS); - } -// @Override -// public ResultData findPoi(TenantEntity tenantInfo, Long couponChannelId) { -// WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); -// if(couponChannel == null || !EnumCouponChannelStatus.STATUS_THROW_IN.getCode().equals(couponChannel.getStatus())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到上架卷数据"); -// } -// if(!EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(couponChannel.getTargetAd())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"只有投放在列表的卷才能进行同步poi"); -// } -// WxCoupon coupon = wxCouponMapper.selectById(couponChannel.getCouponId(), tenantInfo.getTenantId()); -// if(coupon == null || !EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode().equals(coupon.getStatus())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到可投放的卷"); -// } -// if(!EnumCouponType.getSpuSyncType().contains(coupon.getType())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"卷类型不支持同步poi"); -// } -//// List list = new ArrayList<>(); -//// TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(Long.parseLong(tenantInfo.getTenantId())); -////// TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(Long.parseLong("1038")); -//// list.add(merchantPoi); -// -// List merchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), tenantInfo.getTenantId()); -// if(merchantIds == null || merchantIds.size() == 0 ){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到门店"); -// } -// -// TtMerchantPoi poi = new TtMerchantPoi(); -// poi.updateTenantInfo(tenantInfo); -// poi.setIds(merchantIds); -// poi.setMatchStatus(EnumSupplierMathStatus.match_success.getCode()); -// poi.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); -// List poiList = ttMerchantPoiMapper.findList(poi); -// if(poiList != null && merchantIds.size() == poiList.size()){ -// return new ResultData(poiList); -// }else{ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该商品店铺与poi门店不匹配"); -// } -// -// } - private void updateWebAccessToken(WxAppinfo appinfo, TtBasicService ttbasicService) { try { String accessToken = ttbasicService.getAccessToken(true); @@ -784,395 +736,16 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { for (int i = 0 ; i < poiList.size(); i++) { TtMerchantPoi poi = poiList.get(i); if (StringUtils.isNotBlank(poi.getPoiId())) { - poiMerchantIdMap.put(poi.getPoiId(), poi.getId()); + Long curMId = poiMerchantIdMap.get(poi.getPoiId()); + if (null == curMId) { + poiMerchantIdMap.put(poi.getPoiId(), poi.getId()); + }else { + poiMerchantIdMap.put(poi.getPoiId(), -1L); + } } } return poiMerchantIdMap; } return null; } - - -// @Override -// public ResultData spuSync(TenantEntity tenantInfo, Long couponChannelId, List merchantIds) { -// WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); -// if(couponChannel == null || !EnumCouponChannelStatus.STATUS_THROW_IN.getCode().equals(couponChannel.getStatus())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到上架卷数据"); -// } -// if(!EnumCouponChannelType.COUPON_CHANNEL_ID_DOUYIN_LIST.getCode().equals(couponChannel.getTargetAd())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"只有投放在列表的卷才能进行同步poi"); -// } -// WxCoupon coupon = wxCouponMapper.selectById(couponChannel.getCouponId(), tenantInfo.getTenantId()); -// if(coupon == null || !EnumCouponStatus.COUPON_STATUS_THROW_IN.getCode().equals(coupon.getStatus())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到可投放的卷"); -// } -// if(!EnumCouponType.getSpuSyncType().contains(coupon.getType())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"卷类型不支持同步poi"); -// } -// List couponMerchantIds = wxCouponMerchantMapper.findMerchantIdListByProduct(coupon.getId(), tenantInfo.getTenantId()); -// if(couponMerchantIds == null || couponMerchantIds.size() == 0 ){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到门店"); -// } -// -// TtMerchantPoi poi = new TtMerchantPoi(); -// poi.updateTenantInfo(tenantInfo); -// poi.setIds(couponMerchantIds); -// poi.setMatchStatus(EnumSupplierMathStatus.match_success.getCode()); -// poi.setSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); -// List poiList = ttMerchantPoiMapper.findList(poi); -// if(poiList == null || poiList.isEmpty()){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未查询到匹配的poi"); -// } -//// List collect = poiList.stream().map(p -> p.getId()).collect(Collectors.toList()); -// -// String spuId = spuSync(coupon,couponChannel,couponMerchantIds); -// if(StringUtils.isBlank(spuId)){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败"); -// } -// WxCouponChannel ccUpd = new WxCouponChannel(); -// ccUpd.setId(couponChannel.getId()); -// ccUpd.updateTenantInfo(couponChannel); -// ccUpd.setTtSpuId(spuId); -// ccUpd.setUpdateDate(new Date()); -// wxCouponChannelMapper.updateById(ccUpd); -// -// syncCouponChannelPoi(ccUpd); -// return new ResultData(); -// } - -// private void syncCouponChannelPoi(WxCouponChannel ccUpd){ -// TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(ccUpd.getTenantId(),ccUpd.getId()); -// if(ttCouponChannelPoi != null){ -// ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_auditing.getCode()); -// ttCouponChannelPoi.setLastStatusDesc(""); -// ttCouponChannelPoi.setUpdateDate(ccUpd.getUpdateDate()); -// ttCouponChannelPoiMapper.updateById(ttCouponChannelPoi); -// }else{ -// ttCouponChannelPoi = new TtCouponChannelPoi(); -// ttCouponChannelPoi.setId(ccUpd.getId()); -// ttCouponChannelPoi.updateTenantInfo(ccUpd); -// ttCouponChannelPoi.setSpuId(ccUpd.getTtSpuId()); -// ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_auditing.getCode()); -// ttCouponChannelPoi.setLastStatus(EnumSpuSyncStatus.sync_auditing.getCode()); -// ttCouponChannelPoi.setCreateDate(ccUpd.getUpdateDate()); -// ttCouponChannelPoi.setUpdateDate(ccUpd.getUpdateDate()); -// ttCouponChannelPoiMapper.insert(ttCouponChannelPoi); -// } -// } - -// private String spuSync(WxCoupon coupon,WxCouponChannel couponChannel, List merchantIds){ -// TtSpuSync spuSync = new TtSpuSync(); -// spuSync.setEntryInfo(getEntryInfo(couponChannel)); -//// spuSync.setFrontCategoryTag();//前台品类标签 -//// spuSync.setRecommendWord();//推荐语,5~20个字 -//// spuSync.setSortWeight();//排序权重,按降序排列 -// List collect = merchantIds.stream().map(merchantId -> merchantId.toString()).collect(Collectors.toList()); -// spuSync.setSupplierExtIdList(collect); -// spuSync.setPrice(coupon.getSalePrice()); -// spuSync.setSpuExtId(couponChannel.getId().toString()); -// spuSync.setImageList(JSONArray.parseArray(coupon.getCoverPicture(),String.class)); -//// spuSync.setMpSettletype();//小程序结算类型 1-包销 2-代销 -// spuSync.setOriginPrice(coupon.getPrice()); -//// spuSync.setTakeRate();//商品的抽佣率,万分数 -// spuSync.setAttribute(getAttribute(coupon,couponChannel)); -//// spuSync.setHighlights(getHighlights(coupon)); -// spuSync.setName(coupon.getTitle()); -//// spuSync.setOrderDependsOnDate(false);//下单是否依赖日期 -// spuSync.setSpuType(91);//spu类型号,1-日历房,30-酒店民宿预售券,90-门票,91-团购券 -// if(EnumCouponChannelStatus.STATUS_THROW_IN.getCode().equals(couponChannel.getStatus())){ -// spuSync.setStatus(1); -// }else{ -// spuSync.setStatus(2); -// } -// spuSync.setStock(coupon.getRemainInventory()); -// -// String spuId = null; -// try { -// spuId = getTtWebService(coupon).getProductService().spuSync(spuSync); -// } catch (WxErrorException e) { -// logger.error("发起商品同步error"+e.getMessage()); -// throw new MallinkException(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); -// } -// return spuId; -// } - - //__________________________________商品同步_______________________________________________ - //获取入口信息 -// private JsonObject getEntryInfo(WxCouponChannel couponChannel){ -// JsonObject object = new JsonObject(); -// object.addProperty("entry_type",2);//入口类型(1:H5,2:抖音小程序,3:抖音链接) -// JsonObject miniApp = new JsonObject(); -// miniApp.addProperty("params",couponChannel.getTtparams()); -// miniApp.addProperty("path",couponChannel.getTtPath()); -// WxAppinfo appInfo = wxAppinfoService.getCAppInfo(couponChannel, EnumAppPlat.TOUTIAO); -// miniApp.addProperty("app_id",appInfo.getAppId()); -// object.add("entry_miniApp",miniApp); -// return object; -// } -// -// //获取SPU属性字段 -// private JsonObject getAttribute(WxCoupon coupon,WxCouponChannel couponChannel){ -//// JsonObject object = new JsonObject(); -// JsonObject productObjuct = new JsonObject(); -// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); -// productObjuct.addProperty("groupon_valid_start",dateFormat.format(couponChannel.getShowBeginTime()));//团购售卖时间开始 -// // todo 要求必传, 可能为空 -// productObjuct.addProperty("groupon_valid_end",dateFormat.format(coupon.getValidEndDate()));//******* -// -// productObjuct.addProperty("order_limit",coupon.getUseLimitQuantity());//单个用户购买数量限制 -// if(EnumCouponValidType.BETWEEN_TWO_TIME.getCode().equals(coupon.getValidType())){ -// productObjuct.addProperty("order_valid_start",dateFormat.format(coupon.getValidStartDate())); -// productObjuct.addProperty("order_valid_end",dateFormat.format(coupon.getValidEndDate())); -// }else if(EnumCouponValidType.DAYS_AFTER_RECEIVING.getCode().equals(coupon.getValidType())){ -// productObjuct.addProperty("post_purchase_day",coupon.getValidDays()); -// } -// //todo 商家客服电话 目前传的广场的客服电话 联系人广场名称 -// WxMall mall = wxMallMapper.getByTenantId(coupon.getTenantId()); -// JsonArray phoneArray = new JsonArray(); -// phoneArray.add(mall.getServicePhone()); -// productObjuct.add("service_phone",phoneArray); -// productObjuct.addProperty("contact_name",mall.getName()); -// -// //todo 团购须知 要求格式 标题加类容 是否二选一 待测试 -// JsonArray notificationArray = new JsonArray(); -//// for ( : ) { -// JsonObject contentObject = new JsonObject(); -// contentObject.addProperty("title","");//标题 -// contentObject.addProperty("content",coupon.getRemark());//内容 -// notificationArray.add(contentObject); -//// } -// productObjuct.add("notification",notificationArray); -// if(EnumCouponContentType.HTML.getCode().equals(coupon.getContentType())){ -// productObjuct.addProperty("notification_rich_text",coupon.getHtml()); -// } -// productObjuct.addProperty("sub_title",coupon.getSubTitle()); -// -// //todo 团购详情 要求必传, 待测试 -// if(StringUtils.isNotBlank(coupon.getItemGroup())){ -// JsonArray groupArray = new JsonParser().parse(coupon.getItemGroup()).getAsJsonArray(); -// productObjuct.add("pay_item_groups",groupArray); -// } -//// JsonArray groupArray = new JsonArray(); -//// for ( : ) { -//// JsonObject groupObject = new JsonObject(); -//// groupObject.addProperty("group_name","标题");//标题 -//// JsonArray itemArray = new JsonArray(); //菜品 -//// for (:) { -//// JsonObject itemObject = new JsonObject(); -//// itemObject.addProperty("name","菜名"); -//// itemObject.addProperty("count","数量"); -//// itemObject.addProperty("price","价格"); -//// itemArray.add(itemObject); -//// } -//// groupObject.add("item_list",itemArray); -//// groupArray.add(groupObject); -//// } -//// productObjuct.add("pay_item_groups",groupArray); -// -// //使用日期规则 -//// JsonObject dateRuleObject = new JsonObject(); -//// JsonObject unDateObject = new JsonObject();//不可用日期 -//// JsonArray dateArray = new JsonArray();//日期列表,格式yyyy-mm-dd,最多传100个 -//// JsonArray weekDayArray = new JsonArray();//星期列表,1-7代表周一到周天,[1,2]代表周一周二不可用 -//// unDateObject.add("date_list",dateArray); -//// unDateObject.add("weekday_list",weekDayArray); -//// dateRuleObject.add("unavailable_date",unDateObject); -//// productObjuct.add("date_rule",dateRuleObject); -// -// return productObjuct; -// } -// -// //商品亮点标签 -// private JsonArray getHighlights(WxCoupon coupon){ -// JsonArray array = new JsonArray(); -//// for (:) { -//// JsonObject object = new JsonObject(); -//// object.addProperty("content",);//介绍,字符串长度<=5 -//// object.addProperty("priority",);//优先级,数字越小优先级越高 -//// array.add(object); -//// } -// return array; -// } - - //_________________________________________________________________________________ - -// @Override -// public ResultData spuGet(TenantEntity tenantInfo, Long couponChannelId) { -// WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); -// if(couponChannel == null){ -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到卷数据"); -// } -// if(StringUtils.isBlank(couponChannel.getTtSpuId())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未同步poi"); -// } -// TtSpuGet spuGet = new TtSpuGet(); -// spuGet.setSpuExtId(couponChannel.getId().toString()); -// spuGet.setNeedSpuDraft(true); -// spuGet.setSpuDraftcount(3); -// try { -// TtSpuGetResult spuGetResult = getTtWebService(tenantInfo).getProductService().spuGet(spuGet); -// handSyncCouponChannelPoi(tenantInfo,spuGetResult); -// //处理一下数据 -// Map map = new HashMap<>(); -// if(spuGetResult.getSpuDetail() != null){//线上数据 -// TtSpuSync spuDetail = spuGetResult.getSpuDetail(); -// map.put("spuDetail",handSpuSync(spuDetail)); -// } -// if(spuGetResult.getSpuDraft() != null && spuGetResult.getSpuDraft().size() > 0){//最近一次审核数据 -// TtSpuSync spuDraft = spuGetResult.getSpuDraft().get(0); -// map.put("spuDraft",handSpuSync(spuDraft)); -// } -// return new ResultData(map); -// } catch (WxErrorException e) { -// logger.error("couponChannelId:"+couponChannelId +" 多门店SPU信息查询error "+e.getMessage()); -// return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); -// } -// } -// -// private void handSyncCouponChannelPoi(TenantEntity tenantInfo,TtSpuGetResult spuGetResult){ -// Date now = new Date(); -// TtSpuSync spuDetail = spuGetResult.getSpuDetail(); -// if(spuDetail != null && StringUtils.isNotBlank(spuDetail.getSpuId()) && StringUtils.isNotBlank(spuDetail.getSpuExtId()) -// && spuDetail.getStatus() != null){ -// TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),Long.parseLong(spuDetail.getSpuExtId())); -// if(ttCouponChannelPoi != null && !spuDetail.getStatus().equals(ttCouponChannelPoi.getStatus())){ -// TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); -// ccPoi.setId(ttCouponChannelPoi.getId()); -// ccPoi.setStatus(spuDetail.getStatus()); -// ccPoi.setStatusDesc(spuDetail.getStatusDesc()); -// ccPoi.setUpdateDate(now); -// ttCouponChannelPoiMapper.updateById(ccPoi); -// }else if(ttCouponChannelPoi == null){ -// ttCouponChannelPoi = new TtCouponChannelPoi(); -// ttCouponChannelPoi.setId(Long.parseLong(spuDetail.getSpuExtId())); -// ttCouponChannelPoi.updateTenantInfo(tenantInfo); -// ttCouponChannelPoi.setSpuId(spuDetail.getSpuId()); -// ttCouponChannelPoi.setStatus(spuDetail.getStatus()); -// ttCouponChannelPoi.setStatusDesc(spuDetail.getStatusDesc()); -// ttCouponChannelPoi.setCreateDate(now); -// ttCouponChannelPoi.setUpdateDate(now); -// ttCouponChannelPoiMapper.insert(ttCouponChannelPoi); -// } -// } -// List spuDraftList = spuGetResult.getSpuDraft(); -// if(spuDraftList != null && spuDraftList.size() > 0){ -// TtSpuSync spuDraft = spuDraftList.get(0); -// if(spuDraft != null && StringUtils.isNotBlank(spuDraft.getSpuId()) && StringUtils.isNotBlank(spuDraft.getSpuExtId()) -// && spuDraft.getStatus() != null){ -// TtCouponChannelPoi ttCouponChannelPoi = ttCouponChannelPoiMapper.selectById(tenantInfo.getTenantId(),Long.parseLong(spuDraft.getSpuExtId())); -// if(ttCouponChannelPoi != null && !spuDraft.getStatus().equals(ttCouponChannelPoi.getStatus())){ -// TtCouponChannelPoi ccPoi = new TtCouponChannelPoi(); -// ccPoi.setId(ttCouponChannelPoi.getId()); -// ccPoi.setLastStatus(spuDraft.getStatus()); -// ccPoi.setLastStatusDesc(spuDraft.getStatusDesc()); -// ccPoi.setUpdateDate(now); -// ttCouponChannelPoiMapper.updateById(ccPoi); -// }else if(ttCouponChannelPoi == null){ -// ttCouponChannelPoi = new TtCouponChannelPoi(); -// ttCouponChannelPoi.setId(Long.parseLong(spuDraft.getSpuExtId())); -// ttCouponChannelPoi.updateTenantInfo(tenantInfo); -// ttCouponChannelPoi.setSpuId(spuDraft.getSpuId()); -// ttCouponChannelPoi.setStatus(EnumSpuSyncStatus.sync_auditing.getCode()); -// ttCouponChannelPoi.setLastStatus(spuDraft.getStatus()); -// ttCouponChannelPoi.setLastStatusDesc(spuDraft.getStatusDesc()); -// ttCouponChannelPoi.setCreateDate(now); -// ttCouponChannelPoi.setUpdateDate(now); -// ttCouponChannelPoiMapper.insert(ttCouponChannelPoi); -// } -// } -// } -// } -// -// private Map handSpuSync(TtSpuSync spuSync){ -// Map map = new HashMap<>(); -// map.put("id",spuSync.getSpuExtId()); -// map.put("spu_id",spuSync.getSpuId()); -// map.put("image_list",spuSync.getImageList()); -// map.put("name",spuSync.getName()); -// if(spuSync.getAttribute() != null){ -// JsonObject attribute = spuSync.getAttribute(); -// JsonArray pay_item_groups = attribute.getAsJsonArray("pay_item_groups"); -// map.put("pay_item_groups",pay_item_groups.toString()); -// JsonArray notification = attribute.getAsJsonArray("notification"); -// map.put("notification",notification.toString()); -// map.put("order_limit", GsonHelper.getString(attribute, "order_limit")); -// //售卖有效期 -// map.put("groupon_valid_start", GsonHelper.getString(attribute, "groupon_valid_start")); -// map.put("groupon_valid_end", GsonHelper.getString(attribute, "groupon_valid_end")); -// //卷有效期 -// map.put("order_valid_start", GsonHelper.getString(attribute, "order_valid_start")); -// map.put("order_valid_end", GsonHelper.getString(attribute, "order_valid_end")); -// -// } -// -// map.put("price",spuSync.getPrice()); -// map.put("origin_price",spuSync.getOriginPrice()); -// map.put("stock",spuSync.getStock()); -// map.put("status",spuSync.getStatus()); -// map.put("status_desc",spuSync.getStatusDesc()); -// return map; -// } - -// @Override -// public ResultData spuStatusSync(TenantEntity tenantInfo, Long couponChannelId) { -// WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); -// if(couponChannel == null){ -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到卷数据"); -// } -// if(StringUtils.isBlank(couponChannel.getTtSpuId())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未同步poi"); -// } -// TtSpuStatusSync statusSync = new TtSpuStatusSync(); -// List ids = new ArrayList<>(); -// ids.add(couponChannel.getId().toString()); -// statusSync.setSpuExtIdList(ids); -// if(EnumCouponChannelStatus.STATUS_THROW_IN.getCode().equals(couponChannel.getStatus())){ -// statusSync.setStatus(1); -// }else{ -// statusSync.setStatus(2); -// } -// try { -// TtSpuStatusSync statusSyncResult = getTtWebService(tenantInfo).getProductService().spuStatusSync(statusSync); -// if(statusSyncResult.getSpuExtIdList() != null && statusSyncResult.getSpuExtIdList().containsAll(ids)){ -// return new ResultData(); -// } -// } catch (WxErrorException e) { -// logger.error("couponChannelId:"+couponChannelId +" 多门店SPU状态同步error "+e.getMessage()); -// throw new MallinkException(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); -//// return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); -// } -// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); -//// return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); -// } - -// @Override -// public ResultData spuStockSync(TenantEntity tenantInfo, Long couponChannelId) { -// WxCouponChannel couponChannel = wxCouponChannelMapper.selectById(couponChannelId, tenantInfo.getTenantId()); -// if(couponChannel == null){ -// return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到卷数据"); -// } -// if(StringUtils.isBlank(couponChannel.getTtSpuId())){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该券未同步poi"); -// } -// WxCoupon coupon = wxCouponMapper.selectById(couponChannel.getCouponId(), tenantInfo.getTenantId()); -// if(coupon == null){ -// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"未找到卷数据"); -// } -// TtSpuStockSync stockSync = new TtSpuStockSync(); -// stockSync.setSpuExtId(couponChannel.getId().toString()); -// stockSync.setStock(coupon.getRemainInventory()); -// try { -// boolean syncResult = getTtWebService(tenantInfo).getProductService().spuStockUpdate(stockSync); -// if(syncResult){ -// return new ResultData(); -// } -// } catch (WxErrorException e) { -// logger.error("couponChannelId:"+couponChannelId +" 多门店SPU状态同步error "+e.getMessage()); -// throw new MallinkException(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); -//// return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); -// } -// throw new MallinkException(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); -//// return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),"同步失败"); -// } - } diff --git a/mallinkService/src/main/java/com/iformall/service/park/impl/ketuo/KeTuoParkService.java b/mallinkService/src/main/java/com/iformall/service/park/impl/ketuo/KeTuoParkService.java index 82f0a968b..dcc80bc86 100644 --- a/mallinkService/src/main/java/com/iformall/service/park/impl/ketuo/KeTuoParkService.java +++ b/mallinkService/src/main/java/com/iformall/service/park/impl/ketuo/KeTuoParkService.java @@ -65,20 +65,7 @@ public class KeTuoParkService extends BaseParkService implements ParkAdapterServ KeTuoUtil ketuo = new KeTuoUtil(); /** - * 先去捷顺注册,调用登陆获取令牌,然后根据令牌调用别的接口 - * http://ap.jieshun.cn:9088/apply/ 注册信息地址 fumao/iformall2020 - * - * 捷顺商户平台:http://merchant.jslife.com.cn/merchant/index.html#/auth/login - * 捷顺门店平台:http://merchant.jslife.com.cn/store/index.html#/auth/login - * 门店商户号 000000008032172000003 密码 ycHqp61Acudxz - * - * - * API对接注意事项: - 1、token有效期两个小时,每两小时内登录一次获取token,调业务接口不需要频繁登录用,建议获取一次token存本地缓存,之后从本地获取,两小时内刷新一次, - 为避免调业务接口时刚好token被刷新,导致token失效(无效的令牌或令牌已过期),可以做下容错,重新登录获取token或用最新token重新调业务接口。 - 2、token是和ip是一对一绑定,新的ip服务器调捷顺的接口会出现ip不合法,需把ip提供捷顺方,添加白名单。多个服务调捷顺接口共用一个ip情况下,只能共用一套登录获取token机制,各自登录会冲突。 - 3、所有接口要带车牌的一律带横杠。格式如:粤-B12345。 - 4、无效的数据签名是指sn加密方式不对。sn加密方式是对p+signkey进行Md5加密,加密后的字符串大写。 + * 科拓 停车场云助手App. 开通电子抵扣券 */ @Override