Showing
32 changed files
with
1739 additions
and
0 deletions
.gitignore
0 → 100644
| 1 | +HELP.md | ||
| 2 | +target/ | ||
| 3 | +!.mvn/wrapper/maven-wrapper.jar | ||
| 4 | +!**/src/main/**/target/ | ||
| 5 | +!**/src/test/**/target/ | ||
| 6 | + | ||
| 7 | +### STS ### | ||
| 8 | +.apt_generated | ||
| 9 | +.classpath | ||
| 10 | +.factorypath | ||
| 11 | +.project | ||
| 12 | +.settings | ||
| 13 | +.springBeans | ||
| 14 | +.sts4-cache | ||
| 15 | + | ||
| 16 | +### IntelliJ IDEA ### | ||
| 17 | +.idea | ||
| 18 | +*.iws | ||
| 19 | +*.iml | ||
| 20 | +*.ipr | ||
| 21 | + | ||
| 22 | +### NetBeans ### | ||
| 23 | +/nbproject/private/ | ||
| 24 | +/nbbuild/ | ||
| 25 | +/dist/ | ||
| 26 | +/nbdist/ | ||
| 27 | +/.nb-gradle/ | ||
| 28 | +build/ | ||
| 29 | +!**/src/main/**/build/ | ||
| 30 | +!**/src/test/**/build/ | ||
| 31 | + | ||
| 32 | +### VS Code ### | ||
| 33 | +.vscode/ |
.mvn/wrapper/MavenWrapperDownloader.java
0 → 100644
| 1 | +/* | ||
| 2 | + * Copyright 2007-present the original author or authors. | ||
| 3 | + * | ||
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | + * you may not use this file except in compliance with the License. | ||
| 6 | + * You may obtain a copy of the License at | ||
| 7 | + * | ||
| 8 | + * https://www.apache.org/licenses/LICENSE-2.0 | ||
| 9 | + * | ||
| 10 | + * Unless required by applicable law or agreed to in writing, software | ||
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, | ||
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 13 | + * See the License for the specific language governing permissions and | ||
| 14 | + * limitations under the License. | ||
| 15 | + */ | ||
| 16 | +import java.net.*; | ||
| 17 | +import java.io.*; | ||
| 18 | +import java.nio.channels.*; | ||
| 19 | +import java.util.Properties; | ||
| 20 | + | ||
| 21 | +public class MavenWrapperDownloader { | ||
| 22 | + | ||
| 23 | + private static final String WRAPPER_VERSION = "0.5.6"; | ||
| 24 | + /** | ||
| 25 | + * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. | ||
| 26 | + */ | ||
| 27 | + private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" | ||
| 28 | + + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to | ||
| 32 | + * use instead of the default one. | ||
| 33 | + */ | ||
| 34 | + private static final String MAVEN_WRAPPER_PROPERTIES_PATH = | ||
| 35 | + ".mvn/wrapper/maven-wrapper.properties"; | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * Path where the maven-wrapper.jar will be saved to. | ||
| 39 | + */ | ||
| 40 | + private static final String MAVEN_WRAPPER_JAR_PATH = | ||
| 41 | + ".mvn/wrapper/maven-wrapper.jar"; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * Name of the property which should be used to override the default download url for the wrapper. | ||
| 45 | + */ | ||
| 46 | + private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; | ||
| 47 | + | ||
| 48 | + public static void main(String args[]) { | ||
| 49 | + System.out.println("- Downloader started"); | ||
| 50 | + File baseDirectory = new File(args[0]); | ||
| 51 | + System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); | ||
| 52 | + | ||
| 53 | + // If the maven-wrapper.properties exists, read it and check if it contains a custom | ||
| 54 | + // wrapperUrl parameter. | ||
| 55 | + File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); | ||
| 56 | + String url = DEFAULT_DOWNLOAD_URL; | ||
| 57 | + if(mavenWrapperPropertyFile.exists()) { | ||
| 58 | + FileInputStream mavenWrapperPropertyFileInputStream = null; | ||
| 59 | + try { | ||
| 60 | + mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); | ||
| 61 | + Properties mavenWrapperProperties = new Properties(); | ||
| 62 | + mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); | ||
| 63 | + url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); | ||
| 64 | + } catch (IOException e) { | ||
| 65 | + System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); | ||
| 66 | + } finally { | ||
| 67 | + try { | ||
| 68 | + if(mavenWrapperPropertyFileInputStream != null) { | ||
| 69 | + mavenWrapperPropertyFileInputStream.close(); | ||
| 70 | + } | ||
| 71 | + } catch (IOException e) { | ||
| 72 | + // Ignore ... | ||
| 73 | + } | ||
| 74 | + } | ||
| 75 | + } | ||
| 76 | + System.out.println("- Downloading from: " + url); | ||
| 77 | + | ||
| 78 | + File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); | ||
| 79 | + if(!outputFile.getParentFile().exists()) { | ||
| 80 | + if(!outputFile.getParentFile().mkdirs()) { | ||
| 81 | + System.out.println( | ||
| 82 | + "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); | ||
| 83 | + } | ||
| 84 | + } | ||
| 85 | + System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); | ||
| 86 | + try { | ||
| 87 | + downloadFileFromURL(url, outputFile); | ||
| 88 | + System.out.println("Done"); | ||
| 89 | + System.exit(0); | ||
| 90 | + } catch (Throwable e) { | ||
| 91 | + System.out.println("- Error downloading"); | ||
| 92 | + e.printStackTrace(); | ||
| 93 | + System.exit(1); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + private static void downloadFileFromURL(String urlString, File destination) throws Exception { | ||
| 98 | + if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { | ||
| 99 | + String username = System.getenv("MVNW_USERNAME"); | ||
| 100 | + char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); | ||
| 101 | + Authenticator.setDefault(new Authenticator() { | ||
| 102 | + @Override | ||
| 103 | + protected PasswordAuthentication getPasswordAuthentication() { | ||
| 104 | + return new PasswordAuthentication(username, password); | ||
| 105 | + } | ||
| 106 | + }); | ||
| 107 | + } | ||
| 108 | + URL website = new URL(urlString); | ||
| 109 | + ReadableByteChannel rbc; | ||
| 110 | + rbc = Channels.newChannel(website.openStream()); | ||
| 111 | + FileOutputStream fos = new FileOutputStream(destination); | ||
| 112 | + fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); | ||
| 113 | + fos.close(); | ||
| 114 | + rbc.close(); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | +} |
.mvn/wrapper/maven-wrapper.jar
0 → 100644
No preview for this file type
.mvn/wrapper/maven-wrapper.properties
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<DecMessage xmlns="http://www.chinaport.gov.cn/dec"> | ||
| 3 | + <DecHead> | ||
| 4 | + <SeqNo></SeqNo> | ||
| 5 | + <IEFlag>E</IEFlag> --进出口标志 | ||
| 6 | + <Type></Type> --单据类型 | ||
| 7 | + <AgentCode>Z321654987</AgentCode> ---固定取值1111980005 | ||
| 8 | + <AgentName>上海保险</AgentName>---固定取值联邦快递(中国)有限公司 | ||
| 9 | + <ApprNo></ApprNo> --不确定--- | ||
| 10 | + <BillNo>480506137754</BillNo> ---有总单号则取值“总单号_运单号”,没有总单号则取值“运单号 | ||
| 11 | + <ContrNo>SHA123456</ContrNo> --- | ||
| 12 | + <CopCode></CopCode> --录入单位代码,空值--- | ||
| 13 | + <CopName></CopName> --录入单位名称,空值--- | ||
| 14 | + <CustomMaster></CustomMaster> ---固定取值0101 | ||
| 15 | + <CutMode>201</CutMode> ---征免性质 | ||
| 16 | + <DeclTrnRel>0</DeclTrnRel> --报关/转关关系标志---固定取值0 | ||
| 17 | + <DistinatePort>ASM000</DistinatePort> --经停港/抵运港---指运港 | ||
| 18 | + <EdiId>报关标志</EdiId>--- | ||
| 19 | + <EntryId>海关编号</EntryId>--- | ||
| 20 | + <EdiId>报关标志</EdiId> | ||
| 21 | + <FeeCurr>运费币制</FeeCurr>---运费(币制) | ||
| 22 | + <FeeMark>运费标记</FeeMark>---固定取值3 | ||
| 23 | + <FeeCurr>运费币制</FeeCurr>---运费(币制) | ||
| 24 | + <FeeRate>运费/率</FeeRate>---运费总价 | ||
| 25 | + <GrossWet>111.0000000000</GrossWet> ---毛重(公斤) | ||
| 26 | + <InputerName>录入员名称</InputerName>--- | ||
| 27 | + <InsurCurr>MOP</InsurCurr> --保险费币制---保费(币制) | ||
| 28 | + <InsurMark>3</InsurMark> --保险费标记---固定取值3 | ||
| 29 | + <InsurCurr>121</InsurCurr> --保险费币制---保费(币制) | ||
| 30 | + <InsurRate>11.00</InsurRate> --保险费/率---保费总价 | ||
| 31 | + <ManualNo></ManualNo> --备案号 | ||
| 32 | + <NetWt>111.0000000000</NetWt> --净重---净重(公斤) | ||
| 33 | + <OtherCurr>杂费币制</OtherCurr>---杂费(币制) | ||
| 34 | + <OtherMark>杂费标志</OtherMark>--- | ||
| 35 | + <OtherRate>杂费/率</OtherRate>---杂费总价 | ||
| 36 | + <OwnerCode>Z321654987</OwnerCode> --消费使用/生产销售单位代码---生产核销单位海关编码 | ||
| 37 | + <OwnerName>上海保险</OwnerName> --消费使用/生产销售单位单位名称---生产核销单位 | ||
| 38 | + <PackNo>11</PackNo> --件数---运单件数 | ||
| 39 | + <PreEntryId>预录入编号</PreEntryId>---预录入编号 | ||
| 40 | + <TradeCountry>BLM</TradeCountry> --启运国/运抵国---抵运国(地区) | ||
| 41 | + <TradeMode>0200</TradeMode> --监管方式---监管方式 | ||
| 42 | + <TradeCode>Z321654987</TradeCode> --境内发货人海关编码---境内发货人海关编码 | ||
| 43 | + <TrafMode>运输方式代码</TrafMode>---运输方式 | ||
| 44 | + <TradeName>上海保险</TradeName> --境内发货人---境内发货人 | ||
| 45 | + <TransMode>4</TransMode> ---成交方式 | ||
| 46 | + <WrapType>22</WrapType> ---包装种类 | ||
| 47 | + <TradeCodeScc>A74125896321456987</TradeCodeScc> --境内发货人统一信用代码---生产核销单位统一信用证代码 | ||
| 48 | + <OwnerCodeScc>A74125896321456987</OwnerCodeScc> --生产核销单位统一信用代码---报关形式类型 | ||
| 49 | + <TradeAreaCode>699</TradeAreaCode> --贸易国别---贸易国(地区) | ||
| 50 | + <MarkNo></MarkNo> --标记及号码--- | ||
| 51 | + <EntyPortCode>310302</EntyPortCode> --入境口岸代码---固定字段310302 | ||
| 52 | + <GoodsPlace></GoodsPlace> --存放地点---空值 | ||
| 53 | + <DeclareName></DeclareName> --申报人员姓名---报关员证号 | ||
| 54 | + <OverseasConsignorCode>Z785421</OverseasConsignorCode>--境外发货人代码---境外收货人编码 | ||
| 55 | + <OverseasConsigneeCode>Z785421</OverseasConsigneeCode>--境外收货人编码---境外收货人编码 | ||
| 56 | + <OverseasConsigneeEname>Jerry</OverseasConsigneeEname>--境外收货人名称(外文)---境外收货人名称(外文) | ||
| 57 | + </DecHead> | ||
| 58 | + <DecLists> | ||
| 59 | + <DecList> | ||
| 60 | + <ClassMark/> --归类标志---空值 | ||
| 61 | + <CodeTS>3003101200</CodeTS>--商品编号---商品编号 | ||
| 62 | + <DeclPrice>111</DeclPrice>--申报单价--- | ||
| 63 | + <DeclTotal>111.0000000000</DeclTotal>--申报总价---总价 | ||
| 64 | + <DutyMode>1</DutyMode>--征减免税方式---征免 | ||
| 65 | + <ExgNo></ExgNo> --货号--- | ||
| 66 | + <ExgVersion></ExgVersion> --版本号--- | ||
| 67 | + <FirstUnit>035</FirstUnit> --第一计量单位(法定单位)---第一(法定)计量单位 | ||
| 68 | + <FirstQty>1.00000</FirstQty> --第一法定数量---第一(法定)数量 | ||
| 69 | + <GUnit>035</GUnit> --申报计量单位(成交计量单位)---成交单位 | ||
| 70 | + <GModel>2|3|4||||||||</GModel> --商品规格、型号---规格型号(品名) | ||
| 71 | + <GName>1</GName> ---商品名称 | ||
| 72 | + <GNo>1</GNo> --商品序号---商品明细条数从第一条开始数,第几条则为几,从1开始 | ||
| 73 | + <GQty>1.00</GQty> --申报数量(成交计量单位)---成交数量 | ||
| 74 | + <OriginCountry>CHN</OriginCountry> --原产地---最终目的国(地区) | ||
| 75 | + <SecondUnit></SecondUnit> --第二计量单位---第二(法定)计量单位 | ||
| 76 | + <SecondQty>11.00000</SecondQty> --第二法定数量---第二(法定)数量 | ||
| 77 | + <TradeCurr>JPY</TradeCurr> --成交币制---币制 | ||
| 78 | + <UseTo></UseTo> --用途/生产厂家---空值 | ||
| 79 | + <WorkUsd></WorkUsd> --工缴费--- | ||
| 80 | + <DestinationCountry>BLM</DestinationCountry> --最终目的国(地区)---原产地 | ||
| 81 | + <CiqCode></CiqCode> --CIQ代码--- | ||
| 82 | + <DeclGoodsEname></DeclGoodsEname> --申报货物名称(外文)--- | ||
| 83 | + <DestCode></DestCode> --目的地代码--- | ||
| 84 | + <DistrictCode>4408W</DistrictCode> --境内目的地/境内货源地---境内货源地 | ||
| 85 | + </DecList> | ||
| 86 | + </DecLists> | ||
| 87 | +</DecMessage> |
doc/EDI取值20210511ERRY.xlsx
0 → 100644
No preview for this file type
doc/Siemens CTM interface BTRD V1.1.docx
0 → 100644
No preview for this file type
doc/接口secrity明文.txt
0 → 100644
| 1 | + | ||
| 2 | + | ||
| 3 | +md5 小写 16位 | ||
| 4 | +iClearExportDev | ||
| 5 | +iClearExportTest | ||
| 6 | +iClearExportProd | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + | ||
| 11 | + | ||
| 12 | + | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | + | ||
| 23 | +1、接口数据模型调研 2 | ||
| 24 | +2、设计数据接口 2 | ||
| 25 | +3、接收运单数据 | ||
| 26 | + 3.1、接口开发(异步处理) 5 | ||
| 27 | + 3.1.1、数据落地 | ||
| 28 | + 3.1.2、数据推送到iClear | ||
| 29 | + 3.1.3、压力测试 | ||
| 30 | + 3.2、接口联调 3 | ||
| 31 | +4、推送数据 | ||
| 32 | + 4.1、推送报关数据 4 | ||
| 33 | + 4.2、推送回执 4 | ||
| 34 | + | ||
| 35 | +5、接口数据运维系统 10 | ||
| 36 | + 1、查询接收、推送数据日志及接收或推送的 结果 | ||
| 37 | + 2、补推数据功能 | ||
| 38 | + | ||
| 39 | +6、环境搭建 5 | ||
| 40 | + MQ+ MongoDB | ||
| 41 | + | ||
| 42 | + | ||
| 43 | +7、上线准备 1 | ||
| 44 | +8、服务部署 3 | ||
| 45 | + | ||
| 46 | +9、域名及SSL证书申请 3 |
doc/数据推送接口文档.docx
0 → 100644
No preview for this file type
doc/数据推送接口文档v2.docx
0 → 100644
No preview for this file type
doc/数据推送接口文档v3.docx
0 → 100644
No preview for this file type
mvnw
0 → 100644
| 1 | +#!/bin/sh | ||
| 2 | +# ---------------------------------------------------------------------------- | ||
| 3 | +# Licensed to the Apache Software Foundation (ASF) under one | ||
| 4 | +# or more contributor license agreements. See the NOTICE file | ||
| 5 | +# distributed with this work for additional information | ||
| 6 | +# regarding copyright ownership. The ASF licenses this file | ||
| 7 | +# to you under the Apache License, Version 2.0 (the | ||
| 8 | +# "License"); you may not use this file except in compliance | ||
| 9 | +# with the License. You may obtain a copy of the License at | ||
| 10 | +# | ||
| 11 | +# https://www.apache.org/licenses/LICENSE-2.0 | ||
| 12 | +# | ||
| 13 | +# Unless required by applicable law or agreed to in writing, | ||
| 14 | +# software distributed under the License is distributed on an | ||
| 15 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| 16 | +# KIND, either express or implied. See the License for the | ||
| 17 | +# specific language governing permissions and limitations | ||
| 18 | +# under the License. | ||
| 19 | +# ---------------------------------------------------------------------------- | ||
| 20 | + | ||
| 21 | +# ---------------------------------------------------------------------------- | ||
| 22 | +# Maven Start Up Batch script | ||
| 23 | +# | ||
| 24 | +# Required ENV vars: | ||
| 25 | +# ------------------ | ||
| 26 | +# JAVA_HOME - location of a JDK home dir | ||
| 27 | +# | ||
| 28 | +# Optional ENV vars | ||
| 29 | +# ----------------- | ||
| 30 | +# M2_HOME - location of maven2's installed home dir | ||
| 31 | +# MAVEN_OPTS - parameters passed to the Java VM when running Maven | ||
| 32 | +# e.g. to debug Maven itself, use | ||
| 33 | +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 | ||
| 34 | +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files | ||
| 35 | +# ---------------------------------------------------------------------------- | ||
| 36 | + | ||
| 37 | +if [ -z "$MAVEN_SKIP_RC" ] ; then | ||
| 38 | + | ||
| 39 | + if [ -f /etc/mavenrc ] ; then | ||
| 40 | + . /etc/mavenrc | ||
| 41 | + fi | ||
| 42 | + | ||
| 43 | + if [ -f "$HOME/.mavenrc" ] ; then | ||
| 44 | + . "$HOME/.mavenrc" | ||
| 45 | + fi | ||
| 46 | + | ||
| 47 | +fi | ||
| 48 | + | ||
| 49 | +# OS specific support. $var _must_ be set to either true or false. | ||
| 50 | +cygwin=false; | ||
| 51 | +darwin=false; | ||
| 52 | +mingw=false | ||
| 53 | +case "`uname`" in | ||
| 54 | + CYGWIN*) cygwin=true ;; | ||
| 55 | + MINGW*) mingw=true;; | ||
| 56 | + Darwin*) darwin=true | ||
| 57 | + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home | ||
| 58 | + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html | ||
| 59 | + if [ -z "$JAVA_HOME" ]; then | ||
| 60 | + if [ -x "/usr/libexec/java_home" ]; then | ||
| 61 | + export JAVA_HOME="`/usr/libexec/java_home`" | ||
| 62 | + else | ||
| 63 | + export JAVA_HOME="/Library/Java/Home" | ||
| 64 | + fi | ||
| 65 | + fi | ||
| 66 | + ;; | ||
| 67 | +esac | ||
| 68 | + | ||
| 69 | +if [ -z "$JAVA_HOME" ] ; then | ||
| 70 | + if [ -r /etc/gentoo-release ] ; then | ||
| 71 | + JAVA_HOME=`java-config --jre-home` | ||
| 72 | + fi | ||
| 73 | +fi | ||
| 74 | + | ||
| 75 | +if [ -z "$M2_HOME" ] ; then | ||
| 76 | + ## resolve links - $0 may be a link to maven's home | ||
| 77 | + PRG="$0" | ||
| 78 | + | ||
| 79 | + # need this for relative symlinks | ||
| 80 | + while [ -h "$PRG" ] ; do | ||
| 81 | + ls=`ls -ld "$PRG"` | ||
| 82 | + link=`expr "$ls" : '.*-> \(.*\)$'` | ||
| 83 | + if expr "$link" : '/.*' > /dev/null; then | ||
| 84 | + PRG="$link" | ||
| 85 | + else | ||
| 86 | + PRG="`dirname "$PRG"`/$link" | ||
| 87 | + fi | ||
| 88 | + done | ||
| 89 | + | ||
| 90 | + saveddir=`pwd` | ||
| 91 | + | ||
| 92 | + M2_HOME=`dirname "$PRG"`/.. | ||
| 93 | + | ||
| 94 | + # make it fully qualified | ||
| 95 | + M2_HOME=`cd "$M2_HOME" && pwd` | ||
| 96 | + | ||
| 97 | + cd "$saveddir" | ||
| 98 | + # echo Using m2 at $M2_HOME | ||
| 99 | +fi | ||
| 100 | + | ||
| 101 | +# For Cygwin, ensure paths are in UNIX format before anything is touched | ||
| 102 | +if $cygwin ; then | ||
| 103 | + [ -n "$M2_HOME" ] && | ||
| 104 | + M2_HOME=`cygpath --unix "$M2_HOME"` | ||
| 105 | + [ -n "$JAVA_HOME" ] && | ||
| 106 | + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` | ||
| 107 | + [ -n "$CLASSPATH" ] && | ||
| 108 | + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` | ||
| 109 | +fi | ||
| 110 | + | ||
| 111 | +# For Mingw, ensure paths are in UNIX format before anything is touched | ||
| 112 | +if $mingw ; then | ||
| 113 | + [ -n "$M2_HOME" ] && | ||
| 114 | + M2_HOME="`(cd "$M2_HOME"; pwd)`" | ||
| 115 | + [ -n "$JAVA_HOME" ] && | ||
| 116 | + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" | ||
| 117 | +fi | ||
| 118 | + | ||
| 119 | +if [ -z "$JAVA_HOME" ]; then | ||
| 120 | + javaExecutable="`which javac`" | ||
| 121 | + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then | ||
| 122 | + # readlink(1) is not available as standard on Solaris 10. | ||
| 123 | + readLink=`which readlink` | ||
| 124 | + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then | ||
| 125 | + if $darwin ; then | ||
| 126 | + javaHome="`dirname \"$javaExecutable\"`" | ||
| 127 | + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" | ||
| 128 | + else | ||
| 129 | + javaExecutable="`readlink -f \"$javaExecutable\"`" | ||
| 130 | + fi | ||
| 131 | + javaHome="`dirname \"$javaExecutable\"`" | ||
| 132 | + javaHome=`expr "$javaHome" : '\(.*\)/bin'` | ||
| 133 | + JAVA_HOME="$javaHome" | ||
| 134 | + export JAVA_HOME | ||
| 135 | + fi | ||
| 136 | + fi | ||
| 137 | +fi | ||
| 138 | + | ||
| 139 | +if [ -z "$JAVACMD" ] ; then | ||
| 140 | + if [ -n "$JAVA_HOME" ] ; then | ||
| 141 | + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||
| 142 | + # IBM's JDK on AIX uses strange locations for the executables | ||
| 143 | + JAVACMD="$JAVA_HOME/jre/sh/java" | ||
| 144 | + else | ||
| 145 | + JAVACMD="$JAVA_HOME/bin/java" | ||
| 146 | + fi | ||
| 147 | + else | ||
| 148 | + JAVACMD="`which java`" | ||
| 149 | + fi | ||
| 150 | +fi | ||
| 151 | + | ||
| 152 | +if [ ! -x "$JAVACMD" ] ; then | ||
| 153 | + echo "Error: JAVA_HOME is not defined correctly." >&2 | ||
| 154 | + echo " We cannot execute $JAVACMD" >&2 | ||
| 155 | + exit 1 | ||
| 156 | +fi | ||
| 157 | + | ||
| 158 | +if [ -z "$JAVA_HOME" ] ; then | ||
| 159 | + echo "Warning: JAVA_HOME environment variable is not set." | ||
| 160 | +fi | ||
| 161 | + | ||
| 162 | +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher | ||
| 163 | + | ||
| 164 | +# traverses directory structure from process work directory to filesystem root | ||
| 165 | +# first directory with .mvn subdirectory is considered project base directory | ||
| 166 | +find_maven_basedir() { | ||
| 167 | + | ||
| 168 | + if [ -z "$1" ] | ||
| 169 | + then | ||
| 170 | + echo "Path not specified to find_maven_basedir" | ||
| 171 | + return 1 | ||
| 172 | + fi | ||
| 173 | + | ||
| 174 | + basedir="$1" | ||
| 175 | + wdir="$1" | ||
| 176 | + while [ "$wdir" != '/' ] ; do | ||
| 177 | + if [ -d "$wdir"/.mvn ] ; then | ||
| 178 | + basedir=$wdir | ||
| 179 | + break | ||
| 180 | + fi | ||
| 181 | + # workaround for JBEAP-8937 (on Solaris 10/Sparc) | ||
| 182 | + if [ -d "${wdir}" ]; then | ||
| 183 | + wdir=`cd "$wdir/.."; pwd` | ||
| 184 | + fi | ||
| 185 | + # end of workaround | ||
| 186 | + done | ||
| 187 | + echo "${basedir}" | ||
| 188 | +} | ||
| 189 | + | ||
| 190 | +# concatenates all lines of a file | ||
| 191 | +concat_lines() { | ||
| 192 | + if [ -f "$1" ]; then | ||
| 193 | + echo "$(tr -s '\n' ' ' < "$1")" | ||
| 194 | + fi | ||
| 195 | +} | ||
| 196 | + | ||
| 197 | +BASE_DIR=`find_maven_basedir "$(pwd)"` | ||
| 198 | +if [ -z "$BASE_DIR" ]; then | ||
| 199 | + exit 1; | ||
| 200 | +fi | ||
| 201 | + | ||
| 202 | +########################################################################################## | ||
| 203 | +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central | ||
| 204 | +# This allows using the maven wrapper in projects that prohibit checking in binary data. | ||
| 205 | +########################################################################################## | ||
| 206 | +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then | ||
| 207 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 208 | + echo "Found .mvn/wrapper/maven-wrapper.jar" | ||
| 209 | + fi | ||
| 210 | +else | ||
| 211 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 212 | + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." | ||
| 213 | + fi | ||
| 214 | + if [ -n "$MVNW_REPOURL" ]; then | ||
| 215 | + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" | ||
| 216 | + else | ||
| 217 | + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" | ||
| 218 | + fi | ||
| 219 | + while IFS="=" read key value; do | ||
| 220 | + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; | ||
| 221 | + esac | ||
| 222 | + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" | ||
| 223 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 224 | + echo "Downloading from: $jarUrl" | ||
| 225 | + fi | ||
| 226 | + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" | ||
| 227 | + if $cygwin; then | ||
| 228 | + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` | ||
| 229 | + fi | ||
| 230 | + | ||
| 231 | + if command -v wget > /dev/null; then | ||
| 232 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 233 | + echo "Found wget ... using wget" | ||
| 234 | + fi | ||
| 235 | + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then | ||
| 236 | + wget "$jarUrl" -O "$wrapperJarPath" | ||
| 237 | + else | ||
| 238 | + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" | ||
| 239 | + fi | ||
| 240 | + elif command -v curl > /dev/null; then | ||
| 241 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 242 | + echo "Found curl ... using curl" | ||
| 243 | + fi | ||
| 244 | + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then | ||
| 245 | + curl -o "$wrapperJarPath" "$jarUrl" -f | ||
| 246 | + else | ||
| 247 | + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f | ||
| 248 | + fi | ||
| 249 | + | ||
| 250 | + else | ||
| 251 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 252 | + echo "Falling back to using Java to download" | ||
| 253 | + fi | ||
| 254 | + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" | ||
| 255 | + # For Cygwin, switch paths to Windows format before running javac | ||
| 256 | + if $cygwin; then | ||
| 257 | + javaClass=`cygpath --path --windows "$javaClass"` | ||
| 258 | + fi | ||
| 259 | + if [ -e "$javaClass" ]; then | ||
| 260 | + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then | ||
| 261 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 262 | + echo " - Compiling MavenWrapperDownloader.java ..." | ||
| 263 | + fi | ||
| 264 | + # Compiling the Java class | ||
| 265 | + ("$JAVA_HOME/bin/javac" "$javaClass") | ||
| 266 | + fi | ||
| 267 | + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then | ||
| 268 | + # Running the downloader | ||
| 269 | + if [ "$MVNW_VERBOSE" = true ]; then | ||
| 270 | + echo " - Running MavenWrapperDownloader.java ..." | ||
| 271 | + fi | ||
| 272 | + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") | ||
| 273 | + fi | ||
| 274 | + fi | ||
| 275 | + fi | ||
| 276 | +fi | ||
| 277 | +########################################################################################## | ||
| 278 | +# End of extension | ||
| 279 | +########################################################################################## | ||
| 280 | + | ||
| 281 | +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} | ||
| 282 | +if [ "$MVNW_VERBOSE" = true ]; then | ||
| 283 | + echo $MAVEN_PROJECTBASEDIR | ||
| 284 | +fi | ||
| 285 | +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" | ||
| 286 | + | ||
| 287 | +# For Cygwin, switch paths to Windows format before running java | ||
| 288 | +if $cygwin; then | ||
| 289 | + [ -n "$M2_HOME" ] && | ||
| 290 | + M2_HOME=`cygpath --path --windows "$M2_HOME"` | ||
| 291 | + [ -n "$JAVA_HOME" ] && | ||
| 292 | + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` | ||
| 293 | + [ -n "$CLASSPATH" ] && | ||
| 294 | + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` | ||
| 295 | + [ -n "$MAVEN_PROJECTBASEDIR" ] && | ||
| 296 | + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` | ||
| 297 | +fi | ||
| 298 | + | ||
| 299 | +# Provide a "standardized" way to retrieve the CLI args that will | ||
| 300 | +# work with both Windows and non-Windows executions. | ||
| 301 | +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" | ||
| 302 | +export MAVEN_CMD_LINE_ARGS | ||
| 303 | + | ||
| 304 | +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain | ||
| 305 | + | ||
| 306 | +exec "$JAVACMD" \ | ||
| 307 | + $MAVEN_OPTS \ | ||
| 308 | + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ | ||
| 309 | + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ | ||
| 310 | + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" |
mvnw.cmd
0 → 100644
| 1 | +@REM ---------------------------------------------------------------------------- | ||
| 2 | +@REM Licensed to the Apache Software Foundation (ASF) under one | ||
| 3 | +@REM or more contributor license agreements. See the NOTICE file | ||
| 4 | +@REM distributed with this work for additional information | ||
| 5 | +@REM regarding copyright ownership. The ASF licenses this file | ||
| 6 | +@REM to you under the Apache License, Version 2.0 (the | ||
| 7 | +@REM "License"); you may not use this file except in compliance | ||
| 8 | +@REM with the License. You may obtain a copy of the License at | ||
| 9 | +@REM | ||
| 10 | +@REM https://www.apache.org/licenses/LICENSE-2.0 | ||
| 11 | +@REM | ||
| 12 | +@REM Unless required by applicable law or agreed to in writing, | ||
| 13 | +@REM software distributed under the License is distributed on an | ||
| 14 | +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| 15 | +@REM KIND, either express or implied. See the License for the | ||
| 16 | +@REM specific language governing permissions and limitations | ||
| 17 | +@REM under the License. | ||
| 18 | +@REM ---------------------------------------------------------------------------- | ||
| 19 | + | ||
| 20 | +@REM ---------------------------------------------------------------------------- | ||
| 21 | +@REM Maven Start Up Batch script | ||
| 22 | +@REM | ||
| 23 | +@REM Required ENV vars: | ||
| 24 | +@REM JAVA_HOME - location of a JDK home dir | ||
| 25 | +@REM | ||
| 26 | +@REM Optional ENV vars | ||
| 27 | +@REM M2_HOME - location of maven2's installed home dir | ||
| 28 | +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands | ||
| 29 | +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending | ||
| 30 | +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven | ||
| 31 | +@REM e.g. to debug Maven itself, use | ||
| 32 | +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 | ||
| 33 | +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files | ||
| 34 | +@REM ---------------------------------------------------------------------------- | ||
| 35 | + | ||
| 36 | +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' | ||
| 37 | +@echo off | ||
| 38 | +@REM set title of command window | ||
| 39 | +title %0 | ||
| 40 | +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' | ||
| 41 | +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% | ||
| 42 | + | ||
| 43 | +@REM set %HOME% to equivalent of $HOME | ||
| 44 | +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") | ||
| 45 | + | ||
| 46 | +@REM Execute a user defined script before this one | ||
| 47 | +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre | ||
| 48 | +@REM check for pre script, once with legacy .bat ending and once with .cmd ending | ||
| 49 | +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" | ||
| 50 | +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" | ||
| 51 | +:skipRcPre | ||
| 52 | + | ||
| 53 | +@setlocal | ||
| 54 | + | ||
| 55 | +set ERROR_CODE=0 | ||
| 56 | + | ||
| 57 | +@REM To isolate internal variables from possible post scripts, we use another setlocal | ||
| 58 | +@setlocal | ||
| 59 | + | ||
| 60 | +@REM ==== START VALIDATION ==== | ||
| 61 | +if not "%JAVA_HOME%" == "" goto OkJHome | ||
| 62 | + | ||
| 63 | +echo. | ||
| 64 | +echo Error: JAVA_HOME not found in your environment. >&2 | ||
| 65 | +echo Please set the JAVA_HOME variable in your environment to match the >&2 | ||
| 66 | +echo location of your Java installation. >&2 | ||
| 67 | +echo. | ||
| 68 | +goto error | ||
| 69 | + | ||
| 70 | +:OkJHome | ||
| 71 | +if exist "%JAVA_HOME%\bin\java.exe" goto init | ||
| 72 | + | ||
| 73 | +echo. | ||
| 74 | +echo Error: JAVA_HOME is set to an invalid directory. >&2 | ||
| 75 | +echo JAVA_HOME = "%JAVA_HOME%" >&2 | ||
| 76 | +echo Please set the JAVA_HOME variable in your environment to match the >&2 | ||
| 77 | +echo location of your Java installation. >&2 | ||
| 78 | +echo. | ||
| 79 | +goto error | ||
| 80 | + | ||
| 81 | +@REM ==== END VALIDATION ==== | ||
| 82 | + | ||
| 83 | +:init | ||
| 84 | + | ||
| 85 | +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". | ||
| 86 | +@REM Fallback to current working directory if not found. | ||
| 87 | + | ||
| 88 | +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% | ||
| 89 | +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir | ||
| 90 | + | ||
| 91 | +set EXEC_DIR=%CD% | ||
| 92 | +set WDIR=%EXEC_DIR% | ||
| 93 | +:findBaseDir | ||
| 94 | +IF EXIST "%WDIR%"\.mvn goto baseDirFound | ||
| 95 | +cd .. | ||
| 96 | +IF "%WDIR%"=="%CD%" goto baseDirNotFound | ||
| 97 | +set WDIR=%CD% | ||
| 98 | +goto findBaseDir | ||
| 99 | + | ||
| 100 | +:baseDirFound | ||
| 101 | +set MAVEN_PROJECTBASEDIR=%WDIR% | ||
| 102 | +cd "%EXEC_DIR%" | ||
| 103 | +goto endDetectBaseDir | ||
| 104 | + | ||
| 105 | +:baseDirNotFound | ||
| 106 | +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% | ||
| 107 | +cd "%EXEC_DIR%" | ||
| 108 | + | ||
| 109 | +:endDetectBaseDir | ||
| 110 | + | ||
| 111 | +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig | ||
| 112 | + | ||
| 113 | +@setlocal EnableExtensions EnableDelayedExpansion | ||
| 114 | +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a | ||
| 115 | +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% | ||
| 116 | + | ||
| 117 | +:endReadAdditionalConfig | ||
| 118 | + | ||
| 119 | +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" | ||
| 120 | +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" | ||
| 121 | +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain | ||
| 122 | + | ||
| 123 | +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" | ||
| 124 | + | ||
| 125 | +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( | ||
| 126 | + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B | ||
| 127 | +) | ||
| 128 | + | ||
| 129 | +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central | ||
| 130 | +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. | ||
| 131 | +if exist %WRAPPER_JAR% ( | ||
| 132 | + if "%MVNW_VERBOSE%" == "true" ( | ||
| 133 | + echo Found %WRAPPER_JAR% | ||
| 134 | + ) | ||
| 135 | +) else ( | ||
| 136 | + if not "%MVNW_REPOURL%" == "" ( | ||
| 137 | + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" | ||
| 138 | + ) | ||
| 139 | + if "%MVNW_VERBOSE%" == "true" ( | ||
| 140 | + echo Couldn't find %WRAPPER_JAR%, downloading it ... | ||
| 141 | + echo Downloading from: %DOWNLOAD_URL% | ||
| 142 | + ) | ||
| 143 | + | ||
| 144 | + powershell -Command "&{"^ | ||
| 145 | + "$webclient = new-object System.Net.WebClient;"^ | ||
| 146 | + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ | ||
| 147 | + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ | ||
| 148 | + "}"^ | ||
| 149 | + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ | ||
| 150 | + "}" | ||
| 151 | + if "%MVNW_VERBOSE%" == "true" ( | ||
| 152 | + echo Finished downloading %WRAPPER_JAR% | ||
| 153 | + ) | ||
| 154 | +) | ||
| 155 | +@REM End of extension | ||
| 156 | + | ||
| 157 | +@REM Provide a "standardized" way to retrieve the CLI args that will | ||
| 158 | +@REM work with both Windows and non-Windows executions. | ||
| 159 | +set MAVEN_CMD_LINE_ARGS=%* | ||
| 160 | + | ||
| 161 | +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* | ||
| 162 | +if ERRORLEVEL 1 goto error | ||
| 163 | +goto end | ||
| 164 | + | ||
| 165 | +:error | ||
| 166 | +set ERROR_CODE=1 | ||
| 167 | + | ||
| 168 | +:end | ||
| 169 | +@endlocal & set ERROR_CODE=%ERROR_CODE% | ||
| 170 | + | ||
| 171 | +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost | ||
| 172 | +@REM check for post script, once with legacy .bat ending and once with .cmd ending | ||
| 173 | +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" | ||
| 174 | +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" | ||
| 175 | +:skipRcPost | ||
| 176 | + | ||
| 177 | +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' | ||
| 178 | +if "%MAVEN_BATCH_PAUSE%" == "on" pause | ||
| 179 | + | ||
| 180 | +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% | ||
| 181 | + | ||
| 182 | +exit /B %ERROR_CODE% |
pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 3 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 4 | + <modelVersion>4.0.0</modelVersion> | ||
| 5 | + <parent> | ||
| 6 | + <groupId>org.springframework.boot</groupId> | ||
| 7 | + <artifactId>spring-boot-starter-parent</artifactId> | ||
| 8 | + <version>2.1.17.RELEASE</version> | ||
| 9 | + <relativePath/> <!-- lookup parent from repository --> | ||
| 10 | + </parent> | ||
| 11 | + <groupId>com.erry.iclear</groupId> | ||
| 12 | + <artifactId>iclear-api</artifactId> | ||
| 13 | + <version>0.0.1-SNAPSHOT</version> | ||
| 14 | + <packaging>war</packaging> | ||
| 15 | + <name>iClear-api</name> | ||
| 16 | + <description>iClear-api</description> | ||
| 17 | + <properties> | ||
| 18 | + <java.version>1.8</java.version> | ||
| 19 | + </properties> | ||
| 20 | + <dependencies> | ||
| 21 | + | ||
| 22 | + <dependency> | ||
| 23 | + <groupId>org.springframework.boot</groupId> | ||
| 24 | + <artifactId>spring-boot-starter-web</artifactId> | ||
| 25 | + </dependency> | ||
| 26 | + <dependency> | ||
| 27 | + <groupId>org.springframework.boot</groupId> | ||
| 28 | + <artifactId>spring-boot-starter-test</artifactId> | ||
| 29 | + <scope>test</scope> | ||
| 30 | + </dependency> | ||
| 31 | + <dependency> | ||
| 32 | + <groupId>org.springframework.boot</groupId> | ||
| 33 | + <artifactId>spring-boot-devtools</artifactId> | ||
| 34 | + <optional>true</optional> | ||
| 35 | + </dependency> | ||
| 36 | + <dependency> | ||
| 37 | + <groupId>org.springframework.boot</groupId> | ||
| 38 | + <artifactId>spring-boot-starter-tomcat</artifactId> | ||
| 39 | + <scope>provided</scope> | ||
| 40 | + </dependency> | ||
| 41 | + | ||
| 42 | +<!-- <dependency>--> | ||
| 43 | +<!-- <groupId>org.springframework.boot</groupId>--> | ||
| 44 | +<!-- <artifactId>spring-boot-actuator</artifactId>--> | ||
| 45 | +<!-- <version>2.1.7.RELEASE</version>--> | ||
| 46 | +<!-- </dependency>--> | ||
| 47 | +<!-- <dependency>--> | ||
| 48 | +<!-- <groupId>org.springframework.boot</groupId>--> | ||
| 49 | +<!-- <artifactId>spring-boot-actuator-autoconfigure</artifactId>--> | ||
| 50 | +<!-- <version>2.1.7.RELEASE</version>--> | ||
| 51 | +<!-- </dependency>--> | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + <dependency> | ||
| 55 | + <groupId>com.google.code.gson</groupId> | ||
| 56 | + <artifactId>gson</artifactId> | ||
| 57 | + </dependency> | ||
| 58 | + <dependency> | ||
| 59 | + <groupId>io.springfox</groupId> | ||
| 60 | + <artifactId>springfox-swagger2</artifactId> | ||
| 61 | + <version>2.9.2</version> | ||
| 62 | + </dependency> | ||
| 63 | + <dependency> | ||
| 64 | + <groupId>io.springfox</groupId> | ||
| 65 | + <artifactId>springfox-swagger-ui</artifactId> | ||
| 66 | + <version>2.9.2</version> | ||
| 67 | + </dependency> | ||
| 68 | + <dependency> | ||
| 69 | + <groupId>org.projectlombok</groupId> | ||
| 70 | + <artifactId>lombok</artifactId> | ||
| 71 | + <scope>provided</scope> | ||
| 72 | + </dependency> | ||
| 73 | + <dependency> | ||
| 74 | + <groupId>cn.hutool</groupId> | ||
| 75 | + <artifactId>hutool-all</artifactId> | ||
| 76 | + <version>5.2.3</version> | ||
| 77 | + </dependency> | ||
| 78 | + <dependency> | ||
| 79 | + <groupId>com.alibaba</groupId> | ||
| 80 | + <artifactId>fastjson</artifactId> | ||
| 81 | + <version>1.2.60</version> | ||
| 82 | + </dependency> | ||
| 83 | + <dependency> | ||
| 84 | + <groupId>org.apache.commons</groupId> | ||
| 85 | + <artifactId>commons-lang3</artifactId> | ||
| 86 | + </dependency> | ||
| 87 | + <dependency> | ||
| 88 | + <groupId>com.google.guava</groupId> | ||
| 89 | + <artifactId>guava</artifactId> | ||
| 90 | + <version>20.0</version> | ||
| 91 | + </dependency> | ||
| 92 | + | ||
| 93 | + | ||
| 94 | + </dependencies> | ||
| 95 | + | ||
| 96 | + <profiles> | ||
| 97 | + <profile> | ||
| 98 | + <id>dev</id> | ||
| 99 | + <properties> | ||
| 100 | + <activatedProperties>dev</activatedProperties> | ||
| 101 | + </properties> | ||
| 102 | + <activation> | ||
| 103 | + <activeByDefault>true</activeByDefault> | ||
| 104 | + </activation> | ||
| 105 | + </profile> | ||
| 106 | + <profile> | ||
| 107 | + <id>test</id> | ||
| 108 | + <properties> | ||
| 109 | + <activatedProperties>test</activatedProperties> | ||
| 110 | + </properties> | ||
| 111 | + </profile> | ||
| 112 | + <profile> | ||
| 113 | + <id>prod</id> | ||
| 114 | + <properties> | ||
| 115 | + <activatedProperties>prod</activatedProperties> | ||
| 116 | + </properties> | ||
| 117 | + </profile> | ||
| 118 | + </profiles> | ||
| 119 | + <build> | ||
| 120 | + <plugins> | ||
| 121 | + <plugin> | ||
| 122 | + <groupId>org.springframework.boot</groupId> | ||
| 123 | + <artifactId>spring-boot-maven-plugin</artifactId> | ||
| 124 | + </plugin> | ||
| 125 | + </plugins> | ||
| 126 | + </build> | ||
| 127 | + | ||
| 128 | +</project> |
| 1 | +package com.erry.iclear.dateInterface; | ||
| 2 | + | ||
| 3 | +import org.springframework.stereotype.Component; | ||
| 4 | + | ||
| 5 | +import java.util.HashMap; | ||
| 6 | +import java.util.Map; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @author Administrator | ||
| 10 | + */ | ||
| 11 | +@Component | ||
| 12 | +public class Constant { | ||
| 13 | + | ||
| 14 | + public static Map<String,HashMap<String,String>> appIdSecurity = new HashMap<>(); | ||
| 15 | + | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + | ||
| 21 | +} |
| 1 | +package com.erry.iclear.dateInterface; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.springframework.boot.SpringApplication; | ||
| 5 | +import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
| 6 | +import org.springframework.scheduling.annotation.EnableScheduling; | ||
| 7 | + | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author Administrator | ||
| 11 | + */ | ||
| 12 | + | ||
| 13 | +@Slf4j | ||
| 14 | + | ||
| 15 | +@SpringBootApplication | ||
| 16 | +@EnableScheduling | ||
| 17 | +public class IClearApiApplication { | ||
| 18 | + | ||
| 19 | + public static void main(String[] args) { | ||
| 20 | + SpringApplication.run(IClearApiApplication.class, args); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + | ||
| 24 | + | ||
| 25 | +} |
| 1 | +package com.erry.iclear.dateInterface.api; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Mawb; | ||
| 4 | +import com.erry.iclear.dateInterface.api.response.ResultRS; | ||
| 5 | +import com.google.gson.Gson; | ||
| 6 | +import io.swagger.annotations.Api; | ||
| 7 | +import io.swagger.annotations.ApiOperation; | ||
| 8 | +import lombok.extern.slf4j.Slf4j; | ||
| 9 | +import org.springframework.http.HttpRequest; | ||
| 10 | +import org.springframework.web.bind.annotation.*; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * @author Administrator | ||
| 14 | + */ | ||
| 15 | +@RestController | ||
| 16 | +@RequestMapping("/customs") | ||
| 17 | +@Slf4j | ||
| 18 | +public class CustomsDataInterface { | ||
| 19 | + | ||
| 20 | + private Gson gson = new Gson(); | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + @ApiOperation(value = "推送主单数据", httpMethod = "POST", notes = "ex: http://192.168.1.75:8080/customs/sendMawb") | ||
| 24 | + @PostMapping("/sendMawb") | ||
| 25 | + @ResponseBody | ||
| 26 | + public ResultRS sendMawb(@RequestBody Mawb mawb) { | ||
| 27 | + log.info("接收到主单数据:" + gson.toJson(mawb)); | ||
| 28 | + ResultRS result = new ResultRS(); | ||
| 29 | + result.setSuccess(Boolean.FALSE); | ||
| 30 | + | ||
| 31 | + //0、TODO 校验用户名密码 | ||
| 32 | + | ||
| 33 | + //1、TODO 收到主单信息后,数据先落地 | ||
| 34 | + | ||
| 35 | + //2、TODO 校验主单 | ||
| 36 | + | ||
| 37 | + //3、TODO 校验子单 | ||
| 38 | + | ||
| 39 | + //4、TODO 保存主单 | ||
| 40 | + | ||
| 41 | + | ||
| 42 | + | ||
| 43 | + return result; | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + | ||
| 47 | +} | ||
| 48 | + | ||
| 49 | + |
| 1 | +package com.erry.iclear.dateInterface.api.request; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.io.Serializable; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * @author Administrator | ||
| 13 | + */ | ||
| 14 | +@ApiModel(value = "mawb", description = "主运单") | ||
| 15 | +@Data | ||
| 16 | +public class Mawb implements Serializable { | ||
| 17 | + | ||
| 18 | + @ApiModelProperty(value = "进出口标志", name = "IEFlag", example = "固定值:E") | ||
| 19 | + private String IEFlag; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty(value = "报关类型", name = "Type", example = "固定值:EX") | ||
| 22 | + private String Type; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "申报单位代码", name = "agentCode", example = "固定值:1111980005") | ||
| 25 | + private String agentCode; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty(value = "申报单位名称", name = "agentName", example = "固定值:联邦快递(中国)有限公司") | ||
| 28 | + private String agentName; | ||
| 29 | + | ||
| 30 | + @ApiModelProperty(value = "提单号", name = "billNo", example = "固定值:有总单号则取值‘总单号_运单号‘,没有总单号则取值‘运单号‘") | ||
| 31 | + private String billNo; | ||
| 32 | + | ||
| 33 | + @ApiModelProperty(value = "合同号", name = "contrNo", example = "") | ||
| 34 | + private String contrNo; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty(value = "主管海关(申报地海关)", name = "customMaster", example = "固定值:0101") | ||
| 37 | + private String customMaster; | ||
| 38 | + | ||
| 39 | + @ApiModelProperty(value = "征免性质", name = "cutMode", example = "101") | ||
| 40 | + private String cutMode; | ||
| 41 | + | ||
| 42 | + @ApiModelProperty(value = "报关/转关关系标志", name = "declTrnRel", example = "固定值:0") | ||
| 43 | + private String declTrnRel; | ||
| 44 | + | ||
| 45 | + @ApiModelProperty(value = "经停港/指运港", name = "distinatePort", example = "ASM000") | ||
| 46 | + private String distinatePort; | ||
| 47 | + | ||
| 48 | + @ApiModelProperty(value = "报关标志", name = "EdiId", example = "001") | ||
| 49 | + private String ediId; | ||
| 50 | + | ||
| 51 | + @ApiModelProperty(value = "海关编号", name = "EntryId", example = "001") | ||
| 52 | + private String entryId; | ||
| 53 | + | ||
| 54 | + @ApiModelProperty(value = "运费币制", name = "feeCurr", example = "固定值:3") | ||
| 55 | + private String feeCurr; | ||
| 56 | + | ||
| 57 | + @ApiModelProperty(value = "运费标记", name = "feeMark", example = "99.22") | ||
| 58 | + private String feeMark; | ||
| 59 | + | ||
| 60 | + @ApiModelProperty(value = "运费/率", name = "feeRate", example = "43.34358") | ||
| 61 | + private BigDecimal feeRate; | ||
| 62 | + | ||
| 63 | + @ApiModelProperty(value = "毛重", name = "grossWet", example = "") | ||
| 64 | + private Integer grossWet; | ||
| 65 | + | ||
| 66 | + @ApiModelProperty(value = "出入境关闭", name = "IEPort", example = "固定值:0101") | ||
| 67 | + private String IEPort; | ||
| 68 | + | ||
| 69 | + @ApiModelProperty(value = "录入人名称", name = "InputerName", example = "固定值:0101") | ||
| 70 | + private String inputerName; | ||
| 71 | + | ||
| 72 | + @ApiModelProperty(value = "保险费币制", name = "insurCurr", example = "MOP") | ||
| 73 | + private String insurCurr; | ||
| 74 | + | ||
| 75 | + @ApiModelProperty(value = "保险费标记", name = "insurMark", example = "固定值:3") | ||
| 76 | + private String insurMark; | ||
| 77 | + | ||
| 78 | + @ApiModelProperty(value = "保险费/率", name = "insurRate", example = "") | ||
| 79 | + private BigDecimal insurRate; | ||
| 80 | + | ||
| 81 | + @ApiModelProperty(value = "备案号", name = "manualNo", example = "") | ||
| 82 | + private String manualNo; | ||
| 83 | + | ||
| 84 | + @ApiModelProperty(value = "净重", name = "netWt", example = "") | ||
| 85 | + private BigDecimal netWt; | ||
| 86 | + | ||
| 87 | + @ApiModelProperty(value = "杂费币制", name = "otherCurr", example = "") | ||
| 88 | + private String otherCurr; | ||
| 89 | + | ||
| 90 | + @ApiModelProperty(value = "杂费/率", name = "otherRate", example = "") | ||
| 91 | + private BigDecimal otherRate; | ||
| 92 | + | ||
| 93 | + @ApiModelProperty(value = "杂费标志", name = "otherMark", example = "") | ||
| 94 | + private String otherMark; | ||
| 95 | + | ||
| 96 | + @ApiModelProperty(value = "消费使用/生产销售单位代码", name = "ownerCode", example = "Z321654987") | ||
| 97 | + private String ownerCode; | ||
| 98 | + | ||
| 99 | + @ApiModelProperty(value = "消费使用/生产销售单位名称", name = "ownerName", example = "上海保险") | ||
| 100 | + private String ownerName; | ||
| 101 | + | ||
| 102 | + @ApiModelProperty(value = "件数", name = "packNo", example = "") | ||
| 103 | + private Integer packNo; | ||
| 104 | + | ||
| 105 | + @ApiModelProperty(value = "预录入编号", name = "preEntryId", example = "") | ||
| 106 | + private String preEntryId; | ||
| 107 | + | ||
| 108 | + @ApiModelProperty(value = "启运国/运抵国", name = "tradeCountry", example = "USA") | ||
| 109 | + private String tradeCountry; | ||
| 110 | + | ||
| 111 | + @ApiModelProperty(value = "监管方式", name = "tradeMode", example = "0200") | ||
| 112 | + private String tradeMode; | ||
| 113 | + | ||
| 114 | + @ApiModelProperty(value = "境内收发货人编号", name = "tradeCode", example = "Z321654987") | ||
| 115 | + private String tradeCode; | ||
| 116 | + | ||
| 117 | + @ApiModelProperty(value = "运输方式代码", name = "trafMode", example = "1") | ||
| 118 | + private String trafMode; | ||
| 119 | + | ||
| 120 | + @ApiModelProperty(value = "境内收发货人名称", name = "tradeName", example = "上海铢怡国际货物运输代理有限公司") | ||
| 121 | + private String tradeName; | ||
| 122 | + | ||
| 123 | + @ApiModelProperty(value = "成交方式", name = "transMode", example = "2") | ||
| 124 | + private String transMode; | ||
| 125 | + | ||
| 126 | + @ApiModelProperty(value = "包装种类", name = "wrapType", example = "22") | ||
| 127 | + private String wrapType; | ||
| 128 | + | ||
| 129 | + @ApiModelProperty(value = "生产核销单位统一信用代码---报关形式类型", name = "TradeCodeScc", example = "A74125896321456987") | ||
| 130 | + private String tradeCodeScc; | ||
| 131 | + | ||
| 132 | + @ApiModelProperty(value = "消费使用/生产销售单位单位统一编码", name = "ownerCodeScc", example = "") | ||
| 133 | + private String ownerCodeScc; | ||
| 134 | + | ||
| 135 | + @ApiModelProperty(value = "贸易国别", name = "tradeAreaCode", example = "") | ||
| 136 | + private String tradeAreaCode; | ||
| 137 | + | ||
| 138 | + @ApiModelProperty(value = "标记及号码", name = "markNo", example = "N/M") | ||
| 139 | + private String markNo; | ||
| 140 | + | ||
| 141 | + @ApiModelProperty(value = "入境口岸代码", name = "entyPortCode", example = "固定值:310302") | ||
| 142 | + private String entyPortCode; | ||
| 143 | + | ||
| 144 | + @ApiModelProperty(value = "入境口岸代码", name = "goodsPlace", example = "固定值:空值") | ||
| 145 | + private String goodsPlace; | ||
| 146 | + | ||
| 147 | + @ApiModelProperty(value = "申报人员姓名---报关员证号", name = "declareName", example = "固定值:空值") | ||
| 148 | + private String declareName; | ||
| 149 | + | ||
| 150 | + @ApiModelProperty(value = "境外发货人代码", name = "overseasConsignorCode", example = "") | ||
| 151 | + private String overseasConsignorCode; | ||
| 152 | + | ||
| 153 | + @ApiModelProperty(value = "境外收货人编码", name = "overseasConsigneeCode", example = "") | ||
| 154 | + private String overseasConsigneeCode; | ||
| 155 | + | ||
| 156 | + @ApiModelProperty(value = "境外收货人名称(外文)", name = "overseasConsigneeEname", example = "") | ||
| 157 | + private String overseasConsigneeEname; | ||
| 158 | + | ||
| 159 | + @ApiModelProperty(value = "运单明细", name = "mawbDetailList", example = "") | ||
| 160 | + private List<MawbDetail> mawbDetailList; | ||
| 161 | +} |
| 1 | +package com.erry.iclear.dateInterface.api.request; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiModel; | ||
| 4 | +import io.swagger.annotations.ApiModelProperty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.io.Serializable; | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * @author Administrator | ||
| 13 | + */ | ||
| 14 | +@ApiModel(value = "mawbDetail", description = "运单明细") | ||
| 15 | +@Data | ||
| 16 | +public class MawbDetail implements Serializable { | ||
| 17 | + | ||
| 18 | + @ApiModelProperty(value = "商品编号", example = "空值") | ||
| 19 | + private String classMark; | ||
| 20 | + | ||
| 21 | + @ApiModelProperty(value = "商品编号") | ||
| 22 | + private String codeTS; | ||
| 23 | + | ||
| 24 | + @ApiModelProperty(value = "申报单价", example = "空值") | ||
| 25 | + private BigDecimal declPrice; | ||
| 26 | + | ||
| 27 | + @ApiModelProperty(value = "申报总价") | ||
| 28 | + private BigDecimal declTotal; | ||
| 29 | + | ||
| 30 | + @ApiModelProperty(value = "征免方式") | ||
| 31 | + private String dutyMode; | ||
| 32 | + | ||
| 33 | + @ApiModelProperty(value = "货号") | ||
| 34 | + private String exgNo; | ||
| 35 | + | ||
| 36 | + @ApiModelProperty(value = "货号") | ||
| 37 | + private String exgVersion; | ||
| 38 | + | ||
| 39 | + @ApiModelProperty(value = "第一计量单位(法定单位)") | ||
| 40 | + private String firstUnit; | ||
| 41 | + | ||
| 42 | + @ApiModelProperty(value = "第一法定数量") | ||
| 43 | + private Integer firstQty; | ||
| 44 | + | ||
| 45 | + @ApiModelProperty(value = "成交计量单位") | ||
| 46 | + private String GUnit; | ||
| 47 | + | ||
| 48 | + @ApiModelProperty(value = "商品规格、型号") | ||
| 49 | + private String GModel; | ||
| 50 | + | ||
| 51 | + @ApiModelProperty(value = "商品名称") | ||
| 52 | + private String GName; | ||
| 53 | + | ||
| 54 | + @ApiModelProperty(value = "商品序号") | ||
| 55 | + private String GNo; | ||
| 56 | + | ||
| 57 | + @ApiModelProperty(value = "成交数量") | ||
| 58 | + private Integer GQty; | ||
| 59 | + | ||
| 60 | + @ApiModelProperty(value = "原产国") | ||
| 61 | + private String originCountry; | ||
| 62 | + | ||
| 63 | + @ApiModelProperty(value = "第二计量单位") | ||
| 64 | + private String secondUnit; | ||
| 65 | + | ||
| 66 | + @ApiModelProperty(value = "第二法定数量") | ||
| 67 | + private Integer secondQty; | ||
| 68 | + | ||
| 69 | + @ApiModelProperty(value = "成交币制") | ||
| 70 | + private String tradeCurr; | ||
| 71 | + | ||
| 72 | + @ApiModelProperty(value = "用途/生产厂家") | ||
| 73 | + private String useTo; | ||
| 74 | + | ||
| 75 | + @ApiModelProperty(value = "工缴费") | ||
| 76 | + private BigDecimal workUsd; | ||
| 77 | + | ||
| 78 | + @ApiModelProperty(value = "检验检疫编") | ||
| 79 | + private String ciqCode; | ||
| 80 | + | ||
| 81 | + @ApiModelProperty(value = "最终目的国(地区)") | ||
| 82 | + private String destinationCountry; | ||
| 83 | + | ||
| 84 | + @ApiModelProperty(value = "申报货物英文名称") | ||
| 85 | + private String declGoodsEname; | ||
| 86 | + | ||
| 87 | + @ApiModelProperty(value = "目的地代码") | ||
| 88 | + private String destCode; | ||
| 89 | + | ||
| 90 | + @ApiModelProperty(value = "境内目的地/境内货源地") | ||
| 91 | + private String districtCode; | ||
| 92 | + | ||
| 93 | + | ||
| 94 | +} |
| 1 | +package com.erry.iclear.dateInterface.api.response; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +import java.io.Serializable; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author Administrator | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class ResultRS implements Serializable { | ||
| 12 | + | ||
| 13 | + //成功标识 | ||
| 14 | + private Boolean success = true; | ||
| 15 | + private String code; | ||
| 16 | + | ||
| 17 | + //错误信息 | ||
| 18 | + private String msg; | ||
| 19 | + private Object data; | ||
| 20 | +} |
| 1 | +package com.erry.iclear.dateInterface.config; | ||
| 2 | + | ||
| 3 | +import org.springframework.context.annotation.Bean; | ||
| 4 | +import org.springframework.context.annotation.Configuration; | ||
| 5 | +import org.springframework.context.annotation.Profile; | ||
| 6 | +import org.springframework.web.bind.annotation.ControllerAdvice; | ||
| 7 | +import springfox.documentation.builders.ApiInfoBuilder; | ||
| 8 | +import springfox.documentation.builders.PathSelectors; | ||
| 9 | +import springfox.documentation.service.ApiInfo; | ||
| 10 | +import springfox.documentation.spi.DocumentationType; | ||
| 11 | +import springfox.documentation.spring.web.plugins.Docket; | ||
| 12 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @author Administrator | ||
| 16 | + * http://localhost:8080/swagger-ui.html | ||
| 17 | + */ | ||
| 18 | +@Configuration | ||
| 19 | +@EnableSwagger2 | ||
| 20 | +@ControllerAdvice(basePackages = {"com.erry.iclear.dateInterface.controller"}) | ||
| 21 | +@Profile({"!prod"}) | ||
| 22 | +public class SwaggerConfig { | ||
| 23 | + @Bean | ||
| 24 | + public Docket createRestApi() { | ||
| 25 | + return new Docket(DocumentationType.SWAGGER_2) | ||
| 26 | + .apiInfo(apiInfo()) | ||
| 27 | + .select() | ||
| 28 | + .paths(PathSelectors.any()) | ||
| 29 | + .build(); | ||
| 30 | + | ||
| 31 | + } | ||
| 32 | + private ApiInfo apiInfo() { | ||
| 33 | + return new ApiInfoBuilder() | ||
| 34 | + .title("iClearExport DateInterface") | ||
| 35 | + .description("iClearExport 数据接口") | ||
| 36 | + .termsOfServiceUrl("http://dateInterface.iClearExport.com") | ||
| 37 | + .version("1.0") | ||
| 38 | + .build(); | ||
| 39 | + } | ||
| 40 | +} |
| 1 | +package com.erry.iclear.dateInterface.controller; | ||
| 2 | + | ||
| 3 | +import io.swagger.annotations.ApiOperation; | ||
| 4 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 6 | +import org.springframework.web.bind.annotation.RestController; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @author Administrator | ||
| 10 | + */ | ||
| 11 | +@RestController | ||
| 12 | +@RequestMapping("/system") | ||
| 13 | + | ||
| 14 | +public class IClearExportInterface { | ||
| 15 | + | ||
| 16 | + @ApiOperation(value = "IClear 健康检查" ,httpMethod ="GET" ,notes="ex: http://localhost:8080/system/healthCheck") | ||
| 17 | + @GetMapping("/healthCheck") | ||
| 18 | + public String healthCheck() { | ||
| 19 | + return "iClearApi 当前时间:"+System.currentTimeMillis(); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + @ApiOperation(value = "IClear 刷新缓存" ,httpMethod ="GET" ,notes="ex: http://192.168.0.75:8080/system/refreshCache") | ||
| 24 | + @GetMapping("/refreshCache") | ||
| 25 | + public String refreshCache() { | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + return "Success"; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | +} |
| 1 | +package com.erry.iclear.dateInterface.init; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.Constant; | ||
| 4 | +import lombok.extern.slf4j.Slf4j; | ||
| 5 | +import org.springframework.beans.BeansException; | ||
| 6 | +import org.springframework.beans.factory.InitializingBean; | ||
| 7 | +import org.springframework.context.ApplicationContext; | ||
| 8 | +import org.springframework.context.ApplicationContextAware; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | + | ||
| 11 | +import java.util.HashMap; | ||
| 12 | +import java.util.Map; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @author Administrator | ||
| 16 | + */ | ||
| 17 | +@Service("IClearApiSystemInit") | ||
| 18 | +@Slf4j | ||
| 19 | +public class IClearApiSystemInit implements InitializingBean, ApplicationContextAware{ | ||
| 20 | + | ||
| 21 | + private ApplicationContext applicationContext; | ||
| 22 | + | ||
| 23 | + @Override | ||
| 24 | + public void setApplicationContext(ApplicationContext applicationContext)throws BeansException { | ||
| 25 | + this.applicationContext = applicationContext; | ||
| 26 | + | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + @Override | ||
| 30 | + public void afterPropertiesSet() throws Exception { | ||
| 31 | + try{ | ||
| 32 | + log.info("init appIdSecurity start>>>>>>>>>"); | ||
| 33 | + //TODO 需要从数据库中读取,然后加载到map中 | ||
| 34 | + String appId="CTM"; | ||
| 35 | + String appKey="iClearExport"; | ||
| 36 | + String security="b92131f03f19a348"; | ||
| 37 | + | ||
| 38 | + HashMap<String,String> appkeyMap = new HashMap<>(); | ||
| 39 | + appkeyMap.put(appKey,security); | ||
| 40 | + Constant.appIdSecurity.put(appId,appkeyMap); | ||
| 41 | + log.info("init appIdSecurity end>>>>>>>>>"); | ||
| 42 | + }catch (Exception e){ | ||
| 43 | + log.error("init appIdSecurity error:" + e.getMessage()); | ||
| 44 | + } | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import lombok.extern.slf4j.Slf4j; | ||
| 5 | +import org.springframework.stereotype.Service; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author Administrator | ||
| 9 | + */ | ||
| 10 | +@Service | ||
| 11 | +@Slf4j | ||
| 12 | +public class IClearApiSystemService { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * TODO 刷新缓存 | ||
| 16 | + */ | ||
| 17 | + public void refreshCache(){ | ||
| 18 | + | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Mawb; | ||
| 4 | +import com.erry.iclear.dateInterface.api.request.MawbDetail; | ||
| 5 | +import lombok.extern.slf4j.Slf4j; | ||
| 6 | +import org.springframework.stereotype.Service; | ||
| 7 | + | ||
| 8 | +/** | ||
| 9 | + * @author Administrator | ||
| 10 | + */ | ||
| 11 | +@Service | ||
| 12 | +@Slf4j | ||
| 13 | +public class MawbDetailService { | ||
| 14 | + | ||
| 15 | + public void saveMawbDetail(MawbDetail mawbDetail){ | ||
| 16 | + log.info(""); | ||
| 17 | + | ||
| 18 | + log.info(""); | ||
| 19 | + | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | +} |
| 1 | +package com.erry.iclear.dateInterface.service; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Mawb; | ||
| 4 | +import com.google.gson.Gson; | ||
| 5 | +import lombok.extern.slf4j.Slf4j; | ||
| 6 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @author Administrator | ||
| 11 | + */ | ||
| 12 | +@Service | ||
| 13 | +@Slf4j | ||
| 14 | +public class MawbService { | ||
| 15 | + | ||
| 16 | + private Gson gson = new Gson(); | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 保存主单 | ||
| 21 | + * @param mawb | ||
| 22 | + */ | ||
| 23 | + public void saveMawb(Mawb mawb){ | ||
| 24 | + try{ | ||
| 25 | + log.info("saveMawb start>>>>>>>>>>>"); | ||
| 26 | + | ||
| 27 | + | ||
| 28 | + log.info("saveMawb end>>>>>>>>>>>"); | ||
| 29 | + }catch (Exception e){ | ||
| 30 | + log.error("saveMawb() error:"+e.getMessage()); | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + /** | ||
| 36 | + * 校验主单 | ||
| 37 | + * @param mawb | ||
| 38 | + * @return | ||
| 39 | + */ | ||
| 40 | + public Boolean checkMawb(Mawb mawb){ | ||
| 41 | + | ||
| 42 | + try{ | ||
| 43 | + log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb)); | ||
| 44 | + boolean checkResult = Boolean.FALSE; | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + //checkResult= | ||
| 50 | + log.info("checkMawb start>>>>>>>>>> mawb:"+gson.toJson(mawb) | ||
| 51 | + +" result :" +checkResult | ||
| 52 | + ); | ||
| 53 | + | ||
| 54 | + return checkResult; | ||
| 55 | + | ||
| 56 | + }catch (Exception e){ | ||
| 57 | + log.error("checkMawb() error:" + e.getMessage()); | ||
| 58 | + } | ||
| 59 | + return Boolean.FALSE; | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + | ||
| 63 | + | ||
| 64 | +} |
| 1 | +package com.erry.iclear.dateInterface.task; | ||
| 2 | + | ||
| 3 | +import lombok.extern.slf4j.Slf4j; | ||
| 4 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 5 | +import org.springframework.stereotype.Component; | ||
| 6 | + | ||
| 7 | +/** | ||
| 8 | + * @author Administrator | ||
| 9 | + */ | ||
| 10 | +@Component | ||
| 11 | +@Slf4j | ||
| 12 | +public class IClearApiTask { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * TODO 定时任务:每分钟推送 | ||
| 16 | + */ | ||
| 17 | + @Scheduled(cron = "${task.pushMawbToIClear}") | ||
| 18 | + public void pushMawbToIClear(){ | ||
| 19 | + try{ | ||
| 20 | + log.info("pushMawbToIClear start>>>>>>>>>>>>"); | ||
| 21 | + | ||
| 22 | + log.info("pushMawbToIClear end>>>>>>>>>>>>"); | ||
| 23 | + }catch (Exception e){ | ||
| 24 | + log.error("pushMawbToIClear() error:" +e.getMessage()); | ||
| 25 | + } | ||
| 26 | + } | ||
| 27 | +} |
src/main/resources/application-dev.yml
0 → 100644
src/main/resources/application-prod.yml
0 → 100644
src/main/resources/application-test.yml
0 → 100644
| 1 | +package com.erry.iclear.dateInterface; | ||
| 2 | + | ||
| 3 | +import com.erry.iclear.dateInterface.api.request.Mawb; | ||
| 4 | +import com.erry.iclear.dateInterface.api.request.MawbDetail; | ||
| 5 | +import com.erry.iclear.dateInterface.api.response.ResultRS; | ||
| 6 | +import com.google.gson.Gson; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | +import java.util.ArrayList; | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +public class ApiTest { | ||
| 13 | + | ||
| 14 | + | ||
| 15 | + public static void main(String[] args) { | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + | ||
| 19 | + MawbDetail d1 = new MawbDetail(); | ||
| 20 | + d1.setClassMark(""); | ||
| 21 | + d1.setCodeTS("69125472"); | ||
| 22 | + d1.setDeclPrice(BigDecimal.valueOf(111.123)); | ||
| 23 | + d1.setDeclTotal(BigDecimal.valueOf(788)); | ||
| 24 | + d1.setDutyMode("1"); | ||
| 25 | + d1.setExgNo(""); | ||
| 26 | + d1.setExgVersion(""); | ||
| 27 | + d1.setFirstUnit(""); | ||
| 28 | + d1.setFirstQty(11); | ||
| 29 | + d1.setGUnit("007"); | ||
| 30 | + d1.setGModel("商品规格、型号"); | ||
| 31 | + d1.setGName("餐桌"); | ||
| 32 | + d1.setGNo("1"); | ||
| 33 | + d1.setGQty(1); | ||
| 34 | + d1.setOriginCountry("USA"); | ||
| 35 | + d1.setSecondUnit("007"); | ||
| 36 | + d1.setSecondQty(2); | ||
| 37 | + d1.setTradeCurr("USA"); | ||
| 38 | + d1.setUseTo(""); | ||
| 39 | + d1.setWorkUsd(null); | ||
| 40 | + d1.setDestinationCountry("CHN"); | ||
| 41 | + d1.setCiqCode(""); | ||
| 42 | + d1.setDeclGoodsEname(""); | ||
| 43 | + d1.setDestCode(""); | ||
| 44 | + d1.setDistrictCode("4408W"); | ||
| 45 | + | ||
| 46 | + | ||
| 47 | + MawbDetail d2 = new MawbDetail(); | ||
| 48 | + d2.setClassMark(""); | ||
| 49 | + d2.setCodeTS("69125472"); | ||
| 50 | + d2.setDeclPrice(BigDecimal.valueOf(45.72)); | ||
| 51 | + d2.setDeclTotal(BigDecimal.valueOf(33)); | ||
| 52 | + d2.setDutyMode("1"); | ||
| 53 | + d2.setExgNo(""); | ||
| 54 | + d2.setExgVersion(""); | ||
| 55 | + d2.setFirstUnit(""); | ||
| 56 | + d2.setFirstQty(11); | ||
| 57 | + d2.setGUnit("007"); | ||
| 58 | + d2.setGModel("商品规格、型号"); | ||
| 59 | + d2.setGName("餐桌"); | ||
| 60 | + d2.setGNo("2"); | ||
| 61 | + d2.setGQty(22); | ||
| 62 | + d2.setOriginCountry("USA"); | ||
| 63 | + d2.setSecondUnit("007"); | ||
| 64 | + d2.setSecondQty(3); | ||
| 65 | + d2.setTradeCurr("USA"); | ||
| 66 | + d2.setUseTo(""); | ||
| 67 | + d2.setWorkUsd(null); | ||
| 68 | + d2.setDestinationCountry("CHN"); | ||
| 69 | + d2.setCiqCode(""); | ||
| 70 | + d2.setDeclGoodsEname(""); | ||
| 71 | + d2.setDestCode(""); | ||
| 72 | + d2.setDistrictCode("4408W"); | ||
| 73 | + | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + List<MawbDetail> mawbDetailList = new ArrayList<MawbDetail>(); | ||
| 77 | + mawbDetailList.add(d1); | ||
| 78 | + mawbDetailList.add(d2); | ||
| 79 | + | ||
| 80 | + | ||
| 81 | + | ||
| 82 | + | ||
| 83 | + Mawb mawb = new Mawb(); | ||
| 84 | + mawb.setIEFlag("E"); | ||
| 85 | + mawb.setType("EX"); | ||
| 86 | + mawb.setAgentCode("1111980005"); | ||
| 87 | + mawb.setAgentName("联邦快递(中国)有限公司"); | ||
| 88 | + mawb.setBillNo("202105210784"); | ||
| 89 | + mawb.setContrNo("NO.565733"); | ||
| 90 | + mawb.setCustomMaster("0101"); | ||
| 91 | + mawb.setCutMode("101"); | ||
| 92 | + mawb.setDeclTrnRel("0"); | ||
| 93 | + mawb.setDistinatePort("ASM000"); | ||
| 94 | + mawb.setEdiId("001"); | ||
| 95 | + mawb.setEntryId("25512456"); | ||
| 96 | + mawb.setFeeCurr("USD"); | ||
| 97 | + mawb.setFeeMark("3"); | ||
| 98 | + mawb.setFeeRate(BigDecimal.valueOf(100.58)); | ||
| 99 | + mawb.setGrossWet(500); | ||
| 100 | + mawb.setIEPort("0101"); | ||
| 101 | + mawb.setInputerName(""); | ||
| 102 | + mawb.setInsurCurr("MOP"); | ||
| 103 | + mawb.setInsurMark("3"); | ||
| 104 | + mawb.setInsurRate(BigDecimal.valueOf(23.44)); | ||
| 105 | + mawb.setManualNo("备案号"); | ||
| 106 | + mawb.setNetWt(BigDecimal.valueOf(80)); | ||
| 107 | + mawb.setOtherCurr("杂费币制"); | ||
| 108 | + mawb.setOtherRate(BigDecimal.valueOf(10)); | ||
| 109 | + mawb.setOtherMark(""); | ||
| 110 | + mawb.setOwnerCode("Z321654987"); | ||
| 111 | + mawb.setOwnerName("上海保险"); | ||
| 112 | + mawb.setPackNo(1); | ||
| 113 | + mawb.setPreEntryId(""); | ||
| 114 | + mawb.setTradeCountry("USA"); | ||
| 115 | + mawb.setTradeMode("0200"); | ||
| 116 | + mawb.setTradeCode("Z321654987"); | ||
| 117 | + mawb.setTrafMode("1"); | ||
| 118 | + mawb.setTradeName("上海铢怡国际货物运输代理有限公司"); | ||
| 119 | + mawb.setTransMode("3"); | ||
| 120 | + mawb.setWrapType("22"); | ||
| 121 | + mawb.setTradeCodeScc("A74125896321456987"); | ||
| 122 | + mawb.setOwnerCodeScc("A74125896321456987"); | ||
| 123 | + mawb.setTradeAreaCode("USA"); | ||
| 124 | + mawb.setMarkNo("N/M"); | ||
| 125 | + mawb.setEntyPortCode("310302"); | ||
| 126 | + mawb.setGoodsPlace(""); | ||
| 127 | + mawb.setDeclareName("张安"); | ||
| 128 | + mawb.setOverseasConsignorCode("Z785421"); | ||
| 129 | + mawb.setOverseasConsigneeCode("Z785421"); | ||
| 130 | + mawb.setOverseasConsigneeEname("出口时必填收件人公司名(原)"); | ||
| 131 | + mawb.setMawbDetailList(mawbDetailList); | ||
| 132 | + | ||
| 133 | + | ||
| 134 | + | ||
| 135 | + | ||
| 136 | + | ||
| 137 | + List list=(List<MawbDetail>) mawb.getMawbDetailList(); | ||
| 138 | + list.forEach(d->{ | ||
| 139 | + System.out.println(d.toString()); | ||
| 140 | + }); | ||
| 141 | + | ||
| 142 | + | ||
| 143 | + | ||
| 144 | + ResultRS rs = new ResultRS(); | ||
| 145 | + rs.setSuccess(true); | ||
| 146 | + rs.setCode("200"); | ||
| 147 | + rs.setMsg("操作成功"); | ||
| 148 | + rs.setData(mawbDetailList); | ||
| 149 | + | ||
| 150 | + Gson gson = new Gson(); | ||
| 151 | + System.out.println(gson.toJson(mawb)); | ||
| 152 | + | ||
| 153 | + System.out.println(gson.toJson(rs)); | ||
| 154 | + | ||
| 155 | + | ||
| 156 | + | ||
| 157 | + | ||
| 158 | + | ||
| 159 | + | ||
| 160 | + | ||
| 161 | + } | ||
| 162 | +} |
-
Please register or login to post a comment