This commit is contained in:
2025-10-22 14:19:41 +08:00
commit e131e8b719
3326 changed files with 869357 additions and 0 deletions

View File

@@ -0,0 +1,199 @@
package com.point.strategy.docTraditionArrange.docFile.bean;
public class DocFileOriginalEntity {
private Integer id;
private Integer entityId;
private Integer recid;
private String fileName;
private String fileNameServer;
private String fileType;
private Float fileLen;
private String filePath;
private String openType;
private Integer pageNo;
private String version;
private String authorName;
private String fileRemark;
private String fileDes;
private Integer downs;
private Integer veiws;
private String metadataValue;
private Integer metadataType;
private Integer ocrCheck;
private Integer fileStatus;
private Integer fileAttr;
private String md5Code;
private String md5CheckDate;
private String dataContent;
private String fileContent;
private Integer isDivided;
private String dividedContent;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getEntityId() {
return entityId;
}
public void setEntityId(Integer entityId) {
this.entityId = entityId;
}
public Integer getRecid() {
return recid;
}
public void setRecid(Integer recid) {
this.recid = recid;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileNameServer() {
return fileNameServer;
}
public void setFileNameServer(String fileNameServer) {
this.fileNameServer = fileNameServer;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public Float getFileLen() {
return fileLen;
}
public void setFileLen(Float fileLen) {
this.fileLen = fileLen;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getOpenType() {
return openType;
}
public void setOpenType(String openType) {
this.openType = openType;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getFileRemark() {
return fileRemark;
}
public void setFileRemark(String fileRemark) {
this.fileRemark = fileRemark;
}
public String getFileDes() {
return fileDes;
}
public void setFileDes(String fileDes) {
this.fileDes = fileDes;
}
public Integer getDowns() {
return downs;
}
public void setDowns(Integer downs) {
this.downs = downs;
}
public Integer getVeiws() {
return veiws;
}
public void setVeiws(Integer veiws) {
this.veiws = veiws;
}
public String getMetadataValue() {
return metadataValue;
}
public void setMetadataValue(String metadataValue) {
this.metadataValue = metadataValue;
}
public Integer getMetadataType() {
return metadataType;
}
public void setMetadataType(Integer metadataType) {
this.metadataType = metadataType;
}
public Integer getOcrCheck() {
return ocrCheck;
}
public void setOcrCheck(Integer ocrCheck) {
this.ocrCheck = ocrCheck;
}
public Integer getFileStatus() {
return fileStatus;
}
public void setFileStatus(Integer fileStatus) {
this.fileStatus = fileStatus;
}
public Integer getFileAttr() {
return fileAttr;
}
public void setFileAttr(Integer fileAttr) {
this.fileAttr = fileAttr;
}
public String getMd5Code() {
return md5Code;
}
public String getDividedContent() {
return dividedContent;
}
public void setDividedContent(String dividedContent) {
this.dividedContent = dividedContent;
}
public void setMd5Code(String md5Code) {
this.md5Code = md5Code;
}
public String getMd5CheckDate() {
return md5CheckDate;
}
public void setMd5CheckDate(String md5CheckDate) {
this.md5CheckDate = md5CheckDate;
}
public String getDataContent() {
return dataContent;
}
public void setDataContent(String dataContent) {
this.dataContent = dataContent;
}
public String getFileContent() {
return fileContent;
}
public void setFileContent(String fileContent) {
this.fileContent = fileContent;
}
public Integer getIsDivided() {
return isDivided;
}
public void setIsDivided(Integer isDivided) {
this.isDivided = isDivided;
}
}

View File

@@ -0,0 +1,454 @@
package com.point.strategy.docTraditionArrange.docFile.bean;
import com.point.strategy.common.PageBean;
import java.io.Serializable;
import java.util.List;
public class DocTraditionArrangeFile extends PageBean implements Serializable {
private Integer id = 0;
private Integer archiveFileNum = 0;
private String folderNo;
private Integer js = 0;
private String folderLocation;
private String maintitle;
private String securityClass;
private String securityClassCode;
private String fondsNo;
private String fondsNoCode;
private Integer filingYear;
private String retention;
private String retentionCode;
private String archiveCtgNo;
private String archiveCtgNoCode;
private String yearFolderNo;
private Integer quantity = 0;
private String docStartTime;
private String docEndTime;
private String sbtWord;
private String pigeonholeDate;
private String note;
private String mlh;
private String sssq;
private String sssqCode;
private String dagdm;
private String dagdmCode;
private String zqbs;
private String zqbsCode;
private String kzbs;
private String kzbsCode;
private String damldm;
private String damldmCode;
private String createPerson;
private String createDate;
private String archiveFlag;
private String isPackeep;
private String isPackeepCode;
private String md5Code;
private String md5CheckDate;
private String batchId;
private String batchName;
private String backToUpdateState;
private Integer isProcess = 0;
private String archiveEntityStatus;
//部门编码
private String departnameCode;
//部门名称
private String departname;
private Integer fileStatus;
public Integer getFileStatus() {
return fileStatus;
}
public void setFileStatus(Integer fileStatus) {
this.fileStatus = fileStatus;
}
private List<String> idsList;
public List<String> getIdsList() {
return idsList;
}
public void setIdsList(List<String> idsList) {
this.idsList = idsList;
}
public String getDepartnameCode() {
return departnameCode;
}
public void setDepartnameCode(String departnameCode) {
this.departnameCode = departnameCode;
}
public String getDepartname() {
return departname;
}
public void setDepartname(String departname) {
this.departname = departname;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getArchiveFileNum() {
return archiveFileNum;
}
public void setArchiveFileNum(Integer archiveFileNum) {
this.archiveFileNum = archiveFileNum;
}
public String getFolderNo() {
return folderNo;
}
public void setFolderNo(String folderNo) {
this.folderNo = folderNo;
}
public Integer getJs() {
return js;
}
public void setJs(Integer js) {
this.js = js;
}
public String getFolderLocation() {
return folderLocation;
}
public void setFolderLocation(String folderLocation) {
this.folderLocation = folderLocation;
}
public String getMaintitle() {
return maintitle;
}
public void setMaintitle(String maintitle) {
this.maintitle = maintitle;
}
public String getSecurityClass() {
return securityClass;
}
public void setSecurityClass(String securityClass) {
this.securityClass = securityClass;
}
public String getSecurityClassCode() {
return securityClassCode;
}
public void setSecurityClassCode(String securityClassCode) {
this.securityClassCode = securityClassCode;
}
public String getFondsNo() {
return fondsNo;
}
public void setFondsNo(String fondsNo) {
this.fondsNo = fondsNo;
}
public String getFondsNoCode() {
return fondsNoCode;
}
public void setFondsNoCode(String fondsNoCode) {
this.fondsNoCode = fondsNoCode;
}
public Integer getFilingYear() {
return filingYear;
}
public void setFilingYear(Integer filingYear) {
this.filingYear = filingYear;
}
public String getRetention() {
return retention;
}
public void setRetention(String retention) {
this.retention = retention;
}
public String getRetentionCode() {
return retentionCode;
}
public void setRetentionCode(String retentionCode) {
this.retentionCode = retentionCode;
}
public String getArchiveCtgNo() {
return archiveCtgNo;
}
public void setArchiveCtgNo(String archiveCtgNo) {
this.archiveCtgNo = archiveCtgNo;
}
public String getArchiveCtgNoCode() {
return archiveCtgNoCode;
}
public void setArchiveCtgNoCode(String archiveCtgNoCode) {
this.archiveCtgNoCode = archiveCtgNoCode;
}
public String getYearFolderNo() {
return yearFolderNo;
}
public void setYearFolderNo(String yearFolderNo) {
this.yearFolderNo = yearFolderNo;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public String getDocStartTime() {
return docStartTime;
}
public void setDocStartTime(String docStartTime) {
this.docStartTime = docStartTime;
}
public String getDocEndTime() {
return docEndTime;
}
public void setDocEndTime(String docEndTime) {
this.docEndTime = docEndTime;
}
public String getSbtWord() {
return sbtWord;
}
public void setSbtWord(String sbtWord) {
this.sbtWord = sbtWord;
}
public String getPigeonholeDate() {
return pigeonholeDate;
}
public void setPigeonholeDate(String pigeonholeDate) {
this.pigeonholeDate = pigeonholeDate;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getMlh() {
return mlh;
}
public void setMlh(String mlh) {
this.mlh = mlh;
}
public String getSssq() {
return sssq;
}
public void setSssq(String sssq) {
this.sssq = sssq;
}
public String getSssqCode() {
return sssqCode;
}
public void setSssqCode(String sssqCode) {
this.sssqCode = sssqCode;
}
public String getDagdm() {
return dagdm;
}
public void setDagdm(String dagdm) {
this.dagdm = dagdm;
}
public String getDagdmCode() {
return dagdmCode;
}
public void setDagdmCode(String dagdmCode) {
this.dagdmCode = dagdmCode;
}
public String getZqbs() {
return zqbs;
}
public void setZqbs(String zqbs) {
this.zqbs = zqbs;
}
public String getZqbsCode() {
return zqbsCode;
}
public void setZqbsCode(String zqbsCode) {
this.zqbsCode = zqbsCode;
}
public String getKzbs() {
return kzbs;
}
public void setKzbs(String kzbs) {
this.kzbs = kzbs;
}
public String getKzbsCode() {
return kzbsCode;
}
public void setKzbsCode(String kzbsCode) {
this.kzbsCode = kzbsCode;
}
public String getDamldm() {
return damldm;
}
public void setDamldm(String damldm) {
this.damldm = damldm;
}
public String getDamldmCode() {
return damldmCode;
}
public void setDamldmCode(String damldmCode) {
this.damldmCode = damldmCode;
}
public String getCreatePerson() {
return createPerson;
}
public void setCreatePerson(String createPerson) {
this.createPerson = createPerson;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getArchiveFlag() {
return archiveFlag;
}
public void setArchiveFlag(String archiveFlag) {
this.archiveFlag = archiveFlag;
}
public String getIsPackeep() {
return isPackeep;
}
public void setIsPackeep(String isPackeep) {
this.isPackeep = isPackeep;
}
public String getIsPackeepCode() {
return isPackeepCode;
}
public void setIsPackeepCode(String isPackeepCode) {
this.isPackeepCode = isPackeepCode;
}
public String getMd5Code() {
return md5Code;
}
public void setMd5Code(String md5Code) {
this.md5Code = md5Code;
}
public String getMd5CheckDate() {
return md5CheckDate;
}
public void setMd5CheckDate(String md5CheckDate) {
this.md5CheckDate = md5CheckDate;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
public String getBatchName() {
return batchName;
}
public void setBatchName(String batchName) {
this.batchName = batchName;
}
public String getBackToUpdateState() {
return backToUpdateState;
}
public void setBackToUpdateState(String backToUpdateState) {
this.backToUpdateState = backToUpdateState;
}
public Integer getIsProcess() {
return isProcess;
}
public void setIsProcess(Integer isProcess) {
this.isProcess = isProcess;
}
public String getArchiveEntityStatus() {
return archiveEntityStatus;
}
public void setArchiveEntityStatus(String archiveEntityStatus) {
this.archiveEntityStatus = archiveEntityStatus;
}
}

View File

@@ -0,0 +1,514 @@
package com.point.strategy.docTraditionArrange.docFile.controller;
import com.bstek.ureport.Utils;
import com.bstek.ureport.export.ExportConfigure;
import com.bstek.ureport.export.ExportConfigureImpl;
import com.bstek.ureport.export.ExportManager;
import com.github.pagehelper.PageInfo;
import com.point.strategy.common.AjaxJson;
import com.point.strategy.common.FileUtil;
import com.point.strategy.docTraditionArrange.docFile.bean.DocFileOriginalEntity;
import com.point.strategy.docTraditionArrange.docFile.bean.DocTraditionArrangeFile;
import com.point.strategy.docTraditionArrange.docFile.service.DocTraditionFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
@RequestMapping("/v/docFile")
@Api(tags = "文书传统整理-案卷", value = "DocFileController")
public class DocTraditionFileController {
private static final Logger logger = LoggerFactory.getLogger(DocTraditionFileController.class);
@Autowired
private DocTraditionFileService docTraditionFileService;
@RequestMapping(value="/getDocFileWithPage" , method= RequestMethod.POST)
@ApiOperation(value = "分页查询传统方法整理案卷信息")
public AjaxJson getDocFileWithPage(
String folderNo,
String maintitle,
String filingYear,
String fondsNo,
String fondsNoCode,
Integer page,
Integer limit
) {
AjaxJson json = null;
try {
DocTraditionArrangeFile docTraditionArrangeFile = new DocTraditionArrangeFile();
docTraditionArrangeFile.setFondsNo(fondsNo);
docTraditionArrangeFile.setFondsNoCode(fondsNoCode);
docTraditionArrangeFile.setFolderNo(folderNo);
docTraditionArrangeFile.setMaintitle(maintitle);
if (filingYear!=null && !"".equals(filingYear)){
docTraditionArrangeFile.setFilingYear(Integer.parseInt(filingYear));
}
if(page!=null) {
docTraditionArrangeFile.setPage(page);
}
if(limit!=null) {
docTraditionArrangeFile.setLimit(limit);
}
List list = docTraditionFileService.getDocFileWithPage(docTraditionArrangeFile);
PageInfo pageInfo = new PageInfo(list);
long total = pageInfo.getTotal();
json = new AjaxJson();
json.put("list", list);
json.put("total", total);
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("分页查询传统方法整理案卷信息失败"+e);
}
return json;
}
@RequestMapping(value="/saveDocFile" , method= RequestMethod.POST)
@ApiOperation(value = "保存传统方法整理案卷信息")
public AjaxJson saveDocFile(@RequestBody DocTraditionArrangeFile docTraditionArrangeFile) {
AjaxJson json = null;
try {
docTraditionArrangeFile.setFileStatus(1);
int num = docTraditionFileService.saveDocFile(docTraditionArrangeFile);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("保存传统方法整理案卷信息失败"+e);
}
return json;
}
@RequestMapping(value="/deleteDocFile" , method= RequestMethod.POST)
@ApiOperation(value = "删除传统方法整理案卷信息批量删除用逗号隔开id值")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "ids", value = "逗号拼接的id字符串", required = true, dataType = "String"),
})
public AjaxJson deleteDocFile(String ids) {
AjaxJson json = null;
try {
int num = docTraditionFileService.deleteDocFile(ids);
json = AjaxJson.returnInfo("成功删除"+num+"条记录");
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("删除传统方法整理案卷信息失败"+e);
}
return json;
}
@RequestMapping(value="/updateDocFile" , method= RequestMethod.POST)
@ApiOperation(value = "修改传统方法整理案卷信息")
public AjaxJson updateDocFile(@RequestBody DocTraditionArrangeFile docTraditionArrangeFile) {
AjaxJson json = null;
try {
docTraditionFileService.updateDocFile(docTraditionArrangeFile);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("修改传统方法整理案卷信息失败"+e);
}
return json;
}
@RequestMapping(value="/downLoadDocFilePdf" , method= RequestMethod.GET)
@ApiOperation(value = "导出文书传统案卷pdf文件(预览)")
public void downLoadPdf(HttpServletRequest request, HttpServletResponse response,String fileName) throws Exception {
request.setCharacterEncoding("UTF-8");
//String fileName = "创建文书传统案卷pdf文件.pdf";
String dir = request.getRealPath("/")+"pdffile";
String downLoadPath = dir+File.separator+fileName+".pdf";
response.setContentType("application/pdf");
FileInputStream in = new FileInputStream(new File(downLoadPath));
OutputStream out = response.getOutputStream();
byte[] b = new byte[1024];
while ((in.read(b))!=-1) {
out.write(b);
}
out.flush();
in.close();
out.close();
}
@RequestMapping(value="/downPdfAnjuan" , method= RequestMethod.GET)
@ApiOperation(value = "导出文书传统案卷pdf文件")
public void downPdfAnjuan(HttpServletRequest request, HttpServletResponse response,String fileName) throws Exception {
request.setCharacterEncoding("UTF-8");
String dir = request.getRealPath("/")+"pdffile";
String downLoadPath = dir+File.separator+fileName+".pdf";
FileUtil.download(downLoadPath,response);
}
@RequestMapping(value="/createDocFilePdf" , method= RequestMethod.GET)
@ApiOperation(value = "创建文书传统案卷pdf文件")
public AjaxJson createDocFilePdf(HttpServletRequest request,String fondsNo,String fondsNoCode,String fileName,String ids) throws IOException {
AjaxJson json = null;
Map<String, Object> map = new HashMap<String, Object>();
map.put("fondsNo",fondsNo);
map.put("fondsNoCode",fondsNoCode);
map.put("ids",ids);
OutputStream outputStream = null;
try {
//String fileName = "文书案卷.pdf";
String dir = request.getRealPath("/")+"pdffile";
File file = new File(dir);
//如果文件夹不存在则创建
if (!file.exists() && !file.isDirectory()) {
file.mkdir();
}
outputStream = new FileOutputStream(new File(dir+File.separator+fileName+".pdf"));
ExportConfigure config = new ExportConfigureImpl("file:" + "wenshu_anjuan.ureport.xml", map, outputStream);
ExportManager exportManager = (ExportManager) Utils.getApplicationContext().getBean(ExportManager.BEAN_ID);
exportManager.exportPdf(config);
json = new AjaxJson();
}catch (Exception e) {
json = AjaxJson.returnExceptionInfo("创建文书传统案卷pdf文件信息失败"+e);
e.printStackTrace();
}
return json;
}
/*
@RequestMapping(value="/uploadDocFiles",method=RequestMethod.POST)
@ApiOperation(value = "原文单个或者批量上传")
//file要与表单上传的名字相同
public AjaxJson uploadFiles(MultipartFile[] file, Integer recId,String fondscode,HttpServletRequest request) {
AjaxJson json = null;
try {
//创建文件在服务器端存放路径
String dir = request.getServletContext().getRealPath("/"+fondscode);
File fileDir = new File(dir);
if(!fileDir.exists()) {
fileDir.mkdirs();
}
//生成文件在服务器端存放的名字
for(int i=0;i<file.length;i++) {
DocFileOriginalEntity docFileOriginalEntity = new DocFileOriginalEntity();
String originalFilename = file[i].getOriginalFilename();
int index = originalFilename.lastIndexOf(".")+1;
String fileType = originalFilename.substring(index);
docFileOriginalEntity.setFileName(originalFilename);
docFileOriginalEntity.setRecid(recId);
docFileOriginalEntity.setFileType(fileType);
long fileLen = file[i].getSize()/1024;
docFileOriginalEntity.setFileLen((float)fileLen);
docFileOriginalEntity.setFilePath(dir);
int pageNo = docTraditionFileService.getDocFileOriginalEntityCount(recId)+1;
docFileOriginalEntity.setPageNo(pageNo);
docFileOriginalEntity.setFileStatus(1);
docFileOriginalEntity.setIsDivided(-1);
if(pageNo<10)
docFileOriginalEntity.setFileNameServer(fondscode+".000"+pageNo+"."+fileType);
else if(10<=pageNo && pageNo<100)
docFileOriginalEntity.setFileNameServer(fondscode+".00"+pageNo+"."+fileType);
else if(100<=pageNo && pageNo<1000)
docFileOriginalEntity.setFileNameServer(fondscode+".0"+pageNo+"."+fileType);
else
docFileOriginalEntity.setFileNameServer(fondscode+"."+pageNo+"."+fileType);
docTraditionFileService.saveDocFileOriginalEntity(docFileOriginalEntity);
//String fileSuffix = originalFilename.substring(index);
//String fileName= UUID.randomUUID().toString()+fileSuffix;
File files = new File(fileDir+"/"+ docFileOriginalEntity.getFileNameServer());
//上传
file[i].transferTo(files);
}
json = AjaxJson.returnInfo("上传文件成功");
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("上传文件失败失败"+e);
}
return json;
}
*/
@RequestMapping(value="/queryDocFileOriginalEntity" , method= RequestMethod.POST)
@ApiOperation(value = "查询原文信息")
public AjaxJson queryDocFileOriginalEntity(@RequestParam(value = "recId",required = true)Integer recId) {
AjaxJson json = null;
try {
List list = docTraditionFileService.queryDocFileOriginalEntity(recId);
json = new AjaxJson();
json.put("list", list);
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("查询原文信息失败"+e);
}
return json;
}
@RequestMapping(value="/updateDocFileOriginalEntity" , method= RequestMethod.POST)
@ApiOperation(value = "原文入回收站")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "ids", value = "原文主键ids", required = true, dataType = "String"),
})
public AjaxJson updateDocFileOriginalEntity(@RequestParam(value = "ids",required = true) String ids) {
AjaxJson json = null;
try {
String[] idAarray=ids.split(",");
for (String id:idAarray) {
docTraditionFileService.updateDocFileOriginalEntity(Integer.parseInt(id));
}
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("原文入回收站失败"+e);
}
return json;
}
@RequestMapping(value="/queryDocFileOriginalList" , method= RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(name = "recId", example = "1", value = "recId", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "fileStatus", example = "1", value = "文件状态1-上传文件数据2-回收站数据)", dataType = "String", paramType = "query"),
})
@ApiOperation(value = "查询案卷原文文件列表信息")
public AjaxJson queryDocFileOriginalList(
@RequestParam(value = "recId",required = true)Integer recId,
@RequestParam(value = "fileStatus",required = true)Integer fileStatus
) {
AjaxJson json = null;
try {
Map<String,Object> map=new HashMap<>();
map.put("recId",recId);
map.put("fileStatus",fileStatus);
List list = docTraditionFileService.queryDocFileOriginalEntityRecycle(map);
json = new AjaxJson();
json.put("list", list);
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("查询原文信息失败"+e);
}
return json;
}
@RequestMapping(value="/updateDocFileOriginalEntityRecycle" , method= RequestMethod.POST)
@ApiOperation(value = "原文回收站恢复")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "id", value = "原文主键id", required = true, dataType = "String"),
})
public AjaxJson updateDocFileOriginalEntityRecycle(Integer id) {
AjaxJson json = null;
try {
docTraditionFileService.updateDocFileOriginalEntityRecycle(id);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("原文回收站恢复失败"+e);
}
return json;
}
@RequestMapping(value="/deleteDocFileOriginalEntityRecycle" , method= RequestMethod.POST)
@ApiOperation(value = "删除原文回收站批量删除用逗号隔开id值")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "ids", value = "逗号拼接的id字符串", required = true, dataType = "String"),
})
public AjaxJson deleteDocFileOriginalEntityRecycle(String ids) {
AjaxJson json = null;
try {
int num = docTraditionFileService.deleteDocFileOriginalEntityRecycle(ids);
json = AjaxJson.returnInfo("成功删除"+num+"条记录");
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("删除原文回收站信息失败"+e);
}
return json;
}
@RequestMapping(value="/downloadDocFileExcelTemplate" , method= RequestMethod.GET)
@ApiOperation(value = "下载文书传统整理案卷excel模板")
public void downloadExcelTemplate(HttpServletResponse response)throws Exception{
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.reset();
response.setContentType("application/x-msdownload; charset=utf-8");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = new String("文书传统整理模板".getBytes("utf-8"),"utf-8")+sdf.format(new Date())+".xls";
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
String[] columnsTitle = {"案卷级档号","总件数","存放位置","题名","密级","密级代码","全宗名称","全宗号",
"归档年度","保管期限","保管期限代码","实体分类号","实体分类号代码","案卷号","总页数","文件形成开始时间",
"文件形成结束时间","关键字","归档日期","备注","目录号","sssq","sssq_code","档案馆",
"档案馆代码","zqbs","zqbs_code","控制标识","控制标识代码","档案门类","档案门类代码","录入人",
"录入日期","组卷标识","是否打eep包","是否打eep包代码","加密代码","加密检测日期","batch_id","batch_name",
"back_to_update_state","is_process","archive_entity_status"};
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("文书传统整理案卷模板");
HSSFRow row = sheet.createRow(0);
for(int i=0;i<columnsTitle.length;i++) {
HSSFCell cell = row.createCell(i);
sheet.setColumnWidth(i, 3766);
cell.setCellValue(columnsTitle[i]);
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
wb.write(bos);
response.setHeader("Content-Length", bos.toByteArray().length+"");
bos.writeTo(response.getOutputStream());
response.flushBuffer();
}
/**
* 传统-案卷
* @param response
* @param fondsNoCode
* @throws Exception
*/
@RequestMapping(value="/downloadDocFileExcel" , method= RequestMethod.GET)
@ApiOperation(value = "下载文书传统整理Excel")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "fondsNoCode", value = "全宗号代码", dataType = "String"),
})
public void downloadExcel(HttpServletResponse response,String fondsNoCode,String ids)throws Exception{
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.reset();
response.setContentType("application/x-msdownload; charset=utf-8");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = new String("文书案卷目录".getBytes("utf-8"),"ISO-8859-1")+sdf.format(new Date())+".xls";
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
String[] columnsTitle = {"案卷级档号","总件数","存放位置","题名",
"密级", "全宗号","归档年度",
"保管期限","实体分类号","案卷号",
"文件开始时间", "文件结束时间",
"主题词","归档日期","备注","目录号",
"档案所属历史时期", "档案馆代码","政权标识",
"控制标识","档案门类代码","档案实体状态"};
String fieldName = "folder_no,js,folder_location,maintitle," +
"security_class,fonds_no,filing_year," +
"retention,archive_ctg_no,year_folder_no," +
"doc_start_time,doc_end_time," +
"maintitle,filing_year,note,mlh," +
"pigeonhole_date,dagdm,zqbs," +
"kzbs,damldm,archive_entity_status";
String cols[] = fieldName.split(",");
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("文书传统整理");
HSSFRow row = sheet.createRow(0);
for(int i=0;i<cols.length;i++) {
HSSFCell cell = row.createCell(i);
sheet.setColumnWidth(i, 3766);
cell.setCellValue(columnsTitle[i]);
}
List<String> idsList=new ArrayList<>();
if (ids!=null && !"".equals(ids)){
String[] idArray=ids.split(",");
for (String id:idArray) {
idsList.add(id);
}
}
DocTraditionArrangeFile docTraditionArrangeFile = new DocTraditionArrangeFile();
docTraditionArrangeFile.setFondsNoCode(fondsNoCode);
docTraditionArrangeFile.setIdsList(idsList);
List list = docTraditionFileService.getDocFileWithPage(docTraditionArrangeFile);
for (int i = 0; i < list.size(); i++) {
HSSFRow rowi = sheet.createRow(i + 1);
rowi.createCell(0).setCellValue(((DocTraditionArrangeFile)list.get(i)).getFolderNo());
rowi.createCell(1).setCellValue(((DocTraditionArrangeFile)list.get(i)).getJs());
rowi.createCell(2).setCellValue(((DocTraditionArrangeFile)list.get(i)).getFolderLocation());
rowi.createCell(3).setCellValue(((DocTraditionArrangeFile)list.get(i)).getMaintitle());
rowi.createCell(4).setCellValue(((DocTraditionArrangeFile)list.get(i)).getSecurityClass());
rowi.createCell(5).setCellValue(((DocTraditionArrangeFile)list.get(i)).getFondsNo());
rowi.createCell(6).setCellValue(((DocTraditionArrangeFile)list.get(i)).getFilingYear());
rowi.createCell(7).setCellValue(((DocTraditionArrangeFile)list.get(i)).getRetention());
rowi.createCell(8).setCellValue(((DocTraditionArrangeFile)list.get(i)).getArchiveCtgNo());
rowi.createCell(9).setCellValue(((DocTraditionArrangeFile)list.get(i)).getYearFolderNo());
rowi.createCell(10).setCellValue(((DocTraditionArrangeFile)list.get(i)).getDocStartTime());
rowi.createCell(11).setCellValue(((DocTraditionArrangeFile)list.get(i)).getDocEndTime());
rowi.createCell(12).setCellValue(((DocTraditionArrangeFile)list.get(i)).getMaintitle());
rowi.createCell(13).setCellValue(((DocTraditionArrangeFile)list.get(i)).getFilingYear());
rowi.createCell(14).setCellValue(((DocTraditionArrangeFile)list.get(i)).getNote());
rowi.createCell(15).setCellValue(((DocTraditionArrangeFile)list.get(i)).getMlh());
rowi.createCell(16).setCellValue(((DocTraditionArrangeFile)list.get(i)).getDocEndTime());
rowi.createCell(17).setCellValue(((DocTraditionArrangeFile)list.get(i)).getSbtWord());
rowi.createCell(18).setCellValue(((DocTraditionArrangeFile)list.get(i)).getPigeonholeDate());
rowi.createCell(19).setCellValue(((DocTraditionArrangeFile)list.get(i)).getKzbs());
rowi.createCell(20).setCellValue(((DocTraditionArrangeFile)list.get(i)).getDamldm());
rowi.createCell(21).setCellValue(((DocTraditionArrangeFile)list.get(i)).getArchiveEntityStatus());
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
wb.write(bos);
response.setHeader("Content-Length", bos.toByteArray().length+"");
bos.writeTo(response.getOutputStream());
response.flushBuffer();
}
@RequestMapping(value="/saveBatchDocFiles" , method= RequestMethod.POST)
@ApiOperation(value = "批量上传文书传统excel数据")
public AjaxJson saveBatchDocFiles(@RequestParam("file") MultipartFile file)throws Exception {
AjaxJson json = null;
try {
docTraditionFileService.saveBatchDocFiles(file);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("批量上传文书传统整理失败"+e);
}
return json;
}
@RequestMapping(value="/updateTempFile" , method= RequestMethod.POST)
@ApiOperation(value = "更新文书传统案卷原文文件")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", example = "1,2", value = "支持批量操作,多个用逗号隔开", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "fileStatus", example = "1", value = "文件状态1-上传文件数据2-回收站数据)", dataType = "String", paramType = "query"),
})
public AjaxJson updateTempFile(@RequestParam(value = "ids",required = true)String ids,
@RequestParam(value = "fileStatus",required = true)Integer fileStatus
) {
AjaxJson json = null;
try {
String[] idArray= ids.split(",");
for (String id:idArray) {
DocFileOriginalEntity entity=new DocFileOriginalEntity();
entity.setId(Integer.parseInt(id));
entity.setFileStatus(fileStatus);
docTraditionFileService.updateTempFile(entity);
json = new AjaxJson();
}
DocFileOriginalEntity entity=docTraditionFileService.selectFileOneById(Integer.parseInt(idArray[0]));
docTraditionFileService.wsajmlTempCount(entity.getRecid());
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("更新文书传统案卷原文文件失败"+e);
}
return json;
}
}

