1
This commit is contained in:
@@ -40,6 +40,12 @@ public class ErpGoofishOrderController extends BaseController {
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:list')")
|
||||
@GetMapping("/stats/rrsLogistics")
|
||||
public AjaxResult rrsLogisticsStats() {
|
||||
return AjaxResult.success(erpGoofishOrderService.selectRrsJdLinkedLogisticsStats());
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('jarvis:erpGoofishOrder:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ErpGoofishOrder query) {
|
||||
|
||||
@@ -208,7 +208,7 @@ jarvis:
|
||||
adhoc-pending-batch-size: 50
|
||||
# 物流扫描(LogisticsScanTask):轮询 JD 单拉运单 + drain 分享链队列
|
||||
scan:
|
||||
cron: "0 */20 * * * ?"
|
||||
cron: "0 */5 * * * ?"
|
||||
order-delay-ms: 250
|
||||
# 0=不限制;例如 40 可控制单轮最长耗时(余下下轮再扫)
|
||||
max-orders-per-round: 0
|
||||
|
||||
@@ -206,7 +206,7 @@ jarvis:
|
||||
health-path: /health
|
||||
adhoc-pending-batch-size: 50
|
||||
scan:
|
||||
cron: "0 */20 * * * ?"
|
||||
cron: "0 */5 * * * ?"
|
||||
order-delay-ms: 250
|
||||
max-orders-per-round: 0
|
||||
# 获取评论接口服务地址(后端转发)
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.ruoyi.jarvis.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 闲管家订单:日日顺承运且已关联京东单的出库统计口径(与前台「手动推送/hasPlatformShipped」基本一致)。
|
||||
*/
|
||||
@Data
|
||||
public class GoofishRrsLogisticsStatsVo {
|
||||
|
||||
/** 已出库:有有效运单去重计数 + 无运单但已发货/完成或本系统发货成功的订单数 */
|
||||
private long shippedOutboundCount;
|
||||
|
||||
/** 待出库:平台「待发货」且无运单、且非本系统发货成功 */
|
||||
private long pendingOutboundCount;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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, ''))) > 0
|
||||
OR LENGTH(TRIM(IFNULL(e.detail_waybill_no, ''))) > 0
|
||||
)
|
||||
THEN CASE
|
||||
WHEN LENGTH(TRIM(IFNULL(e.local_waybill_no, ''))) > 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>
|
||||
|
||||
Reference in New Issue
Block a user