Blame view

fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/EvalIndicatorController.java 4.74 KB
df2e90b8   姜超   feature(indicator...
1
2
  package cn.fw.morax.server.controller.erp;
  
c029d47e   姜超   feature(*): 考评导入修改
3
  import cn.fw.common.exception.BusinessException;
99c55e88   姜超   feature(*): 导入分页查询
4
  import cn.fw.common.page.AppPage;
df2e90b8   姜超   feature(indicator...
5
6
7
8
  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;
85a03fb4   姜超   feature(*): 修改上传
9
  import cn.fw.morax.common.utils.PublicUtil;
99c55e88   姜超   feature(*): 导入分页查询
10
11
  import cn.fw.morax.domain.db.eval.EvalIndicatorImportDetail;
  import cn.fw.morax.domain.dto.query.EvalIndicatorImportQueryDTO;
ffdae9fa   姜超   feature(*): 上报数据修改
12
  import cn.fw.morax.domain.vo.eval.*;
c029d47e   姜超   feature(*): 考评导入修改
13
  import cn.fw.morax.domain.vo.salary.StaffPersonTaxVO;
74153fda   姜超   feature(*): 修改门店指标展示
14
  import cn.fw.morax.service.biz.eval.EvalIndicatorBizService;
02ed4b17   姜超   feature(*): 考评导入修改
15
  import cn.fw.morax.service.biz.eval.EvalIndicatorReportService;
df2e90b8   姜超   feature(indicator...
16
17
  import cn.fw.security.auth.client.annotation.Authorization;
  import cn.fw.security.auth.client.annotation.IgnoreAuth;
022171e1   姜超   feature(*): 修改注解
18
  import cn.fw.security.auth.client.annotation.IgnoreUserToken;
df2e90b8   姜超   feature(indicator...
19
20
21
22
23
  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.*;
c029d47e   姜超   feature(*): 考评导入修改
24
  import org.springframework.web.multipart.MultipartFile;
df2e90b8   姜超   feature(indicator...
25
  
c029d47e   姜超   feature(*): 考评导入修改
26
27
  import javax.servlet.http.HttpServletRequest;
  import javax.servlet.http.HttpServletResponse;
99c55e88   姜超   feature(*): 导入分页查询
28
  import javax.validation.constraints.NotNull;
df2e90b8   姜超   feature(indicator...
29
  
0a90b3d7   姜超   feature(*): 考评组审批修改
30
31
  import java.util.List;
  
df2e90b8   姜超   feature(indicator...
32
33
34
  import static cn.fw.common.web.util.ResultBuilder.success;
  
  /**
df2e90b8   姜超   feature(indicator...
35
   * @author jiangchao
99c55e88   姜超   feature(*): 导入分页查询
36
   * @des: 导入考评指标控制器
c029d47e   姜超   feature(*): 考评导入修改
37
   * @date 2023/2/8 16:57
df2e90b8   姜超   feature(indicator...
38
39
40
41
42
43
44
   */
  @Slf4j
  @RequiredArgsConstructor
  @Authorization(AuthType.ERP)
  @Validated
  @IgnoreAuth
  @RestController
c029d47e   姜超   feature(*): 考评导入修改
45
  @RequestMapping("/erp/eval-indicator")
df2e90b8   姜超   feature(indicator...
46
47
  public class EvalIndicatorController {
  
99c55e88   姜超   feature(*): 导入分页查询
48
      private final EvalIndicatorReportService evalIndicatorReportService;
74153fda   姜超   feature(*): 修改门店指标展示
49
50
51
52
53
54
55
56
57
58
59
60
61
      private final EvalIndicatorBizService evalIndicatorBizService;
  
      /**
       * 考评指标
       *
       * @return
       */
      @IgnoreAuth
      @GetMapping("/indicators")
      @ControllerMethod("考评指标")
      public Message<List<EvalIndicatorVO>> getEvalIndicators() {
          return success(evalIndicatorBizService.getEvalIndicators());
      }
02ed4b17   姜超   feature(*): 考评导入修改
62
63
  
      /**
99c55e88   姜超   feature(*): 导入分页查询
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
       * 导入记录分页查询
       *
       * @return
       */
      @IgnoreAuth
      @GetMapping("/import-page")
      @ControllerMethod("导入记录分页查询")
      public Message<AppPage<EvalIndicatorImportRecordVO>> importPage(EvalIndicatorImportQueryDTO dto) {
          return success(evalIndicatorReportService.importPage(dto));
      }
  
      /**
       * 导入记录详情查询
       *
       * @return
       */
      @IgnoreAuth
      @GetMapping("/import-detail")
      @ControllerMethod("导入记录详情查询")
7060fbd3   姜超   feature(*): 修改代码格式
83
84
      public Message<List<EvalIndicatorImportDetailVO>> importDetail(@NotNull(message = "导入记录id不能为空") Long id, Boolean querySuccess) {
          return success(evalIndicatorReportService.importDetail(id, querySuccess));
99c55e88   姜超   feature(*): 导入分页查询
85
86
87
88
89
      }
  
  
      /**
       * 人员模板文件
02ed4b17   姜超   feature(*): 考评导入修改
90
91
92
       *
       * @return
       */
022171e1   姜超   feature(*): 修改注解
93
      @IgnoreUserToken
02ed4b17   姜超   feature(*): 考评导入修改
94
      @GetMapping("/staff/template-file")
99c55e88   姜超   feature(*): 导入分页查询
95
      @ControllerMethod("人员模板文件")
d9e88886   姜超   feature(*): 模板文件修改
96
97
      public Message<String> staffTemplateFile() {
          return success(evalIndicatorReportService.staffTemplateFileUrl());
02ed4b17   姜超   feature(*): 考评导入修改
98
99
      }
  
99c55e88   姜超   feature(*): 导入分页查询
100
101
102
103
104
      /**
       * 门店模板文件
       *
       * @return
       */
022171e1   姜超   feature(*): 修改注解
105
      @IgnoreUserToken
99c55e88   姜超   feature(*): 导入分页查询
106
107
      @GetMapping("/shop/template-file")
      @ControllerMethod("门店模板文件")
d9e88886   姜超   feature(*): 模板文件修改
108
109
      public Message<String> shopTemplateFile() {
          return success(evalIndicatorReportService.shopTemplateFileUrl());
99c55e88   姜超   feature(*): 导入分页查询
110
111
112
113
114
115
116
117
      }
  
      /**
       * 上传人员指标
       *
       * @return
       */
      @IgnoreAuth
85a03fb4   姜超   feature(*): 修改上传
118
      @PostMapping("/analysis-staff")
99c55e88   姜超   feature(*): 导入分页查询
119
      @ControllerMethod("上传人员指标")
85a03fb4   姜超   feature(*): 修改上传
120
      public Message<EvalIndicatorImportRecordVO> analysisStaffExcel(@RequestParam("file") MultipartFile file, @CurrentUser LoginAuthBean user) {
99c55e88   姜超   feature(*): 导入分页查询
121
122
123
          if (file.isEmpty()) {
              throw new BusinessException("请上传文件");
          }
85a03fb4   姜超   feature(*): 修改上传
124
          return success(evalIndicatorReportService.uploadStaffIndicator(file, user));
99c55e88   姜超   feature(*): 导入分页查询
125
      }
df2e90b8   姜超   feature(indicator...
126
  
ffdae9fa   姜超   feature(*): 上报数据修改
127
      /**
85a03fb4   姜超   feature(*): 修改上传
128
       * 上传门店指标
5bf6dabb   姜超   feature(*): 上传人员指标
129
130
131
132
       *
       * @return
       */
      @IgnoreAuth
85a03fb4   姜超   feature(*): 修改上传
133
134
      @PostMapping("/analysis-shop")
      @ControllerMethod("上传门店指标")
d833d181   姜超   feature(*): 考评指标修...
135
      public Message<EvalIndicatorImportRecordVO> uploadShopIndicator(@RequestParam("file") MultipartFile file, @CurrentUser LoginAuthBean user) {
5bf6dabb   姜超   feature(*): 上传人员指标
136
137
138
          if (file.isEmpty()) {
              throw new BusinessException("请上传文件");
          }
d833d181   姜超   feature(*): 考评指标修...
139
          return success(evalIndicatorReportService.uploadShopIndicator(file, user));
5bf6dabb   姜超   feature(*): 上传人员指标
140
141
142
      }
  
      /**
85a03fb4   姜超   feature(*): 修改上传
143
       * 保存上传人员数据
ffdae9fa   姜超   feature(*): 上报数据修改
144
145
146
       *
       * @return
       */
85a03fb4   姜超   feature(*): 修改上传
147
148
149
150
151
      @GetMapping("/save-import")
      @ControllerMethod("保存上传人员数据")
      public Message<Void> uploadStaffIndicator(String key) {
          if (PublicUtil.isEmpty(key)) {
              throw new BusinessException("参数错误");
ffdae9fa   姜超   feature(*): 上报数据修改
152
          }
85a03fb4   姜超   feature(*): 修改上传
153
          evalIndicatorReportService.saveImportIndicator(key);
b5babc65   姜超   feature(*): 参数修改
154
          return success();
ffdae9fa   姜超   feature(*): 上报数据修改
155
156
      }
  
df2e90b8   姜超   feature(indicator...
157
  }