优化调整
This commit is contained in:
parent
b46517b361
commit
b9b7cb1466
21
RELEASE.md
Normal file
21
RELEASE.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# 发布记录
|
||||||
|
## V1.0.1_?
|
||||||
|
|
||||||
|
### 功能
|
||||||
|
|
||||||
|
- 接入ES
|
||||||
|
- 接入Swagger
|
||||||
|
|
||||||
|
### 修复
|
||||||
|
|
||||||
|
|
||||||
|
### 优化
|
||||||
|
|
||||||
|
## V1.0.0
|
||||||
|
|
||||||
|
### 功能
|
||||||
|
|
||||||
|
- 操作日志记录服务初始化
|
||||||
|
- 新增操作日志接口
|
||||||
|
- 分页查询操作日志接口
|
||||||
|
- RabbitMQ消费操作日志记录
|
||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.xlog.server.config;
|
package cn.axzo.xlog.server.consumer;
|
||||||
|
|
||||||
|
import cn.axzo.xlog.server.config.RabbitMqConfig;
|
||||||
import cn.axzo.xlog.server.dto.OperateLogReqDTO;
|
import cn.axzo.xlog.server.dto.OperateLogReqDTO;
|
||||||
import cn.axzo.xlog.server.service.OperateLogService;
|
import cn.axzo.xlog.server.service.OperateLogService;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@ -39,6 +40,4 @@ public class OperateLogMqConsumer {
|
|||||||
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -30,10 +30,8 @@ public abstract class BaseEntity<T extends Model<?>> extends Model<T> {
|
|||||||
private Integer isDelete = 0;
|
private Integer isDelete = 0;
|
||||||
|
|
||||||
@TableField(value = "create_at", fill = FieldFill.INSERT)
|
@TableField(value = "create_at", fill = FieldFill.INSERT)
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date createAt;
|
private Date createAt;
|
||||||
|
|
||||||
@TableField(value = "update_at", fill = FieldFill.INSERT_UPDATE)
|
@TableField(value = "update_at", fill = FieldFill.INSERT_UPDATE)
|
||||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date updateAt;
|
private Date updateAt;
|
||||||
}
|
}
|
||||||
@ -19,14 +19,6 @@ public interface OperateLogService {
|
|||||||
*/
|
*/
|
||||||
boolean insertOperaLog(OperateLogReqDTO operateLogReq) throws Exception;
|
boolean insertOperaLog(OperateLogReqDTO operateLogReq) throws Exception;
|
||||||
|
|
||||||
/**
|
|
||||||
* 字段补全
|
|
||||||
*
|
|
||||||
* @param operateLogReq
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
OperateLogRecordEntity fieldFill(OperateLogReqDTO operateLogReq);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询
|
* 分页查询
|
||||||
*
|
*
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface EntityConverter<V, E> {
|
public interface EntityConverter<V, E> {
|
||||||
|
|
||||||
V toVm(E var);
|
V toVo(E var);
|
||||||
|
|
||||||
List<V> toVm(List<E> var);
|
List<V> toVo(List<E> var);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,21 @@
|
|||||||
|
package cn.axzo.xlog.server.service.converter;
|
||||||
|
|
||||||
|
import cn.axzo.xlog.server.dto.OperateLogReqDTO;
|
||||||
|
import cn.axzo.xlog.server.entity.OperateLogRecordEntity;
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
import static org.mapstruct.NullValueCheckStrategy.ALWAYS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: liyong.tian
|
||||||
|
* @Date: 2022/9/20
|
||||||
|
* @Description:
|
||||||
|
*/
|
||||||
|
@Mapper(
|
||||||
|
componentModel = "spring",
|
||||||
|
nullValueCheckStrategy = ALWAYS
|
||||||
|
)
|
||||||
|
public interface OperateLogConverter {
|
||||||
|
|
||||||
|
OperateLogRecordEntity toEntity(OperateLogReqDTO dto);
|
||||||
|
}
|
||||||
@ -17,6 +17,7 @@ import cn.axzo.xlog.server.enums.IdentityType;
|
|||||||
import cn.axzo.xlog.server.repository.OperateLogRepository;
|
import cn.axzo.xlog.server.repository.OperateLogRepository;
|
||||||
import cn.axzo.xlog.server.service.BaseEsService;
|
import cn.axzo.xlog.server.service.BaseEsService;
|
||||||
import cn.axzo.xlog.server.service.OperateLogService;
|
import cn.axzo.xlog.server.service.OperateLogService;
|
||||||
|
import cn.axzo.xlog.server.service.converter.OperateLogConverter;
|
||||||
import cn.azxo.framework.common.model.CommonPageResponse;
|
import cn.azxo.framework.common.model.CommonPageResponse;
|
||||||
import cn.azxo.framework.common.model.CommonResponse;
|
import cn.azxo.framework.common.model.CommonResponse;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
@ -67,6 +68,9 @@ public class OperateLogServiceImpl extends BaseEsService implements OperateLogSe
|
|||||||
@Resource
|
@Resource
|
||||||
private UserProfileServiceApi profileServiceApi;
|
private UserProfileServiceApi profileServiceApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private OperateLogConverter operateLogConverter;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean insertOperaLog(OperateLogReqDTO operateLogReq) throws Exception {
|
public boolean insertOperaLog(OperateLogReqDTO operateLogReq) throws Exception {
|
||||||
//调用接口字段补全
|
//调用接口字段补全
|
||||||
@ -82,33 +86,11 @@ public class OperateLogServiceImpl extends BaseEsService implements OperateLogSe
|
|||||||
return insert(json, indexNamePrex + indexDate);
|
return insert(json, indexNamePrex + indexDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public OperateLogRecordEntity fieldFill(OperateLogReqDTO req) {
|
|
||||||
//补充 termimnal identityType featureName
|
|
||||||
IdentityType type = IdentityType.getIdentityType(req.getIdentityType());
|
|
||||||
OperateLogRecordEntity unifiedLogRecord = new OperateLogRecordEntity();
|
|
||||||
unifiedLogRecord.setServiceName(req.getServiceName());
|
|
||||||
|
|
||||||
unifiedLogRecord.setFeatureCode(req.getFeatureCode());
|
private OperateLogRecordEntity fieldFill(OperateLogReqDTO req) {
|
||||||
unifiedLogRecord.setFeatureName(req.getFeatureName());
|
//补充 termimnal identityType featureName
|
||||||
unifiedLogRecord.setLogGrade(req.getLogGrade());
|
OperateLogRecordEntity unifiedLogRecord = operateLogConverter.toEntity(req);
|
||||||
unifiedLogRecord.setOperateTime(req.getOperateTime());
|
|
||||||
unifiedLogRecord.setTerminal(req.getTerminal());
|
|
||||||
unifiedLogRecord.setIdentityId(req.getIdentityId());
|
|
||||||
//不用 enums
|
|
||||||
unifiedLogRecord.setIdentityType(type.getCode());
|
|
||||||
unifiedLogRecord.setWorkspaceId(req.getWorkspaceId());
|
|
||||||
unifiedLogRecord.setOuId(req.getOuId());
|
|
||||||
unifiedLogRecord.setOperateUserIp(req.getOperateUserIp());
|
|
||||||
unifiedLogRecord.setOperateBefore(req.getOperateBefore());
|
|
||||||
unifiedLogRecord.setOperateAfter(req.getOperateAfter());
|
|
||||||
unifiedLogRecord.setOperateParam(req.getOperateParam());
|
|
||||||
unifiedLogRecord.setContentSummary(req.getContentSummary());
|
|
||||||
unifiedLogRecord.setLogExt(req.getLogExt());
|
|
||||||
unifiedLogRecord.setResourceId(req.getResourceId());
|
|
||||||
unifiedLogRecord.setOperateTable(req.getOperateTable());
|
|
||||||
unifiedLogRecord.setOperateType(req.getOperateType());
|
|
||||||
unifiedLogRecord.setResourceType(req.getResourceType());
|
|
||||||
// 通过接口调用,获取用户手机姓名
|
// 通过接口调用,获取用户手机姓名
|
||||||
IdentityProfileDto identityProfile = qryIdentityProfile(req.getIdentityId(), req.getIdentityType());
|
IdentityProfileDto identityProfile = qryIdentityProfile(req.getIdentityId(), req.getIdentityType());
|
||||||
if (identityProfile != null && identityProfile.getPersonProfile() != null) {
|
if (identityProfile != null && identityProfile.getPersonProfile() != null) {
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import cn.axzo.xlog.server.dto.OperateLogQueryReqDTO;
|
|||||||
import cn.axzo.xlog.server.dto.OperateLogQueryRespDTO;
|
import cn.axzo.xlog.server.dto.OperateLogQueryRespDTO;
|
||||||
import cn.axzo.xlog.server.dto.OperateLogReqDTO;
|
import cn.axzo.xlog.server.dto.OperateLogReqDTO;
|
||||||
import cn.axzo.xlog.server.entity.OperateLogRecordEntity;
|
import cn.axzo.xlog.server.entity.OperateLogRecordEntity;
|
||||||
|
import cn.axzo.xlog.server.service.converter.OperateLogConverter;
|
||||||
import cn.azxo.framework.common.model.CommonPageResponse;
|
import cn.azxo.framework.common.model.CommonPageResponse;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
@ -28,6 +29,9 @@ public class OperateLogServiceTest extends XlogApplicationTestBase {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private OperateLogService operateLogService;
|
private OperateLogService operateLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OperateLogConverter operateLogConverter;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void initreqDataData() {
|
public void initreqDataData() {
|
||||||
reqData = new OperateLogReqDTO();
|
reqData = new OperateLogReqDTO();
|
||||||
@ -56,7 +60,7 @@ public class OperateLogServiceTest extends XlogApplicationTestBase {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFieldFill() {
|
public void testFieldFill() {
|
||||||
OperateLogRecordEntity entity = operateLogService.fieldFill(reqData);
|
OperateLogRecordEntity entity = operateLogConverter.toEntity(reqData);
|
||||||
Assert.assertEquals(reqData.getLogGrade(), entity.getLogGrade());
|
Assert.assertEquals(reqData.getLogGrade(), entity.getLogGrade());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user