package com.neusoft.smart.pos.gateway.controller;


import com.neusoft.smart.pos.dto.trade.request.GetMemberOrdersRequest;
import com.neusoft.smart.pos.dto.trade.response.GetMemberOrdersResponse;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import com.neusoft.smart.pos.gateway.service.MchOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.val;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "商户订单管理使用rest接口", description = "商户订单管理使用rest接口")
@RestController
@RequestMapping(path = "/unionService/mchOrder")
@Validated
public class MchOrderController {

	@Autowired
	private MchOrderService mchOrderService;
	
	@ApiOperation(value = "食堂员工订单信息列表查询接口", notes = "食堂员工订单信息列表查询接口")
	@GetMapping("/memberOrders")
	public ResponseData<GetMemberOrdersResponse> queryMemberOrders(
			@RequestParam(value="mcode",defaultValue = "") String mcode
			, @RequestParam(value="sign",defaultValue = "") String sign
			, @RequestParam(value="memberCardNo",defaultValue = "") String memberCardNo
			, @RequestParam(value="orderType",defaultValue = "") String orderType
			, @RequestParam(value="startTime",defaultValue = "") String startTime
			, @RequestParam(value="endTime",defaultValue = "") String endTime
			, @RequestParam(value="offset",defaultValue = "") Integer offset
			, @RequestParam(value="limit",defaultValue = "") Integer limit
			, @RequestParam(value="isPage",defaultValue = "") Boolean isPage) {
		val memberOrdersRequest = new GetMemberOrdersRequest();
		memberOrdersRequest.setMcode(mcode);
		memberOrdersRequest.setSign(sign);
		memberOrdersRequest.setMemberCardNo(memberCardNo);
		memberOrdersRequest.setOrderType(orderType);
		memberOrdersRequest.setStartTime(startTime);
		memberOrdersRequest.setEndTime(endTime);
		memberOrdersRequest.setOffset(offset);
		memberOrdersRequest.setLimit(limit);
		memberOrdersRequest.setIsPage(isPage);
		return new ResponseData<>(mchOrderService.queryMemberOrders(memberOrdersRequest));
	}
}
	