|
@@ -3,9 +3,11 @@ package com.aoyang.tms.controller;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.aoyang.common.result.Result;
|
|
import com.aoyang.common.result.Result;
|
|
|
import com.aoyang.tms.common.ErrCodeEnum;
|
|
import com.aoyang.tms.common.ErrCodeEnum;
|
|
|
|
|
+import com.aoyang.tms.entity.WorkCycle;
|
|
|
import com.aoyang.tms.entity.WorkOrder;
|
|
import com.aoyang.tms.entity.WorkOrder;
|
|
|
import com.aoyang.tms.entity.WorkSpot;
|
|
import com.aoyang.tms.entity.WorkSpot;
|
|
|
import com.aoyang.tms.service.JxlsExportTestService;
|
|
import com.aoyang.tms.service.JxlsExportTestService;
|
|
|
|
|
+import com.aoyang.tms.service.WorkCycleService;
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -34,14 +36,20 @@ public class JxlsExportTestController {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private JxlsExportTestService jxlsExportTestService;
|
|
private JxlsExportTestService jxlsExportTestService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private WorkCycleService workCycleService;
|
|
|
|
|
|
|
|
@ApiOperation(value = "下载行车日志,导出专用")
|
|
@ApiOperation(value = "下载行车日志,导出专用")
|
|
|
@PostMapping("/download_test")
|
|
@PostMapping("/download_test")
|
|
|
public StreamingResponseBody download(HttpServletResponse response, @RequestBody WorkOrder param) {
|
|
public StreamingResponseBody download(HttpServletResponse response, @RequestBody WorkOrder param) {
|
|
|
log.info("下载行车日志,导出专用,调用/tms/jxls_export/download_test,参数:{}", JSON.toJSONString(param));
|
|
log.info("下载行车日志,导出专用,调用/tms/jxls_export/download_test,参数:{}", JSON.toJSONString(param));
|
|
|
- if (null == param) {
|
|
|
|
|
|
|
+ if (null == param || param.getCycleId() == null) {
|
|
|
log.error("download_list param is null");
|
|
log.error("download_list param is null");
|
|
|
}
|
|
}
|
|
|
|
|
+ WorkCycle workCycle = workCycleService.getById(param.getCycleId());
|
|
|
|
|
+ if (workCycle.getStatus() != 2) {
|
|
|
|
|
+ log.error("已完成周期才可以导出行车日志");
|
|
|
|
|
+ }
|
|
|
try {
|
|
try {
|
|
|
return jxlsExportTestService.download(param, response);
|
|
return jxlsExportTestService.download(param, response);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
@@ -57,6 +65,10 @@ public class JxlsExportTestController {
|
|
|
if (param == null || param.getCycleId() == null) {
|
|
if (param == null || param.getCycleId() == null) {
|
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
return new Result<>(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
}
|
|
}
|
|
|
|
|
+ WorkCycle workCycle = workCycleService.getById(param.getCycleId());
|
|
|
|
|
+ if (workCycle.getStatus() != 2) {
|
|
|
|
|
+ return new Result<>(ErrCodeEnum.CAN_NOT_EXPORT.getCode(), ErrCodeEnum.CAN_NOT_EXPORT.getMessage());
|
|
|
|
|
+ }
|
|
|
return new Result<>(jxlsExportTestService.getWorkLogTplVO(param));
|
|
return new Result<>(jxlsExportTestService.getWorkLogTplVO(param));
|
|
|
}
|
|
}
|
|
|
|
|
|