소스 검색

Merge branch 'master' of http://git.ds-bay.com/project/ccnet2.0

csk 7 년 전
부모
커밋
79edaf35d9
41개의 변경된 파일2202개의 추가작업 그리고 7개의 파일을 삭제
  1. 18 0
      src/main/java/com/emato/ccnet/biz/req/CebReqExcel.java
  2. 25 0
      src/main/java/com/emato/ccnet/biz/req/CebReqMessage.java
  3. 12 0
      src/main/java/com/emato/ccnet/biz/req/CebReqSend.java
  4. 20 0
      src/main/java/com/emato/ccnet/biz/req/CebReqTransfer.java
  5. 19 0
      src/main/java/com/emato/ccnet/biz/req/CusReqBiz.java
  6. 182 0
      src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillBiz.java
  7. 49 0
      src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillData.java
  8. 33 0
      src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillSend.java
  9. 54 0
      src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillSendAfter.java
  10. 49 0
      src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillTransfer.java
  11. 136 0
      src/main/java/com/emato/ccnet/biz/req/pay/icbc/CebReq411PayBillMessage.java
  12. 8 0
      src/main/java/com/emato/ccnet/config/Cus.java
  13. 11 0
      src/main/java/com/emato/ccnet/config/Merchant.java
  14. 25 2
      src/main/java/com/emato/ccnet/controller/KmallOrderController.java
  15. 51 0
      src/main/java/com/emato/ccnet/controller/KmallSellerController.java
  16. 63 0
      src/main/java/com/emato/ccnet/cus/message/req/AbstractCebReq.java
  17. 188 0
      src/main/java/com/emato/ccnet/cus/message/req/CebReqMessageHead.java
  18. 104 0
      src/main/java/com/emato/ccnet/cus/message/req/CebReqRoot.java
  19. 43 0
      src/main/java/com/emato/ccnet/cus/message/req/ceb411/Ceb411Payment.java
  20. 303 0
      src/main/java/com/emato/ccnet/cus/message/req/ceb411/Ceb411PaymentHead.java
  21. 61 0
      src/main/java/com/emato/ccnet/cus/message/req/ceb411/CebReq411Message.java
  22. 131 0
      src/main/java/com/emato/ccnet/cus/message/resp/CebRespRoot.java
  23. 104 0
      src/main/java/com/emato/ccnet/cus/message/support/CebSupport.java
  24. 41 0
      src/main/java/com/emato/ccnet/cus/message/transfer/MessageTransfer.java
  25. 60 0
      src/main/java/com/emato/ccnet/cus/message/transfer/MessageTransferImpl.java
  26. 51 1
      src/main/java/com/emato/ccnet/domain/kmall/PayBill.java
  27. 68 0
      src/main/java/com/emato/ccnet/domain/kmall/Seller.java
  28. 2 0
      src/main/java/com/emato/ccnet/mapper/kmall/KmallOrderMapper.java
  29. 27 0
      src/main/java/com/emato/ccnet/mapper/kmall/KmallSellerMapper.java
  30. 2 0
      src/main/java/com/emato/ccnet/service/kmall/KmallOrderService.java
  31. 22 0
      src/main/java/com/emato/ccnet/service/kmall/KmallSellerService.java
  32. 5 0
      src/main/java/com/emato/ccnet/service/kmall/impl/KmallOrderServiceImpl.java
  33. 34 0
      src/main/java/com/emato/ccnet/service/kmall/impl/KmallSellerServiceImpl.java
  34. 23 0
      src/main/java/com/emato/ccnet/util/DataUtils.java
  35. 18 0
      src/main/resources/application-dev.yml
  36. 18 0
      src/main/resources/application.yml
  37. 21 0
      src/main/resources/mybatis/mapper/kmall/kmall_order.xml
  38. 44 0
      src/main/resources/mybatis/mapper/kmall/kmall_seller.xml
  39. 12 3
      src/main/resources/static/html/cus-doc.html
  40. 64 0
      src/main/resources/static/js/biz/biz.js
  41. 1 1
      src/main/resources/static/js/biz/core.js

+ 18 - 0
src/main/java/com/emato/ccnet/biz/req/CebReqExcel.java

@@ -0,0 +1,18 @@
+package com.emato.ccnet.biz.req;
+
+import java.util.List;
+
+/**
+ * 海关单证Excel数据
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 10:15
+ */
+public interface CebReqExcel {
+
+    /**
+     * 导出excel
+     */
+    List exportExcel(List list);
+
+}

+ 25 - 0
src/main/java/com/emato/ccnet/biz/req/CebReqMessage.java

@@ -0,0 +1,25 @@
+package com.emato.ccnet.biz.req;
+
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+
+import java.util.Map;
+
+/**
+ * 海关单证报文生成
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 10:15
+ */
+public interface CebReqMessage {
+
+    /**
+     * 生成报文
+     * @param bizParams
+     * @param messageType
+     * @param orderNo
+     * @param <T>
+     * @return
+     */
+    <T extends CebReqRoot> T buildMessage(Map<String, Object> bizParams, String messageType, String orderNo);
+
+}

+ 12 - 0
src/main/java/com/emato/ccnet/biz/req/CebReqSend.java

@@ -0,0 +1,12 @@
+package com.emato.ccnet.biz.req;
+
+/**
+ * 海关单证报文发送
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 19:22
+ */
+public interface CebReqSend {
+
+    boolean send(String msgXml, String cebType, String msgFileName, String orderNo);
+}

+ 20 - 0
src/main/java/com/emato/ccnet/biz/req/CebReqTransfer.java

@@ -0,0 +1,20 @@
+package com.emato.ccnet.biz.req;
+
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+
+/**
+ * 请求报文转换
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 21:41
+ */
+public interface CebReqTransfer {
+
+    /**
+     * 报文转换
+     * @param msgObj
+     * @param orderNo
+     * @return
+     */
+    String transform(CebReqRoot msgObj, String orderNo);
+}

+ 19 - 0
src/main/java/com/emato/ccnet/biz/req/CusReqBiz.java

@@ -0,0 +1,19 @@
+package com.emato.ccnet.biz.req;
+
+import com.emato.ccnet.msg.ResponseMessage;
+
+import java.util.Map;
+
+/**
+ * 业务入口
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 10:23
+ */
+public interface CusReqBiz {
+
+    /**
+     * 业务
+     */
+    ResponseMessage biz(Map<String, Object> param);
+}

+ 182 - 0
src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillBiz.java

