Commit b2520f89 by levphon

标准接口api

1 parent 87e1ce94
...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author zhouhaibao * @author zhouhaibao
* @date 2021/5/24 9:49 * @date 2021/5/24 9:49
*/ */
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/channelrisk", fallbackFactory = ChannelRiskFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/channelrisk", fallbackFactory = ChannelRiskFallbackFactory.class, decode404 = true)
public interface ChannelRiskClient { public interface ChannelRiskClient {
@GetMapping(value = "/selectbyworkstandsn") @GetMapping(value = "/selectbyworkstandsn")
......
...@@ -17,7 +17,7 @@ import java.util.List; ...@@ -17,7 +17,7 @@ import java.util.List;
* *
* @author yll * @author yll
*/ */
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/devicelocation", fallbackFactory = DeviceLocationFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/devicelocation", fallbackFactory = DeviceLocationFallbackFactory.class, decode404 = true)
public interface DeviceLocationClient { public interface DeviceLocationClient {
/** /**
......
...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
/** /**
* 围栏试驾信息Controller * 围栏试驾信息Controller
*/ */
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/fencedriver", fallbackFactory = ElectricFenceFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/fencedriver", fallbackFactory = ElectricFenceFallbackFactory.class, decode404 = true)
public interface ElectricFenceClient { public interface ElectricFenceClient {
@GetMapping(value = "/getfencedrive") @GetMapping(value = "/getfencedrive")
......
...@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
/** /**
* 不在店统计 feign * 不在店统计 feign
*/ */
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/electricinstore", fallbackFactory = ElectricInStoreFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/electricinstore", fallbackFactory = ElectricInStoreFallbackFactory.class, decode404 = true)
public interface ElectricInStoreClient { public interface ElectricInStoreClient {
@GetMapping(value = "/getelectricinstore") @GetMapping(value = "/getelectricinstore")
......
...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author zhouhaibao * @author zhouhaibao
* @date 2021/5/24 9:49 * @date 2021/5/24 9:49
*/ */
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/freqrecord", fallbackFactory = FreqRecordFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/freqrecord", fallbackFactory = FreqRecordFallbackFactory.class, decode404 = true)
public interface FreqRecordClient { public interface FreqRecordClient {
/** /**
* 获取数据集合 * 获取数据集合
......
...@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/routeoilmileage", fallbackFactory = StatisticsDriveFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/routeoilmileage", fallbackFactory = StatisticsDriveFallbackFactory.class, decode404 = true)
public interface RouteOilMileageClient { public interface RouteOilMileageClient {
/** /**
......
...@@ -14,7 +14,7 @@ import java.util.List; ...@@ -14,7 +14,7 @@ import java.util.List;
* @author zhouhaibao * @author zhouhaibao
* @date 2021/5/24 9:49 * @date 2021/5/24 9:49
*/ */
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/statisticsdrive", fallbackFactory = StatisticsDriveFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/statisticsdrive", fallbackFactory = StatisticsDriveFallbackFactory.class, decode404 = true)
public interface StatisticsDriveClient { public interface StatisticsDriveClient {
/** /**
* 获取数据集合 * 获取数据集合
......
...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping; ...@@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.GetMapping;
* @author zhouhaibao * @author zhouhaibao
* @date 2021/5/24 9:49 * @date 2021/5/24 9:49
*/ */
@FeignClient(name = "ne-shield-standard-interfaces", path = "/stdinterface/statisticsinstore", fallbackFactory = StatisticsInStoreFallbackFactory.class, decode404 = true) @FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/statisticsinstore", fallbackFactory = StatisticsInStoreFallbackFactory.class, decode404 = true)
public interface StatisticsInStoreClient { public interface StatisticsInStoreClient {
/** /**
......
package cn.com.glsx.stdinterface.api;
import cn.com.glsx.stdinterface.dto.CancelWorkOrderBO;
import cn.com.glsx.stdinterface.dto.InstallWorkOrderBO;
import cn.com.glsx.stdinterface.dto.RemoveWorkOrderBO;
import cn.com.glsx.stdinterface.dto.RepairWorkOrderBO;
import cn.com.glsx.stdinterface.factory.StatisticsInStoreFallbackFactory;
import com.glsx.plat.core.web.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@FeignClient(name = "ne-shield-standard-interfaces", path = "/nesi/workorder", fallbackFactory = StatisticsInStoreFallbackFactory.class, decode404 = true)
public interface WorkOrderClient {
/**
* 安装工单
*
* @param workOrderBO
* @return
*/
@PostMapping(value = "/create")
public R<Long> create(@RequestBody InstallWorkOrderBO workOrderBO);
/**
* 更新工单
*
* @param workOrderBO
* @return
*/
@PostMapping(value = "/update")
public R update(@RequestBody InstallWorkOrderBO workOrderBO);
/**
* 取消工单(还没安装,安装了必须用拆除工单接口)
*
* @param request
* @return
*/
@PostMapping(value = "/cancel")
public R cancel(@RequestBody CancelWorkOrderBO request);
/**
* 维修工单
*
* @param request
* @return
*/
@PostMapping(value = "/repair")
public R repair(@RequestBody RepairWorkOrderBO request);
/**
* 拆除工单
*
* @param workOrderBO
* @return
*/
@PostMapping(value = "/remove")
public R remove(@RequestBody RemoveWorkOrderBO workOrderBO);
}
package cn.com.glsx.stdinterface.dto;
import lombok.Data;
import javax.validation.constraints.NotBlank;
@Data
public class AbstractWorkOrderBO {
@NotBlank
private String workOrderNo;
private String orderSource;
private Long createdBy;
private String remark;
}
package cn.com.glsx.stdinterface.dto;
import lombok.Data;
@Data
public class CancelWorkOrderBO extends AbstractWorkOrderBO {
}
package cn.com.glsx.stdinterface.dto;
import lombok.Data;
import java.util.Date;
import java.util.List;
@Data
public class InstallWorkOrderBO extends AbstractWorkOrderBO {
/**
* 区域
*/
private String district;
/**
* 安装店面名
*/
private String shopName;
/**
* 店面联系人
*/
private String shopContactor;
/**
* 店面联系人手机号
*/
private String shopTelephone;
/**
* 服务期数,以月为单位
*/
private Integer servicePeriod;
/**
* 资金方
*/
private String fundProvider;
/**
* 购置方式 :自采,集采
*/
private String purchaseType;
/**
* 租赁方式 :直租;回租
*/
private String rentType;
/**
* 工单相关车辆
*/
List<WorkOrderVehicleBO> vehicles;
/***************************安装*****************************/
/**
* 安装联系人
*/
private String installLinker;
/**
* 安装联系电话
*/
private String installLinkerPhone;
/**
* 是否需要安装:Y需要,N不需要
*/
private String needInstall;
/**
* 安装说明
*/
private String installExplain;
/**
* 要求安装时间,yyyy-MM-dd HH:mm:ss
*/
private Date installTime;
/**
* 安装地址
*/
private String installAddress;
/***************************安装*****************************/
/***************************保险*****************************/
/**
* 是否需要投保:Y需要,N不需要
*/
// private String needInsure;
// private String insurancePolicyHolder;
// private String insuranceFirstBeneficiary;
// private String insuranceCertificate;
// private String insuranceTelephone;
/***************************保险*****************************/
}
package cn.com.glsx.stdinterface.dto;
import lombok.Data;
@Data
public class RemoveWorkOrderBO extends AbstractWorkOrderBO {
}
package cn.com.glsx.stdinterface.dto;
import lombok.Data;
@Data
public class RepairWorkOrderBO extends AbstractWorkOrderBO {
}
package cn.com.glsx.stdinterface.dto;
import lombok.Data;
@Data
public class WorkOrderVehicleBO {
/**
* 承租人姓名
*/
private String lesseeName;
/**
* 承租人手机号码
*/
private String lesseePhone;
/**
* 车架号(脱敏车架号)
*/
private String vin;
/**
* 车架号hash值
*/
private String vinHash;
/**
* 车牌号
*/
private String plateNo;
/**
* 发动机号
*/
private String engineNo;
/**
* 品牌、子品牌、车系、车型
*/
private Integer brandId;
private String brandName;
private Integer subBrandId;
private String subBrandName;
private Integer seriesId;
private String seriesName;
private Integer typeId;
private String typeName;
/**
* 车辆颜色
*/
private String color;
/**
* 车辆内饰颜色
*/
private String innerColor;
/**
* 安装设备组合,00000,十六进制表示方式:后三位标识位分别表示OBD设备个数,有线GPS设备个数,无线GPS设备个数,第一二标识位预留
* 如果单种设备安装数超过9,用A-F表示,逻辑上来说不可能超过10,极少超过3,如满足不了特殊情况,接口再单独调整
* 针对设备具体型号,如GT700,GT701,GT701A 安装说明(installExplain)即可,以目前对接多家租赁公司来说,其并不关心设备型号,也提供不了设备型号
*/
private String deviceCompose;
}
package cn.com.glsx.stdinterface.factory;
import cn.com.glsx.stdinterface.api.StatisticsInStoreClient;
import cn.com.glsx.stdinterface.api.WorkOrderClient;
import cn.com.glsx.stdinterface.fallback.StatisticsInStoreFallbackImpl;
import cn.com.glsx.stdinterface.fallback.WorkOrderFallbackImpl;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
@Component
public class WorkOrderFallbackFactory implements FallbackFactory<WorkOrderClient> {
@Override
public WorkOrderClient create(Throwable throwable) {
WorkOrderFallbackImpl fallback = new WorkOrderFallbackImpl();
fallback.setCause(throwable);
return fallback;
}
}
...@@ -20,7 +20,6 @@ public class ElectricInStoreFallbackImpl implements ElectricInStoreClient { ...@@ -20,7 +20,6 @@ public class ElectricInStoreFallbackImpl implements ElectricInStoreClient {
@Setter @Setter
private Throwable cause; private Throwable cause;
@Override @Override
public R getElectricInStore(Integer fenceId, String sn, String gpsTime) { public R getElectricInStore(Integer fenceId, String sn, String gpsTime) {
log.warn("getElectricInStore 熔断啦 {}", cause.getMessage()); log.warn("getElectricInStore 熔断啦 {}", cause.getMessage());
......
package cn.com.glsx.stdinterface.fallback;
import cn.com.glsx.stdinterface.api.WorkOrderClient;
import cn.com.glsx.stdinterface.dto.CancelWorkOrderBO;
import cn.com.glsx.stdinterface.dto.InstallWorkOrderBO;
import cn.com.glsx.stdinterface.dto.RemoveWorkOrderBO;
import cn.com.glsx.stdinterface.dto.RepairWorkOrderBO;
import com.glsx.plat.core.web.R;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
@Slf4j
@Component
public class WorkOrderFallbackImpl implements WorkOrderClient {
@Setter
private Throwable cause;
@Override
public R<Long> create(InstallWorkOrderBO workOrderBO) {
log.warn("create 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R update(InstallWorkOrderBO workOrderBO) {
log.warn("update 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R cancel(CancelWorkOrderBO request) {
log.warn("cancel 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R repair(RepairWorkOrderBO request) {
log.warn("repair 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
@Override
public R remove(RemoveWorkOrderBO workOrderBO) {
log.warn("remove 熔断啦 {}", cause.getMessage());
return R.ok("服务异常");
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!