| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.google.common.collect.Lists; |
| | | import com.product.common.lang.StringUtils; |
| | | import com.product.core.cache.util.RedisUtil; |
| | | import com.product.core.entity.DataTableEntity; |
| | |
| | | import com.product.face.config.FaceConst; |
| | | import com.product.face.entity.FaceEntity; |
| | | import com.product.face.entity.FaceListEntity; |
| | | import com.product.face.entity.TableColumn; |
| | | import com.product.face.util.FaceUtil; |
| | | import com.product.util.BaseUtil; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | String treeDataSource = fse.getString("tree_datasource"); |
| | | String treeLabelKey = fse.getString("tree_label_key"); |
| | | String treeValueKey = fse.getString("tree_value_key"); |
| | | List<TableColumn> result = Lists.newArrayList(); |
| | | FaceListEntity faceListEntity = new FaceListEntity(); |
| | | faceListEntity.setFaceName(faceNumber); |
| | | faceListEntity.setTableUuid(tableUuid); |
| | |
| | | faceListEntity.setTreeLabelKey(treeLabelKey); |
| | | faceListEntity.setTreeValueKey(treeValueKey); |
| | | for (int i = 0; i < tableColumns.size(); i++) { |
| | | TableColumn tableColumn = new TableColumn(); |
| | | JSONObject columnJson = tableColumns.getJSONObject(i); |
| | | String fieldName = columnJson.getString(FaceConst.FIELD_PROPERTY_VMODEL); |
| | | if (StringUtils.isEmpty(fieldName)) { |
| | |
| | | JSONObject config = columnJson.getJSONObject(FaceConst.FIELD_PROPERTY_CONFIG); |
| | | |
| | | Object setWidth = config.get("setWidth"); |
| | | if (!StringUtils.isEmpty(setWidth)) { |
| | | tableColumn.setColumnWidth(setWidth + "%"); |
| | | } |
| | | FieldSetEntity fieldInfo = BaseUtil.getSingleInfoByCache("表字段信息", new String[]{tableUuid, fieldName}); |
| | | String label = config.getString(FaceConst.FIELD_PROPERTY_LABEL); |
| | | boolean search = !"0".equals(config.getString("isSearch")); |
| | | String fieldUuid = null; |
| | | String fieldReference = null; |
| | | if (!FieldSetEntity.isEmpty(fieldInfo)) { |
| | | fieldUuid = fieldInfo.getString(FaceConst.UUID); |
| | | fieldReference = fieldInfo.getString(FaceConst.FIELD_FIELD_REFERENCE); |
| | | } |
| | | faceListEntity.addField(fieldName, fieldUuid, label, tableColumn.getColumnWidth(), i, fieldReference); |
| | | tableColumn.setField(fieldName); |
| | | tableColumn.setTitle(config.getString(FaceConst.FIELD_PROPERTY_LABEL)); |
| | | result.add(tableColumn); |
| | | faceListEntity.addField(fieldName, fieldUuid, label, !StringUtils.isEmpty(setWidth)? setWidth+"%" : null, i, fieldReference,search); |
| | | } |
| | | //验证表单中的字段是否存在 |
| | | if (faceListEntity != null && !CollectionUtil.isEmpty(faceListEntity.getFaceFields())) { |