jiangping
2024-11-12 41b5c29f4d3653402b99af7e370bd345e961efdd
server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/SmsEmailServiceImpl.java
@@ -46,6 +46,8 @@
    @Autowired
    @Lazy
    private EmayService emayService;
    @Autowired
    private SmsConfigMapper smsConfigMapper;
    @Value("${debug_model}")
    private boolean debugModel;
@@ -96,17 +98,14 @@
        )>=3){
            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,超出发送次数,请稍后重试!");
        }
        String code = Constants.getRandom6Num();
        String content = systemDictDataBiz.queryByCode(Constants.SMS,Constants.SMS_COMNAME).getCode()+"验证码为:"+code+",此验证码有效为3分钟。请勿泄露";
//        boolean result=   emayService.sendSingleSms(smsEmail.getPhone(),content);
        SmsConfig smsConfig = smsConfigMapper.selectOne(new QueryWrapper<SmsConfig>().lambda().eq(SmsConfig::getObjType,
                SmsConstants.inventCode).last(" limit 1 "));
        //开启短信通知
        if(Objects.nonNull(smsConfig) || Constants.equalsInteger(smsConfig.getStatus(),Constants.ZERO)){
            if(StringUtils.isNotBlank(smsConfig.getContent())){
                String content  = smsConfig.getContent().replace("{验证码}",code);
        emayService.sendSmsByHk(smsEmail.getPhone(),content);
//        if(!result){
//            throw  new BusinessException(ResponseStatus.SERVER_ERROR.getCode(),"对不起,短信验证码发送失败,请稍后重试!");
//        }
        smsEmail.setRemark(code);
        smsEmail.setIsdeleted(Constants.ZERO);
        smsEmail.setCreateDate(new Date());
@@ -116,9 +115,11 @@
        smsEmail.setContent(content);
        smsEmail.setObjType(Constants.ZERO+"");
        smsEmailMapper.insert(smsEmail);
        return smsEmail.getId();
    }
        }
        return null;
    }
    @Override