Index: src/main/java/com/novaone/control/PayController.java
===================================================================
--- src/main/java/com/novaone/control/PayController.java	(revision 29990)
+++ src/main/java/com/novaone/control/PayController.java	(revision 29993)
@@ -10,23 +10,28 @@
 import com.novaone.entity.JsonModel;
 import com.novaone.entity.PayVO;
 import com.novaone.service.BOCPayService;
+import com.novaone.service.BocInterfaceService;
+import com.novaone.service.ConfigService;
+import com.novaone.util.B2e0043Type;
 import com.novaone.util.CommonEnum;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 
+@Slf4j
 @RestController
 @RequestMapping("/pay")
 public class PayController {
-
+    @Resource
     private BOCPayService bocPayService;
+    @Resource
+    private BocInterfaceService bocInterfaceService;
+    @Resource
+    private ConfigService configService;
 
-    @Autowired
-    public PayController(BOCPayService bocPayService) {
-        this.bocPayService = bocPayService;
-    }
 
-
     /**
      * 通过中行账户支付
      */
@@ -56,7 +61,22 @@
     @GetMapping("/download/{type}")
     public JsonModel download(@PathVariable("type") String type){
         JsonModel res = new JsonModel();
+        if (!checkType(type)){
+            res.setCode(CommonEnum.API_ERROR.getCode());
+            res.setDes(CommonEnum.API_ERROR.getRes() + ":传递的参数不符合要求");
+            log.error("传递了错误的参数type = {}",type);
+            return res;
+        }
         try {
+            bocInterfaceService.checkConfig();
+            bocInterfaceService.sign();
+        } catch (Exception e) {
+            res.setCode(CommonEnum.API_ERROR.getCode());
+            res.setDes(CommonEnum.API_ERROR.getRes() + ":" + e.getMessage());
+            log.error("前置机校验失败",e);
+            return res;
+        }
+        try {
             bocPayService.download(type);
             res.setCode(CommonEnum.API_SUCCESS.getCode());
             res.setDes(CommonEnum.API_SUCCESS.getRes());
@@ -63,8 +83,17 @@
         } catch (Exception e) {
             res.setCode(CommonEnum.API_ERROR.getCode());
             res.setDes(CommonEnum.API_ERROR.getRes() + ":" + e.getMessage());
-            e.printStackTrace();
+            log.error("b2e0043接口调用失败",e);
         }
         return res;
     }
+
+    private boolean checkType(String type){
+        for (B2e0043Type value : B2e0043Type.values()) {
+            if (value.getType().equals(type)) {
+                return true;
+            }
+        }
+        return false;
+    }
 }
Index: src/main/java/com/novaone/service/impl/BOCPayServiceImpl.java
===================================================================
--- src/main/java/com/novaone/service/impl/BOCPayServiceImpl.java	(revision 29990)
+++ src/main/java/com/novaone/service/impl/BOCPayServiceImpl.java	(revision 29993)
@@ -33,8 +33,6 @@
 public class BOCPayServiceImpl implements BOCPayService {
 
     @Resource
-    private BocInterfaceService bocInterfaceService;
-    @Resource
     private ConfigService configService;
 
 
@@ -65,14 +63,6 @@
     @SneakyThrows
     public void download(String type) {
         ConfigBocVO configBocVO = configService.queryConfigOne();
-        try {
-            bocInterfaceService.checkConfig();
-            bocInterfaceService.sign();
-        } catch (Exception e) {
-            log.error("前置机校验失败",e);
-            e.printStackTrace();
-            return;
-        }
         String xml = b2e0043XMLBuild(type,configBocVO);
         String url = configBocVO.getProtocol() + "://" + configBocVO.getIp() + ":" + configBocVO.getPort() + "/B2EC/E2BServlet";
         log.info("b2e0043请求URL:{}   XML:{}",url,xml);
Index: src/main/java/com/novaone/util/B2e0043Type.java
===================================================================
--- src/main/java/com/novaone/util/B2e0043Type.java	(nonexistent)
+++ src/main/java/com/novaone/util/B2e0043Type.java	(revision 29993)
@@ -0,0 +1,32 @@
+package com.novaone.util;
+
+/*
+ * @program: BankEnterprise
+ * @description: CNAPS、中行机构号文件下载(b2e0043)请求参数类型枚举
+ * @author: Ma.ChengJian
+ * @create: 2022-02-08 15:12
+ */
+public enum B2e0043Type {
+
+    CNAPS("0","CNAPS文件"),
+    BANK_NUMBER("1","CNAPS文件"),
+    ECD("2","电子汇票行号文件");
+
+
+
+    private String type;
+    private String des;
+
+    B2e0043Type(String type, String des) {
+        this.type = type;
+        this.des = des;
+    }
+
+    public String getType() {
+        return type;
+    }
+
+    public String getDes() {
+        return des;
+    }
+}
Index: src/main/java/com/novaone/util/CreateXml.java
===================================================================
--- src/main/java/com/novaone/util/CreateXml.java	(revision 29990)
+++ src/main/java/com/novaone/util/CreateXml.java	(revision 29993)
@@ -187,20 +187,4 @@
         String json = xmlSerializer.read(xml).toString();
         return JSONObject.fromObject(json);
     }
-
-
-//    public static String createB2e0521XML(ConfigBocVO bocVO, List<B2e0251Rq> trans){
-//        String xmlHead = header(bocVO, "b2e0251");
-//        StringBuilder xml = new StringBuilder(xmlHead);
-//        xml.append("<trans>").append("<trn-b2e0251-rq>");
-//        //将请求业务参数的请求部分转为XML
-//        XStream stream = new XStream();
-//        stream.autodetectAnnotations(true);//配置注解自动检测，开启改配置XStream的注解配置才会生效。
-//        for (B2e0251Rq tran : trans) {
-//            xml.append(stream.toXML(tran));
-//        }
-//        xml.append("</trn-b2e0251-rq>").append("</trans>").append("</bocb2e>");
-//        return xml.toString();
-//    }
-
 }
