ソースを参照

导出以及顺丰面单

zxfqwert 3 週間 前
コミット
017ce3659e

+ 14 - 12
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/controller/BizWaybillCostDetailsController.java

@@ -76,6 +76,20 @@ public class BizWaybillCostDetailsController extends BaseController
 
 
 
+    /**
+     * 导出运单明细列表
+     */
+   // @RequiresPermissions("system:costDetails:export")
+    @Log(title = "运单明细", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, BizWaybillCostDetails bizWaybillCostDetails)
+    {
+        List<BizWaybillCostDetails> list = bizWaybillCostDetailsService.selectBizWaybillCostDetailsList(bizWaybillCostDetails);
+        ExcelUtil<BizWaybillCostDetails> util = new ExcelUtil<BizWaybillCostDetails>(BizWaybillCostDetails.class);
+        util.exportExcel(response, list, "运单明细数据");
+    }
+
+
 
     /**
      * 运单明细详情查询
@@ -143,18 +157,6 @@ public class BizWaybillCostDetailsController extends BaseController
 
 
 
-    /**
-     * 导出运单明细列表
-     */
-    @RequiresPermissions("system:costDetails:export")
-    @Log(title = "运单明细", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, BizWaybillCostDetails bizWaybillCostDetails)
-    {
-        List<BizWaybillCostDetails> list = bizWaybillCostDetailsService.selectBizWaybillCostDetailsList(bizWaybillCostDetails);
-        ExcelUtil<BizWaybillCostDetails> util = new ExcelUtil<BizWaybillCostDetails>(BizWaybillCostDetails.class);
-        util.exportExcel(response, list, "运单明细数据");
-    }
 
     /**
      * 获取运单明细详细信息

+ 2 - 0
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/controller/BizWaybillOrderController.java

@@ -143,4 +143,6 @@ public class BizWaybillOrderController extends BaseController
         BizWaybillOrder bizWaybillOrder = bizWaybillOrderService.selectBizWaybillOrderByWaybillId(waybillId);
         return success(bizWaybillOrderService.queryWaybillPdf(bizWaybillOrder));
     }
+
+
 }

+ 51 - 36
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/domain/BizWaybillCostDetails.java

@@ -4,6 +4,7 @@ import java.math.BigDecimal;
 import java.util.Date;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.logistics.annotation.Dict;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.ruoyi.common.core.annotation.Excel;
@@ -23,46 +24,69 @@ public class BizWaybillCostDetails extends BaseEntity
     private Long waybillDetailId;
 
     /** 运单ID */
-    @Excel(name = "运单ID")
+
     private Long waybillId;
 
+
+    private Integer orderType;
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date signTime;
     /** 外部运单号 */
-    @Excel(name = "外部运单号")
+    @Excel(name = "运单号")
     private String externalWaybillNo;
+    @Excel(name = "寄件地区")
+    private String senderCity;
+    /** 到件地区 */
+    @Excel(name = "到件地区")
+    private String receiverCity;
+    /** 计费重量 */
+    @Excel(name = "计费重量")
+    private BigDecimal goodsWeight;
+    /** 产品类型 */
+    @Excel(name = "产品类型")
+    private String productName;
+    /** 金额 */
+    @Excel(name = "标准费用(元)")
+    private BigDecimal amount;
+    @Excel(name = "折扣")
+    private String rate;
+
+    /** 金额*费率 */
+    @Excel(name = "折扣费用(元)")
+    private BigDecimal rateAmount;
+    /** 采购金额 */
 
+    private BigDecimal purchaseAmount;
+    private String productCode;
     /** 费用项目编码 */
-    @Excel(name = "费用项目编码")
+
     private String feeItemCode;
 
     /** 费用项目名称 */
-    @Excel(name = "费用项目名称")
+    @Excel(name = "增值费用")
     private String feeItemName;
 
     /** 费用名称 */
-    @Excel(name = "费用名称")
+
     private String feeName;
 
-    /** 金额 */
-    @Excel(name = "金额")
-    private BigDecimal amount;
 
-    /** 金额*费率 */
-    @Excel(name = "金额*费率")
-    private BigDecimal rateAmount;
+
+
 
     /** 调整金额 */
-    @Excel(name = "调整金额")
+
     private BigDecimal adjustAmount;
-    @Excel(name = "折扣")
-    private String rate;
+
 
 
     /** 部门id */
-    @Excel(name = "部门id")
+
     private Long deptId;
 
     /** 用户id */
-    @Excel(name = "用户id")
+
     private Long userId;
 
 
@@ -70,28 +94,15 @@ public class BizWaybillCostDetails extends BaseEntity
 
 
 
-    @Excel(name = "订单类型 1-非时效件(京东),2-时效件(顺丰)")
-    private Integer orderType;
-    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
-    private Date signTime;
+
+
     /** 寄件地区 */
-    @Excel(name = "寄件地区")
-    private String senderCity;
-    /** 到件地区 */
-    @Excel(name = "到件地区")
-    private String receiverCity;
-    /** 计费重量 */
-    @Excel(name = "计费重量")
-    private BigDecimal goodsWeight;
-    /** 产品类型 */
-    @Excel(name = "产品类型")
-    private String productCode;
+
     /** 经手人 */
    // @Excel(name = "经手人")
     private String userName;
 
-    @Excel(name = "调账类型")
+
     private String adjustmentType;
 
     @Excel(name = "账单月份")//
