EvalIndicatorController.java
4.74 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
package cn.fw.morax.server.controller.erp;
import cn.fw.common.exception.BusinessException;
import cn.fw.common.page.AppPage;
import cn.fw.common.web.annotation.ControllerMethod;
import cn.fw.common.web.auth.LoginAuthBean;
import cn.fw.common.web.auth.annotation.CurrentUser;
import cn.fw.data.base.domain.common.Message;
import cn.fw.morax.common.utils.PublicUtil;
import cn.fw.morax.domain.db.eval.EvalIndicatorImportDetail;
import cn.fw.morax.domain.dto.query.EvalIndicatorImportQueryDTO;
import cn.fw.morax.domain.vo.eval.*;
import cn.fw.morax.domain.vo.salary.StaffPersonTaxVO;
import cn.fw.morax.service.biz.eval.EvalIndicatorBizService;
import cn.fw.morax.service.biz.eval.EvalIndicatorReportService;
import cn.fw.security.auth.client.annotation.Authorization;
import cn.fw.security.auth.client.annotation.IgnoreAuth;
import cn.fw.security.auth.client.annotation.IgnoreUserToken;
import cn.fw.security.auth.client.enums.AuthType;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.List;
import static cn.fw.common.web.util.ResultBuilder.success;
/**
* @author jiangchao
* @des: 导入考评指标控制器
* @date 2023/2/8 16:57
*/
@Slf4j
@RequiredArgsConstructor
@Authorization(AuthType.ERP)
@Validated
@IgnoreAuth
@RestController
@RequestMapping("/erp/eval-indicator")
public class EvalIndicatorController {
private final EvalIndicatorReportService evalIndicatorReportService;
private final EvalIndicatorBizService evalIndicatorBizService;
/**
* 考评指标
*
* @return
*/
@IgnoreAuth
@GetMapping("/indicators")
@ControllerMethod("考评指标")
public Message<List<EvalIndicatorVO>> getEvalIndicators() {
return success(evalIndicatorBizService.getEvalIndicators());
}
/**
* 导入记录分页查询
*
* @return
*/
@IgnoreAuth
@GetMapping("/import-page")
@ControllerMethod("导入记录分页查询")
public Message<AppPage<EvalIndicatorImportRecordVO>> importPage(EvalIndicatorImportQueryDTO dto) {
return success(evalIndicatorReportService.importPage(dto));
}
/**
* 导入记录详情查询
*
* @return
*/
@IgnoreAuth
@GetMapping("/import-detail")
@ControllerMethod("导入记录详情查询")
public Message<List<EvalIndicatorImportDetailVO>> importDetail(@NotNull(message = "导入记录id不能为空") Long id, Boolean querySuccess) {
return success(evalIndicatorReportService.importDetail(id, querySuccess));
}
/**
* 人员模板文件
*
* @return
*/
@IgnoreUserToken
@GetMapping("/staff/template-file")
@ControllerMethod("人员模板文件")
public Message<String> staffTemplateFile() {
return success(evalIndicatorReportService.staffTemplateFileUrl());
}
/**
* 门店模板文件
*
* @return
*/
@IgnoreUserToken
@GetMapping("/shop/template-file")
@ControllerMethod("门店模板文件")
public Message<String> shopTemplateFile() {
return success(evalIndicatorReportService.shopTemplateFileUrl());
}
/**
* 上传人员指标
*
* @return
*/
@IgnoreAuth
@PostMapping("/analysis-staff")
@ControllerMethod("上传人员指标")
public Message<EvalIndicatorImportRecordVO> analysisStaffExcel(@RequestParam("file") MultipartFile file, @CurrentUser LoginAuthBean user) {
if (file.isEmpty()) {
throw new BusinessException("请上传文件");
}
return success(evalIndicatorReportService.uploadStaffIndicator(file, user));
}
/**
* 上传门店指标
*
* @return
*/
@IgnoreAuth
@PostMapping("/analysis-shop")
@ControllerMethod("上传门店指标")
public Message<EvalIndicatorImportRecordVO> uploadShopIndicator(@RequestParam("file") MultipartFile file, @CurrentUser LoginAuthBean user) {
if (file.isEmpty()) {
throw new BusinessException("请上传文件");
}
return success(evalIndicatorReportService.uploadShopIndicator(file, user));
}
/**
* 保存上传人员数据
*
* @return
*/
@GetMapping("/save-import")
@ControllerMethod("保存上传人员数据")
public Message<Void> uploadStaffIndicator(String key) {
if (PublicUtil.isEmpty(key)) {
throw new BusinessException("参数错误");
}
evalIndicatorReportService.saveImportIndicator(key);
return success();
}
}