package com.sa.ibiz.demo.mob.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.WFWorkListService;
import com.sa.ibiz.demo.ibizutil.domain.AutoCompleteItem;
import com.sa.ibiz.demo.demo.domain.WFWorkList;
import com.sa.ibiz.demo.demo.service.dto.WFWorkListSearchFilter;
import com.sa.ibiz.demo.mob.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("/mob/demo/wfworklist")
public class WFWorkListController{



    @Autowired
	private WFWorkListService wfworklistService;
	/**
	 * 获取服务对象
	*/
	protected WFWorkListService getService(){
		return this.wfworklistService;
	}
	/**
	 * 重定向视图
	 * @param srfkey
	 * @return
	 */
	@GetMapping(value="wfworklistmobwfdataredirectview")
	public ResponseEntity<RedirectResult>wfworklistmobwfdataredirectviewGet(@Validated @NotBlank(message = "srfkey不允许为空") @RequestParam("srfkey")String srfkey) {
		RedirectResult redirectResult = new RedirectResult();
		return ResponseEntity.ok(redirectResult);
	}
	/**
	 * 重定向视图
	 * @param srfkey
	 * @return
	 */
	@GetMapping(value="wfworklistredirectview")
	public ResponseEntity<RedirectResult>wfworklistredirectviewGet(@Validated @NotBlank(message = "srfkey不允许为空") @RequestParam("srfkey")String srfkey) {
		RedirectResult redirectResult = new RedirectResult();
		return ResponseEntity.ok(redirectResult);
	}
	@PostMapping(value="usrmobmdctrl/searchdefault")
	public ResponseEntity<Page<WFWorkList_MOBMDCTRL_Usr>> usrMOBMDCTRLSearchDefault(@Validated @RequestBody WFWorkListSearchFilter searchFilter){
			Page<WFWorkList> searchResult = this.getService().searchDefault(searchFilter);
			Page<WFWorkList_MOBMDCTRL_Usr> searchResult_vo_data =WFWorkList_MOBMDCTRL_Usr.fromWFWorkList(searchResult);
					return ResponseEntity.ok().body(searchResult_vo_data);
	}
	/**
	 * 移动端列表删除
	 * @param
	 * @return
	 */
	@PostMapping(value="usrmobmdctrl/remove")
	public ResponseEntity<WFWorkList> usrMOBMDCTRLRemove(@Validated @RequestBody Map args){
		WFWorkList entity =new WFWorkList();
		if ( !StringUtils.isEmpty(args.get("srfkeys"))) {
			String srfkeys=args.get("srfkeys").toString();
			String srfkeyArr[] =srfkeys.split(";");
			for(String srfkey : srfkeyArr)
			{
				if(!StringUtils.isEmpty(srfkey)){
				entity.setWfworklistid(srfkey);
				this.getService().remove(entity);
				}
			}
		}
		return ResponseEntity.ok().body(entity);
	}
 }