View File

@@ -0,0 +1,30 @@
package com.point.strategy.docTraditionArrange.docFile.mapper;
import com.point.strategy.docTraditionArrange.docFile.bean.DocFileOriginalEntity;
import com.point.strategy.docTraditionArrange.docFile.bean.DocTraditionArrangeFile;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface DocTraditionFileMapper {
public List<DocTraditionArrangeFile> getDocFileWithPage(DocTraditionArrangeFile DocTraditionArrangeFile);
public int saveDocFile(DocTraditionArrangeFile DocTraditionArrangeFile);
public int deleteDocFile(Integer id);
public int deleteDocFileCascadeRecycle(Integer recId);
public int updateDocFile(DocTraditionArrangeFile DocTraditionArrangeFile);
public int getDocFileOriginalEntityCount(Integer recId);
public void saveDocFileOriginalEntity(DocFileOriginalEntity docFileOriginalEntity);
public List<DocTraditionArrangeFile> queryDocFileOriginalEntity(Integer recId);
public void updateDocFileOriginalEntity(Integer id);
public List<DocFileOriginalEntity> queryDocFileOriginalEntityRecycle(Map<String,Object> map);
public void updateDocFileOriginalEntityRecycle(Integer id);
public int deleteDocFileOriginalEntityRecycle(Integer id);
public void saveBatchDocFiles(Map map);
//案卷-更新文书传统案卷原文文件
public void updateTempFile(DocFileOriginalEntity entity);
//案卷-更新档案文件数量
public void wsajmlTempCount(Integer id);
//案卷-查询文件对象
public DocFileOriginalEntity selectFileOneById(Integer id);
}

