create:创建git库
0 parents
Showing
14 changed files
with
598 additions
and
0 deletions
.idea/compiler.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <project version="4"> | ||
3 | <component name="CompilerConfiguration"> | ||
4 | <annotationProcessing> | ||
5 | <profile name="Maven default annotation processors profile" enabled="true"> | ||
6 | <sourceOutputDir name="target/generated-sources/annotations" /> | ||
7 | <sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> | ||
8 | <outputRelativeToContentRoot value="true" /> | ||
9 | <module name="excel" /> | ||
10 | </profile> | ||
11 | </annotationProcessing> | ||
12 | </component> | ||
13 | <component name="JavacSettings"> | ||
14 | <option name="ADDITIONAL_OPTIONS_OVERRIDE"> | ||
15 | <module name="excel" options="-parameters" /> | ||
16 | </option> | ||
17 | </component> | ||
18 | </project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/encodings.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <project version="4"> | ||
3 | <component name="Encoding" native2AsciiForPropertiesFiles="true" defaultCharsetForPropertiesFiles="UTF-8" addBOMForNewFiles="with NO BOM"> | ||
4 | <file url="file://$PROJECT_DIR$" charset="UTF-8" /> | ||
5 | <file url="PROJECT" charset="UTF-8" /> | ||
6 | </component> | ||
7 | </project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/misc.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <project version="4"> | ||
3 | <component name="ExternalStorageConfigurationManager" enabled="true" /> | ||
4 | <component name="MavenProjectsManager"> | ||
5 | <option name="originalFiles"> | ||
6 | <list> | ||
7 | <option value="$PROJECT_DIR$/pom.xml" /> | ||
8 | </list> | ||
9 | </option> | ||
10 | </component> | ||
11 | <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK"> | ||
12 | <output url="file://$PROJECT_DIR$/out" /> | ||
13 | </component> | ||
14 | </project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
.idea/vcs.xml
0 → 100644
excel.iml
0 → 100644
pom.xml
0 → 100644
1 | <?xml version="1.0" encoding="UTF-8"?> | ||
2 | <project xmlns="http://maven.apache.org/POM/4.0.0" | ||
3 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
4 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
5 | <modelVersion>4.0.0</modelVersion> | ||
6 | |||
7 | <groupId>phase</groupId> | ||
8 | <artifactId>excel</artifactId> | ||
9 | <version>1.0-SNAPSHOT</version> | ||
10 | |||
11 | <parent> | ||
12 | <groupId>org.springframework.boot</groupId> | ||
13 | <artifactId>spring-boot-starter-parent</artifactId> | ||
14 | <version>2.1.3.RELEASE</version> | ||
15 | <relativePath/> <!-- lookup parent from repository --> | ||
16 | </parent> | ||
17 | <properties> | ||
18 | <java.version>1.8</java.version> | ||
19 | </properties> | ||
20 | |||
21 | <dependencies> | ||
22 | <dependency> | ||
23 | <groupId>org.springframework.boot</groupId> | ||
24 | <artifactId>spring-boot-starter</artifactId> | ||
25 | <version>2.2.4.RELEASE</version> | ||
26 | </dependency> | ||
27 | <dependency> | ||
28 | <groupId>org.apache.poi</groupId> | ||
29 | <artifactId>poi</artifactId> | ||
30 | <version>3.9</version> | ||
31 | </dependency> | ||
32 | <dependency> | ||
33 | <groupId>org.apache.poi</groupId> | ||
34 | <artifactId>poi-ooxml</artifactId> | ||
35 | <version>3.9</version> | ||
36 | </dependency> | ||
37 | <dependency> | ||
38 | <groupId>com.alibaba</groupId> | ||
39 | <artifactId>fastjson</artifactId> | ||
40 | <version>1.2.3</version> | ||
41 | </dependency> | ||
42 | <dependency> | ||
43 | <groupId>org.projectlombok</groupId> | ||
44 | <artifactId>lombok</artifactId> | ||
45 | <version>1.18.6</version> | ||
46 | </dependency> | ||
47 | </dependencies> | ||
48 | <build> | ||
49 | <plugins> | ||
50 | <plugin> | ||
51 | <groupId>org.springframework.boot</groupId> | ||
52 | <artifactId>spring-boot-maven-plugin</artifactId> | ||
53 | </plugin> | ||
54 | |||
55 | </plugins> | ||
56 | </build> | ||
57 | </project> | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/main/java/com/phase/ColDesc.java
0 → 100644
1 | package com.phase; | ||
2 | |||
3 | import org.springframework.util.StringUtils; | ||
4 | |||
5 | import java.util.HashMap; | ||
6 | import java.util.Map; | ||
7 | |||
8 | //用于excel中的列名和属性名映射,提高可读性和方便维护 | ||
9 | public enum ColDesc { | ||
10 | |||
11 | COL_PHASE_NUM("phaseNum", "大环节No"), | ||
12 | COL_PHASE_TITLE("phaseTitle", "大环节名称"), | ||
13 | COL_HINT_NUM("littlePhaseSerialNum", "小环节No"), | ||
14 | COL_HINT_NAME("littlePhaseName", "小环节名称"), | ||
15 | COL_HINT_TITLE("littlePhaseTitle", "环节展示标题"), | ||
16 | COL_TTS("ttsContent", "TTS报读内容"), | ||
17 | COL_CONDITION_TYPE("triggerConditionSwitch", "触发条件(1=开启,2=关闭,3=自定义)"), | ||
18 | COL_CONDITION_CONTENT("triggerConditionContent", "触发条件内容"), | ||
19 | COL_HINT_TYPE("phaseType", "环节类型(1=问答环节,2=陈述环节,3=文件出示环节,4=证件出示环节,5=通用环节,6=人脸识别环节,7=人工报读环节)"), | ||
20 | COL_SURE("sure", "肯定答复"), | ||
21 | COL_NO("no", "否定答复"), | ||
22 | COL_DOCTYPE("fileType", "文件识别类别(1=通用文件)"), | ||
23 | COL_CERTIFICATE_TYPE("identityType", "证件类别(1=身份证信息面,2=身份证国徽面,3=执业证正面,4=执业正反面)"), | ||
24 | COL_OCR("idcardOcrSwitch", "OCR开启(1=开启,2=关闭)"); | ||
25 | |||
26 | private String attr; | ||
27 | private String col; | ||
28 | |||
29 | ColDesc(String attr, String col) { | ||
30 | this.attr = attr; | ||
31 | this.col = col; | ||
32 | } | ||
33 | |||
34 | public String getAttr() { | ||
35 | return attr; | ||
36 | } | ||
37 | |||
38 | public String getCol() { | ||
39 | return col; | ||
40 | } | ||
41 | |||
42 | private static Map<String, String> attrMap = new HashMap<>(); | ||
43 | |||
44 | static { | ||
45 | for (ColDesc c : ColDesc.values()) { | ||
46 | if (!StringUtils.isEmpty(c.getCol()) && !attrMap.containsKey(c.getCol())) { | ||
47 | attrMap.put(c.getCol(), c.getAttr()); | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | public static String getAttr(String col) { | ||
53 | return attrMap.get(col); | ||
54 | } | ||
55 | |||
56 | } |
src/main/java/com/phase/ExcelUtil.java
0 → 100644
1 | package com.phase; | ||
2 | |||
3 | import org.apache.poi.hssf.usermodel.*; | ||
4 | import org.apache.poi.ss.usermodel.*; | ||
5 | import org.apache.poi.xssf.usermodel.XSSFWorkbook; | ||
6 | |||
7 | import java.io.FileInputStream; | ||
8 | import java.io.FileNotFoundException; | ||
9 | import java.io.IOException; | ||
10 | import java.io.InputStream; | ||
11 | import java.util.ArrayList; | ||
12 | import java.util.LinkedHashMap; | ||
13 | import java.util.List; | ||
14 | import java.util.Map; | ||
15 | |||
16 | /** | ||
17 | * Excel导入导出 | ||
18 | * @Author: guandezhi | ||
19 | * @Date: 2019/3/9 9:47 | ||
20 | */ | ||
21 | public class ExcelUtil { | ||
22 | |||
23 | /** | ||
24 | * 从excel中读内容 | ||
25 | * | ||
26 | * @param filePath | ||
27 | * @param sheetIndex | ||
28 | * @return | ||
29 | */ | ||
30 | public static List<Map<String, String>> readExcel(String filePath, Integer sheetIndex) { | ||
31 | List<Map<String, String>> dataList = new ArrayList<>(); | ||
32 | Workbook wb = ExcelUtil.createWorkBook(filePath); | ||
33 | if (wb != null) { | ||
34 | Sheet sheet = wb.getSheetAt(sheetIndex); | ||
35 | int maxRownum = sheet.getPhysicalNumberOfRows(); | ||
36 | Row firstRow = sheet.getRow(0); | ||
37 | int maxColnum = firstRow.getPhysicalNumberOfCells(); | ||
38 | String columns[] = new String[maxColnum]; | ||
39 | for (int i = 0; i < maxRownum; i++) { | ||
40 | Map<String, String> map = null; | ||
41 | if (i > 0) { | ||
42 | map = new LinkedHashMap<>(); | ||
43 | firstRow = sheet.getRow(i); | ||
44 | } | ||
45 | if (firstRow != null) { | ||
46 | String cellData = null; | ||
47 | for (int j = 0; j < maxColnum; j++) { | ||
48 | cellData = (String) ExcelUtil.getCellFormatValue(firstRow.getCell(j)); | ||
49 | if (i == 0) { | ||
50 | columns[j] = cellData; | ||
51 | } else { | ||
52 | map.put(columns[j], cellData); | ||
53 | } | ||
54 | } | ||
55 | } else { | ||
56 | break; | ||
57 | } | ||
58 | if (i > 0) { | ||
59 | dataList.add(map); | ||
60 | } | ||
61 | } | ||
62 | } | ||
63 | return dataList; | ||
64 | } | ||
65 | |||
66 | private static Workbook createWorkBook(String filePath) { | ||
67 | Workbook wb = null; | ||
68 | if (filePath == null) { | ||
69 | return null; | ||
70 | } | ||
71 | String extString = filePath.substring(filePath.lastIndexOf(".")); | ||
72 | InputStream is = null; | ||
73 | try { | ||
74 | is = new FileInputStream(filePath); | ||
75 | if (".xls".equals(extString)) { | ||
76 | return wb = new HSSFWorkbook(is); | ||
77 | } else if (".xlsx".equals(extString)) { | ||
78 | return wb = new XSSFWorkbook(is); | ||
79 | } else { | ||
80 | return wb; | ||
81 | } | ||
82 | } catch (FileNotFoundException e) { | ||
83 | e.printStackTrace(); | ||
84 | } catch (IOException e) { | ||
85 | e.printStackTrace(); | ||
86 | } | ||
87 | return wb; | ||
88 | } | ||
89 | |||
90 | /** | ||
91 | * 将字段转为相应的格式 | ||
92 | * | ||
93 | * @param cell | ||
94 | * @return | ||
95 | */ | ||
96 | private static Object getCellFormatValue(Cell cell) { | ||
97 | Object cellValue = null; | ||
98 | if (cell != null) { | ||
99 | //判断cell类型 | ||
100 | switch (cell.getCellType()) { | ||
101 | case Cell.CELL_TYPE_NUMERIC: { | ||
102 | double numericCellValue = cell.getNumericCellValue(); | ||
103 | cellValue = String.valueOf(Double.valueOf(numericCellValue).intValue()); | ||
104 | break; | ||
105 | } | ||
106 | case Cell.CELL_TYPE_FORMULA: { | ||
107 | if (DateUtil.isCellDateFormatted(cell)) { | ||
108 | cellValue = cell.getDateCellValue();////转换为日期格式YYYY-mm-dd | ||
109 | } else { | ||
110 | cellValue = String.valueOf(cell.getNumericCellValue()); //数字 | ||
111 | } | ||
112 | break; | ||
113 | } | ||
114 | case Cell.CELL_TYPE_STRING: { | ||
115 | cellValue = cell.getRichStringCellValue().getString(); | ||
116 | break; | ||
117 | } | ||
118 | default: | ||
119 | cellValue = ""; | ||
120 | } | ||
121 | } else { | ||
122 | cellValue = ""; | ||
123 | } | ||
124 | return cellValue; | ||
125 | } | ||
126 | |||
127 | } | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
src/main/java/com/phase/PhaseUtil.java
0 → 100644
1 | package com.phase; | ||
2 | |||
3 | import com.alibaba.fastjson.JSON; | ||
4 | import org.springframework.util.StringUtils; | ||
5 | |||
6 | import java.io.File; | ||
7 | import java.io.FileOutputStream; | ||
8 | import java.io.IOException; | ||
9 | import java.nio.charset.StandardCharsets; | ||
10 | import java.util.*; | ||
11 | |||
12 | public class PhaseUtil { | ||
13 | public static void main(String[] args) { | ||
14 | String speechName = args[0]; | ||
15 | String currentDir = System.getProperty("user.dir"); | ||
16 | String filePath = currentDir + File.separator + speechName + ".xlsx"; | ||
17 | //获取excel文件 | ||
18 | List<Map<String, String>> orgPhaseList = ExcelUtil.readExcel(filePath, | ||
19 | 0); | ||
20 | //将excel文件转换为格式化的json | ||
21 | ArrayList<SpeechBigPhaseEditDTO> bigPhaseList = getBigPhaseListByMapList(orgPhaseList); | ||
22 | //将json输出到系统文件 | ||
23 | SpeechPhaseDTO speechPhaseDTO = SpeechPhaseDTO.builder().phaseList(bigPhaseList).speechName(speechName).stlId(0L).build(); | ||
24 | String phaseJson = JSON.toJSONString(speechPhaseDTO); | ||
25 | System.out.println(phaseJson); | ||
26 | putOutFile(phaseJson,currentDir,speechName); | ||
27 | } | ||
28 | |||
29 | private static void putOutFile(String phaseJson, String currentDir, String speechName) { | ||
30 | String filePath = currentDir + File.separator + speechName + ".txt"; | ||
31 | FileOutputStream out = null; | ||
32 | try { | ||
33 | out = new FileOutputStream(new File(filePath)); | ||
34 | out.write(phaseJson.getBytes(StandardCharsets.UTF_8)); | ||
35 | } catch (IOException e) { | ||
36 | e.printStackTrace(); | ||
37 | } finally { | ||
38 | try { | ||
39 | if (out != null){ | ||
40 | out.close(); | ||
41 | } | ||
42 | } catch (IOException e) { | ||
43 | e.printStackTrace(); | ||
44 | } | ||
45 | } | ||
46 | } | ||
47 | |||
48 | private static ArrayList<SpeechBigPhaseEditDTO> getBigPhaseListByMapList(List<Map<String, String>> orgPhaseList) { | ||
49 | ArrayList<SpeechBigPhaseEditDTO> bigPhaseList = new ArrayList<>(); | ||
50 | HashMap<Integer, SpeechBigPhaseEditDTO> bigPhaseNumMap = new HashMap<>(); | ||
51 | //循环处理每一条话术配置 | ||
52 | int rowNum = 2; | ||
53 | for (Map<String, String> orgPhase : orgPhaseList) { | ||
54 | if (!StringUtils.isEmpty(orgPhase.get(ColDesc.COL_HINT_NUM.getCol()))) { | ||
55 | //获取大环节对象 | ||
56 | SpeechBigPhaseEditDTO bigPhaseEditDTO = fetchBigPhase(bigPhaseNumMap, bigPhaseList, orgPhase); | ||
57 | //生成小环节对象 | ||
58 | SpeechLittlePhaseAddDTO littlePhaseAddDTO; | ||
59 | try { | ||
60 | littlePhaseAddDTO = fetchLittlePhase(orgPhase); | ||
61 | } catch (Exception e){ | ||
62 | throw new RuntimeException("请检查第"+rowNum+"行的数据是否存在参数缺失,或者数据格式问题!"); | ||
63 | } | ||
64 | //将小环节封装入大环节对象的hintList属性中 | ||
65 | bigPhaseEditDTO.getHintsList().add(littlePhaseAddDTO.transToVO()); | ||
66 | } | ||
67 | rowNum++; | ||
68 | } | ||
69 | sortHintList(bigPhaseList); | ||
70 | return bigPhaseList; | ||
71 | } | ||
72 | |||
73 | private static void sortHintList(ArrayList<SpeechBigPhaseEditDTO> bigPhaseList) { | ||
74 | //将大环节列表按小环节序号排序 | ||
75 | bigPhaseList.sort(Comparator.comparingInt(SpeechBigPhaseEditDTO::getPhaseNum)); | ||
76 | for (SpeechBigPhaseEditDTO speechBigPhaseEditDTO : bigPhaseList){ | ||
77 | List<SpeechLittlePhaseEditDTO> hintsList = speechBigPhaseEditDTO.getHintsList(); | ||
78 | //将小环节列表按小环节序号排序 | ||
79 | hintsList.sort(Comparator.comparingInt(SpeechLittlePhaseEditDTO::getHintNum)); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | private static SpeechLittlePhaseAddDTO fetchLittlePhase(Map<String, String> orgPhase) { | ||
84 | int littlePhaseSerialNum = Integer.parseInt(orgPhase.get(ColDesc.COL_HINT_NUM.getCol())); | ||
85 | String littlePhaseName = orgPhase.get(ColDesc.COL_HINT_NAME.getCol()); | ||
86 | int triggerConditionSwitch = Integer.parseInt(orgPhase.get(ColDesc.COL_CONDITION_TYPE.getCol())); | ||
87 | String triggerConditionContent = orgPhase.get(ColDesc.COL_CONDITION_CONTENT.getCol()); | ||
88 | int phaseType = Integer.parseInt(orgPhase.get(ColDesc.COL_HINT_TYPE.getCol())); | ||
89 | int fileType = 0; | ||
90 | int identityType = 0; | ||
91 | int idcardOcrSwitch = 0; | ||
92 | try { | ||
93 | fileType = Integer.parseInt(orgPhase.get(ColDesc.COL_DOCTYPE.getCol())); | ||
94 | } catch (NumberFormatException e) { | ||
95 | } | ||
96 | try { | ||
97 | identityType = Integer.parseInt(orgPhase.get(ColDesc.COL_CERTIFICATE_TYPE.getCol())); | ||
98 | } catch (NumberFormatException e) { | ||
99 | } | ||
100 | try { | ||
101 | idcardOcrSwitch = Integer.parseInt(orgPhase.get(ColDesc.COL_OCR.getCol())); | ||
102 | } catch (NumberFormatException e) { | ||
103 | } | ||
104 | String ttsContent = orgPhase.get(ColDesc.COL_TTS.getCol()); | ||
105 | String littlePhaseTitle = orgPhase.get(ColDesc.COL_HINT_TITLE.getCol()); | ||
106 | String sure = orgPhase.get(ColDesc.COL_SURE.getCol()); | ||
107 | String no = orgPhase.get(ColDesc.COL_NO.getCol()); | ||
108 | return SpeechLittlePhaseAddDTO.builder() | ||
109 | .littlePhaseSerialNum(littlePhaseSerialNum) | ||
110 | .littlePhaseName(littlePhaseName) | ||
111 | .triggerConditionSwitch(triggerConditionSwitch) | ||
112 | .triggerConditionContent(triggerConditionContent) | ||
113 | .phaseType(phaseType) | ||
114 | .sure(sure) | ||
115 | .no(no) | ||
116 | .fileType(fileType) | ||
117 | .identityType(identityType) | ||
118 | .idcardOcrSwitch(idcardOcrSwitch) | ||
119 | .ttsContent(ttsContent) | ||
120 | .littlePhaseTitle(littlePhaseTitle) | ||
121 | .bindUnique("") | ||
122 | .build(); | ||
123 | |||
124 | } | ||
125 | |||
126 | private static SpeechBigPhaseEditDTO fetchBigPhase(HashMap<Integer, SpeechBigPhaseEditDTO> bigPhaseNumMap, ArrayList<SpeechBigPhaseEditDTO> bigPhaseList, Map<String, String> orgPhase) { | ||
127 | Integer bigPhaseNum = Integer.parseInt(orgPhase.get(ColDesc.COL_PHASE_NUM.getCol())); | ||
128 | SpeechBigPhaseEditDTO bigPhaseEditDTO = bigPhaseNumMap.get(bigPhaseNum); | ||
129 | if (bigPhaseEditDTO == null) { | ||
130 | bigPhaseEditDTO = new SpeechBigPhaseEditDTO(); | ||
131 | bigPhaseEditDTO.setPhaseNum(bigPhaseNum); | ||
132 | bigPhaseEditDTO.setPhaseTitle(orgPhase.get(ColDesc.COL_PHASE_TITLE.getCol())); | ||
133 | bigPhaseEditDTO.setHintsList(new ArrayList<>()); | ||
134 | bigPhaseNumMap.put(bigPhaseNum, bigPhaseEditDTO); | ||
135 | bigPhaseList.add(bigPhaseEditDTO); | ||
136 | } | ||
137 | return bigPhaseEditDTO; | ||
138 | } | ||
139 | } |
1 | package com.phase; | ||
2 | |||
3 | import lombok.Getter; | ||
4 | import lombok.NoArgsConstructor; | ||
5 | import lombok.Setter; | ||
6 | |||
7 | import java.util.List; | ||
8 | |||
9 | @Setter | ||
10 | @Getter | ||
11 | @NoArgsConstructor | ||
12 | public class SpeechBigPhaseEditDTO { | ||
13 | |||
14 | private Integer phaseNum; | ||
15 | |||
16 | private String phaseTitle; | ||
17 | |||
18 | private List<SpeechLittlePhaseEditDTO> hintsList; | ||
19 | |||
20 | } |
1 | package com.phase; | ||
2 | |||
3 | import lombok.*; | ||
4 | import org.springframework.util.StringUtils; | ||
5 | |||
6 | import java.util.HashMap; | ||
7 | |||
8 | @Setter | ||
9 | @Getter | ||
10 | @NoArgsConstructor | ||
11 | @AllArgsConstructor | ||
12 | @Builder | ||
13 | public class SpeechLittlePhaseAddDTO { | ||
14 | |||
15 | private int littlePhaseSerialNum; | ||
16 | |||
17 | private String littlePhaseName; | ||
18 | |||
19 | //触发条件状态(1 = 开, 2 = 关, 3 = 自定义条件开启) | ||
20 | private int triggerConditionSwitch; | ||
21 | |||
22 | //触发条件内容 | ||
23 | private String triggerConditionContent; | ||
24 | |||
25 | // 环节类型(1 = 问答环节, 2 = 陈述环节, 3 = 文件初始环节, 4 = 证件初始环节, 5 = 通用环节, 6 = 人脸识别环节) | ||
26 | private int phaseType; | ||
27 | |||
28 | //肯定答复 | ||
29 | private String sure; | ||
30 | |||
31 | //否定答复 | ||
32 | private String no; | ||
33 | |||
34 | //文件出示环节---文件类型(1 = 通用文件) | ||
35 | private int fileType; | ||
36 | |||
37 | //证件出示环节---证件类型(1 = 身份证正面, 2 = 身份证反面, 3 = 执业证正面, 4 = 执业证反面) | ||
38 | private int identityType; | ||
39 | |||
40 | //身份证证件ocr(正/反)开关(1 = 开, 2 = 关) | ||
41 | private int idcardOcrSwitch; | ||
42 | |||
43 | // 环节展示标题 | ||
44 | private String littlePhaseTitle; | ||
45 | |||
46 | //tts播报内容 | ||
47 | private String ttsContent; | ||
48 | |||
49 | private int bindBefore; | ||
50 | |||
51 | private int bindAfter; | ||
52 | |||
53 | private String bindUnique; | ||
54 | |||
55 | public SpeechLittlePhaseEditDTO transToVO() { | ||
56 | return SpeechLittlePhaseEditDTO.builder().hintNum(this.littlePhaseSerialNum).hintName(this.littlePhaseName) | ||
57 | .hintTitle(this.littlePhaseTitle).tts(this.ttsContent).condition(getConditionMap()).hintType(getHintType()). | ||
58 | bindBefore(this.bindBefore).bindAfter(this.bindAfter).bindUnique(this.bindUnique).classIndex(0).build(); | ||
59 | } | ||
60 | |||
61 | private HashMap<String, Object> getConditionMap() { | ||
62 | HashMap<String, Object> conditionMap = new HashMap<>(); | ||
63 | conditionMap.put("conditionType", this.triggerConditionSwitch); | ||
64 | if (this.triggerConditionSwitch == 3) { | ||
65 | conditionMap.put("conditionContent", this.triggerConditionContent); | ||
66 | } | ||
67 | return conditionMap; | ||
68 | } | ||
69 | |||
70 | private HashMap<String, Object> getHintType() { | ||
71 | HashMap<String, Object> hintTypeMap = new HashMap<>(); | ||
72 | hintTypeMap.put("hintType", this.phaseType); | ||
73 | if (this.phaseType == 1) { | ||
74 | if (!StringUtils.isEmpty(this.sure)) { | ||
75 | hintTypeMap.put("sure", this.sure); | ||
76 | } | ||
77 | if (!StringUtils.isEmpty(this.no)) { | ||
78 | hintTypeMap.put("no", this.no); | ||
79 | } | ||
80 | } else if (this.phaseType == 3) { | ||
81 | hintTypeMap.put("docType", this.fileType); | ||
82 | } else if (this.phaseType == 4) { | ||
83 | hintTypeMap.put("certificateType", this.identityType); | ||
84 | if (this.identityType == 1 || this.identityType == 2) { | ||
85 | hintTypeMap.put("ocr", this.idcardOcrSwitch); | ||
86 | } | ||
87 | } | ||
88 | return hintTypeMap; | ||
89 | } | ||
90 | } |
1 | package com.phase; | ||
2 | |||
3 | import lombok.*; | ||
4 | |||
5 | import java.util.HashMap; | ||
6 | |||
7 | @Setter | ||
8 | @Getter | ||
9 | @NoArgsConstructor | ||
10 | @AllArgsConstructor | ||
11 | @Builder | ||
12 | public class SpeechLittlePhaseEditDTO { | ||
13 | |||
14 | private Integer hintNum; | ||
15 | |||
16 | private String hintName; | ||
17 | |||
18 | private String hintTitle; | ||
19 | |||
20 | private String tts; | ||
21 | |||
22 | //触发条件状态(1 = 开, 2 = 关, 3 = 自定义条件开启),map中包含条件状态以及条件内容; | ||
23 | private HashMap condition; | ||
24 | |||
25 | //触发条件内容,环节类型已经相关内容,为了便于匹配前端入参格式,用hashMap封装入参 | ||
26 | private HashMap hintType; | ||
27 | |||
28 | private Integer bindBefore; | ||
29 | |||
30 | private Integer bindAfter; | ||
31 | |||
32 | private String bindUnique; | ||
33 | |||
34 | private Integer classIndex; | ||
35 | |||
36 | } |
src/main/java/com/phase/SpeechPhaseDTO.java
0 → 100644
1 | package com.phase; | ||
2 | |||
3 | import lombok.*; | ||
4 | |||
5 | import java.util.List; | ||
6 | |||
7 | |||
8 | /** | ||
9 | * 话术编辑 | ||
10 | * | ||
11 | * @author sunchenjie <sunchenjie@situdata.com> 2020/03/31 | ||
12 | **/ | ||
13 | @Setter | ||
14 | @Getter | ||
15 | @NoArgsConstructor | ||
16 | @AllArgsConstructor | ||
17 | @Builder | ||
18 | public class SpeechPhaseDTO { | ||
19 | |||
20 | private Long stlId; | ||
21 | |||
22 | private String speechName; | ||
23 | |||
24 | private List<SpeechBigPhaseEditDTO> phaseList; | ||
25 | |||
26 | } |
光大永明-大连地区非自保件.xlsx
0 → 100644
No preview for this file type
-
Please register or sign in to post a comment