审查视图

src/test/java/com/sy/BeihuoTests.java 8.7 KB
朱兆平 authored
1 2 3 4
package com.sy;

import com.sy.bwAnalysis.AnalysisRoute;
import com.sy.logic.LiftBar;
5
import com.sy.utils.XMLThreadPoolFactory;
6
import lombok.extern.slf4j.Slf4j;
朱兆平 authored
7 8 9 10 11
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
12 13 14
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
朱兆平 authored
15 16
@RunWith(SpringRunner.class)
@SpringBootTest
17
@Slf4j
朱兆平 authored
18 19 20
public class BeihuoTests {

21 22 23
    private static ThreadPoolExecutor threadPoolEs = XMLThreadPoolFactory.instance("kakou");
    private AnalysisRoute analysisRoute=new AnalysisRoute();
朱兆平 authored
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
    //车牌号
    private String voNo = "豫A61CR7";
    //备案重量
    private String vo_weight = "2000";
    //过卡重量
    private String cross_weight= "2324";
    //场站编号
    private String areaID = "4604600000";
    //通道编号
    private String chnlNo = "4604601010";
    //进出场类型I/E
    private String ie = "I";
    //二维码
    private String barcode = "613f5c";



    //进通道报文
    private static String IMPORT_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
            "<MSG>\n" +
            "\t<META>\n" +
            "\t\t<SNDR>KAO</SNDR>\n" +
            "\t\t<RCVR/>\n" +
            "\t\t<SEQN>20220624063157</SEQN>\n" +
            "\t\t<DDTM>20220624063157</DDTM>\n" +
            "\t\t<TYPE>KAKO</TYPE>\n" +
            "\t\t<STYP>CARM</STYP>\n" +
            "\t</META>\n" +
            "\t<GATHER_INFO AREA_ID=\"${areaID}\" CHNL_NO=\"${chnlNo}\" I_E_TYPE=\"${IETYPE}\" SEQ_NO=\"20220624063118000004\">\n" +
            "\t\t<IC>\n" +
            "\t\t\t<DR_IC_NO/>\n" +
            "\t\t\t<IC_DR_CUSTOMS_NO/>\n" +
            "\t\t\t<IC_CO_CUSTOMS_NO/>\n" +
            "\t\t\t<IC_BILL_NO/>\n" +
            "\t\t\t<IC_FORM_TYPE/>\n" +
            "\t\t\t<IC_GROSS_WT/>\n" +
            "\t\t\t<IC_VE_CUSTOMS_NO/>\n" +
            "\t\t\t<IC_VE_NAME/>\n" +
            "\t\t\t<IC_CONTA_ID/>\n" +
            "\t\t\t<IC_ESEAL_ID/>\n" +
            "\t\t\t<IC_REG_DATETIME/>\n" +
            "\t\t\t<IC_PER_DAY_DUE/>\n" +
            "\t\t\t<GPS_ID/>\n" +
            "\t\t</IC>\n" +
            "\t\t<WEIGHT>\n" +
            "\t\t\t<GROSS_WT>${cross_weight}</GROSS_WT>\n" +
            "\t\t</WEIGHT>\n" +
            "\t\t<CAR>\n" +
            "\t\t\t<VE_NAME>${car}</VE_NAME>\n" +
            "\t\t\t<CAR_EC_NO/>\n" +
            "\t\t\t<CAR_EC_NO2/>\n" +
            "\t\t\t<VE_CUSTOMS_NO/>\n" +
            "\t\t\t<VE_WT/>\n" +
            "\t\t</CAR>\n" +
            "\t\t<CONTA>\n" +
            "\t\t\t<CONTA_NUM/>\n" +
            "\t\t\t<CONTA_RECO>1</CONTA_RECO>\n" +
            "\t\t\t<CONTA_ID_F/>\n" +
            "\t\t\t<CONTA_ID_B/>\n" +
            "\t\t\t<CONTA_MODEL_F/>\n" +
            "\t\t\t<CONTA_MODEL_B/>\n" +
            "\t\t</CONTA>\n" +
            "\t\t<ORDER_NUM/>\n" +
            "\t\t<BAR_CODE>${barcode}</BAR_CODE>\n" +
            "\t\t<SEAL>\n" +
            "\t\t\t<ESEAL_ID/>\n" +
            "\t\t\t<SEAL_KEY/>\n" +
            "\t\t</SEAL>\n" +
            "\t</GATHER_INFO>\n" +
            "</MSG>";
朱兆平 authored
95
朱兆平 authored
96
    /**
朱兆平 authored
97
     * 进场测试
朱兆平 authored
98 99
     */
    @Test
朱兆平 authored
100 101 102 103
    public void exportDownload_I() throws InterruptedException {
        //车牌号
        String voNo = "豫A61CR7";
        //过卡重量
朱兆平 authored
104
        String cross_weight= "4800";
朱兆平 authored
105
        //场站编号
朱兆平 authored
106
        String areaID = "4604000000";
朱兆平 authored
107
        //通道编号
朱兆平 authored
108
        String chnlNo = "4604333311";
朱兆平 authored
109 110 111
        //进出场类型I/E
        String ie = "I";
        //二维码
朱兆平 authored
112
        String barcode = "fb2-4fdb-aa62-b6ee0d33c915";
朱兆平 authored
113
114
        log.error("开始进场测试");
朱兆平 authored
115
        IMPORT_XML= IMPORT_XML.replace("${car}",voNo)
朱兆平 authored
116 117 118 119 120 121
                .replace("${cross_weight}",cross_weight)
                .replace("${areaID}",areaID)
                .replace("${chnlNo}",chnlNo)
                .replace("${IETYPE}",ie)
                .replace("${barcode}",barcode);
        //进港提货测试
122 123

        analysisRoute.setMessage(IMPORT_XML);
朱兆平 authored
124
        analysisRoute.run();
朱兆平 authored
125 126 127
    }

