Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
sunchenjie
/
ImportSpeechPhaseByExcel
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
5111bf20
authored
2020-07-22 21:05:49 +0800
by
sunchenjie
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
create:excel导入增加popup字段
1 parent
a65a31ce
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
8 deletions
src/main/java/com/phase/ColDesc.java
src/main/java/com/phase/PhaseUtil.java
src/main/java/com/phase/SpeechLittlePhaseAddDTO.java
src/main/java/com/phase/SpeechLittlePhaseEditDTO.java
src/main/java/com/phase/ColDesc.java
View file @
5111bf2
...
...
@@ -21,7 +21,8 @@ public enum ColDesc {
COL_NO
(
"no"
,
"否定答复"
),
COL_DOCTYPE
(
"fileType"
,
"文件识别类别(1=通用文件)"
),
COL_CERTIFICATE_TYPE
(
"identityType"
,
"证件类别(1=身份证信息面,2=身份证国徽面,3=执业证正面,4=执业正反面)"
),
COL_OCR
(
"idcardOcrSwitch"
,
"OCR开启(1=开启,2=关闭)"
);
COL_OCR
(
"idcardOcrSwitch"
,
"OCR开启(1=开启,2=关闭)"
),
COL_POPUP
(
"popup"
,
"文件弹出(1=开启,2=关闭)"
);
private
String
attr
;
private
String
col
;
...
...
src/main/java/com/phase/PhaseUtil.java
View file @
5111bf2
...
...
@@ -23,7 +23,7 @@ public class PhaseUtil {
SpeechPhaseDTO
speechPhaseDTO
=
SpeechPhaseDTO
.
builder
().
phaseList
(
bigPhaseList
).
speechName
(
speechName
).
stlId
(
0L
).
build
();
String
phaseJson
=
JSON
.
toJSONString
(
speechPhaseDTO
);
System
.
out
.
println
(
phaseJson
);
putOutFile
(
phaseJson
,
currentDir
,
speechName
);
putOutFile
(
phaseJson
,
currentDir
,
speechName
);
}
private
static
void
putOutFile
(
String
phaseJson
,
String
currentDir
,
String
speechName
)
{
...
...
@@ -36,7 +36,7 @@ public class PhaseUtil {
e
.
printStackTrace
();
}
finally
{
try
{
if
(
out
!=
null
){
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
...
...
@@ -52,14 +52,15 @@ public class PhaseUtil {
int
rowNum
=
2
;
for
(
Map
<
String
,
String
>
orgPhase
:
orgPhaseList
)
{
if
(!
StringUtils
.
isEmpty
(
orgPhase
.
get
(
ColDesc
.
COL_HINT_NUM
.
getCol
())))
{
System
.
out
.
println
(
"当前处理excel行号:"
+
rowNum
);
//获取大环节对象
SpeechBigPhaseEditDTO
bigPhaseEditDTO
=
fetchBigPhase
(
bigPhaseNumMap
,
bigPhaseList
,
orgPhase
);
//生成小环节对象
SpeechLittlePhaseAddDTO
littlePhaseAddDTO
;
try
{
littlePhaseAddDTO
=
fetchLittlePhase
(
orgPhase
);
}
catch
(
Exception
e
){
throw
new
RuntimeException
(
"请检查第"
+
rowNum
+
"行的数据是否存在参数缺失,或者数据格式问题!"
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"请检查第"
+
rowNum
+
"行的数据是否存在参数缺失,或者数据格式问题!"
);
}
//将小环节封装入大环节对象的hintList属性中
bigPhaseEditDTO
.
getHintsList
().
add
(
littlePhaseAddDTO
.
transToVO
());
...
...
@@ -73,7 +74,7 @@ public class PhaseUtil {
private
static
void
sortHintList
(
ArrayList
<
SpeechBigPhaseEditDTO
>
bigPhaseList
)
{
//将大环节列表按小环节序号排序
bigPhaseList
.
sort
(
Comparator
.
comparingInt
(
SpeechBigPhaseEditDTO:
:
getPhaseNum
));
for
(
SpeechBigPhaseEditDTO
speechBigPhaseEditDTO
:
bigPhaseList
){
for
(
SpeechBigPhaseEditDTO
speechBigPhaseEditDTO
:
bigPhaseList
)
{
List
<
SpeechLittlePhaseEditDTO
>
hintsList
=
speechBigPhaseEditDTO
.
getHintsList
();
//将小环节列表按小环节序号排序
hintsList
.
sort
(
Comparator
.
comparingInt
(
SpeechLittlePhaseEditDTO:
:
getHintNum
));
...
...
@@ -89,6 +90,7 @@ public class PhaseUtil {
int
fileType
=
0
;
int
identityType
=
0
;
int
idcardOcrSwitch
=
0
;
int
popup
=
2
;
try
{
fileType
=
Integer
.
parseInt
(
orgPhase
.
get
(
ColDesc
.
COL_DOCTYPE
.
getCol
()));
}
catch
(
NumberFormatException
e
)
{
...
...
@@ -101,6 +103,10 @@ public class PhaseUtil {
idcardOcrSwitch
=
Integer
.
parseInt
(
orgPhase
.
get
(
ColDesc
.
COL_OCR
.
getCol
()));
}
catch
(
NumberFormatException
e
)
{
}
try
{
popup
=
Integer
.
parseInt
(
orgPhase
.
get
(
ColDesc
.
COL_POPUP
.
getCol
()));
}
catch
(
NumberFormatException
e
)
{
}
String
ttsContent
=
orgPhase
.
get
(
ColDesc
.
COL_TTS
.
getCol
());
String
littlePhaseTitle
=
orgPhase
.
get
(
ColDesc
.
COL_HINT_TITLE
.
getCol
());
String
sure
=
orgPhase
.
get
(
ColDesc
.
COL_SURE
.
getCol
());
...
...
@@ -119,6 +125,7 @@ public class PhaseUtil {
.
ttsContent
(
ttsContent
)
.
littlePhaseTitle
(
littlePhaseTitle
)
.
bindUnique
(
""
)
.
popup
(
popup
)
.
build
();
}
...
...
src/main/java/com/phase/SpeechLittlePhaseAddDTO.java
View file @
5111bf2
...
...
@@ -52,10 +52,13 @@ public class SpeechLittlePhaseAddDTO {
private
String
bindUnique
;
private
Integer
popup
;
public
SpeechLittlePhaseEditDTO
transToVO
()
{
return
SpeechLittlePhaseEditDTO
.
builder
().
hintNum
(
this
.
littlePhaseSerialNum
).
hintName
(
this
.
littlePhaseName
)
.
hintTitle
(
this
.
littlePhaseTitle
).
tts
(
this
.
ttsContent
).
condition
(
getConditionMap
()).
hintType
(
getHintType
()).
bindBefore
(
this
.
bindBefore
).
bindAfter
(
this
.
bindAfter
).
bindUnique
(
this
.
bindUnique
).
classIndex
(
0
).
build
();
.
hintTitle
(
this
.
littlePhaseTitle
).
tts
(
this
.
ttsContent
).
condition
(
getConditionMap
()).
hintType
(
getHintType
())
.
bindBefore
(
this
.
bindBefore
).
bindAfter
(
this
.
bindAfter
).
bindUnique
(
this
.
bindUnique
)
.
classIndex
(
0
).
popup
(
this
.
popup
).
build
();
}
private
HashMap
<
String
,
Object
>
getConditionMap
()
{
...
...
src/main/java/com/phase/SpeechLittlePhaseEditDTO.java
View file @
5111bf2
...
...
@@ -33,4 +33,6 @@ public class SpeechLittlePhaseEditDTO {
private
Integer
classIndex
;
private
Integer
popup
;
}
...
...
Write
Preview
Styling with
Markdown
is supported
Attach a file
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 post a comment