mirror of https://github.com/jeecgboot/jeecg-boot
Feature: makes excluded tracking numbers regex a parameter in ArchiveOrderJob
parent
fa0df9450b
commit
586e0eddda
|
@ -39,6 +39,7 @@ public class ArchiveOrderJob implements Job {
|
|||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
LocalDateTime endDateTime = LocalDateTime.now(ZoneId.of(ZoneId.SHORT_IDS.get("CTT")));
|
||||
LocalDateTime startDateTime = endDateTime.minusDays(DEFAULT_NUMBER_OF_DAYS);
|
||||
String excludedTrackingNumbersRegex = null;
|
||||
List<String> shops = DEFAULT_EXCLUDED_SHOPS;
|
||||
JobDataMap jobDataMap = context.getMergedJobDataMap();
|
||||
String parameter = ((String) jobDataMap.get("parameter"));
|
||||
|
@ -53,6 +54,9 @@ public class ArchiveOrderJob implements Job {
|
|||
String endDateStr = jsonObject.getString("endDateTime");
|
||||
endDateTime = LocalDateTime.parse(endDateStr);
|
||||
}
|
||||
if (!jsonObject.isNull("excludedTrackingNumbersRegex")) {
|
||||
excludedTrackingNumbersRegex = jsonObject.getString("excludedTrackingNumbersRegex");
|
||||
}
|
||||
if (!jsonObject.isNull("excludedShops")) {
|
||||
JSONArray shopsArray = jsonObject.getJSONArray("excludedShops");
|
||||
List<String> shopList = new ArrayList<>();
|
||||
|
@ -70,7 +74,7 @@ public class ArchiveOrderJob implements Job {
|
|||
throw new RuntimeException("EndDateTime must be strictly greater than StartDateTime !");
|
||||
}
|
||||
|
||||
List<String> platformOrderIds = platformOrderService.fetchInvoicedShippedOrdersNotInShops(startDateTime, endDateTime, shops);
|
||||
List<String> platformOrderIds = platformOrderService.fetchInvoicedShippedOrdersNotInShops(startDateTime, endDateTime, shops, excludedTrackingNumbersRegex);
|
||||
|
||||
ExecutorService executor = Executors.newFixedThreadPool(DEFAULT_NUMBER_OF_THREADS);
|
||||
|
||||
|
|
|
@ -163,7 +163,8 @@ public interface PlatformOrderMapper extends BaseMapper<PlatformOrder> {
|
|||
|
||||
List<String> fetchInvoicedShippedOrdersNotInShops(@Param("startDateTime") LocalDateTime startDatetime,
|
||||
@Param("endDateTime") LocalDateTime endDatetime,
|
||||
@Param("shops") List<String> shopCodes);
|
||||
@Param("shops") List<String> shopCodes,
|
||||
@Param("excludedTrackingNumbersRegex") String excludedTrackingNumbersRegex);
|
||||
|
||||
List<PlatformOrderShopSync> fetchOrderInShopsReadyForShopifySync(@Param("shops") List<String> shopCodes);
|
||||
|
||||
|
|
|
@ -435,8 +435,10 @@
|
|||
AND shipping_time <= #{endDateTime}
|
||||
AND shipping_invoice_number IS NOT NULL
|
||||
AND erp_status = 3
|
||||
# Skip CNE packages whose tracking number are not yet up-to-date
|
||||
AND tracking_number NOT REGEXP '3A5V[0-9]{9}|DY01[0-9]{11}';
|
||||
<if test="excludedTrackingNumbersRegex != null">
|
||||
AND tracking_number NOT REGEXP #{excludedTrackingNumbersRegex}
|
||||
</if>
|
||||
;
|
||||
</select>
|
||||
|
||||
<select id="fetchOrderInShopsReadyForShopifySync" resultType="org.jeecg.modules.business.entity.PlatformOrderShopSync">
|
||||
|
|
|
@ -129,12 +129,14 @@ public interface IPlatformOrderService extends IService<PlatformOrder> {
|
|||
/**
|
||||
* Fetch platformOrderId of shipped AND invoiced orders, from startDatetime to endDatetime, excluding orders from
|
||||
* shops whose codes are in shopCodes
|
||||
*
|
||||
* @param startDatetime Start date time
|
||||
* @param endDatetime End date time
|
||||
* @param shopCodes Codes for shops which are to be excluded from request
|
||||
* @param excludedTrackingNumbersRegex Tracking numbers matching the REGEX to be excluded
|
||||
* @return List of PlatformOrderIDs
|
||||
*/
|
||||
List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes);
|
||||
List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes, String excludedTrackingNumbersRegex);
|
||||
|
||||
List<PlatformOrderShopSync> fetchOrderInShopsReadyForShopifySync(List<String> shopCodes);
|
||||
|
||||
|
|
|
@ -353,8 +353,8 @@ public class PlatformOrderServiceImpl extends ServiceImpl<PlatformOrderMapper, P
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes) {
|
||||
return platformOrderMap.fetchInvoicedShippedOrdersNotInShops(startDatetime, endDatetime, shopCodes);
|
||||
public List<String> fetchInvoicedShippedOrdersNotInShops(LocalDateTime startDatetime, LocalDateTime endDatetime, List<String> shopCodes, String excludedTrackingNumbersRegex) {
|
||||
return platformOrderMap.fetchInvoicedShippedOrdersNotInShops(startDatetime, endDatetime, shopCodes, excludedTrackingNumbersRegex);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue