feat:修改文件传输

dev
wangxy 1 month ago
parent 6201cd344f
commit 5a39ce00aa

8
.gitignore vendored

@ -1,8 +1,8 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
!**/src/maintarget/
!**/src/testtarget/
### STS ###
.apt_generated
@ -26,8 +26,8 @@ target/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
!**/src/mainbuild/
!**/src/testbuild/
### VS Code ###
.vscode/

@ -1,58 +1,58 @@
/* */ package com.archive.common.utils;
/* */
/* */ import com.alibaba.fastjson.JSONObject;
/* */ import com.archive.common.utils.IpUtils;
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.common.utils.http.HttpUtils;
/* */ import com.archive.framework.config.ArchiveConfig;
/* */ import org.slf4j.Logger;
/* */ import org.slf4j.LoggerFactory;
/* */
/* */
/* */
/* */
/* */
/* */ public class AddressUtils
/* */ {
/* 17 */ private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.AddressUtils.class);
/* */
/* */
/* */ public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";
/* */
/* */
/* */ public static final String UNKNOWN = "XX XX";
/* */
/* */
/* */ public static String getRealAddressByIP(String ip) {
/* 27 */ String address = "XX XX";
/* */
/* 29 */ if (IpUtils.internalIp(ip))
/* */ {
/* 31 */ return "内网IP";
/* */ }
/* 33 */ if (ArchiveConfig.isAddressEnabled()) {
/* */
/* */ try {
/* */
/* 37 */ String rspStr = HttpUtils.sendGet("http://whois.pconline.com.cn/ipJson.jsp", "ip=" + ip + "&json=true", "GBK");
/* 38 */ if (StringUtils.isEmpty(rspStr)) {
/* */
/* 40 */ log.error("获取地理位置异常 {}", ip);
/* 41 */ return "XX XX";
/* */ }
/* 43 */ JSONObject obj = JSONObject.parseObject(rspStr);
/* 44 */ String region = obj.getString("pro");
/* 45 */ String city = obj.getString("city");
/* 46 */ return String.format("%s %s", new Object[] { region, city });
/* */ }
/* 48 */ catch (Exception e) {
/* */
/* 50 */ log.error("获取地理位置异常 {}", e);
/* */ }
/* */ }
/* 53 */ return address;
/* */ }
/* */ }
package com.archive.common.utils;
import com.alibaba.fastjson.JSONObject;
import com.archive.common.utils.IpUtils;
import com.archive.common.utils.StringUtils;
import com.archive.common.utils.http.HttpUtils;
import com.archive.framework.config.ArchiveConfig;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class AddressUtils
{
private static final Logger log = LoggerFactory.getLogger(com.archive.common.utils.AddressUtils.class);
public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp";
public static final String UNKNOWN = "XX XX";
public static String getRealAddressByIP(String ip) {
String address = "XX XX";
if (IpUtils.internalIp(ip))
{
return "内网IP";
}
if (ArchiveConfig.isAddressEnabled()) {
try {
String rspStr = HttpUtils.sendGet("http://whois.pconline.com.cn/ipJson.jsp", "ip=" + ip + "&json=true", "GBK");
if (StringUtils.isEmpty(rspStr)) {
log.error("获取地理位置异常 {}", ip);
return "XX XX";
}
JSONObject obj = JSONObject.parseObject(rspStr);
String region = obj.getString("pro");
String city = obj.getString("city");
return String.format("%s %s", new Object[] { region, city });
}
catch (Exception e) {
log.error("获取地理位置异常 {}", e);
}
}
return address;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\commo\\utils\AddressUtils.class

@ -1,177 +1,177 @@
/* */ package com.archive.framework.config
package com.archive.framework.config
;
/* */
/* */ import com.archive.common.utils.spring.SpringUtils;
/* */ import com.archive.project.dasz.ccgl.service.ICcglService;
/* */ import java.io.File;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.boot.context.properties.ConfigurationProperties;
/* */ import org.springframework.stereotype.Component;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Component
/* */ @ConfigurationProperties(prefix = "archive")
/* */ public class ArchiveConfig
/* */ {
/* */ private String name;
/* */ private String version;
/* */ private String copyrightYear;
/* */ private boolean demoEnabled;
/* */ private static String profile;
/* */ private static boolean addressEnabled;
/* */ private boolean browseServerEnabled;
/* */ private String browseServer;
/* */ private String databaseType;
/* */ @Autowired
/* */ private ICcglService ccglService;
/* */
/* */ public boolean isBrowseServerEnabled() {
/* 49 */ return this.browseServerEnabled;
/* */ }
/* */
/* */ public void setBrowseServerEnabled(boolean browseServerEnabled) {
/* 53 */ this.browseServerEnabled = browseServerEnabled;
/* */ }
/* */
/* */ public String getBrowseServer() {
/* 57 */ return this.browseServer;
/* */ }
/* */
/* */ public void setBrowseServer(String browseServer) {
/* 61 */ this.browseServer = browseServer;
/* */ }
/* */
/* */
/* */ public String getName() {
/* 66 */ return this.name;
/* */ }
/* */
/* */
/* */ public void setName(String name) {
/* 71 */ this.name = name;
/* */ }
/* */
/* */
/* */ public String getVersion() {
/* 76 */ return this.version;
/* */ }
/* */
/* */
/* */ public void setVersion(String version) {
/* 81 */ this.version = version;
/* */ }
/* */
/* */
/* */ public String getCopyrightYear() {
/* 86 */ return this.copyrightYear;
/* */ }
/* */
/* */
/* */ public void setCopyrightYear(String copyrightYear) {
/* 91 */ this.copyrightYear = copyrightYear;
/* */ }
/* */
/* */
/* */ public boolean isDemoEnabled() {
/* 96 */ return this.demoEnabled;
/* */ }
/* */
/* */
/* */ public void setDemoEnabled(boolean demoEnabled) {
/* 101 */ this.demoEnabled = demoEnabled;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public String getProfile() {
/* 111 */ return this.ccglService.getPathByLjbs("archive.archiveRootPath");
/* */ }
/* */
/* */ public static com.archive.framework.config.ArchiveConfig getInstance() {
/* 115 */ return (com.archive.framework.config.ArchiveConfig)SpringUtils.getBean(com.archive.framework.config.ArchiveConfig.class);
/* */ }
/* */
/* */
/* */ public void setProfile(String profile) {
/* 120 */ com.archive.framework.config.ArchiveConfig.profile = this.ccglService.getPathByLjbs("archive.archiveRootPath");
/* */ }
/* */
/* */
/* */ public static boolean isAddressEnabled() {
/* 125 */ return addressEnabled;
/* */ }
/* */
/* */
/* */ public void setAddressEnabled(boolean addressEnabled) {
/* 130 */ com.archive.framework.config.ArchiveConfig.addressEnabled = addressEnabled;
/* */ }
/* */
/* */ public String getDatabaseType() {
/* 134 */ return this.databaseType;
/* */ }
/* */
/* */ public void setDatabaseType(String databaseType) {
/* 138 */ this.databaseType = databaseType;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String getAvatarPath() {
/* 146 */ return getProfile() + "/avatar";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String getDownloadPath() {
/* 154 */ return getProfile() + "/download/";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String getUploadPath() {
/* 162 */ return getProfile() + "/upload";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public String getImportBathMessagePath() {
/* 170 */ return getProfile() + File.separator + "ImportBathMessage";
/* */ }
/* */ }
import com.archive.common.utils.spring.SpringUtils;
import com.archive.project.dasz.ccgl.service.ICcglService;
import java.io.File;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "archive")
public class ArchiveConfig
{
private String name;
private String version;
private String copyrightYear;
private boolean demoEnabled;
private static String profile;
private static boolean addressEnabled;
private boolean browseServerEnabled;
private String browseServer;
private String databaseType;
@Autowired
private ICcglService ccglService;
public boolean isBrowseServerEnabled() {
return this.browseServerEnabled;
}
public void setBrowseServerEnabled(boolean browseServerEnabled) {
this.browseServerEnabled = browseServerEnabled;
}
public String getBrowseServer() {
return this.browseServer;
}
public void setBrowseServer(String browseServer) {
this.browseServer = browseServer;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getVersion() {
return this.version;
}
public void setVersion(String version) {
this.version = version;
}
public String getCopyrightYear() {
return this.copyrightYear;
}
public void setCopyrightYear(String copyrightYear) {
this.copyrightYear = copyrightYear;
}
public boolean isDemoEnabled() {
return this.demoEnabled;
}
public void setDemoEnabled(boolean demoEnabled) {
this.demoEnabled = demoEnabled;
}
public String getProfile() {
return this.ccglService.getPathByLjbs("archive.archiveRootPath");
}
public static com.archive.framework.config.ArchiveConfig getInstance() {
return (com.archive.framework.config.ArchiveConfig)SpringUtils.getBean(com.archive.framework.config.ArchiveConfig.class);
}
public void setProfile(String profile) {
com.archive.framework.config.ArchiveConfig.profile = this.ccglService.getPathByLjbs("archive.archiveRootPath");
}
public static boolean isAddressEnabled() {
return addressEnabled;
}
public void setAddressEnabled(boolean addressEnabled) {
com.archive.framework.config.ArchiveConfig.addressEnabled = addressEnabled;
}
public String getDatabaseType() {
return this.databaseType;
}
public void setDatabaseType(String databaseType) {
this.databaseType = databaseType;
}
public String getAvatarPath() {
return getProfile() + "/avatar";
}
public String getDownloadPath() {
return getProfile() + "/download/";
}
public String getUploadPath() {
return getProfile() + "/upload";
}
public String getImportBathMessagePath() {
return getProfile() + File.separator + "ImportBathMessage";
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\config\ArchiveConfig.class

@ -1,201 +1,201 @@
/* */ package com.archive.framework.web.domain
package com.archive.framework.web.domain
;
/* */
/* */ import com.archive.common.utils.StringUtils;
/* */ import java.util.HashMap;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class AjaxResult
/* */ extends HashMap<String, Object>
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */ public static final String CODE_TAG = "code";
/* */ public static final String MSG_TAG = "msg";
/* */ public static final String DATA_TAG = "data";
/* */
/* */ public AjaxResult() {}
/* */
/* */ public AjaxResult(Type type, String msg) {
/* 63 */ super.put("code", type);
/* 64 */ super.put("msg", msg);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public AjaxResult(Type type, String msg, Object data) {
/* 76 */ super.put("code", type);
/* 77 */ super.put("msg", msg);
/* 78 */ if (StringUtils.isNotNull(data))
/* */ {
/* 80 */ super.put("data", data);
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Override
/* */ public com.archive.framework.web.domain.AjaxResult put(String key, Object value) {
/* 94 */ super.put(key, value);
/* 95 */ return this;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult success() {
/* 105 */ return success("操作成功");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult success(Object data) {
/* 115 */ return success("操作成功", data);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult success(String msg) {
/* 126 */ return success(msg, null);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult success(String msg, Object data) {
/* 138 */ return new com.archive.framework.web.domain.AjaxResult(Type.SUCCESS, msg, data);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult warn(String msg) {
/* 149 */ return warn(msg, null);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult warn(String msg, Object data) {
/* 161 */ return new com.archive.framework.web.domain.AjaxResult(Type.WARN, msg, data);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult error() {
/* 171 */ return error("操作失败");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult error(String msg) {
/* 182 */ return error(msg, null);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public static com.archive.framework.web.domain.AjaxResult error(String msg, Object data) {
/* 194 */ return new com.archive.framework.web.domain.AjaxResult(Type.ERROR, msg, data);
/* */ }
/* */ }
import com.archive.common.utils.StringUtils;
import java.util.HashMap;
public class AjaxResult
extends HashMap<String, Object>
{
private static final long serialVersionUID = 1L;
public static final String CODE_TAG = "code";
public static final String MSG_TAG = "msg";
public static final String DATA_TAG = "data";
public AjaxResult() {}
public AjaxResult(Type type, String msg) {
super.put("code", type);
super.put("msg", msg);
}
public AjaxResult(Type type, String msg, Object data) {
super.put("code", type);
super.put("msg", msg);
if (StringUtils.isNotNull(data))
{
super.put("data", data);
}
}
@Override
public com.archive.framework.web.domain.AjaxResult put(String key, Object value) {
super.put(key, value);
return this;
}
public static com.archive.framework.web.domain.AjaxResult success() {
return success("操作成功");
}
public static com.archive.framework.web.domain.AjaxResult success(Object data) {
return success("操作成功", data);
}
public static com.archive.framework.web.domain.AjaxResult success(String msg) {
return success(msg, null);
}
public static com.archive.framework.web.domain.AjaxResult success(String msg, Object data) {
return new com.archive.framework.web.domain.AjaxResult(Type.SUCCESS, msg, data);
}
public static com.archive.framework.web.domain.AjaxResult warn(String msg) {
return warn(msg, null);
}
public static com.archive.framework.web.domain.AjaxResult warn(String msg, Object data) {
return new com.archive.framework.web.domain.AjaxResult(Type.WARN, msg, data);
}
public static com.archive.framework.web.domain.AjaxResult error() {
return error("操作失败");
}
public static com.archive.framework.web.domain.AjaxResult error(String msg) {
return error(msg, null);
}
public static com.archive.framework.web.domain.AjaxResult error(String msg, Object data) {
return new com.archive.framework.web.domain.AjaxResult(Type.ERROR, msg, data);
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\framework\web\domain\AjaxResult.class

@ -1,409 +1,409 @@
/* */ package com.archive.project.dajs.archiveimportbatch.controller
package com.archive.project.dajs.archiveimportbatch.controller
;
/* */
/* */ import com.archive.common.utils.StringUtils;
/* */ import com.archive.common.utils.poi.ExcelUtil;
/* */ import com.archive.common.utils.security.ShiroUtils;
/* */ import com.archive.common.utils.text.TextUtils;
/* */ import com.archive.framework.aspectj.lang.annotation.Log;
/* */ import com.archive.framework.aspectj.lang.enums.BusinessType;
/* */ import com.archive.framework.config.ArchiveConfig;
/* */ import com.archive.framework.web.controller.BaseController;
/* */ import com.archive.framework.web.domain.AjaxResult;
/* */ import com.archive.framework.web.page.TableDataInfo;
/* */ import com.archive.project.dajs.archiveimportbatch.domain.ArchiveImportBatch;
/* */ import com.archive.project.dajs.archiveimportbatch.service.IArchiveImportBatchService;
/* */ import com.archive.project.dasz.archivetype.domain.ArchiveType;
/* */ import com.archive.project.dasz.archivetype.service.IArchiveTypeService;
/* */ import com.archive.project.dasz.physicaltable.service.IPhysicalTableService;
/* */ import com.archive.project.dasz.physicaltablecolumn.service.IPhysicalTableColumnService;
/* */ import java.io.File;
/* */ import java.io.IOException;
/* */ import java.util.HashMap;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */ import org.apache.shiro.authz.annotation.RequiresPermissions;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Controller;
/* */ import org.springframework.ui.ModelMap;
/* */ import org.springframework.web.bind.annotation.GetMapping;
/* */ import org.springframework.web.bind.annotation.PathVariable;
/* */ import org.springframework.web.bind.annotation.PostMapping;
/* */ import org.springframework.web.bind.annotation.RequestMapping;
/* */ import org.springframework.web.bind.annotation.RequestParam;
/* */ import org.springframework.web.bind.annotation.ResponseBody;
/* */ import org.springframework.web.multipart.MultipartFile;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Controller
/* */ @RequestMapping({"/dajs/archiveimportbatch"})
/* */ public class ArchiveImportBatchController
/* */ extends BaseController
/* */ {
/* 47 */ private String prefix = "dajs/archiveimportbatch";
/* */
/* */ @Autowired
/* */ private IArchiveImportBatchService archiveImportBatchService;
/* */
/* */ @Autowired
/* */ private IArchiveTypeService archiveTypeService;
/* */
/* */ @Autowired
/* */ private IPhysicalTableColumnService physicalTableColumnService;
/* */
/* */ @Autowired
/* */ private IPhysicalTableService physicalTableService;
/* */
/* */
/* */ @RequiresPermissions({"dajs:archiveimportbatch:view"})
/* */ @GetMapping
/* */ public String ArchiveImportBatch() {
/* 65 */ return this.prefix + "/archiveimportbatch";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @PostMapping({"/list"})
/* */ @ResponseBody
/* */ public TableDataInfo list(ArchiveImportBatch archiveImportBatch) {
/* 76 */ startPage();
/* 77 */ List<ArchiveImportBatch> list = this.archiveImportBatchService.selectArchiveImportBatchList(archiveImportBatch);
/* 78 */ return getDataTable(list);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Log(title = "档案导入", businessType = BusinessType.EXPORT)
/* */ @PostMapping({"/export"})
/* */ @ResponseBody
/* */ public AjaxResult export(ArchiveImportBatch archiveImportBatch) {
/* 90 */ List<ArchiveImportBatch> list = this.archiveImportBatchService.selectArchiveImportBatchList(archiveImportBatch);
/* 91 */ ExcelUtil<ArchiveImportBatch> util = new ExcelUtil(ArchiveImportBatch.class);
/* 92 */ return util.exportExcel(list, "archiveImportBatch");
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @GetMapping({"/add"})
/* */ public String add(String archiveTypeId, String type, ModelMap mmap) {
/* 101 */ long timeNew = System.currentTimeMillis() / 1000L;
/* 102 */ mmap.put("batchNo", Long.valueOf(timeNew));
/* 103 */ mmap.put("archiveTypeId", archiveTypeId);
/* 104 */ ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(Long.valueOf(Long.parseLong(archiveTypeId)));
/* 105 */ if (type.equals("mldr")) {
/* 106 */ if (ArchiveType.getType().toLowerCase().equals("file")) {
/* 107 */ return this.prefix + "/addmldrwj";
/* */ }
/* 109 */ return this.prefix + "/addmldraj";
/* */ }
/* 111 */ if (type.equals("qwgj")) {
/* 112 */ List<Map<String, String>> list = this.archiveImportBatchService.getAllListToSelect(Long.parseLong(archiveTypeId), "file");
/* 113 */ mmap.put("columnList", list);
/* 114 */ return this.prefix + "/addqwgj";
/* */ }
/* 116 */ return this.prefix + "/addgsbdr";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Log(title = "件目录导入", businessType = BusinessType.INSERT)
/* */ @PostMapping({"/add"})
/* */ @ResponseBody
/* */ public AjaxResult addSave(ArchiveImportBatch archiveImportBatch) throws IOException {
/* 130 */ Map<String, String> adiMap = archiveImportBatch.getFormData();
/* 131 */ archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
/* 132 */ archiveImportBatch.setBatchno(adiMap.get("batchno"));
/* 133 */ archiveImportBatch.setBatchname(adiMap.get("batchname"));
/* 134 */ archiveImportBatch.setTempfilepath(adiMap.get("tempfilepath"));
/* */
/* 136 */ String filepath = adiMap.get("tempfilepath");
/* 137 */ List<Map<String, String>> columnList = archiveImportBatch.getColumnData();
/* 138 */ String[] result = this.archiveImportBatchService.excelImport(0, filepath, columnList, Long.parseLong(adiMap.get("batcharchivetypeid")), adiMap.get("batchno"));
/* */
/* 140 */ ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(archiveImportBatch.getBatcharchivetypeid());
/* 141 */ archiveImportBatch.setBatcharchivetypename(ArchiveType.getArchiveName());
/* 142 */ archiveImportBatch.setBatcharchivetypecode(ArchiveType.getArhciveCode());
/* 143 */ archiveImportBatch.setImporttype("目录");
/* 144 */ archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
/* 145 */ archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
/* */
/* 147 */ String wjcontent = result[2];
/* */
/* */
/* */
/* 151 */ String messageFilePath = TextUtils.generateTxt(wjcontent, (String)adiMap.get("batchno") + ".txt");
/* 152 */ archiveImportBatch.setBatchmessage(messageFilePath);
/* 153 */ archiveImportBatch.setBatchcontent(result[0] + "," + result[1]);
/* 154 */ return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
/* */ }
/* */
/* */
/* */
/* */ @Log(title = "档案案卷目录导入", businessType = BusinessType.INSERT)
/* */ @PostMapping({"/addFolderFileImport"})
/* */ @ResponseBody
/* */ public AjaxResult addFolderFileImport(ArchiveImportBatch archiveImportBatch) throws IOException {
/* 163 */ Map<String, String> adiMap = archiveImportBatch.getFormData();
/* 164 */ archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
/* 165 */ archiveImportBatch.setBatchno(adiMap.get("batchno"));
/* 166 */ archiveImportBatch.setBatchname(adiMap.get("batchname"));
/* 167 */ archiveImportBatch.setTempfilepath(adiMap.get("tempfilepath"));
/* */
/* 169 */ String filepath = adiMap.get("tempfilepath");
/* 170 */ List<Map<String, String>> columnList = archiveImportBatch.getColumnData();
/* 171 */ List<Map<String, String>> columnAJList = archiveImportBatch.getColumnAjData();
/* 172 */ String[] result = this.archiveImportBatchService.excelImport(0, filepath, columnAJList, Long.parseLong(adiMap.get("batcharchivetypeid")), adiMap.get("batchno"));
/* 173 */ String[] result2 = this.archiveImportBatchService.excelImport(1, filepath, columnList, Long.parseLong(adiMap.get("batcharchivetypeid")), adiMap.get("batchno"));
/* */
/* 175 */ ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(archiveImportBatch.getBatcharchivetypeid());
/* 176 */ archiveImportBatch.setBatcharchivetypename(ArchiveType.getArchiveName());
/* 177 */ archiveImportBatch.setBatcharchivetypecode(ArchiveType.getArhciveCode());
/* 178 */ archiveImportBatch.setImporttype("目录");
/* 179 */ archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
/* 180 */ archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
/* */
/* 182 */ String ajcontent = result[2];
/* */
/* */
/* */
/* 186 */ String wjcontent = result2[2];
/* */
/* */
/* */
/* */
/* 191 */ String message = "案卷表:" + ajcontent + ", \r\n 卷内表:" + wjcontent;
/* 192 */ String messageFilePath = TextUtils.generateTxt(message, (String)adiMap.get("batchno") + ".txt");
/* 193 */ archiveImportBatch.setBatchmessage(messageFilePath);
/* 194 */ archiveImportBatch.setBatchcontent("案卷表:" + result[0] + "," + result[1] + " \r\n 卷内表:" + result2[0] + "," + result2[1]);
/* 195 */ return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
/* */ }
/* */
/* */ @Log(title = "档案全文挂接", businessType = BusinessType.INSERT)
/* */ @PostMapping({"/qwgjUploadAndImport"})
/* */ @ResponseBody
/* */ public AjaxResult qwgjUploadAndImport(ArchiveImportBatch archiveImportBatch) {
/* 202 */ Map<String, String> adiMap = archiveImportBatch.getFormData();
/* 203 */ archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
/* 204 */ ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(archiveImportBatch.getBatcharchivetypeid());
/* 205 */ archiveImportBatch.setBatcharchivetypename(ArchiveType.getArchiveName());
/* 206 */ archiveImportBatch.setBatcharchivetypecode(ArchiveType.getArhciveCode());
/* 207 */ archiveImportBatch.setBatchno(adiMap.get("batchno"));
/* 208 */ archiveImportBatch.setBatchname(adiMap.get("batchname"));
/* 209 */ archiveImportBatch.setBatchcontent(adiMap.get("batchcontent"));
/* 210 */ String messageFilePath = TextUtils.generateTxt(adiMap.get("batchmessage"), (String)adiMap.get("batchno") + ".txt");
/* 211 */ archiveImportBatch.setBatchmessage(messageFilePath);
/* 212 */ archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
/* 213 */ archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
/* 214 */ archiveImportBatch.setImporttype("全文");
/* 215 */ return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
/* */ }
/* */
/* */ @Log(title = "档案格式包导入", businessType = BusinessType.INSERT)
/* */ @PostMapping({"/addGsbdr"})
/* */ @ResponseBody
/* */ public AjaxResult addSaveGsbdr(ArchiveImportBatch archiveImportBatch) {
/* 222 */ Map<String, String> adiMap = archiveImportBatch.getFormData();
/* 223 */ archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
/* 224 */ archiveImportBatch.setBatchno(adiMap.get("batchno"));
/* 225 */ archiveImportBatch.setBatchname(adiMap.get("batchname"));
/* 226 */ archiveImportBatch.setBatchcontent(adiMap.get("batchcontent"));
/* 227 */ String messageFilePath = TextUtils.generateTxt(adiMap.get("batchmessage"), (String)adiMap.get("batchno") + ".txt");
/* 228 */ archiveImportBatch.setBatchmessage(messageFilePath);
/* 229 */ archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
/* 230 */ archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
/* 231 */ archiveImportBatch.setImporttype("格式包");
/* 232 */ return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
/* */ }
/* */
/* */ @Log(title = "档案导入-全文挂接", businessType = BusinessType.IMPORT)
/* */ @PostMapping({"/qwgjFileUpload"})
/* */ @ResponseBody
/* */ public Map<String, Object> qwgjFileUpload(@RequestParam("file") MultipartFile[] files, long archiveTypeId, String column, String batchNo) {
/* 239 */ Map<String, Object> map = new HashMap<>();
/* 240 */ int sucessCount = 0;
/* 241 */ int failCount = 0;
/* 242 */ String allMessage = "";
/* */ try {
/* 244 */ if (files != null) {
/* 245 */ for (int i = 0; i < files.length; i++) {
/* 246 */ String fileName = files[i].getOriginalFilename();
/* 247 */ String filepath = ArchiveConfig.getInstance().getUploadPath() + "/qwgj/temp";
/* 248 */ File localFile = new File(filepath);
/* 249 */ if (!localFile.exists()) {
/* 250 */ localFile.mkdirs();
/* */ }
/* 252 */ String path = filepath + File.separator + fileName;
/* */
/* 254 */ File server_file = new File(path);
/* 255 */ files[i].transferTo(server_file);
/* */
/* 257 */ Map<String, String> resmap = this.archiveImportBatchService.insertDocByQwgj(path, archiveTypeId, column, batchNo);
/* 258 */ String res = resmap.get("res");
/* 259 */ String msg = resmap.get("msg");
/* 260 */ if (res.equals("1")) {
/* 261 */ sucessCount++;
/* */ } else {
/* 263 */ failCount++;
/* */ }
/* 265 */ allMessage = allMessage + msg + " \r\n ";
/* */ }
/* */ }
/* 268 */ map.put("msg", allMessage);
/* 269 */ map.put("context", "挂接成功" + sucessCount + "条,失败" + failCount + "条");
/* 270 */ } catch (Exception e) {
/* */
/* 272 */ System.out.println("ERROR全文挂接出现异常:" + e.getMessage());
/* 273 */ map.put("context", "挂接失败,出现异常错误,错误信息:" + e.getMessage());
/* */ }
/* 275 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */ @PostMapping({"/gsbdrFileUpload"})
/* */ @ResponseBody
/* */ public Map<String, Object> gsbdrFileUpload(@RequestParam("file") MultipartFile[] files, long archiveTypeId, String column) {
/* 284 */ Map<String, Object> map = new HashMap<>();
/* 285 */ int sucessCount = 0;
/* 286 */ int failCount = 0;
/* 287 */ String allMessage = "";
/* 288 */ Map<String, String> map1 = this.archiveImportBatchService.gsbUploadAndImport(files, archiveTypeId, column);
/* 289 */ allMessage = map1.get("message");
/* 290 */ sucessCount = Integer.parseInt(map1.get("sucess"));
/* 291 */ failCount = Integer.parseInt(map1.get("fail"));
/* 292 */ String filePath = map1.get("path");
/* 293 */ map.put("msg", allMessage);
/* 294 */ map.put("filePath", filePath);
/* 295 */ map.put("context", "挂接成功" + sucessCount + "条,失败" + failCount + "条");
/* 296 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @PostMapping({"/mldrfileUploadAndImport"})
/* */ @ResponseBody
/* */ public Map<String, Object> mldrfileUploadAndImport(@RequestParam("file") MultipartFile file, long archiveTypeId) {
/* 309 */ Map<String, Object> map = this.archiveImportBatchService.mldrFileUploadAndImport(file, archiveTypeId);
/* 310 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @PostMapping({"/folderMldrUploadAndImport"})
/* */ @ResponseBody
/* */ public Map<String, Object> folderMldrUploadAndImport(@RequestParam("file") MultipartFile file, long archiveTypeId, String batchNo) {
/* 323 */ Map<String, Object> map = this.archiveImportBatchService.folderMldrUploadAndImport(file, archiveTypeId, batchNo);
/* 324 */ return map;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @GetMapping({"/edit/{id}"})
/* */ public String edit(@PathVariable("id") Long id, ModelMap mmap) {
/* 335 */ ArchiveImportBatch ArchiveImportBatch = this.archiveImportBatchService.selectArchiveImportBatchById(id);
/* 336 */ mmap.put("archiveImportBatch", ArchiveImportBatch);
/* 337 */ return this.prefix + "/edit";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"dajs:archiveimportbatch:edit"})
/* */ @Log(title = "档案导入-修改", businessType = BusinessType.UPDATE)
/* */ @PostMapping({"/edit"})
/* */ @ResponseBody
/* */ public AjaxResult editSave(ArchiveImportBatch archiveImportBatch) {
/* 349 */ return toAjax(this.archiveImportBatchService.updateArchiveImportBatch(archiveImportBatch));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"dajs:archiveimportbatch:remove"})
/* */ @Log(title = "档案导入-删除批次", businessType = BusinessType.DELETE)
/* */ @PostMapping({"/remove"})
/* */ @ResponseBody
/* */ public AjaxResult remove(String ids) {
/* 362 */ return toAjax(this.archiveImportBatchService.deleteArchiveImportBatchByIds(ids));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @RequiresPermissions({"dajs:archiveimportbatch:remove"})
/* */ @Log(title = "档案导入-删除批次及数据", businessType = BusinessType.DELETE)
/* */ @PostMapping({"/removeData/{type}"})
/* */ @ResponseBody
/* */ public AjaxResult removeData(@PathVariable("type") String type, String ids) {
/* 375 */ return toAjax(this.archiveImportBatchService.deleteArchiveImportBatchAndDataByIds(type, ids));
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @GetMapping({"/importBatchMessage/{id}"})
/* */ public String importBatchMessage(@PathVariable("id") Long id, ModelMap mmap) {
/* 387 */ String importBatchMessage = "无详细信息";
/* 388 */ ArchiveImportBatch archiveImportBatch = this.archiveImportBatchService.selectArchiveImportBatchById(id);
/* 389 */ if (archiveImportBatch != null) {
/* 390 */ String filePath = archiveImportBatch.getBatchmessage();
/* 391 */ if (StringUtils.isNotEmpty(filePath)) {
/* 392 */ File file = new File(filePath);
/* 393 */ if (file.exists()) {
/* 394 */ String text = TextUtils.readText(filePath);
/* 395 */ if (StringUtils.isNotEmpty(text)) {
/* 396 */ importBatchMessage = text;
/* */ }
/* */ }
/* */ }
/* */ }
/* 401 */ mmap.put("importBatchMessage", importBatchMessage);
/* 402 */ return this.prefix + "/importbatchmessage";
/* */ }
/* */ }
import com.archive.common.utils.StringUtils;
import com.archive.common.utils.poi.ExcelUtil;
import com.archive.common.utils.security.ShiroUtils;
import com.archive.common.utils.text.TextUtils;
import com.archive.framework.aspectj.lang.annotation.Log;
import com.archive.framework.aspectj.lang.enums.BusinessType;
import com.archive.framework.config.ArchiveConfig;
import com.archive.framework.web.controller.BaseController;
import com.archive.framework.web.domain.AjaxResult;
import com.archive.framework.web.page.TableDataInfo;
import com.archive.project.dajs.archiveimportbatch.domain.ArchiveImportBatch;
import com.archive.project.dajs.archiveimportbatch.service.IArchiveImportBatchService;
import com.archive.project.dasz.archivetype.domain.ArchiveType;
import com.archive.project.dasz.archivetype.service.IArchiveTypeService;
import com.archive.project.dasz.physicaltable.service.IPhysicalTableService;
import com.archive.project.dasz.physicaltablecolumn.service.IPhysicalTableColumnService;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
@Controller
@RequestMapping({"/dajs/archiveimportbatch"})
public class ArchiveImportBatchController
extends BaseController
{
private String prefix = "dajs/archiveimportbatch";
@Autowired
private IArchiveImportBatchService archiveImportBatchService;
@Autowired
private IArchiveTypeService archiveTypeService;
@Autowired
private IPhysicalTableColumnService physicalTableColumnService;
@Autowired
private IPhysicalTableService physicalTableService;
@RequiresPermissions({"dajs:archiveimportbatch:view"})
@GetMapping
public String ArchiveImportBatch() {
return this.prefix + "/archiveimportbatch";
}
@PostMapping({"/list"})
@ResponseBody
public TableDataInfo list(ArchiveImportBatch archiveImportBatch) {
startPage();
List<ArchiveImportBatch> list = this.archiveImportBatchService.selectArchiveImportBatchList(archiveImportBatch);
return getDataTable(list);
}
@Log(title = "档案导入", businessType = BusinessType.EXPORT)
@PostMapping({"/export"})
@ResponseBody
public AjaxResult export(ArchiveImportBatch archiveImportBatch) {
List<ArchiveImportBatch> list = this.archiveImportBatchService.selectArchiveImportBatchList(archiveImportBatch);
ExcelUtil<ArchiveImportBatch> util = new ExcelUtil(ArchiveImportBatch.class);
return util.exportExcel(list, "archiveImportBatch");
}
@GetMapping({"/add"})
public String add(String archiveTypeId, String type, ModelMap mmap) {
long timeNew = System.currentTimeMillis() / 1000L;
mmap.put("batchNo", Long.valueOf(timeNew));
mmap.put("archiveTypeId", archiveTypeId);
ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(Long.valueOf(Long.parseLong(archiveTypeId)));
if (type.equals("mldr")) {
if (ArchiveType.getType().toLowerCase().equals("file")) {
return this.prefix + "/addmldrwj";
}
return this.prefix + "/addmldraj";
}
if (type.equals("qwgj")) {
List<Map<String, String>> list = this.archiveImportBatchService.getAllListToSelect(Long.parseLong(archiveTypeId), "file");
mmap.put("columnList", list);
return this.prefix + "/addqwgj";
}
return this.prefix + "/addgsbdr";
}
@Log(title = "件目录导入", businessType = BusinessType.INSERT)
@PostMapping({"/add"})
@ResponseBody
public AjaxResult addSave(ArchiveImportBatch archiveImportBatch) throws IOException {
Map<String, String> adiMap = archiveImportBatch.getFormData();
archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
archiveImportBatch.setBatchno(adiMap.get("batchno"));
archiveImportBatch.setBatchname(adiMap.get("batchname"));
archiveImportBatch.setTempfilepath(adiMap.get("tempfilepath"));
String filepath = adiMap.get("tempfilepath");
List<Map<String, String>> columnList = archiveImportBatch.getColumnData();
String[] result = this.archiveImportBatchService.excelImport(0, filepath, columnList, Long.parseLong(adiMap.get("batcharchivetypeid")), adiMap.get("batchno"));
ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(archiveImportBatch.getBatcharchivetypeid());
archiveImportBatch.setBatcharchivetypename(ArchiveType.getArchiveName());
archiveImportBatch.setBatcharchivetypecode(ArchiveType.getArhciveCode());
archiveImportBatch.setImporttype("目录");
archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
String wjcontent = result[2];
String messageFilePath = TextUtils.generateTxt(wjcontent, (String)adiMap.get("batchno") + ".txt");
archiveImportBatch.setBatchmessage(messageFilePath);
archiveImportBatch.setBatchcontent(result[0] + "," + result[1]);
return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
}
@Log(title = "档案案卷目录导入", businessType = BusinessType.INSERT)
@PostMapping({"/addFolderFileImport"})
@ResponseBody
public AjaxResult addFolderFileImport(ArchiveImportBatch archiveImportBatch) throws IOException {
Map<String, String> adiMap = archiveImportBatch.getFormData();
archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
archiveImportBatch.setBatchno(adiMap.get("batchno"));
archiveImportBatch.setBatchname(adiMap.get("batchname"));
archiveImportBatch.setTempfilepath(adiMap.get("tempfilepath"));
String filepath = adiMap.get("tempfilepath");
List<Map<String, String>> columnList = archiveImportBatch.getColumnData();
List<Map<String, String>> columnAJList = archiveImportBatch.getColumnAjData();
String[] result = this.archiveImportBatchService.excelImport(0, filepath, columnAJList, Long.parseLong(adiMap.get("batcharchivetypeid")), adiMap.get("batchno"));
String[] result2 = this.archiveImportBatchService.excelImport(1, filepath, columnList, Long.parseLong(adiMap.get("batcharchivetypeid")), adiMap.get("batchno"));
ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(archiveImportBatch.getBatcharchivetypeid());
archiveImportBatch.setBatcharchivetypename(ArchiveType.getArchiveName());
archiveImportBatch.setBatcharchivetypecode(ArchiveType.getArhciveCode());
archiveImportBatch.setImporttype("目录");
archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
String ajcontent = result[2];
String wjcontent = result2[2];
String message = "案卷表:" + ajcontent + ", \r\n 卷内表:" + wjcontent;
String messageFilePath = TextUtils.generateTxt(message, (String)adiMap.get("batchno") + ".txt");
archiveImportBatch.setBatchmessage(messageFilePath);
archiveImportBatch.setBatchcontent("案卷表:" + result[0] + "," + result[1] + " \r\n 卷内表:" + result2[0] + "," + result2[1]);
return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
}
@Log(title = "档案全文挂接", businessType = BusinessType.INSERT)
@PostMapping({"/qwgjUploadAndImport"})
@ResponseBody
public AjaxResult qwgjUploadAndImport(ArchiveImportBatch archiveImportBatch) {
Map<String, String> adiMap = archiveImportBatch.getFormData();
archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
ArchiveType ArchiveType = this.archiveTypeService.selectArchiveTypeById(archiveImportBatch.getBatcharchivetypeid());
archiveImportBatch.setBatcharchivetypename(ArchiveType.getArchiveName());
archiveImportBatch.setBatcharchivetypecode(ArchiveType.getArhciveCode());
archiveImportBatch.setBatchno(adiMap.get("batchno"));
archiveImportBatch.setBatchname(adiMap.get("batchname"));
archiveImportBatch.setBatchcontent(adiMap.get("batchcontent"));
String messageFilePath = TextUtils.generateTxt(adiMap.get("batchmessage"), (String)adiMap.get("batchno") + ".txt");
archiveImportBatch.setBatchmessage(messageFilePath);
archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
archiveImportBatch.setImporttype("全文");
return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
}
@Log(title = "档案格式包导入", businessType = BusinessType.INSERT)
@PostMapping({"/addGsbdr"})
@ResponseBody
public AjaxResult addSaveGsbdr(ArchiveImportBatch archiveImportBatch) {
Map<String, String> adiMap = archiveImportBatch.getFormData();
archiveImportBatch.setBatcharchivetypeid(Long.valueOf(Long.parseLong(adiMap.get("batcharchivetypeid"))));
archiveImportBatch.setBatchno(adiMap.get("batchno"));
archiveImportBatch.setBatchname(adiMap.get("batchname"));
archiveImportBatch.setBatchcontent(adiMap.get("batchcontent"));
String messageFilePath = TextUtils.generateTxt(adiMap.get("batchmessage"), (String)adiMap.get("batchno") + ".txt");
archiveImportBatch.setBatchmessage(messageFilePath);
archiveImportBatch.setCreateUserid(ShiroUtils.getSysUser().getUserId());
archiveImportBatch.setCreateUsername(ShiroUtils.getSysUser().getUserName());
archiveImportBatch.setImporttype("格式包");
return toAjax(this.archiveImportBatchService.insertArchiveImportBatch(archiveImportBatch));
}
@Log(title = "档案导入-全文挂接", businessType = BusinessType.IMPORT)
@PostMapping({"/qwgjFileUpload"})
@ResponseBody
public Map<String, Object> qwgjFileUpload(@RequestParam("file") MultipartFile[] files, long archiveTypeId, String column, String batchNo) {
Map<String, Object> map = new HashMap<>();
int sucessCount = 0;
int failCount = 0;
String allMessage = "";
try {
if (files != null) {
for (int i = 0; i < files.length; i++) {
String fileName = files[i].getOriginalFilename();
String filepath = ArchiveConfig.getInstance().getUploadPath() + "/qwgj/temp";
File localFile = new File(filepath);
if (!localFile.exists()) {
localFile.mkdirs();
}
String path = filepath + File.separator + fileName;
File server_file = new File(path);
files[i].transferTo(server_file);
Map<String, String> resmap = this.archiveImportBatchService.insertDocByQwgj(path, archiveTypeId, column, batchNo);
String res = resmap.get("res");
String msg = resmap.get("msg");
if (res.equals("1")) {
sucessCount++;
} else {
failCount++;
}
allMessage = allMessage + msg + " \r\n ";
}
}
map.put("msg", allMessage);
map.put("context", "挂接成功" + sucessCount + "条,失败" + failCount + "条");
} catch (Exception e) {
System.out.println("ERROR全文挂接出现异常:" + e.getMessage());
map.put("context", "挂接失败,出现异常错误,错误信息:" + e.getMessage());
}
return map;
}
@PostMapping({"/gsbdrFileUpload"})
@ResponseBody
public Map<String, Object> gsbdrFileUpload(@RequestParam("file") MultipartFile[] files, long archiveTypeId, String column) {
Map<String, Object> map = new HashMap<>();
int sucessCount = 0;
int failCount = 0;
String allMessage = "";
Map<String, String> map1 = this.archiveImportBatchService.gsbUploadAndImport(files, archiveTypeId, column);
allMessage = map1.get("message");
sucessCount = Integer.parseInt(map1.get("sucess"));
failCount = Integer.parseInt(map1.get("fail"));
String filePath = map1.get("path");
map.put("msg", allMessage);
map.put("filePath", filePath);
map.put("context", "挂接成功" + sucessCount + "条,失败" + failCount + "条");
return map;
}
@PostMapping({"/mldrfileUploadAndImport"})
@ResponseBody
public Map<String, Object> mldrfileUploadAndImport(@RequestParam("file") MultipartFile file, long archiveTypeId) {
Map<String, Object> map = this.archiveImportBatchService.mldrFileUploadAndImport(file, archiveTypeId);
return map;
}
@PostMapping({"/folderMldrUploadAndImport"})
@ResponseBody
public Map<String, Object> folderMldrUploadAndImport(@RequestParam("file") MultipartFile file, long archiveTypeId, String batchNo) {
Map<String, Object> map = this.archiveImportBatchService.folderMldrUploadAndImport(file, archiveTypeId, batchNo);
return map;
}
@GetMapping({"/edit/{id}"})
public String edit(@PathVariable("id") Long id, ModelMap mmap) {
ArchiveImportBatch ArchiveImportBatch = this.archiveImportBatchService.selectArchiveImportBatchById(id);
mmap.put("archiveImportBatch", ArchiveImportBatch);
return this.prefix + "/edit";
}
@RequiresPermissions({"dajs:archiveimportbatch:edit"})
@Log(title = "档案导入-修改", businessType = BusinessType.UPDATE)
@PostMapping({"/edit"})
@ResponseBody
public AjaxResult editSave(ArchiveImportBatch archiveImportBatch) {
return toAjax(this.archiveImportBatchService.updateArchiveImportBatch(archiveImportBatch));
}
@RequiresPermissions({"dajs:archiveimportbatch:remove"})
@Log(title = "档案导入-删除批次", businessType = BusinessType.DELETE)
@PostMapping({"/remove"})
@ResponseBody
public AjaxResult remove(String ids) {
return toAjax(this.archiveImportBatchService.deleteArchiveImportBatchByIds(ids));
}
@RequiresPermissions({"dajs:archiveimportbatch:remove"})
@Log(title = "档案导入-删除批次及数据", businessType = BusinessType.DELETE)
@PostMapping({"/removeData/{type}"})
@ResponseBody
public AjaxResult removeData(@PathVariable("type") String type, String ids) {
return toAjax(this.archiveImportBatchService.deleteArchiveImportBatchAndDataByIds(type, ids));
}
@GetMapping({"/importBatchMessage/{id}"})
public String importBatchMessage(@PathVariable("id") Long id, ModelMap mmap) {
String importBatchMessage = "无详细信息";
ArchiveImportBatch archiveImportBatch = this.archiveImportBatchService.selectArchiveImportBatchById(id);
if (archiveImportBatch != null) {
String filePath = archiveImportBatch.getBatchmessage();
if (StringUtils.isNotEmpty(filePath)) {
File file = new File(filePath);
if (file.exists()) {
String text = TextUtils.readText(filePath);
if (StringUtils.isNotEmpty(text)) {
importBatchMessage = text;
}
}
}
}
mmap.put("importBatchMessage", importBatchMessage);
return this.prefix + "/importbatchmessage";
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\dajs\archiveimportbatch\controller\ArchiveImportBatchController.class

@ -1,263 +1,263 @@
/* */ package com.archive.project.dajs.archiveimportbatch.domain;
/* */
/* */ import com.archive.framework.aspectj.lang.annotation.Excel;
/* */ import com.archive.framework.web.domain.BaseEntity;
/* */ import java.util.List;
/* */ import java.util.Map;
/* */ import org.apache.commons.lang3.builder.ToStringBuilder;
/* */ import org.apache.commons.lang3.builder.ToStringStyle;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ArchiveImportBatch
/* */ extends BaseEntity
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */ private Long id;
/* */ @Excel(name = "批次号")
/* */ private String batchno;
/* */ @Excel(name = "批次名称")
/* */ private String batchname;
/* */ @Excel(name = "导入人")
/* */ private Long createUserid;
/* */ @Excel(name = "导入人姓名")
/* */ private String createUsername;
/* */ @Excel(name = "导入结果")
/* */ private String batchcontent;
/* */ @Excel(name = "导入详细信息")
/* */ private String batchmessage;
/* */ @Excel(name = "备注")
/* */ private String bz;
/* */ @Excel(name = "档案类型id")
/* */ private Long batcharchivetypeid;
/* */ @Excel(name = "档案类型名称")
/* */ private String batcharchivetypename;
/* */ @Excel(name = "档案类型编码")
/* */ private String batcharchivetypecode;
/* */ @Excel(name = "导入类型(目录、全文、格式包)")
/* */ private String importtype;
/* */ @Excel(name = "导入临时文件路径")
/* */ private String tempfilepath;
/* */ private String cfsjclType;
/* */ private Map<String, String> formData;
/* */ private List<Map<String, String>> columnData;
/* */ private List<Map<String, String>> columnAjData;
/* */
/* */ public void setFormData(Map<String, String> formData) {
/* 83 */ this.formData = formData;
/* */ }
/* */
/* */
/* */ public Map<String, String> getFormData() {
/* 88 */ return this.formData;
/* */ }
/* */
/* */
/* */
/* */
/* */ public void setColumnAjData(List<Map<String, String>> columnAjData) {
/* 95 */ this.columnAjData = columnAjData;
/* */ }
/* */
/* */
/* */ public List<Map<String, String>> getColumnAjData() {
/* 100 */ return this.columnAjData;
/* */ }
/* */
/* */
/* */ public void setColumnData(List<Map<String, String>> columnData) {
/* 105 */ this.columnData = columnData;
/* */ }
/* */
/* */
/* */ public List<Map<String, String>> getColumnData() {
/* 110 */ return this.columnData;
/* */ }
/* */
/* */
/* */ public void setId(Long id) {
/* 115 */ this.id = id;
/* */ }
/* */
/* */
/* */ public Long getId() {
/* 120 */ return this.id;
/* */ }
/* */
/* */ public void setBatchno(String batchno) {
/* 124 */ this.batchno = batchno;
/* */ }
/* */
/* */
/* */ public String getBatchno() {
/* 129 */ return this.batchno;
/* */ }
/* */
/* */ public void setBatchname(String batchname) {
/* 133 */ this.batchname = batchname;
/* */ }
/* */
/* */
/* */ public String getBatchname() {
/* 138 */ return this.batchname;
/* */ }
/* */
/* */ public void setCreateUserid(Long createUserid) {
/* 142 */ this.createUserid = createUserid;
/* */ }
/* */
/* */
/* */ public Long getCreateUserid() {
/* 147 */ return this.createUserid;
/* */ }
/* */
/* */ public void setCreateUsername(String createUsername) {
/* 151 */ this.createUsername = createUsername;
/* */ }
/* */
/* */
/* */ public String getCreateUsername() {
/* 156 */ return this.createUsername;
/* */ }
/* */
/* */ public void setBatchcontent(String batchcontent) {
/* 160 */ this.batchcontent = batchcontent;
/* */ }
/* */
/* */
/* */ public String getBatchcontent() {
/* 165 */ return this.batchcontent;
/* */ }
/* */
/* */ public void setBatchmessage(String batchmessage) {
/* 169 */ this.batchmessage = batchmessage;
/* */ }
/* */
/* */
/* */ public String getBatchmessage() {
/* 174 */ return this.batchmessage;
/* */ }
/* */
/* */ public void setBz(String bz) {
/* 178 */ this.bz = bz;
/* */ }
/* */
/* */
/* */ public String getBz() {
/* 183 */ return this.bz;
/* */ }
/* */
/* */ public void setBatcharchivetypeid(Long batcharchivetypeid) {
/* 187 */ this.batcharchivetypeid = batcharchivetypeid;
/* */ }
/* */
/* */
/* */ public Long getBatcharchivetypeid() {
/* 192 */ return this.batcharchivetypeid;
/* */ }
/* */
/* */ public void setBatcharchivetypename(String batcharchivetypename) {
/* 196 */ this.batcharchivetypename = batcharchivetypename;
/* */ }
/* */
/* */
/* */ public String getBatcharchivetypename() {
/* 201 */ return this.batcharchivetypename;
/* */ }
/* */
/* */ public void setBatcharchivetypecode(String batcharchivetypecode) {
/* 205 */ this.batcharchivetypecode = batcharchivetypecode;
/* */ }
/* */
/* */
/* */ public String getBatcharchivetypecode() {
/* 210 */ return this.batcharchivetypecode;
/* */ }
/* */
/* */ public void setImporttype(String importtype) {
/* 214 */ this.importtype = importtype;
/* */ }
/* */
/* */
/* */ public String getImporttype() {
/* 219 */ return this.importtype;
/* */ }
/* */
/* */ public void setTempfilepath(String tempfilepath) {
/* 223 */ this.tempfilepath = tempfilepath;
/* */ }
/* */
/* */
/* */ public String getTempfilepath() {
/* 228 */ return this.tempfilepath;
/* */ }
/* */
/* */
/* */ public String toString() {
/* 233 */ return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE))
/* 234 */ .append("id", getId())
/* 235 */ .append("createTime", getCreateTime())
/* 236 */ .append("batchno", getBatchno())
/* 237 */ .append("batchname", getBatchname())
/* 238 */ .append("createUserid", getCreateUserid())
/* 239 */ .append("createUsername", getCreateUsername())
/* 240 */ .append("batchcontent", getBatchcontent())
/* 241 */ .append("batchmessage", getBatchmessage())
/* 242 */ .append("bz", getBz())
/* 243 */ .append("batcharchivetypeid", getBatcharchivetypeid())
/* 244 */ .append("batcharchivetypename", getBatcharchivetypename())
/* 245 */ .append("batcharchivetypecode", getBatcharchivetypecode())
/* 246 */ .append("importtype", getImporttype())
/* 247 */ .append("tempfilepath", getTempfilepath())
/* 248 */ .toString();
/* */ }
/* */
/* */ public String getCfsjclType() {
/* 252 */ return this.cfsjclType;
/* */ }
/* */
/* */ public void setCfsjclType(String cfsjclType) {
/* 256 */ this.cfsjclType = cfsjclType;
/* */ }
/* */ }
package com.archive.project.dajs.archiveimportbatch.domain;
import com.archive.framework.aspectj.lang.annotation.Excel;
import com.archive.framework.web.domain.BaseEntity;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
public class ArchiveImportBatch
extends BaseEntity
{
private static final long serialVersionUID = 1L;
private Long id;
@Excel(name = "批次号")
private String batchno;
@Excel(name = "批次名称")
private String batchname;
@Excel(name = "导入人")
private Long createUserid;
@Excel(name = "导入人姓名")
private String createUsername;
@Excel(name = "导入结果")
private String batchcontent;
@Excel(name = "导入详细信息")
private String batchmessage;
@Excel(name = "备注")
private String bz;
@Excel(name = "档案类型id")
private Long batcharchivetypeid;
@Excel(name = "档案类型名称")
private String batcharchivetypename;
@Excel(name = "档案类型编码")
private String batcharchivetypecode;
@Excel(name = "导入类型(目录、全文、格式包)")
private String importtype;
@Excel(name = "导入临时文件路径")
private String tempfilepath;
private String cfsjclType;
private Map<String, String> formData;
private List<Map<String, String>> columnData;
private List<Map<String, String>> columnAjData;
public void setFormData(Map<String, String> formData) {
this.formData = formData;
}
public Map<String, String> getFormData() {
return this.formData;
}
public void setColumnAjData(List<Map<String, String>> columnAjData) {
this.columnAjData = columnAjData;
}
public List<Map<String, String>> getColumnAjData() {
return this.columnAjData;
}
public void setColumnData(List<Map<String, String>> columnData) {
this.columnData = columnData;
}
public List<Map<String, String>> getColumnData() {
return this.columnData;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return this.id;
}
public void setBatchno(String batchno) {
this.batchno = batchno;
}
public String getBatchno() {
return this.batchno;
}
public void setBatchname(String batchname) {
this.batchname = batchname;
}
public String getBatchname() {
return this.batchname;
}
public void setCreateUserid(Long createUserid) {
this.createUserid = createUserid;
}
public Long getCreateUserid() {
return this.createUserid;
}
public void setCreateUsername(String createUsername) {
this.createUsername = createUsername;
}
public String getCreateUsername() {
return this.createUsername;
}
public void setBatchcontent(String batchcontent) {
this.batchcontent = batchcontent;
}
public String getBatchcontent() {
return this.batchcontent;
}
public void setBatchmessage(String batchmessage) {
this.batchmessage = batchmessage;
}
public String getBatchmessage() {
return this.batchmessage;
}
public void setBz(String bz) {
this.bz = bz;
}
public String getBz() {
return this.bz;
}
public void setBatcharchivetypeid(Long batcharchivetypeid) {
this.batcharchivetypeid = batcharchivetypeid;
}
public Long getBatcharchivetypeid() {
return this.batcharchivetypeid;
}
public void setBatcharchivetypename(String batcharchivetypename) {
this.batcharchivetypename = batcharchivetypename;
}
public String getBatcharchivetypename() {
return this.batcharchivetypename;
}
public void setBatcharchivetypecode(String batcharchivetypecode) {
this.batcharchivetypecode = batcharchivetypecode;
}
public String getBatcharchivetypecode() {
return this.batcharchivetypecode;
}
public void setImporttype(String importtype) {
this.importtype = importtype;
}
public String getImporttype() {
return this.importtype;
}
public void setTempfilepath(String tempfilepath) {
this.tempfilepath = tempfilepath;
}
public String getTempfilepath() {
return this.tempfilepath;
}
public String toString() {
return (new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE))
.append("id", getId())
.append("createTime", getCreateTime())
.append("batchno", getBatchno())
.append("batchname", getBatchname())
.append("createUserid", getCreateUserid())
.append("createUsername", getCreateUsername())
.append("batchcontent", getBatchcontent())
.append("batchmessage", getBatchmessage())
.append("bz", getBz())
.append("batcharchivetypeid", getBatcharchivetypeid())
.append("batcharchivetypename", getBatcharchivetypename())
.append("batcharchivetypecode", getBatcharchivetypecode())
.append("importtype", getImporttype())
.append("tempfilepath", getTempfilepath())
.toString();
}
public String getCfsjclType() {
return this.cfsjclType;
}
public void setCfsjclType(String cfsjclType) {
this.cfsjclType = cfsjclType;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\dajs\archiveimportbatch\domain\ArchiveImportBatch.class

@ -1,134 +1,134 @@
/* */ package com.archive.project.dasz.archivetype.domain
package com.archive.project.dasz.archivetype.domain
;
/* */
/* */ import java.io.Serializable;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class ArchiveCollationTree
/* */ implements Serializable
/* */ {
/* */ private static final long serialVersionUID = 1L;
/* */ private Long id;
/* */ private Long pId;
/* */ private String name;
/* */ private String title;
/* */ private String type;
/* */ private String archiveCode;
/* */ private boolean checked = false;
/* */ private boolean open = false;
/* */ private boolean nocheck = false;
/* */
/* */ public Long getId() {
/* 46 */ return this.id;
/* */ }
/* */
/* */
/* */ public void setId(Long id) {
/* 51 */ this.id = id;
/* */ }
/* */
/* */
/* */ public Long getpId() {
/* 56 */ return this.pId;
/* */ }
/* */
/* */
/* */ public void setpId(Long pId) {
/* 61 */ this.pId = pId;
/* */ }
/* */
/* */
/* */ public String getName() {
/* 66 */ return this.name;
/* */ }
/* */
/* */
/* */ public void setName(String name) {
/* 71 */ this.name = name;
/* */ }
/* */
/* */
/* */ public String getTitle() {
/* 76 */ return this.title;
/* */ }
/* */
/* */
/* */ public void setTitle(String title) {
/* 81 */ this.title = title;
/* */ }
/* */
/* */
/* */ public boolean isChecked() {
/* 86 */ return this.checked;
/* */ }
/* */
/* */
/* */ public void setChecked(boolean checked) {
/* 91 */ this.checked = checked;
/* */ }
/* */
/* */
/* */ public boolean isOpen() {
/* 96 */ return this.open;
/* */ }
/* */
/* */
/* */ public void setOpen(boolean open) {
/* 101 */ this.open = open;
/* */ }
/* */
/* */
/* */ public boolean isNocheck() {
/* 106 */ return this.nocheck;
/* */ }
/* */
/* */
/* */ public void setNocheck(boolean nocheck) {
/* 111 */ this.nocheck = nocheck;
/* */ }
/* */
/* */ public String getType() {
/* 115 */ return this.type;
/* */ }
/* */
/* */ public void setType(String type) {
/* 119 */ this.type = type;
/* */ }
/* */
/* */ public String getArchiveCode() {
/* 123 */ return this.archiveCode;
/* */ }
/* */
/* */ public void setArchiveCode(String archiveCode) {
/* 127 */ this.archiveCode = archiveCode;
/* */ }
/* */ }
import java.io.Serializable;
public class ArchiveCollationTree
implements Serializable
{
private static final long serialVersionUID = 1L;
private Long id;
private Long pId;
private String name;
private String title;
private String type;
private String archiveCode;
private boolean checked = false;
private boolean open = false;
private boolean nocheck = false;
public Long getId() {
return this.id;
}
public void setId(Long id) {
this.id = id;
}
public Long getpId() {
return this.pId;
}
public void setpId(Long pId) {
this.pId = pId;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getTitle() {
return this.title;
}
public void setTitle(String title) {
this.title = title;
}
public boolean isChecked() {
return this.checked;
}
public void setChecked(boolean checked) {
this.checked = checked;
}
public boolean isOpen() {
return this.open;
}
public void setOpen(boolean open) {
this.open = open;
}
public boolean isNocheck() {
return this.nocheck;
}
public void setNocheck(boolean nocheck) {
this.nocheck = nocheck;
}
public String getType() {
return this.type;
}
public void setType(String type) {
this.type = type;
}
public String getArchiveCode() {
return this.archiveCode;
}
public void setArchiveCode(String archiveCode) {
this.archiveCode = archiveCode;
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\dasz\archivetype\domain\ArchiveCollationTree.class

@ -1,272 +1,272 @@
/* */ package com.archive.project.monitor.job.task
package com.archive.project.monitor.job.task
;
/* */
/* */ import com.archive.common.archiveUtil.TableUtil;
/* */ import com.archive.common.convert.ZHConvert;
/* */ import com.archive.common.ocr.PdfOcr;
/* */ import com.archive.framework.config.ArchiveConfig;
/* */ import com.archive.project.common.service.IExecuteSqlService;
/* */ import com.archive.project.dasz.archivetype.domain.ArchiveTableColumn;
/* */ import com.archive.project.dasz.archivetype.domain.ArchiveType;
/* */ import com.archive.project.dasz.archivetype.service.IArchiveListService;
/* */ import com.archive.project.dasz.archivetype.service.IArchiveTypeService;
/* */ import com.archive.project.dasz.ccgl.service.ICcglService;
/* */ import com.archive.project.dasz.physicaltable.service.IPhysicalTableService;
/* */ import com.archive.project.dasz.physicaltablecolumn.service.IPhysicalTableColumnService;
/* */ import com.archive.project.system.config.service.IConfigService;
/* */ import java.io.File;
/* */ import java.io.IOException;
/* */ import java.util.LinkedHashMap;
/* */ import java.util.List;
/* */ import net.sourceforge.tess4j.Tesseract;
/* */ import net.sourceforge.tess4j.util.LoadLibs;
/* */ import org.springframework.beans.factory.annotation.Autowired;
/* */ import org.springframework.stereotype.Component;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ @Component("archiveDataTask")
/* */ public class ArchiveDataTask
/* */ {
/* */ @Autowired
/* */ public IExecuteSqlService executeSqlService;
/* */ @Autowired
/* */ public IPhysicalTableService physicalTableService;
/* */ @Autowired
/* */ public IPhysicalTableColumnService physicalTableColumnService;
/* */ @Autowired
/* */ public IArchiveTypeService ArchiveTypeService;
/* */ @Autowired
/* */ private IConfigService configService;
/* */ @Autowired
/* */ private IArchiveListService archiveListService;
/* */ @Autowired
/* */ private ArchiveConfig archiveConfig;
/* */ @Autowired
/* */ private ICcglService ccglService;
/* */
/* */ public void createDataToTotal() throws IOException {
/* 65 */ String deleteSql = "delete from t_ar_total";
/* 66 */ this.executeSqlService.delete(deleteSql);
/* */
/* 68 */ List<ArchiveType> achiveList = this.ArchiveTypeService.selectArchiveTypeList(new ArchiveType());
/* 69 */ for (int i = 0; i < achiveList.size(); i++) {
/* 70 */ ArchiveType archivetype = achiveList.get(i);
/* 71 */ if (archivetype != null) {
/* 72 */ String code = archivetype.getArhciveCode();
/* 73 */ String name = archivetype.getArchiveName();
/* 74 */ String type = archivetype.getType();
/* 75 */ long archivaTypeId = archivetype.getId().longValue();
/* 76 */ if (type.toLowerCase().equals("folder")) {
/* */
/* 78 */ String str1 = "T_AR_" + code + "_FOLDER";
/* 79 */ String str2 = TableUtil.getTableId(str1);
/* */
/* 81 */ String str3 = "";
/* */
/* 83 */ List<ArchiveTableColumn> list = this.archiveListService.getColumns(String.valueOf(archivetype.getId()), "folder");
/* 84 */ if (list.size() > 0) {
/* 85 */ String columns = "";
/* 86 */ for (int j = 0; j < list.size(); j++) {
/* 87 */ String columnname = ((ArchiveTableColumn)list.get(j)).getField();
/* 88 */ if (columnname != null && !columnname.trim().equals("") && !columnname.trim().equals("id") && !columnname.trim().equals("status") && !columnname.trim().equals("create_time")) {
/* 89 */ if (j == list.size() - 1) {
/* 90 */ columns = columns + columnname;
/* */ } else {
/* 92 */ columns = columns + columnname + ",";
/* */ }
/* */ }
/* */ }
/* 96 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
/* 97 */ str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "',concat_ws('|'," + columns + ") ,'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
/* */
/* */
/* */ }
/* 101 */ else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
/* */
/* */
/* 104 */ String newColumns = "";
/* 105 */ String[] sttr = columns.split(",");
/* 106 */ for (int k = 0; k < sttr.length; k++) {
/* 107 */ if (k == sttr.length - 1) {
/* 108 */ newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')";
/* */ } else {
/* 110 */ newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')||'|'||";
/* */ }
/* */ }
/* 113 */ str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "'," + newColumns + ",'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
/* */
/* */ }
/* */
/* */ }
/* 118 */ else if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
/* 119 */ str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "',concat_ws('|',fonds_code,fondsName,year_code,bgqx,tm,zrz,dh) ,'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
/* */
/* */ }
/* 122 */ else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
/* 123 */ str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "',COALESCE(fonds_code,'')||'|'||COALESCE(fondsName,'')||'|'||COALESCE(year_code,'')||'|'||COALESCE(bgqx,'')||'|'||COALESCE(tm,'')||'|'||COALESCE(zrz,'')||'|'||COALESCE(dh,'') ,'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* 130 */ System.out.println("-----------" + str3);
/* 131 */ this.executeSqlService.insert(str3);
/* */ }
/* */
/* 134 */ String tableName = "T_AR_" + code + "_FILE";
/* 135 */ String tableId = TableUtil.getTableId(tableName);
/* */
/* 137 */ String sql = "";
/* */
/* 139 */ List<ArchiveTableColumn> list1 = this.archiveListService.getColumns(String.valueOf(archivetype.getId()), "file");
/* 140 */ if (list1.size() > 0) {
/* 141 */ String columns = "";
/* 142 */ for (int j = 0; j < list1.size(); j++) {
/* 143 */ String columnname = ((ArchiveTableColumn)list1.get(j)).getField();
/* 144 */ if (columnname != null && !columnname.trim().equals("") && !columnname.trim().equals("id") && !columnname.trim().equals("status") && !columnname.trim().equals("create_time")) {
/* 145 */ if (j == list1.size() - 1) {
/* 146 */ columns = columns + columnname;
/* */ } else {
/* 148 */ columns = columns + columnname + ",";
/* */ }
/* */ }
/* */ }
/* 152 */ if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
/* 153 */ sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws,concat_ws('|'," + columns + "),'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
/* */
/* */ }
/* 156 */ else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
/* */
/* */
/* */
/* 160 */ String newColumns = "";
/* 161 */ String[] sttr = columns.split(",");
/* 162 */ for (int k = 0; k < sttr.length; k++) {
/* 163 */ if (k == sttr.length - 1) {
/* 164 */ newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')";
/* */ } else {
/* 166 */ newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')||'|'||";
/* */ }
/* */ }
/* 169 */ sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws," + newColumns + ",'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
/* */
/* */ }
/* */
/* */ }
/* 174 */ else if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
/* 175 */ sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws,concat_ws('|',fonds_code,fondsName,year_code,bgqx,tm,zrz,wjrq,dh),'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
/* */
/* */ }
/* 178 */ else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
/* 179 */ sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws,COALESCE(fonds_code,'')||'|'||COALESCE(fondsName,'')||'|'||COALESCE(year_code,'')||'|'||COALESCE(bgqx,'')||'|'||COALESCE(tm,'')||'|'||COALESCE(zrz,'')||'|'||COALESCE(wjrq,'')||'|'||COALESCE(dh,''),'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
/* */ }
/* */
/* */
/* */
/* */
/* */
/* 186 */ System.out.println("-----------" + sql);
/* 187 */ this.executeSqlService.insert(sql);
/* */ }
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public void updateContextDataToTotal() {
/* 197 */ String sql = "select id,archiveId,archiveTypeCode,rowContext from t_ar_total where dzqw>0";
/* 198 */ List<LinkedHashMap<String, Object>> list = this.executeSqlService.queryList(sql);
/* 199 */ for (int i = 0; i < list.size(); i++) {
/* 200 */ String id = (((LinkedHashMap)list.get(i)).get("id") == null) ? "" : ((LinkedHashMap)list.get(i)).get("id").toString();
/* 201 */ String archiveId = (((LinkedHashMap)list.get(i)).get("archiveId") == null) ? "" : ((LinkedHashMap)list.get(i)).get("archiveId").toString();
/* 202 */ String archiveTypeCode = (((LinkedHashMap)list.get(i)).get("archiveTypeCode") == null) ? "" : ((LinkedHashMap)list.get(i)).get("archiveTypeCode").toString();
/* 203 */ String rowContext = (((LinkedHashMap)list.get(i)).get("rowContext") == null) ? "" : ((LinkedHashMap)list.get(i)).get("rowContext").toString();
/* */
/* */
/* 206 */ String allValueTraditional = ZHConvert.convert(rowContext, 0);
/* */
/* 208 */ String allValuePinyin = ZHConvert.getPingYin(rowContext);
/* */
/* 210 */ String ocrText = "";
/* 211 */ String tableName = "t_ar_" + archiveTypeCode + "_document";
/* 212 */ String docsql = "select filepath,filehz from " + tableName + " where ownerid=" + archiveId;
/* 213 */ List<LinkedHashMap<String, Object>> doclist = this.executeSqlService.queryList(docsql);
/* */
/* */
/* 216 */ String pdfSpiltImagePath = this.ccglService.getPathByLjbs("archive.pdfSpiltImagePath");
/* 217 */ for (int j = 0; j < doclist.size(); j++) {
/* */ try {
/* 219 */ String path = (((LinkedHashMap)doclist.get(j)).get("filepath") == null) ? "" : ((LinkedHashMap)doclist.get(j)).get("filepath").toString();
/* 220 */ String hz = (((LinkedHashMap)doclist.get(j)).get("filehz") == null) ? "" : ((LinkedHashMap)doclist.get(j)).get("filehz").toString();
/* 221 */ if ((new File(path)).exists()) {
/* 222 */ if (hz.toLowerCase().equals("ofd")) {
/* */
/* 224 */ ocrText = ""; break;
/* */ }
/* 226 */ if (hz.toLowerCase().equals("pdf")) {
/* 227 */ ocrText = PdfOcr.getTextFromPdf(path, pdfSpiltImagePath); break;
/* */ }
/* 229 */ if (hz.toLowerCase().equals("jpg") || hz.toLowerCase().equals("png") || hz.toLowerCase().equals("jpeg")) {
/* 230 */ Tesseract tesseract = new Tesseract();
/* */
/* 232 */ File tessDataFolder = LoadLibs.extractTessResources("tessdata");
/* 233 */ tesseract.setDatapath(tessDataFolder.getAbsolutePath());
/* */
/* 235 */ tesseract.setLanguage("chi_sim");
/* */
/* 237 */ String result = tesseract.doOCR(new File(path));
/* */
/* 239 */ ocrText = result.replaceAll("\\r|\\n", "-").replaceAll(" ", "");
/* */
/* */
/* */ break;
/* */ }
/* */ } else {
/* 245 */ System.out.println("文件不存在:" + path);
/* */ }
/* */
/* 248 */ } catch (Exception e) {
/* 249 */ e.printStackTrace();
/* */ }
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 259 */ ocrText = ocrText.replaceAll(",", "").replaceAll("\"", "").replaceAll(";", "").replaceAll("'", "").replaceAll("/n", "").replaceAll("/r", "").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "").replaceAll("", "").replaceAll("\\[", "").replaceAll("]", "").replaceAll("\\{", "").replaceAll("}", "");
/* */
/* 261 */ String updatesql = "update t_ar_total set fantiContext='" + allValueTraditional + "',pinyinContext='" + allValuePinyin + "',fileContext='" + ocrText + "' where id=" + id;
/* */
/* */
/* 264 */ this.executeSqlService.update(updatesql);
/* */ }
/* */ }
/* */ }
import com.archive.common.archiveUtil.TableUtil;
import com.archive.common.convert.ZHConvert;
import com.archive.common.ocr.PdfOcr;
import com.archive.framework.config.ArchiveConfig;
import com.archive.project.common.service.IExecuteSqlService;
import com.archive.project.dasz.archivetype.domain.ArchiveTableColumn;
import com.archive.project.dasz.archivetype.domain.ArchiveType;
import com.archive.project.dasz.archivetype.service.IArchiveListService;
import com.archive.project.dasz.archivetype.service.IArchiveTypeService;
import com.archive.project.dasz.ccgl.service.ICcglService;
import com.archive.project.dasz.physicaltable.service.IPhysicalTableService;
import com.archive.project.dasz.physicaltablecolumn.service.IPhysicalTableColumnService;
import com.archive.project.system.config.service.IConfigService;
import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.List;
import net.sourceforge.tess4j.Tesseract;
import net.sourceforge.tess4j.util.LoadLibs;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component("archiveDataTask")
public class ArchiveDataTask
{
@Autowired
public IExecuteSqlService executeSqlService;
@Autowired
public IPhysicalTableService physicalTableService;
@Autowired
public IPhysicalTableColumnService physicalTableColumnService;
@Autowired
public IArchiveTypeService ArchiveTypeService;
@Autowired
private IConfigService configService;
@Autowired
private IArchiveListService archiveListService;
@Autowired
private ArchiveConfig archiveConfig;
@Autowired
private ICcglService ccglService;
public void createDataToTotal() throws IOException {
String deleteSql = "delete from t_ar_total";
this.executeSqlService.delete(deleteSql);
List<ArchiveType> achiveList = this.ArchiveTypeService.selectArchiveTypeList(new ArchiveType());
for (int i = 0; i < achiveList.size(); i++) {
ArchiveType archivetype = achiveList.get(i);
if (archivetype != null) {
String code = archivetype.getArhciveCode();
String name = archivetype.getArchiveName();
String type = archivetype.getType();
long archivaTypeId = archivetype.getId().longValue();
if (type.toLowerCase().equals("folder")) {
String str1 = "T_AR_" + code + "_FOLDER";
String str2 = TableUtil.getTableId(str1);
String str3 = "";
List<ArchiveTableColumn> list = this.archiveListService.getColumns(String.valueOf(archivetype.getId()), "folder");
if (list.size() > 0) {
String columns = "";
for (int j = 0; j < list.size(); j++) {
String columnname = ((ArchiveTableColumn)list.get(j)).getField();
if (columnname != null && !columnname.trim().equals("") && !columnname.trim().equals("id") && !columnname.trim().equals("status") && !columnname.trim().equals("create_time")) {
if (j == list.size() - 1) {
columns = columns + columnname;
} else {
columns = columns + columnname + ",";
}
}
}
if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "',concat_ws('|'," + columns + ") ,'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
}
else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
String newColumns = "";
String[] sttr = columns.split(",");
for (int k = 0; k < sttr.length; k++) {
if (k == sttr.length - 1) {
newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')";
} else {
newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')||'|'||";
}
}
str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "'," + newColumns + ",'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
}
}
else if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "',concat_ws('|',fonds_code,fondsName,year_code,bgqx,tm,zrz,dh) ,'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
}
else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
str3 = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,dh,archiveTypeName,rowContext,archiveType) select id," + str2 + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + str1 + "',year_code,bgqx,tm,zrz,dh,'" + name + "',COALESCE(fonds_code,'')||'|'||COALESCE(fondsName,'')||'|'||COALESCE(year_code,'')||'|'||COALESCE(bgqx,'')||'|'||COALESCE(tm,'')||'|'||COALESCE(zrz,'')||'|'||COALESCE(dh,'') ,'" + type + "' from " + str1 + " where is_delete='0' and status='80'";
}
System.out.println("-----------" + str3);
this.executeSqlService.insert(str3);
}
String tableName = "T_AR_" + code + "_FILE";
String tableId = TableUtil.getTableId(tableName);
String sql = "";
List<ArchiveTableColumn> list1 = this.archiveListService.getColumns(String.valueOf(archivetype.getId()), "file");
if (list1.size() > 0) {
String columns = "";
for (int j = 0; j < list1.size(); j++) {
String columnname = ((ArchiveTableColumn)list1.get(j)).getField();
if (columnname != null && !columnname.trim().equals("") && !columnname.trim().equals("id") && !columnname.trim().equals("status") && !columnname.trim().equals("create_time")) {
if (j == list1.size() - 1) {
columns = columns + columnname;
} else {
columns = columns + columnname + ",";
}
}
}
if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws,concat_ws('|'," + columns + "),'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
}
else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
String newColumns = "";
String[] sttr = columns.split(",");
for (int k = 0; k < sttr.length; k++) {
if (k == sttr.length - 1) {
newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')";
} else {
newColumns = newColumns + "COALESCE(" + sttr[k] + ",'')||'|'||";
}
}
sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws," + newColumns + ",'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
}
}
else if ("mysql".equals(this.archiveConfig.getDatabaseType())) {
sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws,concat_ws('|',fonds_code,fondsName,year_code,bgqx,tm,zrz,wjrq,dh),'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
}
else if ("sqlite".equals(this.archiveConfig.getDatabaseType())) {
sql = "insert into t_ar_total(archiveId,tableId,archiveTypeId,archiveTypeCode,qzh,qzmc,ys,mj,kfkz,tableName,yearCode,bgqx,tm,zrz,rq,dh,archiveTypeName,dzqw,rowContext,archiveType) select id," + tableId + "," + archivaTypeId + ",'" + code + "',fonds_code,fondsName,ys,mj,kfqk,'" + tableName + "',year_code,bgqx,tm,zrz,wjrq,dh,'" + name + "',dqzws,COALESCE(fonds_code,'')||'|'||COALESCE(fondsName,'')||'|'||COALESCE(year_code,'')||'|'||COALESCE(bgqx,'')||'|'||COALESCE(tm,'')||'|'||COALESCE(zrz,'')||'|'||COALESCE(wjrq,'')||'|'||COALESCE(dh,''),'" + type + "' from " + tableName + " where is_delete='0' and status='80'";
}
System.out.println("-----------" + sql);
this.executeSqlService.insert(sql);
}
}
}
public void updateContextDataToTotal() {
String sql = "select id,archiveId,archiveTypeCode,rowContext from t_ar_total where dzqw>0";
List<LinkedHashMap<String, Object>> list = this.executeSqlService.queryList(sql);
for (int i = 0; i < list.size(); i++) {
String id = (((LinkedHashMap)list.get(i)).get("id") == null) ? "" : ((LinkedHashMap)list.get(i)).get("id").toString();
String archiveId = (((LinkedHashMap)list.get(i)).get("archiveId") == null) ? "" : ((LinkedHashMap)list.get(i)).get("archiveId").toString();
String archiveTypeCode = (((LinkedHashMap)list.get(i)).get("archiveTypeCode") == null) ? "" : ((LinkedHashMap)list.get(i)).get("archiveTypeCode").toString();
String rowContext = (((LinkedHashMap)list.get(i)).get("rowContext") == null) ? "" : ((LinkedHashMap)list.get(i)).get("rowContext").toString();
String allValueTraditional = ZHConvert.convert(rowContext, 0);
String allValuePinyin = ZHConvert.getPingYin(rowContext);
String ocrText = "";
String tableName = "t_ar_" + archiveTypeCode + "_document";
String docsql = "select filepath,filehz from " + tableName + " where ownerid=" + archiveId;
List<LinkedHashMap<String, Object>> doclist = this.executeSqlService.queryList(docsql);
String pdfSpiltImagePath = this.ccglService.getPathByLjbs("archive.pdfSpiltImagePath");
for (int j = 0; j < doclist.size(); j++) {
try {
String path = (((LinkedHashMap)doclist.get(j)).get("filepath") == null) ? "" : ((LinkedHashMap)doclist.get(j)).get("filepath").toString();
String hz = (((LinkedHashMap)doclist.get(j)).get("filehz") == null) ? "" : ((LinkedHashMap)doclist.get(j)).get("filehz").toString();
if ((new File(path)).exists()) {
if (hz.toLowerCase().equals("ofd")) {
ocrText = ""; break;
}
if (hz.toLowerCase().equals("pdf")) {
ocrText = PdfOcr.getTextFromPdf(path, pdfSpiltImagePath); break;
}
if (hz.toLowerCase().equals("jpg") || hz.toLowerCase().equals("png") || hz.toLowerCase().equals("jpeg")) {
Tesseract tesseract = new Tesseract();
File tessDataFolder = LoadLibs.extractTessResources("tessdata");
tesseract.setDatapath(tessDataFolder.getAbsolutePath());
tesseract.setLanguage("chi_sim");
String result = tesseract.doOCR(new File(path));
ocrText = result.replaceAll("\\r|\\n", "-").replaceAll(" ", "");
break;
}
} else {
System.out.println("文件不存在:" + path);
}
} catch (Exception e) {
e.printStackTrace();
}
}
ocrText = ocrText.replaceAll(",", "").replaceAll("\"", "").replaceAll(";", "").replaceAll("'", "").replaceAll("/n", "").replaceAll("/r", "").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "").replaceAll("", "").replaceAll("\\[", "").replaceAll("]", "").replaceAll("\\{", "").replaceAll("}", "");
String updatesql = "update t_ar_total set fantiContext='" + allValueTraditional + "',pinyinContext='" + allValuePinyin + "',fileContext='" + ocrText + "' where id=" + id;
this.executeSqlService.update(updatesql);
}
}
}
/* Location: C:\Users\Administrator\Desktop\extracted.zip!\extracted\BOOT-INF\classes\com\archive\project\monitor\job\task\ArchiveDataTask.class

@ -88,7 +88,7 @@ mybatis:
# 搜索指定包别名
typeAliasesPackage: com.archive.project.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath:mybatis/**/*Mapper.xml
mapperLocations: classpath:mybatis*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml

Loading…
Cancel
Save