|
|
|
@ -5,11 +5,13 @@ import com.pjilisense.flxai.base.service.impl.CrudServiceImpl;
|
|
|
|
|
import com.pjilisense.flxai.dao.AppAiAssistantDao;
|
|
|
|
|
import com.pjilisense.flxai.dto.AppAiAssistantDTO;
|
|
|
|
|
import com.pjilisense.flxai.entity.AppAiAssistantEntity;
|
|
|
|
|
import com.pjilisense.flxai.entity.AppToolsSetEntity;
|
|
|
|
|
import com.pjilisense.flxai.service.AppAiAssistantService;
|
|
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.pjilisense.flxai.utils.MapUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* AI助手表
|
|
|
|
@ -30,5 +32,44 @@ public class AppAiAssistantServiceImpl extends CrudServiceImpl<AppAiAssistantDao
|
|
|
|
|
return wrapper;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public QueryWrapper<AppAiAssistantEntity> getWrapperAll(Map<String, Object> params){
|
|
|
|
|
String userid = (String)params.get("userid");
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AppAiAssistantEntity> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.eq(StrUtil.isNotBlank(userid), "userid", userid);
|
|
|
|
|
wrapper.orderByDesc("createAt","createdAt");
|
|
|
|
|
return wrapper;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public List<Map<String, Object>> getAllAiTools(String userid) {
|
|
|
|
|
Map<String, Object> params =new HashMap<>();
|
|
|
|
|
params.put("userid",userid);
|
|
|
|
|
List<AppAiAssistantEntity> entityList = baseDao.selectList(getWrapperAll(params));
|
|
|
|
|
params.clear();
|
|
|
|
|
List<Map<String, Object>> retList = new ArrayList<>();
|
|
|
|
|
if(retList!=null && retList.size()>0) {
|
|
|
|
|
for (AppAiAssistantEntity entity : entityList) {
|
|
|
|
|
Map<String, Object> mapx = MapUtils.objectToMap(entity);
|
|
|
|
|
retList.add(mapx);
|
|
|
|
|
HashMap<String, Object> meta = new HashMap<>();
|
|
|
|
|
mapx.put("meta", meta);
|
|
|
|
|
meta.put("avatar", mapx.get("avatar"));
|
|
|
|
|
meta.put("description", mapx.get("description"));
|
|
|
|
|
meta.put("title", mapx.get("title"));
|
|
|
|
|
meta.put("category", mapx.get("category"));
|
|
|
|
|
String tags = (String) mapx.get("tags");
|
|
|
|
|
if (tags.length() > 0) {
|
|
|
|
|
meta.put("tags", Arrays.asList(tags.split("\\,")));
|
|
|
|
|
} else {
|
|
|
|
|
meta.put("tags", new ArrayList<>());
|
|
|
|
|
}
|
|
|
|
|
mapx.remove("avatar");
|
|
|
|
|
mapx.remove("description");
|
|
|
|
|
mapx.remove("title");
|
|
|
|
|
mapx.remove("category");
|
|
|
|
|
mapx.remove("tags");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return retList;
|
|
|
|
|
}
|
|
|
|
|
}
|