Merge branch 'develop/oprlog_modify/221014' into 'dev'
add notNull check See merge request infra/xlog!22
This commit is contained in:
commit
f3787f4c6b
@ -24,6 +24,7 @@ public class OperateLogReq {
|
||||
/**
|
||||
* 调用方服务名
|
||||
*/
|
||||
@NotNull
|
||||
private String serviceName;
|
||||
|
||||
/**
|
||||
|
||||
@ -127,6 +127,15 @@
|
||||
<groupId>cn.axzo.basics</groupId>
|
||||
<artifactId>basics-profiles-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 测试 client 使用
|
||||
<dependency>
|
||||
<groupId>cn.axzo.platform</groupId>
|
||||
<artifactId>axzo-log-api</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@ -26,6 +26,7 @@ public class OperateLogReqDTO {
|
||||
* 调用方服务名
|
||||
*/
|
||||
@ApiModelProperty(value = "调用方服务名", position = 1)
|
||||
@NotNull
|
||||
private String serviceName;
|
||||
|
||||
/**
|
||||
|
||||
@ -2,6 +2,7 @@ package cn.axzo.log.platform.server;
|
||||
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/***
|
||||
@ -11,6 +12,14 @@ import org.springframework.test.context.junit4.SpringRunner;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@EnableFeignClients(basePackages = {
|
||||
"cn.axzo.third.api",
|
||||
"cn.axzo.apollo",
|
||||
"cn.axzo.pudge",
|
||||
"cn.axzo.elise",
|
||||
"cn.axzo.basics",
|
||||
"cn.axzo.log.platform.client",
|
||||
})
|
||||
public class LogPlatApplicationTestBase {
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,63 @@
|
||||
package cn.axzo.log.platform.server.api;
|
||||
|
||||
import cn.axzo.log.platform.client.LogPlatClient;
|
||||
import cn.axzo.log.platform.client.model.OperateLogQueryReq;
|
||||
import cn.axzo.log.platform.client.model.OperateLogQueryResp;
|
||||
import cn.axzo.log.platform.client.model.OperateLogReq;
|
||||
import cn.axzo.log.platform.server.LogPlatApplicationTestBase;
|
||||
import cn.azxo.framework.common.model.CommonPageResponse;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import org.junit.Test;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/***
|
||||
* @author: pepsi
|
||||
* @description: TODO
|
||||
* @date: 2022/10/13
|
||||
*/
|
||||
public class LogPlatClientTest extends LogPlatApplicationTestBase {
|
||||
|
||||
@Autowired
|
||||
private LogPlatClient logPlatClient;
|
||||
|
||||
@Test
|
||||
public void testInsert() {
|
||||
OperateLogReq req = new OperateLogReq();
|
||||
req.setServiceName("ServiceName");
|
||||
req.setFeatureCode("FeatureCode");
|
||||
req.setFeatureName("FeatureName");
|
||||
req.setLogGrade(4);
|
||||
req.setOperateTime(new Date());
|
||||
req.setIdentityId(1L);
|
||||
req.setIdentityType(1);
|
||||
req.setWorkspaceId(1L);
|
||||
req.setOuId(1L);
|
||||
req.setTerminal("macos");
|
||||
req.setOperateUserIp("macos-ip-test");
|
||||
req.setOperateBefore("OperateBefore");
|
||||
req.setOperateAfter("OperateAfter");
|
||||
req.setOperateParam("OperateParam");
|
||||
req.setContentSummary("ContentSummary");
|
||||
req.setContentSummary("ContentSummary");
|
||||
req.setLogExt("LogExt");
|
||||
req.setResourceId(1L);
|
||||
req.setResourceType(1);
|
||||
req.setOperateType(1);
|
||||
req.setOperateTable("table_name");
|
||||
logPlatClient.createOperateLog(req);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testQuery() {
|
||||
OperateLogQueryReq queryReq = new OperateLogQueryReq();
|
||||
queryReq.setServiceName("ServiceName");
|
||||
queryReq.setStartTime(DateUtil.parse("2022-10-01 12:00:00", DatePattern.NORM_DATETIME_FORMAT));
|
||||
queryReq.setEndTime(new Date());
|
||||
CommonPageResponse<OperateLogQueryResp> response = logPlatClient.queryForPage(queryReq);
|
||||
assert response.getTotalCount() == 0;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user