View File

@@ -0,0 +1,196 @@
package com.point.strategy.docTraditionArrange.docFile.service;
import com.github.pagehelper.PageHelper;
import com.point.strategy.docTraditionArrange.docFile.bean.DocTraditionArrangeFile;
import com.point.strategy.docTraditionArrange.docFile.bean.DocFileOriginalEntity;
import com.point.strategy.docTraditionArrange.docFile.mapper.DocTraditionFileMapper;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component("docTraditionFileService")
@Transactional
public class DocTraditionFileService {
//@Autowired
@Resource
public DocTraditionFileMapper docTraditionFileMapper;
public List getDocFileWithPage(DocTraditionArrangeFile docTraditionArrangeFile) {
PageHelper.startPage(docTraditionArrangeFile.getPage(), docTraditionArrangeFile.getLimit());
List docFiles= docTraditionFileMapper.getDocFileWithPage(docTraditionArrangeFile);
return docFiles;
}
public int saveDocFile(DocTraditionArrangeFile docTraditionArrangeFile) {
return docTraditionFileMapper.saveDocFile(docTraditionArrangeFile);
}
public int deleteDocFile(String ids) {
int num = 0;
if(ids!=null && !"".equals(ids) && ids.length()>0){
String id[] = ids.split(",");
for(int i=0;i<id.length;i++){
String index = id[i];
Integer t = Integer.valueOf(index);
int j = docTraditionFileMapper.deleteDocFile(t);
docTraditionFileMapper.deleteDocFileCascadeRecycle(t);
if(j>0) {
num = num + 1;
}
}
}
return num;
}
public int updateDocFile(DocTraditionArrangeFile docTraditionArrangeFile) {
return docTraditionFileMapper.updateDocFile(docTraditionArrangeFile);
}
//删除卷内文件
public int deleteDocFileCascadeRecycle(Integer recid) {
return docTraditionFileMapper.deleteDocFileCascadeRecycle(recid);
}
//下载文件url写法http://localhost:8081/ureport/pdf?_u=file:rr.ureport.xml&name=du,name值在第三个参数map里面
public List docFilePdf(String dataSourceName,String dataSetName,Map paramMap) {
DocTraditionArrangeFile docTraditionArrangeFile = new DocTraditionArrangeFile();
docTraditionArrangeFile.setFondsNo((String)paramMap.get("fondsNo"));
docTraditionArrangeFile.setFondsNoCode((String)paramMap.get("fondsNoCode"));
List docFiles= docTraditionFileMapper.getDocFileWithPage(docTraditionArrangeFile);
return docFiles;
}
public int getDocFileOriginalEntityCount(Integer recId) {
return docTraditionFileMapper.getDocFileOriginalEntityCount(recId);
}
public void saveDocFileOriginalEntity(DocFileOriginalEntity docFileOriginalEntity) {
docTraditionFileMapper.saveDocFileOriginalEntity(docFileOriginalEntity);
}
public List queryDocFileOriginalEntity(Integer recId) {
return docTraditionFileMapper.queryDocFileOriginalEntity(recId);
}
public void updateDocFileOriginalEntity(Integer id){
docTraditionFileMapper.updateDocFileOriginalEntity(id);
}
public List queryDocFileOriginalEntityRecycle(Map<String,Object> map) {
return docTraditionFileMapper.queryDocFileOriginalEntityRecycle(map);
}
public void updateDocFileOriginalEntityRecycle(Integer id){
docTraditionFileMapper.updateDocFileOriginalEntityRecycle(id);
}
public int deleteDocFileOriginalEntityRecycle(String ids) {
int num = 0;
if(ids!=null && !"".equals(ids) && ids.length()>0){
String id[] = ids.split(",");
for(int i=0;i<id.length;i++){
String index = id[i];
Integer t = Integer.valueOf(index);
int j = docTraditionFileMapper.deleteDocFileOriginalEntityRecycle(t);
if(j>0) {
num = num + 1;
}
}
}
return num;
}
public void saveBatchDocFiles(MultipartFile file)throws Exception {
String tableName = "wsajml_20201104084106585_temp";
String fieldName = "folder_no," +
"js," +
"folder_location," +
"maintitle," +
"security_class," +
"security_class_code," +
"fonds_no," +
"fonds_no_code," +
"filing_year," +
"retention," +
"retention_code," +
"archive_ctg_no," +
"archive_ctg_no_code," +
"year_folder_no," +
"quantity," +
"doc_start_time," +
"doc_end_time," +
"sbt_word," +
"pigeonhole_date," +
"note," +
"mlh," +
"sssq," +
"sssq_code," +
"dagdm," +
"dagdm_code," +
"zqbs," +
"zqbs_code," +
"kzbs," +
"kzbs_code," +
"damldm," +
"damldm_code," +
"create_person," +
"create_date," +
"archive_flag," +
"is_packeep," +
"is_packeep_code," +
"md5_code," +
"md5_check_date," +
"batch_id," +
"batch_name," +
"back_to_update_state," +
"is_process," +
"archive_entity_status";
InputStream in = file.getInputStream();
Workbook boxExcel = Workbook.getWorkbook(in);
Sheet boxSheet = boxExcel.getSheet(0);
for (int i = 1; i < boxSheet.getRows(); i++) {
StringBuffer valueNameBuffer = new StringBuffer();
Map map = new HashMap();
for (int j = 0; j <boxSheet.getColumns(); j++) {
Cell boxCell = boxSheet.getCell(j, i);
String val = boxCell.getContents();
// if("".equals(val))val=null; SQL语句需要加上'(单引号)
if(j==0)valueNameBuffer.append("'"+val+"'");
else valueNameBuffer.append(",'"+val+"'");
}
String valueName = valueNameBuffer.toString();
map.put("tableName", tableName);
map.put("fieldName", fieldName);
map.put("valueName", valueName);
docTraditionFileMapper.saveBatchDocFiles(map);
}
}
/**
* 更新文书传统案卷原文文件
* @param entity
*/
public void updateTempFile(DocFileOriginalEntity entity){
docTraditionFileMapper.updateTempFile(entity);
}
//更新档案文件数量
public void wsajmlTempCount(Integer id){
docTraditionFileMapper.wsajmlTempCount(id);
}
//案卷-查询文件对象
public DocFileOriginalEntity selectFileOneById(Integer id){
return docTraditionFileMapper.selectFileOneById(id);
}
}

View File

