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.WFUCPolicyService;
import com.sa.ibiz.demo.ibizutil.domain.AutoCompleteItem;
import com.sa.ibiz.demo.demo.domain.WFUCPolicy;
import com.sa.ibiz.demo.demo.service.dto.WFUCPolicySearchFilter;
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/wfucpolicy")
public class WFUCPolicyController{



    @Autowired
	private WFUCPolicyService wfucpolicyService;
	/**
	 * 获取服务对象
	*/
	protected WFUCPolicyService getService(){
		return this.wfucpolicyService;
	}
	/**
	 * 实体界面行为
	 * @param param 参数集合
	 * @return
	 */
	@PostMapping(value="uiaction/disablepolicy")
	public ResponseEntity<JSONObject>uiactionDisablepolicy(@RequestBody Map param) {
		String strkey="";
		JSONObject obj =new JSONObject();
		WFUCPolicy entity=new WFUCPolicy();
		String srfkeys=param.get("srfkeys").toString();
		String srfkeyArr[] =srfkeys.split(";");
		for(String srfkey : srfkeyArr){
			if(!StringUtils.isEmpty(srfkey)){
				entity.setWfucpolicyid(srfkey);
				this.getService().get(entity);
			}
			this.getService().disablePolicy(entity);
		}
		obj.put("success",true);
		obj.put("info","");
		obj.put("reloadData",true);
		return ResponseEntity.ok().body(obj);
	}
	/**
	 * 实体界面行为
	 * @param param 参数集合
	 * @return
	 */
	@PostMapping(value="uiaction/enablepolicy")
	public ResponseEntity<JSONObject>uiactionEnablepolicy(@RequestBody Map param) {
		String strkey="";
		JSONObject obj =new JSONObject();
		WFUCPolicy entity=new WFUCPolicy();
		String srfkeys=param.get("srfkeys").toString();
		String srfkeyArr[] =srfkeys.split(";");
		for(String srfkey : srfkeyArr){
			if(!StringUtils.isEmpty(srfkey)){
				entity.setWfucpolicyid(srfkey);
				this.getService().get(entity);
			}
			this.getService().enablePolicy(entity);
		}
		obj.put("success",true);
		obj.put("info","");
		obj.put("reloadData",true);
		return ResponseEntity.ok().body(obj);
	}
 }