| | |
| | | |
| | | @Resource |
| | | FlowDetailService flowDetailService; |
| | | |
| | | |
| | | ///获取表单总入口 |
| | | /** |
| | | * |
| | | * @param fse传入表名,或 表UUID |
| | | * @return |
| | | */ |
| | | public List<FaceFieldEntity> getFaceConfig(FieldSetEntity fse) { |
| | | |
| | | String tableUuid=fse.getString("table_uuid"); |
| | | if (tableUuid==null && StringUtils.isNotEmpty(fse.getString("uuid")) |
| | | && StringUtils.isEmpty(fse.getString("table_name"))) { |
| | | //通过业务表信息查表单信息 |
| | | FieldSetEntity detailFse = getBaseDao().getFieldSetEntity(CmnConst.TABLE_FLOW_DETAIL, fse.getString(CmnConst.FIELD_UUID), false); |
| | | if(detailFse!=null) { |
| | | //获取表名 |
| | | fse.setValue("table_name", detailFse.getString("table_name")); |
| | | } |
| | | |
| | | } |
| | | //通过审批任务的uuid来查表单信息 |
| | | if (tableUuid==null && StringUtils.isNotEmpty(fse.getString("table_name"))) { |
| | | FieldSetEntity tableInfo = BaseUtil.getSingleInfoByCache("所有表信息", new String[]{fse.getString("table_name")}); |
| | | if (!FieldSetEntity.isEmpty(tableInfo)) { |
| | | tableUuid = tableInfo.getString("uuid"); |
| | | fse.setValue("table_uuid", tableUuid); |
| | | } |
| | | } |
| | | |
| | | if(tableUuid!=null) { |
| | | |
| | | FieldSetEntity tableInfo = BaseUtil.getSingleInfoByCache("所有表信息(uuid)", new String[]{tableUuid}); |
| | | if (!FieldSetEntity.isEmpty(tableInfo)) { |
| | | //获取表名 |
| | | fse.setValue("table_name", tableInfo.getString("table_name")); |
| | | } |
| | | } |
| | | |
| | | List<FaceFieldEntity> ls=getFaceFieldByTable(fse); |
| | | |
| | | addproperty(tableUuid,fse.getString("table_name"),ls); |
| | | //所有表单uuid自动添加,并为hidden |
| | | return ls; |
| | | |
| | | } |
| | | //递归把主表和子表的字段属性添加进去,如果没有配表单,则取表数据结构进行展示 |
| | | /** |
| | | * |
| | | * @param ls查出来的表单信息 |
| | | * @param tables 记录的所有表,对应的表单信息 |
| | | */ |
| | | private void addproperty(String table_uuid,String table_name,List<FaceFieldEntity> ls) { |
| | | if(ls==null) { |
| | | ls=new ArrayList<FaceFieldEntity>(); |
| | | } |
| | | if(ls.size()>0) { |
| | | for(int i=0;i<ls.size();i++) { |
| | | String subTableName=ls.get(i).getSubTableName();///可能是子表 |
| | | if(StringUtils.isEmpty(subTableName)) {///主表字段 |
| | | DataTableEntity dt = DataPoolCacheImpl.getInstance().getCacheData("表字段信息" |
| | | ,new String[] {table_uuid,ls.get(i).getField()}); |
| | | |
| | | if(!DataTableEntity.isEmpty(dt)) { |
| | | // if(StringUtils.isEmpty(ls.get(i).getType())) { |
| | | // ls.get(i).setType(dt.getFieldSetEntity(0).getString("field_type")); |
| | | // } |
| | | if(StringUtils.isEmpty(ls.get(i).getPrompt()) && |
| | | !StringUtils.isEmpty(dt.getFieldSetEntity(0).getString("field_reference"))) { |
| | | ls.get(i).setPrompt(dt.getFieldSetEntity(0).getString("field_reference")); |
| | | } |
| | | if(StringUtils.isEmpty(ls.get(i).getRequired()) && |
| | | !StringUtils.isEmpty(dt.getFieldSetEntity(0).getString("is_required"))) { |
| | | ls.get(i).setRequired(dt.getFieldSetEntity(0).getString("is_required")); |
| | | } |
| | | if(StringUtils.isEmpty(ls.get(i).getName()) && |
| | | !StringUtils.isEmpty(dt.getFieldSetEntity(0).getString("field_show_name"))) { |
| | | ls.get(i).setName(dt.getFieldSetEntity(0).getString("field_show_name")); |
| | | } |
| | | } |
| | | ls.get(i).setTable(table_name); |
| | | }else { |
| | | //============把子表字段也处理一下 |
| | | //子表 |
| | | FieldSetEntity tableInfo = BaseUtil.getSingleInfoByCache("所有表信息", new String[]{subTableName}); |
| | | if (!FieldSetEntity.isEmpty(tableInfo)) { |
| | | addproperty(tableInfo.getString("uuid"),tableInfo.getString("table_name"),ls.get(i).getSubField()); |
| | | } |
| | | } |
| | | |
| | | } |
| | | DataTableEntity dt = DataPoolCacheImpl.getInstance().getCacheData("表字段信息",new String[] {table_uuid,"uuid"}); |
| | | if(!DataTableEntity.isEmpty(dt)) { |
| | | FaceFieldEntity uuid=new FaceFieldEntity(); |
| | | uuid.setField("uuid"); |
| | | uuid.setType("String"); |
| | | uuid.setTable(table_name); |
| | | uuid.setDisabled("0"); |
| | | ls.add(uuid); |
| | | } |
| | | |
| | | }else {///以表单设计为准,如果没有配置表单,则以数据表为准,全部保留 |
| | | DataTableEntity dte = DataPoolCacheImpl.getInstance().getCacheData("所有字段信息并按表分组",new String[] {table_uuid}); |
| | | for(int j=0;j<dte.getRows();j++) { |
| | | FaceFieldEntity uuid=new FaceFieldEntity(); |
| | | FieldSetEntity f=dte.getFieldSetEntity(j); |
| | | if("pk".equals(f.getString("field_type")) |
| | | ||"updated_by".equals(f.getString("field_name")) |
| | | ||"uuid".equals(f.getString("field_name")) |
| | | ||"updated_utc_datetime".equals(f.getString("field_name"))) { |
| | | continue; |
| | | } |
| | | uuid.setPrompt(f.getString("field_reference")); |
| | | uuid.setName(f.getString("field_show_name")); |
| | | uuid.setField(f.getString("field_name")); |
| | | uuid.setType(f.getString("field_type")); |
| | | uuid.setTable(table_name); |
| | | ls.add(uuid); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public List<FaceFieldEntity> getFaceFieldByTable(FieldSetEntity fse) { |
| | | String tableUuid = fse.getString("table_uuid"); |
| | | String tableName = fse.getString("table_name"); |
| | |
| | | throw new BaseException(MobileCoreCode.SYSTEM_FORM_COUNT); |
| | | } |
| | | FieldSetEntity faceFse = getBaseDao().getFieldSetByFilter("product_sys_face", "table_uuid=?", new Object[]{tableUuid}, true); |
| | | faceFse.setTableName(tableName); |
| | | return getFaceField(faceFse); |
| | | } |
| | | |
| | |
| | | } |
| | | if ("__vModel__".equals(setEntity.getString("property_name"))) { |
| | | result.add(faceFieldEntity); |
| | | propertyName = "fieldName"; |
| | | propertyName = "field"; |
| | | } else if ("defaultNow".equals(propertyName)) { |
| | | propertyName = "defaultValue"; |
| | | } else if ("__config__".equals(propertyName)) { |
| | |
| | | |
| | | } |
| | | } |
| | | if (StringUtils.isEmpty(faceFieldEntity.getFieldName())) { |
| | | if (StringUtils.isEmpty(faceFieldEntity.getField())) { |
| | | return; |
| | | } |
| | | if (parentGroup == other) { |