    /**
朱兆平 authored
128
     * 出场测试
朱兆平 authored
129 130 131 132 133
     */
    @Test
    public void exportDownload_E(){

        //车牌号
朱兆平 authored
134
         String voNo = "豫A61CR8";
朱兆平 authored
135
        //过卡重量
朱兆平 authored
136
         String cross_weight= String.valueOf(4200);
朱兆平 authored
137
        //场站编号
朱兆平 authored
138
         String areaID = "4600329012";
朱兆平 authored
139
        //通道编号
朱兆平 authored
140
         String chnlNo = "4600010006";
朱兆平 authored
141 142 143
        //进出场类型I/E
         String ie = "E";
        //二维码
朱兆平 authored
144
         String barcode = "f7f-461a-bb39-b61c0a4d5677";
145
        log.error("开始出口送货离场测试");
朱兆平 authored
146 147 148 149 150 151 152
        IMPORT_XML= IMPORT_XML.replace("${car}",voNo)
                .replace("${cross_weight}",cross_weight)
                .replace("${areaID}",areaID)
                .replace("${chnlNo}",chnlNo)
                .replace("${IETYPE}",ie)
                .replace("${barcode}",barcode);
        //进港提货测试
153
        analysisRoute.setMessage(IMPORT_XML);
朱兆平 authored
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
        analysisRoute.run();

    }


    /**
     * 带货送货测试
     */
    @Test
    public void exportDownload_I_withGoods() {
        //车牌号
         voNo = "豫A61CR7";
        //过卡重量
         cross_weight= "3000";
        //场站编号
         areaID = "4604600000";
        //通道编号
         chnlNo = "4604601011";
        //进出场类型I/E
         ie = "I";
        //二维码
         barcode = "78825a";
        message();
    }

    @Test
    public void exportDownload_e_withGoods() {
        //车牌号
        voNo = "豫A61CR7";
        //过卡重量
        cross_weight= String.valueOf(3000-402.00);
        //场站编号
        areaID = "4604600000";
        //通道编号
        chnlNo = "4604600011";
        //进出场类型I/E
        ie = "E";
        //二维码
        barcode = "78825a";
        message();
    }
195
朱兆平 authored
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
    /**
     * 带货提货测试
     */
    @Test
    public void DLV_I_withGoods() {
        //车牌号
        voNo = "豫A61CR7";
        //过卡重量
        cross_weight= "4000";
        //场站编号
        areaID = "4604600000";
        //通道编号
        chnlNo = "4604601011";
        //进出场类型I/E
        ie = "I";
        //二维码
        barcode = "14e13a";
        message();
    }

    @Test
    public void DLV_e_withGoods() {
        //车牌号
        voNo = "豫A61CR7";
        //过卡重量
        cross_weight= String.valueOf(4000+3000);
        //场站编号
        areaID = "4604600000";
        //通道编号
        chnlNo = "4604600011";
        //进出场类型I/E
        ie = "E";
        //二维码
        barcode = "14e13a";
        message();
    }


    /**
     * 分批送货,加带货送货一起了
     */
    @Test
    public void export_I_withGoodsSplit() {
        //车牌号
        voNo = "豫A61CR7";
        //过卡重量
        cross_weight= "4000";
        //场站编号
        areaID = "4604600000";
        //通道编号
        chnlNo = "4604601011";
        //进出场类型I/E
        ie = "I";
        //二维码
        barcode = "1498f9";
        message();
    }

    @Test
    public void export_E_withGoodsSplit() {
        //车牌号
        voNo = "豫A61CR7";
        //过卡重量
        cross_weight= String.valueOf(4000-2742);
        //场站编号
        areaID = "4604600000";
        //通道编号
        chnlNo = "4604600011";
        //进出场类型I/E
        ie = "E";
        //二维码
        barcode = "1498f9";
        message();
    }

    /**
     * 分批提货+带货提货
     */
    @Test
    public void dlv_I_withGoodsSplit() {
        //车牌号
        voNo = "豫A61CR7";
        //过卡重量
        cross_weight= "4000";
        //场站编号
        areaID = "4604600000";
        //通道编号
        chnlNo = "4604601011";
        //进出场类型I/E
        ie = "I";
        //二维码
        barcode = "7d0368";
        message();
    }

    @Test
    public void dlv_E_withGoodsSplit() {
        //车牌号
        voNo = "豫A61CR7";
        //过卡重量
        cross_weight= String.valueOf(4000+2700);
        //场站编号
        areaID = "4604600000";
        //通道编号
        chnlNo = "4604600011";
        //进出场类型I/E
        ie = "E";
        //二维码
        barcode = "7d0368";
        message();
朱兆平 authored
306 307
    }
朱兆平 authored
308 309 310 311
    /**
     *
     */
    public void message(){
312
        log.error("开始进场测试");
朱兆平 authored
313 314 315 316 317 318 319 320 321 322 323
        IMPORT_XML= IMPORT_XML.replace("${car}",voNo)
                .replace("${cross_weight}",cross_weight)
                .replace("${areaID}",areaID)
                .replace("${chnlNo}",chnlNo)
                .replace("${IETYPE}",ie)
                .replace("${barcode}",barcode);
        //进港提货测试

        analysisRoute.setMessage(IMPORT_XML);
        analysisRoute.run();
    }
朱兆平 authored
324 325

}