feat:拆分导入、企标稽查计划导入解密
This commit is contained in:
+4
-2
@@ -11,6 +11,7 @@ import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.BeanCopyUtils;
|
||||
import com.jero.common.util.ImportExcelUtil;
|
||||
import com.jero.common.util.IntekeyUtils;
|
||||
import com.jero.modules.activiti.process.esinspectplan.common.EsInspectPlanCommon;
|
||||
import com.jero.modules.activiti.process.esinspectplan.entity.ProcessEsInspectPlan;
|
||||
import com.jero.modules.activiti.process.esinspectplan.entity.ProcessEsInspectPlanOpinion;
|
||||
@@ -215,7 +216,8 @@ public class ProcessEsInspectPlanServiceImpl extends ServiceImpl<ProcessEsInspec
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
// 解密excel
|
||||
MultipartFile file = IntekeyUtils.autoDecryptFile(entity.getValue());
|
||||
ImportParams params = new ImportParams();
|
||||
params.setNeedSave(true);
|
||||
params.setHeadRows(1);
|
||||
@@ -286,7 +288,7 @@ public class ProcessEsInspectPlanServiceImpl extends ServiceImpl<ProcessEsInspec
|
||||
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
|
||||
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
|
||||
// 获取上传文件对象
|
||||
MultipartFile file = entity.getValue();
|
||||
MultipartFile file = IntekeyUtils.autoDecryptFile(entity.getValue());
|
||||
ImportParams params = new ImportParams();
|
||||
params.setNeedSave(true);
|
||||
params.setHeadRows(1);
|
||||
|
||||
+39
-2
@@ -155,6 +155,32 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
@Value(value = "${jero.path.uploadCos}")
|
||||
private String uploadCospath;
|
||||
|
||||
public static boolean ENCRYPT_ENABLE;
|
||||
public static String DECRYPT_URL;
|
||||
public static String DECRYPT_APP_CODE;
|
||||
public static String DECRYPT_SECRET_KEY;
|
||||
|
||||
@Value("${download.enable}")
|
||||
public void setEnable(boolean enable) {
|
||||
ENCRYPT_ENABLE = enable;
|
||||
}
|
||||
|
||||
@Value("${download.decrypt.url}")
|
||||
public void setDecryptUrl(String decryptUrl) {
|
||||
DECRYPT_URL = decryptUrl;
|
||||
}
|
||||
|
||||
@Value("${download.decrypt.app_code}")
|
||||
public void setDecryptAppCode(String decryptAppCode) {
|
||||
DECRYPT_APP_CODE = decryptAppCode;
|
||||
}
|
||||
|
||||
@Value("${download.decrypt.secret_key}")
|
||||
public void setDecryptSecretKey(String decryptSecretKey) {
|
||||
DECRYPT_SECRET_KEY = decryptSecretKey;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int addItemContent(Map<String, Object> parameter){
|
||||
List<SarFileSplitItemsValEO> itemValEOList = (List<SarFileSplitItemsValEO>) parameter.get("itemValEOList");
|
||||
@@ -1596,9 +1622,20 @@ public class FileSplitItemsEOServiceImpl extends ServiceImpl<FileSplitItemsEOMap
|
||||
//excel读取到的数据
|
||||
List<Map<String, Object>> datas = result;
|
||||
if(datas!=null &&!datas.isEmpty()){
|
||||
try {
|
||||
// 将excel文件解密
|
||||
InputStream inputStream = null;
|
||||
if (ENCRYPT_ENABLE) {
|
||||
inputStream = IntekeyUtils.decryptFile(DECRYPT_URL, DECRYPT_APP_CODE, DECRYPT_SECRET_KEY, null,
|
||||
new MockMultipartFile(
|
||||
excelfile.getName(),
|
||||
excelfile.getName(),
|
||||
(String) null,
|
||||
Files.newInputStream(excelfile.toPath())));
|
||||
} else {
|
||||
inputStream = Files.newInputStream(excelfile.toPath());
|
||||
}
|
||||
try (XSSFWorkbook workbook=new XSSFWorkbook(inputStream)){
|
||||
//获取全部sheet页中表格
|
||||
XSSFWorkbook workbook=new XSSFWorkbook(new FileInputStream(excelfile));
|
||||
XSSFSheet sheet=null;
|
||||
List<SplitTableInfo> getSheetTableList = new ArrayList();
|
||||
for (int i = 1; i < workbook.getNumberOfSheets(); i++) {//获取每个Sheet表
|
||||
|
||||
Reference in New Issue
Block a user