瀏覽代碼

整理快递鸟相关代码

zyy 1 月之前
父節點
當前提交
03326f1c88

+ 0 - 113
fs-admin/src/main/java/com/fs/kdniao/config/KdniaoConfig.java

@@ -1,113 +0,0 @@
-package com.fs.kdniao.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * 快递鸟配置类
- */
-@Data
-@Component
-@ConfigurationProperties(prefix = "kdniao")
-public class KdniaoConfig {
-
-    /**
-     * 快递鸟用户ID
-     */
-    private String eBusinessID;
-
-    /**
-     * 快递鸟API Key
-     */
-    private String apiKey;
-
-    /**
-     * 电子面单接口地址
-     */
-    private String reqURL;
-
-    /**
-     * 默认电子面单账号配置
-     */
-    private Account account;
-
-    /**
-     * 默认发件人配置
-     */
-    private Sender sender;
-
-    /**
-     * 电子面单账号配置
-     */
-    @Data
-    public static class Account {
-
-        /**
-         * 电子面单账号
-         */
-        private String customerName;
-
-        /**
-         * 电子面单密码
-         */
-        private String customerPwd;
-
-        /**
-         * 发件网点编码
-         */
-        private String sendSite;
-
-        /**
-         * 月结号
-         */
-        private String monthCode;
-    }
-
-    /**
-     * 默认发件人配置
-     */
-    @Data
-    public static class Sender {
-
-        /**
-         * 发件公司
-         */
-        private String company;
-
-        /**
-         * 发件人姓名
-         */
-        private String name;
-
-        /**
-         * 发件人手机号
-         */
-        private String mobile;
-
-        /**
-         * 发件省
-         */
-        private String provinceName;
-
-        /**
-         * 发件市
-         */
-        private String cityName;
-
-        /**
-         * 发件区/县
-         */
-        private String expAreaName;
-
-        /**
-         * 发件详细地址
-         */
-        private String address;
-
-        /**
-         * 发件邮编
-         */
-        private String postCode;
-    }
-}

+ 0 - 46
fs-admin/src/main/java/com/fs/kdniao/controller/KdniaoEOrderController.java

@@ -1,46 +0,0 @@
-package com.fs.kdniao.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.enums.BusinessType;
-import com.fs.kdniao.domain.KdniaoEOrderResponse;
-import com.fs.kdniao.domain.KdniaoSimpleOrderRequest;
-import com.fs.kdniao.service.IKdniaoEOrderService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * 快递鸟电子面单控制器
- */
-@RestController
-@RequestMapping("/kdniao/eorder")
-public class KdniaoEOrderController extends BaseController {
-
-    @Autowired
-    private IKdniaoEOrderService kdniaoEOrderService;
-
-    /**
-     * 简化参数下单接口
-     * 前端只需要传常用业务参数,后端自动组装 RequestData
-     */
-    @Log(title = "快递鸟电子面单", businessType = BusinessType.INSERT)
-    @PostMapping("/submit")
-    public AjaxResult submit(@RequestBody KdniaoSimpleOrderRequest request) {
-        try {
-            KdniaoEOrderResponse response = kdniaoEOrderService.submitSimpleOrder(request);
-
-            if (Boolean.TRUE.equals(response.getSuccess()) && "100".equals(response.getResultCode())) {
-                return AjaxResult.success("下单成功", response);
-            }
-
-            if ("106".equals(response.getResultCode())) {
-                return AjaxResult.error("订单号重复,快递鸟返回:该订单号已下单成功");
-            }
-
-            return AjaxResult.error("下单失败:" + response.getReason(), response);
-        } catch (Exception e) {
-            return AjaxResult.error("电子面单下单异常:" + e.getMessage());
-        }
-    }
-}

+ 0 - 25
fs-admin/src/main/java/com/fs/kdniao/domain/KdniaoAddService.java

@@ -1,25 +0,0 @@
-package com.fs.kdniao.domain;
-
-import lombok.Data;
-
-/**
- * 增值服务(保价、代收货款等)
- */
-@Data
-public class KdniaoAddService {
-
-    /**
-     * 服务名称(如 COD、INSURE)
-     */
-    private String Name;
-
-    /**
-     * 服务值(金额/参数)
-     */
-    private String Value;
-
-    /**
-     * 客户标识
-     */
-    private String CustomerID;
-}

+ 0 - 47
fs-admin/src/main/java/com/fs/kdniao/domain/KdniaoCommodity.java

@@ -1,47 +0,0 @@
-package com.fs.kdniao.domain;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * 商品信息
- */
-@Data
-public class KdniaoCommodity {
-
-    /**
-     * 商品名称
-     */
-    private String GoodsName;
-
-    /**
-     * 商品编码
-     */
-    private String GoodsCode;
-
-    /**
-     * 商品数量
-     */
-    private Integer Goodsquantity;
-
-    /**
-     * 商品价格
-     */
-    private BigDecimal GoodsPrice;
-
-    /**
-     * 商品重量
-     */
-    private BigDecimal GoodsWeight;
-
-    /**
-     * 商品描述
-     */
-    private String GoodsDesc;
-
-    /**
-     * 商品体积
-     */
-    private BigDecimal GoodsVol;
-}

+ 0 - 181
fs-admin/src/main/java/com/fs/kdniao/domain/KdniaoEOrderRequest.java

@@ -1,181 +0,0 @@
-package com.fs.kdniao.domain;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-import java.util.List;
-
-/**
- * 快递鸟电子面单下单请求对象(RequestData)
- */
-@Data
-public class KdniaoEOrderRequest {
-
-    /**
-     * 订单编号(必须唯一)
-     * 不能重复,否则返回106(幂等控制字段)
-     */
-    private String OrderCode;
-
-    /**
-     * 快递公司编码(如 SF、YTO、ZTO、JDKY 等)
-     */
-    private String ShipperCode;
-
-    /**
-     * 电子面单账号(部分快递必填,如顺丰、圆通等)
-     */
-    private String CustomerName;
-
-    /**
-     * 电子面单密码
-     */
-    private String CustomerPwd;
-
-    /**
-     * 发件网点编码
-     */
-    private String SendSite;
-
-    /**
-     * 发件业务员
-     */
-    private String SendStaff;
-
-    /**
-     * 月结账号
-     */
-    private String MonthCode;
-
-    /**
-     * 运费支付方式
-     * 1:现付
-     * 2:到付
-     * 3:月结
-     * 4:第三方付(部分公司支持)
-     */
-    private Integer PayType;
-
-    /**
-     * 快递业务类型(不同快递公司不同)
-     */
-    private String ExpType;
-
-    /**
-     * 发件人信息(必填)
-     */
-    private KdniaoPerson Sender;
-
-    /**
-     * 收件人信息(必填)
-     */
-    private KdniaoPerson Receiver;
-
-    /**
-     * 包裹数量(>=1)
-     */
-    private Integer Quantity;
-
-    /**
-     * 总重量(kg)
-     * 京东/快运类必填
-     */
-    private BigDecimal Weight;
-
-    /**
-     * 总体积(m³)
-     * 京东/快运类必填
-     */
-    private BigDecimal Volume;
-
-    /**
-     * 运费(部分到付场景必填)
-     */
-    private BigDecimal Cost;
-
-    /**
-     * 其他费用
-     */
-    private BigDecimal OtherCost;
-
-    /**
-     * 增值服务(保价、代收货款等)
-     */
-    private List<KdniaoAddService> AddService;
-
-    /**
-     * 备注(会打印在面单上)
-     */
-    private String Remark;
-
-    /**
-     * 商品信息(至少一个 GoodsName)
-     */
-    private List<KdniaoCommodity> Commodity;
-
-    /**
-     * 是否返回电子面单模板
-     * 0:否
-     * 1:是
-     */
-    private String IsReturnPrintTemplate;
-
-    /**
-     * 面单模板尺寸(如 130)
-     */
-    private String TemplateSize;
-
-    /**
-     * 自定义打印内容
-     */
-    private String CustomArea;
-
-    /**
-     * 是否订阅轨迹推送
-     * 1:订阅(默认)
-     * 0:不订阅(避免消耗余额)
-     */
-    private String IsSubscribe;
-
-    /**
-     * 自定义回传字段
-     */
-    private String Callback;
-
-    /**
-     * 是否通知快递员上门揽件
-     * 0:通知
-     * 1:不通知
-     */
-    private Integer IsNotice;
-
-    /**
-     * 上门揽件开始时间(格式:yyyy-MM-dd HH:mm:ss)
-     */
-    private String StartDate;
-
-    /**
-     * 上门揽件结束时间
-     */
-    private String EndDate;
-
-    /**
-     * 是否要求签回单
-     * 0:否
-     * 1:是
-     */
-    private Integer IsReturnSignBill;
-
-    /**
-     * 是否发送短信通知
-     * 0:否
-     * 1:是
-     */
-    private Integer IsSendMessage;
-
-    /**
-     * 币种(顺丰港澳台必填)
-     * CNY / HKD / NTD
-     */
-    private String CurrencyCode;
-}

