Commit a3dcd50a authored by jennie chen's avatar jennie chen

1.应用热度定时更新

2.获取记忆片段
3.根据应用ID和记忆时间戳删除某个记忆片段
4.根据应用ID删除所有记忆片段
5.修改获取用户创建应用列表的返回
6.收藏/取消收藏个人空间的应用
7.配置【已发布的应用】发布至应用广场(上架应用)
8.下架应用
9.获取应用广场中的应用列表
10.收藏/取消收藏应用市场中的应用
11.修改部分细节
parent 62fc825d
......@@ -22,15 +22,6 @@ public interface AgentApplicationInfoService {
Integer[] knowledgeIds, Integer communicationTurn, Float topP,
List<Message> messages, List<Tool> tools, HttpServletResponse httpServletResponse) throws Exception;
/**
* 应用下架
*
* @param agentId
* @return
*/
boolean unPublish(String agentId) throws Exception;
/**
* 角色指令AI生成
*
......@@ -76,4 +67,19 @@ public interface AgentApplicationInfoService {
* @param input 用户输入内容
*/
CreateAgentTitleAndDescEntity createAgentTitleAndDesc(String input);
/**
* 收藏/取消收藏应用广场中的应用
*
* @param id 应用广场的应用id
* @param agentId Agent应用id
* */
void collectOrCancelAgentInMall(Integer id, String agentId) throws Exception;
/**
* 收藏/取消收藏个人空间中的应用
*
* @param agentId Agent应用id
* */
void collectOrCancelAgentInPerson(String agentId) throws Exception;
}
......@@ -3,9 +3,9 @@ package cn.com.poc.agent_application.aggregate;
public interface AgentApplicationMallService {
/**
* 收藏/取消收藏应用
* 收藏/取消收藏应用广场中的应用
*
* @param agentMallId 应用广场中的id
* */
void collectOrCancelAgentInMall(Integer agentMallId) throws Exception;
void collectOrCancelAgentInMall(Integer id) throws Exception;
}
......@@ -5,11 +5,8 @@ import cn.com.poc.agent_application.constant.AgentApplicationConstants;
import cn.com.poc.agent_application.constant.AgentApplicationDialoguesRecordConstants;
import cn.com.poc.agent_application.constant.AgentApplicationGCConfigConstants;
import cn.com.poc.agent_application.entity.*;
import cn.com.poc.agent_application.service.BizAgentApplicationGcConfigService;
import cn.com.poc.agent_application.service.BizAgentApplicationInfoService;
import cn.com.poc.agent_application.service.BizAgentApplicationLargeModelListService;
import cn.com.poc.agent_application.service.BizAgentApplicationPublishService;
import cn.com.poc.common.service.RedisService;
import cn.com.poc.agent_application.service.*;
import cn.com.poc.common.constant.CommonConstant;
import cn.com.poc.common.utils.BlContext;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.knowledge.entity.BizKnowledgeDocumentEntity;
......@@ -28,6 +25,7 @@ import cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.GetLongMemo
import cn.com.poc.thirdparty.resource.demand.ai.function.value_memory.GetValueMemory;
import cn.com.poc.thirdparty.service.LLMService;
import cn.com.yict.framemax.core.exception.BusinessException;
import cn.com.yict.framemax.data.model.PagingInfo;
import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.core.type.TypeReference;
import org.apache.commons.collections4.CollectionUtils;
......@@ -79,7 +77,10 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
private LLMService llmService;
@Resource
private RedisService redisService;
private BizAgentApplicationMallService bizAgentApplicationMallService;
@Resource
private BizMemberAgentApplicationCollectService bizMemberAgentApplicationCollectService;
@Override
public boolean updateAndPublish(BizAgentApplicationInfoEntity bizAgentApplicationInfoEntity) throws Exception {
......@@ -323,13 +324,6 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
return JsonUtils.deSerialize(res.substring(start, end + 1), CreateAgentTitleAndDescEntity.class);
}
@Override
public boolean unPublish(String agentId) throws Exception {
bizAgentApplicationPublishService.deleteByAgentId(agentId);
bizAgentApplicationInfoService.unPublish(agentId);
return true;
}
/**
* 构建应用信息提示词
*
......@@ -627,4 +621,79 @@ public class AgentApplicationInfoServiceImpl implements AgentApplicationInfoServ
return largeModelEntity.getModelName();
}
@Override
public void collectOrCancelAgentInMall(Integer id, String agentId) throws Exception {
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
BizAgentApplicationMallEntity mallEntity = bizAgentApplicationMallService.get(id);
if(mallEntity == null){
throw new BusinessException("应用不存在");
}
// 先判断当前应用被当前用户收藏了吗
BizMemberAgentApplicationCollectEntity collectEntity = new BizMemberAgentApplicationCollectEntity();
collectEntity.setAgentId(agentId);
collectEntity.setMemberId(userBaseEntity.getUserId().intValue());
List<BizMemberAgentApplicationCollectEntity> collectEntities = bizMemberAgentApplicationCollectService.findByExample(collectEntity, new PagingInfo());
if(collectEntities.isEmpty() || CommonConstant.IsDeleted.N.equals(collectEntities.get(0).getIsCollect())){ //如果没被收藏
// 收藏该应用
// 说明从来没收藏过
if(collectEntities.isEmpty()){
// 在用户收藏表中添加数据
BizMemberAgentApplicationCollectEntity entity = new BizMemberAgentApplicationCollectEntity();
entity.setIsCollect(CommonConstant.IsDeleted.Y);
entity.setMemberId(userBaseEntity.getUserId().intValue());
entity.setAgentId(agentId);
bizMemberAgentApplicationCollectService.save(entity);
}else{ // 说明之前收藏过,则只需要做个修改
collectEntity.setIsCollect(CommonConstant.IsDeleted.Y);
bizMemberAgentApplicationCollectService.update(collectEntity);
}
// 在应用广场的应用中 添加收藏数
mallEntity.setCollectNumber(mallEntity.getCollectNumber() + 1);
}else {
// 取消收藏该应用
collectEntities.get(0).setIsCollect(CommonConstant.IsDeleted.N);
bizMemberAgentApplicationCollectService.update(collectEntity);
// 在应用广场的应用中 取消收藏数
mallEntity.setCollectNumber(mallEntity.getCollectNumber() - 1);
}
bizAgentApplicationMallService.update(mallEntity);
}
@Override
public void collectOrCancelAgentInPerson(String agentId) throws Exception {
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
// 先判断当前应用被当前用户收藏了吗
BizMemberAgentApplicationCollectEntity collectEntity = new BizMemberAgentApplicationCollectEntity();
collectEntity.setAgentId(agentId);
collectEntity.setMemberId(userBaseEntity.getUserId().intValue());
List<BizMemberAgentApplicationCollectEntity> collectEntities = bizMemberAgentApplicationCollectService.findByExample(collectEntity, new PagingInfo());
if(collectEntities.isEmpty() || CommonConstant.IsDeleted.N.equals(collectEntities.get(0).getIsCollect())){ //如果没被收藏
// 收藏该应用
// 说明从来没收藏过
if(collectEntities.isEmpty()){
// 在用户收藏表中添加数据
BizMemberAgentApplicationCollectEntity entity = new BizMemberAgentApplicationCollectEntity();
entity.setIsCollect(CommonConstant.IsDeleted.Y);
entity.setMemberId(userBaseEntity.getUserId().intValue());
entity.setAgentId(agentId);
bizMemberAgentApplicationCollectService.save(entity);
}else{ // 说明之前收藏过,则只需要做个修改
collectEntity.setIsCollect(CommonConstant.IsDeleted.Y);
bizMemberAgentApplicationCollectService.update(collectEntity);
}
}else {
// 取消收藏该应用
collectEntities.get(0).setIsCollect(CommonConstant.IsDeleted.N);
bizMemberAgentApplicationCollectService.update( collectEntities.get(0));
}
}
}
package cn.com.poc.agent_application.aggregate.impl;
import cn.com.poc.agent_application.aggregate.AgentApplicationMallService;
import cn.com.poc.agent_application.convert.BizAgentApplicationMallConvert;
import cn.com.poc.agent_application.dto.BizAgentApplicationMallDto;
import cn.com.poc.agent_application.entity.BizAgentApplicationMallEntity;
import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity;
import cn.com.poc.agent_application.entity.BizMemberAgentApplicationCollectEntity;
import cn.com.poc.agent_application.service.BizAgentApplicationMallService;
import cn.com.poc.agent_application.service.BizAgentApplicationPublishService;
import cn.com.poc.agent_application.service.BizMemberAgentApplicationCollectService;
import cn.com.poc.common.constant.CommonConstant;
import cn.com.poc.common.utils.BlContext;
......@@ -24,20 +28,29 @@ public class AgentApplicationMallServiceImpl implements AgentApplicationMallServ
@Resource
private BizMemberAgentApplicationCollectService bizMemberAgentApplicationCollectService;
@Resource
private BizAgentApplicationPublishService bizAgentApplicationPublishService;
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
@Override
public void collectOrCancelAgentInMall(Integer agentMallId) throws Exception {
public void collectOrCancelAgentInMall(Integer id) throws Exception {
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
if (userBaseEntity == null) {
throw new BusinessException("用户未登录");
}
// 先判断当前应用被收藏了吗
BizMemberAgentApplicationCollectEntity collectEntity = bizMemberAgentApplicationCollectService.getByAgentMallId(agentMallId);
BizAgentApplicationMallEntity mallEntity = bizAgentApplicationMallService.get(agentMallId);
BizAgentApplicationMallEntity mallEntity = bizAgentApplicationMallService.get(id);
if(mallEntity == null){
throw new BusinessException("应用不存在");
}
BizAgentApplicationPublishEntity publishEntity = bizAgentApplicationPublishService.get(mallEntity.getAgentPublishId());
if(publishEntity == null){
throw new BusinessException("应用未发布");
}
// 先判断当前应用被收藏了吗
BizMemberAgentApplicationCollectEntity collectEntity = bizMemberAgentApplicationCollectService.getByAgentId(publishEntity.getAgentId());
if(collectEntity == null || CommonConstant.IsDeleted.N.equals(collectEntity.getIsCollect())){ //如果没被收藏
// 收藏该应用
// 说明从来没收藏过
......@@ -46,7 +59,7 @@ public class AgentApplicationMallServiceImpl implements AgentApplicationMallServ
BizMemberAgentApplicationCollectEntity entity = new BizMemberAgentApplicationCollectEntity();
entity.setIsCollect(CommonConstant.IsDeleted.Y);
entity.setMemberId(userBaseEntity.getUserId().intValue());
entity.setAgentMallId(agentMallId);
entity.setAgentId(publishEntity.getAgentId());
bizMemberAgentApplicationCollectService.save(entity);
}else{ // 说明之前收藏过,则只需要做个修改
collectEntity.setIsCollect(CommonConstant.IsDeleted.Y);
......@@ -62,6 +75,5 @@ public class AgentApplicationMallServiceImpl implements AgentApplicationMallServ
mallEntity.setCollectNumber(mallEntity.getCollectNumber() - 1);
}
bizAgentApplicationMallService.update(mallEntity);
}
}
......@@ -6,12 +6,10 @@ public interface AgentApplicationConstants {
String DRAFT = "draft"; // 草稿
String PUBLISH = "publish"; // 发布
String UN_PUBLISH = "unPublish"; // 已下架
String PUBLISH = "publish"; // 已发布
static boolean isPublishStatus(String status) {
return PUBLISH.equals(status) || DRAFT.equals(status) || UN_PUBLISH.equals(status);
return PUBLISH.equals(status) || DRAFT.equals(status);
}
}
......
......@@ -25,6 +25,7 @@ public class BizAgentApplicationMallConvert {
entity.setClickNumber(model.getClickNumber());
entity.setIsCopy(model.getIsCopy());
entity.setIsSale(model.getIsSale());
entity.setPopularity(model.getPopularity());
return entity;
}
......@@ -37,6 +38,7 @@ public class BizAgentApplicationMallConvert {
model.setClickNumber(entity.getClickNumber());
model.setIsCopy(entity.getIsCopy());
model.setIsSale(entity.getIsSale());
model.setPopularity(entity.getPopularity());
return model;
}
......@@ -96,6 +98,8 @@ public class BizAgentApplicationMallConvert {
dto.setIsCopy(entity.getIsCopy());
dto.setIsSale(entity.getIsSale());
dto.setPopularity(entity.getPopularity());
return dto;
}
......@@ -108,6 +112,7 @@ public class BizAgentApplicationMallConvert {
entity.setClickNumber(dto.getClickNumber());
entity.setIsCopy(dto.getIsCopy());
entity.setIsSale(dto.getIsSale());
entity.setPopularity(dto.getPopularity());
return entity;
}
}
\ No newline at end of file
......@@ -4,14 +4,13 @@ import cn.com.poc.agent_application.model.BizMemberAgentApplicationCollectModel;
import cn.com.poc.agent_application.entity.BizMemberAgentApplicationCollectEntity;
import cn.com.poc.agent_application.dto.BizMemberAgentApplicationCollectDto;
public class BizMemberAgentApplicationCollectConvert {
public static BizMemberAgentApplicationCollectEntity modelToEntity(BizMemberAgentApplicationCollectModel model){
BizMemberAgentApplicationCollectEntity entity = new BizMemberAgentApplicationCollectEntity();
entity.setId(model.getId());
entity.setMemberId(model.getMemberId());
entity.setAgentMallId(model.getAgentMallId());
entity.setAgentId(model.getAgentId());
entity.setIsCollect(model.getIsCollect());
entity.setIsDeleted(model.getIsDeleted());
entity.setCreator(model.getCreator());
......@@ -26,7 +25,7 @@ public class BizMemberAgentApplicationCollectConvert {
BizMemberAgentApplicationCollectModel model = new BizMemberAgentApplicationCollectModel();
model.setId(entity.getId());
model.setMemberId(entity.getMemberId());
model.setAgentMallId(entity.getAgentMallId());
model.setAgentId(entity.getAgentId());
model.setIsCollect(entity.getIsCollect());
model.setIsDeleted(entity.getIsDeleted());
model.setCreator(entity.getCreator());
......@@ -41,7 +40,7 @@ public class BizMemberAgentApplicationCollectConvert {
BizMemberAgentApplicationCollectDto dto = new BizMemberAgentApplicationCollectDto();
dto.setId(entity.getId());
dto.setMemberId(entity.getMemberId());
dto.setAgentMallId(entity.getAgentMallId());
dto.setAgentId(entity.getAgentId());
dto.setIsCollect(entity.getIsCollect());
dto.setIsDeleted(entity.getIsDeleted());
dto.setCreator(entity.getCreator());
......@@ -55,7 +54,7 @@ public class BizMemberAgentApplicationCollectConvert {
BizMemberAgentApplicationCollectEntity entity = new BizMemberAgentApplicationCollectEntity();
entity.setId(dto.getId());
entity.setMemberId(dto.getMemberId());
entity.setAgentMallId(dto.getAgentMallId());
entity.setAgentId(dto.getAgentId());
entity.setIsCollect(dto.getIsCollect());
entity.setIsDeleted(dto.getIsDeleted());
entity.setCreator(dto.getCreator());
......
......@@ -110,4 +110,44 @@ public class AgentApplicationInfoDto implements java.io.Serializable {
this.modifiedTime = modifiedTime;
}
/**
* isCollect
* 当前用户是否收藏 1、Y 是 2、N 否
* */
private String isCollect;
public String getIsCollect() {
return isCollect;
}
public void setIsCollect(String isCollect) {
this.isCollect = isCollect;
}
/** agent_publish_id
*发布应用的ID
*/
private java.lang.Integer agentPublishId;
public java.lang.Integer getAgentPublishId(){
return this.agentPublishId;
}
public void setAgentPublishId(java.lang.Integer agentPublishId){
this.agentPublishId = agentPublishId;
}
/** is_sale
*是否上架应用 1、Y 是 2、N 否
*/
private java.lang.String isSale;
public java.lang.String getIsSale(){
return this.isSale;
}
public void setIsSale(java.lang.String isSale){
this.isSale = isSale;
}
}
\ No newline at end of file
package cn.com.poc.agent_application.dto;
public class AgentLongMemoryDto {
private String content;
private String timestamp;
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
@Override
public String toString() {
return "AgentLongMemoryDto{" +
"content='" + content + '\'' +
", timestamp='" + timestamp + '\'' +
'}';
}
}
......@@ -6,13 +6,13 @@ public class BizAgentApplicationMallDto extends AgentApplicationInfoDto{
private static final long serialVersionUID = 1L;
/** id
*自增ID
*/
*/
private java.lang.Integer id;
public java.lang.Integer getId(){
return this.id;
}
public void setId(java.lang.Integer id){
this.id = id;
}
......@@ -91,4 +91,31 @@ public class BizAgentApplicationMallDto extends AgentApplicationInfoDto{
public void setIsSale(java.lang.String isSale){
this.isSale = isSale;
}
/** popularity
*应用热度
*/
private java.lang.Double popularity;
public java.lang.Double getPopularity(){
return this.popularity;
}
public void setPopularity(java.lang.Double popularity){
this.popularity = popularity;
}
/**
* isCollect
* 当前用户是否收藏 1、Y 是 2、N 否
* */
private String isCollect;
public String getIsCollect() {
return isCollect;
}
public void setIsCollect(String isCollect) {
this.isCollect = isCollect;
}
}
\ No newline at end of file
......@@ -28,17 +28,17 @@ public class BizMemberAgentApplicationCollectDto {
public void setMemberId(java.lang.Integer memberId){
this.memberId = memberId;
}
/** agent_mall_id
*应用广场的应用ID
*/
private java.lang.Integer agentMallId;
/** agent_id
*agent应用ID
*/
private java.lang.String agentId;
public java.lang.Integer getAgentMallId(){
return this.agentMallId;
public java.lang.String getAgentId(){
return this.agentId;
}
public void setAgentMallId(java.lang.Integer agentMallId){
this.agentMallId = agentMallId;
public void setAgentId(java.lang.String agentId){
this.agentId = agentId;
}
/** is_collect
......
......@@ -357,6 +357,8 @@ public class BizAgentApplicationInfoEntity {
", largeModel='" + largeModel + '\'' +
", topP=" + topP +
", unitIds=" + Arrays.toString(unitIds) +
", variableStructure=" + Arrays.toString(variableStructure) +
", isLongMemory='" + isLongMemory + '\'' +
", isDeleted='" + isDeleted + '\'' +
", creator='" + creator + '\'' +
", createdTime=" + createdTime +
......
package cn.com.poc.agent_application.entity;
import javax.persistence.Column;
public class BizAgentApplicationMallEntity {
......@@ -94,6 +93,19 @@ public class BizAgentApplicationMallEntity {
this.isSale = isSale;
}
/** popularity
*应用热度
*/
private java.lang.Double popularity;
public java.lang.Double getPopularity(){
return this.popularity;
}
public void setPopularity(java.lang.Double popularity){
this.popularity = popularity;
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
*/
......
package cn.com.poc.agent_application.entity;
package cn.com.poc.agent_application.entity;
import java.util.Arrays;
public class BizAgentApplicationPublishEntity {
private static final long serialVersionUID = 1L;
......@@ -334,4 +336,37 @@ public class BizAgentApplicationPublishEntity {
public void setSysVersion(java.lang.Integer sysVersion){
this.sysVersion = sysVersion;
}
@Override
public String toString() {
return "BizAgentApplicationPublishEntity{" +
"id=" + id +
", memberId=" + memberId +
", agentId='" + agentId + '\'' +
", agentAvatar='" + agentAvatar + '\'' +
", agentTitle='" + agentTitle + '\'' +
", agentDesc='" + agentDesc + '\'' +
", agentSystem='" + agentSystem + '\'' +
", agentPublishStatus='" + agentPublishStatus + '\'' +
", publishTime=" + publishTime +
", preamble='" + preamble + '\'' +
", variableStructure=" + Arrays.toString(variableStructure) +
", featuredQuestions=" + Arrays.toString(featuredQuestions) +
", communicationTurn=" + communicationTurn +
", continuousQuestionStatus='" + continuousQuestionStatus + '\'' +
", continuousQuestionSystem='" + continuousQuestionSystem + '\'' +
", continuousQuestionTurn=" + continuousQuestionTurn +
", knowledgeIds=" + Arrays.toString(knowledgeIds) +
", largeModel='" + largeModel + '\'' +
", topP=" + topP +
", unitIds=" + Arrays.toString(unitIds) +
", isLongMemory='" + isLongMemory + '\'' +
", isDeleted='" + isDeleted + '\'' +
", creator='" + creator + '\'' +
", createdTime=" + createdTime +
", modifier='" + modifier + '\'' +
", modifiedTime=" + modifiedTime +
", sysVersion=" + sysVersion +
'}';
}
}
\ No newline at end of file
......@@ -28,17 +28,17 @@ public class BizMemberAgentApplicationCollectEntity {
public void setMemberId(java.lang.Integer memberId){
this.memberId = memberId;
}
/** agent_mall_id
*应用广场的应用ID
*/
private java.lang.Integer agentMallId;
/** agent_id
*agent应用ID
*/
private java.lang.String agentId;
public java.lang.Integer getAgentMallId(){
return this.agentMallId;
public java.lang.String getAgentId(){
return this.agentId;
}
public void setAgentMallId(java.lang.Integer agentMallId){
this.agentMallId = agentMallId;
public void setAgentId(java.lang.String agentId){
this.agentId = agentId;
}
/** is_collect
......
......@@ -134,6 +134,21 @@ public class BizAgentApplicationMallModel extends BaseModelClass implements Seri
this.isSale = isSale;
super.addValidField("isSale");
}
/** popularity
*应用热度
*/
private java.lang.Double popularity;
@Column(name = "popularity",length = 10)
public java.lang.Double getPopularity(){
return this.popularity;
}
public void setPopularity(java.lang.Double popularity){
this.popularity = popularity;
super.addValidField("popularity");
}
/** is_deleted
*是否删除 1、Y 是 2、N 否
......
......@@ -56,21 +56,21 @@ public class BizMemberAgentApplicationCollectModel extends BaseModelClass implem
this.memberId = memberId;
super.addValidField("memberId");
}
/** agent_mall_id
*应用广场的应用ID
*/
private java.lang.Integer agentMallId;
@Column(name = "agent_mall_id",length = 10)
public java.lang.Integer getAgentMallId(){
return this.agentMallId;
/** agent_id
*agent应用ID
*/
private java.lang.String agentId;
@Column(name = "agent_id",length = 200)
public java.lang.String getAgentId(){
return this.agentId;
}
public void setAgentMallId(java.lang.Integer agentMallId){
this.agentMallId = agentMallId;
super.addValidField("agentMallId");
public void setAgentId(java.lang.String agentId){
this.agentId = agentId;
super.addValidField("agentId");
}
/** is_collect
......
......@@ -86,4 +86,33 @@ public interface AgentApplicationInfoRest extends BaseRest {
* AI创建应用标题和描述
*/
AgentApplicationGCDto createAgentTitleAndDesc(@RequestBody AgentApplicationGCDto dto) throws Exception;
/**
* 收藏/取消收藏个人空间中的应用
*
* @param agentId agent应用id
* */
void collectOrCancelAgentInPerson(@RequestParam String agentId) throws Exception;
/**
* 获取应用的记忆片段
*
* @param agentId agent应用id
* */
List<AgentLongMemoryDto> getLongMemoryList(@RequestParam String agentId) throws Exception;
/***
* 根据应用id和记忆key删除某个记忆片段
*
* @param agentId agent应用id
* @param timestamp 时间戳
*/
void deleteLongMemoryByKey(@RequestParam String agentId, @RequestParam String timestamp) throws Exception;
/***
* 根据应用id删除所有记忆片段
*
* @param agentId agent应用id
*/
void deleteLongMemory(@RequestParam String agentId) throws Exception;
}
\ No newline at end of file
......@@ -13,11 +13,11 @@ import org.springframework.web.bind.annotation.RequestParam;
public interface BizAgentApplicationMallRest extends BaseRest {
/**
* 配置【已发布的应用】发布至【应用广场】
* 配置【已发布的应用】发布至【应用广场】(上架)
*
* @return
*/
BizAgentApplicationMallDto publishAgentToMall(@RequestBody BizAgentApplicationMallDto dto) throws Exception;
void publishAgentToMall(@RequestBody BizAgentApplicationMallDto dto) throws Exception;
BizAgentApplicationMallDto getById(@RequestParam java.lang.Integer id) throws Exception;
......@@ -33,10 +33,17 @@ public interface BizAgentApplicationMallRest extends BaseRest {
void deletedById(@RequestParam java.lang.Integer id) throws Exception;
/**
* 收藏/取消收藏应用
* 收藏/取消收藏应用市场中的应用
*
* @param id 应用广场中的id
* */
void collectOrCancelAgentInMall(@RequestParam Integer id) throws Exception;
/**
* 下架用户在应用市场中的应用
*
* @param agentPublishId 发布应用表的id
* */
void unSaleAgentInMall(@RequestParam Integer agentPublishId) throws Exception;
}
\ No newline at end of file
......@@ -3,21 +3,20 @@ package cn.com.poc.agent_application.rest.impl;
import cn.com.poc.agent_application.aggregate.AgentApplicationInfoService;
import cn.com.poc.agent_application.convert.AgentApplicationInfoConvert;
import cn.com.poc.agent_application.dto.*;
import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
import cn.com.poc.agent_application.entity.BizAgentApplicationLargeModelListEntity;
import cn.com.poc.agent_application.entity.CreateAgentTitleAndDescEntity;
import cn.com.poc.agent_application.entity.*;
import cn.com.poc.agent_application.query.AgentApplicationInfoQueryCondition;
import cn.com.poc.agent_application.rest.AgentApplicationInfoRest;
import cn.com.poc.agent_application.service.BizAgentApplicationInfoService;
import cn.com.poc.agent_application.service.BizAgentApplicationLargeModelListService;
import cn.com.poc.agent_application.service.BizAgentApplicationPublishService;
import cn.com.poc.agent_application.service.*;
import cn.com.poc.common.constant.CommonConstant;
import cn.com.poc.common.service.RedisService;
import cn.com.poc.common.utils.BlContext;
import cn.com.poc.common.utils.JsonUtils;
import cn.com.poc.knowledge.aggregate.KnowledgeService;
import cn.com.poc.support.security.oauth.entity.UserBaseEntity;
import cn.com.poc.thirdparty.resource.demand.ai.common.domain.Tool;
import cn.com.poc.thirdparty.resource.demand.ai.function.LargeModelFunctionEnum;
import cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.LongMemoryEntity;
import cn.com.poc.thirdparty.resource.demand.ai.function.long_memory.SetLongMemoryConstants;
import cn.com.yict.framemax.core.exception.BusinessException;
import cn.com.yict.framemax.data.model.PagingInfo;
import cn.hutool.core.collection.ListUtil;
......@@ -31,9 +30,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
@Component
......@@ -54,6 +51,15 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
@Resource
private KnowledgeService knowledgeService;
@Resource
private RedisService redisService;
@Resource
private BizMemberAgentApplicationCollectService bizMemberAgentApplicationCollectService;
@Resource
private BizAgentApplicationMallService bizAgentApplicationMallService;
public List<AgentApplicationInfoDto> getListByMember(AgentApplicationInfoSearchDto dto, PagingInfo pagingInfo) throws Exception {
UserBaseEntity userBaseEntity = BlContext.getCurrentUserNotException();
Long userId = userBaseEntity.getUserId();
......@@ -66,11 +72,36 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
condition.setAgentPublishStatus(dto.getPublishStatus());
}
List<BizAgentApplicationInfoEntity> bizAgentApplicationInfoEntities = bizAgentApplicationInfoService.agentApplicationInfoQuery(condition, pagingInfo);
List<AgentApplicationInfoDto> result = new ArrayList<>();
if (CollectionUtils.isNotEmpty(bizAgentApplicationInfoEntities)) {
result = bizAgentApplicationInfoEntities.stream().map(AgentApplicationInfoConvert::entityToDto).collect(Collectors.toList());
List<AgentApplicationInfoDto> resultList = new ArrayList<>();
for(BizAgentApplicationInfoEntity entity : bizAgentApplicationInfoEntities){
AgentApplicationInfoDto infoDto = AgentApplicationInfoConvert.entityToDto(entity);
// 设置当前用户是否收藏了
if(infoDto.getBaseInfo() != null){
BizMemberAgentApplicationCollectEntity collect = bizMemberAgentApplicationCollectService.getByAgentId(infoDto.getBaseInfo().getAgentId());
if(collect != null){
infoDto.setIsCollect(collect.getIsCollect());
}else {
infoDto.setIsCollect(CommonConstant.IsDeleted.N);
}
}
// 判断是否发布了,若发布则设置agentPublishId
BizAgentApplicationPublishEntity publishEntity = bizAgentApplicationPublishService.getByAgentId(entity.getAgentId());
if(publishEntity != null){
infoDto.setAgentPublishId(publishEntity.getId());
// 设置当前作品是否上架
BizAgentApplicationMallEntity mallEntity = bizAgentApplicationMallService.get(publishEntity.getId());
if(mallEntity != null){
infoDto.setIsSale(mallEntity.getIsSale());
}else{
infoDto.setIsSale(CommonConstant.IsDeleted.N);
}
}else{
infoDto.setAgentPublishId(null);
}
resultList.add(infoDto);
}
return result;
return resultList;
}
......@@ -114,7 +145,14 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
public void delete(String agentId) throws Exception {
Assert.notNull(agentId);
bizAgentApplicationInfoService.deletedByAgentId(agentId);
bizAgentApplicationPublishService.deleteByAgentId(agentId);
// 删除应用
BizAgentApplicationPublishEntity publishEntity = bizAgentApplicationPublishService.getByAgentId(agentId);
if(publishEntity != null){
// 删除应用市场表中的应用
bizAgentApplicationMallService.deletedByAgentPublishId(publishEntity.getId());
// 删除发布表中的应用
bizAgentApplicationPublishService.deleteByAgentId(agentId);
}
}
@Override
......@@ -244,4 +282,42 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
result.setAgentDesc(entity.getAgentDesc());
return result;
}
@Override
public void collectOrCancelAgentInPerson(String agentId) throws Exception {
Assert.notNull(agentId);
agentApplicationInfoService.collectOrCancelAgentInPerson(agentId);
}
@Override
public List<AgentLongMemoryDto> getLongMemoryList(String agentId) throws Exception {
Assert.notNull(agentId);
List<AgentLongMemoryDto> result = new ArrayList<>();
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + agentId + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
Map<Object, Object> map = redisService.hmget(contentKey);
Set<Object> keySet = map.keySet();
for (Object mapKey : keySet) {
AgentLongMemoryDto entity = new AgentLongMemoryDto();
entity.setContent(map.get(mapKey).toString());
entity.setTimestamp(mapKey.toString());
result.add(entity);
}
return result;
}
@Override
public void deleteLongMemoryByKey(String agentId, String timestamp) throws Exception {
Assert.notNull(agentId);
Assert.notNull(timestamp);
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + agentId + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
redisService.hdel(contentKey, timestamp);
}
@Override
public void deleteLongMemory(String agentId) throws Exception {
Assert.notNull(agentId);
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + agentId + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
redisService.del(contentKey);
}
}
\ No newline at end of file
......@@ -5,6 +5,12 @@ import java.util.List;
import javax.annotation.Resource;
import cn.com.poc.agent_application.aggregate.AgentApplicationMallService;
import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity;
import cn.com.poc.agent_application.entity.BizMemberAgentApplicationCollectEntity;
import cn.com.poc.agent_application.service.BizAgentApplicationPublishService;
import cn.com.poc.agent_application.service.BizMemberAgentApplicationCollectService;
import cn.com.poc.common.constant.CommonConstant;
import cn.com.yict.framemax.core.exception.BusinessException;
import org.springframework.stereotype.Component;
import cn.com.poc.agent_application.rest.BizAgentApplicationMallRest;
import cn.com.poc.agent_application.service.BizAgentApplicationMallService;
......@@ -19,17 +25,42 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
@Resource
private AgentApplicationMallService agentApplicationMallService;
@Resource
private BizMemberAgentApplicationCollectService bizMemberAgentApplicationCollectService;
@Resource
private BizAgentApplicationPublishService bizAgentApplicationPublishService;
@Resource
private BizAgentApplicationMallService bizAgentApplicationMallService;
@Override
public BizAgentApplicationMallDto publishAgentToMall(BizAgentApplicationMallDto dto) throws Exception {
public void publishAgentToMall(BizAgentApplicationMallDto dto) throws Exception {
Assert.notNull(dto);
Assert.notNull(dto.getAgentPublishId());
Assert.notNull(dto.getAgentType());
Assert.notNull(dto.getIsCopy());
return BizAgentApplicationMallConvert.entityToDto(bizAgentApplicationMallService.save(BizAgentApplicationMallConvert.dtoToEntity(dto)));
BizAgentApplicationPublishEntity publishEntity = bizAgentApplicationPublishService.get(dto.getAgentPublishId());
if(publishEntity == null){
throw new BusinessException("应用未发布");
}
dto.setIsSale(CommonConstant.IsDeleted.Y);
// 判断当前应用之前是否上架了
BizAgentApplicationMallEntity mallEntity = bizAgentApplicationMallService.getByAgentPublishId(dto.getAgentPublishId());
if(mallEntity != null){
mallEntity.setIsSale(CommonConstant.IsDeleted.Y);
mallEntity.setAgentType(dto.getAgentType());
mallEntity.setIsCopy(dto.getIsCopy());
// 如果上架过,则update操作
bizAgentApplicationMallService.update(mallEntity);
}else{
// 如果没上架过,则save操作
// 把应用存入应用市场表中
bizAgentApplicationMallService.save(BizAgentApplicationMallConvert.dtoToEntity(dto));
}
}
public BizAgentApplicationMallDto getById(java.lang.Integer id) throws Exception{
......@@ -46,12 +77,24 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
List<BizAgentApplicationMallDto> resultList = new ArrayList<>();
List<BizAgentApplicationMallEntity> byExample = bizAgentApplicationMallService.findByExample(pagingInfo);
for(BizAgentApplicationMallEntity entity : byExample){
resultList.add(BizAgentApplicationMallConvert.entityToDto(entity));
BizAgentApplicationMallDto mallDto = BizAgentApplicationMallConvert.entityToDto(entity);
// 如果应用上架了
if(CommonConstant.IsDeleted.Y.equals(mallDto.getIsSale())){
// 设置当前用户是否收藏了
if(mallDto.getBaseInfo() != null){
BizMemberAgentApplicationCollectEntity collect = bizMemberAgentApplicationCollectService.getByAgentId(mallDto.getBaseInfo().getAgentId());
if(collect != null){
mallDto.setIsCollect(collect.getIsCollect());
}else {
mallDto.setIsCollect(CommonConstant.IsDeleted.N);
}
}
resultList.add(mallDto);
}
}
return resultList;
}
public BizAgentApplicationMallDto update(BizAgentApplicationMallDto dto) throws Exception{
Assert.notNull(dto);
BizAgentApplicationMallEntity entity = BizAgentApplicationMallConvert.dtoToEntity(dto);
......@@ -65,6 +108,15 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
@Override
public void collectOrCancelAgentInMall(Integer id) throws Exception {
Assert.notNull(id);
agentApplicationMallService.collectOrCancelAgentInMall(id);
}
@Override
public void unSaleAgentInMall(Integer agentPublishId) throws Exception {
Assert.notNull(agentPublishId);
BizAgentApplicationMallEntity mallEntity = bizAgentApplicationMallService.getByAgentPublishId(agentPublishId);
mallEntity.setIsSale(CommonConstant.IsDeleted.N);
bizAgentApplicationMallService.update(mallEntity);
}
}
\ No newline at end of file
package cn.com.poc.agent_application.schedule;
import cn.com.poc.agent_application.entity.BizAgentApplicationDialoguesRecordEntity;
import cn.com.poc.agent_application.entity.BizAgentApplicationMallEntity;
import cn.com.poc.agent_application.entity.BizAgentApplicationPublishEntity;
import cn.com.poc.agent_application.service.BizAgentApplicationDialoguesRecordService;
import cn.com.poc.agent_application.service.BizAgentApplicationMallService;
import cn.com.poc.agent_application.service.BizAgentApplicationPublishService;
import cn.com.yict.framemax.frame.service.FmxParamConfigService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.ZoneOffset;
import java.util.List;
@Component
public class AgentApplicationMallSchedule {
@Resource
private BizAgentApplicationMallService bizAgentApplicationMallService;
@Resource
private BizAgentApplicationDialoguesRecordService bizAgentApplicationDialoguesRecordService;
@Resource
private BizAgentApplicationPublishService bizAgentApplicationPublishService;
@Resource
private FmxParamConfigService fmxParamConfigService;
/**
* 【用于更新DB的应用热度】
* 定时规则:每分钟触发一次
*/
@Scheduled(cron = "0 * * * * ?")
public void updateAgentPopularity() throws Exception {
// 查询应用市场表
List<BizAgentApplicationMallEntity> mallEntities = bizAgentApplicationMallService.getList();
// 获取权重
Double w1 = Double.parseDouble(fmxParamConfigService.getParam("mall.collect.weight"));
Double w2 = Double.parseDouble(fmxParamConfigService.getParam("mall.click.weight"));
Double w3 = Double.parseDouble(fmxParamConfigService.getParam("mall.dialog.weight"));
Double w4 = Double.parseDouble(fmxParamConfigService.getParam("mall.time.weight"));
for(BizAgentApplicationMallEntity mallEntity : mallEntities){
// 获取agentId
BizAgentApplicationPublishEntity publishEntity = bizAgentApplicationPublishService.get(mallEntity.getAgentPublishId());
if(publishEntity != null && publishEntity.getAgentId() != null){ // 如果有对话记录
// 查询对话表,获取聊天次数和最后对话的时间
BizAgentApplicationDialoguesRecordEntity recordEntity = new BizAgentApplicationDialoguesRecordEntity();
recordEntity.setAgentId(publishEntity.getAgentId());
List<BizAgentApplicationDialoguesRecordEntity> recordEntities = bizAgentApplicationDialoguesRecordService.findByExample(recordEntity);
Double popularity;
// 聊天次数
int dialogNumber;
// 时间衰减因子
Double timeDecay;
if(!recordEntities.isEmpty()){
// 更新聊天次数
dialogNumber = recordEntities.size();
// 当前时间戳
LocalDate today = LocalDate.now();
// 获取今天0:00的时间戳
long timestamp = today.atStartOfDay(ZoneOffset.UTC).toEpochSecond() * 1000;
// 时间衰减因子
timeDecay = w4 / Math.abs((recordEntities.get(0).getTimestamp() - timestamp)) / 1000;
BigDecimal round = new BigDecimal(timeDecay).round(new MathContext(3, RoundingMode.HALF_UP));
String string = round.toString();
timeDecay = Double.parseDouble(string.substring(0,4));
// 计算热度值
popularity = w1 * mallEntity.getCollectNumber() + w2 * mallEntity.getClickNumber() + w3 * ((Math.log(dialogNumber))/timeDecay);
}else {
// 计算热度值
popularity = w1 * mallEntity.getCollectNumber() + w2 * mallEntity.getClickNumber();
}
// 更新热度值
mallEntity.setPopularity(popularity);
bizAgentApplicationMallService.update(mallEntity);
}
}
}
}
......@@ -13,6 +13,8 @@ public interface BizAgentApplicationDialoguesRecordService extends BaseService {
List<BizAgentApplicationDialoguesRecordEntity> findByExample(BizAgentApplicationDialoguesRecordEntity example, PagingInfo pagingInfo) throws Exception;
List<BizAgentApplicationDialoguesRecordEntity> findByExample(BizAgentApplicationDialoguesRecordEntity example) throws Exception;
BizAgentApplicationDialoguesRecordEntity save(BizAgentApplicationDialoguesRecordEntity entity) throws Exception;
BizAgentApplicationDialoguesRecordEntity update(BizAgentApplicationDialoguesRecordEntity entity) throws Exception;
......
package cn.com.poc.agent_application.service;
import cn.com.poc.agent_application.constant.AgentApplicationConstants;
import cn.com.poc.agent_application.query.AgentApplicationInfoQueryCondition;
import cn.com.poc.agent_application.query.AgentApplicationInfoQueryItem;
import cn.com.yict.framemax.core.service.BaseService;
import cn.com.poc.agent_application.entity.BizAgentApplicationInfoEntity;
import cn.com.yict.framemax.data.model.PagingInfo;
......@@ -27,6 +25,4 @@ public interface BizAgentApplicationInfoService extends BaseService {
boolean publish(String agentId) throws Exception;
boolean unPublish(String agentId);
}
\ No newline at end of file
......@@ -10,6 +10,8 @@ public interface BizAgentApplicationMallService extends BaseService {
BizAgentApplicationMallEntity get(java.lang.Integer id) throws Exception;
BizAgentApplicationMallEntity getByAgentPublishId(Integer agentPublishId) throws Exception;
List<BizAgentApplicationMallEntity> findByExample(BizAgentApplicationMallEntity example,PagingInfo pagingInfo) throws Exception;
List<BizAgentApplicationMallEntity> findByExample(PagingInfo pagingInfo) throws Exception;
......@@ -21,5 +23,7 @@ public interface BizAgentApplicationMallService extends BaseService {
void deletedByAgentPublishId(java.lang.Integer agentPublishId) throws Exception;
void deletedById(java.lang.Integer id) throws Exception;
List<BizAgentApplicationMallEntity> getList() throws Exception;
}
\ No newline at end of file
......@@ -9,7 +9,7 @@ public interface BizMemberAgentApplicationCollectService extends BaseService {
BizMemberAgentApplicationCollectEntity get(java.lang.Integer id) throws Exception;
BizMemberAgentApplicationCollectEntity getByAgentMallId(java.lang.Integer id) throws Exception;
BizMemberAgentApplicationCollectEntity getByAgentId(java.lang.String agentId) throws Exception;
List<BizMemberAgentApplicationCollectEntity> findByExample(BizMemberAgentApplicationCollectEntity example,PagingInfo pagingInfo) throws Exception;
......
......@@ -55,6 +55,21 @@ public class BizAgentApplicationDialoguesRecordServiceImpl extends BaseServiceIm
return result;
}
@Override
public List<BizAgentApplicationDialoguesRecordEntity> findByExample(BizAgentApplicationDialoguesRecordEntity example) throws Exception {
List<BizAgentApplicationDialoguesRecordEntity> result = new ArrayList<BizAgentApplicationDialoguesRecordEntity>();
BizAgentApplicationDialoguesRecordModel model = new BizAgentApplicationDialoguesRecordModel();
if (example != null) {
model = BizAgentApplicationDialoguesRecordConvert.entityToModel(example);
}
model.setIsDeleted("N");
List<BizAgentApplicationDialoguesRecordModel> models = this.repository.findByExample(model,"timestamp desc",new PagingInfo());
if (CollectionUtils.isNotEmpty(models)) {
result = models.stream().map(BizAgentApplicationDialoguesRecordConvert::modelToEntity).collect(Collectors.toList());
}
return result;
}
public BizAgentApplicationDialoguesRecordEntity save(BizAgentApplicationDialoguesRecordEntity entity) throws Exception {
Assert.notNull(entity);
entity.setId(null);
......
......@@ -144,22 +144,6 @@ public class BizAgentApplicationInfoServiceImpl extends BaseServiceImpl
return true;
}
@Override
public boolean unPublish(String agentId) {
Assert.notNull(agentId);
BizAgentApplicationInfoModel model = new BizAgentApplicationInfoModel();
model.setAgentId(agentId);
model.setIsDeleted(CommonConstant.IsDeleted.N);
List<BizAgentApplicationInfoModel> models = this.repository.findByExample(model);
if (CollectionUtils.isEmpty(models)) {
return false;
}
model = models.get(0);
model.setAgentPublishStatus(AgentApplicationConstants.AGENT_PUBLISH_STATUS.UN_PUBLISH);
this.repository.save(model);
return true;
}
/**
* 参数验证和转换 Entity To Model
*
......
......@@ -35,7 +35,19 @@ public class BizAgentApplicationMallServiceImpl extends BaseServiceImpl
return BizAgentApplicationMallConvert.modelToEntity(model);
}
public List<BizAgentApplicationMallEntity> findByExample(BizAgentApplicationMallEntity example,PagingInfo pagingInfo) throws Exception{
@Override
public BizAgentApplicationMallEntity getByAgentPublishId(Integer agentPublishId) throws Exception {
BizAgentApplicationMallModel model = new BizAgentApplicationMallModel();
model.setIsDeleted("N");
model.setAgentPublishId(agentPublishId);
List<BizAgentApplicationMallModel> models = this.repository.findByExample(model);
if (CollectionUtils.isNotEmpty(models)) {
return BizAgentApplicationMallConvert.modelToEntity(models.get(0));
}
return null;
}
public List<BizAgentApplicationMallEntity> findByExample(BizAgentApplicationMallEntity example, PagingInfo pagingInfo) throws Exception{
List<BizAgentApplicationMallEntity> result = new ArrayList<BizAgentApplicationMallEntity>();
BizAgentApplicationMallModel model = new BizAgentApplicationMallModel();
if (example != null){
......@@ -93,6 +105,9 @@ public class BizAgentApplicationMallServiceImpl extends BaseServiceImpl
if(entity.getIsSale() != null){
model.setIsSale(entity.getIsSale());
}
if(entity.getPopularity() != null){
model.setPopularity(entity.getPopularity());
}
if (entity.getIsDeleted() != null) {
model.setIsDeleted(entity.getIsDeleted());
}
......@@ -125,4 +140,14 @@ public class BizAgentApplicationMallServiceImpl extends BaseServiceImpl
}
}
}
public List<BizAgentApplicationMallEntity> getList() throws Exception{
List<BizAgentApplicationMallEntity> result = new ArrayList<BizAgentApplicationMallEntity>();
List<BizAgentApplicationMallModel> models = this.repository.getAll();
if (CollectionUtils.isNotEmpty(models)) {
result = models.stream().map(BizAgentApplicationMallConvert::modelToEntity).collect(Collectors.toList());
}
return result;
}
}
\ No newline at end of file
......@@ -36,9 +36,9 @@ public class BizMemberAgentApplicationCollectServiceImpl extends BaseServiceImpl
}
@Override
public BizMemberAgentApplicationCollectEntity getByAgentMallId(Integer id) throws Exception {
public BizMemberAgentApplicationCollectEntity getByAgentId(String agentId) throws Exception {
BizMemberAgentApplicationCollectModel model = new BizMemberAgentApplicationCollectModel();
model.setAgentMallId(id);
model.setAgentId(agentId);
model.setIsDeleted("N");
List<BizMemberAgentApplicationCollectModel> models = this.repository.findByExample(model);
if(!models.isEmpty()){
......@@ -79,8 +79,8 @@ public class BizMemberAgentApplicationCollectServiceImpl extends BaseServiceImpl
if (entity.getMemberId() != null){
model.setMemberId(entity.getMemberId());
}
if (entity.getAgentMallId() != null){
model.setAgentMallId(entity.getAgentMallId());
if (entity.getAgentId() != null){
model.setAgentId(entity.getAgentId());
}
if(entity.getIsCollect() != null){
model.setIsCollect(entity.getIsCollect());
......
......@@ -40,18 +40,7 @@ public class SetLongMemoryFunction extends AbstractLargeModelFunction {
// 提取 content
String contents = jsonObject.getStr("content");
String contentKey = SetLongMemoryConstants.REDIS_PREFIX + key + ":" + BlContext.getCurrentUserNotException().getUserId().toString();
Map<Object, Object> hmget = redisService.hmget(contentKey);
Map<String, Object> result = new HashMap<>();
for (Map.Entry<Object, Object> entry : hmget.entrySet()) {
if (entry.getKey() instanceof String) {
// 将 Object 强制转换为 String
String tempKey = (String) entry.getKey();
result.put(tempKey, entry.getValue());
}
}
result.put(DateUtils.getCurrTime(), contents);
redisService.hmset(contentKey, result);
redisService.hset(contentKey, DateUtils.getCurrTime(), contents);
return "SUCCESS";
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment