|
|
|
@@ -240,8 +240,31 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
|
if(!EnumSupplierMathStatus.match_success.getCode().equals(merchantPoi.getMatchStatus())){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"该店铺未匹配成功,暂不能同步"); |
|
|
|
} |
|
|
|
WxMerchant merchant = wxMerchantMapper.selectById(id); |
|
|
|
String supplierId = supplierSync(tenantInfo, merchantPoi, merchant); |
|
|
|
|
|
|
|
String linkPhone = null; |
|
|
|
String contactTel = null; |
|
|
|
List<String> images = new ArrayList<>(); |
|
|
|
Integer status = EnumMerchantStatus.VALID.getCode(); |
|
|
|
String introduction = ""; |
|
|
|
Integer businessId = EnumBusiness.BUSINESS_ID1.getCode(); |
|
|
|
|
|
|
|
// if(merchantPoi.getTenantId().equals(id.toString())){ |
|
|
|
if(merchantPoi.getId() == 1038){ |
|
|
|
WxMall mall = wxMallMapper.getByTenantId(merchantPoi.getTenantId()); |
|
|
|
contactTel = mall.getServicePhone(); |
|
|
|
images.add(mall.getImg()); |
|
|
|
introduction = mall.getIntroduction(); |
|
|
|
}else{ |
|
|
|
WxMerchant merchant = wxMerchantMapper.selectById(id); |
|
|
|
linkPhone = merchant.getLinkPhone(); |
|
|
|
images = JSONArray.parseArray(merchant.getCoverPicture(), String.class); |
|
|
|
status = merchant.getStatus(); |
|
|
|
introduction = merchant.getIntroduction(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
String supplierId = supplierSync(tenantInfo, merchantPoi, linkPhone,contactTel, images, status, introduction, businessId); |
|
|
|
|
|
|
|
if(StringUtils.isBlank(supplierId)){ |
|
|
|
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"同步失败"); |
|
|
|
} |
|
|
|
@@ -254,19 +277,18 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
|
return new ResultData(); |
|
|
|
} |
|
|
|
|
|
|
|
private String supplierSync(TenantEntity tenantInfo,TtMerchantPoi merchantPoi,WxMerchant merchant){ |
|
|
|
private String supplierSync(TenantEntity tenantInfo,TtMerchantPoi merchantPoi, |
|
|
|
String linkPhone,String contactTel,List<String> images,Integer status,String introduction,Integer businessId){ |
|
|
|
TtSupplierSync supplierSync = new TtSupplierSync(); |
|
|
|
supplierSync.setContactPhone(merchant.getLinkPhone()); |
|
|
|
// supplierSync.setContactTel();//联系座机号 |
|
|
|
List<String> images = new ArrayList<>(); |
|
|
|
images.add(merchant.getImgUrl()); |
|
|
|
supplierSync.setContactPhone(linkPhone); |
|
|
|
supplierSync.setContactTel(contactTel);//联系座机号 |
|
|
|
supplierSync.setImages(images); |
|
|
|
// supplierSync.setMerchantUid();//如果开启分账并且已进件 |
|
|
|
// supplierSync.setServiceProvider(getServiceProvider(merchant));//营业执照等 |
|
|
|
supplierSync.setSupplierExtId(merchant.getId().toString()); |
|
|
|
supplierSync.setSupplierExtId(merchantPoi.getSupplierExtId()); |
|
|
|
|
|
|
|
// supplierSync.setTags();//标签 [可停车 离地铁近] |
|
|
|
supplierSync.setStatus(EnumMerchantStatus.VALID.getCode().equals(merchant.getStatus())?1:2); |
|
|
|
supplierSync.setStatus(EnumMerchantStatus.VALID.getCode().equals(status)?1:2); |
|
|
|
// todo POI品类编码 POI品类描述 eg. 美食;中式餐饮;小龙虾 |
|
|
|
// supplierSync.setTypeCode(); |
|
|
|
// supplierSync.setTypeName(); |
|
|
|
@@ -277,10 +299,10 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
|
//todo 商家资质信息 |
|
|
|
// supplierSync.setCustomerInfo(getCustomerInfo(merchantPoi,merchant)); |
|
|
|
|
|
|
|
supplierSync.setDescription(merchant.getIntroduction()); |
|
|
|
supplierSync.setName(merchant.getName()); |
|
|
|
supplierSync.setDescription(introduction); |
|
|
|
supplierSync.setName(merchantPoi.getPoiName()); |
|
|
|
// supplierSync.setRecommends(getRecommends(merchant));//推荐 |
|
|
|
supplierSync.setServices(getServices(merchant)); |
|
|
|
supplierSync.setServices(getServices(merchantPoi)); |
|
|
|
// supplierSync.setAttributes();//不传 |
|
|
|
|
|
|
|
// supplierSync.setLongitude();//经度 |
|
|
|
@@ -293,7 +315,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
|
supplierSync.setPoiId(merchantPoi.getPoiId()); |
|
|
|
|
|
|
|
//todo 如果抖音没有这个类型怎么办 |
|
|
|
Integer ttType = EnumBusiness.getEnum(merchant.getBusinessId()).getTtType(); |
|
|
|
Integer ttType = EnumBusiness.getEnum(businessId).getTtType(); |
|
|
|
if(ttType == null){ |
|
|
|
logger.error("未找到对应的店铺类型"); |
|
|
|
throw new MallinkException(ErrorCode.MSG_METHOD_REQUEST_ERROR.getCode(),"未找到对应的店铺类型"); |
|
|
|
@@ -372,7 +394,7 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { |
|
|
|
} |
|
|
|
|
|
|
|
//团购券类型 services 中的 service_type 必须包含 9101,门票类型 services 中的 service_type 必须包含 9001 |
|
|
|
private JsonArray getServices(WxMerchant merchant){ |
|
|
|
private JsonArray getServices(TtMerchantPoi merchant){ |
|
|
|
JsonArray jsonArray = new JsonArray(); |
|
|
|
JsonObject jsonObject = new JsonObject(); |
|
|
|
jsonObject.addProperty("enable",1); |
|
|
|
|