+ 0 - 62
fs-admin/src/main/java/com/fs/kdniao/domain/KdniaoEOrderResponse.java

@@ -1,62 +0,0 @@
-package com.fs.kdniao.domain;
-
-import lombok.Data;
-
-/**
- * 快递鸟电子面单返回对象
- */
-@Data
-public class KdniaoEOrderResponse {
-
-    /**
-     * 用户ID
-     */
-    private String EBusinessID;
-
-    /**
-     * 是否成功
-     */
-    private Boolean Success;
-
-    /**
-     * 返回编码
-     */
-    private String ResultCode;
-
-    /**
-     * 返回原因
-     */
-    private String Reason;
-
-    /**
-     * 订单信息
-     */
-    private Order Order;
-
-    /**
-     * 面单模板
-     */
-    private String PrintTemplate;
-
-    /**
-     * 运单信息
-     */
-    @Data
-    public static class Order {
-
-        /**
-         * 订单编号
-         */
-        private String OrderCode;
-
-        /**
-         * 快递公司编码
-         */
-        private String ShipperCode;
-
-        /**
-         * 运单号
-         */
-        private String LogisticCode;
-    }
-}

+ 0 - 55
fs-admin/src/main/java/com/fs/kdniao/domain/KdniaoPerson.java

@@ -1,55 +0,0 @@
-package com.fs.kdniao.domain;
-
-import lombok.Data;
-
-/**
- * 发件人 / 收件人信息
- */
-@Data
-public class KdniaoPerson {
-
-    /**
-     * 公司名称
-     */
-    private String Company;
-
-    /**
-     * 姓名
-     */
-    private String Name;
-
-    /**
-     * 电话
-     */
-    private String Tel;
-
-    /**
-     * 手机号
-     */
-    private String Mobile;
-
-    /**
-     * 省
-     */
-    private String ProvinceName;
-
-    /**
-     * 市
-     */
-    private String CityName;
-
-    /**
-     * 区/县
-     */
-    private String ExpAreaName;
-
-    /**
-     * 详细地址
-     */
-    private String Address;
-
-    /**
-     * 邮编
-     */
-    private String PostCode;
-}

+ 0 - 192
fs-admin/src/main/java/com/fs/kdniao/domain/KdniaoSimpleOrderRequest.java

