| | |
| | | public void insertFiles(MetaEntity entity, List<MetaFileEntity> list, List<TabMapperEntity> tabList) { |
| | | try { |
| | | String temp = pathHelper.getConfig().getTempPath(); |
| | | String full = pathHelper.getUploadFullPath(); |
| | | String root = pathHelper.getConfig().getUploadPath(); |
| | | String upload = pathHelper.getUploadFullPath(); |
| | | |
| | | for (MetaFileEntity mf : list) { |
| | | File file = new File(temp + File.separator + mf.getPath()); |
| | | File newFile = new File(root + File.separator + mf.getGuid()); |
| | | File newFile = new File(upload + File.separator + mf.getGuid()); |
| | | |
| | | String type = getType(mf.getName().toLowerCase()); |
| | | if (null == type) { |
| | |
| | | insertXls(temp, mf, tab); |
| | | break; |
| | | } |
| | | int rows = tab.getRows(); |
| | | if (rows == 0) { |
| | | if (0 == tab.getRows()) { |
| | | continue; |
| | | } |
| | | |
| | | MetaEntity me = createMetaEntity(entity, mf); |
| | | // me.setTab,me.setRow |
| | | MetaEntity me = createMetaEntity(entity, mf, tab.getTab(), tab.getRows()); |
| | | if (metaService.insert(me) == 0) { |
| | | continue; |
| | | } |
| | |
| | | metaService.delete(me.getId()); |
| | | continue; |
| | | } |
| | | |
| | | count += rows; |
| | | count += tab.getRows(); |
| | | } |
| | | |
| | | if (count == 0 || null != old) { |
| | |
| | | /** |
| | | * 创建元数据实体 |
| | | */ |
| | | private MetaEntity createMetaEntity(MetaEntity entity, MetaFileEntity mf) { |
| | | private MetaEntity createMetaEntity(MetaEntity entity, MetaFileEntity mf, String tab, int rows) { |
| | | MetaEntity me = new MetaEntity(); |
| | | me.setDepid(entity.getDepid()); |
| | | me.setDirid(entity.getDirid()); |
| | |
| | | me.setDescr(entity.getDescr()); |
| | | me.setName(mf.getName()); |
| | | me.setSizes(mf.getSizes()); |
| | | me.setTab(tab); |
| | | me.setRows(rows); |
| | | me.setCreateTime(entity.getCreateTime()); |
| | | me.setCreateUser(entity.getCreateUser()); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | String tabName = BaseQueryService.getTabName(basicMapper); |
| | | String className = ClassHelper.getClassName(basicMapper); |
| | | Class clazz = ClassHelper.getEntityClass(className); |
| | | if (null == clazz) { |
| | | if (null == clazz || null == tabName) { |
| | | return; |
| | | } |
| | | |
| | |
| | | updateXlsGeom((GeomBaseMapper) basicMapper, list); |
| | | } |
| | | |
| | | tab.setTab(tabName); |
| | | tab.setRows(rows); |
| | | } |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | String tabName = BaseQueryService.getTabName(basicMapper); |
| | | String className = ClassHelper.getClassName(basicMapper); |
| | | Class clazz = ClassHelper.getEntityClass(className); |
| | | if (null == clazz) { |
| | | if (null == clazz || null == tabName) { |
| | | return; |
| | | } |
| | | |
| | |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | setCreateInfo(list, mf); |
| | | int rows = basicMapper.insertBatch(list); |
| | | |
| | | int rows = basicMapper.insertBatch(list); |
| | | tab.setTab(tabName); |
| | | tab.setRows(rows); |
| | | } |
| | | |