| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.lf.server.entity.all.BaseEntity; |
| | | import com.lf.server.entity.data.FmeLogEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.sys.AttachEntity; |
| | | import com.lf.server.helper.ClassHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | |
| | | * 查询FME日志 |
| | | */ |
| | | public List<FmeLogEntity> selectFmeLogs() { |
| | | if (null == tabs) { |
| | | if (StringHelper.isEmpty(tabs)) { |
| | | tabs = UploadAttachService.getTabs().replace("'", ""); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public MetaEntity selectMetaByName(String name) { |
| | | return attachMapper.selectMetaByName(name); |
| | | public Integer insertAttachByMeta(String tab, String tabGuid, String metaName, String dirid) { |
| | | return attachMapper.insertAttachByMeta(tab, tabGuid, metaName, dirid); |
| | | } |
| | | |
| | | /** |
| | |
| | | return; |
| | | } |
| | | |
| | | Field field = getAnnexField(list.get(0), fieldName); |
| | | Field field = UploadAttachService.getAnnexField(list.get(0), tab); |
| | | if (null == field) { |
| | | return; |
| | | } |
| | | |
| | | for (Object obj : list) { |
| | | String[] names = UploadAttachService.getNames(UploadAttachService.getAnnexName(obj, field)); |
| | | if (null == names || names.length == 0) { |
| | | continue; |
| | | } |
| | | |
| | | BaseEntity be = (BaseEntity) obj; |
| | | // |
| | | String dirid = getDirid(be); |
| | | for (String name : names) { |
| | | insertAttachByMeta(tab, be.getEventid(), name, dirid); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取目录编码 |
| | | */ |
| | | private String getDirid(BaseEntity be) { |
| | | if (StringHelper.isEmpty(be.getDirid())) { |
| | | return null; |
| | | } |
| | | |
| | | String dirid = be.getDirid().substring(0, 2); |
| | | |
| | | return StringHelper.getRightLike(dirid); |
| | | } |
| | | |
| | | /** |
| | |
| | | wrapper.apply(field + " is not null"); |
| | | |
| | | return baseMapper.selectList(wrapper); |
| | | } |
| | | |
| | | /** |
| | | * 获取附件字段 |
| | | */ |
| | | private Field getAnnexField(Object obj, String name) { |
| | | try { |
| | | Field field = obj.getClass().getDeclaredField(name); |
| | | field.setAccessible(true); |
| | | |
| | | return field; |
| | | } catch (Exception ex) { |
| | | return null; |
| | | } |
| | | } |
| | | } |