Commit 29ee9345 authored by 赵啸非's avatar 赵啸非

物联网1.0

parent ed3102e2
package com.mortals.xhx.common.pdu;
import lombok.Data;
/**
* @author: zxfei
* @date: 2022/6/28 17:21
* @description:
**/
@Data
public class UserPdu {
private String loginName;
private String password;
private String securityCode;
}
package com.mortals.xhx.feign;
public interface IFeign {
}
package com.mortals.xhx.feign.area;
import com.mortals.xhx.common.pdu.area.AreaPdu;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;
/**
* 区域 Feign接口
* @author zxfei
* @date 2022-06-28
*/
@FeignClient(name = "base-manager", path = "/base", fallback = AreaFeignFallbackFactory.class)
public interface IAreaFeign extends IFeign {
/**
* 查看区域列表
*
* @param areaPdu
* @return
*/
@PostMapping(value = "/area/list")
String list(@RequestBody AreaPdu areaPdu);
/**
* 查看区域
*
* @param id
* @return
*/
@GetMapping(value = "/area/info")
String info(@RequestParam(value = "id") Long id);
/**
* 删除区域
*
* @param ids
* @return
*/
@GetMapping(value = "/area/delete")
String delete(Long[] ids,@RequestHeader("Authorization") String authorization);
/**
* 区域保存更新
*
* @param areaPdu
* @return
*/
@PostMapping(value = "/area/save")
String save(@RequestBody AreaPdu areaPdu,@RequestHeader("Authorization") String authorization);
}
@Slf4j
@Component
class AreaFeignFallbackFactory implements FallbackFactory<IAreaFeign> {
@Override
public IAreaFeign create(Throwable t) {
return new IAreaFeign() {
@Override
public String list(AreaPdu areaPdu) {
return JSON.toJSONString(Rest.fail("暂时无法获取区域列表,请稍后再试!"));
}
@Override
public String info(Long id) {
return JSON.toJSONString(Rest.fail("暂时无法获取区域详细,请稍后再试!"));
}
@Override
public String delete(Long[] ids, String authorization) {
return JSON.toJSONString(Rest.fail("暂时无法删除区域,请稍后再试!"));
}
@Override
public String save(AreaPdu areaPdu, String authorization) {
return JSON.toJSONString(Rest.fail("暂时无法保存区域,请稍后再试!"));
}
};
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment