create:excel导入增加popup字段
Showing
4 changed files
with
22 additions
and
9 deletions
| ... | @@ -21,7 +21,8 @@ public enum ColDesc { | ... | @@ -21,7 +21,8 @@ public enum ColDesc { |
| 21 | COL_NO("no", "否定答复"), | 21 | COL_NO("no", "否定答复"), |
| 22 | COL_DOCTYPE("fileType", "文件识别类别(1=通用文件)"), | 22 | COL_DOCTYPE("fileType", "文件识别类别(1=通用文件)"), |
| 23 | COL_CERTIFICATE_TYPE("identityType", "证件类别(1=身份证信息面,2=身份证国徽面,3=执业证正面,4=执业正反面)"), | 23 | COL_CERTIFICATE_TYPE("identityType", "证件类别(1=身份证信息面,2=身份证国徽面,3=执业证正面,4=执业正反面)"), |
| 24 | COL_OCR("idcardOcrSwitch", "OCR开启(1=开启,2=关闭)"); | 24 | COL_OCR("idcardOcrSwitch", "OCR开启(1=开启,2=关闭)"), |
| 25 | COL_POPUP("popup", "文件弹出(1=开启,2=关闭)"); | ||
| 25 | 26 | ||
| 26 | private String attr; | 27 | private String attr; |
| 27 | private String col; | 28 | private String col; | ... | ... |
| ... | @@ -23,11 +23,11 @@ public class PhaseUtil { | ... | @@ -23,11 +23,11 @@ public class PhaseUtil { |
| 23 | SpeechPhaseDTO speechPhaseDTO = SpeechPhaseDTO.builder().phaseList(bigPhaseList).speechName(speechName).stlId(0L).build(); | 23 | SpeechPhaseDTO speechPhaseDTO = SpeechPhaseDTO.builder().phaseList(bigPhaseList).speechName(speechName).stlId(0L).build(); |
| 24 | String phaseJson = JSON.toJSONString(speechPhaseDTO); | 24 | String phaseJson = JSON.toJSONString(speechPhaseDTO); |
| 25 | System.out.println(phaseJson); | 25 | System.out.println(phaseJson); |
| 26 | putOutFile(phaseJson,currentDir,speechName); | 26 | putOutFile(phaseJson, currentDir, speechName); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | private static void putOutFile(String phaseJson, String currentDir, String speechName) { | 29 | private static void putOutFile(String phaseJson, String currentDir, String speechName) { |
| 30 | String filePath = currentDir + File.separator + speechName + ".txt"; | 30 | String filePath = currentDir + File.separator + speechName + ".txt"; |
| 31 | FileOutputStream out = null; | 31 | FileOutputStream out = null; |
| 32 | try { | 32 | try { |
| 33 | out = new FileOutputStream(new File(filePath)); | 33 | out = new FileOutputStream(new File(filePath)); |
| ... | @@ -36,7 +36,7 @@ public class PhaseUtil { | ... | @@ -36,7 +36,7 @@ public class PhaseUtil { |
| 36 | e.printStackTrace(); | 36 | e.printStackTrace(); |
| 37 | } finally { | 37 | } finally { |
| 38 | try { | 38 | try { |
| 39 | if (out != null){ | 39 | if (out != null) { |
| 40 | out.close(); | 40 | out.close(); |
| 41 | } | 41 | } |
| 42 | } catch (IOException e) { | 42 | } catch (IOException e) { |
| ... | @@ -52,14 +52,15 @@ public class PhaseUtil { | ... | @@ -52,14 +52,15 @@ public class PhaseUtil { |
| 52 | int rowNum = 2; | 52 | int rowNum = 2; |
| 53 | for (Map<String, String> orgPhase : orgPhaseList) { | 53 | for (Map<String, String> orgPhase : orgPhaseList) { |
| 54 | if (!StringUtils.isEmpty(orgPhase.get(ColDesc.COL_HINT_NUM.getCol()))) { | 54 | if (!StringUtils.isEmpty(orgPhase.get(ColDesc.COL_HINT_NUM.getCol()))) { |
| 55 | System.out.println("当前处理excel行号:" + rowNum); | ||
| 55 | //获取大环节对象 | 56 | //获取大环节对象 |
| 56 | SpeechBigPhaseEditDTO bigPhaseEditDTO = fetchBigPhase(bigPhaseNumMap, bigPhaseList, orgPhase); | 57 | SpeechBigPhaseEditDTO bigPhaseEditDTO = fetchBigPhase(bigPhaseNumMap, bigPhaseList, orgPhase); |
| 57 | //生成小环节对象 | 58 | //生成小环节对象 |
| 58 | SpeechLittlePhaseAddDTO littlePhaseAddDTO; | 59 | SpeechLittlePhaseAddDTO littlePhaseAddDTO; |
| 59 | try { | 60 | try { |
| 60 | littlePhaseAddDTO = fetchLittlePhase(orgPhase); | 61 | littlePhaseAddDTO = fetchLittlePhase(orgPhase); |
| 61 | } catch (Exception e){ | 62 | } catch (Exception e) { |
| 62 | throw new RuntimeException("请检查第"+rowNum+"行的数据是否存在参数缺失,或者数据格式问题!"); | 63 | throw new RuntimeException("请检查第" + rowNum + "行的数据是否存在参数缺失,或者数据格式问题!"); |
| 63 | } | 64 | } |
| 64 | //将小环节封装入大环节对象的hintList属性中 | 65 | //将小环节封装入大环节对象的hintList属性中 |
| 65 | bigPhaseEditDTO.getHintsList().add(littlePhaseAddDTO.transToVO()); | 66 | bigPhaseEditDTO.getHintsList().add(littlePhaseAddDTO.transToVO()); |
| ... | @@ -73,7 +74,7 @@ public class PhaseUtil { | ... | @@ -73,7 +74,7 @@ public class PhaseUtil { |
| 73 | private static void sortHintList(ArrayList<SpeechBigPhaseEditDTO> bigPhaseList) { | 74 | private static void sortHintList(ArrayList<SpeechBigPhaseEditDTO> bigPhaseList) { |
| 74 | //将大环节列表按小环节序号排序 | 75 | //将大环节列表按小环节序号排序 |
| 75 | bigPhaseList.sort(Comparator.comparingInt(SpeechBigPhaseEditDTO::getPhaseNum)); | 76 | bigPhaseList.sort(Comparator.comparingInt(SpeechBigPhaseEditDTO::getPhaseNum)); |
| 76 | for (SpeechBigPhaseEditDTO speechBigPhaseEditDTO : bigPhaseList){ | 77 | for (SpeechBigPhaseEditDTO speechBigPhaseEditDTO : bigPhaseList) { |
| 77 | List<SpeechLittlePhaseEditDTO> hintsList = speechBigPhaseEditDTO.getHintsList(); | 78 | List<SpeechLittlePhaseEditDTO> hintsList = speechBigPhaseEditDTO.getHintsList(); |
| 78 | //将小环节列表按小环节序号排序 | 79 | //将小环节列表按小环节序号排序 |
| 79 | hintsList.sort(Comparator.comparingInt(SpeechLittlePhaseEditDTO::getHintNum)); | 80 | hintsList.sort(Comparator.comparingInt(SpeechLittlePhaseEditDTO::getHintNum)); |
| ... | @@ -89,6 +90,7 @@ public class PhaseUtil { | ... | @@ -89,6 +90,7 @@ public class PhaseUtil { |
| 89 | int fileType = 0; | 90 | int fileType = 0; |
| 90 | int identityType = 0; | 91 | int identityType = 0; |
| 91 | int idcardOcrSwitch = 0; | 92 | int idcardOcrSwitch = 0; |
| 93 | int popup = 2; | ||
| 92 | try { | 94 | try { |
| 93 | fileType = Integer.parseInt(orgPhase.get(ColDesc.COL_DOCTYPE.getCol())); | 95 | fileType = Integer.parseInt(orgPhase.get(ColDesc.COL_DOCTYPE.getCol())); |
| 94 | } catch (NumberFormatException e) { | 96 | } catch (NumberFormatException e) { |
| ... | @@ -101,6 +103,10 @@ public class PhaseUtil { | ... | @@ -101,6 +103,10 @@ public class PhaseUtil { |
| 101 | idcardOcrSwitch = Integer.parseInt(orgPhase.get(ColDesc.COL_OCR.getCol())); | 103 | idcardOcrSwitch = Integer.parseInt(orgPhase.get(ColDesc.COL_OCR.getCol())); |
| 102 | } catch (NumberFormatException e) { | 104 | } catch (NumberFormatException e) { |
| 103 | } | 105 | } |
| 106 | try { | ||
| 107 | popup = Integer.parseInt(orgPhase.get(ColDesc.COL_POPUP.getCol())); | ||
| 108 | } catch (NumberFormatException e) { | ||
| 109 | } | ||
| 104 | String ttsContent = orgPhase.get(ColDesc.COL_TTS.getCol()); | 110 | String ttsContent = orgPhase.get(ColDesc.COL_TTS.getCol()); |
| 105 | String littlePhaseTitle = orgPhase.get(ColDesc.COL_HINT_TITLE.getCol()); | 111 | String littlePhaseTitle = orgPhase.get(ColDesc.COL_HINT_TITLE.getCol()); |
| 106 | String sure = orgPhase.get(ColDesc.COL_SURE.getCol()); | 112 | String sure = orgPhase.get(ColDesc.COL_SURE.getCol()); |
| ... | @@ -119,6 +125,7 @@ public class PhaseUtil { | ... | @@ -119,6 +125,7 @@ public class PhaseUtil { |
| 119 | .ttsContent(ttsContent) | 125 | .ttsContent(ttsContent) |
| 120 | .littlePhaseTitle(littlePhaseTitle) | 126 | .littlePhaseTitle(littlePhaseTitle) |
| 121 | .bindUnique("") | 127 | .bindUnique("") |
| 128 | .popup(popup) | ||
| 122 | .build(); | 129 | .build(); |
| 123 | 130 | ||
| 124 | } | 131 | } | ... | ... |
| ... | @@ -52,10 +52,13 @@ public class SpeechLittlePhaseAddDTO { | ... | @@ -52,10 +52,13 @@ public class SpeechLittlePhaseAddDTO { |
| 52 | 52 | ||
| 53 | private String bindUnique; | 53 | private String bindUnique; |
| 54 | 54 | ||
| 55 | private Integer popup; | ||
| 56 | |||
| 55 | public SpeechLittlePhaseEditDTO transToVO() { | 57 | public SpeechLittlePhaseEditDTO transToVO() { |
| 56 | return SpeechLittlePhaseEditDTO.builder().hintNum(this.littlePhaseSerialNum).hintName(this.littlePhaseName) | 58 | return SpeechLittlePhaseEditDTO.builder().hintNum(this.littlePhaseSerialNum).hintName(this.littlePhaseName) |
| 57 | .hintTitle(this.littlePhaseTitle).tts(this.ttsContent).condition(getConditionMap()).hintType(getHintType()). | 59 | .hintTitle(this.littlePhaseTitle).tts(this.ttsContent).condition(getConditionMap()).hintType(getHintType()) |
| 58 | bindBefore(this.bindBefore).bindAfter(this.bindAfter).bindUnique(this.bindUnique).classIndex(0).build(); | 60 | .bindBefore(this.bindBefore).bindAfter(this.bindAfter).bindUnique(this.bindUnique) |
| 61 | .classIndex(0).popup(this.popup).build(); | ||
| 59 | } | 62 | } |
| 60 | 63 | ||
| 61 | private HashMap<String, Object> getConditionMap() { | 64 | private HashMap<String, Object> getConditionMap() { | ... | ... |
-
Please register or sign in to post a comment