@@ -0,0 +1,182 @@
+package com.emato.ccnet.biz.req.pay.icbc;
+
+import com.emato.ccnet.biz.req.CusReqBiz;
+import com.emato.ccnet.config.Cus;
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+import com.emato.ccnet.cus.message.support.CebSupport;
+import com.emato.ccnet.domain.kmall.PayBill;
+import com.emato.ccnet.msg.ResponseMessage;
+import com.google.common.base.Joiner;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 海关支付单 业务
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 10:10
+ */
+@Component
+public class Ceb411PayBillBiz implements CusReqBiz {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Ceb411PayBillBiz.class);
+
+    @Autowired
+    private Cus cus;
+
+    @Autowired
+    private Ceb411PayBillData ceb411PayBillData;
+    @Autowired
+    private CebReq411PayBillMessage ceb411PayBillMessage;
+    @Autowired
+    private Ceb411PayBillTransfer ceb411PayBillTransfer;
+    @Autowired
+    private Ceb411PayBillSend ceb411PayBillSend;
+    @Autowired
+    private Ceb411PayBillSendAfter ceb411PayBillSendAfter;
+
+    private Map<String, Object> param = Collections.EMPTY_MAP;
+
+
+    /**
+     * 业务入口
+     * @param param
+     * @return
+     */
+    @Override
+    public ResponseMessage biz(Map<String, Object> param) {
+        if (param.isEmpty()) {
+            String info = "【CEB411】请求订单支付数据,入参为空";
+            LOGGER.error("--- {}", info);
+            return ResponseMessage.failed(info);
+        }
+
+        //查询支付单数据
+        List list = ceb411PayBillData.getData(param);
+        if (list.isEmpty()) {
+            String info = "【CEB411】没有订单数据, 生成海关支付单报文提前结束";
+            LOGGER.error("--- {}", info);
+            return ResponseMessage.failed(info);
+        }
+
+        //订单发送海关处理
+        List result = sendCusHandle(list);
+
+        return ResponseMessage.success(result);
+    }
+
+
+    private List sendCusHandle(List list) {
+
+        //记录发送成功,发送失败订单
+        List<String> sucList = new ArrayList<>();
+        List<String> failedList = new ArrayList<>();
+
+        //支付单数据
+        List<PayBill> payBillList = (List<PayBill>) list;
+        for (PayBill payBill : payBillList) {
+            try {
+                //生成请求报文文件名
+                String msgFileName = CebSupport.buildFileName(
+                        CebSupport.CEB411,
+                        cus.getAlipay().get("senderID"),
+                        CebSupport.RECEIVER_ID);
+                LOGGER.info("--- 订单:【{}】, 支付单:【{}】, 生成EPort请求报文件名:{}", payBill.getOrderNo(), payBill.getTradeNo(), msgFileName);
+
+                //生成请求报文
+                LOGGER.info("--- 订单:【{}】, 支付单:【{}】,报文对象生成开始......", payBill.getOrderNo(), payBill.getTradeNo());
+                CebReqRoot cebReqRoot;
+
+                try {
+                    ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
+                    builder.put("payBill", payBill);
+                    builder.put("msgFileName", msgFileName);
+
+                    //生成报文
+                    cebReqRoot = ceb411PayBillMessage.buildMessage(builder.build(), CebSupport.CEB411, payBill.getOrderNo());
+
+                } catch (Exception e) {
+                    String str = "--- 订单:【" + payBill.getOrderNo() + "】, 支付单:【" + payBill.getTradeNo() + "】, 生成请求报文失败";
+                    LOGGER.error(str, e);
+                    //失败记录
+                    failedList.add(payBill.getOrderNo());
+                    //其它继续生成
+                    continue;
+                }
+
+                if (cebReqRoot == null) {
+                    String str = "--- 订单:【" + payBill.getOrderNo() + "】, 支付单:【" + payBill.getTradeNo() + "】, 生成请求报文为空";
+                    LOGGER.error(str);
+                    //失败记录
+                    failedList.add(payBill.getOrderNo());
+                    //其它继续生成
+                    continue;
+                }
+
+                LOGGER.info("--- 订单:【{}】, 支付单:【{}】,生成请求报文成功", payBill.getOrderNo(), payBill.getTradeNo());
+
+                //报文对象转XML字符串
+                String msgXml =  ceb411PayBillTransfer.transform(cebReqRoot, payBill.getOrderNo());
+                if (StringUtils.isBlank(msgXml)) {
+                    String str = "--- 订单:【" + payBill.getOrderNo() + "】, 支付单:【" + payBill.getTradeNo() + "】, 报文对象转XML字符串为空";
+                    LOGGER.error(str);
+                    //失败记录
+                    failedList.add(payBill.getOrderNo());
+                    //其它继续生成
+                    continue;
+                }
+                LOGGER.info("--- 订单:【{}】, 支付单:【{}】,报文对象转XML字符串成功", payBill.getOrderNo(), payBill.getTradeNo());
+
+                //报文xml字符串输出存放指定到目录
+                boolean bl = ceb411PayBillSend.send(msgXml, CebSupport.CEB411, msgFileName, payBill.getOrderNo());
+                if (!bl) {
+                    String str = "--- 订单:【" + payBill.getOrderNo() + "】, 支付单:【" + payBill.getTradeNo() + "】, XML字符串保存为文件失败";
+                    LOGGER.error(str);
+                    //失败记录
+                    failedList.add(payBill.getOrderNo());
+                    //其它继续生成
+                    continue;
+                }
+                LOGGER.info("--- 订单:【{}】, 支付单:【{}】,XML字符串保存为文件成功", payBill.getOrderNo(), payBill.getTradeNo());
+
+                //记录成功
+                sucList.add(payBill.getOrderNo());
+
+            } catch (final RuntimeException e) {
+                String str = "--- 订单:【" + payBill.getOrderNo() + "】, 支付单:【" + payBill.getTradeNo() + "】, 生成请求报文异常";
+                LOGGER.error(str);
+                //失败记录
+                failedList.add(payBill.getOrderNo());
+                //其它继续生成
+                continue;
+            }
+        }
+
+        LOGGER.info("--- 【CEB411】【成功】订单数:{}, 订单: {}", sucList.size(), Joiner.on(",").skipNulls().join(sucList.toArray()));
+        LOGGER.info("--- 【CEB411】【失败】订单数:{}, 订单: {}", failedList.size(), Joiner.on(",").skipNulls().join(failedList.toArray()));
+
+        ceb411PayBillSendAfter.afterSend(sucList, failedList);
+
+        Map<String, Object> sucMap = ImmutableMap.of("suc", sucList);
+        Map<String, Object> failedMap = ImmutableMap.of("failed", failedList);
+        List result = ImmutableList.of(sucMap, failedMap);
+        return result;
+    }
+
+    public Map<String, Object> getParam() {
+        return param;
+    }
+
+    public void setParam(Map<String, Object> param) {
+        this.param = param;
+    }
+}

+ 49 - 0
src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillData.java

@@ -0,0 +1,49 @@
+package com.emato.ccnet.biz.req.pay.icbc;
+
+import com.emato.ccnet.biz.req.CebReqGetDate;
+import com.emato.ccnet.domain.kmall.PayBill;
+import com.emato.ccnet.service.kmall.KmallOrderService;
+import com.google.common.collect.ImmutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 海关支付单 数据
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 10:21
+ */
+@Component
+public class Ceb411PayBillData implements CebReqGetDate {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CebReqGetDate.class);
+
+    @Autowired
+    private KmallOrderService kmallOrderService;
+
+    @Override
+    public List getData(Map<String, Object> param) {
+        //取支付单数据
+        List<PayBill> list = kmallOrderService.getIcbcPayBills(param);
+        if (list == null || list.size() == 0) {
+            return Collections.emptyList();
+        }
+
+        //更新取出支付单状态
+        List<Map<String, Object>> updateList = new ArrayList<>();
+        list.stream().forEach(x->{
+            Map<String, Object> map = ImmutableMap.of("orderNo", x.getOrderNo(), "cusPayBillFlag", "1");
+            updateList.add(map);
+        });
+        if (updateList.size() > 0) {
+            kmallOrderService.updateCusKmallOrderStatusBatch(updateList);
+        }
+        return list;
+    }
+}

+ 33 - 0
src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillSend.java

@@ -0,0 +1,33 @@
+package com.emato.ccnet.biz.req.pay.icbc;
+
+import com.emato.ccnet.biz.req.CebReqSend;
+import com.emato.ccnet.config.Cus;
+import com.emato.ccnet.util.FileUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+/**
+ * 海关支付单 发送
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 19:23
+ */
+@Component
+public class Ceb411PayBillSend implements CebReqSend {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Ceb411PayBillSend.class);
+
+    @Autowired
+    private Cus cus;
+
+    @Override
+    public boolean send(String msgXml, String cebType, String msgFileName, String orderNo) {
+        LOGGER.info("--- 业务:【{}】,订单:【{}】,文件名:【{}】,报文xml输出开始......", cebType, orderNo, msgFileName);
+
+        boolean bl = FileUtil.writeFile(msgXml, cus.getMessage().get("saveDir"), msgFileName);
+
+        LOGGER.info("--- 业务:【{}】,订单:【{}】,文件名:【{}】,报文xml输出结束", cebType, orderNo, msgFileName);
+        return bl;
+    }
+}

+ 54 - 0
src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillSendAfter.java

@@ -0,0 +1,54 @@
+package com.emato.ccnet.biz.req.pay.icbc;
+
+import com.emato.ccnet.biz.req.CebReqSendDateAfter;
+import com.emato.ccnet.service.kmall.KmallOrderService;
+import com.google.common.collect.ImmutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 海关支付单 报文发送后
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 21:56
+ */
+@Component
+public class Ceb411PayBillSendAfter implements CebReqSendDateAfter {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Ceb411PayBillSendAfter.class);
+
+    @Autowired
+    private KmallOrderService kmallOrderService;
+
+    @Override
+    public boolean afterSend(List<String> sucList, List<String> failedList) {
+        List<Map<String, Object>> sucs = new ArrayList<>();
+        List<Map<String, Object>> faileds = new ArrayList<>();
+
+        //全部处理完后
+        if (sucList.size() > 0) {
+            LOGGER.info("--- 【CEB411】更新【成功】报文订单记录......");
+            sucList.stream().forEach(x->{
+                Map<String, Object> map = ImmutableMap.of("orderNo", x, "cusPayBillFlag", "2");
+                sucs.add(map);
+            });
+            int i = kmallOrderService.updateCusKmallOrderStatusBatch(sucs);
+        }
+
+        if (failedList.size() > 0) {
+            LOGGER.info("--- 【CEB411】更新【失败】报文订单记录......");
+            failedList.stream().forEach(x->{
+                Map<String, Object> map = ImmutableMap.of("orderNo", x, "cusPayBillFlag", "3");
+                faileds.add(map);
+            });
+            int i = kmallOrderService.updateCusKmallOrderStatusBatch(faileds);
+        }
+
+        return true;
+    }
+}

+ 49 - 0
src/main/java/com/emato/ccnet/biz/req/pay/icbc/Ceb411PayBillTransfer.java

