From 3c6de9d3f924c6e81a2144ee1e9df195b190bd52 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Mon, 15 Jul 2024 10:34:10 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B9=E7=94=A8simcard=E7=9A=84iccid2?= =?UTF-8?q?=E6=9D=A5=E5=8F=91=E9=80=81=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xymanager_service/impl/SmsServiceImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SmsServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SmsServiceImpl.java index c9a481b..3b376cd 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SmsServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/SmsServiceImpl.java @@ -1,10 +1,12 @@ package com.shxy.xymanager_service.impl; import com.shxy.xymanager_common.constant.Constants; +import com.shxy.xymanager_common.entity.TerminalSimcard; import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.exception.ApiException; import com.shxy.xymanager_common.model.SmsModel; import com.shxy.xymanager_common.sms.SmsAdapter; +import com.shxy.xymanager_dao.dao.TerminalSimcardMapper; import com.shxy.xymanager_service.service.*; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -26,6 +28,8 @@ public class SmsServiceImpl implements SmsService { NewCacheService newCacheService; @Resource SmsAdapter smsAdapter; + @Resource + TerminalSimcardMapper simcardMapper; @Override public void sendSms(SmsModel model) { @@ -36,15 +40,19 @@ public class SmsServiceImpl implements SmsService { if (term == null) { throw new ApiException(termId + "该装置不存在"); } - if (StringUtils.isBlank(term.getIccid())) { - throw new ApiException(termId + "该装置缺少iccid"); + TerminalSimcard simcard = simcardMapper.selectByPrimaryKey(termId); + if (simcard == null) { + throw new ApiException(termId + "该装置缺少simcard信息"); + } + if (StringUtils.isBlank(simcard.getIccid2())) { + throw new ApiException(termId + "该装置缺少iccid2"); } - if (Constants.NetType_Dahan.equals(term.getNetType())) { + if (Constants.NetType_Dahan.equals(simcard.getType2())) { dahanList.add(term.getIccid()); - } else if (Constants.NetType_Rabchaser.equals(term.getNetType())) { + } else if (Constants.NetType_Rabchaser.equals(simcard.getType2())) { rabchaserList.add(term.getIccid()); } else { - throw new ApiException(termId + "该装置的网络运营商类型暂不支持发短信"); + throw new ApiException(termId + "该装置的运营商类型type2暂不支持发短信"); } }