jh-module-ecg/jh-module-ecg-biz/pom.xml
@@ -119,6 +119,13 @@ <groupId>com.xingyuv</groupId> <artifactId>spring-boot-starter-captcha-plus</artifactId> <!-- éªè¯ç ï¼ä¸è¬ç¨äºç»å½ä½¿ç¨ --> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> <version>${openfeign.version}</version> </dependency> </dependencies> </project> jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/appointment/AppointmentController.java
@@ -1,5 +1,9 @@ package cn.lihu.jh.module.ecg.controller.admin.appointment; import cn.lihu.jh.module.ecg.feign.RemoteDataService; import cn.lihu.jh.module.ecg.feign.RestApiReqBodyVo; import cn.lihu.jh.module.ecg.feign.RestApiReqParamVo; import cn.lihu.jh.module.ecg.feign.RestApiResult; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.springframework.security.access.prepost.PreAuthorize; @@ -37,6 +41,9 @@ @Resource private AppointmentService appointmentService; @Resource private RemoteDataService remoteDataService; @PostMapping("/create") @Operation(summary = "å建é¢çº¦") @@ -99,6 +106,17 @@ //TODO å¤çæéé»è¾ //AppointmentDO appointment = appointmentService.getAppointment(id); //return success(BeanUtils.toBean(appointment, AppointmentRespVO.class)); RestApiReqParamVo reqParamVo = new RestApiReqParamVo(); reqParamVo.setService("queryEcgRequest"); // queryEcgRequest QueryRisReportList reqParamVo.setUrid("ECG"); reqParamVo.setPwd("ECG"); RestApiReqBodyVo reqBodyVo = new RestApiReqBodyVo(); reqBodyVo.setSfzh("121"); reqBodyVo.setMzzyh("A34343"); RestApiResult<Object> result = remoteDataService.httpApi("queryEcgRequest", "ECG", "ECG", reqBodyVo); return success("hello"); } } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RemoteDataService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,16 @@ package cn.lihu.jh.module.ecg.feign; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; @FeignClient(name = "remote-data-service", url = "http://127.0.0.1:8080") public interface RemoteDataService { @PostMapping(value="/hai/HttpEntry/", produces = MediaType.APPLICATION_JSON_VALUE, consumes = MediaType.APPLICATION_JSON_VALUE) public RestApiResult<Object> httpApi( @RequestParam("service") String service, @RequestParam("urid") String urid, @RequestParam("pwd") String pwd, @RequestBody RestApiReqBodyVo bodyVo); } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RestApiReqBodyVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,9 @@ package cn.lihu.jh.module.ecg.feign; import lombok.Data; @Data public class RestApiReqBodyVo { String sfzh; String mzzyh; } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RestApiReqParamVo.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,34 @@ package cn.lihu.jh.module.ecg.feign; import lombok.Data; @Data public class RestApiReqParamVo { String service; String urid; String pwd; public String getService() { return service; } public void setService(String service) { this.service = service; } public String getUrid() { return urid; } public void setUrid(String urid) { this.urid = urid; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = pwd; } } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/feign/RestApiResult.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,65 @@ package cn.lihu.jh.module.ecg.feign; import lombok.Data; import java.io.Serializable; import java.util.List; /** * éç¨è¿å * * @param <T> æ°æ®æ³å */ @Data public class RestApiResult<T> implements Serializable { private Integer code; /** * è¿åæ°æ® */ private T data; private List<T> row; /** * é误æç¤ºï¼ç¨æ·å¯é 读 * */ private String msg; /** * å°ä¼ å ¥ç result 对象ï¼è½¬æ¢æå¦å¤ä¸ä¸ªæ³åç»æç对象 * * å 为 A æ¹æ³è¿åç CommonResult 对象ï¼ä¸æ»¡è¶³è°ç¨å ¶ç B æ¹æ³çè¿åï¼æä»¥éè¦è¿è¡è½¬æ¢ã * * @param result ä¼ å ¥ç result 对象 * @param <T> è¿åçæ³å * @return æ°ç CommonResult 对象 */ public static <T> RestApiResult<T> error(RestApiResult<?> result) { return error(result.getCode(), result.getMsg()); } public static <T> RestApiResult<T> error(Integer code, String message) { RestApiResult<T> result = new RestApiResult<>(); result.code = code; result.msg = message; return result; } public static <T> RestApiResult<T> success(T data) { RestApiResult<T> result = new RestApiResult<>(); result.code = 0; result.data = data; result.msg = ""; return result; } public static <T> RestApiResult<T> success(List<T> list) { RestApiResult<T> result = new RestApiResult<>(); result.code = 0; result.row = list; result.msg = ""; return result; } } jh-server/pom.xml
@@ -129,6 +129,12 @@ </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-openfeign</artifactId> <version>${openfeign.version}</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> jh-server/src/main/java/cn/lihu/jh/server/JhServerApplication.java
@@ -2,6 +2,7 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; /** * 项ç®çå¯å¨ç±» @@ -14,6 +15,7 @@ */ @SuppressWarnings("SpringComponentScan") // å¿½ç¥ IDEA æ æ³è¯å« ${jh.info.base-package} @SpringBootApplication(scanBasePackages = {"${jh.info.base-package}.server", "${jh.info.base-package}.module"}) @EnableFeignClients(basePackages = "cn.lihu.jh.module.ecg.feign") public class JhServerApplication { public static void main(String[] args) { jh-server/src/main/resources/application-local.yaml
@@ -70,10 +70,10 @@ # Redis é ç½®ãRedisson é»è®¤çé 置足å¤ä½¿ç¨ï¼ä¸è¬ä¸éè¦è¿è¡è°ä¼ redis: host: r-bp1zyjl0g07e1ry08rpd.redis.rds.aliyuncs.com # å°å port: 6379 # ç«¯å£ host: 116.62.18.175 #r-bp1zyjl0g07e1ry08rpd.redis.rds.aliyuncs.com # å°å port: 6020 #ç«¯å£ 6379 database: 2 # æ°æ®åºç´¢å¼ password: Root@yinyu # å¯ç ï¼å»ºè®®ç产ç¯å¢å¼å¯ password: Smartor #Root@yinyu # å¯ç ï¼å»ºè®®ç产ç¯å¢å¼å¯ --- #################### 宿¶ä»»å¡ç¸å ³é ç½® #################### pom.xml
@@ -43,6 +43,7 @@ <!-- ççåæ¾å° bom é --> <lombok.version>1.18.34</lombok.version> <spring.boot.version>2.7.18</spring.boot.version> <openfeign.version>3.1.3</openfeign.version> <mapstruct.version>1.5.5.Final</mapstruct.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties>