Commit a70ec9bb authored by alex yao's avatar alex yao

feat:Agent应用点击事件

parent 8ffb2e1d
......@@ -4,8 +4,14 @@ package cn.com.poc.agent_application.aggregate;
public interface AgentApplicationMallService {
/**
* 收藏/取消收藏应用广场中的应用
*
* */
*/
void collectOrCancelAgentInMall(Integer id) throws Exception;
/**
* 添加浏览量
*
* @param agentPublishId 应用广场发布id
*/
void addClickNumber(Integer agentPublishId) throws Exception;
}
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;
......@@ -85,4 +83,14 @@ public class AgentApplicationMallServiceImpl implements AgentApplicationMallServ
}
bizAgentApplicationMallService.update(mallEntity);
}
@Override
public void addClickNumber(Integer agentPublishId) throws Exception {
BizAgentApplicationMallEntity mallEntity = bizAgentApplicationMallService.getByAgentPublishId(agentPublishId);
if (mallEntity == null) {
return;
}
mallEntity.setClickNumber(mallEntity.getClickNumber() + 1);
bizAgentApplicationMallService.update(mallEntity);
}
}
......@@ -31,7 +31,7 @@ public interface AgentApplicationRest extends BaseRest {
/**
* 创建对话
*/
String createDialogues() throws Exception;
String createDialogues(@RequestParam(required = false) String agentId) throws Exception;
/**
* 调用 已发布Agent应用
......
package cn.com.poc.expose.rest.impl;
import cn.com.poc.agent_application.aggregate.AgentApplicationInfoService;
import cn.com.poc.agent_application.aggregate.AgentApplicationMallService;
import cn.com.poc.agent_application.convert.AgentApplicationInfoConvert;
import cn.com.poc.agent_application.convert.BizAgentApplicationPublishConvert;
import cn.com.poc.agent_application.dto.AgentApplicationCreateContinueQuesDto;
......@@ -23,6 +24,8 @@ import cn.com.poc.support.security.oauth.entity.UserBaseEntity;
import cn.com.yict.framemax.core.i18n.I18nMessageException;
import cn.com.yict.framemax.data.model.PagingInfo;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
......@@ -37,6 +40,7 @@ import java.util.stream.Collectors;
@Component
public class AgentApplicationRestImpl implements AgentApplicationRest {
private Logger logger = LoggerFactory.getLogger(AgentApplicationRest.class);
@Resource
private AgentApplicationService agentApplicationService;
......@@ -50,6 +54,9 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
@Resource
private BizAgentApplicationDialoguesRecordService bizAgentApplicationDialoguesRecordService;
@Resource
private AgentApplicationMallService agentApplicationMallService;
@Override
public List<String> getRecommendQuestions(HttpServletRequest httpServletRequest) throws Exception {
return agentApplicationService.getRecommendQuestions(httpServletRequest.getHeader("x-lang"));
......@@ -78,7 +85,18 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
}
@Override
public String createDialogues() {
public String createDialogues(String agentId) {
if (StringUtils.isNotBlank(agentId)) {
try {
BizAgentApplicationPublishEntity agentApplicationPublishEntity = bizAgentApplicationPublishService.getByAgentId(agentId);
if (agentApplicationPublishEntity != null) {
Integer publishId = agentApplicationPublishEntity.getId();
agentApplicationMallService.addClickNumber(publishId);
}
} catch (Exception e) {
logger.error(e.getMessage());
}
}
return "DIA_" + UUIDTool.getUUID();
}
......
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