package com.fjs.scenic.controller;

import javax.servlet.http.HttpServletRequest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.fjs.scenic.service.ord.OrdersService;
import com.fjs.scenic.utils.ReturnResult;

import io.swagger.annotations.ApiOperation;


@RestController
@RequestMapping("/ticket")
public class TicketController {
	
	private Logger log = LoggerFactory.getLogger(this.getClass());
	@Autowired
	private OrdersService ordersService;
	
//	@ApiOperation(value = "获取菜单", hidden = true)
//	@GetMapping("/createPaymentOrder")
//	@ResponseBody
//	public String createPaymentOrder(){
//		return otaOrderService.createPaymentOrder();
//	}
//	
//	@ApiOperation(value = "获取菜单", hidden = true)
//	@GetMapping("/getProductStock")
//	@ResponseBody
//	public String getProductStock(){
//		return otaOrderService.getProductStock();
//	}
//	@ApiOperation(value = "获取菜单", hidden = true)
//	@GetMapping("/getProduct")
//	@ResponseBody
//	public String getProduct(){
//		return otaOrderService.getProduct();
//	}
//	@ApiOperation(value = "获取菜单", hidden = true)
//	@GetMapping("/getOrder")
//	@ResponseBody
//	public String getOrder(String cytOrderNo){
//		return otaOrderService.getOrder(cytOrderNo);
//	}
//	@ApiOperation(value = "获取菜单", hidden = true)
//	@GetMapping("/refundTicket")
//	@ResponseBody
//	public String refundTicket(String cytOrderNo){
//		return otaOrderService.refundTicket(cytOrderNo);
//	}
//	@ApiOperation(value = "获取菜单", hidden = true)
//	@GetMapping("/checkorderInfo")
//	@ResponseBody
//	public ReturnResult checkorderInfo(){
//		return otaOrderService.checkorderInfo(null,null,null,null,0);
//	}
	
/*	@ApiOperation(value = "获取菜单", hidden = true)
	@GetMapping("/createOrder")
	@ResponseBody
	public ReturnResult createOrder(){
		return otaOrderService.createOrder();
	}*/
	
	/**
     * 出票通知
     * @param request
     * @return
     */
	@ApiOperation(value = "出票通知", hidden = false)
    @PostMapping("/notice")
    public Object orderMessage(HttpServletRequest request) throws Exception{
        request.setCharacterEncoding("UTF-8");
        String param = request.getParameter("requestParam");
        String method = request.getParameter("method");
        log.info("接收的参数：{}，{}", param, method);
        return ordersService.ticketNotice(param, method);
    }
	
    
//	@ApiOperation(value = "出票通知", hidden = true)
//    @PostMapping("/testPlayman/{linkManIds}")
//    public ReturnResult testPlayman(@PathVariable("linkManIds")String linkManIds){
//    	Integer dateId = 6;
//    	String parkingTime="333";
//    	if(dateId!=null && StringUtils.isNotBlank(parkingTime)){
//			log.info("2222");
//		}
//		String[] lmlds = linkManIds.split(",");
//		List<PlayMan> playMans = new ArrayList<>();
//		for (int i = 0; i < lmlds.length; i++) {
//			LinkMan linkman = linkManMapper.selectByPrimaryKey(Integer.parseInt(lmlds[i]));
//			if (linkman == null) {
//				return ReturnResult.build(500, "游玩人id不正确");
//			} else {
//				PlayMan playMan = new PlayMan();
//				playMan.setIdCard(linkman.getIdCard());
//				playMan.setName(linkman.getName());
//				playMan.setOrderId(1);
//				playMans.add(playMan);
//			}
//		}
//		return ReturnResult.ok();
//    }

}
