切换导航条
此项目
正在载入...
登录
HQPT
/
order
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
xudada
5 years ago
提交
fad7c5d4a9147fb35c7cb45b6e2a79cf4543f53e
1 个父辈
83abd3a2
websocket
显示空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
36 行增加
和
863 行删除
docker/Dockerfile
pom.xml
src/main/java/com/sunyo/customer/order/activity/controller/ProcessController.java
src/main/java/com/sunyo/customer/order/activity/model/ProcessForm.java
src/main/java/com/sunyo/customer/order/mydemo/IncomingCall.java
src/main/java/com/sunyo/customer/order/mydemo/MainFrame.java
src/main/resources/application.yml
config/logback-dev.xml → src/main/resources/logback-dev.xml
docker/Dockerfile
0 → 100644
查看文件 @
fad7c5d
FROM java:8u111
VOLUME /tmp
ADD *.jar app.jar
EXPOSE 10006
ENTRYPOINT ["java","-jar","/app.jar"]
# Ubuntu 时区
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
\ No newline at end of file
...
...
pom.xml
查看文件 @
fad7c5d
...
...
@@ -89,11 +89,7 @@
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
com.tianbo
</groupId>
<artifactId>
util
</artifactId>
<version>
1.0-SNAPSHOT
</version>
</dependency>
<!--<dependency>-->
<!--<groupId>com.fasterxml.jackson.core</groupId>-->
<!--<artifactId>jackson-core</artifactId>-->
...
...
@@ -178,31 +174,20 @@
<verbose>
true
</verbose>
</configuration>
</plugin>
<!--Generate java code by xsd file-->
<plugin>
<groupId>
org.jvnet.jaxb2.maven2
</groupId>
<artifactId>
maven-jaxb2-plugin
</artifactId>
<version>
0.14.0
</version>
<configuration>
<schemaDirectory>
src/main/resources/xsd
</schemaDirectory>
<generateDirectory>
src/main/java
</generateDirectory>
<packageLevelAnnotations>
false
</packageLevelAnnotations>
<noFileHeader>
true
</noFileHeader>
<episode>
false
</episode>
<locale>
en
</locale>
</configuration>
<artifactId>
maven-antrun-plugin
</artifactId>
<executions>
<execution>
<id>
xsd1-generate
</id>
<goals>
<goal>
generate
</goal>
</goals>
<id>
gen-webadmin
</id>
<phase>
package
</phase>
<configuration>
<schemaIncludes>
<include>
DecMessage_ImportSave1.xsd
</include>
</schemaIncludes>
<generatePackage>
com.sunyo.customer.order.xsd1
</generatePackage>
<tasks>
<copy
todir=
"docker"
file=
"target/${project.artifactId}-${project.version}.${project.packaging}"
/>
</tasks>
</configuration>
<goals>
<goal>
run
</goal>
</goals>
</execution>
</executions>
</plugin>
...
...
src/main/java/com/sunyo/customer/order/activity/controller/ProcessController.java
查看文件 @
fad7c5d
...
...
@@ -17,6 +17,8 @@ import org.activiti.engine.task.Task;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -66,7 +68,7 @@ public class ProcessController {
}
@PostMapping
(
value
=
"/add"
)
public
ResultJson
add
(
ProcessForm
processForm
){
public
ResultJson
add
(
ProcessForm
processForm
){
String
uuid
=
UUID
.
randomUUID
().
toString
();
processForm
.
setFormid
(
uuid
);
int
i
=
processFormMapper
.
insertSelective
(
processForm
);
...
...
@@ -88,21 +90,21 @@ public class ProcessController {
builder
.
addClasspathResource
(
"processes/customProcess.bpmn20.xml"
).
name
(
"customProcess"
);
builder
.
deploy
();
List
<
ProcessDefinition
>
p
=
repositoryService
.
createProcessDefinitionQuery
().
list
();
// 启动流程实例,字符串"vacation"是BPMN模型文件里process元素的id
// 启动流程实例,字符串"vacation"是BPMN模型文件里process元素的id
ProcessInstance
processInstance
=
runtimeService
.
startProcessInstanceByKey
(
"customProcess"
);
//流程实例启动后,流程会跳转到请假申请节点
//流程实例启动后,流程会跳转到请假申请节点
Task
vacationApply
=
taskService
.
createTaskQuery
().
processInstanceId
(
processInstance
.
getId
()).
singleResult
();
//设置请假申请任务的执行人
//设置请假申请任务的执行人
taskService
.
setAssignee
(
vacationApply
.
getId
(),
"zhangsan"
);
//设置流程参数:请假天数和表单ID
//流程引擎会根据请假天数days>3判断流程走向
//formId是用来将流程数据和表单数据关联起来
//设置流程参数:请假天数和表单ID
//流程引擎会根据请假天数days>3判断流程走向
//formId是用来将流程数据和表单数据关联起来
Map
<
String
,
Object
>
args
=
new
HashMap
<>();
args
.
put
(
"days"
,
"2"
);
args
.
put
(
"formId"
,
"4d8746da-f0c2-418d-86b4-e3646dcef6c9"
);
//完成请假申请任务
//完成请假申请任务
taskService
.
complete
(
vacationApply
.
getId
(),
args
);
}
}
...
...
src/main/java/com/sunyo/customer/order/activity/model/ProcessForm.java
查看文件 @
fad7c5d
...
...
@@ -12,12 +12,12 @@ public class ProcessForm{
private
String
processname
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
begindate
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
@JsonFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
,
timezone
=
"GMT+8"
)
private
Date
enddate
;
private
Byte
vacationtype
;
...
...
src/main/java/com/sunyo/customer/order/mydemo/IncomingCall.java
已删除
100644 → 0
查看文件 @
83abd3a
package
com
.
sunyo
.
customer
.
order
.
mydemo
;
import
phonicapi.PhonicConst
;
import
phonicapi.PhonicHandler
;
import
phonicapi.PhonicNative
;
/**
* Created by XYH on 2020/1/8.
*/
public
class
IncomingCall
implements
PhonicHandler
{
private
int
uBoxHndOne
=
0
;
//线路1操作句柄
private
int
uBoxHndTwo
=
0
;
//线路2操作句柄
private
int
uBoxId
=
0
;
// 设备类型
private
boolean
bHookOff
=
false
;
private
String
strDir
=
"C:\\"
;
//打开设备
public
boolean
openUBox
()
{
PhonicNative
.
ubox_open_logfile
(
0
);
int
nOpen
=
PhonicNative
.
ubox_open
(
this
,
PhonicConst
.
WORK_MODE_RECORD
);
System
.
out
.
println
(
"ubox_open="
+
nOpen
);
if
(
nOpen
==
0
)
{
return
true
;
}
return
false
;
}
//关闭设备
public
boolean
closeUBox
()
{
uBoxHndOne
=
0
;
uBoxHndTwo
=
0
;
PhonicNative
.
ubox_close
();
return
true
;
}
//设备事件
public
void
event
(
int
uboxHnd
,
int
eventID
,
int
param1
,
int
param2
,
int
param3
,
int
param4
)
{
switch
(
eventID
)
{
case
UBOX_EVENT_DEVICE_PLUG_IN:
{
//检测型号正确
//if(1 == PhonicNative.ubox_get_product_ID(uboxHnd))
{
if
(
0
==
uBoxHndOne
)
{
uBoxHndOne
=
uboxHnd
;
uBoxId
=
PhonicNative
.
ubox_get_product_ID
(
uboxHnd
);
System
.
out
.
println
(
PhonicNative
.
ubox_get_device_versionnum
(
uboxHnd
));
System
.
out
.
println
(
PhonicNative
.
ubox_get_product_name
(
uboxHnd
));
if
(
uBoxId
==
8
)
//无线设备
{
PhonicNative
.
ubox_set_gsm_work_mode
(
uboxHnd
,
1
,
0
);
//如果不用电话机,关闭电话机模式,否则振铃的时候,戴着耳麦会听到很大的给电话机送来电号码声音,体验效果不好。
}
}
else
if
(
0
==
uBoxHndTwo
)
{
uBoxHndTwo
=
uboxHnd
;
}
else
{
uBoxHndOne
=
uboxHnd
;
uBoxHndTwo
=
0
;
}
}
System
.
out
.
println
(
"收到设备插入事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_PLUG_OUT:
{
System
.
out
.
println
(
"收到设备拔出事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_HOOK_UP:
{
if
(
uBoxId
==
8
)
{
if
(
param1
==
1
)
{
System
.
out
.
println
(
"收到GSM模块挂机:"
+
uboxHnd
);
PhonicNative
.
ubox_set_talk_link
(
uboxHnd
,
EARPHONE_TO_GSM
,
0
);
//被叫能够听不到耳麦说话的声音
}
else
if
(
param1
==
2
)
{
System
.
out
.
println
(
"收到电话机挂机:"
+
uboxHnd
);
}
else
if
(
param1
==
3
)
{
System
.
out
.
println
(
"收到耳麦挂机:"
+
uboxHnd
);
}
}
else
{
System
.
out
.
println
(
"收到设备挂机事件:"
+
uboxHnd
);
}
}
break
;
case
UBOX_EVENT_LINE_HOOK_OFF:
{
if
(
uBoxId
==
8
)
{
if
(
param1
==
0
)
{
System
.
out
.
println
(
"收到电话机摘机:"
+
uboxHnd
);
}
else
if
(
param1
==
2
)
{
System
.
out
.
println
(
"收到耳麦摘机:"
+
uboxHnd
);
}
else
if
(
param1
==
6
)
{
System
.
out
.
println
(
"收到GSM模块摘机:"
+
uboxHnd
);
PhonicNative
.
ubox_set_talk_link
(
uboxHnd
,
EARPHONE_TO_GSM
,
1
);
//被叫能够听到耳麦说话的声音
}
}
else
{
System
.
out
.
println
(
"收到设备摘机事件:"
+
uboxHnd
);
}
}
break
;
case
UBOX_EVENT_LINE_RINGING:
{
System
.
out
.
println
(
"收到设备检测线路振铃开始事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_PLAY_END:
{
System
.
out
.
println
(
"收到放音结束事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_RING_CANCEL:
{
System
.
out
.
println
(
"收到设备检测线路振铃停止事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_BUSY_TONE:
{
System
.
out
.
println
(
"收到设备检测线路忙音事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_ALARM:
{
System
.
out
.
println
(
"收到设备工作警告事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_ERROR:
{
System
.
out
.
println
(
"收到设备错误事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_RING_STOP:
{
System
.
out
.
println
(
"收到设备检测线路振铃闪停事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_HANG:
{
System
.
out
.
println
(
"收到设备悬空事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_VOLTAGE:
{
System
.
out
.
println
(
"收到设备线路当前电压事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_STREAM_VOICE:
{
System
.
out
.
println
(
"收到流式录音数据包事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DTMF_DOWN:
{
//System.out.println("按键事件:" + uboxHnd);
}
break
;
case
UBOX_EVENT_DTMF_UP:
{
System
.
out
.
println
(
"收到按键释放事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_PLAY_ERROR:
{
System
.
out
.
println
(
"收到放音错误事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_CALLOUTFINISH:
{
System
.
out
.
println
(
"收到软件拨号完成事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_POLARITY:
{
System
.
out
.
println
(
"收到检测极性反转事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_SIM_STATE:
{
if
(
param2
==
1
)
{
System
.
out
.
println
(
"卡状态事件, 当前选择sim卡"
+
param1
);
}
else
if
(
param2
==
2
)
{
System
.
out
.
println
(
"卡状态事件, sim卡"
+
param1
+
" GSM 模块检查Sim卡未插入"
);
}
else
if
(
param2
==
3
)
{
System
.
out
.
println
(
"卡状态事件, sim卡"
+
param1
+
" 检测到卡存在,并且是插好的"
);
}
else
if
(
param2
>
3
)
{
System
.
out
.
println
(
"卡状态事件, sim卡"
+
param1
+
" 检测到卡有错误,错误值:"
+
param2
);
}
}
break
;
case
UBOX_EVENT_ANSWER:
{
System
.
out
.
println
(
" 被叫已经应答了"
);
PhonicNative
.
ubox_set_talk_link
(
uboxHnd
,
EARPHONE_TO_GSM
,
1
);
//被叫能够听到耳麦说话的声音
}
break
;
case
UBOX_EVENT_SIGNALE_SIZE:
{
System
.
out
.
println
(
" 信号大小:"
+
param1
);
}
break
;
case
UBOX_EVENT_SHORT_MSG_SIZE:
{
System
.
out
.
println
(
" 被叫已经应答了"
);
}
break
;
case
UBOX_EVENT_SIM_REG:
{
if
(
param2
==
0
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 网络未注册,当前没有搜索到要注册业务的新营运商 "
);
}
else
if
(
param2
==
1
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 网络已注册"
);
//btnCall.setEnabled(true); //网络已经注册好了,可以拨打电话和发短信
//btnSendMsg.setEnabled(true);
}
else
if
(
param2
==
2
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 网络未注册,正在搜索要注册业务的新营运商"
);
}
else
if
(
param2
==
3
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 注册被拒绝"
);
}
else
if
(
param2
==
4
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 未注册, 未知原因"
);
}
else
if
(
param2
==
5
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 已注册,漫游"
);
}
}
break
;
case
UBOX_EVENT_SHORT_MSG_SEND_REPORT:
{
if
(
param1
==
0
)
{
System
.
out
.
println
(
"短信发送失败"
);
}
else
if
(
param1
==
1
)
{
System
.
out
.
println
(
"短信发送成功"
);
}
else
if
(
param1
==
2
)
{
System
.
out
.
println
(
"短信发送超时"
);
}
}
break
;
default
:
{
System
.
out
.
println
(
"未知事件[uboxHnd="
+
uboxHnd
+
"][eventID="
+
eventID
+
"][param1="
+
param1
+
"][param2="
+
param2
+
"][param3="
+
param3
+
"][param4="
+
param4
+
"]"
);
}
break
;
}
}
public
void
callInNumber
(
int
uboxHnd
,
String
number
)
{
System
.
out
.
println
(
"收到主叫号码[uboxHnd="
+
uboxHnd
+
"][number="
+
number
+
"]"
);
}
public
void
ShortMsg
(
int
uboxHnd
,
String
PhoneNumber
,
String
stTime
,
String
msg
,
String
strDived
)
{
System
.
out
.
println
(
"收到短信[uboxHnd="
+
uboxHnd
+
"][发件人="
+
PhoneNumber
+
"]"
+
", 时间:"
+
stTime
+
", 内容:"
+
msg
+
" "
+
strDived
);
}
public
void
CmdMsg
(
int
uboxHnd
,
String
cmd
)
{
System
.
out
.
println
(
"收到消息[uboxHnd="
+
uboxHnd
+
"][内容="
+
cmd
+
"]"
);
}
public
static
void
main
(
String
[]
args
){
IncomingCall
call
=
new
IncomingCall
();
call
.
openUBox
();
}
}
src/main/java/com/sunyo/customer/order/mydemo/MainFrame.java
已删除
100644 → 0
查看文件 @
83abd3a
package
com
.
sunyo
.
customer
.
order
.
mydemo
;
import
phonicapi.PhonicConst
;
import
phonicapi.PhonicHandler
;
import
phonicapi.PhonicNative
;
import
javax.swing.*
;
import
java.awt.*
;
import
java.awt.event.ActionEvent
;
import
java.awt.event.ActionListener
;
import
java.awt.event.WindowAdapter
;
import
java.awt.event.WindowEvent
;
import
java.io.File
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
MainFrame
extends
JFrame
implements
PhonicHandler
{
private
JButton
btnHookOff
=
new
JButton
(
"摘机"
);
private
JButton
btnHookOn
=
new
JButton
(
"挂机"
);
private
JButton
btnCall
=
new
JButton
(
"拨号"
);
private
JButton
btnSendMsg
=
new
JButton
(
"发送短信"
);
private
JTextField
txtNumb
=
new
JTextField
();
private
JComboBox
cbxLine
=
new
JComboBox
();
private
JTextField
txtShortMsgNumber
=
new
JTextField
();
private
JTextField
txtShortMsg
=
new
JTextField
();
private
int
uBoxHndOne
=
0
;
//线路1操作句柄
private
int
uBoxHndTwo
=
0
;
//线路2操作句柄
private
int
uBoxId
=
0
;
// 设备类型
private
boolean
bHookOff
=
false
;
private
String
strDir
=
"C:\\"
;
MainFrame
()
{
try
{
File
directory
=
new
File
(
""
);
strDir
=
directory
.
getAbsolutePath
();
System
.
out
.
println
(
strDir
);
}
catch
(
Exception
e
){}
//线路
cbxLine
.
setBounds
(
20
,
20
,
160
,
20
);
cbxLine
.
addItem
(
"线路1"
);
cbxLine
.
addItem
(
"线路2"
);
cbxLine
.
setSelectedItem
(
"线路1"
);
//摘机
btnHookOff
.
setBounds
(
20
,
60
,
60
,
20
);
btnHookOff
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
int
uBoxHnd
=
cbxLine
.
getSelectedIndex
()==
0
?
uBoxHndOne:
uBoxHndTwo
;
int
nResult
=
PhonicNative
.
ubox_soft_hook_off
(
uBoxHnd
);
System
.
out
.
println
(
nResult
);
if
(
0
==
nResult
)
{
bHookOff
=
true
;
cbxLine
.
setEnabled
(
false
);
btnHookOff
.
setEnabled
(
false
);
btnHookOn
.
setEnabled
(
true
);
btnCall
.
setEnabled
(
true
);
txtNumb
.
setEnabled
(
true
);
//开始录音
Date
nowDate
=
new
Date
();
DateFormat
dfDate
=
new
SimpleDateFormat
(
"yyyy_MM_dd_HH_mm_ss"
);
String
strPath
=
strDir
+
"\\"
+
dfDate
.
format
(
nowDate
)+
".wav"
;
System
.
out
.
println
(
strPath
);
PhonicNative
.
ubox_record_file
(
uBoxHnd
,
strPath
,
CODER_ALAW
);
}
}
});
//挂机
btnHookOn
.
setEnabled
(
false
);
btnHookOn
.
setBounds
(
120
,
60
,
60
,
20
);
btnHookOn
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
int
uBoxHnd
=
cbxLine
.
getSelectedIndex
()==
0
?
uBoxHndOne:
uBoxHndTwo
;
int
nResult
=
PhonicNative
.
ubox_soft_hook_on
(
uBoxHnd
);
System
.
out
.
println
(
nResult
);
if
(
0
==
nResult
)
{
bHookOff
=
false
;
cbxLine
.
setEnabled
(
true
);
btnHookOff
.
setEnabled
(
true
);
btnHookOn
.
setEnabled
(
false
);
btnCall
.
setEnabled
(
true
);
txtNumb
.
setEnabled
(
true
);
//停止录音
PhonicNative
.
ubox_stop_record
(
uBoxHnd
);
}
}
});
//拨号
btnCall
.
setBounds
(
120
,
100
,
60
,
20
);
btnCall
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
uBoxId
==
8
)
{
if
(
txtNumb
.
getText
().
length
()
>
0
)
{
cbxLine
.
setEnabled
(
false
);
btnHookOff
.
setEnabled
(
false
);
btnHookOn
.
setEnabled
(
true
);
btnCall
.
setEnabled
(
true
);
txtNumb
.
setEnabled
(
true
);
int
uBoxHnd
=
cbxLine
.
getSelectedIndex
()==
0
?
uBoxHndOne:
uBoxHndTwo
;
int
nResult
=
PhonicNative
.
ubox_makecall
(
uBoxHnd
,
txtNumb
.
getText
());
System
.
out
.
println
(
nResult
);
}
}
else
{
//摘机
if
(!
bHookOff
)
{
int
uBoxHnd
=
cbxLine
.
getSelectedIndex
()==
0
?
uBoxHndOne:
uBoxHndTwo
;
int
nResult
=
PhonicNative
.
ubox_soft_hook_off
(
uBoxHnd
);
System
.
out
.
println
(
nResult
);
if
(
0
==
nResult
)
{
bHookOff
=
true
;
cbxLine
.
setEnabled
(
false
);
btnHookOff
.
setEnabled
(
false
);
btnHookOn
.
setEnabled
(
true
);
btnCall
.
setEnabled
(
true
);
txtNumb
.
setEnabled
(
true
);
//开始录音
Date
nowDate
=
new
Date
();
DateFormat
dfDate
=
new
SimpleDateFormat
(
"yyyy_MM_dd_HH_mm_ss"
);
String
strPath
=
strDir
+
"\\"
+
dfDate
.
format
(
nowDate
)+
".wav"
;
System
.
out
.
println
(
strPath
);
PhonicNative
.
ubox_record_file
(
uBoxHnd
,
strPath
,
CODER_ALAW
);
}
//等待0.5秒再拨号
try
{
Thread
.
sleep
(
500
);
}
catch
(
Exception
ee
){
ee
.
printStackTrace
();
}
}
if
(
txtNumb
.
getText
().
length
()
>
0
)
{
btnCall
.
setEnabled
(
false
);
txtNumb
.
setEnabled
(
false
);
int
uBoxHnd
=
cbxLine
.
getSelectedIndex
()==
0
?
uBoxHndOne:
uBoxHndTwo
;
int
nResult
=
PhonicNative
.
ubox_send_dtmf
(
uBoxHnd
,
txtNumb
.
getText
());
System
.
out
.
println
(
nResult
);
}
}
}
});
btnCall
.
setEnabled
(
false
);
btnSendMsg
.
setEnabled
(
false
);
//号码输入框
txtNumb
.
setBounds
(
20
,
100
,
80
,
20
);
txtNumb
.
setText
(
"910000"
);
txtShortMsgNumber
.
setBounds
(
20
,
140
,
80
,
20
);
//收件号码
txtShortMsgNumber
.
setText
(
"8615907558923"
);
//发短信,需要在号码前加国际区号 ,中国"86"
txtShortMsg
.
setBounds
(
120
,
140
,
200
,
20
);
//短信内容
txtShortMsg
.
setText
(
""
);
//发短信,需要在号码前加国际区号 ,中国"86"
//发送短信
btnSendMsg
.
setBounds
(
340
,
140
,
120
,
20
);
btnSendMsg
.
addActionListener
(
new
ActionListener
()
{
public
void
actionPerformed
(
ActionEvent
e
)
{
if
(
uBoxId
==
8
)
{
if
(
txtShortMsgNumber
.
getText
().
length
()
>
0
&&
txtShortMsg
.
getText
().
length
()
>
0
)
{
int
uBoxHnd
=
cbxLine
.
getSelectedIndex
()==
0
?
uBoxHndOne:
uBoxHndTwo
;
int
nResult
=
PhonicNative
.
ubox_send_gsm_msg
(
uBoxHnd
,
1
,
txtShortMsgNumber
.
getText
(),
txtShortMsg
.
getText
(),
txtShortMsg
.
getText
().
length
());
System
.
out
.
println
(
nResult
);
}
}
}
});
//添加控件
add
(
cbxLine
);
add
(
btnHookOff
);
add
(
btnHookOn
);
add
(
btnCall
);
add
(
txtNumb
);
add
(
txtShortMsgNumber
);
add
(
txtShortMsg
);
add
(
btnSendMsg
);
//初始化
openUBox
();
}
//打开设备
public
boolean
openUBox
()
{
PhonicNative
.
ubox_open_logfile
(
0
);
int
nOpen
=
PhonicNative
.
ubox_open
(
this
,
PhonicConst
.
WORK_MODE_RECORD
);
System
.
out
.
println
(
"ubox_open="
+
nOpen
);
if
(
nOpen
==
0
)
{
return
true
;
}
return
false
;
}
//关闭设备
public
boolean
closeUBox
()
{
uBoxHndOne
=
0
;
uBoxHndTwo
=
0
;
PhonicNative
.
ubox_close
();
return
true
;
}
//设备事件
public
void
event
(
int
uboxHnd
,
int
eventID
,
int
param1
,
int
param2
,
int
param3
,
int
param4
)
{
switch
(
eventID
)
{
case
UBOX_EVENT_DEVICE_PLUG_IN:
{
//检测型号正确
//if(1 == PhonicNative.ubox_get_product_ID(uboxHnd))
{
if
(
0
==
uBoxHndOne
)
{
uBoxHndOne
=
uboxHnd
;
uBoxId
=
PhonicNative
.
ubox_get_product_ID
(
uboxHnd
);
System
.
out
.
println
(
PhonicNative
.
ubox_get_device_versionnum
(
uboxHnd
));
System
.
out
.
println
(
PhonicNative
.
ubox_get_product_name
(
uboxHnd
));
if
(
uBoxId
==
8
)
//无线设备
{
PhonicNative
.
ubox_set_gsm_work_mode
(
uboxHnd
,
1
,
0
);
//如果不用电话机,关闭电话机模式,否则振铃的时候,戴着耳麦会听到很大的给电话机送来电号码声音,体验效果不好。
}
}
else
if
(
0
==
uBoxHndTwo
)
{
uBoxHndTwo
=
uboxHnd
;
}
else
{
uBoxHndOne
=
uboxHnd
;
uBoxHndTwo
=
0
;
}
}
System
.
out
.
println
(
"收到设备插入事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_PLUG_OUT:
{
System
.
out
.
println
(
"收到设备拔出事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_HOOK_UP:
{
if
(
uBoxId
==
8
)
{
if
(
param1
==
1
)
{
System
.
out
.
println
(
"收到GSM模块挂机:"
+
uboxHnd
);
PhonicNative
.
ubox_set_talk_link
(
uboxHnd
,
EARPHONE_TO_GSM
,
0
);
//被叫能够听不到耳麦说话的声音
}
else
if
(
param1
==
2
)
{
System
.
out
.
println
(
"收到电话机挂机:"
+
uboxHnd
);
}
else
if
(
param1
==
3
)
{
System
.
out
.
println
(
"收到耳麦挂机:"
+
uboxHnd
);
}
}
else
{
System
.
out
.
println
(
"收到设备挂机事件:"
+
uboxHnd
);
}
}
break
;
case
UBOX_EVENT_LINE_HOOK_OFF:
{
if
(
uBoxId
==
8
)
{
if
(
param1
==
0
)
{
System
.
out
.
println
(
"收到电话机摘机:"
+
uboxHnd
);
}
else
if
(
param1
==
2
)
{
System
.
out
.
println
(
"收到耳麦摘机:"
+
uboxHnd
);
}
else
if
(
param1
==
6
)
{
System
.
out
.
println
(
"收到GSM模块摘机:"
+
uboxHnd
);
PhonicNative
.
ubox_set_talk_link
(
uboxHnd
,
EARPHONE_TO_GSM
,
1
);
//被叫能够听到耳麦说话的声音
}
}
else
{
System
.
out
.
println
(
"收到设备摘机事件:"
+
uboxHnd
);
}
}
break
;
case
UBOX_EVENT_LINE_RINGING:
{
System
.
out
.
println
(
"收到设备检测线路振铃开始事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_PLAY_END:
{
System
.
out
.
println
(
"收到放音结束事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_RING_CANCEL:
{
System
.
out
.
println
(
"收到设备检测线路振铃停止事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_BUSY_TONE:
{
System
.
out
.
println
(
"收到设备检测线路忙音事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_ALARM:
{
System
.
out
.
println
(
"收到设备工作警告事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_ERROR:
{
System
.
out
.
println
(
"收到设备错误事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_RING_STOP:
{
System
.
out
.
println
(
"收到设备检测线路振铃闪停事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_HANG:
{
System
.
out
.
println
(
"收到设备悬空事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_LINE_VOLTAGE:
{
System
.
out
.
println
(
"收到设备线路当前电压事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_STREAM_VOICE:
{
System
.
out
.
println
(
"收到流式录音数据包事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DTMF_DOWN:
{
//System.out.println("按键事件:" + uboxHnd);
}
break
;
case
UBOX_EVENT_DTMF_UP:
{
System
.
out
.
println
(
"收到按键释放事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_DEVICE_PLAY_ERROR:
{
System
.
out
.
println
(
"收到放音错误事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_CALLOUTFINISH:
{
System
.
out
.
println
(
"收到软件拨号完成事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_POLARITY:
{
System
.
out
.
println
(
"收到检测极性反转事件:"
+
uboxHnd
);
}
break
;
case
UBOX_EVENT_SIM_STATE:
{
if
(
param2
==
1
)
{
System
.
out
.
println
(
"卡状态事件, 当前选择sim卡"
+
param1
);
}
else
if
(
param2
==
2
)
{
System
.
out
.
println
(
"卡状态事件, sim卡"
+
param1
+
" GSM 模块检查Sim卡未插入"
);
}
else
if
(
param2
==
3
)
{
System
.
out
.
println
(
"卡状态事件, sim卡"
+
param1
+
" 检测到卡存在,并且是插好的"
);
}
else
if
(
param2
>
3
)
{
System
.
out
.
println
(
"卡状态事件, sim卡"
+
param1
+
" 检测到卡有错误,错误值:"
+
param2
);
}
}
break
;
case
UBOX_EVENT_ANSWER:
{
System
.
out
.
println
(
" 被叫已经应答了"
);
PhonicNative
.
ubox_set_talk_link
(
uboxHnd
,
EARPHONE_TO_GSM
,
1
);
//被叫能够听到耳麦说话的声音
}
break
;
case
UBOX_EVENT_SIGNALE_SIZE:
{
System
.
out
.
println
(
" 信号大小:"
+
param1
);
}
break
;
case
UBOX_EVENT_SHORT_MSG_SIZE:
{
System
.
out
.
println
(
" 被叫已经应答了"
);
}
break
;
case
UBOX_EVENT_SIM_REG:
{
if
(
param2
==
0
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 网络未注册,当前没有搜索到要注册业务的新营运商 "
);
}
else
if
(
param2
==
1
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 网络已注册"
);
btnCall
.
setEnabled
(
true
);
//网络已经注册好了,可以拨打电话和发短信
btnSendMsg
.
setEnabled
(
true
);
}
else
if
(
param2
==
2
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 网络未注册,正在搜索要注册业务的新营运商"
);
}
else
if
(
param2
==
3
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 注册被拒绝"
);
}
else
if
(
param2
==
4
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 未注册, 未知原因"
);
}
else
if
(
param2
==
5
)
{
System
.
out
.
println
(
"sim卡"
+
param1
+
1
+
" 已注册,漫游"
);
}
}
break
;
case
UBOX_EVENT_SHORT_MSG_SEND_REPORT:
{
if
(
param1
==
0
)
{
System
.
out
.
println
(
"短信发送失败"
);
}
else
if
(
param1
==
1
)
{
System
.
out
.
println
(
"短信发送成功"
);
}
else
if
(
param1
==
2
)
{
System
.
out
.
println
(
"短信发送超时"
);
}
}
break
;
default
:
{
System
.
out
.
println
(
"未知事件[uboxHnd="
+
uboxHnd
+
"][eventID="
+
eventID
+
"][param1="
+
param1
+
"][param2="
+
param2
+
"][param3="
+
param3
+
"][param4="
+
param4
+
"]"
);
}
break
;
}
}
public
void
callInNumber
(
int
uboxHnd
,
String
number
)
{
System
.
out
.
println
(
"收到主叫号码[uboxHnd="
+
uboxHnd
+
"][number="
+
number
+
"]"
);
}
public
void
ShortMsg
(
int
uboxHnd
,
String
PhoneNumber
,
String
stTime
,
String
msg
,
String
strDived
)
{
System
.
out
.
println
(
"收到短信[uboxHnd="
+
uboxHnd
+
"][发件人="
+
PhoneNumber
+
"]"
+
", 时间:"
+
stTime
+
", 内容:"
+
msg
+
" "
+
strDived
);
}
public
void
CmdMsg
(
int
uboxHnd
,
String
cmd
)
{
System
.
out
.
println
(
"收到消息[uboxHnd="
+
uboxHnd
+
"][内容="
+
cmd
+
"]"
);
}
public
static
void
main
(
String
[]
args
)
{
final
MainFrame
myFrame
=
new
MainFrame
();
myFrame
.
setTitle
(
"电话示例"
);
myFrame
.
setSize
(
800
,
600
);
myFrame
.
setLayout
(
null
);
Dimension
screenSize
=
Toolkit
.
getDefaultToolkit
().
getScreenSize
();
Dimension
frameSize
=
myFrame
.
getSize
();
myFrame
.
setLocation
((
screenSize
.
width
-
frameSize
.
width
)/
2
,
(
screenSize
.
height
-
frameSize
.
height
)/
2
);
myFrame
.
setDefaultCloseOperation
(
EXIT_ON_CLOSE
);
myFrame
.
addWindowListener
(
new
WindowAdapter
(){
public
void
windowClosing
(
WindowEvent
e
){
myFrame
.
closeUBox
();
}
});
myFrame
.
setVisible
(
true
);
System
.
out
.
println
(
"退出"
);
}
}
src/main/resources/application.yml
查看文件 @
fad7c5d
...
...
@@ -2,7 +2,7 @@
web
:
upload-path
:
upload/
server
:
port
:
1000
2
port
:
1000
6
servlet
:
context-path
:
${SERVER_CONTEXTPATH:}
spring
:
...
...
@@ -103,14 +103,15 @@ eureka:
prefer-ip-address
:
true
instance-id
:
${spring.cloud.client.ip-address}:${server.port}
hostname
:
${spring.cloud.client.ip-address}
lease-renewal-interval-in-seconds
:
15
lease-expiration-duration-in-seconds
:
45
client
:
#eureka注册中心服务器地址
service-url
:
# defaultZone: http://127.0.0.1:12345/eureka/
defaultZone
:
http://192.168.1.53:12345/eureka/
registry-fetch-interval-seconds
:
30
lease-renewal-interval-in-seconds
:
15
lease-expiration-duration-in-seconds
:
45
...
...
@@ -133,7 +134,7 @@ logging:
file
:
path
:
./logs/
name
:
system.log
config
:
c
onfig/
logback-dev.xml
config
:
c
lasspath:
logback-dev.xml
#转移到logback配置文件中
#level:
#org.apache.tomcat: info
...
...
config
/logback-dev.xml →
src/main/resources
/logback-dev.xml
查看文件 @
fad7c5d
请
注册
或
登录
后发表评论