正在显示
8 个修改的文件
包含
36 行增加
和
863 行删除
docker/Dockerfile
0 → 100644
| @@ -89,11 +89,7 @@ | @@ -89,11 +89,7 @@ | ||
| 89 | <artifactId>spring-boot-starter-test</artifactId> | 89 | <artifactId>spring-boot-starter-test</artifactId> |
| 90 | <scope>test</scope> | 90 | <scope>test</scope> |
| 91 | </dependency> | 91 | </dependency> |
| 92 | - <dependency> | ||
| 93 | - <groupId>com.tianbo</groupId> | ||
| 94 | - <artifactId>util</artifactId> | ||
| 95 | - <version>1.0-SNAPSHOT</version> | ||
| 96 | - </dependency> | 92 | + |
| 97 | <!--<dependency>--> | 93 | <!--<dependency>--> |
| 98 | <!--<groupId>com.fasterxml.jackson.core</groupId>--> | 94 | <!--<groupId>com.fasterxml.jackson.core</groupId>--> |
| 99 | <!--<artifactId>jackson-core</artifactId>--> | 95 | <!--<artifactId>jackson-core</artifactId>--> |
| @@ -178,31 +174,20 @@ | @@ -178,31 +174,20 @@ | ||
| 178 | <verbose>true</verbose> | 174 | <verbose>true</verbose> |
| 179 | </configuration> | 175 | </configuration> |
| 180 | </plugin> | 176 | </plugin> |
| 181 | - <!--Generate java code by xsd file--> | ||
| 182 | <plugin> | 177 | <plugin> |
| 183 | - <groupId>org.jvnet.jaxb2.maven2</groupId> | ||
| 184 | - <artifactId>maven-jaxb2-plugin</artifactId> | ||
| 185 | - <version>0.14.0</version> | ||
| 186 | - <configuration> | ||
| 187 | - <schemaDirectory>src/main/resources/xsd</schemaDirectory> | ||
| 188 | - <generateDirectory>src/main/java</generateDirectory> | ||
| 189 | - <packageLevelAnnotations>false</packageLevelAnnotations> | ||
| 190 | - <noFileHeader>true</noFileHeader> | ||
| 191 | - <episode>false</episode> | ||
| 192 | - <locale>en</locale> | ||
| 193 | - </configuration> | 178 | + <artifactId>maven-antrun-plugin</artifactId> |
| 194 | <executions> | 179 | <executions> |
| 195 | <execution> | 180 | <execution> |
| 196 | - <id>xsd1-generate</id> | ||
| 197 | - <goals> | ||
| 198 | - <goal>generate</goal> | ||
| 199 | - </goals> | 181 | + <id>gen-webadmin</id> |
| 182 | + <phase>package</phase> | ||
| 200 | <configuration> | 183 | <configuration> |
| 201 | - <schemaIncludes> | ||
| 202 | - <include>DecMessage_ImportSave1.xsd</include> | ||
| 203 | - </schemaIncludes> | ||
| 204 | - <generatePackage>com.sunyo.customer.order.xsd1</generatePackage> | 184 | + <tasks> |
| 185 | + <copy todir="docker" file="target/${project.artifactId}-${project.version}.${project.packaging}" /> | ||
| 186 | + </tasks> | ||
| 205 | </configuration> | 187 | </configuration> |
| 188 | + <goals> | ||
| 189 | + <goal>run</goal> | ||
| 190 | + </goals> | ||
| 206 | </execution> | 191 | </execution> |
| 207 | </executions> | 192 | </executions> |
| 208 | </plugin> | 193 | </plugin> |
| @@ -17,6 +17,8 @@ import org.activiti.engine.task.Task; | @@ -17,6 +17,8 @@ import org.activiti.engine.task.Task; | ||
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.web.bind.annotation.*; | 18 | import org.springframework.web.bind.annotation.*; |
| 19 | 19 | ||
| 20 | +import java.text.DateFormat; | ||
| 21 | +import java.text.SimpleDateFormat; | ||
| 20 | import java.util.HashMap; | 22 | import java.util.HashMap; |
| 21 | import java.util.List; | 23 | import java.util.List; |
| 22 | import java.util.Map; | 24 | import java.util.Map; |
| @@ -66,7 +68,7 @@ public class ProcessController { | @@ -66,7 +68,7 @@ public class ProcessController { | ||
| 66 | } | 68 | } |
| 67 | 69 | ||
| 68 | @PostMapping(value="/add") | 70 | @PostMapping(value="/add") |
| 69 | - public ResultJson add(ProcessForm processForm){ | 71 | + public ResultJson add( ProcessForm processForm){ |
| 70 | String uuid = UUID.randomUUID().toString(); | 72 | String uuid = UUID.randomUUID().toString(); |
| 71 | processForm.setFormid(uuid); | 73 | processForm.setFormid(uuid); |
| 72 | int i =processFormMapper.insertSelective(processForm); | 74 | int i =processFormMapper.insertSelective(processForm); |
| @@ -88,21 +90,21 @@ public class ProcessController { | @@ -88,21 +90,21 @@ public class ProcessController { | ||
| 88 | builder.addClasspathResource("processes/customProcess.bpmn20.xml").name("customProcess"); | 90 | builder.addClasspathResource("processes/customProcess.bpmn20.xml").name("customProcess"); |
| 89 | builder.deploy(); | 91 | builder.deploy(); |
| 90 | List<ProcessDefinition> p = repositoryService.createProcessDefinitionQuery().list(); | 92 | List<ProcessDefinition> p = repositoryService.createProcessDefinitionQuery().list(); |
| 91 | -// 启动流程实例,字符串"vacation"是BPMN模型文件里process元素的id | 93 | + // 启动流程实例,字符串"vacation"是BPMN模型文件里process元素的id |
| 92 | ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("customProcess"); | 94 | ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("customProcess"); |
| 93 | -//流程实例启动后,流程会跳转到请假申请节点 | 95 | + //流程实例启动后,流程会跳转到请假申请节点 |
| 94 | Task vacationApply = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); | 96 | Task vacationApply = taskService.createTaskQuery().processInstanceId(processInstance.getId()).singleResult(); |
| 95 | -//设置请假申请任务的执行人 | 97 | + //设置请假申请任务的执行人 |
| 96 | taskService.setAssignee(vacationApply.getId(), "zhangsan"); | 98 | taskService.setAssignee(vacationApply.getId(), "zhangsan"); |
| 97 | 99 | ||
| 98 | -//设置流程参数:请假天数和表单ID | ||
| 99 | -//流程引擎会根据请假天数days>3判断流程走向 | ||
| 100 | -//formId是用来将流程数据和表单数据关联起来 | 100 | + //设置流程参数:请假天数和表单ID |
| 101 | + //流程引擎会根据请假天数days>3判断流程走向 | ||
| 102 | + //formId是用来将流程数据和表单数据关联起来 | ||
| 101 | Map<String, Object> args = new HashMap<>(); | 103 | Map<String, Object> args = new HashMap<>(); |
| 102 | args.put("days", "2"); | 104 | args.put("days", "2"); |
| 103 | args.put("formId", "4d8746da-f0c2-418d-86b4-e3646dcef6c9"); | 105 | args.put("formId", "4d8746da-f0c2-418d-86b4-e3646dcef6c9"); |
| 104 | 106 | ||
| 105 | -//完成请假申请任务 | 107 | + //完成请假申请任务 |
| 106 | taskService.complete(vacationApply.getId(), args); | 108 | taskService.complete(vacationApply.getId(), args); |
| 107 | } | 109 | } |
| 108 | } | 110 | } |
| @@ -12,12 +12,12 @@ public class ProcessForm{ | @@ -12,12 +12,12 @@ public class ProcessForm{ | ||
| 12 | 12 | ||
| 13 | private String processname; | 13 | private String processname; |
| 14 | 14 | ||
| 15 | - @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
| 16 | - @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") | 15 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 16 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||
| 17 | private Date begindate; | 17 | private Date begindate; |
| 18 | 18 | ||
| 19 | - @DateTimeFormat(pattern = "yyyy-MM-dd") | ||
| 20 | - @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") | 19 | + @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| 20 | + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | ||
| 21 | private Date enddate; | 21 | private Date enddate; |
| 22 | 22 | ||
| 23 | private Byte vacationtype; | 23 | private Byte vacationtype; |
| 1 | -package com.sunyo.customer.order.mydemo; | ||
| 2 | - | ||
| 3 | -import phonicapi.PhonicConst; | ||
| 4 | -import phonicapi.PhonicHandler; | ||
| 5 | -import phonicapi.PhonicNative; | ||
| 6 | - | ||
| 7 | -/** | ||
| 8 | - * Created by XYH on 2020/1/8. | ||
| 9 | - */ | ||
| 10 | -public class IncomingCall implements PhonicHandler { | ||
| 11 | - private int uBoxHndOne = 0; //线路1操作句柄 | ||
| 12 | - private int uBoxHndTwo = 0; //线路2操作句柄 | ||
| 13 | - private int uBoxId = 0;// 设备类型 | ||
| 14 | - private boolean bHookOff = false; | ||
| 15 | - private String strDir = "C:\\"; | ||
| 16 | - //打开设备 | ||
| 17 | - public boolean openUBox() | ||
| 18 | - { | ||
| 19 | - PhonicNative.ubox_open_logfile(0); | ||
| 20 | - int nOpen = PhonicNative.ubox_open(this, PhonicConst.WORK_MODE_RECORD); | ||
| 21 | - System.out.println("ubox_open="+nOpen); | ||
| 22 | - if(nOpen == 0) | ||
| 23 | - { | ||
| 24 | - return true; | ||
| 25 | - } | ||
| 26 | - return false; | ||
| 27 | - } | ||
| 28 | - | ||
| 29 | - //关闭设备 | ||
| 30 | - public boolean closeUBox() | ||
| 31 | - { | ||
| 32 | - uBoxHndOne = 0; | ||
| 33 | - uBoxHndTwo = 0; | ||
| 34 | - PhonicNative.ubox_close(); | ||
| 35 | - return true; | ||
| 36 | - } | ||
| 37 | - //设备事件 | ||
| 38 | - public void event(int uboxHnd, int eventID, int param1, int param2, int param3, int param4) { | ||
| 39 | - switch (eventID) | ||
| 40 | - { | ||
| 41 | - case UBOX_EVENT_DEVICE_PLUG_IN: | ||
| 42 | - { | ||
| 43 | - //检测型号正确 | ||
| 44 | - //if(1 == PhonicNative.ubox_get_product_ID(uboxHnd)) | ||
| 45 | - { | ||
| 46 | - if(0 == uBoxHndOne) | ||
| 47 | - { | ||
| 48 | - uBoxHndOne = uboxHnd; | ||
| 49 | - uBoxId = PhonicNative.ubox_get_product_ID(uboxHnd); | ||
| 50 | - System.out.println(PhonicNative.ubox_get_device_versionnum(uboxHnd)); | ||
| 51 | - System.out.println(PhonicNative.ubox_get_product_name(uboxHnd)); | ||
| 52 | - if(uBoxId == 8) //无线设备 | ||
| 53 | - { | ||
| 54 | - PhonicNative.ubox_set_gsm_work_mode(uboxHnd, 1, 0); //如果不用电话机,关闭电话机模式,否则振铃的时候,戴着耳麦会听到很大的给电话机送来电号码声音,体验效果不好。 | ||
| 55 | - } | ||
| 56 | - } | ||
| 57 | - else if(0 == uBoxHndTwo) | ||
| 58 | - { | ||
| 59 | - uBoxHndTwo = uboxHnd; | ||
| 60 | - } | ||
| 61 | - else | ||
| 62 | - { | ||
| 63 | - uBoxHndOne = uboxHnd; | ||
| 64 | - uBoxHndTwo = 0; | ||
| 65 | - } | ||
| 66 | - } | ||
| 67 | - System.out.println("收到设备插入事件:" + uboxHnd); | ||
| 68 | - } | ||
| 69 | - break; | ||
| 70 | - case UBOX_EVENT_DEVICE_PLUG_OUT: | ||
| 71 | - { | ||
| 72 | - System.out.println("收到设备拔出事件:" + uboxHnd); | ||
| 73 | - } | ||
| 74 | - break; | ||
| 75 | - case UBOX_EVENT_LINE_HOOK_UP: | ||
| 76 | - { | ||
| 77 | - | ||
| 78 | - if(uBoxId == 8) | ||
| 79 | - { | ||
| 80 | - if(param1 == 1) | ||
| 81 | - { | ||
| 82 | - System.out.println("收到GSM模块挂机:" + uboxHnd); | ||
| 83 | - PhonicNative.ubox_set_talk_link(uboxHnd, EARPHONE_TO_GSM, 0); //被叫能够听不到耳麦说话的声音 | ||
| 84 | - } | ||
| 85 | - else if(param1 == 2) | ||
| 86 | - { | ||
| 87 | - System.out.println("收到电话机挂机:" + uboxHnd); | ||
| 88 | - } | ||
| 89 | - else if(param1 == 3) | ||
| 90 | - { | ||
| 91 | - System.out.println("收到耳麦挂机:" + uboxHnd); | ||
| 92 | - } | ||
| 93 | - } | ||
| 94 | - else | ||
| 95 | - { | ||
| 96 | - System.out.println("收到设备挂机事件:" + uboxHnd); | ||
| 97 | - } | ||
| 98 | - } | ||
| 99 | - break; | ||
| 100 | - case UBOX_EVENT_LINE_HOOK_OFF: | ||
| 101 | - { | ||
| 102 | - if(uBoxId == 8) | ||
| 103 | - { | ||
| 104 | - if(param1 == 0) | ||
| 105 | - { | ||
| 106 | - System.out.println("收到电话机摘机:" + uboxHnd); | ||
| 107 | - } | ||
| 108 | - else if(param1 == 2) | ||
| 109 | - { | ||
| 110 | - System.out.println("收到耳麦摘机:" + uboxHnd); | ||
| 111 | - } | ||
| 112 | - else if(param1 == 6) | ||
| 113 | - { | ||
| 114 | - System.out.println("收到GSM模块摘机:" + uboxHnd); | ||
| 115 | - PhonicNative.ubox_set_talk_link(uboxHnd, EARPHONE_TO_GSM, 1); //被叫能够听到耳麦说话的声音 | ||
| 116 | - } | ||
| 117 | - } | ||
| 118 | - else | ||
| 119 | - { | ||
| 120 | - System.out.println("收到设备摘机事件:" + uboxHnd); | ||
| 121 | - } | ||
| 122 | - } | ||
| 123 | - break; | ||
| 124 | - case UBOX_EVENT_LINE_RINGING: | ||
| 125 | - { | ||
| 126 | - System.out.println("收到设备检测线路振铃开始事件:" + uboxHnd); | ||
| 127 | - } | ||
| 128 | - break; | ||
| 129 | - case UBOX_EVENT_DEVICE_PLAY_END: | ||
| 130 | - { | ||
| 131 | - System.out.println("收到放音结束事件:" + uboxHnd); | ||
| 132 | - } | ||
| 133 | - break; | ||
| 134 | - case UBOX_EVENT_RING_CANCEL: | ||
| 135 | - { | ||
| 136 | - System.out.println("收到设备检测线路振铃停止事件:" + uboxHnd); | ||
| 137 | - } | ||
| 138 | - break; | ||
| 139 | - case UBOX_EVENT_DEVICE_BUSY_TONE: | ||
| 140 | - { | ||
| 141 | - System.out.println("收到设备检测线路忙音事件:" + uboxHnd); | ||
| 142 | - } | ||
| 143 | - break; | ||
| 144 | - case UBOX_EVENT_ALARM: | ||
| 145 | - { | ||
| 146 | - System.out.println("收到设备工作警告事件:" + uboxHnd); | ||
| 147 | - } | ||
| 148 | - break; | ||
| 149 | - case UBOX_EVENT_DEVICE_ERROR: | ||
| 150 | - { | ||
| 151 | - System.out.println("收到设备错误事件:" + uboxHnd); | ||
| 152 | - } | ||
| 153 | - break; | ||
| 154 | - case UBOX_EVENT_LINE_RING_STOP: | ||
| 155 | - { | ||
| 156 | - System.out.println("收到设备检测线路振铃闪停事件:" + uboxHnd); | ||
| 157 | - } | ||
| 158 | - break; | ||
| 159 | - case UBOX_EVENT_LINE_HANG: | ||
| 160 | - { | ||
| 161 | - System.out.println("收到设备悬空事件:" + uboxHnd); | ||
| 162 | - } | ||
| 163 | - break; | ||
| 164 | - case UBOX_EVENT_LINE_VOLTAGE: | ||
| 165 | - { | ||
| 166 | - System.out.println("收到设备线路当前电压事件:" + uboxHnd); | ||
| 167 | - } | ||
| 168 | - break; | ||
| 169 | - case UBOX_EVENT_STREAM_VOICE: | ||
| 170 | - { | ||
| 171 | - System.out.println("收到流式录音数据包事件:" + uboxHnd); | ||
| 172 | - } | ||
| 173 | - break; | ||
| 174 | - case UBOX_EVENT_DTMF_DOWN: | ||
| 175 | - { | ||
| 176 | - //System.out.println("按键事件:" + uboxHnd); | ||
| 177 | - } | ||
| 178 | - break; | ||
| 179 | - case UBOX_EVENT_DTMF_UP: | ||
| 180 | - { | ||
| 181 | - System.out.println("收到按键释放事件:" + uboxHnd); | ||
| 182 | - } | ||
| 183 | - break; | ||
| 184 | - case UBOX_EVENT_DEVICE_PLAY_ERROR: | ||
| 185 | - { | ||
| 186 | - System.out.println("收到放音错误事件:" + uboxHnd); | ||
| 187 | - } | ||
| 188 | - break; | ||
| 189 | - case UBOX_EVENT_CALLOUTFINISH: | ||
| 190 | - { | ||
| 191 | - System.out.println("收到软件拨号完成事件:" + uboxHnd); | ||
| 192 | - } | ||
| 193 | - break; | ||
| 194 | - case UBOX_EVENT_POLARITY: | ||
| 195 | - { | ||
| 196 | - System.out.println("收到检测极性反转事件:" + uboxHnd); | ||
| 197 | - } | ||
| 198 | - break; | ||
| 199 | - case UBOX_EVENT_SIM_STATE: | ||
| 200 | - { | ||
| 201 | - if(param2 == 1) | ||
| 202 | - { | ||
| 203 | - System.out.println("卡状态事件, 当前选择sim卡" + param1); | ||
| 204 | - } | ||
| 205 | - else if(param2 == 2) | ||
| 206 | - { | ||
| 207 | - System.out.println("卡状态事件, sim卡" + param1 +" GSM 模块检查Sim卡未插入"); | ||
| 208 | - } | ||
| 209 | - else if(param2 == 3) | ||
| 210 | - { | ||
| 211 | - System.out.println("卡状态事件, sim卡" + param1 +" 检测到卡存在,并且是插好的"); | ||
| 212 | - } | ||
| 213 | - else if(param2 > 3) | ||
| 214 | - { | ||
| 215 | - System.out.println("卡状态事件, sim卡" + param1 +" 检测到卡有错误,错误值:"+param2); | ||
| 216 | - } | ||
| 217 | - } | ||
| 218 | - break; | ||
| 219 | - case UBOX_EVENT_ANSWER: | ||
| 220 | - { | ||
| 221 | - System.out.println(" 被叫已经应答了"); | ||
| 222 | - | ||
| 223 | - PhonicNative.ubox_set_talk_link(uboxHnd, EARPHONE_TO_GSM, 1); //被叫能够听到耳麦说话的声音 | ||
| 224 | - } | ||
| 225 | - break; | ||
| 226 | - case UBOX_EVENT_SIGNALE_SIZE: | ||
| 227 | - { | ||
| 228 | - System.out.println(" 信号大小:"+param1); | ||
| 229 | - } | ||
| 230 | - break; | ||
| 231 | - case UBOX_EVENT_SHORT_MSG_SIZE: | ||
| 232 | - { | ||
| 233 | - System.out.println(" 被叫已经应答了"); | ||
| 234 | - } | ||
| 235 | - break; | ||
| 236 | - case UBOX_EVENT_SIM_REG: | ||
| 237 | - { | ||
| 238 | - if(param2 == 0) | ||
| 239 | - { | ||
| 240 | - System.out.println("sim卡" + param1+1 + " 网络未注册,当前没有搜索到要注册业务的新营运商 "); | ||
| 241 | - } | ||
| 242 | - else if(param2 == 1) | ||
| 243 | - { | ||
| 244 | - System.out.println("sim卡" + param1+1 + " 网络已注册"); | ||
| 245 | - //btnCall.setEnabled(true); //网络已经注册好了,可以拨打电话和发短信 | ||
| 246 | - //btnSendMsg.setEnabled(true); | ||
| 247 | - } | ||
| 248 | - else if(param2 == 2) | ||
| 249 | - { | ||
| 250 | - System.out.println("sim卡" + param1+1 + " 网络未注册,正在搜索要注册业务的新营运商"); | ||
| 251 | - } | ||
| 252 | - else if(param2 == 3) | ||
| 253 | - { | ||
| 254 | - System.out.println("sim卡" + param1+1 + " 注册被拒绝"); | ||
| 255 | - } | ||
| 256 | - else if(param2 == 4) | ||
| 257 | - { | ||
| 258 | - System.out.println("sim卡" + param1+1 + " 未注册, 未知原因"); | ||
| 259 | - } | ||
| 260 | - else if(param2 == 5) | ||
| 261 | - { | ||
| 262 | - System.out.println("sim卡" + param1+1 + " 已注册,漫游"); | ||
| 263 | - } | ||
| 264 | - } | ||
| 265 | - break; | ||
| 266 | - case UBOX_EVENT_SHORT_MSG_SEND_REPORT: | ||
| 267 | - { | ||
| 268 | - if(param1 == 0) | ||
| 269 | - { | ||
| 270 | - System.out.println("短信发送失败"); | ||
| 271 | - } | ||
| 272 | - else if(param1 == 1) | ||
| 273 | - { | ||
| 274 | - System.out.println("短信发送成功"); | ||
| 275 | - } | ||
| 276 | - else if(param1 == 2) | ||
| 277 | - { | ||
| 278 | - System.out.println("短信发送超时"); | ||
| 279 | - } | ||
| 280 | - } | ||
| 281 | - break; | ||
| 282 | - default: | ||
| 283 | - { | ||
| 284 | - System.out.println("未知事件[uboxHnd=" + uboxHnd + "][eventID=" + eventID | ||
| 285 | - + "][param1=" + param1 + "][param2=" + param2 + "][param3=" | ||
| 286 | - + param3 + "][param4=" + param4 + "]"); | ||
| 287 | - } | ||
| 288 | - break; | ||
| 289 | - } | ||
| 290 | - } | ||
| 291 | - | ||
| 292 | - public void callInNumber(int uboxHnd, String number) { | ||
| 293 | - System.out.println("收到主叫号码[uboxHnd=" + uboxHnd + "][number=" + number + "]"); | ||
| 294 | - } | ||
| 295 | - | ||
| 296 | - public void ShortMsg(int uboxHnd, String PhoneNumber, String stTime, String msg, String strDived) { | ||
| 297 | - System.out.println("收到短信[uboxHnd=" + uboxHnd + "][发件人=" + PhoneNumber + "]" + ", 时间:"+stTime +", 内容:" +msg+ " "+strDived); | ||
| 298 | - } | ||
| 299 | - | ||
| 300 | - public void CmdMsg(int uboxHnd, String cmd) { | ||
| 301 | - System.out.println("收到消息[uboxHnd=" + uboxHnd + "][内容=" + cmd + "]"); | ||
| 302 | - } | ||
| 303 | - public static void main(String[] args){ | ||
| 304 | - IncomingCall call=new IncomingCall(); | ||
| 305 | - call.openUBox(); | ||
| 306 | - } | ||
| 307 | -} |
| 1 | -package com.sunyo.customer.order.mydemo; | ||
| 2 | - | ||
| 3 | -import phonicapi.PhonicConst; | ||
| 4 | -import phonicapi.PhonicHandler; | ||
| 5 | -import phonicapi.PhonicNative; | ||
| 6 | - | ||
| 7 | -import javax.swing.*; | ||
| 8 | -import java.awt.*; | ||
| 9 | -import java.awt.event.ActionEvent; | ||
| 10 | -import java.awt.event.ActionListener; | ||
| 11 | -import java.awt.event.WindowAdapter; | ||
| 12 | -import java.awt.event.WindowEvent; | ||
| 13 | -import java.io.File; | ||
| 14 | -import java.text.DateFormat; | ||
| 15 | -import java.text.SimpleDateFormat; | ||
| 16 | -import java.util.Date; | ||
| 17 | - | ||
| 18 | - | ||
| 19 | -public class MainFrame extends JFrame implements PhonicHandler{ | ||
| 20 | - private JButton btnHookOff = new JButton("摘机"); | ||
| 21 | - private JButton btnHookOn = new JButton("挂机"); | ||
| 22 | - private JButton btnCall = new JButton("拨号"); | ||
| 23 | - | ||
| 24 | - private JButton btnSendMsg = new JButton("发送短信"); | ||
| 25 | - private JTextField txtNumb = new JTextField(); | ||
| 26 | - private JComboBox cbxLine = new JComboBox(); | ||
| 27 | - private JTextField txtShortMsgNumber = new JTextField(); | ||
| 28 | - private JTextField txtShortMsg = new JTextField(); | ||
| 29 | - private int uBoxHndOne = 0; //线路1操作句柄 | ||
| 30 | - private int uBoxHndTwo = 0; //线路2操作句柄 | ||
| 31 | - private int uBoxId = 0;// 设备类型 | ||
| 32 | - private boolean bHookOff = false; | ||
| 33 | - private String strDir = "C:\\"; | ||
| 34 | - | ||
| 35 | - MainFrame () | ||
| 36 | - { | ||
| 37 | - try{ | ||
| 38 | - File directory = new File(""); | ||
| 39 | - strDir = directory.getAbsolutePath(); | ||
| 40 | - System.out.println(strDir); | ||
| 41 | - }catch(Exception e){} | ||
| 42 | - | ||
| 43 | - //线路 | ||
| 44 | - cbxLine.setBounds(20, 20, 160, 20); | ||
| 45 | - cbxLine.addItem("线路1"); | ||
| 46 | - cbxLine.addItem("线路2"); | ||
| 47 | - cbxLine.setSelectedItem("线路1"); | ||
| 48 | - | ||
| 49 | - //摘机 | ||
| 50 | - btnHookOff.setBounds(20, 60, 60, 20); | ||
| 51 | - btnHookOff.addActionListener(new ActionListener() { | ||
| 52 | - public void actionPerformed(ActionEvent e) { | ||
| 53 | - int uBoxHnd = cbxLine.getSelectedIndex()==0?uBoxHndOne:uBoxHndTwo; | ||
| 54 | - int nResult = PhonicNative.ubox_soft_hook_off(uBoxHnd); | ||
| 55 | - System.out.println(nResult); | ||
| 56 | - if(0 == nResult) | ||
| 57 | - { | ||
| 58 | - bHookOff = true; | ||
| 59 | - cbxLine.setEnabled(false); | ||
| 60 | - btnHookOff.setEnabled(false); | ||
| 61 | - btnHookOn.setEnabled(true); | ||
| 62 | - btnCall.setEnabled(true); | ||
| 63 | - txtNumb.setEnabled(true); | ||
| 64 | - | ||
| 65 | - //开始录音 | ||
| 66 | - Date nowDate = new Date(); | ||
| 67 | - DateFormat dfDate = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); | ||
| 68 | - String strPath = strDir+"\\"+dfDate.format(nowDate)+".wav"; | ||
| 69 | - System.out.println(strPath); | ||
| 70 | - PhonicNative.ubox_record_file(uBoxHnd, strPath, CODER_ALAW); | ||
| 71 | - } | ||
| 72 | - } | ||
| 73 | - }); | ||
| 74 | - //挂机 | ||
| 75 | - btnHookOn.setEnabled(false); | ||
| 76 | - btnHookOn.setBounds(120, 60, 60, 20); | ||
| 77 | - btnHookOn.addActionListener(new ActionListener() { | ||
| 78 | - public void actionPerformed(ActionEvent e) { | ||
| 79 | - int uBoxHnd = cbxLine.getSelectedIndex()==0?uBoxHndOne:uBoxHndTwo; | ||
| 80 | - int nResult = PhonicNative.ubox_soft_hook_on(uBoxHnd); | ||
| 81 | - System.out.println(nResult); | ||
| 82 | - if(0 == nResult) | ||
| 83 | - { | ||
| 84 | - bHookOff = false; | ||
| 85 | - cbxLine.setEnabled(true); | ||
| 86 | - btnHookOff.setEnabled(true); | ||
| 87 | - btnHookOn.setEnabled(false); | ||
| 88 | - btnCall.setEnabled(true); | ||
| 89 | - txtNumb.setEnabled(true); | ||
| 90 | - | ||
| 91 | - //停止录音 | ||
| 92 | - PhonicNative.ubox_stop_record(uBoxHnd); | ||
| 93 | - } | ||
| 94 | - } | ||
| 95 | - }); | ||
| 96 | - | ||
| 97 | - //拨号 | ||
| 98 | - btnCall.setBounds(120, 100, 60, 20); | ||
| 99 | - btnCall.addActionListener(new ActionListener() { | ||
| 100 | - public void actionPerformed(ActionEvent e) { | ||
| 101 | - if(uBoxId == 8) | ||
| 102 | - { | ||
| 103 | - if(txtNumb.getText().length() > 0) | ||
| 104 | - { | ||
| 105 | - cbxLine.setEnabled(false); | ||
| 106 | - btnHookOff.setEnabled(false); | ||
| 107 | - btnHookOn.setEnabled(true); | ||
| 108 | - btnCall.setEnabled(true); | ||
| 109 | - txtNumb.setEnabled(true); | ||
| 110 | - int uBoxHnd = cbxLine.getSelectedIndex()==0?uBoxHndOne:uBoxHndTwo; | ||
| 111 | - int nResult = PhonicNative.ubox_makecall(uBoxHnd, txtNumb.getText()); | ||
| 112 | - System.out.println(nResult); | ||
| 113 | - | ||
| 114 | - | ||
| 115 | - } | ||
| 116 | - } | ||
| 117 | - else | ||
| 118 | - { | ||
| 119 | - //摘机 | ||
| 120 | - if(!bHookOff) | ||
| 121 | - { | ||
| 122 | - int uBoxHnd = cbxLine.getSelectedIndex()==0?uBoxHndOne:uBoxHndTwo; | ||
| 123 | - int nResult = PhonicNative.ubox_soft_hook_off(uBoxHnd); | ||
| 124 | - System.out.println(nResult); | ||
| 125 | - if(0 == nResult) | ||
| 126 | - { | ||
| 127 | - bHookOff = true; | ||
| 128 | - cbxLine.setEnabled(false); | ||
| 129 | - btnHookOff.setEnabled(false); | ||
| 130 | - btnHookOn.setEnabled(true); | ||
| 131 | - btnCall.setEnabled(true); | ||
| 132 | - txtNumb.setEnabled(true); | ||
| 133 | - | ||
| 134 | - //开始录音 | ||
| 135 | - Date nowDate = new Date(); | ||
| 136 | - DateFormat dfDate = new SimpleDateFormat("yyyy_MM_dd_HH_mm_ss"); | ||
| 137 | - String strPath = strDir+"\\"+dfDate.format(nowDate)+".wav"; | ||
| 138 | - System.out.println(strPath); | ||
| 139 | - PhonicNative.ubox_record_file(uBoxHnd, strPath, CODER_ALAW); | ||
| 140 | - } | ||
| 141 | - //等待0.5秒再拨号 | ||
| 142 | - try{ | ||
| 143 | - Thread.sleep(500); | ||
| 144 | - }catch(Exception ee){ | ||
| 145 | - ee.printStackTrace(); | ||
| 146 | - } | ||
| 147 | - } | ||
| 148 | - | ||
| 149 | - if(txtNumb.getText().length() > 0) | ||
| 150 | - { | ||
| 151 | - btnCall.setEnabled(false); | ||
| 152 | - txtNumb.setEnabled(false); | ||
| 153 | - int uBoxHnd = cbxLine.getSelectedIndex()==0?uBoxHndOne:uBoxHndTwo; | ||
| 154 | - int nResult = PhonicNative.ubox_send_dtmf(uBoxHnd, txtNumb.getText()); | ||
| 155 | - System.out.println(nResult); | ||
| 156 | - } | ||
| 157 | - } | ||
| 158 | - } | ||
| 159 | - }); | ||
| 160 | - | ||
| 161 | - btnCall.setEnabled(false); | ||
| 162 | - btnSendMsg.setEnabled(false); | ||
| 163 | - //号码输入框 | ||
| 164 | - txtNumb.setBounds(20, 100, 80, 20); | ||
| 165 | - txtNumb.setText("910000"); | ||
| 166 | - | ||
| 167 | - txtShortMsgNumber.setBounds(20, 140, 80, 20); //收件号码 | ||
| 168 | - txtShortMsgNumber.setText("8615907558923");//发短信,需要在号码前加国际区号 ,中国"86" | ||
| 169 | - | ||
| 170 | - txtShortMsg.setBounds(120, 140, 200, 20); //短信内容 | ||
| 171 | - txtShortMsg.setText("");//发短信,需要在号码前加国际区号 ,中国"86" | ||
| 172 | - | ||
| 173 | - //发送短信 | ||
| 174 | - btnSendMsg.setBounds(340, 140, 120, 20); | ||
| 175 | - btnSendMsg.addActionListener(new ActionListener() { | ||
| 176 | - public void actionPerformed(ActionEvent e) { | ||
| 177 | - if(uBoxId == 8) | ||
| 178 | - { | ||
| 179 | - if(txtShortMsgNumber.getText().length() > 0 && txtShortMsg.getText().length() > 0) | ||
| 180 | - { | ||
| 181 | - | ||
| 182 | - int uBoxHnd = cbxLine.getSelectedIndex()==0?uBoxHndOne:uBoxHndTwo; | ||
| 183 | - int nResult = PhonicNative.ubox_send_gsm_msg(uBoxHnd, 1, txtShortMsgNumber.getText(), txtShortMsg.getText(),txtShortMsg.getText().length()); | ||
| 184 | - System.out.println(nResult); | ||
| 185 | - | ||
| 186 | - | ||
| 187 | - } | ||
| 188 | - } | ||
| 189 | - } | ||
| 190 | - }); | ||
| 191 | - //添加控件 | ||
| 192 | - add(cbxLine); | ||
| 193 | - add(btnHookOff); | ||
| 194 | - add(btnHookOn); | ||
| 195 | - add(btnCall); | ||
| 196 | - add(txtNumb); | ||
| 197 | - | ||
| 198 | - add(txtShortMsgNumber); | ||
| 199 | - add(txtShortMsg); | ||
| 200 | - add(btnSendMsg); | ||
| 201 | - //初始化 | ||
| 202 | - openUBox(); | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | - //打开设备 | ||
| 206 | - public boolean openUBox() | ||
| 207 | - { | ||
| 208 | - PhonicNative.ubox_open_logfile(0); | ||
| 209 | - int nOpen = PhonicNative.ubox_open(this, PhonicConst.WORK_MODE_RECORD); | ||
| 210 | - System.out.println("ubox_open="+nOpen); | ||
| 211 | - if(nOpen == 0) | ||
| 212 | - { | ||
| 213 | - return true; | ||
| 214 | - } | ||
| 215 | - return false; | ||
| 216 | - } | ||
| 217 | - | ||
| 218 | - //关闭设备 | ||
| 219 | - public boolean closeUBox() | ||
| 220 | - { | ||
| 221 | - uBoxHndOne = 0; | ||
| 222 | - uBoxHndTwo = 0; | ||
| 223 | - PhonicNative.ubox_close(); | ||
| 224 | - return true; | ||
| 225 | - } | ||
| 226 | - | ||
| 227 | - | ||
| 228 | - //设备事件 | ||
| 229 | - public void event(int uboxHnd, int eventID, int param1, int param2, int param3, int param4) { | ||
| 230 | - switch (eventID) | ||
| 231 | - { | ||
| 232 | - case UBOX_EVENT_DEVICE_PLUG_IN: | ||
| 233 | - { | ||
| 234 | - //检测型号正确 | ||
| 235 | - //if(1 == PhonicNative.ubox_get_product_ID(uboxHnd)) | ||
| 236 | - { | ||
| 237 | - if(0 == uBoxHndOne) | ||
| 238 | - { | ||
| 239 | - uBoxHndOne = uboxHnd; | ||
| 240 | - uBoxId = PhonicNative.ubox_get_product_ID(uboxHnd); | ||
| 241 | - System.out.println(PhonicNative.ubox_get_device_versionnum(uboxHnd)); | ||
| 242 | - System.out.println(PhonicNative.ubox_get_product_name(uboxHnd)); | ||
| 243 | - if(uBoxId == 8) //无线设备 | ||
| 244 | - { | ||
| 245 | - PhonicNative.ubox_set_gsm_work_mode(uboxHnd, 1, 0); //如果不用电话机,关闭电话机模式,否则振铃的时候,戴着耳麦会听到很大的给电话机送来电号码声音,体验效果不好。 | ||
| 246 | - } | ||
| 247 | - } | ||
| 248 | - else if(0 == uBoxHndTwo) | ||
| 249 | - { | ||
| 250 | - uBoxHndTwo = uboxHnd; | ||
| 251 | - } | ||
| 252 | - else | ||
| 253 | - { | ||
| 254 | - uBoxHndOne = uboxHnd; | ||
| 255 | - uBoxHndTwo = 0; | ||
| 256 | - } | ||
| 257 | - } | ||
| 258 | - System.out.println("收到设备插入事件:" + uboxHnd); | ||
| 259 | - } | ||
| 260 | - break; | ||
| 261 | - case UBOX_EVENT_DEVICE_PLUG_OUT: | ||
| 262 | - { | ||
| 263 | - System.out.println("收到设备拔出事件:" + uboxHnd); | ||
| 264 | - } | ||
| 265 | - break; | ||
| 266 | - case UBOX_EVENT_LINE_HOOK_UP: | ||
| 267 | - { | ||
| 268 | - | ||
| 269 | - if(uBoxId == 8) | ||
| 270 | - { | ||
| 271 | - if(param1 == 1) | ||
| 272 | - { | ||
| 273 | - System.out.println("收到GSM模块挂机:" + uboxHnd); | ||
| 274 | - PhonicNative.ubox_set_talk_link(uboxHnd, EARPHONE_TO_GSM, 0); //被叫能够听不到耳麦说话的声音 | ||
| 275 | - } | ||
| 276 | - else if(param1 == 2) | ||
| 277 | - { | ||
| 278 | - System.out.println("收到电话机挂机:" + uboxHnd); | ||
| 279 | - } | ||
| 280 | - else if(param1 == 3) | ||
| 281 | - { | ||
| 282 | - System.out.println("收到耳麦挂机:" + uboxHnd); | ||
| 283 | - } | ||
| 284 | - } | ||
| 285 | - else | ||
| 286 | - { | ||
| 287 | - System.out.println("收到设备挂机事件:" + uboxHnd); | ||
| 288 | - } | ||
| 289 | - } | ||
| 290 | - break; | ||
| 291 | - case UBOX_EVENT_LINE_HOOK_OFF: | ||
| 292 | - { | ||
| 293 | - if(uBoxId == 8) | ||
| 294 | - { | ||
| 295 | - if(param1 == 0) | ||
| 296 | - { | ||
| 297 | - System.out.println("收到电话机摘机:" + uboxHnd); | ||
| 298 | - } | ||
| 299 | - else if(param1 == 2) | ||
| 300 | - { | ||
| 301 | - System.out.println("收到耳麦摘机:" + uboxHnd); | ||
| 302 | - } | ||
| 303 | - else if(param1 == 6) | ||
| 304 | - { | ||
| 305 | - System.out.println("收到GSM模块摘机:" + uboxHnd); | ||
| 306 | - PhonicNative.ubox_set_talk_link(uboxHnd, EARPHONE_TO_GSM, 1); //被叫能够听到耳麦说话的声音 | ||
| 307 | - } | ||
| 308 | - } | ||
| 309 | - else | ||
| 310 | - { | ||
| 311 | - System.out.println("收到设备摘机事件:" + uboxHnd); | ||
| 312 | - } | ||
| 313 | - } | ||
| 314 | - break; | ||
| 315 | - case UBOX_EVENT_LINE_RINGING: | ||
| 316 | - { | ||
| 317 | - System.out.println("收到设备检测线路振铃开始事件:" + uboxHnd); | ||
| 318 | - } | ||
| 319 | - break; | ||
| 320 | - case UBOX_EVENT_DEVICE_PLAY_END: | ||
| 321 | - { | ||
| 322 | - System.out.println("收到放音结束事件:" + uboxHnd); | ||
| 323 | - } | ||
| 324 | - break; | ||
| 325 | - case UBOX_EVENT_RING_CANCEL: | ||
| 326 | - { | ||
| 327 | - System.out.println("收到设备检测线路振铃停止事件:" + uboxHnd); | ||
| 328 | - } | ||
| 329 | - break; | ||
| 330 | - case UBOX_EVENT_DEVICE_BUSY_TONE: | ||
| 331 | - { | ||
| 332 | - System.out.println("收到设备检测线路忙音事件:" + uboxHnd); | ||
| 333 | - } | ||
| 334 | - break; | ||
| 335 | - case UBOX_EVENT_ALARM: | ||
| 336 | - { | ||
| 337 | - System.out.println("收到设备工作警告事件:" + uboxHnd); | ||
| 338 | - } | ||
| 339 | - break; | ||
| 340 | - case UBOX_EVENT_DEVICE_ERROR: | ||
| 341 | - { | ||
| 342 | - System.out.println("收到设备错误事件:" + uboxHnd); | ||
| 343 | - } | ||
| 344 | - break; | ||
| 345 | - case UBOX_EVENT_LINE_RING_STOP: | ||
| 346 | - { | ||
| 347 | - System.out.println("收到设备检测线路振铃闪停事件:" + uboxHnd); | ||
| 348 | - } | ||
| 349 | - break; | ||
| 350 | - case UBOX_EVENT_LINE_HANG: | ||
| 351 | - { | ||
| 352 | - System.out.println("收到设备悬空事件:" + uboxHnd); | ||
| 353 | - } | ||
| 354 | - break; | ||
| 355 | - case UBOX_EVENT_LINE_VOLTAGE: | ||
| 356 | - { | ||
| 357 | - System.out.println("收到设备线路当前电压事件:" + uboxHnd); | ||
| 358 | - } | ||
| 359 | - break; | ||
| 360 | - case UBOX_EVENT_STREAM_VOICE: | ||
| 361 | - { | ||
| 362 | - System.out.println("收到流式录音数据包事件:" + uboxHnd); | ||
| 363 | - } | ||
| 364 | - break; | ||
| 365 | - case UBOX_EVENT_DTMF_DOWN: | ||
| 366 | - { | ||
| 367 | - //System.out.println("按键事件:" + uboxHnd); | ||
| 368 | - } | ||
| 369 | - break; | ||
| 370 | - case UBOX_EVENT_DTMF_UP: | ||
| 371 | - { | ||
| 372 | - System.out.println("收到按键释放事件:" + uboxHnd); | ||
| 373 | - } | ||
| 374 | - break; | ||
| 375 | - case UBOX_EVENT_DEVICE_PLAY_ERROR: | ||
| 376 | - { | ||
| 377 | - System.out.println("收到放音错误事件:" + uboxHnd); | ||
| 378 | - } | ||
| 379 | - break; | ||
| 380 | - case UBOX_EVENT_CALLOUTFINISH: | ||
| 381 | - { | ||
| 382 | - System.out.println("收到软件拨号完成事件:" + uboxHnd); | ||
| 383 | - } | ||
| 384 | - break; | ||
| 385 | - case UBOX_EVENT_POLARITY: | ||
| 386 | - { | ||
| 387 | - System.out.println("收到检测极性反转事件:" + uboxHnd); | ||
| 388 | - } | ||
| 389 | - break; | ||
| 390 | - case UBOX_EVENT_SIM_STATE: | ||
| 391 | - { | ||
| 392 | - if(param2 == 1) | ||
| 393 | - { | ||
| 394 | - System.out.println("卡状态事件, 当前选择sim卡" + param1); | ||
| 395 | - } | ||
| 396 | - else if(param2 == 2) | ||
| 397 | - { | ||
| 398 | - System.out.println("卡状态事件, sim卡" + param1 +" GSM 模块检查Sim卡未插入"); | ||
| 399 | - } | ||
| 400 | - else if(param2 == 3) | ||
| 401 | - { | ||
| 402 | - System.out.println("卡状态事件, sim卡" + param1 +" 检测到卡存在,并且是插好的"); | ||
| 403 | - } | ||
| 404 | - else if(param2 > 3) | ||
| 405 | - { | ||
| 406 | - System.out.println("卡状态事件, sim卡" + param1 +" 检测到卡有错误,错误值:"+param2); | ||
| 407 | - } | ||
| 408 | - } | ||
| 409 | - break; | ||
| 410 | - case UBOX_EVENT_ANSWER: | ||
| 411 | - { | ||
| 412 | - System.out.println(" 被叫已经应答了"); | ||
| 413 | - | ||
| 414 | - PhonicNative.ubox_set_talk_link(uboxHnd, EARPHONE_TO_GSM, 1); //被叫能够听到耳麦说话的声音 | ||
| 415 | - } | ||
| 416 | - break; | ||
| 417 | - case UBOX_EVENT_SIGNALE_SIZE: | ||
| 418 | - { | ||
| 419 | - System.out.println(" 信号大小:"+param1); | ||
| 420 | - } | ||
| 421 | - break; | ||
| 422 | - case UBOX_EVENT_SHORT_MSG_SIZE: | ||
| 423 | - { | ||
| 424 | - System.out.println(" 被叫已经应答了"); | ||
| 425 | - } | ||
| 426 | - break; | ||
| 427 | - case UBOX_EVENT_SIM_REG: | ||
| 428 | - { | ||
| 429 | - if(param2 == 0) | ||
| 430 | - { | ||
| 431 | - System.out.println("sim卡" + param1+1 + " 网络未注册,当前没有搜索到要注册业务的新营运商 "); | ||
| 432 | - } | ||
| 433 | - else if(param2 == 1) | ||
| 434 | - { | ||
| 435 | - System.out.println("sim卡" + param1+1 + " 网络已注册"); | ||
| 436 | - btnCall.setEnabled(true); //网络已经注册好了,可以拨打电话和发短信 | ||
| 437 | - btnSendMsg.setEnabled(true); | ||
| 438 | - } | ||
| 439 | - else if(param2 == 2) | ||
| 440 | - { | ||
| 441 | - System.out.println("sim卡" + param1+1 + " 网络未注册,正在搜索要注册业务的新营运商"); | ||
| 442 | - } | ||
| 443 | - else if(param2 == 3) | ||
| 444 | - { | ||
| 445 | - System.out.println("sim卡" + param1+1 + " 注册被拒绝"); | ||
| 446 | - } | ||
| 447 | - else if(param2 == 4) | ||
| 448 | - { | ||
| 449 | - System.out.println("sim卡" + param1+1 + " 未注册, 未知原因"); | ||
| 450 | - } | ||
| 451 | - else if(param2 == 5) | ||
| 452 | - { | ||
| 453 | - System.out.println("sim卡" + param1+1 + " 已注册,漫游"); | ||
| 454 | - } | ||
| 455 | - } | ||
| 456 | - break; | ||
| 457 | - case UBOX_EVENT_SHORT_MSG_SEND_REPORT: | ||
| 458 | - { | ||
| 459 | - if(param1 == 0) | ||
| 460 | - { | ||
| 461 | - System.out.println("短信发送失败"); | ||
| 462 | - } | ||
| 463 | - else if(param1 == 1) | ||
| 464 | - { | ||
| 465 | - System.out.println("短信发送成功"); | ||
| 466 | - } | ||
| 467 | - else if(param1 == 2) | ||
| 468 | - { | ||
| 469 | - System.out.println("短信发送超时"); | ||
| 470 | - } | ||
| 471 | - } | ||
| 472 | - break; | ||
| 473 | - default: | ||
| 474 | - { | ||
| 475 | - System.out.println("未知事件[uboxHnd=" + uboxHnd + "][eventID=" + eventID | ||
| 476 | - + "][param1=" + param1 + "][param2=" + param2 + "][param3=" | ||
| 477 | - + param3 + "][param4=" + param4 + "]"); | ||
| 478 | - } | ||
| 479 | - break; | ||
| 480 | - } | ||
| 481 | - } | ||
| 482 | - | ||
| 483 | - public void callInNumber(int uboxHnd, String number) { | ||
| 484 | - System.out.println("收到主叫号码[uboxHnd=" + uboxHnd + "][number=" + number + "]"); | ||
| 485 | - } | ||
| 486 | - | ||
| 487 | - public void ShortMsg(int uboxHnd, String PhoneNumber, String stTime, String msg, String strDived) { | ||
| 488 | - System.out.println("收到短信[uboxHnd=" + uboxHnd + "][发件人=" + PhoneNumber + "]" + ", 时间:"+stTime +", 内容:" +msg+ " "+strDived); | ||
| 489 | - } | ||
| 490 | - | ||
| 491 | - public void CmdMsg(int uboxHnd, String cmd) { | ||
| 492 | - System.out.println("收到消息[uboxHnd=" + uboxHnd + "][内容=" + cmd + "]"); | ||
| 493 | - } | ||
| 494 | - | ||
| 495 | - public static void main(String[] args) | ||
| 496 | - { | ||
| 497 | - final MainFrame myFrame = new MainFrame(); | ||
| 498 | - myFrame.setTitle("电话示例"); | ||
| 499 | - myFrame.setSize(800, 600); | ||
| 500 | - myFrame.setLayout(null); | ||
| 501 | - Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); | ||
| 502 | - Dimension frameSize = myFrame.getSize(); | ||
| 503 | - myFrame.setLocation((screenSize.width-frameSize.width)/2, (screenSize.height-frameSize.height)/2); | ||
| 504 | - myFrame.setDefaultCloseOperation(EXIT_ON_CLOSE); | ||
| 505 | - myFrame.addWindowListener(new WindowAdapter(){ | ||
| 506 | - public void windowClosing(WindowEvent e){ | ||
| 507 | - myFrame.closeUBox(); | ||
| 508 | - } | ||
| 509 | - }); | ||
| 510 | - myFrame.setVisible(true); | ||
| 511 | - System.out.println("退出"); | ||
| 512 | - | ||
| 513 | - } | ||
| 514 | -} | ||
| 515 | - |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | web: | 2 | web: |
| 3 | upload-path: upload/ | 3 | upload-path: upload/ |
| 4 | server: | 4 | server: |
| 5 | - port: 10002 | 5 | + port: 10006 |
| 6 | servlet: | 6 | servlet: |
| 7 | context-path: ${SERVER_CONTEXTPATH:} | 7 | context-path: ${SERVER_CONTEXTPATH:} |
| 8 | spring: | 8 | spring: |
| @@ -103,14 +103,15 @@ eureka: | @@ -103,14 +103,15 @@ eureka: | ||
| 103 | prefer-ip-address: true | 103 | prefer-ip-address: true |
| 104 | instance-id: ${spring.cloud.client.ip-address}:${server.port} | 104 | instance-id: ${spring.cloud.client.ip-address}:${server.port} |
| 105 | hostname: ${spring.cloud.client.ip-address} | 105 | hostname: ${spring.cloud.client.ip-address} |
| 106 | + lease-renewal-interval-in-seconds: 15 | ||
| 107 | + lease-expiration-duration-in-seconds: 45 | ||
| 106 | client: | 108 | client: |
| 107 | #eureka注册中心服务器地址 | 109 | #eureka注册中心服务器地址 |
| 108 | service-url: | 110 | service-url: |
| 109 | # defaultZone: http://127.0.0.1:12345/eureka/ | 111 | # defaultZone: http://127.0.0.1:12345/eureka/ |
| 110 | defaultZone: http://192.168.1.53:12345/eureka/ | 112 | defaultZone: http://192.168.1.53:12345/eureka/ |
| 111 | registry-fetch-interval-seconds: 30 | 113 | registry-fetch-interval-seconds: 30 |
| 112 | - lease-renewal-interval-in-seconds: 15 | ||
| 113 | - lease-expiration-duration-in-seconds: 45 | 114 | + |
| 114 | 115 | ||
| 115 | 116 | ||
| 116 | 117 | ||
| @@ -133,7 +134,7 @@ logging: | @@ -133,7 +134,7 @@ logging: | ||
| 133 | file: | 134 | file: |
| 134 | path: ./logs/ | 135 | path: ./logs/ |
| 135 | name: system.log | 136 | name: system.log |
| 136 | - config: config/logback-dev.xml | 137 | + config: classpath:logback-dev.xml |
| 137 | #转移到logback配置文件中 | 138 | #转移到logback配置文件中 |
| 138 | #level: | 139 | #level: |
| 139 | #org.apache.tomcat: info | 140 | #org.apache.tomcat: info |
-
请 注册 或 登录 后发表评论