1;短信发送失败跳出

This commit is contained in:
wangshuai 2024-08-17 16:33:18 +08:00
parent 999b42efef
commit b937cb0882
3 changed files with 9 additions and 5 deletions

View File

@ -17,5 +17,5 @@ public interface IAiService {
void sms();
void sendSmsTask(String content, BusOrderInfo busOrderInfo);
Boolean sendSmsTask(String content, BusOrderInfo busOrderInfo);
}

View File

@ -199,7 +199,10 @@ public class AiConsumer {
fifteenInfo.setLastVisitTime(LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
fifteenInfoService.insertBusFifteenInfo(fifteenInfo);
}else if("sms".equals(busStoreInfo.getMarketingChannels())){
aiService.sendSmsTask(content,busOrderInfo);
Boolean aBoolean = aiService.sendSmsTask(content,busOrderInfo);
if(!aBoolean){
return;
}
BusAgentInfo busAgentInfo =agentInfo;
int a = 1;
int reduce = busAgentInfo.getAiDurationBalance() - a;

View File

@ -328,7 +328,7 @@ public class AiServiceImpl implements IAiService {
@Override
@Transactional(rollbackFor = ServiceException.class)
public void sendSmsTask(String content, BusOrderInfo busOrderInfo) {
public Boolean sendSmsTask(String content, BusOrderInfo busOrderInfo) {
try {
String limitNum = Optional.ofNullable(redisTemplate.opsForValue().get("limitNum")).orElse(null);
BusSmsInfo busSmsInfo1 = busSmsInfoMapper.selectBusSmsInfoByNum(limitNum);
@ -339,7 +339,7 @@ public class AiServiceImpl implements IAiService {
redisTemplate.delete("limitNum");
redisTemplate.delete("totalNum");
log.error("短信余额为空,请充值");
return;
return false;
}
redisTemplate.opsForValue().set("limitNum",busSmsInfo1.getLimitNum()+"");
redisTemplate.opsForValue().set("totalNum",busSmsInfo1.getTotalNum()+"");
@ -358,10 +358,11 @@ public class AiServiceImpl implements IAiService {
}else {
log.error(busOrderInfo.getStoreCode()+"sendSmsTask****短信回访失败 "+phoneNo);
}
return true;
} catch (Exception e) {
e.printStackTrace();
log.error(busOrderInfo.getOrderNo()+"建立sendSmsTask错误 "+e.getMessage());
throw new ServiceException("短信发送失败!");
return false;
}
}