Kaynağa Gözat

Merge remote-tracking branch 'origin/master'

Mr.qian 1 hafta önce
ebeveyn
işleme
0a4fd3c69b

+ 5 - 0
cif-service/pom.xml

@@ -126,6 +126,11 @@
             <!--            <scope>provided</scope>-->
         </dependency>
 
+        <dependency>
+            <groupId>com.txz</groupId>
+            <artifactId>mall-api</artifactId>
+            <version>1.0.0-SNAPSHOT</version>
+        </dependency>
 
         <!--异维科技dubbo接口包依赖-->
         <dependency>

+ 48 - 0
cif-service/src/main/java/com/txz/cif/dubbo/client/OrderDubboServiceClient.java

@@ -0,0 +1,48 @@
+package com.txz.cif.dubbo.client;
+
+
+import com.txz.mall.service.OrderDubboService;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.dubbo.config.annotation.Reference;
+import org.springframework.stereotype.Component;
+
+@Slf4j
+@Component
+public class OrderDubboServiceClient {
+
+    @Reference
+    private OrderDubboService orderDubboService;
+
+    /**
+     * 拼团超时定时任务
+     */
+    public void scheduledTaskStorePinkSummaryClose() {
+        log.info("cif:scheduledTaskStorePinkSummaryClose start");
+        orderDubboService.scheduledTaskStorePinkSummaryClose();
+        log.info("cif:scheduledTaskStorePinkSummaryClose end");
+    }
+
+    ;
+
+    /**
+     * 自动签收定时任务
+     */
+    public void scheduledTaskBatchSigning() {
+        log.info("cif:scheduledTaskBatchSigning start");
+        orderDubboService.scheduledTaskBatchSigning();
+        log.info("cif:scheduledTaskBatchSigning end");
+    }
+
+    ;
+
+
+    public void orderTimeoutAutomaticCancel() {
+        log.info("cif:orderTimeoutAutomaticCancel start");
+        orderDubboService.orderTimeoutAutomaticCancel();
+        log.info("cif:orderTimeoutAutomaticCancel end");
+    }
+
+    ;
+
+}

+ 44 - 0
cif-service/src/main/java/com/txz/cif/task/GeneralJob.java

@@ -5,6 +5,7 @@ import cn.hutool.http.HttpResponse;
 import cn.hutool.http.HttpUtil;
 import cn.hutool.json.JSONObject;
 import cn.hutool.json.JSONUtil;
+import com.txz.cif.dubbo.client.OrderDubboServiceClient;
 import com.txz.cif.service.DayCutService;
 import com.txz.cif.configurer.Parameters;
 import com.xxl.job.core.biz.model.ReturnT;
@@ -36,6 +37,9 @@ public class GeneralJob {
     private DayCutService dayCutService;
 
 
+    @Resource
+    private OrderDubboServiceClient orderDubboServiceClient;
+
     @Resource
     private Parameters parameters;
 
@@ -84,6 +88,46 @@ public class GeneralJob {
 
 
 
+    @XxlJob("scheduledTaskStorePinkSummaryClose")
+    public ReturnT<String> scheduledTaskStorePinkSummaryClose(String param) throws Exception {
+        try {
+            logger.info("【执行拼团超时关闭拼团】开始");
+            orderDubboServiceClient.scheduledTaskStorePinkSummaryClose();
+            logger.info("【执行拼团超时关闭拼团】完成");
+        } catch (Exception e) {
+            logger.error("【执行拼团超时关闭拼团】异常:e{}", e);
+            return ReturnT.FAIL;
+        }
+        return ReturnT.SUCCESS;
+    }
+
+
+    @XxlJob("scheduledTaskBatchSigning")
+    public ReturnT<String> scheduledTaskBatchSigning(String param) throws Exception {
+        try {
+            logger.info("【执行定时签收】开始");
+            orderDubboServiceClient.scheduledTaskBatchSigning();
+            logger.info("【执行定时签收】完成");
+        } catch (Exception e) {
+            logger.error("【执行定时签收】异常:e{}", e);
+            return ReturnT.FAIL;
+        }
+        return ReturnT.SUCCESS;
+    }
+
+    @XxlJob("orderTimeoutAutomaticCancel")
+    public ReturnT<String> orderTimeoutAutomaticCancel(String param) throws Exception {
+        try {
+            logger.info("【订单支付超时定时关单任务】开始");
+            orderDubboServiceClient.orderTimeoutAutomaticCancel();
+            logger.info("【订单支付超时定时关单任务】完成");
+        } catch (Exception e) {
+            logger.error("【订单支付超时定时关单任务】异常:e{}", e);
+            return ReturnT.FAIL;
+        }
+        return ReturnT.SUCCESS;
+    }
+
     public static void main(String[] args) {
 //        int quhao = 154;
 //        int weihao = 9642;

+ 49 - 0
cif-service/src/main/java/com/txz/cif/web/mng/OrderApiController.java

@@ -0,0 +1,49 @@
+package com.txz.cif.web.mng;
+
+import com.txz.cif.core.Result;
+
+import com.txz.cif.core.ResultGenerator;
+import com.txz.cif.dubbo.client.OrderDubboServiceClient;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.web.bind.annotation.PostMapping;
+
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+
+
+@Api(tags = "[后台]mall定时任务")
+@RestController
+@RequestMapping("/order/api/test")
+public class OrderApiController {
+
+    @Resource
+    private OrderDubboServiceClient orderDubboServiceClient;
+
+
+    @PostMapping("/scheduledTaskStorePinkSummaryClose")
+    @ApiOperation(value = "拼团超时定时任务",httpMethod = "POST")
+    public Result scheduledTaskStorePinkSummaryCloseTest() {
+        orderDubboServiceClient.scheduledTaskStorePinkSummaryClose();
+        return ResultGenerator.genSuccessResult();
+    }
+
+
+    @PostMapping("/scheduledTaskBatchSigning")
+    @ApiOperation(value = "自动签收定时任务",httpMethod = "POST")
+    public Result scheduledTaskBatchSigningTest() {
+        orderDubboServiceClient.scheduledTaskBatchSigning();
+        return ResultGenerator.genSuccessResult();
+    }
+
+    @PostMapping("/orderTimeoutAutomaticCancel")
+    @ApiOperation(value = "订单超时未支付定时取消",httpMethod = "POST")
+    public Result orderTimeoutAutomaticCancel() {
+        orderDubboServiceClient.orderTimeoutAutomaticCancel();
+        return ResultGenerator.genSuccessResult();
+    }
+
+}