1、ArchiveFilesFrom
java
package com.gwssi.archiv.entity;
import java.util.List;
/**
* @program: market_admin
* @ClassName ArchiveFilesFrom
* @description:
* @author: liubiao
* @create: 2021-11-10 14:41
**/
public class ArchiveFilesFrom {
private List<ElecFileItem> elecFileItemList;
public List<ElecFileItem> getElecFileItemList() {
return elecFileItemList;
}
public void setElecFileItemList(List<ElecFileItem> elecFileItemList) {
this.elecFileItemList = elecFileItemList;
}
}
2、submitArchiveFiles
接口
java
@RequestMapping(value = "/submitArchiveFiles", method = RequestMethod.POST, produces = "application/json")
@ResponseBody
public String submitArchiveFiles(@RequestBody ArchiveFilesFrom archiveFilesFrom){
if (archiveFilesFrom.getElecFileItemList() == null){
return ResultUtil.paramsIsNull("电子文件材料不能为空");
}
try {
return archivElecFileService.saveArchiveFiles(archiveFilesFrom);
}catch (Exception e){
LOG.error("===》》》申请材料保存异常,业务号:{},异常信息:\n",archiveFilesFrom.getGid(), e);
return ResultUtil.sysException();
}
}
3、保存方法saveArchiveFiles
java
/**
* 申请材料接收
*
* @param archiveFilesFrom
* @return
*/
public String saveArchiveFiles(ArchiveFilesFrom archiveFilesFrom) {
IEntityDao entityDao = DaoManager.getEntityDao();
IBaseDao baseDao = TorchDaoManager.getDao();
String gid = archiveFilesFrom.getGid();
//防止数据重复,每次先删除
baseDao.exeSQL("delete from archiv_elec_file where gid=? ", gid);
List<ElecFileItem> elecFileItemList = archiveFilesFrom.getElecFileItemList();
for (ElecFileItem e : elecFileItemList) {
List<InnerfileItem> innerfileItemList = e.getInnerfileItemList();
ArchivElecFileBo bo = new ArchivElecFileBo();
String uuid = UUIDUtil.getUUID();
bo.setId(uuid);
bo.setGid(gid);
bo.setElecfileid(e.getElecFileID());
bo.setElecfilename(e.getElecFileName());
bo.setElecfilesavepath(e.getElecFileSavePath());
bo.setElecfiletype(e.getElecFileType());
bo.setTimestamp(new Date());
entityDao.insert(bo);
for (InnerfileItem in : innerfileItemList) {
ArchivElecFileBo bo2 = new ArchivElecFileBo();
bo2.setId(UUIDUtil.getUUID());
bo2.setGid(gid);
bo2.setParentid(uuid);
bo2.setElecfileid(e.getElecFileID());
bo2.setElecfilename(e.getElecFileName());
bo2.setElecfilesavepath(e.getElecFileSavePath());
bo2.setElecfiletype(e.getElecFileType());
bo2.setInnerfiletitle(in.getInnerfileTitle());
bo2.setBeginpagenum(in.getBeginPageNum());
bo2.setEndpagenum(in.getEndPageNum());
bo2.setTimestamp(new Date());
entityDao.insert(bo2);
}
}
LOG.info("横琴准入接收网办申请材料成功!,业务号:{}", archiveFilesFrom.getGid());
return ResultUtil.returnResult("200", "成功", null);
}
4、数据表archiv_elec_file
sql
create table archiv_elec_file
(
ID varchar(40) not null
primary key,
GID varchar(40) not null,
ElecFileID varchar(40) null,
ElecFileName varchar(200) not null,
ElecFileSavePath varchar(1000) null,
ElecFileType varchar(20) null,
ParentId varchar(40) null,
InnerfileTitle varchar(200) null,
BeginPageNum int null,
EndPageNum int null,
Timestamp timestamp null
);
create index archiv_elec_file_GID_index
on archiv_elec_file (GID);