| | |
| | | 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; |
| | |
| | | if (!StringUtils.isEmpty(uuid)) { |
| | | objects = new Object[]{uuid}; |
| | | } |
| | | DataTableEntity dt = getBaseDao().listTable(FaceConst.TABLE_FACE_CONFIG, filter, objects, null, null, Integer.MAX_VALUE, 1, true); |
| | | DataTableEntity dt = getBaseDao().listTable(FaceConst.TABLE_FACE_CONFIG, filter, objects, null, null, 0, 0, true); |
| | | if (DataTableEntity.isEmpty(dt)) { |
| | | return; |
| | | } |
| | |
| | | if (StringUtils.isEmpty(faceNumber)) { |
| | | return null; |
| | | } |
| | | return (FaceEntity) RedisUtil.get(FaceConst.FACE_FORM_CACHE_KEY + faceNumber); |
| | | FaceEntity face = (FaceEntity) RedisUtil.get(FaceConst.FACE_FORM_CACHE_KEY + faceNumber); |
| | | return face; |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | fse.getSubData().clear(); |
| | | String faceNumber = fse.getString(FaceConst.FIELD_FACE_NUMBER); |
| | | List<JSONObject> faceControlList = FaceUtil.getFaceControlList(fieldPropertyDt); |
| | | List<JSONObject> faceControlList = FaceUtil.getFaceControlList(fse, fieldPropertyDt); |
| | | if (faceControlList != null) { |
| | | FaceEntity face = new FaceEntity(); |
| | | face.setData(BaseUtil.fieldSetEntityToJson(fse)); |
| | |
| | | if (DataTableEntity.isEmpty(fieldPropertyDt)) { |
| | | return; |
| | | } |
| | | List<JSONObject> faceControlList = FaceUtil.getFaceControlList(fieldPropertyDt); |
| | | List<JSONObject> faceControlList = FaceUtil.getFaceControlList(fse, fieldPropertyDt); |
| | | JSONObject jsonObject = faceControlList.get(0); |
| | | if (jsonObject == null || jsonObject.isEmpty()) { |
| | | return; |
| | |
| | | } |
| | | String faceNumber = fse.getString(FaceConst.FIELD_FACE_NUMBER); |
| | | String tableUuid = fse.getString(FaceConst.FIELD_TABLE_UUID); |
| | | List<TableColumn> result = Lists.newArrayList(); |
| | | String treeShow = fse.getString("tree_show"); |
| | | String treeDataType = fse.getString("tree_data_type"); |
| | | String treeDataSource = fse.getString("tree_datasource"); |
| | | String treeLabelKey = fse.getString("tree_label_key"); |
| | | String treeValueKey = fse.getString("tree_value_key"); |
| | | FaceListEntity faceListEntity = new FaceListEntity(); |
| | | faceListEntity.setFaceName(faceNumber); |
| | | faceListEntity.setTableUuid(tableUuid); |
| | | faceListEntity.setUuid(fse.getUUID()); |
| | | faceListEntity.setTreeShow(treeShow); |
| | | faceListEntity.setTreeDataType(treeDataType); |
| | | faceListEntity.setTreeDataSource(treeDataSource); |
| | | 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())) { |