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..9254acf7 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 @@ -447,7 +447,15 @@ public class OpOrderServiceImpl implements OpOrderService { OpOrder insertOrderData = BeanUtil.toBean(orderInfo, OpOrder.class); log.info("start insertUpdateOpOrder {}", insertOrderData); - opOrderMapper.insertOrUpdate(insertOrderData); + OpOrder orderObj = opOrderMapper.selectByOrderId(order.getOrderId()); + if (orderObj == null) { + opOrderMapper.insertSelective(insertOrderData); + } else { + OpOrder updateOrderData = insertOrderData; + updateOrderData.setGmtCreate(null); + updateOrderData.setOpOrderId(orderObj.getOpOrderId()); + opOrderMapper.updateByPrimaryKeySelective(updateOrderData); + } // TODO: 2023/8/31 op_order_user_open_id // log.info("start saveOpOrderUserOpenId "); @@ -563,7 +571,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 +1663,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 +1676,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 +1684,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 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 = 0L; + Long queueId; if (ObjectUtil.isNull(queueInfo)) { queueInfo = new OpOrderRsyncQueue(); - queueInfo.setShopId(shopid); + queueInfo.setShopId(shopId); queueInfo.setApp(app); queueInfo.setHostname(""); queueInfo.setGmtForceStart(forceStart); @@ -1694,9 +1702,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); @@ -1722,13 +1736,13 @@ 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)) { 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-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); 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 b1554c9a..24c4287b 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 @@ -35,7 +35,6 @@ public class OrderUtil { private final AfterSaleService afterSaleService; - @Transactional(rollbackFor = Exception.class) public ApiResult rsyncOrder(ShopBO shopBO, List orderIds) { if (ObjectUtil.isEmpty(orderIds)) { // autoTriggerRsyncData(orderIds); 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} + +