| | |
| | | */ |
| | | public List<FaceFieldEntity> getFaceConfig(FieldSetEntity fse) { |
| | | |
| | | String tableUuid=fse.getString("table_uuid"); |
| | | if (tableUuid==null && StringUtils.isNotEmpty(fse.getString("uuid")) |
| | | 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) { |
| | | if (detailFse != null) { |
| | | //获取表名 |
| | | fse.setValue("table_name", detailFse.getString("table_name")); |
| | | } |
| | | |
| | | } |
| | | //通过审批任务的uuid来查表单信息 |
| | | if (tableUuid==null && StringUtils.isNotEmpty(fse.getString("table_name"))) { |
| | | 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"); |
| | |
| | | } |
| | | } |
| | | |
| | | if(tableUuid!=null && fse.getString("table_name")==null) { |
| | | if (tableUuid != null && fse.getString("table_name") == null) { |
| | | |
| | | FieldSetEntity tableInfo = BaseUtil.getSingleInfoByCache("所有表信息(uuid)", new String[]{tableUuid}); |
| | | if (!FieldSetEntity.isEmpty(tableInfo)) { |
| | |
| | | } |
| | | } |
| | | |
| | | List<FaceFieldEntity> ls=getFaceFieldByTable(fse); |
| | | if(ls==null)ls=new ArrayList<FaceFieldEntity>(); |
| | | addproperty(tableUuid,fse.getString("table_name"),ls); |
| | | List<FaceFieldEntity> ls = getFaceFieldByTable(fse); |
| | | if (ls == null) ls = new ArrayList<FaceFieldEntity>(); |
| | | 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.size()>0) { |
| | | for(int i=0;i<ls.size();i++) { |
| | | String subTableName=ls.get(i).getSubTableName();///可能是子表 |
| | | if(StringUtils.isEmpty(subTableName)) {///主表字段 |
| | | private void addproperty(String table_uuid, String table_name, List<FaceFieldEntity> ls) { |
| | | 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()}); |
| | | , new String[]{table_uuid, ls.get(i).getField()}); |
| | | |
| | | if(!DataTableEntity.isEmpty(dt)) { |
| | | 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()) && |
| | | 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()) && |
| | | 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()) && |
| | | 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 { |
| | | } else { |
| | | //============把子表字段也处理一下 |
| | | //子表 |
| | | FieldSetEntity tableInfo = BaseUtil.getSingleInfoByCache("所有表信息", new String[]{subTableName}); |
| | | if (!FieldSetEntity.isEmpty(tableInfo)) { |
| | | addproperty(tableInfo.getString("uuid"),tableInfo.getString("table_name"),ls.get(i).getSubField()); |
| | | 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(); |
| | | DataTableEntity dt = DataPoolCacheImpl.getInstance().getCacheData("表字段信息", new String[]{table_uuid, "uuid"}); |
| | | if (!DataTableEntity.isEmpty(dt)) { |
| | | FaceFieldEntity uuid = new FaceFieldEntity(); |
| | | uuid.setComponentType("uuid"); |
| | | uuid.setField("uuid"); |
| | | uuid.setName("编 码"); |
| | |
| | | ls.add(uuid); |
| | | } |
| | | |
| | | }else {///以表单设计为准,如果没有配置表单,则以数据表为准,全部保留 |
| | | toConvertFace(table_uuid,table_name,ls,null); |
| | | } else {///以表单设计为准,如果没有配置表单,则以数据表为准,全部保留 |
| | | toConvertFace(table_uuid, table_name, ls, null); |
| | | //返回子表 |
| | | Object [][]sub=baseDao.getSubTableName(table_name); |
| | | if(sub!=null && sub.length>0&&sub[0].length>0) { |
| | | for(int i=0;i<sub[0].length;i++) { |
| | | toConvertFace(sub[0][i].toString(),sub[1][i].toString(),new ArrayList<FaceFieldEntity>(),ls); |
| | | Object[][] sub = baseDao.getSubTableName(table_name); |
| | | if (sub != null && sub.length > 0 && sub[0].length > 0) { |
| | | for (int i = 0; i < sub[0].length; i++) { |
| | | toConvertFace(sub[0][i].toString(), sub[1][i].toString(), new ArrayList<FaceFieldEntity>(), ls); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 数据库表字段定义转换成表单定义 |
| | | * @param table_uuid |
| | |
| | | * @param ls |
| | | * @param pls 父界面 |
| | | */ |
| | | private void toConvertFace(String table_uuid,String table_name,List<FaceFieldEntity> ls,List<FaceFieldEntity> pls) { |
| | | if(ls==null) { |
| | | ls=new ArrayList<FaceFieldEntity>(); |
| | | private void toConvertFace(String table_uuid, String table_name, List<FaceFieldEntity> ls, List<FaceFieldEntity> pls) { |
| | | if (ls == null) { |
| | | ls = new ArrayList<FaceFieldEntity>(); |
| | | } |
| | | 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")) |
| | | ||"updated_utc_datetime".equals(f.getString("field_name"))) { |
| | | 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")) |
| | | || "updated_utc_datetime".equals(f.getString("field_name"))) { |
| | | continue; |
| | | } |
| | | if("uuid".equals(f.getString("field_name"))) { |
| | | if ("uuid".equals(f.getString("field_name"))) { |
| | | uuid.setHidden("1"); |
| | | } |
| | | if("userids".equals(f.getString("field_type")) ||"orgUuids".equals(f.getString("field_type")) ) { |
| | | if ("userids".equals(f.getString("field_type")) || "orgUuids".equals(f.getString("field_type"))) { |
| | | uuid.setMultiple("1"); |
| | | }else { |
| | | } else { |
| | | uuid.setMultiple("0"); |
| | | } |
| | | |
| | |
| | | uuid.setTable(table_name); |
| | | ls.add(uuid); |
| | | } |
| | | if(pls!=null) { |
| | | FaceFieldEntity uuid=new FaceFieldEntity(); |
| | | if (pls != null) { |
| | | FaceFieldEntity uuid = new FaceFieldEntity(); |
| | | uuid.setHidden(""); |
| | | uuid.setComponentType("subTable"); |
| | | uuid.setPrompt(""); |
| | |
| | | for (FieldSetEntity setEntity : parentGroup) { |
| | | //找到属性名称= __vModel__ |
| | | String propertyName = setEntity.getString("property_name"); |
| | | if ("componentType".equals(propertyName)) { |
| | | continue; |
| | | } |
| | | if ("parentType".equals(propertyName) && "subTable".equals(setEntity.getString("property_value")) && subTableField != null) { |
| | | //子表字段 |
| | | subTableField.add(parentGroup); |
| | |
| | | } |
| | | propertyName = StrUtil.toCamelCase(propertyName); |
| | | if (ReflectUtil.hasField(FaceFieldEntity.class, propertyName) && !"field".equals(setEntity.getString("property_name")) && !"prompt".equals(setEntity.getString("property_name"))) { |
| | | if("prompt".equals(propertyName)){ |
| | | System.out.println(1); |
| | | } |
| | | ReflectUtil.setFieldValue(faceFieldEntity, propertyName, setEntity.getObject("property_value")); |
| | | |
| | | } else if (!StringUtils.isEmpty(setEntity.getObject("property_value"))) { |
| | |
| | | for (FieldSetEntity setEntity : configGroup) { |
| | | //找到属性名称= __vModel__ |
| | | String propertyName = setEntity.getString("property_name"); |
| | | if ("componentType".equals(propertyName)) { |
| | | continue; |
| | | } |
| | | if ("tag".equals(propertyName)) { |
| | | propertyName = "component_type"; |
| | | } else if ("field".equals(propertyName)) { |