新增 用户UI操作日志开关功能
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package com.gzzn.omms.adminapi.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.gzzn.omms.adminapi.dto.OpLogSwitchDto;
|
||||
|
||||
|
||||
public interface IOplogSwithcInfoService {
|
||||
|
||||
public List<OpLogSwitchDto> getOpLogSwitchByLevleAndName(Byte level,String name);
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.gzzn.omms.adminapi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import com.gzzn.omms.adminapi.dto.OpLogSwitchDto;
|
||||
import com.gzzn.omms.adminapi.dto.ResponseDto;
|
||||
import com.gzzn.omms.adminapi.service.IOplogSwithcInfoService;
|
||||
import com.gzzn.omms.adminapi.utils.JsonUtil;
|
||||
|
||||
@Service
|
||||
public class OplogSwithcInfoServiceImpl implements IOplogSwithcInfoService{
|
||||
|
||||
@Value("${sysApi.getOpLogSwitchByLevleAndNameUrl}")
|
||||
private String getOpLogSwitchByLevleAndNameUrl;
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
@Override
|
||||
public List<OpLogSwitchDto> getOpLogSwitchByLevleAndName(Byte level,String name) {
|
||||
String url = getOpLogSwitchByLevleAndNameUrl;
|
||||
url = url.replace("{level}", level.toString())
|
||||
.replace("{name}", name);
|
||||
ResponseEntity<ResponseDto> responseEntity = restTemplate
|
||||
.getForEntity(url, ResponseDto.class);
|
||||
|
||||
if(!responseEntity.getStatusCode().equals(HttpStatus.OK))
|
||||
{
|
||||
throw new RuntimeException("获取公共url信息失败:" + responseEntity.getStatusCode());
|
||||
}
|
||||
|
||||
ResponseDto responseDto = responseEntity.getBody();
|
||||
|
||||
if(responseDto.getIs_success() == false)
|
||||
{
|
||||
throw new RuntimeException("获取公共url信息失败::" + responseDto.getErr_code() + ",msg:"+responseDto.getErr_msg());
|
||||
}
|
||||
|
||||
String srtJson = JsonUtil.getString(responseDto.getBody());
|
||||
List<OpLogSwitchDto> result = JsonUtil.getObject(srtJson, List.class);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user