package com.sa.ibiz.demo.demoapp.controller.demo;

import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.sql.Timestamp;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Data;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import com.sa.ibiz.demo.ibizutil.domain.ActionResult;
import com.sa.ibiz.demo.demo.service.WXEntAppService;
import com.sa.ibiz.demo.ibizutil.domain.AutoCompleteItem;
import com.sa.ibiz.demo.demo.domain.WXEntApp;
import com.sa.ibiz.demo.demo.service.dto.WXEntAppSearchFilter;
import com.sa.ibiz.demo.demoapp.controller.demo.vo.*;
import org.springframework.cglib.beans.BeanGenerator;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.util.StringUtils;
import java.io.IOException;
import com.sa.ibiz.demo.ibizutil.errors.BadRequestAlertException;
import org.springframework.validation.annotation.Validated;
import org.springframework.http.ResponseEntity;
import org.springframework.beans.factory.annotation.Autowired;
import com.sa.ibiz.demo.ibizutil.domain.RedirectResult;
import javax.validation.constraints.NotBlank;
import com.sa.ibiz.demo.ibizutil.domain.AutoCompleteItem;
import java.math.BigInteger;
import com.alibaba.fastjson.JSONObject;

@RestController
@RequestMapping("/demoapp/demo/wxentapp")
public class WXEntAppController{



    @Autowired
	private WXEntAppService wxentappService;
	/**
	 * 获取服务对象
	*/
	protected WXEntAppService getService(){
		return this.wxentappService;
	}
	/**
	 * 实体界面行为
	 * @param param 参数集合
	 * @return
	 */
	@PostMapping(value="uiaction/pubmenu")
	public ResponseEntity<JSONObject>uiactionPubmenu(@RequestBody Map param) {
		String strkey="";
		JSONObject obj =new JSONObject();
		WXEntApp entity=new WXEntApp();
		String srfkeys=param.get("srfkeys").toString();
		String srfkeyArr[] =srfkeys.split(";");
		for(String srfkey : srfkeyArr){
			if(!StringUtils.isEmpty(srfkey)){
				entity.setWxentappid(srfkey);
				this.getService().get(entity);
			}
			this.getService().pubMenu(entity);
		}
		obj.put("success",true);
		obj.put("info","发布菜单成功！");
		obj.put("reloadData",false);
		return ResponseEntity.ok().body(obj);
	}
 }