//package com.yeejoin.equipmanage.controller;
//
//import com.google.common.collect.Lists;
//import com.yeejoin.equipmanage.common.entity.EquipmentPoint;
//import com.yeejoin.equipmanage.common.entity.publics.CommonResponse;
//import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
//import com.yeejoin.equipmanage.common.utils.FileHelper;
//import com.yeejoin.equipmanage.remote.ReginParams;
//import com.yeejoin.equipmanage.service.IExcelService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.annotations.ApiParam;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.*;
//import org.springframework.web.multipart.MultipartFile;
//
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//import java.util.Map;
//import java.util.UUID;
//
//@RestController
//@RequestMapping(value = "/api/excel")
//@Api(tags = "导入导出excel")
//public class ExcelController extends BaseController {
//
//    private final Logger logger = LoggerFactory.getLogger(ExcelController.class);
//
//    @Autowired
//    private IExcelService iExcelService;
//
//    @TycloudOperation(ApiLevel = UserType.AGENCY)
//    @PostMapping(value = "/import/fireEquipment")
//    public CommonResponse importFireEquipment(@RequestPart("file") MultipartFile file) {
//        String fileName = file.getOriginalFilename();
////        if (fileName.endsWith(".xls") || fileName.endsWith(".xlsx")) {
////            try {
////                List<FireEquipmentParam> list = FileHelper.importExcel(file, 1, 1, FireEquipmentParam.class);
////                iExcelService.importFireEquipment(list);
////                return CommonResponseUtil.success();
////            } catch (Exception e) {
////                logger.info("导入消防装备数据异常", e);
////                return CommonResponseUtil.failure("导入失败");
////            }
////        } else {
////            return CommonResponseUtil.failure("文件格式错误");
////        }
//        return null;
//    }
//
//    @TycloudOperation(ApiLevel = UserType.AGENCY)
//    @PostMapping(value = "/export")
//    //@Authorization(ingore = true)
//    public void export(HttpServletResponse response,
//                       @ApiParam(value = "data：导出数据；model：导出模板", required = true) @RequestParam String exportType,
//                       @ApiParam(value = "point：监测点；equipment：设备", required = true) @RequestParam String modelName,
//                       @ApiParam(value = "查询条件") @RequestBody(required = false) Map<String, Object> paramsMap) {
//
//        System.out.println("a");
//    	String orgCode = getOrgCode();
//    	paramsMap.put("compCode", orgCode);
//
//        String fileName = UUID.randomUUID().toString() + ".xls";
//        String title = "监测点";
//        Class cls = null;
//        if ("point".equals(modelName)) {
//            title = "消防点位";
//            cls = EquipmentPoint.class;
//        }
//        if (cls != null) {
//            List<?> list = Lists.newArrayList();
//            if ("data".equals(exportType)) {
//                list = iExcelService.exportPointData(paramsMap);
//            }
//            FileHelper.exportExcel(list, title, title, cls, fileName, response);
//        }
//    }
//}
