Răsfoiți Sursa

训练营APP接口

mac 2 ani în urmă
părinte
comite
27ff5ce6f3

+ 44 - 0
kxs-quartz/src/main/java/com/kxs/daemon/quartz/task/SystemBeanTask.java

@@ -0,0 +1,44 @@
+package com.kxs.daemon.quartz.task;
+
+import com.kxs.common.core.constant.SecurityConstants;
+import com.kxs.daemon.quartz.constants.SkyQuartzEnum;
+import com.kxs.product.api.feign.RemoteKxsProductService;
+import com.kxs.system.api.feign.RemoteOldService;
+import com.kxs.system.api.feign.RemoteSysJobService;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+
+/**
+ * 系统模块 Bean 任务
+ *
+ * @author 没秃顶的码农
+ * @date 2024-03-21
+ */
+@Slf4j
+@Component("systemBeanTask")
+@RequiredArgsConstructor
+public class SystemBeanTask {
+
+    private final RemoteSysJobService remoteSysJobService;
+
+
+    /**
+     *  循环过期机具添加预扣款
+     */
+    @SneakyThrows
+    public String recycleMachineSchedule(String para) {
+        log.info("循环过期机具添加预扣款:{},输入参数{}", LocalDateTime.now(), para);
+        try {
+            remoteSysJobService.prizePoolIsRefreshed(para, SecurityConstants.FROM_IN);
+            return SkyQuartzEnum.JOB_LOG_STATUS_SUCCESS.getType();
+
+        }catch (Exception e){
+            log.error(e.getLocalizedMessage());
+        }
+        return SkyQuartzEnum.JOB_LOG_STATUS_FAIL.getType();
+    }
+}

+ 3 - 2
kxs-system/kxs-system-api/src/main/java/com/kxs/system/api/feign/RemoteSysJobService.java

@@ -4,6 +4,7 @@ import com.kxs.common.core.constant.SecurityConstants;
 import com.kxs.system.api.model.SysLog;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.service.annotation.PostExchange;
 
 /**
@@ -18,7 +19,7 @@ public interface RemoteSysJobService {
 	 * 个人及散下团队购买电签券/大POS券1组,1组计入60元,1组按实收金额5%计算,
 	 * 个人及散下团队购买电签券/大POS券计1组
 	 */
-	@PostExchange("/system-job/taskSubmitOrderAddCamp")
-	void taskSubmitOrderAddCamp(@RequestHeader(SecurityConstants.FROM) String from);
+	@PostExchange("/system-job/prizePoolIsRefreshed")
+	void prizePoolIsRefreshed(@RequestParam("param") String param, @RequestHeader(SecurityConstants.FROM) String from);
 
 }

+ 10 - 0
kxs-system/kxs-system-api/src/main/java/com/kxs/system/api/feign/config/KxsSystemFeignClientConfiguration.java

@@ -135,5 +135,15 @@ public class KxsSystemFeignClientConfiguration {
 		HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(client)).build();
 		return factory.createClient(RemoteParamService.class);
 	}
+	/**
+	 * 参数
+	 * @param client 客户端
+	 * @return 参数
+	 */
+	@Bean
+	RemoteSysJobService remoteSysJobService(@Qualifier("kxsSystemFeignClient") WebClient client) {
+		HttpServiceProxyFactory factory = HttpServiceProxyFactory.builder(WebClientAdapter.forClient(client)).build();
+		return factory.createClient(RemoteSysJobService.class);
+	}
 
 }

+ 15 - 0
kxs-system/kxs-system-biz/src/main/java/com/kxs/system/biz/service/impl/KxsCampServiceImpl.java

@@ -36,6 +36,9 @@ import com.kxs.user.api.model.KxsLeader;
 import com.kxs.user.api.model.KxsUser;
 import com.pig4cloud.plugin.excel.vo.ErrorMessage;
 import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.stereotype.Service;
 import org.springframework.validation.BindingResult;
 
@@ -50,6 +53,8 @@ import java.util.*;
  */
 @Service("kxsCampService")
 @RequiredArgsConstructor
+@EnableAsync
+@Slf4j
 public class KxsCampServiceImpl extends ServiceImpl<KxsCampMapper, KxsCamp> implements KxsCampService {
 
     private final RemoteKxsUserService remoteKxsUserService;
@@ -169,6 +174,7 @@ public class KxsCampServiceImpl extends ServiceImpl<KxsCampMapper, KxsCamp> impl
     }
 
     @Override
+    @Async("getAsyncExecutor")
     public void prizePoolIsRefreshed() {
         //查询正在进行中的活动
         List<KxsCamp> list = baseMapper.selectList(Wrappers.<KxsCamp>lambdaQuery().eq(KxsCamp::getStatus, CampStatusEnum.STATUS_NORMAL.getType()));
@@ -279,6 +285,15 @@ public class KxsCampServiceImpl extends ServiceImpl<KxsCampMapper, KxsCamp> impl
                 }
             }
 
+            /*
+             * 查询活动区间开机数
+             */
+
+
+
+
+
+
             kxsCamp.setBonusPool(totalBonusPool);
             kxsCamp.setOrderNum(orderNum);
             baseMapper.updateById(kxsCamp);