diff --git a/ms-api/src/main/java/com/ms/api/dto/order/RsyncFullOrderRequestDTO.java b/ms-api/src/main/java/com/ms/api/dto/order/RsyncFullOrderRequestDTO.java new file mode 100644 index 00000000..53d0af32 --- /dev/null +++ b/ms-api/src/main/java/com/ms/api/dto/order/RsyncFullOrderRequestDTO.java @@ -0,0 +1,16 @@ +package com.ms.api.dto.order; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.Data; +import org.springframework.util.StringUtils; + +/* + * 获取分销订单列表 请求参数 + */ +@Data +public class RsyncFullOrderRequestDTO { + + + private String rsyncOrderDate; + +} diff --git a/ms-api/src/main/java/com/ms/api/dto/order/SearchDsTabOrderTotalCountRequestDTO.java b/ms-api/src/main/java/com/ms/api/dto/order/SearchDsTabOrderTotalCountRequestDTO.java deleted file mode 100644 index ed1a8254..00000000 --- a/ms-api/src/main/java/com/ms/api/dto/order/SearchDsTabOrderTotalCountRequestDTO.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.ms.api.dto.order; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import lombok.Data; -import org.springframework.util.StringUtils; - -/* - * 获取分销订单列表 请求参数 - */ -@Data -public class SearchDsTabOrderTotalCountRequestDTO { - - private Integer authShopIds; - /* - * tab值waitPurchase:待采购,waitPay:待付款,waitSend:待发货,hasSend:已发货,refunding:退款中,finish:已完成,close:已关闭,isolation:隔离订单,all:全部 - */ - private String purchaseOrderTab; - - /* - * 订单起始时间 - */ - private String orderStartTime; - - /* - * 订单结束时间 - */ - private String orderEndTime; - /* - * 订单号 - */ - private String orderIds; - /* - * 采购单号 - */ - private String purchaseOrderSn; - /* - * 1:是,0:否 - */ - private Integer onlyShowMoreThanTwoHoursOrder; - /* - * 供货商名称 - */ - private String purchaseOrderSeller; - /* - * 商品标题 - */ - private String productName; - /* - * 商品id - */ - private String productId; - /* - * 备注类型[buyer:买家备注,seller:商家备注,app:本地备注] - */ - private String remarkType; - /* - * 备注信息[结合remarkType] - */ - private String orderRemark; - /* - * 收件人姓名 - */ - private String fullname; - - /* - * 联系方式 - */ - private String mobile; - /* - * 规格 - */ - private String skuSubName; - /* - * 采购单状态 - */ - private String purchaseOrderStatus; - - private String dsSourcePlatform; - - /* - * 物流单号 - */ - private String logisticsCode; - - /* - * 收件信息[姓名或者手机号] - */ - private String receiverInfo; - - private Boolean isPriorirtyDelivery; - - private String orderFilterDatePickTime; - - private String hasAfterSale; - - private Integer skipSearchWithEs; - - private Integer delaySendStatus; - - private Boolean isReceiverAddressChanged; - - private Object sellerRemarkStars; - - @JsonIgnore - public boolean checkParams() { - return StringUtils.isEmpty(purchaseOrderTab) - || StringUtils.isEmpty(orderStartTime) - || StringUtils.isEmpty(orderEndTime); - } - -} diff --git a/ms-biz/src/main/java/com/ms/api/consts/RedisKeyConst.java b/ms-biz/src/main/java/com/ms/api/consts/RedisKeyConst.java index 264bffb1..f32e5f56 100644 --- a/ms-biz/src/main/java/com/ms/api/consts/RedisKeyConst.java +++ b/ms-biz/src/main/java/com/ms/api/consts/RedisKeyConst.java @@ -5,9 +5,7 @@ import java.time.ZoneId; import java.time.format.DateTimeFormatter; import java.util.Date; -import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.ObjectUtil; -import cn.hutool.core.util.StrUtil; public class RedisKeyConst { public static final String REDIS_TYPE_BIZ_CACHE = "bizCache"; @@ -15,22 +13,22 @@ public class RedisKeyConst { public static final String REDIS_TYPE_SOLID_CACHE = "solidCache"; public static final String REDIS_TYPE_TIMER_CACHE = "timerCache"; - public static final String MOVE_PRODUCT_PUBLISH_QUEUE_SELF = "dd_move_item_publish_queue_self"; - public static final String MOVE_PRODUCT_PUBLISH_QUEUE = "dd_move_item_publish_queue"; + public static final String MOVE_PRODUCT_PUBLISH_QUEUE_SELF = "dd_move_item_publish_queue_self"; + public static final String MOVE_PRODUCT_PUBLISH_QUEUE = "dd_move_item_publish_queue"; - public static final String SHOP_DENY_REQUEST_SHOP_IDS = "dd_shop_deny_request_shop_ids"; - public static final String SHOP_REQUEST_TS_MAP = "dd_shop_request_ts_map"; - public static final String SHOP_REQUEST_ABNORMAL_SET = "dd_shop_request_abnormal_set"; - public static final String SHOP_MOVE_PUBLISH_COUNT = "dd_shop_move_publish_count"; - public static final String SHOP_MOVE_PUBLISH_COST_TIME_COUNT = "dd_shop_move_publish_cost_time_count"; + public static final String SHOP_DENY_REQUEST_SHOP_IDS = "dd_shop_deny_request_shop_ids"; + public static final String SHOP_REQUEST_TS_MAP = "dd_shop_request_ts_map"; + public static final String SHOP_REQUEST_ABNORMAL_SET = "dd_shop_request_abnormal_set"; + public static final String SHOP_MOVE_PUBLISH_COUNT = "dd_shop_move_publish_count"; + public static final String SHOP_MOVE_PUBLISH_COST_TIME_COUNT = "dd_shop_move_publish_cost_time_count"; - public static final String ADMIN_SELF_SHOP_INFO = "dd_admin_self_shop_info"; + public static final String ADMIN_SELF_SHOP_INFO = "dd_admin_self_shop_info"; - public static final String MOVE_SETTING_SEARCH_JSON_TS = "dd_move_setting_search_json_ts"; + public static final String MOVE_SETTING_SEARCH_JSON_TS = "dd_move_setting_search_json_ts"; - public static final String MOVE_REWRITE_CID_RULES = "dd_move_rewrite_cid_rules"; + public static final String MOVE_REWRITE_CID_RULES = "dd_move_rewrite_cid_rules"; - public static final String LEAF_CATE_LIST = "dd_leaf_cate_list_v2"; + public static final String LEAF_CATE_LIST = "dd_leaf_cate_list_v2"; public static final String OP_ORDER_PURCHASE_OUTSTORAGE_BUFFER = "op_order_purchase_outstorage_buffer"; @@ -70,18 +68,18 @@ public class RedisKeyConst { public static final String JMONITOR_LOG = "jmonitor_log"; public static final String DB_ERROR_LOG = "db_error_log"; - public static final String SHOP_ALL_ROUTE_REQ_STAT_LIST_HEAP_UP_WARNING_FLAG = "shop_all_route_req_stat_list_heap_up_warning_flag"; + public static final String SHOP_ALL_ROUTE_REQ_STAT_LIST_HEAP_UP_WARNING_FLAG = "shop_all_route_req_stat_list_heap_up_warning_flag"; - public static final String STOP_PULL_DY_CLOUD_DATA = "stop_pull_dy_cloud_data"; + public static final String STOP_PULL_DY_CLOUD_DATA = "stop_pull_dy_cloud_data"; public static final String TIMER_MONITOR_TIMER_CODE_LOCK_KEY = "timer:monitor_timer_code"; - public static final int KEY_TYPE_NOT_FOUND = 0; - public static final int KEY_TYPE_STRING = 1; - public static final int KEY_TYPE_SET = 2; - public static final int KEY_TYPE_LIST = 3; - public static final int KEY_TYPE_ZSET = 4; - public static final int KEY_TYPE_HASH = 5; + public static final int KEY_TYPE_NOT_FOUND = 0; + public static final int KEY_TYPE_STRING = 1; + public static final int KEY_TYPE_SET = 2; + public static final int KEY_TYPE_LIST = 3; + public static final int KEY_TYPE_ZSET = 4; + public static final int KEY_TYPE_HASH = 5; public static String buildOrderRsyncCountStatMapKey() { LocalDate currentDate = LocalDate.now(); @@ -90,12 +88,20 @@ public class RedisKeyConst { } public static String buildPayingNewOrderStatBizKey(Date date) { - LocalDate currentDate = ObjectUtil.isEmpty(date)? LocalDate.now(): date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); + LocalDate currentDate = ObjectUtil.isEmpty(date) ? LocalDate.now() : date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); return "paying_new_order_stat_" + currentDate.format(formatter); } + public static String buildOrderStatBizKey(boolean isSelf) { return ORDER_STAT_BIZ_KEY + (isSelf ? "_self" : ""); } + public static String getQueueRedisKey(String queueName, boolean isAdminSelf) { + if (isAdminSelf) { + return (queueName.concat("_self")); + } else { + return queueName; + } + } } diff --git a/ms-biz/src/main/java/com/ms/api/service/OpOrderService.java b/ms-biz/src/main/java/com/ms/api/service/OpOrderService.java index 056ff7b7..701060e9 100644 --- a/ms-biz/src/main/java/com/ms/api/service/OpOrderService.java +++ b/ms-biz/src/main/java/com/ms/api/service/OpOrderService.java @@ -7,6 +7,7 @@ import com.ms.api.dto.order.OriginalAndCustomConsigneeInfoRequestDTO; import com.ms.api.dto.order.OriginalAndCustomConsigneeInfoResponseDTO; import com.ms.dal.entity.OpOrder; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -78,4 +79,6 @@ public interface OpOrderService { * @return */ Boolean batchCancelIsolation(String shopId, List orderIds); + + Long tryRsyncOpOrder(Long shopid, String app, Integer priority, Date forceStart); } diff --git a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderServiceImpl.java b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderServiceImpl.java index cd9166da..b28b7234 100644 --- a/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderServiceImpl.java +++ b/ms-biz/src/main/java/com/ms/api/service/impl/OpOrderServiceImpl.java @@ -1,6 +1,14 @@ package com.ms.api.service.impl; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -44,16 +52,25 @@ import com.doudian.open.api.order_searchList.OrderSearchListResponse; import com.doudian.open.api.order_searchList.param.OrderSearchListParam; import com.ms.api.common.ApiResult; import com.ms.api.consts.AfterSaleConst; -import com.ms.api.consts.*; +import com.ms.api.consts.DsOrderConst; +import com.ms.api.consts.OrderChildTagConst; +import com.ms.api.consts.OrderConst; +import com.ms.api.consts.PurchaseOrderConst; +import com.ms.api.consts.RedisKeyConst; +import com.ms.api.consts.StatusConst; import com.ms.api.dto.order.DsPurchaseSettingDTO; import com.ms.api.dto.order.OrderMultiPackageOutstorageDTO; -import com.ms.api.dto.order.OriginalAndCustomConsigneeInfoRequestDTO; import com.ms.api.dto.order.OriginalAndCustomConsigneeInfoResponseDTO; -import com.ms.api.service.*; +import com.ms.api.service.OpOrderDsService; +import com.ms.api.service.OpOrderExtService; +import com.ms.api.service.OpOrderSellerWordsUpdateLogService; +import com.ms.api.service.OpOrderService; +import com.ms.api.service.OrderPrintService; +import com.ms.api.service.PurchaseOrderService; +import com.ms.api.service.ShopService; import com.ms.api.tool.CommonTool; import com.ms.api.tool.DsOrderTool; import com.ms.api.util.DdRequestUtil; -import com.ms.dal.entity.*; import com.ms.dal.entity.DsAutoPurchaseOrderBuffer; import com.ms.dal.entity.OpCouponInfo; import com.ms.dal.entity.OpOrder; @@ -73,11 +90,13 @@ import com.ms.dal.entity.OpOrderExt; import com.ms.dal.entity.OpOrderGivenProduct; import com.ms.dal.entity.OpOrderPhase; import com.ms.dal.entity.OpOrderPriceProtection; +import com.ms.dal.entity.OpOrderRsyncQueue; import com.ms.dal.entity.OpOrderSellerWordsUpdateLog; import com.ms.dal.entity.OpOrderSensitive; import com.ms.dal.entity.ProductToDsItem; import com.ms.dal.entity.PurchaseOrder; import com.ms.dal.entity.PurchaseOrderItem; +import com.ms.dal.entity.Shop; import com.ms.dal.mapper.DsAutoPurchaseOrderBufferMapper; import com.ms.dal.mapper.OpCouponInfoMapper; import com.ms.dal.mapper.OpOrderAddressHistoryEncryptIndexMapper; @@ -98,6 +117,7 @@ import com.ms.dal.mapper.OpOrderNoIndexEncryptMapper; import com.ms.dal.mapper.OpOrderPhaseMapper; import com.ms.dal.mapper.OpOrderPriceProtectionMapper; import com.ms.dal.mapper.OpOrderPurchaseOutstorageQueueMapper; +import com.ms.dal.mapper.OpOrderRsyncQueueMapper; import com.ms.dal.mapper.OpOrderSensitiveMapper; import com.ms.dal.mapper.ProductToDsItemMapper; import com.ms.dal.mapper.PurchaseOrderItemMapper; @@ -105,6 +125,7 @@ import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; +import org.springframework.data.redis.core.ListOperations; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -138,7 +159,7 @@ public class OpOrderServiceImpl implements OpOrderService { @Lazy @Autowired - private OrderPrintService orderPrintService; + private OrderPrintService orderPrintService; private final OpOrderEncryptIndexMapper opOrderEncryptIndexMapper; @@ -175,6 +196,8 @@ public class OpOrderServiceImpl implements OpOrderService { private final OpOrderAddressHistoryEncryptMapper opOrderAddressHistoryEncryptMapper; private final OpOrderAddressHistorySensitiveMapper opOrderAddressHistorySensitiveMapper; + + private final OpOrderRsyncQueueMapper opOrderRsyncQueueMapper; @Lazy @Autowired private OpOrderSellerWordsUpdateLogService opOrderSellerWordsUpdateLogService; @@ -183,7 +206,6 @@ public class OpOrderServiceImpl implements OpOrderService { @Autowired private ShopService shopService; - @Override public int deleteByPrimaryKey(Long id) { return opOrderMapper.deleteByPrimaryKey(id); @@ -1546,14 +1568,14 @@ public class OpOrderServiceImpl implements OpOrderService { } List itemList = new ArrayList<>(); - packageList.stream().forEach(e->{ + packageList.stream().forEach(e -> { PackListItem item = new PackListItem(); BeanUtil.copyProperties(e, item); List infoItems = new ArrayList<>(); item.setShippedOrderInfo(infoItems); if (CollectionUtil.isNotEmpty(e.getShippedOrderInfo())) { - e.getShippedOrderInfo().stream().forEach(it->{ + e.getShippedOrderInfo().stream().forEach(it -> { ShippedOrderInfoItem infoItem = new ShippedOrderInfoItem(); BeanUtil.copyProperties(it, infoItem); infoItems.add(infoItem); @@ -1587,8 +1609,8 @@ public class OpOrderServiceImpl implements OpOrderService { } List invalidStatusOrderIds = orderList.stream() - .filter(e-> (OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS.equals(e.getOrderStatus())||OrderConst.ORDER_STATUS_PART_DELIVERY.equals(e.getOrderStatus()))) - .map(e-> e.getOrderId()).collect(Collectors.toList()); + .filter(e -> (OrderConst.ORDER_STATUS_WAIT_SELLER_SEND_GOODS.equals(e.getOrderStatus()) || OrderConst.ORDER_STATUS_PART_DELIVERY.equals(e.getOrderStatus()))) + .map(e -> e.getOrderId()).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(invalidStatusOrderIds)) { throw new RuntimeException(String.format("订单:%s 当前状态不能进行发货操作", invalidStatusOrderIds.toString())); } @@ -1617,14 +1639,14 @@ public class OpOrderServiceImpl implements OpOrderService { List childOrderIds = new ArrayList<>(); for (OrderMultiPackageOutstorageDTO.PackageInfoDTO packageInfoDTO : packageList) { if (CollectionUtil.isNotEmpty(packageInfoDTO.getShippedOrderInfo())) { - packageInfoDTO.getShippedOrderInfo().stream().forEach(e->{ + packageInfoDTO.getShippedOrderInfo().stream().forEach(e -> { childOrderIds.add(e.getShippedOrderId()); }); } } if (CollectionUtil.isNotEmpty(goingChildOrderIdList)) { - goingChildOrderIdList.stream().forEach(e->{ + goingChildOrderIdList.stream().forEach(e -> { if (!childOrderIds.contains(e)) { childOrderIds.add(e); } @@ -1662,6 +1684,47 @@ public class OpOrderServiceImpl implements OpOrderService { } return true; } + + @Override + public Long tryRsyncOpOrder(Long shopid, String app, Integer priority, Date forceStart) { + OpOrderRsyncQueue queueInfo = opOrderRsyncQueueMapper.getByShopId(shopid); + Long queueId = 0L; + if (ObjectUtil.isNull(queueInfo)) { + queueInfo = new OpOrderRsyncQueue(); + queueInfo.setShopId(shopid); + queueInfo.setApp(app); + queueInfo.setGmtForceStart(forceStart); + queueInfo.setGmtModified(new Date()); + queueInfo.setPriority(priority); + queueInfo.setLocked(0L); + queueInfo.setOrderTotal(0L); + queueInfo.setCompleted(0L); + queueInfo.setStatus(StatusConst.wait); + queueInfo.setGmtCreate(new Date()); + + opOrderRsyncQueueMapper.insert(queueInfo); + queueId = queueInfo.getOpOrderRsyncQueueId(); + if (ObjectUtil.isNotNull(queueId) && queueId > 0) { + String queueRedisKey = RedisKeyConst.getQueueRedisKey("op_order_rsync_queue", true); + ListOperations listOps = redisTemplate.opsForList(); + if (priority > 99) { + listOps.leftPush(queueRedisKey, queueId.toString()); + } else { + listOps.rightPush(queueRedisKey, queueId.toString()); + } + return queueId; + } + } + + queueInfo.setGmtModified(new Date()); + queueInfo.setPriority(priority < queueInfo.getPriority() ? priority : queueInfo.getPriority()); + + if (ObjectUtil.isNotNull(forceStart)){ + queueInfo.setGmtForceStart(forceStart); + } + opOrderRsyncQueueMapper.updateByPrimaryKey(queueInfo); + return queueInfo.getOpOrderRsyncQueueId(); + } } diff --git a/ms-biz/src/main/java/com/ms/api/spi/order/RsyncFullOrderService.java b/ms-biz/src/main/java/com/ms/api/spi/order/RsyncFullOrderService.java new file mode 100644 index 00000000..4e23b6cc --- /dev/null +++ b/ms-biz/src/main/java/com/ms/api/spi/order/RsyncFullOrderService.java @@ -0,0 +1,33 @@ +package com.ms.api.spi.order; + +import javax.annotation.Resource; + +import com.jinritemai.cloud.base.api.BaseRequest; +import com.jinritemai.cloud.base.api.BaseResponse; +import com.jinritemai.cloud.base.api.ExtensionService; +import com.jinritemai.cloud.base.api.ExtensionServiceHandler; +import com.ms.api.common.ApiResult; +import com.ms.api.common.R; +import com.ms.api.common.Ret; +import com.ms.api.dto.order.RsyncFullOrderRequestDTO; +import com.ms.api.util.OrderUtil; +import lombok.extern.slf4j.Slf4j; + +@ExtensionService("rsyncFullOrder") +@Slf4j +public class RsyncFullOrderService implements ExtensionServiceHandler { + + @Resource + private OrderUtil orderUtil; + + @Override + public BaseResponse handle(BaseRequest req) { + String shopId = req.getAuthId(); + RsyncFullOrderRequestDTO dto = req.getData(); + ApiResult ret = orderUtil.rsyncFullOrder(shopId, dto.getRsyncOrderDate(), true); + if (!ret.isSuccess()) { + return R.ok(Ret.fail(ret.getMsg())); + } + return R.ok(Ret.success()); + } +} diff --git a/ms-biz/src/main/java/com/ms/api/util/OrderUtil.java b/ms-biz/src/main/java/com/ms/api/util/OrderUtil.java index 555d8f93..9349bf52 100644 --- a/ms-biz/src/main/java/com/ms/api/util/OrderUtil.java +++ b/ms-biz/src/main/java/com/ms/api/util/OrderUtil.java @@ -1,18 +1,21 @@ package com.ms.api.util; import java.util.Arrays; +import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; import cn.hutool.core.util.ObjectUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.ms.api.common.ApiResult; import com.ms.api.service.OpOrderService; +import com.ms.api.service.OrderPrintService; import com.ms.api.service.ShopService; -import com.ms.api.tool.CommonTool; -import com.ms.dal.entity.Shop; +import com.ms.dal.entity.OpOrderRsyncInfo; +import com.ms.dal.mapper.OpOrderRsyncInfoMapper; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -27,6 +30,10 @@ public class OrderUtil { private final OpOrderService opOrderService; + private final OpOrderRsyncInfoMapper opOrderRsyncInfoMapper; + + private final OrderPrintService orderPrintService; + @Transactional(rollbackFor = Exception.class) public ApiResult rsyncOrder(String targetShopId, List orderIds, String paramsRoute) { if (ObjectUtil.isEmpty(orderIds)) { @@ -40,8 +47,8 @@ public class OrderUtil { // } JSONObject ret = opOrderService.rsyncOpOrderByOrderIds(targetShopId, orderIds, new HashMap<>(), false, paramsRoute); if (ret.containsKey("orderIdAndFailReasonMap")) { - Map orderIdAndFailReasonMap =(Map) JSON.parseObject(ret.getString("orderIdAndFailReasonMap"), Map.class); - if (ObjectUtil.isEmpty(orderIdAndFailReasonMap)){ + Map orderIdAndFailReasonMap = (Map) JSON.parseObject(ret.getString("orderIdAndFailReasonMap"), Map.class); + if (ObjectUtil.isEmpty(orderIdAndFailReasonMap)) { return ApiResult.ok(); } StringBuilder failReason = new StringBuilder(); @@ -52,4 +59,26 @@ public class OrderUtil { } return ApiResult.ok(); } + + public ApiResult rsyncFullOrder(String shopId, String rsyncOrderDate, boolean isManual) { + if (!Arrays.asList("3", "7", "15", "20", "30", "60", "90").contains(rsyncOrderDate)) { + return ApiResult.fail("参数不合法"); + } + List authShopIds = Arrays.asList(shopId); + Map orderRsyncInfoMap = opOrderRsyncInfoMapper.getOpOrderRsyncInfoByShopIds(authShopIds).stream().collect(Collectors.toMap(OpOrderRsyncInfo::getShopId, x -> x)); + for (String authShopId : authShopIds) { + Long shopid = Long.valueOf(authShopId); + if (!orderRsyncInfoMap.containsKey(shopid)) { + continue; + } + Date lastRsyncOrderTime = orderRsyncInfoMap.get(shopid).getGmtOpEnd(); + System.out.println(System.currentTimeMillis() ); + System.out.println(lastRsyncOrderTime.getTime() ); + if (!isManual && ObjectUtil.isEmpty(lastRsyncOrderTime) && (System.currentTimeMillis() - lastRsyncOrderTime.getTime()) <= 300000) { + continue; + } + opOrderService.tryRsyncOpOrder(shopid,"appName",100,null); + } + return ApiResult.ok(); + } } diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncInfoMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncInfoMapper.java index 585918a8..6eed3988 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncInfoMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncInfoMapper.java @@ -1,7 +1,10 @@ package com.ms.dal.mapper; +import java.util.List; + import com.ms.dal.entity.OpOrderRsyncInfo; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * @Entity com.ms.dal.entity.OpOrderRsyncInfo @@ -21,4 +24,5 @@ public interface OpOrderRsyncInfoMapper { int updateByPrimaryKey(OpOrderRsyncInfo record); + List getOpOrderRsyncInfoByShopIds(@Param("shopIds") List asList); } diff --git a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java index 7ff0771f..4a8b5397 100644 --- a/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java +++ b/ms-dal/src/main/java/com/ms/dal/mapper/OpOrderRsyncQueueMapper.java @@ -2,6 +2,7 @@ package com.ms.dal.mapper; import com.ms.dal.entity.OpOrderRsyncQueue; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * @Entity com.ms.dal.entity.OpOrderRsyncQueue @@ -21,4 +22,5 @@ public interface OpOrderRsyncQueueMapper { int updateByPrimaryKey(OpOrderRsyncQueue record); + OpOrderRsyncQueue getByShopId(@Param("shopId") Long shopid); } diff --git a/ms-dal/src/main/resources/mapper/OpOrderRsyncInfoMapper.xml b/ms-dal/src/main/resources/mapper/OpOrderRsyncInfoMapper.xml index 2b5741de..ecf614b5 100644 --- a/ms-dal/src/main/resources/mapper/OpOrderRsyncInfoMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpOrderRsyncInfoMapper.xml @@ -24,6 +24,17 @@ from op_order_rsync_info where op_order_rsync_info_id = #{opOrderRsyncInfoId,jdbcType=BIGINT} + delete from op_order_rsync_info diff --git a/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml b/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml index 0e1aeba9..eca4dc10 100644 --- a/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml @@ -40,6 +40,11 @@ from op_order_rsync_queue where op_order_rsync_queue_id = #{opOrderRsyncQueueId,jdbcType=BIGINT} + delete from op_order_rsync_queue diff --git a/ms-web/src/main/java/com/ms/web/OrderTestController.java b/ms-web/src/main/java/com/ms/web/OrderTestController.java index 295ab61b..ea71e6a6 100644 --- a/ms-web/src/main/java/com/ms/web/OrderTestController.java +++ b/ms-web/src/main/java/com/ms/web/OrderTestController.java @@ -17,6 +17,7 @@ import com.ms.api.common.Ret; import com.ms.api.consts.AppConst; import com.ms.api.consts.DsOrderConst; import com.ms.api.consts.PurchaseOrderConst; +import com.ms.api.dto.order.RsyncFullOrderRequestDTO; import com.ms.api.dto.order.SearchDsOrderFilterDTO; import com.ms.api.dto.order.SearchDsOrderListRequestDTO; import com.ms.api.service.OpOrderExtService; @@ -69,6 +70,18 @@ public class OrderTestController { return R.ok(pager); } + @GetMapping("/rsyncFullOrder") + public BaseResponse rsyncFullOrder() { + String shopId = AppConst.TEST_SHOP_ID; + RsyncFullOrderRequestDTO dto = new RsyncFullOrderRequestDTO(); + dto.setRsyncOrderDate("7"); + ApiResult ret = orderUtil.rsyncFullOrder(shopId, dto.getRsyncOrderDate(), true); + if (!ret.isSuccess()) { + return R.ok(Ret.fail(ret.getMsg())); + } + return R.ok(Ret.success()); + } + @GetMapping("/getDsOrderCount") public BaseResponse getDsOrderCount() { String shopId = AppConst.TEST_SHOP_ID;