demand: 江苏国泰国华订单系统对接 - 订单模版 接口对接
committer: heyu
This commit is contained in:
parent
b562a81e7a
commit
fa0b4e87de
@ -11,9 +11,11 @@
|
||||
|
||||
package com.xdadan.erp.web.emis;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xdadan.erp.common.annotation.Log;
|
||||
import com.xdadan.erp.common.config.PayConfig;
|
||||
import com.xdadan.erp.common.core.domain.AjaxResult;
|
||||
import com.xdadan.erp.common.core.domain.entity.SysUser;
|
||||
import com.xdadan.erp.common.core.redis.RedissonService;
|
||||
@ -33,7 +35,9 @@ import com.xdadan.erp.emis.service.print.tanex.TanexPdfPrinter;
|
||||
import com.xdadan.erp.emis.utils.WaybillHelper;
|
||||
import com.xdadan.erp.framework.manager.AsyncManager;
|
||||
import com.xdadan.erp.framework.manager.factory.AsyncFactory;
|
||||
import com.xdadan.erp.system.domain.SysFileInfo;
|
||||
import com.xdadan.erp.system.service.ISysConfigService;
|
||||
import com.xdadan.erp.system.service.ISysFileInfoService;
|
||||
import com.xdadan.erp.system.service.ISysNoticeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
@ -45,6 +49,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -80,7 +86,6 @@ public class EmisCommonController extends EmisBaseController
|
||||
@Autowired
|
||||
private RL7moorService rl7moorService;
|
||||
|
||||
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
@ -126,6 +131,12 @@ public class EmisCommonController extends EmisBaseController
|
||||
@Autowired
|
||||
private IEmisCustomerSignService emisCustomerSignService;
|
||||
|
||||
@Autowired
|
||||
private ISysFileInfoService sysFileInfoService;
|
||||
|
||||
@Autowired
|
||||
private IEmisWaybillExternalService emisWaybillExternalService;
|
||||
|
||||
/**
|
||||
* 在线支付回调
|
||||
* @param method
|
||||
@ -1481,6 +1492,11 @@ public class EmisCommonController extends EmisBaseController
|
||||
// 5. 调用service处理订单信息
|
||||
Map<String, Object> result = emisWaybillService.processOrderToWaybill(orderDatas, appId);
|
||||
|
||||
// 6. 从返回结果中获取客户信息
|
||||
String customerName = (String) result.getOrDefault("customerName", "");
|
||||
String custNo = (String) result.getOrDefault("custNo", "");
|
||||
String createSite = (String) result.getOrDefault("createSite", "");
|
||||
|
||||
// 6. 转换返回结果
|
||||
JSONObject response = new JSONObject();
|
||||
List<Map<String, Object>> resultList = (List<Map<String, Object>>) result.get("result");
|
||||
@ -1491,7 +1507,11 @@ public class EmisCommonController extends EmisBaseController
|
||||
boolean hasSuccess = false;
|
||||
|
||||
if (resultList != null) {
|
||||
for (Map<String, Object> item : resultList) {
|
||||
// 由于resultList和orderDatas的顺序是对应的,直接通过索引匹配
|
||||
for (int i = 0; i < resultList.size() && i < orderDatas.size(); i++) {
|
||||
Map<String, Object> item = resultList.get(i);
|
||||
JSONObject originalOrderData = orderDatas.getJSONObject(i);
|
||||
|
||||
JSONObject dataItem = new JSONObject();
|
||||
dataItem.put("orderNo", item.get("orderNo"));
|
||||
dataItem.put("logisticNo", item.get("logisticNo"));
|
||||
@ -1503,8 +1523,81 @@ public class EmisCommonController extends EmisBaseController
|
||||
String statusCode = (String) item.get("statusCode");
|
||||
if ("0000".equals(statusCode)) {
|
||||
hasSuccess = true;
|
||||
|
||||
// 生成PDF面单 - 合并resultList和orderDatas的数据
|
||||
try {
|
||||
|
||||
// 合并数据:resultList提供运单号等处理结果,orderDatas提供原始订单数据
|
||||
Map<String, Object> waybillData = new HashMap<>();
|
||||
waybillData.putAll(item); // 添加resultList的数据
|
||||
|
||||
// 添加入库需要的字段
|
||||
waybillData.put("customerName", customerName);
|
||||
waybillData.put("custNo", custNo);
|
||||
waybillData.put("orderSn", item.get("orderNo"));
|
||||
waybillData.put("custOrderId",
|
||||
originalOrderData != null ? originalOrderData.getString("orderNo") : "");
|
||||
waybillData.put("createSite", createSite);
|
||||
|
||||
if (originalOrderData != null) {
|
||||
// 添加orderDatas中的原始订单数据
|
||||
waybillData.put("orderDate", originalOrderData.getString("orderDate"));
|
||||
|
||||
// 寄件人信息 - 从orderDatas获取正确的字段名
|
||||
waybillData.put("senderName", originalOrderData.getString("sender"));
|
||||
waybillData.put("senderPhone", originalOrderData.getString("senderTel"));
|
||||
waybillData.put("senderCompany", originalOrderData.getString("senderCompany"));
|
||||
waybillData.put("senderAddress", originalOrderData.getString("senderAddress"));
|
||||
|
||||
// 收件人信息 - 从orderDatas获取正确的字段名
|
||||
waybillData.put("consigneeName", originalOrderData.getString("consignee"));
|
||||
waybillData.put("consigneePhone", originalOrderData.getString("tel"));
|
||||
waybillData.put("consigneeCompany", originalOrderData.getString("company"));
|
||||
waybillData.put("consigneeAddress", originalOrderData.getString("address"));
|
||||
|
||||
// 包裹信息 - 从orderDatas获取正确的字段名
|
||||
waybillData.put("parcelQty", originalOrderData.getString("parcelQty"));
|
||||
waybillData.put("volume", originalOrderData.getString("volume"));
|
||||
waybillData.put("actualWeight", originalOrderData.getString("weight"));
|
||||
|
||||
waybillData.put("volumeWeight", ""); // 体积重量需要计算
|
||||
waybillData.put("settlementWeight", ""); // 结算重量需要计算
|
||||
waybillData.put("freight", ""); // 运费需要计算
|
||||
waybillData.put("paymentType", originalOrderData.getString("paymentType"));
|
||||
waybillData.put("packType", originalOrderData.getString("packType"));
|
||||
waybillData.put("goodsInfo", originalOrderData.getString("goodsInfo"));
|
||||
waybillData.put("remark", originalOrderData.getString("remark"));
|
||||
|
||||
// 服务类型和目的地 - 从orderDatas获取正确的字段名
|
||||
waybillData.put("serviceType1", originalOrderData.getString("transLine"));
|
||||
waybillData.put("serviceType2", originalOrderData.getString("productType"));
|
||||
waybillData.put("destinationCountry", originalOrderData.getString("country"));
|
||||
waybillData.put("destinationCity", originalOrderData.getString("province"));
|
||||
|
||||
// 寄件人省市信息 - 从orderDatas获取
|
||||
waybillData.put("senderProvince", originalOrderData.getString("senderProvince"));
|
||||
waybillData.put("senderCity", originalOrderData.getString("senderCity"));
|
||||
|
||||
// 收件人省市信息 - 从orderDatas获取
|
||||
waybillData.put("consigneeProvince", originalOrderData.getString("province"));
|
||||
waybillData.put("consigneeCity", originalOrderData.getString("city"));
|
||||
|
||||
// 打印信息
|
||||
waybillData.put("printDate",
|
||||
DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date()));
|
||||
waybillData.put("printMan", "系统");
|
||||
waybillData.put("printCount", "1");
|
||||
}
|
||||
|
||||
String pdfUrl = generateWaybillPdf(waybillData);
|
||||
dataItem.put("pdfUrl", pdfUrl);
|
||||
} catch (Exception e) {
|
||||
log.error("生成PDF面单失败: {}", e.getMessage(), e);
|
||||
dataItem.put("pdfUrl", "");
|
||||
}
|
||||
} else if ("9999".equals(statusCode)) {
|
||||
hasFailure = true;
|
||||
dataItem.put("pdfUrl", "");
|
||||
}
|
||||
dataArray.add(dataItem);
|
||||
}
|
||||
@ -1807,11 +1900,234 @@ public class EmisCommonController extends EmisBaseController
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成运单PDF面单
|
||||
*
|
||||
* @param waybillData 运单数据
|
||||
* @return PDF文件URL
|
||||
* @throws Exception
|
||||
*/
|
||||
private String generateWaybillPdf(Map<String, Object> waybillData) throws Exception {
|
||||
int parcelQty = Integer.parseInt(waybillData.getOrDefault("parcelQty", "1").toString());
|
||||
String mainLogisticNo = (String) waybillData.get("logisticNo");
|
||||
|
||||
List<String> pdfUrls = new ArrayList<>();
|
||||
|
||||
// 生成主单PDF(不立即入库)
|
||||
String mainPdfUrl = generateMainWaybillPdfWithoutSave(waybillData, mainLogisticNo);
|
||||
pdfUrls.add(mainPdfUrl);
|
||||
|
||||
// 如果件数大于1,生成子单PDF(不立即入库)
|
||||
if (parcelQty > 1) {
|
||||
for (int i = 2; i <= parcelQty; i++) {
|
||||
String subLogisticNo = mainLogisticNo + String.format("%04d", i);
|
||||
String subPdfUrl = generateSubWaybillPdfWithoutSave(waybillData, subLogisticNo);
|
||||
pdfUrls.add(subPdfUrl);
|
||||
}
|
||||
}
|
||||
|
||||
// 所有PDF生成完成后,统一入库
|
||||
String totalPdfUrl = String.join(",", pdfUrls);
|
||||
saveWaybillExternalPdf(waybillData, mainLogisticNo, totalPdfUrl);
|
||||
|
||||
return totalPdfUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成主单PDF(不立即入库)
|
||||
*/
|
||||
private String generateMainWaybillPdfWithoutSave(Map<String, Object> waybillData, String logisticNo)
|
||||
throws Exception {
|
||||
// 构建面单数据
|
||||
Map<String, Object> orderMap = new HashMap<>();
|
||||
|
||||
// 基本信息
|
||||
orderMap.put("logisticNo", logisticNo);
|
||||
orderMap.put("ydSn", logisticNo); // 条形码使用运单号
|
||||
orderMap.put("sendDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date()));
|
||||
orderMap.put("printDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date()));
|
||||
orderMap.put("printMan", "系统");
|
||||
orderMap.put("printCount", "1");
|
||||
|
||||
// 订单时间 - 直接取当前系统时间,精确到日
|
||||
String orderTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date());
|
||||
orderMap.put("orderTime", orderTime);
|
||||
|
||||
// 收件人信息 - 从waybillData获取
|
||||
orderMap.put("consignee", waybillData.getOrDefault("consigneeName", ""));
|
||||
orderMap.put("mobile", waybillData.getOrDefault("consigneePhone", ""));
|
||||
orderMap.put("address", waybillData.getOrDefault("consigneeAddress", ""));
|
||||
orderMap.put("company", waybillData.getOrDefault("consigneeCompany", ""));
|
||||
orderMap.put("consigneeProvince", waybillData.getOrDefault("consigneeProvince", ""));
|
||||
orderMap.put("consigneeCity", waybillData.getOrDefault("consigneeCity", ""));
|
||||
|
||||
// 寄件人信息 - 从waybillData获取
|
||||
orderMap.put("sendPerson", waybillData.getOrDefault("senderName", ""));
|
||||
orderMap.put("sendMobile", waybillData.getOrDefault("senderPhone", ""));
|
||||
orderMap.put("sendCompany", waybillData.getOrDefault("senderCompany", ""));
|
||||
orderMap.put("sendAddress", waybillData.getOrDefault("senderAddress", ""));
|
||||
orderMap.put("senderProvince", waybillData.getOrDefault("senderProvince", ""));
|
||||
orderMap.put("senderCity", waybillData.getOrDefault("senderCity", ""));
|
||||
|
||||
// 包裹信息 - 从waybillData获取
|
||||
orderMap.put("parcelQty", waybillData.getOrDefault("parcelQty", ""));
|
||||
orderMap.put("billWeight", waybillData.getOrDefault("actualWeight", ""));
|
||||
orderMap.put("totalVolume", waybillData.getOrDefault("volume", ""));
|
||||
orderMap.put("volumeWeight", waybillData.getOrDefault("volumeWeight", ""));
|
||||
orderMap.put("settlementWeight", waybillData.getOrDefault("settlementWeight", ""));
|
||||
orderMap.put("freight", waybillData.getOrDefault("freight", ""));
|
||||
orderMap.put("paymentType", waybillData.getOrDefault("paymentType", ""));
|
||||
orderMap.put("packType", waybillData.getOrDefault("packType", ""));
|
||||
orderMap.put("goodsInfo", waybillData.getOrDefault("goodsInfo", ""));
|
||||
|
||||
// 备注信息 - 从waybillData获取
|
||||
orderMap.put("remark", waybillData.getOrDefault("remark", ""));
|
||||
|
||||
// 服务类型字段 - 从waybillData获取,用于在寄件信息上面空白区域显示
|
||||
orderMap.put("transLine", waybillData.getOrDefault("serviceType1", ""));
|
||||
orderMap.put("productType", waybillData.getOrDefault("serviceType2", ""));
|
||||
|
||||
// 目的地信息 - 从waybillData获取
|
||||
orderMap.put("destinationCountry", waybillData.getOrDefault("destinationCountry", ""));
|
||||
orderMap.put("destinationCity", waybillData.getOrDefault("destinationCity", ""));
|
||||
|
||||
// 生成PDF
|
||||
String fileId = IdUtil.fastUUID();
|
||||
String fileUploadDir = PayConfig.getUploadPath() + File.separator + DateUtils.datePath();
|
||||
|
||||
File saveDir = new File(fileUploadDir);
|
||||
if (!saveDir.exists()) {
|
||||
saveDir.mkdirs();
|
||||
}
|
||||
|
||||
String saveFileName = fileUploadDir + File.separator + fileId + ".pdf";
|
||||
|
||||
try (FileOutputStream os = new FileOutputStream(saveFileName)) {
|
||||
IXddTplPrint tplPrint = new TanexPdfPrinter();
|
||||
// 使用TAN-CM-130-NEW模板
|
||||
tplPrint.genPDF(orderMap, "TAN-EXTERNAL", "", os);
|
||||
}
|
||||
|
||||
// 上传文件并获取URL
|
||||
SysFileInfo sysFileInfo = sysFileInfoService.ossUploadLocalFile(saveFileName,
|
||||
logisticNo + "-main-waybill.pdf",
|
||||
"主单面单PDF");
|
||||
|
||||
// 删除本地文件
|
||||
new File(saveFileName).delete();
|
||||
|
||||
return sysFileInfo.getFileRemoteUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成子单PDF(不立即入库)
|
||||
*/
|
||||
private String generateSubWaybillPdfWithoutSave(Map<String, Object> waybillData, String subLogisticNo)
|
||||
throws Exception {
|
||||
// 构建面单数据
|
||||
Map<String, Object> orderMap = new HashMap<>();
|
||||
|
||||
// 基本信息
|
||||
orderMap.put("logisticNo", subLogisticNo);
|
||||
orderMap.put("ydSn", subLogisticNo); // 条形码使用子单号
|
||||
orderMap.put("sendDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date()));
|
||||
orderMap.put("printDate", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, new Date()));
|
||||
orderMap.put("printMan", "系统");
|
||||
orderMap.put("printCount", "1");
|
||||
|
||||
// 订单时间 - 直接取当前系统时间,精确到日
|
||||
String orderTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date());
|
||||
orderMap.put("orderTime", orderTime);
|
||||
|
||||
// 收件人信息 - 从waybillData获取
|
||||
orderMap.put("consignee", waybillData.getOrDefault("consigneeName", ""));
|
||||
orderMap.put("mobile", waybillData.getOrDefault("consigneePhone", ""));
|
||||
orderMap.put("address", waybillData.getOrDefault("consigneeAddress", ""));
|
||||
orderMap.put("company", waybillData.getOrDefault("consigneeCompany", ""));
|
||||
orderMap.put("consigneeProvince", waybillData.getOrDefault("consigneeProvince", ""));
|
||||
orderMap.put("consigneeCity", waybillData.getOrDefault("consigneeCity", ""));
|
||||
|
||||
// 寄件人信息 - 从waybillData获取
|
||||
orderMap.put("sendPerson", waybillData.getOrDefault("senderName", ""));
|
||||
orderMap.put("sendMobile", waybillData.getOrDefault("senderPhone", ""));
|
||||
orderMap.put("sendCompany", waybillData.getOrDefault("senderCompany", ""));
|
||||
orderMap.put("sendAddress", waybillData.getOrDefault("senderAddress", ""));
|
||||
orderMap.put("senderProvince", waybillData.getOrDefault("senderProvince", ""));
|
||||
orderMap.put("senderCity", waybillData.getOrDefault("senderCity", ""));
|
||||
|
||||
// 包裹信息 - 子单每件都是1件,其他数据从waybillData获取
|
||||
orderMap.put("parcelQty", "1");
|
||||
orderMap.put("billWeight", waybillData.getOrDefault("actualWeight", ""));
|
||||
orderMap.put("totalVolume", waybillData.getOrDefault("volume", ""));
|
||||
orderMap.put("volumeWeight", waybillData.getOrDefault("volumeWeight", ""));
|
||||
orderMap.put("settlementWeight", waybillData.getOrDefault("settlementWeight", ""));
|
||||
orderMap.put("freight", waybillData.getOrDefault("freight", ""));
|
||||
orderMap.put("paymentType", waybillData.getOrDefault("paymentType", ""));
|
||||
orderMap.put("packType", waybillData.getOrDefault("packType", ""));
|
||||
orderMap.put("goodsInfo", waybillData.getOrDefault("goodsInfo", ""));
|
||||
|
||||
// 备注信息 - 从waybillData获取
|
||||
orderMap.put("remark", waybillData.getOrDefault("remark", ""));
|
||||
|
||||
// 服务类型字段 - 从waybillData获取,用于在寄件信息上面空白区域显示
|
||||
orderMap.put("transLine", waybillData.getOrDefault("serviceType1", ""));
|
||||
orderMap.put("productType", waybillData.getOrDefault("serviceType2", ""));
|
||||
|
||||
// 目的地信息 - 从waybillData获取
|
||||
orderMap.put("destinationCountry", waybillData.getOrDefault("destinationCountry", ""));
|
||||
orderMap.put("destinationCity", waybillData.getOrDefault("destinationCity", ""));
|
||||
|
||||
// 生成PDF
|
||||
String fileId = IdUtil.fastUUID();
|
||||
String fileUploadDir = PayConfig.getUploadPath() + File.separator + DateUtils.datePath();
|
||||
|
||||
File saveDir = new File(fileUploadDir);
|
||||
if (!saveDir.exists()) {
|
||||
saveDir.mkdirs();
|
||||
}
|
||||
|
||||
String saveFileName = fileUploadDir + File.separator + fileId + ".pdf";
|
||||
|
||||
try (FileOutputStream os = new FileOutputStream(saveFileName)) {
|
||||
IXddTplPrint tplPrint = new TanexPdfPrinter();
|
||||
// 使用TAN-CM-130-NEW模板
|
||||
tplPrint.genPDF(orderMap, "TAN-EXTERNAL", "", os);
|
||||
}
|
||||
|
||||
// 上传文件并获取URL
|
||||
SysFileInfo sysFileInfo = sysFileInfoService.ossUploadLocalFile(saveFileName,
|
||||
subLogisticNo + "-sub-waybill.pdf",
|
||||
"子单面单PDF");
|
||||
|
||||
// 删除本地文件
|
||||
new File(saveFileName).delete();
|
||||
|
||||
return sysFileInfo.getFileRemoteUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一保存外部运单PDF信息
|
||||
*/
|
||||
private void saveWaybillExternalPdf(Map<String, Object> waybillData, String mainLogisticNo, String totalPdfUrl) {
|
||||
try {
|
||||
String customerName = (String) waybillData.getOrDefault("customerName", "");
|
||||
String custNo = (String) waybillData.getOrDefault("custNo", "");
|
||||
String orderSn = (String) waybillData.getOrDefault("orderSn", "");
|
||||
String custOrderId = (String) waybillData.getOrDefault("custOrderId", "");
|
||||
|
||||
emisWaybillExternalService.saveWaybillExternalPdf(
|
||||
customerName, custNo, mainLogisticNo, totalPdfUrl, orderSn, custOrderId, "");
|
||||
} catch (Exception e) {
|
||||
// 记录日志但不影响主流程
|
||||
log.error("保存外部运单PDF信息失败: " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String appId = "APP17490075851304001";
|
||||
String appKey = "sDAbUqxjsWCbHGJlEi0bL3OXgB9SoyK4";
|
||||
String orderBase64Data = "ewogICJsb2dpc3RpY05vIjogIlQ3MDgwMzAwMDk2MzA4IiwKICAidHJhbnNMaW5lIjogIuafrOWflOWvqOmZhui/kCIsCiAgInByb2R1Y3RUeXBlIjogIumZhui/kOeJueaDoOi+viIsCiAgImN1c3RvbXNDbGVhciI6ICIzIiwKICAiY3VzdG9tc0VjbGFyYXRpb24iOiAiMyIsCiAgInBpY2t1cE1ldGhvZCI6ICIyIiwKICAiZGlzcGF0Y2hNZXRob2QiOiAiMSIsCiAgInBhY2tUeXBlIjogIjIiLAogICJwYXltZW50VHlwZSI6ICIyIiwKICAiY291bnRyeSI6ICLmn6zln5Tlr6giLAogICJwcm92aW5jZSI6ICLph5HovrkiLAogICJjb25zaWduZWUiOiAi5Y2O5LiwIiwKICAidGVsIjogIjA5Nzc1NzAyNzUiLAogICJhZGRyZXNzIjogIllhbnFpbmcgSW5kdXN0cmlhbCBQYXJrIElJSSwgS20uMzQgUm9hZCAjNCBTYW5na3JvcyBjaGVhdCB2aWxsYWdlLCBUcmFwZWFuZyBLb25nIGNvbW11bmUsIFNhbXJhb25nIFRvbmcgZGlzdHJpY3QgS2FtcG9uZyBTcGV1IHByb3ZpbmNlLENhbWJvZGlhIiwKICAicG9zdENvZGUiOiAiIiwKICAic2VuZGVyIjogIum7hOWTjeaDoDEiLAogICJzZW5kZXJDb3VudHJ5IjogIuS4reWbvSIsCiAgInNlbmRlclByb3ZpbmNlIjogIuWuieW+veecgSIsCiAgInNlbmRlclRlbCI6ICIxMjM0NTYiLAogICJzZW5kZXJBZGRyZXNzIjogIuaxn+iLj+ecgeW8oOWutua4r+W4guS6uuawkei3rzEyNeWPt+WbveazsOaWsOS4lue6quW5v+WcujI35qW8MSIsCiAgInBhcmNlbFF0eSI6IDEsCiAgIndlaWdodCI6IDEwMDAsCiAgImdvb2RzSW5mbyI6ICLpnaLovoXmlpkiCn0=";
|
||||
String securityKey = "M7SGAUenMSkYfBZR8t9FQjwqwbZCDaGY";
|
||||
String appId = "APP17585924144573479";
|
||||
String appKey = "q1HrN1J8K8VkHnnbDHXN56ZzNJenOTQ2";
|
||||
String orderBase64Data = "W3sKICAib3JkZXJObyI6ICIxOTIxMDMwNzI3Njc2MTk4OTEyIiwKICAidHJhbnNMaW5lIjogIuafrOWflOWvqOmZhui/kCIsCiAgInByb2R1Y3RUeXBlIjogIumZhui/kOeJueaDoOi+viIsCiAgImN1c3RvbXNDbGVhciI6ICIzIiwKICAiY3VzdG9tc0VjbGFyYXRpb24iOiAiMyIsCiAgInBpY2t1cE1ldGhvZCI6ICIxIiwKICAiZGlzcGF0Y2hNZXRob2QiOiAiMSIsCiAgInBhY2tUeXBlIjogIjIiLAogICJwYXltZW50VHlwZSI6ICIyIiwKICAiY3VzdE5vIjogIlRMWjA1MTIzMDE2IiwKICAic2FsZW1lbiI6ICLnlLDlsI/ovokiLAogICJjb3VudHJ5IjogIuafrOWflOWvqCIsCiAgInByb3ZpbmNlIjogIumHkei+uSIsCiAgImNpdHkiOiAiIiwKICAiZGlzdHJpY3QiOiAiIiwKICAiY29uc2lnbmVlIjogIuWNjuS4sCIsCiAgImNvbXBhbnkiOiAi5Y2O5LiwU09LIEhVT04iLAogICJ0ZWwiOiAiMDk3NzU3MDI3NSIsCiAgImFkZHJlc3MiOiAiWWFucWluZyBJbmR1c3RyaWFsIFBhcmsgSUlJLCBLbS4zNCBSb2FkICM0IFNhbmdrcm9zIGNoZWF0IHZpbGxhZ2UsIFRyYXBlYW5nIEtvbmcgY29tbXVuZSwgU2FtcmFvbmcgVG9uZyBkaXN0cmljdCBLYW1wb25nIFNwZXUgcHJvdmluY2UsQ2FtYm9kaWEiLAogICJwb3N0Q29kZSI6ICIiLAogICJzZW5kZXIiOiAi6buE5ZON5oOgIiwKICAic2VuZGVyQ291bnRyeSI6ICLkuK3lm70iLAogICJzZW5kZXJQcm92aW5jZSI6ICLmsZ/oi4/nnIEiLAogICJzZW5kZXJDaXR5IjogIuWNl+S6rOW4giIsCiAgInNlbmRlckRpc3RyaWN0IjogIiIsCiAgInNlbmRlckNvbXBhbnkiOiAi5rGf6IuP5Zu95rOw5Lq/6L6+5a6e5Lia5pyJ6ZmQ5YWs5Y+4IiwKICAic2VuZGVyVGVsIjogIjEzOTIxOTYxODYzIiwKICAic2VuZGVyQWRkcmVzcyI6ICLmsZ/oi4/nnIHlvKDlrrbmuK/luILkurrmsJHot68xMjXlj7flm73ms7DmlrDkuJbnuqrlub/lnLoyN+alvCIsCiAgImJhdGNoTnVtYmVyIjogIiIsCiAgInBhcmNlbFF0eSI6IDMsCiAgIndlaWdodCI6IDEsCiAgInZvbHVtZSI6IDEwLAogICJnb29kc0luZm8iOiAi6Z2i6L6F5paZIiwKICAiZ29vZHMiOiAiW3sgXCJpdGVtTm9cIjpcIjFcIiwgXCJuYW1lXCI6XCIyXCIsIFwiYnJhbmRcIjpcIjNcIiwgXCJtb2RlbFwiOlwiMVwiLCBcImJhcmNvZGVcIjpcIjFcIiwgXCJoc2NvZGVcIjpcIjFcIiwgXCJxdHlcIjpcIjNcIiwgXCJwcmljZVwiOjEwMCwgXCJ1bml0XCI6MSwgXCJuZXRXZWlnaHRcIjoyLCBcImdyb3NzV2VpZ2h0XCI6MywgXCJ0ZXh0dXJlXCI6XCI0XCIsIFwicHVycG9zZVwiOlwiNVwiLCBcIm5hdGl2ZUNvdW50cnlcIjpcIjZcIiB9XSIsCiAgInJlbWFyayI6ICLlk4jlk4jlk4jlk4giCn1d";
|
||||
String securityKey = "Bw8po8iLH1bPfelWYPTN4DqPhTgIDMzb";
|
||||
String signStr = appId + appKey + orderBase64Data + securityKey;
|
||||
String generatedSign = DigestUtils.md5Hex(signStr);
|
||||
System.out.println(generatedSign);
|
||||
|
||||
@ -0,0 +1,157 @@
|
||||
package com.xdadan.erp.emis.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xdadan.erp.common.annotation.Excel;
|
||||
import com.xdadan.erp.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 外部运单对象 emis_waybill_external
|
||||
*
|
||||
* @author system
|
||||
* @date 2024-12-19
|
||||
*/
|
||||
public class EmisWaybillExternal extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户名称 */
|
||||
@Excel(name = "客户名称")
|
||||
private String customerName;
|
||||
|
||||
/** 客户编号 */
|
||||
@Excel(name = "客户编号")
|
||||
private String custNo;
|
||||
|
||||
/** 运单号 */
|
||||
@Excel(name = "运单号")
|
||||
private String billCode;
|
||||
|
||||
/** PDF文件URL */
|
||||
@Excel(name = "PDF文件URL")
|
||||
private String pdfUrl;
|
||||
|
||||
/** 订单号 */
|
||||
@Excel(name = "订单号")
|
||||
private String orderSn;
|
||||
|
||||
/** 客户订单ID */
|
||||
@Excel(name = "客户订单ID")
|
||||
private String custOrderId;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 创建网点 */
|
||||
@Excel(name = "创建网点")
|
||||
private String createSite;
|
||||
|
||||
/** 更新网点 */
|
||||
@Excel(name = "更新网点")
|
||||
private String updateSite;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName) {
|
||||
this.customerName = customerName;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return customerName;
|
||||
}
|
||||
|
||||
public void setCustNo(String custNo) {
|
||||
this.custNo = custNo;
|
||||
}
|
||||
|
||||
public String getCustNo() {
|
||||
return custNo;
|
||||
}
|
||||
|
||||
public void setBillCode(String billCode) {
|
||||
this.billCode = billCode;
|
||||
}
|
||||
|
||||
public String getBillCode() {
|
||||
return billCode;
|
||||
}
|
||||
|
||||
public void setPdfUrl(String pdfUrl) {
|
||||
this.pdfUrl = pdfUrl;
|
||||
}
|
||||
|
||||
public String getPdfUrl() {
|
||||
return pdfUrl;
|
||||
}
|
||||
|
||||
public void setOrderSn(String orderSn) {
|
||||
this.orderSn = orderSn;
|
||||
}
|
||||
|
||||
public String getOrderSn() {
|
||||
return orderSn;
|
||||
}
|
||||
|
||||
public void setCustOrderId(String custOrderId) {
|
||||
this.custOrderId = custOrderId;
|
||||
}
|
||||
|
||||
public String getCustOrderId() {
|
||||
return custOrderId;
|
||||
}
|
||||
|
||||
public void setDelFlag(String delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
public String getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setCreateSite(String createSite) {
|
||||
this.createSite = createSite;
|
||||
}
|
||||
|
||||
public String getCreateSite() {
|
||||
return createSite;
|
||||
}
|
||||
|
||||
public void setUpdateSite(String updateSite) {
|
||||
this.updateSite = updateSite;
|
||||
}
|
||||
|
||||
public String getUpdateSite() {
|
||||
return updateSite;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("customerName", getCustomerName())
|
||||
.append("custNo", getCustNo())
|
||||
.append("billCode", getBillCode())
|
||||
.append("pdfUrl", getPdfUrl())
|
||||
.append("orderSn", getOrderSn())
|
||||
.append("custOrderId", getCustOrderId())
|
||||
.append("delFlag", getDelFlag())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createSite", getCreateSite())
|
||||
.append("updateSite", getUpdateSite())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.xdadan.erp.emis.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillExternal;
|
||||
|
||||
/**
|
||||
* 外部运单Mapper接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2024-12-19
|
||||
*/
|
||||
public interface EmisWaybillExternalMapper {
|
||||
/**
|
||||
* 查询外部运单
|
||||
*
|
||||
* @param id 外部运单主键
|
||||
* @return 外部运单
|
||||
*/
|
||||
public EmisWaybillExternal selectEmisWaybillExternalById(Long id);
|
||||
|
||||
/**
|
||||
* 查询外部运单列表
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 外部运单集合
|
||||
*/
|
||||
public List<EmisWaybillExternal> selectEmisWaybillExternalList(EmisWaybillExternal emisWaybillExternal);
|
||||
|
||||
/**
|
||||
* 新增外部运单
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisWaybillExternal(EmisWaybillExternal emisWaybillExternal);
|
||||
|
||||
/**
|
||||
* 修改外部运单
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmisWaybillExternal(EmisWaybillExternal emisWaybillExternal);
|
||||
|
||||
/**
|
||||
* 删除外部运单
|
||||
*
|
||||
* @param id 外部运单主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisWaybillExternalById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除外部运单
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisWaybillExternalByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据运单号查询外部运单
|
||||
*
|
||||
* @param billCode 运单号
|
||||
* @return 外部运单
|
||||
*/
|
||||
public EmisWaybillExternal selectEmisWaybillExternalByBillCode(String billCode);
|
||||
|
||||
/**
|
||||
* 根据客户订单ID查询外部运单
|
||||
*
|
||||
* @param custOrderId 客户订单ID
|
||||
* @return 外部运单
|
||||
*/
|
||||
public EmisWaybillExternal selectEmisWaybillExternalByCustOrderId(String custOrderId);
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.xdadan.erp.emis.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillExternal;
|
||||
|
||||
/**
|
||||
* 外部运单Service接口
|
||||
*
|
||||
* @author system
|
||||
* @date 2024-12-19
|
||||
*/
|
||||
public interface IEmisWaybillExternalService {
|
||||
/**
|
||||
* 查询外部运单
|
||||
*
|
||||
* @param id 外部运单主键
|
||||
* @return 外部运单
|
||||
*/
|
||||
public EmisWaybillExternal selectEmisWaybillExternalById(Long id);
|
||||
|
||||
/**
|
||||
* 查询外部运单列表
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 外部运单集合
|
||||
*/
|
||||
public List<EmisWaybillExternal> selectEmisWaybillExternalList(EmisWaybillExternal emisWaybillExternal);
|
||||
|
||||
/**
|
||||
* 新增外部运单
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertEmisWaybillExternal(EmisWaybillExternal emisWaybillExternal);
|
||||
|
||||
/**
|
||||
* 修改外部运单
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateEmisWaybillExternal(EmisWaybillExternal emisWaybillExternal);
|
||||
|
||||
/**
|
||||
* 批量删除外部运单
|
||||
*
|
||||
* @param ids 需要删除的外部运单主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisWaybillExternalByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除外部运单信息
|
||||
*
|
||||
* @param id 外部运单主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteEmisWaybillExternalById(Long id);
|
||||
|
||||
/**
|
||||
* 根据运单号查询外部运单
|
||||
*
|
||||
* @param billCode 运单号
|
||||
* @return 外部运单
|
||||
*/
|
||||
public EmisWaybillExternal selectEmisWaybillExternalByBillCode(String billCode);
|
||||
|
||||
/**
|
||||
* 根据客户订单ID查询外部运单
|
||||
*
|
||||
* @param custOrderId 客户订单ID
|
||||
* @return 外部运单
|
||||
*/
|
||||
public EmisWaybillExternal selectEmisWaybillExternalByCustOrderId(String custOrderId);
|
||||
|
||||
/**
|
||||
* 保存外部运单PDF信息
|
||||
*
|
||||
* @param customerName 客户名称
|
||||
* @param custNo 客户编号
|
||||
* @param billCode 运单号
|
||||
* @param pdfUrl PDF文件URL
|
||||
* @param orderSn 订单号
|
||||
* @param custOrderId 客户订单ID
|
||||
* @param createSite 创建网点
|
||||
* @return 结果
|
||||
*/
|
||||
public int saveWaybillExternalPdf(String customerName, String custNo, String billCode,
|
||||
String pdfUrl, String orderSn, String custOrderId, String createSite);
|
||||
}
|
||||
@ -0,0 +1,142 @@
|
||||
package com.xdadan.erp.emis.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.xdadan.erp.common.utils.DateUtils;
|
||||
import com.xdadan.erp.common.utils.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.xdadan.erp.emis.mapper.EmisWaybillExternalMapper;
|
||||
import com.xdadan.erp.emis.domain.EmisWaybillExternal;
|
||||
import com.xdadan.erp.emis.service.IEmisWaybillExternalService;
|
||||
|
||||
/**
|
||||
* 外部运单Service业务层处理
|
||||
*
|
||||
* @author system
|
||||
* @date 2024-12-19
|
||||
*/
|
||||
@Service
|
||||
public class EmisWaybillExternalServiceImpl implements IEmisWaybillExternalService {
|
||||
@Autowired
|
||||
private EmisWaybillExternalMapper emisWaybillExternalMapper;
|
||||
|
||||
/**
|
||||
* 查询外部运单
|
||||
*
|
||||
* @param id 外部运单主键
|
||||
* @return 外部运单
|
||||
*/
|
||||
@Override
|
||||
public EmisWaybillExternal selectEmisWaybillExternalById(Long id) {
|
||||
return emisWaybillExternalMapper.selectEmisWaybillExternalById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询外部运单列表
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 外部运单
|
||||
*/
|
||||
@Override
|
||||
public List<EmisWaybillExternal> selectEmisWaybillExternalList(EmisWaybillExternal emisWaybillExternal) {
|
||||
return emisWaybillExternalMapper.selectEmisWaybillExternalList(emisWaybillExternal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增外部运单
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertEmisWaybillExternal(EmisWaybillExternal emisWaybillExternal) {
|
||||
emisWaybillExternal.setCreateTime(DateUtils.getNowDate());
|
||||
return emisWaybillExternalMapper.insertEmisWaybillExternal(emisWaybillExternal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改外部运单
|
||||
*
|
||||
* @param emisWaybillExternal 外部运单
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateEmisWaybillExternal(EmisWaybillExternal emisWaybillExternal) {
|
||||
emisWaybillExternal.setUpdateTime(DateUtils.getNowDate());
|
||||
return emisWaybillExternalMapper.updateEmisWaybillExternal(emisWaybillExternal);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除外部运单
|
||||
*
|
||||
* @param ids 需要删除的外部运单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmisWaybillExternalByIds(Long[] ids) {
|
||||
return emisWaybillExternalMapper.deleteEmisWaybillExternalByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除外部运单信息
|
||||
*
|
||||
* @param id 外部运单主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteEmisWaybillExternalById(Long id) {
|
||||
return emisWaybillExternalMapper.deleteEmisWaybillExternalById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据运单号查询外部运单
|
||||
*
|
||||
* @param billCode 运单号
|
||||
* @return 外部运单
|
||||
*/
|
||||
@Override
|
||||
public EmisWaybillExternal selectEmisWaybillExternalByBillCode(String billCode) {
|
||||
return emisWaybillExternalMapper.selectEmisWaybillExternalByBillCode(billCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据客户订单ID查询外部运单
|
||||
*
|
||||
* @param custOrderId 客户订单ID
|
||||
* @return 外部运单
|
||||
*/
|
||||
@Override
|
||||
public EmisWaybillExternal selectEmisWaybillExternalByCustOrderId(String custOrderId) {
|
||||
return emisWaybillExternalMapper.selectEmisWaybillExternalByCustOrderId(custOrderId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存外部运单PDF信息
|
||||
*
|
||||
* @param customerName 客户名称
|
||||
* @param custNo 客户编号
|
||||
* @param billCode 运单号
|
||||
* @param pdfUrl PDF文件URL
|
||||
* @param orderSn 订单号
|
||||
* @param custOrderId 客户订单ID
|
||||
* @param createSite 创建网点
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int saveWaybillExternalPdf(String customerName, String custNo, String billCode,
|
||||
String pdfUrl, String orderSn, String custOrderId, String createSite) {
|
||||
EmisWaybillExternal waybillExternal = new EmisWaybillExternal();
|
||||
waybillExternal.setCustomerName(customerName);
|
||||
waybillExternal.setCustNo(custNo);
|
||||
waybillExternal.setBillCode(billCode);
|
||||
waybillExternal.setPdfUrl(pdfUrl);
|
||||
waybillExternal.setOrderSn(orderSn);
|
||||
waybillExternal.setCustOrderId(custOrderId);
|
||||
waybillExternal.setDelFlag("0");
|
||||
waybillExternal.setCreateBy("system");
|
||||
waybillExternal.setCreateSite(createSite);
|
||||
waybillExternal.setUpdateSite(createSite);
|
||||
|
||||
return insertEmisWaybillExternal(waybillExternal);
|
||||
}
|
||||
}
|
||||
@ -4969,9 +4969,9 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
waybill.setPackType(packType);
|
||||
// 支付方式 1:现金,2:月结,3:到付,4:到付月结,5:第三方月结,6:其他
|
||||
waybill.setPaymentType(paymentType);
|
||||
// if(StringUtil.isBlank(custNo)){
|
||||
//
|
||||
// }
|
||||
// if(StringUtil.isBlank(custNo)){
|
||||
//
|
||||
// }
|
||||
waybill.setCustNo(custNo);
|
||||
waybill.setReceiveCountry(country);
|
||||
waybill.setReceiveProvince(province);
|
||||
@ -4994,14 +4994,14 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
waybill.setSendSiteCode(emisCustomerSign.getOwnerSite());
|
||||
waybill.setParcelQty(Integer.valueOf(parcelQty));
|
||||
waybill.setBillWeight(new BigDecimal(weight));
|
||||
if(volume!=null){
|
||||
if (volume != null) {
|
||||
waybill.setTotalVolume(new BigDecimal(volume));
|
||||
}
|
||||
waybill.setGoodsInfo(goodsInfo);
|
||||
waybill.setRemark(remark);
|
||||
|
||||
// 处理goods信息
|
||||
List<EmisWaybillDeclareGoods> declareGoodsList =new ArrayList<>();
|
||||
List<EmisWaybillDeclareGoods> declareGoodsList = new ArrayList<>();
|
||||
if (StringUtils.isNotEmpty(goodsStr)) {
|
||||
JSONArray goodsArray = JSON.parseArray(goodsStr);
|
||||
if (CollectionUtil.isNotEmpty(goodsArray)) {
|
||||
@ -5039,6 +5039,12 @@ public class EmisWaybillServiceImpl extends EmisBaseService implements IEmisWayb
|
||||
}
|
||||
|
||||
result.put("result", resultList);
|
||||
// 添加客户信息到返回结果中
|
||||
if (emisCustomerSign != null) {
|
||||
result.put("customerName", emisCustomerSign.getCustName());
|
||||
result.put("custNo", emisCustomerSign.getCustNo());
|
||||
result.put("createSite", emisCustomerSign.getOwnerSite());
|
||||
}
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -529,6 +529,167 @@ public class ItemHelper {
|
||||
return printItems;
|
||||
}
|
||||
|
||||
// TAN-EXTERNAL 外部接口面单模板 - 根据图1预期效果设计
|
||||
public static ArrayList<ItemCell> gen_external(Map<String, Object> orderMap) {
|
||||
ArrayList<ItemCell> printItems = new ArrayList<>();
|
||||
|
||||
String extData = MapUtils.getString(orderMap, "extData", "");
|
||||
if (!StringUtils.isEmpty(extData)) {
|
||||
try {
|
||||
Map mapExtData = JSON.parseObject(extData, Map.class);
|
||||
orderMap.putAll(mapExtData);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
}
|
||||
|
||||
// 1. 公司Logo和基本信息
|
||||
printItems.add(new ItemCell("companyLogo", "TANEXPRESS", 16, true, Element.ALIGN_LEFT, "Text"));
|
||||
printItems.add(new ItemCell("companyName", "探路速运", 12, true, Element.ALIGN_LEFT, "Text"));
|
||||
printItems.add(new ItemCell("companyFullName", "TANEX Co.,Ltd", 10, true, Element.ALIGN_LEFT, "Text"));
|
||||
printItems.add(new ItemCell("companyTel", "TEL:400-025-7080", 8, true, Element.ALIGN_LEFT, "Text"));
|
||||
printItems.add(new ItemCell("companyWebsite", "www.tanex56.com", 8, true, Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 2. 目的地信息
|
||||
printItems.add(new ItemCell("destinationCountry", MapUtils.getString(orderMap, "destinationCountry", ""), 16,
|
||||
true, Element.ALIGN_RIGHT, "Text"));
|
||||
printItems.add(new ItemCell("destinationCity", MapUtils.getString(orderMap, "destinationCity", ""), 16, true,
|
||||
Element.ALIGN_RIGHT, "Text"));
|
||||
|
||||
// 3. 寄件日期
|
||||
printItems.add(new ItemCell("orderTimeLabel", "订单时间", 8, true, Element.ALIGN_LEFT, "Text"));
|
||||
printItems.add(new ItemCell("orderTime", MapUtils.getString(orderMap, "orderTime", ""), 8, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 4. 条形码和运单号
|
||||
// 判断是主单还是子单,添加相应的标签
|
||||
String logisticNo = MapUtils.getString(orderMap, "logisticNo", "");
|
||||
String logisticNoStr ="";
|
||||
|
||||
// 检查是否是子单(子单号通常以主单号+序号结尾)
|
||||
if (logisticNo.length() > 14 && logisticNo.matches(".*\\d{4}$")) {
|
||||
logisticNoStr = "子单号" + logisticNo;
|
||||
// 子单二维码使用主单运单号(去掉最后4位序号)
|
||||
String mainLogisticNo = logisticNo.substring(0, logisticNo.length() - 4);
|
||||
printItems.add(new ItemCell("barcodeImg1", mainLogisticNo, 1, true, "BarCode"));
|
||||
} else {
|
||||
logisticNoStr = "主单号" + logisticNo;
|
||||
// 主单二维码使用自己的运单号
|
||||
printItems.add(new ItemCell("barcodeImg1", logisticNo, 1, true, "BarCode"));
|
||||
}
|
||||
|
||||
printItems.add(new ItemCell("logisticNo", logisticNoStr, 9, true,
|
||||
Element.ALIGN_CENTER, "Text"));
|
||||
|
||||
// 5. 寄件人省市信息 - 参考gen_tancm130,使用k2和k3字段名
|
||||
String senderCity = MapUtils.getString(orderMap, "senderCity", "");
|
||||
String senderProvince = MapUtils.getString(orderMap, "senderProvince", "");
|
||||
String k2Value = StringUtils.isNotEmpty(senderCity) ? senderCity : senderProvince;
|
||||
System.out.println("DEBUG gen_external - k2Value (sender): " + k2Value);
|
||||
printItems.add(new ItemCell("k10", k2Value, 10, true, Element.ALIGN_RIGHT, "Text"));
|
||||
|
||||
String consigneeCity = MapUtils.getString(orderMap, "consigneeCity", "");
|
||||
String consigneeProvince = MapUtils.getString(orderMap, "consigneeProvince", "");
|
||||
String k3Value = StringUtils.isNotEmpty(consigneeCity) ? consigneeCity : consigneeProvince;
|
||||
System.out.println("DEBUG gen_external - k3Value (consignee): " + k3Value);
|
||||
printItems.add(new ItemCell("k11", k3Value, 10, true, Element.ALIGN_RIGHT, "Text"));
|
||||
|
||||
// 6. 寄件人信息 - 参考gen_tancm130,使用sender字段名
|
||||
String senderName = MapUtils.getString(orderMap, "sendPerson", "");
|
||||
String senderPhone = MapUtils.getString(orderMap, "sendMobile", "");
|
||||
String senderInfo = senderName + (StringUtils.isNotEmpty(senderPhone) ? " " + senderPhone : "");
|
||||
printItems.add(new ItemCell("sender", senderInfo, 8, true, Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 7. 收件人信息 - 参考gen_tancm130,使用consignee字段名
|
||||
String consigneeName = MapUtils.getString(orderMap, "consignee", "");
|
||||
String consigneePhone = MapUtils.getString(orderMap, "mobile", "");
|
||||
String consigneeInfo = consigneeName + (StringUtils.isNotEmpty(consigneePhone) ? " " + consigneePhone : "");
|
||||
System.out.println(
|
||||
"DEBUG gen_external - consigneeName: " + consigneeName + ", consigneePhone: " + consigneePhone);
|
||||
printItems.add(new ItemCell("consignee", consigneeInfo, 8, true, Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 7.1. 收件人地址和公司 - 参考gen_tancm130
|
||||
printItems.add(new ItemCell("address", MapUtils.getString(orderMap, "address", ""), 8, true, Element.ALIGN_LEFT,
|
||||
"Text"));
|
||||
printItems.add(new ItemCell("company", MapUtils.getString(orderMap, "company", ""), 8, true, Element.ALIGN_LEFT,
|
||||
"Text"));
|
||||
|
||||
// 7.2. 寄件人公司地址 - 参考gen_tancm130
|
||||
printItems.add(new ItemCell("sendCompany", MapUtils.getString(orderMap, "sendCompany", ""), 8, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
printItems.add(new ItemCell("sendAddress", MapUtils.getString(orderMap, "sendAddress", ""), 8, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 8. 线路和产品类型 - 参考gen_tancm130,使用k10和k11字段名
|
||||
String transLineValue = MapUtils.getString(orderMap, "transLine", "");
|
||||
String productTypeValue = MapUtils.getString(orderMap, "productType", "");
|
||||
System.out.println("DEBUG gen_external - transLine: " + transLineValue + ", productType: " + productTypeValue);
|
||||
printItems.add(new ItemCell("k2", transLineValue, 10, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
printItems.add(new ItemCell("k3", productTypeValue, 10, true,
|
||||
Element.ALIGN_RIGHT, "Text"));
|
||||
|
||||
// 9. 包裹信息 - 参考gen_tancm130的字段命名和格式
|
||||
String parcelQty = MapUtils.getString(orderMap, "parcelQty", "");
|
||||
printItems.add(new ItemCell("parcelQty", "件数:" + parcelQty, 10, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
String actualWeight = MapUtils.getString(orderMap, "billWeight", "");
|
||||
printItems.add(new ItemCell("billWeight", "实际重量:" + actualWeight + "kg", 10, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
String volume = MapUtils.getString(orderMap, "totalVolume", "");
|
||||
printItems.add(new ItemCell("totalVolume", "体积:" + volume + "m3", 10, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
String goodsInfo = MapUtils.getString(orderMap, "goodsInfo", "");
|
||||
printItems.add(new ItemCell("freight", "品名:" + goodsInfo, 10, true,
|
||||
Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// // 10. 其他包裹信息 - 参考gen_tancm130
|
||||
// String volumeWeight = MapUtils.getString(orderMap, "volumeWeight", "");
|
||||
// printItems
|
||||
// .add(new ItemCell("volumeWeight", "体积重量:" + volumeWeight + "kg", 7, true,
|
||||
// Element.ALIGN_LEFT, "Text"));
|
||||
//
|
||||
// String settlementWeight = MapUtils.getString(orderMap, "settlementWeight",
|
||||
// "");
|
||||
// printItems.add(new ItemCell("settlementWeight", "结算重量:" + settlementWeight +
|
||||
// "kg", 7, true, Element.ALIGN_LEFT,
|
||||
// "Text"));
|
||||
//
|
||||
// String freight = MapUtils.getString(orderMap, "freight", "");
|
||||
// printItems.add(new ItemCell("freight", "运费:" + freight, 7, true,
|
||||
// Element.ALIGN_LEFT, "Text"));
|
||||
//
|
||||
// String paymentType = MapUtils.getString(orderMap, "paymentType", "");
|
||||
// printItems.add(new ItemCell("paymentType", "支付方式:" + paymentType, 7, true,
|
||||
// Element.ALIGN_LEFT, "Text"));
|
||||
//
|
||||
// String packType = MapUtils.getString(orderMap, "packType", "");
|
||||
// printItems.add(new ItemCell("packType", "包装类型:" + packType, 7, true,
|
||||
// Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 11. 备注 - 参考gen_tancm130的格式
|
||||
String remarkValue = MapUtils.getString(orderMap, "remark", "");
|
||||
String feeRemarkValue = MapUtils.getString(orderMap, "feeRemark", "");
|
||||
String remark = "订单备注:" + remarkValue + feeRemarkValue;
|
||||
System.out.println("DEBUG gen_external - remark: " + remark);
|
||||
printItems.add(new ItemCell("remark", remark, 6, true, Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 12. 打印信息 - 参考gen_tancm130
|
||||
// String printInfo = "打印信息:" + MapUtils.getString(orderMap, "printDate", "")
|
||||
// + "/" + MapUtils.getString(orderMap, "printMan", "")
|
||||
// + "/" + MapUtils.getString(orderMap, "printCount", "");
|
||||
// printItems.add(new ItemCell("printInfo", printInfo, 7, true,
|
||||
// Element.ALIGN_LEFT, "Text"));
|
||||
|
||||
// 13. 寄件日期 - 参考gen_tancm130
|
||||
printItems.add(new ItemCell("sendDate", MapUtils.getString(orderMap, "sendDate", ""), 8, true,
|
||||
Element.ALIGN_CENTER, "Text"));
|
||||
|
||||
return printItems;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -38,9 +38,10 @@ public class TanexPdfPrinter extends XddBasePrint {
|
||||
}
|
||||
else if("TAN-GOT-130".equals(tplCode)){
|
||||
return ItemHelper.gen_tangot130(orderMap);
|
||||
}
|
||||
else if("TAN-CM-130".equals(tplCode)){
|
||||
} else if ("TAN-CM-130".equals(tplCode)) {
|
||||
return ItemHelper.gen_tancm130(orderMap);
|
||||
} else if ("TAN-EXTERNAL".equals(tplCode)) {
|
||||
return ItemHelper.gen_external(orderMap);
|
||||
}
|
||||
else if("TAN-GM-130".equals(tplCode)){
|
||||
return ItemHelper.gen_tangm130(orderMap);
|
||||
|
||||
122
emis-biz/src/main/resources/mapper/EmisWaybillExternalMapper.xml
Normal file
122
emis-biz/src/main/resources/mapper/EmisWaybillExternalMapper.xml
Normal file
@ -0,0 +1,122 @@
|
||||
<?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.xdadan.erp.emis.mapper.EmisWaybillExternalMapper">
|
||||
|
||||
<resultMap type="EmisWaybillExternal" id="EmisWaybillExternalResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="customerName" column="customer_name" />
|
||||
<result property="custNo" column="cust_no" />
|
||||
<result property="billCode" column="bill_code" />
|
||||
<result property="pdfUrl" column="pdf_url" />
|
||||
<result property="orderSn" column="order_sn" />
|
||||
<result property="custOrderId" column="cust_order_id" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createSite" column="create_site" />
|
||||
<result property="updateSite" column="update_site" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectEmisWaybillExternalVo">
|
||||
select id, customer_name, cust_no, bill_code, pdf_url, order_sn, cust_order_id, del_flag, create_by, create_time, update_by, update_time, create_site, update_site from emis_waybill_external
|
||||
</sql>
|
||||
|
||||
<select id="selectEmisWaybillExternalList" parameterType="EmisWaybillExternal" resultMap="EmisWaybillExternalResult">
|
||||
<include refid="selectEmisWaybillExternalVo"/>
|
||||
<where>
|
||||
<if test="customerName != null and customerName != ''"> and customer_name like concat('%', #{customerName}, '%')</if>
|
||||
<if test="custNo != null and custNo != ''"> and cust_no = #{custNo}</if>
|
||||
<if test="billCode != null and billCode != ''"> and bill_code = #{billCode}</if>
|
||||
<if test="pdfUrl != null and pdfUrl != ''"> and pdf_url = #{pdfUrl}</if>
|
||||
<if test="orderSn != null and orderSn != ''"> and order_sn = #{orderSn}</if>
|
||||
<if test="custOrderId != null and custOrderId != ''"> and cust_order_id = #{custOrderId}</if>
|
||||
<if test="delFlag != null and delFlag != ''"> and del_flag = #{delFlag}</if>
|
||||
<if test="createSite != null and createSite != ''"> and create_site = #{createSite}</if>
|
||||
<if test="updateSite != null and updateSite != ''"> and update_site = #{updateSite}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillExternalById" parameterType="Long" resultMap="EmisWaybillExternalResult">
|
||||
<include refid="selectEmisWaybillExternalVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillExternalByBillCode" parameterType="String" resultMap="EmisWaybillExternalResult">
|
||||
<include refid="selectEmisWaybillExternalVo"/>
|
||||
where bill_code = #{billCode}
|
||||
</select>
|
||||
|
||||
<select id="selectEmisWaybillExternalByCustOrderId" parameterType="String" resultMap="EmisWaybillExternalResult">
|
||||
<include refid="selectEmisWaybillExternalVo"/>
|
||||
where cust_order_id = #{custOrderId}
|
||||
</select>
|
||||
|
||||
<insert id="insertEmisWaybillExternal" parameterType="EmisWaybillExternal" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into emis_waybill_external
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="customerName != null and customerName != ''">customer_name,</if>
|
||||
<if test="custNo != null and custNo != ''">cust_no,</if>
|
||||
<if test="billCode != null and billCode != ''">bill_code,</if>
|
||||
<if test="pdfUrl != null">pdf_url,</if>
|
||||
<if test="orderSn != null and orderSn != ''">order_sn,</if>
|
||||
<if test="custOrderId != null and custOrderId != ''">cust_order_id,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createSite != null">create_site,</if>
|
||||
<if test="updateSite != null">update_site,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="customerName != null and customerName != ''">#{customerName},</if>
|
||||
<if test="custNo != null and custNo != ''">#{custNo},</if>
|
||||
<if test="billCode != null and billCode != ''">#{billCode},</if>
|
||||
<if test="pdfUrl != null">#{pdfUrl},</if>
|
||||
<if test="orderSn != null and orderSn != ''">#{orderSn},</if>
|
||||
<if test="custOrderId != null and custOrderId != ''">#{custOrderId},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createSite != null">#{createSite},</if>
|
||||
<if test="updateSite != null">#{updateSite},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateEmisWaybillExternal" parameterType="EmisWaybillExternal">
|
||||
update emis_waybill_external
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="customerName != null and customerName != ''">customer_name = #{customerName},</if>
|
||||
<if test="custNo != null and custNo != ''">cust_no = #{custNo},</if>
|
||||
<if test="billCode != null and billCode != ''">bill_code = #{billCode},</if>
|
||||
<if test="pdfUrl != null">pdf_url = #{pdfUrl},</if>
|
||||
<if test="orderSn != null and orderSn != ''">order_sn = #{orderSn},</if>
|
||||
<if test="custOrderId != null and custOrderId != ''">cust_order_id = #{custOrderId},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createSite != null">create_site = #{createSite},</if>
|
||||
<if test="updateSite != null">update_site = #{updateSite},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteEmisWaybillExternalById" parameterType="Long">
|
||||
delete from emis_waybill_external where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEmisWaybillExternalByIds" parameterType="String">
|
||||
delete from emis_waybill_external where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
BIN
emis-biz/src/main/resources/tpl/TAN-EXTERNAL.pdf
Normal file
BIN
emis-biz/src/main/resources/tpl/TAN-EXTERNAL.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user