Commit 9ed0c9c0 authored by alex yao's avatar alex yao

feat:api配置重置

parent 5f4d7788
...@@ -12,6 +12,8 @@ public interface BizAgentApplicationApiProfileService extends BaseService { ...@@ -12,6 +12,8 @@ public interface BizAgentApplicationApiProfileService extends BaseService {
BizAgentApplicationApiProfileEntity initProfile(Long memberId); BizAgentApplicationApiProfileEntity initProfile(Long memberId);
BizAgentApplicationApiProfileEntity resetProfile(Long memberId) throws Exception;
BizAgentApplicationApiProfileEntity getByKeyAndSecret(String key, String secret); BizAgentApplicationApiProfileEntity getByKeyAndSecret(String key, String secret);
List<BizAgentApplicationApiProfileEntity> findByExample(BizAgentApplicationApiProfileEntity example, PagingInfo pagingInfo) throws Exception; List<BizAgentApplicationApiProfileEntity> findByExample(BizAgentApplicationApiProfileEntity example, PagingInfo pagingInfo) throws Exception;
......
...@@ -57,6 +57,14 @@ public class BizAgentApplicationApiProfileServiceImpl extends BaseServiceImpl ...@@ -57,6 +57,14 @@ public class BizAgentApplicationApiProfileServiceImpl extends BaseServiceImpl
return entity; return entity;
} }
@Override
public synchronized BizAgentApplicationApiProfileEntity resetProfile(Long memberId) throws Exception {
BizAgentApplicationApiProfileEntity entity = this.getByMemberId(memberId);
entity.setApiKey(snowflakeGenerator.next().toString());
entity.setApiSecret(UUIDTool.getUUID());
return this.update(entity);
}
@Override @Override
public BizAgentApplicationApiProfileEntity getByKeyAndSecret(String key, String secret) { public BizAgentApplicationApiProfileEntity getByKeyAndSecret(String key, String secret) {
BizAgentApplicationApiProfileModel model = new BizAgentApplicationApiProfileModel(); BizAgentApplicationApiProfileModel model = new BizAgentApplicationApiProfileModel();
......
...@@ -76,4 +76,12 @@ public interface AgentApplicationService { ...@@ -76,4 +76,12 @@ public interface AgentApplicationService {
*/ */
BizAgentApplicationApiProfileEntity getApiProfile(Long memberId); BizAgentApplicationApiProfileEntity getApiProfile(Long memberId);
/**
* 重置应用的API配置
*
* @param memberId 用户ID
* @return 应用API配置
*/
BizAgentApplicationApiProfileEntity resetApiProfile(Long memberId) throws Exception;
} }
...@@ -188,7 +188,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService { ...@@ -188,7 +188,7 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
if (StringUtils.isBlank(channel)) { if (StringUtils.isBlank(channel)) {
channel = DataAnalyzeChannelEnum.link_share.getChannel(); channel = DataAnalyzeChannelEnum.link_share.getChannel();
} }
dataAnalyzeReportService.dataReport(agentId,DataAnalyzeChannelEnum.valueOf(channel),userBaseEntity.getUserId(),pointDeductionNum); dataAnalyzeReportService.dataReport(agentId, DataAnalyzeChannelEnum.valueOf(channel), userBaseEntity.getUserId(), pointDeductionNum);
} catch (Exception e) { } catch (Exception e) {
memberEquityService.rollbackPoint(reduceSn); memberEquityService.rollbackPoint(reduceSn);
throw new BusinessException(e.getMessage()); throw new BusinessException(e.getMessage());
...@@ -354,6 +354,11 @@ public class AgentApplicationServiceImpl implements AgentApplicationService { ...@@ -354,6 +354,11 @@ public class AgentApplicationServiceImpl implements AgentApplicationService {
return agentApplicationApiProfileEntity; return agentApplicationApiProfileEntity;
} }
@Override
public BizAgentApplicationApiProfileEntity resetApiProfile(Long memberId) throws Exception {
return bizAgentApplicationApiProfileService.resetProfile(memberId);
}
private void createCNQuestion() { private void createCNQuestion() {
Message message = new Message(); Message message = new Message();
message.setRole(LLMRoleEnum.USER.getRole()); message.setRole(LLMRoleEnum.USER.getRole());
......
...@@ -108,4 +108,11 @@ public interface AgentApplicationRest extends BaseRest { ...@@ -108,4 +108,11 @@ public interface AgentApplicationRest extends BaseRest {
* @return 应用API配置 * @return 应用API配置
*/ */
AgentApplicationApiProfileDto getApiProfile(); AgentApplicationApiProfileDto getApiProfile();
/**
* 重置应用的API配置
*
* @return 应用API配置
*/
AgentApplicationApiProfileDto resetApiProfile() throws Exception;
} }
...@@ -269,4 +269,14 @@ public class AgentApplicationRestImpl implements AgentApplicationRest { ...@@ -269,4 +269,14 @@ public class AgentApplicationRestImpl implements AgentApplicationRest {
result.setApiSecret(apiProfileEntity.getApiSecret()); result.setApiSecret(apiProfileEntity.getApiSecret());
return result; return result;
} }
@Override
public AgentApplicationApiProfileDto resetApiProfile() throws Exception {
UserBaseEntity userBaseEntity = BlContext.getCurrentUser();
BizAgentApplicationApiProfileEntity apiProfileEntity = agentApplicationService.resetApiProfile(userBaseEntity.getUserId());
AgentApplicationApiProfileDto result = new AgentApplicationApiProfileDto();
result.setApiKey(apiProfileEntity.getApiKey());
result.setApiSecret(apiProfileEntity.getApiSecret());
return result;
}
} }
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