Commit 40eb0b54 authored by mcb's avatar mcb

no message

parent 1c032397
...@@ -22,7 +22,7 @@ public class SourceDbNameListDto { ...@@ -22,7 +22,7 @@ public class SourceDbNameListDto {
/* /*
* 源数据库名称 * 源数据库名称
* */ * */
@ApiModelProperty(value = "源数据库名称") @ApiModelProperty(value = "数据源名称")
String datasourceNameOrg; String datasourceNameOrg;
/* /*
...@@ -40,7 +40,7 @@ public class SourceDbNameListDto { ...@@ -40,7 +40,7 @@ public class SourceDbNameListDto {
/* /*
* 源数据库和数据库类型名称 * 源数据库和数据库类型名称
* */ * */
@ApiModelProperty(value = "源数据库和数据库类型名称") @ApiModelProperty(value = "数据源和数据库类型名称")
String datasourceName; String datasourceName;
/* /*
......
...@@ -217,4 +217,27 @@ public class DmpApiMangeController { ...@@ -217,4 +217,27 @@ public class DmpApiMangeController {
return jsonResult; return jsonResult;
} }
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation(value = "授权模糊查询组织信息", notes = "授权模糊查询组织信息")
@GetMapping(value = "/authOrgList")
@ApiImplicitParam(name = "key", value = "key", required = true)
public JsonResult getAuthOrgList(@RequestParam String key, HttpServletRequest httpRequest) {
if (StringUtils.isEmpty(key)) {
return JsonResult.error(ResultCode.PARAMS_ERROR, "key不能为空!");
}
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.getAuthOrgList(key);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
} }
\ No newline at end of file
...@@ -2,6 +2,7 @@ package com.jz.dmp.modules.controller.dataService; ...@@ -2,6 +2,7 @@ package com.jz.dmp.modules.controller.dataService;
import com.jz.common.constant.JsonResult; import com.jz.common.constant.JsonResult;
import com.jz.common.constant.ResultCode; import com.jz.common.constant.ResultCode;
import com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto;
import com.jz.dmp.modules.controller.dataService.bean.*; import com.jz.dmp.modules.controller.dataService.bean.*;
import com.jz.dmp.modules.service.DmpApiMangeService; import com.jz.dmp.modules.service.DmpApiMangeService;
import com.jz.dmp.modules.service.DmpApiServiceMangeService; import com.jz.dmp.modules.service.DmpApiServiceMangeService;
...@@ -17,6 +18,7 @@ import org.springframework.validation.annotation.Validated; ...@@ -17,6 +18,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List;
/** /**
* 数据服务-服务管理--调用gateway 接口 * 数据服务-服务管理--调用gateway 接口
...@@ -37,6 +39,9 @@ public class DmpApiServiceMangeController { ...@@ -37,6 +39,9 @@ public class DmpApiServiceMangeController {
@Autowired @Autowired
private DmpApiServiceMangeService dmpApiServiceMangeService; private DmpApiServiceMangeService dmpApiServiceMangeService;
@Autowired
private DmpApiMangeService dmpApiMangeService;
/** /**
* 保存API(第三方)基本信息 * 保存API(第三方)基本信息
* *
...@@ -117,4 +122,66 @@ public class DmpApiServiceMangeController { ...@@ -117,4 +122,66 @@ public class DmpApiServiceMangeController {
return jsonResult; return jsonResult;
} }
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
@ApiOperation(value = "API计量--调用次数和执行时长", notes = "API计量调用次数和执行时长")
@GetMapping(value = "/countAPiCallStat")
//@ApiImplicitParam(name = "date", value = "date", required = true)
public JsonResult countAPiCallStat(HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiServiceMangeService.getCountAPiCallStat();
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* API计量--API列表
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation(value = "API计量--API列表", notes = "API计量--API列表")
@PostMapping(value = "/apiCountListPage")
public JsonResult apiCountListPage(@RequestBody @Validated ApiInterfaceInfoListReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiMangeService.queryApiListPage(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 获取数据源配置——下拉框
*
* @return
* @author Bellamy
*/
@ApiOperation(value = "获取数据源配置-下拉框", notes = "获取数据源配置")
@GetMapping(value = "/sourceDbList")
@ApiImplicitParam(name = "projectId", value = "项目id", required = true)
public JsonResult<List<SourceDbNameListDto>> getSourceDbList(@RequestParam Integer projectId) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiServiceMangeService.querygSourceDbList(projectId);
} catch (Exception e) {
jsonResult.setMessage("查询失败");
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
} }
\ No newline at end of file
...@@ -47,7 +47,7 @@ public class OrganizationManageAddReq implements Serializable { ...@@ -47,7 +47,7 @@ public class OrganizationManageAddReq implements Serializable {
private String linkman; private String linkman;
@ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true) @ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private String status; private Boolean status;
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createUser; private String createUser;
......
...@@ -50,7 +50,7 @@ public class OrganizationManageUpdateReq implements Serializable { ...@@ -50,7 +50,7 @@ public class OrganizationManageUpdateReq implements Serializable {
private String linkman; private String linkman;
@ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true) @ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private String status; private Boolean status;
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private String createUser; private String createUser;
......
...@@ -76,4 +76,11 @@ public interface DmpApiMangeService { ...@@ -76,4 +76,11 @@ public interface DmpApiMangeService {
*/ */
JsonResult checkApiLogInfo(LogInfoListReq req) throws Exception; JsonResult checkApiLogInfo(LogInfoListReq req) throws Exception;
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
JsonResult getAuthOrgList(String key) throws Exception;
} }
...@@ -46,4 +46,20 @@ public interface DmpApiServiceMangeService { ...@@ -46,4 +46,20 @@ public interface DmpApiServiceMangeService {
* @since 2021-01-20 * @since 2021-01-20
*/ */
JsonResult updateApiBigDataInfo(MakeBigDataApiReq req) throws Exception; JsonResult updateApiBigDataInfo(MakeBigDataApiReq req) throws Exception;
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult getCountAPiCallStat() throws Exception;
/**
* 获取数据源配置——下拉框
*
* @return
* @author Bellamy
*/
JsonResult querygSourceDbList(Integer projectId) throws Exception;
} }
\ No newline at end of file
...@@ -54,6 +54,9 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService { ...@@ -54,6 +54,9 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
//查看日志url //查看日志url
private static final String checkApiLog = "/api/logging/listApiLog"; private static final String checkApiLog = "/api/logging/listApiLog";
//授权模糊查询组织信息url
private static final String authOrgList = "/api/auth/getAuthNameList";
@Value("${spring.gateway-url}") @Value("${spring.gateway-url}")
private String gatewayUrl; private String gatewayUrl;
...@@ -308,4 +311,36 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService { ...@@ -308,4 +311,36 @@ public class DmpApiMangeServiceImpl implements DmpApiMangeService {
return result; return result;
} }
/**
* 授权模糊查询组织信息
*
* @author Bellamy
* @since 2021-01-19
*/
@Override
public JsonResult getAuthOrgList(String key) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + authOrgList;
Map params = new HashMap();
params.put("key", key);
String returnData = HttpClientUtils.getJsonForParam(url, params);
if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果{}" + returnData);
Map map = JSONObject.parseObject(returnData);
if (map.containsKey("code")) {
if ("200".equals(map.get("code").toString())) {
return JsonResult.ok(map.get("data"));
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
}
} }
...@@ -3,11 +3,14 @@ package com.jz.dmp.modules.service.impl; ...@@ -3,11 +3,14 @@ package com.jz.dmp.modules.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jz.common.constant.JsonResult; import com.jz.common.constant.JsonResult;
import com.jz.common.constant.ResultCode; import com.jz.common.constant.ResultCode;
import com.jz.common.utils.DateUtils;
import com.jz.common.utils.web.HttpClientUtils; import com.jz.common.utils.web.HttpClientUtils;
import com.jz.common.utils.web.SessionUtils; import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.DataIntegration.bean.SourceDbNameListDto;
import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq; import com.jz.dmp.modules.controller.dataService.bean.ApiInterfaceReq;
import com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq; import com.jz.dmp.modules.controller.dataService.bean.MakeBigDataApiReq;
import com.jz.dmp.modules.dao.DvRuleTDao; import com.jz.dmp.modules.dao.DvRuleTDao;
import com.jz.dmp.modules.dao.OfflineSynchDao;
import com.jz.dmp.modules.model.DvRuleT; import com.jz.dmp.modules.model.DvRuleT;
import com.jz.dmp.modules.service.DmpApiServiceMangeService; import com.jz.dmp.modules.service.DmpApiServiceMangeService;
import com.jz.dmp.modules.service.DvRuleTService; import com.jz.dmp.modules.service.DvRuleTService;
...@@ -19,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -19,6 +22,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -43,9 +48,17 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -43,9 +48,17 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
//编辑API(第三方)基本信息url //编辑API(第三方)基本信息url
private static final String updateApiInfo = "/api/producer/saveUpdate"; private static final String updateApiInfo = "/api/producer/saveUpdate";
//API计量调用次数和执行时长url
private static final String countAPiCallStat = "/api/logging/countAPiCallStat";
@Value("${spring.gateway-url}") @Value("${spring.gateway-url}")
private String gatewayUrl; private String gatewayUrl;
@Value("${spring.api-bigData-setting}")
private String apiBigSetting;
@Autowired
private OfflineSynchDao offlineSynchDao;
/** /**
* 保存API(第三方)基本信息 * 保存API(第三方)基本信息
* *
...@@ -192,4 +205,51 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -192,4 +205,51 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
} }
return result; return result;
} }
/**
* API计量调用次数和执行时长
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public JsonResult getCountAPiCallStat() throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + countAPiCallStat;
Map params = new HashMap();
params.put("date", DateUtils.currentDate());
String returnData = HttpClientUtils.getJsonForParam(url, params);
if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("查询失败!");
}
logger.info("#################响应结果{}" + returnData);
Map map = JSONObject.parseObject(returnData);
if (map.containsKey("code")) {
if ("200".equals(map.get("code").toString())) {
return JsonResult.ok(map.get("data"));
}
}
if (map.containsKey("message")) {
logger.info(map.get("message").toString());
result.setMessage(map.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
}
return result;
}
/**
* 获取数据源配置——下拉框
*
* @return
* @author Bellamy
*/
@Override
public JsonResult querygSourceDbList(Integer projectId) throws Exception {
Map map = new HashMap();
map.put("projectId", projectId); //项目id
map.put("datasource", apiBigSetting.split(","));
List<SourceDbNameListDto> list = offlineSynchDao.querygSourceDbList(map);
return JsonResult.ok(list);
}
} }
\ No newline at end of file
...@@ -153,7 +153,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService { ...@@ -153,7 +153,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
@Override @Override
public JsonResult updateOrg(OrganizationManageUpdateReq req) throws Exception { public JsonResult updateOrg(OrganizationManageUpdateReq req) throws Exception {
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
String url = gatewayUrl + updateOrg; String url = gatewayUrl + addOrg;
req.setCreateUser(SessionUtils.getCurrentUserName()); req.setCreateUser(SessionUtils.getCurrentUserName());
String returnData = HttpClientUtils.post(url, JSONObject.toJSONString(req)); String returnData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
......
...@@ -49,17 +49,16 @@ ...@@ -49,17 +49,16 @@
dsdt.datasource_catecode as datasourceCatecode dsdt.datasource_catecode as datasourceCatecode
from dmp_syncing_datasource ds from dmp_syncing_datasource ds
inner join dmp_syncing_datasource_type dsdt on ds.datasource_type = dsdt.id inner join dmp_syncing_datasource_type dsdt on ds.datasource_type = dsdt.id
<if test = 'isEnableSource != null and isEnableSource == "1"'> <if test = 'isEnableSource != null and isEnableSource == "1"'> and dsdt.is_enable_source = '1' </if>
and dsdt.is_enable_source = '1' <if test = "isEnableTarget != null and isEnableTarget=='1'.toString()"> and dsdt.is_enable_target = '1' </if>
</if> where ds.data_status = '1' and ds.project_id = #{projectId}
<if test = "isEnableTarget != null and isEnableTarget=='1'.toString()"> <if test="datasource != null and datasource !='' ">
and dsdt.is_enable_target = '1' and dsdt.datasource in
</if> <foreach collection="datasource" item="item" open="(" separator="," close=")">
where ds.data_status = '1' #{item}
and ds.project_id = #{projectId} </foreach>
<if test = 'datasourceType != null and datasourceType > 0 '>
and ds.DATASOURCE_TYPE = #{datasourceType}
</if> </if>
<if test = 'datasourceType != null and datasourceType > 0 '> and ds.DATASOURCE_TYPE = #{datasourceType} </if>
</select> </select>
<!--主键查询数据源--> <!--主键查询数据源-->
......
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