Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
fill-system
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
廖旭伟
fill-system
Commits
449e0d73
Commit
449e0d73
authored
Jun 12, 2025
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加cad 级联组件
parent
f3471e9a
Pipeline
#2971
canceled with stages
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
424 additions
and
23 deletions
+424
-23
fill-manager/src/main/java/com/mortals/xhx/common/code/ComponentEnum.java
.../main/java/com/mortals/xhx/common/code/ComponentEnum.java
+2
-1
fill-manager/src/main/java/com/mortals/xhx/common/formdesign/DesignComponent.java
...va/com/mortals/xhx/common/formdesign/DesignComponent.java
+3
-0
fill-manager/src/main/java/com/mortals/xhx/common/formdesign/component/DesignDynamicTableComponent.java
...mon/formdesign/component/DesignDynamicTableComponent.java
+283
-9
fill-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterDatumServiceImpl.java
...hx/module/matter/service/impl/MatterDatumServiceImpl.java
+136
-13
No files found.
fill-manager/src/main/java/com/mortals/xhx/common/code/ComponentEnum.java
View file @
449e0d73
...
...
@@ -19,7 +19,8 @@ public enum ComponentEnum {
AREA
(
"area"
,
"区域选择栏"
),
IMAGE
(
"@image"
,
"图片选择"
),
LIST
(
"list"
,
"横向单列表"
),
DYNAMIC_TABLE
(
"dt"
,
"动态表格"
);
DYNAMIC_TABLE
(
"dt"
,
"动态表格"
),
CASCADE
(
"csd"
,
"级联选择"
);
private
String
value
;
private
String
desc
;
...
...
fill-manager/src/main/java/com/mortals/xhx/common/formdesign/DesignComponent.java
View file @
449e0d73
...
...
@@ -40,6 +40,9 @@ public abstract class DesignComponent {
return
new
DesignListComponent
(
type
);
}
else
if
(
type
.
equals
(
ComponentEnum
.
DYNAMIC_TABLE
.
getValue
()))
{
return
new
DesignDynamicTableComponent
(
type
);
}
else
if
(
type
.
equals
(
ComponentEnum
.
CASCADE
.
getValue
()))
{
//return new DesignCascadeComponent(type);
return
null
;
}
// else if (type.equals(ComponentEnum.AREA.getValue())) {
// return new AreaComponent(type);
...
...
fill-manager/src/main/java/com/mortals/xhx/common/formdesign/component/DesignDynamicTableComponent.java
View file @
449e0d73
package
com.mortals.xhx.common.formdesign.component
;
import
cn.hutool.core.util.IdUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.google.common.collect.Lists
;
import
com.mortals.xhx.common.code.ComponentEnum
;
import
com.mortals.xhx.common.formdesign.*
;
import
com.mortals.xhx.common.pdu.gen.component.ComponentCons
;
import
com.mortals.xhx.common.utils.StringUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.util.ObjectUtils
;
import
java.util.ArrayList
;
...
...
@@ -18,6 +22,7 @@ import java.util.stream.Collectors;
* @date: 2021/10/26 10:35
* @description:
**/
@Slf4j
public
class
DesignDynamicTableComponent
extends
DesignComponent
{
public
DesignDynamicTableComponent
(
String
type
)
{
...
...
@@ -50,10 +55,10 @@ public class DesignDynamicTableComponent extends DesignComponent {
//动态生成列元素
List
<
ColumnsItem
>
columnsItemList
=
cons
.
getColList
().
stream
().
map
(
item
->
{
ColumnsItem
columnsItem
=
new
ColumnsItem
();
columnsItem
.
setId
(
item
.
getVal
());
columnsItem
.
set_id
(
item
.
getVal
());
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
INPUT
.
getValue
()))
{
//创建输入框出初始值
columnsItem
.
setId
(
item
.
getVal
());
columnsItem
.
set_id
(
item
.
getVal
());
columnsItem
.
setCompType
(
"input"
);
columnsItem
.
setCompName
(
"单行文本"
);
columnsItem
.
setCompIcon
(
"input"
);
...
...
@@ -82,8 +87,6 @@ public class DesignDynamicTableComponent extends DesignComponent {
columnsItem
.
setPrepend
(
""
);
columnsItem
.
setLayout
(
"colItem"
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
TEXTAREA
.
getValue
())){
columnsItem
.
setId
(
item
.
getVal
());
columnsItem
.
set_id
(
item
.
getVal
());
columnsItem
.
setCompType
(
"textarea"
);
columnsItem
.
setEle
(
"el-input"
);
columnsItem
.
setCompName
(
"多行文本"
);
...
...
@@ -109,10 +112,190 @@ public class DesignDynamicTableComponent extends DesignComponent {
columnsItem
.
setRules
(
Lists
.
newArrayList
());
columnsItem
.
setRuleError
(
"该字段不能为空"
);
columnsItem
.
setRulesType
(
"default"
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
SELECT
.
getValue
())){
columnsItem
.
setCompType
(
"select"
);
columnsItem
.
setCompName
(
item
.
getLabel
());
columnsItem
.
setCompIcon
(
"select"
);
columnsItem
.
setEle
(
"el-select"
);
columnsItem
.
setViewType
(
"component"
);
columnsItem
.
setConfig
(
true
);
columnsItem
.
setShowLabel
(
true
);
columnsItem
.
setLabel
(
item
.
getLabel
());
columnsItem
.
setLabelWidth
(
120
);
columnsItem
.
setPlaceholder
(
"请输入"
+
item
.
getLabel
());
columnsItem
.
setMaxLength
(
50
);
columnsItem
.
setRequired
(
false
);
columnsItem
.
setMultiple
(
false
);
columnsItem
.
setCollapseTags
(
false
);
columnsItem
.
setDisabled
(
false
);
columnsItem
.
setGutter
(
15
);
columnsItem
.
setSpan
(
12
);
columnsItem
.
setDataType
(
"static"
);
columnsItem
.
setClearable
(
false
);
columnsItem
.
setRules
(
Lists
.
newArrayList
());
columnsItem
.
setLayout
(
"colItem"
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
DATE
.
getValue
())){
columnsItem
.
setRuleError
(
"该字段不能为空"
);
columnsItem
.
setRulesType
(
"default"
);
initDefaultSelectValue
(
item
,
columnsItem
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
RADIO
.
getValue
())){
log
.
info
(
"radio:{}"
,
JSON
.
toJSONString
(
item
));
columnsItem
.
setCompType
(
"radio"
);
columnsItem
.
setCompName
(
item
.
getLabel
());
columnsItem
.
setCompIcon
(
"radio"
);
columnsItem
.
setEle
(
"el-radio-group"
);
columnsItem
.
setViewType
(
"component"
);
columnsItem
.
setConfig
(
true
);
columnsItem
.
setShowLabel
(
true
);
columnsItem
.
setLabel
(
item
.
getLabel
());
columnsItem
.
setLabelWidth
(
120
);
columnsItem
.
setPlaceholder
(
"请输入"
+
item
.
getLabel
());
columnsItem
.
setMaxLength
(
50
);
columnsItem
.
setRequired
(
false
);
columnsItem
.
setDisabled
(
false
);
columnsItem
.
setBorder
(
false
);
columnsItem
.
setSize
(
"medium"
);
columnsItem
.
setGutter
(
15
);
columnsItem
.
setSpan
(
12
);
columnsItem
.
setOptionType
(
"default"
);
columnsItem
.
setDataType
(
"static"
);
columnsItem
.
setClearable
(
false
);
columnsItem
.
setRules
(
Lists
.
newArrayList
());
columnsItem
.
setLayout
(
"colItem"
);
columnsItem
.
setRuleError
(
"该字段不能为空"
);
initDefaultRadioValue
(
item
,
columnsItem
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
CHECKBOX
.
getValue
())){
columnsItem
.
setCompType
(
"checkbox"
);
columnsItem
.
setCompName
(
item
.
getLabel
());
columnsItem
.
setCompIcon
(
"checkbox"
);
columnsItem
.
setEle
(
"el-checkbox-group"
);
columnsItem
.
setViewType
(
"component"
);
columnsItem
.
setConfig
(
true
);
columnsItem
.
setShowLabel
(
true
);
columnsItem
.
setLabel
(
item
.
getLabel
());
columnsItem
.
setLabelWidth
(
120
);
columnsItem
.
setPlaceholder
(
"请输入"
+
item
.
getLabel
());
columnsItem
.
setMaxLength
(
50
);
columnsItem
.
setRequired
(
false
);
columnsItem
.
setMultiple
(
false
);
columnsItem
.
setCollapseTags
(
false
);
columnsItem
.
setDisabled
(
false
);
columnsItem
.
setBorder
(
false
);
columnsItem
.
setSize
(
"medium"
);
columnsItem
.
setGutter
(
15
);
columnsItem
.
setSpan
(
12
);
columnsItem
.
setOptionType
(
"default"
);
columnsItem
.
setDataType
(
"static"
);
columnsItem
.
setAction
(
"https://www.fastmock.site/mock/51715c0157535b99010bde55f2df33c8/formDesigner/api/options"
);
columnsItem
.
setClearable
(
false
);
columnsItem
.
setValue
(
""
);
columnsItem
.
setRules
(
Lists
.
newArrayList
());
columnsItem
.
setLayout
(
"colItem"
);
columnsItem
.
setRuleError
(
"该字段不能为空"
);
columnsItem
.
setRulesType
(
"default"
);
initDefaultCheckBoxValue
(
item
,
columnsItem
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
IMAGE
.
getValue
())){
columnsItem
.
setCompType
(
"upload"
);
columnsItem
.
setCompName
(
"附件"
);
columnsItem
.
setCompIcon
(
"att"
);
columnsItem
.
setEle
(
"el-upload"
);
columnsItem
.
setViewType
(
"component"
);
columnsItem
.
setConfig
(
true
);
columnsItem
.
setShowLabel
(
true
);
columnsItem
.
setLabel
(
item
.
getLabel
());
columnsItem
.
setLabelWidth
(
120
);
columnsItem
.
setMultiple
(
false
);
columnsItem
.
setRequired
(
false
);
// columnsItem.setAction(item.getUploadFileUrl());
columnsItem
.
setName
(
"file"
);
columnsItem
.
setShowFileList
(
true
);
columnsItem
.
setListType
(
"picture-card"
);
columnsItem
.
setShowTip
(
false
);
columnsItem
.
setTips
(
"点击按钮上传附件"
);
columnsItem
.
setAccept
(
"jpg,png,jpeg,bmp"
);
columnsItem
.
setFileSize
(
10
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
BUTTON
.
getValue
())){
columnsItem
.
setCompType
(
"button"
);
columnsItem
.
setCompName
(
item
.
getLabel
());
columnsItem
.
setCompIcon
(
"button"
);
columnsItem
.
setEle
(
"el-button"
);
columnsItem
.
setViewType
(
"component"
);
columnsItem
.
setConfig
(
true
);
columnsItem
.
setShowLabel
(
true
);
columnsItem
.
setLabel
(
item
.
getLabel
());
columnsItem
.
setLabelWidth
(
120
);
columnsItem
.
setType
(
"primary"
);
columnsItem
.
setText
(
"按钮"
);
columnsItem
.
setPlain
(
true
);
columnsItem
.
setRound
(
false
);
columnsItem
.
setCircle
(
false
);
columnsItem
.
setLoading
(
false
);
columnsItem
.
setLayout
(
"colItem"
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
CASCADE
.
getValue
())){
columnsItem
.
setId
(
item
.
getVal
());
columnsItem
.
set_id
(
item
.
getVal
());
columnsItem
.
setCompType
(
"cascader"
);
columnsItem
.
setEle
(
"el-cascader"
);
columnsItem
.
setCompName
(
"级联选择"
);
columnsItem
.
setCompIcon
(
"cascader"
);
columnsItem
.
setViewType
(
"component"
);
columnsItem
.
setConfig
(
true
);
columnsItem
.
setShowLabel
(
true
);
columnsItem
.
setLabel
(
item
.
getLabel
());
columnsItem
.
setLabelWidth
(
120
);
columnsItem
.
setPlaceholder
(
"请选择"
+
item
.
getLabel
());
columnsItem
.
setRequired
(
false
);
columnsItem
.
setGutter
(
15
);
columnsItem
.
setSpan
(
24
);
columnsItem
.
setSize
(
"medium"
);
columnsItem
.
setDisabled
(
false
);
columnsItem
.
setDataType
(
"static"
);
columnsItem
.
setChinaAreaData
(
""
);
columnsItem
.
setAction
(
""
);
//Props 设置
Props
props
=
new
Props
();
props
.
setClearable
(
false
);
props
.
setSeparator
(
"-"
);
props
.
setShowAllLevels
(
true
);
props
.
setFilterable
(
false
);
Props
propsChild
=
new
Props
();
propsChild
.
setExpandTrigger
(
"click"
);
propsChild
.
setMultiple
(
false
);
propsChild
.
setCheckStrictly
(
false
);
propsChild
.
setLabel
(
"label"
);
propsChild
.
setValue
(
"value"
);
propsChild
.
setChildren
(
"children"
);
props
.
setProps
(
propsChild
);
columnsItem
.
setProps
(
props
);
//设置options
List
<
OptionsItem
>
options
=
new
ArrayList
<>();
OptionsItem
optionsItem
=
new
OptionsItem
();
optionsItem
.
setValue
(
"zhinan"
);
optionsItem
.
setLabel
(
"指南"
);
List
<
ChildrenItem
>
children
=
new
ArrayList
<>();
ChildrenItem
child
=
new
ChildrenItem
();
child
.
setValue
(
"shejiyuanze"
);
child
.
setLabel
(
"设计原则"
);
children
.
add
(
child
);
optionsItem
.
setChildren
(
children
);
List
<
ChildrenItem
>
children1
=
new
ArrayList
<>();
ChildrenItem
child1
=
new
ChildrenItem
();
child1
.
setValue
(
"yizhi"
);
child1
.
setLabel
(
"一致"
);
children1
.
add
(
child1
);
child
.
setChildren
(
children1
);
columnsItem
.
setOptions
(
options
);
}
else
if
(
item
.
getColType
().
equals
(
ComponentEnum
.
DATE
.
getValue
())){
columnsItem
.
setCompType
(
"date"
);
columnsItem
.
setEle
(
"el-date-picker"
);
columnsItem
.
setCompName
(
"日期"
);
...
...
@@ -133,16 +316,13 @@ public class DesignDynamicTableComponent extends DesignComponent {
columnsItem
.
setDisabled
(
false
);
columnsItem
.
setReadonly
(
false
);
columnsItem
.
setRules
(
new
ArrayList
<>());
// columnsItem.setRangeSeparator("-");
// columnsItem.setFormat("yyyy-MM-dd");
// columnsItem.setValueFormat("yyyy-MM-dd");
columnsItem
.
setRangeSeparator
(
" "
);
columnsItem
.
setFormat
(
"yyyy 年 MM 月 dd 日"
);
columnsItem
.
setValueFormat
(
"yyyy 年 MM 月 dd 日"
);
columnsItem
.
setStartPlaceholder
(
"开始日期"
);
columnsItem
.
setEndPlaceholder
(
"结束日期"
);
columnsItem
.
setLayout
(
"colItem"
);
}
columnsItem
.
setLayout
(
"colItem"
);
return
columnsItem
;
}).
collect
(
Collectors
.
toList
());
listItem
.
setColumns
(
columnsItemList
);
...
...
@@ -151,6 +331,100 @@ public class DesignDynamicTableComponent extends DesignComponent {
}
private
void
initDefaultCheckBoxValue
(
TableColItem
cons
,
ColumnsItem
columnsItem
)
{
if
(
cons
.
getVal
().
indexOf
(
"<"
)
!=
-
1
)
{
String
cks
=
StringUtils
.
substringBetween
(
cons
.
getVal
(),
"<"
,
">"
);
if
(
ObjectUtils
.
isEmpty
(
cks
))
return
;
List
<
OptionsItem
>
optionsItemList
=
StrUtil
.
splitTrim
(
cks
,
"-"
,
-
1
).
stream
().
map
(
option
->
{
OptionsItem
options
=
new
OptionsItem
();
options
.
setLabel
(
option
);
options
.
setValue
(
option
);
return
options
;
}).
collect
(
Collectors
.
toList
());
columnsItem
.
setOptions
(
optionsItemList
);
}
}
private
void
initDefaultRadioValue
(
TableColItem
cons
,
ColumnsItem
columnsItem
)
{
if
(
cons
.
getVal
().
indexOf
(
"<"
)
!=
-
1
)
{
String
cks
=
StringUtils
.
substringBetween
(
cons
.
getVal
(),
"<"
,
">"
);
if
(
ObjectUtils
.
isEmpty
(
cks
))
return
;
List
<
OptionsItem
>
optionsItemList
=
StrUtil
.
splitTrim
(
cks
,
"-"
,
-
1
).
stream
().
map
(
option
->
{
OptionsItem
options
=
new
OptionsItem
();
options
.
setLabel
(
option
);
options
.
setValue
(
option
);
return
options
;
}).
collect
(
Collectors
.
toList
());
columnsItem
.
setOptions
(
optionsItemList
);
}
}
private
void
initDefaultSelectValue
(
TableColItem
cons
,
ColumnsItem
columnsItem
)
{
//判断如果包含年,月,日,选项框 基础化
if
(
cons
.
getVal
().
indexOf
(
"年"
)
!=
-
1
)
{
//初始化10年
List
<
OptionsItem
>
optionsItems
=
initYears
();
columnsItem
.
setOptions
(
optionsItems
);
}
else
if
(
cons
.
getVal
().
indexOf
(
"月"
)
!=
-
1
)
{
List
<
OptionsItem
>
optionsItems
=
initMonths
();
columnsItem
.
setOptions
(
optionsItems
);
}
else
if
(
cons
.
getVal
().
indexOf
(
"日"
)
!=
-
1
)
{
List
<
OptionsItem
>
optionsItems
=
initDays
();
columnsItem
.
setOptions
(
optionsItems
);
}
if
(
cons
.
getVal
().
indexOf
(
"<"
)
!=
-
1
)
{
String
cks
=
StringUtils
.
substringBetween
(
cons
.
getVal
(),
"<"
,
">"
);
if
(
ObjectUtils
.
isEmpty
(
cks
))
return
;
List
<
OptionsItem
>
optionsItemList
=
StrUtil
.
splitTrim
(
cks
,
"-"
,
-
1
).
stream
().
map
(
option
->
{
OptionsItem
options
=
new
OptionsItem
();
options
.
setLabel
(
option
);
options
.
setValue
(
option
);
return
options
;
}).
collect
(
Collectors
.
toList
());
columnsItem
.
setOptions
(
optionsItemList
);
// cons.setVal(cons.getVal().substring(0, cons.getVal().indexOf("[")));
// cons.setLabel(cons.getLabel().substring(0, cons.getLabel().indexOf("[")));
}
}
public
List
<
OptionsItem
>
initYears
()
{
List
<
OptionsItem
>
list
=
new
ArrayList
<>();
for
(
int
i
=
2020
;
i
<
2030
;
i
++)
{
OptionsItem
optionsItem
=
new
OptionsItem
();
optionsItem
.
setLabel
(
i
+
""
);
optionsItem
.
setValue
(
i
+
""
);
list
.
add
(
optionsItem
);
}
return
list
;
}
public
List
<
OptionsItem
>
initMonths
()
{
List
<
OptionsItem
>
list
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
12
;
i
++)
{
OptionsItem
optionsItem
=
new
OptionsItem
();
optionsItem
.
setLabel
(
i
+
""
);
optionsItem
.
setValue
(
i
+
""
);
list
.
add
(
optionsItem
);
}
return
list
;
}
public
List
<
OptionsItem
>
initDays
()
{
List
<
OptionsItem
>
list
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
31
;
i
++)
{
OptionsItem
optionsItem
=
new
OptionsItem
();
optionsItem
.
setLabel
(
i
+
""
);
optionsItem
.
setValue
(
i
+
""
);
list
.
add
(
optionsItem
);
}
return
list
;
}
@Override
public
String
getType
()
{
return
ComponentEnum
.
DYNAMIC_TABLE
.
getValue
();
...
...
fill-manager/src/main/java/com/mortals/xhx/module/matter/service/impl/MatterDatumServiceImpl.java
View file @
449e0d73
...
...
@@ -16,6 +16,7 @@ import com.deepoove.poi.data.PictureRenderData;
import
com.deepoove.poi.data.PictureType
;
import
com.deepoove.poi.data.Pictures
;
import
com.deepoove.poi.plugin.table.MultipleRowTableRenderPolicy
;
import
com.deepoove.poi.render.RenderContext
;
import
com.deepoove.poi.template.MetaTemplate
;
import
com.deepoove.poi.util.RegexUtils
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
...
...
@@ -37,7 +38,6 @@ import com.mortals.xhx.common.pdu.gen.component.ComponentCons;
import
com.mortals.xhx.common.plugin.LoopSingleRowTableRenderPolicy
;
import
com.mortals.xhx.common.utils.ExportDocUtil
;
import
com.mortals.xhx.common.utils.WordUtil
;
import
com.mortals.xhx.module.device.service.DeviceMatterDatumService
;
import
com.mortals.xhx.module.hotword.model.HotwordEntity
;
import
com.mortals.xhx.module.hotword.model.HotwordQuery
;
import
com.mortals.xhx.module.hotword.service.HotwordService
;
...
...
@@ -49,6 +49,7 @@ import com.mortals.xhx.module.matter.service.MatterService;
import
com.mortals.xhx.module.pubdatum.model.PubdatumEntity
;
import
com.mortals.xhx.module.pubdatum.model.PubdatumQuery
;
import
com.mortals.xhx.module.pubdatum.service.PubdatumService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.commons.io.FilenameUtils
;
import
org.apache.http.entity.ContentType
;
...
...
@@ -78,6 +79,7 @@ import java.util.stream.Collectors;
* @date 2022-09-27
*/
@Service
(
"matterDatumService"
)
@Slf4j
public
class
MatterDatumServiceImpl
extends
AbstractCRUDServiceImpl
<
MatterDatumDao
,
MatterDatumEntity
,
Long
>
implements
MatterDatumService
{
@Value
(
"${upload.path}"
)
...
...
@@ -94,7 +96,6 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
@Autowired
private
HotwordService
hotwordService
;
public
static
String
word
[]
=
{
"doc"
,
"dot"
,
"wps"
,
"wpt"
,
"docx"
,
"dotx"
,
"docm"
,
"dotm"
};
public
static
String
imgs
[]
=
{
"jpg"
,
"png"
,
"jpeg"
,
"gif"
};
...
...
@@ -148,15 +149,12 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
matterEntity
.
setDatumCount
(
count
);
matterService
.
update
(
matterEntity
,
context
);
}
}
@Override
protected
void
saveBefore
(
MatterDatumEntity
entity
,
Context
context
)
throws
AppException
{
super
.
saveBefore
(
entity
,
context
);
if
(
StringUtils
.
isEmpty
(
entity
.
getFileUrl
()))
{
/*
if (StringUtils.isEmpty(entity.getFileUrl())) {
throw new AppException("填单附件不能为空");
}
if (StringUtils.isEmpty(entity.getSamplePath())) {
...
...
@@ -164,7 +162,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
}
if (StringUtils.isEmpty(entity.getTemplatePath())) {
throw new AppException("样表模板地址不能为空");
}
}
*/
//校验材料名是否重复
int
count
=
this
.
count
(
new
MatterDatumQuery
().
materialName
(
entity
.
getMaterialName
()),
context
);
if
(
count
>
0
)
{
...
...
@@ -228,7 +226,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
if
(!
pathDir
.
exists
())
{
pathDir
.
mkdirs
();
}
String
newName
=
RandomUtil
.
randomNumbers
(
12
)
+
".
jp
g"
;
String
newName
=
RandomUtil
.
randomNumbers
(
12
)
+
".
pn
g"
;
String
filePathAll
=
filePath
+
newName
;
//判断文件类型是否为doc pdf jpg png 等
String
extName
=
FileUtil
.
getSuffix
(
samplePath
);
...
...
@@ -310,6 +308,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
builderTable
.
setValidErrorHandler
(
new
Configure
.
DiscardHandler
());
builderTable
.
useDefaultEL
(
false
);
builderTable
.
buildGramer
(
"["
,
"]"
);
builderTable
.
useSpringEL
();
XWPFTemplate
templateTable
=
XWPFTemplate
.
compile
(
filepath
,
builderTable
.
build
());
for
(
MetaTemplate
col
:
templateTable
.
getElementTemplates
())
{
...
...
@@ -356,6 +355,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
//转换表单参数为map集合
ObjectMapper
mapper
=
new
ObjectMapper
();
ConfigureBuilder
builder
=
Configure
.
builder
();
//builder.useSpringEL();
builder
.
buildGrammerRegex
(
RegexUtils
.
createGeneral
(
"{{"
,
"}}"
));
try
{
Map
<
String
,
Object
>
data
=
mapper
.
readValue
(
docFormVo
.
getFormContent
(),
Map
.
class
);
...
...
@@ -376,7 +376,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
}
}
//构建填充复选框值
if
(
entry
.
getKey
().
indexOf
(
"ck_"
)
!=
-
1
&&
entry
.
getKey
().
indexOf
(
"<"
)
!=
-
1
)
{
if
(
entry
.
getKey
().
indexOf
(
ComponentEnum
.
CHECKBOX
.
getValue
()
)
!=
-
1
&&
entry
.
getKey
().
indexOf
(
"<"
)
!=
-
1
)
{
//获取复选框选项,并渲染值
String
ckStr
=
StringUtils
.
substringBetween
(
entry
.
getKey
(),
"<"
,
">"
);
//获取所有选项
...
...
@@ -401,21 +401,44 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
}
//TODO 单选
//绑定动态表单
if
(
entry
.
getKey
().
indexOf
(
"dt_"
)
!=
-
1
)
{
if
(
entry
.
getKey
().
indexOf
(
ComponentEnum
.
DYNAMIC_TABLE
.
getValue
())
!=
-
1
)
{
ArrayList
<
Map
<
String
,
Object
>>
listMap
=
(
ArrayList
)
entry
.
getValue
();
for
(
Map
<
String
,
Object
>
map
:
listMap
)
{
Integer
index
=
(
Integer
)
map
.
get
(
"index"
);
if
(!
ObjectUtils
.
isEmpty
(
index
)){
map
.
put
(
"index"
,
index
+
1
);
}
}
builder
.
bind
(
entry
.
getKey
(),
new
MultipleRowTableRenderPolicy
());
}
//绑定转换list list_1_身份证
if
(
entry
.
getKey
().
indexOf
(
"list_"
)
!=
-
1
)
{
if
(
entry
.
getKey
().
indexOf
(
ComponentEnum
.
LIST
.
getValue
()
)
!=
-
1
)
{
String
value
=
entry
.
getValue
().
toString
();
SplitIter
splitIter
=
new
SplitIter
(
value
,
new
LengthFinder
(
1
),
-
1
,
false
);
List
<
String
>
valueList
=
splitIter
.
toList
(
true
);
builder
.
bind
(
entry
.
getKey
(),
new
LoopSingleRowTableRenderPolicy
());
data
.
put
(
entry
.
getKey
(),
valueList
);
}
//TODO cascade 级联
if
(
entry
.
getKey
().
indexOf
(
ComponentEnum
.
CASCADE
.
getValue
())
!=
-
1
)
{
List
<
String
>
value
=
(
ArrayList
)
entry
.
getValue
();
log
.
info
(
"级联数据:{}"
,
JSON
.
toJSONString
(
value
));
entry
.
setValue
(
value
.
stream
().
collect
(
Collectors
.
joining
(
""
)));
}
});
if
(
addMap
.
size
()
>
0
)
{
data
.
putAll
(
addMap
);
}
//将data中的list中的index 加1
//查询是否有多选框,
//获取模板文件地址
MatterDatumEntity
docTemplateEntity
=
this
.
get
(
docFormVo
.
getId
(),
context
);
...
...
@@ -423,6 +446,7 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
String
path
=
rootPath
+
docTemplateEntity
.
getTemplatePath
();
String
templateName
=
FileUtil
.
getName
(
path
);
Configure
config
=
builder
.
build
();
XWPFTemplate
template
=
null
;
ByteArrayOutputStream
byteArrayOutputStream
=
null
;
try
{
...
...
@@ -588,8 +612,98 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
}
public
static
FormDesignRoot
parseLocalDocxToJson
(
String
filepath
)
{
ConfigureBuilder
builder
=
Configure
.
builder
();
builder
.
setValidErrorHandler
(
new
Configure
.
DiscardHandler
());
builder
.
useDefaultEL
(
false
);
builder
.
buildGrammerRegex
(
RegexUtils
.
createGeneral
(
"{{"
,
"}}"
));
//builder.buildGramer("[","]");
XWPFTemplate
template
=
XWPFTemplate
.
compile
(
filepath
,
builder
.
build
());
FormDesignRoot
root
=
new
FormDesignRoot
();
FormDesignConfig
config
=
new
FormDesignConfig
();
config
.
initAttribute
();
root
.
setConfig
(
config
);
List
<
ListItem
>
collect
=
new
ArrayList
<>();
HashSet
<
String
>
hs
=
new
HashSet
<>();
//去除重复标签
for
(
MetaTemplate
item
:
template
.
getElementTemplates
())
{
if
(
hs
.
contains
(
item
.
variable
()))
{
continue
;
}
else
{
hs
.
add
(
item
.
variable
());
}
//识别简单输入
String
val
=
StrUtil
.
strip
(
item
.
variable
(),
"{{"
,
"}}"
);
List
<
String
>
keys
=
StrSplitter
.
split
(
val
,
"_"
,
true
,
true
);
//切分分隔符后动态 创建组件 i_1_姓名(第一个代表类型,第二个如果是多个累加,第三个显示label)
if
(
keys
.
size
()
>
2
)
{
String
label
=
keys
.
get
(
2
);
String
type
=
keys
.
get
(
0
);
ComponentCons
cons
=
new
ComponentCons
();
cons
.
setLabel
(
label
);
cons
.
setVal
(
val
);
cons
.
setEl
(
item
.
variable
());
if
(
type
.
equalsIgnoreCase
(
ComponentEnum
.
DYNAMIC_TABLE
.
getValue
()))
{
HashSet
<
String
>
dhs
=
new
HashSet
<>();
//去除重复标签
List
<
TableColItem
>
colList
=
new
ArrayList
<>();
//表格 结构化绑定数据
ConfigureBuilder
builderTable
=
Configure
.
builder
();
builderTable
.
setValidErrorHandler
(
new
Configure
.
ValidErrorHandler
()
{
@Override
public
void
handler
(
RenderContext
<?>
context
)
{
log
.
info
(
"111111111111111"
);
}
});
builderTable
.
useDefaultEL
(
false
);
builderTable
.
buildGramer
(
"["
,
"]"
);
//builderTable.useSpringEL();
builderTable
.
buildGrammerRegex
(
RegexUtils
.
createGeneral
(
"["
,
"]"
));
XWPFTemplate
templateTable
=
XWPFTemplate
.
compile
(
filepath
,
builderTable
.
build
());
for
(
MetaTemplate
col
:
templateTable
.
getElementTemplates
())
{
if
(
dhs
.
contains
(
col
.
variable
()))
{
continue
;
}
else
{
dhs
.
add
(
col
.
variable
());
}
String
colVal
=
StrUtil
.
strip
(
col
.
variable
(),
"["
,
"]"
);
if
(!
StrUtil
.
startWith
(
colVal
,
label
))
{
continue
;
}
List
<
String
>
colKeys
=
StrSplitter
.
split
(
colVal
,
"_"
,
true
,
true
);
//提取当前table中的列元素
if
(
colKeys
.
size
()
>
3
)
{
String
colLabel
=
colKeys
.
get
(
3
);
String
colType
=
colKeys
.
get
(
1
);
TableColItem
tableColItem
=
new
TableColItem
();
tableColItem
.
setLabel
(
colLabel
);
tableColItem
.
setColType
(
colType
);
tableColItem
.
setVal
(
colVal
);
colList
.
add
(
tableColItem
);
log
.
info
(
"列元素"
+
col
.
variable
());
}
}
cons
.
setColList
(
colList
);
DesignComponent
designComponent
=
DesignComponent
.
createType
(
type
);
ListItem
listItem
=
designComponent
.
buildDefaultComponent
(
cons
);
collect
.
add
(
listItem
);
continue
;
}
DesignComponent
designComponent
=
DesignComponent
.
createType
(
type
);
ListItem
listItem
=
designComponent
.
buildDefaultComponent
(
cons
);
collect
.
add
(
listItem
);
}
}
root
.
setList
(
collect
);
return
root
;
}
public
static
void
main
(
String
[]
args
)
{
String
colVal
=
"i_1_变更登记事项"
;
/*
String colVal = "i_1_变更登记事项";
List<String> colKeys = StrSplitter.split(colVal, "_", true, true);
System.out.println(colKeys.size());
...
...
@@ -601,12 +715,21 @@ public class MatterDatumServiceImpl extends AbstractCRUDServiceImpl<MatterDatumD
List<String> strings1 = splitIter.toList(true);
strings1.forEach(item -> {
System.out.println(item);
});
});
*/
// String[] strings = StrSplitter.splitByLength(colVal, 1);
// for (int i = 0; i <strings.length ; i++) {
// System.out.println(strings[i]);
// }
String
filePath
=
"F:\\1.docx"
;
FormDesignRoot
formDesignRoot
=
parseLocalDocxToJson
(
filePath
);
System
.
out
.
println
(
JSON
.
toJSONString
(
formDesignRoot
));
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment