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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
package com.yiboshi.science.rest.v1;
import com.yiboshi.arch.base.ResponseDataModel;
import com.yiboshi.science.config.security.SecurityUserHolder;
import com.yiboshi.science.enumeration.CommonEnum;
import com.yiboshi.science.param.dto.*;
import com.yiboshi.science.param.query.ComPersonQueryVO;
import com.yiboshi.science.param.query.ComProjectAuditQueryVO;
import com.yiboshi.science.param.query.ComUnitQueryVO;
import com.yiboshi.science.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
* /**
*
* @author wxl
* @date
*/
@Slf4j
@RestController
@RequestMapping("/v1/science-admin/statistical")
@RequiredArgsConstructor
@Api(tags = "statistical", description = "系统数据统计接口")
public class StatisticalController {
@Autowired
private ComProjectAuditService comProjectAuditService;
@Autowired
private ComBatchService comBatchService;
@Autowired
private ComUnitService comUnitService;
@Autowired
private ComPersonService comPersonService;
@Autowired
private LogsLoginService logsLoginService;
@Autowired
private ComDownloadService ComDownloadService;
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/geFirstAuditCount")
@PreAuthorize("hasAnyRole('GOV','UNIT')")
public ResponseDataModel<DataStatisticsDTO> geFirstAuditCount(ComProjectAuditQueryVO v) {
v.setAuditUnitId(SecurityUserHolder.getUnitId());
v.setAuditMethod(CommonEnum.auditMethod.audit.getCode());
return getDataStatisticsDTOResponseDataModel(v);
}
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/geLastAuditCount")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<DataStatisticsDTO> geLastAuditCount(ComProjectAuditQueryVO v) {
v.setAuditUnitId(SecurityUserHolder.getUnitId());
v.setAuditMethod(CommonEnum.auditMethod.last.getCode());
v.setCompleted(1);
return getDataStatisticsDTOResponseDataModel(v);
}
private ResponseDataModel<DataStatisticsDTO> getDataStatisticsDTOResponseDataModel(ComProjectAuditQueryVO v) {
DataStatisticsDTO count= comProjectAuditService.getCount(v);
DataStatisticsDTO dto=new DataStatisticsDTO();
dto.setCount1(count.getCount1());
dto.setCount2(count.getCount5()-count.getCount1());
dto.setCount5(count.getCount5());
dto.setCount3(comProjectAuditService.getCountByDay(v).getCount1());
return ResponseDataModel.ok(dto);
}
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getFirstAuditPassCount")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<DataStatisticsDTO> getFirstAuditPassCount(ComProjectAuditQueryVO v) {
v.setAuditUnitId(SecurityUserHolder.getUnitId());
v.setAuditUnitId(SecurityUserHolder.getUnitId());
v.setAuditResult(CommonEnum.auditResult.pass.getCode());
v.setAuditMethod(CommonEnum.auditMethod.audit.getCode());
DataStatisticsDTO count= comProjectAuditService.getFirstAuditPassCount(v);
return ResponseDataModel.ok(count);
}
@ApiOperation(value = "科研项目分配人次", httpMethod = "GET", notes = "科研项目分配人次")
@GetMapping
@RequestMapping("/getAssignPersonCount")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<DataStatisticsDTO> getAssignPersonCount(Integer projType) {
Integer assignYear = comBatchService.getReportYear(projType);
return ResponseDataModel.ok(comProjectAuditService.getAssignPersonCount(assignYear, projType));
}
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getLoginCount")
@PreAuthorize("hasAnyRole('GOV','ADMIN')")
public ResponseDataModel<DataStatisticsDTO> getLoginCount() {
DataStatisticsDTO count=logsLoginService.getCount();
count.setCount3(logsLoginService.getCountByDay().getCount1());
return ResponseDataModel.ok(count);
}
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getDirectorySize")
@PreAuthorize("hasAnyRole('ADMIN')")
public ResponseDataModel<String> getDirectorySize() {
return ResponseDataModel.ok(ComDownloadService.getDirectorySize());
}
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getRegisterUnitCount")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<DataStatisticsDTO> getRegisterUnitCount() {
ComUnitQueryVO vo=new ComUnitQueryVO();
vo.setAuditResult(0);
vo.setTreeCode(SecurityUserHolder.getUnitCode());
DataStatisticsDTO count=comUnitService.getRegisterUnitCount(vo);
count.setCount3(comUnitService.getRegisterUnitCountByDay(vo).getCount1());
return ResponseDataModel.ok(count);
}
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getRegisterPersonCount")
@PreAuthorize("hasAnyRole('UNIT')")
public ResponseDataModel<DataStatisticsDTO> getRegisterPersonCount() {
ComPersonQueryVO vo=new ComPersonQueryVO();
vo.setAuditUnit(SecurityUserHolder.getUnitId());
vo.setAuditResult(0);
DataStatisticsDTO count=comPersonService.getRegisterPersonCount(vo);
count.setCount3(comPersonService.getRegisterPersonCountByDay(vo).getCount1());
return ResponseDataModel.ok(count);
}
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getTreeCodeProjectCount")
@PreAuthorize("hasAnyRole('GOV','UNIT')")
public ResponseDataModel<List<DataStatisticsDTO>> getTreeCodeProjectCount(ComProjectAuditQueryVO v) {
v.setAuditUnitId(SecurityUserHolder.getUnitId());
if(Objects.nonNull(v.getProjType())){
if(v.getProjType().equals(CommonEnum.projType.key.getCode()))
v.setAuditMethod(CommonEnum.auditMethod.audit.getCode());
else
v.setAuditMethod(CommonEnum.auditMethod.last.getCode());
}
List<DataStatisticsDTO> list= comProjectAuditService.getTreeCodeProjectCount(v,SecurityUserHolder.getUnitCode());
return ResponseDataModel.ok(list);
}
/**
* 获取统计数据
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getKnowledgeCount")
@PreAuthorize("hasAnyRole('GOV','UNIT')")
public ResponseDataModel<List<DataStatisticsDTO>> getKnowledgeCount(ComProjectAuditQueryVO v) {
v.setAuditUnitId(SecurityUserHolder.getUnitId());
if(Objects.nonNull(v.getProjType())){
if(v.getProjType().equals(CommonEnum.projType.key.getCode()))
v.setAuditMethod(CommonEnum.auditMethod.audit.getCode());
else
v.setAuditMethod(CommonEnum.auditMethod.last.getCode());
}
List<DataStatisticsDTO> list= comProjectAuditService.getKnowledgeCount(v);
return ResponseDataModel.ok(list);
}
/**
*
* @param v
* @return
*/
@ApiOperation(value = "获取统计数据", httpMethod = "GET", notes = "获取统计数据")
@GetMapping
@RequestMapping("/getKnowledgeStatistic")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<List<KnowledgeStatisticsDTO>> getKnowledgeStatistic(ComProjectAuditQueryVO v) {
v.setAuditUnitId(SecurityUserHolder.getUnitId());
if (Objects.nonNull(v.getProjType())) {
if (v.getProjType().equals(CommonEnum.projType.key.getCode()))
v.setAuditMethod(CommonEnum.auditMethod.audit.getCode());
else
v.setAuditMethod(CommonEnum.auditMethod.last.getCode());
}
List<KnowledgeStatisticsDTO> list= comProjectAuditService.getKnowledgeStatistic(v);
return ResponseDataModel.ok(list);
}
@ApiOperation(value = "项目组二级学科选中列表", httpMethod = "GET", notes = "项目组二级学科选中列表")
@GetMapping
@RequestMapping("/getKnowledgeSelectedList")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<List<KnowledgeStatisticsDTO>> getKnowledgeSelectedList(ComProjectAuditQueryVO v) {
v.setAuditUnitId(SecurityUserHolder.getUnitId());
if (Objects.nonNull(v.getProjType())) {
if (v.getProjType().equals(CommonEnum.projType.key.getCode()))
v.setAuditMethod(CommonEnum.auditMethod.audit.getCode());
else
v.setAuditMethod(CommonEnum.auditMethod.last.getCode());
}
List<KnowledgeStatisticsDTO> list= comProjectAuditService.getKnowledgeSelectedList(v);
return ResponseDataModel.ok(list);
}
@ApiOperation(value = "项目专家组分配统计列表", httpMethod = "GET", notes = "项目专家组分配统计列表")
@GetMapping
@RequestMapping("/getProjectExpertGroupStatistic")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<List<projectExpertGroupStatisticDTO>> getProjectExpertGroupStatistic(ComProjectAuditQueryVO vo) {
vo.setAuditUnitId(SecurityUserHolder.getUnitId());
vo.setProjType(SecurityUserHolder.projectType());
vo.setAuditType(1);
vo.setAuditMethod(CommonEnum.auditMethod.last.getCode());
return ResponseDataModel.ok(comProjectAuditService.getProjectExpertGroupStatistic(vo));
}
@ApiOperation(value = "项目评审结果统计", httpMethod = "GET", notes = "项目评审结果统计")
@GetMapping
@RequestMapping("/getEvaluationStatistic")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<List<EvaluationStatisticDTO>> getEvaluationStatistic(Integer reportYear) {
return ResponseDataModel.ok(comProjectAuditService.getEvaluationStatistic(reportYear));
}
@ApiOperation(value = "导出excel数据列表", httpMethod = "GET", notes = "导出excel数据列表")
@GetMapping
@RequestMapping("/getEvaluationExportExcel")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<EvaluationExportExcelDTO> getEvaluationExportExcel(Integer reportYear, Integer startRow, String rowMarks) {
String[] split = rowMarks.split(",");
List<String> rowMarkList = Arrays.asList(split);
return ResponseDataModel.ok(comProjectAuditService.getEvaluationExportExcel(reportYear, startRow, rowMarkList));
}
@ApiOperation(value = "导出excel数据列表", httpMethod = "GET", notes = "导出excel数据列表")
@GetMapping
@RequestMapping("/getProjectGroupScoreOrder")
@PreAuthorize("hasAnyRole('GOV')")
public ResponseDataModel<EvaluationExportExcelDTO> getProjectGroupScoreOrder(Integer reportYear, Integer startRow, String rowMarks) {
String[] split = rowMarks.split(",");
List<String> rowMarkList = Arrays.asList(split);
return ResponseDataModel.ok(comProjectAuditService.getProjectGroupScoreOrder(reportYear, startRow, rowMarkList));
}
}