This commit is contained in:
van
2026-05-19 23:15:05 +08:00
parent 379a11ae63
commit 4aec0177dd
9 changed files with 104 additions and 4 deletions

View File

@@ -0,0 +1,16 @@
package com.ruoyi.jarvis.dto;
import lombok.Data;
/**
* 闲管家订单:日日顺承运且已关联京东单的出库统计口径(与前台「手动推送/hasPlatformShipped」基本一致
*/
@Data
public class GoofishRrsLogisticsStatsVo {
/** 已出库:有有效运单去重计数 + 无运单但已发货/完成或本系统发货成功的订单数 */
private long shippedOutboundCount;
/** 待出库:平台「待发货」且无运单、且非本系统发货成功 */
private long pendingOutboundCount;
}

View File

@@ -1,6 +1,7 @@
package com.ruoyi.jarvis.mapper;
import com.ruoyi.jarvis.domain.ErpGoofishOrder;
import com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@@ -25,4 +26,9 @@ public interface ErpGoofishOrderMapper {
List<ErpGoofishOrder> selectByGoofishOrderNo(@Param("orderNo") String orderNo);
int resetShipForRetry(@Param("id") Long id);
/**
* 已关联 jd_order_id、承运为日日顺rrs 或名称含日日顺);排除已退款/已关闭。
*/
GoofishRrsLogisticsStatsVo selectRrsJdLinkedLogisticsStats();
}

View File

@@ -5,6 +5,7 @@ import com.ruoyi.jarvis.domain.ErpGoofishOrder;
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLog;
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLogQuery;
import com.ruoyi.jarvis.dto.GoofishShipPreviewVo;
import com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo;
import java.util.List;
@@ -17,6 +18,9 @@ public interface IErpGoofishOrderService {
*/
void asyncPipelineAfterNotify(String appid, JSONObject notifyBody);
/** 日日顺 + 关联京东出库统计(侧边栏):已出库(去重运单口径)/待出库 */
GoofishRrsLogisticsStatsVo selectRrsJdLinkedLogisticsStats();
List<ErpGoofishOrder> selectList(ErpGoofishOrder query);
ErpGoofishOrder selectById(Long id);

View File

@@ -9,6 +9,7 @@ import com.ruoyi.jarvis.domain.JDOrder;
import com.ruoyi.jarvis.domain.ErpGoofishOrderEventLogQuery;
import com.ruoyi.jarvis.domain.ErpOpenConfig;
import com.ruoyi.jarvis.dto.GoofishNotifyMessage;
import com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo;
import com.ruoyi.jarvis.dto.GoofishShipPreviewVo;
import com.ruoyi.jarvis.mapper.ErpGoofishOrderEventLogMapper;
import com.ruoyi.jarvis.mapper.ErpGoofishOrderMapper;
@@ -83,6 +84,12 @@ public class ErpGoofishOrderServiceImpl implements IErpGoofishOrderService {
goofishOrderPipeline.runFullPipeline(appid, notifyBody);
}
@Override
public GoofishRrsLogisticsStatsVo selectRrsJdLinkedLogisticsStats() {
GoofishRrsLogisticsStatsVo vo = erpGoofishOrderMapper.selectRrsJdLinkedLogisticsStats();
return vo != null ? vo : new GoofishRrsLogisticsStatsVo();
}
@Override
public List<ErpGoofishOrder> selectList(ErpGoofishOrder query) {
return erpGoofishOrderMapper.selectList(query);

View File

@@ -15,7 +15,7 @@ import java.util.List;
/**
* 物流信息扫描定时任务
* 按配置周期(默认每 20 分钟)扫描分销标记为 F/PDD 等的订单(最近 30 天),拉物流并推送;
* 按配置周期(默认每 5 分钟)扫描分销标记为 F/PDD 等的订单(最近 30 天),拉物流并推送;
* 结束后处理企微分享链 adhoc 队列。
*/
@Component
@@ -39,7 +39,7 @@ public class LogisticsScanTask {
/**
* 只扫描最近 30 天的订单SQL 固定);周期与单轮上限见 jarvis.server.logistics.scan.*
*/
@Scheduled(cron = "${jarvis.server.logistics.scan.cron:0 */20 * * * ?}")
@Scheduled(cron = "${jarvis.server.logistics.scan.cron:0 */5 * * * ?}")
public void scanAndFetchLogistics() {
long t0 = System.currentTimeMillis();
int orderCandidates = 0;

View File

@@ -182,4 +182,65 @@
update_time = now()
where id = #{id}
</update>
<!-- 日日顺 + 已关联京东:已出库/待出库口径与 erpGoofishOrder 列表「手动推送」一致(有单号或已发货状态) -->
<select id="selectRrsJdLinkedLogisticsStats"
resultType="com.ruoyi.jarvis.dto.GoofishRrsLogisticsStatsVo">
SELECT
(
IFNULL(COUNT(DISTINCT CASE
WHEN e.jd_order_id IS NOT NULL
AND (
LOWER(TRIM(IFNULL(e.detail_express_code, ''))) = 'rrs'
OR LOWER(TRIM(IFNULL(e.ship_express_code, ''))) = 'rrs'
OR IFNULL(e.detail_express_name, '') LIKE CONCAT('%', '日日顺', '%')
)
AND (e.order_status IS NULL OR e.order_status NOT IN (23, 24))
AND (
LENGTH(TRIM(IFNULL(e.local_waybill_no, ''))) &gt; 0
OR LENGTH(TRIM(IFNULL(e.detail_waybill_no, ''))) &gt; 0
)
THEN CASE
WHEN LENGTH(TRIM(IFNULL(e.local_waybill_no, ''))) &gt; 0
THEN TRIM(e.local_waybill_no)
ELSE TRIM(e.detail_waybill_no)
END
ELSE NULL
END), 0)
+
IFNULL(COUNT(CASE
WHEN e.jd_order_id IS NOT NULL
AND (
LOWER(TRIM(IFNULL(e.detail_express_code, ''))) = 'rrs'
OR LOWER(TRIM(IFNULL(e.ship_express_code, ''))) = 'rrs'
OR IFNULL(e.detail_express_name, '') LIKE CONCAT('%', '日日顺', '%')
)
AND (e.order_status IS NULL OR e.order_status NOT IN (23, 24))
AND LENGTH(TRIM(IFNULL(e.local_waybill_no, ''))) = 0
AND LENGTH(TRIM(IFNULL(e.detail_waybill_no, ''))) = 0
AND (
IFNULL(e.ship_status, 0) = 1
OR IFNULL(e.order_status, 0) IN (21, 22)
)
THEN 1
ELSE NULL
END), 0)
) AS shippedOutboundCount,
IFNULL(COUNT(CASE
WHEN e.jd_order_id IS NOT NULL
AND (
LOWER(TRIM(IFNULL(e.detail_express_code, ''))) = 'rrs'
OR LOWER(TRIM(IFNULL(e.ship_express_code, ''))) = 'rrs'
OR IFNULL(e.detail_express_name, '') LIKE CONCAT('%', '日日顺', '%')
)
AND (e.order_status IS NULL OR e.order_status NOT IN (23, 24))
AND IFNULL(e.order_status, 0) = 12
AND LENGTH(TRIM(IFNULL(e.local_waybill_no, ''))) = 0
AND LENGTH(TRIM(IFNULL(e.detail_waybill_no, ''))) = 0
AND (e.ship_status IS NULL OR e.ship_status != 1)
THEN 1
ELSE NULL
END), 0) AS pendingOutboundCount
FROM erp_goofish_order e
</select>
</mapper>