@@ -0,0 +1,533 @@
package com.point.strategy.docTraditionArrange.docVolume.bean;
import com.point.strategy.common.PageBean;
import java.io.Serializable;
import java.util.List;
public class DocTraditionArrangeVolume extends PageBean implements Serializable {
private Integer id = 0;
private Integer archiveFileNum = 0;
private String archiveNo;
private String folderNo;
private String maintitle;
private String createdDate;
private String docNo;
private String securityClass;
private String securityClassCode;
private String fondsNo;
private String fondsNoCode;
private String retention;
private String retentionCode;
private Integer filingYear = 0 ;
private String archiveCtgNo;
private String archiveCtgNoCode;
private String yearFolderNo;
private Integer pageNo = 0;
private Integer pieceNo = 0;
private Integer quantity = 0;
private String responsibleby;
private String sbtWord;
private String folderLocation;
private String pigeonholeDate;
private String note;
private Integer objectQuantity = 0;
private String pageNoEnd;
private String mlh;
private String sssq;
private String sssqCode;
private String dagdm;
private String dagdmCode;
private String zqbs;
private String zqbsCode;
private String kzbs;
private String kzbsCode;
private String damldm;
private String damldmCode;
private String reportPage;
private String pid;
private String createPerson;
private String createDate;
private String archiveFlag;
private String isPackeep;
private String isPackeepCode;
private String md5Code;
private String md5CheckDate;
private String batchId;
private String batchName;
private String backToUpdateState;
private Integer isProcess = 0;
private String archiveEntityStatus;
private String archiveZjbs;
private String tempNo;
//部门编码
private String departnameCode;
//部门名称
private String departname;
private Integer fileStatus;
public Integer getFileStatus() {
return fileStatus;
}
public void setFileStatus(Integer fileStatus) {
this.fileStatus = fileStatus;
}
private List<String> idsList;
public List<String> getIdsList() {
return idsList;
}
public void setIdsList(List<String> idsList) {
this.idsList = idsList;
}
public String getDepartnameCode() {
return departnameCode;
}
public void setDepartnameCode(String departnameCode) {
this.departnameCode = departnameCode;
}
public String getDepartname() {
return departname;
}
public void setDepartname(String departname) {
this.departname = departname;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getArchiveFileNum() {
return archiveFileNum;
}
public void setArchiveFileNum(Integer archiveFileNum) {
this.archiveFileNum = archiveFileNum;
}
public String getFolderNo() {
return folderNo;
}
public void setFolderNo(String folderNo) {
this.folderNo = folderNo;
}
public String getFolderLocation() {
return folderLocation;
}
public void setFolderLocation(String folderLocation) {
this.folderLocation = folderLocation;
}
public String getMaintitle() {
return maintitle;
}
public void setMaintitle(String maintitle) {
this.maintitle = maintitle;
}
public String getSecurityClass() {
return securityClass;
}
public void setSecurityClass(String securityClass) {
this.securityClass = securityClass;
}
public String getSecurityClassCode() {
return securityClassCode;
}
public void setSecurityClassCode(String securityClassCode) {
this.securityClassCode = securityClassCode;
}
public String getFondsNo() {
return fondsNo;
}
public void setFondsNo(String fondsNo) {
this.fondsNo = fondsNo;
}
public String getFondsNoCode() {
return fondsNoCode;
}
public void setFondsNoCode(String fondsNoCode) {
this.fondsNoCode = fondsNoCode;
}
public Integer getFilingYear() {
return filingYear;
}
public void setFilingYear(Integer filingYear) {
this.filingYear = filingYear;
}
public String getRetention() {
return retention;
}
public void setRetention(String retention) {
this.retention = retention;
}
public String getRetentionCode() {
return retentionCode;
}
public void setRetentionCode(String retentionCode) {
this.retentionCode = retentionCode;
}
public String getArchiveCtgNo() {
return archiveCtgNo;
}
public void setArchiveCtgNo(String archiveCtgNo) {
this.archiveCtgNo = archiveCtgNo;
}
public String getArchiveCtgNoCode() {
return archiveCtgNoCode;
}
public void setArchiveCtgNoCode(String archiveCtgNoCode) {
this.archiveCtgNoCode = archiveCtgNoCode;
}
public String getYearFolderNo() {
return yearFolderNo;
}
public void setYearFolderNo(String yearFolderNo) {
this.yearFolderNo = yearFolderNo;
}
public Integer getQuantity() {
return quantity;
}
public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
public String getSbtWord() {
return sbtWord;
}
public void setSbtWord(String sbtWord) {
this.sbtWord = sbtWord;
}
public String getPigeonholeDate() {
return pigeonholeDate;
}
public void setPigeonholeDate(String pigeonholeDate) {
this.pigeonholeDate = pigeonholeDate;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getMlh() {
return mlh;
}
public void setMlh(String mlh) {
this.mlh = mlh;
}
public String getSssq() {
return sssq;
}
public void setSssq(String sssq) {
this.sssq = sssq;
}
public String getSssqCode() {
return sssqCode;
}
public void setSssqCode(String sssqCode) {
this.sssqCode = sssqCode;
}
public String getDagdm() {
return dagdm;
}
public void setDagdm(String dagdm) {
this.dagdm = dagdm;
}
public String getDagdmCode() {
return dagdmCode;
}
public void setDagdmCode(String dagdmCode) {
this.dagdmCode = dagdmCode;
}
public String getZqbs() {
return zqbs;
}
public void setZqbs(String zqbs) {
this.zqbs = zqbs;
}
public String getZqbsCode() {
return zqbsCode;
}
public void setZqbsCode(String zqbsCode) {
this.zqbsCode = zqbsCode;
}
public String getKzbs() {
return kzbs;
}
public void setKzbs(String kzbs) {
this.kzbs = kzbs;
}
public String getKzbsCode() {
return kzbsCode;
}
public void setKzbsCode(String kzbsCode) {
this.kzbsCode = kzbsCode;
}
public String getDamldm() {
return damldm;
}
public void setDamldm(String damldm) {
this.damldm = damldm;
}
public String getDamldmCode() {
return damldmCode;
}
public void setDamldmCode(String damldmCode) {
this.damldmCode = damldmCode;
}
public String getCreatePerson() {
return createPerson;
}
public void setCreatePerson(String createPerson) {
this.createPerson = createPerson;
}
public String getCreateDate() {
return createDate;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getArchiveFlag() {
return archiveFlag;
}
public void setArchiveFlag(String archiveFlag) {
this.archiveFlag = archiveFlag;
}
public String getIsPackeep() {
return isPackeep;
}
public void setIsPackeep(String isPackeep) {
this.isPackeep = isPackeep;
}
public String getIsPackeepCode() {
return isPackeepCode;
}
public void setIsPackeepCode(String isPackeepCode) {
this.isPackeepCode = isPackeepCode;
}
public String getMd5Code() {
return md5Code;
}
public void setMd5Code(String md5Code) {
this.md5Code = md5Code;
}
public String getMd5CheckDate() {
return md5CheckDate;
}
public void setMd5CheckDate(String md5CheckDate) {
this.md5CheckDate = md5CheckDate;
}
public String getBatchId() {
return batchId;
}
public void setBatchId(String batchId) {
this.batchId = batchId;
}
public String getBatchName() {
return batchName;
}
public void setBatchName(String batchName) {
this.batchName = batchName;
}
public String getBackToUpdateState() {
return backToUpdateState;
}
public void setBackToUpdateState(String backToUpdateState) {
this.backToUpdateState = backToUpdateState;
}
public Integer getIsProcess() {
return isProcess;
}
public void setIsProcess(Integer isProcess) {
this.isProcess = isProcess;
}
public String getArchiveEntityStatus() {
return archiveEntityStatus;
}
public void setArchiveEntityStatus(String archiveEntityStatus) {
this.archiveEntityStatus = archiveEntityStatus;
}
public String getArchiveNo() {
return archiveNo;
}
public void setArchiveNo(String archiveNo) {
this.archiveNo = archiveNo;
}
public String getCreatedDate() {
return createdDate;
}
public void setCreatedDate(String createdDate) {
this.createdDate = createdDate;
}
public String getDocNo() {
return docNo;
}
public void setDocNo(String docNo) {
this.docNo = docNo;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
public String getResponsibleby() {
return responsibleby;
}
public void setResponsibleby(String responsibleby) {
this.responsibleby = responsibleby;
}
public Integer getObjectQuantity() {
return objectQuantity;
}
public void setObjectQuantity(Integer objectQuantity) {
this.objectQuantity = objectQuantity;
}
public String getPageNoEnd() {
return pageNoEnd;
}
public void setPageNoEnd(String pageNoEnd) {
this.pageNoEnd = pageNoEnd;
}
public String getReportPage() {
return reportPage;
}
public void setReportPage(String reportPage) {
this.reportPage = reportPage;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getArchiveZjbs() {
return archiveZjbs;
}
public void setArchiveZjbs(String archiveZjbs) {
this.archiveZjbs = archiveZjbs;
}
public String getTempNo() {
return tempNo;
}
public void setTempNo(String tempNo) {
this.tempNo = tempNo;
}
public Integer getPieceNo() {
return pieceNo;
}
public void setPieceNo(Integer pieceNo) {
this.pieceNo = pieceNo;
}
}

View File

@@ -0,0 +1,199 @@
package com.point.strategy.docTraditionArrange.docVolume.bean;
public class DocVolumeOriginalEntity {
private Integer id;
private Integer entityId;
private Integer recid;
private String fileName;
private String fileNameServer;
private String fileType;
private Float fileLen;
private String filePath;
private String openType;
private Integer pageNo;
private String version;
private String authorName;
private String fileRemark;
private String fileDes;
private Integer downs;
private Integer veiws;
private String metadataValue;
private Integer metadataType;
private Integer ocrCheck;
private Integer fileStatus;
private Integer fileAttr;
private String md5Code;
private String md5CheckDate;
private String dataContent;
private String fileContent;
private Integer isDivided;
private String dividedContent;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getEntityId() {
return entityId;
}
public void setEntityId(Integer entityId) {
this.entityId = entityId;
}
public Integer getRecid() {
return recid;
}
public void setRecid(Integer recid) {
this.recid = recid;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFileNameServer() {
return fileNameServer;
}
public void setFileNameServer(String fileNameServer) {
this.fileNameServer = fileNameServer;
}
public String getFileType() {
return fileType;
}
public void setFileType(String fileType) {
this.fileType = fileType;
}
public Float getFileLen() {
return fileLen;
}
public void setFileLen(Float fileLen) {
this.fileLen = fileLen;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getOpenType() {
return openType;
}
public void setOpenType(String openType) {
this.openType = openType;
}
public Integer getPageNo() {
return pageNo;
}
public void setPageNo(Integer pageNo) {
this.pageNo = pageNo;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getAuthorName() {
return authorName;
}
public void setAuthorName(String authorName) {
this.authorName = authorName;
}
public String getFileRemark() {
return fileRemark;
}
public void setFileRemark(String fileRemark) {
this.fileRemark = fileRemark;
}
public String getFileDes() {
return fileDes;
}
public void setFileDes(String fileDes) {
this.fileDes = fileDes;
}
public Integer getDowns() {
return downs;
}
public void setDowns(Integer downs) {
this.downs = downs;
}
public Integer getVeiws() {
return veiws;
}
public void setVeiws(Integer veiws) {
this.veiws = veiws;
}
public String getMetadataValue() {
return metadataValue;
}
public void setMetadataValue(String metadataValue) {
this.metadataValue = metadataValue;
}
public Integer getMetadataType() {
return metadataType;
}
public void setMetadataType(Integer metadataType) {
this.metadataType = metadataType;
}
public Integer getOcrCheck() {
return ocrCheck;
}
public void setOcrCheck(Integer ocrCheck) {
this.ocrCheck = ocrCheck;
}
public Integer getFileStatus() {
return fileStatus;
}
public void setFileStatus(Integer fileStatus) {
this.fileStatus = fileStatus;
}
public Integer getFileAttr() {
return fileAttr;
}
public void setFileAttr(Integer fileAttr) {
this.fileAttr = fileAttr;
}
public String getMd5Code() {
return md5Code;
}
public String getDividedContent() {
return dividedContent;
}
public void setDividedContent(String dividedContent) {
this.dividedContent = dividedContent;
}
public void setMd5Code(String md5Code) {
this.md5Code = md5Code;
}
public String getMd5CheckDate() {
return md5CheckDate;
}
public void setMd5CheckDate(String md5CheckDate) {
this.md5CheckDate = md5CheckDate;
}
public String getDataContent() {
return dataContent;
}
public void setDataContent(String dataContent) {
this.dataContent = dataContent;
}
public String getFileContent() {
return fileContent;
}
public void setFileContent(String fileContent) {
this.fileContent = fileContent;
}
public Integer getIsDivided() {
return isDivided;
}
public void setIsDivided(Integer isDivided) {
this.isDivided = isDivided;
}
}

View File

@@ -0,0 +1,651 @@
package com.point.strategy.docTraditionArrange.docVolume.controller;
import com.point.strategy.bean.TentityInterfaceSystem;
import com.point.strategy.bean.TentityType;
import com.point.strategy.bean.TtableDescription;
import com.point.strategy.common.AjaxJson;
import com.point.strategy.common.FileUtil;
import com.point.strategy.docTraditionArrange.docVolume.service.DanganguanliService;
import com.point.strategy.service.DocImportLogService;
import com.point.strategy.user.service.UserService;
import com.point.strategy.webSocket.WebSocket;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/v/danganguanli")
@Api(tags = "动态档案管理", value = "DanganguanliController")
public class DanganguanliController {
private static final Logger logger = LoggerFactory.getLogger(DanganguanliController.class);
@Autowired
private DanganguanliService danganguanliService;
@Autowired
private WebSocket webSocket;
@Autowired
private UserService userService;
@Autowired
private DocImportLogService docImportLogService;
//=================已入库数据浏览=======================start
//1.查询案卷列表
//2.点击数字 查询列表
//3.导出报表pdf
//添加收藏夹
//5.对文件相关的操作
//=================已入库数据浏览=======================end
//-----------------已入库数据浏览-----------------start
//查询列表
//报表
//从收藏夹移除
//-----------------已入库数据浏览-----------------end
//****************未入库档案著录****************start
//1.查询案卷列表
//通过门类id
//我要返回
//(1)列表字段
//(2)表名字
//(3)数据列表
//(4)页面上的查询条件
//第一层
@RequestMapping(value = "/selectObjectList1", method = RequestMethod.POST)
@ApiOperation(value = "动态查询【传统案卷】")
public AjaxJson selectObjectList1(Integer classId, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
Map<String, Object> data = danganguanliService.selectObjectMap1(classId);
json = new AjaxJson();
json.put("data", data);
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统案卷失败" + e);
}
return json;
}
@RequestMapping(value = "/selectById", method = RequestMethod.POST)
@ApiOperation(value = "根据表名和id查询档案")
public AjaxJson selectObject(String tableName, Integer id) {
AjaxJson json = null;
try {
Map<String, Object> map = new HashMap<>();
map.put("tableName", tableName);
map.put("conditionSql", "id = " + id);
List<Map<String, Object>> list = danganguanliService.selectObject(map);
json = new AjaxJson();
json.put("list", list);
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统案卷失败" + e);
}
return json;
}
@RequestMapping(value = "/selectThreeObject", method = RequestMethod.POST)
@ApiOperation(value = "根据表名和id查询档案和父级档案")
public AjaxJson selectThreeObject(String[] tableName, Integer id, Integer level){
AjaxJson json = null;
try {
Map<String, Object> map = new HashMap<>();
map.put("tableName", tableName[level]);
map.put("conditionSql", "id = " + id);
List<Map<String, Object>> list = danganguanliService.selectObject(map);
if (level==1){//三层案卷
for (Map<String, Object> maps : list) {
Object pid = maps.get("pid");
//获取父类数据
if (pid!=null){
Map<String, Object> pMaps = new HashMap<>();
pMaps.put("tableName", tableName[0]);
pMaps.put("conditionSql", "id = " + pid);
List<Map<String, Object>> lists = danganguanliService.selectObject(pMaps);
for (Map<String, Object> pMap : lists) {
maps.put("item_id",pMap.get("item_id"));
maps.put("item_name",pMap.get("item_name"));
break;
}
}
break;
}
}else {//三层卷内
//找到案卷的id
for (Map<String, Object> maps : list) {
Object pid = maps.get("pid");
//获取父类数据
if (pid!=null){
Map<String, Object> pMaps = new HashMap<>();
pMaps.put("tableName", tableName[1]);
pMaps.put("conditionSql", "id = " + pid);
List<Map<String, Object>> lists = danganguanliService.selectObject(pMaps);
//通过案卷的id找到项目的id
for (Map<String, Object> pMap : lists) {
Object fid = pMap.get("pid");
Map<String, Object> fMaps = new HashMap<>();
fMaps.put("tableName", tableName[0]);
fMaps.put("conditionSql", "id = " + fid);
List<Map<String, Object>> flists = danganguanliService.selectObject(fMaps);
//获取项目的信息
for (Map<String, Object> flist : flists) {
maps.put("item_id",flist.get("item_id"));
maps.put("item_name",flist.get("item_name"));
break;
}
break;
}
}
break;
}
}
json = new AjaxJson();
json.put("list", list);
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统案卷失败" + e);
}
return json;
}
//2.点击数字 查询文件列表
//3.导出报表pdf
/**
* @param response
* @param ids 1,2,3
* @param entityId
* @throws Exception
*/
//4.导出excel
//我还没写好,先放着
@RequestMapping(value = "/downloadExcel", method = RequestMethod.GET)
@ApiOperation(value = "下载文书传统整理Excel")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "entityId", value = "实体id", dataType = "Integer"),
@ApiImplicitParam(paramType = "query", name = "ids", value = "ids", dataType = "String"),
})
public void downloadExcel(HttpServletResponse response,
String ids,
Integer entityId
) throws Exception {
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.reset();
response.setContentType("application/x-msdownload; charset=utf-8");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
TentityType entityType = danganguanliService.selectEntityOne(entityId);
String fileName = new String(entityType.getEntityName().getBytes("utf-8"), "ISO-8859-1") + sdf.format(new Date()) + ".xls";
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
TtableDescription tableDescription = danganguanliService.selectTable(entityId);
String tableName = tableDescription.getTableName();
List<String[]> listArray= danganguanliService.selectExcelField(tableName);
// String[] columnsTitle = {"文件级档号",
// "案卷级档号",
// "题名"
// };
// String[] columnsEng = {"a", "b"};
String[] columnsTitle=listArray.get(0);
String[] columnsEng=listArray.get(1);
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("Sheet1");
HSSFRow row = sheet.createRow(0);
for (int i = 0; i < columnsTitle.length; i++) {
HSSFCell cell = row.createCell(i);
sheet.setColumnWidth(i, 3766);
cell.setCellValue(columnsTitle[i]);
}
List<Map<String, Object>> list = danganguanliService.getDataList(tableName, columnsEng, ids);
for (int i = 0; i < list.size(); i++) {
Map<String, Object> map = list.get(i);
HSSFRow rowi = sheet.createRow(i + 1);
//"文件级档号","案卷级档号","题名","文件形成时间","文件编号",
for (int j=0;j<columnsTitle.length;i++){
rowi.createCell(j).setCellValue(map.get(columnsEng[i]).toString());
}
// rowi.createCell(1).setCellValue(map.get("bb").toString());
// rowi.createCell(2).setCellValue(map.get("cc").toString());
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
wb.write(bos);
response.setHeader("Content-Length", bos.toByteArray().length + "");
bos.writeTo(response.getOutputStream());
response.flushBuffer();
}
//5.添加
//(1)点击按钮 要渲染表单,我要返回表单的数据
@RequestMapping(value = "/gotoAdd", method = RequestMethod.POST)
@ApiOperation(value = "跳转到新增页面")
public AjaxJson gotoAdd(Integer classId, Integer entityId, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
TentityInterfaceSystem data = danganguanliService.selectInterface(entityId);
json = new AjaxJson();
json.put("data", data);
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统案卷失败" + e);
}
return json;
}
/**
* jsonData格式如下
* {
* "字段1":"aa",
* "字段2":"bb",
* "字段3":"cc",
* }
*/
//(2)点击保存的接口
@RequestMapping(value = "/doAdd", method = RequestMethod.POST)
@ApiOperation(value = "新增功能")
public AjaxJson doAdd(Integer entityId, String tableName, String jsonData, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
danganguanliService.save(entityId, tableName, jsonData);
json = new AjaxJson();
// json.put("hashMap", data);
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统案卷失败" + e);
}
return json;
}
//6.修改
//(1)点击按钮 要渲染表单,我要返回表单的数据 并且要返回数据
//这个和跳转到新增的页面是一样的,数据页面上有,所以这个接口同上(/gotoAdd
//(2)点击保存的接口
@RequestMapping(value = "/doEdit", method = RequestMethod.POST)
@ApiOperation(value = "更新功能")
public AjaxJson doEdit(Integer entityId, Integer id, String tableName, String jsonData, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
danganguanliService.edit(entityId, id, tableName, jsonData);
json = new AjaxJson();
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统案卷失败" + e);
}
return json;
}
//7.删除
@RequestMapping(value = "/doDelete", method = RequestMethod.POST)
@ApiOperation(value = "删除功能")
public AjaxJson doDelete(Integer id, String tableName, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
danganguanliService.delete(id, tableName);
json = new AjaxJson();
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统案卷失败" + e);
}
return json;
}
//file_status 1-正常,2-删除
//8.操作文件相关
@RequestMapping(value = "/selectObjectFileList", method = RequestMethod.POST)
@ApiOperation(value = "动态查询【文件】")
public AjaxJson selectObjectFileList(Integer fileStatus, String tableName, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
Map<String, Object> data = danganguanliService.selectObjectMapFile(fileStatus, tableName);
json = new AjaxJson();
json.put("data", data);
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询失败" + e);
}
return json;
}
//9.上传文件
@RequestMapping(value = "/uploadFile", method = RequestMethod.POST)
@ApiOperation(value = "传统卷内整理原文-单个或者多个上传")
//file要与表单上传的名字相同
public AjaxJson uploadFile(MultipartFile[] file,
String fondscode,
Integer recId,
String tableName,
HttpServletRequest request) {
Integer successNum = 0;
Integer falseNum = 0;
for (int i = 0; i < file.length; i++) {
MultipartFile file0 = file[i];
String archiveNo = file0.getOriginalFilename();
archiveNo = archiveNo.substring(0, archiveNo.indexOf("."));
//创建文件在服务器端存放路径
String dir = request.getRealPath("/") + tableName + "_temp_file" + File.separator + fondscode + File.separator + recId;
File fileDir = new File(dir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
AjaxJson json2 = uploadFiles2(file0, dir, recId, tableName);
if ("101".equals(json2.getCode())) {
falseNum++;
}
if ("100".equals(json2.getCode())) {
successNum++;
}
//更新 _temp文件的数量
danganguanliService.edit_temp(recId, tableName);
}
AjaxJson json = AjaxJson.returnInfo("成功上传数successNum失败上传数falseNum");
json.put("successNum", successNum);
json.put("falseNum", falseNum);
return json;
}
public AjaxJson uploadFiles2(MultipartFile file, String dir, Integer recId, String tableName) {
AjaxJson json = null;
try {
File fileDir = new File(dir);
String originalFilename = file.getOriginalFilename();
danganguanliService.saveFile(file, dir, recId, tableName);
File files = new File(fileDir + "/" + originalFilename);
file.transferTo(files);
json = AjaxJson.returnInfo("上传文件成功");
} catch (IOException e) {
json = AjaxJson.returnExceptionInfo("上传文件失败" + e);
e.printStackTrace();
}
return json;
}
//file_status 1-正常,2-删除
// 10.删除文件
@RequestMapping(value = "/doEditFile", method = RequestMethod.POST)
@ApiOperation(value = "删除文件(更新状态)")
public AjaxJson doEditFile(Integer id, Integer fileStatus, String tableName, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
danganguanliService.editFile(id, fileStatus, tableName);
json = new AjaxJson();
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("删除文件(更新状态)失败" + e);
}
return json;
}
// 11.删除文件
@RequestMapping(value = "/doDeleteFile", method = RequestMethod.POST)
@ApiOperation(value = "删除文件(彻底删除)")
public AjaxJson doDeleteFile(Integer id, String tableName, String oneMenuCode, String twoMenuCode) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
danganguanliService.deleteFile(id, tableName);
json = new AjaxJson();
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("删除文件(彻底删除)失败" + e);
}
return json;
}
//查看图片文件
//第二层
//a查询列表
@RequestMapping(value = "/selectObjectList2", method = RequestMethod.POST)
@ApiOperation(value = "动态查询【传统卷内】")
public AjaxJson selectObjectList2(Integer classId, String oneMenuCode, String twoMenuCode, String pid) {
AjaxJson json = null;
try {
if ("1".equals(oneMenuCode) && "2".equals(twoMenuCode)) {
Map<String, Object> data = danganguanliService.selectObjectMap2(classId, pid);
json = new AjaxJson();
json.put("data", data);
}
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("动态查询传统卷内失败" + e);
}
return json;
}
//b.添加卷内
//(1).跳转到新增页面,和上面的方法(/gotoAdd一样
//(2).点击保存也和上面的方法相似但是要多传一个pid所以要确认下pid
//c.修改卷内
//(1)点击按钮 要渲染表单,我要返回表单的数据 并且要返回数据
//这个和跳转到新增的页面是一样的,数据页面上有,所以这个接口同上(/gotoAdd
//(2)感觉可以共用也是通过id更新数据同上/doEdit
//d.删除卷内
//同上(/doDelete
//e.报表
//****************未入库档案著录****************end
//^^^^^^^^^^^^^^^^未入库回收站^^^^^^^^^^^^^^^^^start
//1.查询列表
//2.恢复
//3.删除
//^^^^^^^^^^^^^^^^未入库回收站^^^^^^^^^^^^^^^^^end
/**
* 批量挂接
*
* @param fondscode 全宗号
* @param pathurl 文件路径
* @param //type 类型0-覆盖1-追加)
* @param request
* @return
*/
@RequestMapping(value = "/uploadFilesByPathsAnjuan", method = RequestMethod.POST)
@ApiOperation(value = "传统案卷整理原文-通过文件夹批量上传")
public AjaxJson uploadFilesByPathsAnjuan(String fondscode,
String pathurl,
Integer entityId,
HttpServletRequest request
) {
Integer successNum = 0;
Integer falseNum = 0;
Integer fileCount = 0;
long fileSize = 0;
File file = new File(pathurl);
File[] fs = file.listFiles();
if (null == fs || fs.length < 1) {
return AjaxJson.returnExceptionInfo("文件路径填写错误或不存在");
}
fileCount = FileUtil.getFileNum(file, 0);
TtableDescription tableDescription = danganguanliService.selectTable(entityId);
String tableName = tableDescription.getTableName();
// UserRole userRole = userService.getUserRole(request);
// User user = userRole.getUser();
// String code = "";
// if(null != user){
// code = user.getUsername();
// }
// Session session = SessionUtils.get(code);
for (int i = 0; i < fs.length; i++) {
String archiveNo = fs[i].getName();
//得到数据列表
Map<String, Object> parasMap = new HashMap<String, Object>();
parasMap.put("fieldName", "*");
parasMap.put("tableName", tableName + "_temp");
parasMap.put("conditionSql", " 1=1 and archive_no= '" + archiveNo + "' ");
List<Map<String, Object>> list = danganguanliService.selectObject(parasMap);
if (CollectionUtils.isEmpty(list)) {
return AjaxJson.returnExceptionInfo("文件存放路径错误");
}
Map<String, Object> docTraditionArrangeFile2 = list.get(0);
Integer id = Integer.parseInt(docTraditionArrangeFile2.get("id").toString());
Integer recId = id;
String dir = request.getRealPath("/") + tableName + "_temp_file" + File.separator + fondscode + File.separator + recId;
// String saveFilePath = tableName+"_temp_file" + File.separator + fondscode + File.separator + recId;
File fileDir = new File(dir);
if (!fileDir.exists()) {
fileDir.mkdirs();
}
String path = fs[i].getAbsolutePath();
System.out.println(path + "===" + archiveNo);
File[] fs2 = fs[i].listFiles();
for (int j = 0; j < fs2.length; j++) {
FileInputStream input = null;
try {
input = new FileInputStream(fs2[j]);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
MultipartFile multipartFile = null;
try {
multipartFile = new MockMultipartFile("file", fs2[j].getName(), "text/plain", IOUtils.toByteArray(input));
fileSize += multipartFile.getSize();
} catch (IOException e1) {
e1.printStackTrace();
}
try {
AjaxJson json2 = uploadFiles2(multipartFile, dir, recId, tableName);
String str = "";
if ("101".equals(json2.getCode())) {
falseNum++;
str = "挂接失败";
}
if ("100".equals(json2.getCode())) {
successNum++;
str = "挂接成功";
}
// if(null != session){
// AjaxJson ajaxJson = AjaxJson.returnInfo(path + str);
// ajaxJson.put("successNum", successNum);
// ajaxJson.put("falseNum", falseNum);
// ajaxJson.put("fileCount", fileCount);
// JSONObject jsonObject = JSONObject.fromObject(ajaxJson);
// webSocket.sendMessage(jsonObject.toString(), session);
// }
//webSocket.sendMessage(pathurl+"/"+archiveNo+"/"+multipartFile.getOriginalFilename()+"挂接成功");
} catch (Exception e) {
//webSocket.sendMessage(pathurl+"/"+archiveNo+"/"+multipartFile.getOriginalFilename()+"挂接失败");
// if(null != session){
// AjaxJson ajaxJson = AjaxJson.returnInfo(path + "挂接失败");
// ajaxJson.put("successNum", successNum);
// ajaxJson.put("falseNum", falseNum);
// ajaxJson.put("fileCount", fileCount);
// JSONObject jsonObject = JSONObject.fromObject(ajaxJson);
// webSocket.sendMessage(jsonObject.toString(), session);
// }
logger.error(path + "传统案卷批量挂接失败" + e);
}
String filePath = fs2[j].getAbsolutePath();
String fileName = fs2[j].getName();
System.out.println(filePath + "===" + fileName);
}
// docTraditionFileService.wsajmlTempCount(recId);
//更新 _temp文件的数量
danganguanliService.edit_temp(recId, tableName);
}
//记录导入日志
// DocImportLog docImportLog = new DocImportLog();
// docImportLog.setCreateDate(new Date());
// docImportLog.setDocSize(new BigDecimal(fileSize/1024));
// docImportLog.setDocNum(successNum);
// docImportLog.setUserId(user.getId());
// docImportLog.setUserName(user.getUsername());
// docImportLogService.insert(docImportLog);
AjaxJson json = AjaxJson.returnInfo("成功上传数successNum失败上传数falseNum");
json.put("successNum", successNum);
json.put("falseNum", falseNum);
return json;
}
}

