|
@@ -9,9 +9,11 @@ import org.springblade.archive.mapper.ArchivesAutoMapper;
|
|
|
import org.springblade.archive.service.IArchiveOfflineVersionInfoService;
|
|
|
import org.springblade.archive.utils.FileUtils;
|
|
|
import org.springblade.business.entity.ArchiveFile;
|
|
|
+import org.springblade.business.entity.MetadataClassification;
|
|
|
import org.springblade.business.feign.ArchiveFileClient;
|
|
|
import org.springblade.common.utils.CommonUtil;
|
|
|
import org.springblade.common.utils.SnowFlakeUtil;
|
|
|
+import org.springblade.core.log.exception.ServiceException;
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl;
|
|
|
import org.springblade.core.oss.model.BladeFile;
|
|
|
import org.springblade.core.tool.utils.ResourceUtil;
|
|
@@ -21,10 +23,9 @@ import org.springblade.manager.feign.ArchiveTreeContractClient;
|
|
|
import org.springblade.resource.feign.NewIOSSClient;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.InputStream;
|
|
|
+import java.io.*;
|
|
|
import java.sql.Connection;
|
|
|
import java.sql.PreparedStatement;
|
|
|
import java.sql.Statement;
|
|
@@ -32,8 +33,12 @@ import java.text.SimpleDateFormat;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.zip.ZipOutputStream;
|
|
|
+
|
|
|
+import static org.springblade.common.utils.CommonUtil.isDirectory;
|
|
|
|
|
|
/**
|
|
|
* @Param
|
|
@@ -54,11 +59,16 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
@Override
|
|
|
@Async
|
|
|
public void packData(Long projectId) throws Exception {
|
|
|
+ ArchiveOfflineVersionInfo info = new ArchiveOfflineVersionInfo();
|
|
|
+ info.setId(SnowFlakeUtil.getId());
|
|
|
+ info.setProjectId(projectId);
|
|
|
+ info.setUploadDate(LocalDateTime.now());
|
|
|
+ infoMapper.insert(info);
|
|
|
// String localUrl = "/www/wwwroot/localClient/local_archives/alilib";
|
|
|
// String packUrl = "/www/wwwroot/localClient";
|
|
|
// String zipUrl = "/www/wwwroot/localClient.zip";
|
|
|
String localUrl = "/www/wwwroot/Users/hongchuangyanfa/Desktop/localArchive/localClient/local_archives/alilib";
|
|
|
- String packUrl = "/www/wwwroot/Users/hongchuangyanfa/Desktop/localArchive/localClient";
|
|
|
+ String packUrl = "/www/wwwroot/Users/hongchuangyanfa/Desktop/localArchive";
|
|
|
String zipUrl = "/www/wwwroot/Users/hongchuangyanfa/Desktop/localArchive/"+projectId;
|
|
|
//清空url的文件夹
|
|
|
CommonUtil.deleteDir(localUrl);
|
|
@@ -74,23 +84,89 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
//导入元数据
|
|
|
this.metadataToSqlite(projectId);
|
|
|
System.out.println("导入元数据");
|
|
|
+ //导入元数据通用字段
|
|
|
+ this.metadataFieldToSqlite();
|
|
|
+ System.out.println("导入元数据通用字段");
|
|
|
//打包文件
|
|
|
- CommonUtil.packageZip(packUrl,zipUrl);
|
|
|
- System.out.println("打包文件");
|
|
|
+// CommonUtil.packageZip(packUrl,zipUrl);
|
|
|
+ this.packageZip2(zipUrl,packUrl);
|
|
|
+ System.out.println("打包文件完成");
|
|
|
//上传文件
|
|
|
// File zipFile = ResourceUtil.getFile(zipUrl);
|
|
|
//BladeFile bladeFile = ossBuilder.template().putFile("localClient.zip",new FileInputStream(zipFile));
|
|
|
// BladeFile bladeFile = newIOSSClient.uploadFile("localClient.zip", zipUrl);
|
|
|
- ArchiveOfflineVersionInfo info = new ArchiveOfflineVersionInfo();
|
|
|
- info.setId(SnowFlakeUtil.getId());
|
|
|
info.setFileUrl("http://fileinfo.hczcxx.cn/localArchive/"+projectId+"/localArchive.zip");
|
|
|
info.setFileName("localArchive.zip");
|
|
|
info.setUploadDate(LocalDateTime.now());
|
|
|
- info.setProjectId(projectId);
|
|
|
File file = new File(zipUrl+"/localArchive.zip");
|
|
|
info.setFileSize(file.length()+"");
|
|
|
- infoMapper.insert(info);
|
|
|
+ baseMapper.updateById2(info);
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 压缩指定路径下的文件夹-直接执行linux命令,多线程,速度快几十倍
|
|
|
+ *
|
|
|
+ * @param
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public static void packageZip2(String zipUrl,String packUrl) throws Exception {
|
|
|
+ // 要被压缩的文件夹
|
|
|
+ File folder = new File(zipUrl);
|
|
|
+ if (!folder.exists() && !folder.isDirectory()) {
|
|
|
+ folder.mkdirs();
|
|
|
+ }
|
|
|
+ // 执行脚本文件
|
|
|
+ // 多条命令执行
|
|
|
+ String[] cmds = {"/bin/sh", "-c", "cd "+packUrl+" && zip -q -r "+zipUrl+"/localArchive.zip localClient"};
|
|
|
+ System.out.println("开始执行命令:" + Arrays.toString(cmds));
|
|
|
+ //主要在这步写入后调用命令
|
|
|
+ Process process = Runtime.getRuntime().exec(cmds);
|
|
|
+ process.waitFor();
|
|
|
+ }
|
|
|
+
|
|
|
+ public void metadataFieldToSqlite() {
|
|
|
+ List<MetadataClassification> list = baseMapper.getProjectAllMetadataField();
|
|
|
+ if (list != null && list.size() > 0){
|
|
|
+ try {
|
|
|
+ Connection conn = data.dataSource().getConnection();
|
|
|
+ Statement statement = conn.createStatement();
|
|
|
+ statement.execute("DELETE FROM u_metadata_classification");
|
|
|
+ statement.close();
|
|
|
+ //获取执行对象
|
|
|
+ String sql = "INSERT INTO u_metadata_classification(id, container_name, field_type, code, container_type,capture_mode,mandatory_type,file_storage_type,container_init_tab_name,field_key,is_type)" +
|
|
|
+ "VALUES(?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
+ PreparedStatement pstm = conn.prepareStatement(sql);
|
|
|
+ //pstm 绑定数据
|
|
|
+ int i = 0;
|
|
|
+ for (MetadataClassification m : list) {
|
|
|
+ i++;
|
|
|
+ pstm.setLong(1, m.getId());
|
|
|
+ pstm.setString(2, m.getContainerName());
|
|
|
+ pstm.setString(3, m.getFieldType());
|
|
|
+ pstm.setString(4, m.getCode());
|
|
|
+ pstm.setLong(5, m.getContainerType());
|
|
|
+ pstm.setLong(6, m.getCaptureMode());
|
|
|
+ pstm.setLong(7, m.getMandatoryType());
|
|
|
+ pstm.setString(8, m.getFileStorageType());
|
|
|
+ pstm.setString(9, m.getContainerInitTabName());
|
|
|
+ pstm.setString(10, m.getFieldKey());
|
|
|
+ pstm.setLong(11, m.getIsType());
|
|
|
+ //添加批处理
|
|
|
+ pstm.addBatch();
|
|
|
+ if (i % 1000 == 0) {
|
|
|
+ pstm.executeBatch();
|
|
|
+ pstm.clearBatch();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //将批处理余下的语句执行完毕
|
|
|
+ pstm.executeBatch();
|
|
|
+ //释放资源
|
|
|
+ pstm.close();
|
|
|
+ conn.close();
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public void metadataToSqlite(Long projectId) {
|
|
@@ -102,8 +178,11 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
statement.execute("DELETE FROM u_metadata_file");
|
|
|
statement.close();
|
|
|
//获取执行对象
|
|
|
- String sql = "INSERT INTO u_metadata_file(id, file_id, file_key_m1, file_key_m4, file_key_m11,file_key_m13,file_key_m14,file_key_m16,file_key_m17,file_key_m18,file_key_m19,file_key_m22,file_key_m34,file_key_m36,file_key_m37,file_key_m38,file_key_m40,file_key_m41,file_key_m60)" +
|
|
|
- "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
+ String sql = "INSERT INTO u_metadata_file(id, file_id, file_key_m1, file_key_m2, file_key_m3, file_key_m4, file_key_m5, file_key_m6, file_key_m7, file_key_m8, file_key_m9, file_key_m10, file_key_m11, file_key_m12, file_key_m13, " +
|
|
|
+ "file_key_m14,file_key_m15,file_key_m16,file_key_m17,file_key_m18,file_key_m19,file_key_m20,file_key_m21,file_key_m22,file_key_m23,file_key_m24,file_key_m25,file_key_m26,file_key_m27,file_key_m28,file_key_m29,file_key_m30,file_key_m31,file_key_m32," +
|
|
|
+ "file_key_m33,file_key_m34,file_key_m35,file_key_m36,file_key_m37,file_key_m38,file_key_m39,file_key_m40,file_key_m41,file_key_m42,file_key_m43,file_key_m44,file_key_m45,file_key_m46,file_key_m47,file_key_m48,file_key_m49,file_key_m50," +
|
|
|
+ "file_key_m51, file_key_m52,file_key_m53,file_key_m54,file_key_m55,file_key_m56,file_key_m57,file_key_m58,file_key_m59,file_key_m60,file_key_m61,file_key_m62,file_key_m63 )" +
|
|
|
+ "VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
|
|
|
PreparedStatement pstm = conn.prepareStatement(sql);
|
|
|
//pstm 绑定数据
|
|
|
int i = 0;
|
|
@@ -112,25 +191,71 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
pstm.setLong(1, (Long) Map.get("id"));
|
|
|
pstm.setLong(2, (Long) Map.get("file_id"));
|
|
|
pstm.setString(3, Map.get("file_key_m1") == null ? null : Map.get("file_key_m1")+"");
|
|
|
- pstm.setString(4, Map.get("file_key_m4") == null ? null : Map.get("file_key_m4")+"");
|
|
|
- pstm.setString(5, Map.get("file_key_m11") == null ? null : Map.get("file_key_m11")+"");
|
|
|
- pstm.setString(6, Map.get("file_key_m13") == null ? null : Map.get("file_key_m13")+"");
|
|
|
- pstm.setString(7, Map.get("file_key_m14") == null ? null : Map.get("file_key_m14")+"");
|
|
|
- pstm.setString(8, Map.get("file_key_m16") == null ? null : Map.get("file_key_m16")+"");
|
|
|
- pstm.setString(9, Map.get("file_key_m17") == null ? null : Map.get("file_key_m17")+"");
|
|
|
- pstm.setString(10, Map.get("file_key_m18") == null ? null : Map.get("file_key_m18")+"");
|
|
|
- pstm.setString(11, Map.get("file_key_m19") == null ? null : Map.get("file_key_m19")+"");
|
|
|
- pstm.setString(12, Map.get("file_key_m22") == null ? null : Map.get("file_key_m22")+"");
|
|
|
- pstm.setString(13, Map.get("file_key_m34") == null ? null : Map.get("file_key_m34")+"");
|
|
|
- pstm.setString(14, Map.get("file_key_m36") == null ? null : Map.get("file_key_m36")+"");
|
|
|
- pstm.setString(15, Map.get("file_key_m37") == null ? null : Map.get("file_key_m37")+"");
|
|
|
- pstm.setString(16, Map.get("file_key_m38") == null ? null : Map.get("file_key_m38")+"");
|
|
|
- pstm.setString(17, Map.get("file_key_m40") == null ? null : Map.get("file_key_m40")+"");
|
|
|
- pstm.setString(18, Map.get("file_key_m41") == null ? null : Map.get("file_key_m41")+"");
|
|
|
- pstm.setString(19, Map.get("file_key_m60") == null ? null : Map.get("file_key_m60")+"");
|
|
|
+ pstm.setString(4, Map.get("file_key_m2") == null ? null : Map.get("file_key_m2")+"");
|
|
|
+ pstm.setString(5, Map.get("file_key_m3") == null ? null : Map.get("file_key_m3")+"");
|
|
|
+ pstm.setString(6, Map.get("file_key_m4") == null ? null : Map.get("file_key_m4")+"");
|
|
|
+ pstm.setString(7, Map.get("file_key_m5") == null ? null : Map.get("file_key_m5")+"");
|
|
|
+ pstm.setString(8, Map.get("file_key_m6") == null ? null : Map.get("file_key_m6")+"");
|
|
|
+ pstm.setString(9, Map.get("file_key_m7") == null ? null : Map.get("file_key_m7")+"");
|
|
|
+ pstm.setString(10, Map.get("file_key_m8") == null ? null : Map.get("file_key_m8")+"");
|
|
|
+ pstm.setString(11, Map.get("file_key_m9") == null ? null : Map.get("file_key_m9")+"");
|
|
|
+ pstm.setString(12, Map.get("file_key_m10") == null ? null : Map.get("file_key_m10")+"");
|
|
|
+ pstm.setString(13, Map.get("file_key_m11") == null ? null : Map.get("file_key_m11")+"");
|
|
|
+ pstm.setString(14, Map.get("file_key_m12") == null ? null : Map.get("file_key_m12")+"");
|
|
|
+ pstm.setString(15, Map.get("file_key_m13") == null ? null : Map.get("file_key_m13")+"");
|
|
|
+ pstm.setString(16, Map.get("file_key_m14") == null ? null : Map.get("file_key_m14")+"");
|
|
|
+ pstm.setString(17, Map.get("file_key_m15") == null ? null : Map.get("file_key_m15")+"");
|
|
|
+ pstm.setString(18, Map.get("file_key_m16") == null ? null : Map.get("file_key_m16")+"");
|
|
|
+ pstm.setString(19, Map.get("file_key_m17") == null ? null : Map.get("file_key_m17")+"");
|
|
|
+ pstm.setString(20, Map.get("file_key_m18") == null ? null : Map.get("file_key_m18")+"");
|
|
|
+ pstm.setString(21, Map.get("file_key_m19") == null ? null : Map.get("file_key_m19")+"");
|
|
|
+ pstm.setString(22, Map.get("file_key_m20") == null ? null : Map.get("file_key_m20")+"");
|
|
|
+ pstm.setString(23, Map.get("file_key_m21") == null ? null : Map.get("file_key_m21")+"");
|
|
|
+ pstm.setString(24, Map.get("file_key_m22") == null ? null : Map.get("file_key_m22")+"");
|
|
|
+ pstm.setString(25, Map.get("file_key_m23") == null ? null : Map.get("file_key_m23")+"");
|
|
|
+ pstm.setString(26, Map.get("file_key_m24") == null ? null : Map.get("file_key_m24")+"");
|
|
|
+ pstm.setString(27, Map.get("file_key_m25") == null ? null : Map.get("file_key_m25")+"");
|
|
|
+ pstm.setString(28, Map.get("file_key_m26") == null ? null : Map.get("file_key_m26")+"");
|
|
|
+ pstm.setString(29, Map.get("file_key_m27") == null ? null : Map.get("file_key_m27")+"");
|
|
|
+ pstm.setString(30, Map.get("file_key_m28") == null ? null : Map.get("file_key_m28")+"");
|
|
|
+ pstm.setString(31, Map.get("file_key_m29") == null ? null : Map.get("file_key_m29")+"");
|
|
|
+ pstm.setString(32, Map.get("file_key_m30") == null ? null : Map.get("file_key_m30")+"");
|
|
|
+ pstm.setString(33, Map.get("file_key_m31") == null ? null : Map.get("file_key_m31")+"");
|
|
|
+ pstm.setString(34, Map.get("file_key_m32") == null ? null : Map.get("file_key_m32")+"");
|
|
|
+ pstm.setString(35, Map.get("file_key_m33") == null ? null : Map.get("file_key_m33")+"");
|
|
|
+ pstm.setString(36, Map.get("file_key_m34") == null ? null : Map.get("file_key_m34")+"");
|
|
|
+ pstm.setString(37, Map.get("file_key_m35") == null ? null : Map.get("file_key_m35")+"");
|
|
|
+ pstm.setString(38, Map.get("file_key_m36") == null ? null : Map.get("file_key_m36")+"");
|
|
|
+ pstm.setString(39, Map.get("file_key_m37") == null ? null : Map.get("file_key_m37")+"");
|
|
|
+ pstm.setString(40, Map.get("file_key_m38") == null ? null : Map.get("file_key_m38")+"");
|
|
|
+ pstm.setString(41, Map.get("file_key_m39") == null ? null : Map.get("file_key_m39")+"");
|
|
|
+ pstm.setString(42, Map.get("file_key_m40") == null ? null : Map.get("file_key_m40")+"");
|
|
|
+ pstm.setString(43, Map.get("file_key_m41") == null ? null : Map.get("file_key_m41")+"");
|
|
|
+ pstm.setString(44, Map.get("file_key_m42") == null ? null : Map.get("file_key_m42")+"");
|
|
|
+ pstm.setString(45, Map.get("file_key_m43") == null ? null : Map.get("file_key_m43")+"");
|
|
|
+ pstm.setString(46, Map.get("file_key_m44") == null ? null : Map.get("file_key_m44")+"");
|
|
|
+ pstm.setString(47, Map.get("file_key_m45") == null ? null : Map.get("file_key_m45")+"");
|
|
|
+ pstm.setString(48, Map.get("file_key_m46") == null ? null : Map.get("file_key_m46")+"");
|
|
|
+ pstm.setString(49, Map.get("file_key_m47") == null ? null : Map.get("file_key_m47")+"");
|
|
|
+ pstm.setString(50, Map.get("file_key_m48") == null ? null : Map.get("file_key_m48")+"");
|
|
|
+ pstm.setString(51, Map.get("file_key_m49") == null ? null : Map.get("file_key_m49")+"");
|
|
|
+ pstm.setString(52, Map.get("file_key_m50") == null ? null : Map.get("file_key_m50")+"");
|
|
|
+ pstm.setString(53, Map.get("file_key_m51") == null ? null : Map.get("file_key_m51")+"");
|
|
|
+ pstm.setString(54, Map.get("file_key_m52") == null ? null : Map.get("file_key_m52")+"");
|
|
|
+ pstm.setString(55, Map.get("file_key_m53") == null ? null : Map.get("file_key_m53")+"");
|
|
|
+ pstm.setString(56, Map.get("file_key_m54") == null ? null : Map.get("file_key_m54")+"");
|
|
|
+ pstm.setString(57, Map.get("file_key_m55") == null ? null : Map.get("file_key_m55")+"");
|
|
|
+ pstm.setString(58, Map.get("file_key_m56") == null ? null : Map.get("file_key_m56")+"");
|
|
|
+ pstm.setString(59, Map.get("file_key_m57") == null ? null : Map.get("file_key_m57")+"");
|
|
|
+ pstm.setString(60, Map.get("file_key_m58") == null ? null : Map.get("file_key_m58")+"");
|
|
|
+ pstm.setString(61, Map.get("file_key_m59") == null ? null : Map.get("file_key_m59")+"");
|
|
|
+ pstm.setString(62, Map.get("file_key_m60") == null ? null : Map.get("file_key_m60")+"");
|
|
|
+ pstm.setString(63, Map.get("file_key_m61") == null ? null : Map.get("file_key_m61")+"");
|
|
|
+ pstm.setString(64, Map.get("file_key_m62") == null ? null : Map.get("file_key_m62")+"");
|
|
|
+ pstm.setString(65, Map.get("file_key_m63") == null ? null : Map.get("file_key_m63")+"");
|
|
|
//添加批处理
|
|
|
pstm.addBatch();
|
|
|
- if (i % 1000 == 0) {
|
|
|
+ if (i % 500 == 0) {
|
|
|
pstm.executeBatch();
|
|
|
pstm.clearBatch();
|
|
|
}
|
|
@@ -146,6 +271,20 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取当前打包状态,如果正在进行打包则提示
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public int getPackStatus() {
|
|
|
+ ArchiveOfflineVersionInfo info = baseMapper.getPackStatus();
|
|
|
+ if (info == null || info.getFileUrl() != null){
|
|
|
+ return 0;
|
|
|
+ }else {
|
|
|
+ throw new ServiceException("有项目正在打包中,请稍后再试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void fileToSqlite(Long projectId) throws Exception {
|
|
|
List<ArchiveFile> list = fileClient.getListByProjectId(projectId);
|
|
|
if (list != null && list.size() > 0) {
|
|
@@ -192,8 +331,8 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
pstm.setString(6, file.getFileTime());
|
|
|
pstm.setString(7, file.getFileUrl() == null ? "" : file.getFileUrl());
|
|
|
pstm.setString(8, file.getPdfFileUrl() == null ? "" : file.getPdfFileUrl());
|
|
|
- pstm.setInt(9, file.getStatus());
|
|
|
- pstm.setInt(10, file.getIsDeleted());
|
|
|
+ pstm.setLong(9, file.getStatus());
|
|
|
+ pstm.setLong(10, file.getIsDeleted());
|
|
|
pstm.setLong(11, file.getArchiveId() == null ? -1 : file.getArchiveId());
|
|
|
pstm.setString(12, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(file.getCreateTime()));
|
|
|
pstm.setString(13, file.getDutyUser());
|
|
@@ -216,7 +355,7 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
}
|
|
|
|
|
|
public void contractToSqlite(Long projectId) {
|
|
|
- List<ArchiveTreeContract> list = contractClient.getListByProjectId(projectId);
|
|
|
+ List<ArchiveTreeContract> list = baseMapper.getListByProjectId(projectId);
|
|
|
if (list != null && list.size() > 0) {
|
|
|
try {
|
|
|
Connection conn = data.dataSource().getConnection();
|
|
@@ -224,8 +363,8 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
statement.execute("DELETE FROM m_archive_tree_contract");
|
|
|
statement.close();
|
|
|
//获取执行对象
|
|
|
- String sql = "INSERT INTO m_archive_tree_contract(id, project_id, parent_id, ancestors, node_name,status,is_deleted,create_time)" +
|
|
|
- "VALUES(?, ?, ?, ?, ?,?,?,?)";
|
|
|
+ String sql = "INSERT INTO m_archive_tree_contract(id, project_id, parent_id, ancestors, node_name,status,is_deleted,create_time,storage_type)" +
|
|
|
+ "VALUES(?, ?, ?, ?, ?,?,?,?,?)";
|
|
|
PreparedStatement pstm = conn.prepareStatement(sql);
|
|
|
//pstm 绑定数据
|
|
|
int i = 0;
|
|
@@ -236,9 +375,10 @@ public class ArchiveOfflineVersionInfoServiceImpl extends BaseServiceImpl<Archiv
|
|
|
pstm.setLong(3, contract.getParentId());
|
|
|
pstm.setString(4, contract.getAncestors());
|
|
|
pstm.setString(5, contract.getNodeName());
|
|
|
- pstm.setInt(6, contract.getStatus());
|
|
|
- pstm.setInt(7, contract.getIsDeleted());
|
|
|
+ pstm.setLong(6, contract.getStatus());
|
|
|
+ pstm.setLong(7, contract.getIsDeleted());
|
|
|
pstm.setString(8, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(contract.getCreateTime()));
|
|
|
+ pstm.setString(9, contract.getStorageType() == null ? null : contract.getStorageType()+"");
|
|
|
//添加批处理
|
|
|
pstm.addBatch();
|
|
|
if (i % 1000 == 0) {
|