验证码

This commit is contained in:
zhangyx
2022-06-27 11:26:52 +08:00
parent 8f42d1c192
commit 66117f0191
2 changed files with 28 additions and 9 deletions

View File

@ -24,9 +24,8 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*; import java.util.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
@ -47,7 +46,7 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
private BizSendMsgLogService msgLogService; private BizSendMsgLogService msgLogService;
@Autowired @Autowired
private BizFuncSwitchConfigMapper funcSwitchConfigMapper; private BizFuncSwitchConfigMapper funcSwitchConfigMapper;
@Autowired @Resource
private RedisTemplate<String, Object> redisTemplate; private RedisTemplate<String, Object> redisTemplate;
@Override @Override
@ -106,11 +105,12 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
public Boolean interestOutcomSendMsg(InterestOutcome interestOutcome) { public Boolean interestOutcomSendMsg(InterestOutcome interestOutcome) {
boolean result = false; boolean result = false;
BaseCacheUser user = cacheUserService.getCacheUser(); BaseCacheUser user = cacheUserService.getCacheUser();
// user.setOrganizationId("111").setUserId("ex-wanghy623").setFullName("曹鹏");
String verifyCode = String.valueOf((int)(Math.random()*900000 + 100000)); String verifyCode = String.valueOf((int)(Math.random()*900000 + 100000));
interestOutcome.setCheckCode(verifyCode); interestOutcome.setCheckCode(verifyCode);
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd hh:mm:ss");
String nowTime = df.format(now); String nowTime = now.format(formatter);
//模板ID //模板ID
String templateId = "interest_outcome_msg"; String templateId = "interest_outcome_msg";
QueryWrapper<BizSendMsgTemplate> query = new QueryWrapper<>(new BizSendMsgTemplate().setTemplateId(templateId)); QueryWrapper<BizSendMsgTemplate> query = new QueryWrapper<>(new BizSendMsgTemplate().setTemplateId(templateId));
@ -142,7 +142,7 @@ public class BizSendMsgTemplateServiceImpl extends ServiceImpl<BizSendMsgTemplat
} }
redisTemplate.opsForValue().set("subAcctNum:" + interestOutcome.getSubAcctNum(), JSON.toJSONString(interestOutcome), 5, TimeUnit.MINUTES); redisTemplate.opsForValue().set("subAcctNum:" + interestOutcome.getSubAcctNum(), JSON.toJSONString(interestOutcome), 5, TimeUnit.MINUTES);
//active使能10 //active使能10
int active =funcSwitchConfigMapper.selectByType("send-sms-func"); int active =funcSwitchConfigMapper.selectByType("send-interest-sms-func");
//发送状态0-失败1-成功2-短信功能未开启 //发送状态0-失败1-成功2-短信功能未开启
int sendResult = 2; int sendResult = 2;
if (active==1) { if (active==1) {

View File

@ -36,8 +36,8 @@ spring:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
username: mall username: mall
password: unicom password: unicom
jdbc-url: jdbc:mysql://10.125.160.26:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true jdbc-url: jdbc:mysql://10.125.160.30:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://10.125.160.26:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://10.125.160.30:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
filters: stat,wall,log4j filters: stat,wall,log4j
maxActive: 20 maxActive: 20
initialSize: 1 initialSize: 1
@ -172,6 +172,8 @@ mconfig:
bss: bss:
app-id: 2ICalrrQ0F app-id: 2ICalrrQ0F
app-secret: 1mb6n6635cJkDb3pEQPUFXc2nRJ8RPaS app-secret: 1mb6n6635cJkDb3pEQPUFXc2nRJ8RPaS
app-url-test: 2ICalrrQ0F
app-url: 1mb6n6635cJkDb3pEQPUFXc2nRJ8RPaS
document: document:
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749 clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
@ -197,3 +199,20 @@ xxl:
port: 18181 port: 18181
logpath: /data/applogs/xxl-job/jobhandler logpath: /data/applogs/xxl-job/jobhandler
logretentiondays: 30 logretentiondays: 30
unifast:
sso:
public-key: 11
clientId: 1
redirectUrl: 1
getCode:
url: 1
client:
clientHttpUrl: http://10.242.31.158:8100/auth/oauth/token?grant_type=client_credentials&client_id=bVS46ElU&client_secret=58ea04ba02475c8da2321cc99849d2a10f15b749
allow:
apis:
- ^GET\./?v1/send/msg/interest/getcode$
- ^POST\./?v1/send/msg/interest/code$