|
@@ -9,17 +9,21 @@ import com.steerinfo.dil.feign.TmsFeign;
|
|
|
import com.steerinfo.dil.mapper.UniversalMapper;
|
|
import com.steerinfo.dil.mapper.UniversalMapper;
|
|
|
import com.steerinfo.dil.util.BaseRESTfulController;
|
|
import com.steerinfo.dil.util.BaseRESTfulController;
|
|
|
import com.steerinfo.dil.util.ExcelToolUtils;
|
|
import com.steerinfo.dil.util.ExcelToolUtils;
|
|
|
|
|
+import com.steerinfo.dil.util.Util;
|
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
import com.steerinfo.framework.controller.RESTfulResult;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import oracle.jdbc.proxy.annotation.Post;
|
|
import oracle.jdbc.proxy.annotation.Post;
|
|
|
|
|
+import org.apache.commons.io.FilenameUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
import java.io.FileInputStream;
|
|
|
|
|
+import java.io.FileOutputStream;
|
|
|
|
|
+import java.io.OutputStreamWriter;
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
|
import java.text.DateFormat;
|
|
import java.text.DateFormat;
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
@@ -964,12 +968,31 @@ public class TMSController extends BaseRESTfulController {
|
|
|
String userName,
|
|
String userName,
|
|
|
String resultType) throws Exception {
|
|
String resultType) throws Exception {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
+ if (file.isEmpty()) {
|
|
|
|
|
+ return new HashMap<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ // 获取源文件名称
|
|
|
|
|
+ String originalFilename = file.getOriginalFilename();
|
|
|
|
|
+ // 获取源文件后缀名
|
|
|
|
|
+ String extension = "." + FilenameUtils.getExtension(originalFilename);
|
|
|
|
|
+ // 定义新路径
|
|
|
|
|
+ String newPath = "/data/file/result/";
|
|
|
|
|
+ String newName = userName + "-" + originalFilename+ Util.RandomCreate(8) + ".xlsx";
|
|
|
|
|
+ File dataFile = new File(newPath);
|
|
|
|
|
+ if (!dataFile.exists()) {
|
|
|
|
|
+ dataFile.mkdirs();
|
|
|
|
|
+ }
|
|
|
|
|
+ FileOutputStream fileOutputStream = new FileOutputStream(newPath + newName);
|
|
|
|
|
+ fileOutputStream.write(file.getBytes());
|
|
|
|
|
+ fileOutputStream.flush();
|
|
|
|
|
+ fileOutputStream.close();
|
|
|
//获取Excel中包含的对象数组
|
|
//获取Excel中包含的对象数组
|
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
List<Map<String, Object>> list = ExcelToolUtils.getExcelList(file, 0);
|
|
|
map.put("list", list);
|
|
map.put("list", list);
|
|
|
map.put("userId", userId);
|
|
map.put("userId", userId);
|
|
|
map.put("userName", userName);
|
|
map.put("userName", userName);
|
|
|
map.put("resultType", resultType);
|
|
map.put("resultType", resultType);
|
|
|
|
|
+ map.put("filePath",newPath + newName);
|
|
|
return tmsFeign.importComprehensiveResult(map);
|
|
return tmsFeign.importComprehensiveResult(map);
|
|
|
}
|
|
}
|
|
|
@ApiOperation(value = "火运大宗销售订单 删除销售运输订单")
|
|
@ApiOperation(value = "火运大宗销售订单 删除销售运输订单")
|