@@ -0,0 +1,49 @@
+package com.emato.ccnet.biz.req.pay.icbc;
+
+import com.emato.ccnet.biz.req.CebReqTransfer;
+import com.emato.ccnet.config.Cus;
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+import com.emato.ccnet.cus.message.support.CebSupport;
+import com.emato.ccnet.cus.message.transfer.MessageTransfer;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+/**
+ * 海关支付单 报文对象转XML
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 21:54
+ */
+@Component
+public class Ceb411PayBillTransfer implements CebReqTransfer {
+    private static final Logger LOGGER = LoggerFactory.getLogger(Ceb411PayBillTransfer.class);
+
+    /**
+     * 是否格式化XML报文,主要用于调试程序,生产环境不能格式化(必须为false)
+     */
+    @Autowired
+    private Cus cus;
+
+    @Autowired
+    private MessageTransfer messageTransfer;
+
+
+    @Override
+    public String transform(CebReqRoot msgObj, String orderNo) {
+        LOGGER.info("--- 【CEB411】订单:【{}】,报文Java对象转XML字符串开始......", orderNo);
+        String xmlStr="";
+        try {
+            //报文对象转XML字符串
+            xmlStr = messageTransfer.toXml(CebSupport.CEB411, msgObj, Boolean.valueOf(cus.getMessage().get("format")));
+            LOGGER.debug("--- 【CEB411】订单:【{}】,转换后的报文XML字符串:{}", orderNo, xmlStr);
+        } catch (Exception e) {
+            LOGGER.error("--- 【CEB411】订单:【{}】,EPort请求报文Java对象转为XML字符串时,发生错误", orderNo, e);
+            return xmlStr;
+        }
+        LOGGER.info("--- 【CEB411】订单:【{}】,报文Java对象转XML字符串结束----------", orderNo);
+        return xmlStr;
+    }
+}

+ 136 - 0
src/main/java/com/emato/ccnet/biz/req/pay/icbc/CebReq411PayBillMessage.java

@@ -0,0 +1,136 @@
+package com.emato.ccnet.biz.req.pay.icbc;
+
+import com.emato.ccnet.biz.req.CebReqMessage;
+import com.emato.ccnet.config.Cus;
+import com.emato.ccnet.config.Merchant;
+import com.emato.ccnet.cus.message.req.AbstractCebReq;
+import com.emato.ccnet.cus.message.req.CebReqMessageHead;
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+import com.emato.ccnet.cus.message.req.ceb411.Ceb411Payment;
+import com.emato.ccnet.cus.message.req.ceb411.Ceb411PaymentHead;
+import com.emato.ccnet.cus.message.req.ceb411.CebReq411Message;
+import com.emato.ccnet.cus.message.support.CebSupport;
+import com.emato.ccnet.domain.kmall.PayBill;
+import com.emato.ccnet.util.LocalDateTimeUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+import java.util.UUID;
+
+/**
+ * 海关支付单 报文Java对象生成
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 09:49
+ */
+@Component
+public class CebReq411PayBillMessage extends AbstractCebReq implements CebReqMessage {
+    private static final Logger LOGGER = LoggerFactory.getLogger(CebReq411PayBillMessage.class);
+
+    @Autowired
+    private Cus cus;
+    @Autowired
+    private Merchant merchant;
+
+    /**
+     * 报文生成
+     * @param messageType
+     * @param bizParams
+     * @param <T>
+     * @return
+     */
+    @Override
+    public <T extends CebReqRoot> T buildMessage(Map<String, Object> bizParams, String messageType, String orderNo) {
+        LOGGER.info("--- 订单:【{}】, 报文Java对象生成开始......", orderNo);
+
+        PayBill payBill = (PayBill)bizParams.get("payBill");
+        //报文生成异常时,记录文件名到库
+        String msgFileName = (String) bizParams.get("msgFileName");
+
+        //---------- 报文组装 ------------------------------
+
+        //----------报文----------
+        CebReq411Message ceb411Message = super.setMessageAttribute(new CebReq411Message());
+
+        /**
+         * 报文编号
+         * 系统唯一序号
+         * 企业系统生成36 位单证唯一序号(要求为guid36 位,英文字母大写)
+         */
+        String messageId = UUID.randomUUID().toString().toUpperCase();
+        String guid = UUID.randomUUID().toString().toUpperCase();
+
+        ceb411Message.setGuid(messageId);
+
+        //----------报文头----------
+        CebReqMessageHead cebReqMessageHead = super.setMessageHead(new CebReqMessageHead());
+        //报文唯一编号
+        cebReqMessageHead.setMessageID(messageId);
+        //报文类型
+        cebReqMessageHead.setMessageType(messageType);
+        /**
+         * 接收部门
+         * 填写本报文发送的监管单位,可同时填写多个监管部门:
+         * C-海关;Q-检验检疫;
+         * 例如:同时发送至海关、检验检疫可填写:CQ
+         * 本节点根据监管部门要求将来可扩展
+         */
+        cebReqMessageHead.setReceiverDepartment(CebSupport.ceb_cq);
+
+
+        //----------报文体----------
+        Ceb411Payment ceb411Payment = new Ceb411Payment();
+
+        //----------表头----------
+        Ceb411PaymentHead ceb411PaymentHead = new Ceb411PaymentHead();
+        ceb411PaymentHead.setGuid(guid);
+        ceb411PaymentHead.setAppType(CebSupport.APP_TYPE_ADD);
+        ceb411PaymentHead.setAppStatus(CebSupport.APP_status_decl);
+        ceb411PaymentHead.setAppTime(LocalDateTimeUtils.formatNow("yyyyMMddHHmmss"));
+
+
+        ceb411PaymentHead.setPayCode(cus.getAlipay().get("copCode"));
+        ceb411PaymentHead.setPayName(cus.getAlipay().get("copName"));
+
+        //支付编号
+        ceb411PaymentHead.setPayTransactionId(payBill.getTradeNo());
+        //订单编号
+        ceb411PaymentHead.setOrderNo(payBill.getOrderNo());
+        //电商平台代码
+        ceb411PaymentHead.setEbpCode(merchant.getMerchantCustomsCode());
+        //电商平台名称
+        ceb411PaymentHead.setEbpName(merchant.getMerchantCustomsName());
+        //支付人证件类型
+        ceb411PaymentHead.setPayerIdType(payBill.getIdType());
+        //支付人证件号码
+        ceb411PaymentHead.setPayerIdNumber(payBill.getIdCode());
+        //支付人姓名
+        ceb411PaymentHead.setPayerName(payBill.getTrueName());
+        //支付人电话
+         ceb411PaymentHead.setTelephone(payBill.getMobile());
+        //支付金额
+        ceb411PaymentHead.setAmountPaid(payBill.getRealAmount().toString());
+        //支付币制
+        ceb411PaymentHead.setCurrency(payBill.getCurrency());
+
+        //支付时间
+        ceb411PaymentHead.setPayTime(LocalDateTimeUtils.formatTime(payBill.getPayTime(), "yyyyMMddHHmmss"));
+
+        //备注, 与工行商定填写支付渠道
+        ceb411PaymentHead.setNote(cus.getAlipay().get("payChannel"));
+
+        //----------表头添加到报文体----------
+        ceb411Payment.setCEB411PaymentHead(ceb411PaymentHead);
+
+        //----------报文头添加到报文----------
+        ceb411Message.setCebReqMessageHead(cebReqMessageHead);
+        //----------报文体添加到报文----------
+        ceb411Message.setCEB411Payment(ceb411Payment);
+
+        LOGGER.info("--- 订单:【{}】, 支付单:【{}】,生成报文对象数据: {}", payBill.getOrderNo(), payBill.getTradeNo(), ceb411Message.toString());
+        return (T)ceb411Message;
+    }
+}

+ 8 - 0
src/main/java/com/emato/ccnet/config/Cus.java

