@@ -70,13 +70,17 @@ public class TtMerchantPoiServiceImpl implements TtMerchantPoiService { | |||||
TtOpenMaService openMaService = openService.getTtOpenComponentService().getTtMaServiceByAppid(appinfo.getAppId()); | TtOpenMaService openMaService = openService.getTtOpenComponentService().getTtMaServiceByAppid(appinfo.getAppId()); | ||||
TtOpenResult res = openMaService.addShopMaterial(shopMaterial); | |||||
if(res.isSuccess()){ | |||||
merchantPoi.setUpdateDate(new Date()); | |||||
ttMerchantPoiMapper.updateById(merchantPoi); | |||||
return true; | |||||
try{ | |||||
TtOpenResult res = openMaService.addShopMaterial(shopMaterial); | |||||
if(res.isSuccess()){ | |||||
merchantPoi.setUpdateDate(new Date()); | |||||
ttMerchantPoiMapper.updateById(merchantPoi); | |||||
return true; | |||||
} | |||||
logger.error("提交商铺资质材料error"+ res.getMessage()); | |||||
}catch(Exception e){ | |||||
logger.error("提交商铺资质材料error"+ e.getMessage()); | |||||
} | } | ||||
logger.error("提交商铺资质材料error"+ res.getMessage()); | |||||
return false; | return false; | ||||
} | } | ||||
@@ -243,6 +243,11 @@ public interface TtOpenMaService extends TtMaService { | |||||
*/ | */ | ||||
String API_ADD_SHOP_MATERIAL = "https://open.microapp.bytedance.com/openapi/v1/microapp/operation/add_shop_material"; | String API_ADD_SHOP_MATERIAL = "https://open.microapp.bytedance.com/openapi/v1/microapp/operation/add_shop_material"; | ||||
/** | |||||
* 查询商铺资质材料 | |||||
*/ | |||||
String APIQUERY_SHOP_MATERIAL = "https://open.microapp.bytedance.com/openapi/v1//microapp/operation/poi/query_shop_material"; | |||||
/** | /** | ||||
* 获得小程序的域名配置信息 | * 获得小程序的域名配置信息 | ||||
@@ -498,6 +503,8 @@ public interface TtOpenMaService extends TtMaService { | |||||
TtOpenResult addShopMaterial(TtOpenShopMaterial shopMaterial)throws WxErrorException; | TtOpenResult addShopMaterial(TtOpenShopMaterial shopMaterial)throws WxErrorException; | ||||
String queryShopMeaterial(String supplierExtId)throws WxErrorException ; | |||||
// /** | // /** | ||||
// * 小程序用户隐私保护指引服务 | // * 小程序用户隐私保护指引服务 | ||||
// * | // * | ||||
@@ -690,6 +690,13 @@ public class TtOpenMaServiceImpl extends TtMaServiceImpl implements TtOpenMaServ | |||||
return TtOpenGsonBuilder.create().fromJson(response, TtOpenResult.class); | return TtOpenGsonBuilder.create().fromJson(response, TtOpenResult.class); | ||||
} | } | ||||
@Override | |||||
public String queryShopMeaterial(String supplierExtId) throws WxErrorException { | |||||
String uri = APIQUERY_SHOP_MATERIAL + "?component_appid=" + ttOpenComponentService.getWxOpenConfigStorage().getComponentAppId(); | |||||
String response = ttOpenComponentService.getByAppAccessToken(appId, uri, "authorizer_access_token"); | |||||
return response; | |||||
} | |||||
/** | /** | ||||
* 将字符串对象转化为GsonArray对象 | * 将字符串对象转化为GsonArray对象 | ||||
@@ -207,4 +207,36 @@ public class TtMerchantPoiController extends BaseController { | |||||
} | } | ||||
@ApiOperation("查询商铺资质材料状态") | |||||
@GetMapping("/query_shop_meaterial") | |||||
@ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
public ResultData queryShopMeaterial(String appId,Long id) { | |||||
logger.debug("[" + getIpAddr() + "] TtMerchantPoiController::findById"); | |||||
if(StringUtils.isBlank(appId)){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"appId为空"); | |||||
} | |||||
WxAppinfo appinfo = appinfoService.getByAppId(appId); | |||||
if(appinfo == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_ERROR.getCode(),"找不到小程序信息"); | |||||
} | |||||
if(id == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||||
} | |||||
TtMerchantPoi record = ttMerchantPoiService.getById(id); | |||||
if(record == null){ | |||||
return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL.getCode(),"查询不到商户"); | |||||
} | |||||
try{ | |||||
TtOpenMaService openMaService = openService.getTtOpenComponentService().getTtMaServiceByAppid(appId); | |||||
String res = openMaService.queryShopMeaterial(record.getSupplierExtId()); | |||||
return new ResultData(res); | |||||
}catch(Exception e){ | |||||
logger.error("查询商铺资质材料状态 error"+ e.getMessage()); | |||||
} | |||||
return new ResultData(ErrorCode.SYS_SERVER_ERROR); | |||||
} | |||||
} | } |