package com.xinelu.manage.controller.signpatientmanageroutenode;

import com.aliyuncs.exceptions.ClientException;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.common.core.domain.R;
import com.xinelu.manage.dto.signpatientmanageroutenode.TaskStatusDto;
import com.xinelu.manage.dto.signpatientmanageroutenode.UploadRobotPublishTaskDto;
import com.xinelu.manage.service.signpatientmanageroutenode.IRobotPublishService;
import io.swagger.annotations.Api;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 爱医声接口对接控制器
 * @author: haown
 * @create: 2024-08-16 10:48
 **/

@Api(tags = "签约患者管理任务路径节点控制器")
@RestController
@RequestMapping("/api")
public class RobotPublishController {
	@Resource
	private IRobotPublishService robotPublishService;

	/**
	 * 上传任务
	 * @param body
	 * @return
	 */
	@PostMapping("/uploadRobotPublishTask")
	public R<String> uploadRobotPublishTask(@RequestBody(required = false) UploadRobotPublishTaskDto body) {
		robotPublishService.uploadRobotPublishTask(body);
		return R.ok();
	}

	@PostMapping("/push_robot_publish_task_status")
	public AjaxResult push_robot_publish_task_status(@RequestBody(required = false) TaskStatusDto body) throws ClientException {
		// TaskStatusDto(id=TK1824283980640428032IK4, yw_task_id=16, task_status=3)
		robotPublishService.updateTaskStatus(body);
		AjaxResult ajax = AjaxResult.success();
		ajax.put("code", body);
		ajax.put("msg", "xxxx");
		System.out.println(body.toString());
		return ajax;
	}

}
