|
|
|
@ -24,6 +24,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -59,7 +60,7 @@ public class BomUploadController {
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public ResultBean uploadPl(@RequestParam("file") MultipartFile[] file ,@RequestParam("tltList") MultipartFile[] tltList , String czbh,String pl, String isupload, HttpServletRequest req) throws Exception, CustomException {
|
|
|
|
|
String date=DateUtil.date().toString("yyyyMMdd");
|
|
|
|
|
String path="/"+czbh+"_"+pl+"/"+date+"/ERP";
|
|
|
|
|
String path="/"+czbh+"/"+pl+"/ERP";
|
|
|
|
|
ResultBean bean= bomUploadService.uploadZ( file , czbh, pl,isupload, req,path);
|
|
|
|
|
Map map =(Map)bean.getData();
|
|
|
|
|
if(map.get("zt").equals("01")){
|
|
|
|
@ -76,18 +77,19 @@ public class BomUploadController {
|
|
|
|
|
@Transactional
|
|
|
|
|
public boolean uploadPDF(MultipartFile[] fileList, String dcCh,String pl,String date)throws IOException {
|
|
|
|
|
List<Dm_zhbmp> kwxxs = dm_zhbmpRepository.findByBMLB("KWXX");
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
Map<String, String> kwxxMap = kwxxs.stream().collect(Collectors.toMap(Dm_zhbmp::getBM, Dm_zhbmp::getBmsm));
|
|
|
|
|
for (MultipartFile file : fileList) {//船号_批量/日期/PDF(ERP)
|
|
|
|
|
if(file.getOriginalFilename().contains(".QG")){
|
|
|
|
|
String s = kwxxMap.get(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1).substring(4, 7));
|
|
|
|
|
String url= com.dsic.gj_erp.util.FileUtil.handlerUpload(file,"/"+dcCh+"_"+pl+"/"+date+"/QG"+"/"+s);
|
|
|
|
|
String url= com.dsic.gj_erp.util.FileUtil.handlerUpload(file,"/"+dcCh+"/"+pl+"/QG"+"/"+s);
|
|
|
|
|
|
|
|
|
|
bomMapper.insertFile(url,"");
|
|
|
|
|
}else if (file.getOriginalFilename().contains(".pdf")){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String url= com.dsic.gj_erp.util.FileUtil.handlerUpload(file,"/"+dcCh+"_"+pl+"/"+date+"/PDF");
|
|
|
|
|
String url= com.dsic.gj_erp.util.FileUtil.handlerUpload(file,"/"+dcCh+"/"+pl+"/PDF");
|
|
|
|
|
// PDDocument document = PDDocument.load(file.getInputStream());
|
|
|
|
|
// int pageNum = document.getNumberOfPages();
|
|
|
|
|
// PDFTextStripper stripper = new PDFTextStripper();
|
|
|
|
|