md
This commit is contained in:
parent
bb93122480
commit
9a84987a4f
@ -14,21 +14,30 @@ package com.xdadan.erp.oms.web;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.xdadan.erp.oms.common.annotation.Log;
|
||||
import com.xdadan.erp.oms.common.core.controller.BaseController;
|
||||
import com.xdadan.erp.oms.common.core.domain.AjaxResult;
|
||||
import com.xdadan.erp.oms.common.core.redis.RedissonService;
|
||||
import com.xdadan.erp.oms.common.enums.BusinessType;
|
||||
import com.xdadan.erp.oms.common.utils.DateUtils;
|
||||
import com.xdadan.erp.oms.domain.exception.EmisBizError;
|
||||
import com.xdadan.erp.oms.domain.vo.AddressParseResult;
|
||||
import com.xdadan.erp.oms.service.*;
|
||||
import com.xdadan.erp.oms.service.svc.IApiwebSvc;
|
||||
import com.xdadan.erp.oms.service.svc.IRpcCommonSvc;
|
||||
import com.xdadan.erp.oms.service.svc.IRpcWarehouseInSvc;
|
||||
import com.xdadan.erp.oms.service.svc.IRpcWaybillSvc;
|
||||
import com.xdadan.erp.oms.utils.TraceUtils;
|
||||
import feign.Response;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
@ -37,11 +46,16 @@ import java.util.Date;
|
||||
* @author linfso
|
||||
* @date 2023-12-14 13:02:48
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/oms2c/common")
|
||||
public class Oms2cCommonController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private IRpcWarehouseInSvc iRpcWarehouseInSvc;
|
||||
|
||||
|
||||
@Autowired
|
||||
RedissonService redissonService;
|
||||
|
||||
@ -121,4 +135,42 @@ public class Oms2cCommonController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出进仓单模板
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "导出进仓单文件", businessType = BusinessType.EXPORT)
|
||||
@RequestMapping("/exportWarehouseInTpl")
|
||||
public void exportWarehouseInTpl(HttpServletResponse servletResponse, String orderSn) throws IOException {
|
||||
|
||||
Response response = this.iRpcWarehouseInSvc.exportWarehouseInTpl(orderSn);
|
||||
Response.Body body = response.body();
|
||||
log.error("====>exportWarehouseInTpl==>{}", JSON.toJSONString(response.headers()));
|
||||
// for (Object key : response.headers().keySet()) {
|
||||
// List<String> kList = (List<String>) response.headers().get(key);
|
||||
// for (String val : kList) {
|
||||
// servletResponse.setHeader(key.toString(), val);
|
||||
// }
|
||||
// }
|
||||
servletResponse.setContentType("application/octet-stream");
|
||||
servletResponse.setHeader("Content-Disposition", "attachment;fileName=" + orderSn + ".pdf");
|
||||
InputStream inputStream = null;
|
||||
OutputStream outputStream = null;
|
||||
try {
|
||||
inputStream = body.asInputStream();
|
||||
outputStream = servletResponse.getOutputStream();
|
||||
byte[] b = new byte[inputStream.available()];
|
||||
inputStream.read(b);
|
||||
outputStream.write(b);
|
||||
outputStream.flush();
|
||||
} catch (IOException e) {
|
||||
System.out.println("失败了");
|
||||
}finally {
|
||||
inputStream.close();
|
||||
outputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user