From 4ad4b51a4fb177eafee8a3a355496e7b6c1be662 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期四, 11 七月 2024 16:24:46 +0800
Subject: [PATCH] 花城 小程序签退打卡获取积分详情报错2

---
 springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NeedProblemInventoryServiceImpl.java |  135 +++++++++++++++++++++++++++++++-------------
 1 files changed, 94 insertions(+), 41 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NeedProblemInventoryServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NeedProblemInventoryServiceImpl.java
index eb777eb..24d08b1 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NeedProblemInventoryServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/NeedProblemInventoryServiceImpl.java
@@ -21,6 +21,7 @@
 import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -42,24 +43,72 @@
                                                   String kind,
                                                   String userId,
                                                   String userIds,
-                                                  String communityId)
+                                                  String isDisplay,
+                                                  String communityId,
+                                                  Date startTime,
+                                                  Date endTime)
     {
         Page page = new Page<>(pageNum,pageSize);
-        return baseMapper.getList(page, search, classifyId,status,kind,userId,userIds,communityId);
+        return baseMapper.getList(page, search, classifyId,status,kind,userId,userIds,isDisplay,communityId,startTime,endTime);
     }
 
     @Override
     public IPage<NeedProblemInventoryDTO> getMyJoinList(int pageNum, int pageSize,String search,String status,
                                                         String kind,
                                                         String userIds,
-                                                        String userId) {
+                                                        String isDisplay,
+                                                        String userId,
+                                                        Date startTime,
+                                                        Date endTime) {
         Page page = new Page<>(pageNum,pageSize);
-        return baseMapper.getMyJoinList(page, search, status,kind,userIds,userId);
+        return baseMapper.getMyJoinList(page, search, status,kind,userIds,isDisplay,userId,startTime,endTime);
     }
 
     @Override
-    public NeedProblemInventoryDTO getDetails(String id,String userIds) {
-        return baseMapper.getDetails(id,userIds);
+    public NeedProblemInventoryDTO getDetails(String id,String userIds)
+    {
+        NeedProblemInventoryDTO item=baseMapper.getDetails(id,userIds);
+        //当前时间
+        long newTime = System.currentTimeMillis();
+        //活动报名时间
+        long applyStartTime = item.getClaimStartTime().getTime();
+        //报名结束时间
+        long applyEndTime = item.getClaimEndTime().getTime();
+        //活动开始时间
+        long activityStartTime = item.getNeedStartTime().getTime();
+        //活动结束时间
+        long activityEndTime = item.getNeedEndTime().getTime();
+
+
+        switch (item.getStatus()) {
+            //待开始
+            case "1":
+                if (newTime > applyEndTime) {
+                    //报名结束
+                    NeedProblemInventoryDTO vo = new NeedProblemInventoryDTO();
+                    vo.setId(item.getId());
+                    vo.setStatus("2");
+                    item.setStatus("2");
+                    baseMapper.editData(vo);
+                }
+
+                break;
+            //报名中
+            case "2":
+                if (newTime > activityEndTime) {
+                    NeedProblemInventoryDTO vo = new NeedProblemInventoryDTO();
+                    vo.setId(item.getId());
+                    vo.setStatus("3");
+                    item.setStatus("3");
+                    baseMapper.editData(vo);
+                }
+                break;
+            //已开始
+            case "3":
+
+                break;
+        }
+        return item;
     }
 
     @Override
@@ -68,40 +117,40 @@
         item.setStatus("1");
         int num=baseMapper.addData(item);
         //1问题清单  2需求清单
-        if(num>0)
-        {
-            List<String> openIdList=baseMapper.getOpenIdList(item.getCommunityId());
-            if(openIdList==null || openIdList.size()<=0)
-            {
-                return num;
-            }
-            if(item.getKind().equals("1"))
-            {
-                WxXCXTempSend util = new WxXCXTempSend();
-                try {
-                    for (String str:openIdList)
-                    {
-                        WxUtil.sendLongTimeTemplate(str,util.getAccessToken(),"问题清单发布提醒",item.getTitle(),"/packageH/pages/problemDetail/problemDetail?type=1&id="+item.getId());
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    return num;
-                }
-            }
-            else
-            {
-                WxXCXTempSend util = new WxXCXTempSend();
-                try {
-                    for (String str:openIdList)
-                    {
-                        WxUtil.sendLongTimeTemplate(str,util.getAccessToken(),"需求清单发布提醒",item.getTitle(),"/packageH/pages/problemDetail/problemDetail?type=2&id="+item.getId());
-                    }
-                } catch (Exception e) {
-                    e.printStackTrace();
-                    return num;
-                }
-            }
-        }
+//        if(num>0)
+//        {
+//            List<String> openIdList=baseMapper.getOpenIdList(item.getCommunityId());
+//            if(openIdList==null || openIdList.size()<=0)
+//            {
+//                return num;
+//            }
+//            if(item.getKind().equals("1"))
+//            {
+//                WxXCXTempSend util = new WxXCXTempSend();
+//                try {
+//                    for (String str:openIdList)
+//                    {
+//                        WxUtil.sendLongTimeTemplate(str,util.getAccessToken(),"问题清单发布提醒",item.getTitle(),"/packageH/pages/problemDetail/problemDetail?type=1&id="+item.getId());
+//                    }
+//                } catch (Exception e) {
+//                    e.printStackTrace();
+//                    return num;
+//                }
+//            }
+//            else
+//            {
+//                WxXCXTempSend util = new WxXCXTempSend();
+//                try {
+//                    for (String str:openIdList)
+//                    {
+//                        WxUtil.sendLongTimeTemplate(str,util.getAccessToken(),"需求清单发布提醒",item.getTitle(),"/packageH/pages/problemDetail/problemDetail?type=2&id="+item.getId());
+//                    }
+//                } catch (Exception e) {
+//                    e.printStackTrace();
+//                    return num;
+//                }
+//            }
+//        }
         return num;
     }
 
@@ -119,6 +168,8 @@
     public R timedNewFightNeedProblemInventoryHandler() {
         //        定时任务
         List<NeedProblemInventoryDTO> list = baseMapper.getTimeList();
+        int num=0;
+        int num2=0;
 
         for (NeedProblemInventoryDTO item : list) {
             //当前时间
@@ -142,6 +193,7 @@
                         vo.setId(item.getId());
                         vo.setStatus("2");
                         baseMapper.editData(vo);
+                        num++;
                     }
 
                     break;
@@ -152,6 +204,7 @@
                         vo.setId(item.getId());
                         vo.setStatus("3");
                         baseMapper.editData(vo);
+                        num2++;
                     }
                     break;
                 //已开始
@@ -161,6 +214,6 @@
             }
 
         }
-        return R.ok();
+        return R.ok(num+" "+num2);
     }
 }

--
Gitblit v1.7.1