Przeglądaj źródła

批量驳回已通过工时

QuYueTing 1 tydzień temu
rodzic
commit
c4e6e1bc68

+ 12 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -3073,6 +3073,18 @@ public class ReportController {
         }
     }
 
+    @RequestMapping("/batchDenyPassReport")
+    public HttpRespMsg batchDenyPassReport(@RequestParam String userId, String startDate, String endDate,
+                                          String reason, HttpServletRequest request) {
+        try {
+            return reportService.batchDenyPassReport(userId, startDate, endDate, reason, request);
+        } catch (Exception e) {
+            HttpRespMsg msg = new HttpRespMsg();
+            msg.setError("批量审核失败:"+e.getMessage());
+            return msg;
+        }
+    }
+
     @RequestMapping("/getMembList")
     public HttpRespMsg getMembList(@RequestParam(required=false) String date, HttpServletRequest request) {
         if (date == null) {

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java

@@ -250,4 +250,6 @@ public interface ReportService extends IService<Report> {
     HttpRespMsg getWorkedProjectList(Integer companyId, String ymonth, Integer pageIndex, Integer pageSize);
 
     HttpRespMsg getAllReportListByToken(String json);
+
+    HttpRespMsg batchDenyPassReport(String userId, String startDate, String endDate, String reason, HttpServletRequest request);
 }

+ 61 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -16915,6 +16915,67 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         return msg;
     }
 
+    @Override
+    public HttpRespMsg batchDenyPassReport(String userId, String startDate, String endDate, String reason, HttpServletRequest request) {
+        //批量驳回员工已通过的日报
+        User user = userMapper.selectById(request.getHeader("TOKEN"));
+        TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
+        QueryWrapper<Report> queryWrapper = new QueryWrapper<Report>().select("id, creator_id, create_date, state, group_id").eq("creator_id", userId).eq("state", 1).between("create_date", startDate, endDate);
+        List<Report> passReportList = reportMapper.selectList(queryWrapper);
+        if (reason == null) {
+            reason = "-";
+        }
+        int count = passReportList.size();
+
+        if (count > 0) {
+            reportMapper.update(new Report().setState(2)
+                    .setRejectReason(reason).setRejectUserid(user.getId()).setRejectUsername(user.getName()), queryWrapper);
+            if (timeType.getReportAuditType() == 2 || timeType.getReportAuditType() == 9) {
+                List<Report> newList = new ArrayList<>();
+                for (Report item : passReportList) {
+                    //退回任务分组审核状态
+                    Report upR = new Report();
+                    upR.setId(item.getId());
+                    upR.setGroupAuditState(0);
+                    String inchargerId = taskGroupMapper.selectById(item.getGroupId()).getInchargerId();
+                    upR.setProjectAuditorId(inchargerId);
+                    upR.setProjectAuditorName(userMapper.selectById(inchargerId).getName());
+                    newList.add(upR);
+                }
+                if (newList.size() > 0) {
+                    updateBatchById(newList);
+                }
+            }
+            DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            Report oneReport = passReportList.get(0);
+
+            saveDenyReportLog(passReportList, user.getId(), user.getName(), reason);
+            String str = "您"+startDate+"至"+endDate+"填写的日报被批量驳回。原因:" + reason;
+            String fillUserId = passReportList.get(0).getCreatorId();
+            informationMapper.insert(new Information().setType(0).setContent(startDate).setUserId(fillUserId).setMsg(str));
+
+            //发送企业微信通知消息
+            User reporter = userMapper.selectById(fillUserId);
+            String corpwxUserid = reporter.getCorpwxUserid();
+            //先判断钉钉
+            if (reporter.getDingdingUserid() != null) {
+                projectMapper.selectById(oneReport.getProjectId()).getProjectName();
+                companyDingdingService.sendRejectReportMsg(reporter.getCompanyId(), dtf.format(oneReport.getCreateDate()), "多个项目", reason, user.getName(), reporter.getDingdingUserid());
+            }
+            if (corpwxUserid != null) {
+                WxCorpInfo info = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+                wxCorpInfoService.sendWXCorpMsg(info, corpwxUserid, str, null, WxCorpInfoServiceImpl.TEXT_CARD_MSG_REPORT_DENY);
+            } else if (reporter.getWxOpenid() != null){
+                //发送个人微信通知
+                pushReject(str, reporter, user.getName(), reason);
+            }
+        }
+
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.data = count;
+        return msg;
+    }
+
     public String getWeek(DayOfWeek dayOfWeek){
         //获取中文形式的星期几
         String dayOfWeekChinese = "";

+ 28 - 25
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/dailyReportReview.vue

@@ -811,37 +811,40 @@
             batchDenyPassSubmit() {
                 this.$refs.batchDenyElForm.validate((valid) => {
                     if (valid) {
-                        this.denyDoing = true
-                        let form = this.batchDenyForm;
-                        form.startDate = this.batchDenyForm.date[0];
-                        form.endDate = this.batchDenyForm.date[1];
-                        this.http.post('/report/batchDenyPassReport', form,
-                        res => {
-                            this.denyDoing = false
-                            if (res.code == "ok") {
-                                if (res.data == 0) {
-                                    this.$message({
-                                        message: '操作失败:无审核通过的工时',
-                                        type: "error"
-                                    });
+                        this.$confirm('您确认要驳回该员工的工时报告吗?', '提示', {
+                            confirmButtonText: '确定',
+                            cancelButtonText: '取消',
+                            type: 'warning'
+                        }).then(() => {
+                            this.denyDoing = true;
+                            let form = this.batchDenyForm;
+                            form.startDate = this.batchDenyForm.date[0];
+                            form.endDate = this.batchDenyForm.date[1];
+                            this.http.post('/report/batchDenyPassReport', form,
+                            res => {
+                                this.denyDoing = false;
+                                if (res.code == "ok") {
+                                    if (res.data == 0) {
+                                        this.$message({
+                                            message: '操作失败:无审核通过的工时',
+                                            type: "error"
+                                        });
+                                    } else {
+                                        this.$message({
+                                            message: '成功驳回'+res.data+'条工时',
+                                            type: "success"
+                                        });
+                                    }
                                 } else {
                                     this.$message({
-                                        message: '成功驳回'+res.data+'条工时',
-                                        type: "success"
+                                        message: res.msg,
+                                        type: "error"
                                     });
                                 }
-                                
-                            } else {
-                                this.$message({
-                                    message: res.msg,
-                                    type: "error"
-                                });
-                            }
                             });
-                            
-                        }
+                        }).catch(() => {});
+                    }
                 });
-                
             },
           clickBathCancel() {
               this.undoBathFormLoading = true