|
|
package com.yoho.unions.helper;
|
|
|
|
|
|
import com.yoho.message.sdk.common.model.SendMessageRspBo;
|
|
|
import com.yoho.message.sdk.service.product.ISendProductMessage;
|
|
|
import com.yoho.unions.common.utils.DateUtil;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.math.BigDecimal;
|
...
|
...
|
@@ -16,38 +20,49 @@ import java.util.Map; |
|
|
public class SendMessageHelper {
|
|
|
static Logger log = LoggerFactory.getLogger(SendMessageHelper.class);
|
|
|
|
|
|
//模版ID
|
|
|
static Map<Integer, String> keyMap = new HashMap<Integer, String>(){{
|
|
|
put(1,"AyIBF3VgCkk4V4s4NIuNmjcIe5IUeufmlMXv0oxcj74");//每日新产生佣金提醒
|
|
|
put(2,"9nUlr41s8vvOgKZ-xA5_VV_Gqs-868_KxdRzDziYTa4");//提现打款提醒
|
|
|
put(3,"IE7sO6J-r1iEd-G6dmuFaN64Qnk9lqJFmsBpO1YACWs");//可结算提醒
|
|
|
put(4,"QtoMH65mEHuDYMAtNKLSrIxQKqNNdDLDl_dMOY1cHhw");//申请成功提醒
|
|
|
}};
|
|
|
@Autowired
|
|
|
ISendProductMessage iSendProductMessage;
|
|
|
|
|
|
public <T> void sendMessage(int uid,int type,T value) {
|
|
|
log.info("sendMessage enter,uid is {},type is {},value is {}.",uid,type,value);
|
|
|
String key = keyMap.get(type);
|
|
|
if (key == null) {
|
|
|
log.info("sendMessage end,type error,uid is {},type is {},value is {}.",uid,type,value);
|
|
|
return;
|
|
|
}
|
|
|
try {
|
|
|
//模版ID
|
|
|
// static Map<Integer, String> keyMap = new HashMap<Integer, String>(){{
|
|
|
// put(1,"AyIBF3VgCkk4V4s4NIuNmjcIe5IUeufmlMXv0oxcj74");//每日新产生佣金提醒
|
|
|
// put(2,"9nUlr41s8vvOgKZ-xA5_VV_Gqs-868_KxdRzDziYTa4");//提现打款提醒
|
|
|
// put(3,"IE7sO6J-r1iEd-G6dmuFaN64Qnk9lqJFmsBpO1YACWs");//可结算提醒
|
|
|
// put(4,"QtoMH65mEHuDYMAtNKLSrIxQKqNNdDLDl_dMOY1cHhw");//申请成功提醒
|
|
|
// }};
|
|
|
|
|
|
System.out.println(key);
|
|
|
} catch (Exception e) {
|
|
|
log.error("sendMessage error,e is {}.",e);
|
|
|
}
|
|
|
}
|
|
|
public void sendMessage(int uid, int type, int time, BigDecimal amount) {
|
|
|
log.info("sendMessage enter,uid is {},type is {},time is {},amount is {}.",uid,type,time,amount);
|
|
|
String key = keyMap.get(type);
|
|
|
if (key == null) {
|
|
|
if (type < 1 || type > 4) {
|
|
|
log.info("sendMessage end,type error,uid is {},type is {},time is {},amount is {}.",uid,type,time,amount);
|
|
|
return;
|
|
|
}
|
|
|
// String key = keyMap.get(type);
|
|
|
// if (key == null) {
|
|
|
// log.info("sendMessage end,type error,uid is {},type is {},time is {},amount is {}.",uid,type,time,amount);
|
|
|
// return;
|
|
|
// }
|
|
|
try {
|
|
|
|
|
|
System.out.println(key);
|
|
|
String timeStr = DateUtil.long2DateStr(time * 1000, DateUtil.DATE_TIME_FORMAT);
|
|
|
System.out.println(timeStr);
|
|
|
SendMessageRspBo sendMessageRspBo=null;
|
|
|
if (type == 1) {
|
|
|
//预估佣金提醒
|
|
|
sendMessageRspBo=iSendProductMessage.estimateNotice(Integer.toString(uid), amount.toString(),timeStr );
|
|
|
}
|
|
|
if (type == 2) {
|
|
|
//提现打款提醒
|
|
|
sendMessageRspBo=iSendProductMessage.cashAccountNotice(Integer.toString(uid), amount.toString(), timeStr);
|
|
|
}
|
|
|
if (type == 3) {
|
|
|
//可结算提醒
|
|
|
sendMessageRspBo=iSendProductMessage.commissionNotice(Integer.toString(uid), amount.toString(), timeStr);
|
|
|
}
|
|
|
if (type == 4) {
|
|
|
//申请成功提醒
|
|
|
sendMessageRspBo=iSendProductMessage.joinSuccessNotice(Integer.toString(uid), timeStr);
|
|
|
}
|
|
|
log.info("sendMessage enter,uid is {},type is {},time is {},amount is {},sendMessageRspBo is {}.",uid,type,time,sendMessageRspBo);
|
|
|
} catch (Exception e) {
|
|
|
log.error("sendMessage error,e is {}.",e);
|
|
|
}
|
...
|
...
|
|