|
|
|
@ -35,6 +35,8 @@ public class SmsServiceImpl implements SmsService {
|
|
|
|
|
public void sendSms(SmsModel model) {
|
|
|
|
|
List<String> dahanList = new ArrayList<>();
|
|
|
|
|
List<String> rabchaserList = new ArrayList<>();
|
|
|
|
|
List<String> m2mList = new ArrayList<>();
|
|
|
|
|
List<String> lkjList = new ArrayList<>();
|
|
|
|
|
for (Integer termId : model.getTermIdList()) {
|
|
|
|
|
Terminals term = newCacheService.getTerminal(termId);
|
|
|
|
|
if (term == null) {
|
|
|
|
@ -44,13 +46,27 @@ public class SmsServiceImpl implements SmsService {
|
|
|
|
|
if (simcard == null) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少simcard信息");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Constants.NetType_Dahan.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getIccid2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少iccid2");
|
|
|
|
|
}
|
|
|
|
|
if (Constants.NetType_Dahan.equals(simcard.getType2())) {
|
|
|
|
|
dahanList.add(simcard.getIccid2());
|
|
|
|
|
} else if (Constants.NetType_Rabchaser.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getIccid2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少iccid2");
|
|
|
|
|
}
|
|
|
|
|
rabchaserList.add(simcard.getIccid2());
|
|
|
|
|
} else if (Constants.NetType_M2M10086.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getIccid2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少iccid2");
|
|
|
|
|
}
|
|
|
|
|
m2mList.add(simcard.getIccid2());
|
|
|
|
|
} else if (Constants.NetType_LWWLKJ.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getMsisdn2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少msisdn2");
|
|
|
|
|
}
|
|
|
|
|
lkjList.add(simcard.getMsisdn2());
|
|
|
|
|
} else {
|
|
|
|
|
throw new ApiException(termId + "该装置的运营商类型type2=" + simcard.getType2() + "暂不支持发短信");
|
|
|
|
|
}
|
|
|
|
@ -62,6 +78,12 @@ public class SmsServiceImpl implements SmsService {
|
|
|
|
|
if (!CollectionUtils.isEmpty(rabchaserList)) {
|
|
|
|
|
smsAdapter.sendSms(Constants.NetType_Rabchaser, rabchaserList, model.getContent());
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(m2mList)) {
|
|
|
|
|
smsAdapter.sendSms(Constants.NetType_M2M10086, m2mList, model.getContent());
|
|
|
|
|
}
|
|
|
|
|
if (!CollectionUtils.isEmpty(lkjList)) {
|
|
|
|
|
smsAdapter.sendSms(Constants.NetType_LWWLKJ, lkjList, model.getContent());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -74,13 +96,27 @@ public class SmsServiceImpl implements SmsService {
|
|
|
|
|
if (simcard == null) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少simcard信息");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (Constants.NetType_Dahan.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getMsisdn2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少msisdn2");
|
|
|
|
|
}
|
|
|
|
|
return smsAdapter.listSms(simcard.getType2(), simcard.getMsisdn2());
|
|
|
|
|
} else if (Constants.NetType_Rabchaser.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getIccid2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少iccid2");
|
|
|
|
|
}
|
|
|
|
|
if (Constants.NetType_Dahan.equals(simcard.getType2())) {
|
|
|
|
|
return smsAdapter.listSms(Constants.NetType_Dahan, simcard.getIccid2());
|
|
|
|
|
} else if (Constants.NetType_Rabchaser.equals(simcard.getType2())) {
|
|
|
|
|
return smsAdapter.listSms(Constants.NetType_Rabchaser, simcard.getIccid2());
|
|
|
|
|
return smsAdapter.listSms(simcard.getType2(), simcard.getIccid2());
|
|
|
|
|
} else if (Constants.NetType_M2M10086.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getIccid2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少iccid2");
|
|
|
|
|
}
|
|
|
|
|
return smsAdapter.listSms(simcard.getType2(), simcard.getIccid2());
|
|
|
|
|
} else if (Constants.NetType_LWWLKJ.equals(simcard.getType2())) {
|
|
|
|
|
if (StringUtils.isBlank(simcard.getMsisdn2())) {
|
|
|
|
|
throw new ApiException(termId + "该装置缺少msisdn2");
|
|
|
|
|
}
|
|
|
|
|
return smsAdapter.listSms(simcard.getType2(), simcard.getMsisdn2());
|
|
|
|
|
} else {
|
|
|
|
|
throw new ApiException(termId + "该装置的运营商类型type2=" + simcard.getType2() + "暂不支持查询短信");
|
|
|
|
|
}
|
|
|
|
|