Commit 8019337f by java-李谡

Merge branch 'develop' into 'master'

Develop

See merge request java-jdair-foc/foc-api-2.0!5
parents 65fdc2bd a206bc65
......@@ -57,7 +57,7 @@
<filter-class>com.ejweb.core.filter.BasicVerifyFilter</filter-class>
<init-param>
<param-name>excludedPages</param-name>
<param-value>*</param-value>
<param-value>/api/user/login;/api/call/findPhoneInfo</param-value>
</init-param>
</filter>
<filter-mapping>
......
......@@ -67,7 +67,7 @@ seat.default.photo=images/user/avatar/seat_avatar.png
# Sign Private Key(Default FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn)
content.sign.private.key=FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn
# Verify Post Content Sign(Default true)
is.verify.content.sign=false
is.verify.content.sign=true
# \u9996\u822A\u63A5\u53E3\u57FA\u672C\u5730\u5740
jdair.api.base.url=https://dsp.jdair.net
jdair.api.base.param=ai.cc=7&ai.cp=10.68.26.52
......
......@@ -3,9 +3,9 @@ db.table.prefix=foc_
jdbc.type=mysql
jdbc.driver.class=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://106.75.97.50:3306/jd_foc?useUnicode=true&characterEncoding=utf-8&useSSL=true
jdbc.username=focuser
jdbc.password=FOC@2016
jdbc.url=jdbc:mysql://106.75.105.96:5508/jd_foc?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username=sms_develop
jdbc.password=Develop2018!@#
#\u521d\u59cb\u5316\u8fde\u63a5
jdbc.initialSize=0
......
......@@ -64,13 +64,13 @@
)
</if>
<if test="arrIata != null and arrIata != ''">
AND (a.id in (
SELECT id FROM foc_airline_verify where arrIata = #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE arrIata = #{arrIata} AND is_main != '0')
)
</if>
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
......@@ -93,4 +93,70 @@
ORDER BY ata_chn DESC
LIMIT 1
</select>
<select id="getStatisticalArrIataList" resultType="com.ejweb.modules.airport.entity.StatisticalEntity">
SELECT a.verif_no as verifNo,
a.id as verifId,
CASE WHEN a.verif_type='01' OR a.verif_type='02'
OR a.verif_type='03' OR a.verif_type='04' OR a.verif_type='05'
THEN b.flight_no
ELSE a.flight_no
END flightNo,
a.route_no AS routeNo,
a.aircraft_type,
TIMESTAMPDIFF(DAY,a.start_time,CURRENT_TIMESTAMP) AS expiryDate,
roundtrip_type,
IFNULL(b.depIata,a.depIata) AS depIata,
b.arrIata,
DATE_FORMAT(a.start_time, '%Y-%m-%d') AS startTime,
CASE WHEN a.verif_type='01' OR a.verif_type='02'
OR a.verif_type='03' OR a.verif_type='04' OR a.verif_type='05'
THEN p.city_name
ELSE tt.airport_name
END depIataName,
a.verif_type as verifType,
r.city_name AS arrIataName,
a.verifued_count AS verifuedCount,
a.depart_id as departId,
d.file_path as filePath,
c.type_name as typeName,
a.state
from foc_airline_verify a
left JOIN foc_airline_connect b on a.id = b.verif_id AND b.Is_main!='0'
LEFT JOIN foc_aircraft_type c on a.aircraft_type = c.id
LEFT JOIN foc_sailing_file d on a.id = d.verif_id
LEFT JOIN foc_airports p ON p.airport_iata = b.depIata
LEFT JOIN foc_sailing_command cc ON a.id = cc.verif_id
LEFT JOIN foc_airports r ON r.airport_iata = b.arrIata
LEFT JOIN foc_airports tt ON tt.airport_iata = a.depIata
where a.verif_status='02' AND a.del_flag = #{DEL_FLAG_NORMAL}
<if test="routeNo != null and routeNo != ''">
AND a.route_no LIKE
<if test="dbName == 'oracle'">'%'||#{routeNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{routeNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{routeNo}, '%')</if>
</if>
<if test="verifNo != null and verifNo != ''">
AND a.verif_no LIKE
<if test="dbName == 'oracle'">'%'||#{verifNo}||'%')</if>
<if test="dbName == 'mssql'">'%'+#{verifNo}+'%')</if>
<if test="dbName == 'mysql'">CONCAT('%', #{verifNo}, '%')</if>
</if>
<if test="verifType != null and verifType != ''">
AND a.verif_type = #{verifType}
</if>
AND (a.id in (
SELECT id FROM foc_airline_verify where depIata =#{depIata} AND arrIata= #{arrIata} ) OR a.id IN
(SELECT verif_id FROM foc_airline_connect WHERE depIata =#{depIata} and arrIata =#{arrIata} AND is_main != '0')
)
<if test="aircraftType != null and aircraftType != ''">
AND a.aircraft_type = #{aircraftType}
</if>
GROUP BY verifNo,routeNo,arrIata,depIata
</select>
</mapper>
\ No newline at end of file
......@@ -46,5 +46,27 @@
AND verif_id=#{verifId}
</if>
</select>
<select id="findDepartByList" resultType="com.ejweb.modules.depart.entity.DepartEntity">
SELECT
fu.id,
fu.depart_name,
fu.is_verif,
fu.is_risk,
f.depart_id
FROM `foc_user_depart_type` f
INNER JOIN foc_user_depart fu on f.depart_id = fu.id AND fu.del_flag='0'
WHERE f.del_flag = '0'
<if test="type != null and type !=''">
AND f.type=#{type}
</if>
</select>
<select id="findDepartAllList" resultType="com.ejweb.modules.depart.entity.DepartTypeEntity">
SELECT
a.id,
a.is_verif,
a.is_risk,
a.depart_name
FROM foc_user_depart a
WHERE a.del_flag = '0'
</select>
</mapper>
\ No newline at end of file
......@@ -33,8 +33,8 @@
status,
s.create_by,
s.create_date,
update_by,
update_date,
s.update_by,
s.update_date,
s.remarks,
url,
is_complete,
......@@ -43,9 +43,11 @@
foc_notify s
LEFT JOIN foc_verify_record r
ON s.verif_id=r.verif_id AND ((r.record_type='01' AND r.record_status='00') or r.verif_id is null)
LEFT JOIN foc_airline_verify a ON s.verif_id=a.id
WHERE
s.del_flag =#{DEL_FLAG_NORMAL}
AND a.verif_status!= '01'
AND a.verif_status!= '02'
AND s.depart_id = #{departId}
AND (s.type
IN (
......
......@@ -904,4 +904,36 @@
</if>
ORDER BY r.login_date DESC
</select>
<select id="findByIp" resultType="com.ejweb.modules.user.bean.LoginIpInfo">
select black_ip from sys_login_blacklist where black_ip = #{userIp}
</select>
<insert id="insertInfoByIp">
insert into sys_login_blacklist(black_ip,create_time) values (#{userIp},#{date})
</insert>
<select id="findListUser" resultType="com.ejweb.modules.user.entity.UserExport">
SELECT /*a.id,*/
a.login_name,
a.no,
a.name,
a.email,
a.phone,
a.mobile,
c.name AS company,
o.name AS office,
a.huawei_num,
a.user_type,
a.login_ip,
a.login_date,
a.login_flag,
a.photo
FROM sys_user a
LEFT JOIN sys_office c
ON c.id = a.company_id
LEFT JOIN sys_office o
ON o.id = a.office_id
WHERE a.del_flag='0'
/* AND user_type=6*/
</select>
</mapper>
\ No newline at end of file
......@@ -36,5 +36,7 @@
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 -->
<setting name="jdbcTypeForNull" value="NULL"/>
<!--打印sql-->
<!--<setting name="logImpl" value="STDOUT_LOGGING"/>-->
</settings>
</configuration>
redis.host=106.75.105.96
redis.port=7211
redis.auth=bbdtek!@#2018
redis.timeout=10000
redis.maxTotal=100
redis.maxIdle=20
redis.maxWaitMillis=10000
redis.testOnBorrow=true
redis.testOnReturn=true
redis.dbIndex=3
redis.ipWithinSeconds=60
redis.ipLimitTimes=10
redis.usernameWithinSeconds=60
redis.usernameLimitTimes=6
redis.blackUsernameTime=60
\ No newline at end of file
......@@ -32,6 +32,7 @@
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:ejweb.properties</value>
<value>classpath:redis.properties</value>
</list>
</property>
</bean>
......@@ -141,4 +142,20 @@
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
</bean>
<!--设置jedisPool链接池的配置-->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxTotal" value="${redis.maxTotal}"/>
<property name="maxIdle" value="${redis.maxIdle}"/>
<property name="maxWaitMillis" value="${redis.maxWaitMillis}"/>
<property name="testOnBorrow" value="${redis.testOnBorrow}"/>
<property name="testOnReturn" value="${redis.testOnReturn}"/>
</bean>
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg name="poolConfig" ref="jedisPoolConfig"/>
<constructor-arg name="host" value="${redis.host}"/>
<constructor-arg name="port" value="${redis.port}"/>
<constructor-arg name="timeout" value="${redis.timeout}"/>
<constructor-arg name="password" value="${redis.auth}"/>
</bean>
</beans>
\ No newline at end of file
......@@ -25,6 +25,7 @@
<list>
<value>classpath:jdbc.properties</value>
<value>classpath:ejweb.properties</value>
<value>classpath:redis.properties</value>
</list>
</property>
</bean>
......
package com.ejweb.core.base;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.annotation.JSONField;
import com.ejweb.core.conf.GConstants;
import org.hibernate.validator.constraints.NotEmpty;
/**
*
* 请求接口基本数据
*
* @team IT Team
* @author renmb
* @version 1.0
* @time 2016-03-10
*
*/
public class BaseUserBean {
@JSONField(deserialize = false, serialize = false)
public static final String DEL_FLAG_NORMAL = "0";
// @JSONField(deserialize=false, serialize=false)
// protected String dbprefix=GConstants.getValue("db.table.prefix", "");//
// 数据库表前缀
@JSONField(serialize=false)
@NotEmpty(message = "appCode不允许为空")
// @JSONField(name="app_code")
protected String userSign;
@JSONField(deserialize = false, serialize = false)
public String getDbprefix() {
return GConstants.getValue("db.table.prefix", "");// 数据库表前缀;
}
// public void setDbprefix(String dbprefix) {
// this.dbprefix = dbprefix;
// }
@JSONField(deserialize = false, serialize = false)
public String getDbName() {
return GConstants.getValue("jdbc.type");
}
public String getUserSign() {
return userSign;
}
public void setUserSign(String userSign) {
this.userSign = userSign;
}
@Override
public String toString() {
return JSON.toJSONString(this);
}
}
......@@ -79,6 +79,7 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
public static void main(String[] args) {
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("69872b2310ba9b30470ce46682151021e825c3909c394aa5f4387123bdbfa67e", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("fc76fa2b2e10b3d4450d564314a97766", CONF_DESC_KEY));
System.out.println(DES3Utils.decrypt("31a63fac8317458d81c034906825749f7c58c30a773c6927", CONF_DESC_KEY));
}
}
......@@ -54,17 +54,12 @@ public class ErrorHandler {
valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ",";
}
//乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
// valueStr = new String(valueStr.getBytes("ISO-8859-1"), "UTF-8");
buf.append(" "+name+":"+valueStr+"\n");
}
String clientip = Util.getOnlineIP(request);
String uri = request.getRequestURI();
EmailStackTraceHandler.getInstance().sendEmail("系统异常", "Request IP: "+clientip+"\nRequest URI: "+uri+"\nParameter Map: \n"+buf.toString()+"\nStack Trace: \n"+error);
}
// if(StringUtils.isNotBlank(uri) && uri.contains("/api/")){// 接口
//
// }
} catch (Exception e2) {
// TODO: handle exception
}
......
package com.ejweb.core.fetcher;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.conf.GConstants;
import com.ejweb.core.security.GlobalUtil;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.ejweb.core.conf.ErrorCode;
import com.ejweb.core.conf.GConstants;
import com.ejweb.core.security.GlobalUtil;
import com.ejweb.modules.im.entity.GroupEntity;
/*
* 利用HttpClient进行post请求的工具类
*/
public class HttpClientUtil {
import java.util.*;
import java.util.Map.Entry;
/**
* 利用HttpClient进行post请求的工具类
*/
public class HttpClientUtil {
@SuppressWarnings("deprecation")
public static String doPost(String url,Map<String,String> map,String charset){
CloseableHttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try{
public static String doPost(String url, Map<String, String> map, String charset) {
CloseableHttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try {
// httpClient = new DefaultHttpClient();
httpClient = HttpClients.createDefault();
httpPost = new HttpPost(url);
httpPost.addHeader("ACCESS_TOKEN", "VEs0MjI5Nzc3Mzk3NzM4MDYyNDgyMDUy");
//设置参数
List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = map.entrySet().iterator();
while(iterator.hasNext()){
Entry<String,String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(),elem.getValue()));
}
if(list.size() > 0){
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list,charset);
httpPost.setEntity(entity);
}
HttpResponse response = httpClient.execute(httpPost);
if(response != null){
HttpEntity resEntity = response.getEntity();
if(resEntity != null){
result = EntityUtils.toString(resEntity,charset);
}
}
}catch(Exception ex){
ex.printStackTrace();
}
return result;
}
public static void main(String[] args){
List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(), elem.getValue()));
}
if (list.size() > 0) {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset);
httpPost.setEntity(entity);
}
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
public static void main(String[] args) {
try {
// StringBuilder url = new StringBuilder("https://ewatch.okayapps.com/faq/api/user/login");
StringBuilder url = new StringBuilder("https://ewatch.okayapps.com/faq/api/ask/detail");
String loginName = "root";
String password = "1";
JSONObject content = new JSONObject();
......@@ -78,14 +69,14 @@ public class HttpClientUtil {
content.put("platform", "Android");
content.put("language", "zh_CN");
content.put("appCode", "10001");
content.put("loginName", "root");
content.put("password", "admin");
content.put("userCode", "userId");
content.put("id", "93648376039909180225");
Map<String, String> params = new HashMap<String, String>();
params.put("content", JSON.toJSONString(content));
String sign = GlobalUtil.getParamsSignStr(GConstants.SIGN_PRIVATE_KEY, params.get("content"));
params.put("sign", sign);
String res = HttpClientUtil.doPost(url.toString(), params, "UTF-8");
......
......@@ -4,6 +4,8 @@ import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class GlobalUtil {
......@@ -16,7 +18,20 @@ public class GlobalUtil {
public static boolean verify(String data, String privateKey, String sign) {
try {
String mSign = getParamsSignStr(privateKey, data);
if(mSign == null || sign == null)
if (mSign == null || sign == null)
return true;
mSign = URLDecoder.decode(mSign, "UTF-8");
return mSign.equals(sign);
} catch (Exception e) {
// TODO: handle exception
}
return false;
}
public static boolean verifySign(String data, String privateKey, String sign) {
try {
String mSign = getParamsSign(privateKey, data);
if (mSign == null || sign == null)
return true;
mSign = URLDecoder.decode(mSign, "UTF-8");
return mSign.equals(sign);
......@@ -35,7 +50,24 @@ public class GlobalUtil {
/**
* 获取加密后的字符串
*
*/
public static String getParamsSign(String key, String paramsStr) {
if (key == null || paramsStr == null) {
return "";
}
// String signedString = JSON.toJSONString(paramsStr);
String signedStr = getSHA256(paramsStr + key);
// String signedStr1 = base64(signedStr.getBytes("UTF-8"));
return signedStr;
// try {
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// return "";
}
/**
* 获取加密后的字符串
*/
public static String getParamsSignStr(String key, String paramsStr) {
if (key == null || paramsStr == null) {
......@@ -53,11 +85,9 @@ public class GlobalUtil {
/**
* HMACSHA1加密
*
* @param key
* 加密使用的key
* @param strByte
* 待加密的数据
*
* @param key 加密使用的key
* @param strByte 待加密的数据
* @return 生成MD5编码的字符串
*/
......@@ -80,15 +110,56 @@ public class GlobalUtil {
* base64加密
*/
public static String base64(byte[] val) {
if (val == null)
if (val == null) {
return null;
else
} else {
return Base64.encode(val);
}
}
/**
*     * 利用java原生的类实现SHA256加密
*     * @param str 加密后的报文
*     * @return
*     
*/
public static String getSHA256(String str) {
MessageDigest messageDigest;
String encodeStr = "";
try {
messageDigest = MessageDigest.getInstance("SHA-256");
messageDigest.update(str.getBytes("UTF-8"));
encodeStr = byte2Hex(messageDigest.digest());
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return encodeStr;
}
/**
*     * 将byte转为16进制
*     * @param bytes
*     * @return
*     
*/
private static String byte2Hex(byte[] bytes) {
StringBuffer stringBuffer = new StringBuffer();
String temp = null;
for (int i = 0; i < bytes.length; i++) {
temp = Integer.toHexString(bytes[i] & 0xFF);
if (temp.length() == 1) {
//1得到一位的进行补0操作
stringBuffer.append("0");
}
stringBuffer.append(temp);
}
return stringBuffer.toString();
}
public static void main(String[] args) {
//{"shop_code":"ringpu","user_code":"","role_code":"","user_channel":"1002","sub_channel":"AGENCY","version_name":"0.9","password":"111111","telephone":"13752653287"}
//{"shop_code":"ringpu","user_code":"","role_code":"","user_channel":"1002","sub_channel":"AGENCY","version_name":"0.9","password":"111111","telephone":"13752653287"}
String param = "{\"appCode\":\"30007\",\"appkey\":\"\",\"versionName\":\"6.0.0\",\"platform\":\"Android\",\"deviceToken\":\"deviceToken\",\"language\":\"zh_CN\",email : '123@qwe.com',name : 'name', keywords : '天津', staffAccounts : ['794089036222300160', 'seat791537198252023808']}";
String sign = GlobalUtil.getParamsSignStr("FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn", param);
String check = getParamsSignStr("FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn", param);
......
package com.ejweb.core.util;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Properties;
/**
* @author zangtao
*/
public class PropertiesUtils {
private static Properties properties ;
/**
* 获取配置文件中配置信息
*/
static { }
public static Properties getProperties(){
if (properties == null){
properties = new Properties();
try {
properties.load(new InputStreamReader(PropertiesUtils.class.getClassLoader().getResourceAsStream("redis.properties"),"UTF-8"));
} catch (IOException e) {
e.printStackTrace();
}
}
return properties;
}
}
package com.ejweb.core.util;
import com.alibaba.fastjson.JSON;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;
/**
* @author lisu
*/
@Component
public class RedisUtils {
private final Logger log = LoggerFactory.getLogger(this.getClass());
@Autowired
private JedisPool jedisPool;
/**
* 通过key获取储存在redis中的value
* 并释放连接
*
* @param key
* @param indexDb 选择redis库 0-15
* @return 成功返回value 失败返回null
*/
public String get(String key, int indexDb) {
Jedis jedis = null;
String value = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
value = jedis.get(key);
log.info(value);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return value;
}
public Long del(String key, int indexDb) {
Jedis jedis = null;
Long value = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
value = jedis.del(key);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return value;
}
/**
* 通过key 对value进行加值+1操作,当value不是int类型时会返回错误,当key不存在是则value为1
*
* @param key
* @return 加值后的结果
*/
public Long incr(String key, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
res = jedis.incr(key);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
/**
* 通过key 对value进行加值+1操作,当value不是int类型时会返回错误,当key不存在是则value为1
* 自增不取消过期时间
*
* @param key
* @return 加值后的结果
*/
public Long incrNotResetExpireTime(String key, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
Integer expireTime = jedis.ttl(key).intValue();
res = jedis.incr(key);
// jedis.expireAt(key, expireTime);
res = jedis.expire(key, expireTime);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
public String set(String key, Object value, int indexDb) {
Jedis jedis = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
JSON.toJSONString(value);
return jedis.set(key, JSON.toJSONString(value));
} catch (Exception e) {
log.error(e.getMessage());
return "0";
} finally {
returnResource(jedisPool, jedis);
}
}
/**
* 设置过期时间
*
* @param key
* @param unixTime 过期时间的时间戳(秒)
* @return
*/
public Long expireAt(String key, long unixTime, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
res = jedis.expireAt(key, unixTime);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
/**
* 设置过期时间
*
* @param key
* @param seconds 过期时间(秒)
* @return
*/
public Long expire(String key, int seconds, int indexDb) {
Jedis jedis = null;
Long res = null;
try {
jedis = jedisPool.getResource();
jedis.select(indexDb);
res = jedis.expire(key, seconds);
} catch (Exception e) {
log.error(e.getMessage());
} finally {
returnResource(jedisPool, jedis);
}
return res;
}
/**
* 返还到连接池
*
* @param jedisPool
* @param jedis
*/
public static void returnResource(JedisPool jedisPool, Jedis jedis) {
if (jedis != null) {
jedisPool.returnResource(jedis);
}
}
}
\ No newline at end of file
......@@ -3,17 +3,17 @@
*/
package com.ejweb.core.util;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
/**
* 时间计算工具类
*
*
* @author ThinkGem
* @version 2013-11-03
*/
......@@ -64,12 +64,12 @@ public class TimeUtils {
/**
* 各常量允许的最大值
*/
private final int[] maxFields = { 59, 59, 23, Integer.MAX_VALUE - 1 };
private final int[] maxFields = {59, 59, 23, Integer.MAX_VALUE - 1};
/**
* 各常量允许的最小值
*/
private final int[] minFields = { 0, 0, 0, Integer.MIN_VALUE };
private final int[] minFields = {0, 0, 0, Integer.MIN_VALUE};
/**
* 默认的字符串格式时间分隔符
......@@ -90,11 +90,9 @@ public class TimeUtils {
/**
* 使用时、分构造一个时间
*
* @param hour
* 小时
* @param minute
* 分钟
*
* @param hour 小时
* @param minute 分钟
*/
public TimeUtils(int hour, int minute) {
this(0, hour, minute, 0);
......@@ -102,13 +100,10 @@ public class TimeUtils {
/**
* 使用时、分、秒构造一个时间
*
* @param hour
* 小时
* @param minute
* 分钟
* @param second
* 秒
*
* @param hour 小时
* @param minute 分钟
* @param second 秒
*/
public TimeUtils(int hour, int minute, int second) {
this(0, hour, minute, second);
......@@ -117,9 +112,8 @@ public class TimeUtils {
/**
* 使用一个字符串构造时间<br/>
* Time time = new Time("14:22:23");
*
* @param time
* 字符串格式的时间,默认采用“:”作为分隔符
*
* @param time 字符串格式的时间,默认采用“:”作为分隔符
*/
public TimeUtils(String time) {
this(time, null);
......@@ -128,7 +122,7 @@ public class TimeUtils {
/**
* 使用时间毫秒构建时间
*
*
* @param time
*/
public TimeUtils(long time) {
......@@ -137,7 +131,7 @@ public class TimeUtils {
/**
* 使用日期对象构造时间
*
*
* @param date
*/
public TimeUtils(Date date) {
......@@ -146,15 +140,11 @@ public class TimeUtils {
/**
* 使用天、时、分、秒构造时间,进行全字符的构造
*
* @param day
* 天
* @param hour
* 时
* @param minute
* 分
* @param second
* 秒
*
* @param day 天
* @param hour 时
* @param minute 分
* @param second 秒
*/
public TimeUtils(int day, int hour, int minute, int second) {
initialize(day, hour, minute, second);
......@@ -163,9 +153,8 @@ public class TimeUtils {
/**
* 使用一个字符串构造时间,指定分隔符<br/>
* Time time = new Time("14-22-23", "-");
*
* @param time
* 字符串格式的时间
*
* @param time 字符串格式的时间
*/
public TimeUtils(String time, String timeSeparator) {
if (timeSeparator != null) {
......@@ -176,11 +165,9 @@ public class TimeUtils {
/**
* 设置时间字段的值
*
* @param field
* 时间字段常量
* @param value
* 时间字段的值
*
* @param field 时间字段常量
* @param value 时间字段的值
*/
public void set(int field, int value) {
if (value < minFields[field]) {
......@@ -197,9 +184,8 @@ public class TimeUtils {
/**
* 获得时间字段的值
*
* @param field
* 时间字段常量
*
* @param field 时间字段常量
* @return 该时间字段的值
*/
public int get(int field) {
......@@ -211,9 +197,8 @@ public class TimeUtils {
/**
* 将时间进行“加”运算,即加上一个时间
*
* @param time
* 需要加的时间
*
* @param time 需要加的时间
* @return 运算后的时间
*/
public TimeUtils addTime(TimeUtils time) {
......@@ -229,9 +214,8 @@ public class TimeUtils {
/**
* 将时间进行“减”运算,即减去一个时间
*
* @param time
* 需要减的时间
*
* @param time 需要减的时间
* @return 运算后的时间
*/
public TimeUtils subtractTime(TimeUtils time) {
......@@ -254,7 +238,7 @@ public class TimeUtils {
/**
* 获得时间字段的分隔符
*
*
* @return
*/
public String getTimeSeparator() {
......@@ -263,9 +247,8 @@ public class TimeUtils {
/**
* 设置时间字段的分隔符(用于字符串格式的时间)
*
* @param timeSeparator
* 分隔符字符串
*
* @param timeSeparator 分隔符字符串
*/
public void setTimeSeparator(String timeSeparator) {
this.timeSeparator = timeSeparator;
......@@ -318,15 +301,16 @@ public class TimeUtils {
time + ", time format error, HH" + this.timeSeparator + "mm" + this.timeSeparator + "ss");
}
/**
* 获取今天是星期几
* @author huhy
* @time 2016年11月24日
* @param dt
* @return
*/
/**
* 获取今天是星期几
*
* @param dt
* @return
* @author huhy
* @time 2016年11月24日
*/
public static String getWeekOfDate(Date dt) {
String[] weekDays = {"星期日","星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
Calendar cal = Calendar.getInstance();
cal.setTime(dt);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
......@@ -337,11 +321,11 @@ public class TimeUtils {
/**
* 获取前后日期 i为正数 向后推迟i天,负数时向前提前i天
*
* @author huhy
* @time 2016年11月24日
*
* @param i
* @return
* @author huhy
* @time 2016年11月24日
*/
public static Date getdate(int i) {
Date dat = null;
......@@ -390,4 +374,14 @@ public class TimeUtils {
return true;
}
/**
* 获取当前时间
*
* @param formatType 转换格式,如:yyyy-MM-dd HH:mm:ss
* @return
*/
public static String getTime(String formatType) {
SimpleDateFormat format = new SimpleDateFormat(formatType);
return format.format(System.currentTimeMillis());
}
}
\ No newline at end of file
......@@ -53,7 +53,8 @@ public class StatisticalController{
if(message == null){
// 参数校验为通过
PageEntity<StatisticalEntity> list = statisticalService.getStatisticalList(bean);
if(list == null){// 查询结果为空
// 查询结果为空
if (list == null) {
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
......
......@@ -3,12 +3,12 @@
*/
package com.ejweb.modules.airport.dao;
import java.util.List;
import com.ejweb.core.base.BaseDao;
import com.ejweb.modules.airport.bean.StatisticalBean;
import com.ejweb.modules.airport.entity.StatisticalEntity;
import java.util.List;
/**
*
* @team suzhou
......@@ -19,5 +19,6 @@ import com.ejweb.modules.airport.entity.StatisticalEntity;
public interface StatisticalDao extends BaseDao{
List<StatisticalEntity> getStatisticalList(StatisticalBean bean);
List<StatisticalEntity> getStatisticalArrIataList(StatisticalBean bean);
Integer getDay(StatisticalEntity entity);
}
......@@ -14,9 +14,12 @@ import com.ejweb.modules.verify.dao.AirlineVerifyDao;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
......@@ -27,6 +30,7 @@ import java.util.List;
*/
@Service
public class StatisticalService extends BaseService<StatisticalDao> {
private final static Logger LOG = Logger.getLogger(StatisticalService.class);
@Autowired
private AirlineVerifiedDao airlineVerifiedDao;
......@@ -41,24 +45,49 @@ public class StatisticalService extends BaseService<StatisticalDao> {
abean.setUserCode(bean.getUserCode());
if (StringUtils.isEmpty(bean.getSort())) {
PageHelper.orderBy("source,routeNo DESC");
} else
} else {
PageHelper.orderBy("source," + bean.getSort());
List<StatisticalEntity> lists = dao.getStatisticalList(bean);
}
// 双向查询目的地修正
String depIata = bean.getDepIata();
String arrIata = bean.getArrIata();
List<StatisticalEntity> lists = null;
if (depIata.length() != 0 && arrIata.length() != 0) {
lists = dao.getStatisticalArrIataList(bean);
} else {
lists = dao.getStatisticalList(bean);
}
LOG.info("用户userCode:" + bean.getUserCode());
String departId = airlineVerifiedDao.findDepartId(abean);
for (StatisticalEntity e : lists) {
String typelist = verifdao.getTypeList1(e.getVerifId());
if (StringUtils.isNoneBlank(typelist))
if (StringUtils.isNoneBlank(typelist)) {
e.setTypeName(e.getTypeName() + ":" + typelist);
}
e.setTypeList(verifdao.getTypeList(e.getVerifId()));
if (departId.equals(e.getDepartId()))
if (departId.equals(e.getDepartId())) {
e.setReStart(true);
else
} else {
e.setReStart(false);
}
// 根据调机进行状态修改
String startTime = e.getStartTime();
Date date = new Date();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String format = sdf.format(date);
if ("05".equals(e.getVerifType())) {
//调机类型,如果当天为开航时间,有效期为1天,否则设置为负数,前端判断有效期为负数,显示--
if (null != startTime && format.equals(startTime)) {
e.setExpiryDate(1 + "");
} else {
e.setExpiryDate(-10 + "");
}
}
if ("06".equals(e.getVerifType()) || "07".equals(e.getVerifType())
|| "08".equals(e.getVerifType())) {
e.setExpiryDate("长期有效");
} else {
} else if (!"05".equals(e.getVerifType())) {
Integer day = dao.getDay(e);
if (day != null) {
if (day > 180 && Integer.parseInt(e.getExpiryDate()) > 180) {
......
package com.ejweb.modules.depart.api;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ejweb.core.api.RequestBean;
import com.ejweb.core.api.ResponseBean;
import com.ejweb.core.conf.ErrorCode;
import com.ejweb.core.conf.GConstants;
import com.ejweb.modules.depart.bean.DepartBean;
import com.ejweb.modules.depart.bean.DepartTypeBean;
import com.ejweb.modules.depart.entity.DepartEntity;
import com.ejweb.modules.depart.entity.DepartTypeEntity;
import com.ejweb.modules.depart.service.DepartService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* Airport Controller
*
* @author zhanglg
* @version 2016-8-23
*/
@Controller
@RequestMapping(value = "/api/depart")
public class DepartController{
public class DepartController {
@Autowired
private DepartService departService;
@ResponseBody
@RequestMapping(value = "list")
public ResponseBean list(RequestBean requestBean,BindingResult errors) {
public ResponseBean list(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors);
if(message == null){// 通过参数校验
List<DepartEntity> list = departService.findAllList(bean.getIsVerif());
if(list == null){// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
String message = departService.validate(bean, errors);
if (message == null) {// 通过参数校验
List<DepartEntity> list = departService.findAllList(bean.getIsVerif());
if (list == null) {// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}
responseBean.setData(list);
return responseBean;
}
responseBean.setData(list);
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
@ResponseBody
@RequestMapping(value = "risklist")
public ResponseBean risklist(RequestBean requestBean,BindingResult errors) {
public ResponseBean risklist(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors);
if(message == null){// 通过参数校验
List<DepartEntity> list = departService.findRiskList(bean);
if(list == null){// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
String message = departService.validate(bean, errors);
if (message == null) {// 通过参数校验
List<DepartEntity> list = departService.findRiskList(bean);
if (list == null) {// 数据为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}
responseBean.setData(list);
return responseBean;
}
responseBean.setData(list);
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
@ResponseBody
@RequestMapping(value = "getByuserCode")
public ResponseBean getByUserCode(RequestBean requestBean,BindingResult errors){
public ResponseBean getByUserCode(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors);
if(message == null){// 通过参数校验
DepartEntity entity= departService.getByUserCode(bean.getUserCode());
if(entity == null){// 查询结果为空
String message = departService.validate(bean, errors);
if (message == null) {// 通过参数校验
DepartEntity entity = departService.getByUserCode(bean.getUserCode());
if (entity == null) {// 查询结果为空
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}else{
} else {
responseBean.setData(entity);
responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
......@@ -96,4 +100,28 @@ public class DepartController{
return responseBean;
}
@ResponseBody
@RequestMapping(value = "departList")
public ResponseBean departList(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean();
DepartTypeBean bean = requestBean.getObjectBean(DepartTypeBean.class);
String message = departService.validate(bean, errors);
// 通过参数校验
if (message == null) {
List<DepartTypeEntity> list = departService.findDepartList(bean);
// 数据为空
if (list == null) {
responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean;
}
responseBean.setData(list);
return responseBean;
}
responseBean.setMessage(message);
responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean;
}
}
/**
*
*/
package com.ejweb.modules.depart.bean;
import com.ejweb.core.base.GenericBean;
import org.hibernate.validator.constraints.NotEmpty;
/**
*
* @team IT Team
* @author zhanglg
* @version 1.0
* @time 2016年9月9日
*/
public class DepartTypeBean extends GenericBean {
@NotEmpty(message = "type不能为空")
String type;
String verifId;
String isVerif;
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getVerifId() {
return verifId;
}
public void setVerifId(String verifId) {
this.verifId = verifId;
}
public String getIsVerif() {
return isVerif;
}
public void setIsVerif(String isVerif) {
this.isVerif = isVerif;
}
}
package com.ejweb.modules.depart.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ejweb.core.base.BaseDao;
import com.ejweb.modules.depart.bean.DepartBean;
import com.ejweb.modules.depart.entity.DepartEntity;
import com.ejweb.modules.depart.entity.DepartTypeEntity;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
......@@ -19,4 +19,6 @@ public interface DepartDao extends BaseDao{
public List<DepartEntity> findAllList(DepartEntity departEntity);
public DepartEntity getByUserCode(@Param(value="userCode") String userCode);
public List<DepartEntity> findRiskList(DepartBean bean);
public List<DepartEntity> findDepartByList(@Param(value="type") String type, @Param(value = "isVerif") String isVerif);
public List<DepartTypeEntity> findDepartAllList();
}
\ No newline at end of file
package com.ejweb.modules.depart.entity;
import com.ejweb.core.base.BaseEntity;
/**
*
* 论证部门Entity
* @author zhanglg
* @version 2016-08-24
*/
public class DepartTypeEntity extends BaseEntity{
private static final long serialVersionUID = 1L;
private String id;
private String departName;
private String isVerif;
private String isRisk;
private Boolean check=false;
public static long getSerialVersionUID() {
return serialVersionUID;
}
public Boolean getCheck() {
return check;
}
public void setCheck(Boolean check) {
this.check = check;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id == null ? null : id.trim();
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
public String getIsVerif() {
return isVerif;
}
public void setIsVerif(String isVerif) {
this.isVerif = isVerif;
}
public String getIsRisk() {
return isRisk;
}
public void setIsRisk(String isRisk) {
this.isRisk = isRisk;
}
}
\ No newline at end of file
package com.ejweb.modules.depart.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.ejweb.core.base.BaseService;
import com.ejweb.modules.depart.bean.DepartBean;
import com.ejweb.modules.depart.bean.DepartTypeBean;
import com.ejweb.modules.depart.dao.DepartDao;
import com.ejweb.modules.depart.entity.DepartEntity;
import com.ejweb.modules.depart.entity.DepartTypeEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* Depart Service
......@@ -39,5 +40,22 @@ public class DepartService extends BaseService<DepartDao> {
return departDao.findRiskList(bean);
}
public List<DepartTypeEntity> findDepartList(DepartTypeBean departTypeBean){
//查询所有的部门
List<DepartTypeEntity> allList = departDao.findDepartAllList();
// 根据类型type值查询对应的部门信息
String type = departTypeBean.getType();
List<DepartEntity> byList = departDao.findDepartByList(type,departTypeBean.getIsVerif());
if (byList != null) {
for (DepartTypeEntity udAll : allList) {
for (DepartEntity udBy : byList) {
if (udAll.getId() == udBy.getId() || udAll.getId().equals(udBy.getId())) {
udAll.setCheck(true);
}
}
}
}
return allList;
}
}
......@@ -36,7 +36,7 @@ import java.util.List;
* @time 2016年9月23日
*/
@Service
@Transactional(readOnly = true, rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class)
public class ShortMessageService extends BaseService<ShortMessageDao> {
private final static Logger logger = Logger.getLogger(ShortMessageService.class);
......@@ -64,7 +64,8 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
}
builder.append(phones[i].replaceAll("^0+", ""));
}
phone = builder.toString();
//电话号码去除空格,否则导致发送失败
phone = builder.toString().trim();
if (StringUtils.isEmpty(phone)) {
return false;
}
......@@ -79,6 +80,7 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
String resultCode = result.getJSONObject("result").getString("resultCode");
// 判断 调用接口是否成功
if ("1000".equals(resultCode)) {
logger.info("短信发送成功:" + result.toJSONString());
SmsRecordEntity record = new SmsRecordEntity();
record.setClientip(bean.getClientip());
record.setCreateTime(new Date());
......
......@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List;
import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -33,6 +34,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@Service
public class NotifyService extends BaseService<NotifyDao> {
private final static Logger LOG = Logger.getLogger(NotifyService.class);
@Autowired
AirlineVerifyDao verifyDao;
@Autowired
......@@ -44,7 +46,6 @@ public class NotifyService extends BaseService<NotifyDao> {
*
* @author renmb
* @time 2016年8月27日
* @param bean
* @return
*/
public Integer addNotifyRecord(String notifyId, String userId, String readFlag){
......@@ -63,7 +64,7 @@ public class NotifyService extends BaseService<NotifyDao> {
PageEntity<NotifyListEntity> page = new PageEntity<NotifyListEntity>();
page.setPageNo(bean.getPageNo());
page.setPageSize(bean.getPageSize());
LOG.info("用户userCode:" + bean.getUserCode());
bean.setDepartId(departDao.getByUserCode(bean.getUserCode()).getId());
bean.setPermissionList(dao.permissionList(bean.getUserCode()));
......
package com.ejweb.modules.route.bean;
import java.util.List;
import java.util.Map;
import com.ejweb.core.base.GenericBean;
import org.hibernate.validator.constraints.NotEmpty;
import com.ejweb.core.base.GenericBean;
import java.util.List;
import java.util.Map;
public class VerifyStatusBean extends GenericBean {
......
......@@ -39,6 +39,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import freemarker.template.TemplateException;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -63,6 +64,8 @@ import java.util.regex.Pattern;
*/
@Service
public class SailingCommandService extends CurdService<SailingCommandDao, SailingCommandEntity> {
private final static Logger LOG = Logger.getLogger(SailingCommandService.class);
@Autowired
private AirlineVerifyDao verifyDao;
@Autowired
......@@ -370,11 +373,7 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
if ("01".equals(CommandStatus) && "01".equals(bean.getCommandStatus())) {
return false;
}
if ("01".equals(bean.getCommandStatus()) || "02".equals(bean.getCommandStatus())) {
//commandStatus为’01’时,以verifId找到foc_airline_verify对应数据中的verif_status设置为02
bean.setVerifStatus("02");
dao.updateVerifStatys(bean);
}
if (!"00".equals(bean.getCommandStatus())) {
// 该input标签不一定以 / 结尾
Pattern pattern = Pattern.compile("(?<=routeNo\" value=\")(.+?)(?=\"/?>)");
......@@ -394,7 +393,6 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
bean.setRouteNo(routeNo);
// if(bean.getFormText()!=null&&!"".equals(bean.getFormText())){
try {
// 完成审核通知置灰
NotifyAddBean addbean = new NotifyAddBean();
addbean.setVerifId(bean.getVerifId());
......@@ -540,7 +538,7 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
sb.append(bean.getConRemarks().replaceAll("<table", "<table width=\"80%\" "));
// sb.append(bean.getConRemarks());
/* sb.append("<br/><h2>开航指令:</h2>");
sb.append(bean.getFormText());*/
sb.append("<br/><h2>各部门论证单:</h2>");
......@@ -595,42 +593,46 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
sailingFileBean.setCreateBy(bean.getUserCode());
//dao.deleteSailingFile(sailingFileBean);
dao.insertSailingFile(sailingFileBean);
} catch (Exception e) {
// TODO: handle exception
}
LOG.info("添加开航指令文件完成");
dao.updateAirlineverify(bean);
LOG.info("更新开航指令绑定完成");
// 获取论证全部参与部门
List<String> lst = dao.getVerifDeparts(bean.getVerifId());
for (String departId : lst) {
NotifyAddBean addbean = new NotifyAddBean();
StringBuffer sb = new StringBuffer();
NotifyAddBean addbean1 = new NotifyAddBean();
StringBuffer sbContent = new StringBuffer();
sb.append("论证单号为").append(map1.get("verifNo"))
sbContent.append("论证单号为").append(map1.get("verifNo"))
.append(map1.get("verifType")).append(map1.get("depName")).append("的航线已生成开航指令。");
StringBuffer url = new StringBuffer();
url.append("<<<a href='airway-argument-details.htm?verifId=").append(bean.getVerifId());
url.append("&verifNo=").append(map1.get("verifNo"));
url.append("&sailingDate=").append(map1.get("startTime"));
url.append("'>点击查看</a>");
addbean.setUrl(url.toString());
addbean.setType("14");
addbean.setContent(sb.toString());
addbean.setTitle("开航指令下发完成提醒");
addbean.setCreateBy(bean.getUserCode());
addbean.setUpdateBy(bean.getUserCode());
addbean.setCreateDate(new Date());
addbean.setUpdateDate(new Date());
addbean.setId(IdWorker.getNextId());
addbean.setDepartId(departId);
addbean.setVerifId(bean.getVerifId());
addbean.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean);
addbean1.setUrl(url.toString());
addbean1.setType("14");
addbean1.setContent(sbContent.toString());
addbean1.setTitle("开航指令下发完成提醒");
addbean1.setCreateBy(bean.getUserCode());
addbean1.setUpdateBy(bean.getUserCode());
addbean1.setCreateDate(new Date());
addbean1.setUpdateDate(new Date());
addbean1.setId(IdWorker.getNextId());
addbean1.setDepartId(departId);
addbean1.setVerifId(bean.getVerifId());
addbean1.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean1);
}
}
dao.updateSailingCommand(bean);
LOG.info("更新开航指令状态完成,已完成开航指令,开航指令状态:" + bean.getCommandStatus());
if ("01".equals(bean.getCommandStatus()) || "02".equals(bean.getCommandStatus())) {
//commandStatus为’01’时,以verifId找到foc_airline_verify对应数据中的verif_status设置为02
bean.setVerifStatus("02");
dao.updateVerifStatys(bean);
LOG.info("更新论证状态为论证成功");
}
return true;
}
......
......@@ -38,11 +38,10 @@ import java.util.List;
import java.util.Map;
/**
* @team IT Team
* @author renmb
* @version 1.0
* @team IT Team
* @time 2016-03-22
*
*/
@Controller
@RequestMapping(value = "/api/upload")
......@@ -54,12 +53,12 @@ public class UploadController {
/**
* 使用BASE64上传文件
*
* @author renmb
* @time 2016年11月1日
*
* @param request
* @param requestBean
* @return
* @author renmb
* @time 2016年11月1日
*/
@ResponseBody
@RequestMapping("/base64")
......@@ -135,7 +134,7 @@ public class UploadController {
@ResponseBody
@RequestMapping("/files")
public ResponseBean files(HttpServletRequest request, @RequestParam("file") CommonsMultipartFile[] files,
RequestBean requestBean) {
RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
List<UploadFileBean> uploadFiles = null;
......@@ -279,12 +278,16 @@ public class UploadController {
@RequestMapping("download")
public void download(RequestBean requestBean, HttpServletResponse response, HttpServletRequest request) throws JsonParseException, JsonMappingException, IOException {
FileBean bean = requestBean.getObjectBean(FileBean.class);
FileBean bean = requestBean.getObjectBean(FileBean.class);
// File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR, filepath);
InputStream in = null;
OutputStream out = null;
try {
if (bean.getPath() != null) {
if (bean.getPath().indexOf("../") != -1) {
return;
}
}
// 设置文件MIME类型
response.setContentType("application/form-data;charset=utf-8");
// String downloadFileName=Encodes.urlEncode(bean.getName());
......@@ -294,16 +297,16 @@ public class UploadController {
downloadFileName = "=?UTF-8?B?" + (new String(Base64.encodeBase64(bean.getName().getBytes("UTF-8"))))
+ "?=";
} /*
* else{ downloadFileName = URLDecoder.decode(bean.getName(),
* "UTF-8"); }
*/
* else{ downloadFileName = URLDecoder.decode(bean.getName(),
* "UTF-8"); }
*/
// 设置Content-Disposition
response.setHeader("Content-Disposition", "attachment; filename=\"" + downloadFileName + "\"");
// 获取目标文件的绝对路径
// String fullFileName = GConstants.FILE_UPLOAD_DIR + bean.getPath();
File downloadFile = new File(GConstants.FILE_UPLOAD_DIR, bean.getPath());
LOG.error("文件下载地址:"+downloadFile.getAbsolutePath());
System.out.println("文件下载地址:"+downloadFile.getAbsolutePath());
LOG.error("文件下载地址:" + downloadFile.getAbsolutePath());
System.out.println("文件下载地址:" + downloadFile.getAbsolutePath());
// 读取文件
in = new FileInputStream(downloadFile);
out = response.getOutputStream();
......@@ -323,8 +326,8 @@ public class UploadController {
IOUtils.closeQuietly(out);
}
}
// public static String GetImageStr(String imgFile)
// public static String GetImageStr(String imgFile)
// {//将图片文件转化为字节数组字符串,并对其进行Base64编码处理
//// String imgFile = "d://test.jpg";//待处理的图片
// InputStream in = null;
......@@ -400,12 +403,12 @@ public class UploadController {
@RequestMapping("/verifFile")
public ResponseBean verifFile(HttpServletRequest request, RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean();
String stream=request.getParameter("fileStream");
String filePath=request.getParameter("filePath");
String fileDir=request.getParameter("fileDir");
String stream = request.getParameter("fileStream");
String filePath = request.getParameter("filePath");
String fileDir = request.getParameter("fileDir");
ByteArrayInputStream bais = null;
FileOutputStream ostream = null;
try{
try {
byte buf[] = stream.getBytes("utf-8");
bais = new ByteArrayInputStream(buf);
POIFSFileSystem poifs = new POIFSFileSystem();
......@@ -413,12 +416,11 @@ public class UploadController {
directory.createDocument("WordDocument", bais);
// 文件保存地址
File uploadFilePath = new File(GConstants.FILE_UPLOAD_DIR,filePath);
if(uploadFilePath.exists())
{
File uploadFilePath = new File(GConstants.FILE_UPLOAD_DIR, filePath);
if (uploadFilePath.exists()) {
return responseBean;
}
File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR,fileDir);
File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR, fileDir);
if (!baseUploadDir.exists()) {// 如果文件夹不存在则创建
baseUploadDir.mkdirs();
}
......@@ -434,6 +436,6 @@ public class UploadController {
responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
responseBean.setMessage(GConstants.OK);
return responseBean;
}
}
......@@ -17,6 +17,7 @@ public class LoginBean extends GenericBean {
private String verifyCode;
private String permission;
private String clientip;
private String userIp;
public String getPermission() {
return permission;
......@@ -58,4 +59,11 @@ public class LoginBean extends GenericBean {
this.clientip = clientip;
}
public String getUserIp() {
return userIp;
}
public void setUserIp(String userIp) {
this.userIp = userIp;
}
}
package com.ejweb.modules.user.bean;
import java.util.Date;
/**
* 登录Ip信息
*
* @author zangtao
* @create 2019 - 09 -24 10:06
*/
public class LoginIpInfo {
private Integer id;
private String blackIp;
private Date createTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getBlackIp() {
return blackIp;
}
public void setBlackIp(String blackIp) {
this.blackIp = blackIp;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
}
......@@ -10,6 +10,7 @@ import com.ejweb.modules.user.bean.*;
import com.ejweb.modules.user.entity.*;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -101,4 +102,9 @@ public interface UserDao extends CurdDao<UserEntity> {
public void updateOuterUser(OuterUserBean bean);
List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity);
LoginIpInfo findByIp(@Param("userIp") String userIp);
void insertInfoByIp(@Param("userIp") String userIp ,@Param("date") Date date);
List<UserExport> findListUser();
}
/**
* Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.ejweb.modules.user.entity;
import com.ejweb.core.base.BaseEntity;
import java.util.Date;
/**
* 用户Entity
* @author ThinkGem
* @version 2013-12-05
*/
public class UserExport extends BaseEntity {
private static final long serialVersionUID = 1L;
private String company; // 归属公司
private String office; // 归属部门
private String loginName;// 登录名
private String password;// 密码
private String no; // 工号
private String name; // 姓名
private String email; // 邮箱
private String phone; // 电话
private String mobile; // 手机
private String mobileNubmer; // 手机
private String userType;// 用户类型
private String loginIp; // 最后登陆IP
private String loginDate; // 最后登陆日期
private String loginFlag; // 是否允许登陆
private String photo; // 头像
private String oldLoginName;// 原登录名
private String newPassword; // 新密码
public static long getSerialVersionUID() {
return serialVersionUID;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getOffice() {
return office;
}
public void setOffice(String office) {
this.office = office;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getNo() {
return no;
}
public void setNo(String no) {
this.no = no;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getMobile() {
return mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
public String getMobileNubmer() {
return mobileNubmer;
}
public void setMobileNubmer(String mobileNubmer) {
this.mobileNubmer = mobileNubmer;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getLoginIp() {
return loginIp;
}
public void setLoginIp(String loginIp) {
this.loginIp = loginIp;
}
public String getLoginDate() {
return loginDate;
}
public void setLoginDate(String loginDate) {
this.loginDate = loginDate;
}
public String getLoginFlag() {
return loginFlag;
}
public void setLoginFlag(String loginFlag) {
this.loginFlag = loginFlag;
}
public String getPhoto() {
return photo;
}
public void setPhoto(String photo) {
this.photo = photo;
}
public String getOldLoginName() {
return oldLoginName;
}
public void setOldLoginName(String oldLoginName) {
this.oldLoginName = oldLoginName;
}
public String getNewPassword() {
return newPassword;
}
public void setNewPassword(String newPassword) {
this.newPassword = newPassword;
}
}
\ No newline at end of file
package com.ejweb.modules.user.entity;
import java.util.Date;
import com.ejweb.core.base.BaseEntity;
import com.ejweb.core.conf.GConstants;
import java.util.Date;
/**
* 用户详情扩展表 对应联系人列表功能
* @author lyw
......@@ -59,7 +59,7 @@ public class UserProfileEntity extends BaseEntity {
public void setLoginFlag(String loginFlag) {
this.loginFlag = loginFlag;
}
public String getId() {
return id;
}
......
......@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -658,4 +659,23 @@ public class UserService extends CurdService<UserDao, UserEntity> {
public List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity) {
return dao.findUserLoginLogList(userLoginLogEntity);
}
/**
* 查找IP
*
* @param userIp
* @return
*/
public LoginIpInfo findByIp(String userIp) {
return dao.findByIp(userIp);
}
public void insertInfoByIp(String userIp) {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// String date = simpleDateFormat.format(new Date());
dao.insertInfoByIp(userIp,new Date());
}
public List<UserExport> findListUser() {
return dao.findListUser();
}
}
......@@ -206,6 +206,7 @@ public class AirlineVerifiedAddBean extends GenericBean {
public class Deport {
private String departId;
private String departName;
public String getDepartId() {
return departId;
......@@ -215,7 +216,13 @@ public class AirlineVerifiedAddBean extends GenericBean {
this.departId = departId;
}
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
}
public String getVerifNo() {
......
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