This commit is contained in:
van
2026-09-07 19:27:22 +08:00
parent a169a554b9
commit 3b5081ce25
11 changed files with 199 additions and 22 deletions
@@ -448,9 +448,9 @@ public class TencentDocController extends BaseController {
return AjaxResult.error("未找到订单信息");
}
// 检查是否有物流链接
if (order.getLogisticsLink() == null || order.getLogisticsLink().trim().isEmpty()) {
return AjaxResult.error("订单缺少物流链接,无法自动发货");
// 检查是否有物流链接或物流单号
if (!order.hasLogisticsInfo()) {
return AjaxResult.error("订单缺少物流链接或物流单号,无法自动发货");
}
// 上传物流信息到腾讯文档
@@ -1480,8 +1480,8 @@ public class TencentDocController extends BaseController {
continue;
}
if (order.getLogisticsLink() != null && !order.getLogisticsLink().trim().isEmpty()) {
String logisticsLink = order.getLogisticsLink().trim();
if (order.hasLogisticsInfo()) {
String logisticsLink = order.resolveLogisticsDocValue();
// 从status字段中提取手机号码
String phone = null;
@@ -1526,14 +1526,14 @@ public class TencentDocController extends BaseController {
order.getTencentDocPushed() != null && order.getTencentDocPushed() == 1 ? "是" : "否");
} else {
errorCount++;
log.warn("订单物流链接为空 - 单号: {}, 行号: {}", orderNo, excelRow);
log.warn("订单物流链接/单号为空 - 单号: {}, 行号: {}", orderNo, excelRow);
// 记录错误详情
Map<String, Object> errorLog = new java.util.HashMap<>();
errorLog.put("orderNo", orderNo);
errorLog.put("row", excelRow);
errorLog.put("errorType", "物流链接为空");
errorLog.put("errorMessage", "订单物流链接为空");
errorLog.put("errorMessage", "订单缺少物流链接或物流单号");
errorLogs.add(errorLog);
}
} catch (Exception e) {
@@ -1760,8 +1760,8 @@ public class TencentDocController extends BaseController {
log.info("✓ 先清除单元格内容 - 行: {}, 列: {}", row, logisticsLinkColumn);
}
// 1. 更新物流单号(超链接类型)
requests.add(buildUpdateCellRequest(sheetId, row - 1, logisticsLinkColumn, logisticsLink, true));
// 1. 更新物流单号(链接写超链接,纯单号写文本)
requests.add(buildUpdateCellRequest(sheetId, row - 1, logisticsLinkColumn, logisticsLink, JDOrder.isHttpUrl(logisticsLink)));
// 2. 更新"下单电话"列(如果存在且提取到了手机号码)
String phone = update.getString("phone");
@@ -59,6 +59,33 @@ public class JDOrder extends BaseEntity {
@Excel(name = "物流链接")
private String logisticsLink;
/** 物流运单号(手工填写或扫描回写;无物流链接时也可落库) */
@Excel(name = "物流单号")
private String waybillNo;
/** 腾讯文档「物流单号」列:优先链接,否则运单号 */
public String resolveLogisticsDocValue() {
if (logisticsLink != null && !logisticsLink.trim().isEmpty()) {
return logisticsLink.trim();
}
if (waybillNo != null && !waybillNo.trim().isEmpty()) {
return waybillNo.trim();
}
return null;
}
public boolean hasLogisticsInfo() {
return resolveLogisticsDocValue() != null;
}
public static boolean isHttpUrl(String value) {
if (value == null) {
return false;
}
String t = value.trim();
return t.startsWith("http://") || t.startsWith("https://");
}
/** 是否已推送到腾讯文档(0-未推送,1-已推送) */
private Integer tencentDocPushed;
@@ -46,6 +46,11 @@ public interface JDOrderMapper {
* 根据物流链接查询订单
*/
JDOrder selectJDOrderByLogisticsLink(String logisticsLink);
/**
* 根据物流运单号查询订单
*/
JDOrder selectJDOrderByWaybillNo(String waybillNo);
/**
* 根据第三方单号查询订单
@@ -43,6 +43,9 @@ public interface IJDOrderService {
/** 根据物流链接查询订单 */
JDOrder selectJDOrderByLogisticsLink(String logisticsLink);
/** 根据物流运单号查询订单 */
JDOrder selectJDOrderByWaybillNo(String waybillNo);
/** 根据第三方单号查询订单 */
JDOrder selectJDOrderByThirdPartyOrderNo(String thirdPartyOrderNo);
@@ -16,6 +16,11 @@ public interface ILogisticsService {
*/
boolean fetchLogisticsAndPush(JDOrder order);
/**
* 录单手工填写的运单号:写入 Redis 并触发闲鱼同步(无物流链接时跳过扫描抓取)。
*/
void persistManualWaybill(JDOrder order);
/**
* 分享类京东物流短链:查运单并通过 wxts 推送到指定 touser(不依赖订单表)
*/
@@ -60,6 +60,8 @@ public class InstructionServiceImpl implements IInstructionService {
@Resource
private IWeComShareLinkLogisticsJobService weComShareLinkLogisticsJobService;
@Resource
private com.ruoyi.jarvis.service.ILogisticsService logisticsService;
@Resource
private com.ruoyi.jarvis.config.TencentDocConfig tencentDocConfig;
@Resource
private com.ruoyi.common.core.redis.RedisCache redisCache;
@@ -76,7 +78,7 @@ public class InstructionServiceImpl implements IInstructionService {
private static final int EXTERNAL_LOGISTICS_LIST_LIMIT = 35;
// 录单模板(与 jd/JDUtil 中 WENAN_D 保持一致)
private static final String WENAN_D = "单:\n" + "{单号} \n" + "分销标记:{分销标记}\n" + "第三方单号:{第三方单号}\n" + "—————————\n" + "下单链接(必须用这个):\n" + "{链接}\n" + "下单地址(注意带分机):\n" + "{地址}\n" + "—————————\n" + "型号:{型号}\n" + "\n" + "下单人(需填):\n" + "\n" + "下单付款(注意核对):\n" + "\n" + "后返金额(注意核对):\n" + "\n" + "订单号(需填):\n" + "\n" + "物流链接(需填):\n" + "\n" + "备注(下单号码有变动/没法带分机号的写这里):\n" + "{单的备注}\n" + "—————————\n" + "京粉实际价格:不用填";
private static final String WENAN_D = "单:\n" + "{单号} \n" + "分销标记:{分销标记}\n" + "第三方单号:{第三方单号}\n" + "—————————\n" + "下单链接(必须用这个):\n" + "{链接}\n" + "下单地址(注意带分机):\n" + "{地址}\n" + "—————————\n" + "型号:{型号}\n" + "\n" + "下单人(需填):\n" + "\n" + "下单付款(注意核对):\n" + "\n" + "后返金额(注意核对):\n" + "\n" + "订单号(需填):\n" + "\n" + "物流链接(需填):\n" + "\n" + "物流单号(无链接时填):\n" + "\n" + "备注(下单号码有变动/没法带分机号的写这里):\n" + "{单的备注}\n" + "—————————\n" + "京粉实际价格:不用填";
@Override
public List<String> execute(String command) {
@@ -1504,6 +1506,9 @@ public class InstructionServiceImpl implements IInstructionService {
if (logistics == null && order.getLogisticsLink() != null) {
logistics = order.getLogisticsLink();
}
if (isEmpty(logistics) && !isEmpty(order.getWaybillNo())) {
logistics = order.getWaybillNo();
}
if (isEmpty(model) && isEmpty(address) && isEmpty(logistics)) {
return null;
}
@@ -1568,7 +1573,7 @@ public class InstructionServiceImpl implements IInstructionService {
if (isEmpty(order.getBuyer())) missing.append("下单人\n");
if (order.getPaymentAmount() == null || order.getPaymentAmount() == 0) missing.append("下单价格\n");
if (order.getRebateAmount() == null) missing.append("后返金额\n");
if (isEmpty(order.getLogisticsLink())) missing.append("物流链接\n");
if (isEmpty(order.getLogisticsLink()) && isEmpty(order.getWaybillNo())) missing.append("物流链接或物流单号\n");
if (isEmpty(order.getAddress())) missing.append("收货地址\n");
if (isEmpty(order.getModelNumber())) missing.append("型号\n");
if (missing.length() > 0) {
@@ -1606,6 +1611,18 @@ public class InstructionServiceImpl implements IInstructionService {
}
}
// 物流单号重复校验(控制台入口跳过)
if (!isFromConsole && !isEmpty(order.getWaybillNo())) {
JDOrder existingByWaybill = jdOrderService.selectJDOrderByWaybillNo(order.getWaybillNo());
if (existingByWaybill != null && !order.getRemark().equals(existingByWaybill.getRemark())) {
String warn = "[炸弹] [炸弹] [炸弹] 录单警告!!! \n物流单号重复!\n" +
"物流单号:" + order.getWaybillNo() + "\n" +
"已存在的订单:" + existingByWaybill.getRemark() + "\n" +
"下单时间:" + new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(existingByWaybill.getOrderTime());
return warn;
}
}
// 地址重复提示(不阻断写入,与 JDUtil 提示一致)
List<JDOrder> byAddress = jdOrderService.selectJDOrderListByAddress(order.getAddress());
if (byAddress != null && !byAddress.isEmpty()) {
@@ -1670,6 +1687,8 @@ public class InstructionServiceImpl implements IInstructionService {
}
}
persistManualWaybillIfPresent(order);
// H-TF订单触发延迟推送机制
// 录单后,重置10分钟倒计时,10分钟内无新录单则自动推送
if ("H-TF".equals(order.getDistributionMark())) {
@@ -1712,6 +1731,9 @@ public class InstructionServiceImpl implements IInstructionService {
if (logistics == null && order.getLogisticsLink() != null) {
logistics = order.getLogisticsLink();
}
if (isEmpty(logistics) && !isEmpty(order.getWaybillNo())) {
logistics = order.getWaybillNo();
}
if (!isEmpty(logistics)) {
sb.append("物流:").append(shortenLogisticsLineForReply(logistics)).append("\n");
}
@@ -1794,6 +1816,8 @@ public class InstructionServiceImpl implements IInstructionService {
sb.append("物流链接(需填):\n");
// 使用原始输入的完整物流链接,如果没有则使用数据库中的值
sb.append(originalLogisticsLink != null ? originalLogisticsLink : (order.getLogisticsLink() != null ? order.getLogisticsLink() : "")).append("\n");
sb.append("物流单号(无链接时填):\n");
sb.append(order.getWaybillNo() != null ? order.getWaybillNo() : "").append("\n");
sb.append("备注(下单号码有变动/没法带分机号的写这里):\n");
sb.append(order.getStatus() != null ? order.getStatus() : "").append("\n");
sb.append("—————————\n");
@@ -1852,8 +1876,8 @@ public class InstructionServiceImpl implements IInstructionService {
if (input == null || input.isEmpty()) {
return null;
}
// 提取"物流链接(需填):"到"备注(下单号码有变动/没法带分机号的写这里):"之间的完整内容
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("物流链接(需填):\\s*(.*?)\\s*(?=备注(下单号码有变动/没法带分机号的写这里):|\\Z)", java.util.regex.Pattern.DOTALL);
// 提取"物流链接(需填):"到「物流单号」或「备注」之间的完整内容
java.util.regex.Pattern pattern = java.util.regex.Pattern.compile("物流链接(需填):\\s*(.*?)\\s*(?=物流单号(无链接时填):|物流单号:|备注(下单号码有变动/没法带分机号的写这里):|\\Z)", java.util.regex.Pattern.DOTALL);
java.util.regex.Matcher matcher = pattern.matcher(input);
if (matcher.find()) {
String logisticsLink = matcher.group(1).trim();
@@ -2006,13 +2030,28 @@ public class InstructionServiceImpl implements IInstructionService {
order.setAddress(address);
System.out.println("地址: " + (address != null && address.length() > 50 ? address.substring(0, 50) + "..." : address));
// 物流链接(新格式)或物流链接(旧格式)
// 物流链接(新格式)或物流链接(旧格式);无 URL 时把内容当作运单号
String logisticsLink = fields.getOrDefault("物流链接(需填)", null);
if (logisticsLink == null) {
logisticsLink = fields.getOrDefault("物流链接", "");
}
order.setLogisticsLink(extractFirstUrl(logisticsLink));
System.out.println("物流链接: " + order.getLogisticsLink());
String waybillRaw = fields.getOrDefault("物流单号(无链接时填)", null);
if (waybillRaw == null) {
waybillRaw = fields.getOrDefault("物流单号", null);
}
String waybillUrl = extractFirstUrl(waybillRaw);
if (waybillUrl != null && isEmpty(order.getLogisticsLink())) {
order.setLogisticsLink(waybillUrl);
}
String waybillNo = normalizeTrackingNo(waybillRaw);
if (isEmpty(waybillNo) && isEmpty(order.getLogisticsLink())) {
waybillNo = normalizeTrackingNo(logisticsLink);
}
order.setWaybillNo(waybillNo);
System.out.println("物流单号: " + order.getWaybillNo());
// 订单号(新格式)或订单号(旧格式)
String orderId = fields.getOrDefault("订单号(需填)", null);
@@ -2065,7 +2104,13 @@ public class InstructionServiceImpl implements IInstructionService {
extractFieldWithSeparator(input, fields, "下单付款(注意核对):", "后返金额(注意核对):");
extractFieldWithSeparator(input, fields, "后返金额(注意核对):", "订单号(需填):");
extractFieldWithSeparator(input, fields, "订单号(需填):", "物流链接(需填):");
extractFieldWithSeparator(input, fields, "物流链接(需填):", "备注(下单号码有变动/没法带分机号的写这里):");
if (input.contains("物流单号(无链接时填):") || input.contains("物流单号:")) {
String waybillLabel = input.contains("物流单号(无链接时填):") ? "物流单号(无链接时填):" : "物流单号:";
extractFieldWithSeparator(input, fields, "物流链接(需填):", waybillLabel);
extractFieldWithSeparator(input, fields, waybillLabel, "备注(下单号码有变动/没法带分机号的写这里):");
} else {
extractFieldWithSeparator(input, fields, "物流链接(需填):", "备注(下单号码有变动/没法带分机号的写这里):");
}
// 手动提取"备注"字段(最后一个字段,可能后面有分隔线或"京粉实际价格")
java.util.regex.Pattern remarkPattern = java.util.regex.Pattern.compile("备注(下单号码有变动/没法带分机号的写这里):[\\s\\n]*([\\s\\S]*?)[\\s\\n]*(?=—————————|京粉实际价格|\\Z)", java.util.regex.Pattern.DOTALL);
@@ -2199,6 +2244,33 @@ public class InstructionServiceImpl implements IInstructionService {
return matcher.find() ? matcher.group(0) : null;
}
/** 非 URL 的物流单号:去空白、去掉中文标签,长度 6–64 */
private String normalizeTrackingNo(String text) {
if (text == null || text.isEmpty()) {
return null;
}
if (extractFirstUrl(text) != null) {
return null;
}
String s = text.trim().replaceAll("\\s+", "");
s = s.replaceFirst("^(物流单号|运单号|快递单号)[::]?", "");
if (s.isEmpty() || s.length() < 6 || s.length() > 64) {
return null;
}
return s;
}
private void persistManualWaybillIfPresent(JDOrder order) {
if (order == null || order.getId() == null || isEmpty(order.getWaybillNo())) {
return;
}
try {
logisticsService.persistManualWaybill(order);
} catch (Exception e) {
System.err.println("手工运单号写入 Redis 失败 - 订单ID: " + order.getId() + ", 错误: " + e.getMessage());
}
}
private String handleTransferLike(String input) {
// 前端仍复用已有 /jarvis/jdorder/generatePromotionContent 接口,这里仅提供一个回显占位
return "指令入口:请在\"一键转链\"页面使用(输入文案/链接后点生成)";
@@ -78,6 +78,11 @@ public class JDOrderServiceImpl implements IJDOrderService {
public JDOrder selectJDOrderByLogisticsLink(String logisticsLink) {
return jdOrderMapper.selectJDOrderByLogisticsLink(logisticsLink);
}
@Override
public JDOrder selectJDOrderByWaybillNo(String waybillNo) {
return jdOrderMapper.selectJDOrderByWaybillNo(waybillNo);
}
@Override
public JDOrder selectJDOrderByThirdPartyOrderNo(String thirdPartyOrderNo) {
@@ -324,6 +324,41 @@ public class LogisticsServiceImpl implements ILogisticsService {
return m.startsWith("F") || m.contains("\u95f2\u9c7c");
}
@Override
public void persistManualWaybill(JDOrder order) {
if (order == null || order.getId() == null || !StringUtils.hasText(order.getWaybillNo())) {
return;
}
Long orderId = order.getId();
String waybillNo = order.getWaybillNo().trim();
String redisKey = REDIS_WAYBILL_KEY_PREFIX + orderId;
stringRedisTemplate.opsForValue().set(redisKey, waybillNo, 30, TimeUnit.DAYS);
persistWaybillNoToOrder(orderId, waybillNo);
safeNotifyGoofishShip(orderId, waybillNo, "录单手工填写运单号;已写 Redis;随后触发闲鱼同步");
logger.info("手工运单号已固化 - 订单ID: {}, waybill_no: {}", orderId, waybillNo);
}
private void persistWaybillNoToOrder(Long orderId, String waybillNo) {
if (orderId == null || !StringUtils.hasText(waybillNo)) {
return;
}
try {
JDOrder updateOrder = jdOrderService.selectJDOrderById(orderId);
if (updateOrder == null) {
return;
}
String current = updateOrder.getWaybillNo();
if (waybillNo.trim().equals(current == null ? "" : current.trim())) {
return;
}
updateOrder.setWaybillNo(waybillNo.trim());
jdOrderService.updateJDOrder(updateOrder);
logger.info("订单运单号已回写数据库 - 订单ID: {}, waybill_no: {}", orderId, waybillNo);
} catch (Exception e) {
logger.warn("回写订单运单号失败 - 订单ID: {}, waybill_no: {}, err={}", orderId, waybillNo, e.toString());
}
}
@Override
public boolean fetchLogisticsAndPush(JDOrder order) {
if (order == null || order.getId() == null) {
@@ -357,7 +392,11 @@ public class LogisticsServiceImpl implements ILogisticsService {
// 检查物流链接
String logisticsLink = order.getLogisticsLink();
if (logisticsLink == null || logisticsLink.trim().isEmpty()) {
if (!JDOrder.isHttpUrl(logisticsLink)) {
if (StringUtils.hasText(order.getWaybillNo())) {
persistManualWaybill(order);
return true;
}
logger.info("订单暂无物流链接,跳过处理 - 订单ID: {}", orderId);
return false;
}
@@ -411,6 +450,7 @@ public class LogisticsServiceImpl implements ILogisticsService {
}
logger.info("检测到waybill_no: {} - 订单ID: {}", waybillNo, orderId);
persistWaybillNoToOrder(orderId, waybillNo);
// 标记物流链接是否更新
boolean logisticsLinkUpdated = false;
@@ -145,7 +145,7 @@ public class TencentDocServiceImpl implements ITencentDocService {
row.add(order.getOrderTime() != null ? sdf.format(order.getOrderTime()) : "");
row.add(order.getModelNumber() != null ? order.getModelNumber() : "");
row.add(order.getAddress() != null ? order.getAddress() : "");
row.add(order.getLogisticsLink() != null ? order.getLogisticsLink() : "");
row.add(order.resolveLogisticsDocValue() != null ? order.resolveLogisticsDocValue() : "");
row.add(order.getBuyer() != null ? order.getBuyer() : "");
row.add(order.getPaymentAmount() != null ? order.getPaymentAmount().toString() : "");
row.add(order.getRebateAmount() != null ? order.getRebateAmount().toString() : "");
@@ -345,8 +345,9 @@ public class TencentDocServiceImpl implements ITencentDocService {
if (arrangedColumn != null) {
requests.add(buildUpdateRequest(sheetId, rowIndex, arrangedColumn, "2", false));
}
if (logisticsColumn != null && order.getLogisticsLink() != null && !order.getLogisticsLink().isEmpty()) {
requests.add(buildUpdateRequest(sheetId, rowIndex, logisticsColumn, order.getLogisticsLink(), true)); // 超链接
String logisticsDocValue = order.resolveLogisticsDocValue();
if (logisticsColumn != null && logisticsDocValue != null) {
requests.add(buildUpdateRequest(sheetId, rowIndex, logisticsColumn, logisticsDocValue, JDOrder.isHttpUrl(logisticsDocValue)));
}
// 5. 使用 batchUpdate 写入
@@ -13,6 +13,7 @@
<result property="rebateAmount" column="rebate_amount"/>
<result property="address" column="address"/>
<result property="logisticsLink" column="logistics_link"/>
<result property="waybillNo" column="waybill_no"/>
<result property="tencentDocPushed" column="tencent_doc_pushed"/>
<result property="tencentDocPushTime" column="tencent_doc_push_time"/>
<result property="orderId" column="order_id"/>
@@ -48,7 +49,7 @@
<sql id="selectJDOrderBase">
select id, remark, distribution_mark, model_number, model_shop, link, payment_amount, rebate_amount,
address, logistics_link, order_id, buyer, order_time, create_time, update_time, status, is_count_enabled, third_party_order_no, jingfen_actual_price,
address, logistics_link, waybill_no, order_id, buyer, order_time, create_time, update_time, status, is_count_enabled, third_party_order_no, jingfen_actual_price,
is_refunded, refund_date, is_refund_received, refund_received_date, is_rebate_received, rebate_received_date,
is_price_protected, price_protected_date, is_invoice_opened, invoice_opened_date, is_review_posted, review_posted_date,
rebate_remark_json, rebate_remark_has_abnormal,
@@ -65,6 +66,7 @@
order_id like concat('%', #{params.orderSearch}, '%')
or third_party_order_no like concat('%', #{params.orderSearch}, '%')
or distribution_mark like concat('%', #{params.orderSearch}, '%')
or waybill_no like concat('%', #{params.orderSearch}, '%')
)
</if>
<if test="params.quickRecordSearch != null and params.quickRecordSearch != ''">
@@ -76,6 +78,8 @@
or order_id like concat('%', #{params.quickRecordSearch}, '%')
or third_party_order_no like concat('%', #{params.quickRecordSearch}, '%')
or distribution_mark like concat('%', #{params.quickRecordSearch}, '%')
or waybill_no like concat('%', #{params.quickRecordSearch}, '%')
or logistics_link like concat('%', #{params.quickRecordSearch}, '%')
)
</if>
<if test="distributionMark != null and distributionMark != ''"> and distribution_mark = #{distributionMark}</if>
@@ -96,6 +100,7 @@
<if test="rebateAmount != null"> and rebate_amount = #{rebateAmount}</if>
<if test="address != null and address != ''"> and address like concat('%', #{address}, '%')</if>
<if test="logisticsLink != null and logisticsLink != ''"> and logistics_link like concat('%', #{logisticsLink}, '%')</if>
<if test="waybillNo != null and waybillNo != ''"> and waybill_no like concat('%', #{waybillNo}, '%')</if>
<if test="buyer != null and buyer != ''"> and buyer like concat('%', #{buyer}, '%')</if>
<if test="orderTime != null"> and order_time = #{orderTime}</if>
<if test="status != null and status != ''"> and status like concat('%', #{status}, '%')</if>
@@ -135,6 +140,7 @@
order_id like concat('%', #{params.orderSearch}, '%')
or third_party_order_no like concat('%', #{params.orderSearch}, '%')
or distribution_mark like concat('%', #{params.orderSearch}, '%')
or waybill_no like concat('%', #{params.orderSearch}, '%')
)
</if>
<if test="params.quickRecordSearch != null and params.quickRecordSearch != ''">
@@ -146,6 +152,8 @@
or order_id like concat('%', #{params.quickRecordSearch}, '%')
or third_party_order_no like concat('%', #{params.quickRecordSearch}, '%')
or distribution_mark like concat('%', #{params.quickRecordSearch}, '%')
or waybill_no like concat('%', #{params.quickRecordSearch}, '%')
or logistics_link like concat('%', #{params.quickRecordSearch}, '%')
)
</if>
<if test="distributionMark != null and distributionMark != ''"> and distribution_mark = #{distributionMark}</if>
@@ -166,6 +174,7 @@
<if test="rebateAmount != null"> and rebate_amount = #{rebateAmount}</if>
<if test="address != null and address != ''"> and address like concat('%', #{address}, '%')</if>
<if test="logisticsLink != null and logisticsLink != ''"> and logistics_link like concat('%', #{logisticsLink}, '%')</if>
<if test="waybillNo != null and waybillNo != ''"> and waybill_no like concat('%', #{waybillNo}, '%')</if>
<if test="buyer != null and buyer != ''"> and buyer like concat('%', #{buyer}, '%')</if>
<if test="orderTime != null"> and order_time = #{orderTime}</if>
<if test="status != null and status != ''"> and status like concat('%', #{status}, '%')</if>
@@ -213,7 +222,7 @@
<insert id="insertJDOrder" parameterType="JDOrder" useGeneratedKeys="true" keyProperty="id">
insert into jd_order (
remark, distribution_mark, model_number, model_shop, link,
payment_amount, rebate_amount, address, logistics_link,
payment_amount, rebate_amount, address, logistics_link, waybill_no,
tencent_doc_pushed, tencent_doc_push_time,
order_id, buyer, order_time, create_time, update_time, status, is_count_enabled, third_party_order_no, jingfen_actual_price,
is_refunded, refund_date, is_refund_received, refund_received_date, is_rebate_received, rebate_received_date,
@@ -221,7 +230,7 @@
selling_price_type, selling_price, profit, selling_price_manual, profit_manual, extra_cost
) values (
#{remark}, #{distributionMark}, #{modelNumber}, #{modelShop}, #{link},
#{paymentAmount}, #{rebateAmount}, #{address}, #{logisticsLink},
#{paymentAmount}, #{rebateAmount}, #{address}, #{logisticsLink}, #{waybillNo},
0, null,
#{orderId}, #{buyer}, #{orderTime}, now(), now(), #{status}, #{isCountEnabled}, #{thirdPartyOrderNo}, #{jingfenActualPrice},
#{isRefunded}, #{refundDate}, #{isRefundReceived}, #{refundReceivedDate}, #{isRebateReceived}, #{rebateReceivedDate},
@@ -242,6 +251,7 @@
<if test="rebateAmount != null"> rebate_amount = #{rebateAmount},</if>
<if test="address != null"> address = #{address},</if>
<if test="logisticsLink != null"> logistics_link = #{logisticsLink},</if>
<if test="waybillNo != null"> waybill_no = #{waybillNo},</if>
<if test="tencentDocPushed != null"> tencent_doc_pushed = #{tencentDocPushed},</if>
<if test="tencentDocPushTime != null"> tencent_doc_push_time = #{tencentDocPushTime},</if>
<if test="orderId != null"> order_id = #{orderId},</if>
@@ -317,6 +327,13 @@
limit 1
</select>
<select id="selectJDOrderByWaybillNo" parameterType="string" resultMap="JDOrderResult">
<include refid="selectJDOrderBase"/>
where waybill_no = #{waybillNo}
order by order_time desc
limit 1
</select>
<select id="selectJDOrderByThirdPartyOrderNo" parameterType="string" resultMap="JDOrderResult">
<include refid="selectJDOrderBase"/>
where third_party_order_no = #{thirdPartyOrderNo}
+2
View File
@@ -0,0 +1,2 @@
-- 京东订单:物流运单号(手工填写或扫描回写;与 logistics_link 独立,无链接时也可录单)
ALTER TABLE jd_order ADD COLUMN waybill_no VARCHAR(128) DEFAULT NULL COMMENT '物流运单号(手工填写或扫描回写)' AFTER logistics_link;