From cd29a16199c5bf771400ce51c15b6ac9a1a7e61a Mon Sep 17 00:00:00 2001 From: ljl Date: Fri, 22 Sep 2023 13:55:22 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ms/api/dto/dsorder/ResultDTO.java | 69 ------------------- .../api/service/impl/OpOrderServiceImpl.java | 16 ++--- 2 files changed, 8 insertions(+), 77 deletions(-) delete mode 100644 ms-api/src/main/java/com/ms/api/dto/dsorder/ResultDTO.java diff --git a/ms-api/src/main/java/com/ms/api/dto/dsorder/ResultDTO.java b/ms-api/src/main/java/com/ms/api/dto/dsorder/ResultDTO.java deleted file mode 100644 index fa3f4e19..00000000 --- a/ms-api/src/main/java/com/ms/api/dto/dsorder/ResultDTO.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.ms.api.dto.dsorder; - -import lombok.Data; - -import java.util.HashMap; -import java.util.Map; - -@Data -public class ResultDTO { - public final static String SUCCESS = "success"; - public final static String FAIL = "fail"; - - private String result; - private String reason; - private String code; - private String message; - - private Map data = new HashMap<>(); - - public boolean isSuccess() { - return "success".equals(result); - } - - public static ResultDTO success() { - ResultDTO result = new ResultDTO(); - result.setResult(SUCCESS); - result.setReason("成功"); - result.setCode(SUCCESS); - result.setMessage("成功"); - return result; - } - - public static ResultDTO success(Map data) { - ResultDTO result = new ResultDTO(); - result.setResult(SUCCESS); - result.setReason("成功"); - result.setCode(SUCCESS); - result.setMessage("成功"); - result.setData(data); - return result; - } - - public static ResultDTO fail() { - ResultDTO result = new ResultDTO(); - result.setResult(FAIL); - result.setReason("失败"); - result.setCode(FAIL); - result.setMessage("失败"); - return result; - } - - public static ResultDTO fail(String message) { - ResultDTO result = new ResultDTO(); - result.setResult(FAIL); - result.setReason(message); - result.setCode(FAIL); - result.setMessage(message); - return result; - } - - public static ResultDTO fail(String code, String message) { - ResultDTO result = new ResultDTO(); - result.setResult(FAIL); - result.setReason(message); - result.setCode(code); - result.setMessage(message); - return result; - } -} 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 2b02ff07..412ef7ff 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 @@ -563,7 +563,7 @@ public class OpOrderServiceImpl implements OpOrderService { // TODO: 2023/9/1 表基本没有 全部跳过 // processWaybillWarningStatus(shopId, orderId, orderInfo); } catch (Exception e) { - log.error("processOpOrder数据操作异常,rollback: ", e.getMessage()); + log.error("processOpOrder数据操作异常,rollback: ", e); dataSourceTransactionManager.rollback(transactionStatus); return ApiResult.fail("数据操作异常"); } @@ -1655,7 +1655,7 @@ public class OpOrderServiceImpl implements OpOrderService { throw new RuntimeException("请先选择订单"); } List orderList = getListByOrderIds(orderIds); - Boolean isSuccess = orderPrintService.batchSetIsolationOrders(Arrays.asList(shopId), orderIds); + Boolean isSuccess = orderPrintService.batchSetIsolationOrders(Collections.singletonList(shopId), orderIds); if (!isSuccess) { throw new RuntimeException("操作失败"); } @@ -1668,7 +1668,7 @@ public class OpOrderServiceImpl implements OpOrderService { throw new RuntimeException("请先选择订单"); } List orderList = getListByOrderIds(orderIds); - Boolean isSuccess = orderPrintService.batchCancelIsolationOrders(Arrays.asList(shopId), orderIds); + Boolean isSuccess = orderPrintService.batchCancelIsolationOrders(Collections.singletonList(shopId), orderIds); if (!isSuccess) { throw new RuntimeException("订单取消隔离失败"); } @@ -1676,13 +1676,13 @@ public class OpOrderServiceImpl implements OpOrderService { } @Override - public Long tryRsyncOpOrder(Long shopid, String app, Integer priority, Date forceStart) { - List list = opOrderRsyncQueueMapper.getByShopId(Arrays.asList(shopid.toString())); + public Long tryRsyncOpOrder(Long shipId, String app, Integer priority, Date forceStart) { + List list = opOrderRsyncQueueMapper.getByShopId(Collections.singletonList(shipId.toString())); OpOrderRsyncQueue queueInfo = ObjectUtil.isEmpty(list) ? null : list.get(0); - Long queueId = 0L; + Long queueId; if (ObjectUtil.isNull(queueInfo)) { queueInfo = new OpOrderRsyncQueue(); - queueInfo.setShopId(shopid); + queueInfo.setShopId(shipId); queueInfo.setApp(app); queueInfo.setHostname(""); queueInfo.setGmtForceStart(forceStart); @@ -1722,7 +1722,7 @@ public class OpOrderServiceImpl implements OpOrderService { @Override public Map checkRsyncDataFinished(List shopIds) { - Map result = new HashMap(); + Map result = new HashMap<>(); result.put("orderRsyncFinished", 1); result.put("synchronizingUserIds", new ArrayList<>()); if (ObjectUtil.isEmpty(shopIds)) { From 279c29b92adfef058ebcd475658c612ecb34ad93 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Fri, 22 Sep 2023 14:41:09 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ms/api/spi/callback/ShopAuthCallbackService.java | 2 +- .../com/ms/api/spi/move/GetRecommendProductListService.java | 2 +- .../ms/api/spi/timer/CreateSyncCategoryQueueTimerService.java | 2 +- .../com/ms/api/spi/timer/SyncShopCategoryQueueTimerService.java | 2 +- ms-biz/src/main/java/com/ms/api/tool/SecurityTool.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java index 5b420d29..683efba3 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/callback/ShopAuthCallbackService.java @@ -50,7 +50,7 @@ public class ShopAuthCallbackService extends SPIBaseService implements Extension String reqBody = req.getData().getBody(); String key = cloudAppSecret.replaceAll("-", ""); reqBody = SecurityTool.decryptDoudianCallback(reqBody, key); - log.info("receive callback body: ", reqBody); + log.info("receive callback body: " + reqBody); JSONObject bodyObj = JSONObject.parseObject(reqBody); Integer msgType = bodyObj.getInteger("msg_type"); diff --git a/ms-biz/src/main/java/com/ms/api/spi/move/GetRecommendProductListService.java b/ms-biz/src/main/java/com/ms/api/spi/move/GetRecommendProductListService.java index ea82530c..764badb9 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/move/GetRecommendProductListService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/move/GetRecommendProductListService.java @@ -58,7 +58,7 @@ public class GetRecommendProductListService extends SPIBaseService implements Ex List categoryList = categoryService.getAllLeafProductCatListFromTos(shopId.intValue(), false); Collections.shuffle(categoryList); - if (ObjectUtil.isNotEmpty(dsCateLeafArray) && ObjectUtil.isNotEmpty(dsCateLeafArray)) { + if (ObjectUtil.isNotEmpty(dsCateLeafArray) && ObjectUtil.isNotEmpty(categoryList)) { final int eachCateProductChooseCount = 15; int categoryIndex = 0; HashSet sourceItemIdSet = new HashSet<>(); diff --git a/ms-biz/src/main/java/com/ms/api/spi/timer/CreateSyncCategoryQueueTimerService.java b/ms-biz/src/main/java/com/ms/api/spi/timer/CreateSyncCategoryQueueTimerService.java index 5fe46a35..6fcbda0d 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/timer/CreateSyncCategoryQueueTimerService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/timer/CreateSyncCategoryQueueTimerService.java @@ -17,7 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; public class CreateSyncCategoryQueueTimerService extends TimerBaseService implements ExtensionServiceHandler { @Autowired - CreateSyncCategoryQueueTaskService createSyncCategoryQueueTaskService; + private CreateSyncCategoryQueueTaskService createSyncCategoryQueueTaskService; @Override public BaseResponse handle(BaseRequest req) { diff --git a/ms-biz/src/main/java/com/ms/api/spi/timer/SyncShopCategoryQueueTimerService.java b/ms-biz/src/main/java/com/ms/api/spi/timer/SyncShopCategoryQueueTimerService.java index 3a731e85..ad7ea1f8 100644 --- a/ms-biz/src/main/java/com/ms/api/spi/timer/SyncShopCategoryQueueTimerService.java +++ b/ms-biz/src/main/java/com/ms/api/spi/timer/SyncShopCategoryQueueTimerService.java @@ -17,7 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; public class SyncShopCategoryQueueTimerService extends TimerBaseService implements ExtensionServiceHandler { @Autowired - SyncShopCategoryQueueTaskService syncShopCategoryQueueTaskService; + private SyncShopCategoryQueueTaskService syncShopCategoryQueueTaskService; @Override public BaseResponse handle(BaseRequest req) { diff --git a/ms-biz/src/main/java/com/ms/api/tool/SecurityTool.java b/ms-biz/src/main/java/com/ms/api/tool/SecurityTool.java index 142c5818..325c898d 100644 --- a/ms-biz/src/main/java/com/ms/api/tool/SecurityTool.java +++ b/ms-biz/src/main/java/com/ms/api/tool/SecurityTool.java @@ -89,7 +89,7 @@ public class SecurityTool { public static void main(String[] args) { // String msgSecret = "rzYLiyrSFtW8vSQWrlRTtsSHcH6KZdJGEpCGNZRjNcdXrn1HR39YSMXhj7z36gbeHdqPqR2zbkzO2CMOJz6l1aDFX5ZYTYHsLAIdOyN3RyQYJDihcLzhlACdNf/fEf28srQI37N/7+gVwSApAmnvP7CvBg8X5Hb+2A2cK13jMT8GAskYsNieL982MMPiAZmAF8ktAqN2bLJo/IpxYrW+OXLudrRylWXeLa5fbqO+pZVAtItoGN995lf6iPF8JnWJpQaSBPVuUgU/6Ns5sFWl7A=="; - String msgSecret = "rzYLiyrSFtW8vSQWrlRTtsSHcH6KZdJGEpCGNZRjNcdXrn1HR39YSMXhj7z36gbeHdqPqR2zbkzO2CMOJz6l1aDFX5ZYTYHsLAIdOyN3RyTiAMe+84MuHM3uxeNkW/JIxvG0fighkM9qD7AtihaXkyzm2EJbnIUO4O4kWmgJxiNDhfqndhNEK/zzTxWvrgIUlZ+cJNDGjiA7XOab5l105cSVdFmay9I74sH907Bg+jz7w8JDIy5hbAK7rphu1Bv9eVQr4ct4wazka/T1/U2AvA=="; + String msgSecret = "rzYLiyrSFtW8vSQWrlRTtsSHcH6KZdJGEpCGNZRjNcdXrn1HR39YSMXhj7z36gbeHdqPqR2zbkzO2CMOJz6l1aDFX5ZYTYHsLAIdOyN3RyTiAMe+84MuHM3uxeNkW/JIKQHQ0OBWp23RHqn1mxKaiaij7cG+jkAC/nrQW027QRqWW+y74MK5v79h3ex4BvlIcPq6hALSMAso7pWuo7KTUjI+QRM8CBafWYNRzcYMl3jyEKZTozWHHKXb+aZMVcjS1hiNNTRTAfZWFfkutSk2kA=="; String appSecret = "4c927c89-d55c-42cf-805c-694269a4b165"; String key = appSecret.replaceAll("-", ""); String decrypt = decryptDoudianCallback(msgSecret,key); From 8b5c079693d68df8e063b37fe711274a981b5ce5 Mon Sep 17 00:00:00 2001 From: wangchaoxu Date: Fri, 22 Sep 2023 16:14:47 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/service/impl/OpOrderServiceImpl.java | 18 ++++++++++++------ .../ms/dal/mapper/OpOrderRsyncQueueMapper.java | 4 +++- .../mapper/OpOrderRsyncQueueMapper.xml | 8 +++++++- 3 files changed, 22 insertions(+), 8 deletions(-) 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 412ef7ff..92dcd76e 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 @@ -1676,13 +1676,13 @@ public class OpOrderServiceImpl implements OpOrderService { } @Override - public Long tryRsyncOpOrder(Long shipId, String app, Integer priority, Date forceStart) { - List list = opOrderRsyncQueueMapper.getByShopId(Collections.singletonList(shipId.toString())); + public Long tryRsyncOpOrder(Long shopId, String app, Integer priority, Date forceStart) { + List list = opOrderRsyncQueueMapper.getListByShopId(Collections.singletonList(shopId.toString())); OpOrderRsyncQueue queueInfo = ObjectUtil.isEmpty(list) ? null : list.get(0); Long queueId; if (ObjectUtil.isNull(queueInfo)) { queueInfo = new OpOrderRsyncQueue(); - queueInfo.setShopId(shipId); + queueInfo.setShopId(shopId); queueInfo.setApp(app); queueInfo.setHostname(""); queueInfo.setGmtForceStart(forceStart); @@ -1694,9 +1694,15 @@ public class OpOrderServiceImpl implements OpOrderService { queueInfo.setPageCount(0); queueInfo.setCompletedPageCount(0); queueInfo.setStatus(StatusConst.wait); - queueInfo.setGmtCreate(new Date()); - opOrderRsyncQueueMapper.insertUpdate(queueInfo); + OpOrderRsyncQueue obj = opOrderRsyncQueueMapper.getByShopId(shopId); + if (obj == null) { + queueInfo.setGmtCreate(new Date()); + opOrderRsyncQueueMapper.insertSelective(queueInfo); + } else { + queueInfo.setOpOrderRsyncQueueId(obj.getOpOrderRsyncQueueId()); + opOrderRsyncQueueMapper.updateByPrimaryKeySelective(queueInfo); + } queueId = queueInfo.getOpOrderRsyncQueueId(); if (ObjectUtil.isNotNull(queueId) && queueId > 0) { String queueRedisKey = RedisKeyConst.getQueueRedisKey(TblConst.op_order_rsync_queue, false); @@ -1728,7 +1734,7 @@ public class OpOrderServiceImpl implements OpOrderService { if (ObjectUtil.isEmpty(shopIds)) { return result; } - List opOrderRsyncQueueList = opOrderRsyncQueueMapper.getByShopId(shopIds); + List opOrderRsyncQueueList = opOrderRsyncQueueMapper.getListByShopId(shopIds); result.put("orderRsyncFinished", ObjectUtil.isNotEmpty(opOrderRsyncQueueList) ? 0 : 1); result.put("synchronizingUserIds", opOrderRsyncQueueList.stream().map(OpOrderRsyncQueue::getShopId).collect(Collectors.toList())); return result; 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 a69a0e27..33e08e2f 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 @@ -24,7 +24,9 @@ public interface OpOrderRsyncQueueMapper { int updateByPrimaryKey(OpOrderRsyncQueue record); - List getByShopId(@Param("shopIds") List shopid); + List getListByShopId(@Param("shopIds") List shopid); + + OpOrderRsyncQueue getByShopId(Long shopId); int insertUpdate(OpOrderRsyncQueue queueInfo); diff --git a/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml b/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml index 70fb7cf2..fa5db7bb 100644 --- a/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml +++ b/ms-dal/src/main/resources/mapper/OpOrderRsyncQueueMapper.xml @@ -40,7 +40,13 @@ from op_order_rsync_queue where op_order_rsync_queue_id = #{opOrderRsyncQueueId,jdbcType=BIGINT} - + select + + from op_order_rsync_queue + where shop_id = #{shopId,jdbcType=BIGINT} + +