| | |
| | | import com.yami.trading.common.http.HttpHelper; |
| | | import com.yami.trading.common.manager.BlacklistIpTimeWindow; |
| | | import com.yami.trading.common.manager.SendCountTimeWindow; |
| | | import com.yami.trading.common.manager.sms.BUKASmsUtils; |
| | | import com.yami.trading.common.manager.sms.GoToneSmsUtils; |
| | | import com.yami.trading.service.EmailSendService; |
| | | import com.yami.trading.service.IdentifyingCodeService; |
| | | import com.yami.trading.service.IdentifyingCodeTimeWindowService; |
| | |
| | | import com.yami.trading.service.syspara.SysparaService; |
| | | import com.yami.trading.service.system.CodeLogService; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.commons.lang3.StringEscapeUtils; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.IOException; |
| | | import java.text.MessageFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | |
| | | |
| | | private Map<String, Integer> ipCache = new ConcurrentHashMap<String, Integer>(); |
| | | |
| | | @Autowired |
| | | GoToneSmsUtils goToneSmsUtils; |
| | | |
| | | @Autowired |
| | | BUKASmsUtils bukasmsUtils; |
| | | |
| | | @Override |
| | | public void send(String target, String ip) { |
| | | public void send(String target, String ip) throws IOException { |
| | | String code = null; |
| | | if (chcekIp(ip)) {// 被封的ip直接返回 不操作 |
| | | return; |
| | |
| | | return; |
| | | } |
| | | |
| | | if ("buka".equals(send_code_type)) { |
| | | bukasmsUtils.sendSms(target, MessageFormat.format(send_code_text, new Object[] { code })); |
| | | logger.info(MessageFormat.format("buka--target:{0},code:{1},ip:{2}", target, code, ip)); |
| | | } |
| | | |
| | | if ("GoTone".equals(send_code_type)) { |
| | | String response = goToneSmsUtils.sendSms(target, MessageFormat.format(send_code_text, new Object[] { code })); |
| | | logger.info(MessageFormat.format("GoTone--target:{0},code:{1},ip:{2}", target, code, ip)); |
| | | String responseWithChinese = StringEscapeUtils.unescapeJava(response); |
| | | System.out.println("中文发送结果: " + responseWithChinese); |
| | | } |
| | | |
| | | |
| | | if ("tiantian".equals(send_code_type)) { |
| | | smsSendService.send(target, MessageFormat.format(send_code_text, new Object[] { code })); |
| | | logger.info(MessageFormat.format("tiangtian--target:{0},code:{1},ip:{2}", target, code, ip)); |