no message
This commit is contained in:
parent
60ef63dfc0
commit
2061c555e9
|
|
@ -26,7 +26,7 @@ import com.ghy.order.request.SysOrderAssignRequest;
|
|||
import com.ghy.order.request.SysOrderGoodsStandards;
|
||||
import com.ghy.order.request.TransferOrderRequest;
|
||||
import com.ghy.order.service.*;
|
||||
import com.ghy.web.controller.order.AfterServiceDisputeRequest;
|
||||
|
||||
import com.ghy.payment.domain.FinancialChangeRecord;
|
||||
import com.ghy.payment.domain.FinancialDetail;
|
||||
import com.ghy.payment.domain.FinancialMaster;
|
||||
|
|
@ -59,12 +59,25 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -77,6 +90,56 @@ import java.util.stream.Collectors;
|
|||
@RequestMapping("/order/master")
|
||||
public class OrderMasterController extends BaseController {
|
||||
|
||||
/**
|
||||
* 批量下单导入模板下载(服务端转发,避免浏览器混合内容限制)
|
||||
*/
|
||||
@GetMapping("/importTemplate")
|
||||
public void downloadBatchImportTemplate(HttpServletResponse response) throws IOException {
|
||||
String remoteUrl = "https://gqz.opsoul.com/%E6%89%B9%E9%87%8F%E4%B8%8B%E5%8D%95%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xls";
|
||||
|
||||
HttpURLConnection conn = null;
|
||||
InputStream in = null;
|
||||
ServletOutputStream out = null;
|
||||
try {
|
||||
URL url = new URL(remoteUrl);
|
||||
conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setConnectTimeout(5000);
|
||||
conn.setReadTimeout(15000);
|
||||
conn.setRequestMethod("GET");
|
||||
|
||||
int status = conn.getResponseCode();
|
||||
if (status != HttpURLConnection.HTTP_OK) {
|
||||
response.sendError(HttpServletResponse.SC_BAD_GATEWAY, "远程模板下载失败");
|
||||
return;
|
||||
}
|
||||
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
String fileName = "批量下单导入模板.xls";
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment; filename=" + URLEncoder.encode(fileName, "UTF-8"));
|
||||
|
||||
in = conn.getInputStream();
|
||||
out = response.getOutputStream();
|
||||
|
||||
byte[] buffer = new byte[8192];
|
||||
int len;
|
||||
while ((len = in.read(buffer)) != -1) {
|
||||
out.write(buffer, 0, len);
|
||||
}
|
||||
out.flush();
|
||||
} finally {
|
||||
if (in != null) {
|
||||
in.close();
|
||||
}
|
||||
if (out != null) {
|
||||
out.close();
|
||||
}
|
||||
if (conn != null) {
|
||||
conn.disconnect();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final String prefix = "order/master";
|
||||
|
||||
@Resource
|
||||
|
|
@ -672,7 +735,7 @@ public class OrderMasterController extends BaseController {
|
|||
}
|
||||
request.setPrice(new BigDecimal(orderRequest.getPrice()));
|
||||
request.setVideoUrl(orderRequest.getUrl());
|
||||
request.setImageUrl("http://gqz.opsoul.com/default.jpeg");
|
||||
request.setImageUrl("https://gqz.opsoul.com/default.jpeg");
|
||||
List<SysOrderGoodsStandards> goodsStandards = new ArrayList<>();
|
||||
String[] categoryNames = orderRequest.getCategory().split("-");
|
||||
if (categoryNames.length != 3) {
|
||||
|
|
|
|||
|
|
@ -391,7 +391,7 @@ var table = {
|
|||
importTemplate: function() {
|
||||
$.get(activeWindow().table.options.importTemplateUrl, function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
window.location.href = "http://gqz.opsoul.com/%E6%89%B9%E9%87%8F%E4%B8%8B%E5%8D%95%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.xls";
|
||||
window.location.href = ctx + "order/master/importTemplate";
|
||||
} else if (result.code == web_status.WARNING) {
|
||||
$.modal.alertWarning(result.msg)
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue