| | |
| | | import com.lf.server.entity.data.FmeLogEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.GdbHelper; |
| | | import com.lf.server.helper.ShpHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.*; |
| | | import com.lf.server.mapper.all.BasicMapper; |
| | | import com.lf.server.mapper.data.UploadMapper; |
| | | import com.lf.server.service.all.BaseQueryService; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.sql.Timestamp; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 检查元数据文件 |
| | | */ |
| | | private void checkMetaFiles(UserEntity ue, List<MetaFileEntity> list) { |
| | | Timestamp createTime = WebHelper.getCurrentTimestamp(); |
| | | String tempPath = pathHelper.getConfig().getTempPath(); |
| | | |
| | | for (MetaFileEntity mf : list) { |
| | | mf.setCreateUser(ue.getId()); |
| | | mf.setCreatetime(createTime); |
| | | mf.setDepid(ue.getDepid()); |
| | | mf.setPath(tempPath + File.separator + mf.getPath()); |
| | | |
| | | File f = new File(mf.getPath()); |
| | | if (!f.exists()) { |
| | | mf.setRows(-1); |
| | | mf.setMsg("文件不存在"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 加载数据 |
| | | */ |
| | | private void dataLoader(List<MetaFileEntity> list) { |
| | | loadData(list); |
| | | copyFiles(list); |
| | | insertMetas(list); |
| | | } |
| | | |
| | | /** |
| | |
| | | setCreateInfo(list, mf); |
| | | |
| | | int rows = basicMapper.insertBatch(list); |
| | | mf.setTab(tabName); |
| | | mf.setRows(rows); |
| | | if (rows > 0) { |
| | | mf.setTab(tabName); |
| | | mf.setRows(rows); |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | BaseEntity be = (BaseEntity) t; |
| | | be.setEventid(StringHelper.getGuid()); |
| | | be.setParentid(mf.getEventid()); |
| | | be.setCreateuser(mf.getCreateUser()); |
| | | be.setCreatetime(mf.getCreatetime()); |
| | | be.setDirid(mf.getDirid()); |
| | | be.setDepid(mf.getDepid()); |
| | | be.setVerid(mf.getVerid()); |
| | | be.setCreateuser(mf.getCreateUser()); |
| | | be.setCreatetime(mf.getCreatetime()); |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | |
| | | * 复制文件 |
| | | */ |
| | | private void copyFiles(List<MetaFileEntity> list) { |
| | | for (MetaFileEntity mf : list) { |
| | | switch (mf.getExtName()) { |
| | | case StaticData.MPT: |
| | | copyMultiFile(mf, StaticData.MPT_EXT); |
| | | break; |
| | | case StaticData.IMG: |
| | | copyMultiFile(mf, StaticData.IMG_EXT); |
| | | break; |
| | | case StaticData.TIF: |
| | | copyMultiFile(mf, StaticData.TIF_EXT); |
| | | break; |
| | | case StaticData.TIFF: |
| | | copyMultiFile(mf, StaticData.TIFF_EXT); |
| | | break; |
| | | case StaticData.SHP: |
| | | copyMultiFile(mf, StaticData.SHP_EXT); |
| | | break; |
| | | case StaticData.GDB: |
| | | copyFolderFile(mf); |
| | | break; |
| | | default: |
| | | copySingleFile(mf); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 复制单个文件 |
| | | */ |
| | | private void copySingleFile(MetaFileEntity mf) { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 检查元数据文件 |
| | | * 复制多个文件 |
| | | */ |
| | | private void checkMetaFiles(UserEntity ue, List<MetaFileEntity> list) { |
| | | String tempPath = pathHelper.getConfig().getTempPath(); |
| | | for (MetaFileEntity mf : list) { |
| | | mf.setCreateUser(ue.getId()); |
| | | mf.setDepid(ue.getDepid()); |
| | | mf.setPath(tempPath + File.separator + mf.getPath()); |
| | | private void copyMultiFile(MetaFileEntity mf, List<String> extList) { |
| | | |
| | | File f = new File(mf.getPath()); |
| | | if (!f.exists()) { |
| | | mf.setRows(-1); |
| | | mf.setMsg("文件不存在"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 复制文件夹文件 |
| | | */ |
| | | private void copyFolderFile(MetaFileEntity mf) { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 插入元数据 |
| | | * |
| | | * @param list |
| | | */ |
| | | private void insertMetas(List<MetaFileEntity> list) { |
| | | for (MetaFileEntity mf : list) { |
| | | // |
| | | } |
| | | } |
| | | |