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
......
......@@ -251,11 +251,11 @@ WHERE c.subtime BETWEEN CONVERT(CONCAT(DATE_ADD(#{fltDate},INTERVAL -1 DAY), " 2
update_date=VALUES(update_date)
</insert>
<!-- 获取飞机总量 -->
<select id="getTotalFlight" resultType="com.ejweb.modules.statistics.entity.FlightTotalEntity">
<!-- 获取最近时间飞机总量 -->
<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})
......
......@@ -190,13 +190,13 @@ public class CallController {
record.setCreateBy(bean.getCreateBy());
if(StringUtils.isEmpty(bean.getCreateName())){
String name = callService.getNameByPhoneFromSeat(bean.getCreatePhone());
if(name!=null){
if (name != null) {
record.setCreateName(name);
}else{
} else {
name = callService.getNameByPhone(bean.getCreatePhone());
if(name!=null){
if (name != null) {
record.setCreateName(name);
}else{
} else {
record.setCreateName(bean.getCreatePhone());
}
}
......@@ -236,7 +236,7 @@ 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();
......@@ -326,18 +326,18 @@ public class CallController {
String message = callService.validate(bean);
if (message == null) {// 校验通过
Boolean show=false;
UserEntity ue=new UserEntity();
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;
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;
} else {
UserSeatEntity seat = userService.getSeatsEntity(bean.getUserId());
if (seat != null && StringUtils.isNoneBlank(seat.getPhone())) {
show = true;
}
}
PageEntity<CallRecordListEntity> page = callService.getCallRecordList(bean);
......@@ -425,7 +425,7 @@ public class CallController {
}
if(StringUtils.isNotEmpty(record.getPhone())
&& record.getPhone().startsWith("6")
&& record.getPhone().length() == 4){// 6开头的华为短号不展示
&& record.getPhone().length() == 4) {// 6开头的华为短号不展示
record.setPhone("");
}
......@@ -692,25 +692,25 @@ public class CallController {
record.setCallType("USER");
String name = callService.getNameByPhoneFromSeat(bean.getCallNo());
String id = callService.getIdByPhoneFromSeat(bean.getCallNo());
if(name!=null){
if (name != null) {
record.setCreateName(name);
record.setCreateBy(id);
}else{
} else {
name = callService.getNameByPhone(bean.getCallNo());
if(name!=null){
if (name != null) {
id = callService.getIdByPhone(bean.getCallNo());
record.setCreateName(name);
record.setCreateBy(id);
}else{
} else {
record.setCreateName(bean.getCallNo());
record.setCreateBy("1");
}
}
int userCount = 1;
if(bean.getResult()!=null && !bean.getResult().equals("0")){
if (bean.getResult() != null && !bean.getResult().equals("0")) {
record.setEndStatus("SUCCESS");
userCount = 2;
}else{
} else {
record.setEndStatus("FAILD");
}
record.setId(IdWorker.getNextId());
......@@ -745,16 +745,16 @@ public class CallController {
}
String acceptName = callService.getNameByPhoneFromSeat(bean.getAcceptNo());
String acceptId = callService.getIdByPhoneFromSeat(bean.getAcceptNo());
if(acceptName!=null){
if (acceptName != null) {
phone.setUserId(acceptId);
phone.setUsername(acceptName);
}else{
} else {
acceptName = callService.getNameByPhone(bean.getAcceptNo());
if(acceptName!=null){
if (acceptName != null) {
acceptId = callService.getIdByPhone(bean.getAcceptNo());
phone.setUserId(acceptId);
phone.setUsername(acceptName);
}else{
} else {
phone.setUserId("1");
phone.setUsername(bean.getAcceptNo());
}
......
......@@ -105,7 +105,7 @@ public class CallService extends BaseService<CallDao> {
PageHelper.startPage(bean.getPageNo(), bean.getPageSize());
pageInfo = new PageInfo<CallRecordListEntity>(dao.getCallSoundList(bean));
if(pageInfo.getPages()<bean.getPageNo()){// 页码大于总页数,则返回NULL
if (pageInfo.getPages() < bean.getPageNo()) {// 页码大于总页数,则返回NULL
return null;
}
......@@ -367,7 +367,6 @@ public class CallService extends BaseService<CallDao> {
// }
public List<MemberEntity> getMemberList(String id) {
return dao.getMemberList( id);
}
......
......@@ -3,15 +3,6 @@
*/
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
* @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);
/**
* 向指定的手机发送短信信息
*
* @return
* @author renmb
* @time 2016年9月25日
* @param phone
* @param message
* @return
*/
@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());
......@@ -89,10 +91,10 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
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());
......@@ -108,6 +110,8 @@ public class ShortMessageService extends BaseService<ShortMessageDao>{
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);
// }
}
......@@ -21,7 +21,7 @@ public interface FlightDynamicsDao extends BaseDao{
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