package com.bohuikeji.delivery.backstage.controller.views;

import com.bohuikeji.delivery.backstage.service.ITLocationService;
import com.bohuikeji.frame.module.admin.base.PageTemplateControllerBase;
import com.bohuikeji.frame.module.admin.entity.back.PageEntity;
import com.bohuikeji.frame.module.admin.entity.web.block.ButtonBlock;
import com.bohuikeji.frame.module.admin.entity.web.template.TableTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.ArrayList;
import java.util.List;

/**
 * 系统页面控制器
 * @author 10552
 */
@Slf4j
@Controller
@RequestMapping("/views")
public class SystemPage extends PageTemplateControllerBase {

    @Autowired
    ITLocationService locationService;
    /**
     * 派送员管理——待审核
     *
     * @return
     */
    @GetMapping("/table/sys/log")
    public PageEntity toCourierCheck() {
        TableTemplate pageTemplate = (TableTemplate) createPage(TableTemplate.class);
        List<ButtonBlock> buts = new ArrayList<>(0);
        pageTemplate.setBatchButton(buts);
        session.setAttribute("pageTemplate", pageTemplate);
        return PageEntity.page("/table/index");
    }

    @GetMapping("/map/gaode/line")
    public PageEntity gaoDeLine(Integer courierId) {
        return PageEntity.page("/page/map/gaode_line").add("courierArray",locationService.getLocationArray(courierId).toJSONString());
    }
}