@@ -100,9 +111,13 @@ public class BizWaybillCostDetails extends BaseEntity
     private String  adjustmentReason;
 
 
-    /** 采购金额 */
-    @Excel(name = "采购金额")
-    private BigDecimal purchaseAmount;
+    public void setProductName(String productName) {
+        this.productName = productName;
+    }
+
+    public String getProductName() {
+        return productName;
+    }
 
     public String getRate() {
         return rate;

+ 53 - 6
jd-logistics-modules/jd-logistics-system/src/main/java/com/ruoyi/logistics/service/impl/SFLogisticsService.java

@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.type.TypeFactory;
+import com.ruoyi.common.core.utils.StringUtils;
 import com.ruoyi.common.core.web.domain.AjaxResult;
 import com.ruoyi.common.redis.service.RedisIdGenerator;
 import com.ruoyi.logistics.config.SFExpressConfig;
@@ -277,11 +278,6 @@ public class SFLogisticsService implements LogisticsService {
         orderData.put("language","zh_CN");
         orderData.put("orderId",bizWaybillOrder.getWaybillNo());
         orderData.put("dealType",1);
-
-
-
-
-
         String msgData =tools.packageMsgData(standardService);
         msgData= JSON.toJSONString(orderData);
         try {
@@ -360,8 +356,59 @@ public class SFLogisticsService implements LogisticsService {
         return null;
     }
 
+
+
+
+    /*获取面单pdf下载地址*/
     @Override
     public JSONObject queryWaybillPdf(BizWaybillOrder bizWaybillOrder) {
-        return null;
+
+        IServiceCodeStandard standardService = ExpressServiceCodeEnum.COM_RECE_CLOUD_PRINT_WAYBILLS;
+        CallExpressServiceTools tools=CallExpressServiceTools.getInstance();
+        Map<String, String> params = new HashMap<String, String>();
+        String timeStamp = String.valueOf(System.currentTimeMillis());
+        Map<String,Object> orderData= new HashMap<>();
+        orderData.put("templateCode","fm_210_standard_{{clientcode}}");
+        orderData.put("version","2.0");
+        orderData.put("fileType","pdf");
+        orderData.put("sync",true);
+        List<Map<String, Object>> documents = new ArrayList<>();
+        Map<String, Object> doc = new HashMap<>();
+        doc.put("masterWaybillNo",bizWaybillOrder.getWaybillNo() );
+        documents.add(doc);
+        orderData.put("documents",documents);
+        String msgData =tools.packageMsgData(standardService);
+        msgData= JSON.toJSONString(orderData);
+        try {
+            params.put("partnerID", sfExpressConfig.getClientCode());  // 顾客编码 ,对应丰桥上获取的clientCode
+            params.put("requestID", UUID.randomUUID().toString().replace("-", ""));
+            params.put("serviceCode",standardService.getCode());// 接口服务码
+            params.put("timestamp", timeStamp);
+            params.put("msgData", msgData);
+            params.put("msgDigest", tools.getMsgDigest(msgData,timeStamp,sfExpressConfig.getCheckWord()));
+            String result = HttpClientUtil.post(sfExpressConfig.getCurrentApiUrl(), params);
+            JSONObject jsonObject = JSON.parseObject(result).getJSONObject("apiResultData");
+            JSONObject resultInfo = new JSONObject();
+            if (jsonObject != null && jsonObject.containsKey("apiErrorMsg") && StringUtils.isBlank("apiErrorMsg")) {
+                resultInfo.put("success", true);
+                JSONObject obj = jsonObject.getJSONObject("obj");
+                // 4. 取出 files 数组,取第一个
+                JSONObject file = obj.getJSONArray("files").getJSONObject(0);
+                // 5. 拿到最终的 URL
+                String url = file.getString("url");
+                String token = file.getString("token");
+                resultInfo.put("msg",url);
+                resultInfo.put("token",token);
+                return resultInfo;
+            } else {
+                resultInfo.put("success", false);
+                resultInfo.put("msg", "获取面单失败!失败原因:"+jsonObject.get("apiErrorMsg"));
+                return resultInfo;
+            }
+
+        }
+        catch(Exception e){
+            throw new RuntimeException();
+        }
     }
 }

+ 5 - 0
jd-logistics-modules/jd-logistics-system/src/main/resources/mapper/logistics/BizWaybillCostDetailsMapper.xml

@@ -30,6 +30,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="signTime"    column="sign_time"    />
         <result property="goodsWeight"    column="goods_weight"    />
         <result property="productCode"    column="product_code"    />
+        <result property="productName"    column="product_name"    />
         <result property="userName"    column="user_name"    />
         <result property="summaryMonth"    column="summaryMonth"    />
 
@@ -47,6 +48,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             b.receiver_city,
             b.goods_weight,
             b.order_type,
+            CASE b.order_type
+        WHEN 1 THEN (SELECT dict_label	FROM sys_dict_data WHERE dict_type = 'jd_logistics_product_code' AND dict_value = b.product_code LIMIT 1)
+        WHEN 2 THEN (SELECT dict_label FROM sys_dict_data WHERE dict_type = 'sf_logistics_product_code' AND dict_value = b.product_code LIMIT 1)
+        ELSE NULL END AS product_name,
             b.product_code,
             u.nick_name,
             a.waybill_id,