package com.huimv.receive.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.huimv.receive.common.token.TokenSign;
import com.huimv.receive.common.utils.PdfUtil;
import com.huimv.receive.common.utils.Result;
import com.huimv.receive.common.utils.ResultCode;
import com.huimv.receive.common.utils.UploadImage;
import com.huimv.receive.entity.AccountGroup;
import com.huimv.receive.entity.SysAccountMultilevel;
import com.huimv.receive.service.IAccountGroupService;
import com.huimv.receive.service.ISysAccountMultilevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author astupidcoder
 * @since 2021-10-14
 */
@CrossOrigin
@RestController
@RequestMapping("/accountMultilevel")
public class SysAccountMultilevelController1 {
    @Autowired
    private ISysAccountMultilevelService accountMultilevelService;

    @Autowired
    private IAccountGroupService accountGroupService;
    @Autowired
    private UploadImage uploadImage;

    @GetMapping("/printAccount")
    public void printAccount(HttpServletResponse response, @RequestParam(name = "ids") String ids) throws Exception {
        Map<String, String> map = new HashMap<>();
        map.put("ids", ids);
        accountMultilevelService.printAccount(response, map);
        String path = "/opt/huatong/account.xls";
        PdfUtil.returnPdfStream3(response, path, "账号列表");
    }
}
