Commit 82af8b3c by zt

修改

parent d0d8d0d6
...@@ -84,6 +84,16 @@ ...@@ -84,6 +84,16 @@
<!-- maven-shade-plugin --> <!-- maven-shade-plugin -->
<!-- 打包方式:mvn package --> <!-- 打包方式:mvn package -->
<plugin> <plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<compilerArguments>
<extdirs>lib</extdirs>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId> <artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version> <version>2.4.1</version>
......
...@@ -3,7 +3,9 @@ package com.foc; ...@@ -3,7 +3,9 @@ package com.foc;
import com.foc.entity.AccessInfo; import com.foc.entity.AccessInfo;
import com.foc.service.Sms; import com.foc.service.Sms;
import com.foc.service.SoundMonitorService; import com.foc.service.SoundMonitorService;
import com.foc.util.PropertiesUtil;
import com.foc.util.PropertiesUtils;
import lombok.extern.log4j.Log4j;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -17,9 +19,10 @@ import java.util.Properties; ...@@ -17,9 +19,10 @@ import java.util.Properties;
* 2.查看是否有录音文件记录 * 2.查看是否有录音文件记录
* 3.查看安科数据库最后一条数据 * 3.查看安科数据库最后一条数据
*/ */
@Log4j
public class DbSoundsMonitorTask { public class DbSoundsMonitorTask {
private static final Logger logger = LoggerFactory.getLogger(DbSoundsMonitorTask.class); // private static final Logger logger = LoggerFactory.getLogger(DbSoundsMonitorTask.class);
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
if (args == null || args.length == 0){ if (args == null || args.length == 0){
...@@ -30,19 +33,21 @@ public class DbSoundsMonitorTask { ...@@ -30,19 +33,21 @@ public class DbSoundsMonitorTask {
} }
public static void loadConf(String path) throws Exception { public static void loadConf(String path) throws Exception {
Properties properties = PropertiesUtils.getProperties(path);
//查看定时任务最后同步时间 //查看定时任务最后同步时间
SoundMonitorService.init(); SoundMonitorService.init();
Integer i = SoundMonitorService.test(); boolean i = SoundMonitorService.test();
if (i == 1){ if (i = true){
//发送短信 //发送短信
AccessInfo accessInfo = new AccessInfo(); AccessInfo accessInfo = new AccessInfo();
accessInfo.setAicc("5"); accessInfo.setAicc("5");
accessInfo.setAicp("10.68.26.52"); accessInfo.setAicp("10.68.26.52");
Properties properties = PropertiesUtil.getProperties(path); String result = Sms.sendSms(accessInfo, properties.getProperty("mobile"), "预警:智能首航录音记录显示异常,请处理。");
String result = Sms.sendSms(accessInfo, properties.getProperty("mobile"), "警告"); System.out.println(result);
logger.info(result); log.info(result);
}else { }else {
logger.info("没有异常!" ); log.info("没有异常!" );
} }
} }
} }
package com.foc.entity;
import lombok.Data;
/**
* @author zangtao
* @create 2019 - 05 -07 17:35
*/
@Data
public class ResultDate {
private int messageCount;
private String mess;
private String msgid;
private String msgStatus;
}
package com.foc.entity;
import lombok.Data;
/**
* @author zangtao
* @create 2019 - 05 -07 17:34
*/
@Data
public class ResultMsg {
private String message;
private String viewMessage;
private String resultCode;
}
package com.foc.entity;
import lombok.Data;
/**
* 发短信返回成功
*
* @author zangtao
* @create 2019 - 05 -07 16:16
*/
@Data
public class SmsResult {
private ResultMsg result;
private ResultDate date;
}
package com.foc.service; package com.foc.service;
import com.foc.util.Coder; import com.foc.util.PropertiesUtils;
import com.foc.util.PropertiesUtil; import org.apache.http.HttpResponse;
import com.opendata.api.ODPRequest; import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.io.File; import java.util.Properties;
import java.util.*;
/** /**
* 发邮件 * 发邮件
...@@ -19,20 +20,6 @@ public class Email { ...@@ -19,20 +20,6 @@ public class Email {
private static final Logger logger = LoggerFactory.getLogger(Email.class); private static final Logger logger = LoggerFactory.getLogger(Email.class);
//正式环境服务接口请用调用地址 http://esb.hna.net/api
//测试环境服务接口请用调用地址 http://10.70.72.110/api/inner/ESBService
//API服务接口请求调用地址,查看说明文档
/**
* URL: API服务接口请求调用地址,查看说明文档
* method: API接口名称,查看个人订单-接口名称
* Appsecret: app密钥,查看个人中心-app key
* AccessToken: 应用票据,查看个人中心-app key
*/
String URL = "http://10.70.72.110/api/inner/ESBService";
String method = "Exchange_MailService_SendMail";
String Appsecret = "9eztwb08qdvkzk0zadzdvtl6j1bssqvp";
String AccessToken = "A6BD747ECB212285E6DC3528EFB482AF04B40F17";
/** /**
* 发送邮件 * 发送邮件
* *
...@@ -44,18 +31,10 @@ public class Email { ...@@ -44,18 +31,10 @@ public class Email {
public static String sendEmail(String toEmail , String subject , String body ){ public static String sendEmail(String toEmail , String subject , String body ){
//读取配置文件 //读取配置文件
Properties properties = PropertiesUtil.getProperties(); Properties properties = PropertiesUtils.getProperties();
//接口地址
String emailUrl = properties.getProperty("emailUrl");
//接口地址
String method = properties.getProperty("emailMethod");
//接口地址
String Appsecret = properties.getProperty("Appsecret");
//接口地址 //接口地址
String AccessToken = properties.getProperty("AccessToken"); String emailUrl = properties.getProperty("emailUrl");
//邮件服务发件人参数 //邮件服务发件人参数
String fromEmail = properties.getProperty("fromEmail"); String fromEmail = properties.getProperty("fromEmail");
...@@ -66,64 +45,30 @@ public class Email { ...@@ -66,64 +45,30 @@ public class Email {
//发件人的密码 //发件人的密码
String UserPwd = properties.getProperty("UserPwd"); String UserPwd = properties.getProperty("UserPwd");
String res = new ODPRequest(emailUrl, Appsecret) HttpClient httpClient = HttpClients.createDefault();
.addTextSysPara("Method", method)
.addTextSysPara("AccessToken", AccessToken) try {
.addTextSysPara("Format", "json") HttpPost httpPost = new HttpPost("https://dsp.jdair.net/flightinterface/uss/json/email/sendEmail.json" + "?ai.cc=5&ai.cc=1&ai.cp=10.68.26.52"
//应用参数 + "&fromEmail=" + fromEmail + "&fromPasswd=" + UserPwd
//邮件服务发件人参数//sdhkyxglzx@hnair.com + "&toEmail=" + toEmail + "&subject=" + subject
.addTextAppPara("From", fromEmail) + "&fromName=sdhkyxglzx" + "&content=" + body);
//邮件服务收件人参数 HttpResponse response = httpClient.execute(httpPost);
.addTextAppPara("To", toEmail) logger.info(response.toString());
//发件人的内网账号 return response.getEntity().toString();
.addTextAppPara("UserName", UserName) } catch (Exception ex) {
//发件人的密码,需要base64编码 ex.printStackTrace();
.addTextAppPara("UserPwd", Coder.getBASE64(UserPwd)) }
//邮件标题
.addTextAppPara("Subject",subject) return null;
//邮件内容参数,需要base64编码
.addTextAppPara("Body", Coder.getBASE64(body))
// .addTextAppPara("Attachments", mapList)//附件
.post();
// .addTextAppPara("StartDate", "2016-11-15")
// .addTextAppPara("EndDate", "2016-11-15").post();
return res;
} }
public void testEmail() throws Exception { public static void main(String[] args) {
//拼装附件mapList System.out.println(sendEmail("906577196@qq.com","测试测试","你好啊啊啊啊啊"));
List<Object> mapList = new ArrayList<Object>();
Map<String, String> map = new HashMap<String, String>();
Map<String, Object> mapAttachment = new HashMap<String, Object>();
Map<String, Object> mapAttachment2 = new HashMap<String, Object>();
map.put("FileName", "附件1.txt");//文件名称
map.put("Content", Coder.getBASE64("这是附件1的内容."));//文件内容:需要字节流的base64编码值
mapAttachment.put("Attachment", map);
mapList.add(mapAttachment);
Map<String, String> map2 = new HashMap<String, String>();
map2.put("FileName", "IMG_2005.PNG");
map2.put("Content", Coder.fileCode("E:" + File.separator + "IMG_2005.PNG"));
mapAttachment2.put("Attachment", map2);
mapList.add(mapAttachment2);
String res = new ODPRequest(URL, Appsecret)
.addTextSysPara("Method", method)
.addTextSysPara("AccessToken", AccessToken)
.addTextSysPara("Format", "json")
//应用参数
.addTextAppPara("From", "sdhkyxglzx@hnair.com")//邮件服务发件人参数//sdhkyxglzx@hnair.com
.addTextAppPara("To", "chl.zhou@hnair.com")//邮件服务收件人参数
.addTextAppPara("UserName", "sdhkyxglzx")//发件人的内网账号
.addTextAppPara("UserPwd", Coder.getBASE64("075.wxp"))//发件人的密码,需要base64编码
.addTextAppPara("Subject", "邮件标题-测试")//邮件标题
.addTextAppPara("Body", Coder.getBASE64("邮件正文,测试英文字符:You and me are working in the same organization for the same purpose."))//邮件内容参数,需要base64编码
// .addTextAppPara("Attachments", mapList)//附件
.post();
System.out.println(res);
} }
} }
package com.foc.service; package com.foc.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.foc.entity.AccessInfo; import com.foc.entity.AccessInfo;
import com.foc.entity.SmsResult;
import com.foc.util.HttpClientUtils; import com.foc.util.HttpClientUtils;
import com.foc.util.PropertiesUtil; import com.foc.util.PropertiesUtils;
import org.apache.http.HttpResponse; import lombok.extern.log4j.Log4j;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.HttpClients;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import java.util.Properties; import java.util.Properties;
...@@ -19,10 +18,9 @@ import java.util.Properties; ...@@ -19,10 +18,9 @@ import java.util.Properties;
* @author zangtao * @author zangtao
* @create 2019 - 04 -11 15:35 * @create 2019 - 04 -11 15:35
*/ */
@Log4j
public class Sms { public class Sms {
private static final Logger logger = LoggerFactory.getLogger(Sms.class);
/** /**
* 发送短信 * 发送短信
* *
...@@ -33,33 +31,22 @@ public class Sms { ...@@ -33,33 +31,22 @@ public class Sms {
*/ */
public static String sendSms(AccessInfo accessInfo, String mobile, String msg) { public static String sendSms(AccessInfo accessInfo, String mobile, String msg) {
//读取配置文件 //读取配置文件
Properties properties = PropertiesUtil.getProperties(); Properties properties = PropertiesUtils.getProperties();
String smsUrl = properties.getProperty("smsUrl"); String smsUrl = properties.getProperty("smsUrl");
String result; String result;
result = HttpClientUtils.doGet(smsUrl + "?ai.cp=" + accessInfo.getAicp() + "&ai.cc=" + accessInfo.getAicc() result = HttpClientUtils.doGet(smsUrl + "?ai.cp=" + accessInfo.getAicp() + "&ai.cc=" + accessInfo.getAicc()
+ "&mobile=" + mobile + "&msg=" + msg ); + "&mobile=" + mobile + "&msg=" + msg );
SmsResult rootEntity = JSON.parseObject(result, SmsResult.class);
if (rootEntity.getResult().getResultCode().equals("1000")){
log.info("发送成功,Time:"+ new Date() +"result:"+result);
}else {
log.info("发送失败,Time:"+ new Date() +"result:"+result);
}
// HttpClient httpClient = HttpClients.createDefault();
// try {
// HttpPost httpPost = new HttpPost(smsUrl + "?ai.cp=" + accessInfo.getAicp() + "&ai.cc=" + accessInfo.getAicc()
// + "&mobile=" + mobile + "&msg=" + msg);
// HttpResponse response = httpClient.execute(httpPost);
// logger.info(response.toString());
// return response.toString();
// } catch (Exception ex) {
// ex.printStackTrace();
// }
return result; return result;
} }
// public static void main(String[] args) {
// AccessInfo accessInfo = new AccessInfo();
// accessInfo.setAicc("5");
// accessInfo.setAicp("10.68.26.52");
//// accessInfo.setAict("21");
// String res = Sms.sendSms(accessInfo, "13222650486", "HelloWorld");
// System.out.println(res);
// }
} }
...@@ -3,6 +3,8 @@ package com.foc.service; ...@@ -3,6 +3,8 @@ package com.foc.service;
import com.foc.dao.SoundsMaxIdDao; import com.foc.dao.SoundsMaxIdDao;
import com.foc.entity.SoundInfo; import com.foc.entity.SoundInfo;
import com.foc.entity.SoundsMaxId; import com.foc.entity.SoundsMaxId;
import com.foc.util.DateUtils;
import com.foc.util.PropertiesUtils;
import com.foc.util.StringUtils; import com.foc.util.StringUtils;
import lombok.extern.log4j.Log4j; import lombok.extern.log4j.Log4j;
import org.apache.ibatis.io.Resources; import org.apache.ibatis.io.Resources;
...@@ -12,8 +14,11 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder; ...@@ -12,8 +14,11 @@ import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import java.io.IOException; import java.io.IOException;
import java.io.Reader; import java.io.Reader;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Properties;
/** /**
* @Author: lisu * @Author: lisu
...@@ -43,23 +48,34 @@ public class SoundMonitorService { ...@@ -43,23 +48,34 @@ public class SoundMonitorService {
// } // }
} }
public static Integer test() { public static boolean test() {
Properties properties = PropertiesUtils.getProperties();
String interval = properties.getProperty("interval");
SoundsMaxIdDao soundsMaxIdDao = session.getMapper(SoundsMaxIdDao.class); SoundsMaxIdDao soundsMaxIdDao = session.getMapper(SoundsMaxIdDao.class);
SoundsMaxId maxId = soundsMaxIdDao.getMaxId(); SoundsMaxId maxId = soundsMaxIdDao.getMaxId();
String updateTime = maxId.getUpdateDate(); String updateTime = maxId.getUpdateDate();
log.info("当前系统时间:" + new Date()); log.info("当前系统时间:" + new Date());
//比较时间,如果相差20分钟没有执行 //比较时间,如果相差20分钟没有执行
DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
LocalDateTime ldt = LocalDateTime.parse(updateTime,df);
if (DateUtils.until(ldt) > Long.parseLong(interval)){
log.info("更新时间异常,与最新时间间隔大于20分钟,updateTime:"+ updateTime) ;
return true;
}
List<SoundInfo> list = soundsMaxIdDao.getInfo(updateTime); List<SoundInfo> list = soundsMaxIdDao.getInfo(updateTime);
for (SoundInfo soundInfo : list){ for (SoundInfo soundInfo : list){
//成功且没有url的 //成功且没有url的
if(soundInfo.getResult().equals("SUCCESS") && StringUtils.isEmpty(soundInfo.getDownloadUrl() ) ){ if(StringUtils.isEmpty(soundInfo.getDownloadUrl() ) ){
log.info("{}" + soundInfo.toString()); log.info(new Date()+"该条记录无url:" + soundInfo.toString());
return 1; return true;
} }
} }
log.info("全部成功" ); log.info("全部成功" );
return 2; return false;
} }
......
package com.foc.util;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import java.io.*;
public class Coder {
/**
* 将 s 进行 BASE64 编码
*/
public static String getBASE64(byte[] s) {
if (s == null) {
return null;
}
return (new BASE64Encoder()).encode(s);
}
public static String getBASE64(String s) {
if (s == null) {
return null;
}
return (new BASE64Encoder()).encode(s.getBytes());
}
// 将 BASE64 编码的字符串 s 进行解码
public static String getFromBASE64(String s) {
if (s == null)
return null;
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(s);
return new String(b);
} catch (Exception e) {
return null;
}
}
public static String fileCode(String fileurl) throws Exception {
String result = null;
// 第1步、使用File类找到一个文件
File f = new File(fileurl); // 声明File对象
// 第2步、通过子类实例化父类对象
InputStream input = null; // 准备好一个输入的对象
input = new FileInputStream(f); // 通过对象多态性,进行实例化
// 第3步、进行读操作
// byte b[] = new byte[input..available()] ; 跟使用下面的代码是一样的
byte b[] = new byte[(int) f.length()]; // 数组大小由文件决定
int len = input.read(b); // 读取内容
// 第4步、关闭输出流
input.close(); // 关闭输出流\
// System.out.println("读入数据的长度:" + len);
result = Coder.getBASE64(b);
// System.out.println("内容为:" + result); // 把byte数组变为字符串输出
return result;
}
public static String fileStringCode(String fileurl) throws Exception {
String result = "";
String encoding = "GBK";
File file = new File(fileurl);
if (file.isFile() && file.exists()) { //判断文件是否存在
InputStreamReader read = new InputStreamReader(new FileInputStream(file), encoding);//考虑到编码格式
BufferedReader bufferedReader = new BufferedReader(read);
String lineTxt = null;
while ((lineTxt = bufferedReader.readLine()) != null) {
result += lineTxt;
}
// System.out.println("内容为:" + result);
read.close();
}
return result;
}
}
package com.foc.util;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
/**
* @author lisu
*/
public class DateUtils {
/**
* 计算当前日期与{@code endDate}的间隔天数
*
* @param time
* @return 间隔分钟
*/
public static long until(LocalDateTime time) {
return Math.abs(LocalDateTime.now().until(time, ChronoUnit.MINUTES));
}
}
package com.foc.util;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;
/**
* @author 臧涛
*/
public class PropertiesUtil {
private PropertiesUtil() {}
private static Properties properties = null;
public static Properties getProperties(String path) {
if (properties == null) {
try {
Properties prop = new Properties();
InputStream in = new FileInputStream(path);
// InputStream in = PropertiesUtil.class.getClassLoader().getResourceAsStream("global.properties");
prop.load(in);
properties = prop;
return properties;
} catch (Exception e) {
e.printStackTrace();
}
}
return properties;
}
public static Properties getProperties() {
return properties;
}
}
package com.foc.util;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Properties;
/**
* @author zangtao
*/
public class PropertiesUtils {
private static Properties properties ;
/**
* 获取配置文件中配置信息
*/
static { }
public static Properties getProperties(String path){
if(properties == null){
properties = new Properties();
try {
InputStream in = new FileInputStream(path);
properties.load(in);
} catch (IOException e) {
e.printStackTrace();
}
}
return properties;
}
public static Properties getProperties(){
if (properties == null){
properties = new Properties();
try {
properties.load(new InputStreamReader(PropertiesUtils.class.getClassLoader().getResourceAsStream("server.properties"),"UTF-8"));
} catch (IOException e) {
e.printStackTrace();
}
}
return properties;
}
}
package com.foc.util; package com.foc.util;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/** /**
* @author lisu * @author lisu
*/ */
public class StringUtils { public class StringUtils {
public static boolean rightRandom(String str) {
String regex = "^[a-zA-Z0-9]{6}$";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(str);
boolean isMatch = m.matches();
return isMatch;
}
/**
* 手机号码校验
*
* @param phone 手机号
* @param regex 正则
* @return
*/
public static boolean isPhone(String phone, String regex) {
if (phone.length() != 11) {
return false;
} else {
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(phone);
boolean isMatch = m.matches();
return isMatch;
}
}
/**
* 把原始字符串分割成指定长度的字符串列表
*
* @param inputString 原始字符串
* @param length 指定长度
* @return
*/
public static List<String> getStrList(String inputString, int length) {
int size = inputString.length() / length;
if (inputString.length() % length != 0) {
size += 1;
}
return getStrList(inputString, length, size);
}
/**
* 把原始字符串分割成指定长度的字符串列表
*
* @param inputString 原始字符串
* @param length 指定长度
* @param size 指定列表大小
* @return
*/
public static List<String> getStrList(String inputString, int length, int size) {
List<String> list = new ArrayList<>();
for (int index = 0; index < size; index++) {
String childStr = substring(inputString, index * length, (index + 1) * length);
list.add(childStr);
}
return list;
}
/**
* 分割字符串,如果开始位置大于字符串长度,返回空
*
* @param str 原始字符串
* @param f 开始位置
* @param t 结束位置
* @return
*/
public static String substring(String str, int f, int t) {
if (f > str.length()) {
return null;
}
if (t > str.length()) {
return str.substring(f, str.length());
} else {
return str.substring(f, t);
}
}
/**
* BASE64解密
*
* @param key
* @return
* @throws Exception
*/
public static String decryptBASE64(String key) {
byte[] decodedBytes = Base64.getDecoder().decode(key);
return new String(decodedBytes);
}
/**
* BASE64加密
*
* @param key
* @return
* @throws Exception
*/
public static String encryptBASE64(String key) {
return Base64.getEncoder().encodeToString(key.getBytes());
}
public static boolean isEmpty(String str) { public static boolean isEmpty(String str) {
return str == null || "".equals(str); return str == null || "".equals(str);
} }
/**
* 利用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;
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();
}
/**
* 获取6位随机字符
*
* @return
*/
public static String getRandom(){
String a = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
char[] rands = new char[6];
for (int i = 0; i < rands.length; i++) {
int rand = (int) (Math.random() * a.length());
rands[i] = a.charAt(rand);
}
StringBuffer stringBuffer = new StringBuffer();
for(int i=0;i<rands.length;i++){
stringBuffer = stringBuffer.append(rands[i]);
}
return stringBuffer.toString();
}
/**
* 获取精确到秒的时间戳
* @return
*/
public static int getSecondTimestamp(Date date){
if (null == date) {
return 0;
}
String timestamp = String.valueOf(date.getTime());
int length = timestamp.length();
if (length > 3) {
return Integer.valueOf(timestamp.substring(0,length-3));
} else {
return 0;
}
}
} }
...@@ -4,7 +4,8 @@ smsUrl=http://user.jdair.net/ussinterface/uss/json/mobile/messSend.json ...@@ -4,7 +4,8 @@ smsUrl=http://user.jdair.net/ussinterface/uss/json/mobile/messSend.json
#������������URL #������������URL
#smsUrl=http://10.70.35.68:808/flightinterface/uss/json/mobile/messSend.json? #smsUrl=http://10.70.35.68:808/flightinterface/uss/json/mobile/messSend.json?
#�ʼ����Ի��� #�ʼ����Ի���
emailUrl=http://10.70.72.110/api/inner/ESBService #emailUrl=http://10.70.72.110/api/inner/ESBService
emailUrl=https://dsp.jdair.net/flightinterface/uss/json/email/sendEmail.json
#�ʼ���ʽ���� #�ʼ���ʽ����
#emailUrl=http://esb.hna.net/api #emailUrl=http://esb.hna.net/api
#API�ӿ����ƣ��鿴���˶���-�ӿ����� #API�ӿ����ƣ��鿴���˶���-�ӿ�����
...@@ -20,4 +21,7 @@ UserName=sdhkyxglzx ...@@ -20,4 +21,7 @@ UserName=sdhkyxglzx
#�����˵����� #�����˵�����
UserPwd=075.wxp UserPwd=075.wxp
#手机 #手机
mobile=13222650486 mobile=13222650486
\ No newline at end of file #首航电话
#mobile=13222650486,18501501226,18513137897,13910771191,13691466286,15011288928
interval=20
\ No newline at end of file
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
foc_sound_records ac foc_sound_records ac
LEFT JOIN foc_sound_phones ap ON ac.id = ap.record_id LEFT JOIN foc_sound_phones ap ON ac.id = ap.record_id
WHERE WHERE
ac.end_status != 'INIT' ac.end_status = 'SUCCESS'
AND ac.start_time &lt;= #{date} AND ac.start_time &lt;= #{date}
AND ( AND (
ac.end_time &lt; #{date} ac.end_time &lt; #{date}
......
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