WebRelatedRelationshipController.java
3.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
package com.lhcredit.project.webbusiness.controller;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.lhcredit.framework.web.controller.BaseController;
import com.lhcredit.framework.web.domain.AjaxResult;
import com.lhcredit.framework.web.page.TableDataInfo;
import com.lhcredit.project.business.TianYC.entity.param.RequestParams;
import com.lhcredit.project.business.frontUser.domain.FrontUserMon;
import com.lhcredit.project.business.relatedRelation.service.RelatedRelationShipService;
import com.lhcredit.project.business.searchLog.service.SearchLogServiceImpl;
import io.swagger.annotations.Api;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "关联关系")
@RestController
@RequestMapping(("/api-V2.0/related"))
@RequiredArgsConstructor
public class WebRelatedRelationshipController extends BaseController {
@Autowired
private RelatedRelationShipService relatedRelationShipService;
@Autowired
private SearchLogServiceImpl searchLogService;
/**
* 企业关联关系查询
* @param requestParams
* @return
*/
@PostMapping("/relationShipsByName")
public AjaxResult getEnterpriseRelationShipsByName(@Validated @RequestBody RequestParams requestParams){
if (StringUtils.isEmpty(requestParams.getName()) || StringUtils.isEmpty(requestParams.getId()))
return AjaxResult.error("参数未传");
//设置当前操作人姓名
FrontUserMon loginUser=getUserInfo();
requestParams.setHumanName(loginUser.getUserName());
// requestParams.setHumanName("getUsername()");
JSONObject ships = relatedRelationShipService.getEnterpriseRelationShipsByName(requestParams);
if (ships == null){
return AjaxResult.error("暂无数据");
}
TableDataInfo resData = new TableDataInfo();
JSONArray data = ships.getJSONArray("data");
resData.setRows(data);
// Long total = ships.getLong("total");
// resData.setTotal(total);
return AjaxResult.success(resData);
}
/**
* 查询 关联关系的链路列表
* @param requestParams
* @return
*/
@PostMapping("/relationShipsLinkByName")
public AjaxResult getRelationShipLinkList(@Validated @RequestBody RequestParams requestParams){
if (StringUtils.isEmpty(requestParams.getName()) || StringUtils.isEmpty(requestParams.getId()))
return AjaxResult.error("参数未传");
JSONObject linkList = relatedRelationShipService.getRelationShipLinkListByName(requestParams);
if (linkList == null){
return AjaxResult.error(String.valueOf(2010),"暂无数据");
}
TableDataInfo resData = new TableDataInfo();
JSONArray data = linkList.getJSONArray("data");
resData.setRows(data);
return AjaxResult.success(resData);
}
/**
* 查询企业关联关系查询日志列表
*/
/*@GetMapping("/list")
public AjaxResult getEnterpriseRelatedRelationShipList(){
//借助分页取前五条
List<JSONObject> list = searchLogService.getSearchLogs(SearchLog.SearchType.RELATED_RELATIONSHIP.getKey(), getUsername());
return AjaxResult.success(list);
}*/
}