Merge remote-tracking branch 'origin/master'
This commit is contained in:
+3
-3
@@ -157,15 +157,15 @@ class SeaweedDataSynch extends BaseBatch{
|
|||||||
|
|
||||||
def dists = updating(c, "district")
|
def dists = updating(c, "district")
|
||||||
updateEs(c, dists, "district", "192.168.0.89")
|
updateEs(c, dists, "district", "192.168.0.89")
|
||||||
// updateEs(c, dists, "district", "192.168.0.52")
|
updateEs(c, dists, "district", "192.168.0.52")
|
||||||
|
|
||||||
def offices = updating(c, "office")
|
def offices = updating(c, "office")
|
||||||
updateEs(c, offices, "office", "192.168.0.89")
|
updateEs(c, offices, "office", "192.168.0.89")
|
||||||
// updateEs(c, offices, "office", "192.168.0.52")
|
updateEs(c, offices, "office", "192.168.0.52")
|
||||||
|
|
||||||
def shops = updating(c, "shop")
|
def shops = updating(c, "shop")
|
||||||
updateEs(c, shops, "shop", "192.168.0.89")
|
updateEs(c, shops, "shop", "192.168.0.89")
|
||||||
// updateEs(c, shops, "shop", "192.168.0.52")
|
updateEs(c, shops, "shop", "192.168.0.52")
|
||||||
|
|
||||||
println index +" "+ c + " 完成 "+new Date().toString()
|
println index +" "+ c + " 完成 "+new Date().toString()
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ import com.mongodb.DBObject
|
|||||||
class ApiInvokeStatistics extends BaseBatch{
|
class ApiInvokeStatistics extends BaseBatch{
|
||||||
final static def mongoDomain = "mongo.db.fangjia.com"
|
final static def mongoDomain = "mongo.db.fangjia.com"
|
||||||
public static final DBCollection OPEN_URI_LOG = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI,"business", "open_uri_log")
|
public static final DBCollection OPEN_URI_LOG = com.fangjia.core.util.MongoUtils.getDbCollection(Constants.SEAWATER_MONGO_URI,"business", "open_uri_log")
|
||||||
public static final DBCollection OPEN_URI_LOG_COUNT = MongoUtils.getCollectionByName("business", "api_invoke_statistical", "mongo.db.fangjia.com", 27017)
|
public static final DBCollection OPEN_URI_LOG_COUNT = MongoUtils.getCollectionByName("business", "api_invoke_statistical", "mongo.db.fangjia.com", 28017)
|
||||||
static final dbFangjia = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/fangjia?autoReconnect=true&characterEncoding=utf-8&autoReconnect=true", "sa", "G00jia", "com.mysql.jdbc.Driver");
|
static final dbFangjia = Sql.newInstance("jdbc:mysql://mysql.db.fangjia.com:4306/fangjia?autoReconnect=true&characterEncoding=utf-8&autoReconnect=true", "sa", "G00jia", "com.mysql.jdbc.Driver");
|
||||||
static main(args) {
|
static main(args) {
|
||||||
def s = System.currentTimeMillis()
|
def s = System.currentTimeMillis()
|
||||||
|
|||||||
+28
-39
@@ -41,7 +41,7 @@ class SMSOutgoingListener extends BaseBatch {
|
|||||||
public static final int MAX_SYS_SEND_COUNT = 4000
|
public static final int MAX_SYS_SEND_COUNT = 4000
|
||||||
//设置Web Service服务器,该服务器用于接收信息
|
//设置Web Service服务器,该服务器用于接收信息
|
||||||
public static final List TASK_QUEUE = Collections.synchronizedList(new ArrayList())
|
public static final List TASK_QUEUE = Collections.synchronizedList(new ArrayList())
|
||||||
public static final List ADMINISTRATORS = [Watcher.DuXiaoYu.mobile, Watcher.WangWenYan.mobile, "13621625626"]
|
public static final List ADMINISTRATORS = [ Watcher.WangWenYan.mobile, "13621625626"]
|
||||||
/**初始化手机号白名单和黑名单*/
|
/**初始化手机号白名单和黑名单*/
|
||||||
public static def MOBILE_LIST = [ : ]
|
public static def MOBILE_LIST = [ : ]
|
||||||
|
|
||||||
@@ -93,35 +93,38 @@ class SMSOutgoingListener extends BaseBatch {
|
|||||||
new Thread(){
|
new Thread(){
|
||||||
@Override
|
@Override
|
||||||
void run() {
|
void run() {
|
||||||
|
|
||||||
while(true){
|
while(true){
|
||||||
try{
|
|
||||||
synchronized(TASK_QUEUE){
|
synchronized(TASK_QUEUE){
|
||||||
println("..........................................-->开始消费:" + new Date().format("HH:mm:ss"))
|
println("..........................................-->开始消费:" + new Date().format("HH:mm:ss"))
|
||||||
Iterator iter = TASK_QUEUE.iterator();
|
Iterator iter = TASK_QUEUE.iterator();
|
||||||
while (iter.hasNext()){
|
while (iter.hasNext()){
|
||||||
def msg = iter.next()
|
try{
|
||||||
def mobile = msg.getObject().mobile
|
def msg = iter.next()
|
||||||
def logs = LOG_COLL.find(new BasicDBObject("mobile",mobile)).sort(new BasicDBObject("c_date", -1)).limit(1).toArray()
|
def mobile = msg.getObject().mobile
|
||||||
if(logs.size() == 0){
|
def logs = LOG_COLL.find(new BasicDBObject("mobile",mobile)).sort(new BasicDBObject("c_date", -1)).limit(1).toArray()
|
||||||
consumerQueue(msg)
|
if(logs.size() == 0){
|
||||||
iter.remove()
|
|
||||||
}else{
|
|
||||||
def lastSendTime = (Date)logs[0].get("c_date")
|
|
||||||
long interval = new Date().getTime() - lastSendTime.getTime()
|
|
||||||
if(interval > 1000 * 60 * 2){
|
|
||||||
consumerQueue(msg)
|
|
||||||
iter.remove()
|
|
||||||
}else{
|
|
||||||
int count = smsSendCount(mobile, 10)
|
|
||||||
if(count < 7){
|
|
||||||
consumerQueue(msg)
|
consumerQueue(msg)
|
||||||
iter.remove()
|
iter.remove()
|
||||||
}else {
|
}else{
|
||||||
println "$mobile 短信发送频繁 延后再发"
|
def lastSendTime = (Date)logs[0].get("c_date")
|
||||||
|
long interval = new Date().getTime() - lastSendTime.getTime()
|
||||||
|
if(interval > 1000 * 60 * 2){
|
||||||
|
consumerQueue(msg)
|
||||||
|
iter.remove()
|
||||||
|
}else{
|
||||||
|
int count = smsSendCount(mobile, 10)
|
||||||
|
if(count < 7){
|
||||||
|
consumerQueue(msg)
|
||||||
|
iter.remove()
|
||||||
|
}else {
|
||||||
|
println "$mobile 短信发送频繁 延后再发"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}catch(Exception e){
|
||||||
|
println "Error:"+e.getMessage()
|
||||||
|
iter.remove()
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(TASK_QUEUE.isEmpty()){
|
if(TASK_QUEUE.isEmpty()){
|
||||||
TASK_QUEUE.wait()
|
TASK_QUEUE.wait()
|
||||||
@@ -129,9 +132,7 @@ class SMSOutgoingListener extends BaseBatch {
|
|||||||
sleep(100)
|
sleep(100)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(Exception e){
|
|
||||||
println "Error:"+e.getMessage()
|
|
||||||
}
|
|
||||||
println("..........................................")
|
println("..........................................")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +166,7 @@ class SMSOutgoingListener extends BaseBatch {
|
|||||||
|
|
||||||
def mobile = msg.getObject().mobile
|
def mobile = msg.getObject().mobile
|
||||||
String content = msg.getObject().msgContent.trim()
|
String content = msg.getObject().msgContent.trim()
|
||||||
content = content.replace("【房价网】", "【上海估家】")
|
content = content.replace("【房价网】", "【上海估家网络科技】")
|
||||||
if(!content.startsWith("【")){
|
if(!content.startsWith("【")){
|
||||||
content = "【上海估家】" + content;
|
content = "【上海估家】" + content;
|
||||||
}
|
}
|
||||||
@@ -273,19 +274,6 @@ class SMSOutgoingListener extends BaseBatch {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 监控短信使用量
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
def monitorUsage(){
|
|
||||||
int amount = (int)(SingletonClient.getClient().balance * 10)
|
|
||||||
if(amount < 1000 && amount % 300 == 0 && amount != 0){//调用失败时为0
|
|
||||||
ADMINISTRATORS.each {phone->
|
|
||||||
jms.sendSms(phone, "短信剩余量:${amount} 请尽快充值!!".toString(), false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
println("短信剩余数量" + amount)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否是白名单手机号
|
* 是否是白名单手机号
|
||||||
@@ -316,7 +304,8 @@ class SMSOutgoingListener extends BaseBatch {
|
|||||||
if(StringUtils.isNotBlank(checkCode)){
|
if(StringUtils.isNotBlank(checkCode)){
|
||||||
JSONObject con = new JSONObject()
|
JSONObject con = new JSONObject()
|
||||||
con.put("code", checkCode);
|
con.put("code", checkCode);
|
||||||
return AliyunSmsClient.sendSms(mobile, "SMS_483345375", con.toString())
|
println("mobile:"+mobile+" code:"+checkCode)
|
||||||
|
return AliyunSmsClient.sendSms(mobile, "SMS_485015075", con.toString())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int resCode = SingletonClient.getClient().sendSMS([mobile] as String[],content, 5)
|
int resCode = SingletonClient.getClient().sendSMS([mobile] as String[],content, 5)
|
||||||
|
|||||||
+2
-2
@@ -39,7 +39,7 @@ class AliyunSmsClient {
|
|||||||
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式;发送国际/港澳台消息时,接收号码格式为00+国际区号+号码,如“0085200000000”
|
//必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式;发送国际/港澳台消息时,接收号码格式为00+国际区号+号码,如“0085200000000”
|
||||||
request.setPhoneNumbers(phoneNumber)
|
request.setPhoneNumbers(phoneNumber)
|
||||||
//必填:短信签名-可在短信控制台中找到
|
//必填:短信签名-可在短信控制台中找到
|
||||||
request.setSignName("房价网")
|
request.setSignName("上海估家网络科技")
|
||||||
//必填:短信模板-可在短信控制台中找到
|
//必填:短信模板-可在短信控制台中找到
|
||||||
request.setTemplateCode(templateCode);
|
request.setTemplateCode(templateCode);
|
||||||
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
|
||||||
@@ -52,7 +52,7 @@ class AliyunSmsClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
sendSms("15021384995", "SMS_482915107", '{"code":12345}')
|
sendSms("15021384995", "SMS_485015075", '{"code":6666}')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -325,7 +325,7 @@ public class AiShopServiceImpl implements AiShopService {
|
|||||||
query.setCityDisplay(evaluation.getCity());
|
query.setCityDisplay(evaluation.getCity());
|
||||||
Pager pager = new Pager();
|
Pager pager = new Pager();
|
||||||
pager.setStartRow(0);
|
pager.setStartRow(0);
|
||||||
pager.setPageSize(5);
|
pager.setPageSize(10);
|
||||||
query.setPager(pager);
|
query.setPager(pager);
|
||||||
query.setTable("latest_seawater");
|
query.setTable("latest_seawater");
|
||||||
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
||||||
@@ -378,7 +378,7 @@ public class AiShopServiceImpl implements AiShopService {
|
|||||||
query.setCityDisplay(evaluation.getCity());
|
query.setCityDisplay(evaluation.getCity());
|
||||||
Pager pager = new Pager();
|
Pager pager = new Pager();
|
||||||
pager.setStartRow(0);
|
pager.setStartRow(0);
|
||||||
pager.setPageSize(5);
|
pager.setPageSize(10);
|
||||||
query.setPager(pager);
|
query.setPager(pager);
|
||||||
query.setTable("latest_seawater");
|
query.setTable("latest_seawater");
|
||||||
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
List<Seawater> shops = seawaterService.findSeawatersByQuery(query);
|
||||||
|
|||||||
Reference in New Issue
Block a user