提交 7fbc4716 authored 作者: hzh's avatar hzh

代码优化

上级 ba040b56
package org.dromara.common.ys.exception;
/**
* @author hzh
* @date 2025-06-20
**/
public class YunShangException extends RuntimeException {
public YunShangException(String message) {
super("云上资源方调用失败:" + message);
}
}
......@@ -8,6 +8,7 @@ import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.common.PageInfo;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.bill.BillApiEnum;
import org.dromara.common.ys.exception.YunShangException;
import org.dromara.common.ys.model.req.bill.AccountDetailModel;
import org.dromara.common.ys.model.req.bill.ConfirmReconModel;
import org.dromara.common.ys.model.res.bill.*;
......@@ -33,7 +34,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), QueryBillModel.class);
}
......@@ -48,7 +49,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), QueryBillAllModel.class);
}
......@@ -63,7 +64,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return PageInfo.<AccountDetailBeanModel>builder().build()
......@@ -94,7 +95,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), ConsTicketListModel.class);
}
......@@ -109,7 +110,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), TravelBillPushStatementModel.class);
}
......@@ -124,7 +125,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), TravelBillGetCompareResultModel.class);
}
......@@ -139,7 +140,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), EditBxjlModel.class);
}
......@@ -154,7 +155,7 @@ public class BillServiceImpl implements IBillService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
}
}
......@@ -7,6 +7,7 @@ import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.resource.CommonResourceApiEnum;
import org.dromara.common.ys.exception.YunShangException;
import org.dromara.common.ys.model.req.commonResource.*;
import org.dromara.common.ys.service.ICommonResourceService;
import org.springframework.stereotype.Service;
......@@ -32,7 +33,7 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
JSON.toJSONString(new CountryModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("countryDataList"), org.dromara.common.ys.model.res.comomResource.CountryModel.class);
}
......@@ -47,7 +48,7 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
JSON.toJSONString(new ProvinceModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("provinceDataList"), org.dromara.common.ys.model.res.comomResource.ProvinceModel.class);
}
......@@ -62,7 +63,7 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
JSON.toJSONString(new CityModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
......@@ -80,7 +81,7 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
JSON.toJSONString(new AirportModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
......@@ -99,7 +100,7 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
JSON.toJSONString(new StationModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
......@@ -118,7 +119,7 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
JSON.toJSONString(new TrainBaseModel())
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
......@@ -138,7 +139,7 @@ public class CommonResourceServiceImpl implements ICommonResourceService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return new ArrayList<>();
......
......@@ -8,6 +8,7 @@ import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.common.PageInfo;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.hotel.HotelApiEnum;
import org.dromara.common.ys.exception.YunShangException;
import org.dromara.common.ys.model.req.hotel.HotelQueryOrderModel;
import org.dromara.common.ys.model.req.hotel.HotelQueryRefundOrderModel;
import org.dromara.common.ys.model.req.hotel.PayOrderModel;
......@@ -37,7 +38,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return null;
......@@ -55,7 +56,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return Optional.ofNullable(res.getData()).map(data->JSON.parseObject(JSON.parseObject(data).toJSONString(), HotelShoppingPricePlanModel.class)).orElse(null);
}
......@@ -70,7 +71,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return PageInfo.<HotelShoppingBaseListModel>builder().build()
......@@ -101,7 +102,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), HotelOrderBookModel.class);
}
......@@ -116,7 +117,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), CancelOrderModel.class);
}
......@@ -131,7 +132,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return true;
}
......@@ -146,7 +147,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), HotelOrderQueryDetailModel.class);
}
......@@ -161,7 +162,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return PageInfo.<HotelOrderQueryListModel>builder().build()
......@@ -192,7 +193,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("orderGather"), HtOrderInfoModel.class);
}
......@@ -207,7 +208,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("orderGather"), HtRefundInfoModel.class);
}
......@@ -222,7 +223,7 @@ public class HotelServiceImpl implements IHotelService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), HotelOrderXjdModel.class);
}
......
......@@ -7,6 +7,7 @@ import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.insurance.InsuranceApiEnum;
import org.dromara.common.ys.exception.YunShangException;
import org.dromara.common.ys.model.req.insurance.BxcpModel;
import org.dromara.common.ys.service.IInsuranceService;
import org.springframework.stereotype.Service;
......@@ -31,7 +32,7 @@ public class InsuranceServiceImpl implements IInsuranceService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("cpList"), org.dromara.common.ys.model.res.insurance.BxcpModel.class);
}
......
......@@ -7,8 +7,9 @@ import org.dromara.common.ys.common.ApiHttpResponse;
import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.org.OrgApiEnum;
import org.dromara.common.ys.service.IOrgService;
import org.dromara.common.ys.exception.YunShangException;
import org.dromara.common.ys.model.req.org.EditEmployeeModel;
import org.dromara.common.ys.service.IOrgService;
import org.springframework.stereotype.Service;
/**
......@@ -29,7 +30,7 @@ public class OrgServiceImpl implements IOrgService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return true;
}
......
......@@ -8,6 +8,7 @@ import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.common.PageInfo;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.qz.QzApiEnum;
import org.dromara.common.ys.exception.YunShangException;
import org.dromara.common.ys.model.req.qz.*;
import org.dromara.common.ys.model.res.qz.GetAssociatDetailModel;
import org.dromara.common.ys.model.res.qz.GetProdDetailModel;
......@@ -36,7 +37,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return PageInfo.<VisaProdBeanModel>builder().build()
......@@ -67,7 +68,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return PageInfo.<AssocitionBeanModel>builder().build()
......@@ -98,7 +99,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return PageInfo.<OrderListBeanModel>builder().build()
......@@ -129,7 +130,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), GetProdDetailModel.class);
}
......@@ -144,7 +145,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), QzOrderGetDetailModel.class);
}
......@@ -159,7 +160,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
}
......@@ -173,7 +174,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(JSON.parseObject(res.getData()).toJSONString(), GetAssociatDetailModel.class);
}
......@@ -188,7 +189,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("newAppointmentBeans"), NewAppointmentBeanModel.class);
}
......@@ -203,7 +204,7 @@ public class QzServiceImpl implements IQzService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
}
}
......@@ -8,6 +8,7 @@ import org.dromara.common.ys.common.Code;
import org.dromara.common.ys.common.PageInfo;
import org.dromara.common.ys.enums.DomainEnum;
import org.dromara.common.ys.enums.vehicles.VehiclesApiEnum;
import org.dromara.common.ys.exception.YunShangException;
import org.dromara.common.ys.model.req.vehicles.ConfirmPayApiModel;
import org.dromara.common.ys.model.req.vehicles.EstimateJsycPriceModel;
import org.dromara.common.ys.model.req.vehicles.EstimateYyycPriceModel;
......@@ -37,7 +38,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.vehicles.EstimateYyycPriceModel.class);
}
......@@ -53,7 +54,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), org.dromara.common.ys.model.res.vehicles.EstimateJsycPriceModel.class);
}
......@@ -69,7 +70,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), OrderDetailModel.class);
}
......@@ -85,7 +86,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
if (res.getData() == null) {
return PageInfo.<OrderListModel>builder().build()
......@@ -117,7 +118,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), OrderBookJsycModel.class);
}
......@@ -133,7 +134,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), OrderBookYyycModel.class);
}
......@@ -149,7 +150,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), DriverLocationModel.class);
}
......@@ -165,7 +166,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), CancelFeeModel.class);
}
......@@ -181,7 +182,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseObject(res.getData(), OrderCancelModel.class);
}
......@@ -197,7 +198,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(model)
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
}
......@@ -212,7 +213,7 @@ public class VehiclesServiceImpl implements IVehiclesService {
JSON.toJSONString(new HashMap<>(8))
);
if (!CharSequenceUtil.equals(res.getErrCode(), Code.SUCCESS.getCode())) {
throw new RuntimeException(res.getTips());
throw new YunShangException(res.getTips());
}
return JSON.parseArray(JSON.parseObject(res.getData()).getString("qxyyList"), OrderGetQxyyModel.class);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论