package com.yijia.station.controller;

import com.yijia.common.core.controller.BaseController;
import com.yijia.common.core.domain.entity.SysDept;
import com.yijia.common.core.domain.model.LoginUser;
import com.yijia.common.core.page.TableDataInfo;
import com.yijia.common.utils.SecurityUtils;
import com.yijia.station.domain.PayOrder;
import com.yijia.station.service.IPayOrderService;
import com.yijia.system.service.ISysDeptService;
import com.yijia.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;

@RestController
@RequestMapping("/station/noorder")
public class NoOilOrderController  extends BaseController {
    @Autowired
    private IPayOrderService payOrderService;
    @Autowired
    private ISysUserService sysUserService;
    @Autowired
    private ISysDeptService deptService;
    /**
     * 查询订单支付列表
     */
    @GetMapping("/list")
    public TableDataInfo list(PayOrder payOrder)
    {
        LoginUser currentUser = SecurityUtils.getLoginUser();
        SysDept dept =new SysDept();
        dept.setDeptId(currentUser.getUser().getDeptId());
        List<String> list = deptService.selectDeptId(dept);
        if(list!=null && list.size()>0){
            payOrder.setStationIdList(list);
            payOrder.setStationId(null);
        }
        startPage();
        payOrder.setStatus("1");
        List<PayOrder> payOrderlist = payOrderService.selectPayOrderList(payOrder);
        return getDataTable(payOrderlist);
    }
}
