| | |
| | | import com.google.common.collect.Sets; |
| | | import com.product.common.lang.StringUtils; |
| | | import com.product.core.cache.DataPoolCacheImpl; |
| | | import com.product.core.dao.BaseDao; |
| | | import com.product.core.entity.DataTableEntity; |
| | | import com.product.core.entity.FieldSetEntity; |
| | | import com.product.core.exception.BaseException; |
| | |
| | | import com.product.tool.flow.config.CmnConst; |
| | | import com.product.tool.flow.service.FlowDetailService; |
| | | import com.product.util.BaseUtil; |
| | | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | FlowDetailService flowDetailService; |
| | | |
| | | @Autowired |
| | | public BaseDao baseDao; |
| | | |
| | | ///获取表单总入口 |
| | | /** |
| | |
| | | } |
| | | } |
| | | |
| | | if(tableUuid!=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); |
| | | //所有表单uuid自动添加,并为hidden |
| | | return 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();///可能是子表 |
| | |
| | | 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("编 码"); |
| | | uuid.setType("String"); |
| | | uuid.setTable(table_name); |
| | | uuid.setDisabled("0"); |
| | | uuid.setHidden("1"); |
| | | ls.add(uuid); |
| | | } |
| | | |
| | | }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); |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | /** |
| | | * 数据库表字段定义转换成表单定义 |
| | | * @param table_uuid |
| | | * @param table_name |
| | | * @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>(); |
| | | } |
| | | 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; |
| | | } |
| | | if("uuid".equals(f.getString("field_name"))) { |
| | | uuid.setHidden("1"); |
| | | } |
| | | if("userids".equals(f.getString("field_type")) ||"orgUuids".equals(f.getString("field_type")) ) { |
| | | uuid.setMultiple("1"); |
| | | }else { |
| | | uuid.setMultiple("0"); |
| | | } |
| | | |
| | | uuid.setComponentType(""); |
| | | uuid.setPrompt(f.getString("field_reference")); |
| | | uuid.setName(f.getString("field_show_name")); |
| | | uuid.setField(f.getString("field_name")); |
| | |
| | | uuid.setTable(table_name); |
| | | ls.add(uuid); |
| | | } |
| | | if(pls!=null) { |
| | | FaceFieldEntity uuid=new FaceFieldEntity(); |
| | | uuid.setHidden(""); |
| | | uuid.setComponentType("subTable"); |
| | | uuid.setPrompt(""); |
| | | uuid.setName(""); |
| | | uuid.setField(""); |
| | | uuid.setType(""); |
| | | uuid.setSubField(ls); |
| | | uuid.setSubTableName(table_name); |
| | | pls.add(uuid); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public List<FaceFieldEntity> getFaceFieldByTable(FieldSetEntity fse) { |
| | | String tableUuid = fse.getString("table_uuid"); |
| | |
| | | |
| | | private List<FaceFieldEntity> getFaceField(FieldSetEntity faceFse) { |
| | | if (FieldSetEntity.isEmpty(faceFse) || DataTableEntity.isEmpty(faceFse.getSubDataTable("product_sys_face_control_property"))) { |
| | | throw new BaseException(MobileCoreCode.GET_FACE_CONFIG_FAIL); |
| | | return null; |
| | | // throw new BaseException(MobileCoreCode.GET_FACE_CONFIG_FAIL); |
| | | } |
| | | |
| | | DataTableEntity productSysFaceControlProperty = faceFse.getSubDataTable("product_sys_face_control_property"); |