| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | |
| | | @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 |