@@ -15,6 +15,7 @@ public class Cus  implements Serializable {
     private Map<String, String> alipay = new HashMap<>(); //接收alipay里面的属性值
     private Map<String, String> order = new HashMap<>(); //接收order里面的属性值
     private Map<String, String> waybill = new HashMap<>(); //接收waybill里面的属性值
+    private Map<String, String> message = new HashMap<>();//接收message里面的属性值
 
     public Map<String, String> getAlipay() {
         return alipay;
@@ -40,4 +41,11 @@ public class Cus  implements Serializable {
         this.waybill = waybill;
     }
 
+    public Map<String, String> getMessage() {
+        return message;
+    }
+
+    public void setMessage(Map<String, String> message) {
+        this.message = message;
+    }
 }

+ 11 - 0
src/main/java/com/emato/ccnet/config/Merchant.java

@@ -9,6 +9,9 @@ import java.io.Serializable;
 @ConfigurationProperties(prefix="merchant") //接收application.yml中的merchant下面的属性
 public class Merchant implements Serializable {
     private static final long serialVersionUID = -488663428498976725L;
+
+    private String code;
+
     /**
      * 商户编号
      */
@@ -38,6 +41,14 @@ public class Merchant implements Serializable {
      */
     private String merchantCustomsName;
 
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
     public String getMerchSn() {
         return merchSn;
     }

+ 25 - 2
src/main/java/com/emato/ccnet/controller/KmallOrderController.java

@@ -3,6 +3,7 @@ package com.emato.ccnet.controller;
 import com.emato.ccnet.biz.req.order.csp.Ceb311OrderBiz;
 import com.emato.ccnet.biz.req.order.csp.Ceb311SendDateRequet;
 import com.emato.ccnet.biz.req.pay.alipay.Ceb411AlipayBiz;
+import com.emato.ccnet.biz.req.pay.icbc.Ceb411PayBillBiz;
 import com.emato.ccnet.biz.req.waybill.oms.Ceb511OmsWayBiz;
 import com.emato.ccnet.msg.ResponseMessage;
 import com.google.common.collect.ImmutableMap;
@@ -26,7 +27,10 @@ public class KmallOrderController {
     private static final Logger logger = LoggerFactory.getLogger(KmallOrderController.class);
 
     @Autowired
-    private Ceb411AlipayBiz ceb411PayBillBiz;
+    private Ceb411AlipayBiz ceb411AlipayBiz;
+
+    @Autowired
+    private Ceb411PayBillBiz ceb411PayBillBiz;
 
     @Autowired
     private Ceb311OrderBiz ceb311OrderBiz;
@@ -80,7 +84,26 @@ public class KmallOrderController {
 
         /*Map<String, Object> reqParam = ImmutableMap.of("number", number);*/
 
-        ResponseMessage result = ceb411PayBillBiz.biz();
+        ResponseMessage result = ceb411AlipayBiz.biz();
+
+        logger.info("---------- 支付单数据结束 ----------------------------------------");
+        return result;
+    }
+
+    @RequestMapping(value="/kmall/cusIcbcPayBill")
+    public ResponseMessage cusPayBill(@RequestBody Map<String, Object> param) {
+        logger.info("---------- 支付单数据开始 ----------------------------------------");
+        if (param.isEmpty()) {
+            return ResponseMessage.error("入参数为空");
+        }
+        if (!param.containsKey("sellerId") || StringUtils.isBlank(String.valueOf(param.get("sellerId")))) {
+            return ResponseMessage.error("商家为空");
+        }
+
+        String sellerId = String.valueOf(param.get("sellerId"));
+
+        Map<String, Object> reqParam = ImmutableMap.of("sellerId", sellerId);
+        ResponseMessage result = ceb411PayBillBiz.biz(reqParam);
 
         logger.info("---------- 支付单数据结束 ----------------------------------------");
         return result;

+ 51 - 0
src/main/java/com/emato/ccnet/controller/KmallSellerController.java

@@ -0,0 +1,51 @@
+package com.emato.ccnet.controller;
+
+import com.emato.ccnet.domain.kmall.Seller;
+import com.emato.ccnet.msg.ResponseMessage;
+import com.emato.ccnet.msg.ResponseMessageData;
+import com.emato.ccnet.service.kmall.KmallSellerService;
+import com.google.common.collect.ImmutableMap;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-04 17:55
+ */
+@RestController
+public class KmallSellerController {
+    private static final Logger logger = LoggerFactory.getLogger(KmallSellerController.class);
+
+    @Autowired
+    private KmallSellerService kmallSellerService;
+
+    /**
+     * 商户信息
+     * @return
+     */
+    @RequestMapping(value="/kmall/getSeller")
+    public ResponseMessage getSeller(@RequestBody(required = false) Map<String, Object> param) {
+        logger.info("---------- 获取商户数据开始 ----------------------------------------");
+
+        //取电子订单运单数据
+        Map<String, Object> map = ImmutableMap.of("isDel", "0");
+        List<Seller> list = kmallSellerService.getSeller(map);
+
+        ResponseMessageData respData = ResponseMessageData.builder(list).build();
+        ResponseMessage message = ResponseMessage.builder().setData(respData).build();
+
+        logger.info("---------- 获取商户数据结束 ----------------------------------------");
+        return message;
+    }
+
+
+
+}

+ 63 - 0
src/main/java/com/emato/ccnet/cus/message/req/AbstractCebReq.java

@@ -0,0 +1,63 @@
+package com.emato.ccnet.cus.message.req;
+
+import com.emato.ccnet.config.Cus;
+import com.emato.ccnet.cus.message.support.CebSupport;
+import com.emato.ccnet.util.LocalDateTimeUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+/**
+ * EPort请求报文生成抽象类
+ * 提供请求报文中公共属性和字段设置
+ *
+ * 可以由运维配置项,在properties文件,参见{@code eport.properties}
+ * 涉及程序相关配置项,参见{@link com.emato.ccnet.cus.message.support.CebSupport}
+ *
+ * @author Scott Chen
+ * @date 2016/11/24
+ */
+public abstract class AbstractCebReq {
+
+    @Autowired
+    private Cus cus;
+
+    /**
+     * 设置EPort请求报文属性
+     *
+     * @param <T>
+     * @return 返回报文根节点
+     */
+    public <T extends CebReqRoot> T setMessageAttribute(T root) {
+        root.setXmlns(CebSupport.xmlns);
+        root.setXmlnsXsi(CebSupport.xmlnsXsi);
+        root.setVersion(CebSupport.version);
+        return root;
+    }
+
+    /**
+     * 设置EPort请求报文头
+     * @return
+     */
+    public CebReqMessageHead setMessageHead(CebReqMessageHead cebReqMessageHead) {
+        //报文头
+        //messageHead.setMessageType("CEB511Message");
+        //messageHead.setMessageID("4575B0EE-B081-4922-9112-E54972DA479X");
+        //企业组织机构代码或统一社会信用代码
+        cebReqMessageHead.setOrgCode(cus.getAlipay().get("orgCode"));
+        //传输企业代码
+        cebReqMessageHead.setCopCode(cus.getAlipay().get("copCode"));
+        //传输企业名称
+        cebReqMessageHead.setCopName(cus.getAlipay().get("copName"));
+        //发送方
+        cebReqMessageHead.setSenderID(cus.getAlipay().get("senderID"));
+        //接收方
+        cebReqMessageHead.setReceiverID(cus.getAlipay().get("receiverID"));
+        //接收部门
+        //messageHead.setReceiverDepartment("CQ");
+        //发送时间,格式:yyyyMMddHHmmssSSS
+        cebReqMessageHead.setSendTime(LocalDateTimeUtils.formatNow("yyyyMMddHHmmssSSS"));
+        //版本号
+        cebReqMessageHead.setVersion(CebSupport.version);
+        return cebReqMessageHead;
+    }
+
+}

+ 188 - 0
src/main/java/com/emato/ccnet/cus/message/req/CebReqMessageHead.java

@@ -0,0 +1,188 @@
+package com.emato.ccnet.cus.message.req;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import java.io.Serializable;
+
+/**
+ * EPort请求报文头
+ * 所有请求消息头相同,其它请求消息根节点的子节点
+ * Java报文对象转XML
+ *
+ * @author Scott Chen
+ * @date 2017/11/05
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CebReqMessageHead implements Serializable {
+
+    private static final long serialVersionUID = -9018799772407388539L;
+
+    /**
+     * 报文唯一编号
+     * 企业系统生成36位报文唯一序号(要求为guid36位,英文字母大写)。
+     * 同guid
+     */
+    @XmlElement(name="MessageID")
+    private String messageID;
+
+    /**
+     * 报文类型
+     */
+    @XmlElement(name="MessageType")
+    private String messageType;
+
+    /**
+     * 企业组织机构代码或统一社会信用代码
+     */
+    @XmlElement(name="OrgCode")
+    private String orgCode;
+
+    /**
+     * 传输企业代码
+     * 报文传输的企业海关注册代码(需要与接入客户端的企业身份一致)
+     */
+    @XmlElement(name="CopCode")
+    private String copCode;
+
+    /**
+     * 传输企业名称
+     * 报文传输的企业海关注册名称
+     */
+    @XmlElement(name="CopName")
+    private String copName;
+
+    /**
+     * 发送方
+     * 企业客户端ID号
+     */
+    @XmlElement(name="SenderID")
+    private String senderID;
+
+    /**
+     * 接收方
+     * EPORT
+     */
+    @XmlElement(name="ReceiverID")
+    private String receiverID;
+
+    /**
+     * 接收部门
+     * 填写本报文发送的监管单位,可同时填写多个监管部门:
+     *     C-海关;Q-检验检疫;
+     *     例如:同时发送至海关、检验检疫可填写:CQ
+     *     本节点根据监管部门要求将来可扩展
+     */
+    @XmlElement(name="ReceiverDepartment")
+    private String receiverDepartment;
+
+    /**
+     * 发送时间
+     * 格式:yyyyMMddHHmmssSSS
+     */
+    @XmlElement(name="SendTime")
+    private String sendTime;
+
+    /**
+     * 版本号
+     */
+    @XmlElement(name="Version")
+    private String version;
+
+    @Override
+    public String toString() {
+        return "{" +
+                "messageID='" + messageID + '\'' +
+                ", messageType='" + messageType + '\'' +
+                ", orgCode='" + orgCode + '\'' +
+                ", copCode='" + copCode + '\'' +
+                ", copName='" + copName + '\'' +
+                ", senderID='" + senderID + '\'' +
+                ", receiverID='" + receiverID + '\'' +
+                ", receiverDepartment='" + receiverDepartment + '\'' +
+                ", sendTime='" + sendTime + '\'' +
+                ", version='" + version + '\'' +
+                '}';
+    }
+
+    public String getMessageID() {
+        return messageID;
+    }
+
+    public void setMessageID(String messageID) {
+        this.messageID = messageID;
+    }
+
+    public String getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(String messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getOrgCode() {
+        return orgCode;
+    }
+
+    public void setOrgCode(String orgCode) {
+        this.orgCode = orgCode;
+    }
+
+    public String getCopCode() {
+        return copCode;
+    }
+
+    public void setCopCode(String copCode) {
+        this.copCode = copCode;
+    }
+
+    public String getCopName() {
+        return copName;
+    }
+
+    public void setCopName(String copName) {
+        this.copName = copName;
+    }
+
+    public String getSenderID() {
+        return senderID;
+    }
+
+    public void setSenderID(String senderID) {
+        this.senderID = senderID;
+    }
+
+    public String getReceiverID() {
+        return receiverID;
+    }
+
+    public void setReceiverID(String receiverID) {
+        this.receiverID = receiverID;
+    }
+
+    public String getReceiverDepartment() {
+        return receiverDepartment;
+    }
+
+    public void setReceiverDepartment(String receiverDepartment) {
+        this.receiverDepartment = receiverDepartment;
+    }
+
+    public String getSendTime() {
+        return sendTime;
+    }
+
+    public void setSendTime(String sendTime) {
+        this.sendTime = sendTime;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+}

+ 104 - 0
src/main/java/com/emato/ccnet/cus/message/req/CebReqRoot.java

@@ -0,0 +1,104 @@
+package com.emato.ccnet.cus.message.req;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import java.io.Serializable;
+
+/**
+ * EPort请求报文适配器
+ * 所有EPort请求报文适配器父类
+ * 设置报文属性
+ *
+ * @author Scott Chen
+ * @date 2017/11/05
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CebReqRoot implements Serializable {
+
+    private static final long serialVersionUID = -1329830271583172202L;
+
+    /**
+     * EPorty消息类型
+     * 此处主要用于业务判断
+     * 需要手动设置,一般在转换器内设置
+     */
+     private String messageType;
+
+    /**
+     * 请求消息XML属性
+     */
+    @XmlAttribute
+    public String xmlns;
+
+    /**
+     * EPort请求XML属性
+     */
+    @XmlAttribute(name="xmlns:xsi")
+    private String xmlnsXsi;
+
+    /**
+     * EPort请求XML属性
+     */
+    @XmlAttribute
+    public String guid;
+
+    /**
+     * EPort请求XML属性
+     */
+    @XmlAttribute
+    public String version;
+
+    @Override
+    public String toString() {
+        return "CebRoot{" +
+                "messageType='" + messageType + '\'' +
+                ", xmlns='" + xmlns + '\'' +
+                ", xmlnsXsi='" + xmlnsXsi + '\'' +
+                ", guid='" + guid + '\'' +
+                ", version='" + version + '\'' +
+                '}';
+    }
+
+
+    public String getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(String messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getXmlns() {
+        return xmlns;
+    }
+
+    public void setXmlns(String xmlns) {
+        this.xmlns = xmlns;
+    }
+
+    public String getXmlnsXsi() {
+        return xmlnsXsi;
+    }
+
+    public void setXmlnsXsi(String xmlnsXsi) {
+        this.xmlnsXsi = xmlnsXsi;
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+}

+ 43 - 0
src/main/java/com/emato/ccnet/cus/message/req/ceb411/Ceb411Payment.java

@@ -0,0 +1,43 @@
+package com.emato.ccnet.cus.message.req.ceb411;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import java.io.Serializable;
+
+/**
+ * 海关支付单 报文体
+ * Java报文对象转XML
+ *
+ * 报文体(1:1)=表头(1:1)
+ *
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-06 23:47
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Ceb411Payment implements Serializable {
+
+    private static final long serialVersionUID = 6871721188732967001L;
+
+    /**
+     * 表头(1:1)
+     */
+    @XmlElement(name="PaymentHead")
+    private Ceb411PaymentHead cEB411PaymentHead;
+
+    @Override
+    public String toString() {
+        return "{" +
+                "PaymentHead=" + cEB411PaymentHead +
+                '}';
+    }
+
+    public Ceb411PaymentHead getCEB411PaymentHead() {
+        return cEB411PaymentHead;
+    }
+
+    public void setCEB411PaymentHead(Ceb411PaymentHead Ceb411PaymentHead) {
+        this.cEB411PaymentHead = Ceb411PaymentHead;
+    }
+}

+ 303 - 0
src/main/java/com/emato/ccnet/cus/message/req/ceb411/Ceb411PaymentHead.java

@@ -0,0 +1,303 @@
+package com.emato.ccnet.cus.message.req.ceb411;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import java.io.Serializable;
+
+/**
+ * 海关支付单 表头
+ * Java报文对象转XML
+ *
+ * 表头(1:1)
+ *
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-06 23:51
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class Ceb411PaymentHead implements Serializable {
+
+    private static final long serialVersionUID = 3304376487303900138L;
+
+    /**
+     * 报文唯一编号
+     * 企业系统生成36位报文唯一序号(要求为guid36位,英文字母大写)。
+     */
+    @XmlElement
+    private String guid;
+    /**
+     * 报送类型 C1
+     * 报送类型:1-新增,2-修改,默认为1
+     */
+    @XmlElement
+    private String appType;
+    /**
+     * 报送时间
+     * 企业报送时间。格式:YYYYMMDDhhmmss。
+     */
+    @XmlElement
+    private String appTime;
+    /**
+     * 业务状态
+     * 业务状态:1-暂存,2-申报,默认为2。
+     */
+    @XmlElement
+    private String appStatus;
+
+
+    /**
+     * 支付企业的海关注册登记编号
+     */
+    @XmlElement
+    private String payCode;
+
+    /**
+     * 支付企业在海关注册登记的名称
+     */
+    @XmlElement
+    private String payName;
+
+    /**
+     * 支付企业唯一的支付流水号
+     */
+    @XmlElement
+    private String payTransactionId;
+
+    /**
+     * 交易平台的订单编号,同一交易平台的订单编号应唯一
+     */
+    @XmlElement
+    private String orderNo;
+
+
+    /**
+     * 电商平台的海关注册登记编号;电商平台未在海关注册登记,由电商企业发送订单的,以中国电子口岸发布的电商平台标识编号为准
+     */
+    @XmlElement
+    private String ebpCode;
+
+    /**
+     * 电商平台的海关注册登记名称;电商平台未在海关注册登记,由电商企业发送订单的,以中国电子口岸发布的电商平台名称为准
+     */
+    @XmlElement
+    private String ebpName;
+
+    /**
+     * 1-身份证,2-其它。限定为身份证,填写“1”
+     */
+    @XmlElement
+    private String payerIdType;
+
+    /**
+     * 支付人的身份证件号码
+     */
+    @XmlElement
+    private String payerIdNumber;
+
+
+    /**
+     * 支付人的真实姓名
+     */
+    @XmlElement
+    private String payerName;
+
+    /**
+     * 支付人的电话号码
+     */
+    @XmlElement
+    private String telephone;
+
+    /**
+     * 支付金额
+     */
+    @XmlElement
+    private String amountPaid;
+
+    /**
+     * 限定为人民币,填写“142”
+     */
+    @XmlElement
+    private String currency;
+
+
+    /**
+     * 支付时间,格式:YYYYMMDDhhmmss
+     */
+    @XmlElement
+    private String payTime;
+
+    /**
+     * 备注
+     */
+    @XmlElement
+    private String note;
+
+    @Override
+    public String toString() {
+        return "{" +
+                "guid='" + guid + '\'' +
+                ", appType='" + appType + '\'' +
+                ", appTime='" + appTime + '\'' +
+                ", appStatus='" + appStatus + '\'' +
+                ", payCode='" + payCode + '\'' +
+                ", payName='" + payName + '\'' +
+                ", payTransactionId='" + payTransactionId + '\'' +
+                ", orderNo='" + orderNo + '\'' +
+                ", ebpCode='" + ebpCode + '\'' +
+                ", ebpName='" + ebpName + '\'' +
+                ", payerIdType='" + payerIdType + '\'' +
+                ", payerIdNumber='" + payerIdNumber + '\'' +
+                ", payerName='" + payerName + '\'' +
+                ", telephone='" + telephone + '\'' +
+                ", amountPaid='" + amountPaid + '\'' +
+                ", currency='" + currency + '\'' +
+                ", payTime='" + payTime + '\'' +
+                ", note='" + note + '\'' +
+                '}';
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public String getAppType() {
+        return appType;
+    }
+
+    public void setAppType(String appType) {
+        this.appType = appType;
+    }
+
+    public String getAppTime() {
+        return appTime;
+    }
+
+    public void setAppTime(String appTime) {
+        this.appTime = appTime;
+    }
+
+    public String getAppStatus() {
+        return appStatus;
+    }
+
+    public void setAppStatus(String appStatus) {
+        this.appStatus = appStatus;
+    }
+
+    public String getPayCode() {
+        return payCode;
+    }
+
+    public void setPayCode(String payCode) {
+        this.payCode = payCode;
+    }
+
+    public String getPayName() {
+        return payName;
+    }
+
+    public void setPayName(String payName) {
+        this.payName = payName;
+    }
+
+    public String getPayTransactionId() {
+        return payTransactionId;
+    }
+
+    public void setPayTransactionId(String payTransactionId) {
+        this.payTransactionId = payTransactionId;
+    }
+
+    public String getOrderNo() {
+        return orderNo;
+    }
+
+    public void setOrderNo(String orderNo) {
+        this.orderNo = orderNo;
+    }
+
+    public String getEbpCode() {
+        return ebpCode;
+    }
+
+    public void setEbpCode(String ebpCode) {
+        this.ebpCode = ebpCode;
+    }
+
+    public String getEbpName() {
+        return ebpName;
+    }
+
+    public void setEbpName(String ebpName) {
+        this.ebpName = ebpName;
+    }
+
+    public String getPayerIdType() {
+        return payerIdType;
+    }
+
+    public void setPayerIdType(String payerIdType) {
+        this.payerIdType = payerIdType;
+    }
+
+    public String getPayerIdNumber() {
+        return payerIdNumber;
+    }
+
+    public void setPayerIdNumber(String payerIdNumber) {
+        this.payerIdNumber = payerIdNumber;
+    }
+
+    public String getPayerName() {
+        return payerName;
+    }
+
+    public void setPayerName(String payerName) {
+        this.payerName = payerName;
+    }
+
+    public String getTelephone() {
+        return telephone;
+    }
+
+    public void setTelephone(String telephone) {
+        this.telephone = telephone;
+    }
+
+    public String getAmountPaid() {
+        return amountPaid;
+    }
+
+    public void setAmountPaid(String amountPaid) {
+        this.amountPaid = amountPaid;
+    }
+
+    public String getCurrency() {
+        return currency;
+    }
+
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+
+    public String getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(String payTime) {
+        this.payTime = payTime;
+    }
+
+    public String getNote() {
+        return note;
+    }
+
+    public void setNote(String note) {
+        this.note = note;
+    }
+}

+ 61 - 0
src/main/java/com/emato/ccnet/cus/message/req/ceb411/CebReq411Message.java

@@ -0,0 +1,61 @@
+package com.emato.ccnet.cus.message.req.ceb411;
+
+import com.emato.ccnet.cus.message.req.CebReqMessageHead;
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import java.io.Serializable;
+
+/**
+ * 海关支付单
+ * Java报文对象转XML
+ *
+ * 报文=报文头(1:1)+报文体(1:1)
+ * 报文体(1:1)=表头(1:1)
+ *
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-06 23:26
+ */
+@XmlRootElement(name="CEB411Message")
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CebReq411Message extends CebReqRoot implements Serializable {
+
+    private static final long serialVersionUID = 5967051675559343907L;
+
+    /**
+     * 报文头(1:1)
+     */
+    @XmlElement(name="MessageHead")
+    private CebReqMessageHead cebReqMessageHead;
+
+    @XmlElement(name="Payment")
+    private Ceb411Payment cEB411Payment;
+
+    @Override
+    public String toString() {
+        return "CEB411Message{" +
+                "MessageHead=" + cebReqMessageHead +
+                ", Payment=" + cEB411Payment +
+                "} " + super.toString();
+    }
+
+    public CebReqMessageHead getCebReqMessageHead() {
+        return cebReqMessageHead;
+    }
+
+    public void setCebReqMessageHead(CebReqMessageHead cebReqMessageHead) {
+        this.cebReqMessageHead = cebReqMessageHead;
+    }
+
+    public Ceb411Payment getCEB411Payment() {
+        return cEB411Payment;
+    }
+
+    public void setCEB411Payment(Ceb411Payment Ceb411Payment) {
+        this.cEB411Payment = Ceb411Payment;
+    }
+}

+ 131 - 0
src/main/java/com/emato/ccnet/cus/message/resp/CebRespRoot.java

@@ -0,0 +1,131 @@
+package com.emato.ccnet.cus.message.resp;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import java.io.Serializable;
+
+/**
+ * 全部回执报文适配器抽象类
+ * 所有EPort回执报文适配器父类
+ *
+ * @author Scott Chen
+ * @date 2016/11/19
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+public class CebRespRoot implements Serializable {
+
+    private static final long serialVersionUID = -4957481003625861410L;
+    /**
+     * 文件名
+     */
+    private String fileName;
+
+    /**
+     * 机构类型
+     * CHCUS:海关, SZCIQ:国检, EPORT:电子口岸
+     */
+    private String orgType;
+
+    /**
+     * EPort回执消息类型
+     * 此处主要用于业务判断
+     * 部分回执无此字段,需要手动设置,一般在转换器内设置
+     */
+     private String messageType;
+
+    /**
+     * 回执消息XML属性
+     */
+    @XmlAttribute
+    public String xmlns;
+
+    /**
+     * EPort回执XML属性
+     */
+    @XmlAttribute(name="xmlns:xsi")
+    private String xmlnsXsi;
+
+    /**
+     * EPort回执XML属性
+     */
+    @XmlAttribute
+    public String guid;
+
+    /**
+     * EPort回执XML属性
+     */
+    @XmlAttribute
+    public String version;
+
+
+    @Override
+    public String toString() {
+        return "EportResponseXmlJsonAbstract{" +
+                "fileName='" + fileName + '\'' +
+                "orgType='" + orgType + '\'' +
+                "messageType='" + messageType + '\'' +
+                ", xmlns='" + xmlns + '\'' +
+                ", xmlnsXsi='" + xmlnsXsi + '\'' +
+                ", guid='" + guid + '\'' +
+                ", version='" + version + '\'' +
+                '}';
+    }
+
+    public String getFileName() {
+        return fileName;
+    }
+
+    public void setFileName(String fileName) {
+        this.fileName = fileName;
+    }
+
+    public String getOrgType() {
+        return orgType;
+    }
+
+    public void setOrgType(String orgType) {
+        this.orgType = orgType;
+    }
+
+    public String getMessageType() {
+        return messageType;
+    }
+
+    public void setMessageType(String messageType) {
+        this.messageType = messageType;
+    }
+
+    public String getXmlns() {
+        return xmlns;
+    }
+
+    public void setXmlns(String xmlns) {
+        this.xmlns = xmlns;
+    }
+
+    public String getXmlnsXsi() {
+        return xmlnsXsi;
+    }
+
+    public void setXmlnsXsi(String xmlnsXsi) {
+        this.xmlnsXsi = xmlnsXsi;
+    }
+
+    public String getGuid() {
+        return guid;
+    }
+
+    public void setGuid(String guid) {
+        this.guid = guid;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+}

+ 104 - 0
src/main/java/com/emato/ccnet/cus/message/support/CebSupport.java

@@ -0,0 +1,104 @@
+package com.emato.ccnet.cus.message.support;
+
+import com.emato.ccnet.util.DataUtils;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 13:51
+ */
+public class CebSupport {
+    /**
+     * 请求报文文件名模板
+     */
+    public static final String CEB_NAME_TEMPLATE = "CEB_$messageType_$senderId_$receiverID_$time$random.xml";
+
+    /**
+     * 请求报文属性xmlns
+     */
+    public static final String xmlns = "http://www.chinaport.gov.cn/ceb";
+    /**
+     * 请求报文属性xmlns:xsi
+     */
+    public static final String xmlnsXsi = "http://www.w3.org/2001/XMLSchema-instance";
+    /**
+     * 请求报文属性version
+     */
+    public static final String version = "1.0";
+
+    /**
+     * 消息头接收方ID
+     */
+    public static final String RECEIVER_ID = "EPORT";
+
+    /**
+     * 表头 业务状态 新增
+     */
+    public static final String APP_TYPE_ADD = "1";
+
+    /**
+     * 表头 申报状态 申报
+     */
+    public static final String APP_status_decl = "2";
+
+    /**
+     * 证件类型 1:身份证
+     */
+    public static final String CEB_ID_TYPE = "1";
+
+    /**
+     * EPort请求-物流运单报文接收机构
+     * C-海关;Q-检验检疫
+     */
+    public static final String ceb_cq = "CQ";
+
+    public static final String ceb_c = "C";
+
+    public static final String ceb_q = "CQ";
+
+    /**
+     * 电子订单-请求
+     */
+    public static final String CEB311 = "CEB311";
+
+    /**
+     * 支付单-请求
+     */
+    public static final String CEB411 = "CEB411";
+
+    /**
+     * 物流运单-请求
+     */
+    public static final String CEB511 = "CEB511";
+    /**
+     * #物流运单状态-请求
+     */
+    public static final String CEB513 = "CEB513";
+    /**
+     * 进口清单-请求
+     */
+    public static final String CEB621 = "CEB621";
+    /**
+     * 入库明细单-请求
+     */
+    public static final String CEB711 = "CEB711";
+
+    /**
+     * 构建EPort请求报文文件名
+     *
+     * @param messageType
+     * @return
+     */
+    public static String buildFileName(String messageType, String senderId, String receiverID) {
+        String time = DateTimeFormatter.ofPattern("yyyyMMddHHmmssSSS").format(LocalDateTime.now());
+        int random = DataUtils.createRandomNumber(1000, 9999);
+        String fileNameTemplate = CEB_NAME_TEMPLATE;
+        return fileNameTemplate.replace("$messageType", messageType).replace("$senderId", senderId)
+                .replace("$receiverID",receiverID)
+                .replace("$time", time).replace("$random", Integer.valueOf(random).toString());
+    }
+
+}

+ 41 - 0
src/main/java/com/emato/ccnet/cus/message/transfer/MessageTransfer.java

@@ -0,0 +1,41 @@
+package com.emato.ccnet.cus.message.transfer;
+
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+import com.emato.ccnet.cus.message.resp.CebRespRoot;
+
+/**
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 20:54
+ */
+public interface MessageTransfer {
+
+    /**
+     * 请求报文转换
+     * Java对象转XML
+     *
+     * @param messageType
+     * @param t
+     * @param format
+     * @param <T>
+     * @return
+     * @throws Exception
+     */
+    <T extends CebReqRoot> String toXml(String messageType, T t, Boolean format) throws Exception;
+
+    /**
+     * 回执报文转换
+     * XML转Java对象
+     *
+     * @param fileName
+     * @param orgType
+     * @param messageType
+     * @param type
+     * @param eportResultStr
+     * @return
+     * @throws Exception
+     */
+    CebRespRoot fromXml(String fileName, String orgType, String messageType, Class<? extends CebRespRoot> type, String eportResultStr) throws Exception;
+
+
+}

+ 60 - 0
src/main/java/com/emato/ccnet/cus/message/transfer/MessageTransferImpl.java

@@ -0,0 +1,60 @@
+package com.emato.ccnet.cus.message.transfer;
+
+
+import com.emato.ccnet.cus.message.req.CebReqRoot;
+import com.emato.ccnet.cus.message.resp.CebRespRoot;
+import com.emato.ccnet.util.XmlUtil;
+import org.springframework.stereotype.Component;
+
+/**
+ * 海关报文消息转换器
+ * XML与Java对象相互转换
+ *
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 20:54
+ */
+@Component
+class MessageTransferImpl implements MessageTransfer {
+
+    /**
+     * 请求报文转换
+     * Java对象转XML
+     *
+     * @param messageType
+     * @param t
+     * @param format
+     * @param <T>
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public <T extends CebReqRoot> String toXml(String messageType, T t, Boolean format) throws Exception {
+        String xmlStr = XmlUtil.toXML(t, format);
+        return xmlStr;
+    }
+
+
+    /**
+     * 回执报文转换
+     * XML转Java对象
+     *
+     * @param fileName
+     * @param orgType
+     * @param messageType
+     * @param type
+     * @param eportResultStr
+     * @return
+     * @throws Exception
+     */
+    @Override
+    public CebRespRoot fromXml(String fileName, String orgType, String messageType, Class<? extends CebRespRoot> type, String eportResultStr) throws Exception {
+        CebRespRoot responseXmlJson = XmlUtil.fromXML(eportResultStr, type, true);
+        responseXmlJson.setFileName(fileName);
+        responseXmlJson.setOrgType(orgType);
+        responseXmlJson.setMessageType(messageType);
+        return responseXmlJson;
+    }
+
+
+}

+ 51 - 1
src/main/java/com/emato/ccnet/domain/kmall/PayBill.java

@@ -44,10 +44,20 @@ public class PayBill implements Serializable {
     private String trueName;
 
     /**
-     *订购人身份证号
+     *订购人证件类型
+     */
+    private String idType;
+
+    /**
+     *订购人证件号
      */
     private String idCode;
 
+    private String mobile;
+    private String currency;
+    private LocalDateTime payTime;
+    private String payType;
+
     public static long getSerialVersionUID() {
         return serialVersionUID;
     }
@@ -115,4 +125,44 @@ public class PayBill implements Serializable {
     public void setIdCode(String idCode) {
         this.idCode = idCode;
     }
+
+    public String getIdType() {
+        return idType;
+    }
+
+    public void setIdType(String idType) {
+        this.idType = idType;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getCurrency() {
+        return currency;
+    }
+
+    public void setCurrency(String currency) {
+        this.currency = currency;
+    }
+
+    public LocalDateTime getPayTime() {
+        return payTime;
+    }
+
+    public void setPayTime(LocalDateTime payTime) {
+        this.payTime = payTime;
+    }
+
+    public String getPayType() {
+        return payType;
+    }
+
+    public void setPayType(String payType) {
+        this.payType = payType;
+    }
 }

+ 68 - 0
src/main/java/com/emato/ccnet/domain/kmall/Seller.java

@@ -0,0 +1,68 @@
+package com.emato.ccnet.domain.kmall;
+
+import java.io.Serializable;
+
+/**
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-08 18:22
+ */
+public class Seller implements Serializable {
+
+    private static final long serialVersionUID = 6426434786568867647L;
+
+    private String id;
+    private String sellerName;
+    private String trueName;
+    private String mobile;
+    private String isLock;
+    private String isDel;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getSellerName() {
+        return sellerName;
+    }
+
+    public void setSellerName(String sellerName) {
+        this.sellerName = sellerName;
+    }
+
+    public String getTrueName() {
+        return trueName;
+    }
+
+    public void setTrueName(String trueName) {
+        this.trueName = trueName;
+    }
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getIsLock() {
+        return isLock;
+    }
+
+    public void setIsLock(String isLock) {
+        this.isLock = isLock;
+    }
+
+    public String getIsDel() {
+        return isDel;
+    }
+
+    public void setIsDel(String isDel) {
+        this.isDel = isDel;
+    }
+}

+ 2 - 0
src/main/java/com/emato/ccnet/mapper/kmall/KmallOrderMapper.java

@@ -33,6 +33,8 @@ public interface KmallOrderMapper {
      */
     List<PayBill> getPayBills(Map<String, Object> param);
 
+    List<PayBill> getIcbcPayBills(Map<String, Object> param);
+
     /**
      * 海关订单批量更新
      * @param list

+ 27 - 0
src/main/java/com/emato/ccnet/mapper/kmall/KmallSellerMapper.java

@@ -0,0 +1,27 @@
+package com.emato.ccnet.mapper.kmall;
+
+import com.emato.ccnet.domain.kmall.Seller;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商户信息
+ *
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-04 16:55
+ */
+@Repository
+public interface KmallSellerMapper {
+
+    /**
+     * 商户信息
+     * @param param
+     * @return
+     */
+    List<Seller> getSeller(Map<String, Object> param);
+
+
+}

+ 2 - 0
src/main/java/com/emato/ccnet/service/kmall/KmallOrderService.java

@@ -29,6 +29,8 @@ public interface KmallOrderService {
      */
     List<PayBill> getPayBills(Map<String, Object> param);
 
+    List<PayBill> getIcbcPayBills(Map<String, Object> param);
+
     /**
      * 海关订单批量更新
      * @param list

+ 22 - 0
src/main/java/com/emato/ccnet/service/kmall/KmallSellerService.java

@@ -0,0 +1,22 @@
+package com.emato.ccnet.service.kmall;
+
+import com.emato.ccnet.domain.kmall.Seller;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商户信息
+ *
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-04 17:42
+ */
+public interface KmallSellerService {
+    /**
+     * 商户信息
+     * @param param
+     * @return
+     */
+    List<Seller> getSeller(Map<String, Object> param);
+}

+ 5 - 0
src/main/java/com/emato/ccnet/service/kmall/impl/KmallOrderServiceImpl.java

@@ -43,6 +43,11 @@ public class KmallOrderServiceImpl implements KmallOrderService {
         return kmallOrderMapper.getPayBills(param);
     }
 
+    @Override
+    public List<PayBill> getIcbcPayBills(Map<String, Object> param) {
+        return kmallOrderMapper.getIcbcPayBills(param);
+    }
+
     /**
      * 海关订单批量更新
      * @param list

+ 34 - 0
src/main/java/com/emato/ccnet/service/kmall/impl/KmallSellerServiceImpl.java

@@ -0,0 +1,34 @@
+package com.emato.ccnet.service.kmall.impl;
+
+import com.emato.ccnet.domain.kmall.Seller;
+import com.emato.ccnet.mapper.kmall.KmallSellerMapper;
+import com.emato.ccnet.service.kmall.KmallSellerService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 商户信息
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-04 17:54
+ */
+@Service
+public class KmallSellerServiceImpl implements KmallSellerService {
+
+    @Autowired
+    private KmallSellerMapper kmallSellerMapper;
+
+    /**
+     * 商户信息
+     * @param param
+     * @return
+     */
+    @Override
+    public List<Seller> getSeller(Map<String, Object> param) {
+        return kmallSellerMapper.getSeller(param);
+    }
+
+}

+ 23 - 0
src/main/java/com/emato/ccnet/util/DataUtils.java

@@ -0,0 +1,23 @@
+package com.emato.ccnet.util;
+
+import java.util.Random;
+
+/**
+ * @author Scott Chen
+ * @version 1.0
+ * 2017-11-07 16:18
+ */
+public class DataUtils {
+    /**
+     * 构建随机数
+     * @param min
+     * @param max
+     * @return
+     */
+    public static synchronized int createRandomNumber(int min, int max) {
+        Random random = new Random();
+        return random.nextInt(max)%(max-min+1) + min;
+    }
+
+
+}

+ 18 - 0
src/main/resources/application-dev.yml

@@ -96,6 +96,12 @@ redis:
 
 # 海关业务信息
 cus:
+  message:
+    # 是否格式化XML报文,主要用于调试程序,生产环境不能格式化(必须为false)
+    format: false
+    # 报文存放目录
+    saveDir: E://
+
   # 支付信息
   alipay:
     code: icbc
@@ -113,6 +119,18 @@ cus:
     customs-place: SHENZHEN_ZS
     # 报关请求地址
     getWay: https://mapi.alipay.com/gateway.do
+    # 企业组织机构代码或统一社会信用代码
+    orgCode: 689413365
+    # 支付企业海关备案代码
+    copCode: 440316T016
+    # 支付企业海关备案名称
+    copName: 中国工商银行股份有限公司前海分行
+    # 发送方ID
+    senderID: DXPENT0000012148
+    # 接送方ID
+    receiverID: EPORT
+    # 支付渠道:支付宝
+    payChannel: ALIP
 
 
   # 海关电子订单配置参数

+ 18 - 0
src/main/resources/application.yml

@@ -133,6 +133,11 @@ redis:
 
 # 海关业务信息
 cus:
+  message:
+    # 是否格式化XML报文,主要用于调试程序,生产环境不能格式化(必须为false)
+    format: false
+    # 报文存放目录
+    saveDir: /home/kefu_admin/CEB411/
   # 支付信息
   alipay:
     code: icbc
@@ -150,6 +155,18 @@ cus:
     customs-place: SHENZHEN_ZS
     # 报关请求地址
     getWay: https://mapi.alipay.com/gateway.do
+    # 企业组织机构代码或统一社会信用代码
+    orgCode: 689413365
+    # 支付企业海关备案代码
+    copCode: 440316T016
+    # 支付企业海关备案名称
+    copName: 中国工商银行股份有限公司前海分行
+    # 发送方ID
+    senderID: DXPENT0000012148
+    # 接送方ID
+    receiverID: EPORT
+    # 支付渠道:支付宝
+    payChannel: ALIP
 
 
   # 海关电子订单配置参数
@@ -169,6 +186,7 @@ cus:
 
 # 商户信息
 merchant:
+  code: zwkj
   #商户编号
   merch-sn: mhbs990053989883052032
   #商户名称

+ 21 - 0
src/main/resources/mybatis/mapper/kmall/kmall_order.xml

@@ -47,7 +47,12 @@
         <result property="realAmount" column="real_amount"/>
         <result property="trueName" column="true_name"/>
         <result property="idCode" column="id_code"/>
+        <result property="idType" column="id_type"/>
+        <result property="mobile" column="mobile"/>
+        <result property="currency" column="currency"/>
 
+        <result property="payTime" column="pay_time"/>
+        <result property="payType" column="pay_type"/>
     </resultMap>
 
     <resultMap id="orderBill" type="com.emato.ccnet.domain.kmall.OrderBill">
@@ -138,6 +143,22 @@
         ORDER BY tio.id limit #{number}
     </select>
 
+    <select id="getIcbcPayBills" parameterType="hashMap" resultMap="payBill">
+        SELECT t.order_no,
+        t1.true_name, t1.id_type, t1.id_code, t1.mobile,
+        t.trade_no, t.real_amount, '142' AS currency, t.pay_time, t.pay_type
+        FROM iwebshop_order t
+        LEFT OUTER JOIN iwebshop_member t1 ON t.user_id=t1.user_id
+        LEFT OUTER JOIN iwebshop_order_cus t2 ON t.order_no=t2.order_no
+        <where>
+            t.pay_status='1' AND t2.cus_pay_bill_flag='0'
+            <if test="sellerId != null and sellerId != '' ">
+                AND t.seller_id=#{sellerId}
+            </if>
+        </where>
+        ORDER BY t.id
+    </select>
+
     <!--商品详情-->
     <select id="getOrderGoods" parameterType="java.lang.String" resultMap="orderGoods">
         SELECT t.order_no, t2.goods_no, t2.cost_price,t1.goods_nums,

+ 44 - 0
src/main/resources/mybatis/mapper/kmall/kmall_seller.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+
+<mapper namespace="com.emato.ccnet.mapper.kmall.KmallSellerMapper">
+
+
+    <resultMap id="seller" type="com.emato.ccnet.domain.kmall.Seller">
+        <result property="id" column="id"/>
+        <result property="sellerName" column="seller_name"/>
+        <result property="trueName" column="true_name"/>
+        <result property="mobile" column="mobile"/>
+        <result property="isLock" column="is_lock"/>
+        <result property="isDel" column="is_del"/>
+    </resultMap>
+
+    <select id="getSeller" parameterType="hashMap" resultMap="seller">
+        SELECT t.id,
+          t.seller_name, t.true_name, t.mobile
+        FROM iwebshop_seller t
+        <where>
+            <if test="id !=null and id !=''">
+                t.id=#{id}
+            </if>
+            <if test="sellerName !=null and sellerName !=''">
+                AND t.seller_name=#{sellerName}
+            </if>
+            <if test="trueName !=null and trueName !=''">
+                AND t.true_name=#{trueName}
+            </if>
+            <if test="mobile !=null and mobile !=''">
+                AND t.mobile=#{mobile}
+            </if>
+            <if test="isLock !=null and isLock !=''">
+                AND t.is_lock=#{isLock}
+            </if>
+            <if test="isDel !=null and isDel !=''">
+                AND t.is_del=#{isDel}
+            </if>
+        </where>
+        ORDER BY t.id
+    </select>
+
+
+</mapper>

+ 12 - 3
src/main/resources/static/html/cus-doc.html

@@ -17,9 +17,18 @@
                 <span>商家选择</span>
                 <select id="sellerId">
                 </select>
-                &nbsp;&nbsp;&nbsp;<button type="button"  onclick="Cus.orderWaybill()">导出海关电子订单运单excel</button>&nbsp;
-                <button type="button"  onclick="Cus.payBill()">生成海关支付单报文</button>
-
+                &nbsp;&nbsp;&nbsp;<button type="button"  onclick="Cus.orderWaybill()">导出海关电子订单运单excel</button>
+            </div>
+            <br/>
+            <div>
+                <span>企业选择</span>
+                <select id="payId" onchange="Cus.changePay()">
+                    <option selected="selected" value="-">请选择</option>
+                    <option value="alipay">阿里巴巴</option>
+                    <option value="icbc">中国工商银行</option>
+                </select>
+                <button type="button" id="create" onclick="Cus.icbcPayBill()" disabled="disabled">生成海关支付单报文</button>
+                <button type="button" id="push" onclick="Cus.payBill()" disabled="disabled">推单</button>
             </div>
             <br/>
             <div>

+ 64 - 0
src/main/resources/static/js/biz/biz.js

@@ -6,6 +6,22 @@
 
 (function (window, $, undefined) {
 
+    var _changePay = function () {
+        var $payId = $("#payId"), $push = $("#push"), $create = $("#create");
+        var val = $payId.val();
+
+        if (val == 'alipay') {
+            $push.removeAttr("disabled");
+            $create.attr("disabled", "disabled");
+        } else if (val == 'icbc') {
+            $push.attr("disabled", "disabled");
+            $create.removeAttr("disabled");
+        } else {
+            $push.attr("disabled", "disabled");
+            $create.attr("disabled", "disabled");
+        }
+    };
+
     //海关电子订单,运单
     var _orderWaybill = function () {
         var sellerId, param = {}, txt='';
@@ -91,6 +107,48 @@
         Req.iAjax(param, _cb, null, null);
     };
 
+    var _icbcPayBill = function () {
+        var sellerId, param = {}, txt='';
+        $sellId = $("#sellerId"),
+            $suc = $("#suc_pay"),
+            $failed = $("#failed_pay");
+
+
+        if($sellId.val()=='-') {
+            alert('请选择商家');
+            return false;
+        }
+
+        sellerId = $sellId.val();
+        var json = {};
+        json.sellerId = sellerId;
+
+        param.data = JSON.stringify(json);
+        param.url = svr_url + '/kmall/cusIcbcPayBill';
+        param.returnAll = false;
+        var _cb = function(data) {
+            if (!data || $.isEmptyObject(data)) {
+                alert("服务端没有请求消息返回");
+                return false;
+            }
+            if(data.rows && data.rows.length>0) {
+                for(var i=0;i<data.rows.length;i++) {
+                    if(data.rows[i]['suc']) {
+                        var rec = data.rows[i]['suc'];
+                        $suc.text("成功订单:" + rec);
+                    }else if(data.rows[i]['failed']) {
+                        var rec = data.rows[i]['failed'];
+                        $failed.text("失败订单:" + rec);
+                    }else {
+                        $suc.text("没有成功和失败记录");
+                    }
+                }
+            }
+
+        };
+        Req.iAjax(param, _cb, null, null);
+    };
+
     var expose = function () {
         return {
             orderWaybill: function() {
@@ -98,6 +156,12 @@
             },
             payBill: function() {
                 return _payBill();
+            },
+            icbcPayBill: function() {
+                return _icbcPayBill();
+            },
+            changePay: function() {
+                return _changePay();
             }
         }
     }();

+ 1 - 1
src/main/resources/static/js/biz/core.js

@@ -4,7 +4,7 @@
  * 2017-09-23 08:55
  */
 
-var svr_url = 'http://127.0.0.1:8080/ccnet';
+var svr_url = 'http://127.0.0.1:8090/ccnet';
 
 (function (window, $, undefined) {
     //--------------------------------- ajax 定义开始 ---------------------------------//