EnterpriseInfoController.java
6.24 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
package com.lhcredit.project.business.enterpriseInfo.controller;
import com.github.pagehelper.PageHelper;
import com.lhcredit.common.utils.poi.ExcelUtil;
import com.lhcredit.framework.aspectj.lang.annotation.Log;
import com.lhcredit.framework.aspectj.lang.enums.BusinessType;
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.enterpriseInfo.domain.EnterpriseInfo;
import com.lhcredit.project.business.enterpriseInfo.service.IEnterpriseInfoService;
import com.lhcredit.project.business.frontUser.domain.FrontUserMon;
import com.lhcredit.project.business.searchLog.service.ISearchLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
/**
* 企业信息Controller
*
* @author ruoyi
* @date 2025-04-25
*/
@RestController
@RequestMapping("/business/info")
public class EnterpriseInfoController extends BaseController
{
@Autowired
private IEnterpriseInfoService enterpriseInfoService;
@Autowired
private ISearchLogService searchLogService;
/**
* 查询企业信息列表
*/
@PostMapping("/getEnterpriseList")
public TableDataInfo getEnterpriseList(EnterpriseInfo enterpriseInfo)
{
//设置当前登陆人
FrontUserMon loginUser=getUserInfo();
enterpriseInfo.setCreateBy(loginUser.getUserName());
//记录 搜索日志,当搜索名称为空时, 不统计
if (StringUtils.isNotEmpty(enterpriseInfo.getEname()))
searchLogService.setSearchLogs(enterpriseInfo);
startPage();
List<EnterpriseInfo> list = enterpriseInfoService.selectEnterpriseInfoList(enterpriseInfo);
return getDataTable(list);
}
/**
* 根据统一社会信用代码查询 企业标签
* @param creditCode
* @return
*/
@GetMapping("/getEnterpriseInfoByEcdoe")
public AjaxResult getEnterpriseInfoByEcdoe(String creditCode){
if (StringUtils.isEmpty(creditCode))
return AjaxResult.error("企业统一社会信用代码必传");
EnterpriseInfo enterpriseInfo = EnterpriseInfo.builder().creditCode(creditCode).build();
return AjaxResult.success(enterpriseInfoService.getEnterpriseInfoByEcdoe(enterpriseInfo));
}
/**
* 导出企业信息列表 (默认导出1000条)
*/
// @PreAuthorize("@ss.hasPermi('business:info:export')")
@Log(title = "企业信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public void export(HttpServletResponse response,EnterpriseInfo enterpriseInfo) throws Exception
{
//默认导出1000条
PageHelper.startPage(1,1000);
List<EnterpriseInfo> list = enterpriseInfoService.selectEnterpriseInfoList(enterpriseInfo);
// 设置响应头,修改下载文件名
String fileName = "企业信息.xlsx";
String encodedFileName = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
response.setHeader("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\"; filename*=UTF-8''" + encodedFileName);
// response.setHeader("Content-Disposition", "attachment; filename=\"555.xlsx\"");
ExcelUtil<EnterpriseInfo> util = new ExcelUtil<EnterpriseInfo>(EnterpriseInfo.class);
util.exportExcel( list, "企业信息数据",response);
}
/**
* 获取企业信息详细信息
*/
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(enterpriseInfoService.selectEnterpriseInfoById(id));
}
/**
* 新增企业信息
*/
@Log(title = "企业信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EnterpriseInfo enterpriseInfo)
{
return toAjax(enterpriseInfoService.insertEnterpriseInfo(enterpriseInfo));
}
/**
* 修改企业信息
*/
@Log(title = "企业信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EnterpriseInfo enterpriseInfo)
{
return toAjax(enterpriseInfoService.updateEnterpriseInfo(enterpriseInfo));
}
/**
* 删除企业信息
*/
@Log(title = "企业信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(enterpriseInfoService.deleteEnterpriseInfoByIds(ids));
}
/**
* 查询 各个类型的企业 数量
* @return
*/
@GetMapping("/getEnterpriseCount")
public AjaxResult getEnterpriseCount(){
return success(enterpriseInfoService.getEnterpriseCount());
}
/**
* 查询企业数量变化趋势 图
* @param enterpriseInfo
* @return
*/
@PostMapping("/getEnterpriseCountTrend")
public AjaxResult getEnterpriseCountTrend(EnterpriseInfo enterpriseInfo){
return AjaxResult.success(enterpriseInfoService.getEnterpriseCountTrend(enterpriseInfo));
}
/**
* 企业吊销/注销数量变化趋势 图
* @param enterpriseInfo
* @return
*/
@PostMapping("/getEnterpriseRegCountTrend")
public AjaxResult getEnterpriseRegCountTrend(EnterpriseInfo enterpriseInfo) {
return AjaxResult.success(enterpriseInfoService.getEnterpriseRegCountTrend(enterpriseInfo));
}
/**
* 企业地区数量占比分布情况 / 企业信用评级占比分布情况
* @param enterpriseInfo
* @return
*/
@PostMapping("/getEnterpriseCountByType")
public AjaxResult getEnterpriseCountByType(EnterpriseInfo enterpriseInfo){
return AjaxResult.success(enterpriseInfoService.getEnterpriseCountByType(enterpriseInfo));
}
/**
*企业注册资本规模占比分布情况 图
* @param enterpriseInfo
* @return
*/
@PostMapping("/getEnterpriseCountRegCapTrend")
public AjaxResult getEnterpriseCountRegCapTrend(EnterpriseInfo enterpriseInfo){
return AjaxResult.success(enterpriseInfoService.getEnterpriseCountRegCapTrend(enterpriseInfo));
}
}