Browse Source

operaccess模块修改feign

dev_shibei_match
yinzuomei 6 years ago
parent
commit
dfc459269c
  1. 8
      epmet-module/oper-access/oper-access-server/pom.xml
  2. 4
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/OperAccessApplication.java
  3. 2
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java
  4. 11
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java
  5. 2
      epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml
  6. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java

8
epmet-module/oper-access/oper-access-server/pom.xml

@ -59,6 +59,12 @@
<version>2.0.0</version> <version>2.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<!-- 替换Feign原生httpclient -->
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>10.3.0</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
@ -147,4 +153,4 @@
</profile> </profile>
</profiles> </profiles>
</project> </project>

4
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/AccessApplication.java → epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/OperAccessApplication.java

@ -14,8 +14,8 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication @SpringBootApplication
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients @EnableFeignClients
public class AccessApplication { public class OperAccessApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(AccessApplication.class, args); SpringApplication.run(OperAccessApplication.class, args);
} }
} }

2
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/config/ModuleConfigImpl.java

@ -21,6 +21,6 @@ import org.springframework.stereotype.Service;
public class ModuleConfigImpl implements ModuleConfig { public class ModuleConfigImpl implements ModuleConfig {
@Override @Override
public String getName() { public String getName() {
return "access"; return "operaccess";
} }
} }

11
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/feign/EpmetUserFeignClient.java

@ -5,10 +5,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.OperUserDTO; import com.epmet.dto.OperUserDTO;
import com.epmet.feign.fallback.EpmetUserFeignClientFallback; import com.epmet.feign.fallback.EpmetUserFeignClientFallback;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/** /**
* @author zhaoqifeng * @author zhaoqifeng
@ -22,11 +19,11 @@ public interface EpmetUserFeignClient {
* *
* 根据id查询运营人员详情 * 根据id查询运营人员详情
* *
* @param id ID * @param operUserId oper_user表主键
* @return com.epmet.commons.tools.utils.Result<java.util.List <com.epmet.dto.OperUserDTO>> * @return com.epmet.commons.tools.utils.Result<java.util.List <com.epmet.dto.OperUserDTO>>
* @author zhaoqifeng * @author zhaoqifeng
* @date 2020/3/19 09:28 * @date 2020/3/19 09:28
**/ **/
@PostMapping("/user/info/") @GetMapping("/operuser/queryOperUserDtoById/{operUserId}")
Result<OperUserDTO> info(@RequestBody String id); Result<OperUserDTO> info(@PathVariable("operUserId") String operUserId);
} }

2
epmet-module/oper-access/oper-access-server/src/main/resources/bootstrap.yml

@ -86,8 +86,6 @@ feign:
loggerLevel: BASIC loggerLevel: BASIC
httpclient: httpclient:
enabled: true enabled: true
max-connections: 200
max-connections-per-route: 50
hystrix: hystrix:
command: command:

14
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java

@ -46,9 +46,9 @@ import java.util.Map;
* @since v1.0.0 2020-03-18 * @since v1.0.0 2020-03-18
*/ */
@RestController @RestController
@RequestMapping("user") @RequestMapping("operuser")
public class OperUserController { public class OperUserController {
@Autowired @Autowired
private OperUserService operUserService; private OperUserService operUserService;
@ -96,14 +96,14 @@ public class OperUserController {
/** /**
* 获取运营人员信息 * 获取运营人员信息
* @param id 主键 * @param operUserId oper_user表主键
* @return OperUserDTO * @return OperUserDTO
* @author zhaoqifeng * @author zhaoqifeng
*/ */
@PostMapping("info") @GetMapping("queryOperUserDtoById/{operUserId}")
public Result<OperUserDTO> info(@RequestBody String id){ public Result<OperUserDTO> queryOperUserDtoById(@PathVariable("operUserId") String operUserId){
OperUserDTO data = operUserService.getOperUserInfoById(id); OperUserDTO data = operUserService.getOperUserInfoById(operUserId);
return new Result<OperUserDTO>().ok(data); return new Result<OperUserDTO>().ok(data);
} }
} }

Loading…
Cancel
Save