View File

@@ -0,0 +1,494 @@
package com.point.strategy.docTraditionArrange.docVolume.controller;
import com.bstek.ureport.Utils;
import com.bstek.ureport.export.ExportConfigure;
import com.bstek.ureport.export.ExportConfigureImpl;
import com.bstek.ureport.export.ExportManager;
import com.github.pagehelper.PageInfo;
import com.point.strategy.common.AjaxJson;
import com.point.strategy.common.FileUtil;
import com.point.strategy.docTraditionArrange.docVolume.bean.DocTraditionArrangeVolume;
import com.point.strategy.docTraditionArrange.docVolume.bean.DocVolumeOriginalEntity;
import com.point.strategy.docTraditionArrange.docVolume.service.DocTraditionVolumeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
@RequestMapping("/v/docVolume")
@Api(tags = "文书传统整理-卷内", value = "DocVolumeController")
public class DocTraditionVolumeController {
private static final Logger logger = LoggerFactory.getLogger(DocTraditionVolumeController.class);
@Autowired
private DocTraditionVolumeService docTraditionVolumeService;
@RequestMapping(value="/getDocVolumeWithPage" , method= RequestMethod.POST)
@ApiOperation(value = "分页查询传统方法整理卷内信息")
public AjaxJson getDocVolumeWithPage(String fondsNo,String fondsNoCode,String pid,Integer page,Integer limit) {
AjaxJson json = null;
try {
DocTraditionArrangeVolume docTraditionArrangeVolume = new DocTraditionArrangeVolume();
docTraditionArrangeVolume.setFondsNo(fondsNo);
docTraditionArrangeVolume.setFondsNoCode(fondsNoCode);
docTraditionArrangeVolume.setPid(pid);
if(page!=null)
{
docTraditionArrangeVolume.setPage(page);
}
if(limit!=null)
{
docTraditionArrangeVolume.setLimit(limit);
}
List list = docTraditionVolumeService.getDocVolumeWithPage(docTraditionArrangeVolume);
PageInfo pageInfo = new PageInfo(list);
long total = pageInfo.getTotal();
json = new AjaxJson();
json.put("list", list);
json.put("total", total);
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("分页查询传统方法整理卷内信息失败"+e);
}
return json;
}
@RequestMapping(value="/saveDocVolume" , method= RequestMethod.POST)
@ApiOperation(value = "保存传统方法整理卷内信息")
public AjaxJson saveDocVolume(@RequestBody DocTraditionArrangeVolume docTraditionArrangeVolume) {
AjaxJson json = null;
try {
docTraditionArrangeVolume.setFileStatus(1);
int num = docTraditionVolumeService.saveDocVolume(docTraditionArrangeVolume);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("保存传统方法整理卷内信息失败"+e);
}
return json;
}
@RequestMapping(value="/deleteDocVolume" , method= RequestMethod.POST)
@ApiOperation(value = "删除传统方法整理卷内信息批量删除用逗号隔开id值")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "ids", value = "逗号拼接的id字符串", required = true, dataType = "String"),
})
public AjaxJson deleteDocVolume(String ids) {
AjaxJson json = null;
try {
int num = docTraditionVolumeService.deleteDocVolume(ids);
json = AjaxJson.returnInfo("成功删除"+num+"条记录");
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("删除传统方法整理卷内信息失败"+e);
}
return json;
}
@RequestMapping(value="/updateDocVolume" , method= RequestMethod.POST)
@ApiOperation(value = "修改传统方法整理卷内信息")
public AjaxJson updateDocVolume(@RequestBody DocTraditionArrangeVolume docTraditionArrangeVolume) {
AjaxJson json = null;
try {
docTraditionVolumeService.updateDocVolume(docTraditionArrangeVolume);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("修改传统方法整理卷内信息失败"+e);
}
return json;
}
@RequestMapping(value="/downLoadDocVolumePdf" , method= RequestMethod.GET)
@ApiOperation(value = "导出文书传统卷内pdf文件(预览)")
public void downLoadPdf(HttpServletRequest request, HttpServletResponse response,String fileName) throws Exception {
request.setCharacterEncoding("UTF-8");
//String fileName = "创建文书传统卷内pdf文件.pdf";
String dir = request.getRealPath("/")+"pdffile";
String downLoadPath = dir+File.separator+fileName+".pdf";
response.setContentType("application/pdf");
FileInputStream in = new FileInputStream(new File(downLoadPath));
OutputStream out = response.getOutputStream();
byte[] b = new byte[1024];
while ((in.read(b))!=-1) {
out.write(b);
}
out.flush();
in.close();
out.close();
}
@RequestMapping(value="/downPdfJuannei" , method= RequestMethod.GET)
@ApiOperation(value = "导出文书传统案卷pdf文件")
public void downPdfJuannei(HttpServletRequest request, HttpServletResponse response,String fileName) throws Exception {
request.setCharacterEncoding("UTF-8");
String dir = request.getRealPath("/")+"pdffile";
String downLoadPath = dir+File.separator+fileName+".pdf";
FileUtil.download(downLoadPath,response);
}
@RequestMapping(value="/createDocVolumePdf" , method= RequestMethod.GET)
@ApiOperation(value = "创建文书传统卷内pdf文件")
public AjaxJson createDocVolumePdf(HttpServletRequest request,String fondsNo,String fondsNoCode,String pid,String fileName,String ids) throws IOException {
AjaxJson json = null;
Map<String, Object> map = new HashMap<String, Object>();
map.put("fondsNo",fondsNo);
map.put("pid",pid);
map.put("ids",ids);
OutputStream outputStream = null;
try {
//String fileName = "文书卷内.pdf";
String dir = request.getRealPath("/")+"pdffile";
File file = new File(dir);
//如果文件夹不存在则创建
if (!file.exists() && !file.isDirectory()) {
file.mkdir();
}
outputStream = new FileOutputStream(new File(dir+File.separator+fileName+".pdf"));
ExportConfigure config = new ExportConfigureImpl("file:" + "wenshu_juannei.ureport.xml", map, outputStream);
ExportManager exportManager = (ExportManager) Utils.getApplicationContext().getBean(ExportManager.BEAN_ID);
exportManager.exportPdf(config);
json = new AjaxJson();
}catch (Exception e) {
json = AjaxJson.returnExceptionInfo("创建文书传统卷内pdf文件信息失败"+e);
e.printStackTrace();
}
return json;
}
/*
@RequestMapping(value="/uploadDocVolumes",method=RequestMethod.POST)
@ApiOperation(value = "原文单个或者批量上传")
//file要与表单上传的名字相同
public AjaxJson uploadFiles(MultipartFile[] file, Integer recId,String fondscode,HttpServletRequest request) {
AjaxJson json = null;
try {
//创建文件在服务器端存放路径
String dir = request.getServletContext().getRealPath("/"+fondscode);
File fileDir = new File(dir);
if(!fileDir.exists()) {
fileDir.mkdirs();
}
//生成文件在服务器端存放的名字
for(int i=0;i<file.length;i++) {
DocVolumeOriginalEntity docVolumeOriginalEntity = new DocVolumeOriginalEntity();
String originalFilename = file[i].getOriginalFilename();
int index = originalFilename.lastIndexOf(".")+1;
String fileType = originalFilename.substring(index);
docVolumeOriginalEntity.setFileName(originalFilename);
docVolumeOriginalEntity.setRecid(recId);
docVolumeOriginalEntity.setFileType(fileType);
long fileLen = file[i].getSize()/1024;
docVolumeOriginalEntity.setFileLen((float)fileLen);
docVolumeOriginalEntity.setFilePath(dir);
int pageNo = docTraditionVolumeService.getDocVolumeOriginalEntityCount(recId)+1;
docVolumeOriginalEntity.setPageNo(pageNo);
docVolumeOriginalEntity.setFileStatus(1);
docVolumeOriginalEntity.setIsDivided(-1);
if(pageNo<10)
docVolumeOriginalEntity.setFileNameServer(fondscode+".000"+pageNo+"."+fileType);
else if(10<=pageNo && pageNo<100)
docVolumeOriginalEntity.setFileNameServer(fondscode+".00"+pageNo+"."+fileType);
else if(100<=pageNo && pageNo<1000)
docVolumeOriginalEntity.setFileNameServer(fondscode+".0"+pageNo+"."+fileType);
else
docVolumeOriginalEntity.setFileNameServer(fondscode+"."+pageNo+"."+fileType);
docTraditionVolumeService.saveDocVolumeOriginalEntity(docVolumeOriginalEntity);
//String fileSuffix = originalFilename.substring(index);
//String fileName= UUID.randomUUID().toString()+fileSuffix;
File files = new File(fileDir+"/"+ docVolumeOriginalEntity.getFileNameServer());
//上传
file[i].transferTo(files);
}
json = AjaxJson.returnInfo("上传文件成功");
} catch (Exception e) {
json = AjaxJson.returnExceptionInfo("上传文件失败失败"+e);
}
return json;
}
*/
@RequestMapping(value="/queryDocVolumeOriginalEntity" , method= RequestMethod.POST)
@ApiOperation(value = "查询原文信息")
public AjaxJson queryDocVolumeOriginalEntity(@RequestParam(value = "recId",required = true)Integer recId) {
AjaxJson json = null;
try {
List list = docTraditionVolumeService.queryDocVolumeOriginalEntity(recId);
json = new AjaxJson();
json.put("list", list);
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("查询原文信息失败"+e);
}
return json;
}
@RequestMapping(value="/updateDocVolumeOriginalEntity" , method= RequestMethod.POST)
@ApiOperation(value = "原文入回收站")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "ids", value = "原文主键ids", required = true, dataType = "String"),
})
public AjaxJson updateDocVolumeOriginalEntity(@RequestParam(value = "ids",required = true) String ids) {
AjaxJson json = null;
try {
String[] idAarray=ids.split(",");
for (String id:idAarray) {
docTraditionVolumeService.updateDocVolumeOriginalEntity(Integer.parseInt(id));
}
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("原文入回收站失败"+e);
}
return json;
}
@RequestMapping(value="/queryDocVolumeOriginalEntityRecycle" , method= RequestMethod.POST)
@ApiImplicitParams({
@ApiImplicitParam(name = "recId", example = "1", value = "recId", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "fileStatus", example = "1", value = "文件状态1-上传文件数据2-回收站数据)", dataType = "String", paramType = "query"),
})
@ApiOperation(value = "查询原文文件信息")
public AjaxJson queryDocVolumeOriginalEntityRecycle(
@RequestParam(value = "recId",required = true)Integer recId,
@RequestParam(value = "fileStatus",required = true)Integer fileStatus
) {
AjaxJson json = null;
try {
Map<String,Object> map=new HashMap<>();
map.put("recId",recId);
map.put("fileStatus",fileStatus);
List list = docTraditionVolumeService.queryDocVolumeOriginalEntityRecycle(map);
json = new AjaxJson();
json.put("list", list);
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("查询原文回收站信息失败"+e);
}
return json;
}
@RequestMapping(value="/updateDocVolumeOriginalEntityRecycle" , method= RequestMethod.POST)
@ApiOperation(value = "原文回收站恢复")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "id", value = "原文主键id", required = true, dataType = "String"),
})
public AjaxJson updateDocVolumeOriginalEntityRecycle(Integer id) {
AjaxJson json = null;
try {
docTraditionVolumeService.updateDocVolumeOriginalEntityRecycle(id);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("原文回收站恢复失败"+e);
}
return json;
}
@RequestMapping(value="/deleteDocVolumeOriginalEntityRecycle" , method= RequestMethod.POST)
@ApiOperation(value = "删除原文回收站批量删除用逗号隔开id值")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "ids", value = "逗号拼接的id字符串", required = true, dataType = "String"),
})
public AjaxJson deleteDocVolumeOriginalEntityRecycle(String ids) {
AjaxJson json = null;
try {
int num = docTraditionVolumeService.deleteDocVolumeOriginalEntityRecycle(ids);
json = AjaxJson.returnInfo("成功删除"+num+"条记录");
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("删除原文回收站信息失败"+e);
}
return json;
}
@RequestMapping(value="/downloadDocVolumeExcelTemplate" , method= RequestMethod.GET)
@ApiOperation(value = "下载文书传统整理卷内excel模板")
public void downloadExcelTemplate(HttpServletResponse response)throws Exception{
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.reset();
response.setContentType("application/x-msdownload; charset=utf-8");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = new String("文书传统整理卷内模板".getBytes("utf-8"),"utf-8")+sdf.format(new Date())+".xls";
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
String[] columnsTitle = {"文件级档号","案卷级档号","题名","文件形成开始时间","文号","密级","密级代码","全宗名称","全宗号",
"归档年度","保管期限","保管期限代码","实体分类号","实体分类号代码","案卷号","页号","件号","页数","责任者",
"关键字","档案存放位置","归档日期","备注","份数","止页号","目录号","sssq","sssq_code","档案馆",
"档案馆代码","控制标识","控制标识代码","zqbs","zqbs_code","档案门类","档案门类代码","report_page",
"pid","录入人","录入日期","组卷标识","是否打eep包","是否打eep包代码","加密代码","加密检测日期","batch_id","batch_name",
"back_to_update_state","is_process","archive_entity_status","archive_zjbs","temp_no"};
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("文书传统整理卷内模板");
HSSFRow row = sheet.createRow(0);
for(int i=0;i<columnsTitle.length;i++) {
HSSFCell cell = row.createCell(i);
sheet.setColumnWidth(i, 3766);
cell.setCellValue(columnsTitle[i]);
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
wb.write(bos);
response.setHeader("Content-Length", bos.toByteArray().length+"");
bos.writeTo(response.getOutputStream());
response.flushBuffer();
}
/**
* 传统-卷内
* @param response
* @param fondsNoCode
* @throws Exception
*/
@RequestMapping(value="/downloadDocVolumeExcel" , method= RequestMethod.GET)
@ApiOperation(value = "下载文书传统整理Excel")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "fondsNoCode", value = "全宗号代码", dataType = "String"),
})
public void downloadExcel(HttpServletResponse response,String fondsNoCode,String pid,String ids)throws Exception{
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
response.reset();
response.setContentType("application/x-msdownload; charset=utf-8");
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
String fileName = new String("文书卷内目录".getBytes("utf-8"),"ISO-8859-1")+sdf.format(new Date())+".xls";
response.setHeader("Content-disposition", "attachment; filename=" + fileName);
String[] columnsTitle = {"文件级档号","案卷级档号","题名","文件形成时间","文件编号",
"密级","全宗号","归档年度","保管期限","实体分类号",
"案卷号","起页号","件号","页数","责任者",
"主题词","存放位置","归档日期","备注","份数",
"止页号","目录号","档案所属历史时期","档案馆代码","控制标识"
,"档案门类代码"};
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("文书传统整理卷内");
HSSFRow row = sheet.createRow(0);
for(int i=0;i<columnsTitle.length;i++) {
HSSFCell cell = row.createCell(i);
sheet.setColumnWidth(i, 3766);
cell.setCellValue(columnsTitle[i]);
}
List<String> idsList=new ArrayList<>();
if (ids!=null && !"".equals(ids)){
String[] idArray=ids.split(",");
for (String id:idArray) {
idsList.add(id);
}
}
DocTraditionArrangeVolume docTraditionArrangeVolume = new DocTraditionArrangeVolume();
docTraditionArrangeVolume.setFondsNoCode(fondsNoCode);
docTraditionArrangeVolume.setPid(pid);
docTraditionArrangeVolume.setIdsList(idsList);
List list = docTraditionVolumeService.getDocVolumeWithPage(docTraditionArrangeVolume);
for (int i = 0; i < list.size(); i++) {
HSSFRow rowi = sheet.createRow(i + 1);
//"文件级档号","案卷级档号","题名","文件形成时间","文件编号",
rowi.createCell(0).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getArchiveNo());
rowi.createCell(1).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getFolderNo());
rowi.createCell(2).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getMaintitle());
rowi.createCell(3).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getCreatedDate());
rowi.createCell(4).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getDocNo());
// "密级","全宗号","归档年度","保管期限","实体分类号",
rowi.createCell(5).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getSecurityClass());
rowi.createCell(6).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getFondsNo());
rowi.createCell(7).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getFilingYear());
rowi.createCell(8).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getCreatedDate());
rowi.createCell(9).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getArchiveCtgNo());
// "案卷号","起页号","件号","页数","责任者",
rowi.createCell(10).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getYearFolderNo());
rowi.createCell(11).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getPageNo());
rowi.createCell(12).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getPieceNo());
rowi.createCell(13).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getId());
rowi.createCell(14).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getResponsibleby());
// "主题词","存放位置","归档日期","备注","份数",
rowi.createCell(15).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getSbtWord());
rowi.createCell(16).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getFolderLocation());
rowi.createCell(17).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getPigeonholeDate());
rowi.createCell(18).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getNote());
rowi.createCell(19).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getFolderLocation());
//"止页号","目录号","档案所属历史时期","档案馆代码","控制标识"
rowi.createCell(20).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getPageNoEnd());
rowi.createCell(21).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getMlh());
rowi.createCell(22).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getObjectQuantity());
rowi.createCell(23).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getDagdm());
rowi.createCell(24).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getKzbs());
//"档案门类代码"
rowi.createCell(25).setCellValue(((DocTraditionArrangeVolume)list.get(i)).getDamldm());
}
ByteArrayOutputStream bos = new ByteArrayOutputStream();
wb.write(bos);
response.setHeader("Content-Length", bos.toByteArray().length+"");
bos.writeTo(response.getOutputStream());
response.flushBuffer();
}
@RequestMapping(value="/saveBatchDocVolumes" , method= RequestMethod.POST)
@ApiOperation(value = "批量上传文书传统卷内excel数据")
public AjaxJson saveBatchDocVolumes(@RequestParam("file") MultipartFile file)throws Exception {
AjaxJson json = null;
try {
docTraditionVolumeService.saveBatchDocVolumes(file);
json = new AjaxJson();
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("批量上传文书传统整理卷内失败"+e);
}
return json;
}
@RequestMapping(value="/updateTempFile" , method= RequestMethod.POST)
@ApiOperation(value = "把文件删除到回收站以及恢复")
@ApiImplicitParams({
@ApiImplicitParam(name = "ids", example = "1,2", value = "支持批量操作", dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "fileStatus", example = "1", value = "文件状态1-上传文件数据2-回收站数据)", dataType = "String", paramType = "query"),
})
public AjaxJson updateTempFile(
@RequestParam(value = "ids",required = true)String ids,
@RequestParam(value = "fileStatus",required = true)Integer fileStatus
) {
AjaxJson json = null;
try {
String[] idArray=ids.split(",");
for (String id:idArray) {
DocVolumeOriginalEntity entity=new DocVolumeOriginalEntity();
entity.setId(Integer.parseInt(id));
entity.setFileStatus(fileStatus);
docTraditionVolumeService.updateTempFile(entity);
json = new AjaxJson();
}
DocVolumeOriginalEntity entity=docTraditionVolumeService.selectFileOneById(Integer.parseInt(idArray[0]));
docTraditionVolumeService.wsjnmlTempCount(entity.getRecid());
}catch(Exception e) {
json = AjaxJson.returnExceptionInfo("操作失败"+e);
}
return json;
}
}

