fix: 调整短信查询返回结构

dev
huangfeng 11 months ago
parent e62304d43f
commit d01d6289ed

@ -4,6 +4,7 @@ import com.shxy.xymanager_common.annotation.Log;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.model.SmsModel;
import com.shxy.xymanager_common.model.SmsReturn;
import com.shxy.xymanager_common.sms.dahan.DahanWeb;
import com.shxy.xymanager_common.sms.lwwlkj.LwwlkjWeb;
import com.shxy.xymanager_common.sms.m2m.M2m10086Web;
@ -38,8 +39,8 @@ public class SmsController extends BaseController {
@GetMapping("list")
@ApiOperation("查询短信")
@Log(title = "查询短信", type = "查询")
public ResponseReult<Object> list(Integer termId) {
Object obj = service.listSms(termId);
public ResponseReult<SmsReturn> list(Integer termId) {
SmsReturn obj = service.listSms(termId);
return ResponseReult.success(obj);
}

@ -0,0 +1,9 @@
package com.shxy.xymanager_common.model;
import lombok.Data;
@Data
public class SmsReturn {
Integer type;
Object data;
}

@ -1,6 +1,7 @@
package com.shxy.xymanager_common.sms;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.model.SmsReturn;
import com.shxy.xymanager_common.sms.dahan.DahanWeb;
import com.shxy.xymanager_common.sms.lwwlkj.LwwlkjWeb;
import com.shxy.xymanager_common.sms.m2m.M2m10086Web;
@ -41,17 +42,23 @@ public class SmsAdapter {
}
}
public Object listSms(Integer type, String iccid) {
public SmsReturn listSms(Integer type, String iccid) {
SmsReturn result = new SmsReturn();
result.setType(type);
String today = DateUtil.format(new Date(), "yyyy-MM-dd");
if (Constants.NetType_Dahan.equals(type)) {
return dahanWeb.listSms(iccid, today);
Object obj = dahanWeb.listSms(iccid, today);
result.setData(obj);
} else if (Constants.NetType_Rabchaser.equals(type)) {
rabchaserWeb.listSms(iccid, today);
Object obj = rabchaserWeb.listSms(iccid, today);
result.setData(obj);
} else if (Constants.NetType_M2M10086.equals(type)) {
m2m10086Web.listSms(iccid, today);
Object obj = m2m10086Web.listSms(iccid, today);
result.setData(obj);
} else if (Constants.NetType_LWWLKJ.equals(type)) {
lwwlkjWeb.listSms(iccid, today);
Object obj = lwwlkjWeb.listSms(iccid, today);
result.setData(obj);
}
return null;
return result;
}
}

@ -5,6 +5,7 @@ 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.model.SmsReturn;
import com.shxy.xymanager_common.sms.SmsAdapter;
import com.shxy.xymanager_dao.dao.TerminalSimcardMapper;
import com.shxy.xymanager_service.service.*;
@ -87,7 +88,7 @@ public class SmsServiceImpl implements SmsService {
}
@Override
public Object listSms(Integer termId) {
public SmsReturn listSms(Integer termId) {
Terminals term = newCacheService.getTerminal(termId);
if (term == null) {
throw new ApiException(termId + "该装置不存在");

@ -1,11 +1,12 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.model.SmsModel;
import com.shxy.xymanager_common.model.SmsReturn;
public interface SmsService {
void sendSms(SmsModel model);
Object listSms(Integer termId);
SmsReturn listSms(Integer termId);
}

Loading…
Cancel
Save