|
@@ -6,12 +6,15 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import shop.alien.entity.store.AiIntelligentAssistant;
|
|
|
import shop.alien.entity.store.StoreCustomerService;
|
|
import shop.alien.entity.store.StoreCustomerService;
|
|
|
|
|
+import shop.alien.mapper.AiIntelligentAssistantMapper;
|
|
|
import shop.alien.mapper.StoreCustomerServiceMapper;
|
|
import shop.alien.mapper.StoreCustomerServiceMapper;
|
|
|
import shop.alien.store.service.StoreCustomerServiceService;
|
|
import shop.alien.store.service.StoreCustomerServiceService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
@@ -29,6 +32,8 @@ public class StoreCustomerServiceServiceImpl extends ServiceImpl<StoreCustomerSe
|
|
|
|
|
|
|
|
private final StoreCustomerServiceMapper storeCustomerServiceMapper;
|
|
private final StoreCustomerServiceMapper storeCustomerServiceMapper;
|
|
|
|
|
|
|
|
|
|
+ private final AiIntelligentAssistantMapper aiIntelligentAssistantMapper;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public StoreCustomerService getByQuestion(String question) {
|
|
public StoreCustomerService getByQuestion(String question) {
|
|
|
LambdaQueryWrapper<StoreCustomerService> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<StoreCustomerService> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
@@ -78,4 +83,33 @@ public class StoreCustomerServiceServiceImpl extends ServiceImpl<StoreCustomerSe
|
|
|
.last("order by rand() LIMIT " + limit);
|
|
.last("order by rand() LIMIT " + limit);
|
|
|
return storeCustomerServiceMapper.selectList(lambdaQueryWrapper);
|
|
return storeCustomerServiceMapper.selectList(lambdaQueryWrapper);
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<AiIntelligentAssistant> saveAiIntelligentAssistant(List<AiIntelligentAssistant> aiIntelligentAssistants) {
|
|
|
|
|
+ for (AiIntelligentAssistant aiIntelligentAssistant : aiIntelligentAssistants) {
|
|
|
|
|
+ aiIntelligentAssistant.setCreatedTime(new Date());
|
|
|
|
|
+ aiIntelligentAssistant.setUpdatedTime(new Date());
|
|
|
|
|
+ }
|
|
|
|
|
+ aiIntelligentAssistantMapper.insertList(aiIntelligentAssistants);
|
|
|
|
|
+ return aiIntelligentAssistants;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<AiIntelligentAssistant> selectAiIntelligentAssistant(String userId,String time) {
|
|
|
|
|
+ LambdaQueryWrapper<AiIntelligentAssistant> last = new LambdaQueryWrapper<AiIntelligentAssistant>()
|
|
|
|
|
+ .lt(AiIntelligentAssistant::getCreatedTime, time)
|
|
|
|
|
+ .eq(AiIntelligentAssistant::getDeleteFlag, 0)
|
|
|
|
|
+ .eq(AiIntelligentAssistant::getType, 0).eq(AiIntelligentAssistant::getUserId, userId).orderByDesc(AiIntelligentAssistant::getCreatedTime).last("limit 1");
|
|
|
|
|
+ AiIntelligentAssistant aiIntelligentAssistant = aiIntelligentAssistantMapper.selectOne(last);
|
|
|
|
|
+ if (ObjectUtils.isNotEmpty(aiIntelligentAssistant)) {
|
|
|
|
|
+ LambdaQueryWrapper<AiIntelligentAssistant> queryWrapper = new LambdaQueryWrapper<AiIntelligentAssistant>()
|
|
|
|
|
+ .ge(AiIntelligentAssistant::getCreatedTime, aiIntelligentAssistant.getCreatedTime())
|
|
|
|
|
+ .lt(AiIntelligentAssistant::getCreatedTime, time)
|
|
|
|
|
+ .eq(AiIntelligentAssistant::getDeleteFlag, 0)
|
|
|
|
|
+ .eq(AiIntelligentAssistant::getUserId, userId)
|
|
|
|
|
+ .orderByAsc(AiIntelligentAssistant::getCreatedTime);
|
|
|
|
|
+ return aiIntelligentAssistantMapper.selectList(queryWrapper);
|
|
|
|
|
+ }
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|