View File

@@ -0,0 +1,70 @@
package com.point.strategy.docTraditionArrange.docVolume.mapper;
import com.point.strategy.bean.TentityInterfaceSystem;
import com.point.strategy.bean.TentityType;
import com.point.strategy.bean.TtableDescription;
import com.point.strategy.bean.TtableStructDescription;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface DanganguanliMapper {
//===========动态sql================start
void updateObject(Map<String, Object> map);
List<Map<String, Object>> selectObject(Map<String, Object> map);
Integer selectObjectCount(Map<String, Object> map);
String selectThreeName(Map<String, Object> map);
Integer selectObjectMax(Map<String, Object> map);
Integer selectObjectMax2(Map<String, Object> map);
Integer auto(Map<String, Object> map);
void deleteObject(Map<String, Object> map);
void saveObject(Map<String, Object> map);
List<Map<String,Object>> getCountDocStartTimeObject(Map<String,Object> map);
List<Map<String,Object>> getCountCreatedDateObject(Map<String,Object> map);
List<Map<String,Object>> selectCountGroupRetention(Map<String,Object> map);
//============动态sql===============end
//通过门类id得到 实体列表
List<TentityType> selectEntityList(Integer classId);
//通过实体id得到 实体对象
TentityType selectEntityOne(Integer id);
//通过实体id得到 表的名字
TtableDescription selectTable(Integer entityId);
//通过表名得到 字段列表名称
List<TtableStructDescription> selectTableStruct(String tableName);
//通过表名得到 字段列表名称
TentityInterfaceSystem selectInterface(Integer entityId);
void wsajmlTempCount(Map<String, Object> map);
//通过门类名称得到表table的信息
List<Map<String, Object>> selectTabByClassId(Integer classId);
//查询图片的文字
String selectWord(Map<String, Object> map);
Double getSumFileLen(Map<String, Object> map);
}

