Преглед изворни кода

人员充值做校验是否同步成功

yq пре 3 година
родитељ
комит
f0f363d730

+ 7 - 0
src/main/java/com/usky/dxtop/service/MsgLogService.java

@@ -20,4 +20,11 @@ public interface MsgLogService extends IService<MsgLog> {
 
 
     void consumerSuccess(Long id,String consequence);
+
+    /**
+     * 判断是否同步成功
+     * @param businessId
+     * @return
+     */
+    boolean isSuccess(Long businessId);
 }

+ 15 - 0
src/main/java/com/usky/dxtop/service/impl/MsgLogServiceImpl.java

@@ -1,5 +1,7 @@
 package com.usky.dxtop.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.usky.dxtop.mapper.MsgLogMapper;
 import com.usky.dxtop.model.MsgLog;
@@ -35,4 +37,17 @@ public class MsgLogServiceImpl extends ServiceImpl<MsgLogMapper, MsgLog> impleme
         }
     }
 
+    @Override
+    public boolean isSuccess(Long businessId) {
+        LambdaQueryWrapper<MsgLog> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(MsgLog::getMsgFlag,MsgLogStatus.CONSUMER_SUCCESS.getCode())
+                .eq(MsgLog::getBusinessId,businessId);
+        int count = this.count(queryWrapper);
+        if (count > 0){
+            return true;
+        }else {
+            return false;
+        }
+    }
+
 }

+ 3 - 1
src/main/java/com/usky/dxtop/service/impl/OrderServiceImpl.java

@@ -641,11 +641,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             });
             //添加卡号
             Staff staff = staffService.getById(order.getUserId());
-            Optional.ofNullable(staff).orElseThrow(() -> new CustomException("卡号不能为空"));
+            Optional.ofNullable(staff).orElseThrow(() -> new CustomException("用户信息不存在"));
             Optional.ofNullable(staff.getCardId()).orElseThrow(() -> new CustomException("卡号不能为空"));
             order.setCard(staff.getCardId());
             order.setUserName(staff.getName());
             order.setUserPhone(staff.getContacts());
+            //判断卡同步成功
+            Assert.check(msgLogService.isSuccess(order.getUserId()),"人员同步失败,请手动同步人员信息");
         }else {
             if (null != order.getChannelId() && 0 != order.getChannelId()){
                 TopChannel topChannel = topChannelService.getById(order.getChannelId());