| | |
| | | package com.xiaopeng.maintenance.controller; |
| | | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.xiaopeng.api.dto.account.XpOperationsUserPositionDTO; |
| | |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.shardingsphere.transaction.annotation.ShardingSphereTransactionType; |
| | | import org.apache.shardingsphere.transaction.core.TransactionType; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.io.IOException; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | return R.ok(xpTaskService.reassignTaskPageList(query)); |
| | | } |
| | | |
| | | @ApiOperation(value = "待改派的工单导出", tags = {"管理后台-运维执行-任务工单-待改派工单"}) |
| | | @PostMapping("/api/v1/task/reassign/export") |
| | | public R<?> export(@RequestBody TaskPageListQuery query, HttpServletResponse response) { |
| | | List<XpTaskVO> list= xpTaskService.exportList(query); |
| | | Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), XpCruiseCheckInRecordVO.class, list); |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | ServletOutputStream outputStream = null; |
| | | try { |
| | | String fileName = URLEncoder.encode("巡游打卡记录.xls", "utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName); |
| | | outputStream = response.getOutputStream(); |
| | | workbook.write(outputStream); |
| | | outputStream.flush(); |
| | | } catch (IOException e) { |
| | | log.error("导出巡游打卡记录失败", e); |
| | | } finally { |
| | | try { |
| | | if (outputStream != null) { |
| | | outputStream.close(); |
| | | } |
| | | if (workbook != null) { |
| | | workbook.close(); |
| | | } |
| | | } catch (IOException e) { |
| | | log.error("关闭输出流失败", e); |
| | | } |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Resource |
| | | XpFleetClient xpFleetClient; |
| | | |