Merge branch 'master' into feature/REQ-2997
This commit is contained in:
commit
2080a6b7f2
@ -41,6 +41,5 @@ public class LogAddReq {
|
||||
/**
|
||||
* 日志内容,需要是json格式
|
||||
*/
|
||||
@NotBlank(message = "message is required")
|
||||
private String message;
|
||||
}
|
||||
|
||||
@ -109,9 +109,14 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.axzo.maokai</groupId>
|
||||
<artifactId>maokai-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- <dependency>
|
||||
<groupId>cn.axzo.basics</groupId>
|
||||
<artifactId>basics-organizational-api</artifactId>
|
||||
</dependency>
|
||||
</dependency>-->
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.axzo.apollo</groupId>
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
|
||||
@ -29,4 +30,10 @@ public class ExceptionAdviceHandler {
|
||||
log.warn("业务异常", e);
|
||||
return ApiResult.err(e.getMessage());
|
||||
}
|
||||
|
||||
@ExceptionHandler({MethodArgumentNotValidException.class})
|
||||
public ApiResult<Void> exceptionHandler(MethodArgumentNotValidException e) {
|
||||
log.error("参数异常", e);
|
||||
return ApiResult.err(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@ -80,6 +80,9 @@ public class LogServiceImpl implements LogService {
|
||||
*/
|
||||
@Override
|
||||
public String addLog(LogAddReq req) {
|
||||
if (StringUtils.isBlank(req.getMessage())) {
|
||||
return "";
|
||||
}
|
||||
LogEntity logEntity = buildToLogEntity(req);
|
||||
logMapper.save(logEntity);
|
||||
return logEntity.getId();
|
||||
@ -147,8 +150,12 @@ public class LogServiceImpl implements LogService {
|
||||
*/
|
||||
@Override
|
||||
public List<String> batchAddLogs(LogBatchAddReq req) {
|
||||
if (req.getLogs().stream().allMatch(l -> StringUtils.isBlank(l.getMessage()))) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<LogEntity> logEntities = req.getLogs()
|
||||
.stream()
|
||||
.filter(l -> StringUtils.isNotBlank(l.getMessage()))
|
||||
.map(this::buildToLogEntity)
|
||||
.collect(Collectors.toList());
|
||||
logMapper.saveAll(logEntities);
|
||||
|
||||
@ -4,8 +4,9 @@ import cn.axzo.apollo.core.web.Result;
|
||||
import cn.axzo.apollo.workspace.api.workspace.WorkspaceApi;
|
||||
import cn.axzo.apollo.workspace.api.workspace.req.GetDetailReq;
|
||||
import cn.axzo.apollo.workspace.api.workspace.res.GetDetailRes;
|
||||
import cn.axzo.basics.organizational.api.OrganizationalUnitApi;
|
||||
import cn.axzo.basics.organizational.api.vo.response.OrganizationalUnitVO;
|
||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||
import cn.axzo.maokai.api.client.OrganizationalUnitApi;
|
||||
import cn.axzo.maokai.api.vo.response.OrganizationalUnitVO;
|
||||
import cn.axzo.basics.profiles.api.UserProfileServiceApi;
|
||||
import cn.axzo.basics.profiles.common.enums.IdentityType;
|
||||
import cn.axzo.basics.profiles.dto.basic.IdentityProfileDto;
|
||||
@ -377,7 +378,7 @@ public class OperateLogServiceImpl extends BaseEsService implements OperateLogSe
|
||||
* @return
|
||||
*/
|
||||
private OrganizationalUnitVO qryOrgUnitInf(Long ouId) throws ThirdApiException {
|
||||
CommonResponse<OrganizationalUnitVO> response = organizationalUnitApi.getById(ouId);
|
||||
ApiResult<OrganizationalUnitVO> response = organizationalUnitApi.getById(ouId);
|
||||
if (response.getCode() != 200) {
|
||||
throw new ThirdApiException(response.getMsg());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user