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 @@ ...@@ -57,7 +57,7 @@
<filter-class>com.ejweb.core.filter.BasicVerifyFilter</filter-class> <filter-class>com.ejweb.core.filter.BasicVerifyFilter</filter-class>
<init-param> <init-param>
<param-name>excludedPages</param-name> <param-name>excludedPages</param-name>
<param-value>*</param-value> <param-value>/api/user/login;/api/call/findPhoneInfo</param-value>
</init-param> </init-param>
</filter> </filter>
<filter-mapping> <filter-mapping>
......
...@@ -67,7 +67,7 @@ seat.default.photo=images/user/avatar/seat_avatar.png ...@@ -67,7 +67,7 @@ seat.default.photo=images/user/avatar/seat_avatar.png
# Sign Private Key(Default FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn) # Sign Private Key(Default FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn)
content.sign.private.key=FvNMhdkN5eTsgAfU2YHGJ2RfpKVi3omn 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=true
# \u9996\u822A\u63A5\u53E3\u57FA\u672C\u5730\u5740 # \u9996\u822A\u63A5\u53E3\u57FA\u672C\u5730\u5740
jdair.api.base.url=https://dsp.jdair.net 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
......
...@@ -3,9 +3,9 @@ db.table.prefix=foc_ ...@@ -3,9 +3,9 @@ db.table.prefix=foc_
jdbc.type=mysql jdbc.type=mysql
jdbc.driver.class=com.mysql.jdbc.Driver 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.url=jdbc:mysql://106.75.105.96:5508/jd_foc?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull
jdbc.username=focuser jdbc.username=sms_develop
jdbc.password=FOC@2016 jdbc.password=Develop2018!@#
#\u521d\u59cb\u5316\u8fde\u63a5 #\u521d\u59cb\u5316\u8fde\u63a5
jdbc.initialSize=0 jdbc.initialSize=0
......
...@@ -93,4 +93,70 @@ ...@@ -93,4 +93,70 @@
ORDER BY ata_chn DESC ORDER BY ata_chn DESC
LIMIT 1 LIMIT 1
</select> </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> </mapper>
\ No newline at end of file
...@@ -46,5 +46,27 @@ ...@@ -46,5 +46,27 @@
AND verif_id=#{verifId} AND verif_id=#{verifId}
</if> </if>
</select> </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> </mapper>
\ No newline at end of file
...@@ -33,8 +33,8 @@ ...@@ -33,8 +33,8 @@
status, status,
s.create_by, s.create_by,
s.create_date, s.create_date,
update_by, s.update_by,
update_date, s.update_date,
s.remarks, s.remarks,
url, url,
is_complete, is_complete,
...@@ -43,9 +43,11 @@ ...@@ -43,9 +43,11 @@
foc_notify s foc_notify s
LEFT JOIN foc_verify_record r 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) 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 WHERE
s.del_flag =#{DEL_FLAG_NORMAL} s.del_flag =#{DEL_FLAG_NORMAL}
AND a.verif_status!= '01'
AND a.verif_status!= '02'
AND s.depart_id = #{departId} AND s.depart_id = #{departId}
AND (s.type AND (s.type
IN ( IN (
......
...@@ -904,4 +904,36 @@ ...@@ -904,4 +904,36 @@
</if> </if>
ORDER BY r.login_date DESC ORDER BY r.login_date DESC
</select> </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> </mapper>
\ No newline at end of file
...@@ -36,5 +36,7 @@ ...@@ -36,5 +36,7 @@
<!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 --> <!-- 设置但JDBC类型为空时,某些驱动程序 要指定值,default:OTHER,插入空值时不需要指定类型 -->
<setting name="jdbcTypeForNull" value="NULL"/> <setting name="jdbcTypeForNull" value="NULL"/>
<!--打印sql-->
<!--<setting name="logImpl" value="STDOUT_LOGGING"/>-->
</settings> </settings>
</configuration> </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 @@ ...@@ -32,6 +32,7 @@
<list> <list>
<value>classpath:jdbc.properties</value> <value>classpath:jdbc.properties</value>
<value>classpath:ejweb.properties</value> <value>classpath:ejweb.properties</value>
<value>classpath:redis.properties</value>
</list> </list>
</property> </property>
</bean> </bean>
...@@ -141,4 +142,20 @@ ...@@ -141,4 +142,20 @@
<bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"> <bean id="validator" class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean">
<property name="providerClass" value="org.hibernate.validator.HibernateValidator"/> <property name="providerClass" value="org.hibernate.validator.HibernateValidator"/>
</bean> </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> </beans>
\ No newline at end of file
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
<list> <list>
<value>classpath:jdbc.properties</value> <value>classpath:jdbc.properties</value>
<value>classpath:ejweb.properties</value> <value>classpath:ejweb.properties</value>
<value>classpath:redis.properties</value>
</list> </list>
</property> </property>
</bean> </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 ...@@ -79,6 +79,7 @@ public class SecurityPropertyPlaceholderConfigurer extends PropertyPlaceholderCo
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(DES3Utils.encrypt("foctest", CONF_DESC_KEY)); 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 { ...@@ -54,17 +54,12 @@ public class ErrorHandler {
valueStr = (i == values.length - 1) ? valueStr + values[i] valueStr = (i == values.length - 1) ? valueStr + values[i]
: valueStr + values[i] + ","; : valueStr + values[i] + ",";
} }
//乱码解决,这段代码在出现乱码时使用。如果mysign和sign不相等也可以使用这段代码转化
// valueStr = new String(valueStr.getBytes("ISO-8859-1"), "UTF-8");
buf.append(" "+name+":"+valueStr+"\n"); buf.append(" "+name+":"+valueStr+"\n");
} }
String clientip = Util.getOnlineIP(request); String clientip = Util.getOnlineIP(request);
String uri = request.getRequestURI(); String uri = request.getRequestURI();
EmailStackTraceHandler.getInstance().sendEmail("系统异常", "Request IP: "+clientip+"\nRequest URI: "+uri+"\nParameter Map: \n"+buf.toString()+"\nStack Trace: \n"+error); 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) { } catch (Exception e2) {
// TODO: handle exception // TODO: handle exception
} }
......
package com.ejweb.core.fetcher; package com.ejweb.core.fetcher;
import java.util.ArrayList; import com.alibaba.fastjson.JSON;
import java.util.HashMap; import com.alibaba.fastjson.JSONObject;
import java.util.Iterator; import com.ejweb.core.conf.GConstants;
import java.util.List; import com.ejweb.core.security.GlobalUtil;
import java.util.Map;
import java.util.Map.Entry;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpEntity; import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.CloseableHttpClient; 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.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair; import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils; import org.apache.http.util.EntityUtils;
import com.alibaba.fastjson.JSON; import java.util.*;
import com.alibaba.fastjson.JSONObject; import java.util.Map.Entry;
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请求的工具类 * 利用HttpClient进行post请求的工具类
*/ */
public class HttpClientUtil { public class HttpClientUtil {
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public static String doPost(String url,Map<String,String> map,String charset){ public static String doPost(String url, Map<String, String> map, String charset) {
CloseableHttpClient httpClient = null; CloseableHttpClient httpClient = null;
HttpPost httpPost = null; HttpPost httpPost = null;
String result = null; String result = null;
try{ try {
// httpClient = new DefaultHttpClient(); // httpClient = new DefaultHttpClient();
httpClient = HttpClients.createDefault(); httpClient = HttpClients.createDefault();
httpPost = new HttpPost(url); httpPost = new HttpPost(url);
...@@ -43,28 +34,28 @@ public class HttpClientUtil { ...@@ -43,28 +34,28 @@ public class HttpClientUtil {
//设置参数 //设置参数
List<NameValuePair> list = new ArrayList<NameValuePair>(); List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = map.entrySet().iterator(); Iterator iterator = map.entrySet().iterator();
while(iterator.hasNext()){ while (iterator.hasNext()) {
Entry<String,String> elem = (Entry<String, String>) iterator.next(); Entry<String, String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(),elem.getValue())); list.add(new BasicNameValuePair(elem.getKey(), elem.getValue()));
} }
if(list.size() > 0){ if (list.size() > 0) {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list,charset); UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset);
httpPost.setEntity(entity); httpPost.setEntity(entity);
} }
HttpResponse response = httpClient.execute(httpPost); HttpResponse response = httpClient.execute(httpPost);
if(response != null){ if (response != null) {
HttpEntity resEntity = response.getEntity(); HttpEntity resEntity = response.getEntity();
if(resEntity != null){ if (resEntity != null) {
result = EntityUtils.toString(resEntity,charset); result = EntityUtils.toString(resEntity, charset);
} }
} }
}catch(Exception ex){ } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }
return result; return result;
} }
public static void main(String[] args){ public static void main(String[] args) {
try { try {
// StringBuilder url = new StringBuilder("https://ewatch.okayapps.com/faq/api/user/login"); // StringBuilder url = new StringBuilder("https://ewatch.okayapps.com/faq/api/user/login");
......
...@@ -4,6 +4,8 @@ import javax.crypto.Mac; ...@@ -4,6 +4,8 @@ import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec; import javax.crypto.spec.SecretKeySpec;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class GlobalUtil { public class GlobalUtil {
...@@ -16,7 +18,20 @@ public class GlobalUtil { ...@@ -16,7 +18,20 @@ public class GlobalUtil {
public static boolean verify(String data, String privateKey, String sign) { public static boolean verify(String data, String privateKey, String sign) {
try { try {
String mSign = getParamsSignStr(privateKey, data); 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; return true;
mSign = URLDecoder.decode(mSign, "UTF-8"); mSign = URLDecoder.decode(mSign, "UTF-8");
return mSign.equals(sign); return mSign.equals(sign);
...@@ -35,7 +50,24 @@ public class GlobalUtil { ...@@ -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) { public static String getParamsSignStr(String key, String paramsStr) {
if (key == null || paramsStr == null) { if (key == null || paramsStr == null) {
...@@ -54,10 +86,8 @@ public class GlobalUtil { ...@@ -54,10 +86,8 @@ public class GlobalUtil {
/** /**
* HMACSHA1加密 * HMACSHA1加密
* *
* @param key * @param key 加密使用的key
* 加密使用的key * @param strByte 待加密的数据
* @param strByte
* 待加密的数据
* @return 生成MD5编码的字符串 * @return 生成MD5编码的字符串
*/ */
...@@ -80,14 +110,55 @@ public class GlobalUtil { ...@@ -80,14 +110,55 @@ public class GlobalUtil {
* base64加密 * base64加密
*/ */
public static String base64(byte[] val) { public static String base64(byte[] val) {
if (val == null) if (val == null) {
return null; return null;
else } else {
return Base64.encode(val); return Base64.encode(val);
} }
}
public static void main(String[] args) { /**
*     * 利用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 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 sign = GlobalUtil.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,14 +3,14 @@ ...@@ -3,14 +3,14 @@
*/ */
package com.ejweb.core.util; package com.ejweb.core.util;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils;
/** /**
* 时间计算工具类 * 时间计算工具类
* *
...@@ -64,12 +64,12 @@ public class TimeUtils { ...@@ -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};
/** /**
* 默认的字符串格式时间分隔符 * 默认的字符串格式时间分隔符
...@@ -91,10 +91,8 @@ public class TimeUtils { ...@@ -91,10 +91,8 @@ public class TimeUtils {
/** /**
* 使用时、分构造一个时间 * 使用时、分构造一个时间
* *
* @param hour * @param hour 小时
* 小时 * @param minute 分钟
* @param minute
* 分钟
*/ */
public TimeUtils(int hour, int minute) { public TimeUtils(int hour, int minute) {
this(0, hour, minute, 0); this(0, hour, minute, 0);
...@@ -103,12 +101,9 @@ public class TimeUtils { ...@@ -103,12 +101,9 @@ public class TimeUtils {
/** /**
* 使用时、分、秒构造一个时间 * 使用时、分、秒构造一个时间
* *
* @param hour * @param hour 小时
* 小时 * @param minute 分钟
* @param minute * @param second 秒
* 分钟
* @param second
* 秒
*/ */
public TimeUtils(int hour, int minute, int second) { public TimeUtils(int hour, int minute, int second) {
this(0, hour, minute, second); this(0, hour, minute, second);
...@@ -118,8 +113,7 @@ public class TimeUtils { ...@@ -118,8 +113,7 @@ public class TimeUtils {
* 使用一个字符串构造时间<br/> * 使用一个字符串构造时间<br/>
* Time time = new Time("14:22:23"); * Time time = new Time("14:22:23");
* *
* @param time * @param time 字符串格式的时间,默认采用“:”作为分隔符
* 字符串格式的时间,默认采用“:”作为分隔符
*/ */
public TimeUtils(String time) { public TimeUtils(String time) {
this(time, null); this(time, null);
...@@ -147,14 +141,10 @@ public class TimeUtils { ...@@ -147,14 +141,10 @@ public class TimeUtils {
/** /**
* 使用天、时、分、秒构造时间,进行全字符的构造 * 使用天、时、分、秒构造时间,进行全字符的构造
* *
* @param day * @param day 天
* 天 * @param hour 时
* @param hour * @param minute 分
* 时 * @param second 秒
* @param minute
* 分
* @param second
* 秒
*/ */
public TimeUtils(int day, int hour, int minute, int second) { public TimeUtils(int day, int hour, int minute, int second) {
initialize(day, hour, minute, second); initialize(day, hour, minute, second);
...@@ -164,8 +154,7 @@ public class TimeUtils { ...@@ -164,8 +154,7 @@ public class TimeUtils {
* 使用一个字符串构造时间,指定分隔符<br/> * 使用一个字符串构造时间,指定分隔符<br/>
* Time time = new Time("14-22-23", "-"); * Time time = new Time("14-22-23", "-");
* *
* @param time * @param time 字符串格式的时间
* 字符串格式的时间
*/ */
public TimeUtils(String time, String timeSeparator) { public TimeUtils(String time, String timeSeparator) {
if (timeSeparator != null) { if (timeSeparator != null) {
...@@ -177,10 +166,8 @@ public class TimeUtils { ...@@ -177,10 +166,8 @@ public class TimeUtils {
/** /**
* 设置时间字段的值 * 设置时间字段的值
* *
* @param field * @param field 时间字段常量
* 时间字段常量 * @param value 时间字段的值
* @param value
* 时间字段的值
*/ */
public void set(int field, int value) { public void set(int field, int value) {
if (value < minFields[field]) { if (value < minFields[field]) {
...@@ -198,8 +185,7 @@ public class TimeUtils { ...@@ -198,8 +185,7 @@ public class TimeUtils {
/** /**
* 获得时间字段的值 * 获得时间字段的值
* *
* @param field * @param field 时间字段常量
* 时间字段常量
* @return 该时间字段的值 * @return 该时间字段的值
*/ */
public int get(int field) { public int get(int field) {
...@@ -212,8 +198,7 @@ public class TimeUtils { ...@@ -212,8 +198,7 @@ public class TimeUtils {
/** /**
* 将时间进行“加”运算,即加上一个时间 * 将时间进行“加”运算,即加上一个时间
* *
* @param time * @param time 需要加的时间
* 需要加的时间
* @return 运算后的时间 * @return 运算后的时间
*/ */
public TimeUtils addTime(TimeUtils time) { public TimeUtils addTime(TimeUtils time) {
...@@ -230,8 +215,7 @@ public class TimeUtils { ...@@ -230,8 +215,7 @@ public class TimeUtils {
/** /**
* 将时间进行“减”运算,即减去一个时间 * 将时间进行“减”运算,即减去一个时间
* *
* @param time * @param time 需要减的时间
* 需要减的时间
* @return 运算后的时间 * @return 运算后的时间
*/ */
public TimeUtils subtractTime(TimeUtils time) { public TimeUtils subtractTime(TimeUtils time) {
...@@ -264,8 +248,7 @@ public class TimeUtils { ...@@ -264,8 +248,7 @@ public class TimeUtils {
/** /**
* 设置时间字段的分隔符(用于字符串格式的时间) * 设置时间字段的分隔符(用于字符串格式的时间)
* *
* @param timeSeparator * @param timeSeparator 分隔符字符串
* 分隔符字符串
*/ */
public void setTimeSeparator(String timeSeparator) { public void setTimeSeparator(String timeSeparator) {
this.timeSeparator = timeSeparator; this.timeSeparator = timeSeparator;
...@@ -320,13 +303,14 @@ public class TimeUtils { ...@@ -320,13 +303,14 @@ public class TimeUtils {
/** /**
* 获取今天是星期几 * 获取今天是星期几
* @author huhy *
* @time 2016年11月24日
* @param dt * @param dt
* @return * @return
* @author huhy
* @time 2016年11月24日
*/ */
public static String getWeekOfDate(Date dt) { public static String getWeekOfDate(Date dt) {
String[] weekDays = {"星期日","星期一", "星期二", "星期三", "星期四", "星期五", "星期六"}; String[] weekDays = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.setTime(dt); cal.setTime(dt);
int w = cal.get(Calendar.DAY_OF_WEEK) - 1; int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
...@@ -338,10 +322,10 @@ public class TimeUtils { ...@@ -338,10 +322,10 @@ public class TimeUtils {
/** /**
* 获取前后日期 i为正数 向后推迟i天,负数时向前提前i天 * 获取前后日期 i为正数 向后推迟i天,负数时向前提前i天
* *
* @author huhy
* @time 2016年11月24日
* @param i * @param i
* @return * @return
* @author huhy
* @time 2016年11月24日
*/ */
public static Date getdate(int i) { public static Date getdate(int i) {
Date dat = null; Date dat = null;
...@@ -390,4 +374,14 @@ public class TimeUtils { ...@@ -390,4 +374,14 @@ public class TimeUtils {
return true; 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{ ...@@ -53,7 +53,8 @@ public class StatisticalController{
if(message == null){ if(message == null){
// 参数校验为通过 // 参数校验为通过
PageEntity<StatisticalEntity> list = statisticalService.getStatisticalList(bean); PageEntity<StatisticalEntity> list = statisticalService.getStatisticalList(bean);
if(list == null){// 查询结果为空 // 查询结果为空
if (list == null) {
responseBean.setMessage(GConstants.EMPTY); responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001); responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean; return responseBean;
......
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
*/ */
package com.ejweb.modules.airport.dao; package com.ejweb.modules.airport.dao;
import java.util.List;
import com.ejweb.core.base.BaseDao; import com.ejweb.core.base.BaseDao;
import com.ejweb.modules.airport.bean.StatisticalBean; import com.ejweb.modules.airport.bean.StatisticalBean;
import com.ejweb.modules.airport.entity.StatisticalEntity; import com.ejweb.modules.airport.entity.StatisticalEntity;
import java.util.List;
/** /**
* *
* @team suzhou * @team suzhou
...@@ -19,5 +19,6 @@ import com.ejweb.modules.airport.entity.StatisticalEntity; ...@@ -19,5 +19,6 @@ import com.ejweb.modules.airport.entity.StatisticalEntity;
public interface StatisticalDao extends BaseDao{ public interface StatisticalDao extends BaseDao{
List<StatisticalEntity> getStatisticalList(StatisticalBean bean); List<StatisticalEntity> getStatisticalList(StatisticalBean bean);
List<StatisticalEntity> getStatisticalArrIataList(StatisticalBean bean);
Integer getDay(StatisticalEntity entity); Integer getDay(StatisticalEntity entity);
} }
...@@ -14,9 +14,12 @@ import com.ejweb.modules.verify.dao.AirlineVerifyDao; ...@@ -14,9 +14,12 @@ import com.ejweb.modules.verify.dao.AirlineVerifyDao;
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.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
...@@ -27,6 +30,7 @@ import java.util.List; ...@@ -27,6 +30,7 @@ import java.util.List;
*/ */
@Service @Service
public class StatisticalService extends BaseService<StatisticalDao> { public class StatisticalService extends BaseService<StatisticalDao> {
private final static Logger LOG = Logger.getLogger(StatisticalService.class);
@Autowired @Autowired
private AirlineVerifiedDao airlineVerifiedDao; private AirlineVerifiedDao airlineVerifiedDao;
...@@ -41,24 +45,49 @@ public class StatisticalService extends BaseService<StatisticalDao> { ...@@ -41,24 +45,49 @@ public class StatisticalService extends BaseService<StatisticalDao> {
abean.setUserCode(bean.getUserCode()); abean.setUserCode(bean.getUserCode());
if (StringUtils.isEmpty(bean.getSort())) { if (StringUtils.isEmpty(bean.getSort())) {
PageHelper.orderBy("source,routeNo DESC"); PageHelper.orderBy("source,routeNo DESC");
} else } else {
PageHelper.orderBy("source," + bean.getSort()); 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); String departId = airlineVerifiedDao.findDepartId(abean);
for (StatisticalEntity e : lists) { for (StatisticalEntity e : lists) {
String typelist = verifdao.getTypeList1(e.getVerifId()); String typelist = verifdao.getTypeList1(e.getVerifId());
if (StringUtils.isNoneBlank(typelist)) if (StringUtils.isNoneBlank(typelist)) {
e.setTypeName(e.getTypeName() + ":" + typelist); e.setTypeName(e.getTypeName() + ":" + typelist);
}
e.setTypeList(verifdao.getTypeList(e.getVerifId())); e.setTypeList(verifdao.getTypeList(e.getVerifId()));
if (departId.equals(e.getDepartId())) if (departId.equals(e.getDepartId())) {
e.setReStart(true); e.setReStart(true);
else } else {
e.setReStart(false); 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()) if ("06".equals(e.getVerifType()) || "07".equals(e.getVerifType())
|| "08".equals(e.getVerifType())) { || "08".equals(e.getVerifType())) {
e.setExpiryDate("长期有效"); e.setExpiryDate("长期有效");
} else { } else if (!"05".equals(e.getVerifType())) {
Integer day = dao.getDay(e); Integer day = dao.getDay(e);
if (day != null) { if (day != null) {
if (day > 180 && Integer.parseInt(e.getExpiryDate()) > 180) { if (day > 180 && Integer.parseInt(e.getExpiryDate()) > 180) {
......
package com.ejweb.modules.depart.api; 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.RequestBean;
import com.ejweb.core.api.ResponseBean; import com.ejweb.core.api.ResponseBean;
import com.ejweb.core.conf.ErrorCode; import com.ejweb.core.conf.ErrorCode;
import com.ejweb.core.conf.GConstants; import com.ejweb.core.conf.GConstants;
import com.ejweb.modules.depart.bean.DepartBean; 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.DepartEntity;
import com.ejweb.modules.depart.entity.DepartTypeEntity;
import com.ejweb.modules.depart.service.DepartService; 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 * Airport Controller
*
* @author zhanglg * @author zhanglg
* @version 2016-8-23 * @version 2016-8-23
*/ */
@Controller @Controller
@RequestMapping(value = "/api/depart") @RequestMapping(value = "/api/depart")
public class DepartController{ public class DepartController {
@Autowired @Autowired
private DepartService departService; private DepartService departService;
@ResponseBody @ResponseBody
@RequestMapping(value = "list") @RequestMapping(value = "list")
public ResponseBean list(RequestBean requestBean,BindingResult errors) { public ResponseBean list(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class); DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors); String message = departService.validate(bean, errors);
if(message == null){// 通过参数校验 if (message == null) {// 通过参数校验
List<DepartEntity> list = departService.findAllList(bean.getIsVerif()); List<DepartEntity> list = departService.findAllList(bean.getIsVerif());
if(list == null){// 数据为空 if (list == null) {// 数据为空
responseBean.setMessage(GConstants.EMPTY); responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001); responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean; return responseBean;
...@@ -51,15 +53,16 @@ public class DepartController{ ...@@ -51,15 +53,16 @@ public class DepartController{
responseBean.setStatus(ErrorCode.STATUS_CODE_4001); responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean; return responseBean;
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "risklist") @RequestMapping(value = "risklist")
public ResponseBean risklist(RequestBean requestBean,BindingResult errors) { public ResponseBean risklist(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class); DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors); String message = departService.validate(bean, errors);
if(message == null){// 通过参数校验 if (message == null) {// 通过参数校验
List<DepartEntity> list = departService.findRiskList(bean); List<DepartEntity> list = departService.findRiskList(bean);
if(list == null){// 数据为空 if (list == null) {// 数据为空
responseBean.setMessage(GConstants.EMPTY); responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001); responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean; return responseBean;
...@@ -72,19 +75,20 @@ public class DepartController{ ...@@ -72,19 +75,20 @@ public class DepartController{
responseBean.setStatus(ErrorCode.STATUS_CODE_4001); responseBean.setStatus(ErrorCode.STATUS_CODE_4001);
return responseBean; return responseBean;
} }
@ResponseBody @ResponseBody
@RequestMapping(value = "getByuserCode") @RequestMapping(value = "getByuserCode")
public ResponseBean getByUserCode(RequestBean requestBean,BindingResult errors){ public ResponseBean getByUserCode(RequestBean requestBean, BindingResult errors) {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
DepartBean bean = requestBean.getObjectBean(DepartBean.class); DepartBean bean = requestBean.getObjectBean(DepartBean.class);
String message = departService.validate(bean,errors); String message = departService.validate(bean, errors);
if(message == null){// 通过参数校验 if (message == null) {// 通过参数校验
DepartEntity entity= departService.getByUserCode(bean.getUserCode()); DepartEntity entity = departService.getByUserCode(bean.getUserCode());
if(entity == null){// 查询结果为空 if (entity == null) {// 查询结果为空
responseBean.setMessage(GConstants.EMPTY); responseBean.setMessage(GConstants.EMPTY);
responseBean.setStatus(ErrorCode.STATUS_CODE_2001); responseBean.setStatus(ErrorCode.STATUS_CODE_2001);
return responseBean; return responseBean;
}else{ } else {
responseBean.setData(entity); responseBean.setData(entity);
responseBean.setMessage(GConstants.OK); responseBean.setMessage(GConstants.OK);
responseBean.setStatus(ErrorCode.STATUS_CODE_2000); responseBean.setStatus(ErrorCode.STATUS_CODE_2000);
...@@ -96,4 +100,28 @@ public class DepartController{ ...@@ -96,4 +100,28 @@ public class DepartController{
return responseBean; 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; 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.core.base.BaseDao;
import com.ejweb.modules.depart.bean.DepartBean; import com.ejweb.modules.depart.bean.DepartBean;
import com.ejweb.modules.depart.entity.DepartEntity; 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{ ...@@ -19,4 +19,6 @@ public interface DepartDao extends BaseDao{
public List<DepartEntity> findAllList(DepartEntity departEntity); public List<DepartEntity> findAllList(DepartEntity departEntity);
public DepartEntity getByUserCode(@Param(value="userCode") String userCode); public DepartEntity getByUserCode(@Param(value="userCode") String userCode);
public List<DepartEntity> findRiskList(DepartBean bean); 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; 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.core.base.BaseService;
import com.ejweb.modules.depart.bean.DepartBean; 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.dao.DepartDao;
import com.ejweb.modules.depart.entity.DepartEntity; 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 * Depart Service
...@@ -39,5 +40,22 @@ public class DepartService extends BaseService<DepartDao> { ...@@ -39,5 +40,22 @@ public class DepartService extends BaseService<DepartDao> {
return departDao.findRiskList(bean); 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; ...@@ -36,7 +36,7 @@ import java.util.List;
* @time 2016年9月23日 * @time 2016年9月23日
*/ */
@Service @Service
@Transactional(readOnly = true, rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public class ShortMessageService extends BaseService<ShortMessageDao> { public class ShortMessageService extends BaseService<ShortMessageDao> {
private final static Logger logger = Logger.getLogger(ShortMessageService.class); private final static Logger logger = Logger.getLogger(ShortMessageService.class);
...@@ -64,7 +64,8 @@ public class ShortMessageService extends BaseService<ShortMessageDao> { ...@@ -64,7 +64,8 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
} }
builder.append(phones[i].replaceAll("^0+", "")); builder.append(phones[i].replaceAll("^0+", ""));
} }
phone = builder.toString(); //电话号码去除空格,否则导致发送失败
phone = builder.toString().trim();
if (StringUtils.isEmpty(phone)) { if (StringUtils.isEmpty(phone)) {
return false; return false;
} }
...@@ -79,6 +80,7 @@ public class ShortMessageService extends BaseService<ShortMessageDao> { ...@@ -79,6 +80,7 @@ public class ShortMessageService extends BaseService<ShortMessageDao> {
String resultCode = result.getJSONObject("result").getString("resultCode"); String resultCode = result.getJSONObject("result").getString("resultCode");
// 判断 调用接口是否成功 // 判断 调用接口是否成功
if ("1000".equals(resultCode)) { if ("1000".equals(resultCode)) {
logger.info("短信发送成功:" + result.toJSONString());
SmsRecordEntity record = new SmsRecordEntity(); SmsRecordEntity record = new SmsRecordEntity();
record.setClientip(bean.getClientip()); record.setClientip(bean.getClientip());
record.setCreateTime(new Date()); record.setCreateTime(new Date());
......
...@@ -4,6 +4,7 @@ import java.util.Date; ...@@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -33,6 +34,7 @@ import com.github.pagehelper.PageHelper; ...@@ -33,6 +34,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@Service @Service
public class NotifyService extends BaseService<NotifyDao> { public class NotifyService extends BaseService<NotifyDao> {
private final static Logger LOG = Logger.getLogger(NotifyService.class);
@Autowired @Autowired
AirlineVerifyDao verifyDao; AirlineVerifyDao verifyDao;
@Autowired @Autowired
...@@ -44,7 +46,6 @@ public class NotifyService extends BaseService<NotifyDao> { ...@@ -44,7 +46,6 @@ public class NotifyService extends BaseService<NotifyDao> {
* *
* @author renmb * @author renmb
* @time 2016年8月27日 * @time 2016年8月27日
* @param bean
* @return * @return
*/ */
public Integer addNotifyRecord(String notifyId, String userId, String readFlag){ public Integer addNotifyRecord(String notifyId, String userId, String readFlag){
...@@ -63,7 +64,7 @@ public class NotifyService extends BaseService<NotifyDao> { ...@@ -63,7 +64,7 @@ public class NotifyService extends BaseService<NotifyDao> {
PageEntity<NotifyListEntity> page = new PageEntity<NotifyListEntity>(); PageEntity<NotifyListEntity> page = new PageEntity<NotifyListEntity>();
page.setPageNo(bean.getPageNo()); page.setPageNo(bean.getPageNo());
page.setPageSize(bean.getPageSize()); page.setPageSize(bean.getPageSize());
LOG.info("用户userCode:" + bean.getUserCode());
bean.setDepartId(departDao.getByUserCode(bean.getUserCode()).getId()); bean.setDepartId(departDao.getByUserCode(bean.getUserCode()).getId());
bean.setPermissionList(dao.permissionList(bean.getUserCode())); bean.setPermissionList(dao.permissionList(bean.getUserCode()));
......
package com.ejweb.modules.route.bean; package com.ejweb.modules.route.bean;
import java.util.List; import com.ejweb.core.base.GenericBean;
import java.util.Map;
import org.hibernate.validator.constraints.NotEmpty; 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 { public class VerifyStatusBean extends GenericBean {
......
...@@ -39,6 +39,7 @@ import com.github.pagehelper.PageHelper; ...@@ -39,6 +39,7 @@ import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import freemarker.template.TemplateException; import freemarker.template.TemplateException;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -63,6 +64,8 @@ import java.util.regex.Pattern; ...@@ -63,6 +64,8 @@ import java.util.regex.Pattern;
*/ */
@Service @Service
public class SailingCommandService extends CurdService<SailingCommandDao, SailingCommandEntity> { public class SailingCommandService extends CurdService<SailingCommandDao, SailingCommandEntity> {
private final static Logger LOG = Logger.getLogger(SailingCommandService.class);
@Autowired @Autowired
private AirlineVerifyDao verifyDao; private AirlineVerifyDao verifyDao;
@Autowired @Autowired
...@@ -370,11 +373,7 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin ...@@ -370,11 +373,7 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
if ("01".equals(CommandStatus) && "01".equals(bean.getCommandStatus())) { if ("01".equals(CommandStatus) && "01".equals(bean.getCommandStatus())) {
return false; 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())) { if (!"00".equals(bean.getCommandStatus())) {
// 该input标签不一定以 / 结尾 // 该input标签不一定以 / 结尾
Pattern pattern = Pattern.compile("(?<=routeNo\" value=\")(.+?)(?=\"/?>)"); Pattern pattern = Pattern.compile("(?<=routeNo\" value=\")(.+?)(?=\"/?>)");
...@@ -394,7 +393,6 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin ...@@ -394,7 +393,6 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
bean.setRouteNo(routeNo); bean.setRouteNo(routeNo);
// if(bean.getFormText()!=null&&!"".equals(bean.getFormText())){ // if(bean.getFormText()!=null&&!"".equals(bean.getFormText())){
try {
// 完成审核通知置灰 // 完成审核通知置灰
NotifyAddBean addbean = new NotifyAddBean(); NotifyAddBean addbean = new NotifyAddBean();
addbean.setVerifId(bean.getVerifId()); addbean.setVerifId(bean.getVerifId());
...@@ -595,42 +593,46 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin ...@@ -595,42 +593,46 @@ public class SailingCommandService extends CurdService<SailingCommandDao, Sailin
sailingFileBean.setCreateBy(bean.getUserCode()); sailingFileBean.setCreateBy(bean.getUserCode());
//dao.deleteSailingFile(sailingFileBean); //dao.deleteSailingFile(sailingFileBean);
dao.insertSailingFile(sailingFileBean); dao.insertSailingFile(sailingFileBean);
} catch (Exception e) { LOG.info("添加开航指令文件完成");
// TODO: handle exception
}
dao.updateAirlineverify(bean); dao.updateAirlineverify(bean);
LOG.info("更新开航指令绑定完成");
// 获取论证全部参与部门 // 获取论证全部参与部门
List<String> lst = dao.getVerifDeparts(bean.getVerifId()); List<String> lst = dao.getVerifDeparts(bean.getVerifId());
for (String departId : lst) { for (String departId : lst) {
NotifyAddBean addbean = new NotifyAddBean(); NotifyAddBean addbean1 = new NotifyAddBean();
StringBuffer sb = new StringBuffer(); 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("的航线已生成开航指令。"); .append(map1.get("verifType")).append(map1.get("depName")).append("的航线已生成开航指令。");
StringBuffer url = new StringBuffer(); StringBuffer url = new StringBuffer();
url.append("<<<a href='airway-argument-details.htm?verifId=").append(bean.getVerifId()); url.append("<<<a href='airway-argument-details.htm?verifId=").append(bean.getVerifId());
url.append("&verifNo=").append(map1.get("verifNo")); url.append("&verifNo=").append(map1.get("verifNo"));
url.append("&sailingDate=").append(map1.get("startTime")); url.append("&sailingDate=").append(map1.get("startTime"));
url.append("'>点击查看</a>"); url.append("'>点击查看</a>");
addbean.setUrl(url.toString()); addbean1.setUrl(url.toString());
addbean.setType("14"); addbean1.setType("14");
addbean.setContent(sb.toString()); addbean1.setContent(sbContent.toString());
addbean.setTitle("开航指令下发完成提醒"); addbean1.setTitle("开航指令下发完成提醒");
addbean.setCreateBy(bean.getUserCode()); addbean1.setCreateBy(bean.getUserCode());
addbean.setUpdateBy(bean.getUserCode()); addbean1.setUpdateBy(bean.getUserCode());
addbean.setCreateDate(new Date()); addbean1.setCreateDate(new Date());
addbean.setUpdateDate(new Date()); addbean1.setUpdateDate(new Date());
addbean.setId(IdWorker.getNextId()); addbean1.setId(IdWorker.getNextId());
addbean.setDepartId(departId); addbean1.setDepartId(departId);
addbean.setVerifId(bean.getVerifId()); addbean1.setVerifId(bean.getVerifId());
addbean.setConId(bean.getVerifId()); addbean1.setConId(bean.getVerifId());
notifyDao.saveNotify(addbean); notifyDao.saveNotify(addbean1);
} }
} }
dao.updateSailingCommand(bean); 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; return true;
} }
......
...@@ -38,11 +38,10 @@ import java.util.List; ...@@ -38,11 +38,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @team IT Team
* @author renmb * @author renmb
* @version 1.0 * @version 1.0
* @team IT Team
* @time 2016-03-22 * @time 2016-03-22
*
*/ */
@Controller @Controller
@RequestMapping(value = "/api/upload") @RequestMapping(value = "/api/upload")
...@@ -55,11 +54,11 @@ public class UploadController { ...@@ -55,11 +54,11 @@ public class UploadController {
/** /**
* 使用BASE64上传文件 * 使用BASE64上传文件
* *
* @author renmb
* @time 2016年11月1日
* @param request * @param request
* @param requestBean * @param requestBean
* @return * @return
* @author renmb
* @time 2016年11月1日
*/ */
@ResponseBody @ResponseBody
@RequestMapping("/base64") @RequestMapping("/base64")
...@@ -284,7 +283,11 @@ public class UploadController { ...@@ -284,7 +283,11 @@ public class UploadController {
InputStream in = null; InputStream in = null;
OutputStream out = null; OutputStream out = null;
try { try {
if (bean.getPath() != null) {
if (bean.getPath().indexOf("../") != -1) {
return;
}
}
// 设置文件MIME类型 // 设置文件MIME类型
response.setContentType("application/form-data;charset=utf-8"); response.setContentType("application/form-data;charset=utf-8");
// String downloadFileName=Encodes.urlEncode(bean.getName()); // String downloadFileName=Encodes.urlEncode(bean.getName());
...@@ -302,8 +305,8 @@ public class UploadController { ...@@ -302,8 +305,8 @@ public class UploadController {
// 获取目标文件的绝对路径 // 获取目标文件的绝对路径
// String fullFileName = GConstants.FILE_UPLOAD_DIR + bean.getPath(); // String fullFileName = GConstants.FILE_UPLOAD_DIR + bean.getPath();
File downloadFile = new File(GConstants.FILE_UPLOAD_DIR, bean.getPath()); File downloadFile = new File(GConstants.FILE_UPLOAD_DIR, bean.getPath());
LOG.error("文件下载地址:"+downloadFile.getAbsolutePath()); LOG.error("文件下载地址:" + downloadFile.getAbsolutePath());
System.out.println("文件下载地址:"+downloadFile.getAbsolutePath()); System.out.println("文件下载地址:" + downloadFile.getAbsolutePath());
// 读取文件 // 读取文件
in = new FileInputStream(downloadFile); in = new FileInputStream(downloadFile);
out = response.getOutputStream(); out = response.getOutputStream();
...@@ -324,7 +327,7 @@ public class UploadController { ...@@ -324,7 +327,7 @@ public class UploadController {
} }
} }
// public static String GetImageStr(String imgFile) // public static String GetImageStr(String imgFile)
// {//将图片文件转化为字节数组字符串,并对其进行Base64编码处理 // {//将图片文件转化为字节数组字符串,并对其进行Base64编码处理
//// String imgFile = "d://test.jpg";//待处理的图片 //// String imgFile = "d://test.jpg";//待处理的图片
// InputStream in = null; // InputStream in = null;
...@@ -400,12 +403,12 @@ public class UploadController { ...@@ -400,12 +403,12 @@ public class UploadController {
@RequestMapping("/verifFile") @RequestMapping("/verifFile")
public ResponseBean verifFile(HttpServletRequest request, RequestBean requestBean) { public ResponseBean verifFile(HttpServletRequest request, RequestBean requestBean) {
ResponseBean responseBean = new ResponseBean(); ResponseBean responseBean = new ResponseBean();
String stream=request.getParameter("fileStream"); String stream = request.getParameter("fileStream");
String filePath=request.getParameter("filePath"); String filePath = request.getParameter("filePath");
String fileDir=request.getParameter("fileDir"); String fileDir = request.getParameter("fileDir");
ByteArrayInputStream bais = null; ByteArrayInputStream bais = null;
FileOutputStream ostream = null; FileOutputStream ostream = null;
try{ try {
byte buf[] = stream.getBytes("utf-8"); byte buf[] = stream.getBytes("utf-8");
bais = new ByteArrayInputStream(buf); bais = new ByteArrayInputStream(buf);
POIFSFileSystem poifs = new POIFSFileSystem(); POIFSFileSystem poifs = new POIFSFileSystem();
...@@ -413,12 +416,11 @@ public class UploadController { ...@@ -413,12 +416,11 @@ public class UploadController {
directory.createDocument("WordDocument", bais); directory.createDocument("WordDocument", bais);
// 文件保存地址 // 文件保存地址
File uploadFilePath = new File(GConstants.FILE_UPLOAD_DIR,filePath); File uploadFilePath = new File(GConstants.FILE_UPLOAD_DIR, filePath);
if(uploadFilePath.exists()) if (uploadFilePath.exists()) {
{
return responseBean; return responseBean;
} }
File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR,fileDir); File baseUploadDir = new File(GConstants.FILE_UPLOAD_DIR, fileDir);
if (!baseUploadDir.exists()) {// 如果文件夹不存在则创建 if (!baseUploadDir.exists()) {// 如果文件夹不存在则创建
baseUploadDir.mkdirs(); baseUploadDir.mkdirs();
} }
......
...@@ -17,6 +17,7 @@ public class LoginBean extends GenericBean { ...@@ -17,6 +17,7 @@ public class LoginBean extends GenericBean {
private String verifyCode; private String verifyCode;
private String permission; private String permission;
private String clientip; private String clientip;
private String userIp;
public String getPermission() { public String getPermission() {
return permission; return permission;
...@@ -58,4 +59,11 @@ public class LoginBean extends GenericBean { ...@@ -58,4 +59,11 @@ public class LoginBean extends GenericBean {
this.clientip = clientip; 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.*; ...@@ -10,6 +10,7 @@ import com.ejweb.modules.user.bean.*;
import com.ejweb.modules.user.entity.*; import com.ejweb.modules.user.entity.*;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -101,4 +102,9 @@ public interface UserDao extends CurdDao<UserEntity> { ...@@ -101,4 +102,9 @@ public interface UserDao extends CurdDao<UserEntity> {
public void updateOuterUser(OuterUserBean bean); public void updateOuterUser(OuterUserBean bean);
List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity); 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; package com.ejweb.modules.user.entity;
import java.util.Date;
import com.ejweb.core.base.BaseEntity; import com.ejweb.core.base.BaseEntity;
import com.ejweb.core.conf.GConstants; import com.ejweb.core.conf.GConstants;
import java.util.Date;
/** /**
* 用户详情扩展表 对应联系人列表功能 * 用户详情扩展表 对应联系人列表功能
* @author lyw * @author lyw
......
...@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service; ...@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -658,4 +659,23 @@ public class UserService extends CurdService<UserDao, UserEntity> { ...@@ -658,4 +659,23 @@ public class UserService extends CurdService<UserDao, UserEntity> {
public List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity) { public List<UserLoginLogEntity> findUserLoginLogList(UserLoginLogEntity userLoginLogEntity) {
return dao.findUserLoginLogList(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 { ...@@ -206,6 +206,7 @@ public class AirlineVerifiedAddBean extends GenericBean {
public class Deport { public class Deport {
private String departId; private String departId;
private String departName;
public String getDepartId() { public String getDepartId() {
return departId; return departId;
...@@ -215,7 +216,13 @@ public class AirlineVerifiedAddBean extends GenericBean { ...@@ -215,7 +216,13 @@ public class AirlineVerifiedAddBean extends GenericBean {
this.departId = departId; this.departId = departId;
} }
public String getDepartName() {
return departName;
}
public void setDepartName(String departName) {
this.departName = departName;
}
} }
public String getVerifNo() { 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