作者 xudada

查询分拨申请

@@ -51,7 +51,7 @@ spring: @@ -51,7 +51,7 @@ spring:
51 # url: jdbc:oracle:thin:@192.168.1.199:10069:CGODB 51 # url: jdbc:oracle:thin:@192.168.1.199:10069:CGODB
52 # username: CGONMS 52 # username: CGONMS
53 # password: 1q2w3e4r 53 # password: 1q2w3e4r
54 - url: jdbc:oracle:thin:@192.168.1.253:1522:ORCLL 54 + url: jdbc:oracle:thin:@118.31.66.166:17005:ORCLL
55 username: CGONMS 55 username: CGONMS
56 password: vmvnv1v2 56 password: vmvnv1v2
57 #spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码 57 #spring datasource mysql,注意编码配置,缺少数据库编码配置容易引起中文入库乱码
@@ -193,6 +193,10 @@ mq: @@ -193,6 +193,10 @@ mq:
193 vHost: NMMS 193 vHost: NMMS
194 username: admin 194 username: admin
195 password: admin 195 password: admin
  196 +feign:
  197 + hystrix:
  198 + enabled: true
  199 +inport-url: http://nmms1.15miaoo.com:17999
196 info: 200 info:
197 version: 1.0 201 version: 1.0
198 description: "新舱单辅助管理服务-统一认证、转运管理、提前运抵等" 202 description: "新舱单辅助管理服务-统一认证、转运管理、提前运抵等"
@@ -192,6 +192,11 @@ @@ -192,6 +192,11 @@
192 <artifactId>springfox-swagger-ui</artifactId> 192 <artifactId>springfox-swagger-ui</artifactId>
193 <version>2.9.2</version> 193 <version>2.9.2</version>
194 </dependency> 194 </dependency>
  195 +
  196 + <dependency>
  197 + <groupId>org.springframework.cloud</groupId>
  198 + <artifactId>spring-cloud-starter-openfeign</artifactId>
  199 + </dependency>
195 </dependencies> 200 </dependencies>
196 201
197 <dependencyManagement> 202 <dependencyManagement>
@@ -10,6 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -10,6 +10,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
10 import org.springframework.boot.web.client.RestTemplateBuilder; 10 import org.springframework.boot.web.client.RestTemplateBuilder;
11 import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 11 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
12 import org.springframework.cloud.client.loadbalancer.LoadBalanced; 12 import org.springframework.cloud.client.loadbalancer.LoadBalanced;
  13 +import org.springframework.cloud.openfeign.EnableFeignClients;
13 import org.springframework.context.annotation.Bean; 14 import org.springframework.context.annotation.Bean;
14 import org.springframework.context.annotation.ComponentScan; 15 import org.springframework.context.annotation.ComponentScan;
15 import org.springframework.transaction.annotation.EnableTransactionManagement; 16 import org.springframework.transaction.annotation.EnableTransactionManagement;
@@ -19,6 +20,7 @@ import org.springframework.web.client.RestTemplate; @@ -19,6 +20,7 @@ import org.springframework.web.client.RestTemplate;
19 //@EnableScheduling 20 //@EnableScheduling
20 @EnableDiscoveryClient 21 @EnableDiscoveryClient
21 @EnableTransactionManagement 22 @EnableTransactionManagement
  23 +@EnableFeignClients
22 @MapperScan("com.tianbo.analysis.dao") 24 @MapperScan("com.tianbo.analysis.dao")
23 public class NmmsAdminApplication { 25 public class NmmsAdminApplication {
24 26
  1 +package com.tianbo.analysis.controller;
  2 +
  3 +import com.tianbo.analysis.model.INPORTALLOCATE;
  4 +import com.tianbo.analysis.model.InportallocateMode;
  5 +import com.tianbo.analysis.model.ResultJson;
  6 +import com.tianbo.analysis.service.InportallcateService;
  7 +import lombok.extern.slf4j.Slf4j;
  8 +import org.springframework.beans.factory.annotation.Autowired;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import java.util.List;
  14 +import java.util.Map;
  15 +
  16 +@Slf4j
  17 +@RestController
  18 +@RequestMapping("/inport")
  19 +public class InportallocateController {
  20 + @Autowired
  21 + InportallcateService inportallcateService;
  22 + @RequestMapping("/selectInportallocates")
  23 + public ResultJson getById(@RequestParam(value = "waybill",required = true) String waybill,
  24 + @RequestParam(value = "pageIndex",required = true) int pageIndex,
  25 + @RequestParam(value = "pageSize",required = true) int pageSize){
  26 + InportallocateMode mode=new InportallocateMode();
  27 + mode.setWaybill(waybill);
  28 + mode.setPageIndex(pageIndex);
  29 + mode.setPageSize(pageSize);
  30 + Map map=inportallcateService.selectAllocate(mode);
  31 + return new ResultJson<>("200","success",map);
  32 + }
  33 +}
  1 +package com.tianbo.analysis.model;
  2 +
  3 +import lombok.Data;
  4 +
  5 +@Data
  6 +public class InportallocateMode {
  7 + private String waybill;
  8 + private int pageIndex;
  9 + private int pageSize;
  10 +}
  1 +package com.tianbo.analysis.service;
  2 +
  3 +import com.tianbo.analysis.model.InportallocateMode;
  4 +import com.tianbo.analysis.service.imp.InportallocateImpl;
  5 +import org.springframework.cloud.openfeign.FeignClient;
  6 +import org.springframework.stereotype.Component;
  7 +import org.springframework.web.bind.annotation.PostMapping;
  8 +
  9 +import java.util.Map;
  10 +@Component
  11 +@FeignClient(url="${inport-url}",fallback = InportallocateImpl.class,name = "InportFeign")
  12 +public interface InportallcateService {
  13 +
  14 + @PostMapping("/Allocate/querypage_inportallocate")
  15 + Map selectAllocate(InportallocateMode mode);
  16 +}
  1 +package com.tianbo.analysis.service.imp;
  2 +
  3 +import com.tianbo.analysis.model.InportallocateMode;
  4 +import com.tianbo.analysis.service.InportallcateService;
  5 +import lombok.extern.slf4j.Slf4j;
  6 +import org.springframework.stereotype.Service;
  7 +
  8 +import java.util.Map;
  9 +
  10 +@Slf4j
  11 +@Service
  12 +public class InportallocateImpl implements InportallcateService {
  13 + @Override
  14 + public Map selectAllocate(InportallocateMode mode) {
  15 + log.info("调用分拨接口失败");
  16 + return null;
  17 + }
  18 +}