Min 1 anno fa
parent
commit
06125c41d1

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

@@ -4,6 +4,7 @@ package com.management.platform.controller;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.util.StringUtil;
 import com.management.platform.config.LimitRequest;
@@ -2450,5 +2451,27 @@ public class ReportController {
     public HttpRespMsg getCustomDataWithDate(String startDate,String endDate,HttpServletRequest request){
         return reportService.getCustomDataWithDate(startDate,endDate,request);
     }
+
+    @RequestMapping("/denyByCheckId")
+    public HttpRespMsg denyByCheckId(String userId){
+        HttpRespMsg msg=new HttpRespMsg();
+        Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
+        LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(Report::getState,0);
+        queryWrapper.eq(Report::getCompanyId,companyId);
+        queryWrapper.and(wrapper->wrapper.and(wr->wr.eq(Report::getAuditDeptManagerid,userId).eq(Report::getIsDeptAudit,1)).or(wr1->wr1.eq(Report::getProjectAuditorId,userId).eq(Report::getIsDeptAudit,0)));
+        List<Report> reportList = reportMapper.selectList(queryWrapper);
+        reportList.forEach(r->{
+            r.setState(2);
+        });
+        if(!reportService.updateBatchById(reportList)){
+            msg.setError("验证失败");
+            return msg;
+        }
+        User user = userMapper.selectById(userId);
+        user.setIsActive(0);
+        userMapper.updateById(user);
+        return msg;
+    }
 }
 

+ 17 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -81,7 +81,8 @@ public class UserController {
     private ExpenseMainTypeService expenseMainTypeService;
     @Resource
     private ExpenseTypeService expenseTypeService;
-
+    @Resource
+    private ReportMapper reportMapper;
     @Value("${spring.ldap.urls}")
     private String ldapUrl;
     @Value("${spring.ldap.base.dcFirst}")
@@ -267,9 +268,23 @@ public class UserController {
 
     @RequestMapping("/deactiveUser")
     public HttpRespMsg deactiveUser(User user) {
+        HttpRespMsg msg = new HttpRespMsg();
+        Integer companyId = userService.getById(request.getHeader("token")).getCompanyId();
+        //针对美莱德,飞锐特,湾创在对人员进行停用操作时,需要检查待他审核的日报
+        if(companyId==876||companyId==877||companyId==878){
+            LambdaQueryWrapper<Report> queryWrapper = new LambdaQueryWrapper<>();
+            queryWrapper.eq(Report::getState,0);
+            queryWrapper.eq(Report::getCompanyId,companyId);
+            queryWrapper.and(wrapper->wrapper.and(wr->wr.eq(Report::getAuditDeptManagerid,user.getId()).eq(Report::getIsDeptAudit,1)).or(wr1->wr1.eq(Report::getProjectAuditorId,user.getId()).eq(Report::getIsDeptAudit,0)));
+            Integer count = reportMapper.selectCount(queryWrapper);
+            if(count>0){
+                msg.setError("当前员工有待审核日报,确认停用并驳回日报吗?");
+                return msg;
+            }
+        }
         user.setIsActive(0);
         userService.updateById(user);
-        return new HttpRespMsg();
+        return msg;
     }
 
 

+ 42 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -2125,13 +2125,50 @@ export default {
               message: this.$t('stopsuccess'),
               type: "success",
             });
-            // this.getUsers();
             this.getUser();
           } else {
-            this.$message({
-              message: res.msg,
-              type: "error",
-            });
+            if(this.user.companyId==876||this.user.companyId==877||this.user.companyId==878){
+                this.$confirm('当前员工有待审核日报,确认停用并驳回日报吗?', '提示', {
+                confirmButtonText: '确定',
+                cancelButtonText: '取消',
+                type: 'warning'
+                }).then(() => {
+                  this.http.post(
+                    "/report/denyByCheckId",
+                    { userId:this.deactiveUser.id },
+                    (res) => {
+                      if (res.code == "ok") {
+                        this.$message({
+                          message: this.$t('stopsuccess'),
+                          type: "success",
+                        });
+                      } else {
+                        this.$message({
+                          message: res.msg,
+                          type: "error",
+                        });
+                      }
+                    },
+                    (error) => {
+                      this.listLoading = false;
+                      this.$message({
+                        message: error,
+                        type: "error",
+                      });
+                    }
+                  );
+                }).catch(() => {
+                  this.$message({
+                    type: 'info',
+                    message: '已取消'
+                  });          
+              });
+            }else{
+              this.$message({
+                message: error,
+                type: "error",
+              });
+            }
           }
         },
         (error) => {