diff --git a/src/main/java/neatlogic/module/tenant/api/form/FormCopyApi.java b/src/main/java/neatlogic/module/tenant/api/form/FormCopyApi.java index ee4ba9bef7d0305df41634c3fca7ceb189a03dfe..447a371536cdbf1385948c95ef7d86411d8cc3a2 100644 --- a/src/main/java/neatlogic/module/tenant/api/form/FormCopyApi.java +++ b/src/main/java/neatlogic/module/tenant/api/form/FormCopyApi.java @@ -138,6 +138,12 @@ public class FormCopyApi extends PrivateApiComponentBase { formMapper.insertFormExtendAttribute(formAttributeVo); } } + List formVersionCustomExtendAttributeList = formVersionVo.getFormCustomExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formVersionCustomExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formVersionCustomExtendAttributeList) { + formMapper.insertFormExtendAttribute(formAttributeVo); + } + } } return newFrom; } diff --git a/src/main/java/neatlogic/module/tenant/api/form/FormImportApi.java b/src/main/java/neatlogic/module/tenant/api/form/FormImportApi.java index 5d1401a8e0cc6870577294dc43e5b5c9cca0f070..1a319de68c8fa36a89a19d2d39a38113d6adb95c 100755 --- a/src/main/java/neatlogic/module/tenant/api/form/FormImportApi.java +++ b/src/main/java/neatlogic/module/tenant/api/form/FormImportApi.java @@ -127,6 +127,14 @@ public class FormImportApi extends PrivateBinaryStreamApiComponentBase { formMapper.insertFormExtendAttribute(formAttributeVo); } } + List formCustomExtendAttributeList = formVersion.getFormCustomExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formCustomExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formCustomExtendAttributeList) { + formAttributeVo.setFormUuid(formVersion.getFormUuid()); + formAttributeVo.setFormVersionUuid(formVersion.getUuid()); + formMapper.insertFormExtendAttribute(formAttributeVo); + } + } } } else { resultList.add("更新表单:" + formVo.getName()); @@ -160,6 +168,14 @@ public class FormImportApi extends PrivateBinaryStreamApiComponentBase { formMapper.insertFormExtendAttribute(formAttributeVo); } } + List formCustomExtendAttributeList = formVersion.getFormCustomExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formCustomExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formCustomExtendAttributeList) { + formAttributeVo.setFormUuid(formVersion.getFormUuid()); + formAttributeVo.setFormVersionUuid(formVersion.getUuid()); + formMapper.insertFormExtendAttribute(formAttributeVo); + } + } } } return resultList; diff --git a/src/main/java/neatlogic/module/tenant/api/form/FormSaveApi.java b/src/main/java/neatlogic/module/tenant/api/form/FormSaveApi.java index 49a5e55f22e45bcf1f4a0b04480d71b10836be11..04b0730ba16fe8ea5b4f6548e29d4d4ff2fa35bd 100644 --- a/src/main/java/neatlogic/module/tenant/api/form/FormSaveApi.java +++ b/src/main/java/neatlogic/module/tenant/api/form/FormSaveApi.java @@ -193,6 +193,13 @@ public class FormSaveApi extends PrivateApiComponentBase { formMapper.insertFormExtendAttribute(formAttributeVo); } } + // 表单自定义扩展属性 + List formCustomExtendAttributeList = formVersionVo.getFormCustomExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formCustomExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formCustomExtendAttributeList) { + formMapper.insertFormExtendAttribute(formAttributeVo); + } + } } return resultObj; } diff --git a/src/main/java/neatlogic/module/tenant/api/form/FormVersionImportApi.java b/src/main/java/neatlogic/module/tenant/api/form/FormVersionImportApi.java index 0fc407c0d6d6e462491eb939e6c955b46e7040b4..4f3a67892ac0f665db4645a08fcb46890e1bd083 100755 --- a/src/main/java/neatlogic/module/tenant/api/form/FormVersionImportApi.java +++ b/src/main/java/neatlogic/module/tenant/api/form/FormVersionImportApi.java @@ -128,6 +128,14 @@ public class FormVersionImportApi extends PrivateBinaryStreamApiComponentBase { formMapper.insertFormExtendAttribute(formAttributeVo); } } + List formCustomExtendAttributeList = formVersionVo.getFormCustomExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formCustomExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formCustomExtendAttributeList) { + formAttributeVo.setFormUuid(formVersionVo.getFormUuid()); + formAttributeVo.setFormVersionUuid(formVersionVo.getUuid()); + formMapper.insertFormExtendAttribute(formAttributeVo); + } + } return resultObj; } else { throw new FileExtNotAllowedException(multipartFile.getOriginalFilename()); diff --git a/src/main/java/neatlogic/module/tenant/api/form/ListFormTagApi.java b/src/main/java/neatlogic/module/tenant/api/form/ListFormTagApi.java new file mode 100644 index 0000000000000000000000000000000000000000..ff06ed119cd68eacfd1db0c06ed9abcedd00e019 --- /dev/null +++ b/src/main/java/neatlogic/module/tenant/api/form/ListFormTagApi.java @@ -0,0 +1,96 @@ +/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.module.tenant.api.form; + +import com.alibaba.fastjson.JSONObject; +import neatlogic.framework.common.constvalue.ApiParamType; +import neatlogic.framework.form.dao.mapper.FormMapper; +import neatlogic.framework.form.dto.FormAttributeVo; +import neatlogic.framework.form.dto.FormVersionVo; +import neatlogic.framework.form.dto.FormVo; +import neatlogic.framework.form.exception.FormActiveVersionNotFoundExcepiton; +import neatlogic.framework.form.exception.FormNotFoundException; +import neatlogic.framework.restful.annotation.*; +import neatlogic.framework.restful.constvalue.OperationTypeEnum; +import neatlogic.framework.restful.core.privateapi.PrivateApiComponentBase; +import neatlogic.framework.util.TableResultUtil; +import org.apache.commons.collections4.CollectionUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +@Service +@OperationType(type = OperationTypeEnum.SEARCH) +public class ListFormTagApi extends PrivateApiComponentBase { + + @Resource + private FormMapper formMapper; + + @Override + public String getToken() { + return "form/tag/list"; + } + + @Override + public String getName() { + return "nmtaf.listformtagapi.getname"; + } + + @Override + public String getConfig() { + return null; + } + + @Input({ + @Param(name = "formUuid", type = ApiParamType.STRING, isRequired = true, desc = "term.framework.formuuid") + }) + @Output({ + @Param(name = "tbodyList", explode = String[].class, desc = "common.tbodylist") + }) + @Description(desc = "nmtaf.listformtagapi.getname") + @Override + public Object myDoService(JSONObject jsonObj) throws Exception { + String formUuid = jsonObj.getString("formUuid"); + FormVo form = formMapper.getFormByUuid(formUuid); + if (form == null) { + throw new FormNotFoundException(formUuid); + } + FormVersionVo formVersionVo = formMapper.getActionFormVersionByFormUuid(formUuid); + if (formVersionVo == null) { + throw new FormActiveVersionNotFoundExcepiton(form.getName()); + } + Set tagSet = new HashSet<>(); + List formExtendAttributeList = formVersionVo.getFormExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formExtendAttributeList) { + tagSet.add(formAttributeVo.getTag()); + } + } + List formCustomExtendAttributeList = formVersionVo.getFormCustomExtendAttributeList(); + if (CollectionUtils.isNotEmpty(formCustomExtendAttributeList)) { + for (FormAttributeVo formAttributeVo : formCustomExtendAttributeList) { + tagSet.add(formAttributeVo.getTag()); + } + } + + return TableResultUtil.getResult(new ArrayList<>(tagSet)); + } + +}