|
|
@@ -269,12 +269,14 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
// if(StringUtils.isBlank(supplierId)){ |
|
|
// if(StringUtils.isBlank(supplierId)){ |
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败"); |
|
|
// return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败"); |
|
|
// } |
|
|
// } |
|
|
TtMerchantPoi updPoi = new TtMerchantPoi(); |
|
|
|
|
|
updPoi.setId(id); |
|
|
|
|
|
updPoi.setSupplierId(supplierId); |
|
|
|
|
|
updPoi.setLastSyncStatus(EnumSupplierSyncStatus.sync_success.getCode()); |
|
|
|
|
|
updPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttMerchantPoiMapper.updateById(merchantPoi); |
|
|
|
|
|
|
|
|
if(!EnumSupplierSyncStatus.sync_success.getCode().equals(merchantPoi.getSyncStatus())){ |
|
|
|
|
|
TtMerchantPoi updPoi = new TtMerchantPoi(); |
|
|
|
|
|
updPoi.setId(id); |
|
|
|
|
|
updPoi.setSupplierId(supplierId); |
|
|
|
|
|
updPoi.setLastSyncStatus(EnumSupplierSyncStatus.sync_wait.getCode()); |
|
|
|
|
|
updPoi.setUpdateDate(new Date()); |
|
|
|
|
|
ttMerchantPoiMapper.updateById(merchantPoi); |
|
|
|
|
|
} |
|
|
return new ResultData(); |
|
|
return new ResultData(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@@ -426,15 +428,15 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void supplierQuery(Long id) { |
|
|
|
|
|
|
|
|
public ResultData supplierQuery(TenantEntity tenantEntity, Long id) { |
|
|
TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(id); |
|
|
TtMerchantPoi merchantPoi = ttMerchantPoiMapper.selectById(id); |
|
|
if(merchantPoi == null){ |
|
|
if(merchantPoi == null){ |
|
|
logger.error("未找到数据"); |
|
|
logger.error("未找到数据"); |
|
|
return; |
|
|
|
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"未找到数据"); |
|
|
} |
|
|
} |
|
|
if(!EnumSupplierSyncStatus.sync_wait.getCode().equals(merchantPoi.getLastSyncStatus())){ |
|
|
|
|
|
logger.error("该店铺暂未申请同步或已知同步结果"); |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
if(merchantPoi.getLastSyncStatus() == null){ |
|
|
|
|
|
logger.error("该店铺暂未申请同步"); |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"该店铺暂未申请同步"); |
|
|
} |
|
|
} |
|
|
try { |
|
|
try { |
|
|
TtSupplierSyncQuery syncQuery = getTtWebService(merchantPoi).getProductService().supplierQuery(merchantPoi.getSupplierExtId()); |
|
|
TtSupplierSyncQuery syncQuery = getTtWebService(merchantPoi).getProductService().supplierQuery(merchantPoi.getSupplierExtId()); |
|
|
@@ -448,12 +450,33 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
poiUpd.setFailReason(syncQuery.getSyncStatus().getFailReason()); |
|
|
poiUpd.setFailReason(syncQuery.getSyncStatus().getFailReason()); |
|
|
poiUpd.setUpdateDate(new Date()); |
|
|
poiUpd.setUpdateDate(new Date()); |
|
|
ttMerchantPoiMapper.updateById(poiUpd); |
|
|
ttMerchantPoiMapper.updateById(poiUpd); |
|
|
}else{ |
|
|
|
|
|
logger.error("请求接口返回为空"); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
return new ResultData(handSupplieSync(syncQuery)); |
|
|
} catch (WxErrorException e) { |
|
|
} catch (WxErrorException e) { |
|
|
logger.error("查询匹配任务error"+e.getMessage()); |
|
|
logger.error("查询匹配任务error"+e.getMessage()); |
|
|
|
|
|
return new ResultData(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),e.getMessage()); |
|
|
|
|
|
} catch (Exception e){ |
|
|
|
|
|
logger.error("查询匹配任务error"+e.getMessage()); |
|
|
|
|
|
return new ResultData(ErrorCode.SYS_SERVER_ERROR.getCode(),e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private Map<String,Object> handSupplieSync(TtSupplierSyncQuery syncQuery){ |
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
|
if(syncQuery != null){ |
|
|
|
|
|
if(syncQuery.getDataDetail() != null){ |
|
|
|
|
|
map.put("data_detail",syncQuery.getDataDetail().toJson()); |
|
|
|
|
|
} |
|
|
|
|
|
if(syncQuery.getSyncStatus() != null){ |
|
|
|
|
|
Map<String,Object> statusMap = new HashMap<>(); |
|
|
|
|
|
statusMap.put("last_sync_status",syncQuery.getSyncStatus().getLastSyncStatus()); |
|
|
|
|
|
statusMap.put("fail_reason",syncQuery.getSyncStatus().getFailReason()); |
|
|
|
|
|
map.put("sync_status",syncQuery.getSyncStatus()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
return map; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|