From 0fab8240d03efd88f75bb8864f4cb98f9d108aae Mon Sep 17 00:00:00 2001
From: fengjin <1435304038@qq.com>
Date: 星期一, 26 九月 2022 18:19:45 +0800
Subject: [PATCH] 添加短信登录功能 添加常见问题表模块 办事指南访问模块 并给相应的所有接口加token验证

---
 flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java |   36 ++++++++++++++++++++++++++++++------
 1 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java b/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java
index 6c991ea..7374151 100644
--- a/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java
+++ b/flower_city/src/main/java/com/dg/core/service/impl/TransactionEventImpl.java
@@ -4,10 +4,8 @@
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.dg.core.db.gen.entity.KeywordEntity;
-import com.dg.core.db.gen.entity.OrganizationChartEntity;
-import com.dg.core.db.gen.entity.SysUser;
-import com.dg.core.db.gen.entity.TransactionEvent;
+import com.dg.core.db.gen.entity.*;
+import com.dg.core.db.gen.mapper.AutomessageTransactionEventInterviewMapper;
 import com.dg.core.db.gen.mapper.KeywordMapper;
 import com.dg.core.db.gen.mapper.OrganizationChartMapper;
 import com.dg.core.db.gen.mapper.TransactionEventMapper;
@@ -19,6 +17,9 @@
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -31,9 +32,32 @@
     @Resource
     private KeywordMapper keywordMapper;
 
+    @Resource
+    private AutomessageTransactionEventInterviewMapper automessageTransactionEventInterviewMapper;
+
     @Override
-    public TransactionEvent selectConfigData(String Id) {
-        return baseMapper.selectConfigData(Id);
+    public TransactionEvent selectConfigData(String Id,SysUser sysUser) {
+        TransactionEvent transactionEvent = baseMapper.selectConfigData(Id);
+        LocalDateTime startTime = LocalDate.now().atTime(0, 0, 0);
+        LocalDateTime endTime = LocalDate.now().atTime(23, 59, 59);
+        AutomessageTransactionEventInterview automessageTransactionEventInterview = automessageTransactionEventInterviewMapper.selectOne(new QueryWrapper<AutomessageTransactionEventInterview>()
+                .lambda().eq(AutomessageTransactionEventInterview::getTransactionEventId, Id)
+                .eq(AutomessageTransactionEventInterview::getUserId, sysUser.getUserId())
+                .orderByDesc(AutomessageTransactionEventInterview::getInterviewTime)
+                .last("limit 1"));
+        transactionEvent.setQueryTime(LocalDateTime.now());
+        //判断上次访问时间是不是今天 如果
+        if (automessageTransactionEventInterview==null||(!(transactionEvent.getQueryTime().isAfter(startTime)&&transactionEvent.getQueryTime().isBefore(endTime)))) {
+            transactionEvent.setBrowseNum(transactionEvent.getBrowseNum()+1);
+            baseMapper.updateById(transactionEvent);
+            AutomessageTransactionEventInterview automessageTransactionEventInterviewNew =
+                    new AutomessageTransactionEventInterview();
+            automessageTransactionEventInterviewNew.setTransactionEventId(Integer.valueOf(Id));
+            automessageTransactionEventInterviewNew.setUserId(new Long(sysUser.getUserId()));
+            automessageTransactionEventInterviewNew.setInterviewTime(LocalDateTime.now());
+            automessageTransactionEventInterviewMapper.insert(automessageTransactionEventInterviewNew);
+        }
+        return transactionEvent;
     }
 
     @Override

--
Gitblit v1.7.1