Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
api
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
首航-临时账号
api
Commits
e031a93d
Commit
e031a93d
authored
Jan 07, 2022
by
罗胜
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2022-01-07 00:02
1.油量分析和导出excel从单表获取数据
parent
03465474
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
2051 additions
and
1707 deletions
+2051
-1707
OilAnalysisDao.xml
resources/mapper/modules/airport/OilAnalysisDao.xml
+210
-3
CallDao.xml
resources/mapper/modules/call/CallDao.xml
+508
-507
RequestBean.java
src/com/ejweb/core/api/RequestBean.java
+1
-0
BasicVerifyFilter.java
src/com/ejweb/core/filter/BasicVerifyFilter.java
+5
-0
OilAnalysisController.java
src/com/ejweb/modules/airport/api/OilAnalysisController.java
+7
-0
OilAnalysisDao.java
src/com/ejweb/modules/airport/dao/OilAnalysisDao.java
+3
-0
OilAnalysisEntity.java
src/com/ejweb/modules/airport/entity/OilAnalysisEntity.java
+101
-0
OilAnalysisService.java
src/com/ejweb/modules/airport/service/OilAnalysisService.java
+9
-4
CallController.java
src/com/ejweb/modules/call/api/CallController.java
+804
-800
CallService.java
src/com/ejweb/modules/call/service/CallService.java
+393
-393
UserController.java
src/com/ejweb/modules/user/api/UserController.java
+3
-0
web.xml
web/WEB-INF/web.xml
+7
-0
No files found.
resources/mapper/modules/airport/OilAnalysisDao.xml
View file @
e031a93d
<?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">
<mapper
namespace=
"com.ejweb.modules.airport.dao.OilAnalysisDao"
>
<select
id=
"get
OilAnalysisData
"
resultType=
"com.ejweb.modules.airport.entity.OilAnalysisEntity"
>
<select
id=
"get
ExcelOilAnalysisData1
"
resultType=
"com.ejweb.modules.airport.entity.OilAnalysisEntity"
>
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i:%s')as stdExcel,
sta.flight_no,
...
...
@@ -18,8 +18,17 @@
airdep.city_name as depAirPortName,
airArr.airport_icao as arrIcaoId,
airdep.airport_icao as depIcaoId,
IFNULL(fat.verify_ac_type,'') as acTypeName
IFNULL(fat.verify_ac_type,'') as acTypeName,
sta.airline_oil,
sta.remark_msg,
sta.alt1_fuel,
sta.alt1_distance,
sta.alt1_time,
sta.alt2_fuel,
sta.alt2_time,
sta.alt2_distance,
sta.cruising_altitude,
sta.e_e_t as eet
from foc_flight_dynamics_sta sta
left join foc_airports airArr on airArr.airport_iata = sta.arr_iata_id
left join foc_airports airdep on airdep.airport_iata = sta.dep_iata_id
...
...
@@ -69,4 +78,201 @@
</select>
<select
id=
"getExcelOilAnalysisData"
resultType=
"com.ejweb.modules.airport.entity.OilAnalysisEntity"
>
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i:%s')as stdExcel,
sta.flight_no,
sta.ac_no,
sta.dispatcher_name,
IFNULL(sta.dispatcher_account,'') as dispatcherAccount,
sta.total_oil,
sta.dep_iata_id,
sta.arr_iata_id,
sta.extra_oil_fuel_reason,
DATE_FORMAT(sta.update_date, '%Y/%m/%d')as updateDate,
DATE_FORMAT(sta.update_time, '%Y/%m/%d %H:%i:%s')as updateTime,
sta.arr_air_port_name,
sta.dep_air_port_name,
sta.arr_icao_id,
sta.dep_icao_id,
IFNULL(sta.ac_type_name,'') as acTypeName,
sta.airline_oil,
sta.remark_msg,
sta.alt1_fuel,
sta.alt1_distance,
sta.alt1_time,
sta.alt2_fuel,
sta.alt2_time,
sta.alt2_distance,
sta.cruising_altitude,
sta.e_e_t as eet
from foc_flight_dynamics_sta sta
where 1=1
<if
test=
"arrIata!=null and arrIata!='' "
>
and sta.arr_iata_id = #{arrIata}
</if>
<if
test=
"depIata!=null and depIata!='' "
>
and sta.dep_iata_id = #{depIata}
</if>
<if
test=
"flightNo!=null and flightNo!='' "
>
and sta.flight_no = #{flightNo}
</if>
<if
test=
"dispatcherZH!=null and dispatcherZH!=''"
>
and sta.dispatcher_account LIKE CONCAT('%',#{dispatcherZH}, '%')
</if>
<if
test=
"dispatcherENG!=null and dispatcherENG!=''"
>
and sta.dispatcher_name LIKE CONCAT('%',#{dispatcherENG}, '%')
</if>
<if
test=
"minDepTime !=null and minDepTime!=''"
>
and sta.std
<![CDATA[>=]]>
date_format(#{minDepTime},'%Y-%c-%d %H:%i')
</if>
<if
test=
"maxDepTime !=null and maxDepTime!=''"
>
and sta.std
<![CDATA[<]]>
date_format(#{maxDepTime},'%Y-%c-%d %H:%i')
</if>
<if
test=
"mintotalOil !=null and mintotalOil!=''"
>
and substring_index(sta.total_oil,'KGS',1) >= #{mintotalOil}
</if>
<if
test=
"maxtotalOil !=null and maxtotalOil!=''"
>
and substring_index(sta.total_oil,'KGS',1)
<![CDATA[<]]>
#{maxtotalOil}
</if>
group by sta.std,sta.flight_no
order by sta.std desc
</select>
<select
id=
"getOilAnalysisData1"
resultType=
"com.ejweb.modules.airport.entity.OilAnalysisEntity"
>
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
sta.flight_no,
sta.ac_no,
sta.dispatcher_name,
IFNULL(u.name,'') as dispatcherAccount,
sta.total_oil,
sta.dep_iata_id,
sta.arr_iata_id,
sta.extra_oil_fuel_reason,
airArr.city_name as arrAirPortName,
airdep.city_name as depAirPortName,
DATE_FORMAT(sta.update_date, '%Y/%m/%d')as updateDate,
DATE_FORMAT(sta.update_time, '%Y/%m/%d %H:%i:%s')as updateTime,
IFNULL(acType.type_name,'') as acTypeName
from foc_flight_dynamics_sta sta
left join foc_airports airArr on airArr.LoginName = sta.arr_iata_id
left join foc_airports airdep on airdep.airport_iata = sta.dep_iata_id
left join foc_ac_type acType on acType.flight_no = sta.ac_no
left join sys_user u on u.login_name = sta.dispatcher_name
where 1=1
<if
test=
"arrIata!=null and arrIata!='' "
>
and sta.arr_iata_id = #{arrIata}
</if>
<if
test=
"depIata!=null and depIata!='' "
>
and sta.dep_iata_id = #{depIata}
</if>
<if
test=
"flightNo!=null and flightNo!='' "
>
and sta.flight_no = #{flightNo}
</if>
<if
test=
"dispatcherZH!=null and dispatcherZH!=''"
>
and u.name LIKE CONCAT('%',#{dispatcherZH}, '%')
</if>
<if
test=
"dispatcherENG!=null and dispatcherENG!=''"
>
and sta.dispatcher_name LIKE CONCAT('%',#{dispatcherENG}, '%')
</if>
<if
test=
"minDepTime !=null and minDepTime!=''"
>
and sta.std
<![CDATA[>=]]>
date_format(#{minDepTime},'%Y-%c-%d %H:%i')
</if>
<if
test=
"maxDepTime !=null and maxDepTime!=''"
>
and sta.std
<![CDATA[<]]>
date_format(#{maxDepTime},'%Y-%c-%d %H:%i')
</if>
<if
test=
"mintotalOil !=null and mintotalOil!=''"
>
and substring_index(sta.total_oil,'KGS',1) >= #{mintotalOil}
</if>
<if
test=
"maxtotalOil !=null and maxtotalOil!=''"
>
and substring_index(sta.total_oil,'KGS',1)
<![CDATA[<]]>
#{maxtotalOil}
</if>
group by sta.std,sta.flight_no
order by sta.std desc
</select>
<select
id=
"getOilAnalysisData"
resultType=
"com.ejweb.modules.airport.entity.OilAnalysisEntity"
>
select DATE_FORMAT(sta.std, '%Y/%m/%d %H:%i')as std,
sta.flight_no,
sta.ac_no,
sta.dispatcher_name,
sta.dispatcher_account,
sta.total_oil,
sta.dep_iata_id,
sta.arr_iata_id,
sta.extra_oil_fuel_reason,
sta.arr_air_port_name,
sta.dep_air_port_name,
DATE_FORMAT(sta.update_date, '%Y/%m/%d')as updateDate,
DATE_FORMAT(sta.update_time, '%Y/%m/%d %H:%i:%s')as updateTime,
sta.ac_type_name
from foc_flight_dynamics_sta sta
where 1=1
<if
test=
"arrIata!=null and arrIata!='' "
>
and sta.arr_iata_id = #{arrIata}
</if>
<if
test=
"depIata!=null and depIata!='' "
>
and sta.dep_iata_id = #{depIata}
</if>
<if
test=
"flightNo!=null and flightNo!='' "
>
and sta.flight_no = #{flightNo}
</if>
<if
test=
"dispatcherZH!=null and dispatcherZH!=''"
>
and u.name LIKE CONCAT('%',#{dispatcherZH}, '%')
</if>
<if
test=
"dispatcherENG!=null and dispatcherENG!=''"
>
and sta.dispatcher_name LIKE CONCAT('%',#{dispatcherENG}, '%')
</if>
<if
test=
"minDepTime !=null and minDepTime!=''"
>
and sta.std
<![CDATA[>=]]>
date_format(#{minDepTime},'%Y-%c-%d %H:%i')
</if>
<if
test=
"maxDepTime !=null and maxDepTime!=''"
>
and sta.std
<![CDATA[<]]>
date_format(#{maxDepTime},'%Y-%c-%d %H:%i')
</if>
<if
test=
"mintotalOil !=null and mintotalOil!=''"
>
and substring_index(sta.total_oil,'KGS',1) >= #{mintotalOil}
</if>
<if
test=
"maxtotalOil !=null and maxtotalOil!=''"
>
and substring_index(sta.total_oil,'KGS',1)
<![CDATA[<]]>
#{maxtotalOil}
</if>
group by sta.std,sta.flight_no
order by sta.std desc
</select>
</mapper>
\ No newline at end of file
resources/mapper/modules/call/CallDao.xml
View file @
e031a93d
<?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">
<mapper
namespace=
"com.ejweb.modules.call.dao.CallDao"
>
<!-- 通话主记录 -->
<insert
id=
"createCallRecord"
>
INSERT INTO foc_call_records(
id,
app_code,
platform,
version_name,
channel_type,
call_type,
user_count,
end_status,
create_by,
create_name,
create_phone,
create_show_phone,
phone_type,
start_time,
end_time,
download_url,
duration
) VALUE (
#{id},
#{appCode},
#{platform},
#{versionName},
#{channelType},
#{callType},
#{userCount},
#{endStatus},
#{createBy},
#{createName},
#{createPhone},
#{createShowPhone},
#{phoneType},
#{startTime},
#{endTime},
#{downloadUrl},
#{duration}
)
</insert>
<select
id=
"getNameByPhone"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT name
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select
id=
"getIdByPhone"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT id
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select
id=
"getNameByPhoneFromSeat"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT seat_name as name
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select
id=
"getIdByPhoneFromSeat"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT id
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<!-- 添加电话号码记录 -->
<insert
id=
"addCallPhoneList"
>
INSERT INTO foc_call_phones(
id,
record_id,
title,
user_id,
username,
phone,
show_phone,
phone_type,
flow,
download_url,
center_records_id
) VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.id},
#{item.recordId},
#{item.title},
#{item.userId},
#{item.username},
#{item.phone},
#{item.showPhone},
#{item.phoneType},
#{item.flow},
#{item.downloadUrl},
#{item.centerRecordsId}
)
</foreach>
</insert>
<update
id=
"updateCallRecord"
>
UPDATE foc_call_records SET end_status=#{endStatus}, end_time=#{endTime} WHERE id=#{id}
</update>
<!-- 获取通话记录列表 -->
<select
id=
"getCallRecordList"
resultType=
"com.ejweb.modules.call.entity.CallRecordListEntity"
>
SELECT
r.id,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto,
r.download_url
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND r.end_status !='INIT'
ORDER BY r.start_time DESC
</select>
<!-- 查重 -->
<select
id=
"get"
resultType=
"com.ejweb.modules.call.entity.CallRecordListEntity"
>
SELECT
r.id,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto,
r.download_url
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.end_status !='INIT'
and r.create_name = #{createName}
and p.username = #{username}
and r.start_time
<
= #{endTime}
ORDER BY r.start_time DESC
</select>
<!-- 通过通话的电话号查询用户信息 -->
<select
id=
"findUserByCallPhone"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT a.id AS userId,
a.name,
a.email,
a.phone,
a.mobile,
a.photo,
a.huawei_num,
a.full_office_name AS officeFullName,
c.name AS companyName,
o.name AS officeName,
p.duty_name,
p.sex,
a.mobile_nubmer,
a.mobile_province,
a.mobile_city,
a.mobile_sp,
'USER' AS type,
'USER' AS fromType
FROM sys_user a
LEFT JOIN sys_office c
ON c.id = a.company_id
LEFT JOIN sys_office o
ON o.id = a.office_id
LEFT JOIN sys_user_profiles p
ON a.id = p.user_id
WHERE a.del_flag = '0'
AND (a.phone = #{phoneNumer}
OR a.huawei_num = #{phoneNumer}
OR a.mobile = #{phoneNumer}
OR a.mobile_nubmer = #{phoneNumer}
OR a.mobile_nubmer = #{mobileNubmer0}
OR a.mobile_nubmer = #{mobileNubmer00}
OR a.phone_number = #{phoneNumer}
OR a.phone_number = #{mobileNubmer0}
OR a.phone_number = #{mobileNubmer00})
ORDER BY a.login_date DESC
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select
id=
"findSeatListByCallPhone"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT s.id AS seatId,
s.id AS userId,
t.station_name,
st.type_name,
s.seat_name,
s.seat_name AS name,
s.seat_phone,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'SEAT' AS fromType
FROM foc_seats s
LEFT JOIN foc_seat_type st
ON s.seat_type=st.id
LEFT JOIN foc_station t
ON st.station_id=t.id
WHERE s.huawei_num = #{phoneNumer}
OR s.seat_phone = #{phoneNumer}
OR s.seat_phone_number = #{phoneNumer}
</select>
<select
id=
"findUserInfoByNumOrId"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type
FROM foc_seats s
WHERE s.huawei_num = #{phoneNumer}
OR s.id = #{userId}
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type
FROM sys_user a
WHERE a.huawei_num = #{phoneNumer}
OR a.id = #{userId}
LIMIT 1
</select>
<!-- 通过通话记录获取来电人信息 -->
<select
id=
"findUserByCallRecord"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT a.`id`,
a.`create_name` AS name,
a.`create_phone`,
a.create_by AS userId,
a.create_by AS seatId,
IF(u.id, 'USER', 'SEAT') AS type,
IF(u.id, u.phone_number, s.seat_phone_number) AS phone_number,
IF(u.id, u.photo, su.photo) AS photo,
s.seat_name,
a.`start_time`,
'RECORD' AS fromType
FROM `foc_sound_records` a
LEFT JOIN sys_user u
ON a.create_by=u.id
LEFT JOIN foc_seats s
ON a.create_by=s.id
LEFT JOIN sys_user su
ON s.login_id=su.id
WHERE a.`start_time` BETWEEN #{startTime} AND #{endTime}
AND a.end_status !='INIT'
HAVING phone_number=#{phoneNumer} OR create_phone= #{phoneNumer}
ORDER BY start_time DESC
LIMIT 1
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select
id=
"getPhoneAreaByAreaCode"
resultType=
"com.ejweb.modules.call.entity.CallPhoneAreaEntity"
>
SELECT * FROM `foc_phone_area` WHERE `area_code`=#{areaCode}
</select>
<!-- 通过手机查询 -->
<select
id=
"getPhoneAreaByMobile"
resultType=
"com.ejweb.modules.call.entity.CallPhoneAreaEntity"
>
SELECT * FROM `foc_phone_area_records` a
WHERE a.mobile=#{mobile}
OR a.mobile_nubmer=#{mobileNubmer0}
OR a.mobile_nubmer=#{mobileNubmer00}
OR a.mobile_nubmer=#{mobileNubmer000}
ORDER BY update_date DESC
LIMIT 1
</select>
<!-- 添加查询记录 -->
<insert
id=
"addPhoneAreaCode"
>
INSERT INTO foc_phone_area(
area_code,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type
) VALUE (
#{areaCode},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type}
)
ON DUPLICATE KEY UPDATE premobile=VALUES(premobile),
mobile_province=VALUES(mobile_province),
mobile_city=VALUES(mobile_city)
</insert>
<!-- 添加查询记录 -->
<insert
id=
"addPhoneAreaRecord"
>
INSERT INTO foc_phone_area_records(
id,
mobile,
mobile_nubmer,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type,
update_date
) VALUE (
#{id},
#{mobile},
#{mobileNubmer},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type},
#{updateDate}
)
</insert>
<!-- 添加安科的录音记录 -->
<insert
id=
"addSoundRecord"
>
INSERT INTO foc_callcenter_records(
id,
call_no,
accept_no,
begin_time,
end_time,
result,
duration,
download_url,
download_size,
current,
current_time_millis,
channel_type,
call_record_id,
foc_begin_time,
foc_end_time,
foc_time_millis,
foc_diff_millis,
create_date
) VALUE (
#{id},
#{callNo},
#{acceptNo},
#{beginTime},
#{endTime},
#{result},
#{duration},
#{downloadUrl},
#{downloadSize},
#{current},
#{currentTimeMillis},
#{channelType},
#{callRecordId},
#{focBeginTime},
#{focEndTime},
#{focTimeMillis},
#{focDiffMillis},
#{createDate}
)
</insert>
<!-- 安科记录 -->
<select
id=
"getCallSoundList"
resultType=
"com.ejweb.modules.call.entity.CallRecordListEntity"
>
SELECT *
FROM (
SELECT
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
r.create_by AS userId,
r.create_name AS username,
r.create_phone AS phone,
CONCAT('由', r.create_name, '发起电话会议') AS title,
'CALLING' AS flow,
u.photo AS userPhoto,
u.photo AS createByPhoto
FROM foc_sound_records r
LEFT JOIN sys_user u
ON r.create_by = u.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND r.end_status !='INIT'
AND r.create_by=#{userId}
AND r.call_type='GROUP'
ORDER BY r.start_time DESC
UNION
SELECT
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND p.phone_type != 'HWNUBMER'
AND r.end_status !='INIT'
AND r.call_type='USER'
ORDER BY r.start_time DESC
) t
ORDER BY t.start_time DESC
</select>
<!-- 通过华为号码查询用户信息 -->
<select
id=
"findPhneListByHuaweiNum"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'' AS mobile
FROM foc_seats s
WHERE s.huawei_num IN
<foreach
collection=
"huweiNumList"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type,
a.mobile
FROM sys_user a
WHERE a.huawei_num IN
<foreach
collection=
"huweiNumList"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</select>
<select
id=
"GetPhoneById"
resultType=
"String"
>
SELECT
CASE WHEN phone_number is not null AND LENGTH(phone_number) >0 THEN phone_number
WHEN mobile is not null AND LENGTH(mobile) >0 THEN mobile
END mobile
FROM sys_user u
WHERE id=#{userId}
UNION
SELECT seat_phone_number FROM foc_seats s
WHERE id=#{userId}
limit 1
</select>
<select
id=
"getMemberList"
resultType=
"com.ejweb.modules.call.entity.MemberEntity"
>
SELECT p.user_id AS userCode,p.username,p.phone,
IFNULL(s.photo,u.photo) AS userPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u on p.user_id=u.id
LEFT JOIN foc_seats s on p.user_id=s.id
WHERE p.record_id=#{recordId}
</select>
<?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">
<mapper
namespace=
"com.ejweb.modules.call.dao.CallDao"
>
<!-- 通话主记录 -->
<insert
id=
"createCallRecord"
>
INSERT INTO foc_call_records(
id,
app_code,
platform,
version_name,
channel_type,
call_type,
user_count,
end_status,
create_by,
create_name,
create_phone,
create_show_phone,
phone_type,
start_time,
end_time,
download_url,
duration
) VALUE (
#{id},
#{appCode},
#{platform},
#{versionName},
#{channelType},
#{callType},
#{userCount},
#{endStatus},
#{createBy},
#{createName},
#{createPhone},
#{createShowPhone},
#{phoneType},
#{startTime},
#{endTime},
#{downloadUrl},
#{duration}
)
</insert>
<select
id=
"getNameByPhone"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT name
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select
id=
"getIdByPhone"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT id
FROM sys_user
WHERE phone= CONCAT('0',#{mobileNubmer})
OR phone_number= CONCAT('00',#{mobileNubmer})
OR mobile= #{mobileNubmer}
OR mobile_nubmer= CONCAT('00',#{mobileNubmer})
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select
id=
"getNameByPhoneFromSeat"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT seat_name as name
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<select
id=
"getIdByPhoneFromSeat"
resultType=
"java.lang.String"
>
<![CDATA[
SELECT id
FROM foc_seats
WHERE seat_phone= #{mobileNubmer}
OR huawei_num= #{mobileNubmer}
limit 1
]]>
</select>
<!-- 添加电话号码记录 -->
<insert
id=
"addCallPhoneList"
>
INSERT INTO foc_call_phones(
id,
record_id,
title,
user_id,
username,
phone,
show_phone,
phone_type,
flow,
download_url,
center_records_id
) VALUES
<foreach
collection=
"list"
item=
"item"
index=
"index"
separator=
","
>
(
#{item.id},
#{item.recordId},
#{item.title},
#{item.userId},
#{item.username},
#{item.phone},
#{item.showPhone},
#{item.phoneType},
#{item.flow},
#{item.downloadUrl},
#{item.centerRecordsId}
)
</foreach>
</insert>
<update
id=
"updateCallRecord"
>
UPDATE foc_call_records SET end_status=#{endStatus}, end_time=#{endTime} WHERE id=#{id}
</update>
<!-- 获取通话记录列表 -->
<select
id=
"getCallRecordList"
resultType=
"com.ejweb.modules.call.entity.CallRecordListEntity"
>
SELECT
r.id,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto,
r.download_url
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND r.end_status !='INIT'
ORDER BY r.start_time DESC
</select>
<!-- 查重 -->
<select
id=
"get"
resultType=
"com.ejweb.modules.call.entity.CallRecordListEntity"
>
SELECT
r.id,
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto,
r.download_url
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.end_status !='INIT'
and r.create_name = #{createName}
and p.username = #{username}
and r.start_time
<
= #{endTime}
ORDER BY r.start_time DESC
</select>
<!-- 通过通话的电话号查询用户信息 -->
<select
id=
"findUserByCallPhone"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT a.id AS userId,
a.name,
a.email,
a.phone,
a.mobile,
a.photo,
a.huawei_num,
a.full_office_name AS officeFullName,
c.name AS companyName,
o.name AS officeName,
p.duty_name,
p.sex,
a.mobile_nubmer,
a.mobile_province,
a.mobile_city,
a.mobile_sp,
'USER' AS type,
'USER' AS fromType
FROM sys_user a
LEFT JOIN sys_office c
ON c.id = a.company_id
LEFT JOIN sys_office o
ON o.id = a.office_id
LEFT JOIN sys_user_profiles p
ON a.id = p.user_id
WHERE a.del_flag = '0'
AND (a.phone = #{phoneNumer}
OR a.huawei_num = #{phoneNumer}
OR a.mobile = #{phoneNumer}
OR a.mobile_nubmer = #{phoneNumer}
OR a.mobile_nubmer = #{mobileNubmer0}
OR a.mobile_nubmer = #{mobileNubmer00}
OR a.phone_number = #{phoneNumer}
OR a.phone_number = #{mobileNubmer0}
OR a.phone_number = #{mobileNubmer00})
ORDER BY a.login_date DESC
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select
id=
"findSeatListByCallPhone"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT s.id AS seatId,
s.id AS userId,
t.station_name,
st.type_name,
s.seat_name,
s.seat_name AS name,
s.seat_phone,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'SEAT' AS fromType
FROM foc_seats s
LEFT JOIN foc_seat_type st
ON s.seat_type=st.id
LEFT JOIN foc_station t
ON st.station_id=t.id
WHERE s.huawei_num = #{phoneNumer}
OR s.seat_phone = #{phoneNumer}
OR s.seat_phone_number = #{phoneNumer}
</select>
<select
id=
"findUserInfoByNumOrId"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type
FROM foc_seats s
WHERE s.huawei_num = #{phoneNumer}
OR s.id = #{userId}
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type
FROM sys_user a
WHERE a.huawei_num = #{phoneNumer}
OR a.id = #{userId}
LIMIT 1
</select>
<!-- 通过通话记录获取来电人信息 -->
<select
id=
"findUserByCallRecord"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT a.`id`,
a.`create_name` AS name,
a.`create_phone`,
a.create_by AS userId,
a.create_by AS seatId,
IF(u.id, 'USER', 'SEAT') AS type,
IF(u.id, u.phone_number, s.seat_phone_number) AS phone_number,
IF(u.id, u.photo, su.photo) AS photo,
s.seat_name,
a.`start_time`,
'RECORD' AS fromType
FROM `foc_sound_records` a
LEFT JOIN sys_user u
ON a.create_by=u.id
LEFT JOIN foc_seats s
ON a.create_by=s.id
LEFT JOIN sys_user su
ON s.login_id=su.id
WHERE a.`start_time` BETWEEN #{startTime} AND #{endTime}
AND a.end_status !='INIT'
HAVING phone_number=#{phoneNumer} OR create_phone= #{phoneNumer}
ORDER BY start_time DESC
LIMIT 1
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select
id=
"getPhoneAreaByAreaCode"
resultType=
"com.ejweb.modules.call.entity.CallPhoneAreaEntity"
>
SELECT * FROM `foc_phone_area` WHERE `area_code`=#{areaCode}
</select>
<!-- 通过手机查询 -->
<select
id=
"getPhoneAreaByMobile"
resultType=
"com.ejweb.modules.call.entity.CallPhoneAreaEntity"
>
SELECT * FROM `foc_phone_area_records` a
WHERE a.mobile=#{mobile}
OR a.mobile_nubmer=#{mobileNubmer0}
OR a.mobile_nubmer=#{mobileNubmer00}
OR a.mobile_nubmer=#{mobileNubmer000}
ORDER BY update_date DESC
LIMIT 1
</select>
<!-- 添加查询记录 -->
<insert
id=
"addPhoneAreaCode"
>
INSERT INTO foc_phone_area(
area_code,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type
) VALUE (
#{areaCode},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type}
)
ON DUPLICATE KEY UPDATE premobile=VALUES(premobile),
mobile_province=VALUES(mobile_province),
mobile_city=VALUES(mobile_city)
</insert>
<!-- 添加查询记录 -->
<insert
id=
"addPhoneAreaRecord"
>
INSERT INTO foc_phone_area_records(
id,
mobile,
mobile_nubmer,
premobile,
mobile_province,
mobile_city,
mobile_sp,
type,
update_date
) VALUE (
#{id},
#{mobile},
#{mobileNubmer},
#{premobile},
#{mobileProvince},
#{mobileCity},
#{mobileSp},
#{type},
#{updateDate}
)
</insert>
<!-- 添加安科的录音记录 -->
<insert
id=
"addSoundRecord"
>
INSERT INTO foc_callcenter_records(
id,
call_no,
accept_no,
begin_time,
end_time,
result,
duration,
download_url,
download_size,
current,
current_time_millis,
channel_type,
call_record_id,
foc_begin_time,
foc_end_time,
foc_time_millis,
foc_diff_millis,
create_date
) VALUE (
#{id},
#{callNo},
#{acceptNo},
#{beginTime},
#{endTime},
#{result},
#{duration},
#{downloadUrl},
#{downloadSize},
#{current},
#{currentTimeMillis},
#{channelType},
#{callRecordId},
#{focBeginTime},
#{focEndTime},
#{focTimeMillis},
#{focDiffMillis},
#{createDate}
)
</insert>
<!-- 安科记录 -->
<select
id=
"getCallSoundList"
resultType=
"com.ejweb.modules.call.entity.CallRecordListEntity"
>
SELECT *
FROM (
SELECT
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
r.create_by AS userId,
r.create_name AS username,
r.create_phone AS phone,
CONCAT('由', r.create_name, '发起电话会议') AS title,
'CALLING' AS flow,
u.photo AS userPhoto,
u.photo AS createByPhoto
FROM foc_sound_records r
LEFT JOIN sys_user u
ON r.create_by = u.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND r.end_status !='INIT'
AND r.create_by=#{userId}
AND r.call_type='GROUP'
ORDER BY r.start_time DESC
UNION
SELECT
r.create_by,
r.create_name,
r.create_phone,
r.call_type,
r.end_status,
r.user_count,
r.start_time,
r.end_time,
p.user_id AS userId,
p.username,
p.phone,
p.title,
p.flow,
u.photo AS userPhoto,
uu.photo AS createByPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u
ON p.user_id = u.id
LEFT JOIN foc_sound_records r
ON p.record_id=r.id
LEFT JOIN sys_user uu
ON r.create_by = uu.id
WHERE r.start_time BETWEEN #{startTime} AND #{endTime}
AND (p.user_id=#{userId} OR r.create_by=#{userId})
AND p.phone_type != 'HWNUBMER'
AND r.end_status !='INIT'
AND r.call_type='USER'
ORDER BY r.start_time DESC
) t
ORDER BY t.start_time DESC
</select>
<!-- 通过华为号码查询用户信息 -->
<select
id=
"findPhneListByHuaweiNum"
resultType=
"com.ejweb.modules.call.entity.CallPhoneInfoListEntity"
>
SELECT s.id AS userId,
s.seat_name AS name,
s.seat_phone AS phone,
s.huawei_num,
'SEAT' AS type,
'' AS mobile
FROM foc_seats s
WHERE s.huawei_num IN
<foreach
collection=
"huweiNumList"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
UNION
SELECT a.id AS userId,
a.name,
a.phone,
a.huawei_num,
'USER' AS type,
a.mobile
FROM sys_user a
WHERE a.huawei_num IN
<foreach
collection=
"huweiNumList"
open=
"("
close=
")"
separator=
","
item=
"item"
>
#{item}
</foreach>
</select>
<select
id=
"GetPhoneById"
resultType=
"String"
>
SELECT
CASE WHEN phone_number is not null AND LENGTH(phone_number) >0 THEN phone_number
WHEN mobile is not null AND LENGTH(mobile) >0 THEN mobile
END mobile
FROM sys_user u
WHERE id=#{userId}
UNION
SELECT seat_phone_number FROM foc_seats s
WHERE id=#{userId}
limit 1
</select>
<select
id=
"getMemberList"
resultType=
"com.ejweb.modules.call.entity.MemberEntity"
>
SELECT p.user_id AS userCode,p.username,p.phone,
IFNULL(s.photo,u.photo) AS userPhoto
FROM foc_sound_phones p
LEFT JOIN sys_user u on p.user_id=u.id
LEFT JOIN foc_seats s on p.user_id=s.id
WHERE p.record_id=#{recordId}
</select>
</mapper>
\ No newline at end of file
src/com/ejweb/core/api/RequestBean.java
View file @
e031a93d
...
...
@@ -78,4 +78,5 @@ public class RequestBean {
public
String
toString
()
{
return
JSON
.
toJSONString
(
this
);
}
}
src/com/ejweb/core/filter/BasicVerifyFilter.java
View file @
e031a93d
...
...
@@ -111,6 +111,7 @@ public class BasicVerifyFilter implements Filter {
if
(
content
!=
null
)
{
message
=
"无效请求"
;
BaseUserBean
baseUserBean
=
JSON
.
parseObject
(
content
,
BaseUserBean
.
class
);
// BaseUserBean baseUserBean = JSON.parseObject("{\"userSign\":\"1000849147\"}", BaseUserBean.class); //测试使用
String
userSign
=
baseUserBean
.
getUserSign
();
if
(
userSign
!=
null
&&
!
""
.
equals
(
userSign
)
&&
!
"undefind"
.
equals
(
userSign
))
{
ServletContext
context
=
request
.
getServletContext
();
...
...
@@ -161,4 +162,8 @@ public class BasicVerifyFilter implements Filter {
}
}
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
1638349534590L
-
1638349534589L
);
}
}
src/com/ejweb/modules/airport/api/OilAnalysisController.java
View file @
e031a93d
...
...
@@ -12,7 +12,9 @@ import com.ejweb.modules.airport.entity.OilAnalysisEntity;
import
com.ejweb.modules.airport.service.OilAnalysisService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -33,6 +35,9 @@ public class OilAnalysisController {
PageEntity
<
OilAnalysisEntity
>
list
=
null
;
ResponseBean
responseBean
=
new
ResponseBean
();
OilAnalysisBean
bean
=
requestBean
.
getObjectBean
(
OilAnalysisBean
.
class
);
// OilAnalysisBean bean =new OilAnalysisBean(); //测试使用
// bean.setPageNo(20);
// bean.setPageSize(10);
list
=
oilAnalysisService
.
getAnalysisData
(
bean
,
true
);
if
(
list
==
null
)
{
responseBean
.
setMessage
(
GConstants
.
EMPTY
);
...
...
@@ -46,6 +51,7 @@ public class OilAnalysisController {
return
responseBean
;
}
@RequestMapping
(
value
=
"/oilAnalysisExport"
)
public
ResponseBean
newExport
(
RequestBean
requestBean
,
HttpServletResponse
response
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
...
...
@@ -59,6 +65,7 @@ public class OilAnalysisController {
String
fileName
=
"油量分析统计(油量单位:KGS).xlsx"
;
try
{
new
ExportExcel
(
"油量分析统计(油量单位:KGS)"
,
OilAnalysisEntity
.
class
).
setDataList
(
list
).
write
(
response
,
fileName
).
dispose
();
// new ExportExcel("油量分析统计(油量单位:KGS)", OilAnalysisEntity.class).setDataList(list).writeFile("D:\\"+fileName).dispose();
}
catch
(
IOException
e
)
{
responseBean
.
setMessage
(
"导出数据失败"
+
e
.
getMessage
());
return
responseBean
;
...
...
src/com/ejweb/modules/airport/dao/OilAnalysisDao.java
View file @
e031a93d
...
...
@@ -12,4 +12,7 @@ public interface OilAnalysisDao extends BaseDao {
// 查询油量分析数据
List
<
OilAnalysisEntity
>
getOilAnalysisData
(
OilAnalysisBean
bean
);
// 导出查询油量分析数据
List
<
OilAnalysisEntity
>
getExcelOilAnalysisData
(
OilAnalysisBean
bean
);
}
src/com/ejweb/modules/airport/entity/OilAnalysisEntity.java
View file @
e031a93d
...
...
@@ -79,11 +79,112 @@ public class OilAnalysisEntity {
@ExcelField
(
title
=
"数据更新时间"
,
type
=
0
,
align
=
1
,
sort
=
50
)
private
String
updateTime
;
// 数据更新时间
@ExcelField
(
title
=
"航线耗油"
,
type
=
0
,
align
=
1
,
sort
=
51
)
private
String
airlineOil
;
// 航线耗油
@ExcelField
(
title
=
"签派放行备注"
,
type
=
0
,
align
=
1
,
sort
=
52
)
private
String
remarkMsg
;
// 签派放行备注
@ExcelField
(
title
=
"目的机场到第一备降所需油量"
,
type
=
0
,
align
=
1
,
sort
=
53
)
private
String
alt1Fuel
;
// 目的机场到第一备降所需油量
@ExcelField
(
title
=
"目的机场到第一备降所需时间"
,
type
=
0
,
align
=
1
,
sort
=
54
)
private
String
alt1Time
;
// 目的机场到第一备降所需时间
@ExcelField
(
title
=
"目的机场到第一备降距离"
,
type
=
0
,
align
=
1
,
sort
=
55
)
private
String
alt1Distance
;
// 目的机场到第一备降距离
@ExcelField
(
title
=
"目的机场到第二备降所需油量"
,
type
=
0
,
align
=
1
,
sort
=
56
)
private
String
alt2Fuel
;
// 目的机场到第二备降所需油量
@ExcelField
(
title
=
"目的机场到第二备降所需时间"
,
type
=
0
,
align
=
1
,
sort
=
57
)
private
String
alt2Time
;
// 目的机场到第二备降所需时间
@ExcelField
(
title
=
"目的机场到第二备降距离"
,
type
=
0
,
align
=
1
,
sort
=
58
)
private
String
alt2Distance
;
// 目的机场到第二备降距离
@ExcelField
(
title
=
"巡航高度"
,
type
=
0
,
align
=
1
,
sort
=
59
)
private
String
cruisingAltitude
;
// 巡航高度
@ExcelField
(
title
=
"EET"
,
type
=
0
,
align
=
1
,
sort
=
60
)
private
String
eeT
;
// EET
private
String
updateDate
;
// 数据更新时间
private
String
extraOilFuelReason
;
// 额外油加注原因
private
String
totalOil
;
// 总油量
private
String
std
;
// 计划起飞时间
public
String
getAirlineOil
()
{
return
airlineOil
;
}
public
void
setAirlineOil
(
String
airlineOil
)
{
this
.
airlineOil
=
airlineOil
;
}
public
String
getRemarkMsg
()
{
return
remarkMsg
;
}
public
void
setRemarkMsg
(
String
remarkMsg
)
{
this
.
remarkMsg
=
remarkMsg
;
}
public
String
getAlt1Fuel
()
{
return
alt1Fuel
;
}
public
void
setAlt1Fuel
(
String
alt1Fuel
)
{
this
.
alt1Fuel
=
alt1Fuel
;
}
public
String
getAlt1Time
()
{
return
alt1Time
;
}
public
void
setAlt1Time
(
String
alt1Time
)
{
this
.
alt1Time
=
alt1Time
;
}
public
String
getAlt1Distance
()
{
return
alt1Distance
;
}
public
void
setAlt1Distance
(
String
alt1Distance
)
{
this
.
alt1Distance
=
alt1Distance
;
}
public
String
getAlt2Fuel
()
{
return
alt2Fuel
;
}
public
void
setAlt2Fuel
(
String
alt2Fuel
)
{
this
.
alt2Fuel
=
alt2Fuel
;
}
public
String
getAlt2Time
()
{
return
alt2Time
;
}
public
void
setAlt2Time
(
String
alt2Time
)
{
this
.
alt2Time
=
alt2Time
;
}
public
String
getAlt2Distance
()
{
return
alt2Distance
;
}
public
void
setAlt2Distance
(
String
alt2Distance
)
{
this
.
alt2Distance
=
alt2Distance
;
}
public
String
getCruisingAltitude
()
{
return
cruisingAltitude
;
}
public
void
setCruisingAltitude
(
String
cruisingAltitude
)
{
this
.
cruisingAltitude
=
cruisingAltitude
;
}
public
String
getEeT
()
{
return
eeT
;
}
public
void
setEeT
(
String
eET
)
{
this
.
eeT
=
eET
;
}
public
String
getDepIcaoId
()
{
return
depIcaoId
;
}
...
...
src/com/ejweb/modules/airport/service/OilAnalysisService.java
View file @
e031a93d
...
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.List
;
@Service
...
...
@@ -19,6 +20,8 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
@Autowired
protected
OilAnalysisDao
oilAnalysisDao
;
public
PageEntity
<
OilAnalysisEntity
>
getAnalysisData
(
OilAnalysisBean
bean
,
Boolean
isPage
)
{
if
(
isPage
==
true
)
{
...
...
@@ -36,9 +39,12 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
}
PageInfo
<
OilAnalysisEntity
>
pageInfo
=
null
;
List
<
OilAnalysisEntity
>
oilAnalysisEntityList
=
oilAnalysisDao
.
getOilAnalysisData
(
bean
);
List
<
OilAnalysisEntity
>
oilAnalysisEntityList
=
null
;
if
(
isPage
){
oilAnalysisEntityList
=
oilAnalysisDao
.
getOilAnalysisData
(
bean
);
}
else
{
oilAnalysisEntityList
=
oilAnalysisDao
.
getExcelOilAnalysisData
(
bean
);
}
for
(
OilAnalysisEntity
oilAnalysisEntity
:
oilAnalysisEntityList
)
{
int
index
=
oilAnalysisEntityList
.
indexOf
(
oilAnalysisEntity
);
oilAnalysisEntity
.
setNo
(
index
+
1
);
...
...
@@ -140,5 +146,4 @@ public class OilAnalysisService extends BaseService<OilAnalysisDao> {
}
}
src/com/ejweb/modules/call/api/CallController.java
View file @
e031a93d
package
com
.
ejweb
.
modules
.
call
.
api
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.ejweb.core.api.RequestBean
;
import
com.ejweb.core.api.ResponseBean
;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.conf.ErrorCode
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallLogListBean
;
import
com.ejweb.modules.call.bean.CallPhoneAreaBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallRecordBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.entity.CallListEntity
;
import
com.ejweb.modules.call.entity.CallPhoneAreaEntity
;
import
com.ejweb.modules.call.entity.CallPhoneInfoListEntity
;
import
com.ejweb.modules.call.entity.CallRecordEntity
;
import
com.ejweb.modules.call.entity.CallRecordListEntity
;
import
com.ejweb.modules.call.entity.CallSoundRecordBean
;
import
com.ejweb.modules.call.entity.MemberEntity
;
import
com.ejweb.modules.call.service.CallService
;
import
com.ejweb.modules.user.entity.User
;
import
com.ejweb.modules.user.entity.UserEntity
;
import
com.ejweb.modules.user.entity.UserSeatEntity
;
import
com.ejweb.modules.user.service.UserService
;
/**
* 电话会议记录及查询
*
* @team IT Team
* @author renmb
* @version 1.0
* @time 2016年10月6日
*/
@Controller
@RequestMapping
(
value
=
"/api/call"
)
public
class
CallController
{
@Autowired
private
CallService
callService
;
@Autowired
private
UserService
userService
;
/**
* 批量查询电话号码列表
*
* @author renmb
* @time 2017年1月22日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/phoneAreaList"
)
public
ResponseBean
phoneAreaList
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallPhoneAreaBean
bean
=
requestBean
.
getObjectBean
(
CallPhoneAreaBean
.
class
);
String
message
=
this
.
callService
.
validate
(
bean
);
List
<
CallPhoneAreaEntity
>
searchPhoneList
=
bean
.
getCallPhoneList
();
if
(
message
==
null
&&
searchPhoneList
!=
null
&&
searchPhoneList
.
size
()>
0
){
List
<
CallPhoneAreaEntity
>
callPhoneList
=
new
ArrayList
<
CallPhoneAreaEntity
>();
for
(
CallPhoneAreaEntity
phone:
searchPhoneList
)
{
CallPhoneAreaEntity
callPhone
=
callService
.
addPhoneArea
(
phone
.
getMobile
());
if
(
callPhone
==
null
){
// 未查询到相关数据
callPhone
=
new
CallPhoneAreaEntity
();
}
callPhone
.
setMobile
(
phone
.
getMobile
());
callPhone
.
setShowPhone
(
phone
.
getMobile
());
if
(
"PHONE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setMobileNubmer
(
callPhone
.
getPhone
());
callPhone
.
setShowPhone
(
callPhone
.
getShowPhone
());
}
else
if
(
"MOBILE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setShowPhone
(
callPhone
.
getMobile
());
callPhone
.
setPhone
(
callPhone
.
getMobileNubmer
());
}
callPhoneList
.
add
(
callPhone
);
}
responseBean
.
setData
(
callPhoneList
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 格式化手机号码
* 42.4 查询手机归属地信息接口
*
* @author renmb
* @time 2016年12月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/phoneArea"
)
public
ResponseBean
phoneArea
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallPhoneAreaBean
bean
=
requestBean
.
getObjectBean
(
CallPhoneAreaBean
.
class
);
String
message
=
this
.
callService
.
validate
(
bean
);
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
if
(
message
==
null
){
callPhone
.
setPhone
(
bean
.
getPhone
());
callPhone
.
setMobile
(
bean
.
getMobile
());
// 格式化手机号
if
(
StringUtils
.
isNotBlank
(
bean
.
getMobile
())){
String
mobile
=
bean
.
getMobile
();
// 只使用第一个手机号
String
[]
species
=
mobile
.
split
(
"\\s+"
);
if
(
species
.
length
>
1
&&
species
[
0
].
matches
(
"1\\d+"
)
&&
species
[
1
].
matches
(
"1\\d+"
)){
mobile
=
species
[
0
];
}
callPhone
=
callService
.
addPhoneArea
(
mobile
);
// 未查询到相关数据
if
(
callPhone
==
null
){
callPhone
=
new
CallPhoneAreaEntity
();
}
callPhone
.
setMobile
(
bean
.
getMobile
());
}
if
(
StringUtils
.
isNotBlank
(
bean
.
getPhone
())){
callPhone
.
setShowPhone
(
bean
.
getPhone
());
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
bean
.
getPhone
()));
callPhone
.
setType
(
"PHONE"
);
}
if
(
"PHONE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setMobileNubmer
(
callPhone
.
getPhone
());
callPhone
.
setShowPhone
(
callPhone
.
getShowPhone
());
}
else
if
(
"MOBILE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setShowPhone
(
callPhone
.
getMobile
());
callPhone
.
setPhone
(
callPhone
.
getMobileNubmer
());
}
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setData
(
callPhone
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 42.1 开始会话提交接口,在发起人拨打电话时调用
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/start"
)
public
ResponseBean
start
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordBean
bean
=
requestBean
.
getObjectBean
(
CallRecordBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
List
<
CallPhoneBean
>
phoneList
=
bean
.
getPhoneList
();
int
userCount
=
phoneList
.
size
()+
1
;
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setCallType
(
bean
.
getCallType
());
record
.
setCreateBy
(
bean
.
getCreateBy
());
if
(
StringUtils
.
isEmpty
(
bean
.
getCreateName
())){
String
name
=
callService
.
getNameByPhoneFromSeat
(
bean
.
getCreatePhone
());
if
(
name
!=
null
)
{
record
.
setCreateName
(
name
);
}
else
{
name
=
callService
.
getNameByPhone
(
bean
.
getCreatePhone
());
if
(
name
!=
null
)
{
record
.
setCreateName
(
name
);
}
else
{
record
.
setCreateName
(
bean
.
getCreatePhone
());
}
}
}
else
{
record
.
setCreateName
(
bean
.
getCreateName
());
}
// record.setCreateName(StringUtils.isEmpty(bean.getCreateName()) ? bean.getCreatePhone() : bean.getCreateName());
record
.
setEndStatus
(
bean
.
getEndStatus
());
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setChannelType
(
bean
.
getChannelType
());
record
.
setStartTime
(
new
Date
());
record
.
setAppCode
(
bean
.
getAppCode
());
record
.
setPlatform
(
bean
.
getPlatform
());
record
.
setVersionName
(
bean
.
getVersionName
());
if
(
"APP"
.
equals
(
bean
.
getChannelType
())
==
false
){
// 通过系统拨打的电话记录
if
(
bean
.
getStartTime
()
!=
null
){
record
.
setStartTime
(
bean
.
getStartTime
());
}
}
record
.
setUserCount
(
userCount
);
record
.
setCreatePhone
(
bean
.
getCreatePhone
());
record
.
setCreateShowPhone
(
bean
.
getCreateShowPhone
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getCreatePhone
()));
callService
.
createCallRecord
(
record
);
// 添加主记录
for
(
CallPhoneBean
phone
:
phoneList
)
{
phone
.
setId
(
IdWorker
.
getNextId
());
phone
.
setPhoneType
(
Util
.
getPhoneType
(
phone
.
getPhone
()));
phone
.
setRecordId
(
record
.
getId
());
if
(
"GROUP"
.
equals
(
record
.
getCallType
()))
{
// 群组聊天的时候记录标题
phone
.
setTitle
(
"由"
+
record
.
getCreateName
()
+
"发起电话会议"
);
}
else
{
phone
.
setTitle
(
record
.
getCreateName
());
}
if
(
StringUtils
.
isEmpty
(
phone
.
getUserId
())
&&
StringUtils
.
isNotEmpty
(
phone
.
getPhone
())){
// 如果没有匹配用户信息则通过号码匹配用户信息
CallFindPhoneInfoBean
phoneBean
=
new
CallFindPhoneInfoBean
();
Date
current
=
new
Date
();
// 用于查询通话记录
phoneBean
.
setEndTime
(
current
);
// 查询时间
phoneBean
.
setStartTime
(
new
Date
(
current
.
getTime
()-
3
*
60
*
1000
));
// 开始时间=查询时间-3分钟
phoneBean
.
setPhoneNumer
(
phone
.
getPhone
());
List
<
CallPhoneInfoListEntity
>
userList
=
callService
.
findUserByCallPhone
(
phoneBean
,
true
);
if
(
userList
!=
null
&&
userList
.
size
()
==
1
){
CallPhoneInfoListEntity
callPhoneInfo
=
userList
.
get
(
0
);
if
(
StringUtils
.
isNotEmpty
(
callPhoneInfo
.
getUserId
())){
phone
.
setUserId
(
callPhoneInfo
.
getUserId
());
phone
.
setUsername
(
callPhoneInfo
.
getName
());
}
}
}
}
callService
.
addCallPhoneList
(
phoneList
);
// 添加电话列表
responseBean
.
setData
(
record
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 42.2 结束会话提交接口
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/end"
)
public
ResponseBean
end
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordBean
bean
=
requestBean
.
getObjectBean
(
CallRecordBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setEndStatus
(
bean
.
getEndStatus
());
record
.
setEndTime
(
bean
.
getEndTime
());
if
(
"APP"
.
equals
(
bean
.
getChannelType
())
==
false
){
// 通过系统拨打的电话记录
if
(
bean
.
getEndTime
()
!=
null
){
record
.
setEndTime
(
bean
.
getEndTime
());
}
}
record
.
setId
(
bean
.
getRecordCode
());
callService
.
updateCallRecord
(
record
);
// 添加主记录
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 42.3 会话列表接口
* V2.0 添加分页
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/list"
)
public
ResponseBean
list
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordListBean
bean
=
requestBean
.
getObjectBean
(
CallRecordListBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
Boolean
show
=
false
;
UserEntity
ue
=
new
UserEntity
();
ue
.
setUsercode
(
bean
.
getUserId
());
User
user
=
userService
.
getUserByUserCode
(
ue
);
if
(
user
!=
null
)
{
if
(
StringUtils
.
isNoneBlank
(
user
.
getPhone
()))
{
show
=
true
;
}
}
else
{
UserSeatEntity
seat
=
userService
.
getSeatsEntity
(
bean
.
getUserId
());
if
(
seat
!=
null
&&
StringUtils
.
isNoneBlank
(
seat
.
getPhone
()))
{
show
=
true
;
}
}
PageEntity
<
CallRecordListEntity
>
page
=
callService
.
getCallRecordList
(
bean
);
if
(
page
==
null
){
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
return
responseBean
;
}
List
<
CallRecordListEntity
>
callRecordList
=
page
.
getList
();
List
<
CallListEntity
>
callList
=
new
ArrayList
<
CallListEntity
>();
List
<
String
>
huweiNumList
=
new
ArrayList
<>();
for
(
CallRecordListEntity
record:
callRecordList
){
CallListEntity
call
=
new
CallListEntity
();
call
.
setCallType
(
record
.
getCallType
());
call
.
setEndStatus
(
record
.
getEndStatus
());
call
.
setPhone
(
record
.
getPhone
());
call
.
setStartTime
(
record
.
getStartTime
());
call
.
setEndTime
(
record
.
getEndTime
());
call
.
setTitle
(
record
.
getTitle
());
call
.
setUserCount
(
record
.
getUserCount
());
call
.
setFlow
(
record
.
getFlow
());
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 是本人发起的电话,即主叫
call
.
setFlow
(
"CALLING"
);
call
.
setUserId
(
record
.
getUserId
());
// call.setPhone( callService.GetPhoneById(record.getUserId()));
call
.
setUsername
(
record
.
getUsername
());
// call.setUsername(record.getName());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getUserPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
else
{
// 他人发起的电话,电话号码显示
call
.
setFlow
(
"CALLED"
);
call
.
setPhone
(
record
.
getCreatePhone
());
// call.setPhone( callService.GetPhoneById(record.getCreateBy()));
call
.
setUserId
(
record
.
getCreateBy
());
call
.
setUsername
(
record
.
getCreateName
());
// call.setUsername(record.getName());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getCreateByPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
if
(
"GROUP"
.
equals
(
record
.
getCallType
())){
// 群组聊天时所有的电话均设置为群发起人电话
call
.
setPhone
(
record
.
getCreatePhone
());
List
<
MemberEntity
>
memberlist
=
callService
.
getMemberList
(
record
.
getId
());
memberlist
.
forEach
(
mEntity
->
huweiNumList
.
add
(
mEntity
.
getPhone
()));
call
.
setMemberList
(
memberlist
);
}
else
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 非群聊,且是本人发起的电话
// call.setTitle(record.getName());
call
.
setTitle
(
record
.
getUsername
());
}
// if(show){
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
// }
call
.
setDownloadUrl
(
this
.
formatedDownloadUrl
(
record
.
getDownloadUrl
()));
huweiNumList
.
add
(
call
.
getPhone
());
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
callList
.
add
(
call
);
}
Map
<
String
,
String
>
map
=
callService
.
findPhoneByHuaweiNum
(
huweiNumList
);
// 通过华为短号查询座机号
for
(
CallListEntity
record:
callList
){
if
(
map
!=
null
){
if
(
StringUtils
.
isNotEmpty
(
map
.
get
(
record
.
getPhone
()))){
record
.
setPhone
(
Util
.
formatedWorkPhone
(
map
.
get
(
record
.
getPhone
())));
}
if
(
"GROUP"
.
equals
(
record
.
getCallType
())){
record
.
getMemberList
().
forEach
(
entity
->{
if
(
StringUtils
.
isNotEmpty
(
map
.
get
(
entity
.
getPhone
()))){
entity
.
setPhone
(
Util
.
formatedWorkPhone
(
map
.
get
(
entity
.
getPhone
())));
}
entity
.
setShowPhone
(
Util
.
getShowPhone
(
entity
.
getPhone
()));
});
}
}
if
(
StringUtils
.
isNotEmpty
(
record
.
getPhone
())
&&
record
.
getPhone
().
startsWith
(
"6"
)
&&
record
.
getPhone
().
length
()
==
4
)
{
// 6开头的华为短号不展示
record
.
setPhone
(
""
);
}
record
.
setShowPhone
(
Util
.
getShowPhone
(
record
.
getPhone
()));
}
PageEntity
<
CallListEntity
>
retPage
=
new
PageEntity
<
CallListEntity
>();
retPage
.
setCount
(
page
.
getCount
());
retPage
.
setPageNo
(
page
.
getPageNo
());
retPage
.
setList
(
callList
);
retPage
.
setPageSize
(
page
.
getPageSize
());
retPage
.
setTotalPage
(
page
.
getTotalPage
());
responseBean
.
setData
(
retPage
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 安科录音接口
*
* @author renmb
* @time 2017年3月15日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/soundList"
)
public
ResponseBean
soundList
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordListBean
bean
=
requestBean
.
getObjectBean
(
CallRecordListBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
PageEntity
<
CallRecordListEntity
>
page
=
callService
.
getCallRecordList
(
bean
);
// PageEntity<CallRecordListEntity> page = callService.getCallSoundList(bean);
if
(
page
==
null
){
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
return
responseBean
;
}
List
<
CallRecordListEntity
>
callRecordList
=
page
.
getList
();
List
<
CallListEntity
>
callList
=
new
ArrayList
<
CallListEntity
>();
List
<
String
>
huweiNumList
=
new
ArrayList
<>();
for
(
CallRecordListEntity
record:
callRecordList
){
CallListEntity
call
=
new
CallListEntity
();
call
.
setCallType
(
record
.
getCallType
());
call
.
setEndStatus
(
record
.
getEndStatus
());
call
.
setPhone
(
record
.
getPhone
());
call
.
setStartTime
(
record
.
getStartTime
());
call
.
setTitle
(
record
.
getTitle
());
call
.
setUserCount
(
record
.
getUserCount
());
call
.
setFlow
(
record
.
getFlow
());
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 是本人发起的电话,即主叫
call
.
setFlow
(
"CALLING"
);
call
.
setUserId
(
record
.
getUserId
());
call
.
setUsername
(
record
.
getUsername
());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getUserPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
else
{
// 他人发起的电话,电话号码显示
call
.
setFlow
(
"CALLED"
);
call
.
setPhone
(
record
.
getCreatePhone
());
call
.
setUserId
(
record
.
getCreateBy
());
call
.
setUsername
(
record
.
getCreateName
());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getCreateByPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
if
(
"GROUP"
.
equals
(
record
.
getCallType
())){
// 群组聊天时所有的电话均设置为群发起人电话
call
.
setPhone
(
record
.
getCreatePhone
());
}
else
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 非群聊,且是本人发起的电话
call
.
setTitle
(
record
.
getUsername
());
}
huweiNumList
.
add
(
call
.
getPhone
());
call
.
setDownloadUrl
(
this
.
formatedDownloadUrl
(
record
.
getDownloadUrl
()));
callList
.
add
(
call
);
}
Map
<
String
,
String
>
map
=
callService
.
findPhoneByHuaweiNum
(
huweiNumList
);
// 通过华为短号查询座机号
for
(
CallListEntity
record:
callList
){
if
(
map
!=
null
&&
StringUtils
.
isNotEmpty
(
map
.
get
(
record
.
getPhone
()))){
record
.
setPhone
(
Util
.
formatedWorkPhone
(
map
.
get
(
record
.
getPhone
())));
}
// if(StringUtils.isNotEmpty(record.getPhone())
// && record.getPhone().startsWith("6")
// && record.getPhone().length() == 4){// 6开头的华为短号不展示
//
// record.setPhone("");
// }
record
.
setShowPhone
(
Util
.
getShowPhone
(
record
.
getPhone
()));
}
PageEntity
<
CallListEntity
>
retPage
=
new
PageEntity
<
CallListEntity
>();
retPage
.
setCount
(
page
.
getCount
());
retPage
.
setPageNo
(
page
.
getPageNo
());
retPage
.
setList
(
callList
);
retPage
.
setPageSize
(
page
.
getPageSize
());
retPage
.
setTotalPage
(
page
.
getTotalPage
());
responseBean
.
setData
(
retPage
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 根据电话号码查询电话相关的席位或者用户信息
*
* @author renmb
* @time 2017年1月5日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/findPhoneInfo"
)
public
ResponseBean
findPhoneInfo
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallFindPhoneInfoBean
bean
=
requestBean
.
getObjectBean
(
CallFindPhoneInfoBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
Date
current
=
new
Date
();
// 用于查询通话记录
bean
.
setEndTime
(
current
);
// 查询时间
bean
.
setStartTime
(
new
Date
(
current
.
getTime
()-
3
*
60
*
1000
));
// 开始时间=查询时间-3分钟
List
<
CallPhoneInfoListEntity
>
userList
=
callService
.
findUserByCallPhone
(
bean
,
false
);
if
(
userList
==
null
||
userList
.
size
()
==
0
){
responseBean
.
setMessage
(
GConstants
.
EMPTY
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
return
responseBean
;
}
for
(
CallPhoneInfoListEntity
call:
userList
){
call
.
setPhoto
(
Util
.
getAbsoluteUrl
(
call
.
getPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
// callService.addCallRecordByCalled(bean, userList.get(0));
responseBean
.
setData
(
userList
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 一次性批量提交电话会议记录
*
* 42.4 批量提交通话记录接口
*
* @author renmb
* @time 2017年2月17日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/postCallLogList"
)
public
ResponseBean
postCallLogList
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallLogListBean
callLog
=
requestBean
.
getObjectBean
(
CallLogListBean
.
class
);
if
(
callLog
!=
null
&&
callLog
.
getCallLogList
()
!=
null
)
{
// 校验通过
List
<
CallRecordBean
>
callLogList
=
callLog
.
getCallLogList
();
for
(
CallRecordBean
bean:
callLogList
)
{
List
<
CallPhoneBean
>
phoneList
=
bean
.
getPhoneList
();
int
userCount
=
phoneList
.
size
()+
1
;
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setCallType
(
bean
.
getCallType
());
record
.
setCreateBy
(
bean
.
getCreateBy
());
record
.
setCreateName
(
bean
.
getCreateName
());
record
.
setEndStatus
(
record
.
getEndStatus
());
record
.
setChannelType
(
bean
.
getChannelType
());
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setAppCode
(
bean
.
getAppCode
());
record
.
setPlatform
(
bean
.
getPlatform
());
record
.
setVersionName
(
bean
.
getVersionName
());
if
(
bean
.
getStartTime
()
==
null
){
record
.
setStartTime
(
new
Date
());
}
else
{
record
.
setStartTime
(
bean
.
getStartTime
());
}
record
.
setUserCount
(
userCount
);
record
.
setCreatePhone
(
bean
.
getCreatePhone
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getCreatePhone
()));
callService
.
createCallRecord
(
record
);
// 添加主记录
for
(
CallPhoneBean
phone
:
phoneList
)
{
phone
.
setId
(
IdWorker
.
getNextId
());
phone
.
setRecordId
(
record
.
getId
());
if
(
"GROUP"
.
equals
(
record
.
getCallType
()))
{
// 群组聊天的时候记录标题
phone
.
setTitle
(
"由"
+
record
.
getCreateName
()
+
"发起电话会议"
);
}
else
{
phone
.
setTitle
(
record
.
getCreateName
());
}
}
callService
.
addCallPhoneList
(
phoneList
);
// 添加电话列表
}
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
GConstants
.
EMPTY
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 用于安科同步录音数据
*
* @author renmb
* @time 2017年2月28日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/addSoundRecord"
)
public
ResponseBean
addSoundRecord
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallSoundRecordBean
bean
=
requestBean
.
getObjectBean
(
CallSoundRecordBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
bean
.
setFocTimeMillis
(
System
.
currentTimeMillis
());
Date
createDate
=
new
Date
(
bean
.
getFocTimeMillis
());
bean
.
setCreateDate
(
createDate
);
long
focDiffMillis
=
bean
.
getCurrentTimeMillis
()
-
bean
.
getFocTimeMillis
()+
GConstants
.
getIntValue
(
"add.diff.millis"
,
100
);
// if(focDiffMillis<1000){
// focDiffMillis = 0;
// }
bean
.
setFocDiffMillis
((
int
)
focDiffMillis
);
Date
start
=
new
Date
(
bean
.
getBeginTime
().
getTime
()-
focDiffMillis
);
bean
.
setFocBeginTime
(
start
);
if
(
bean
.
getEndTime
()
!=
null
){
Date
end
=
new
Date
(
bean
.
getEndTime
().
getTime
()-
focDiffMillis
);
bean
.
setFocEndTime
(
end
);
}
//添加通话记录call_record,call_office
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setCallType
(
"USER"
);
String
name
=
callService
.
getNameByPhoneFromSeat
(
bean
.
getCallNo
());
String
id
=
callService
.
getIdByPhoneFromSeat
(
bean
.
getCallNo
());
if
(
name
!=
null
)
{
record
.
setCreateName
(
name
);
record
.
setCreateBy
(
id
);
}
else
{
name
=
callService
.
getNameByPhone
(
bean
.
getCallNo
());
if
(
name
!=
null
)
{
id
=
callService
.
getIdByPhone
(
bean
.
getCallNo
());
record
.
setCreateName
(
name
);
record
.
setCreateBy
(
id
);
}
else
{
record
.
setCreateName
(
bean
.
getCallNo
());
record
.
setCreateBy
(
"1"
);
}
}
int
userCount
=
1
;
if
(
bean
.
getResult
()
!=
null
&&
!
bean
.
getResult
().
equals
(
"0"
))
{
record
.
setEndStatus
(
"SUCCESS"
);
userCount
=
2
;
}
else
{
record
.
setEndStatus
(
"FAILD"
);
}
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setChannelType
(
bean
.
getChannelType
());
record
.
setAppCode
(
"30011"
);
record
.
setPlatform
(
"JAVA"
);
record
.
setVersionName
(
"1.0"
);
record
.
setDownloadUrl
(
bean
.
getDownloadUrl
());
record
.
setDuration
(
bean
.
getDuration
());
record
.
setStartTime
(
bean
.
getBeginTime
());
record
.
setEndTime
(
bean
.
getEndTime
());
record
.
setUserCount
(
userCount
);
record
.
setCreatePhone
(
bean
.
getCallNo
());
record
.
setCreateShowPhone
(
bean
.
getCallNo
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getCallNo
()));
// callService.createCallRecord(record);// 添加主记录
//添加被叫记录
List
<
CallPhoneBean
>
phoneList
=
new
ArrayList
<
CallPhoneBean
>();
CallPhoneBean
phone
=
new
CallPhoneBean
();
phone
.
setId
(
IdWorker
.
getNextId
());
phone
.
setPhoneType
(
Util
.
getPhoneType
(
phone
.
getPhone
()));
phone
.
setRecordId
(
record
.
getId
());
phone
.
setDownloadUrl
(
bean
.
getDownloadUrl
());
phone
.
setCenterRecordsId
(
bean
.
getId
());
if
(
"GROUP"
.
equals
(
record
.
getCallType
()))
{
// 群组聊天的时候记录标题
phone
.
setTitle
(
"由"
+
record
.
getCreateName
()
+
"发起电话会议"
);
}
else
{
phone
.
setTitle
(
record
.
getCreateName
());
}
String
acceptName
=
callService
.
getNameByPhoneFromSeat
(
bean
.
getAcceptNo
());
String
acceptId
=
callService
.
getIdByPhoneFromSeat
(
bean
.
getAcceptNo
());
if
(
acceptName
!=
null
)
{
phone
.
setUserId
(
acceptId
);
phone
.
setUsername
(
acceptName
);
}
else
{
acceptName
=
callService
.
getNameByPhone
(
bean
.
getAcceptNo
());
if
(
acceptName
!=
null
)
{
acceptId
=
callService
.
getIdByPhone
(
bean
.
getAcceptNo
());
phone
.
setUserId
(
acceptId
);
phone
.
setUsername
(
acceptName
);
}
else
{
phone
.
setUserId
(
"1"
);
phone
.
setUsername
(
bean
.
getAcceptNo
());
}
}
phone
.
setPhone
(
bean
.
getAcceptNo
());
phone
.
setShowPhone
(
bean
.
getAcceptNo
());
phone
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getAcceptNo
()));
phone
.
setFlow
(
"CALLED"
);
phoneList
.
add
(
phone
);
// callService.addCallPhoneList(phoneList);// 添加电话列表
bean
.
setCallRecordId
(
record
.
getId
());
if
(
callService
.
addSoundRecord
(
bean
,
phoneList
,
record
)){
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
else
{
responseBean
.
setData
(
bean
);
responseBean
.
setMessage
(
"记录保存失败!"
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
public
String
formatedDownloadUrl
(
String
downloadUrl
){
try
{
if
(
StringUtils
.
isEmpty
(
downloadUrl
))
return
null
;
return
GConstants
.
getValue
(
"jd.sound.recording.prefix"
,
"https://ifos.jdair.net/sounds"
)
+
downloadUrl
.
replaceAll
(
"\\\\+"
,
"/"
).
replace
(
GConstants
.
getValue
(
"ak.sound.recording.prefix"
,
"http://10.72.23.187"
),
""
);
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
return
null
;
}
// public static void main(String[] args){
// System.out.println(formatedDownloadUrl("http://10.72.23.187\\01\\log20170105204535S000Ch001.wav"));
// }
}
package
com
.
ejweb
.
modules
.
call
.
api
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
com.ejweb.core.api.RequestBean
;
import
com.ejweb.core.api.ResponseBean
;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.conf.ErrorCode
;
import
com.ejweb.core.conf.GConstants
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallLogListBean
;
import
com.ejweb.modules.call.bean.CallPhoneAreaBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallRecordBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.entity.CallListEntity
;
import
com.ejweb.modules.call.entity.CallPhoneAreaEntity
;
import
com.ejweb.modules.call.entity.CallPhoneInfoListEntity
;
import
com.ejweb.modules.call.entity.CallRecordEntity
;
import
com.ejweb.modules.call.entity.CallRecordListEntity
;
import
com.ejweb.modules.call.entity.CallSoundRecordBean
;
import
com.ejweb.modules.call.entity.MemberEntity
;
import
com.ejweb.modules.call.service.CallService
;
import
com.ejweb.modules.user.entity.User
;
import
com.ejweb.modules.user.entity.UserEntity
;
import
com.ejweb.modules.user.entity.UserSeatEntity
;
import
com.ejweb.modules.user.service.UserService
;
/**
* 电话会议记录及查询
*
* @team IT Team
* @author renmb
* @version 1.0
* @time 2016年10月6日
*/
@Controller
@RequestMapping
(
value
=
"/api/call"
)
public
class
CallController
{
@Autowired
private
CallService
callService
;
@Autowired
private
UserService
userService
;
/**
* 批量查询电话号码列表
*
* @author renmb
* @time 2017年1月22日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/phoneAreaList"
)
public
ResponseBean
phoneAreaList
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallPhoneAreaBean
bean
=
requestBean
.
getObjectBean
(
CallPhoneAreaBean
.
class
);
String
message
=
this
.
callService
.
validate
(
bean
);
List
<
CallPhoneAreaEntity
>
searchPhoneList
=
bean
.
getCallPhoneList
();
if
(
message
==
null
&&
searchPhoneList
!=
null
&&
searchPhoneList
.
size
()>
0
){
List
<
CallPhoneAreaEntity
>
callPhoneList
=
new
ArrayList
<
CallPhoneAreaEntity
>();
for
(
CallPhoneAreaEntity
phone:
searchPhoneList
)
{
CallPhoneAreaEntity
callPhone
=
callService
.
addPhoneArea
(
phone
.
getMobile
());
if
(
callPhone
==
null
){
// 未查询到相关数据
callPhone
=
new
CallPhoneAreaEntity
();
}
callPhone
.
setMobile
(
phone
.
getMobile
());
callPhone
.
setShowPhone
(
phone
.
getMobile
());
if
(
"PHONE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setMobileNubmer
(
callPhone
.
getPhone
());
callPhone
.
setShowPhone
(
callPhone
.
getShowPhone
());
}
else
if
(
"MOBILE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setShowPhone
(
callPhone
.
getMobile
());
callPhone
.
setPhone
(
callPhone
.
getMobileNubmer
());
}
callPhoneList
.
add
(
callPhone
);
}
responseBean
.
setData
(
callPhoneList
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 格式化手机号码
* 42.4 查询手机归属地信息接口
*
* @author renmb
* @time 2016年12月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/phoneArea"
)
public
ResponseBean
phoneArea
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallPhoneAreaBean
bean
=
requestBean
.
getObjectBean
(
CallPhoneAreaBean
.
class
);
String
message
=
this
.
callService
.
validate
(
bean
);
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
if
(
message
==
null
){
callPhone
.
setPhone
(
bean
.
getPhone
());
callPhone
.
setMobile
(
bean
.
getMobile
());
// 格式化手机号
if
(
StringUtils
.
isNotBlank
(
bean
.
getMobile
())){
String
mobile
=
bean
.
getMobile
();
// 只使用第一个手机号
String
[]
species
=
mobile
.
split
(
"\\s+"
);
if
(
species
.
length
>
1
&&
species
[
0
].
matches
(
"1\\d+"
)
&&
species
[
1
].
matches
(
"1\\d+"
)){
mobile
=
species
[
0
];
}
callPhone
=
callService
.
addPhoneArea
(
mobile
);
// 未查询到相关数据
if
(
callPhone
==
null
){
callPhone
=
new
CallPhoneAreaEntity
();
}
callPhone
.
setMobile
(
bean
.
getMobile
());
}
if
(
StringUtils
.
isNotBlank
(
bean
.
getPhone
())){
callPhone
.
setShowPhone
(
bean
.
getPhone
());
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
bean
.
getPhone
()));
callPhone
.
setType
(
"PHONE"
);
}
if
(
"PHONE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setMobileNubmer
(
callPhone
.
getPhone
());
callPhone
.
setShowPhone
(
callPhone
.
getShowPhone
());
}
else
if
(
"MOBILE"
.
equals
(
callPhone
.
getType
())){
callPhone
.
setShowPhone
(
callPhone
.
getMobile
());
callPhone
.
setPhone
(
callPhone
.
getMobileNubmer
());
}
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setData
(
callPhone
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 42.1 开始会话提交接口,在发起人拨打电话时调用
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/start"
)
public
ResponseBean
start
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordBean
bean
=
requestBean
.
getObjectBean
(
CallRecordBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
List
<
CallPhoneBean
>
phoneList
=
bean
.
getPhoneList
();
int
userCount
=
phoneList
.
size
()+
1
;
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setCallType
(
bean
.
getCallType
());
record
.
setCreateBy
(
bean
.
getCreateBy
());
if
(
StringUtils
.
isEmpty
(
bean
.
getCreateName
())){
String
name
=
callService
.
getNameByPhoneFromSeat
(
bean
.
getCreatePhone
());
if
(
name
!=
null
)
{
record
.
setCreateName
(
name
);
}
else
{
name
=
callService
.
getNameByPhone
(
bean
.
getCreatePhone
());
if
(
name
!=
null
)
{
record
.
setCreateName
(
name
);
}
else
{
record
.
setCreateName
(
bean
.
getCreatePhone
());
}
}
}
else
{
record
.
setCreateName
(
bean
.
getCreateName
());
}
// record.setCreateName(StringUtils.isEmpty(bean.getCreateName()) ? bean.getCreatePhone() : bean.getCreateName());
record
.
setEndStatus
(
bean
.
getEndStatus
());
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setChannelType
(
bean
.
getChannelType
());
record
.
setStartTime
(
new
Date
());
record
.
setAppCode
(
bean
.
getAppCode
());
record
.
setPlatform
(
bean
.
getPlatform
());
record
.
setVersionName
(
bean
.
getVersionName
());
if
(
"APP"
.
equals
(
bean
.
getChannelType
())
==
false
){
// 通过系统拨打的电话记录
if
(
bean
.
getStartTime
()
!=
null
){
record
.
setStartTime
(
bean
.
getStartTime
());
}
}
record
.
setUserCount
(
userCount
);
record
.
setCreatePhone
(
bean
.
getCreatePhone
());
record
.
setCreateShowPhone
(
bean
.
getCreateShowPhone
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getCreatePhone
()));
callService
.
createCallRecord
(
record
);
// 添加主记录
for
(
CallPhoneBean
phone
:
phoneList
)
{
phone
.
setId
(
IdWorker
.
getNextId
());
phone
.
setPhoneType
(
Util
.
getPhoneType
(
phone
.
getPhone
()));
phone
.
setRecordId
(
record
.
getId
());
if
(
"GROUP"
.
equals
(
record
.
getCallType
()))
{
// 群组聊天的时候记录标题
phone
.
setTitle
(
"由"
+
record
.
getCreateName
()
+
"发起电话会议"
);
}
else
{
phone
.
setTitle
(
record
.
getCreateName
());
}
if
(
StringUtils
.
isEmpty
(
phone
.
getUserId
())
&&
StringUtils
.
isNotEmpty
(
phone
.
getPhone
())){
// 如果没有匹配用户信息则通过号码匹配用户信息
CallFindPhoneInfoBean
phoneBean
=
new
CallFindPhoneInfoBean
();
Date
current
=
new
Date
();
// 用于查询通话记录
phoneBean
.
setEndTime
(
current
);
// 查询时间
phoneBean
.
setStartTime
(
new
Date
(
current
.
getTime
()-
3
*
60
*
1000
));
// 开始时间=查询时间-3分钟
phoneBean
.
setPhoneNumer
(
phone
.
getPhone
());
List
<
CallPhoneInfoListEntity
>
userList
=
callService
.
findUserByCallPhone
(
phoneBean
,
true
);
if
(
userList
!=
null
&&
userList
.
size
()
==
1
){
CallPhoneInfoListEntity
callPhoneInfo
=
userList
.
get
(
0
);
if
(
StringUtils
.
isNotEmpty
(
callPhoneInfo
.
getUserId
())){
phone
.
setUserId
(
callPhoneInfo
.
getUserId
());
phone
.
setUsername
(
callPhoneInfo
.
getName
());
}
}
}
}
callService
.
addCallPhoneList
(
phoneList
);
// 添加电话列表
responseBean
.
setData
(
record
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 42.2 结束会话提交接口
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/end"
)
public
ResponseBean
end
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordBean
bean
=
requestBean
.
getObjectBean
(
CallRecordBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setEndStatus
(
bean
.
getEndStatus
());
record
.
setEndTime
(
bean
.
getEndTime
());
if
(
"APP"
.
equals
(
bean
.
getChannelType
())
==
false
){
// 通过系统拨打的电话记录
if
(
bean
.
getEndTime
()
!=
null
){
record
.
setEndTime
(
bean
.
getEndTime
());
}
}
record
.
setId
(
bean
.
getRecordCode
());
callService
.
updateCallRecord
(
record
);
// 添加主记录
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 42.3 会话列表接口
* V2.0 添加分页
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/list"
)
public
ResponseBean
list
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordListBean
bean
=
requestBean
.
getObjectBean
(
CallRecordListBean
.
class
);
// CallRecordListBean bean=new CallRecordListBean();
// bean.setUserId("1000849147");
// bean.setPageNo(0);
// bean.setPageSize(10);
// String message=null;
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
Boolean
show
=
false
;
UserEntity
ue
=
new
UserEntity
();
ue
.
setUsercode
(
bean
.
getUserId
());
User
user
=
userService
.
getUserByUserCode
(
ue
);
if
(
user
!=
null
)
{
if
(
StringUtils
.
isNoneBlank
(
user
.
getPhone
()))
{
show
=
true
;
}
}
else
{
UserSeatEntity
seat
=
userService
.
getSeatsEntity
(
bean
.
getUserId
());
if
(
seat
!=
null
&&
StringUtils
.
isNoneBlank
(
seat
.
getPhone
()))
{
show
=
true
;
}
}
PageEntity
<
CallRecordListEntity
>
page
=
callService
.
getCallRecordList
(
bean
);
if
(
page
==
null
){
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
return
responseBean
;
}
List
<
CallRecordListEntity
>
callRecordList
=
page
.
getList
();
List
<
CallListEntity
>
callList
=
new
ArrayList
<
CallListEntity
>();
List
<
String
>
huweiNumList
=
new
ArrayList
<>();
for
(
CallRecordListEntity
record:
callRecordList
){
CallListEntity
call
=
new
CallListEntity
();
call
.
setCallType
(
record
.
getCallType
());
call
.
setEndStatus
(
record
.
getEndStatus
());
call
.
setPhone
(
record
.
getPhone
());
call
.
setStartTime
(
record
.
getStartTime
());
call
.
setEndTime
(
record
.
getEndTime
());
call
.
setTitle
(
record
.
getTitle
());
call
.
setUserCount
(
record
.
getUserCount
());
call
.
setFlow
(
record
.
getFlow
());
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 是本人发起的电话,即主叫
call
.
setFlow
(
"CALLING"
);
call
.
setUserId
(
record
.
getUserId
());
// call.setPhone( callService.GetPhoneById(record.getUserId()));
call
.
setUsername
(
record
.
getUsername
());
// call.setUsername(record.getName());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getUserPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
else
{
// 他人发起的电话,电话号码显示
call
.
setFlow
(
"CALLED"
);
call
.
setPhone
(
record
.
getCreatePhone
());
// call.setPhone( callService.GetPhoneById(record.getCreateBy()));
call
.
setUserId
(
record
.
getCreateBy
());
call
.
setUsername
(
record
.
getCreateName
());
// call.setUsername(record.getName());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getCreateByPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
if
(
"GROUP"
.
equals
(
record
.
getCallType
())){
// 群组聊天时所有的电话均设置为群发起人电话
call
.
setPhone
(
record
.
getCreatePhone
());
List
<
MemberEntity
>
memberlist
=
callService
.
getMemberList
(
record
.
getId
());
memberlist
.
forEach
(
mEntity
->
huweiNumList
.
add
(
mEntity
.
getPhone
()));
call
.
setMemberList
(
memberlist
);
}
else
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 非群聊,且是本人发起的电话
// call.setTitle(record.getName());
call
.
setTitle
(
record
.
getUsername
());
}
// if(show){
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
// }
call
.
setDownloadUrl
(
this
.
formatedDownloadUrl
(
record
.
getDownloadUrl
()));
huweiNumList
.
add
(
call
.
getPhone
());
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
callList
.
add
(
call
);
}
Map
<
String
,
String
>
map
=
callService
.
findPhoneByHuaweiNum
(
huweiNumList
);
// 通过华为短号查询座机号
for
(
CallListEntity
record:
callList
){
if
(
map
!=
null
){
if
(
StringUtils
.
isNotEmpty
(
map
.
get
(
record
.
getPhone
()))){
record
.
setPhone
(
Util
.
formatedWorkPhone
(
map
.
get
(
record
.
getPhone
())));
}
if
(
"GROUP"
.
equals
(
record
.
getCallType
())){
record
.
getMemberList
().
forEach
(
entity
->{
if
(
StringUtils
.
isNotEmpty
(
map
.
get
(
entity
.
getPhone
()))){
entity
.
setPhone
(
Util
.
formatedWorkPhone
(
map
.
get
(
entity
.
getPhone
())));
}
entity
.
setShowPhone
(
Util
.
getShowPhone
(
entity
.
getPhone
()));
});
}
}
if
(
StringUtils
.
isNotEmpty
(
record
.
getPhone
())
&&
record
.
getPhone
().
startsWith
(
"6"
)
&&
record
.
getPhone
().
length
()
==
4
)
{
// 6开头的华为短号不展示
record
.
setPhone
(
""
);
}
record
.
setShowPhone
(
Util
.
getShowPhone
(
record
.
getPhone
()));
}
PageEntity
<
CallListEntity
>
retPage
=
new
PageEntity
<
CallListEntity
>();
retPage
.
setCount
(
page
.
getCount
());
retPage
.
setPageNo
(
page
.
getPageNo
());
retPage
.
setList
(
callList
);
retPage
.
setPageSize
(
page
.
getPageSize
());
retPage
.
setTotalPage
(
page
.
getTotalPage
());
responseBean
.
setData
(
retPage
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 安科录音接口
*
* @author renmb
* @time 2017年3月15日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/soundList"
)
public
ResponseBean
soundList
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallRecordListBean
bean
=
requestBean
.
getObjectBean
(
CallRecordListBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
PageEntity
<
CallRecordListEntity
>
page
=
callService
.
getCallRecordList
(
bean
);
// PageEntity<CallRecordListEntity> page = callService.getCallSoundList(bean);
if
(
page
==
null
){
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
return
responseBean
;
}
List
<
CallRecordListEntity
>
callRecordList
=
page
.
getList
();
List
<
CallListEntity
>
callList
=
new
ArrayList
<
CallListEntity
>();
List
<
String
>
huweiNumList
=
new
ArrayList
<>();
for
(
CallRecordListEntity
record:
callRecordList
){
CallListEntity
call
=
new
CallListEntity
();
call
.
setCallType
(
record
.
getCallType
());
call
.
setEndStatus
(
record
.
getEndStatus
());
call
.
setPhone
(
record
.
getPhone
());
call
.
setStartTime
(
record
.
getStartTime
());
call
.
setTitle
(
record
.
getTitle
());
call
.
setUserCount
(
record
.
getUserCount
());
call
.
setFlow
(
record
.
getFlow
());
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 是本人发起的电话,即主叫
call
.
setFlow
(
"CALLING"
);
call
.
setUserId
(
record
.
getUserId
());
call
.
setUsername
(
record
.
getUsername
());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getUserPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
else
{
// 他人发起的电话,电话号码显示
call
.
setFlow
(
"CALLED"
);
call
.
setPhone
(
record
.
getCreatePhone
());
call
.
setUserId
(
record
.
getCreateBy
());
call
.
setUsername
(
record
.
getCreateName
());
call
.
setUserPhoto
(
Util
.
getAbsoluteUrl
(
record
.
getCreateByPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
if
(
"GROUP"
.
equals
(
record
.
getCallType
())){
// 群组聊天时所有的电话均设置为群发起人电话
call
.
setPhone
(
record
.
getCreatePhone
());
}
else
if
(
bean
.
getUserId
().
equals
(
record
.
getCreateBy
())){
// 非群聊,且是本人发起的电话
call
.
setTitle
(
record
.
getUsername
());
}
huweiNumList
.
add
(
call
.
getPhone
());
call
.
setDownloadUrl
(
this
.
formatedDownloadUrl
(
record
.
getDownloadUrl
()));
callList
.
add
(
call
);
}
Map
<
String
,
String
>
map
=
callService
.
findPhoneByHuaweiNum
(
huweiNumList
);
// 通过华为短号查询座机号
for
(
CallListEntity
record:
callList
){
if
(
map
!=
null
&&
StringUtils
.
isNotEmpty
(
map
.
get
(
record
.
getPhone
()))){
record
.
setPhone
(
Util
.
formatedWorkPhone
(
map
.
get
(
record
.
getPhone
())));
}
// if(StringUtils.isNotEmpty(record.getPhone())
// && record.getPhone().startsWith("6")
// && record.getPhone().length() == 4){// 6开头的华为短号不展示
//
// record.setPhone("");
// }
record
.
setShowPhone
(
Util
.
getShowPhone
(
record
.
getPhone
()));
}
PageEntity
<
CallListEntity
>
retPage
=
new
PageEntity
<
CallListEntity
>();
retPage
.
setCount
(
page
.
getCount
());
retPage
.
setPageNo
(
page
.
getPageNo
());
retPage
.
setList
(
callList
);
retPage
.
setPageSize
(
page
.
getPageSize
());
retPage
.
setTotalPage
(
page
.
getTotalPage
());
responseBean
.
setData
(
retPage
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 根据电话号码查询电话相关的席位或者用户信息
*
* @author renmb
* @time 2017年1月5日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/findPhoneInfo"
)
public
ResponseBean
findPhoneInfo
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallFindPhoneInfoBean
bean
=
requestBean
.
getObjectBean
(
CallFindPhoneInfoBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
Date
current
=
new
Date
();
// 用于查询通话记录
bean
.
setEndTime
(
current
);
// 查询时间
bean
.
setStartTime
(
new
Date
(
current
.
getTime
()-
3
*
60
*
1000
));
// 开始时间=查询时间-3分钟
List
<
CallPhoneInfoListEntity
>
userList
=
callService
.
findUserByCallPhone
(
bean
,
false
);
if
(
userList
==
null
||
userList
.
size
()
==
0
){
responseBean
.
setMessage
(
GConstants
.
EMPTY
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2001
);
return
responseBean
;
}
for
(
CallPhoneInfoListEntity
call:
userList
){
call
.
setPhoto
(
Util
.
getAbsoluteUrl
(
call
.
getPhoto
(),
GConstants
.
DEFAULT_SEAT_PHOTO
));
}
// callService.addCallRecordByCalled(bean, userList.get(0));
responseBean
.
setData
(
userList
);
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 一次性批量提交电话会议记录
*
* 42.4 批量提交通话记录接口
*
* @author renmb
* @time 2017年2月17日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/postCallLogList"
)
public
ResponseBean
postCallLogList
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallLogListBean
callLog
=
requestBean
.
getObjectBean
(
CallLogListBean
.
class
);
if
(
callLog
!=
null
&&
callLog
.
getCallLogList
()
!=
null
)
{
// 校验通过
List
<
CallRecordBean
>
callLogList
=
callLog
.
getCallLogList
();
for
(
CallRecordBean
bean:
callLogList
)
{
List
<
CallPhoneBean
>
phoneList
=
bean
.
getPhoneList
();
int
userCount
=
phoneList
.
size
()+
1
;
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setCallType
(
bean
.
getCallType
());
record
.
setCreateBy
(
bean
.
getCreateBy
());
record
.
setCreateName
(
bean
.
getCreateName
());
record
.
setEndStatus
(
record
.
getEndStatus
());
record
.
setChannelType
(
bean
.
getChannelType
());
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setAppCode
(
bean
.
getAppCode
());
record
.
setPlatform
(
bean
.
getPlatform
());
record
.
setVersionName
(
bean
.
getVersionName
());
if
(
bean
.
getStartTime
()
==
null
){
record
.
setStartTime
(
new
Date
());
}
else
{
record
.
setStartTime
(
bean
.
getStartTime
());
}
record
.
setUserCount
(
userCount
);
record
.
setCreatePhone
(
bean
.
getCreatePhone
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getCreatePhone
()));
callService
.
createCallRecord
(
record
);
// 添加主记录
for
(
CallPhoneBean
phone
:
phoneList
)
{
phone
.
setId
(
IdWorker
.
getNextId
());
phone
.
setRecordId
(
record
.
getId
());
if
(
"GROUP"
.
equals
(
record
.
getCallType
()))
{
// 群组聊天的时候记录标题
phone
.
setTitle
(
"由"
+
record
.
getCreateName
()
+
"发起电话会议"
);
}
else
{
phone
.
setTitle
(
record
.
getCreateName
());
}
}
callService
.
addCallPhoneList
(
phoneList
);
// 添加电话列表
}
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
responseBean
.
setMessage
(
GConstants
.
EMPTY
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
/**
* 用于安科同步录音数据
*
* @author renmb
* @time 2017年2月28日
* @param requestBean
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/addSoundRecord"
)
public
ResponseBean
addSoundRecord
(
RequestBean
requestBean
)
{
ResponseBean
responseBean
=
new
ResponseBean
();
CallSoundRecordBean
bean
=
requestBean
.
getObjectBean
(
CallSoundRecordBean
.
class
);
String
message
=
callService
.
validate
(
bean
);
if
(
message
==
null
)
{
// 校验通过
bean
.
setFocTimeMillis
(
System
.
currentTimeMillis
());
Date
createDate
=
new
Date
(
bean
.
getFocTimeMillis
());
bean
.
setCreateDate
(
createDate
);
long
focDiffMillis
=
bean
.
getCurrentTimeMillis
()
-
bean
.
getFocTimeMillis
()+
GConstants
.
getIntValue
(
"add.diff.millis"
,
100
);
// if(focDiffMillis<1000){
// focDiffMillis = 0;
// }
bean
.
setFocDiffMillis
((
int
)
focDiffMillis
);
Date
start
=
new
Date
(
bean
.
getBeginTime
().
getTime
()-
focDiffMillis
);
bean
.
setFocBeginTime
(
start
);
if
(
bean
.
getEndTime
()
!=
null
){
Date
end
=
new
Date
(
bean
.
getEndTime
().
getTime
()-
focDiffMillis
);
bean
.
setFocEndTime
(
end
);
}
//添加通话记录call_record,call_office
CallRecordEntity
record
=
new
CallRecordEntity
();
record
.
setCallType
(
"USER"
);
String
name
=
callService
.
getNameByPhoneFromSeat
(
bean
.
getCallNo
());
String
id
=
callService
.
getIdByPhoneFromSeat
(
bean
.
getCallNo
());
if
(
name
!=
null
)
{
record
.
setCreateName
(
name
);
record
.
setCreateBy
(
id
);
}
else
{
name
=
callService
.
getNameByPhone
(
bean
.
getCallNo
());
if
(
name
!=
null
)
{
id
=
callService
.
getIdByPhone
(
bean
.
getCallNo
());
record
.
setCreateName
(
name
);
record
.
setCreateBy
(
id
);
}
else
{
record
.
setCreateName
(
bean
.
getCallNo
());
record
.
setCreateBy
(
"1"
);
}
}
int
userCount
=
1
;
if
(
bean
.
getResult
()
!=
null
&&
!
bean
.
getResult
().
equals
(
"0"
))
{
record
.
setEndStatus
(
"SUCCESS"
);
userCount
=
2
;
}
else
{
record
.
setEndStatus
(
"FAILD"
);
}
record
.
setId
(
IdWorker
.
getNextId
());
record
.
setChannelType
(
bean
.
getChannelType
());
record
.
setAppCode
(
"30011"
);
record
.
setPlatform
(
"JAVA"
);
record
.
setVersionName
(
"1.0"
);
record
.
setDownloadUrl
(
bean
.
getDownloadUrl
());
record
.
setDuration
(
bean
.
getDuration
());
record
.
setStartTime
(
bean
.
getBeginTime
());
record
.
setEndTime
(
bean
.
getEndTime
());
record
.
setUserCount
(
userCount
);
record
.
setCreatePhone
(
bean
.
getCallNo
());
record
.
setCreateShowPhone
(
bean
.
getCallNo
());
record
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getCallNo
()));
// callService.createCallRecord(record);// 添加主记录
//添加被叫记录
List
<
CallPhoneBean
>
phoneList
=
new
ArrayList
<
CallPhoneBean
>();
CallPhoneBean
phone
=
new
CallPhoneBean
();
phone
.
setId
(
IdWorker
.
getNextId
());
phone
.
setPhoneType
(
Util
.
getPhoneType
(
phone
.
getPhone
()));
phone
.
setRecordId
(
record
.
getId
());
phone
.
setDownloadUrl
(
bean
.
getDownloadUrl
());
phone
.
setCenterRecordsId
(
bean
.
getId
());
if
(
"GROUP"
.
equals
(
record
.
getCallType
()))
{
// 群组聊天的时候记录标题
phone
.
setTitle
(
"由"
+
record
.
getCreateName
()
+
"发起电话会议"
);
}
else
{
phone
.
setTitle
(
record
.
getCreateName
());
}
String
acceptName
=
callService
.
getNameByPhoneFromSeat
(
bean
.
getAcceptNo
());
String
acceptId
=
callService
.
getIdByPhoneFromSeat
(
bean
.
getAcceptNo
());
if
(
acceptName
!=
null
)
{
phone
.
setUserId
(
acceptId
);
phone
.
setUsername
(
acceptName
);
}
else
{
acceptName
=
callService
.
getNameByPhone
(
bean
.
getAcceptNo
());
if
(
acceptName
!=
null
)
{
acceptId
=
callService
.
getIdByPhone
(
bean
.
getAcceptNo
());
phone
.
setUserId
(
acceptId
);
phone
.
setUsername
(
acceptName
);
}
else
{
phone
.
setUserId
(
"1"
);
phone
.
setUsername
(
bean
.
getAcceptNo
());
}
}
phone
.
setPhone
(
bean
.
getAcceptNo
());
phone
.
setShowPhone
(
bean
.
getAcceptNo
());
phone
.
setPhoneType
(
Util
.
getPhoneType
(
bean
.
getAcceptNo
()));
phone
.
setFlow
(
"CALLED"
);
phoneList
.
add
(
phone
);
// callService.addCallPhoneList(phoneList);// 添加电话列表
bean
.
setCallRecordId
(
record
.
getId
());
if
(
callService
.
addSoundRecord
(
bean
,
phoneList
,
record
)){
responseBean
.
setMessage
(
GConstants
.
OK
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_2000
);
return
responseBean
;
}
else
{
responseBean
.
setData
(
bean
);
responseBean
.
setMessage
(
"记录保存失败!"
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
}
responseBean
.
setMessage
(
message
);
responseBean
.
setStatus
(
ErrorCode
.
STATUS_CODE_4001
);
return
responseBean
;
}
public
String
formatedDownloadUrl
(
String
downloadUrl
){
try
{
if
(
StringUtils
.
isEmpty
(
downloadUrl
))
return
null
;
return
GConstants
.
getValue
(
"jd.sound.recording.prefix"
,
"https://ifos.jdair.net/sounds"
)
+
downloadUrl
.
replaceAll
(
"\\\\+"
,
"/"
).
replace
(
GConstants
.
getValue
(
"ak.sound.recording.prefix"
,
"http://10.72.23.187"
),
""
);
}
catch
(
Exception
e
)
{
// TODO: handle exception
}
return
null
;
}
// public static void main(String[] args){
// System.out.println(formatedDownloadUrl("http://10.72.23.187\\01\\log20170105204535S000Ch001.wav"));
// }
}
src/com/ejweb/modules/call/service/CallService.java
View file @
e031a93d
package
com
.
ejweb
.
modules
.
call
.
service
;
import
com.ejweb.core.base.BaseService
;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.dao.CallDao
;
import
com.ejweb.modules.call.entity.*
;
import
com.ejweb.modules.call.util.PhoneAreaEntity
;
import
com.ejweb.modules.call.util.PhoneAreaUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
@Service
@Transactional
(
readOnly
=
true
)
public
class
CallService
extends
BaseService
<
CallDao
>
{
public
void
createCallRecord
(
CallRecordEntity
entity
){
dao
.
createCallRecord
(
entity
);
}
public
void
updateCallRecord
(
CallRecordEntity
entity
){
dao
.
updateCallRecord
(
entity
);
}
public
Integer
addCallPhoneList
(
List
<
CallPhoneBean
>
phoneList
){
return
dao
.
addCallPhoneList
(
phoneList
);
}
/**
* 获取通话记录列表
*
* @author renmb
* @time 2016年12月6日
* @param bean
* @return
*/
public
PageEntity
<
CallRecordListEntity
>
getCallRecordList
(
CallRecordListBean
bean
){
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
Date
current
=
new
Date
();
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
3
);
bean
.
setStartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
bean
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
// 必须紧贴dao的查询方法
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallRecordList
(
bean
));
if
(
pageInfo
.
getPages
()<
bean
.
getPageNo
()){
// 页码大于总页数,则返回NULL
return
null
;
}
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
return
null
;
}
//过滤重复记录
List
<
CallRecordListEntity
>
templist
=
new
ArrayList
<
CallRecordListEntity
>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
CallRecordListEntity
callRecordListEntity
=
list
.
get
(
i
);
if
(
i
>
0
&&
"FAILD"
.
equals
(
callRecordListEntity
.
getEndStatus
()))
{
CallRecordListEntity
last
=
list
.
get
(
i
-
1
);
if
(
"SUCCESS"
.
equals
(
last
.
getEndStatus
())
&&
callRecordListEntity
.
getCreateName
().
equals
(
last
.
getCreateName
())
&&
callRecordListEntity
.
get
Username
().
equals
(
last
.
getUsername
())
&&
!
callRecordListEntity
.
getEndTime
().
before
(
last
.
getStartTime
()))
{
templist
.
add
(
callRecordListEntity
);
}
}
}
if
(
templist
.
size
()>
0
){
list
.
removeAll
(
templist
);
pageInfo
.
setSize
(
list
.
size
());
pageInfo
.
set
Total
(
list
.
size
());
}
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
page
.
setPageNo
(
pageInfo
.
getPageNum
());
page
.
setPage
Size
(
pageInfo
.
getPageSize
());
page
.
set
Count
(
pageInfo
.
getTotal
());
page
.
set
TotalPage
(
pageInfo
.
getPages
());
page
.
set
List
(
pageInfo
.
getList
());
return
page
;
}
public
PageEntity
<
CallRecordListEntity
>
getCallSoundList
(
CallRecordListBean
bean
){
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
Date
current
=
new
Date
();
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
6
);
bean
.
setStartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
bean
.
set
EndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
// 必须紧贴dao的查询方法
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallSoundList
(
bean
));
if
(
pageInfo
.
getPages
()
<
bean
.
getPageNo
())
{
// 页码大于总页数,则返回NULL
return
null
;
}
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
return
null
;
}
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
page
.
setPageNo
(
pageInfo
.
getPageNum
());
page
.
setPage
Size
(
pageInfo
.
getPageSize
());
page
.
set
Count
(
pageInfo
.
getTotal
());
page
.
set
TotalPage
(
pageInfo
.
getPages
());
page
.
set
List
(
pageInfo
.
getList
());
return
page
;
}
/**
* 根据电话号码查询,通话来电号码查询用户信息
*
*
1、席位优先
*
2、查询最近通话记录
*
3、查询用户表,如果有多个用户就展示用户手机号或者座机号
*
*
@author renmb
* @
time 2017年1月5日
* @
param bean
* @
return
*
/
public
List
<
CallPhoneInfoListEntity
>
findUserByCallPhone
(
CallFindPhoneInfoBean
bean
,
boolean
isOnlySearch
){
bean
.
setMobileNubmer0
(
"0"
+
bean
.
getPhoneNumer
());
bean
.
setMobileNubmer0
0
(
"00"
+
bean
.
getPhoneNumer
());
List
<
CallPhoneInfoListEntity
>
callList
=
dao
.
findUserByCallRecord
(
bean
);
if
(
callList
==
null
||
callList
.
size
()
==
0
){
// 没有匹配到席位信息
List
<
CallPhoneInfoListEntity
>
seatList
=
dao
.
findSeatListByCallPhone
(
bean
);
if
(
seatList
==
null
||
seatList
.
size
()
==
0
){
// 没有匹配到通话记录信息
List
<
CallPhoneInfoListEntity
>
userList
=
dao
.
findUserByCallPhone
(
bean
);
if
(
userList
==
null
||
userList
.
size
()
==
0
||
userList
.
size
()
>
1
){
// 没有匹配到用户信息,或者匹配个数大于1
CallPhoneInfoListEntity
entity
=
new
CallPhoneInfoListEntity
();
entity
.
setType
(
"PHONE"
);
entity
.
setUserId
(
""
);
entity
.
setName
(
bean
.
getPhoneNumer
());
entity
.
setPhone
(
bean
.
getPhoneNumer
());
List
<
CallPhoneInfoListEntity
>
phoneList
=
new
ArrayList
<
CallPhoneInfoListEntity
>(
1
);
phoneList
.
add
(
entity
);
return
phoneList
;
}
else
{
// 有用户信息直接返回
return
userList
;
}
}
else
{
// 有通话记录信息,直接返回
return
seatList
;
}
}
else
{
// 有席位信息直接返回
return
callList
;
}
}
/**
* 被叫方添加通话记录
*
* @author renmb
* @time 2017年3月17日
* @param bean
* @param fromUser
*/
// public void addCallRecordByCalled(CallFindPhoneInfoBean bean, CallPhoneInfoListEntity fromUser){
// if("RECORD".equals(fromUser.getFromType())){// 记录是从通话记录里面获取的
//
// return ;
// }
// CallPhoneInfoListEntity calledUser = dao.findUserInfoByNumOrId(bean);// 被拨打方用户信息
// if(calledUser == null){
//
// return ;
// }
// CallRecordEntity record = new CallRecordEntity();
// record.setCallType("USER");
// record.setEndStatus("CALLING");
// record.setId(IdWorker.getNextId());
// record.setChannelType("APP");
// record.setStartTime(new Date());
// record.setAppCode(bean.getAppCode());
// record.setPlatform(bean.getPlatform());
// record.setVersionName(bean.getVersionName());
// record.setUserCount(1);
// if(StringUtils.isEmpty(fromUser.getUserId())){
// record.setCreateBy("");
// record.setCreateName(bean.getPhoneNumer());
// record.setCreatePhone(bean.getPhoneNumer());
// record.setCreateShowPhone(bean.getPhoneNumer());
// record.setPhoneType(Util.getPhoneType(bean.getPhoneNumer()));
// } else{
//
// record.setCreateBy(fromUser.getUserId());
// record.setCreateName(fromUser.getName());
// record.setCreatePhone(fromUser.getHuaweiNum());
// record.setCreateShowPhone(bean.getPhoneNumer());
// record.setPhoneType(Util.getPhoneType(fromUser.getHuaweiNum()));
// }
// this.createCallRecord(record);// 添加主记录
//
// CallPhoneBean calledPhone = new CallPhoneBean();
// calledPhone.setId(IdWorker.getNextId());
// calledPhone.setPhoneType(Util.getPhoneType(bean.getPhoneNumer()));
// calledPhone.setRecordId(record.getId());
// calledPhone.setTitle(bean.getPhoneNumer());
// calledPhone.setFlow("CALLED");
// calledPhone.setUsername(calledUser.getName());
// calledPhone.setUserId(calledUser.getUserId());
//
// List<CallPhoneBean> phoneList = new ArrayList<CallPhoneBean>(1);
// phoneList.add(calledPhone);
// this.addCallPhoneList(phoneList);// 添加电话列表
// }
/**
* 综合查询手机号的归属地信息
*
* @author renmb
* @time 2017年1月22日
* @param mobile
* @return
*/
@Transactional
(
readOnly
=
false
)
public
CallPhoneAreaEntity
addPhoneArea
(
String
mobile
){
if
(
StringUtils
.
isEmpty
(
mobile
)
||
mobile
.
length
()<
7
){
return
null
;
}
String
src
=
new
String
(
mobile
);
CallPhoneAreaEntity
phoneArea
=
null
;
mobile
=
mobile
.
replaceAll
(
"^0+"
,
""
);
// 去掉手机号前面的0
if
(
mobile
.
length
()>
7
){
CallPhoneAreaEntity
searchMobile
=
new
CallPhoneAreaEntity
();
// 第二步: 通过地区码查询手机归宿地信息
searchMobile
.
setAreaCode
(
mobile
.
substring
(
0
,
7
));
searchMobile
.
setMobile
(
mobile
);
phoneArea
=
dao
.
getPhoneAreaByAreaCode
(
searchMobile
);
if
(
phoneArea
!=
null
&&
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
phoneArea
.
setMobileNubmer
(
phoneArea
.
getPremobile
()+
mobile
);
return
phoneArea
;
}
// 第三步:通过360接口获取归属地信息
phoneArea
=
this
.
getCallPhoneAreaBy360
(
mobile
);
if
(
phoneArea
!=
null
){
if
(
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
// 手机类型进行缓存数据库
phoneArea
.
setId
(
IdWorker
.
getNextId
());
phoneArea
.
setUpdateDate
(
new
Date
());
if
(
phoneArea
.
getMobile
().
length
()>=
7
){
phoneArea
.
setAreaCode
(
phoneArea
.
getMobile
().
substring
(
0
,
7
));
dao
.
addPhoneAreaCode
(
phoneArea
);
}
dao
.
addPhoneAreaRecord
(
phoneArea
);
}
else
{
// 非手机号,按座机号处理
phoneArea
.
setShowPhone
(
src
);
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
phoneArea
.
setType
(
"PHONE"
);
}
return
phoneArea
;
}
}
phoneArea
=
new
CallPhoneAreaEntity
();
phoneArea
.
setShowPhone
(
src
);
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
phoneArea
.
setType
(
"PHONE"
);
return
phoneArea
;
}
@Transactional
(
readOnly
=
false
)
public
CallPhoneAreaEntity
getCallPhoneAreaBy360
(
String
mobile
){
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
callPhone
.
setMobile
(
mobile
);
// 格式化手机号
if
(
StringUtils
.
isNotBlank
(
mobile
)){
// 国外手机号,前面加拨3个0
if
(
mobile
.
startsWith
(
"+"
)){
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setPremobile
(
"000"
);
callPhone
.
setMobileNubmer
(
"000"
+
mobile
.
replace
(
"+"
,
""
));
return
callPhone
;
// 可能是手机号
}
else
if
(
mobile
.
startsWith
(
"0"
)
==
false
){
PhoneAreaEntity
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
if
(
area
==
null
){
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
}
if
(
area
!=
null
&&
StringUtils
.
isNotBlank
(
area
.
getProvince
())){
// 能够查到省份信息
if
(
area
.
getProvince
().
contains
(
"北京"
)
||
(
StringUtils
.
isNotBlank
(
area
.
getCity
())
&&
area
.
getCity
().
contains
(
"北京"
))){
// 北京前面加拨一个0
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setMobileNubmer
(
"0"
+
mobile
);
// 加拨1个0
callPhone
.
setPremobile
(
"0"
);
callPhone
.
setMobileProvince
(
"北京"
);
callPhone
.
setMobileCity
(
"北京"
);
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
return
callPhone
;
}
else
{
// 非北京号码加拨两个0
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setMobileNubmer
(
"00"
+
mobile
);
// 加拨2个0
callPhone
.
setPremobile
(
"00"
);
callPhone
.
setMobileProvince
(
area
.
getProvince
());
callPhone
.
setMobileCity
(
StringUtils
.
isBlank
(
area
.
getCity
())
?
""
:
area
.
getCity
());
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
return
callPhone
;
}
}
}
}
// 非手机号,按座机号处理
callPhone
.
setShowPhone
(
mobile
);
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
mobile
));
callPhone
.
setType
(
"PHONE"
);
return
callPhone
;
}
/**
* 添加安科同步过来的数据
*
* @author renmb
* @time 2017年2月28日
* @param entity
* @return
*/
public
boolean
addSoundRecord
(
CallSoundRecordBean
entity
,
List
<
CallPhoneBean
>
phoneList
,
CallRecordEntity
record
){
dao
.
createCallRecord
(
record
);
dao
.
addCallPhoneList
(
phoneList
);
Integer
count
=
dao
.
addSoundRecord
(
entity
);
return
count
!=
null
&&
count
>
0
;
}
public
Map
<
String
,
String
>
findPhoneByHuaweiNum
(
List
<
String
>
huweiNumList
){
HuaweiNumListEntity
entity
=
new
HuaweiNumListEntity
();
entity
.
setHuweiNumList
(
huweiNumList
);
List
<
CallPhoneInfoListEntity
>
list
=
dao
.
findPhneListByHuaweiNum
(
entity
);
if
(
list
==
null
||
list
.
size
()
==
0
){
return
null
;
}
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
for
(
CallPhoneInfoListEntity
p:
list
){
map
.
put
(
p
.
getHuaweiNum
(),
p
.
getPhone
());
}
return
map
;
}
// public String GetPhoneById(String id){
// return dao. GetPhoneById( id);
// }
public
List
<
MemberEntity
>
getMemberList
(
String
id
)
{
return
dao
.
getMemberList
(
id
);
}
public
String
getNameByPhone
(
String
createPhone
)
{
// TODO Auto-generated method stub
return
dao
.
getNameByPhone
(
createPhone
);
}
public
String
getNameByPhoneFromSeat
(
String
createPhone
)
{
// TODO Auto-generated method stub
return
dao
.
getNameByPhoneFromSeat
(
createPhone
);
}
public
String
getIdByPhoneFromSeat
(
String
callNo
)
{
// TODO Auto-generated method stub
return
dao
.
getIdByPhoneFromSeat
(
callNo
);
}
public
String
getIdByPhone
(
String
callNo
)
{
// TODO Auto-generated method stub
return
dao
.
getIdByPhone
(
callNo
);
}
}
package
com
.
ejweb
.
modules
.
call
.
service
;
import
com.ejweb.core.base.BaseService
;
import
com.ejweb.core.base.PageEntity
;
import
com.ejweb.core.util.IdWorker
;
import
com.ejweb.core.util.Util
;
import
com.ejweb.modules.call.bean.CallFindPhoneInfoBean
;
import
com.ejweb.modules.call.bean.CallPhoneBean
;
import
com.ejweb.modules.call.bean.CallRecordListBean
;
import
com.ejweb.modules.call.dao.CallDao
;
import
com.ejweb.modules.call.entity.*
;
import
com.ejweb.modules.call.util.PhoneAreaEntity
;
import
com.ejweb.modules.call.util.PhoneAreaUtil
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.time.DateFormatUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.*
;
@Service
@Transactional
(
readOnly
=
true
)
public
class
CallService
extends
BaseService
<
CallDao
>
{
public
void
createCallRecord
(
CallRecordEntity
entity
){
dao
.
createCallRecord
(
entity
);
}
public
void
updateCallRecord
(
CallRecordEntity
entity
){
dao
.
updateCallRecord
(
entity
);
}
public
Integer
addCallPhoneList
(
List
<
CallPhoneBean
>
phoneList
){
return
dao
.
addCallPhoneList
(
phoneList
);
}
/**
* 获取通话记录列表
*
* @author renmb
* @time 2016年12月6日
* @param bean
* @return
*/
public
PageEntity
<
CallRecordListEntity
>
getCallRecordList
(
CallRecordListBean
bean
){
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
Date
current
=
new
Date
();
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
3
);
bean
.
setStartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
bean
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
// List<CallRecordListEntity> callRecordList = dao.getCallRecordList(bean);
// 必须紧贴dao的查询方法
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallRecordList
(
bean
));
// if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
//
// return null;
// }
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
return
null
;
}
//过滤重复记录
List
<
CallRecordListEntity
>
templist
=
new
ArrayList
<
CallRecordListEntity
>();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
CallRecordListEntity
callRecordListEntity
=
list
.
get
(
i
);
if
(
i
>
0
&&
"FAILD"
.
equals
(
callRecordListEntity
.
getEndStatus
()))
{
CallRecordListEntity
last
=
list
.
get
(
i
-
1
);
if
(
"SUCCESS"
.
equals
(
last
.
getEndStatus
())
&&
callRecordListEntity
.
get
CreateName
().
equals
(
last
.
getCreateName
())
&&
callRecordListEntity
.
getUsername
().
equals
(
last
.
getUsername
())
&&
!
callRecordListEntity
.
getEndTime
().
before
(
last
.
getStartTime
()))
{
templist
.
add
(
callRecordListEntity
);
}
}
}
if
(
templist
.
size
()>
0
){
list
.
removeAll
(
templist
);
pageInfo
.
set
Size
(
list
.
size
());
pageInfo
.
setTotal
(
list
.
size
());
}
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
page
.
setPage
No
(
pageInfo
.
getPageNum
());
page
.
set
PageSize
(
pageInfo
.
getPageSize
());
page
.
set
Count
(
pageInfo
.
getTotal
());
page
.
set
TotalPage
(
pageInfo
.
getPages
());
page
.
setList
(
pageInfo
.
getList
());
return
page
;
}
public
PageEntity
<
CallRecordListEntity
>
getCallSoundList
(
CallRecordListBean
bean
){
PageInfo
<
CallRecordListEntity
>
pageInfo
=
null
;
Date
current
=
new
Date
();
Date
startTime
=
DateUtils
.
addDays
(
current
,
-
6
);
bean
.
set
StartTime
(
DateFormatUtils
.
format
(
startTime
,
"yyyy-MM-dd 00:00:00"
));
bean
.
setEndTime
(
DateFormatUtils
.
format
(
current
,
"yyyy-MM-dd 23:59:59"
));
// 必须紧贴dao的查询方法
PageHelper
.
startPage
(
bean
.
getPageNo
(),
bean
.
getPageSize
());
pageInfo
=
new
PageInfo
<
CallRecordListEntity
>(
dao
.
getCallSoundList
(
bean
));
if
(
pageInfo
.
getPages
()
<
bean
.
getPageNo
())
{
// 页码大于总页数,则返回NULL
return
null
;
}
List
<
CallRecordListEntity
>
list
=
pageInfo
.
getList
();
if
(
list
==
null
||
list
.
size
()
==
0
)
{
// 如果没有数据则返回NULL
return
null
;
}
PageEntity
<
CallRecordListEntity
>
page
=
new
PageEntity
<
CallRecordListEntity
>();
page
.
setPage
No
(
pageInfo
.
getPageNum
());
page
.
set
PageSize
(
pageInfo
.
getPageSize
());
page
.
set
Count
(
pageInfo
.
getTotal
());
page
.
set
TotalPage
(
pageInfo
.
getPages
());
page
.
setList
(
pageInfo
.
getList
());
return
page
;
}
/**
*
根据电话号码查询,通话来电号码查询用户信息
*
*
1、席位优先
*
2、查询最近通话记录
*
3、查询用户表,如果有多个用户就展示用户手机号或者座机号
*
* @
author renmb
* @
time 2017年1月5日
* @
param bean
*
@return
*/
public
List
<
CallPhoneInfoListEntity
>
findUserByCallPhone
(
CallFindPhoneInfoBean
bean
,
boolean
isOnlySearch
){
bean
.
setMobileNubmer0
(
"0"
+
bean
.
getPhoneNumer
());
bean
.
setMobileNubmer00
(
"00"
+
bean
.
getPhoneNumer
());
List
<
CallPhoneInfoListEntity
>
callList
=
dao
.
findUserByCallRecord
(
bean
);
if
(
callList
==
null
||
callList
.
size
()
==
0
){
// 没有匹配到席位信息
List
<
CallPhoneInfoListEntity
>
seatList
=
dao
.
findSeatListByCallPhone
(
bean
);
if
(
seatList
==
null
||
seatList
.
size
()
==
0
){
// 没有匹配到通话记录信息
List
<
CallPhoneInfoListEntity
>
userList
=
dao
.
findUserByCallPhone
(
bean
);
if
(
userList
==
null
||
userList
.
size
()
==
0
||
userList
.
size
()
>
1
){
// 没有匹配到用户信息,或者匹配个数大于1
CallPhoneInfoListEntity
entity
=
new
CallPhoneInfoListEntity
();
entity
.
setType
(
"PHONE"
);
entity
.
setUserId
(
""
);
entity
.
setName
(
bean
.
getPhoneNumer
());
entity
.
setPhone
(
bean
.
getPhoneNumer
());
List
<
CallPhoneInfoListEntity
>
phoneList
=
new
ArrayList
<
CallPhoneInfoListEntity
>(
1
);
phoneList
.
add
(
entity
);
return
phoneList
;
}
else
{
// 有用户信息直接返回
return
userList
;
}
}
else
{
// 有通话记录信息,直接返回
return
seatList
;
}
}
else
{
// 有席位信息直接返回
return
callList
;
}
}
/**
* 被叫方添加通话记录
*
* @author renmb
* @time 2017年3月17日
* @param bean
* @param fromUser
*/
// public void addCallRecordByCalled(CallFindPhoneInfoBean bean, CallPhoneInfoListEntity fromUser){
// if("RECORD".equals(fromUser.getFromType())){// 记录是从通话记录里面获取的
//
// return ;
// }
// CallPhoneInfoListEntity calledUser = dao.findUserInfoByNumOrId(bean);// 被拨打方用户信息
// if(calledUser == null){
//
// return ;
// }
// CallRecordEntity record = new CallRecordEntity();
// record.setCallType("USER");
// record.setEndStatus("CALLING");
// record.setId(IdWorker.getNextId());
// record.setChannelType("APP");
// record.setStartTime(new Date());
// record.setAppCode(bean.getAppCode());
// record.setPlatform(bean.getPlatform());
// record.setVersionName(bean.getVersionName());
// record.setUserCount(1);
// if(StringUtils.isEmpty(fromUser.getUserId())){
// record.setCreateBy("");
// record.setCreateName(bean.getPhoneNumer());
// record.setCreatePhone(bean.getPhoneNumer());
// record.setCreateShowPhone(bean.getPhoneNumer());
// record.setPhoneType(Util.getPhoneType(bean.getPhoneNumer()));
// } else{
//
// record.setCreateBy(fromUser.getUserId());
// record.setCreateName(fromUser.getName());
// record.setCreatePhone(fromUser.getHuaweiNum());
// record.setCreateShowPhone(bean.getPhoneNumer());
// record.setPhoneType(Util.getPhoneType(fromUser.getHuaweiNum()));
// }
// this.createCallRecord(record);// 添加主记录
//
// CallPhoneBean calledPhone = new CallPhoneBean();
// calledPhone.setId(IdWorker.getNextId());
// calledPhone.setPhoneType(Util.getPhoneType(bean.getPhoneNumer()));
// calledPhone.setRecordId(record.getId());
// calledPhone.setTitle(bean.getPhoneNumer());
// calledPhone.setFlow("CALLED");
// calledPhone.setUsername(calledUser.getName());
// calledPhone.setUserId(calledUser.getUserId());
//
// List<CallPhoneBean> phoneList = new ArrayList<CallPhoneBean>(1);
// phoneList.add(calledPhone);
// this.addCallPhoneList(phoneList);// 添加电话列表
// }
/**
* 综合查询手机号的归属地信息
*
* @author renmb
* @time 2017年1月22日
* @param mobile
* @return
*/
@Transactional
(
readOnly
=
false
)
public
CallPhoneAreaEntity
addPhoneArea
(
String
mobile
){
if
(
StringUtils
.
isEmpty
(
mobile
)
||
mobile
.
length
()<
7
){
return
null
;
}
String
src
=
new
String
(
mobile
);
CallPhoneAreaEntity
phoneArea
=
null
;
mobile
=
mobile
.
replaceAll
(
"^0+"
,
""
);
// 去掉手机号前面的0
if
(
mobile
.
length
()>
7
){
CallPhoneAreaEntity
searchMobile
=
new
CallPhoneAreaEntity
();
// 第二步: 通过地区码查询手机归宿地信息
searchMobile
.
setAreaCode
(
mobile
.
substring
(
0
,
7
));
searchMobile
.
setMobile
(
mobile
);
phoneArea
=
dao
.
getPhoneAreaByAreaCode
(
searchMobile
);
if
(
phoneArea
!=
null
&&
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
phoneArea
.
setMobileNubmer
(
phoneArea
.
getPremobile
()+
mobile
);
return
phoneArea
;
}
// 第三步:通过360接口获取归属地信息
phoneArea
=
this
.
getCallPhoneAreaBy360
(
mobile
);
if
(
phoneArea
!=
null
){
if
(
StringUtils
.
isNotEmpty
(
phoneArea
.
getPremobile
())){
// 手机类型进行缓存数据库
phoneArea
.
setId
(
IdWorker
.
getNextId
());
phoneArea
.
setUpdateDate
(
new
Date
());
if
(
phoneArea
.
getMobile
().
length
()>=
7
){
phoneArea
.
setAreaCode
(
phoneArea
.
getMobile
().
substring
(
0
,
7
));
dao
.
addPhoneAreaCode
(
phoneArea
);
}
dao
.
addPhoneAreaRecord
(
phoneArea
);
}
else
{
// 非手机号,按座机号处理
phoneArea
.
setShowPhone
(
src
);
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
phoneArea
.
setType
(
"PHONE"
);
}
return
phoneArea
;
}
}
phoneArea
=
new
CallPhoneAreaEntity
();
phoneArea
.
setShowPhone
(
src
);
phoneArea
.
setPhone
(
Util
.
formatedWorkPhone
(
src
));
phoneArea
.
setType
(
"PHONE"
);
return
phoneArea
;
}
@Transactional
(
readOnly
=
false
)
public
CallPhoneAreaEntity
getCallPhoneAreaBy360
(
String
mobile
){
CallPhoneAreaEntity
callPhone
=
new
CallPhoneAreaEntity
();
callPhone
.
setMobile
(
mobile
);
// 格式化手机号
if
(
StringUtils
.
isNotBlank
(
mobile
)){
// 国外手机号,前面加拨3个0
if
(
mobile
.
startsWith
(
"+"
)){
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setPremobile
(
"000"
);
callPhone
.
setMobileNubmer
(
"000"
+
mobile
.
replace
(
"+"
,
""
));
return
callPhone
;
// 可能是手机号
}
else
if
(
mobile
.
startsWith
(
"0"
)
==
false
){
PhoneAreaEntity
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
if
(
area
==
null
){
area
=
PhoneAreaUtil
.
get360PhoneArea
(
mobile
);
}
if
(
area
!=
null
&&
StringUtils
.
isNotBlank
(
area
.
getProvince
())){
// 能够查到省份信息
if
(
area
.
getProvince
().
contains
(
"北京"
)
||
(
StringUtils
.
isNotBlank
(
area
.
getCity
())
&&
area
.
getCity
().
contains
(
"北京"
))){
// 北京前面加拨一个0
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setMobileNubmer
(
"0"
+
mobile
);
// 加拨1个0
callPhone
.
setPremobile
(
"0"
);
callPhone
.
setMobileProvince
(
"北京"
);
callPhone
.
setMobileCity
(
"北京"
);
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
return
callPhone
;
}
else
{
// 非北京号码加拨两个0
callPhone
.
setType
(
"MOBILE"
);
callPhone
.
setMobileNubmer
(
"00"
+
mobile
);
// 加拨2个0
callPhone
.
setPremobile
(
"00"
);
callPhone
.
setMobileProvince
(
area
.
getProvince
());
callPhone
.
setMobileCity
(
StringUtils
.
isBlank
(
area
.
getCity
())
?
""
:
area
.
getCity
());
callPhone
.
setMobileSp
(
StringUtils
.
isBlank
(
area
.
getSp
())
?
""
:
area
.
getSp
());
return
callPhone
;
}
}
}
}
// 非手机号,按座机号处理
callPhone
.
setShowPhone
(
mobile
);
callPhone
.
setPhone
(
Util
.
formatedWorkPhone
(
mobile
));
callPhone
.
setType
(
"PHONE"
);
return
callPhone
;
}
/**
* 添加安科同步过来的数据
*
* @author renmb
* @time 2017年2月28日
* @param entity
* @return
*/
public
boolean
addSoundRecord
(
CallSoundRecordBean
entity
,
List
<
CallPhoneBean
>
phoneList
,
CallRecordEntity
record
){
dao
.
createCallRecord
(
record
);
dao
.
addCallPhoneList
(
phoneList
);
Integer
count
=
dao
.
addSoundRecord
(
entity
);
return
count
!=
null
&&
count
>
0
;
}
public
Map
<
String
,
String
>
findPhoneByHuaweiNum
(
List
<
String
>
huweiNumList
){
HuaweiNumListEntity
entity
=
new
HuaweiNumListEntity
();
entity
.
setHuweiNumList
(
huweiNumList
);
List
<
CallPhoneInfoListEntity
>
list
=
dao
.
findPhneListByHuaweiNum
(
entity
);
if
(
list
==
null
||
list
.
size
()
==
0
){
return
null
;
}
Map
<
String
,
String
>
map
=
new
HashMap
<
String
,
String
>();
for
(
CallPhoneInfoListEntity
p:
list
){
map
.
put
(
p
.
getHuaweiNum
(),
p
.
getPhone
());
}
return
map
;
}
// public String GetPhoneById(String id){
// return dao. GetPhoneById( id);
// }
public
List
<
MemberEntity
>
getMemberList
(
String
id
)
{
return
dao
.
getMemberList
(
id
);
}
public
String
getNameByPhone
(
String
createPhone
)
{
// TODO Auto-generated method stub
return
dao
.
getNameByPhone
(
createPhone
);
}
public
String
getNameByPhoneFromSeat
(
String
createPhone
)
{
// TODO Auto-generated method stub
return
dao
.
getNameByPhoneFromSeat
(
createPhone
);
}
public
String
getIdByPhoneFromSeat
(
String
callNo
)
{
// TODO Auto-generated method stub
return
dao
.
getIdByPhoneFromSeat
(
callNo
);
}
public
String
getIdByPhone
(
String
callNo
)
{
// TODO Auto-generated method stub
return
dao
.
getIdByPhone
(
callNo
);
}
}
src/com/ejweb/modules/user/api/UserController.java
View file @
e031a93d
...
...
@@ -82,7 +82,10 @@ public class UserController {
String
message
=
userService
.
validate
(
requestBean
,
errors
);
if
(
message
==
null
)
{
UserFindByCodeBean
reqUserBean
=
requestBean
.
getObjectBean
(
UserFindByCodeBean
.
class
);
// reqUserBean.setUsercode("1000154873");
message
=
userService
.
validate
(
reqUserBean
,
errors
);
message
=
null
;
if
(
message
==
null
)
{
UserEntity
userEntity
=
userService
.
findByCode
(
reqUserBean
.
getUsercode
());
message
=
userService
.
validate
(
userEntity
,
errors
);
...
...
web/WEB-INF/web.xml
0 → 100644
View file @
e031a93d
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns=
"http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
version=
"4.0"
>
</web-app>
\ 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