View File

@@ -0,0 +1,30 @@
package com.point.strategy.docTraditionArrange.docVolume.mapper;
import com.point.strategy.docTraditionArrange.docVolume.bean.DocVolumeOriginalEntity;
import com.point.strategy.docTraditionArrange.docVolume.bean.DocTraditionArrangeVolume;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
public interface DocTraditionVolumeMapper {
List<DocTraditionArrangeVolume> getDocVolumeWithPage(DocTraditionArrangeVolume docTraditionArrangeVolume);
public int saveDocVolume(DocTraditionArrangeVolume docTraditionArrangeVolume);
public int deleteDocVolume(Integer id);
public int deleteDocVolumeCascadeRecycle(Integer recId);
public int updateDocVolume(DocTraditionArrangeVolume docTraditionArrangeVolume);
public int getDocVolumeOriginalEntityCount(Integer recId);
public void saveDocVolumeOriginalEntity(DocVolumeOriginalEntity docVolumeOriginalEntity);
public List<DocTraditionArrangeVolume> queryDocVolumeOriginalEntity(Integer recId);
public void updateDocVolumeOriginalEntity(Integer id);
public List<DocVolumeOriginalEntity> queryDocVolumeOriginalEntityRecycle(Map<String,Object> map);
public void updateDocVolumeOriginalEntityRecycle(Integer id);
public int deleteDocVolumeOriginalEntityRecycle(Integer id);
public void saveBatchDocVolumes(Map map);
//卷内-更新文书传统卷内原文文件
public void updateTempFile(DocVolumeOriginalEntity entity);
//卷内-更新档案文件数量
public void wsjnmlTempCount(Integer id);
//卷内-查询文件id
public DocVolumeOriginalEntity selectFileOneById(Integer id);
}

View File

