Commit 83db87d0 by java-李谡

修改飞机统计

parent 0d005762
# Created by .ignore support plugin (hsz.mobi)
/im.message.log
/.idea/
/.classpath
/out/
/.project
/.settings/
...@@ -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
......
...@@ -250,12 +250,12 @@ WHERE c.subtime BETWEEN CONVERT(CONCAT(DATE_ADD(#{fltDate},INTERVAL -1 DAY), " 2 ...@@ -250,12 +250,12 @@ WHERE c.subtime BETWEEN CONVERT(CONCAT(DATE_ADD(#{fltDate},INTERVAL -1 DAY), " 2
update_by=VALUES(update_by), update_by=VALUES(update_by),
update_date=VALUES(update_date) update_date=VALUES(update_date)
</insert> </insert>
<!-- 获取飞机总量 --> <!-- 获取最近时间飞机总量 -->
<select id="getTotalFlight" resultType="com.ejweb.modules.statistics.entity.FlightTotalEntity"> <select id="getLastTotalFlight" resultType="com.ejweb.modules.statistics.entity.FlightTotalEntity">
SELECT * SELECT *
FROM foc_flight_total FROM foc_flight_total
WHERE flight_date=#{flightDate} order by flight_date desc limit 1;
</select> </select>
<select id="getPlaneDailyUsage" resultType="Double"> <select id="getPlaneDailyUsage" resultType="Double">
SELECT SUM(unix_timestamp(ata_chn) - unix_timestamp(atd_chn))/(60*60*#{flightTotal}) SELECT SUM(unix_timestamp(ata_chn) - unix_timestamp(atd_chn))/(60*60*#{flightTotal})
......
...@@ -3,60 +3,38 @@ ...@@ -3,60 +3,38 @@
*/ */
package com.ejweb.core.conf; package com.ejweb.core.conf;
import java.io.File; import com.ejweb.core.security.DES3Utils;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;
import com.ejweb.core.security.DES3Utils; import java.util.Enumeration;
import com.jdair.util.security.DESPlus; import java.util.Properties;
/** /**
*
* @team IT Team
* @author renmb * @author renmb
* @version 1.0 * @version 1.0
* @time 2016年11月2日 * @team IT Team
* @time 2016年11月2日
*/ */
public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer { public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
// private static final String key = "";
private static final String CONF_DESC_KEY = "2012PinganVitality075522628888ForShenZhenBelter075561869839"; private static final String CONF_DESC_KEY = "2012PinganVitality075522628888ForShenZhenBelter075561869839";
private Map<String, Boolean> keys = new HashMap<String, Boolean>();
@Override @Override
protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props) protected void processProperties(ConfigurableListableBeanFactory beanFactory, Properties props)
throws BeansException { throws BeansException {
// TODO Auto-generated method stub // TODO Auto-generated method stub
try { try {
Enumeration<?> enu = props.propertyNames(); Enumeration<?> enu = props.propertyNames();
while (enu.hasMoreElements()) { while (enu.hasMoreElements()) {
try { try {
String key = (String) enu.nextElement(); String key = (String) enu.nextElement();
String val = (String) props.get(key); String val = (String) props.get(key);
String decorded = DES3Utils.decrypt(val, CONF_DESC_KEY); String decorded = DES3Utils.decrypt(val, CONF_DESC_KEY);
if(decorded != null){ if (decorded != null) {
props.put(key, decorded); props.put(key, decorded);
} }
// if("is.devmode".equals(key) == false && keys.get(key) == null){// 还未处理
// keys.put(key, true);
//
// String val = (String) props.get(key);
// String decorded = DES3Utils.decrypt(val, CONF_DESC_KEY);
// if(decorded != null){
// props.put(key, decorded);
// }
// }
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
...@@ -66,191 +44,41 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo ...@@ -66,191 +44,41 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
} }
super.processProperties(beanFactory, props); super.processProperties(beanFactory, props);
} }
public static String getValue(Properties props,String key) {
if(key == null) public static String getValue(Properties props, String key) {
if (key == null) {
return null; return null;
}
if (props.containsKey(key)) { if (props.containsKey(key)) {
return props.getProperty(key); return props.getProperty(key);
} }
return System.getProperty(key); return System.getProperty(key);
} }
public static String getValue(Properties props,String key, String want) {
public static String getValue(Properties props, String key, String want) {
String val = getValue(props, key); String val = getValue(props, key);
if(val == null) if (val == null) {
return want; return want;
}
return val; return val;
} }
public static boolean getBoolean(Properties props, String key, boolean want) { public static boolean getBoolean(Properties props, String key, boolean want) {
try { try {
String val = props.getProperty(key); String val = props.getProperty(key);
if(val == null || val.length() == 0) if (val == null || val.length() == 0) {
return want; return want;
}
return Boolean.parseBoolean(val); return Boolean.parseBoolean(val);
} catch (Exception e) { } catch (Exception e) {
// TODO: handle exception // TODO: handle exception
} }
return want; return want;
} }
/**
* 解密
* @param encode
* @return
*/
// public static String decrypt(String encode) {
// if (StringUtils.isBlank(encode)) {
// return null;
// }
// try {
//// DESPlus des = new DESPlus(CONF_DESC_KEY);
// return DES3Utils.decrypt(encode, CONF_DESC_KEY);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
// }
// public static void main(String[] args) throws IOException {
// InputStream in = new FileInputStream(new File("W:\\佰邦达科技\\FOC智能管控系统\\线上配置\\20170105\\api.conf\\3DES加密版本\\api.ejweb.properties"));
//
// Properties props = new Properties();
// props.load(in);
//
//
// InputStream in2 = new FileInputStream(new File("W:\\佰邦达科技\\FOC智能管控系统\\线上配置\\20170105\\api.conf\\ejweb.properties"));
//
// Properties props2 = new Properties();
// props2.load(in2);
//
// List<String> keys = new ArrayList<>();
// keys.add("file.upload.dir");
// keys.add("file.prefix.url");
// keys.add("seat.default.photo");
// keys.add("jdair.api.base.url");
// keys.add("jdair.api.base.param");
// keys.add("huawei.uc.gwIp");
// keys.add("foc.sound.recording.url");
// keys.add("foc.sound.records.proxy");
// keys.add("jdair.api.sms.url");
//
// for(String key:keys){
//
// if(props2.get(key) != null){
// String val = (String) props2.get(key);
// System.out.println("正常: "+key+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// }
// }
// InputStream in2 = new FileInputStream(new File("W:\\佰邦达科技\\FOC智能管控系统\\线上配置\\20170105\\api.conf\\jdbc.properties"));
//
// Properties props2 = new Properties();
// props2.load(in2);
//
// List<String> keys = new ArrayList<>();
// keys.add("jdbc.url");
// keys.add("jdbc.username");
// keys.add("jdbc.password");
//
// for(String key:keys){
//
// if(props2.get(key) != null){
// String val = (String) props2.get(key);
// System.out.println("正常: "+key+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// }
// }
// Enumeration<?> enu = props2.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props2.get(key);
// if(props.get(key) == null){
// System.out.println("新增: "+key+"="+val);
// }
// }
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// if(props2.get(key) == null){
//
// }
//// if(props2.get(key) == null){
//
// String decrypted = DES3Utils.decrypt(val, CONF_DESC_KEY);
// if(decrypted == null){
//// System.out.println("新增: "+key+"="+val);
// } else{
// val = decrypted;
//// System.out.println("新增: "+key+"="+decrypted);
// }
// if(props2.get(key).equals(val) ==false){
//
// System.out.println("新增: "+key+"="+val);
// }
//// }
// }
// DES解密版本
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// try {
// DESPlus des = new DESPlus(CONF_DESC_KEY);//定义密钥
//
// System.out.println("正常: "+key+"="+des.decrypt(val));
// } catch (Exception e) {
// // TODO: handle exception
// System.out.println("异常: "+key+"="+val);
// }
// }
// 3DES加密
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// try {
//
// System.out.println("正常: "+key+"="+DES3Utils.encrypt(val, CONF_DESC_KEY));
// } catch (Exception e) {
// // TODO: handle exception
// System.out.println("异常: "+key+"="+val);
// }
// }
// }
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY));
// try { System.out.println(DES3Utils.decrypt("69872b2310ba9b30470ce46682151021e825c3909c394aa5f4387123bdbfa67e", CONF_DESC_KEY));
// InputStream in2 = new FileInputStream(new File("W:\\FOC智能管控系统\\线上配置\\all_conf.20170423\\all_conf\\api_conf\\ejweb.properties"));
//
// Properties props = new Properties();
// props.load(in2);
//
// Enumeration<?> enu = props.propertyNames();
// while (enu.hasMoreElements()) {
// String key = (String) enu.nextElement();
// String val = (String) props.get(key);
// String decrypted = DES3Utils.decrypt(val, CONF_DESC_KEY);
// if(decrypted == null){
// System.out.println("新增: "+key+"="+val);
// } else{
// System.out.println("NULL新增: "+key+"="+decrypted);
// }
// }
//
// String decrypted = DES3Utils.decrypt("dc6788486fc8fa4660890b4cba7ee6ada527e2e604dbe7fa0fdcf7401a0dd11996450d7fea85f2d9724b7d8fff30a4826c098fd51da0815035030eec22e491802aa2975c67259d9ca89540576b301b6d", CONF_DESC_KEY);
// System.out.println(decrypted);
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY));
//// DESPlus des = new DESPlus(CONF_DESC_KEY);//定义密钥
// System.out.println(DES3Utils.encrypt("jdbc:mysql://10.70.78.27:3306/foc?useUnicode=true&characterEncoding=utf-8", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("0e8dfd0927dd5d88fee454c6aef2a68a38e20f99110a3d5a933c45a72bf468e954c33fb8cfe5bcae", CONF_DESC_KEY));
// } catch (Exception e) {
// e.printStackTrace();
// }
} }
} }
...@@ -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