作者 朱兆平

Merge remote-tracking branch 'origin/forWechatService' into forWechatService

@@ -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 +}
@@ -102,7 +102,7 @@ public class UpfileJsonController { @@ -102,7 +102,7 @@ public class UpfileJsonController {
102 or.setConsigneeaddress(arr.get(47));//收货人地址 102 or.setConsigneeaddress(arr.get(47));//收货人地址
103 or.setCreatedate(new Date());//创建日期yyyy-MM-dd HH:mm:ss 103 or.setCreatedate(new Date());//创建日期yyyy-MM-dd HH:mm:ss
104 or.setFlightDate(format.parse(arr.get(66)));//航班日期yyyy-MM-dd 104 or.setFlightDate(format.parse(arr.get(66)));//航班日期yyyy-MM-dd
105 - or.setStatus("17");//操作状态 105 + or.setStatus("01");//操作状态
106 or.setIsbatch("T");//分批标识 106 or.setIsbatch("T");//分批标识
107 or.setShipperCountrycode(arr.get(86));//发货人国家代码 107 or.setShipperCountrycode(arr.get(86));//发货人国家代码
108 or.setShipperPhone(arr.get(106));//发货人联系电话 108 or.setShipperPhone(arr.get(106));//发货人联系电话
  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 +}
@@ -22,8 +22,7 @@ import java.util.ArrayList; @@ -22,8 +22,7 @@ import java.util.ArrayList;
22 import java.util.Date; 22 import java.util.Date;
23 import java.util.List; 23 import java.util.List;
24 24
25 -import static org.apache.poi.ss.usermodel.CellType.BLANK;  
26 -import static org.apache.poi.ss.usermodel.CellType.STRING; 25 +import static org.apache.poi.ss.usermodel.CellType.*;
27 26
28 /** 27 /**
29 * shenhailong 28 * shenhailong
@@ -59,7 +58,7 @@ public class ExcelUtils { @@ -59,7 +58,7 @@ public class ExcelUtils {
59 } 58 }
60 totoalRows = xssfSheet.getLastRowNum(); 59 totoalRows = xssfSheet.getLastRowNum();
61 //读取row 60 //读取row
62 - for (int rowIndex = 2; rowIndex <= totoalRows; rowIndex++) { 61 + for (int rowIndex = 1; rowIndex <= totoalRows; rowIndex++) {
63 XSSFRow xssfRow = xssfSheet.getRow(rowIndex); 62 XSSFRow xssfRow = xssfSheet.getRow(rowIndex);
64 63
65 if (xssfRow == null) { 64 if (xssfRow == null) {
@@ -145,12 +144,12 @@ public class ExcelUtils { @@ -145,12 +144,12 @@ public class ExcelUtils {
145 //读取列 144 //读取列
146 for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) { 145 for (int cellIndex = 0; cellIndex < totalCells; cellIndex++) {
147 HSSFCell hssfCell = hssfRow.getCell(cellIndex); 146 HSSFCell hssfCell = hssfRow.getCell(cellIndex);
148 - if (hssfCell == null) { 147 + if (hssfCell == null || String.valueOf(hssfCell)=="") {
149 rowList.add(""); 148 rowList.add("");
150 } else { 149 } else {
151 // System.out.println(hssfCell.getCellType()); 150 // System.out.println(hssfCell.getCellType());
152 151
153 - if(BLANK==hssfCell.getCellType()){ 152 + if(NUMERIC==hssfCell.getCellType()){
154 if(DateUtil.isCellDateFormatted(hssfCell)){ 153 if(DateUtil.isCellDateFormatted(hssfCell)){
155 //用于转化为日期格式 154 //用于转化为日期格式
156 Date d = hssfCell.getDateCellValue(); 155 Date d = hssfCell.getDateCellValue();