From 7c11b241c3b16bccd1dc9ea62a16d2b5d64dbc4f Mon Sep 17 00:00:00 2001
From: CeDo <cedoogle@gmail.com>
Date: 星期二, 27 四月 2021 11:32:25 +0800
Subject: [PATCH] add:微心愿状态刷新任务

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMicroWishServiceImpl.java |    9 +++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActMicroWishService.java          |    7 +++++++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java                            |    9 +++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java                        |    9 +++++++++
 springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java                              |   14 ++++++++++++++
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java  |    2 --
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java                  |    5 +++++
 7 files changed, 53 insertions(+), 2 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
index 7dd9a5a..2f5d2c0 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -742,6 +742,15 @@
     @PostMapping("timedtaskactactivityall")
     R timedTaskActActivityAll();
 
+
+    /**
+     * 定时任务刷新社区活动的各个状态 除取消外
+     *
+     * @return
+     */
+    @PostMapping("timedtaskactmicrowishall")
+    R timedTaskActMicroWishAll();
+
     /**
      * 其他建筑详情
      *
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
index deab443..e38e6a9 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/CommunityApi.java
@@ -1114,6 +1114,15 @@
     }
 
     /**
+     * 定时任务刷新微心愿的状态
+     * @return 更新结果
+     */
+    @PostMapping("timedtaskactmicrowish")
+    R timedTaskActMicroWishAll(){
+        return comActMicroWishService.timedTaskActMicroWishAll();
+    }
+
+    /**
      * 其他建筑详情
      * @param id 主键id
      * @return 建筑内容
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
index c440bb1..e1c20af 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActMicroWishDAO.java
@@ -9,6 +9,7 @@
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.apache.ibatis.annotations.Update;
 
 import java.util.List;
 
@@ -151,4 +152,8 @@
             "GROUP BY\n" +
             "\tw.community_id\n")
     List<TodoEventsVO> selectNeedToDo(@Param("communityId") Long communityId, @Param("userId") Long userId);
+
+    @Update("update com_act_micro_wish set `status`=4 where `status`=5 and TIMESTAMPDIFF(HOUR, feedback_at, SYSDATE())>=72")
+    int updateStatusAutoConfirm();
+
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActMicroWishService.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActMicroWishService.java
index 49ee41a..559880e 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActMicroWishService.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComActMicroWishService.java
@@ -61,4 +61,11 @@
      * @return
      */
     R deleteMicroWish(Long id);
+
+
+    /**
+     * 定时任务刷新微心愿状态
+     * @return
+     */
+    R timedTaskActMicroWishAll();
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
index da124bc..d4d5f56 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
@@ -412,8 +412,6 @@
         return R.ok(indexDataVO);
     }
 
-
-
     /**
      * 获取最近七天的时间
      * @return
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMicroWishServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMicroWishServiceImpl.java
index 678ef7b..6f31a02 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMicroWishServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActMicroWishServiceImpl.java
@@ -14,6 +14,7 @@
 import com.panzhihua.service_community.model.dos.ComActMicroWishDO;
 import com.panzhihua.service_community.model.dos.ComActMicroWishUserDO;
 import com.panzhihua.service_community.service.ComActMicroWishService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
@@ -28,6 +29,7 @@
  * @create: 2020-12-07 14:34
  **/
 @Service
+@Slf4j
 public class ComActMicroWishServiceImpl extends ServiceImpl<ComActMicroWishDAO, ComActMicroWishDO> implements ComActMicroWishService {
     @Resource
     private ComActMicroWishDAO comActMicroWishDAO;
@@ -251,4 +253,11 @@
         comActMicroWishUserDAO.delete(new LambdaQueryWrapper<ComActMicroWishUserDO>().eq(ComActMicroWishUserDO::getMicroWishId,id));
         return R.ok();
     }
+
+    @Override
+    public R timedTaskActMicroWishAll() {
+        int num=comActMicroWishDAO.updateStatusAutoConfirm();
+        log.info("定时任务--修改待自动确认微心愿状态数量【{}】",num);
+        return R.ok();
+    }
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java b/springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java
index 401522f..9d881ad 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/timejob/src/main/java/com/panzhihua/timejob/jobhandler/CommunityJobHandler.java
@@ -115,4 +115,18 @@
         log.info("执行结果【{}】",r.toString());
         return ReturnT.SUCCESS;
     }
+
+
+    /**
+     * 定时任务刷新社区活动的各个状态 除取消外
+     * @return 刷新个数
+     * @throws Exception 出现的异常
+     */
+    @XxlJob("timedTaskActActivityAllJobHandler")
+    public ReturnT<String> timedTaskActMicroWishAllJobHandler(String param) throws Exception {
+        log.info("定时任务刷新微心愿 待自动确认的状态");
+        R r=communityService.timedTaskActMicroWishAll();
+        log.info("执行结果【{}】",r.toString());
+        return ReturnT.SUCCESS;
+    }
 }

--
Gitblit v1.7.1