liude 1 год назад
Родитель
Сommit
77deced089

+ 9 - 0
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/service/impl/MerchantAuthServiceImpl.java

@@ -7,6 +7,7 @@ import com.chelvc.cloud.user.client.model.Scope;
 import com.chelvc.cloud.vehicle.client.dto.MerchantAuthDTO;
 import com.chelvc.cloud.vehicle.client.param.MerchantAuthModifyParam;
 import com.chelvc.cloud.vehicle.client.param.MerchantAuthPagingParam;
+import com.chelvc.cloud.vehicle.client.param.MerchantModifyParam;
 import com.chelvc.cloud.vehicle.server.copier.MerchantAuthCopier;
 import com.chelvc.cloud.vehicle.server.dao.MerchantAuthMapper;
 import com.chelvc.cloud.vehicle.server.entity.MerchantAuth;
@@ -45,6 +46,14 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
         merchantAuth.setApplicationTime(new Date());
         merchantAuth.setApplicant(userId);
         this.save(merchantAuth);
+        MerchantModifyParam param1 = new MerchantModifyParam();
+        param1.setName(param.getStoreName());
+        param1.setMobile(param.getLegalRepresentativeName());
+        param1.setMobile(param.getMobileNumber());
+        param1.setAddress(param.getStoreAddressDetail());
+        param1.setRecommend(true);
+        param1.setBusinessStatus("1");
+        this.merchantService.addMerchant(param1);
         return merchantAuth.getId();
     }
 

+ 23 - 0
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/service/impl/OmsOrderServiceImpl.java

@@ -19,6 +19,10 @@ import com.chelvc.framework.common.util.AssertUtils;
 import com.chelvc.framework.common.util.ObjectUtils;
 import com.chelvc.framework.common.util.StringUtils;
 import com.chelvc.framework.database.context.DatabaseContextHolder;
+import io.netty.util.HashedWheelTimer;
+import io.netty.util.Timeout;
+import io.netty.util.Timer;
+import io.netty.util.TimerTask;
 import lombok.RequiredArgsConstructor;
 import org.apache.http.util.Asserts;
 import org.springframework.beans.BeanUtils;
@@ -30,6 +34,7 @@ import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.time.LocalDateTime;
 import java.util.*;
+import java.util.concurrent.TimeUnit;
 
 /**
  * 订单Service业务层处理
@@ -310,6 +315,24 @@ public class OmsOrderServiceImpl extends ServiceImpl<OmsOrderMapper, OmsOrder> i
 
     @Override
     public void cancelOrder(Long orderId) {
+        List<Long> orderIds = new ArrayList<>();
+        orderIds.add(orderId);
+        this.baseMapper.updateOrderStatus(orderIds, 0);
+        // 初始化时间轮
+        Timer timer = new HashedWheelTimer();
+        // 定时任务
+        TimerTask task1 = new io.netty.util.TimerTask() {
+            public void run(Timeout timeout) throws Exception {
+                // 取消订单业务逻辑
+                closeOrder(orderId);
+            }
+        };
+        // 注册此定时任务(延迟时间为900秒,也就是说900秒后订单过期)
+        timer.newTimeout(task1, 900, TimeUnit.SECONDS);
+
+    }
+
+    private void closeOrder(Long orderId) {
         //查询未付款的取消订单
         List<OmsOrder> cancelOrderList = this.lambdaQuery()
                 .eq(OmsOrder::getId,orderId)