Commit 1c032397 authored by mcb's avatar mcb

no message

parent e5356244
...@@ -110,6 +110,7 @@ public class SessionUtils { ...@@ -110,6 +110,7 @@ public class SessionUtils {
/** /**
* @Title: getSessionUserId * @Title: getSessionUserId
* @Description: 获取登录用户ID * @Description: 获取登录用户ID
* @Author: Bellamy
* @return String 返回类型 * @return String 返回类型
*/ */
public static String getCurrentUserId(){ public static String getCurrentUserId(){
...@@ -121,6 +122,21 @@ public class SessionUtils { ...@@ -121,6 +122,21 @@ public class SessionUtils {
return userId; return userId;
} }
/**
* @Title: getCurrentUserName
* @Description: 获取登录用户名称
* @Author: Bellamy
* @return String 返回类型
*/
public static String getCurrentUserName(){
String userName = "";
DmpMember user = getSecurityUser();
if(user != null){
userName = user.getUserName();
}
return userName;
}
/** /**
* @Title: getAuthentication * @Title: getAuthentication
* @Description: TODO(获取authentication) * @Description: TODO(获取authentication)
......
...@@ -45,7 +45,7 @@ public class DmpApiServiceMangeController { ...@@ -45,7 +45,7 @@ public class DmpApiServiceMangeController {
*/ */
@ApiOperation(value = "保存API(第三方)", notes = "保存API(第三方)") @ApiOperation(value = "保存API(第三方)", notes = "保存API(第三方)")
@PostMapping(value = "/saveApi") @PostMapping(value = "/saveApi")
public JsonResult saveApiInfo(@RequestBody ApiInterfaceReq req, HttpServletRequest httpRequest) { public JsonResult saveApiInfo(@RequestBody @Validated ApiInterfaceReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
try { try {
jsonResult = dmpApiServiceMangeService.saveApiInfo(req); jsonResult = dmpApiServiceMangeService.saveApiInfo(req);
...@@ -65,7 +65,7 @@ public class DmpApiServiceMangeController { ...@@ -65,7 +65,7 @@ public class DmpApiServiceMangeController {
*/ */
@ApiOperation(value = "保存API(大数据查询/标签查询)", notes = "保存API(大数据查询/标签查询)") @ApiOperation(value = "保存API(大数据查询/标签查询)", notes = "保存API(大数据查询/标签查询)")
@PostMapping(value = "/saveApiBigData") @PostMapping(value = "/saveApiBigData")
public JsonResult saveApiBigDataInfo(@RequestBody MakeBigDataApiReq req, HttpServletRequest httpRequest) { public JsonResult saveApiBigDataInfo(@RequestBody @Validated MakeBigDataApiReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
try { try {
jsonResult = dmpApiServiceMangeService.saveApiBigDataInfo(req); jsonResult = dmpApiServiceMangeService.saveApiBigDataInfo(req);
...@@ -77,4 +77,44 @@ public class DmpApiServiceMangeController { ...@@ -77,4 +77,44 @@ public class DmpApiServiceMangeController {
return jsonResult; return jsonResult;
} }
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
@ApiOperation(value = "编辑API(第三方)", notes = "编辑API(第三方)")
@PostMapping(value = "/updataApi")
public JsonResult updateApiInfo(@RequestBody @Validated ApiInterfaceReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiServiceMangeService.updateApiInfo(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-19
*/
@ApiOperation(value = "编辑API(大数据查询/标签查询)", notes = "编辑API(大数据查询/标签查询)")
@PostMapping(value = "/updateApiBigData")
public JsonResult updateApiBigDataInfo(@RequestBody @Validated MakeBigDataApiReq req, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult();
try {
jsonResult = dmpApiServiceMangeService.updateApiBigDataInfo(req);
} catch (Exception e) {
jsonResult.setMessage(e.getMessage());
jsonResult.setCode(ResultCode.INTERNAL_SERVER_ERROR);
e.printStackTrace();
}
return jsonResult;
}
} }
\ No newline at end of file
...@@ -135,7 +135,7 @@ public class DmpOrgMangeController { ...@@ -135,7 +135,7 @@ public class DmpOrgMangeController {
* @since 2021-01-18 * @since 2021-01-18
*/ */
@ApiOperation(value = "根据组织id获取组织详情", notes = "根据组织id获取组织详情") @ApiOperation(value = "根据组织id获取组织详情", notes = "根据组织id获取组织详情")
@PostMapping(value = "/orgInfo") @GetMapping(value = "/orgInfo")
@ApiImplicitParam(name = "id", value = "组织id", required = true) @ApiImplicitParam(name = "id", value = "组织id", required = true)
public JsonResult getOrgInfoByOrgId(@RequestParam String id, HttpServletRequest httpRequest) { public JsonResult getOrgInfoByOrgId(@RequestParam String id, HttpServletRequest httpRequest) {
JsonResult jsonResult = new JsonResult(); JsonResult jsonResult = new JsonResult();
......
...@@ -62,13 +62,13 @@ public class ApiInterfaceReq implements Serializable { ...@@ -62,13 +62,13 @@ public class ApiInterfaceReq implements Serializable {
@NotNull(message="项目id不能为空") @NotNull(message="项目id不能为空")
public Long projectId; public Long projectId;
@ApiModelProperty(value = "状态",required = false) @ApiModelProperty(value = "状态",required = false)
public String status; public String status;
@ApiModelProperty(value = "更新时传入api自增id",required = false) @ApiModelProperty(value = "更新时传入api自增id",required = false)
public Long id; public Long id;
@ApiModelProperty(value = "创建用户",hidden = true)
@ApiModelProperty(value = "创建用户")
public String createUser; public String createUser;
@ApiModelProperty(value = "api类型:1.数据银行制作大数据表 " + @ApiModelProperty(value = "api类型:1.数据银行制作大数据表 " +
......
...@@ -6,6 +6,8 @@ import lombok.Data; ...@@ -6,6 +6,8 @@ import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
import java.util.Map;
/** /**
* @ClassName: MakeBigDataApiReq * @ClassName: MakeBigDataApiReq
...@@ -104,7 +106,7 @@ public class MakeBigDataApiReq implements Serializable { ...@@ -104,7 +106,7 @@ public class MakeBigDataApiReq implements Serializable {
@ApiModelProperty(value = "段列表",required = true) @ApiModelProperty(value = "段列表",required = true)
@NotNull(message = "字段列表不能为空") @NotNull(message = "字段列表不能为空")
private String tableFields; private List<Map> tableFields;
@ApiModelProperty(value = "创建用户",required = false) @ApiModelProperty(value = "创建用户",required = false)
public String createUser; public String createUser;
......
...@@ -30,22 +30,25 @@ public class OrganizationManageAddReq implements Serializable { ...@@ -30,22 +30,25 @@ public class OrganizationManageAddReq implements Serializable {
@NotEmpty(message = "组织名称不能为空!") @NotEmpty(message = "组织名称不能为空!")
private String orgName; private String orgName;
@ApiModelProperty(value = "组织描述", required = false) @ApiModelProperty(value = "组织描述")
private String orgDesc; private String orgDesc;
@ApiModelProperty(value = "组织英文名称", required = false) @ApiModelProperty(value = "组织英文名称")
private String orgCnName; private String orgCnName;
@ApiModelProperty(value = "组织邮箱", required = false) @ApiModelProperty(value = "组织邮箱")
private String orgMail; private String orgMail;
@ApiModelProperty(value = "联系方式", required = true) @ApiModelProperty(value = "联系方式", required = true)
@NotEmpty(message = "联系方式不能为空!") @NotEmpty(message = "联系方式不能为空!")
private String orgPhone; private String orgPhone;
@ApiModelProperty(value = "联系人")
private String linkman;
@ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true) @ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private String status; private String status;
@ApiModelProperty(value = "联系人", required = true) @ApiModelProperty(value = "创建人")
private String createUser; private String createUser;
} }
...@@ -24,4 +24,7 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri ...@@ -24,4 +24,7 @@ public class OrganizationManageListQueryReq extends BasePageBean implements Seri
@ApiModelProperty(value = "组织编码(组织唯一标识)") @ApiModelProperty(value = "组织编码(组织唯一标识)")
private String orgCode; private String orgCode;
@ApiModelProperty(value = "联系人")
private String linkman;
} }
...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel; ...@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.io.Serializable; import java.io.Serializable;
...@@ -22,30 +23,36 @@ public class OrganizationManageUpdateReq implements Serializable { ...@@ -22,30 +23,36 @@ public class OrganizationManageUpdateReq implements Serializable {
@NotNull(message = "组织id不能为空") @NotNull(message = "组织id不能为空")
private Long id; private Long id;
/* @ApiModelProperty(value = "组织名称",required = true) @ApiModelProperty(value = "组织类型:INT 内部组织 OUT 外部组织", required = true)
@NotNull(message = "组织类型不能为空!")
@NotEmpty(message = "组织类型不能为空!")
private String orgType;
@ApiModelProperty(value = "组织名称", required = true)
@NotNull(message = "组织名称不能为空") @NotNull(message = "组织名称不能为空")
private String orgName;*/ @NotEmpty(message = "组织名称不能为空!")
private String orgName;
@ApiModelProperty(value = "组织描述",required = false) @ApiModelProperty(value = "组织描述")
private String orgDesc; private String orgDesc;
@ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)",required = false) @ApiModelProperty(value = "组织英文名称")
private String status;
@ApiModelProperty(value = "组织英文名称",required = false)
private String orgCnName; private String orgCnName;
@ApiModelProperty(value = "组织邮箱",required = false) @ApiModelProperty(value = "组织邮箱")
private String orgMail; private String orgMail;
@ApiModelProperty(value = "组织电话",required = false) @ApiModelProperty(value = "联系方式", required = true)
@NotEmpty(message = "联系方式不能为空!")
private String orgPhone; private String orgPhone;
@ApiModelProperty(value = "备注",required = false) @ApiModelProperty(value = "联系人")
private String remark; private String linkman;
@ApiModelProperty(value = "创建用户",required = false) @ApiModelProperty(value = "状态(NORMAL-正常 FREEZE-冻结 CANCEL-注销)", required = true)
private String updateUser; private String status;
@ApiModelProperty(value = "创建人")
private String createUser;
} }
...@@ -30,4 +30,20 @@ public interface DmpApiServiceMangeService { ...@@ -30,4 +30,20 @@ public interface DmpApiServiceMangeService {
* @since 2021-01-19 * @since 2021-01-19
*/ */
JsonResult saveApiBigDataInfo(MakeBigDataApiReq req) throws Exception; JsonResult saveApiBigDataInfo(MakeBigDataApiReq req) throws Exception;
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult updateApiInfo(ApiInterfaceReq req) throws Exception;
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-20
*/
JsonResult updateApiBigDataInfo(MakeBigDataApiReq req) throws Exception;
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject; ...@@ -4,6 +4,7 @@ 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.web.HttpClientUtils; import com.jz.common.utils.web.HttpClientUtils;
import com.jz.common.utils.web.SessionUtils;
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;
...@@ -39,6 +40,9 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -39,6 +40,9 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
//保存API(大数据查询/标签查询)url //保存API(大数据查询/标签查询)url
private static final String addApiBigData = "/api/producer/makeBigDataApi"; private static final String addApiBigData = "/api/producer/makeBigDataApi";
//编辑API(第三方)基本信息url
private static final String updateApiInfo = "/api/producer/saveUpdate";
@Value("${spring.gateway-url}") @Value("${spring.gateway-url}")
private String gatewayUrl; private String gatewayUrl;
...@@ -52,6 +56,8 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -52,6 +56,8 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
public JsonResult saveApiInfo(ApiInterfaceReq req) throws Exception { public JsonResult saveApiInfo(ApiInterfaceReq req) throws Exception {
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
String url = gatewayUrl + addApiInfo; String url = gatewayUrl + addApiInfo;
req.setCreateUser(SessionUtils.getCurrentUserName());
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req)); String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) { if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("保存失败!"); throw new RuntimeException("保存失败!");
...@@ -82,14 +88,17 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -82,14 +88,17 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
*/ */
@Override @Override
public JsonResult saveApiBigDataInfo(MakeBigDataApiReq req) throws Exception { public JsonResult saveApiBigDataInfo(MakeBigDataApiReq req) throws Exception {
JsonResult result = new JsonResult();
ApiInterfaceReq baseInfo = new ApiInterfaceReq(); ApiInterfaceReq baseInfo = new ApiInterfaceReq();
BeanUtils.copyProperties(req, baseInfo); BeanUtils.copyProperties(req, baseInfo);
//保存API基本信息 //保存API基本信息
JsonResult apiKeyData = saveApiInfo(baseInfo); JsonResult apiKeyData = saveApiInfo(baseInfo);
String apiKey = apiKeyData.getData().toString(); String apiKey = apiKeyData.getData().toString();
if (StringUtils.isNotEmpty(apiKey)) {
logger.info("######apiKey=" + apiKey);
JsonResult result = new JsonResult();
req.setApiKey(apiKey); req.setApiKey(apiKey);
req.setCreateUser(SessionUtils.getCurrentUserName());
String url = gatewayUrl + addApiBigData;//保存API(大数据查询/标签查询) String url = gatewayUrl + addApiBigData;//保存API(大数据查询/标签查询)
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req)); String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) { if (StringUtils.isEmpty(resultData)) {
...@@ -97,6 +106,79 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService ...@@ -97,6 +106,79 @@ public class DmpApiServiceMangeServiceImpl implements DmpApiServiceMangeService
} }
logger.info("#################响应结果数据{}" + resultData); logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
return result;
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
}
}
return result;
}
/**
* 编辑API(第三方)基本信息
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public JsonResult updateApiInfo(ApiInterfaceReq req) throws Exception {
JsonResult result = new JsonResult();
String url = gatewayUrl + updateApiInfo;
req.setCreateUser(SessionUtils.getCurrentUserName());
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("编辑失败!");
}
logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) {
return result;
}
}
if (jsonObject.containsKey("message")) {
logger.info(jsonObject.get("message").toString());
result.setCode(ResultCode.INTERNAL_SERVER_ERROR);
result.setMessage(jsonObject.get("message").toString());
}
return result;
}
/**
* 编辑API(大数据查询/标签查询)
*
* @author Bellamy
* @since 2021-01-20
*/
@Override
public JsonResult updateApiBigDataInfo(MakeBigDataApiReq req) throws Exception {
ApiInterfaceReq baseApi = new ApiInterfaceReq();
BeanUtils.copyProperties(req, baseApi);
//编辑API基本信息
JsonResult baseRes = updateApiInfo(baseApi);
if (!"200".equals(baseRes.getCode())) {
throw new RuntimeException(baseRes.getMessage());
}
//编辑API(大数据查询/标签查询)
JsonResult result = new JsonResult();
req.setCreateUser(SessionUtils.getCurrentUserName());
String url = gatewayUrl + addApiBigData;
String resultData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(resultData)) {
throw new RuntimeException("编辑失败!");
}
logger.info("#################响应结果数据{}" + resultData);
Map jsonObject = JSONObject.parseObject(resultData); Map jsonObject = JSONObject.parseObject(resultData);
if (jsonObject.containsKey("code")) { if (jsonObject.containsKey("code")) {
if ("200".equals(jsonObject.get("code").toString())) { if ("200".equals(jsonObject.get("code").toString())) {
......
package com.jz.dmp.modules.service.impl; package com.jz.dmp.modules.service.impl;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.jcraft.jsch.Session;
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.web.HttpClientUtils; import com.jz.common.utils.web.HttpClientUtils;
import com.jz.common.utils.web.SessionUtils;
import com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq; import com.jz.dmp.modules.controller.dataService.bean.OrganizationManageAddReq;
import com.jz.dmp.modules.controller.dataService.bean.OrganizationManageDetailQueryReq; import com.jz.dmp.modules.controller.dataService.bean.OrganizationManageDetailQueryReq;
import com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq; import com.jz.dmp.modules.controller.dataService.bean.OrganizationManageListQueryReq;
...@@ -120,6 +122,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService { ...@@ -120,6 +122,7 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
public JsonResult addOrg(OrganizationManageAddReq req) throws Exception { public JsonResult addOrg(OrganizationManageAddReq req) throws Exception {
JsonResult result = new JsonResult(); JsonResult result = new JsonResult();
String url = gatewayUrl + addOrg; String url = gatewayUrl + addOrg;
req.setCreateUser(SessionUtils.getCurrentUserName());
String returnData = HttpClientUtils.post(url, JSONObject.toJSONString(req)); String returnData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(returnData)) { if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("新增失败!"); throw new RuntimeException("新增失败!");
...@@ -151,6 +154,8 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService { ...@@ -151,6 +154,8 @@ public class DmpOrgMangeServiceImpl implements DmpOrgMangeService {
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 + updateOrg;
req.setCreateUser(SessionUtils.getCurrentUserName());
String returnData = HttpClientUtils.post(url, JSONObject.toJSONString(req)); String returnData = HttpClientUtils.post(url, JSONObject.toJSONString(req));
if (StringUtils.isEmpty(returnData)) { if (StringUtils.isEmpty(returnData)) {
throw new RuntimeException("编辑失败!"); throw new RuntimeException("编辑失败!");
......
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