Commit c433afe1 authored by chenhao's avatar chenhao

修改bug

parent 20cde7d7
......@@ -32,7 +32,7 @@ public class FirefightersThought extends BaseEntity {
@ApiModelProperty(value = "消防救援人员")
private Long firefightersId;
@DateTimeFormat(pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "谈话时间")
private Date talkingTime;
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.io.IOException;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.CurrentStatusDto;
import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum;
import feign.Response;
import org.apache.poi.ss.formula.functions.T;
import org.apache.commons.io.IOUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
......@@ -33,20 +22,24 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService;
import com.yeejoin.amos.boot.module.common.api.dto.CurrentStatusDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto;
import com.yeejoin.amos.boot.module.common.api.dto.FailureStatusCountDto;
import com.yeejoin.amos.boot.module.common.api.entity.FailureDetails;
import com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum;
import com.yeejoin.amos.boot.module.common.biz.constats.Constants;
import com.yeejoin.amos.boot.module.common.biz.service.impl.FailureDetailsServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import feign.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -241,31 +234,29 @@ public class FailureDetailsController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping (value = "/downloadFile/{sequenceNbr}")
@ApiOperation(httpMethod = "GET", value = "流程图高亮图片", notes = "流程图高亮图片")
public void downloadFile(@PathVariable Long sequenceNbr, HttpServletRequest request, HttpServletResponse response) throws Exception {
public ResponseEntity<String> downloadFile(@PathVariable Long sequenceNbr, HttpServletRequest request, HttpServletResponse response) throws Exception {
String processId = failureDetailsServiceImpl.queryBySeq(sequenceNbr).getProcessId();
Response feignResponse = workflowFeignService.thighLineImg(processId);
OutputStream out = null;
try {
out = response.getOutputStream();
Response.Body body = feignResponse.body();
HttpHeaders heads = new HttpHeaders();
heads.setContentType(MediaType.valueOf(MediaType.IMAGE_JPEG_VALUE));
byte[] b = new byte[1024];
int len;
while ((len = body.asInputStream().read(b, 0, 1024)) != -1) {
out.write(b, 0, len);
}
out.flush();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
} catch (Exception e) {
e.printStackTrace();
}
// response.setContentType("application/octet-stream");//
// response.setHeader("content-type", "application/octet-stream");
// response.setContentType("text/xml");//
// response.setHeader("content-type", "text/xml");
// response.setCharacterEncoding("utf-8");
// response.setHeader("Content-Disposition", "attachment;fileName=workflow.svg");
// response.reset();
// byte[] b = new byte[1024];
// int len;
// while ((len = body.asInputStream().read(b, 0, 1024)) != -1) {
// out.write(b, 0, len);
// }
// out.flush();
return new ResponseEntity<String>(IOUtils.toString(body.asInputStream()), HttpStatus.OK);
//.toByteArray(body.asInputStream()), responseHeaders, HttpStatus.OK);
} catch (Exception e) {
throw new BaseException("Error exporting diagram", "500", processId);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment