Commit 1d3a64da authored by youjj's avatar youjj

股权信息添加图片

parent 654ba2a0
......@@ -24,11 +24,16 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
......@@ -213,4 +218,14 @@ public class BranchCompanyStockService {
FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
return RestResponse.suc(realFileRelPath);
}
public ResponseEntity<byte[]> downloadCompanyPic(String realFileRelPath) throws IOException {
String filePath = baseUploadPath + realFileRelPath;
File file = new File(filePath);//新建一个文件
HttpHeaders headers = new HttpHeaders();//http头信息
String downloadFileName = new String(file.getName());//设置编码
headers.setContentDispositionFormData("attachment", downloadFileName);
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file),headers, HttpStatus.CREATED);
}
}
......@@ -38,6 +38,6 @@ public class BranchCompanyStockInfo {
private Integer addrCity;
private Integer state;
private Integer companyPic;
private String companyPic;
}
\ No newline at end of file
......@@ -10,6 +10,7 @@ import com.xinxincaravan.caravan.vehicle.vo.BranchCompanyStockApplyVo;
import com.xinxincaravan.caravan.vehicle.vo.BranchCompanyStockInfoVo;
import com.xinxincaravan.caravan.vehicle.vo.BranchCompanyStockSearchVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
......@@ -111,6 +112,12 @@ public class BranchCompanyStockController {
return branchCompanyStockService.uploadCompanyPic(file);
}
@IgnoreUserToken
@RequestMapping(value="/download/companyPic",method=RequestMethod.GET)
public ResponseEntity<byte[]> downloadDrivingLicense(@RequestParam("realFileRelPath") String realFileRelPath) throws Exception {
return branchCompanyStockService.downloadCompanyPic(realFileRelPath);
}
/**
* 申请购买
* @param applyVo
......
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