Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
foc_manage
Overview
Overview
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
首航-临时账号
foc_manage
Commits
18c2ff27
Commit
18c2ff27
authored
Sep 20, 2017
by
Java-金吉宝
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重复记录
parent
1d43b2c7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
361 additions
and
273 deletions
+361
-273
SoundRecordingDao.xml
resources/mappings/modules/contact/SoundRecordingDao.xml
+129
-59
SoundRecordingDao.java
src/com/ejweb/modules/contact/dao/SoundRecordingDao.java
+14
-10
SoundRecordingService.java
src/com/ejweb/modules/contact/service/SoundRecordingService.java
+77
-72
SoundRecordingController.java
src/com/ejweb/modules/contact/web/SoundRecordingController.java
+141
-132
No files found.
resources/mappings/modules/contact/SoundRecordingDao.xml
View file @
18c2ff27
<?xml version="1.0" encoding="UTF-8" ?>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.ejweb.modules.contact.dao.SoundRecordingDao"
>
<mapper
namespace=
"com.ejweb.modules.contact.dao.SoundRecordingDao"
>
<select
id=
"findList"
resultType=
"com.ejweb.modules.contact.entity.SoundRecordingEntity"
>
<!-- <select id="findList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
SELECT CONCAT(ac.create_name,ap.username,(UNIX_TIMESTAMP(ac.end_time)-ac.duration)) as b,
select *
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
from (
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
SELECT CONCAT(ac.create_name,ap.username,(UNIX_TIMESTAMP(ac.end_time)-ac.duration)) as b,
FROM foc_sound_records ac
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
<where>
FROM foc_sound_records ac
ac.end_status !='INIT'
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
<if
test=
"seatList.size() > 0"
>
where
and (ac.create_by in
ac.end_status !='INIT'
<foreach
item=
"item"
collection=
"seatList"
separator=
","
open=
"("
close=
")"
index=
""
>
<if test="seatList.size() > 0">
#{item.id}
and (ac.create_by in
</foreach>
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
or
#{item.id}
ap.user_id in
</foreach>
<foreach
item=
"item"
collection=
"seatList"
separator=
","
open=
"("
close=
")"
index=
""
>
or
#{item.id}
ap.user_id in
</foreach>
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
)
#{item.id}
</if>
</foreach>
<if
test=
"callNo != null and callNo != ''"
>
)
AND ac.create_phone LIKE
</if>
<if
test=
"dbName == 'oracle'"
>
'%'||#{callNo}||'%'
</if>
<if test="callNo != null and callNo != ''">
<if
test=
"dbName == 'mssql'"
>
'%'+#{callNo}+'%'
</if>
AND ac.create_phone LIKE
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{callNo}, '%')
</if>
<if test="dbName == 'oracle'">'%'||#{callNo}||'%'</if>
</if>
<if test="dbName == 'mssql'">'%'+#{callNo}+'%'</if>
<if
test=
"callName != null and callName != ''"
>
<if test="dbName == 'mysql'">CONCAT('%', #{callNo}, '%')</if>
AND ac.create_name LIKE
</if>
<if
test=
"dbName == 'oracle'"
>
'%'||#{callName}||'%'
</if>
<if test="callName != null and callName != ''">
<if
test=
"dbName == 'mssql'"
>
'%'+#{callName}+'%'
</if>
AND ac.create_name LIKE
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{callName}, '%')
</if>
<if test="dbName == 'oracle'">'%'||#{callName}||'%'</if>
</if>
<if test="dbName == 'mssql'">'%'+#{callName}+'%'</if>
<if
test=
"acceptNo != null and acceptNo != ''"
>
<if test="dbName == 'mysql'">CONCAT('%', #{callName}, '%')</if>
AND ap.phone LIKE
</if>
<if
test=
"dbName == 'oracle'"
>
'%'||#{acceptNo}||'%'
</if>
<if test="acceptNo != null and acceptNo != ''">
<if
test=
"dbName == 'mssql'"
>
'%'+#{acceptNo}+'%'
</if>
AND ap.phone LIKE
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{acceptNo}, '%')
</if>
<if test="dbName == 'oracle'">'%'||#{acceptNo}||'%'</if>
</if>
<if test="dbName == 'mssql'">'%'+#{acceptNo}+'%'</if>
<if
test=
"acceptName != null and acceptName != ''"
>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptNo}, '%')</if>
AND ap.username LIKE
</if>
<if
test=
"dbName == 'oracle'"
>
'%'||#{acceptName}||'%'
</if>
<if test='acceptName != null and acceptName != ""'>
<if
test=
"dbName == 'mssql'"
>
'%'+#{acceptName}+'%'
</if>
AND ap.username LIKE
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{acceptName}, '%')
</if>
<if test="dbName == 'oracle'">'%'||#{acceptName}||'%'</if>
</if>
<if test="dbName == 'mssql'">'%'+#{acceptName}+'%'</if>
<if
test=
"beginTime != null and beginTime != ''"
>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptName}, '%')</if>
AND (ac.start_time BETWEEN #{beginTime} AND #{endTime})
</if>
<!-- AND ac.start_time <![CDATA[>]]> #{beginTime} -->
<if test='beginTime != null and beginTime != ""'>
</if>
AND ac.start_time <![CDATA[<=]]>#{endTime} and ac.start_time <![CDATA[>=]]> #{beginTime}
<if
test=
"endTime != null and endTime != ''"
>
AND ac.start_time <![CDATA[>]]> #{beginTime}
AND ( ac.end_time
<![CDATA[<]]>
#{endTime} OR ac.end_time is NULL)
</if>
</if>
<if test='endTime != null and endTime != ""'>
</where>
AND ( ac.end_time <![CDATA[<]]> #{endTime} OR ac.end_time is NULL)
group by b
</if>
ORDER BY ac.start_time desc
</select>
GROUP BY b
) er
ORDER BY beginTime DESC
</select> -->
<select
id=
"findList"
resultType=
"com.ejweb.modules.contact.entity.SoundRecordingEntity"
>
SELECT
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
where
ac.end_status !='INIT'
<if
test=
"seatList.size() > 0"
>
and (ac.create_by in
<foreach
item=
"item"
collection=
"seatList"
separator=
","
open=
"("
close=
")"
index=
""
>
#{item.id}
</foreach>
or
ap.user_id in
<foreach
item=
"item"
collection=
"seatList"
separator=
","
open=
"("
close=
")"
index=
""
>
#{item.id}
</foreach>
)
</if>
<if
test=
"callNo != null and callNo != ''"
>
AND ac.create_phone LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{callNo}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{callNo}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{callNo}, '%')
</if>
</if>
<if
test=
"callName != null and callName != ''"
>
AND ac.create_name LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{callName}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{callName}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{callName}, '%')
</if>
</if>
<if
test=
"acceptNo != null and acceptNo != ''"
>
AND ap.phone LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{acceptNo}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{acceptNo}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{acceptNo}, '%')
</if>
</if>
<if
test=
'acceptName != null and acceptName != ""'
>
AND ap.username LIKE
<if
test=
"dbName == 'oracle'"
>
'%'||#{acceptName}||'%'
</if>
<if
test=
"dbName == 'mssql'"
>
'%'+#{acceptName}+'%'
</if>
<if
test=
"dbName == 'mysql'"
>
CONCAT('%', #{acceptName}, '%')
</if>
</if>
<if
test=
'beginTime != null and beginTime != ""'
>
AND ac.start_time
<![CDATA[<=]]>
#{endTime} and ac.start_time
<![CDATA[>=]]>
#{beginTime}
AND ac.start_time
<![CDATA[>]]>
#{beginTime}
</if>
<if
test=
'endTime != null and endTime != ""'
>
AND ( ac.end_time
<![CDATA[<]]>
#{endTime} OR ac.end_time is NULL)
</if>
ORDER BY beginTime DESC
</select>
<select
id=
"findRecordingList"
resultType=
"com.ejweb.modules.contact.entity.SoundRecordingEntity"
>
SELECT
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
where
ac.end_status !='INIT'
and ac.create_name=#{callName}
and ap.username=#{acceptName}
and ac.start_time=#{endTime}
</select>
</mapper>
</mapper>
\ No newline at end of file
src/com/ejweb/modules/contact/dao/SoundRecordingDao.java
View file @
18c2ff27
package
com
.
ejweb
.
modules
.
contact
.
dao
;
package
com
.
ejweb
.
modules
.
contact
.
dao
;
import
com.ejweb.core.persistence.CrudDao
;
import
java.util.List
;
import
com.ejweb.core.persistence.annotation.MyBatisDao
;
import
com.ejweb.modules.contact.entity.SoundRecordingEntity
;
import
com.ejweb.core.persistence.CrudDao
;
import
com.ejweb.core.persistence.annotation.MyBatisDao
;
@MyBatisDao
import
com.ejweb.modules.contact.entity.SoundRecordingEntity
;
public
interface
SoundRecordingDao
extends
CrudDao
<
SoundRecordingEntity
>
{
@MyBatisDao
}
public
interface
SoundRecordingDao
extends
CrudDao
<
SoundRecordingEntity
>
{
List
<
SoundRecordingEntity
>
findRecordingList
(
SoundRecordingEntity
entityTmp
);
}
src/com/ejweb/modules/contact/service/SoundRecordingService.java
View file @
18c2ff27
package
com
.
ejweb
.
modules
.
contact
.
service
;
package
com
.
ejweb
.
modules
.
contact
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.ejweb.core.fetcher.HttpClientUtil
;
import
com.ejweb.core.fetcher.HttpClientUtil
;
import
com.ejweb.core.persistence.Page
;
import
com.ejweb.core.persistence.Page
;
import
com.ejweb.core.service.CrudService
;
import
com.ejweb.core.service.CrudService
;
import
com.ejweb.core.utils.StringUtils
;
import
com.ejweb.core.utils.StringUtils
;
import
com.ejweb.modules.contact.dao.SoundRecordingDao
;
import
com.ejweb.modules.contact.dao.SoundRecordingDao
;
import
com.ejweb.modules.contact.entity.SoundRecordingEntity
;
import
com.ejweb.modules.contact.entity.SoundRecordingEntity
;
import
com.ejweb.modules.contact.entity.SoundRecordingResponseEntity
;
import
com.ejweb.modules.contact.entity.SoundRecordingResponseEntity
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
/**
/**
* 聊天记录Service
* 聊天记录Service
* @author lyw
* @author lyw
*
*
*/
*/
@Service
@Service
public
class
SoundRecordingService
extends
CrudService
<
SoundRecordingDao
,
SoundRecordingEntity
>
{
public
class
SoundRecordingService
extends
CrudService
<
SoundRecordingDao
,
SoundRecordingEntity
>
{
@Value
(
"${foc.sound.records.url}"
)
@Value
(
"${foc.sound.records.url}"
)
private
String
soundRecordingUrl
;
private
String
soundRecordingUrl
;
public
Page
<
SoundRecordingEntity
>
getPage
(
Page
<
SoundRecordingEntity
>
page
,
SoundRecordingEntity
soundRecordingEntity
)
{
public
Page
<
SoundRecordingEntity
>
getPage
(
Page
<
SoundRecordingEntity
>
page
,
SoundRecordingEntity
soundRecordingEntity
)
{
soundRecordingEntity
.
setPage
(
page
);
soundRecordingEntity
.
setPage
(
page
);
String
url
=
soundRecordingUrl
;
String
url
=
soundRecordingUrl
;
Map
<
String
,
String
>
params
=
new
HashMap
<>();
Map
<
String
,
String
>
params
=
new
HashMap
<>();
params
.
put
(
"pageNo"
,
String
.
valueOf
(
soundRecordingEntity
.
getPage
().
getPageNo
()));
params
.
put
(
"pageNo"
,
String
.
valueOf
(
soundRecordingEntity
.
getPage
().
getPageNo
()));
params
.
put
(
"pageSize"
,
String
.
valueOf
(
soundRecordingEntity
.
getPage
().
getPageSize
()));
params
.
put
(
"pageSize"
,
String
.
valueOf
(
soundRecordingEntity
.
getPage
().
getPageSize
()));
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getBeginTime
()))
{
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getBeginTime
()))
{
params
.
put
(
"beginTime"
,
soundRecordingEntity
.
getBeginTime
());
params
.
put
(
"beginTime"
,
soundRecordingEntity
.
getBeginTime
());
}
}
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getEndTime
()))
{
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getEndTime
()))
{
params
.
put
(
"endTime"
,
soundRecordingEntity
.
getEndTime
());
params
.
put
(
"endTime"
,
soundRecordingEntity
.
getEndTime
());
}
}
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getCallName
()))
{
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getCallName
()))
{
params
.
put
(
"callUserName"
,
soundRecordingEntity
.
getCallName
());
params
.
put
(
"callUserName"
,
soundRecordingEntity
.
getCallName
());
}
}
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getAcceptName
()))
{
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getAcceptName
()))
{
params
.
put
(
"acceptUserName"
,
soundRecordingEntity
.
getAcceptName
());
params
.
put
(
"acceptUserName"
,
soundRecordingEntity
.
getAcceptName
());
}
}
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getCallUserNo
()))
{
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getCallUserNo
()))
{
params
.
put
(
"callUserNo"
,
soundRecordingEntity
.
getCallUserNo
());
params
.
put
(
"callUserNo"
,
soundRecordingEntity
.
getCallUserNo
());
}
}
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getAcceptUserNo
()))
{
if
(
StringUtils
.
isNotBlank
(
soundRecordingEntity
.
getAcceptUserNo
()))
{
params
.
put
(
"acceptUserNo"
,
soundRecordingEntity
.
getAcceptUserNo
());
params
.
put
(
"acceptUserNo"
,
soundRecordingEntity
.
getAcceptUserNo
());
}
}
String
res
=
HttpClientUtil
.
doPost
(
url
,
params
,
"UTF-8"
);
String
res
=
HttpClientUtil
.
doPost
(
url
,
params
,
"UTF-8"
);
HashMap
returnResult
=
JSON
.
parseObject
(
res
,
HashMap
.
class
);
HashMap
returnResult
=
JSON
.
parseObject
(
res
,
HashMap
.
class
);
// Page<SoundRecordingEntity> pageReturnResult = new Page<>();
// Page<SoundRecordingEntity> pageReturnResult = new Page<>();
if
(
"2000"
.
equals
(
returnResult
.
get
(
"status"
)))
{
if
(
"2000"
.
equals
(
returnResult
.
get
(
"status"
)))
{
SoundRecordingResponseEntity
responseEntity
=
JSON
.
parseObject
(
returnResult
.
get
(
"data"
).
toString
(),
SoundRecordingResponseEntity
.
class
);
SoundRecordingResponseEntity
responseEntity
=
JSON
.
parseObject
(
returnResult
.
get
(
"data"
).
toString
(),
SoundRecordingResponseEntity
.
class
);
if
(
responseEntity
!=
null
)
{
if
(
responseEntity
!=
null
)
{
page
.
setCount
(
responseEntity
.
getCount
());
page
.
setCount
(
responseEntity
.
getCount
());
page
.
setList
(
responseEntity
.
getList
());
page
.
setList
(
responseEntity
.
getList
());
page
.
setPageNo
(
responseEntity
.
getPageNo
());
page
.
setPageNo
(
responseEntity
.
getPageNo
());
page
.
setPageSize
(
responseEntity
.
getPageSize
());
page
.
setPageSize
(
responseEntity
.
getPageSize
());
}
}
}
}
System
.
out
.
print
(
res
);
System
.
out
.
print
(
res
);
return
page
;
return
page
;
}
}
}
public
List
<
SoundRecordingEntity
>
findRecordingList
(
SoundRecordingEntity
entityTmp
)
{
// TODO Auto-generated method stub
return
dao
.
findRecordingList
(
entityTmp
);
}
}
src/com/ejweb/modules/contact/web/SoundRecordingController.java
View file @
18c2ff27
package
com
.
ejweb
.
modules
.
contact
.
web
;
package
com
.
ejweb
.
modules
.
contact
.
web
;
import
com.ejweb.core.base.BaseController
;
import
com.ejweb.core.base.BaseController
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.persistence.Page
;
import
com.ejweb.core.persistence.Page
;
import
com.ejweb.modules.contact.entity.SeatEntity
;
import
com.ejweb.modules.contact.entity.SeatEntity
;
import
com.ejweb.modules.contact.entity.SoundRecordingEntity
;
import
com.ejweb.modules.contact.entity.SoundRecordingEntity
;
import
com.ejweb.modules.contact.service.SoundRecordingService
;
import
com.ejweb.modules.contact.service.SoundRecordingService
;
import
com.ejweb.modules.contact.service.UserProfileServce
;
import
com.ejweb.modules.contact.service.UserProfileServce
;
import
com.ejweb.modules.sys.entity.Role
;
import
com.ejweb.modules.sys.entity.Role
;
import
com.ejweb.modules.sys.entity.User
;
import
com.ejweb.modules.sys.entity.User
;
import
com.ejweb.modules.sys.utils.UserUtils
;
import
com.ejweb.modules.sys.utils.UserUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.apache.shiro.authz.annotation.RequiresPermissions
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.ui.Model
;
import
org.springframework.ui.Model
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
org.springframework.web.servlet.mvc.support.RedirectAttributes
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.io.*
;
import
java.net.HttpURLConnection
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.Date
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Date
;
import
java.util.List
;
/**
* 录音管理Controller
/**
* @author lyw
* 录音管理Controller
*
* @author lyw
*/
*
@Controller
*/
@RequestMapping
(
value
=
"${adminPath}/contact/soundRecording/"
)
@Controller
public
class
SoundRecordingController
extends
BaseController
{
@RequestMapping
(
value
=
"${adminPath}/contact/soundRecording/"
)
public
class
SoundRecordingController
extends
BaseController
{
@Autowired
private
SoundRecordingService
soundRecordingService
;
@Autowired
@Autowired
private
SoundRecordingService
soundRecordingService
;
private
UserProfileServce
userProfileService
;
@Autowired
private
UserProfileServce
userProfileService
;
@RequiresPermissions
(
"im:soundRecording:view"
)
@RequestMapping
(
value
=
"list"
)
@RequiresPermissions
(
"im:soundRecording:view"
)
public
String
list
(
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
,
SoundRecordingEntity
soundRecordingEntity
)
{
@RequestMapping
(
value
=
"list"
)
Page
<
SoundRecordingEntity
>
page
=
soundRecordingService
.
getPage
(
new
Page
<
SoundRecordingEntity
>(
request
,
response
),
soundRecordingEntity
);
public
String
list
(
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
,
SoundRecordingEntity
soundRecordingEntity
)
{
if
(
page
!=
null
&&
!
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
Page
<
SoundRecordingEntity
>
page
=
soundRecordingService
.
getPage
(
new
Page
<
SoundRecordingEntity
>(
request
,
response
),
soundRecordingEntity
);
String
proxy
=
GConstants
.
getValue
(
"foc.sound.records.proxy"
,
"https://ifos.jdair.net/sounds/"
);
if
(
page
!=
null
&&
!
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
for
(
SoundRecordingEntity
entityTmp
:
page
.
getList
())
{
String
proxy
=
GConstants
.
getValue
(
"foc.sound.records.proxy"
,
"https://ifos.jdair.net/sounds/"
);
if
(
StringUtils
.
isNotBlank
(
entityTmp
.
getDownloadUrl
()))
{
for
(
SoundRecordingEntity
entityTmp
:
page
.
getList
())
{
entityTmp
.
setDownloadUrl
(
entityTmp
.
getDownloadUrl
().
replaceAll
(
".{4,5}://.*?(/|\\\\)"
,
proxy
).
replaceAll
(
"\\\\"
,
"/"
));
if
(
StringUtils
.
isNotBlank
(
entityTmp
.
getDownloadUrl
()))
{
}
entityTmp
.
setDownloadUrl
(
entityTmp
.
getDownloadUrl
().
replaceAll
(
".{4,5}://.*?(/|\\\\)"
,
proxy
).
replaceAll
(
"\\\\"
,
"/"
));
}
}
}
}
model
.
addAttribute
(
"page"
,
page
);
}
return
"modules/contact/soundRecordingList"
;
model
.
addAttribute
(
"page"
,
page
);
}
return
"modules/contact/soundRecordingList"
;
@RequiresPermissions
(
"im:soundRecording:view"
)
}
@RequestMapping
(
value
=
"newList"
)
@RequiresPermissions
(
"im:soundRecording:view"
)
public
String
newList
(
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
,
SoundRecordingEntity
soundRecordingEntity
)
{
@RequestMapping
(
value
=
"newList"
)
//Page<SoundRecordingEntity> page = soundRecordingService.getPage(new Page<SoundRecordingEntity>(request, response), soundRecordingEntity);
public
String
newList
(
Model
model
,
HttpServletRequest
request
,
HttpServletResponse
response
,
SoundRecordingEntity
soundRecordingEntity
)
{
User
user
=
UserUtils
.
getUser
();
//Page<SoundRecordingEntity> page = soundRecordingService.getPage(new Page<SoundRecordingEntity>(request, response), soundRecordingEntity);
User
user
=
UserUtils
.
getUser
();
List
<
SeatEntity
>
list
=
userProfileService
.
getSeatList
(
user
.
getId
());
//查询录音权限
if
(
StringUtils
.
isEmpty
(
soundRecordingEntity
.
getBeginTime
())){
List
<
SeatEntity
>
list
=
userProfileService
.
getSeatList
(
user
.
getId
());
//查询录音权限
if
(
StringUtils
.
isEmpty
(
soundRecordingEntity
.
getBeginTime
())){
Date
current
=
new
Date
();
Date
startTime
=
new
Date
(
current
.
getTime
()-
36
*
60
*
60
*
1000
);
Date
current
=
new
Date
();
soundRecordingEntity
.
setBeginTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
));
Date
startTime
=
new
Date
(
current
.
getTime
()-
36
*
60
*
60
*
1000
);
soundRecordingEntity
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
soundRecordingEntity
.
setBeginTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd HH:mm:ss"
));
}
soundRecordingEntity
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
soundRecordingEntity
.
setSeatList
(
list
);
}
Page
<
SoundRecordingEntity
>
page
=
soundRecordingService
.
findPage
(
new
Page
<
SoundRecordingEntity
>(
request
,
response
),
soundRecordingEntity
);
soundRecordingEntity
.
setSeatList
(
list
);
Page
<
SoundRecordingEntity
>
page
=
soundRecordingService
.
findPage
(
new
Page
<
SoundRecordingEntity
>(
request
,
response
),
soundRecordingEntity
);
if
(
page
!=
null
&&
!
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
if
(
page
!=
null
&&
!
CollectionUtils
.
isEmpty
(
page
.
getList
()))
{
String
proxy
=
GConstants
.
getValue
(
"foc.sound.records.proxy"
,
"https://ifos.jdair.net/sounds/"
);
if
(
StringUtils
.
isNoneBlank
(
proxy
)){
String
proxy
=
GConstants
.
getValue
(
"foc.sound.records.proxy"
,
"https://ifos.jdair.net/sounds/"
);
proxy
=
"https://ifos.jdair.net/sounds/"
;
if
(
StringUtils
.
isNoneBlank
(
proxy
)){
}
proxy
=
"https://ifos.jdair.net/sounds/"
;
for
(
SoundRecordingEntity
entityTmp
:
page
.
getList
())
{
}
if
(
StringUtils
.
isNotBlank
(
entityTmp
.
getDownloadUrl
()))
{
List
<
SoundRecordingEntity
>
templist
=
new
ArrayList
<
SoundRecordingEntity
>();
entityTmp
.
setDownloadUrl
(
entityTmp
.
getDownloadUrl
().
replaceAll
(
".{4,5}://.*?(/|\\\\)"
,
proxy
).
replaceAll
(
"\\\\"
,
"/"
));
for
(
SoundRecordingEntity
entityTmp
:
page
.
getList
())
{
}
if
(
StringUtils
.
isNotBlank
(
entityTmp
.
getDownloadUrl
()))
{
}
entityTmp
.
setDownloadUrl
(
entityTmp
.
getDownloadUrl
().
replaceAll
(
".{4,5}://.*?(/|\\\\)"
,
proxy
).
replaceAll
(
"\\\\"
,
"/"
));
}
}
model
.
addAttribute
(
"page"
,
page
);
List
<
SoundRecordingEntity
>
entity
=
soundRecordingService
.
findRecordingList
(
entityTmp
);
return
"modules/contact/soundRecordingList"
;
if
(
entity
.
size
()>
0
){
}
templist
.
add
(
entityTmp
);
@RequiresPermissions
(
"im:soundRecording:view"
)
}
@RequestMapping
(
value
=
"download"
)
}
public
void
download
(
HttpServletRequest
request
,
HttpServletResponse
response
,
SoundRecordingEntity
soundRecordingEntity
,
RedirectAttributes
redirectAttributes
)
{
if
(
templist
.
size
()>
0
){
if
(
soundRecordingEntity
==
null
||
StringUtils
.
isBlank
(
soundRecordingEntity
.
getDownloadUrl
()))
{
page
.
getList
().
removeAll
(
templist
);
addMessage
(
redirectAttributes
,
"下载路径有问题"
);
}
return
;
}
}
model
.
addAttribute
(
"page"
,
page
);
soundRecordingEntity
.
setDownloadUrl
(
soundRecordingEntity
.
getDownloadUrl
().
replaceAll
(
"\\\\"
,
"/"
));
return
"modules/contact/soundRecordingList"
;
ServletOutputStream
outputStream
=
null
;
}
InputStream
inputStream
=
null
;
@RequiresPermissions
(
"im:soundRecording:view"
)
HttpURLConnection
urlCon
=
null
;
@RequestMapping
(
value
=
"download"
)
try
{
public
void
download
(
HttpServletRequest
request
,
HttpServletResponse
response
,
SoundRecordingEntity
soundRecordingEntity
,
RedirectAttributes
redirectAttributes
)
{
String
fileName
=
soundRecordingEntity
.
getDownloadUrl
().
substring
(
soundRecordingEntity
.
getDownloadUrl
().
lastIndexOf
(
"/"
)
+
1
,
soundRecordingEntity
.
getDownloadUrl
().
length
());
if
(
soundRecordingEntity
==
null
||
StringUtils
.
isBlank
(
soundRecordingEntity
.
getDownloadUrl
()))
{
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
new
String
(
fileName
.
getBytes
(
"gbk"
),
"ISO8859-1"
));
addMessage
(
redirectAttributes
,
"下载路径有问题"
);
outputStream
=
response
.
getOutputStream
();
return
;
URL
url
=
new
URL
(
soundRecordingEntity
.
getDownloadUrl
());
}
urlCon
=
(
HttpURLConnection
)
url
.
openConnection
();
soundRecordingEntity
.
setDownloadUrl
(
soundRecordingEntity
.
getDownloadUrl
().
replaceAll
(
"\\\\"
,
"/"
));
urlCon
.
setConnectTimeout
(
30000
);
ServletOutputStream
outputStream
=
null
;
urlCon
.
setReadTimeout
(
30000
);
//最多连接30秒
InputStream
inputStream
=
null
;
inputStream
=
urlCon
.
getInputStream
();
HttpURLConnection
urlCon
=
null
;
byte
[]
bytes
=
new
byte
[
1024
];
try
{
int
len
=
0
;
String
fileName
=
soundRecordingEntity
.
getDownloadUrl
().
substring
(
soundRecordingEntity
.
getDownloadUrl
().
lastIndexOf
(
"/"
)
+
1
,
soundRecordingEntity
.
getDownloadUrl
().
length
());
while
((
len
=
inputStream
.
read
(
bytes
,
0
,
bytes
.
length
))
!=
-
1
)
{
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
new
String
(
fileName
.
getBytes
(
"gbk"
),
"ISO8859-1"
));
outputStream
.
write
(
bytes
,
0
,
len
);
outputStream
=
response
.
getOutputStream
();
outputStream
.
flush
();
URL
url
=
new
URL
(
soundRecordingEntity
.
getDownloadUrl
());
}
urlCon
=
(
HttpURLConnection
)
url
.
openConnection
();
}
catch
(
IOException
e
)
{
urlCon
.
setConnectTimeout
(
30000
);
e
.
printStackTrace
();
urlCon
.
setReadTimeout
(
30000
);
//最多连接30秒
}
finally
{
inputStream
=
urlCon
.
getInputStream
();
if
(
urlCon
!=
null
)
{
urlCon
.
disconnect
();}
byte
[]
bytes
=
new
byte
[
1024
];
try
{
int
len
=
0
;
if
(
inputStream
!=
null
)
{
inputStream
.
close
();}
while
((
len
=
inputStream
.
read
(
bytes
,
0
,
bytes
.
length
))
!=
-
1
)
{
if
(
outputStream
!=
null
)
{
outputStream
.
close
();}
outputStream
.
write
(
bytes
,
0
,
len
);
}
catch
(
IOException
e
)
{
outputStream
.
flush
();
e
.
printStackTrace
();
}
}
}
catch
(
IOException
e
)
{
}
e
.
printStackTrace
();
}
}
finally
{
}
if
(
urlCon
!=
null
)
{
urlCon
.
disconnect
();}
try
{
if
(
inputStream
!=
null
)
{
inputStream
.
close
();}
if
(
outputStream
!=
null
)
{
outputStream
.
close
();}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
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