package com.hotent.portal.controller;

import com.fasterxml.jackson.databind.JsonNode;
import com.hotent.base.controller.BaseController;
import com.hotent.base.model.CommonResult;
import com.hotent.base.query.*;
import com.hotent.base.util.BeanUtils;
import com.hotent.base.util.HttpUtil;
import com.hotent.base.util.time.DateFormatUtil;
import com.hotent.portal.model.AppDingModel;
import com.hotent.portal.model.AppModel;
import com.hotent.portal.model.PortalDingTodoTask;
import com.hotent.portal.params.AppTree;
import com.hotent.portal.persistence.manager.AppDingModelManager;
import com.hotent.portal.persistence.manager.AppModelManager;
import com.hotent.portal.service.PortalDingTodoTaskService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartHttpServletRequest;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDateTime;
import java.util.Arrays;
import java.util.List;
import java.util.Map;

/**
 * @description 流程和钉钉待办id关联
 * @author  yangzibin
 * @date    2024/3/20 16:01
 * @param	null
 * @return
 */
@RestController
@RequestMapping(value="/portal/dingTodoTask/v1")
@Api(tags="PortalDingTodoTaskController")
public class PortalDingTodoTaskController extends BaseController<PortalDingTodoTaskService, PortalDingTodoTask>{
	@Resource
	PortalDingTodoTaskService portalDingTodoTaskService;

	/**
	 * 获取流程和钉钉待办id关联数据
	 * @param
	 * @throws Exception
	 * @return
	 * @exception
	 */
	@GetMapping(value="/queryEntityById")
	public List<PortalDingTodoTask> queryEntityById(@ApiParam(name="taskId",value="任务id", required = true)@RequestParam String taskId) throws Exception{
		return portalDingTodoTaskService.queryEntityById(taskId,"");
	}

	/**
	 * 保存待办id和人员绑定
	 * @param
	 * @throws Exception
	 * @return
	 * @exception
	 */
	@GetMapping(value="/saveEntity")
	public void  saveEntity(@ApiParam(name="taskId",value="任务id", required = true)@RequestParam String dingTodoTaskId,
											   @ApiParam(name="taskId",value="任务id", required = true)@RequestParam String dingtalkIds,
											   @ApiParam(name="taskId",value="任务id", required = true)@RequestParam String userDingUnionId,
											   @ApiParam(name="taskId",value="任务id", required = true)@RequestParam String taskId,
											   @ApiParam(name="taskId",value="任务id", required = true)@RequestParam String orgId
											   ) throws Exception{
		 portalDingTodoTaskService.saveEntity(dingTodoTaskId,dingtalkIds,userDingUnionId,taskId,orgId);
	}

}
