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})
......
...@@ -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);
} }
...@@ -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