Commit 65fdc2bd by java-李谡

Merge branch 'develop'

parents 7ca35260 e31cb219
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_91"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
# Created by .ignore support plugin (hsz.mobi)
/im.message.log
/.idea/
/out/
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>foc-api-1.0</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/*.min.js|**/node_modules/*|**/bower_components/*" kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="foc-api-1.0">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/resources"/>
<property name="context-root" value="foc-api-1.0"/>
<property name="java-output-path" value="/foc-api-1.0/build/classes"/>
</wb-module>
</project-modules>
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="java"/>
<fixed facet="jst.web"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
\ No newline at end of file
...@@ -69,7 +69,7 @@ content.sign.private.key=FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn ...@@ -69,7 +69,7 @@ content.sign.private.key=FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn
# Verify Post Content Sign(Default true) # Verify Post Content Sign(Default true)
is.verify.content.sign=false is.verify.content.sign=false
# \u9996\u822A\u63A5\u53E3\u57FA\u672C\u5730\u5740 # \u9996\u822A\u63A5\u53E3\u57FA\u672C\u5730\u5740
jdair.api.base.url=http://123.56.146.7 jdair.api.base.url=https://dsp.jdair.net
jdair.api.base.param=ai.cc=7&ai.cp=10.68.26.52 jdair.api.base.param=ai.cc=7&ai.cp=10.68.26.52
#huaweiUC properties #huaweiUC properties
......
# Root logger option # Root logger option
## log4j.rootLogger=DEBUG, WARN, INFO, stdout, R ## log4j.rootLogger=DEBUG, WARN, INFO, stdout, R
log4j.rootLogger=DEBUG, stdout, R log4j.rootLogger=INFO, stdout, R
#Console #Console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n #log4j.appender.stdout.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss a} [Thread: %t][ Class:%c Method: %l ]%n%p:%m%n
#RollingFile #RollingFile
log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R=org.apache.log4j.RollingFileAppender
......
...@@ -99,7 +99,7 @@ ...@@ -99,7 +99,7 @@
center_records_id center_records_id
) VALUES ) VALUES
<foreach collection="list" item="item" index="index" separator=","> <foreach collection="list" item="item" index="index" separator=",">
( (
#{item.id}, #{item.id},
#{item.recordId}, #{item.recordId},
#{item.title}, #{item.title},
...@@ -182,7 +182,7 @@ ...@@ -182,7 +182,7 @@
and r.start_time &lt;= #{endTime} and r.start_time &lt;= #{endTime}
ORDER BY r.start_time DESC ORDER BY r.start_time DESC
</select> </select>
<!-- 通过通话的电话号查询用户信息 --> <!-- 通过通话的电话号查询用户信息 -->
<select id="findUserByCallPhone" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity"> <select id="findUserByCallPhone" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT a.id AS userId, SELECT a.id AS userId,
...@@ -244,7 +244,7 @@ ...@@ -244,7 +244,7 @@
OR s.seat_phone = #{phoneNumer} OR s.seat_phone = #{phoneNumer}
OR s.seat_phone_number = #{phoneNumer} OR s.seat_phone_number = #{phoneNumer}
</select> </select>
<select id="findUserInfoByNumOrId" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity"> <select id="findUserInfoByNumOrId" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS userId, SELECT s.id AS userId,
s.seat_name AS name, s.seat_name AS name,
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
ORDER BY start_time DESC ORDER BY start_time DESC
LIMIT 1 LIMIT 1
</select> </select>
<!-- 通过通话的电话号查询席位信息 --> <!-- 通过通话的电话号查询席位信息 -->
<select id="getPhoneAreaByAreaCode" resultType="com.ejweb.modules.call.entity.CallPhoneAreaEntity"> <select id="getPhoneAreaByAreaCode" resultType="com.ejweb.modules.call.entity.CallPhoneAreaEntity">
SELECT * FROM `foc_phone_area` WHERE `area_code`=#{areaCode} SELECT * FROM `foc_phone_area` WHERE `area_code`=#{areaCode}
...@@ -351,7 +351,7 @@ ...@@ -351,7 +351,7 @@
#{updateDate} #{updateDate}
) )
</insert> </insert>
<!-- 添加安科的录音记录 --> <!-- 添加安科的录音记录 -->
<insert id="addSoundRecord"> <insert id="addSoundRecord">
INSERT INTO foc_callcenter_records( INSERT INTO foc_callcenter_records(
...@@ -394,8 +394,8 @@ ...@@ -394,8 +394,8 @@
#{createDate} #{createDate}
) )
</insert> </insert>
<!-- 安科记录 --> <!-- 安科记录 -->
<select id="getCallSoundList" resultType="com.ejweb.modules.call.entity.CallRecordListEntity"> <select id="getCallSoundList" resultType="com.ejweb.modules.call.entity.CallRecordListEntity">
...@@ -468,7 +468,7 @@ ...@@ -468,7 +468,7 @@
'SEAT' AS type, 'SEAT' AS type,
'' AS mobile '' AS mobile
FROM foc_seats s FROM foc_seats s
WHERE s.huawei_num IN WHERE s.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item"> <foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item} #{item}
</foreach> </foreach>
...@@ -480,7 +480,7 @@ ...@@ -480,7 +480,7 @@
'USER' AS type, 'USER' AS type,
a.mobile a.mobile
FROM sys_user a FROM sys_user a
WHERE a.huawei_num IN WHERE a.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item"> <foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item} #{item}
</foreach> </foreach>
......
...@@ -250,12 +250,12 @@ WHERE c.subtime BETWEEN CONVERT(CONCAT(DATE_ADD(#{fltDate},INTERVAL -1 DAY), " 2 ...@@ -250,12 +250,12 @@ WHERE c.subtime BETWEEN CONVERT(CONCAT(DATE_ADD(#{fltDate},INTERVAL -1 DAY), " 2
update_by=VALUES(update_by), update_by=VALUES(update_by),
update_date=VALUES(update_date) update_date=VALUES(update_date)
</insert> </insert>
<!-- 获取飞机总量 --> <!-- 获取最近时间飞机总量 -->
<select id="getTotalFlight" resultType="com.ejweb.modules.statistics.entity.FlightTotalEntity"> <select id="getLastTotalFlight" resultType="com.ejweb.modules.statistics.entity.FlightTotalEntity">
SELECT * SELECT *
FROM foc_flight_total FROM foc_flight_total
WHERE flight_date=#{flightDate} order by flight_date desc limit 1;
</select> </select>
<select id="getPlaneDailyUsage" resultType="Double"> <select id="getPlaneDailyUsage" resultType="Double">
SELECT SUM(unix_timestamp(ata_chn) - unix_timestamp(atd_chn))/(60*60*#{flightTotal}) SELECT SUM(unix_timestamp(ata_chn) - unix_timestamp(atd_chn))/(60*60*#{flightTotal})
......
...@@ -3,60 +3,38 @@ ...@@ -3,60 +3,38 @@
*/ */
package com.ejweb.core.conf; package com.ejweb.core.conf;
import java.io.File; import com.ejweb.core.security.DES3Utils;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import com.ejweb.core.security.DES3Utils; import java.util.Enumeration;
import com.jdair.util.security.DESPlus; import java.util.Properties;
/** /**
*
* @team IT Team
* @author renmb * @author renmb
* @version 1.0 * @version 1.0
* @time 2016年11月2日 * @team IT Team
* @time 2016年11月2日
*/ */
public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
// private static final String key = "";
private static final String CONF_DESC_KEY = "2012PinganVitality075522628888ForShenZhenBelter075561869839"; private static final String CONF_DESC_KEY = "2012PinganVitality075522628888ForShenZhenBelter075561869839";
private Map<String, Boolean> keys = new HashMap<String, Boolean>();
@Override @Override
protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
throws BeansException { throws BeansException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
try { try {
Enumeration<?> enu = props.propertyNames(); Enumeration<?> enu = props.propertyNames();
while (enu.hasMoreElements()) { while (enu.hasMoreElements()) {
try { try {
String key = (String) enu.nextElement(); String key = (String) enu.nextElement();
String val = (String) props.get(key); String val = (String) props.get(key);
String decorded = DES3Utils.decrypt(val, CONF_DESC_KEY); String decorded = DES3Utils.decrypt(val, CONF_DESC_KEY);
if(decorded != null){ if (decorded != null) {
props.put(key, decorded); props.put(key, decorded);
} }
// if("is.devmode".equals(key) == false && keys.get(key) == null){// 还未处理
// keys.put(key, true);
//
// String val = (String) props.get(key);
// String decorded = DES3Utils.decrypt(val, CONF_DESC_KEY);
// if(decorded != null){
// props.put(key, decorded);
// }
// }
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
...@@ -66,191 +44,41 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo ...@@ -66,191 +44,41 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
} }
super.processProperties(beanFactory, props); super.processProperties(beanFactory, props);
} }
public static String getValue(Properties props,String key) {
if(key == null) public static String getValue(Properties props, String key) {
if (key == null) {
return null; return null;
}
if (props.containsKey(key)) { if (props.containsKey(key)) {
return props.getProperty(key); return props.getProperty(key);
} }
return System.getProperty(key); return System.getProperty(key);
} }
public static String getValue(Properties props,String key, String want) {
public static String getValue(Properties props, String key, String want) {
String val = getValue(props, key); String val = getValue(props, key);
if(val == null) if (val == null) {
return want; return want;
}
return val; return val;
} }
public static boolean getBoolean(Properties props, String key, boolean want) { public static boolean getBoolean(Properties props, String key, boolean want) {
try { try {
String val = props.getProperty(key); String val = props.getProperty(key);
if(val == null || val.length() == 0) if (val == null || val.length() == 0) {
return want; return want;
}
return Boolean.parseBoolean(val); return Boolean.parseBoolean(val);
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
return want; return want;
} }
/**
* 解密
* @param encode
* @return
*/
// public static String decrypt(String encode) {
// if (StringUtils.isBlank(encode)) {
// return null;
// }
// try {
//// DESPlus des = new DESPlus(CONF_DESC_KEY);
// return DES3Utils.decrypt(encode, CONF_DESC_KEY);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
// }
// public static void main(String[] args) throws IOException {
// InputStream in = new FileInputStream(new File("W:\\佰邦达科技\\FOC智能管控系统\\线上配置\\20170105\\api.conf\\3DES加密版本\\api.ejweb.properties"));
//
// Properties props = new Properties();
// props.load(in);
//
//
// InputStream in2 = new FileInputStream(new File("W:\\佰邦达科技\\FOC智能管控系统\\线上配置\\20170105\\api.conf\\ejweb.properties"));
//
// Properties props2 = new Properties();
// props2.load(in2);
//
// List<String> keys = new ArrayList<>();
// keys.add("file.upload.dir");
// keys.add("file.prefix.url");
// keys.add("seat.default.photo");
// keys.add("jdair.api.base.url");
// keys.add("jdair.api.base.param");
// keys.add("huawei.uc.gwIp");
// keys.add("foc.sound.recording.url");
// keys.add("foc.sound.records.proxy");
// keys.add("jdair.api.sms.url");
//
// for(String key:keys){
//
// if(props2.get(key) != null){
// String val = (String) props2.get(key);
// System.out.println("正常: "+key+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// }
// }
// InputStream in2 = new FileInputStream(new File("W:\\佰邦达科技\\FOC智能管控系统\\线上配置\\20170105\\api.conf\\jdbc.properties"));
//
// Properties props2 = new Properties();
// props2.load(in2);
//
// List<String> keys = new ArrayList<>();
// keys.add("jdbc.url");
// keys.add("jdbc.username");
// keys.add("jdbc.password");
//
// for(String key:keys){
//
// if(props2.get(key) != null){
// String val = (String) props2.get(key);
// System.out.println("正常: "+key+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// }
// }
// Enumeration<?> enu = props2.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props2.get(key);
// if(props.get(key) == null){
// System.out.println("新增: "+key+"="+val);
// }
// }
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// if(props2.get(key) == null){
//
// }
//// if(props2.get(key) == null){
//
// String decrypted = DES3Utils.decrypt(val, CONF_DESC_KEY);
// if(decrypted == null){
//// System.out.println("新增: "+key+"="+val);
// } else{
// val = decrypted;
//// System.out.println("新增: "+key+"="+decrypted);
// }
// if(props2.get(key).equals(val) ==false){
//
// System.out.println("新增: "+key+"="+val);
// }
//// }
// }
// DES解密版本
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// try {
// DESPlus des = new DESPlus(CONF_DESC_KEY);//定义密钥
//
// System.out.println("正常: "+key+"="+des.decrypt(val));
// } catch (Exception e) {
// // TODO: handle exception
// System.out.println("异常: "+key+"="+val);
// }
// }
// 3DES加密
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// try {
//
// System.out.println("正常: "+key+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// } catch (Exception e) {
// // TODO: handle exception
// System.out.println("异常: "+key+"="+val);
// }
// }
// }
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY));
// try { System.out.println(DES3Utils.decrypt("69872b2310ba9b30470ce46682151021e825c3909c394aa5f4387123bdbfa67e", CONF_DESC_KEY));
// InputStream in2 = new FileInputStream(new File("W:\\FOC智能管控系统\\线上配置\\all_conf.20170423\\all_conf\\api_conf\\ejweb.properties"));
//
// Properties props = new Properties();
// props.load(in2);
//
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// String decrypted = DES3Utils.decrypt(val, CONF_DESC_KEY);
// if(decrypted == null){
// System.out.println("新增: "+key+"="+val);
// } else{
// System.out.println("NULL新增: "+key+"="+decrypted);
// }
// }
//
// String decrypted = DES3Utils.decrypt("dc6788486fc8fa4660890b4cba7ee6ada527e2e604dbe7fa0fdcf7401a0dd11996450d7fea85f2d9724b7d8fff30a4826c098fd51da0815035030eec22e491802aa2975c67259d9ca89540576b301b6d", CONF_DESC_KEY);
// System.out.println(decrypted);
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY));
//// DESPlus des = new DESPlus(CONF_DESC_KEY);//定义密钥
// System.out.println(DES3Utils.encrypt("jdbc:mysql://10.70.78.27:3306/foc?useUnicode=true&characterEncoding=utf-8", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("0e8dfd0927dd5d88fee454c6aef2a68a38e20f99110a3d5a933c45a72bf468e954c33fb8cfe5bcae", CONF_DESC_KEY));
// } catch (Exception e) {
// e.printStackTrace();
// }
} }
} }
...@@ -39,7 +39,7 @@ import com.ejweb.modules.user.service.UserService; ...@@ -39,7 +39,7 @@ import com.ejweb.modules.user.service.UserService;
/** /**
* 电话会议记录及查询 * 电话会议记录及查询
* *
* @team IT Team * @team IT Team
* @author renmb * @author renmb
* @version 1.0 * @version 1.0
...@@ -55,7 +55,7 @@ public class CallController { ...@@ -55,7 +55,7 @@ public class CallController {
private UserService userService; private UserService userService;
/** /**
* 批量查询电话号码列表 * 批量查询电话号码列表
* *
* @author renmb * @author renmb
* @time 2017年1月22日 * @time 2017年1月22日
* @param requestBean * @param requestBean
...@@ -67,25 +67,25 @@ public class CallController { ...@@ -67,25 +67,25 @@ public class CallController {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
CallPhoneAreaBean bean = requestBean.getObjectBean(CallPhoneAreaBean.class); CallPhoneAreaBean bean = requestBean.getObjectBean(CallPhoneAreaBean.class);
String message = this.callService.validate(bean); String message = this.callService.validate(bean);
List<CallPhoneAreaEntity> searchPhoneList = bean.getCallPhoneList(); List<CallPhoneAreaEntity> searchPhoneList = bean.getCallPhoneList();
if(message == null && searchPhoneList !=null && searchPhoneList.size()>0){ if(message == null && searchPhoneList !=null && searchPhoneList.size()>0){
List<CallPhoneAreaEntity> callPhoneList = new ArrayList<CallPhoneAreaEntity>(); List<CallPhoneAreaEntity> callPhoneList = new ArrayList<CallPhoneAreaEntity>();
for (CallPhoneAreaEntity phone:searchPhoneList) { for (CallPhoneAreaEntity phone:searchPhoneList) {
CallPhoneAreaEntity callPhone = callService.addPhoneArea(phone.getMobile()); CallPhoneAreaEntity callPhone = callService.addPhoneArea(phone.getMobile());
if(callPhone == null){// 未查询到相关数据 if(callPhone == null){// 未查询到相关数据
callPhone = new CallPhoneAreaEntity(); callPhone = new CallPhoneAreaEntity();
} }
callPhone.setMobile(phone.getMobile()); callPhone.setMobile(phone.getMobile());
callPhone.setShowPhone(phone.getMobile()); callPhone.setShowPhone(phone.getMobile());
if("PHONE".equals(callPhone.getType())){ if("PHONE".equals(callPhone.getType())){
callPhone.setMobileNubmer(callPhone.getPhone()); callPhone.setMobileNubmer(callPhone.getPhone());
callPhone.setShowPhone(callPhone.getShowPhone()); callPhone.setShowPhone(callPhone.getShowPhone());
} else if("MOBILE".equals(callPhone.getType())){ } else if("MOBILE".equals(callPhone.getType())){
callPhone.setShowPhone(callPhone.getMobile()); callPhone.setShowPhone(callPhone.getMobile());
callPhone.setPhone(callPhone.getMobileNubmer()); callPhone.setPhone(callPhone.getMobileNubmer());
} }
...@@ -99,12 +99,12 @@ public class CallController { ...@@ -99,12 +99,12 @@ public class CallController {
responseBean.setMessage(message); responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001); responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean; return responseBean;
} }
/** /**
* 格式化手机号码 * 格式化手机号码
* 42.4 查询手机归属地信息接口 * 42.4 查询手机归属地信息接口
* *
* @author renmb * @author renmb
* @time 2016年12月6日 * @time 2016年12月6日
* @param requestBean * @param requestBean
...@@ -114,29 +114,29 @@ public class CallController { ...@@ -114,29 +114,29 @@ public class CallController {
@RequestMapping(value = "/phoneArea") @RequestMapping(value = "/phoneArea")
public ResponseBean phoneArea(RequestBean requestBean) { public ResponseBean phoneArea(RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
CallPhoneAreaBean bean = requestBean.getObjectBean(CallPhoneAreaBean.class); CallPhoneAreaBean bean = requestBean.getObjectBean(CallPhoneAreaBean.class);
String message = this.callService.validate(bean); String message = this.callService.validate(bean);
CallPhoneAreaEntity callPhone = new CallPhoneAreaEntity(); CallPhoneAreaEntity callPhone = new CallPhoneAreaEntity();
if(message == null){ if(message == null){
callPhone.setPhone(bean.getPhone()); callPhone.setPhone(bean.getPhone());
callPhone.setMobile(bean.getMobile()); callPhone.setMobile(bean.getMobile());
// 格式化手机号 // 格式化手机号
if(StringUtils.isNotBlank(bean.getMobile())){ if(StringUtils.isNotBlank(bean.getMobile())){
String mobile = bean.getMobile(); String mobile = bean.getMobile();
// 只使用第一个手机号 // 只使用第一个手机号
String[] species = mobile.split("\\s+"); String[] species = mobile.split("\\s+");
if(species.length>1 && species[0].matches("1\\d+") && species[1].matches("1\\d+")){ if(species.length>1 && species[0].matches("1\\d+") && species[1].matches("1\\d+")){
mobile = species[0]; mobile = species[0];
} }
callPhone = callService.addPhoneArea(mobile); callPhone = callService.addPhoneArea(mobile);
// 未查询到相关数据 // 未查询到相关数据
if(callPhone == null){ if(callPhone == null){
callPhone = new CallPhoneAreaEntity(); callPhone = new CallPhoneAreaEntity();
} }
callPhone.setMobile(bean.getMobile()); callPhone.setMobile(bean.getMobile());
...@@ -151,7 +151,7 @@ public class CallController { ...@@ -151,7 +151,7 @@ public class CallController {
callPhone.setMobileNubmer(callPhone.getPhone()); callPhone.setMobileNubmer(callPhone.getPhone());
callPhone.setShowPhone(callPhone.getShowPhone()); callPhone.setShowPhone(callPhone.getShowPhone());
} else if("MOBILE".equals(callPhone.getType())){ } else if("MOBILE".equals(callPhone.getType())){
callPhone.setShowPhone(callPhone.getMobile()); callPhone.setShowPhone(callPhone.getMobile());
callPhone.setPhone(callPhone.getMobileNubmer()); callPhone.setPhone(callPhone.getMobileNubmer());
} }
...@@ -167,7 +167,7 @@ public class CallController { ...@@ -167,7 +167,7 @@ public class CallController {
/** /**
* 42.1 开始会话提交接口,在发起人拨打电话时调用 * 42.1 开始会话提交接口,在发起人拨打电话时调用
* *
* @author renmb * @author renmb
* @time 2016年10月6日 * @time 2016年10月6日
* @param requestBean * @param requestBean
...@@ -183,25 +183,25 @@ public class CallController { ...@@ -183,25 +183,25 @@ public class CallController {
if (message == null) {// 校验通过 if (message == null) {// 校验通过
List<CallPhoneBean> phoneList = bean.getPhoneList(); List<CallPhoneBean> phoneList = bean.getPhoneList();
int userCount = phoneList.size()+1; int userCount = phoneList.size()+1;
CallRecordEntity record = new CallRecordEntity(); CallRecordEntity record = new CallRecordEntity();
record.setCallType(bean.getCallType()); record.setCallType(bean.getCallType());
record.setCreateBy(bean.getCreateBy()); record.setCreateBy(bean.getCreateBy());
if(StringUtils.isEmpty(bean.getCreateName())){ if(StringUtils.isEmpty(bean.getCreateName())){
String name = callService.getNameByPhoneFromSeat(bean.getCreatePhone()); String name = callService.getNameByPhoneFromSeat(bean.getCreatePhone());
if(name!=null){ if (name != null) {
record.setCreateName(name); record.setCreateName(name);
}else{ } else {
name = callService.getNameByPhone(bean.getCreatePhone()); name = callService.getNameByPhone(bean.getCreatePhone());
if(name!=null){ if (name != null) {
record.setCreateName(name); record.setCreateName(name);
}else{ } else {
record.setCreateName(bean.getCreatePhone()); record.setCreateName(bean.getCreatePhone());
} }
} }
}else{ }else{
record.setCreateName(bean.getCreateName()); record.setCreateName(bean.getCreateName());
} }
// record.setCreateName(StringUtils.isEmpty(bean.getCreateName()) ? bean.getCreatePhone() : bean.getCreateName()); // record.setCreateName(StringUtils.isEmpty(bean.getCreateName()) ? bean.getCreatePhone() : bean.getCreateName());
record.setEndStatus(bean.getEndStatus()); record.setEndStatus(bean.getEndStatus());
...@@ -213,7 +213,7 @@ public class CallController { ...@@ -213,7 +213,7 @@ public class CallController {
record.setVersionName(bean.getVersionName()); record.setVersionName(bean.getVersionName());
if("APP".equals(bean.getChannelType()) == false){// 通过系统拨打的电话记录 if("APP".equals(bean.getChannelType()) == false){// 通过系统拨打的电话记录
if(bean.getStartTime() != null){ if(bean.getStartTime() != null){
record.setStartTime(bean.getStartTime()); record.setStartTime(bean.getStartTime());
} }
} }
...@@ -223,7 +223,7 @@ public class CallController { ...@@ -223,7 +223,7 @@ public class CallController {
record.setPhoneType(Util.getPhoneType(bean.getCreatePhone())); record.setPhoneType(Util.getPhoneType(bean.getCreatePhone()));
callService.createCallRecord(record);// 添加主记录 callService.createCallRecord(record);// 添加主记录
for (CallPhoneBean phone : phoneList) { for (CallPhoneBean phone : phoneList) {
phone.setId(IdWorker.getNextId()); phone.setId(IdWorker.getNextId());
...@@ -236,30 +236,30 @@ public class CallController { ...@@ -236,30 +236,30 @@ public class CallController {
phone.setTitle(record.getCreateName()); phone.setTitle(record.getCreateName());
} }
if(StringUtils.isEmpty(phone.getUserId()) if (StringUtils.isEmpty(phone.getUserId())
&& StringUtils.isNotEmpty(phone.getPhone())){// 如果没有匹配用户信息则通过号码匹配用户信息 && StringUtils.isNotEmpty(phone.getPhone())){// 如果没有匹配用户信息则通过号码匹配用户信息
CallFindPhoneInfoBean phoneBean = new CallFindPhoneInfoBean(); CallFindPhoneInfoBean phoneBean = new CallFindPhoneInfoBean();
Date current = new Date();// 用于查询通话记录 Date current = new Date();// 用于查询通话记录
phoneBean.setEndTime(current);// 查询时间 phoneBean.setEndTime(current);// 查询时间
phoneBean.setStartTime(new Date(current.getTime()-3*60*1000));// 开始时间=查询时间-3分钟 phoneBean.setStartTime(new Date(current.getTime()-3*60*1000));// 开始时间=查询时间-3分钟
phoneBean.setPhoneNumer(phone.getPhone()); phoneBean.setPhoneNumer(phone.getPhone());
List<CallPhoneInfoListEntity> userList = callService.findUserByCallPhone(phoneBean, true); List<CallPhoneInfoListEntity> userList = callService.findUserByCallPhone(phoneBean, true);
if(userList != null && userList.size() == 1){ if(userList != null && userList.size() == 1){
CallPhoneInfoListEntity callPhoneInfo = userList.get(0); CallPhoneInfoListEntity callPhoneInfo = userList.get(0);
if(StringUtils.isNotEmpty(callPhoneInfo.getUserId())){ if(StringUtils.isNotEmpty(callPhoneInfo.getUserId())){
phone.setUserId(callPhoneInfo.getUserId()); phone.setUserId(callPhoneInfo.getUserId());
phone.setUsername(callPhoneInfo.getName()); phone.setUsername(callPhoneInfo.getName());
} }
} }
} }
} }
callService.addCallPhoneList(phoneList);// 添加电话列表 callService.addCallPhoneList(phoneList);// 添加电话列表
responseBean.setData(record); responseBean.setData(record);
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
...@@ -272,7 +272,7 @@ public class CallController { ...@@ -272,7 +272,7 @@ public class CallController {
/** /**
* 42.2 结束会话提交接口 * 42.2 结束会话提交接口
* *
* @author renmb * @author renmb
* @time 2016年10月6日 * @time 2016年10月6日
* @param requestBean * @param requestBean
...@@ -292,14 +292,14 @@ public class CallController { ...@@ -292,14 +292,14 @@ public class CallController {
record.setEndTime(bean.getEndTime()); record.setEndTime(bean.getEndTime());
if("APP".equals(bean.getChannelType()) == false){// 通过系统拨打的电话记录 if("APP".equals(bean.getChannelType()) == false){// 通过系统拨打的电话记录
if(bean.getEndTime() != null){ if(bean.getEndTime() != null){
record.setEndTime(bean.getEndTime()); record.setEndTime(bean.getEndTime());
} }
} }
record.setId(bean.getRecordCode()); record.setId(bean.getRecordCode());
callService.updateCallRecord(record);// 添加主记录 callService.updateCallRecord(record);// 添加主记录
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean; return responseBean;
...@@ -311,7 +311,7 @@ public class CallController { ...@@ -311,7 +311,7 @@ public class CallController {
/** /**
* 42.3 会话列表接口 * 42.3 会话列表接口
* V2.0 添加分页 * V2.0 添加分页
* *
* @author renmb * @author renmb
* @time 2016年10月6日 * @time 2016年10月6日
* @param requestBean * @param requestBean
...@@ -323,26 +323,26 @@ public class CallController { ...@@ -323,26 +323,26 @@ public class CallController {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
CallRecordListBean bean = requestBean.getObjectBean(CallRecordListBean.class); CallRecordListBean bean = requestBean.getObjectBean(CallRecordListBean.class);
String message = callService.validate(bean); String message = callService.validate(bean);
if (message == null) {// 校验通过 if (message == null) {// 校验通过
Boolean show=false; Boolean show = false;
UserEntity ue=new UserEntity(); UserEntity ue = new UserEntity();
ue.setUsercode(bean.getUserId()); ue.setUsercode(bean.getUserId());
User user = userService.getUserByUserCode(ue); User user = userService.getUserByUserCode(ue);
if(user!=null){ if (user != null) {
if(StringUtils.isNoneBlank(user.getPhone())){ if (StringUtils.isNoneBlank(user.getPhone())) {
show=true; show = true;
} }
}else{ } else {
UserSeatEntity seat= userService.getSeatsEntity(bean.getUserId()); UserSeatEntity seat = userService.getSeatsEntity(bean.getUserId());
if(seat != null && StringUtils.isNoneBlank(seat.getPhone())){ if (seat != null && StringUtils.isNoneBlank(seat.getPhone())) {
show=true; show = true;
} }
} }
PageEntity<CallRecordListEntity> page = callService.getCallRecordList(bean); PageEntity<CallRecordListEntity> page = callService.getCallRecordList(bean);
if(page == null){ if(page == null){
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001); responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean; return responseBean;
...@@ -351,7 +351,7 @@ public class CallController { ...@@ -351,7 +351,7 @@ public class CallController {
List<CallListEntity> callList = new ArrayList<CallListEntity>(); List<CallListEntity> callList = new ArrayList<CallListEntity>();
List<String> huweiNumList = new ArrayList<>(); List<String> huweiNumList = new ArrayList<>();
for(CallRecordListEntity record:callRecordList){ for(CallRecordListEntity record:callRecordList){
CallListEntity call = new CallListEntity(); CallListEntity call = new CallListEntity();
call.setCallType(record.getCallType()); call.setCallType(record.getCallType());
call.setEndStatus(record.getEndStatus()); call.setEndStatus(record.getEndStatus());
...@@ -361,32 +361,32 @@ public class CallController { ...@@ -361,32 +361,32 @@ public class CallController {
call.setTitle(record.getTitle()); call.setTitle(record.getTitle());
call.setUserCount(record.getUserCount()); call.setUserCount(record.getUserCount());
call.setFlow(record.getFlow()); call.setFlow(record.getFlow());
if(bean.getUserId().equals(record.getCreateBy())){// 是本人发起的电话,即主叫 if(bean.getUserId().equals(record.getCreateBy())){// 是本人发起的电话,即主叫
call.setFlow("CALLING"); call.setFlow("CALLING");
call.setUserId(record.getUserId()); call.setUserId(record.getUserId());
// call.setPhone( callService.GetPhoneById(record.getUserId())); // call.setPhone( callService.GetPhoneById(record.getUserId()));
call.setUsername(record.getUsername()); call.setUsername(record.getUsername());
// call.setUsername(record.getName()); // call.setUsername(record.getName());
call.setUserPhoto(Util.getAbsoluteUrl(record.getUserPhoto(), GConstants.DEFAULT_SEAT_PHOTO)); call.setUserPhoto(Util.getAbsoluteUrl(record.getUserPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
} else {// 他人发起的电话,电话号码显示 } else {// 他人发起的电话,电话号码显示
call.setFlow("CALLED"); call.setFlow("CALLED");
call.setPhone(record.getCreatePhone()); call.setPhone(record.getCreatePhone());
// call.setPhone( callService.GetPhoneById(record.getCreateBy())); // call.setPhone( callService.GetPhoneById(record.getCreateBy()));
call.setUserId(record.getCreateBy()); call.setUserId(record.getCreateBy());
call.setUsername(record.getCreateName()); call.setUsername(record.getCreateName());
// call.setUsername(record.getName()); // call.setUsername(record.getName());
call.setUserPhoto(Util.getAbsoluteUrl(record.getCreateByPhoto(), GConstants.DEFAULT_SEAT_PHOTO)); call.setUserPhoto(Util.getAbsoluteUrl(record.getCreateByPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
} }
if("GROUP".equals(record.getCallType())){// 群组聊天时所有的电话均设置为群发起人电话 if("GROUP".equals(record.getCallType())){// 群组聊天时所有的电话均设置为群发起人电话
call.setPhone(record.getCreatePhone()); call.setPhone(record.getCreatePhone());
List<MemberEntity> memberlist = callService.getMemberList(record.getId()); List<MemberEntity> memberlist = callService.getMemberList(record.getId());
memberlist.forEach(mEntity->huweiNumList.add(mEntity.getPhone())); memberlist.forEach(mEntity->huweiNumList.add(mEntity.getPhone()));
call.setMemberList(memberlist); call.setMemberList(memberlist);
} else if(bean.getUserId().equals(record.getCreateBy())){// 非群聊,且是本人发起的电话 } else if(bean.getUserId().equals(record.getCreateBy())){// 非群聊,且是本人发起的电话
// call.setTitle(record.getName()); // call.setTitle(record.getName());
call.setTitle(record.getUsername()); call.setTitle(record.getUsername());
...@@ -395,38 +395,38 @@ public class CallController { ...@@ -395,38 +395,38 @@ public class CallController {
// if(show){ // if(show){
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl())); // call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
// } // }
call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl())); call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
huweiNumList.add(call.getPhone()); huweiNumList.add(call.getPhone());
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl())); // call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
callList.add(call); callList.add(call);
} }
Map<String, String> map = callService.findPhoneByHuaweiNum(huweiNumList);// 通过华为短号查询座机号 Map<String, String> map = callService.findPhoneByHuaweiNum(huweiNumList);// 通过华为短号查询座机号
for(CallListEntity record:callList){ for(CallListEntity record:callList){
if(map != null ){ if(map != null ){
if(StringUtils.isNotEmpty(map.get(record.getPhone()))){ if(StringUtils.isNotEmpty(map.get(record.getPhone()))){
record.setPhone(Util.formatedWorkPhone(map.get(record.getPhone()))); record.setPhone(Util.formatedWorkPhone(map.get(record.getPhone())));
} }
if("GROUP".equals(record.getCallType())){ if("GROUP".equals(record.getCallType())){
record.getMemberList().forEach(entity->{ record.getMemberList().forEach(entity->{
if(StringUtils.isNotEmpty(map.get(entity.getPhone()))){ if(StringUtils.isNotEmpty(map.get(entity.getPhone()))){
entity.setPhone(Util.formatedWorkPhone(map.get(entity.getPhone()))); entity.setPhone(Util.formatedWorkPhone(map.get(entity.getPhone())));
} }
entity.setShowPhone(Util.getShowPhone(entity.getPhone())); entity.setShowPhone(Util.getShowPhone(entity.getPhone()));
}); });
} }
} }
if(StringUtils.isNotEmpty(record.getPhone()) if(StringUtils.isNotEmpty(record.getPhone())
&& record.getPhone().startsWith("6") && record.getPhone().startsWith("6")
&& record.getPhone().length() == 4){// 6开头的华为短号不展示 && record.getPhone().length() == 4) {// 6开头的华为短号不展示
record.setPhone(""); record.setPhone("");
} }
record.setShowPhone(Util.getShowPhone(record.getPhone())); record.setShowPhone(Util.getShowPhone(record.getPhone()));
...@@ -437,7 +437,7 @@ public class CallController { ...@@ -437,7 +437,7 @@ public class CallController {
retPage.setList(callList); retPage.setList(callList);
retPage.setPageSize(page.getPageSize()); retPage.setPageSize(page.getPageSize());
retPage.setTotalPage(page.getTotalPage()); retPage.setTotalPage(page.getTotalPage());
responseBean.setData(retPage); responseBean.setData(retPage);
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
...@@ -449,7 +449,7 @@ public class CallController { ...@@ -449,7 +449,7 @@ public class CallController {
} }
/** /**
* 安科录音接口 * 安科录音接口
* *
* @author renmb * @author renmb
* @time 2017年3月15日 * @time 2017年3月15日
* @param requestBean * @param requestBean
...@@ -467,7 +467,7 @@ public class CallController { ...@@ -467,7 +467,7 @@ public class CallController {
PageEntity<CallRecordListEntity> page = callService.getCallRecordList(bean); PageEntity<CallRecordListEntity> page = callService.getCallRecordList(bean);
// PageEntity<CallRecordListEntity> page = callService.getCallSoundList(bean); // PageEntity<CallRecordListEntity> page = callService.getCallSoundList(bean);
if(page == null){ if(page == null){
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001); responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean; return responseBean;
...@@ -476,7 +476,7 @@ public class CallController { ...@@ -476,7 +476,7 @@ public class CallController {
List<CallListEntity> callList = new ArrayList<CallListEntity>(); List<CallListEntity> callList = new ArrayList<CallListEntity>();
List<String> huweiNumList = new ArrayList<>(); List<String> huweiNumList = new ArrayList<>();
for(CallRecordListEntity record:callRecordList){ for(CallRecordListEntity record:callRecordList){
CallListEntity call = new CallListEntity(); CallListEntity call = new CallListEntity();
call.setCallType(record.getCallType()); call.setCallType(record.getCallType());
call.setEndStatus(record.getEndStatus()); call.setEndStatus(record.getEndStatus());
...@@ -485,15 +485,15 @@ public class CallController { ...@@ -485,15 +485,15 @@ public class CallController {
call.setTitle(record.getTitle()); call.setTitle(record.getTitle());
call.setUserCount(record.getUserCount()); call.setUserCount(record.getUserCount());
call.setFlow(record.getFlow()); call.setFlow(record.getFlow());
if(bean.getUserId().equals(record.getCreateBy())){// 是本人发起的电话,即主叫 if(bean.getUserId().equals(record.getCreateBy())){// 是本人发起的电话,即主叫
call.setFlow("CALLING"); call.setFlow("CALLING");
call.setUserId(record.getUserId()); call.setUserId(record.getUserId());
call.setUsername(record.getUsername()); call.setUsername(record.getUsername());
call.setUserPhoto(Util.getAbsoluteUrl(record.getUserPhoto(), GConstants.DEFAULT_SEAT_PHOTO)); call.setUserPhoto(Util.getAbsoluteUrl(record.getUserPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
} else {// 他人发起的电话,电话号码显示 } else {// 他人发起的电话,电话号码显示
call.setFlow("CALLED"); call.setFlow("CALLED");
call.setPhone(record.getCreatePhone()); call.setPhone(record.getCreatePhone());
call.setUserId(record.getCreateBy()); call.setUserId(record.getCreateBy());
...@@ -501,10 +501,10 @@ public class CallController { ...@@ -501,10 +501,10 @@ public class CallController {
call.setUserPhoto(Util.getAbsoluteUrl(record.getCreateByPhoto(), GConstants.DEFAULT_SEAT_PHOTO)); call.setUserPhoto(Util.getAbsoluteUrl(record.getCreateByPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
} }
if("GROUP".equals(record.getCallType())){// 群组聊天时所有的电话均设置为群发起人电话 if("GROUP".equals(record.getCallType())){// 群组聊天时所有的电话均设置为群发起人电话
call.setPhone(record.getCreatePhone()); call.setPhone(record.getCreatePhone());
} else if(bean.getUserId().equals(record.getCreateBy())){// 非群聊,且是本人发起的电话 } else if(bean.getUserId().equals(record.getCreateBy())){// 非群聊,且是本人发起的电话
call.setTitle(record.getUsername()); call.setTitle(record.getUsername());
} }
huweiNumList.add(call.getPhone()); huweiNumList.add(call.getPhone());
...@@ -515,7 +515,7 @@ public class CallController { ...@@ -515,7 +515,7 @@ public class CallController {
for(CallListEntity record:callList){ for(CallListEntity record:callList){
if(map != null && if(map != null &&
StringUtils.isNotEmpty(map.get(record.getPhone()))){ StringUtils.isNotEmpty(map.get(record.getPhone()))){
record.setPhone(Util.formatedWorkPhone(map.get(record.getPhone()))); record.setPhone(Util.formatedWorkPhone(map.get(record.getPhone())));
} }
// if(StringUtils.isNotEmpty(record.getPhone()) // if(StringUtils.isNotEmpty(record.getPhone())
...@@ -532,7 +532,7 @@ public class CallController { ...@@ -532,7 +532,7 @@ public class CallController {
retPage.setList(callList); retPage.setList(callList);
retPage.setPageSize(page.getPageSize()); retPage.setPageSize(page.getPageSize());
retPage.setTotalPage(page.getTotalPage()); retPage.setTotalPage(page.getTotalPage());
responseBean.setData(retPage); responseBean.setData(retPage);
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
...@@ -544,7 +544,7 @@ public class CallController { ...@@ -544,7 +544,7 @@ public class CallController {
} }
/** /**
* 根据电话号码查询电话相关的席位或者用户信息 * 根据电话号码查询电话相关的席位或者用户信息
* *
* @author renmb * @author renmb
* @time 2017年1月5日 * @time 2017年1月5日
* @param requestBean * @param requestBean
...@@ -558,11 +558,11 @@ public class CallController { ...@@ -558,11 +558,11 @@ public class CallController {
CallFindPhoneInfoBean bean = requestBean.getObjectBean(CallFindPhoneInfoBean.class); CallFindPhoneInfoBean bean = requestBean.getObjectBean(CallFindPhoneInfoBean.class);
String message = callService.validate(bean); String message = callService.validate(bean);
if (message == null) {// 校验通过 if (message == null) {// 校验通过
Date current = new Date();// 用于查询通话记录 Date current = new Date();// 用于查询通话记录
bean.setEndTime(current);// 查询时间 bean.setEndTime(current);// 查询时间
bean.setStartTime(new Date(current.getTime()-3*60*1000));// 开始时间=查询时间-3分钟 bean.setStartTime(new Date(current.getTime()-3*60*1000));// 开始时间=查询时间-3分钟
List<CallPhoneInfoListEntity> userList = callService.findUserByCallPhone(bean, false); List<CallPhoneInfoListEntity> userList = callService.findUserByCallPhone(bean, false);
if(userList == null || userList.size() == 0){ if(userList == null || userList.size() == 0){
responseBean.setMessage(GConstants.EMPTY); responseBean.setMessage(GConstants.EMPTY);
...@@ -570,11 +570,11 @@ public class CallController { ...@@ -570,11 +570,11 @@ public class CallController {
return responseBean; return responseBean;
} }
for(CallPhoneInfoListEntity call:userList){ for(CallPhoneInfoListEntity call:userList){
call.setPhoto(Util.getAbsoluteUrl(call.getPhoto(), GConstants.DEFAULT_SEAT_PHOTO)); call.setPhoto(Util.getAbsoluteUrl(call.getPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
} }
// callService.addCallRecordByCalled(bean, userList.get(0)); // callService.addCallRecordByCalled(bean, userList.get(0));
responseBean.setData(userList); responseBean.setData(userList);
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
...@@ -586,9 +586,9 @@ public class CallController { ...@@ -586,9 +586,9 @@ public class CallController {
} }
/** /**
* 一次性批量提交电话会议记录 * 一次性批量提交电话会议记录
* *
* 42.4 批量提交通话记录接口 * 42.4 批量提交通话记录接口
* *
* @author renmb * @author renmb
* @time 2017年2月17日 * @time 2017年2月17日
* @param requestBean * @param requestBean
...@@ -601,11 +601,11 @@ public class CallController { ...@@ -601,11 +601,11 @@ public class CallController {
CallLogListBean callLog = requestBean.getObjectBean(CallLogListBean.class); CallLogListBean callLog = requestBean.getObjectBean(CallLogListBean.class);
if (callLog != null && callLog.getCallLogList() != null) {// 校验通过 if (callLog != null && callLog.getCallLogList() != null) {// 校验通过
List<CallRecordBean> callLogList = callLog.getCallLogList(); List<CallRecordBean> callLogList = callLog.getCallLogList();
for (CallRecordBean bean:callLogList) { for (CallRecordBean bean:callLogList) {
List<CallPhoneBean> phoneList = bean.getPhoneList(); List<CallPhoneBean> phoneList = bean.getPhoneList();
int userCount = phoneList.size()+1; int userCount = phoneList.size()+1;
CallRecordEntity record = new CallRecordEntity(); CallRecordEntity record = new CallRecordEntity();
record.setCallType(bean.getCallType()); record.setCallType(bean.getCallType());
...@@ -617,7 +617,7 @@ public class CallController { ...@@ -617,7 +617,7 @@ public class CallController {
record.setAppCode(bean.getAppCode()); record.setAppCode(bean.getAppCode());
record.setPlatform(bean.getPlatform()); record.setPlatform(bean.getPlatform());
record.setVersionName(bean.getVersionName()); record.setVersionName(bean.getVersionName());
if(bean.getStartTime() == null){ if(bean.getStartTime() == null){
record.setStartTime(new Date()); record.setStartTime(new Date());
} else{ } else{
...@@ -629,7 +629,7 @@ public class CallController { ...@@ -629,7 +629,7 @@ public class CallController {
callService.createCallRecord(record);// 添加主记录 callService.createCallRecord(record);// 添加主记录
for (CallPhoneBean phone : phoneList) { for (CallPhoneBean phone : phoneList) {
phone.setId(IdWorker.getNextId()); phone.setId(IdWorker.getNextId());
...@@ -642,7 +642,7 @@ public class CallController { ...@@ -642,7 +642,7 @@ public class CallController {
phone.setTitle(record.getCreateName()); phone.setTitle(record.getCreateName());
} }
} }
callService.addCallPhoneList(phoneList);// 添加电话列表 callService.addCallPhoneList(phoneList);// 添加电话列表
} }
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
...@@ -653,16 +653,16 @@ public class CallController { ...@@ -653,16 +653,16 @@ public class CallController {
responseBean.setStatus(ErrorCode.STATUS_CODE_4001); responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean; return responseBean;
} }
/** /**
* 用于安科同步录音数据 * 用于安科同步录音数据
* *
* @author renmb * @author renmb
* @time 2017年2月28日 * @time 2017年2月28日
* @param requestBean * @param requestBean
* @return * @return
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "/addSoundRecord") @RequestMapping(value = "/addSoundRecord")
public ResponseBean addSoundRecord(RequestBean requestBean) { public ResponseBean addSoundRecord(RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
...@@ -670,11 +670,11 @@ public class CallController { ...@@ -670,11 +670,11 @@ public class CallController {
CallSoundRecordBean bean = requestBean.getObjectBean(CallSoundRecordBean.class); CallSoundRecordBean bean = requestBean.getObjectBean(CallSoundRecordBean.class);
String message = callService.validate(bean); String message = callService.validate(bean);
if (message == null) {// 校验通过 if (message == null) {// 校验通过
bean.setFocTimeMillis(System.currentTimeMillis()); bean.setFocTimeMillis(System.currentTimeMillis());
Date createDate = new Date(bean.getFocTimeMillis()); Date createDate = new Date(bean.getFocTimeMillis());
bean.setCreateDate(createDate); bean.setCreateDate(createDate);
long focDiffMillis = bean.getCurrentTimeMillis() - bean.getFocTimeMillis()+GConstants.getIntValue("add.diff.millis", 100); long focDiffMillis = bean.getCurrentTimeMillis() - bean.getFocTimeMillis()+GConstants.getIntValue("add.diff.millis", 100);
// if(focDiffMillis<1000){ // if(focDiffMillis<1000){
// focDiffMillis = 0; // focDiffMillis = 0;
...@@ -683,92 +683,92 @@ public class CallController { ...@@ -683,92 +683,92 @@ public class CallController {
Date start = new Date(bean.getBeginTime().getTime()-focDiffMillis); Date start = new Date(bean.getBeginTime().getTime()-focDiffMillis);
bean.setFocBeginTime(start); bean.setFocBeginTime(start);
if(bean.getEndTime() != null){ if(bean.getEndTime() != null){
Date end = new Date(bean.getEndTime().getTime()-focDiffMillis); Date end = new Date(bean.getEndTime().getTime()-focDiffMillis);
bean.setFocEndTime(end); bean.setFocEndTime(end);
} }
//添加通话记录call_record,call_office //添加通话记录call_record,call_office
CallRecordEntity record = new CallRecordEntity(); CallRecordEntity record = new CallRecordEntity();
record.setCallType("USER"); record.setCallType("USER");
String name = callService.getNameByPhoneFromSeat(bean.getCallNo()); String name = callService.getNameByPhoneFromSeat(bean.getCallNo());
String id = callService.getIdByPhoneFromSeat(bean.getCallNo()); String id = callService.getIdByPhoneFromSeat(bean.getCallNo());
if(name!=null){ if (name != null) {
record.setCreateName(name); record.setCreateName(name);
record.setCreateBy(id); record.setCreateBy(id);
}else{ } else {
name = callService.getNameByPhone(bean.getCallNo()); name = callService.getNameByPhone(bean.getCallNo());
if(name!=null){ if (name != null) {
id = callService.getIdByPhone(bean.getCallNo()); id = callService.getIdByPhone(bean.getCallNo());
record.setCreateName(name); record.setCreateName(name);
record.setCreateBy(id); record.setCreateBy(id);
}else{ } else {
record.setCreateName(bean.getCallNo()); record.setCreateName(bean.getCallNo());
record.setCreateBy("1"); record.setCreateBy("1");
} }
} }
int userCount = 1; int userCount = 1;
if(bean.getResult()!=null && !bean.getResult().equals("0")){ if (bean.getResult() != null && !bean.getResult().equals("0")) {
record.setEndStatus("SUCCESS"); record.setEndStatus("SUCCESS");
userCount = 2; userCount = 2;
}else{ } else {
record.setEndStatus("FAILD"); record.setEndStatus("FAILD");
} }
record.setId(IdWorker.getNextId()); record.setId(IdWorker.getNextId());
record.setChannelType(bean.getChannelType()); record.setChannelType(bean.getChannelType());
record.setAppCode("30011"); record.setAppCode("30011");
record.setPlatform("JAVA"); record.setPlatform("JAVA");
record.setVersionName("1.0"); record.setVersionName("1.0");
record.setDownloadUrl(bean.getDownloadUrl()); record.setDownloadUrl(bean.getDownloadUrl());
record.setDuration(bean.getDuration()); record.setDuration(bean.getDuration());
record.setStartTime(bean.getBeginTime()); record.setStartTime(bean.getBeginTime());
record.setEndTime(bean.getEndTime()); record.setEndTime(bean.getEndTime());
record.setUserCount(userCount); record.setUserCount(userCount);
record.setCreatePhone(bean.getCallNo()); record.setCreatePhone(bean.getCallNo());
record.setCreateShowPhone(bean.getCallNo()); record.setCreateShowPhone(bean.getCallNo());
record.setPhoneType(Util.getPhoneType(bean.getCallNo())); record.setPhoneType(Util.getPhoneType(bean.getCallNo()));
// callService.createCallRecord(record);// 添加主记录 // callService.createCallRecord(record);// 添加主记录
//添加被叫记录 //添加被叫记录
List<CallPhoneBean> phoneList = new ArrayList<CallPhoneBean>(); List<CallPhoneBean> phoneList = new ArrayList<CallPhoneBean>();
CallPhoneBean phone = new CallPhoneBean(); CallPhoneBean phone = new CallPhoneBean();
phone.setId(IdWorker.getNextId()); phone.setId(IdWorker.getNextId());
phone.setPhoneType(Util.getPhoneType(phone.getPhone())); phone.setPhoneType(Util.getPhoneType(phone.getPhone()));
phone.setRecordId(record.getId()); phone.setRecordId(record.getId());
phone.setDownloadUrl(bean.getDownloadUrl()); phone.setDownloadUrl(bean.getDownloadUrl());
phone.setCenterRecordsId(bean.getId()); phone.setCenterRecordsId(bean.getId());
if ("GROUP".equals(record.getCallType())) {// 群组聊天的时候记录标题 if ("GROUP".equals(record.getCallType())) {// 群组聊天的时候记录标题
phone.setTitle("由" + record.getCreateName() + "发起电话会议"); phone.setTitle("由" + record.getCreateName() + "发起电话会议");
} else { } else {
phone.setTitle(record.getCreateName()); 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());
} }
String acceptName = callService.getNameByPhoneFromSeat(bean.getAcceptNo()); }
String acceptId = callService.getIdByPhoneFromSeat(bean.getAcceptNo()); phone.setPhone(bean.getAcceptNo());
if(acceptName!=null){ phone.setShowPhone(bean.getAcceptNo());
phone.setUserId(acceptId); phone.setPhoneType(Util.getPhoneType(bean.getAcceptNo()));
phone.setUsername(acceptName); phone.setFlow("CALLED");
}else{ phoneList.add(phone);
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);// 添加电话列表 // callService.addCallPhoneList(phoneList);// 添加电话列表
bean.setCallRecordId(record.getId()); bean.setCallRecordId(record.getId());
if(callService.addSoundRecord(bean,phoneList,record)){ if(callService.addSoundRecord(bean,phoneList,record)){
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean; return responseBean;
......
...@@ -17,47 +17,47 @@ import com.ejweb.modules.call.entity.MemberEntity; ...@@ -17,47 +17,47 @@ import com.ejweb.modules.call.entity.MemberEntity;
public interface CallDao extends BaseDao { public interface CallDao extends BaseDao {
public Integer createCallRecord(CallRecordEntity entity); public Integer createCallRecord(CallRecordEntity entity);
public Integer updateCallRecord(CallRecordEntity entity); public Integer updateCallRecord(CallRecordEntity entity);
public Integer addCallPhoneList(List<CallPhoneBean> phoneList); public Integer addCallPhoneList(List<CallPhoneBean> phoneList);
public List<CallRecordListEntity> getCallRecordList(CallRecordListBean bean); public List<CallRecordListEntity> getCallRecordList(CallRecordListBean bean);
public List<CallRecordListEntity> getCallSoundList(CallRecordListBean bean); public List<CallRecordListEntity> getCallSoundList(CallRecordListBean bean);
public List<CallPhoneInfoListEntity> findUserByCallPhone(CallFindPhoneInfoBean bean); public List<CallPhoneInfoListEntity> findUserByCallPhone(CallFindPhoneInfoBean bean);
public List<CallPhoneInfoListEntity> findUserByCallRecord(CallFindPhoneInfoBean bean); public List<CallPhoneInfoListEntity> findUserByCallRecord(CallFindPhoneInfoBean bean);
public List<CallPhoneInfoListEntity> findSeatListByCallPhone(CallFindPhoneInfoBean bean); public List<CallPhoneInfoListEntity> findSeatListByCallPhone(CallFindPhoneInfoBean bean);
public CallPhoneInfoListEntity findUserInfoByNumOrId(CallFindPhoneInfoBean bean); public CallPhoneInfoListEntity findUserInfoByNumOrId(CallFindPhoneInfoBean bean);
public CallPhoneAreaEntity getPhoneAreaByAreaCode(CallPhoneAreaEntity areaCode); public CallPhoneAreaEntity getPhoneAreaByAreaCode(CallPhoneAreaEntity areaCode);
public CallPhoneAreaEntity getPhoneAreaByMobile(CallPhoneAreaEntity mobile); public CallPhoneAreaEntity getPhoneAreaByMobile(CallPhoneAreaEntity mobile);
public Integer addPhoneAreaRecord(CallPhoneAreaEntity entity); public Integer addPhoneAreaRecord(CallPhoneAreaEntity entity);
public Integer addPhoneAreaCode(CallPhoneAreaEntity entity); public Integer addPhoneAreaCode(CallPhoneAreaEntity entity);
public Integer addSoundRecord(CallSoundRecordBean entity); public Integer addSoundRecord(CallSoundRecordBean entity);
public List<CallPhoneInfoListEntity> findPhneListByHuaweiNum(HuaweiNumListEntity entity); public List<CallPhoneInfoListEntity> findPhneListByHuaweiNum(HuaweiNumListEntity entity);
public String GetPhoneById(String id); public String GetPhoneById(String id);
public List<MemberEntity> getMemberList(String recordId); public List<MemberEntity> getMemberList(String recordId);
public String getNameByPhone(String mobileNubmer); public String getNameByPhone(String mobileNubmer);
public String getNameByPhoneFromSeat(String createPhone); public String getNameByPhoneFromSeat(String createPhone);
public String getIdByPhoneFromSeat(String createPhone); public String getIdByPhoneFromSeat(String createPhone);
public String getIdByPhone(String mobileNubmer); public String getIdByPhone(String mobileNubmer);
public List<CallRecordListEntity> get(CallRecordListEntity callRecordListEntity); public List<CallRecordListEntity> get(CallRecordListEntity callRecordListEntity);
public List<CallRecordListEntity> getList(CallRecordListEntity callRecordListEntity); public List<CallRecordListEntity> getList(CallRecordListEntity callRecordListEntity);
} }
...@@ -26,29 +26,29 @@ import java.util.*; ...@@ -26,29 +26,29 @@ import java.util.*;
public class CallService extends BaseService<CallDao> { public class CallService extends BaseService<CallDao> {
public void createCallRecord(CallRecordEntity entity){ public void createCallRecord(CallRecordEntity entity){
dao.createCallRecord(entity); dao.createCallRecord(entity);
} }
public void updateCallRecord(CallRecordEntity entity){ public void updateCallRecord(CallRecordEntity entity){
dao.updateCallRecord(entity); dao.updateCallRecord(entity);
} }
public Integer addCallPhoneList(List<CallPhoneBean> phoneList){ public Integer addCallPhoneList(List<CallPhoneBean> phoneList){
return dao.addCallPhoneList(phoneList); return dao.addCallPhoneList(phoneList);
} }
/** /**
* 获取通话记录列表 * 获取通话记录列表
* *
* @author renmb * @author renmb
* @time 2016年12月6日 * @time 2016年12月6日
* @param bean * @param bean
* @return * @return
*/ */
public PageEntity<CallRecordListEntity> getCallRecordList(CallRecordListBean bean){ public PageEntity<CallRecordListEntity> getCallRecordList(CallRecordListBean bean){
PageInfo<CallRecordListEntity> pageInfo = null; PageInfo<CallRecordListEntity> pageInfo = null;
Date current = new Date(); Date current = new Date();
Date startTime = DateUtils.addDays(current, -3); Date startTime = DateUtils.addDays(current, -3);
...@@ -57,9 +57,9 @@ public class CallService extends BaseService<CallDao> { ...@@ -57,9 +57,9 @@ public class CallService extends BaseService<CallDao> {
// 必须紧贴dao的查询方法 // 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize()); PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallRecordList(bean)); pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallRecordList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
return null; return null;
} }
List<CallRecordListEntity> list = pageInfo.getList(); List<CallRecordListEntity> list = pageInfo.getList();
...@@ -81,7 +81,7 @@ public class CallService extends BaseService<CallDao> { ...@@ -81,7 +81,7 @@ public class CallService extends BaseService<CallDao> {
} }
} }
if(templist.size()>0){ if(templist.size()>0){
list.removeAll(templist); list.removeAll(templist);
pageInfo.setSize(list.size()); pageInfo.setSize(list.size());
pageInfo.setTotal(list.size()); pageInfo.setTotal(list.size());
} }
...@@ -95,55 +95,55 @@ public class CallService extends BaseService<CallDao> { ...@@ -95,55 +95,55 @@ public class CallService extends BaseService<CallDao> {
return page; return page;
} }
public PageEntity<CallRecordListEntity> getCallSoundList(CallRecordListBean bean){ public PageEntity<CallRecordListEntity> getCallSoundList(CallRecordListBean bean){
PageInfo<CallRecordListEntity> pageInfo = null; PageInfo<CallRecordListEntity> pageInfo = null;
Date current = new Date(); Date current = new Date();
Date startTime = DateUtils.addDays(current, -6); Date startTime = DateUtils.addDays(current, -6);
bean.setStartTime(DateFormatUtils.format(startTime, "yyyy-MM-dd 00:00:00")); bean.setStartTime(DateFormatUtils.format(startTime, "yyyy-MM-dd 00:00:00"));
bean.setEndTime(DateFormatUtils.format(current, "yyyy-MM-dd 23:59:59")); bean.setEndTime(DateFormatUtils.format(current, "yyyy-MM-dd 23:59:59"));
// 必须紧贴dao的查询方法 // 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize()); PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallSoundList(bean)); pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallSoundList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL if (pageInfo.getPages() < bean.getPageNo()) {// 页码大于总页数,则返回NULL
return null; return null;
} }
List<CallRecordListEntity> list = pageInfo.getList(); List<CallRecordListEntity> list = pageInfo.getList();
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL if (list == null || list.size() == 0) {// 如果没有数据则返回NULL
return null; return null;
} }
PageEntity<CallRecordListEntity> page = new PageEntity<CallRecordListEntity>(); PageEntity<CallRecordListEntity> page = new PageEntity<CallRecordListEntity>();
page.setPageNo(pageInfo.getPageNum()); page.setPageNo(pageInfo.getPageNum());
page.setPageSize(pageInfo.getPageSize()); page.setPageSize(pageInfo.getPageSize());
page.setCount(pageInfo.getTotal()); page.setCount(pageInfo.getTotal());
page.setTotalPage(pageInfo.getPages()); page.setTotalPage(pageInfo.getPages());
page.setList(pageInfo.getList()); page.setList(pageInfo.getList());
return page; return page;
} }
/** /**
* 根据电话号码查询,通话来电号码查询用户信息 * 根据电话号码查询,通话来电号码查询用户信息
* *
* 1、席位优先 * 1、席位优先
* 2、查询最近通话记录 * 2、查询最近通话记录
* 3、查询用户表,如果有多个用户就展示用户手机号或者座机号 * 3、查询用户表,如果有多个用户就展示用户手机号或者座机号
* *
* @author renmb * @author renmb
* @time 2017年1月5日 * @time 2017年1月5日
* @param bean * @param bean
* @return * @return
*/ */
public List<CallPhoneInfoListEntity> findUserByCallPhone(CallFindPhoneInfoBean bean, boolean isOnlySearch){ public List<CallPhoneInfoListEntity> findUserByCallPhone(CallFindPhoneInfoBean bean, boolean isOnlySearch){
bean.setMobileNubmer0("0"+bean.getPhoneNumer()); bean.setMobileNubmer0("0"+bean.getPhoneNumer());
bean.setMobileNubmer00("00"+bean.getPhoneNumer()); bean.setMobileNubmer00("00"+bean.getPhoneNumer());
List<CallPhoneInfoListEntity> callList = dao.findUserByCallRecord(bean); List<CallPhoneInfoListEntity> callList = dao.findUserByCallRecord(bean);
if(callList == null || callList.size() == 0){// 没有匹配到席位信息 if(callList == null || callList.size() == 0){// 没有匹配到席位信息
List<CallPhoneInfoListEntity> seatList = dao.findSeatListByCallPhone(bean); List<CallPhoneInfoListEntity> seatList = dao.findSeatListByCallPhone(bean);
if(seatList == null || seatList.size() == 0){// 没有匹配到通话记录信息 if(seatList == null || seatList.size() == 0){// 没有匹配到通话记录信息
List<CallPhoneInfoListEntity> userList = dao.findUserByCallPhone(bean); List<CallPhoneInfoListEntity> userList = dao.findUserByCallPhone(bean);
if(userList == null || userList.size() == 0 || userList.size() > 1){// 没有匹配到用户信息,或者匹配个数大于1 if(userList == null || userList.size() == 0 || userList.size() > 1){// 没有匹配到用户信息,或者匹配个数大于1
CallPhoneInfoListEntity entity = new CallPhoneInfoListEntity(); CallPhoneInfoListEntity entity = new CallPhoneInfoListEntity();
...@@ -155,21 +155,21 @@ public class CallService extends BaseService<CallDao> { ...@@ -155,21 +155,21 @@ public class CallService extends BaseService<CallDao> {
phoneList.add(entity); phoneList.add(entity);
return phoneList; return phoneList;
} else{// 有用户信息直接返回 } else{// 有用户信息直接返回
return userList; return userList;
} }
} else {// 有通话记录信息,直接返回 } else {// 有通话记录信息,直接返回
return seatList; return seatList;
} }
} else{// 有席位信息直接返回 } else{// 有席位信息直接返回
return callList; return callList;
} }
} }
/** /**
* 被叫方添加通话记录 * 被叫方添加通话记录
* *
* @author renmb * @author renmb
* @time 2017年3月17日 * @time 2017年3月17日
* @param bean * @param bean
...@@ -226,7 +226,7 @@ public class CallService extends BaseService<CallDao> { ...@@ -226,7 +226,7 @@ public class CallService extends BaseService<CallDao> {
// } // }
/** /**
* 综合查询手机号的归属地信息 * 综合查询手机号的归属地信息
* *
* @author renmb * @author renmb
* @time 2017年1月22日 * @time 2017年1月22日
* @param mobile * @param mobile
...@@ -235,7 +235,7 @@ public class CallService extends BaseService<CallDao> { ...@@ -235,7 +235,7 @@ public class CallService extends BaseService<CallDao> {
@Transactional(readOnly = false) @Transactional(readOnly = false)
public CallPhoneAreaEntity addPhoneArea(String mobile){ public CallPhoneAreaEntity addPhoneArea(String mobile){
if(StringUtils.isEmpty(mobile) || mobile.length()<7){ if(StringUtils.isEmpty(mobile) || mobile.length()<7){
return null; return null;
} }
String src = new String(mobile); String src = new String(mobile);
...@@ -256,17 +256,17 @@ public class CallService extends BaseService<CallDao> { ...@@ -256,17 +256,17 @@ public class CallService extends BaseService<CallDao> {
phoneArea = this.getCallPhoneAreaBy360(mobile); phoneArea = this.getCallPhoneAreaBy360(mobile);
if(phoneArea != null){ if(phoneArea != null){
if(StringUtils.isNotEmpty(phoneArea.getPremobile())){// 手机类型进行缓存数据库 if(StringUtils.isNotEmpty(phoneArea.getPremobile())){// 手机类型进行缓存数据库
phoneArea.setId(IdWorker.getNextId()); phoneArea.setId(IdWorker.getNextId());
phoneArea.setUpdateDate(new Date()); phoneArea.setUpdateDate(new Date());
if(phoneArea.getMobile().length()>=7){ if(phoneArea.getMobile().length()>=7){
phoneArea.setAreaCode(phoneArea.getMobile().substring(0, 7)); phoneArea.setAreaCode(phoneArea.getMobile().substring(0, 7));
dao.addPhoneAreaCode(phoneArea); dao.addPhoneAreaCode(phoneArea);
} }
dao.addPhoneAreaRecord(phoneArea); dao.addPhoneAreaRecord(phoneArea);
} else{// 非手机号,按座机号处理 } else{// 非手机号,按座机号处理
phoneArea.setShowPhone(src); phoneArea.setShowPhone(src);
phoneArea.setPhone(Util.formatedWorkPhone(src)); phoneArea.setPhone(Util.formatedWorkPhone(src));
phoneArea.setType("PHONE"); phoneArea.setType("PHONE");
...@@ -296,14 +296,14 @@ public class CallService extends BaseService<CallDao> { ...@@ -296,14 +296,14 @@ public class CallService extends BaseService<CallDao> {
} else if(mobile.startsWith("0") == false){ } else if(mobile.startsWith("0") == false){
PhoneAreaEntity area = PhoneAreaUtil.get360PhoneArea(mobile); PhoneAreaEntity area = PhoneAreaUtil.get360PhoneArea(mobile);
if(area == null){ if(area == null){
area = PhoneAreaUtil.get360PhoneArea(mobile); area = PhoneAreaUtil.get360PhoneArea(mobile);
} }
if(area != null && StringUtils.isNotBlank(area.getProvince())){// 能够查到省份信息 if(area != null && StringUtils.isNotBlank(area.getProvince())){// 能够查到省份信息
if(area.getProvince().contains("北京") if(area.getProvince().contains("北京")
|| (StringUtils.isNotBlank(area.getCity()) && area.getCity().contains("北京"))){// 北京前面加拨一个0 || (StringUtils.isNotBlank(area.getCity()) && area.getCity().contains("北京"))){// 北京前面加拨一个0
callPhone.setType("MOBILE"); callPhone.setType("MOBILE");
callPhone.setMobileNubmer("0"+mobile);// 加拨1个0 callPhone.setMobileNubmer("0"+mobile);// 加拨1个0
callPhone.setPremobile("0"); callPhone.setPremobile("0");
...@@ -312,7 +312,7 @@ public class CallService extends BaseService<CallDao> { ...@@ -312,7 +312,7 @@ public class CallService extends BaseService<CallDao> {
callPhone.setMobileSp(StringUtils.isBlank(area.getSp()) ? "" : area.getSp()); callPhone.setMobileSp(StringUtils.isBlank(area.getSp()) ? "" : area.getSp());
return callPhone; return callPhone;
} else {// 非北京号码加拨两个0 } else {// 非北京号码加拨两个0
callPhone.setType("MOBILE"); callPhone.setType("MOBILE");
callPhone.setMobileNubmer("00"+mobile);// 加拨2个0 callPhone.setMobileNubmer("00"+mobile);// 加拨2个0
callPhone.setPremobile("00"); callPhone.setPremobile("00");
...@@ -332,32 +332,32 @@ public class CallService extends BaseService<CallDao> { ...@@ -332,32 +332,32 @@ public class CallService extends BaseService<CallDao> {
} }
/** /**
* 添加安科同步过来的数据 * 添加安科同步过来的数据
* *
* @author renmb * @author renmb
* @time 2017年2月28日 * @time 2017年2月28日
* @param entity * @param entity
* @return * @return
*/ */
public boolean addSoundRecord(CallSoundRecordBean entity,List<CallPhoneBean> phoneList,CallRecordEntity record){ public boolean addSoundRecord(CallSoundRecordBean entity,List<CallPhoneBean> phoneList,CallRecordEntity record){
dao.createCallRecord(record); dao.createCallRecord(record);
dao.addCallPhoneList(phoneList); dao.addCallPhoneList(phoneList);
Integer count = dao.addSoundRecord(entity); Integer count = dao.addSoundRecord(entity);
return count != null && count > 0; return count != null && count > 0;
} }
public Map<String, String> findPhoneByHuaweiNum(List<String> huweiNumList){ public Map<String, String> findPhoneByHuaweiNum(List<String> huweiNumList){
HuaweiNumListEntity entity = new HuaweiNumListEntity(); HuaweiNumListEntity entity = new HuaweiNumListEntity();
entity.setHuweiNumList(huweiNumList); entity.setHuweiNumList(huweiNumList);
List<CallPhoneInfoListEntity> list = dao.findPhneListByHuaweiNum(entity); List<CallPhoneInfoListEntity> list = dao.findPhneListByHuaweiNum(entity);
if(list == null || list.size() == 0){ if(list == null || list.size() == 0){
return null; return null;
} }
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
for(CallPhoneInfoListEntity p:list){ for(CallPhoneInfoListEntity p:list){
map.put(p.getHuaweiNum(), p.getPhone()); map.put(p.getHuaweiNum(), p.getPhone());
} }
return map; return map;
...@@ -367,28 +367,27 @@ public class CallService extends BaseService<CallDao> { ...@@ -367,28 +367,27 @@ public class CallService extends BaseService<CallDao> {
// } // }
public List<MemberEntity> getMemberList(String id) { public List<MemberEntity> getMemberList(String id) {
return dao.getMemberList( id); return dao.getMemberList( id);
} }
public String getNameByPhone(String createPhone) { public String getNameByPhone(String createPhone) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return dao.getNameByPhone(createPhone); return dao.getNameByPhone(createPhone);
} }
public String getNameByPhoneFromSeat(String createPhone) { public String getNameByPhoneFromSeat(String createPhone) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return dao.getNameByPhoneFromSeat(createPhone); return dao.getNameByPhoneFromSeat(createPhone);
} }
public String getIdByPhoneFromSeat(String callNo) { public String getIdByPhoneFromSeat(String callNo) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return dao.getIdByPhoneFromSeat(callNo); return dao.getIdByPhoneFromSeat(callNo);
} }
public String getIdByPhone(String callNo) { public String getIdByPhone(String callNo) {
// TODO Auto-generated method stub // TODO Auto-generated method stub
return dao.getIdByPhone(callNo); return dao.getIdByPhone(callNo);
} }
} }
...@@ -640,7 +640,7 @@ public class HuaweiUCSyncService { ...@@ -640,7 +640,7 @@ public class HuaweiUCSyncService {
//更新席位账号,UC状态为关闭 //更新席位账号,UC状态为关闭
SeatEntity seatEntity = huaweiUCSyncDao.getSeatById(accountId); SeatEntity seatEntity = huaweiUCSyncDao.getSeatById(accountId);
if(seatEntity != null){ if(seatEntity != null){
return updateSeatAccountInfo(seatEntity, personInfo, "1", ucOpen); return updateSeatAccountInfo(seatEntity, personInfo, "1", ucOpen);
} }
return false; return false;
...@@ -671,7 +671,7 @@ public class HuaweiUCSyncService { ...@@ -671,7 +671,7 @@ public class HuaweiUCSyncService {
accountUpdateBean.setName(StringUtils.isBlank(userProfileEntity.getName()) ? "未填写" : userProfileEntity.getName()); accountUpdateBean.setName(StringUtils.isBlank(userProfileEntity.getName()) ? "未填写" : userProfileEntity.getName());
// accountUpdateBean.setSex(userProfileEntity.getSex().toString().equals("M") ? "0" : "1"); // accountUpdateBean.setSex(userProfileEntity.getSex().toString().equals("M") ? "0" : "1");
if(StringUtils.isNotEmpty(userProfileEntity.getSex())){ if(StringUtils.isNotEmpty(userProfileEntity.getSex())){
accountUpdateBean.setSex("M".equals(userProfileEntity.getSex()) ? "0" : "1"); accountUpdateBean.setSex("M".equals(userProfileEntity.getSex()) ? "0" : "1");
} }
// accountUpdateBean.setHomePhone(homePhone); // accountUpdateBean.setHomePhone(homePhone);
...@@ -924,20 +924,20 @@ public class HuaweiUCSyncService { ...@@ -924,20 +924,20 @@ public class HuaweiUCSyncService {
} }
/** /**
//是否忽略系统最大的sip号码,忽略的话只根据配置进行处理,需要循环得到不存在的号码 //是否忽略系统最大的sip号码,忽略的话只根据配置进行处理,需要循环得到不存在的号码
if (ignoreMaxSipNum) { if (ignoreMaxSipNum) {
while (true) { while (true) {
Boolean checkSipResult = checkSipExists(maxSipNum); Boolean checkSipResult = checkSipExists(maxSipNum);
if (checkSipResult == null) { if (checkSipResult == null) {
return false; return false;
} }
if (checkSipResult) { if (checkSipResult) {
maxSipNum++; maxSipNum++;
} }
if (!checkSipResult) { if (!checkSipResult) {
break; break;
} }
} }
} }
* *
*/ */
...@@ -1077,10 +1077,10 @@ public class HuaweiUCSyncService { ...@@ -1077,10 +1077,10 @@ public class HuaweiUCSyncService {
accountInfo.getAccount().setUserState("0"); accountInfo.getAccount().setUserState("0");
accountInfo.getAccount().setDepartmentId(departmentId); accountInfo.getAccount().setDepartmentId(departmentId);
if(StringUtils.isNotEmpty(userProfileEntity.getSex())){ if(StringUtils.isNotEmpty(userProfileEntity.getSex())){
accountInfo.getAccount().setSex("M".equals(userProfileEntity.getSex()) ? "0" : "1"); accountInfo.getAccount().setSex("M".equals(userProfileEntity.getSex()) ? "0" : "1");
} }
accountInfo.getAccount().setCellPhone(Util.formatedMobile(userProfileEntity.getMobile())); accountInfo.getAccount().setCellPhone(Util.formatedMobile(userProfileEntity.getMobile()));
accountInfo.getAccount().setWebsite(userProfileEntity.getName()); accountInfo.getAccount().setWebsite(userProfileEntity.getName());
accountInfo.getAccount().setOfficePhone(Util.formatedWorkPhone(userProfileEntity.getPhone())); accountInfo.getAccount().setOfficePhone(Util.formatedWorkPhone(userProfileEntity.getPhone()));
...@@ -1417,7 +1417,7 @@ public class HuaweiUCSyncService { ...@@ -1417,7 +1417,7 @@ public class HuaweiUCSyncService {
* @return * @return
*/ */
public boolean deleteUCAccount(String accountId) { public boolean deleteUCAccount(String accountId) {
try { try {
RestRequestMessage restRequestMessage = new RestRequestMessage(); RestRequestMessage restRequestMessage = new RestRequestMessage();
restRequestMessage.setHttpMethod("DELETE"); restRequestMessage.setHttpMethod("DELETE");
...@@ -1425,7 +1425,7 @@ public class HuaweiUCSyncService { ...@@ -1425,7 +1425,7 @@ public class HuaweiUCSyncService {
params.put("userId", userId); params.put("userId", userId);
params.put("accountId", accountId); params.put("accountId", accountId);
restRequestMessage.setParameters(params); restRequestMessage.setParameters(params);
String res = restUtils.sendMessage(restRequestMessage, accountRestUrl); String res = restUtils.sendMessage(restRequestMessage, accountRestUrl);
if (StringUtils.isNotBlank(res)) { if (StringUtils.isNotBlank(res)) {
HuaweiQueryResponseEntity queryResponseEntity = JSONObject.parseObject(res, HuaweiQueryResponseEntity.class); HuaweiQueryResponseEntity queryResponseEntity = JSONObject.parseObject(res, HuaweiQueryResponseEntity.class);
......
/** /**
* *
*/ */
package com.ejweb.modules.message.service; package com.ejweb.modules.message.service;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.base.BaseService; import com.ejweb.core.base.BaseService;
...@@ -26,57 +17,68 @@ import com.ejweb.modules.message.bean.ShortMsgUserListBean; ...@@ -26,57 +17,68 @@ import com.ejweb.modules.message.bean.ShortMsgUserListBean;
import com.ejweb.modules.message.dao.ShortMessageDao; import com.ejweb.modules.message.dao.ShortMessageDao;
import com.ejweb.modules.message.entity.ShortMsgUserListEntity; import com.ejweb.modules.message.entity.ShortMsgUserListEntity;
import com.ejweb.modules.message.entity.SmsRecordEntity; import com.ejweb.modules.message.entity.SmsRecordEntity;
import com.ejweb.modules.notice.bean.NewsNoticeListBean;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/** /**
*
* @team suzhou
* @author huhy, renmb * @author huhy, renmb
* @version 1.0 * @version 1.0
* @time 2016年9月23日 * @team suzhou
* @time 2016年9月23日
*/ */
@Service @Service
@Transactional(readOnly = true) @Transactional(readOnly = true, rollbackFor = Exception.class)
public class ShortMessageService extends BaseService<ShortMessageDao>{ public class ShortMessageService extends BaseService<ShortMessageDao> {
private final static Logger logger = Logger.getLogger(ShortMessageService.class);
/** /**
* 向指定的手机发送短信信息 * 向指定的手机发送短信信息
* *
* @author renmb
* @time 2016年9月25日
* @param phone
* @param message
* @return * @return
* @author renmb
* @time 2016年9月25日
*/ */
@Transactional(readOnly = false) @Transactional(rollbackFor = Exception.class)
public boolean addMessageToPhone(ShortMsgBean bean){ public boolean addMessageToPhone(ShortMsgBean bean) {
try { try {
String phone = bean.getPhone(); String phone = bean.getPhone();
if(StringUtils.isEmpty(phone)) if (StringUtils.isEmpty(phone)) {
return false; return false;
}
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
String[] phones = phone.split(",|,"); String[] phones = phone.split(",|,");
for (int i=0,len = phones.length;i<len;i++) { for (int i = 0, len = phones.length; i < len; i++) {
if(i > 0){ if (i > 0) {
builder.append(","); builder.append(",");
} }
builder.append(phones[i].replaceAll("^0+", "")); builder.append(phones[i].replaceAll("^0+", ""));
} }
phone = builder.toString();//phone.replaceAll("^0+", ""); phone = builder.toString();
if(StringUtils.isEmpty(phone)) if (StringUtils.isEmpty(phone)) {
return false; return false;
}
HCFetcher fetcher = HCFetcher.getInstance(); HCFetcher fetcher = HCFetcher.getInstance();
// fetcher.setPolitenessDelay(3000); FetchEntity entity = fetcher.post(GConstants.JDAIR_SMS_API + "&mobile=" + phone + "&msg=" + URLEncoder.encode(bean.getMessage(), "UTF-8"), null);
FetchEntity entity = fetcher.post(GConstants.JDAIR_SMS_API+"&mobile="+phone+"&msg="+URLEncoder.encode(bean.getMessage(), "UTF-8"),null); if (entity != null && entity.isSuccess()) {
if(entity != null && entity.isSuccess()){
String resultStr = entity.getContent("utf-8"); String resultStr = entity.getContent("utf-8");
if (StringUtils.isNotBlank(resultStr)) {// 成功获取数据 // 成功获取数据
JSONObject result = JSON.parseObject(resultStr);// 解析JSON数据 if (StringUtils.isNotBlank(resultStr)) {
// 解析JSON数据
JSONObject result = JSON.parseObject(resultStr);
String resultCode = result.getJSONObject("result").getString("resultCode"); String resultCode = result.getJSONObject("result").getString("resultCode");
if ("1000".equals(resultCode)) {// 判断 调用接口是否成功 // 判断 调用接口是否成功
if ("1000".equals(resultCode)) {
SmsRecordEntity record = new SmsRecordEntity(); SmsRecordEntity record = new SmsRecordEntity();
record.setClientip(bean.getClientip()); record.setClientip(bean.getClientip());
record.setCreateTime(new Date()); record.setCreateTime(new Date());
...@@ -87,13 +89,13 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{ ...@@ -87,13 +89,13 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
record.setUserId(bean.getUserId()); record.setUserId(bean.getUserId());
record.setGroupId(bean.getGroupId()); record.setGroupId(bean.getGroupId());
this.addSmsRecords(record); this.addSmsRecords(record);
List<ShortMsgUserListBean> userList = bean.getUserList(); List<ShortMsgUserListBean> userList = bean.getUserList();
if(userList != null && userList.size()>0){ if (userList != null && userList.size() > 0) {
Date createDate = new Date(); Date createDate = new Date();
List<ShortMsgUserListEntity> smsUserList = new ArrayList<ShortMsgUserListEntity>(); List<ShortMsgUserListEntity> smsUserList = new ArrayList<ShortMsgUserListEntity>();
for(ShortMsgUserListBean user:userList){ for (ShortMsgUserListBean user : userList) {
ShortMsgUserListEntity smsUser = new ShortMsgUserListEntity(); ShortMsgUserListEntity smsUser = new ShortMsgUserListEntity();
smsUser.setId(IdWorker.getNextNumId()); smsUser.setId(IdWorker.getNextNumId());
smsUser.setCreateDate(createDate); smsUser.setCreateDate(createDate);
...@@ -102,12 +104,14 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{ ...@@ -102,12 +104,14 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
smsUser.setUserId(user.getUserId()); smsUser.setUserId(user.getUserId());
smsUser.setUserMobile(user.getUserMobile()); smsUser.setUserMobile(user.getUserMobile());
smsUser.setUserType(user.getUserType()); smsUser.setUserType(user.getUserType());
smsUserList.add(smsUser); smsUserList.add(smsUser);
} }
this.addUser2SmsRecords(smsUserList); this.addUser2SmsRecords(smsUserList);
} }
return true; return true;
} else {
logger.error("短信发送错误:" + result.toJSONString());
} }
} }
} }
...@@ -117,47 +121,54 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{ ...@@ -117,47 +121,54 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
} }
return false; return false;
} }
/** /**
* 添加发送短信记录 * 添加发送短信记录
* *
* @author renmb
* @time 2016年10月4日
* @param entity * @param entity
* @return * @return
* @author renmb
* @time 2016年10月4日
*/ */
@Transactional(readOnly = false) @Transactional(rollbackFor = Exception.class)
public Integer addSmsRecords(SmsRecordEntity entity){ public Integer addSmsRecords(SmsRecordEntity entity) {
return dao.addSmsRecords(entity); return dao.addSmsRecords(entity);
} }
@Transactional(readOnly = false)
public Integer addUser2SmsRecords(List<ShortMsgUserListEntity> smsUserList){ @Transactional(rollbackFor = Exception.class)
if(smsUserList != null && smsUserList.size()>0) public Integer addUser2SmsRecords(List<ShortMsgUserListEntity> smsUserList) {
if (smsUserList != null && smsUserList.size() > 0) {
return dao.addUser2SmsRecords(smsUserList); return dao.addUser2SmsRecords(smsUserList);
}
return 0; return 0;
} }
public List<ShortMsgUserListEntity> findSmsUserList(ShortMsgListBean bean){
public List<ShortMsgUserListEntity> findSmsUserList(ShortMsgListBean bean) {
return dao.findSmsUserList(bean); return dao.findSmsUserList(bean);
} }
/** /**
* 查询用户短信列表 * 查询用户短信列表
* *
* @author renmb
* @time 2017年3月7日
* @param bean * @param bean
* @return * @return
* @author renmb
* @time 2017年3月7日
*/ */
public PageEntity<SmsRecordEntity> findUserSmsMesaageList(ShortMsgListBean bean){ public PageEntity<SmsRecordEntity> findUserSmsMesaageList(ShortMsgListBean bean) {
PageInfo<SmsRecordEntity> pageInfo = null; PageInfo<SmsRecordEntity> pageInfo = null;
// 必须紧贴dao的查询方法 // 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize()); PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<SmsRecordEntity>(dao.findUserSmsMesaageList(bean)); pageInfo = new PageInfo<SmsRecordEntity>(dao.findUserSmsMesaageList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL // 页码大于总页数,则返回NULL
if (pageInfo.getPages() < bean.getPageNo()) {
return null; return null;
} }
List<SmsRecordEntity> list = pageInfo.getList(); List<SmsRecordEntity> list = pageInfo.getList();
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL // 如果没有数据则返回NULL
if (list == null || list.size() == 0) {
return null; return null;
} }
PageEntity<SmsRecordEntity> page = new PageEntity<SmsRecordEntity>(); PageEntity<SmsRecordEntity> page = new PageEntity<SmsRecordEntity>();
...@@ -168,18 +179,4 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{ ...@@ -168,18 +179,4 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
page.setList(pageInfo.getList()); page.setList(pageInfo.getList());
return page; return page;
} }
// public static void main(String[] args){
// StringBuilder builder = new StringBuilder();
// String phone = "13357826761,0013357826761,13357826761";
// String[] phones = phone.split(",|,");
// for (int i=0,len = phones.length;i<len;i++) {
// if(i > 0){
//
// builder.append(",");
// }
// builder.append(phones[0].replaceAll("^0+", ""));
// }
// phone = builder.toString();//phone.replaceAll("^0+", "");
// System.out.println(phone);
// }
} }
...@@ -20,8 +20,8 @@ public interface FlightDynamicsDao extends BaseDao{ ...@@ -20,8 +20,8 @@ public interface FlightDynamicsDao extends BaseDao{
List<FlightDynamicsEntity> getDailyList(FlightDynamicsTotalBean bean); List<FlightDynamicsEntity> getDailyList(FlightDynamicsTotalBean bean);
public Integer updateTotalFlight(FlightTotalEntity bean); public Integer updateTotalFlight(FlightTotalEntity bean);
public FlightTotalEntity getTotalFlight(FlightTotalEntity bean); public FlightTotalEntity getLastTotalFlight();
List<FlightDynamicsDetailEntity> getCancelList(FlightDynamicsDetailBean bean); List<FlightDynamicsDetailEntity> getCancelList(FlightDynamicsDetailBean bean);
......
...@@ -188,12 +188,7 @@ public class FlightDynamicsService extends BaseService<FlightDynamicsDao> { ...@@ -188,12 +188,7 @@ public class FlightDynamicsService extends BaseService<FlightDynamicsDao> {
} else { } else {
LOG.debug("没有数据"); LOG.debug("没有数据");
} }
int flightTotal = this.getTotalFlight(bean.getFltDate()); int flightTotal = getLastTotalFlight();
if(flightTotal<1){
flightTotal = 72;
}
totalEntity.setPlanFlightTotal(flightTotal); totalEntity.setPlanFlightTotal(flightTotal);
totalEntity.setPlaneDailyUsage(dao.getPlaneDailyUsage(bean.getFltDate(),flightTotal)); totalEntity.setPlaneDailyUsage(dao.getPlaneDailyUsage(bean.getFltDate(),flightTotal));
...@@ -220,22 +215,17 @@ public class FlightDynamicsService extends BaseService<FlightDynamicsDao> { ...@@ -220,22 +215,17 @@ public class FlightDynamicsService extends BaseService<FlightDynamicsDao> {
return dao.updateTotalFlight(bean); return dao.updateTotalFlight(bean);
} }
/** /**
* 获取某一天的飞机总量 * 获取最近修改的飞机总量
* *
* @author renmb
* @time 2017年2月8日
* @param flightDate
* @return * @return
*/ */
public int getTotalFlight(String flightDate){ public int getLastTotalFlight() {
FlightTotalEntity total = dao.getLastTotalFlight();
FlightTotalEntity bean = new FlightTotalEntity(); if (total == null) {
bean.setFlightDate(flightDate);
FlightTotalEntity total = dao.getTotalFlight(bean);
if(total == null)
return 0; return 0;
}
return total.getFlightTotal(); return total.getFlightTotal();
} }
} }
No preview for this file type
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