@@ -0,0 +1,492 @@
package com.point.strategy.docTraditionArrange.docVolume.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.point.strategy.bean.TentityInterfaceSystem;
import com.point.strategy.bean.TentityType;
import com.point.strategy.bean.TtableDescription;
import com.point.strategy.bean.TtableStructDescription;
import com.point.strategy.docTraditionArrange.docVolume.mapper.DanganguanliMapper;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component("DanganguanliService")
@Transactional
public class DanganguanliService {
@Resource
public DanganguanliMapper danganguanliMapper;
//===========动态sql================start
public void updateObject(Map<String, Object> map){
danganguanliMapper.updateObject(map);
}
public List<Map<String, Object>> selectObject(Map<String, Object> map){
return danganguanliMapper.selectObject(map);
}
public Integer selectObjectCount(Map<String, Object> map){
return danganguanliMapper.selectObjectCount(map);
}
public void deleteObject(Map<String, Object> map){
danganguanliMapper.deleteObject(map);
}
public void saveObject(Map<String, Object> map){
danganguanliMapper.saveObject(map);
}
//============动态sql===============end
public Map<String, Object> selectObjectMap1(Integer classId) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
//有可能有多个实体
List<TentityType> entityList = danganguanliMapper.selectEntityList(classId);
Integer entityId1=0;
Integer entityId2=0;
String tableName1 = "";
String tableName2 = "";
if (entityList != null && entityList.size() >= 2) {
TtableDescription tableDescription = danganguanliMapper.selectTable(entityList.get(0).getId());
TtableDescription tableDescription1 = danganguanliMapper.selectTable(entityList.get(1).getId());
tableName1 = tableDescription.getTableName();
tableName2 = tableDescription1.getTableName();
entityId1=entityList.get(0).getId();
entityId2=entityList.get(1).getId();
} else {
TtableDescription tableDescription = danganguanliMapper.selectTable(entityList.get(0).getId());
tableName1 = tableDescription.getTableName();
entityId1=entityList.get(0).getId();
}
//获取字段列表数据
List<TtableStructDescription> tableStructList1 = danganguanliMapper.selectTableStruct(tableName1);
List<TtableStructDescription> tableStructList2 = danganguanliMapper.selectTableStruct(tableName2);
//得到数据列表
Map<String, Object> parasMap = new HashMap<String, Object>();
// parasMap.put("fieldName", fomratFieldNameEng(tableStructList1));
parasMap.put("tableName", tableName1 + "_temp");
parasMap.put("conditionSql", " 1=1 ");
List<Map<String, Object>> dataList = danganguanliMapper.selectObject(parasMap);
resutlMap.put("tableName1", tableName1);
resutlMap.put("tableName2", tableName2);
resutlMap.put("entityId1", entityId1);
resutlMap.put("entityId2", entityId2);
resutlMap.put("fieldName1", fomratFieldNameChn(tableStructList1));
resutlMap.put("fieldName2", fomratFieldNameChn(tableStructList2));
// resutlMap.put("conditionSql", "");
resutlMap.put("dataList", dataList);
return resutlMap;
}
public List<String[]> selectExcelField(String tableName) {
List<String[]> resultList=new ArrayList<>();
//获取字段列表数据
List<TtableStructDescription> tableStructList1 = danganguanliMapper.selectTableStruct(tableName);
int num=tableStructList1.size();
String[] columnsTitle = new String[num];
String[] columnsEng = new String[num];
int i=0;
for (TtableStructDescription tableStructDescription:tableStructList1) {
columnsTitle[i]=tableStructDescription.getColumnChnName();
columnsEng[i]=tableStructDescription.getColumnName();
i++;
}
//中文
resultList.add(columnsTitle);
//英文字段
resultList.add(columnsEng);
return resultList;
}
public Map<String, Object> selectObjectMap2(Integer classId, String pid) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
List<TentityType> entityList = danganguanliMapper.selectEntityList(classId);
TtableDescription tableDescription2 = danganguanliMapper.selectTable(entityList.get(1).getId());
String tableName2 = tableDescription2.getTableName();
//获取字段列表数据
List<TtableStructDescription> tableStructList2 = danganguanliMapper.selectTableStruct(tableName2);
//得到数据列表
Map<String, Object> parasMap = new HashMap<String, Object>();
// parasMap.put("fieldName", fomratFieldNameEng(tableStructList2));
parasMap.put("tableName", tableName2 + "_temp");
parasMap.put("conditionSql", " 1=1 and pid= '"+pid+"' ");
List<Map<String, Object>> dataList2 = danganguanliMapper.selectObject(parasMap);
// resutlMap.put("conditionSql", "");
resutlMap.put("dataList", dataList2);
return resutlMap;
}
//通过表名得到 字段列表名称
public TentityInterfaceSystem selectInterface(Integer entityId){
return danganguanliMapper.selectInterface(entityId);
}
/**
*
jsonData格式如下
{
"字段1":"aa",
"字段2":"bb",
"字段3":"cc",
}
*/
public Map<String, Object> save(Integer entityId,String tableName,String jsonData) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
String fieldName="";
String valueName="";
//通过实体id获取到对应字段
TentityInterfaceSystem entityInterface=danganguanliMapper.selectInterface(entityId);
String jsonArrayStr= entityInterface.getInterfaceShow();
JSONArray jsonArray=JSON.parseArray(jsonArrayStr);
JSONObject jsonObject=JSON.parseObject(jsonData);
for (int i=0;i<jsonArray.size();i++){
String field= jsonArray.getJSONObject(i).getString("field_name");
String val= jsonObject.getString(field);
fieldName=fieldName+field+",";
valueName=valueName+val+",";
}
fieldName=fieldName.substring(0,fieldName.length()-1);
valueName=valueName.substring(0,valueName.length()-1);
Map<String, Object> map=new HashMap<String, Object>();
map.put("tableName", tableName + "_temp");
//其实我们知道是哪些字段
map.put("fieldName",fieldName);
map.put("valueName",valueName);
danganguanliMapper.saveObject(map);
return resutlMap;
}
public Map<String, Object> saveFile(MultipartFile file, String dir, Integer recId, String tableName) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
String originalFilename = file.getOriginalFilename();
int index = originalFilename.lastIndexOf(".") + 1;
String fileType = originalFilename.substring(index);
long fileLen = file.getSize() / 1024;
Map<String, Object> map5=new HashMap<>();
map5.put("tableName",tableName + "_temp_file");
map5.put("conditionSql","rec_id= '"+recId+"'");
int pageNo=danganguanliMapper.selectObjectCount(map5)+1;
String fieldName=
"file_name," +
"rec_id," +
"file_type," +
"file_len," +
"file_path," +
"page_no," +
"file_status," +
"is_divided," +
"file_name_server";
String valueName="'"+originalFilename+"'"+","
+"'"+recId+"'"+","
+"'"+fileType+"'"+","
+"'"+fileLen+"'"+","
+"'"+dir+"'"+","
+"'"+pageNo+"'"
+",1,-1,"
+"'"+originalFilename+"'";
Map<String, Object> map=new HashMap<String, Object>();
map.put("tableName", tableName + "_temp_file");
//其实我们知道是哪些字段
map.put("fieldName",fieldName);
map.put("valueName",valueName);
danganguanliMapper.saveObject(map);
return resutlMap;
}
/**
*
jsonData格式如下
{
"字段1":"aa",
"字段2":"bb",
"字段3":"cc",
}
更新sql标准格式
update
table_name set
field1=new-value1, field2=new-value2
where id=1
*/
public Map<String, Object> edit(Integer entityId,Integer id,String tableName,String jsonData) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
String fieldValue="";
String conditionSql=" id='"+id+"'";
//通过实体id获取到对应字段
TentityInterfaceSystem entityInterface=danganguanliMapper.selectInterface(entityId);
String jsonArrayStr= entityInterface.getInterfaceShow();
JSONArray jsonArray=JSON.parseArray(jsonArrayStr);
JSONObject jsonObject=JSON.parseObject(jsonData);
for (int i=0;i<jsonArray.size();i++){
String field= jsonArray.getJSONObject(i).getString("field_name");
String val= jsonObject.getString(field);
fieldValue=fieldValue+field+"="+val+",";
}
fieldValue=fieldValue.substring(0,fieldValue.length()-1);
Map<String, Object> map=new HashMap<String, Object>();
map.put("tableName", tableName + "_temp");
//其实我们知道是哪些字段
map.put("fieldValue",fieldValue);
map.put("conditionSql",conditionSql);
danganguanliMapper.updateObject(map);
return resutlMap;
}
/**
*
更新sql标准格式
update
table_name set
field1=new-value1, field2=new-value2
where id=1
*/
public Map<String, Object> editFile(Integer id,Integer fileStatus,String tableName) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
String fieldValue="file_status="+fileStatus;
String conditionSql=" id='"+id+"'";
Map<String, Object> map=new HashMap<String, Object>();
map.put("tableName", tableName + "_temp_file");
map.put("fieldValue",fieldValue);
map.put("conditionSql",conditionSql);
danganguanliMapper.updateObject(map);
return resutlMap;
}
public Map<String, Object> deleteFile(Integer id,String tableName) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
//删除数据
String conditionSql=" id='"+id+"'";
Map<String, Object> map=new HashMap<String, Object>();
map.put("tableName", tableName + "_temp_file");
//其实我们知道是哪些字段
map.put("conditionSql",conditionSql);
danganguanliMapper.deleteObject(map);
return resutlMap;
}
public Map<String, Object> edit_temp(Integer id,String tableName) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
String fieldValue=" archive_file_num = archive_file_num +1";
String conditionSql=" id='"+id+"'";
Map<String, Object> map=new HashMap<String, Object>();
map.put("tableName", tableName + "_temp");
map.put("fieldValue",fieldValue);
map.put("conditionSql",conditionSql);
danganguanliMapper.updateObject(map);
return resutlMap;
}
//数据要迁移到其他的表
//tab_nameb_20210422184803183_temp 数据迁移到 tab_name_20210422184803183_temp_trash
public Map<String, Object> delete(Integer id,String tableName) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
//得到数据列表
Map<String, Object> parasMapSelect = new HashMap<String, Object>();
// parasMapSelect.put("fieldName", "*");
parasMapSelect.put("tableName", tableName + "_temp");
parasMapSelect.put("conditionSql", " id='"+id+"'" );
List<Map<String, Object>> dataList = danganguanliMapper.selectObject(parasMapSelect);
String fieldName="";
String valueName="";
if (dataList!=null){
Map<String, Object> map2= dataList.get(0);
for (Map.Entry<String, Object> m : map2.entrySet()) {
System.out.println("key:" + m.getKey() + " value:" + m.getValue());
fieldName=fieldName+m.getKey()+",";
valueName=valueName+m.getValue()+",";
}
fieldName=fieldName.substring(0,fieldName.length()-1);
valueName=valueName.substring(0,valueName.length()-1);
}
//删除数据
String conditionSql=" id='"+id+"'";
Map<String, Object> map=new HashMap<String, Object>();
map.put("tableName", tableName + "_temp");
//其实我们知道是哪些字段
map.put("conditionSql",conditionSql);
danganguanliMapper.deleteObject(map);
//添加到 _temp_trash(垃圾表)
Map<String, Object> parasMapAdd=new HashMap<String, Object>();
parasMapAdd.put("tableName", tableName + "_temp_trash");
//其实我们知道是哪些字段
parasMapAdd.put("fieldName",fieldName);
parasMapAdd.put("valueName",valueName);
danganguanliMapper.saveObject(parasMapAdd);
return resutlMap;
}
//对文件操作
// 感觉所有的 文件字段都是一样的,这个不是动态配置的,但是需要确认,很关键
//file_status 1-正常,2-删除
public Map<String, Object> selectObjectMapFile(Integer fileStatus,String tableName) {
HashMap<String, Object> resutlMap = new HashMap<String, Object>();
String tableName1=tableName+"_temp_file";
String fieldName="*";
String conditionSql="file_status="+fileStatus;
//得到数据列表
Map<String, Object> parasMap = new HashMap<String, Object>();
// parasMap.put("fieldName", fieldName);
parasMap.put("tableName", tableName1);
parasMap.put("conditionSql", conditionSql);
List<Map<String, Object>> dataList = danganguanliMapper.selectObject(parasMap);
// resutlMap.put("tableName", tableName1);
// resutlMap.put("fieldName1", fomratFieldNameChn(tableStructList1));
// resutlMap.put("conditionSql", "");
resutlMap.put("dataList", dataList);
return resutlMap;
}
public List<Map<String,Object>> getDataList(String tableName,String[] columnsEng,String ids){
String fieldName="";
String conditionSql="";
if (ids!=null && !"".equals(ids)){
String id2="";
String[] idsArr= ids.split(",");
for (String id:idsArr) {
id2=id2+"'"+id+"'"+",";
}
id2=id2.substring(0,id2.length()-1);
conditionSql="and id in ( "+id2+" ) ";
}
for (String columns:columnsEng) {
fieldName=fieldName+columns+",";
}
fieldName=fieldName.substring(0,fieldName.length()-1);
//得到数据列表
Map<String, Object> parasMap = new HashMap<String, Object>();
// parasMap.put("fieldName", fieldName);
parasMap.put("tableName", tableName+"_temp");
parasMap.put("conditionSql", " 1=1 "+conditionSql);
List<Map<String, Object>> dataList = danganguanliMapper.selectObject(parasMap);
return dataList;
}
/**
* 获取英文字段
*/
public String fomratFieldNameEng(List<TtableStructDescription> tableStructList) {
String result = "";
if (tableStructList != null && tableStructList.size() > 0) {
for (TtableStructDescription entity : tableStructList) {
result = result + entity.getColumnName() + " as "+entity.getColumnChnName()+",";
}
result=result+" id ";
// result = result.substring(0, result.length() - 1);
}
return result;
}
/**
* 获取中文字段
*/
public String fomratFieldNameChn(List<TtableStructDescription> tableStructList){
String result="";
if (tableStructList!=null && tableStructList.size()>0){
for (TtableStructDescription entity:tableStructList) {
result=result+entity.getColumnChnName()+",";
}
result=result.substring(0,result.length()-1);
}
return result;
}
public TentityType selectEntityOne(Integer id){
TentityType entityType= danganguanliMapper.selectEntityOne(id);
return entityType;
}
//通过实体id得到 表的名字
public TtableDescription selectTable(Integer entityId){
return danganguanliMapper.selectTable(entityId);
}
public void wsajmlTempCount(Map<String, Object> map){
danganguanliMapper.wsajmlTempCount(map);
}
public String selectWord(Map<String, Object> map){
return danganguanliMapper.selectWord(map);
}
}

View File

@@ -0,0 +1,207 @@
package com.point.strategy.docTraditionArrange.docVolume.service;
import com.github.pagehelper.PageHelper;
import com.point.strategy.docTraditionArrange.docVolume.bean.DocVolumeOriginalEntity;
import com.point.strategy.docTraditionArrange.docVolume.bean.DocTraditionArrangeVolume;
import com.point.strategy.docTraditionArrange.docVolume.mapper.DocTraditionVolumeMapper;
import jxl.Cell;
import jxl.Sheet;
import jxl.Workbook;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component("DocTraditionVolumeService")
@Transactional
public class DocTraditionVolumeService {
//@Autowired
@Resource
public DocTraditionVolumeMapper docTraditionVolumeMapper;
public List getDocVolumeWithPage(DocTraditionArrangeVolume docTraditionArrangeVolume) {
PageHelper.startPage(docTraditionArrangeVolume.getPage(), docTraditionArrangeVolume.getLimit());
List docVolumes= docTraditionVolumeMapper.getDocVolumeWithPage(docTraditionArrangeVolume);
return docVolumes;
}
public int saveDocVolume(DocTraditionArrangeVolume docTraditionArrangeVolume) {
return docTraditionVolumeMapper.saveDocVolume(docTraditionArrangeVolume);
}
public int deleteDocVolume(String ids) {
int num = 0;
if(ids!=null && !"".equals(ids) && ids.length()>0){
String id[] = ids.split(",");
for(int i=0;i<id.length;i++){
String index = id[i];
Integer t = Integer.valueOf(index);
int j = docTraditionVolumeMapper.deleteDocVolume(t);
docTraditionVolumeMapper.deleteDocVolumeCascadeRecycle(t);
if(j>0) {
num = num + 1;
}
}
}
return num;
}
public int deleteDocVolumeCascadeRecycle(Integer recid) {
return docTraditionVolumeMapper.deleteDocVolumeCascadeRecycle(recid);
}
public int updateDocVolume(DocTraditionArrangeVolume docTraditionArrangeVolume) {
return docTraditionVolumeMapper.updateDocVolume(docTraditionArrangeVolume);
}
//下载文件url写法http://localhost:8081/ureport/pdf?_u=file:rr.ureport.xml&name=du,name值在第三个参数map里面
public List docVolumePdf(String dataSourceName,String dataSetName,Map paramMap) {
DocTraditionArrangeVolume docTraditionArrangeVolume = new DocTraditionArrangeVolume();
docTraditionArrangeVolume.setFondsNo((String)paramMap.get("fondsNo"));
docTraditionArrangeVolume.setFondsNoCode((String)paramMap.get("fondsNoCode"));
List docVolumes= docTraditionVolumeMapper.getDocVolumeWithPage(docTraditionArrangeVolume);
return docVolumes;
}
public int getDocVolumeOriginalEntityCount(Integer recId) {
return docTraditionVolumeMapper.getDocVolumeOriginalEntityCount(recId);
}
public void saveDocVolumeOriginalEntity(DocVolumeOriginalEntity docVolumeOriginalEntity) {
docTraditionVolumeMapper.saveDocVolumeOriginalEntity(docVolumeOriginalEntity);
}
public List queryDocVolumeOriginalEntity(Integer recId) {
return docTraditionVolumeMapper.queryDocVolumeOriginalEntity(recId);
}
public void updateDocVolumeOriginalEntity(Integer id){
docTraditionVolumeMapper.updateDocVolumeOriginalEntity(id);
}
public List queryDocVolumeOriginalEntityRecycle(Map<String,Object> map) {
return docTraditionVolumeMapper.queryDocVolumeOriginalEntityRecycle(map);
}
public void updateDocVolumeOriginalEntityRecycle(Integer id){
docTraditionVolumeMapper.updateDocVolumeOriginalEntityRecycle(id);
}
public int deleteDocVolumeOriginalEntityRecycle(String ids) {
int num = 0;
if(ids!=null && !"".equals(ids) && ids.length()>0){
String id[] = ids.split(",");
for(int i=0;i<id.length;i++){
String index = id[i];
Integer t = Integer.valueOf(index);
int j = docTraditionVolumeMapper.deleteDocVolumeOriginalEntityRecycle(t);
if(j>0) {
num = num + 1;
}
}
}
return num;
}
public void saveBatchDocVolumes(MultipartFile file)throws Exception {
String tableName = "wsjnml_20201104084119220_temp";
String fieldName = "archive_no," +
"folder_no," +
"maintitle," +
"created_date," +
"doc_no," +
"security_class," +
"security_class_code," +
"fonds_no," +
"fonds_no_code," +
"filing_year," +
"retention," +
"retention_code," +
"archive_ctg_no," +
"archive_ctg_no_code," +
"year_folder_no," +
"page_no," +
"piece_no," +
"quantity," +
"responsibleby," +
"sbt_word," +
"folder_location," +
"pigeonhole_date," +
"note," +
"object_quantity," +
"page_no_end," +
"mlh," +
"sssq," +
"sssq_code," +
"dagdm," +
"dagdm_code," +
"kzbs," +
"kzbs_code," +
"zqbs," +
"zqbs_code," +
"damldm," +
"damldm_code," +
"report_page," +
"pid," +
"create_person," +
"create_date," +
"archive_flag," +
"is_packeep," +
"is_packeep_code," +
"md5_code," +
"md5_check_date," +
"batch_id," +
"batch_name," +
"back_to_update_state," +
"is_process," +
"archive_entity_status," +
"archive_zjbs," +
"temp_no";
InputStream in = file.getInputStream();
Workbook boxExcel = Workbook.getWorkbook(in);
Sheet boxSheet = boxExcel.getSheet(0);
for (int i = 1; i < boxSheet.getRows(); i++) {
StringBuffer valueNameBuffer = new StringBuffer();
Map map = new HashMap();
for (int j = 0; j <boxSheet.getColumns(); j++) {
Cell boxCell = boxSheet.getCell(j, i);
String val = boxCell.getContents();
// if("".equals(val))val=null; SQL语句需要加上'(单引号)
if(j==0)valueNameBuffer.append("'"+val+"'");
else valueNameBuffer.append(",'"+val+"'");
}
String valueName = valueNameBuffer.toString();
map.put("tableName", tableName);
map.put("fieldName", fieldName);
map.put("valueName", valueName);
docTraditionVolumeMapper.saveBatchDocVolumes(map);
}
}
/**
* 更新文书传统卷内原文文件
* @param entity
*/
public void updateTempFile(DocVolumeOriginalEntity entity){
docTraditionVolumeMapper.updateTempFile(entity);
}
//卷内-更新档案文件数量
public void wsjnmlTempCount(Integer id){
docTraditionVolumeMapper.wsjnmlTempCount(id);
}
//卷内-查询文件id
public DocVolumeOriginalEntity selectFileOneById(Integer id){
return docTraditionVolumeMapper.selectFileOneById(id);
}
}