@@ -1,192 +0,0 @@
-package com.fs.kdniao.domain;
-
-import lombok.Data;
-
-import java.math.BigDecimal;
-
-/**
- * 前端简化下单请求对象
- */
-@Data
-public class KdniaoSimpleOrderRequest {
-
-    /**
-     * 业务订单号
-     * 传系统自己的订单号
-     */
-    private String bizOrderNo;
-
-    /**
-     * 快递公司编码,如 SF、YTO、ZTO、JDKY、EMS
-     */
-    private String shipperCode;
-
-    /**
-     * 运费支付方式
-     * 1:现付
-     * 2:到付
-     * 3:月结
-     */
-    private Integer payType;
-
-    /**
-     * 快递业务类型
-     * 常见值:1
-     */
-    private String expType;
-
-    /**
-     * 收件人姓名
-     */
-    private String receiverName;
-
-    /**
-     * 收件人手机号
-     */
-    private String receiverMobile;
-
-    /**
-     * 收件人电话
-     */
-    private String receiverTel;
-
-    /**
-     * 收件省
-     */
-    private String receiverProvinceName;
-
-    /**
-     * 收件市
-     */
-    private String receiverCityName;
-
-    /**
-     * 收件区/县
-     */
-    private String receiverExpAreaName;
-
-    /**
-     * 收件详细地址
-     * 不要包含省市区
-     */
-    private String receiverAddress;
-
-    /**
-     * 收件邮编
-     * EMS 场景建议传
-     */
-    private String receiverPostCode;
-
-    /**
-     * 商品名称
-     * 建议传类别,如:文件、衣服、电子产品
-     */
-    private String goodsName;
-
-    /**
-     * 商品数量
-     */
-    private Integer goodsQuantity;
-
-    /**
-     * 商品价格
-     */
-    private BigDecimal goodsPrice;
-
-    /**
-     * 商品重量
-     */
-    private BigDecimal goodsWeight;
-
-    /**
-     * 商品描述
-     */
-    private String goodsDesc;
-
-    /**
-     * 包裹数量
-     */
-    private Integer quantity;
-
-    /**
-     * 总重量(kg)
-     */
-    private BigDecimal weight;
-
-    /**
-     * 总体积(m³)
-     */
-    private BigDecimal volume;
-
-    /**
-     * 运费
-     */
-    private BigDecimal cost;
-
-    /**
-     * 其他费用
-     */
-    private BigDecimal otherCost;
-
-    /**
-     * 备注
-     */
-    private String remark;
-
-    /**
-     * 是否返回面单模板
-     * 0:否
-     * 1:是
-     */
-    private String isReturnPrintTemplate;
-
-    /**
-     * 面单模板尺寸
-     */
-    private String templateSize;
-
-    /**
-     * 是否订阅轨迹推送
-     * 1:订阅
-     * 0:不订阅
-     */
-    private String isSubscribe;
-
-    /**
-     * 是否通知上门取件
-     * 0:通知
-     * 1:不通知
-     */
-    private Integer isNotice;
-
-    /**
-     * 上门取件开始时间
-     * 格式:yyyy-MM-dd HH:mm:ss
-     */
-    private String startDate;
-
-    /**
-     * 上门取件结束时间
-     */
-    private String endDate;
-
-    /**
-     * 是否要求签回单
-     * 0:否
-     * 1:是
-     */
-    private Integer isReturnSignBill;
-
-    /**
-     * 是否发送短信
-     * 0:否
-     * 1:是
-     */
-    private Integer isSendMessage;
-
-    /**
-     * 币种
-     * 特殊场景需要
-     */
-    private String currencyCode;
-}

+ 0 - 18
fs-admin/src/main/java/com/fs/kdniao/service/IKdniaoEOrderService.java

@@ -1,18 +0,0 @@
-package com.fs.kdniao.service;
-
-import com.fs.kdniao.domain.KdniaoEOrderResponse;
-import com.fs.kdniao.domain.KdniaoSimpleOrderRequest;
-
-/**
- * 快递鸟电子面单业务接口
- */
-public interface IKdniaoEOrderService {
-
-    /**
-     * 前端简化参数下单
-     *
-     * @param request 简化请求参数
-     * @return 下单结果
-     */
-    KdniaoEOrderResponse submitSimpleOrder(KdniaoSimpleOrderRequest request);
-}

+ 0 - 214
fs-admin/src/main/java/com/fs/kdniao/service/impl/KdniaoEOrderServiceImpl.java

@@ -1,214 +0,0 @@
-package com.fs.kdniao.service.impl;
-
-import com.alibaba.fastjson.JSON;
-import com.fs.kdniao.config.KdniaoConfig;
-import com.fs.kdniao.domain.KdniaoCommodity;
-import com.fs.kdniao.domain.KdniaoEOrderRequest;
-import com.fs.kdniao.domain.KdniaoEOrderResponse;
-import com.fs.kdniao.domain.KdniaoPerson;
-import com.fs.kdniao.domain.KdniaoSimpleOrderRequest;
-import com.fs.kdniao.service.IKdniaoEOrderService;
-import com.fs.kdniao.util.KdniaoUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.StringUtils;
-
-import java.net.URLEncoder;
-import java.util.Collections;
-
-/**
- * 快递鸟电子面单业务实现类
- */
-@Service
-public class KdniaoEOrderServiceImpl implements IKdniaoEOrderService {
-
-    @Autowired
-    private KdniaoConfig kdniaoConfig;
-
-    /**
-     * 前端简化参数下单
-     */
-    @Override
-    public KdniaoEOrderResponse submitSimpleOrder(KdniaoSimpleOrderRequest request) {
-        validateRequest(request);
-
-        KdniaoEOrderRequest eOrderRequest = buildEOrderRequest(request);
-
-        String requestData = KdniaoUtil.toRequestDataJson(eOrderRequest);
-        String dataSign = KdniaoUtil.getDataSign(requestData, kdniaoConfig.getApiKey());
-
-        try {
-            String formData = buildFormData(requestData, dataSign);
-            String result = KdniaoUtil.doPost(kdniaoConfig.getReqURL(), formData);
-            return JSON.parseObject(result, KdniaoEOrderResponse.class);
-        } catch (Exception e) {
-            throw new RuntimeException("电子面单下单失败:" + e.getMessage(), e);
-        }
-    }
-
-    /**
-     * 组装快递鸟标准请求对象
-     */
-    private KdniaoEOrderRequest buildEOrderRequest(KdniaoSimpleOrderRequest request) {
-        KdniaoEOrderRequest eOrderRequest = new KdniaoEOrderRequest();
-
-        // 基础字段
-        eOrderRequest.setOrderCode(buildOrderCode(request.getBizOrderNo()));
-        eOrderRequest.setShipperCode(request.getShipperCode());
-        eOrderRequest.setCustomerName(kdniaoConfig.getAccount().getCustomerName());
-        eOrderRequest.setCustomerPwd(kdniaoConfig.getAccount().getCustomerPwd());
-        eOrderRequest.setSendSite(kdniaoConfig.getAccount().getSendSite());
-        eOrderRequest.setMonthCode(kdniaoConfig.getAccount().getMonthCode());
-        eOrderRequest.setPayType(request.getPayType());
-        eOrderRequest.setExpType(request.getExpType());
-
-        // 发件人
-        eOrderRequest.setSender(buildSender());
-
-        // 收件人
-        eOrderRequest.setReceiver(buildReceiver(request));
-
-        // 商品
-        eOrderRequest.setCommodity(Collections.singletonList(buildCommodity(request)));
-
-        // 包裹信息
-        eOrderRequest.setQuantity(request.getQuantity() == null ? 1 : request.getQuantity());
-        eOrderRequest.setWeight(request.getWeight());
-        eOrderRequest.setVolume(request.getVolume());
-        eOrderRequest.setCost(request.getCost());
-        eOrderRequest.setOtherCost(request.getOtherCost());
-
-        // 打印和备注
-        eOrderRequest.setRemark(trimToNull(request.getRemark()));
-        eOrderRequest.setIsReturnPrintTemplate(StringUtils.hasText(request.getIsReturnPrintTemplate()) ? request.getIsReturnPrintTemplate() : "1");
-        eOrderRequest.setTemplateSize(StringUtils.hasText(request.getTemplateSize()) ? request.getTemplateSize() : "130");
-        eOrderRequest.setIsSubscribe(StringUtils.hasText(request.getIsSubscribe()) ? request.getIsSubscribe() : "0");
-
-        // 上门取件
-        eOrderRequest.setIsNotice(request.getIsNotice());
-        eOrderRequest.setStartDate(trimToNull(request.getStartDate()));
-        eOrderRequest.setEndDate(trimToNull(request.getEndDate()));
-
-        // 其他
-        eOrderRequest.setIsReturnSignBill(request.getIsReturnSignBill());
-        eOrderRequest.setIsSendMessage(request.getIsSendMessage());
-        eOrderRequest.setCurrencyCode(trimToNull(request.getCurrencyCode()));
-
-        return eOrderRequest;
-    }
-
-    /**
-     * 构建订单号
-     * 规则:业务订单号 + 时间戳,保证唯一
-     */
-    private String buildOrderCode(String bizOrderNo) {
-        if (StringUtils.hasText(bizOrderNo)) {
-            return bizOrderNo.trim() + "-" + System.currentTimeMillis();
-        }
-        return "KD" + System.currentTimeMillis();
-    }
-
-    /**
-     * 组装默认发件人
-     */
-    private KdniaoPerson buildSender() {
-        KdniaoPerson sender = new KdniaoPerson();
-        sender.setCompany(trimToNull(kdniaoConfig.getSender().getCompany()));
-        sender.setName(kdniaoConfig.getSender().getName());
-        sender.setMobile(kdniaoConfig.getSender().getMobile());
-        sender.setProvinceName(kdniaoConfig.getSender().getProvinceName());
-        sender.setCityName(kdniaoConfig.getSender().getCityName());
-        sender.setExpAreaName(kdniaoConfig.getSender().getExpAreaName());
-        sender.setAddress(kdniaoConfig.getSender().getAddress());
-        sender.setPostCode(trimToNull(kdniaoConfig.getSender().getPostCode()));
-        return sender;
-    }
-
-    /**
-     * 组装收件人
-     */
-    private KdniaoPerson buildReceiver(KdniaoSimpleOrderRequest request) {
-        KdniaoPerson receiver = new KdniaoPerson();
-        receiver.setName(request.getReceiverName());
-        receiver.setMobile(trimToNull(request.getReceiverMobile()));
-        receiver.setTel(trimToNull(request.getReceiverTel()));
-        receiver.setProvinceName(request.getReceiverProvinceName());
-        receiver.setCityName(request.getReceiverCityName());
-        receiver.setExpAreaName(request.getReceiverExpAreaName());
-        receiver.setAddress(request.getReceiverAddress());
-        receiver.setPostCode(trimToNull(request.getReceiverPostCode()));
-        return receiver;
-    }
-
-    /**
-     * 组装商品信息
-     */
-    private KdniaoCommodity buildCommodity(KdniaoSimpleOrderRequest request) {
-        KdniaoCommodity commodity = new KdniaoCommodity();
-        commodity.setGoodsName(request.getGoodsName());
-        commodity.setGoodsquantity(request.getGoodsQuantity() == null ? 1 : request.getGoodsQuantity());
-        commodity.setGoodsPrice(request.getGoodsPrice());
-        commodity.setGoodsWeight(request.getGoodsWeight());
-        commodity.setGoodsDesc(trimToNull(request.getGoodsDesc()));
-        return commodity;
-    }
-
-    /**
-     * 构建表单请求参数
-     */
-    private String buildFormData(String requestData, String dataSign) throws Exception {
-        StringBuilder sb = new StringBuilder();
-        sb.append("RequestData=").append(URLEncoder.encode(requestData, "UTF-8"));
-        sb.append("&EBusinessID=").append(URLEncoder.encode(kdniaoConfig.getEBusinessID(), "UTF-8"));
-        sb.append("&RequestType=").append(URLEncoder.encode("1007", "UTF-8"));
-        sb.append("&DataSign=").append(dataSign);
-        sb.append("&DataType=").append(URLEncoder.encode("2", "UTF-8"));
-        return sb.toString();
-    }
-
-    /**
-     * 前端简化参数校验
-     */
-    private void validateRequest(KdniaoSimpleOrderRequest request) {
-        if (request == null) {
-            throw new IllegalArgumentException("请求参数不能为空");
-        }
-        if (!StringUtils.hasText(request.getShipperCode())) {
-            throw new IllegalArgumentException("shipperCode不能为空");
-        }
-        if (request.getPayType() == null) {
-            throw new IllegalArgumentException("payType不能为空");
-        }
-        if (!StringUtils.hasText(request.getExpType())) {
-            throw new IllegalArgumentException("expType不能为空");
-        }
-        if (!StringUtils.hasText(request.getReceiverName())) {
-            throw new IllegalArgumentException("receiverName不能为空");
-        }
-        if (!StringUtils.hasText(request.getReceiverMobile()) && !StringUtils.hasText(request.getReceiverTel())) {
-            throw new IllegalArgumentException("receiverMobile和receiverTel至少填写一个");
-        }
-        if (!StringUtils.hasText(request.getReceiverProvinceName())) {
-            throw new IllegalArgumentException("receiverProvinceName不能为空");
-        }
-        if (!StringUtils.hasText(request.getReceiverCityName())) {
-            throw new IllegalArgumentException("receiverCityName不能为空");
-        }
-        if (!StringUtils.hasText(request.getReceiverExpAreaName())) {
-            throw new IllegalArgumentException("receiverExpAreaName不能为空");
-        }
-        if (!StringUtils.hasText(request.getReceiverAddress())) {
-            throw new IllegalArgumentException("receiverAddress不能为空");
-        }
-        if (!StringUtils.hasText(request.getGoodsName())) {
-            throw new IllegalArgumentException("goodsName不能为空");
-        }
-    }
-
-    /**
-     * 去除空白,空字符串转 null
-     */
-    private String trimToNull(String value) {
-        return StringUtils.hasText(value) ? value.trim() : null;
-    }
-}

