Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
b4d60ab0
Commit
b4d60ab0
authored
Aug 26, 2021
by
KeYong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of 172.16.10.76:moa/amos-boot-biz into develop
parents
a32b1dca
04ef1308
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
986 additions
and
58 deletions
+986
-58
HttpUtils.java
...ava/com/yeejoin/amos/boot/biz/common/utils/HttpUtils.java
+244
-0
RedisKey.java
...java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
+2
-0
FirefightersContractDto.java
...s/boot/module/common/api/dto/FirefightersContractDto.java
+8
-2
FirefightersContract.java
...s/boot/module/common/api/entity/FirefightersContract.java
+9
-0
FirefightersThought.java
...os/boot/module/common/api/entity/FirefightersThought.java
+1
-1
IFirefightersContractService.java
...dule/common/api/service/IFirefightersContractService.java
+12
-0
IOrgUsrService.java
...n/amos/boot/module/common/api/service/IOrgUsrService.java
+19
-4
CheckShot.java
...va/com/yeejoin/amos/maintenance/dao/entity/CheckShot.java
+1
-5
PlanTask.java
...ava/com/yeejoin/amos/maintenance/dao/entity/PlanTask.java
+26
-0
CtiDto.java
...java/com/yeejoin/amos/boot/module/tzs/api/dto/CtiDto.java
+59
-0
VoiceRecordFileDto.java
...join/amos/boot/module/tzs/api/dto/VoiceRecordFileDto.java
+3
-0
ICtiService.java
...yeejoin/amos/boot/module/tzs/api/service/ICtiService.java
+41
-0
FailureDetailsController.java
...odule/common/biz/controller/FailureDetailsController.java
+29
-31
FirefightersContractController.java
...common/biz/controller/FirefightersContractController.java
+23
-8
FirefightersContractServiceImpl.java
...mon/biz/service/impl/FirefightersContractServiceImpl.java
+78
-0
FirefightersController.java
...oot/module/jcs/biz/controller/FirefightersController.java
+0
-0
PlanTaskController.java
...s/maintenance/business/controller/PlanTaskController.java
+1
-1
CheckInputParam.java
...join/amos/maintenance/business/param/CheckInputParam.java
+2
-1
CheckRecordParam.java
...oin/amos/maintenance/business/param/CheckRecordParam.java
+2
-1
CheckServiceImpl.java
...s/maintenance/business/service/impl/CheckServiceImpl.java
+13
-4
PlanTaskServiceImpl.java
...aintenance/business/service/impl/PlanTaskServiceImpl.java
+2
-0
CtiController.java
...in/amos/boot/module/tzs/biz/controller/CtiController.java
+94
-0
VoiceRecordFileController.java
.../module/tzs/biz/controller/VoiceRecordFileController.java
+67
-0
CtiServiceImpl.java
...amos/boot/module/tzs/biz/service/impl/CtiServiceImpl.java
+222
-0
HttpUtils.java
...com/yeejoin/amos/boot/module/tzs/biz/utils/HttpUtils.java
+0
-0
pom.xml
amos-boot-module/amos-boot-module-biz/pom.xml
+5
-0
mt-1.0.0.xml
...-maintenance/src/main/resources/db/changelog/mt-1.0.0.xml
+23
-0
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/HttpUtils.java
0 → 100644
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.config.RequestConfig
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
import
org.apache.http.client.methods.CloseableHttpResponse
;
import
org.apache.http.client.methods.HttpGet
;
import
org.apache.http.client.methods.HttpPost
;
import
org.apache.http.conn.ssl.SSLConnectionSocketFactory
;
import
org.apache.http.conn.ssl.TrustStrategy
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.CloseableHttpClient
;
import
org.apache.http.impl.client.HttpClients
;
import
org.apache.http.impl.conn.PoolingHttpClientConnectionManager
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.ssl.SSLContextBuilder
;
import
org.apache.http.util.EntityUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.net.ssl.HostnameVerifier
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLSession
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.nio.charset.Charset
;
import
java.security.GeneralSecurityException
;
import
java.security.cert.CertificateException
;
import
java.security.cert.X509Certificate
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
class
HttpUtils
{
private
static
PoolingHttpClientConnectionManager
connMgr
;
private
static
RequestConfig
requestConfig
;
private
static
final
int
MAX_TIMEOUT
=
50000
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
HttpUtils
.
class
);
static
{
// 设置连接池
connMgr
=
new
PoolingHttpClientConnectionManager
();
// 设置连接池大小
connMgr
.
setMaxTotal
(
100
);
connMgr
.
setDefaultMaxPerRoute
(
connMgr
.
getMaxTotal
());
// Validate connections after 1 sec of inactivity
connMgr
.
setValidateAfterInactivity
(
5000
);
RequestConfig
.
Builder
configBuilder
=
RequestConfig
.
custom
();
// 设置连接超时
configBuilder
.
setConnectTimeout
(
MAX_TIMEOUT
);
// 设置读取超时
configBuilder
.
setSocketTimeout
(
MAX_TIMEOUT
);
// 设置从连接池获取连接实例的超时
configBuilder
.
setConnectionRequestTimeout
(
MAX_TIMEOUT
);
requestConfig
=
configBuilder
.
build
();
}
/**
* 发送 GET 请求(HTTP),不带输入数据
*
* @param url
* @return
*/
public
static
String
doGet
(
String
url
)
{
return
doGet
(
url
,
new
HashMap
<
String
,
Object
>());
}
/**
* 发送 GET 请求(HTTP),K-V形式
*
* @param url
* @param params
* @return
*/
public
static
String
doGet
(
String
url
,
Map
<
String
,
Object
>
params
)
{
String
apiUrl
=
url
;
StringBuffer
param
=
new
StringBuffer
();
int
i
=
0
;
for
(
String
key
:
params
.
keySet
())
{
if
(
i
==
0
)
param
.
append
(
"?"
);
else
param
.
append
(
"&"
);
param
.
append
(
key
).
append
(
"="
).
append
(
params
.
get
(
key
));
i
++;
}
apiUrl
+=
param
;
String
result
=
null
;
HttpClient
httpClient
=
null
;
if
(
apiUrl
.
startsWith
(
"https"
))
{
httpClient
=
HttpClients
.
custom
().
setSSLSocketFactory
(
createSSLConnSocketFactory
())
.
setConnectionManager
(
connMgr
).
setDefaultRequestConfig
(
requestConfig
).
build
();
}
else
{
httpClient
=
HttpClients
.
createDefault
();
}
try
{
HttpGet
httpGet
=
new
HttpGet
(
apiUrl
);
HttpResponse
response
=
httpClient
.
execute
(
httpGet
);
HttpEntity
entity
=
response
.
getEntity
();
if
(
entity
!=
null
)
{
InputStream
instream
=
entity
.
getContent
();
result
=
IOUtils
.
toString
(
instream
,
"UTF-8"
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
result
;
}
/**
* 发送 POST 请求(HTTP),不带输入数据
*
* @param apiUrl
* @return
*/
public
static
String
doPost
(
String
apiUrl
)
{
return
doPost
(
apiUrl
,
new
HashMap
<
String
,
Object
>());
}
/**
* 发送 POST 请求,K-V形式
*
* @param apiUrl
* API接口URL
* @param params
* 参数map
* @return
*/
public
static
String
doPost
(
String
apiUrl
,
Map
<
String
,
Object
>
params
)
{
CloseableHttpClient
httpClient
=
null
;
if
(
apiUrl
.
startsWith
(
"https"
))
{
httpClient
=
HttpClients
.
custom
().
setSSLSocketFactory
(
createSSLConnSocketFactory
())
.
setConnectionManager
(
connMgr
).
setDefaultRequestConfig
(
requestConfig
).
build
();
}
else
{
httpClient
=
HttpClients
.
createDefault
();
}
String
httpStr
=
null
;
HttpPost
httpPost
=
new
HttpPost
(
apiUrl
);
CloseableHttpResponse
response
=
null
;
try
{
httpPost
.
setConfig
(
requestConfig
);
List
<
NameValuePair
>
pairList
=
new
ArrayList
<>(
params
.
size
());
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
params
.
entrySet
())
{
NameValuePair
pair
=
new
BasicNameValuePair
(
entry
.
getKey
(),
entry
.
getValue
()!=
null
?
entry
.
getValue
().
toString
():
""
);
pairList
.
add
(
pair
);
}
httpPost
.
setEntity
(
new
UrlEncodedFormEntity
(
pairList
,
Charset
.
forName
(
"UTF-8"
)));
response
=
httpClient
.
execute
(
httpPost
);
HttpEntity
entity
=
response
.
getEntity
();
httpStr
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
response
!=
null
)
{
try
{
EntityUtils
.
consume
(
response
.
getEntity
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
httpStr
;
}
/**
* 发送 POST 请求,JSON形式,接收端需要支持json形式,否则取不到数据
*
* @param apiUrl
* @param json
* json对象
* @return
*/
public
static
String
doPost
(
String
apiUrl
,
String
json
)
{
CloseableHttpClient
httpClient
=
null
;
if
(
apiUrl
.
startsWith
(
"https"
))
{
httpClient
=
HttpClients
.
custom
().
setSSLSocketFactory
(
createSSLConnSocketFactory
()).
setConnectionManager
(
connMgr
).
setDefaultRequestConfig
(
requestConfig
).
build
();
}
else
{
httpClient
=
HttpClients
.
createDefault
();
}
String
httpStr
=
null
;
HttpPost
httpPost
=
new
HttpPost
(
apiUrl
);
CloseableHttpResponse
response
=
null
;
try
{
httpPost
.
setConfig
(
requestConfig
);
StringEntity
stringEntity
=
new
StringEntity
(
json
,
"UTF-8"
);
// 解决中文乱码问题
stringEntity
.
setContentEncoding
(
"UTF-8"
);
stringEntity
.
setContentType
(
"application/json"
);
httpPost
.
setEntity
(
stringEntity
);
response
=
httpClient
.
execute
(
httpPost
);
HttpEntity
entity
=
response
.
getEntity
();
httpStr
=
EntityUtils
.
toString
(
entity
,
"UTF-8"
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
response
!=
null
)
{
try
{
EntityUtils
.
consume
(
response
.
getEntity
());
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
httpStr
;
}
/**
* 创建SSL安全连接
*
* @return
*/
private
static
SSLConnectionSocketFactory
createSSLConnSocketFactory
()
{
SSLConnectionSocketFactory
sslsf
=
null
;
try
{
SSLContext
sslContext
=
new
SSLContextBuilder
().
loadTrustMaterial
(
null
,
new
TrustStrategy
()
{
public
boolean
isTrusted
(
X509Certificate
[]
chain
,
String
authType
)
throws
CertificateException
{
return
true
;
}
}).
build
();
sslsf
=
new
SSLConnectionSocketFactory
(
sslContext
,
new
HostnameVerifier
()
{
@Override
public
boolean
verify
(
String
arg0
,
SSLSession
arg1
)
{
return
true
;
}
});
}
catch
(
GeneralSecurityException
e
)
{
e
.
printStackTrace
();
}
return
sslsf
;
}
}
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
View file @
b4d60ab0
...
...
@@ -28,6 +28,8 @@ public class RedisKey {
public
static
final
String
ALERTCALLED_ID
=
"alertcalled_id_"
;
/**特种设备根据警情id查询警情详情记录*/
public
static
final
String
TZS_ALERTCALLED_ID
=
"tzs_alertcalled_id_"
;
/**联通CTI token */
public
static
final
String
CTI_TOKEN
=
"cti_token"
;
/** 驼峰转下划线(简单写法,效率低于{@link #humpToLine2(String)}) */
public
static
String
humpToLine
(
String
str
)
{
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/dto/FirefightersContractDto.java
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
dto
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.boot.biz.common.dto.BaseDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
java.util.Date
;
/**
* 消防员合同
*
...
...
@@ -52,5 +55,8 @@ public class FirefightersContractDto extends BaseDto {
@ApiModelProperty
(
value
=
"操作人名称"
)
private
String
recUserName
;
@ApiModelProperty
(
value
=
"附件"
)
private
Map
<
String
,
List
<
AttachmentDto
>>
attachments
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/FirefightersContract.java
View file @
b4d60ab0
...
...
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
...
...
@@ -12,6 +14,8 @@ import lombok.experimental.Accessors;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
/**
* 消防员合同
*
...
...
@@ -66,4 +70,9 @@ public class FirefightersContract extends BaseEntity {
@ApiModelProperty
(
value
=
"更新时间"
)
@TableField
(
fill
=
FieldFill
.
UPDATE
)
private
Date
updateTime
;
@TableField
(
exist
=
false
)
@ApiModelProperty
(
value
=
"附件"
)
private
Map
<
String
,
List
<
AttachmentDto
>>
attachments
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/entity/FirefightersThought.java
View file @
b4d60ab0
...
...
@@ -32,7 +32,7 @@ public class FirefightersThought extends BaseEntity {
@ApiModelProperty
(
value
=
"消防救援人员"
)
private
Long
firefightersId
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd
HH:mm:ss
"
)
@ApiModelProperty
(
value
=
"谈话时间"
)
private
Date
talkingTime
;
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IFirefightersContractService.java
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
service
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
/**
* 消防员合同 服务类
*
...
...
@@ -7,5 +10,14 @@ package com.yeejoin.amos.boot.module.common.api.service;
* @date 2021-06-07
*/
public
interface
IFirefightersContractService
{
/**
* 保存
* @param firefightersContract
* @return
*/
public
FirefightersContractDto
save
(
FirefightersContractDto
firefightersContract
);
public
FirefightersContractDto
updateById
(
FirefightersContractDto
firefightersContract
,
AgencyUserModel
userInfo
);
}
amos-boot-module/amos-boot-module-api/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/service/IOrgUsrService.java
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
api
.
service
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.yeejoin.amos.boot.module.common.api.dto.*
;
import
com.yeejoin.amos.boot.module.common.api.dto.CheckObjectDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.CompanyDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.ESOrgUsrDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FormValue
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgDepartmentFormDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgMenuDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgPersonDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgPersonFormDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrExcelDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrFormDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.OrgUsrzhDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.RequestData
;
import
com.yeejoin.amos.boot.module.common.api.dto.UserUnitDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance
;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
/**
* 机构/部门/人员表 服务类
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-maintenance-api/src/main/java/com/yeejoin/amos/maintenance/dao/entity/CheckShot.java
View file @
b4d60ab0
...
...
@@ -45,11 +45,7 @@ public class CheckShot extends BasicEntity {
private
String
pointName
;
/**
* 拍照类型:定点(检查项拍照),普通(检
*
*
*
*
* 拍照类型:1-检查项照片;2-不合格照片
* 点现场照片)
*/
@Column
(
name
=
"shot_type"
)
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-maintenance-api/src/main/java/com/yeejoin/amos/maintenance/dao/entity/PlanTask.java
View file @
b4d60ab0
...
...
@@ -31,6 +31,16 @@ public class PlanTask extends BasicEntity {
*/
@Column
(
name
=
"begin_time"
)
private
String
beginTime
;
/**
* 维保公司id
*/
private
String
companyId
;
/**
* 维保公司名称
*/
private
String
companyName
;
/**
* 巡检日期
*/
...
...
@@ -136,6 +146,22 @@ public class PlanTask extends BasicEntity {
this
.
batchNo
=
batchNo
;
}
public
String
getCompanyId
()
{
return
companyId
;
}
public
void
setCompanyId
(
String
companyId
)
{
this
.
companyId
=
companyId
;
}
public
String
getCompanyName
()
{
return
companyName
;
}
public
void
setCompanyName
(
String
companyName
)
{
this
.
companyName
=
companyName
;
}
public
String
getBeginTime
()
{
return
this
.
beginTime
;
}
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/CtiDto.java
0 → 100644
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
dto
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.experimental.Accessors
;
import
java.util.Map
;
/**
* 联通回调方法传入参数
* @author fengwang
* @date 2021-08-06.
*/
@Data
@Accessors
(
chain
=
true
)
@ApiModel
(
value
=
"CtiDto"
,
description
=
"CtiDto"
)
public
class
CtiDto
{
@ApiModelProperty
(
value
=
"企业ID"
)
private
Integer
cid
;
@ApiModelProperty
(
value
=
"呼叫类型(1:呼入;2:呼出)"
)
private
String
call_type
;
@ApiModelProperty
(
value
=
"外呼主叫(呼入时为呼入的热线号码)"
)
private
String
sysphone
;
@ApiModelProperty
(
value
=
"客户号码"
)
private
String
telephone
;
@ApiModelProperty
(
value
=
"客户ID"
)
private
String
cusid
;
@ApiModelProperty
(
value
=
"呼叫时间"
)
private
String
call_time
;
@ApiModelProperty
(
value
=
"服务工号"
)
private
String
empcode
;
@ApiModelProperty
(
value
=
"挂机时间"
)
private
String
hangup_time
;
@ApiModelProperty
(
value
=
"挂机方(1:坐席挂机;2:客户挂机)"
)
private
String
hangup_flag
;
@ApiModelProperty
(
value
=
"按键值(按键的数值,如果多个按键用-连接,如1-2)"
)
private
String
press_key
;
@ApiModelProperty
(
value
=
"按键值名称(press_key中按键的含义,多个按键用-连接,如:转组-转人工)"
)
private
String
press_key_name
;
@ApiModelProperty
(
value
=
"客户呼叫流水号"
)
private
String
connection_id
;
@ApiModelProperty
(
value
=
"坐席呼叫流水号"
)
private
String
service_connection_id
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/dto/VoiceRecordFileDto.java
View file @
b4d60ab0
...
...
@@ -51,4 +51,7 @@ public class VoiceRecordFileDto extends BaseDto {
@ApiModelProperty
(
value
=
"通话时长"
)
private
String
telTime
;
@ApiModelProperty
(
value
=
"通话记录id"
)
private
String
connectId
;
}
amos-boot-module/amos-boot-module-api/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/service/ICtiService.java
0 → 100644
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
service
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
java.util.Map
;
/**
* 联通cti 服务类
*
* @author system_generator
* @date 2021-08-03
*/
public
interface
ICtiService
{
/**
* 获取token
* @return
*/
String
getAccessToken
();
/**
* 获取登陆人坐席信息
* @return
*/
JSONObject
getLoginInfo
();
/**
* 根据话单id 查询话单详细信息
* @param connectionid
* @return
*/
JSONArray
getCallInfo
(
String
connectionid
);
/**
* 根据connectionid 下载录音 key 为录音地址 value 为录音名称
* @return
*/
Map
<
String
,
String
>
downLoadRecordFile
(
String
connectionid
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/FailureDetailsController.java
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
controller
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService
;
import
com.yeejoin.amos.boot.module.common.api.dto.CurrentStatusDto
;
import
com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum
;
import
feign.Response
;
import
org.apache.commons.io.IOUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.Http
Header
s
;
import
org.springframework.http.
MediaType
;
import
org.springframework.http.Http
Statu
s
;
import
org.springframework.http.
ResponseEntity
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -26,18 +20,24 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.exception.BaseException
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.workflow.feign.WorkflowFeignService
;
import
com.yeejoin.amos.boot.module.common.api.dto.CurrentStatusDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FailureDetailsDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.FailureDetails
;
import
com.yeejoin.amos.boot.module.common.api.enums.FailureStatuEnum
;
import
com.yeejoin.amos.boot.module.common.biz.constats.Constants
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FailureDetailsServiceImpl
;
import
feign.Response
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -216,31 +216,29 @@ public class FailureDetailsController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/downloadFile/{sequenceNbr}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"流程图高亮图片"
,
notes
=
"流程图高亮图片"
)
public
void
downloadFile
(
@PathVariable
Long
sequenceNbr
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
public
ResponseEntity
<
String
>
downloadFile
(
@PathVariable
Long
sequenceNbr
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
String
processId
=
failureDetailsServiceImpl
.
queryBySeq
(
sequenceNbr
).
getProcessId
();
Response
feignResponse
=
workflowFeignService
.
thighLineImg
(
processId
);
OutputStream
out
=
null
;
try
{
out
=
response
.
getOutputStream
();
Response
.
Body
body
=
feignResponse
.
body
();
HttpHeaders
heads
=
new
HttpHeaders
();
heads
.
setContentType
(
MediaType
.
valueOf
(
MediaType
.
IMAGE_JPEG_VALUE
));
byte
[]
b
=
new
byte
[
1024
];
int
len
;
while
((
len
=
body
.
asInputStream
().
read
(
b
,
0
,
1024
))
!=
-
1
)
{
out
.
write
(
b
,
0
,
len
);
}
out
.
flush
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
// response.setContentType("application/octet-stream");//
// response.setHeader("content-type", "application/octet-stream");
// response.setContentType("text/xml");//
// response.setHeader("content-type", "text/xml");
// response.setCharacterEncoding("utf-8");
// response.setHeader("Content-Disposition", "attachment;fileName=workflow.svg");
// response.reset();
// byte[] b = new byte[1024];
// int len;
// while ((len = body.asInputStream().read(b, 0, 1024)) != -1) {
// out.write(b, 0, len);
// }
// out.flush();
return
new
ResponseEntity
<
String
>(
IOUtils
.
toString
(
body
.
asInputStream
()),
HttpStatus
.
OK
);
//.toByteArray(body.asInputStream()), responseHeaders, HttpStatus.OK);
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
"Error exporting diagram"
,
"500"
,
processId
);
}
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/controller/FirefightersContractController.java
View file @
b4d60ab0
...
...
@@ -15,6 +15,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
...
@@ -28,8 +29,11 @@ import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersContract
;
import
com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractService
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.FirefightersContractServiceImpl
;
import
com.yeejoin.amos.boot.module.common.biz.service.impl.SourceFileServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -48,6 +52,12 @@ public class FirefightersContractController extends BaseController {
@Autowired
FirefightersContractServiceImpl
iFirefightersContractService
;
@Autowired
IFirefightersContractService
firefightersContractService
;
@Autowired
SourceFileServiceImpl
sourceFileService
;
@Autowired
RedisUtils
redisUtils
;
@Value
(
"${redis.cache.failure.time}"
)
...
...
@@ -59,9 +69,8 @@ public class FirefightersContractController extends BaseController {
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增消防员合同"
,
notes
=
"新增消防员合同"
)
public
ResponseModel
<
FirefightersContract
>
saveFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContract
firefightersContract
){
iFirefightersContractService
.
save
(
firefightersContract
);
return
ResponseHelper
.
buildResponse
(
firefightersContract
);
public
ResponseModel
<
FirefightersContractDto
>
saveFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContractDto
firefightersContract
){
return
ResponseHelper
.
buildResponse
(
firefightersContractService
.
save
(
firefightersContract
));
}
/**
...
...
@@ -93,8 +102,8 @@ public class FirefightersContractController extends BaseController {
@TycloudOperation
(
needAuth
=
true
,
ApiLevel
=
UserType
.
AGENCY
)
@RequestMapping
(
value
=
"/updateById"
,
method
=
RequestMethod
.
PUT
)
@ApiOperation
(
httpMethod
=
"PUT"
,
value
=
"修改消防员合同"
,
notes
=
"修改消防员合同"
)
public
ResponseModel
<
FirefightersContract
>
updateByIdFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContract
firefightersContract
){
iFirefightersContractService
.
updateById
(
firefightersContract
);
public
ResponseModel
<
FirefightersContract
Dto
>
updateByIdFirefightersContract
(
HttpServletRequest
request
,
@RequestBody
FirefightersContractDto
firefightersContract
){
firefightersContractService
.
updateById
(
firefightersContract
,
getUserInfo
()
);
//删除缓存
redisUtils
.
del
(
RedisKey
.
CONTRACT_ID
+
firefightersContract
.
getSequenceNbr
());
return
ResponseHelper
.
buildResponse
(
firefightersContract
);
...
...
@@ -116,9 +125,12 @@ public class FirefightersContractController extends BaseController {
return
ResponseHelper
.
buildResponse
(
obj
);
}
else
{
FirefightersContract
firefightersContract
=
iFirefightersContractService
.
getById
(
id
);
redisUtils
.
set
(
RedisKey
.
CONTRACT_ID
+
id
,
JSON
.
toJSON
(
firefightersContract
),
time
);
return
ResponseHelper
.
buildResponse
(
firefightersContract
);
}
FirefightersContractDto
dto
=
new
FirefightersContractDto
();
Bean
.
copyExistPropertis
(
firefightersContract
,
dto
);
dto
.
setAttachments
(
sourceFileService
.
getAttachments
(
id
));
redisUtils
.
set
(
RedisKey
.
CONTRACT_ID
+
id
,
JSON
.
toJSON
(
dto
),
time
);
return
ResponseHelper
.
buildResponse
(
dto
);
}
}
...
...
@@ -173,6 +185,9 @@ public class FirefightersContractController extends BaseController {
pageBean
=
new
Page
<
FirefightersContract
>(
Integer
.
parseInt
(
pageNum
),
Integer
.
parseInt
(
pageSize
));
}
page
=
iFirefightersContractService
.
page
(
pageBean
,
firefightersContractQueryWrapper
);
page
.
getRecords
().
forEach
(
i
->{
i
.
setAttachments
(
sourceFileService
.
getAttachments
(
i
.
getSequenceNbr
()));
});
return
ResponseHelper
.
buildResponse
(
page
);
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-common-biz/src/main/java/com/yeejoin/amos/boot/module/common/biz/service/impl/FirefightersContractServiceImpl.java
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
common
.
biz
.
service
.
impl
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.typroject.tyboot.core.foundation.utils.Bean
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
com.baomidou.mybatisplus.core.toolkit.Sequence
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.boot.module.common.api.dto.AttachmentDto
;
import
com.yeejoin.amos.boot.module.common.api.dto.FirefightersContractDto
;
import
com.yeejoin.amos.boot.module.common.api.entity.FirefightersContract
;
import
com.yeejoin.amos.boot.module.common.api.entity.SourceFile
;
import
com.yeejoin.amos.boot.module.common.api.mapper.FirefightersContractMapper
;
import
com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractService
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
/**
* 消防员合同 服务实现类
...
...
@@ -17,4 +31,68 @@ import com.yeejoin.amos.boot.module.common.api.service.IFirefightersContractServ
@Service
public
class
FirefightersContractServiceImpl
extends
BaseService
<
FirefightersContractDto
,
FirefightersContract
,
FirefightersContractMapper
>
implements
IFirefightersContractService
{
@Autowired
SourceFileServiceImpl
sourceFileService
;
@Autowired
private
Sequence
sequence
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
FirefightersContractDto
save
(
FirefightersContractDto
firefightersContract
)
{
long
sequenceId
=
sequence
.
nextId
();
FirefightersContract
detail
=
new
FirefightersContract
();
Bean
.
copyExistPropertis
(
firefightersContract
,
detail
);
firefightersContract
.
setSequenceNbr
(
sequenceId
);
detail
.
setSequenceNbr
(
sequenceId
);
this
.
save
(
detail
);
saveAttachments
(
firefightersContract
);
return
firefightersContract
;
}
public
void
saveAttachments
(
FirefightersContractDto
firefightersContract
)
{
if
(!
ValidationUtil
.
isEmpty
(
firefightersContract
.
getAttachments
()))
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
Map
<
String
,
List
<
AttachmentDto
>>
attachmentMap
=
firefightersContract
.
getAttachments
();
attachmentMap
.
entrySet
().
forEach
(
entry
->
{
List
<
AttachmentDto
>
atts
=
entry
.
getValue
();
sourceFiles
.
addAll
(
attachment2SourceFile
(
entry
.
getKey
(),
atts
));
});
sourceFileService
.
saveSourceFile
(
firefightersContract
.
getSequenceNbr
(),
sourceFiles
);
}
}
private
List
<
SourceFile
>
attachment2SourceFile
(
String
type
,
List
<
AttachmentDto
>
attachmentDtoList
)
{
List
<
SourceFile
>
sourceFiles
=
Lists
.
newArrayList
();
if
(!
ValidationUtil
.
isEmpty
(
attachmentDtoList
))
{
attachmentDtoList
.
forEach
(
a
->
{
SourceFile
s
=
new
SourceFile
();
s
.
setFilePath
(
a
.
getUrl
());
s
.
setFileName
(
a
.
getName
());
s
.
setFileCategory
(
type
);
sourceFiles
.
add
(
s
);
});
}
return
sourceFiles
;
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
FirefightersContractDto
updateById
(
FirefightersContractDto
firefightersContract
,
AgencyUserModel
userInfo
)
{
FirefightersContract
detail
=
new
FirefightersContract
();
Bean
.
copyExistPropertis
(
firefightersContract
,
detail
);
detail
.
setIsDelete
(
false
);
detail
.
setRecDate
(
new
Date
());
detail
.
setRecUserId
(
userInfo
.
getUserId
());
detail
.
setRecUserName
(
userInfo
.
getUserName
());
this
.
baseMapper
.
updateById
(
detail
);
Map
<
String
,
List
<
AttachmentDto
>>
map
=
firefightersContract
.
getAttachments
();
if
(
ObjectUtils
.
isNotEmpty
(
map
))
{
this
.
saveAttachments
(
firefightersContract
);
}
return
firefightersContract
;
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/FirefightersController.java
View file @
b4d60ab0
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/controller/PlanTaskController.java
View file @
b4d60ab0
...
...
@@ -195,7 +195,7 @@ public class PlanTaskController extends AbstractBaseController {
* @param
* @return
*/
@PersonIdentify
(
isNeedIdentity
=
true
)
@PersonIdentify
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"维保任务查询-mobile"
,
notes
=
"根据用户条件查询所有计划任务-mobile"
)
@RequestMapping
(
value
=
"/queryPlanTask"
,
produces
=
"application/json;charset=UTF-8"
,
method
=
RequestMethod
.
GET
)
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/param/CheckInputParam.java
View file @
b4d60ab0
...
...
@@ -5,6 +5,7 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -20,7 +21,7 @@ public class CheckInputParam {
private
boolean
isCheck
;
private
String
remark
;
private
Long
routePointItemId
;
private
List
<
CheckShotDto
>
checkInputShot
;
private
List
<
CheckShotDto
>
checkInputShot
=
new
ArrayList
<>()
;
public
CheckInputParam
(
String
inputValue
)
{
this
.
inputValue
=
inputValue
;
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/param/CheckRecordParam.java
View file @
b4d60ab0
...
...
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -37,5 +38,5 @@ public class CheckRecordParam {
* 检查项
*/
@ApiModelProperty
(
value
=
"检查项"
,
required
=
true
)
private
List
<
CheckInputParam
>
checkItems
;
private
List
<
CheckInputParam
>
checkItems
=
new
ArrayList
<>()
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/CheckServiceImpl.java
View file @
b4d60ab0
...
...
@@ -46,6 +46,7 @@ import com.yeejoin.amos.maintenance.core.util.query.BaseQuerySpecification;
import
com.yeejoin.amos.maintenance.dao.entity.*
;
import
com.yeejoin.amos.maintenance.feign.RemoteSecurityService
;
import
com.yeejoin.amos.maintenance.mqtt.MqttGateway
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.cxf.common.util.CollectionUtils
;
import
org.assertj.core.util.Sets
;
...
...
@@ -64,6 +65,7 @@ import java.util.*;
import
java.util.stream.Collectors
;
@Service
(
"checkService"
)
@Slf4j
public
class
CheckServiceImpl
implements
ICheckService
{
@Autowired
...
...
@@ -266,7 +268,8 @@ public class CheckServiceImpl implements ICheckService {
//7.返回不合格记录
return
new
CheckDto
(
check
.
getId
(),
unqualifiedCheckItemList
);
}
catch
(
Exception
e
)
{
throw
new
Exception
(
e
.
getMessage
());
log
.
error
(
e
.
getMessage
(),
e
);
throw
new
Exception
(
e
.
getMessage
(),
e
);
}
}
...
...
@@ -329,7 +332,9 @@ public class CheckServiceImpl implements ICheckService {
score
=
jsonObject
.
getIntValue
(
XJConstant
.
INPUT_ITEM_OK_SCORE
);
}
}
if
(
XJConstant
.
YES
.
equals
(
isScore
))
checkInput
.
setScore
(
score
);
if
(
XJConstant
.
YES
.
equals
(
isScore
))
{
checkInput
.
setScore
(
score
);
}
return
checkInput
;
}
...
...
@@ -370,7 +375,9 @@ public class CheckServiceImpl implements ICheckService {
checkInput
.
setIsOk
(
XJConstant
.
OK
);
score
=
OkScore
;
}
if
(
XJConstant
.
YES
.
equals
(
isScore
))
checkInput
.
setScore
(
score
);
if
(
XJConstant
.
YES
.
equals
(
isScore
))
{
checkInput
.
setScore
(
score
);
}
return
checkInput
;
}
...
...
@@ -399,7 +406,9 @@ public class CheckServiceImpl implements ICheckService {
}
}
}
if
(
XJConstant
.
YES
.
equals
(
isScore
))
checkInput
.
setScore
(
score
);
if
(
XJConstant
.
YES
.
equals
(
isScore
))
{
checkInput
.
setScore
(
score
);
}
return
checkInput
;
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/PlanTaskServiceImpl.java
View file @
b4d60ab0
...
...
@@ -388,6 +388,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTask
.
setUserName
(
userName
);
planTask
.
setPlanId
(
plan
.
getId
());
planTask
.
setBatchNo
(
batchNo
);
planTask
.
setCompanyId
(
plan
.
getCompanyId
());
planTask
.
setCompanyName
(
plan
.
getCompanyName
());
planTask
.
setRouteId
(
plan
.
getRouteId
());
planTask
.
setInOrder
(
plan
.
getInOrder
());
planTask
.
setUserId
(
userId
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/CtiController.java
0 → 100644
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.CtiDto
;
import
com.yeejoin.amos.boot.module.tzs.api.service.ICtiService
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.security.MessageDigest
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 联通API controller
*
* @author kongfm
* @date 2021-08-25
*/
@RestController
@Api
(
tags
=
"联通CTIApi"
)
@RequestMapping
(
value
=
"/cti"
)
public
class
CtiController
extends
BaseController
{
@Autowired
private
ICtiService
ctiService
;
/**
* 获取坐席登陆信息
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/getCtiInfo"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取坐席登陆信息"
,
notes
=
"获取坐席登陆信息"
)
public
ResponseModel
<
JSONObject
>
getCtiInfo
()
{
JSONObject
loginData
=
ctiService
.
getLoginInfo
();
return
ResponseHelper
.
buildResponse
(
loginData
);
}
/**
* 获取坐席登陆信息
* 暴露公网
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
ANONYMOUS
,
needAuth
=
false
)
@PostMapping
(
value
=
"/ctiBack"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"获取电话结束后回调信息"
,
notes
=
"获取电话结束后回调信息"
)
public
JSONObject
ctiBack
(
@RequestBody
CtiDto
ctiDto
)
{
System
.
out
.
println
(
"===================================="
);
System
.
out
.
println
(
ctiDto
);
JSONObject
result
=
new
JSONObject
();
result
.
put
(
"code"
,
"0"
);
result
.
put
(
"message"
,
"调用成功"
);
return
result
;
}
/**
* 获取坐席登陆信息
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/info/{connectId}"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"获取通话话单详情"
,
notes
=
"获取通话话单详情"
)
public
ResponseModel
<
JSONObject
>
getCallInfo
(
@PathVariable
String
connectId
)
{
JSONArray
recordInfos
=
ctiService
.
getCallInfo
(
connectId
);
JSONObject
recordInfo
=
recordInfos
.
getJSONObject
(
0
);
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
);
return
ResponseHelper
.
buildResponse
(
recordInfo
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/VoiceRecordFileController.java
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile
;
import
com.yeejoin.amos.boot.module.tzs.api.service.ICtiService
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.VoiceRecordFileServiceImpl
;
import
io.swagger.annotations.Api
;
...
...
@@ -25,9 +28,13 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
/**
...
...
@@ -47,6 +54,9 @@ public class VoiceRecordFileController extends BaseController {
@Autowired
AlertCalledServiceImpl
iAlertCalledService
;
@Autowired
ICtiService
ctiService
;
/**
* 新增通话记录附件
*
...
...
@@ -103,4 +113,61 @@ public class VoiceRecordFileController extends BaseController {
});
return
ResponseHelper
.
buildResponse
(
dtoList
);
}
/**
* 新增通话记录
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/saveRecord"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增通话记录附件"
,
notes
=
"新增通话记录附件"
)
public
ResponseModel
<
VoiceRecordFileDto
>
saveRecord
(
@RequestBody
VoiceRecordFileDto
model
)
{
if
(
ValidationUtil
.
isEmpty
(
model
.
getAlertId
())
||
ValidationUtil
.
isEmpty
(
model
.
getConnectId
())){
throw
new
BadRequest
(
"参数校验失败."
);
}
// 获取通话人信息
JSONArray
recordInfos
=
ctiService
.
getCallInfo
(
model
.
getConnectId
());
if
(
recordInfos
==
null
||
recordInfos
.
size
()
==
0
)
{
throw
new
BadRequest
(
"未找到通话详单信息"
);
}
JSONObject
recordInfo
=
recordInfos
.
getJSONObject
(
0
);
model
.
setTel
(
recordInfo
.
getString
(
"telephone"
));
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd'T'HH:mm:ss.SSSZ"
);
Date
telStartTime
=
null
;
Date
telEndTime
=
null
;
try
{
telStartTime
=
sdf
.
parse
(
recordInfo
.
getString
(
"connectTime"
));
telEndTime
=
sdf
.
parse
(
recordInfo
.
getString
(
"hangupTime"
));
}
catch
(
ParseException
e
)
{
throw
new
BadRequest
(
"日期转换错误"
);
}
model
.
setTelStartTime
(
telStartTime
);
model
.
setTelEndTime
(
telEndTime
);
if
(
1
==
recordInfo
.
getInteger
(
"callType"
))
{
model
.
setFileType
(
"客户呼入"
);
}
else
if
(
2
==
recordInfo
.
getInteger
(
"callType"
))
{
model
.
setFileType
(
"坐席呼出"
);
}
// 获取附件
Map
<
String
,
String
>
downloadFile
=
ctiService
.
downLoadRecordFile
(
model
.
getConnectId
());
if
(
downloadFile
.
isEmpty
())
{
throw
new
BadRequest
(
"未找到附件文件"
);
}
for
(
Map
.
Entry
<
String
,
String
>
file
:
downloadFile
.
entrySet
())
{
model
.
setFilePath
(
file
.
getKey
());
}
AlertCalledFormDto
alertDto
=
iAlertCalledService
.
selectAlertCalledByIdNoCache
(
model
.
getAlertId
());
if
(
alertDto
==
null
||
alertDto
.
getAlertCalledDto
()
==
null
)
{
throw
new
BadRequest
(
"未找到相关警情"
);
}
model
.
setAlertStage
(
alertDto
.
getAlertCalledDto
().
getAlertStage
());
model
.
setAlertStageCode
(
alertDto
.
getAlertCalledDto
().
getAlertStageCode
());
model
.
setSourceId
(-
1
l
);
model
=
voiceRecordFileServiceImpl
.
createWithModel
(
model
);
return
ResponseHelper
.
buildResponse
(
model
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/service/impl/CtiServiceImpl.java
0 → 100644
View file @
b4d60ab0
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
service
.
impl
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledObjsDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto
;
import
com.yeejoin.amos.boot.module.tzs.api.dto.FormValue
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.AlertFormValue
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.Elevator
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.AlertStageEnums
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.DispatchPaperEnums
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.AlertCalledMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IAlertCalledService
;
import
com.yeejoin.amos.boot.module.tzs.api.service.ICtiService
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.HttpUtils
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.FileInfoModel
;
import
org.apache.commons.fileupload.FileItem
;
import
org.apache.commons.fileupload.FileItemFactory
;
import
org.apache.commons.fileupload.disk.DiskFileItemFactory
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.MediaType
;
import
org.springframework.mock.web.MockMultipartFile
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.springframework.web.multipart.commons.CommonsMultipartFile
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.security.MessageDigest
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 联通cti 服务实现类
*
* @author kongfm
* @date 2021-08-25
*/
@Service
public
class
CtiServiceImpl
implements
ICtiService
{
@Autowired
RedisUtils
redisUtils
;
/**
* token 过期时间, cti 系统为7200 ,tzs 系统小于7200 防止获取到无效token
*/
private
long
time
=
6000
l
;
private
final
String
APP_KEY
=
"4e805006-3fef-ae43-3915-a153731007c4"
;
private
final
String
SECRET_KEY
=
"7bd29115-99ee-4f7d-1fb1-7c4719d5f43a"
;
private
String
ctiUrl
=
"http://36.46.151.113:8000"
;
@Override
public
String
getAccessToken
()
{
if
(
redisUtils
.
hasKey
(
RedisKey
.
CTI_TOKEN
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
CTI_TOKEN
);
return
obj
.
toString
();
}
else
{
String
tokenAccessUrl
=
ctiUrl
+
"/openauth/getAccessToken"
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"appKey"
,
APP_KEY
);
String
randomStr
=
System
.
currentTimeMillis
()
+
""
;
params
.
put
(
"randomStr"
,
randomStr
);
String
signStr
=
APP_KEY
+
randomStr
+
SECRET_KEY
;
String
sign
=
encrypt32
(
signStr
).
toLowerCase
();
params
.
put
(
"sign"
,
sign
);
String
responseStr
=
HttpUtils
.
doPost
(
tokenAccessUrl
,
params
);
JSONObject
response
=
null
;
try
{
response
=
JSONObject
.
parseObject
(
responseStr
);
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"获取token 出错:"
+
e
.
getMessage
());
}
if
(
response
.
getInteger
(
"code"
)
==
0
)
{
// 获取token 成功
try
{
String
token
=
response
.
getJSONObject
(
"data"
).
getString
(
"accessToken"
);
redisUtils
.
set
(
RedisKey
.
CTI_TOKEN
,
token
,
time
);
return
token
;
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"获取token 出错:"
+
e
.
getMessage
());
}
}
else
{
throw
new
BadRequest
(
"获取token 出错:"
+
response
.
getString
(
"msg"
));
}
}
}
@Override
public
JSONObject
getLoginInfo
()
{
String
token
=
this
.
getAccessToken
();
// gid code extphone 目前写死 后面根据用户获取
String
gid
=
"61,默认,0"
;
String
code
=
"1001"
;
String
extphone
=
"10001001"
;
String
loginUrl
=
ctiUrl
+
"/cti/login"
+
"?accessToken="
+
token
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"accessToken"
,
token
);
params
.
put
(
"gid"
,
gid
);
params
.
put
(
"code"
,
code
);
params
.
put
(
"extphone"
,
extphone
);
String
responseStr
=
HttpUtils
.
doPost
(
loginUrl
,
params
);
JSONObject
response
=
null
;
try
{
response
=
JSONObject
.
parseObject
(
responseStr
);
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"登陆出错:"
+
e
.
getMessage
());
}
if
(
response
.
getInteger
(
"code"
)
==
0
)
{
// 登陆成功
try
{
JSONObject
loginData
=
response
.
getJSONObject
(
"loginData"
);
return
loginData
;
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"获取loginData 出错:"
+
e
.
getMessage
());
}
}
else
{
//登陆失败
throw
new
BadRequest
(
"登陆失败出错:"
+
response
.
getString
(
"message"
));
}
}
@Override
public
JSONArray
getCallInfo
(
String
connectionid
)
{
String
token
=
this
.
getAccessToken
();
String
url
=
ctiUrl
+
"/onOpenAuth/cti/openApi/querycalllist1"
;
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"connectionid"
,
connectionid
);
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
"accessToken"
,
token
);
String
responseStr
=
HttpUtils
.
doPostWithHeader
(
url
,
params
.
toJSONString
(),
header
);
JSONObject
response
=
null
;
try
{
response
=
JSONObject
.
parseObject
(
responseStr
);
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"获取话单出错:"
+
e
.
getMessage
());
}
if
(
response
.
getInteger
(
"code"
)
==
0
)
{
// 登陆成功
try
{
JSONArray
loginData
=
response
.
getJSONArray
(
"data"
);
return
loginData
;
}
catch
(
Exception
e
)
{
throw
new
BadRequest
(
"获取loginData 出错:"
+
e
.
getMessage
());
}
}
else
{
//登陆失败
throw
new
BadRequest
(
"获取话单出错:"
+
response
.
getString
(
"msg"
));
}
}
@Override
public
Map
<
String
,
String
>
downLoadRecordFile
(
String
connectionid
)
{
String
token
=
this
.
getAccessToken
();
String
url
=
ctiUrl
+
"/onOpenAuth/cti/openApi/downloadvoice"
;
JSONObject
params
=
new
JSONObject
();
params
.
put
(
"connectionid"
,
connectionid
);
Map
<
String
,
String
>
header
=
new
HashMap
<>();
header
.
put
(
"accessToken"
,
token
);
byte
[]
bytes
=
HttpUtils
.
doPostWithHeaderDownload
(
url
,
params
.
toJSONString
(),
header
);
if
(
bytes
==
null
||
bytes
.
length
==
0
)
{
throw
new
BadRequest
(
"获取录音失败"
);
}
else
{
MultipartFile
file
=
new
MockMultipartFile
(
"录音.MP3"
,
"录音.MP3"
,
"application/octet-stream"
,
bytes
);
FeignClientResult
<
Map
<
String
,
String
>>
result
=
Systemctl
.
fileStorageClient
.
updateCommonFile
(
file
);
Map
<
String
,
String
>
map
=
result
.
getResult
();
return
map
;
}
}
/**
* 获取MD加密串
* @param encryptStr
* @return
*/
private
String
encrypt32
(
String
encryptStr
)
{
MessageDigest
md5
;
try
{
md5
=
MessageDigest
.
getInstance
(
"MD5"
);
byte
[]
md5Bytes
=
md5
.
digest
(
encryptStr
.
getBytes
());
StringBuffer
hexValue
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
md5Bytes
.
length
;
i
++)
{
int
val
=
((
int
)
md5Bytes
[
i
])
&
0xff
;
if
(
val
<
16
)
hexValue
.
append
(
"0"
);
hexValue
.
append
(
Integer
.
toHexString
(
val
));
}
encryptStr
=
hexValue
.
toString
();
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
return
encryptStr
;
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/utils/HttpUtils.java
0 → 100644
View file @
b4d60ab0
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-biz/pom.xml
View file @
b4d60ab0
...
...
@@ -28,6 +28,11 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.springframework
</groupId>
<artifactId>
spring-mock
</artifactId>
<version>
2.0.8
</version>
</dependency>
</dependencies>
<modules>
...
...
amos-boot-system-maintenance/src/main/resources/db/changelog/mt-1.0.0.xml
View file @
b4d60ab0
...
...
@@ -168,4 +168,26 @@
ALTER TABLE p_check add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1629788256095-12"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_plan_task"
columnName=
"company_id"
/>
</not>
</preConditions>
<comment>
p_plan_task add COLUMN company_id 维保公司id
</comment>
<sql>
ALTER TABLE p_plan_task add COLUMN `company_id` varchar(32) DEFAULT NULL COMMENT '维保公司id';
</sql>
</changeSet>
<changeSet
author=
"suhuiguang"
id=
"1629788256095-13"
>
<preConditions
onFail=
"MARK_RAN"
>
<not>
<columnExists
tableName=
"p_plan_task"
columnName=
"company_name"
/>
</not>
</preConditions>
<comment>
p_plan_task add COLUMN company_name '维保公司名称'
</comment>
<sql>
ALTER TABLE p_plan_task add COLUMN `company_name` varchar(255) DEFAULT NULL COMMENT '维保公司名称';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment