com.alipay.api.response.AlipayMobilePublicMenuUpdateResponse Java Examples

The following examples show how to use com.alipay.api.response.AlipayMobilePublicMenuUpdateResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JwMenuAPI.java    From jeewx-api with Apache License 2.0 5 votes vote down vote up
/**
 * 更新菜单方法
 * 
 * @param appAuthToken
 * @param bizContent
 * @return
 * @throws AlipayApiException
 */
public static AlipayMobilePublicMenuUpdateResponse menuUpdate(String appAuthToken, BizContent model,AlipayConfig config) throws AlipayApiException {
	AlipayMobilePublicMenuUpdateRequest request = new AlipayMobilePublicMenuUpdateRequest();
	request.putOtherTextParam("app_auth_token", appAuthToken);
	String json = JSONObject.toJSONString(model);
	//update-begin-author:zhangjiaqiang Date:20161011 for:TASK #1422 【支付窗】3. 菜单同步,没有二级菜单,同步不成功
	json = json.replace(",\"subButton\":[]", "");
	//update-end-author:zhangjiaqiang Date:20161011 for:TASK #1422 【支付窗】3. 菜单同步,没有二级菜单,同步不成功
	request.setBizContent(json);
	return AlipayClientFactory.getAlipayClientInstance(config).execute(request);
}
 
Example #2
Source File: AlipayMobilePublicMenuUpdateRequest.java    From alipay-sdk-java-all with Apache License 2.0 4 votes vote down vote up
public Class<AlipayMobilePublicMenuUpdateResponse> getResponseClass() {
	return AlipayMobilePublicMenuUpdateResponse.class;
}
 
Example #3
Source File: AlipayMobilePublicMenuUpdateRequest.java    From alipay-sdk with Apache License 2.0 4 votes vote down vote up
public Class<AlipayMobilePublicMenuUpdateResponse> getResponseClass() {
	return AlipayMobilePublicMenuUpdateResponse.class;
}
 
Example #4
Source File: AlipayMobilePublicMenuUpdateRequest.java    From pay with Apache License 2.0 4 votes vote down vote up
public Class<AlipayMobilePublicMenuUpdateResponse> getResponseClass() {
	return AlipayMobilePublicMenuUpdateResponse.class;
}
 
Example #5
Source File: AlipayMenuController.java    From jeewx with Apache License 2.0 4 votes vote down vote up
/**
 * 同步菜单
 * @return
 */
@RequestMapping(params="doSynch",method = RequestMethod.GET)
@ResponseBody
public AjaxJson doSynch(@ModelAttribute AlipayMenu query){
		AjaxJson j = new AjaxJson();
		try {
			AlipayConfig config = alipayAccountService.getAlipayConfig();
			if(config == null){
				j.setMsg("请先添加支付窗账号");
				j.setSuccess(false);
				return j;
			}
		 		//微信菜单
		 		//获取第一级菜单
		 		List<AlipayMenu> mainMenulist =  alipayMenuDao.getAllFirstMenu(SystemUtil.getOnlieAlipayAccountId());
		 		BizContent biz = new BizContent();
		 		if(mainMenulist!=null && mainMenulist.size()!=0){
		 			//存储一级菜单
		 			List<Button> mainList = new ArrayList<Button>();
		 			//遍历一级菜单,存储到VO中
		 			for(AlipayMenu po:mainMenulist){
		 				if(po.getMenuName().length()>4){
		 			    	j.setSuccess(false);
		 			    	j.setMsg("同步失败,一级菜单标题长度不能大于4!");
		 			    	return j;
		 			    }
		 				Button mainbutton = new Button();
		 				mainbutton.setName(po.getMenuName());
		 				if("link".equals(po.getMenuType())){
		 					 mainbutton.setActionType("link");
					    	 mainbutton.setActionParam(po.getUrl());
					     }else{
					    	 mainbutton.setActionType("out");
			 				mainbutton.setActionParam(po.getMenuKey());
					     }
					    //获取二级菜单
					    List<SubButton> subList = new ArrayList<SubButton>();
					    //通过父ID获取子菜单列表
					    List<AlipayMenu> subMenulist = alipayMenuDao.getAllMenuByParentid(po.getId());
					    //遍历子菜单
					    for(AlipayMenu sub:subMenulist){
					    	if(sub.getMenuName().length()>12){
			 			    	j.setSuccess(false);
			 			    	j.setMsg("同步失败,二级菜单标题长度不能大于12!");
			 			    	return j;
			 			    }
					    	SubButton btn = new SubButton();
						     btn.setName(sub.getMenuName());  
						     btn.setActionType(sub.getMenuType());
						     if("link".equals(sub.getMenuType())){
						    	 btn.setActionType("link");
						    	 btn.setActionParam(sub.getUrl());
						     }else{
						    	 btn.setActionType("out");
						    	 btn.setActionParam(sub.getMenuKey());
						     }
						     subList.add(btn);
					    }
					    mainbutton.setSubButton(subList.toArray(new SubButton[subList.size()]));
					    mainList.add(mainbutton);
		 			}
		 			biz.setButton(mainList);
		 		}
		 		System.out.println("同步菜单发送文本:"+JSONObject.toJSONString(biz));
		 		//加载本项目帐号配置
		 		//update-begin--author:zhangjiaqiang Date:20161108 for:#1487 【开源项目】开源支付窗服务窗单公众号项目
		 		//执行,返回响应
		 		AlipayMobilePublicMenuUpdateResponse response = JwMenuAPI.menuUpdate(null, biz,config);
		 		//update-end--author:zhangjiaqiang Date:20161108 for:#1487 【开源项目】开源支付窗服务窗单公众号项目
		 		System.out.println("同步菜单:"+response.getBody());
		 		if("200".equals(response.getCode())){
		 			j.setMsg("同步菜单成功!");
		 		}else{
		 			j.setMsg("错误代码:"+response.getCode()+","+response.getMsg());
		 		}
		} catch (Exception e) {
			e.printStackTrace();
		    log.info(e.getMessage());
			j.setSuccess(false);
			j.setMsg("同步菜单失败");
		}
		return j;
}