Commit 18c2ff27 by Java-金吉宝

重复记录

parent 1d43b2c7
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ejweb.modules.contact.dao.SoundRecordingDao"> <mapper namespace="com.ejweb.modules.contact.dao.SoundRecordingDao">
<select id="findList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity"> <!-- <select id="findList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
select *
from (
SELECT CONCAT(ac.create_name,ap.username,(UNIX_TIMESTAMP(ac.end_time)-ac.duration)) as b, SELECT CONCAT(ac.create_name,ap.username,(UNIX_TIMESTAMP(ac.end_time)-ac.duration)) as b,
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName, create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
<where> where
ac.end_status !='INIT' ac.end_status !='INIT'
<if test="seatList.size() > 0"> <if test="seatList.size() > 0">
and (ac.create_by in and (ac.create_by in
...@@ -40,21 +42,88 @@ ...@@ -40,21 +42,88 @@
<if test="dbName == 'mssql'">'%'+#{acceptNo}+'%'</if> <if test="dbName == 'mssql'">'%'+#{acceptNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptNo}, '%')</if> <if test="dbName == 'mysql'">CONCAT('%', #{acceptNo}, '%')</if>
</if> </if>
<if test="acceptName != null and acceptName != ''"> <if test='acceptName != null and acceptName != ""'>
AND ap.username LIKE AND ap.username LIKE
<if test="dbName == 'oracle'">'%'||#{acceptName}||'%'</if> <if test="dbName == 'oracle'">'%'||#{acceptName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptName}+'%'</if> <if test="dbName == 'mssql'">'%'+#{acceptName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptName}, '%')</if> <if test="dbName == 'mysql'">CONCAT('%', #{acceptName}, '%')</if>
</if> </if>
<if test="beginTime != null and beginTime != ''"> <if test='beginTime != null and beginTime != ""'>
AND (ac.start_time BETWEEN #{beginTime} AND #{endTime}) AND ac.start_time <![CDATA[<=]]>#{endTime} and ac.start_time <![CDATA[>=]]> #{beginTime}
<!-- AND ac.start_time <![CDATA[>]]> #{beginTime} --> AND ac.start_time <![CDATA[>]]> #{beginTime}
</if> </if>
<if test="endTime != null and endTime != ''"> <if test='endTime != null and endTime != ""'>
AND ( ac.end_time <![CDATA[<]]> #{endTime} OR ac.end_time is NULL) AND ( ac.end_time <![CDATA[<]]> #{endTime} OR ac.end_time is NULL)
</if> </if>
</where>
group by b GROUP BY b
ORDER BY ac.start_time desc ) er
ORDER BY beginTime DESC
</select> -->
<select id="findList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
SELECT
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
where
ac.end_status !='INIT'
<if test="seatList.size() > 0">
and (ac.create_by in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
or
ap.user_id in
<foreach item="item" collection="seatList" separator="," open="(" close=")" index="">
#{item.id}
</foreach>
)
</if>
<if test="callNo != null and callNo != ''">
AND ac.create_phone LIKE
<if test="dbName == 'oracle'">'%'||#{callNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callNo}, '%')</if>
</if>
<if test="callName != null and callName != ''">
AND ac.create_name LIKE
<if test="dbName == 'oracle'">'%'||#{callName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{callName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{callName}, '%')</if>
</if>
<if test="acceptNo != null and acceptNo != ''">
AND ap.phone LIKE
<if test="dbName == 'oracle'">'%'||#{acceptNo}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptNo}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptNo}, '%')</if>
</if>
<if test='acceptName != null and acceptName != ""'>
AND ap.username LIKE
<if test="dbName == 'oracle'">'%'||#{acceptName}||'%'</if>
<if test="dbName == 'mssql'">'%'+#{acceptName}+'%'</if>
<if test="dbName == 'mysql'">CONCAT('%', #{acceptName}, '%')</if>
</if>
<if test='beginTime != null and beginTime != ""'>
AND ac.start_time <![CDATA[<=]]>#{endTime} and ac.start_time <![CDATA[>=]]> #{beginTime}
AND ac.start_time <![CDATA[>]]> #{beginTime}
</if>
<if test='endTime != null and endTime != ""'>
AND ( ac.end_time <![CDATA[<]]> #{endTime} OR ac.end_time is NULL)
</if>
ORDER BY beginTime DESC
</select>
<select id="findRecordingList" resultType="com.ejweb.modules.contact.entity.SoundRecordingEntity">
SELECT
create_phone AS callNo,ac.create_name AS callName,ap.phone AS acceptNo,ap.username AS acceptName,
ac.start_time AS beginTime, ac.end_time AS endTime, ac.download_url ,ac.duration,end_status AS result
FROM foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id=ap.record_id
where
ac.end_status !='INIT'
and ac.create_name=#{callName}
and ap.username=#{acceptName}
and ac.start_time=#{endTime}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
package com.ejweb.modules.contact.dao; package com.ejweb.modules.contact.dao;
import java.util.List;
import com.ejweb.core.persistence.CrudDao; import com.ejweb.core.persistence.CrudDao;
import com.ejweb.core.persistence.annotation.MyBatisDao; import com.ejweb.core.persistence.annotation.MyBatisDao;
import com.ejweb.modules.contact.entity.SoundRecordingEntity; import com.ejweb.modules.contact.entity.SoundRecordingEntity;
...@@ -7,4 +9,6 @@ import com.ejweb.modules.contact.entity.SoundRecordingEntity; ...@@ -7,4 +9,6 @@ import com.ejweb.modules.contact.entity.SoundRecordingEntity;
@MyBatisDao @MyBatisDao
public interface SoundRecordingDao extends CrudDao<SoundRecordingEntity> { public interface SoundRecordingDao extends CrudDao<SoundRecordingEntity> {
List<SoundRecordingEntity> findRecordingList(SoundRecordingEntity entityTmp);
} }
...@@ -69,4 +69,9 @@ public class SoundRecordingService extends CrudService<SoundRecordingDao, SoundR ...@@ -69,4 +69,9 @@ public class SoundRecordingService extends CrudService<SoundRecordingDao, SoundR
System.out.print(res); System.out.print(res);
return page; return page;
} }
public List<SoundRecordingEntity> findRecordingList(SoundRecordingEntity entityTmp) {
// TODO Auto-generated method stub
return dao.findRecordingList(entityTmp);
}
} }
...@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection; import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -82,10 +83,18 @@ public class SoundRecordingController extends BaseController { ...@@ -82,10 +83,18 @@ public class SoundRecordingController extends BaseController {
if(StringUtils.isNoneBlank(proxy)){ if(StringUtils.isNoneBlank(proxy)){
proxy="https://ifos.jdair.net/sounds/"; proxy="https://ifos.jdair.net/sounds/";
} }
List<SoundRecordingEntity> templist = new ArrayList<SoundRecordingEntity>();
for (SoundRecordingEntity entityTmp : page.getList()) { for (SoundRecordingEntity entityTmp : page.getList()) {
if (StringUtils.isNotBlank(entityTmp.getDownloadUrl())) { if (StringUtils.isNotBlank(entityTmp.getDownloadUrl())) {
entityTmp.setDownloadUrl(entityTmp.getDownloadUrl().replaceAll(".{4,5}://.*?(/|\\\\)", proxy).replaceAll("\\\\", "/")); entityTmp.setDownloadUrl(entityTmp.getDownloadUrl().replaceAll(".{4,5}://.*?(/|\\\\)", proxy).replaceAll("\\\\", "/"));
} }
List<SoundRecordingEntity> entity = soundRecordingService.findRecordingList(entityTmp);
if(entity.size()>0){
templist.add(entityTmp);
}
}
if(templist.size()>0){
page.getList().removeAll(templist);
} }
} }
model.addAttribute("page", page); model.addAttribute("page", page);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment