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
# Verify Post Content Sign(Default true)
is.verify.content.sign=false
# \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
#huaweiUC properties
......
# Root logger option
## log4j.rootLogger=DEBUG, WARN, INFO, stdout, R
log4j.rootLogger=DEBUG, stdout, R
log4j.rootLogger=INFO, stdout, R
#Console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
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
log4j.appender.R=org.apache.log4j.RollingFileAppender
......
......@@ -99,7 +99,7 @@
center_records_id
) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
(
#{item.id},
#{item.recordId},
#{item.title},
......@@ -182,7 +182,7 @@
and r.start_time &lt;= #{endTime}
ORDER BY r.start_time DESC
</select>
<!-- 通过通话的电话号查询用户信息 -->
<select id="findUserByCallPhone" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT a.id AS userId,
......@@ -244,7 +244,7 @@
OR s.seat_phone = #{phoneNumer}
OR s.seat_phone_number = #{phoneNumer}
</select>
<select id="findUserInfoByNumOrId" resultType="com.ejweb.modules.call.entity.CallPhoneInfoListEntity">
SELECT s.id AS userId,
s.seat_name AS name,
......@@ -291,7 +291,7 @@
ORDER BY start_time DESC
LIMIT 1
</select>
<!-- 通过通话的电话号查询席位信息 -->
<select id="getPhoneAreaByAreaCode" resultType="com.ejweb.modules.call.entity.CallPhoneAreaEntity">
SELECT * FROM `foc_phone_area` WHERE `area_code`=#{areaCode}
......@@ -351,7 +351,7 @@
#{updateDate}
)
</insert>
<!-- 添加安科的录音记录 -->
<insert id="addSoundRecord">
INSERT INTO foc_callcenter_records(
......@@ -394,8 +394,8 @@
#{createDate}
)
</insert>
<!-- 安科记录 -->
<select id="getCallSoundList" resultType="com.ejweb.modules.call.entity.CallRecordListEntity">
......@@ -468,7 +468,7 @@
'SEAT' AS type,
'' AS mobile
FROM foc_seats s
WHERE s.huawei_num IN
WHERE s.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
......@@ -480,7 +480,7 @@
'USER' AS type,
a.mobile
FROM sys_user a
WHERE a.huawei_num IN
WHERE a.huawei_num IN
<foreach collection="huweiNumList" open="(" close=")" separator="," item="item">
#{item}
</foreach>
......
......@@ -250,12 +250,12 @@ WHERE c.subtime BETWEEN CONVERT(CONCAT(DATE_ADD(#{fltDate},INTERVAL -1 DAY), " 2
update_by=VALUES(update_by),
update_date=VALUES(update_date)
</insert>
<!-- 获取飞机总量 -->
<select id="getTotalFlight" resultType="com.ejweb.modules.statistics.entity.FlightTotalEntity">
SELECT *
<!-- 获取最近时间飞机总量 -->
<select id="getLastTotalFlight" resultType="com.ejweb.modules.statistics.entity.FlightTotalEntity">
SELECT *
FROM foc_flight_total
WHERE flight_date=#{flightDate}
order by flight_date desc limit 1;
</select>
<select id="getPlaneDailyUsage" resultType="Double">
SELECT SUM(unix_timestamp(ata_chn) - unix_timestamp(atd_chn))/(60*60*#{flightTotal})
......
......@@ -3,60 +3,38 @@
*/
package com.ejweb.core.conf;
import java.io.File;
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 com.ejweb.core.security.DES3Utils;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import com.ejweb.core.security.DES3Utils;
import com.jdair.util.security.DESPlus;
import java.util.Enumeration;
import java.util.Properties;
/**
*
* @team IT Team
* @author renmb
* @version 1.0
* @time 2016年11月2日
* @team IT Team
* @time 2016年11月2日
*/
public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
// private static final String key = "";
private static final String CONF_DESC_KEY = "2012PinganVitality075522628888ForShenZhenBelter075561869839";
private Map<String, Boolean> keys = new HashMap<String, Boolean>();
private static final String CONF_DESC_KEY = "2012PinganVitality075522628888ForShenZhenBelter075561869839";
@Override
protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
throws BeansException {
// TODO Auto-generated method stub
try {
Enumeration<?> enu = props.propertyNames();
Enumeration<?> enu = props.propertyNames();
while (enu.hasMoreElements()) {
try {
String key = (String) enu.nextElement();
String val = (String) props.get(key);
String decorded = DES3Utils.decrypt(val, CONF_DESC_KEY);
if(decorded != null){
if (decorded != null) {
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) {
// TODO: handle exception
}
......@@ -66,191 +44,41 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
}
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;
}
if (props.containsKey(key)) {
return props.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);
if(val == null)
if (val == null) {
return want;
}
return val;
}
public static boolean getBoolean(Properties props, String key, boolean want) {
try {
String val = props.getProperty(key);
if(val == null || val.length() == 0)
if (val == null || val.length() == 0) {
return want;
}
return Boolean.parseBoolean(val);
} catch (Exception e) {
// TODO: handle exception
}
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) {
// try {
// 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();
// }
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("69872b2310ba9b30470ce46682151021e825c3909c394aa5f4387123bdbfa67e", CONF_DESC_KEY));
}
}
......@@ -39,7 +39,7 @@ import com.ejweb.modules.user.service.UserService;
/**
* 电话会议记录及查询
*
*
* @team IT Team
* @author renmb
* @version 1.0
......@@ -55,7 +55,7 @@ public class CallController {
private UserService userService;
/**
* 批量查询电话号码列表
*
*
* @author renmb
* @time 2017年1月22日
* @param requestBean
......@@ -67,25 +67,25 @@ public class CallController {
ResponseBean responseBean = new ResponseBean();
CallPhoneAreaBean bean = requestBean.getObjectBean(CallPhoneAreaBean.class);
String message = this.callService.validate(bean);
List<CallPhoneAreaEntity> searchPhoneList = bean.getCallPhoneList();
if(message == null && searchPhoneList !=null && searchPhoneList.size()>0){
List<CallPhoneAreaEntity> callPhoneList = new ArrayList<CallPhoneAreaEntity>();
for (CallPhoneAreaEntity phone:searchPhoneList) {
CallPhoneAreaEntity callPhone = callService.addPhoneArea(phone.getMobile());
if(callPhone == null){// 未查询到相关数据
callPhone = new CallPhoneAreaEntity();
}
callPhone.setMobile(phone.getMobile());
callPhone.setShowPhone(phone.getMobile());
if("PHONE".equals(callPhone.getType())){
callPhone.setMobileNubmer(callPhone.getPhone());
callPhone.setShowPhone(callPhone.getShowPhone());
} else if("MOBILE".equals(callPhone.getType())){
callPhone.setShowPhone(callPhone.getMobile());
callPhone.setPhone(callPhone.getMobileNubmer());
}
......@@ -99,12 +99,12 @@ public class CallController {
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
/**
* 格式化手机号码
* 42.4 查询手机归属地信息接口
*
*
* @author renmb
* @time 2016年12月6日
* @param requestBean
......@@ -114,29 +114,29 @@ public class CallController {
@RequestMapping(value = "/phoneArea")
public ResponseBean phoneArea(RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
CallPhoneAreaBean bean = requestBean.getObjectBean(CallPhoneAreaBean.class);
String message = this.callService.validate(bean);
CallPhoneAreaEntity callPhone = new CallPhoneAreaEntity();
if(message == null){
callPhone.setPhone(bean.getPhone());
callPhone.setMobile(bean.getMobile());
// 格式化手机号
if(StringUtils.isNotBlank(bean.getMobile())){
String mobile = bean.getMobile();
// 只使用第一个手机号
String[] species = mobile.split("\\s+");
if(species.length>1 && species[0].matches("1\\d+") && species[1].matches("1\\d+")){
mobile = species[0];
}
callPhone = callService.addPhoneArea(mobile);
// 未查询到相关数据
if(callPhone == null){
callPhone = new CallPhoneAreaEntity();
}
callPhone.setMobile(bean.getMobile());
......@@ -151,7 +151,7 @@ public class CallController {
callPhone.setMobileNubmer(callPhone.getPhone());
callPhone.setShowPhone(callPhone.getShowPhone());
} else if("MOBILE".equals(callPhone.getType())){
callPhone.setShowPhone(callPhone.getMobile());
callPhone.setPhone(callPhone.getMobileNubmer());
}
......@@ -167,7 +167,7 @@ public class CallController {
/**
* 42.1 开始会话提交接口,在发起人拨打电话时调用
*
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
......@@ -183,25 +183,25 @@ public class CallController {
if (message == null) {// 校验通过
List<CallPhoneBean> phoneList = bean.getPhoneList();
int userCount = phoneList.size()+1;
CallRecordEntity record = new CallRecordEntity();
record.setCallType(bean.getCallType());
record.setCreateBy(bean.getCreateBy());
if(StringUtils.isEmpty(bean.getCreateName())){
String name = callService.getNameByPhoneFromSeat(bean.getCreatePhone());
if(name!=null){
record.setCreateName(name);
}else{
name = callService.getNameByPhone(bean.getCreatePhone());
if(name!=null){
record.setCreateName(name);
}else{
record.setCreateName(bean.getCreatePhone());
}
}
String name = callService.getNameByPhoneFromSeat(bean.getCreatePhone());
if (name != null) {
record.setCreateName(name);
} else {
name = callService.getNameByPhone(bean.getCreatePhone());
if (name != null) {
record.setCreateName(name);
} else {
record.setCreateName(bean.getCreatePhone());
}
}
}else{
record.setCreateName(bean.getCreateName());
record.setCreateName(bean.getCreateName());
}
// record.setCreateName(StringUtils.isEmpty(bean.getCreateName()) ? bean.getCreatePhone() : bean.getCreateName());
record.setEndStatus(bean.getEndStatus());
......@@ -213,7 +213,7 @@ public class CallController {
record.setVersionName(bean.getVersionName());
if("APP".equals(bean.getChannelType()) == false){// 通过系统拨打的电话记录
if(bean.getStartTime() != null){
record.setStartTime(bean.getStartTime());
}
}
......@@ -223,7 +223,7 @@ public class CallController {
record.setPhoneType(Util.getPhoneType(bean.getCreatePhone()));
callService.createCallRecord(record);// 添加主记录
for (CallPhoneBean phone : phoneList) {
phone.setId(IdWorker.getNextId());
......@@ -236,30 +236,30 @@ public class CallController {
phone.setTitle(record.getCreateName());
}
if(StringUtils.isEmpty(phone.getUserId())
if (StringUtils.isEmpty(phone.getUserId())
&& StringUtils.isNotEmpty(phone.getPhone())){// 如果没有匹配用户信息则通过号码匹配用户信息
CallFindPhoneInfoBean phoneBean = new CallFindPhoneInfoBean();
Date current = new Date();// 用于查询通话记录
phoneBean.setEndTime(current);// 查询时间
phoneBean.setStartTime(new Date(current.getTime()-3*60*1000));// 开始时间=查询时间-3分钟
phoneBean.setPhoneNumer(phone.getPhone());
List<CallPhoneInfoListEntity> userList = callService.findUserByCallPhone(phoneBean, true);
if(userList != null && userList.size() == 1){
CallPhoneInfoListEntity callPhoneInfo = userList.get(0);
if(StringUtils.isNotEmpty(callPhoneInfo.getUserId())){
phone.setUserId(callPhoneInfo.getUserId());
phone.setUsername(callPhoneInfo.getName());
}
}
}
}
callService.addCallPhoneList(phoneList);// 添加电话列表
responseBean.setData(record);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -272,7 +272,7 @@ public class CallController {
/**
* 42.2 结束会话提交接口
*
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
......@@ -292,14 +292,14 @@ public class CallController {
record.setEndTime(bean.getEndTime());
if("APP".equals(bean.getChannelType()) == false){// 通过系统拨打的电话记录
if(bean.getEndTime() != null){
record.setEndTime(bean.getEndTime());
}
}
record.setId(bean.getRecordCode());
callService.updateCallRecord(record);// 添加主记录
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
......@@ -311,7 +311,7 @@ public class CallController {
/**
* 42.3 会话列表接口
* V2.0 添加分页
*
*
* @author renmb
* @time 2016年10月6日
* @param requestBean
......@@ -323,26 +323,26 @@ public class CallController {
ResponseBean responseBean = new ResponseBean();
CallRecordListBean bean = requestBean.getObjectBean(CallRecordListBean.class);
String message = callService.validate(bean);
if (message == null) {// 校验通过
Boolean show=false;
UserEntity ue=new UserEntity();
ue.setUsercode(bean.getUserId());
User user = userService.getUserByUserCode(ue);
if(user!=null){
if(StringUtils.isNoneBlank(user.getPhone())){
show=true;
}
}else{
UserSeatEntity seat= userService.getSeatsEntity(bean.getUserId());
if(seat != null && StringUtils.isNoneBlank(seat.getPhone())){
show=true;
}
}
Boolean show = false;
UserEntity ue = new UserEntity();
ue.setUsercode(bean.getUserId());
User user = userService.getUserByUserCode(ue);
if (user != null) {
if (StringUtils.isNoneBlank(user.getPhone())) {
show = true;
}
} else {
UserSeatEntity seat = userService.getSeatsEntity(bean.getUserId());
if (seat != null && StringUtils.isNoneBlank(seat.getPhone())) {
show = true;
}
}
PageEntity<CallRecordListEntity> page = callService.getCallRecordList(bean);
if(page == null){
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
......@@ -351,7 +351,7 @@ public class CallController {
List<CallListEntity> callList = new ArrayList<CallListEntity>();
List<String> huweiNumList = new ArrayList<>();
for(CallRecordListEntity record:callRecordList){
CallListEntity call = new CallListEntity();
call.setCallType(record.getCallType());
call.setEndStatus(record.getEndStatus());
......@@ -361,32 +361,32 @@ public class CallController {
call.setTitle(record.getTitle());
call.setUserCount(record.getUserCount());
call.setFlow(record.getFlow());
if(bean.getUserId().equals(record.getCreateBy())){// 是本人发起的电话,即主叫
call.setFlow("CALLING");
call.setUserId(record.getUserId());
// call.setPhone( callService.GetPhoneById(record.getUserId()));
// call.setPhone( callService.GetPhoneById(record.getUserId()));
call.setUsername(record.getUsername());
// call.setUsername(record.getName());
call.setUserPhoto(Util.getAbsoluteUrl(record.getUserPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
} else {// 他人发起的电话,电话号码显示
call.setFlow("CALLED");
call.setPhone(record.getCreatePhone());
// call.setPhone( callService.GetPhoneById(record.getCreateBy()));
// call.setPhone( callService.GetPhoneById(record.getCreateBy()));
call.setUserId(record.getCreateBy());
call.setUsername(record.getCreateName());
// call.setUsername(record.getName());
call.setUserPhoto(Util.getAbsoluteUrl(record.getCreateByPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
}
if("GROUP".equals(record.getCallType())){// 群组聊天时所有的电话均设置为群发起人电话
call.setPhone(record.getCreatePhone());
List<MemberEntity> memberlist = callService.getMemberList(record.getId());
memberlist.forEach(mEntity->huweiNumList.add(mEntity.getPhone()));
call.setMemberList(memberlist);
} else if(bean.getUserId().equals(record.getCreateBy())){// 非群聊,且是本人发起的电话
// call.setTitle(record.getName());
call.setTitle(record.getUsername());
......@@ -395,38 +395,38 @@ public class CallController {
// if(show){
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
// }
call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
huweiNumList.add(call.getPhone());
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
// call.setDownloadUrl(this.formatedDownloadUrl(record.getDownloadUrl()));
callList.add(call);
}
Map<String, String> map = callService.findPhoneByHuaweiNum(huweiNumList);// 通过华为短号查询座机号
for(CallListEntity record:callList){
if(map != null ){
if(StringUtils.isNotEmpty(map.get(record.getPhone()))){
record.setPhone(Util.formatedWorkPhone(map.get(record.getPhone())));
}
if("GROUP".equals(record.getCallType())){
record.getMemberList().forEach(entity->{
if(StringUtils.isNotEmpty(map.get(entity.getPhone()))){
entity.setPhone(Util.formatedWorkPhone(map.get(entity.getPhone())));
}
entity.setShowPhone(Util.getShowPhone(entity.getPhone()));
});
}
}
if(StringUtils.isNotEmpty(record.getPhone())
&& record.getPhone().startsWith("6")
&& record.getPhone().length() == 4){// 6开头的华为短号不展示
&& record.getPhone().length() == 4) {// 6开头的华为短号不展示
record.setPhone("");
}
record.setShowPhone(Util.getShowPhone(record.getPhone()));
......@@ -437,7 +437,7 @@ public class CallController {
retPage.setList(callList);
retPage.setPageSize(page.getPageSize());
retPage.setTotalPage(page.getTotalPage());
responseBean.setData(retPage);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -449,7 +449,7 @@ public class CallController {
}
/**
* 安科录音接口
*
*
* @author renmb
* @time 2017年3月15日
* @param requestBean
......@@ -467,7 +467,7 @@ public class CallController {
PageEntity<CallRecordListEntity> page = callService.getCallRecordList(bean);
// PageEntity<CallRecordListEntity> page = callService.getCallSoundList(bean);
if(page == null){
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
......@@ -476,7 +476,7 @@ public class CallController {
List<CallListEntity> callList = new ArrayList<CallListEntity>();
List<String> huweiNumList = new ArrayList<>();
for(CallRecordListEntity record:callRecordList){
CallListEntity call = new CallListEntity();
call.setCallType(record.getCallType());
call.setEndStatus(record.getEndStatus());
......@@ -485,15 +485,15 @@ public class CallController {
call.setTitle(record.getTitle());
call.setUserCount(record.getUserCount());
call.setFlow(record.getFlow());
if(bean.getUserId().equals(record.getCreateBy())){// 是本人发起的电话,即主叫
call.setFlow("CALLING");
call.setUserId(record.getUserId());
call.setUsername(record.getUsername());
call.setUserPhoto(Util.getAbsoluteUrl(record.getUserPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
} else {// 他人发起的电话,电话号码显示
call.setFlow("CALLED");
call.setPhone(record.getCreatePhone());
call.setUserId(record.getCreateBy());
......@@ -501,10 +501,10 @@ public class CallController {
call.setUserPhoto(Util.getAbsoluteUrl(record.getCreateByPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
}
if("GROUP".equals(record.getCallType())){// 群组聊天时所有的电话均设置为群发起人电话
call.setPhone(record.getCreatePhone());
} else if(bean.getUserId().equals(record.getCreateBy())){// 非群聊,且是本人发起的电话
call.setTitle(record.getUsername());
}
huweiNumList.add(call.getPhone());
......@@ -515,7 +515,7 @@ public class CallController {
for(CallListEntity record:callList){
if(map != null &&
StringUtils.isNotEmpty(map.get(record.getPhone()))){
record.setPhone(Util.formatedWorkPhone(map.get(record.getPhone())));
}
// if(StringUtils.isNotEmpty(record.getPhone())
......@@ -532,7 +532,7 @@ public class CallController {
retPage.setList(callList);
retPage.setPageSize(page.getPageSize());
retPage.setTotalPage(page.getTotalPage());
responseBean.setData(retPage);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -544,7 +544,7 @@ public class CallController {
}
/**
* 根据电话号码查询电话相关的席位或者用户信息
*
*
* @author renmb
* @time 2017年1月5日
* @param requestBean
......@@ -558,11 +558,11 @@ public class CallController {
CallFindPhoneInfoBean bean = requestBean.getObjectBean(CallFindPhoneInfoBean.class);
String message = callService.validate(bean);
if (message == null) {// 校验通过
Date current = new Date();// 用于查询通话记录
bean.setEndTime(current);// 查询时间
bean.setStartTime(new Date(current.getTime()-3*60*1000));// 开始时间=查询时间-3分钟
List<CallPhoneInfoListEntity> userList = callService.findUserByCallPhone(bean, false);
if(userList == null || userList.size() == 0){
responseBean.setMessage(GConstants.EMPTY);
......@@ -570,11 +570,11 @@ public class CallController {
return responseBean;
}
for(CallPhoneInfoListEntity call:userList){
call.setPhoto(Util.getAbsoluteUrl(call.getPhoto(), GConstants.DEFAULT_SEAT_PHOTO));
}
// callService.addCallRecordByCalled(bean, userList.get(0));
responseBean.setData(userList);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -586,9 +586,9 @@ public class CallController {
}
/**
* 一次性批量提交电话会议记录
*
*
* 42.4 批量提交通话记录接口
*
*
* @author renmb
* @time 2017年2月17日
* @param requestBean
......@@ -601,11 +601,11 @@ public class CallController {
CallLogListBean callLog = requestBean.getObjectBean(CallLogListBean.class);
if (callLog != null && callLog.getCallLogList() != null) {// 校验通过
List<CallRecordBean> callLogList = callLog.getCallLogList();
for (CallRecordBean bean:callLogList) {
List<CallPhoneBean> phoneList = bean.getPhoneList();
int userCount = phoneList.size()+1;
CallRecordEntity record = new CallRecordEntity();
record.setCallType(bean.getCallType());
......@@ -617,7 +617,7 @@ public class CallController {
record.setAppCode(bean.getAppCode());
record.setPlatform(bean.getPlatform());
record.setVersionName(bean.getVersionName());
if(bean.getStartTime() == null){
record.setStartTime(new Date());
} else{
......@@ -629,7 +629,7 @@ public class CallController {
callService.createCallRecord(record);// 添加主记录
for (CallPhoneBean phone : phoneList) {
phone.setId(IdWorker.getNextId());
......@@ -642,7 +642,7 @@ public class CallController {
phone.setTitle(record.getCreateName());
}
}
callService.addCallPhoneList(phoneList);// 添加电话列表
}
responseBean.setMessage(GConstants.OK);
......@@ -653,16 +653,16 @@ public class CallController {
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
/**
* 用于安科同步录音数据
*
*
* @author renmb
* @time 2017年2月28日
* @param requestBean
* @return
*/
@ResponseBody
@ResponseBody
@RequestMapping(value = "/addSoundRecord")
public ResponseBean addSoundRecord(RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
......@@ -670,11 +670,11 @@ public class CallController {
CallSoundRecordBean bean = requestBean.getObjectBean(CallSoundRecordBean.class);
String message = callService.validate(bean);
if (message == null) {// 校验通过
bean.setFocTimeMillis(System.currentTimeMillis());
Date createDate = new Date(bean.getFocTimeMillis());
bean.setCreateDate(createDate);
long focDiffMillis = bean.getCurrentTimeMillis() - bean.getFocTimeMillis()+GConstants.getIntValue("add.diff.millis", 100);
// if(focDiffMillis<1000){
// focDiffMillis = 0;
......@@ -683,92 +683,92 @@ public class CallController {
Date start = new Date(bean.getBeginTime().getTime()-focDiffMillis);
bean.setFocBeginTime(start);
if(bean.getEndTime() != null){
Date end = new Date(bean.getEndTime().getTime()-focDiffMillis);
bean.setFocEndTime(end);
}
//添加通话记录call_record,call_office
CallRecordEntity record = new CallRecordEntity();
record.setCallType("USER");
String name = callService.getNameByPhoneFromSeat(bean.getCallNo());
String id = callService.getIdByPhoneFromSeat(bean.getCallNo());
if(name!=null){
record.setCreateName(name);
record.setCreateBy(id);
}else{
name = callService.getNameByPhone(bean.getCallNo());
if(name!=null){
id = callService.getIdByPhone(bean.getCallNo());
record.setCreateName(name);
record.setCreateBy(id);
}else{
record.setCreateName(bean.getCallNo());
record.setCreateBy("1");
}
}
int userCount = 1;
if(bean.getResult()!=null && !bean.getResult().equals("0")){
record.setEndStatus("SUCCESS");
userCount = 2;
}else{
record.setEndStatus("FAILD");
}
record.setId(IdWorker.getNextId());
record.setChannelType(bean.getChannelType());
record.setAppCode("30011");
record.setPlatform("JAVA");
record.setVersionName("1.0");
record.setDownloadUrl(bean.getDownloadUrl());
record.setDuration(bean.getDuration());
record.setStartTime(bean.getBeginTime());
record.setEndTime(bean.getEndTime());
record.setUserCount(userCount);
record.setCreatePhone(bean.getCallNo());
record.setCreateShowPhone(bean.getCallNo());
record.setPhoneType(Util.getPhoneType(bean.getCallNo()));
//添加通话记录call_record,call_office
CallRecordEntity record = new CallRecordEntity();
record.setCallType("USER");
String name = callService.getNameByPhoneFromSeat(bean.getCallNo());
String id = callService.getIdByPhoneFromSeat(bean.getCallNo());
if (name != null) {
record.setCreateName(name);
record.setCreateBy(id);
} else {
name = callService.getNameByPhone(bean.getCallNo());
if (name != null) {
id = callService.getIdByPhone(bean.getCallNo());
record.setCreateName(name);
record.setCreateBy(id);
} else {
record.setCreateName(bean.getCallNo());
record.setCreateBy("1");
}
}
int userCount = 1;
if (bean.getResult() != null && !bean.getResult().equals("0")) {
record.setEndStatus("SUCCESS");
userCount = 2;
} else {
record.setEndStatus("FAILD");
}
record.setId(IdWorker.getNextId());
record.setChannelType(bean.getChannelType());
record.setAppCode("30011");
record.setPlatform("JAVA");
record.setVersionName("1.0");
record.setDownloadUrl(bean.getDownloadUrl());
record.setDuration(bean.getDuration());
record.setStartTime(bean.getBeginTime());
record.setEndTime(bean.getEndTime());
record.setUserCount(userCount);
record.setCreatePhone(bean.getCallNo());
record.setCreateShowPhone(bean.getCallNo());
record.setPhoneType(Util.getPhoneType(bean.getCallNo()));
// callService.createCallRecord(record);// 添加主记录
//添加被叫记录
List<CallPhoneBean> phoneList = new ArrayList<CallPhoneBean>();
CallPhoneBean phone = new CallPhoneBean();
//添加被叫记录
List<CallPhoneBean> phoneList = new ArrayList<CallPhoneBean>();
CallPhoneBean phone = new CallPhoneBean();
phone.setId(IdWorker.getNextId());
phone.setPhoneType(Util.getPhoneType(phone.getPhone()));
phone.setRecordId(record.getId());
phone.setDownloadUrl(bean.getDownloadUrl());
phone.setCenterRecordsId(bean.getId());
if ("GROUP".equals(record.getCallType())) {// 群组聊天的时候记录标题
phone.setId(IdWorker.getNextId());
phone.setPhoneType(Util.getPhoneType(phone.getPhone()));
phone.setRecordId(record.getId());
phone.setDownloadUrl(bean.getDownloadUrl());
phone.setCenterRecordsId(bean.getId());
if ("GROUP".equals(record.getCallType())) {// 群组聊天的时候记录标题
phone.setTitle("由" + record.getCreateName() + "发起电话会议");
} else {
phone.setTitle("由" + record.getCreateName() + "发起电话会议");
} 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());
if(acceptName!=null){
phone.setUserId(acceptId);
phone.setUsername(acceptName);
}else{
acceptName = callService.getNameByPhone(bean.getAcceptNo());
if(acceptName!=null){
acceptId = callService.getIdByPhone(bean.getAcceptNo());
phone.setUserId(acceptId);
phone.setUsername(acceptName);
}else{
phone.setUserId("1");
phone.setUsername(bean.getAcceptNo());
}
}
phone.setPhone(bean.getAcceptNo());
phone.setShowPhone(bean.getAcceptNo());
phone.setPhoneType(Util.getPhoneType(bean.getAcceptNo()));
phone.setFlow("CALLED");
phoneList.add(phone);
}
phone.setPhone(bean.getAcceptNo());
phone.setShowPhone(bean.getAcceptNo());
phone.setPhoneType(Util.getPhoneType(bean.getAcceptNo()));
phone.setFlow("CALLED");
phoneList.add(phone);
// callService.addCallPhoneList(phoneList);// 添加电话列表
bean.setCallRecordId(record.getId());
bean.setCallRecordId(record.getId());
if(callService.addSoundRecord(bean,phoneList,record)){
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
return responseBean;
......
......@@ -17,47 +17,47 @@ import com.ejweb.modules.call.entity.MemberEntity;
public interface CallDao extends BaseDao {
public Integer createCallRecord(CallRecordEntity entity);
public Integer updateCallRecord(CallRecordEntity entity);
public Integer addCallPhoneList(List<CallPhoneBean> phoneList);
public List<CallRecordListEntity> getCallRecordList(CallRecordListBean bean);
public List<CallRecordListEntity> getCallSoundList(CallRecordListBean bean);
public List<CallPhoneInfoListEntity> findUserByCallPhone(CallFindPhoneInfoBean bean);
public List<CallPhoneInfoListEntity> findUserByCallRecord(CallFindPhoneInfoBean bean);
public List<CallPhoneInfoListEntity> findSeatListByCallPhone(CallFindPhoneInfoBean bean);
public CallPhoneInfoListEntity findUserInfoByNumOrId(CallFindPhoneInfoBean bean);
public CallPhoneAreaEntity getPhoneAreaByAreaCode(CallPhoneAreaEntity areaCode);
public CallPhoneAreaEntity getPhoneAreaByMobile(CallPhoneAreaEntity mobile);
public Integer addPhoneAreaRecord(CallPhoneAreaEntity entity);
public Integer addPhoneAreaCode(CallPhoneAreaEntity entity);
public Integer addSoundRecord(CallSoundRecordBean entity);
public List<CallPhoneInfoListEntity> findPhneListByHuaweiNum(HuaweiNumListEntity entity);
public String GetPhoneById(String id);
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.*;
public class CallService extends BaseService<CallDao> {
public void createCallRecord(CallRecordEntity entity){
dao.createCallRecord(entity);
}
public void updateCallRecord(CallRecordEntity entity){
dao.updateCallRecord(entity);
}
public Integer addCallPhoneList(List<CallPhoneBean> phoneList){
return dao.addCallPhoneList(phoneList);
}
/**
* 获取通话记录列表
*
*
* @author renmb
* @time 2016年12月6日
* @param bean
* @return
*/
public PageEntity<CallRecordListEntity> getCallRecordList(CallRecordListBean bean){
PageInfo<CallRecordListEntity> pageInfo = null;
Date current = new Date();
Date startTime = DateUtils.addDays(current, -3);
......@@ -57,9 +57,9 @@ public class CallService extends BaseService<CallDao> {
// 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallRecordList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
return null;
}
List<CallRecordListEntity> list = pageInfo.getList();
......@@ -81,7 +81,7 @@ public class CallService extends BaseService<CallDao> {
}
}
if(templist.size()>0){
list.removeAll(templist);
list.removeAll(templist);
pageInfo.setSize(list.size());
pageInfo.setTotal(list.size());
}
......@@ -95,55 +95,55 @@ public class CallService extends BaseService<CallDao> {
return page;
}
public PageEntity<CallRecordListEntity> getCallSoundList(CallRecordListBean bean){
PageInfo<CallRecordListEntity> pageInfo = null;
Date current = new Date();
Date startTime = DateUtils.addDays(current, -6);
bean.setStartTime(DateFormatUtils.format(startTime, "yyyy-MM-dd 00:00:00"));
bean.setEndTime(DateFormatUtils.format(current, "yyyy-MM-dd 23:59:59"));
// 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallSoundList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
return null;
}
List<CallRecordListEntity> list = pageInfo.getList();
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL
return null;
}
PageEntity<CallRecordListEntity> page = new PageEntity<CallRecordListEntity>();
page.setPageNo(pageInfo.getPageNum());
page.setPageSize(pageInfo.getPageSize());
page.setCount(pageInfo.getTotal());
page.setTotalPage(pageInfo.getPages());
page.setList(pageInfo.getList());
return page;
}
PageInfo<CallRecordListEntity> pageInfo = null;
Date current = new Date();
Date startTime = DateUtils.addDays(current, -6);
bean.setStartTime(DateFormatUtils.format(startTime, "yyyy-MM-dd 00:00:00"));
bean.setEndTime(DateFormatUtils.format(current, "yyyy-MM-dd 23:59:59"));
// 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallSoundList(bean));
if (pageInfo.getPages() < bean.getPageNo()) {// 页码大于总页数,则返回NULL
return null;
}
List<CallRecordListEntity> list = pageInfo.getList();
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL
return null;
}
PageEntity<CallRecordListEntity> page = new PageEntity<CallRecordListEntity>();
page.setPageNo(pageInfo.getPageNum());
page.setPageSize(pageInfo.getPageSize());
page.setCount(pageInfo.getTotal());
page.setTotalPage(pageInfo.getPages());
page.setList(pageInfo.getList());
return page;
}
/**
* 根据电话号码查询,通话来电号码查询用户信息
*
*
* 1、席位优先
* 2、查询最近通话记录
* 3、查询用户表,如果有多个用户就展示用户手机号或者座机号
*
*
* @author renmb
* @time 2017年1月5日
* @param bean
* @return
*/
public List<CallPhoneInfoListEntity> findUserByCallPhone(CallFindPhoneInfoBean bean, boolean isOnlySearch){
bean.setMobileNubmer0("0"+bean.getPhoneNumer());
bean.setMobileNubmer00("00"+bean.getPhoneNumer());
List<CallPhoneInfoListEntity> callList = dao.findUserByCallRecord(bean);
if(callList == null || callList.size() == 0){// 没有匹配到席位信息
List<CallPhoneInfoListEntity> seatList = dao.findSeatListByCallPhone(bean);
if(seatList == null || seatList.size() == 0){// 没有匹配到通话记录信息
List<CallPhoneInfoListEntity> userList = dao.findUserByCallPhone(bean);
if(userList == null || userList.size() == 0 || userList.size() > 1){// 没有匹配到用户信息,或者匹配个数大于1
CallPhoneInfoListEntity entity = new CallPhoneInfoListEntity();
......@@ -155,21 +155,21 @@ public class CallService extends BaseService<CallDao> {
phoneList.add(entity);
return phoneList;
} else{// 有用户信息直接返回
return userList;
}
} else {// 有通话记录信息,直接返回
return seatList;
}
} else{// 有席位信息直接返回
return callList;
}
}
/**
* 被叫方添加通话记录
*
*
* @author renmb
* @time 2017年3月17日
* @param bean
......@@ -226,7 +226,7 @@ public class CallService extends BaseService<CallDao> {
// }
/**
* 综合查询手机号的归属地信息
*
*
* @author renmb
* @time 2017年1月22日
* @param mobile
......@@ -235,7 +235,7 @@ public class CallService extends BaseService<CallDao> {
@Transactional(readOnly = false)
public CallPhoneAreaEntity addPhoneArea(String mobile){
if(StringUtils.isEmpty(mobile) || mobile.length()<7){
return null;
}
String src = new String(mobile);
......@@ -256,17 +256,17 @@ public class CallService extends BaseService<CallDao> {
phoneArea = this.getCallPhoneAreaBy360(mobile);
if(phoneArea != null){
if(StringUtils.isNotEmpty(phoneArea.getPremobile())){// 手机类型进行缓存数据库
phoneArea.setId(IdWorker.getNextId());
phoneArea.setUpdateDate(new Date());
if(phoneArea.getMobile().length()>=7){
phoneArea.setAreaCode(phoneArea.getMobile().substring(0, 7));
dao.addPhoneAreaCode(phoneArea);
}
dao.addPhoneAreaRecord(phoneArea);
} else{// 非手机号,按座机号处理
phoneArea.setShowPhone(src);
phoneArea.setPhone(Util.formatedWorkPhone(src));
phoneArea.setType("PHONE");
......@@ -296,14 +296,14 @@ public class CallService extends BaseService<CallDao> {
} else if(mobile.startsWith("0") == false){
PhoneAreaEntity area = PhoneAreaUtil.get360PhoneArea(mobile);
if(area == null){
area = PhoneAreaUtil.get360PhoneArea(mobile);
}
if(area != null && StringUtils.isNotBlank(area.getProvince())){// 能够查到省份信息
if(area.getProvince().contains("北京")
|| (StringUtils.isNotBlank(area.getCity()) && area.getCity().contains("北京"))){// 北京前面加拨一个0
callPhone.setType("MOBILE");
callPhone.setMobileNubmer("0"+mobile);// 加拨1个0
callPhone.setPremobile("0");
......@@ -312,7 +312,7 @@ public class CallService extends BaseService<CallDao> {
callPhone.setMobileSp(StringUtils.isBlank(area.getSp()) ? "" : area.getSp());
return callPhone;
} else {// 非北京号码加拨两个0
callPhone.setType("MOBILE");
callPhone.setMobileNubmer("00"+mobile);// 加拨2个0
callPhone.setPremobile("00");
......@@ -332,32 +332,32 @@ public class CallService extends BaseService<CallDao> {
}
/**
* 添加安科同步过来的数据
*
*
* @author renmb
* @time 2017年2月28日
* @param entity
* @return
*/
public boolean addSoundRecord(CallSoundRecordBean entity,List<CallPhoneBean> phoneList,CallRecordEntity record){
dao.createCallRecord(record);
dao.addCallPhoneList(phoneList);
dao.createCallRecord(record);
dao.addCallPhoneList(phoneList);
Integer count = dao.addSoundRecord(entity);
return count != null && count > 0;
}
public Map<String, String> findPhoneByHuaweiNum(List<String> huweiNumList){
HuaweiNumListEntity entity = new HuaweiNumListEntity();
entity.setHuweiNumList(huweiNumList);
List<CallPhoneInfoListEntity> list = dao.findPhneListByHuaweiNum(entity);
if(list == null || list.size() == 0){
return null;
}
Map<String, String> map = new HashMap<String, String>();
for(CallPhoneInfoListEntity p:list){
map.put(p.getHuaweiNum(), p.getPhone());
}
return map;
......@@ -367,28 +367,27 @@ public class CallService extends BaseService<CallDao> {
// }
public List<MemberEntity> getMemberList(String id) {
return dao.getMemberList( id);
}
public String getNameByPhone(String createPhone) {
// TODO Auto-generated method stub
return dao.getNameByPhone(createPhone);
}
public String getNameByPhoneFromSeat(String createPhone) {
// TODO Auto-generated method stub
return dao.getNameByPhoneFromSeat(createPhone);
}
public String getIdByPhoneFromSeat(String callNo) {
// TODO Auto-generated method stub
return dao.getIdByPhoneFromSeat(callNo);
}
public String getIdByPhone(String callNo) {
// TODO Auto-generated method stub
return dao.getIdByPhone(callNo);
}
public String getNameByPhone(String createPhone) {
// TODO Auto-generated method stub
return dao.getNameByPhone(createPhone);
}
public String getNameByPhoneFromSeat(String createPhone) {
// TODO Auto-generated method stub
return dao.getNameByPhoneFromSeat(createPhone);
}
public String getIdByPhoneFromSeat(String callNo) {
// TODO Auto-generated method stub
return dao.getIdByPhoneFromSeat(callNo);
}
public String getIdByPhone(String callNo) {
// TODO Auto-generated method stub
return dao.getIdByPhone(callNo);
}
}
......@@ -640,7 +640,7 @@ public class HuaweiUCSyncService {
//更新席位账号,UC状态为关闭
SeatEntity seatEntity = huaweiUCSyncDao.getSeatById(accountId);
if(seatEntity != null){
return updateSeatAccountInfo(seatEntity, personInfo, "1", ucOpen);
}
return false;
......@@ -671,7 +671,7 @@ public class HuaweiUCSyncService {
accountUpdateBean.setName(StringUtils.isBlank(userProfileEntity.getName()) ? "未填写" : userProfileEntity.getName());
// accountUpdateBean.setSex(userProfileEntity.getSex().toString().equals("M") ? "0" : "1");
if(StringUtils.isNotEmpty(userProfileEntity.getSex())){
accountUpdateBean.setSex("M".equals(userProfileEntity.getSex()) ? "0" : "1");
}
// accountUpdateBean.setHomePhone(homePhone);
......@@ -924,20 +924,20 @@ public class HuaweiUCSyncService {
}
/**
//是否忽略系统最大的sip号码,忽略的话只根据配置进行处理,需要循环得到不存在的号码
if (ignoreMaxSipNum) {
while (true) {
Boolean checkSipResult = checkSipExists(maxSipNum);
if (checkSipResult == null) {
return false;
}
if (checkSipResult) {
maxSipNum++;
}
if (!checkSipResult) {
break;
}
}
}
if (ignoreMaxSipNum) {
while (true) {
Boolean checkSipResult = checkSipExists(maxSipNum);
if (checkSipResult == null) {
return false;
}
if (checkSipResult) {
maxSipNum++;
}
if (!checkSipResult) {
break;
}
}
}
*
*/
......@@ -1077,10 +1077,10 @@ public class HuaweiUCSyncService {
accountInfo.getAccount().setUserState("0");
accountInfo.getAccount().setDepartmentId(departmentId);
if(StringUtils.isNotEmpty(userProfileEntity.getSex())){
accountInfo.getAccount().setSex("M".equals(userProfileEntity.getSex()) ? "0" : "1");
}
accountInfo.getAccount().setCellPhone(Util.formatedMobile(userProfileEntity.getMobile()));
accountInfo.getAccount().setWebsite(userProfileEntity.getName());
accountInfo.getAccount().setOfficePhone(Util.formatedWorkPhone(userProfileEntity.getPhone()));
......@@ -1417,7 +1417,7 @@ public class HuaweiUCSyncService {
* @return
*/
public boolean deleteUCAccount(String accountId) {
try {
RestRequestMessage restRequestMessage = new RestRequestMessage();
restRequestMessage.setHttpMethod("DELETE");
......@@ -1425,7 +1425,7 @@ public class HuaweiUCSyncService {
params.put("userId", userId);
params.put("accountId", accountId);
restRequestMessage.setParameters(params);
String res = restUtils.sendMessage(restRequestMessage, accountRestUrl);
if (StringUtils.isNotBlank(res)) {
HuaweiQueryResponseEntity queryResponseEntity = JSONObject.parseObject(res, HuaweiQueryResponseEntity.class);
......
/**
*
*
*/
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.JSONObject;
import com.ejweb.core.base.BaseService;
......@@ -26,57 +17,68 @@ import com.ejweb.modules.message.bean.ShortMsgUserListBean;
import com.ejweb.modules.message.dao.ShortMessageDao;
import com.ejweb.modules.message.entity.ShortMsgUserListEntity;
import com.ejweb.modules.message.entity.SmsRecordEntity;
import com.ejweb.modules.notice.bean.NewsNoticeListBean;
import com.github.pagehelper.PageHelper;
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
* @version 1.0
* @time 2016年9月23日
* @team suzhou
* @time 2016年9月23日
*/
@Service
@Transactional(readOnly = true)
public class ShortMessageService extends BaseService<ShortMessageDao>{
@Transactional(readOnly = true, rollbackFor = Exception.class)
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
* @author renmb
* @time 2016年9月25日
*/
@Transactional(readOnly = false)
public boolean addMessageToPhone(ShortMsgBean bean){
@Transactional(rollbackFor = Exception.class)
public boolean addMessageToPhone(ShortMsgBean bean) {
try {
String phone = bean.getPhone();
if(StringUtils.isEmpty(phone))
if (StringUtils.isEmpty(phone)) {
return false;
}
StringBuilder builder = new StringBuilder();
String[] phones = phone.split(",|,");
for (int i=0,len = phones.length;i<len;i++) {
if(i > 0){
for (int i = 0, len = phones.length; i < len; i++) {
if (i > 0) {
builder.append(",");
}
builder.append(phones[i].replaceAll("^0+", ""));
}
phone = builder.toString();//phone.replaceAll("^0+", "");
if(StringUtils.isEmpty(phone))
phone = builder.toString();
if (StringUtils.isEmpty(phone)) {
return false;
}
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);
if(entity != null && entity.isSuccess()){
FetchEntity entity = fetcher.post(GConstants.JDAIR_SMS_API + "&mobile=" + phone + "&msg=" + URLEncoder.encode(bean.getMessage(), "UTF-8"), null);
if (entity != null && entity.isSuccess()) {
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");
if ("1000".equals(resultCode)) {// 判断 调用接口是否成功
// 判断 调用接口是否成功
if ("1000".equals(resultCode)) {
SmsRecordEntity record = new SmsRecordEntity();
record.setClientip(bean.getClientip());
record.setCreateTime(new Date());
......@@ -87,13 +89,13 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
record.setUserId(bean.getUserId());
record.setGroupId(bean.getGroupId());
this.addSmsRecords(record);
List<ShortMsgUserListBean> userList = bean.getUserList();
if(userList != null && userList.size()>0){
if (userList != null && userList.size() > 0) {
Date createDate = new Date();
List<ShortMsgUserListEntity> smsUserList = new ArrayList<ShortMsgUserListEntity>();
for(ShortMsgUserListBean user:userList){
for (ShortMsgUserListBean user : userList) {
ShortMsgUserListEntity smsUser = new ShortMsgUserListEntity();
smsUser.setId(IdWorker.getNextNumId());
smsUser.setCreateDate(createDate);
......@@ -102,12 +104,14 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
smsUser.setUserId(user.getUserId());
smsUser.setUserMobile(user.getUserMobile());
smsUser.setUserType(user.getUserType());
smsUserList.add(smsUser);
}
this.addUser2SmsRecords(smsUserList);
}
return true;
} else {
logger.error("短信发送错误:" + result.toJSONString());
}
}
}
......@@ -117,47 +121,54 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
}
return false;
}
/**
* 添加发送短信记录
*
* @author renmb
* @time 2016年10月4日
*
* @param entity
* @return
* @author renmb
* @time 2016年10月4日
*/
@Transactional(readOnly = false)
public Integer addSmsRecords(SmsRecordEntity entity){
@Transactional(rollbackFor = Exception.class)
public Integer addSmsRecords(SmsRecordEntity entity) {
return dao.addSmsRecords(entity);
}
@Transactional(readOnly = false)
public Integer addUser2SmsRecords(List<ShortMsgUserListEntity> smsUserList){
if(smsUserList != null && smsUserList.size()>0)
@Transactional(rollbackFor = Exception.class)
public Integer addUser2SmsRecords(List<ShortMsgUserListEntity> smsUserList) {
if (smsUserList != null && smsUserList.size() > 0) {
return dao.addUser2SmsRecords(smsUserList);
}
return 0;
}
public List<ShortMsgUserListEntity> findSmsUserList(ShortMsgListBean bean){
public List<ShortMsgUserListEntity> findSmsUserList(ShortMsgListBean bean) {
return dao.findSmsUserList(bean);
}
/**
* 查询用户短信列表
*
* @author renmb
* @time 2017年3月7日
*
* @param bean
* @return
* @author renmb
* @time 2017年3月7日
*/
public PageEntity<SmsRecordEntity> findUserSmsMesaageList(ShortMsgListBean bean){
public PageEntity<SmsRecordEntity> findUserSmsMesaageList(ShortMsgListBean bean) {
PageInfo<SmsRecordEntity> pageInfo = null;
// 必须紧贴dao的查询方法
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<SmsRecordEntity>(dao.findUserSmsMesaageList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
// 页码大于总页数,则返回NULL
if (pageInfo.getPages() < bean.getPageNo()) {
return null;
}
List<SmsRecordEntity> list = pageInfo.getList();
if (list == null || list.size() == 0) {// 如果没有数据则返回NULL
// 如果没有数据则返回NULL
if (list == null || list.size() == 0) {
return null;
}
PageEntity<SmsRecordEntity> page = new PageEntity<SmsRecordEntity>();
......@@ -168,18 +179,4 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
page.setList(pageInfo.getList());
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{
List<FlightDynamicsEntity> getDailyList(FlightDynamicsTotalBean bean);
public Integer updateTotalFlight(FlightTotalEntity bean);
public FlightTotalEntity getTotalFlight(FlightTotalEntity bean);
public FlightTotalEntity getLastTotalFlight();
List<FlightDynamicsDetailEntity> getCancelList(FlightDynamicsDetailBean bean);
......
......@@ -188,12 +188,7 @@ public class FlightDynamicsService extends BaseService<FlightDynamicsDao> {
} else {
LOG.debug("没有数据");
}
int flightTotal = this.getTotalFlight(bean.getFltDate());
if(flightTotal<1){
flightTotal = 72;
}
int flightTotal = getLastTotalFlight();
totalEntity.setPlanFlightTotal(flightTotal);
totalEntity.setPlaneDailyUsage(dao.getPlaneDailyUsage(bean.getFltDate(),flightTotal));
......@@ -220,22 +215,17 @@ public class FlightDynamicsService extends BaseService<FlightDynamicsDao> {
return dao.updateTotalFlight(bean);
}
/**
* 获取某一天的飞机总量
*
* @author renmb
* @time 2017年2月8日
* @param flightDate
* 获取最近修改的飞机总量
*
* @return
*/
public int getTotalFlight(String flightDate){
FlightTotalEntity bean = new FlightTotalEntity();
bean.setFlightDate(flightDate);
FlightTotalEntity total = dao.getTotalFlight(bean);
if(total == null)
public int getLastTotalFlight() {
FlightTotalEntity total = dao.getLastTotalFlight();
if (total == null) {
return 0;
}
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