+ 0 - 114
fs-admin/src/main/java/com/fs/kdniao/util/KdniaoUtil.java

@@ -1,114 +0,0 @@
-package com.fs.kdniao.util;
-
-import com.alibaba.fastjson.JSON;
-import com.fs.kdniao.domain.KdniaoEOrderRequest;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLEncoder;
-import java.security.MessageDigest;
-import java.util.Base64;
-
-/**
- * 快递鸟工具类
- */
-public class KdniaoUtil {
-
-    private KdniaoUtil() {
-    }
-
-    /**
-     * 将标准请求对象转成 RequestData JSON 字符串
-     */
-    public static String toRequestDataJson(KdniaoEOrderRequest request) {
-        return JSON.toJSONString(request);
-    }
-
-    /**
-     * 生成 DataSign
-     * 规则:Base64(MD5(RequestData + ApiKey))
-     */
-    public static String getDataSign(String requestData, String apiKey) {
-        try {
-            String md5Result = md5(requestData + apiKey);
-            String base64 = Base64.getEncoder().encodeToString(md5Result.getBytes("UTF-8"));
-            return URLEncoder.encode(base64, "UTF-8");
-        } catch (Exception e) {
-            throw new RuntimeException("生成DataSign失败", e);
-        }
-    }
-
-    /**
-     * POST 表单请求
-     */
-    public static String doPost(String reqURL, String formData) {
-        HttpURLConnection connection = null;
-        OutputStream os = null;
-        BufferedReader br = null;
-        try {
-            URL url = new URL(reqURL);
-            connection = (HttpURLConnection) url.openConnection();
-            connection.setRequestMethod("POST");
-            connection.setConnectTimeout(10000);
-            connection.setReadTimeout(20000);
-            connection.setDoOutput(true);
-            connection.setDoInput(true);
-            connection.setUseCaches(false);
-            connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded;charset=UTF-8");
-
-            os = connection.getOutputStream();
-            os.write(formData.getBytes("UTF-8"));
-            os.flush();
-
-            br = new BufferedReader(new InputStreamReader(connection.getInputStream(), "UTF-8"));
-            StringBuilder sb = new StringBuilder();
-            String line;
-            while ((line = br.readLine()) != null) {
-                sb.append(line);
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            throw new RuntimeException("调用快递鸟接口失败", e);
-        } finally {
-            try {
-                if (os != null) {
-                    os.close();
-                }
-            } catch (Exception ignored) {
-            }
-            try {
-                if (br != null) {
-                    br.close();
-                }
-            } catch (Exception ignored) {
-            }
-            if (connection != null) {
-                connection.disconnect();
-            }
-        }
-    }
-
-    /**
-     * MD5
-     */
-    private static String md5(String text) {
-        try {
-            MessageDigest md = MessageDigest.getInstance("MD5");
-            byte[] digest = md.digest(text.getBytes("UTF-8"));
-            StringBuilder sb = new StringBuilder();
-            for (byte b : digest) {
-                String hex = Integer.toHexString(b & 0xff);
-                if (hex.length() == 1) {
-                    sb.append("0");
-                }
-                sb.append(hex);
-            }
-            return sb.toString();
-        } catch (Exception e) {
-            throw new RuntimeException("MD5计算失败", e);
-        }
-    }
-}

+ 0 - 45
fs-admin/src/main/java/com/fs/kdniaoNew/controller/KdniaoUniversalEOrderController.java

@@ -1,45 +0,0 @@
-package com.fs.kdniaoNew.controller;
-
-import com.fs.common.annotation.Log;
-import com.fs.common.core.controller.BaseController;
-import com.fs.common.core.domain.AjaxResult;
-import com.fs.common.enums.BusinessType;
-import com.fs.kdniaoNew.domain.KdniaoSubmitCommand;
-import com.fs.kdniaoNew.domain.KdniaoUniversalResponse;
-import com.fs.kdniaoNew.service.IKdniaoUniversalEOrderService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * 快递鸟统一电子面单控制器
- */
-@RestController
-@RequestMapping("/kdniao/universal/eorder")
-public class KdniaoUniversalEOrderController extends BaseController {
-
-    @Autowired
-    private IKdniaoUniversalEOrderService kdniaoUniversalEOrderService;
-
-    /**
-     * 统一下单
-     */
-    @Log(title = "快递鸟统一电子面单", businessType = BusinessType.INSERT)
-    @PostMapping("/submit")
-    public AjaxResult submit(@RequestBody KdniaoSubmitCommand command) {
-        try {
-            KdniaoUniversalResponse response = kdniaoUniversalEOrderService.submit(command);
-
-            if (Boolean.TRUE.equals(response.getSuccess()) && "100".equals(response.getResultCode())) {
-                return AjaxResult.success("下单成功", response);
-            }
-
-            if ("106".equals(response.getResultCode())) {
-                return AjaxResult.error("订单号重复,快递鸟返回:该订单号已下单成功");
-            }
-
-            return AjaxResult.error("下单失败:" + response.getReason(), response);
-        } catch (Exception e) {
-            return AjaxResult.error("下单异常:" + e.getMessage());
-        }
-    }
-}