From 57ee247a4e74927d5da5c815fcc5a425c8d31ac3 Mon Sep 17 00:00:00 2001 From: xhxu Date: Thu, 14 Apr 2022 12:52:06 +0800 Subject: [PATCH] //update test --- .../com/iformall/domain/po/TtMerchantPoi.java | 40 +++++++++++++++ .../impl/TtMerchantPoiServiceImpl.java | 50 +++++++++++++------ .../resources/mapper/TtMerchantPoiMapper.xml | 14 +++++- 3 files changed, 89 insertions(+), 15 deletions(-) diff --git a/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java b/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java index a24197a23..495bf2b44 100644 --- a/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java +++ b/mallinkService/src/main/java/com/iformall/domain/po/TtMerchantPoi.java @@ -1,7 +1,9 @@ package com.iformall.domain.po; import com.baomidou.mybatisplus.annotation.TableName; +import com.google.gson.JsonObject; import com.iformall.domain.po.base.TenantEntity; +import com.iformall.utils.Constant; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; @@ -84,4 +86,42 @@ public class TtMerchantPoi extends TenantEntity { @io.swagger.annotations.ApiModelProperty(value="同步失败原因,抖音风控政策问题,该字段无法提供太多信息,目前审核不通过联系抖音运营做进一步处理",name="failReason") private String failReason; + + @io.swagger.annotations.ApiModelProperty(value="商铺营业执照路径",name="bizLicencePath") + private String bizLicencePath; + @io.swagger.annotations.ApiModelProperty(value="营业执照审核详细",name="bizLicenceStatus") + private String bizLicenceStatus; + @io.swagger.annotations.ApiModelProperty(value="商家授权函(或与小程序的合作协议)路径",name="contractPath") + private String contractPath; + @io.swagger.annotations.ApiModelProperty(value="商家授权函审核详细",name="contractStatus") + private String contractStatus; + @io.swagger.annotations.ApiModelProperty(value="商铺行业资质材料信息",name="qualMaterial") + private String qualMaterial; + @io.swagger.annotations.ApiModelProperty(value="商铺行业资质材料信息审核详细",name="qualMaterialStatus") + private String qualMaterialStatus; + @io.swagger.annotations.ApiModelProperty(value="其他补充资质",name="additionalQual") + private String additionalQual; + @io.swagger.annotations.ApiModelProperty(value="其他补充资质审核详细",name="additionalQualStatus") + private String additionalQualStatus; + @io.swagger.annotations.ApiModelProperty(value="所有资质的最早过期时间",name="expireTime") + private String expireTime; + + + + + public String getTtparams(){ + return Constant.mainPageUrl; + } + + public String getTtPath(){ + JsonObject object = new JsonObject(); + // if(!merchantPoi.getTenantId().equals(id.toString())){ + if(getId() != 1038){ + object.addProperty("type","md"); + object.addProperty("id",id); + } + return object.toString(); + } + + } 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 2cbeb486a..164166bce 100644 --- a/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java +++ b/mallinkService/src/main/java/com/iformall/service/impl/TtMerchantPoiServiceImpl.java @@ -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 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 images,Integer status,String introduction,Integer businessId){ TtSupplierSync supplierSync = new TtSupplierSync(); - supplierSync.setContactPhone(merchant.getLinkPhone()); -// supplierSync.setContactTel();//联系座机号 - List 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); diff --git a/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml b/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml index b3ad7e961..3c44afdae 100644 --- a/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml +++ b/mallinkService/src/main/resources/mapper/TtMerchantPoiMapper.xml @@ -34,6 +34,17 @@ + + + + + + + + + + + @@ -43,7 +54,8 @@ `poi_id`,`poi_name`,`province`,`city`,`address`, `task_id`,`match_status`,`mismatch_status_desc`, `create_date`,`update_date`, - `supplier_id`,`sync_status`,`last_sync_status`,`fail_reason` + `supplier_id`,`sync_status`,`last_sync_status`,`fail_reason`, + `biz_licence_path`,`biz_licence_status`,`contract_path`,`contract_status`,`qual_material`,`qual_material_status`,`additional_qual`,`additional_qual_status`,`expire_time`