@Test public void testFindTemplateLibraryKeywordList() throws Exception { WxMaTemplateLibraryGetResult result = this.wxService.getTemplateService().findTemplateLibraryKeywordList("AT0004"); Assert.assertEquals("AT0004", result.getId()); Assert.assertEquals("交易提醒", result.getTitle()); Assert.assertEquals(100, result.getKeywordList().size()); }
@Override public WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id) throws WxErrorException { Map<String, String> params = new HashMap<>(); params.put("id", id); String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params)); WxError wxError = WxError.fromJson(responseText); if(wxError.getErrorCode() == 0){ return WxMaTemplateLibraryGetResult.fromJson(responseText); }else { throw new WxErrorException(wxError); } }
WxMaTemplateServiceImpl implements WxMaTemplateService { @Override public WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id) throws WxErrorException { Map<String, String> params = new HashMap<>(); params.put("id", id); String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params)); WxError wxError = WxError.fromJson(responseText); if(wxError.getErrorCode() == 0){ return WxMaTemplateLibraryGetResult.fromJson(responseText); }else { throw new WxErrorException(wxError); } } }
WxMaTemplateServiceImpl implements WxMaTemplateService { @Override public WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id) throws WxErrorException { Map<String, String> params = new HashMap<>(); params.put("id", id); String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params)); WxError wxError = WxError.fromJson(responseText); if(wxError.getErrorCode() == 0){ return WxMaTemplateLibraryGetResult.fromJson(responseText); }else { throw new WxErrorException(wxError); } } WxMaTemplateServiceImpl(WxMaService wxMaService); }
WxMaTemplateServiceImpl implements WxMaTemplateService { @Override public WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id) throws WxErrorException { Map<String, String> params = new HashMap<>(); params.put("id", id); String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params)); WxError wxError = WxError.fromJson(responseText); if(wxError.getErrorCode() == 0){ return WxMaTemplateLibraryGetResult.fromJson(responseText); }else { throw new WxErrorException(wxError); } } WxMaTemplateServiceImpl(WxMaService wxMaService); @Override WxMaTemplateLibraryListResult findTemplateLibraryList(int offset, int count); @Override WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id); @Override WxMaTemplateAddResult addTemplate(String id, List<Integer> keywordIdList); @Override WxMaTemplateListResult findTemplateList(int offset, int count); @Override boolean delTemplate(String templateId); }
WxMaTemplateServiceImpl implements WxMaTemplateService { @Override public WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id) throws WxErrorException { Map<String, String> params = new HashMap<>(); params.put("id", id); String responseText = this.wxMaService.post(TEMPLATE_LIBRARY_KEYWORD_URL, WxGsonBuilder.create().toJson(params)); WxError wxError = WxError.fromJson(responseText); if(wxError.getErrorCode() == 0){ return WxMaTemplateLibraryGetResult.fromJson(responseText); }else { throw new WxErrorException(wxError); } } WxMaTemplateServiceImpl(WxMaService wxMaService); @Override WxMaTemplateLibraryListResult findTemplateLibraryList(int offset, int count); @Override WxMaTemplateLibraryGetResult findTemplateLibraryKeywordList(String id); @Override WxMaTemplateAddResult addTemplate(String id, List<Integer> keywordIdList); @Override WxMaTemplateListResult findTemplateList(int offset, int count); @Override boolean delTemplate(String templateId);  }