|
@@ -38,6 +38,7 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.*;
|
|
import org.apache.poi.xssf.usermodel.*;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
@@ -143,7 +144,7 @@ public class ComListLogic {
|
|
|
|
|
|
//上传主文件到oss,并记录
|
|
//上传主文件到oss,并记录
|
|
//CommonFile commonFile = commonLogic.uploadFile(file);
|
|
//CommonFile commonFile = commonLogic.uploadFile(file);
|
|
-
|
|
|
|
|
|
+/*
|
|
InputStream inputStream = commonLogic.getFileInputStreamByUrl(file);
|
|
InputStream inputStream = commonLogic.getFileInputStreamByUrl(file);
|
|
List<Object> objects = ExcelUtils.importExcel(inputStream);
|
|
List<Object> objects = ExcelUtils.importExcel(inputStream);
|
|
//拆分excel并上传oss
|
|
//拆分excel并上传oss
|
|
@@ -172,7 +173,7 @@ public class ComListLogic {
|
|
comDetails.add(comDetail);
|
|
comDetails.add(comDetail);
|
|
//}
|
|
//}
|
|
}
|
|
}
|
|
- comDetailService.saveBatch(comDetails);
|
|
|
|
|
|
+ comDetailService.saveBatch(comDetails);*/
|
|
}
|
|
}
|
|
|
|
|
|
public void download(String id, String downloadPwd, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
public void download(String id, String downloadPwd, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
@@ -588,4 +589,49 @@ public class ComListLogic {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void upFile() {
|
|
|
|
+ List<ComList> comListList = comListService.lambdaQuery()
|
|
|
|
+ .eq(ComList::getType, "CENTER")
|
|
|
|
+ .eq(ComList::getCenterUp, 0).list();
|
|
|
|
+
|
|
|
|
+ if (!CollectionUtil.isEmpty(comListList)){
|
|
|
|
+ for (ComList comList : comListList) {
|
|
|
|
+ List<ComDetail> list = comDetailService.lambdaQuery()
|
|
|
|
+ .eq(ComDetail::getComListId, comList.getId()).list();
|
|
|
|
+ ComDetail comDetail1 = list.get(0);
|
|
|
|
+
|
|
|
|
+ InputStream inputStream = commonLogic.getFileInputStreamByUrl(comDetail1.getFileUrl());
|
|
|
|
+ List<Object> objects = ExcelUtils.importExcel(inputStream);
|
|
|
|
+ //拆分excel并上传oss
|
|
|
|
+ List<Map<String, Object>> fileUrls = this.createExcel(objects);
|
|
|
|
+ if (fileUrls == null) {
|
|
|
|
+ throw new RemoteServiceException("拆分失败");
|
|
|
|
+ }
|
|
|
|
+ List<ComDetail> comDetails = new ArrayList<>();
|
|
|
|
+ for (Map<String, Object> fileUrl : fileUrls) {
|
|
|
|
+ String websitNumber = (String) fileUrl.get("websitNumber");
|
|
|
|
+ String filePath = (String) fileUrl.get("filePath");
|
|
|
|
+ //新增拆分的附件明细表
|
|
|
|
+ //for(Belongcompany belongcompany : list) {
|
|
|
|
+ ComDetail comDetail = new ComDetail();
|
|
|
|
+ comDetail.setCompanyWechatId(comDetail1.getCompanyWechatId());
|
|
|
|
+ comDetail.setCompanyName(comDetail1.getCompanyName());
|
|
|
|
+ comDetail.setTitle(comDetail1.getTitle());
|
|
|
|
+ comDetail.setComListId(comDetail1.getComListId());
|
|
|
|
+ comDetail.setFileName(comDetail1.getTitle());
|
|
|
|
+ comDetail.setWebsitId(websitNumber);
|
|
|
|
+ comDetail.setFileUrl(filePath);
|
|
|
|
+ comDetail.setIsDownload(false);
|
|
|
|
+ comDetail.setCreateTime(new Date());
|
|
|
|
+ comDetail.setIsNotice(comList.getIsNotice());
|
|
|
|
+ //comDetail.insert();
|
|
|
|
+ comDetails.add(comDetail);
|
|
|
|
+ //}
|
|
|
|
+ }
|
|
|
|
+ comDetailService.saveBatch(comDetails);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|