| | |
| | | import com.product.face.service.ide.IFaceDesignService; |
| | | import com.product.face.util.FaceUtil; |
| | | import com.product.util.BaseUtil; |
| | | import org.apache.poi.hdgf.pointers.Pointer; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | return BaseUtil.success(fse, other); |
| | | } |
| | | |
| | | public class Pointer { |
| | | int data = 0; |
| | | |
| | | public int getData() { |
| | | return ++data; |
| | | } |
| | | |
| | | public void setData(int data) { |
| | | this.data = data; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 保存表单内容数据 |
| | |
| | | ErrorCode.SAVE_EMPTY_FACE_FAIL.throwException(); |
| | | } |
| | | List<FieldSetEntity> fieldSetEntityList = new ArrayList<>(); |
| | | //声明一个带指针的int变量 |
| | | Pointer pointer = new Pointer(); |
| | | for (int i = 0; i < fields.getRows(); i++) { |
| | | if (fields.getBoolean(i, "event_property")) { |
| | | DataTableEntity subDataTable = fields.getFieldSetEntity(i).getSubDataTable("event_array"); |
| | |
| | | } |
| | | fields.setFieldValue(i, "event_array", BaseUtil.dataTableEntityToJson(subDataTable)); |
| | | } |
| | | fieldSetEntityList.addAll(controlTraverse(new JSONObject((Map) fields.getFieldSetEntity(i).getValues()), null, i)); |
| | | fieldSetEntityList.addAll(controlTraverse(new JSONObject((Map) fields.getFieldSetEntity(i).getValues()), null, i, pointer)); |
| | | } |
| | | fse.removeSubData(FaceConst.FACE_FIELD); |
| | | BaseUtil.createCreatorAndCreationTime(fse); |
| | |
| | | return fse; |
| | | } |
| | | |
| | | public List<FieldSetEntity> controlTraverse(Object o, String parentUuid, Integer sequence) { |
| | | public List<FieldSetEntity> controlTraverse(Object o, String parentUuid, Integer sequence, Pointer pointer) { |
| | | List<FieldSetEntity> fieldSetList = new ArrayList<>(); |
| | | try { |
| | | if (o instanceof JSONArray) { |
| | |
| | | try { |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | Object obj = jsonArray.get(i); |
| | | fieldSetList.addAll(controlTraverse(obj, parentUuid, i)); |
| | | fieldSetList.addAll(controlTraverse(obj, parentUuid, i, pointer)); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | int propertyType = fs.getInteger(FaceConst.FIELD_PROPERTY_TYPE).intValue(); |
| | | if ((4 == propertyType || 3 == propertyType) && (entry.getValue() instanceof JSONArray || entry.getValue() instanceof JSONObject)) { |
| | | try { |
| | | fieldSetList.addAll(controlTraverse(entry.getValue(), fs.getUUID(), null)); |
| | | fieldSetList.addAll(controlTraverse(entry.getValue(), fs.getUUID(), null, pointer)); |
| | | fs.remove(FaceConst.FIELD_PROPERTY_VALUE); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | |
| | | } |
| | | } |
| | | if (sequence != null) { |
| | | FieldSetEntity fs = getTemplateFieldSet(FaceConst.CONTROL_SEQUENCE, sequence, groupUuid); |
| | | FieldSetEntity fs = getTemplateFieldSet(FaceConst.CONTROL_SEQUENCE, pointer.getData(), groupUuid); |
| | | fs.setValue(FaceConst.FIELD_PARENT_UUID, parentUuid); |
| | | fieldSetList.add(fs); |
| | | } |