Blame view

fw-morax-server/src/main/java/cn/fw/morax/server/controller/erp/EvalIndicatorController.java 4.89 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("人员模板文件")
02ed4b17   姜超   feature(*): 考评导入修改
96
97
98
99
100
      public Message<Void> staffTemplateFile(HttpServletRequest request, HttpServletResponse response) {
          evalIndicatorReportService.staffTemplateFile(request, response);
          return success();
      }
  
99c55e88   姜超   feature(*): 导入分页查询
101
102
103
104
105
      /**
       * 门店模板文件
       *
       * @return
       */
022171e1   姜超   feature(*): 修改注解
106
      @IgnoreUserToken
99c55e88   姜超   feature(*): 导入分页查询
107
108
109
110
111
112
113
114
115
116
117
118
119
      @GetMapping("/shop/template-file")
      @ControllerMethod("门店模板文件")
      public Message<Void> shopTemplateFile(HttpServletRequest request, HttpServletResponse response) {
          evalIndicatorReportService.shopTemplateFile(request, response);
          return success();
      }
  
      /**
       * 上传人员指标
       *
       * @return
       */
      @IgnoreAuth
85a03fb4   姜超   feature(*): 修改上传
120
      @PostMapping("/analysis-staff")
99c55e88   姜超   feature(*): 导入分页查询
121
      @ControllerMethod("上传人员指标")
85a03fb4   姜超   feature(*): 修改上传
122
      public Message<EvalIndicatorImportRecordVO> analysisStaffExcel(@RequestParam("file") MultipartFile file, @CurrentUser LoginAuthBean user) {
99c55e88   姜超   feature(*): 导入分页查询
123
124
125
          if (file.isEmpty()) {
              throw new BusinessException("请上传文件");
          }
85a03fb4   姜超   feature(*): 修改上传
126
          return success(evalIndicatorReportService.uploadStaffIndicator(file, user));
99c55e88   姜超   feature(*): 导入分页查询
127
      }
df2e90b8   姜超   feature(indicator...
128
  
ffdae9fa   姜超   feature(*): 上报数据修改
129
      /**
85a03fb4   姜超   feature(*): 修改上传
130
       * 上传门店指标
5bf6dabb   姜超   feature(*): 上传人员指标
131
132
133
134
       *
       * @return
       */
      @IgnoreAuth
85a03fb4   姜超   feature(*): 修改上传
135
136
      @PostMapping("/analysis-shop")
      @ControllerMethod("上传门店指标")
d833d181   姜超   feature(*): 考评指标修...
137
      public Message<EvalIndicatorImportRecordVO> uploadShopIndicator(@RequestParam("file") MultipartFile file, @CurrentUser LoginAuthBean user) {
5bf6dabb   姜超   feature(*): 上传人员指标
138
139
140
          if (file.isEmpty()) {
              throw new BusinessException("请上传文件");
          }
d833d181   姜超   feature(*): 考评指标修...
141
          return success(evalIndicatorReportService.uploadShopIndicator(file, user));
5bf6dabb   姜超   feature(*): 上传人员指标
142
143
144
      }
  
      /**
85a03fb4   姜超   feature(*): 修改上传
145
       * 保存上传人员数据
ffdae9fa   姜超   feature(*): 上报数据修改
146
147
148
       *
       * @return
       */
85a03fb4   姜超   feature(*): 修改上传
149
150
151
152
153
      @GetMapping("/save-import")
      @ControllerMethod("保存上传人员数据")
      public Message<Void> uploadStaffIndicator(String key) {
          if (PublicUtil.isEmpty(key)) {
              throw new BusinessException("参数错误");
ffdae9fa   姜超   feature(*): 上报数据修改
154
          }
85a03fb4   姜超   feature(*): 修改上传
155
          evalIndicatorReportService.saveImportIndicator(key);
b5babc65   姜超   feature(*): 参数修改
156
          return success();
ffdae9fa   姜超   feature(*): 上报数据修改
157
158
      }
  
df2e90b8   姜超   feature(indicator...
159
  }