Przeglądaj źródła

Merge branch 'master' of http://47.100.37.243:10080/wutt/manHourHousekeeper

ggooalice 2 lat temu
rodzic
commit
2b824811b9

+ 4 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -234,16 +234,16 @@ public class ProjectController {
      * 导出查询者所在公司每个项目的工时成本
      */
     @RequestMapping("/exportTimeCost")
-    public HttpRespMsg exportTimeCost(String startDate, String endDate, Integer projectId, String userId, Boolean projectSum,Integer type,Integer deptId,@RequestParam(defaultValue = "1") Integer stateKey) {
-        return projectService.exportTimeCost(startDate, endDate, projectId, userId, projectSum,type,deptId,stateKey, request);
+    public HttpRespMsg exportTimeCost(String exportContent,String startDate, String endDate, Integer projectId, String userId, Boolean projectSum,Integer type,Integer deptId,@RequestParam(defaultValue = "1") Integer stateKey) {
+        return projectService.exportTimeCost(exportContent,startDate, endDate, projectId, userId, projectSum,type,deptId,stateKey, request);
     }
 
     /**
      * 导出查询者所在公司每个项目分类的工时成本
      */
     @RequestMapping("/exportTimeCostByCategory")
-    public HttpRespMsg exportTimeCostByCategory(String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum,Integer type) {
-        return projectService.exportTimeCostByCategory(startDate, endDate, projectCategoryId, userId, projectSum,type, request);
+    public HttpRespMsg exportTimeCostByCategory(String exportContent,String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum,Integer type) {
+        return projectService.exportTimeCostByCategory(exportContent,startDate, endDate, projectCategoryId, userId, projectSum,type, request);
     }
 
     /**

+ 71 - 15
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserYearleaveSettingController.java

@@ -9,17 +9,20 @@ import com.dingtalk.api.DingTalkClient;
 import com.dingtalk.api.request.OapiAttendanceVacationTypeListRequest;
 import com.dingtalk.api.response.OapiAttendanceVacationTypeListResponse;
 import com.management.platform.entity.*;
+import com.management.platform.entity.vo.DdLeaveQtVo;
 import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.mapper.*;
 import com.management.platform.service.CompanyDingdingService;
 import com.management.platform.service.DingDingService;
 import com.management.platform.service.ExcelExportService;
 import com.management.platform.service.UserYearleaveSettingService;
+import com.management.platform.service.impl.ProjectServiceImpl;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.ListUtil;
 import com.management.platform.util.MessageUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RequestParam;
@@ -27,10 +30,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Optional;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -117,17 +117,19 @@ public class UserYearleaveSettingController {
 
     /**
      *
-     * @param leaveCode 请假类型代码
-     * @param companyId 公司id (必传
-     * @param departmentId 部门id
-     * @param userId 员工id
+     * @param ddLeaveQtVo 请求相关参数
      * @param pageIndex 页码
      * @return
      */
     @RequestMapping("/getDingDingLeaveQt")
-    public HttpRespMsg getDingDingLeaveQt(String leaveCode, Integer companyId, Integer departmentId, String userId,@RequestParam(required = false, defaultValue = "1") Integer pageIndex) {
+    public HttpRespMsg getDingDingLeaveQt(DdLeaveQtVo ddLeaveQtVo, @RequestParam(required = false, defaultValue = "1") Integer pageIndex) {
         QueryWrapper<LeaveQuotaNum> quotaNumQueryWrapper = new QueryWrapper<>();
+        String leaveCode = ddLeaveQtVo.getLeaveCode();
+        Integer[] departmentId = ddLeaveQtVo.getDepartmentId();
+        String userId = ddLeaveQtVo.getUserId();
+        Integer companyId = ddLeaveQtVo.getCompanyId();
         quotaNumQueryWrapper.eq("company_id", companyId);
+        ArrayList<Integer> deptList = null;
         HashMap map = new HashMap();
         if (leaveCode == null) {
             List<LeaveType> typeList = leaveTypeMapper.selectList(new QueryWrapper<LeaveType>().eq("company_id", companyId));
@@ -166,15 +168,22 @@ public class UserYearleaveSettingController {
             if (userId != null) {
                 String dingdingUserid = userMapper.selectById(userId).getDingdingUserid();
                 quotaNumQueryWrapper.eq("user_dingding_id", dingdingUserid);
-            } else if (departmentId != null) {
+            } else if (departmentId!=null) {
+                deptList = new ArrayList<>(Arrays.asList(departmentId));
                 //指定部门
-                Department dept = departmentMapper.selectById(departmentId);
+                List<Department> dept = departmentMapper.selectBatchIds(deptList);
                 List<Department> allDept = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
-                List<Department> allSubDepts = getSubDeptList(allDept, dept);
+                List<Department> allSubDepts = new ArrayList<>();
+                for (Department department : dept) {
+                    allSubDepts.addAll(getSubDeptList(allDept, department));
+                }
                 List<User> userList = userMapper.selectList(
                         new QueryWrapper<User>()
                                 .in("department_id", allSubDepts.stream().map(Department::getDepartmentId).collect(Collectors.toList())));
                 List<String> userDDIds = userList.stream().map(User::getDingdingUserid).collect(Collectors.toList());
+                if (userDDIds.size() == 0){
+                    userDDIds.add("");
+                }
                 quotaNumQueryWrapper.in("user_dingding_id", userDDIds);
             }
         }
@@ -192,17 +201,56 @@ public class UserYearleaveSettingController {
         return msg;
     }
 
+    //递归获取所有上级部门字符串,格式:"上级部门/上级部门/部门"
+    private String getSupDepartment(Department department) {
+        String depHierarchy = department.getDepartmentName();
+        //搜到父部门进行添加
+        if (department.getSuperiorId()==null) {
+            return depHierarchy;
+        } else {
+            Department supDep = departmentMapper.selectById(department.getSuperiorId());
+            return getSupDepartment(supDep) + "/" + depHierarchy;
+        }
+    }
+
+    //递归获取企业微信所有上级部门字符串,格式:"上级部门/上级部门/部门"
+    private String getWxDepartment(Department department) {
+        String depHierarchy = "$departmentName="+department.getCorpwxDeptid()+"$";
+        //搜到父部门进行添加
+        if (department.getCorpwxDeptpid()==null || department.getCorpwxDeptpid()==1) {
+            return depHierarchy;
+        }else{
+            Department supDep = departmentMapper.selectOne(new QueryWrapper<Department>().eq("corpwx_deptid",department.getCorpwxDeptpid()));
+            return getWxDepartment(supDep) + "/" + depHierarchy;
+        }
+    }
+
     //导出剩余假期
     @RequestMapping("/exportDingDingLeaveQt")
-    public HttpRespMsg exportDingDingLeaveQt(String leaveCode, Integer companyId, Integer departmentId, String userId){
+    public HttpRespMsg exportDingDingLeaveQt(DdLeaveQtVo ddLeaveQtVo){
         HttpRespMsg httpRespMsg = new HttpRespMsg();
+        Integer companyId = ddLeaveQtVo.getCompanyId();
         WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id",companyId));
         List<String> headList = new ArrayList<>();
         List<List<String>> allList = new ArrayList<>();
-        HttpRespMsg dingDingLeaveQt = getDingDingLeaveQt(leaveCode, companyId, departmentId, userId, 1);
+        HttpRespMsg dingDingLeaveQt = getDingDingLeaveQt(ddLeaveQtVo, 1);
         HashMap map = (HashMap)dingDingLeaveQt.data;
         List<LeaveQuotaNum> records = (List<LeaveQuotaNum>)map.get("records");
         Long total = (Long) map.get("total");
+        List<Department> deptName = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", companyId));
+        List<User> user = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+        List<HashMap<String,Object>> deptMap = new ArrayList<>();
+        for (Department department : deptName) {
+            department.setDepartmentName(getSupDepartment(department));
+            for (User userItem : user) {
+                if (userItem.getDepartmentId().equals(department.getDepartmentId())){
+                    HashMap<String, Object> mapItem = new HashMap<>();
+                    mapItem.put("ddUserId",userItem.getDingdingUserid());
+                    mapItem.put("deptName",department.getDepartmentName());
+                    deptMap.add(mapItem);
+                }
+            }
+        }
         Long j = 0L;
         if (total!=0){
             j = total / 50;
@@ -210,12 +258,14 @@ public class UserYearleaveSettingController {
                 j += 1;
             }
         }
+        //        headList.add("部门");
         //        headList.add("员工姓名");
         //        headList.add("有效期");
         //        headList.add("总额度");
         //        headList.add("已使用");
         //        headList.add("剩余额度");
         headList.add(MessageUtils.message("entry.staffName"));
+        headList.add(MessageUtils.message("excel.department"));
         headList.add(MessageUtils.message("excel.validity"));
         headList.add(MessageUtils.message("leave.totalAmount"));
         headList.add(MessageUtils.message("leave.used"));
@@ -226,15 +276,21 @@ public class UserYearleaveSettingController {
                 break;
             }
             for (LeaveQuotaNum record : records) {
+                for (HashMap<String, Object> stringMap : deptMap) {
+                    if (record.getUserDingdingId().equals(stringMap.get("ddUserId"))){
+                        record.setDepartment(stringMap.get("deptName").toString());
+                    }
+                }
                 ArrayList<String> data = new ArrayList<>();
                 data.add(record.getName());
+                data.add(record.getDepartment()==null?"未分配":record.getDepartment());
                 data.add(record.getStartTime()+" - "+record.getEndTime());
                 data.add(record.getQuotaInHours()+"h");
                 data.add(record.getUsedInHours()+"h");
                 data.add(record.getLeftInHours()+"h");
                 allList.add(data);
             }
-            dingDingLeaveQt = getDingDingLeaveQt(leaveCode, companyId, departmentId, userId, i);
+            dingDingLeaveQt = getDingDingLeaveQt(ddLeaveQtVo, i);
             map = (HashMap)dingDingLeaveQt.data;
             records = (List<LeaveQuotaNum>)map.get("records");
         }

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/LeaveQuotaNum.java

@@ -27,6 +27,9 @@ public class LeaveQuotaNum extends Model<LeaveQuotaNum> {
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    @TableField(exist = false)
+    private String department;
+
     @TableField("company_id")
     private Integer companyId;
 

+ 18 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/DdLeaveQtVo.java

@@ -0,0 +1,18 @@
+package com.management.platform.entity.vo;
+
+import lombok.Data;
+
+/**
+ * @author cs
+ * @version 1.0
+ * @ClassName DdLeaveQtVo
+ * @Description
+ * @date 2022-11-03 11:42
+ */
+@Data
+public class DdLeaveQtVo {
+    private String leaveCode;
+    private Integer companyId;
+    private Integer[] departmentId;
+    private String userId;
+}

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

@@ -58,7 +58,7 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg getAllMembCost(String startDate, String endDate, Integer projectId, HttpServletRequest request);
 
-    HttpRespMsg exportTimeCost(String startDate, String endDate, Integer projectId,String userId, Boolean projectSum,Integer type,Integer deptId,Integer stateKey,HttpServletRequest request);
+    HttpRespMsg exportTimeCost(String exportContent,String startDate, String endDate, Integer projectId,String userId, Boolean projectSum,Integer type,Integer deptId,Integer stateKey,HttpServletRequest request);
 
     HttpRespMsg updateProgress(Integer id, Integer progress, HttpServletRequest request);
 
@@ -143,7 +143,7 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg getTimeCostByCategory(String startDate, String endDate, String userId, HttpServletRequest request);
 
-    HttpRespMsg exportTimeCostByCategory(String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request);
+    HttpRespMsg exportTimeCostByCategory(String exportContent,String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request);
 
     HttpRespMsg getUserWorkingTimeList(String userId, Integer projectId, String startDate, String endDate, Integer pageIndex, Integer pageSize,HttpServletRequest request,Integer departmentId);
 

+ 148 - 53
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -1118,7 +1118,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
 
     //导出查询者所在公司每个项目的工时成本,包括项目人员明细统计
     @Override
-    public HttpRespMsg exportTimeCost(String startDate, String endDate,Integer projectId, String userId, Boolean projectSum,Integer type,Integer deptId, Integer stateKey,HttpServletRequest request) {
+    public HttpRespMsg exportTimeCost(String exportContent,String startDate, String endDate,Integer projectId, String userId, Boolean projectSum,Integer type,Integer deptId, Integer stateKey,HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
             User targetUser = userMapper.selectById(request.getHeader("Token"));
@@ -1192,14 +1192,22 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 headList.add(MessageUtils.message("entry.personnel"));
                 //headList.add("部门");
                 headList.add(MessageUtils.message("excel.department"));
-                if(functionTimeList.size()>0){
+                //hours:仅导出工时;cost:导出成本;hoursAndCost:导出成本和工时;
+                if ("hours".equals(exportContent) && functionTimeList.size()>0){
                     //headList.add("工时(h)");
                     headList.add(MessageUtils.message("entry.workHours")+"(h)");
-                }
-                if(functionCostList.size()>0){
+                }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                     //headList.add("成本(元)");
                     headList.add(MessageUtils.message("entry.cost")+"(元)");
+                }else {
+                    if(functionTimeList.size()>0 && functionCostList.size()>0){
+                        //headList.add("工时(h)");
+                        headList.add(MessageUtils.message("entry.workHours")+"(h)");
+                        //headList.add("成本(元)");
+                        headList.add(MessageUtils.message("entry.cost")+"(元)");
+                    }
                 }
+
                 allList=new ArrayList<>();
                 allList.add(headList);
                 double totalCostTime = 0;
@@ -1219,11 +1227,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     rowData.add((String)map.get("categoryName"));
                     rowData.add("");
                     rowData.add("");
-                    if(functionTimeList.size()>0){
+
+                    if ("hours".equals(exportContent) && functionTimeList.size()>0){
                         rowData.add(((Double)map.get("cost")).toString());
-                    }
-                    if(functionCostList.size()>0){
+                    }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                         rowData.add(((BigDecimal)map.get("costMoney")).toString());
+                    }else {
+                        if(functionTimeList.size()>0 && functionCostList.size()>0){
+                            rowData.add(((Double)map.get("cost")).toString());
+                            rowData.add(((BigDecimal)map.get("costMoney")).toString());
+                        }
                     }
                     if (projectSum != null && projectSum == true) {
                         allList.add(rowData);
@@ -1263,12 +1276,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             membRowData.add((String)membMap.get("name"));
                             membRowData.add((String)membMap.get("departmentName"));
                         }
-                        if(functionTimeList.size()>0){
+
+                        if ("hours".equals(exportContent) && functionTimeList.size()>0){
                             membRowData.add(((Double)membMap.get("cost")).toString());
-                        }
-                        if(functionCostList.size()>0){
+                        }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                             membRowData.add(((BigDecimal)membMap.get("costMoney")).toString());
+                        }else {
+                            if(functionTimeList.size()>0 && functionCostList.size()>0){
+                                membRowData.add(((Double)membMap.get("cost")).toString());
+                                membRowData.add(((BigDecimal)membMap.get("costMoney")).toString());
+                            }
                         }
+
                         allList.add(membRowData);
                     }
                 }
@@ -1280,12 +1299,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 sumRow.add("");
                 sumRow.add("");
                 sumRow.add("");
-                if(functionTimeList.size()>0){
+                if ("hours".equals(exportContent) && functionTimeList.size()>0){
                     sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
-                }
-                if(functionCostList.size()>0){
+                }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                     sumRow.add(totalMoneyCost.toString());
+                }else {
+                    if(functionTimeList.size()>0 && functionCostList.size()>0){
+                        sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                        sumRow.add(totalMoneyCost.toString());
+                    }
                 }
+
                 allList.add(sumRow);
             }else{
                 List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
@@ -1295,23 +1319,36 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 //headList.add("人员");
                 headList.add(MessageUtils.message("entry.personnel"));
                 projectNames.forEach(pn->{
-                    if(functionTimeList.size()>0){
+                    if ("hours".equals(exportContent) && functionTimeList.size()>0){
                         //headList.add(String.valueOf(pn)+"/工时");
                         headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.workHours"));
-                    }
-                    if(functionCostList.size()>0){
+                    }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                         //headList.add(String.valueOf(pn)+"/成本");
                         headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.cost"));
+                    }else {
+                        if(functionTimeList.size()>0 && functionCostList.size()>0){
+                            //headList.add(String.valueOf(pn)+"/工时");
+                            headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.workHours"));
+                            //headList.add(String.valueOf(pn)+"/成本");
+                            headList.add(String.valueOf(pn)+"/"+MessageUtils.message("entry.cost"));
+                        }
                     }
                 });
-                if(functionTimeList.size()>0){
+                if ("hours".equals(exportContent) && functionTimeList.size()>0){
                     //headList.add("合计/工时");
                     headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.workHours"));
-                }
-                if(functionCostList.size()>0){
+                }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                     //headList.add("合计/成本");
                     headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.cost"));
+                }else {
+                    if(functionTimeList.size()>0 && functionCostList.size()>0){
+                        //headList.add("合计/工时");
+                        headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.workHours"));
+                        //headList.add("合计/成本");
+                        headList.add(MessageUtils.message("entry.total")+"/"+MessageUtils.message("entry.cost"));
+                    }
                 }
+
                 allList=new ArrayList<>();
                 allList.add(headList);
                 //统计当前所有项目所有人的时间成本投入
@@ -1325,28 +1362,42 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     for(Object i:projectIds){
                         List<Map<String, Object>> resultList = mapList.stream().filter(mp -> mp.get("projectId").equals(i)).collect(Collectors.toList());
                         if(resultList.size()>0){
-                            if(functionTimeList.size()>0){
+                            if ("hours".equals(exportContent) && functionTimeList.size()>0){
                                 membRowData.add(String.valueOf(resultList.get(0).get("cost")));
-                            }
-                            if(functionCostList.size()>0){
+                            }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                                 membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
+                            }else {
+                                if(functionTimeList.size()>0 && functionCostList.size()>0){
+                                    membRowData.add(String.valueOf(resultList.get(0).get("cost")));
+                                    membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
+                                }
                             }
+
                             costTime += (Double)resultList.get(0).get("cost");
                             moneyCost = moneyCost.add((BigDecimal)resultList.get(0).get("costMoney"));
                         }else{
-                            if(functionTimeList.size()>0){
+                            if ("hours".equals(exportContent) && functionTimeList.size()>0){
                                 membRowData.add("");
-                            }
-                            if(functionCostList.size()>0){
+                            }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                                 membRowData.add("");
+                            }else {
+                                if(functionTimeList.size()>0 && functionCostList.size()>0){
+                                    membRowData.add("");
+                                    membRowData.add("");
+                                }
                             }
+
                         }
                     }
-                    if(functionTimeList.size()>0){
+                    if ("hours".equals(exportContent) && functionTimeList.size()>0){
                         membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
-                    }
-                    if(functionCostList.size()>0){
+                    }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                         membRowData.add(moneyCost.toString());
+                    }else {
+                        if(functionTimeList.size()>0 && functionCostList.size()>0){
+                            membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                            membRowData.add(moneyCost.toString());
+                        }
                     }
                     if(mapList.size()>0){
                         allList.add(membRowData);
@@ -5430,7 +5481,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     }
 
     @Override
-    public HttpRespMsg exportTimeCostByCategory(String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request) {
+    public HttpRespMsg exportTimeCostByCategory(String exportContent,String startDate, String endDate, Integer projectCategoryId, String userId, Boolean projectSum, Integer type, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
             //根据系统配置的员工成本计算方式,按固定时薪还是固定月薪,分情况计算。
@@ -5471,14 +5522,21 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 List<String> headList = new ArrayList<String>();
                 //headList.add("项目分类");
                 headList.add(MessageUtils.message("entry.projectType"));
-                if(functionTimeList.size()>0){
+                if ("hours".equals(exportContent) && functionTimeList.size()>0){
                     //headList.add("工时(h)");
                     headList.add(MessageUtils.message("entry.workHours")+"(h)");
-                }
-                if(functionCostList.size()>0){
+                }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                     //headList.add("成本(元)");
                     headList.add(MessageUtils.message("entry.cost")+"(元)");
+                }else {
+                    if(functionTimeList.size()>0 && functionCostList.size()>0){
+                        //headList.add("工时(h)");
+                        headList.add(MessageUtils.message("entry.workHours")+"(h)");
+                        //headList.add("成本(元)");
+                        headList.add(MessageUtils.message("entry.cost")+"(元)");
+                    }
                 }
+
                 allList=new ArrayList<>();
                 allList.add(headList);
                 double totalCostTime = 0;
@@ -5494,11 +5552,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     totalCostTime += (Double)map.get("cost");
                     List<String> rowData = new ArrayList<String>();
                     rowData.add((String)map.get("categoryName"));
-                    if(functionTimeList.size()>0){
+                    if ("hours".equals(exportContent) && functionTimeList.size()>0){
                         rowData.add(((Double)map.get("cost")).toString());
-                    }
-                    if(functionCostList.size()>0){
+                    }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                         rowData.add(((BigDecimal)map.get("costMoney")).toString());
+                    }else {
+                        if(functionTimeList.size()>0 && functionCostList.size()>0){
+                            rowData.add(((Double)map.get("cost")).toString());
+                            rowData.add(((BigDecimal)map.get("costMoney")).toString());
+                        }
                     }
                     allList.add(rowData);
                 }
@@ -5506,12 +5568,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 sumRow=new ArrayList<>();
                 //sumRow.add("合计");
                 sumRow.add(MessageUtils.message("entry.total"));
-                if(functionTimeList.size()>0){
+                if ("hours".equals(exportContent) && functionTimeList.size()>0){
                     sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
-                }
-                if(functionCostList.size()>0){
+                }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                     sumRow.add(totalMoneyCost.toString());
+                }else {
+                    if(functionTimeList.size()>0 && functionCostList.size()>0){
+                        sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                        sumRow.add(totalMoneyCost.toString());
+                    }
                 }
+
                 allList.add(sumRow);
             }else{
                 List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
@@ -5521,23 +5588,37 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 //headList.add("人员");
                 headList.add(MessageUtils.message("entry.personnel"));
                 projectCategoryNameS.forEach(pc->{
-                    if(functionTimeList.size()>0){
+                    if ("hours".equals(exportContent) && functionTimeList.size()>0){
                         //headList.add(String.valueOf(pc)+"/工时");
                         headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.workHours"));
-                    }
-                    if(functionCostList.size()>0){
+                    }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                         //headList.add(String.valueOf(pc)+"/成本");
                         headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.cost"));
+                    }else {
+                        if(functionTimeList.size()>0 && functionCostList.size()>0){
+                            //headList.add(String.valueOf(pc)+"/工时");
+                            headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.workHours"));
+                            //headList.add(String.valueOf(pc)+"/成本");
+                            headList.add(String.valueOf(pc)+"/"+MessageUtils.message("entry.cost"));
+                        }
                     }
+
                 });
-                if(functionTimeList.size()>0){
+                if ("hours".equals(exportContent) && functionTimeList.size()>0){
                     //headList.add("工时/合计");
                     headList.add(MessageUtils.message("entry.workHours")+"/"+MessageUtils.message("entry.total"));
-                }
-                if(functionCostList.size()>0){
+                }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                     //headList.add("成本/合计");
                     headList.add(MessageUtils.message("entry.cost")+"/"+MessageUtils.message("entry.total"));
+                }else {
+                    if(functionTimeList.size()>0 && functionCostList.size()>0){
+                        //headList.add("工时/合计");
+                        headList.add(MessageUtils.message("entry.workHours")+"/"+MessageUtils.message("entry.total"));
+                        //headList.add("成本/合计");
+                        headList.add(MessageUtils.message("entry.cost")+"/"+MessageUtils.message("entry.total"));
+                    }
                 }
+
                 allList=new ArrayList<>();
                 allList.add(headList);
                 //统计当前所有项目所有人的时间成本投入
@@ -5555,29 +5636,43 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     for(Object i:projectCategorys){
                         List<Map<String, Object>> resultList = mapList.stream().filter(mp -> mp.get("category").equals(i)).collect(Collectors.toList());
                         if(resultList.size()>0){
-                            if(functionTimeList.size()>0){
+                            if ("hours".equals(exportContent) && functionTimeList.size()>0){
                                 membRowData.add(String.valueOf(resultList.get(0).get("cost")));
-                            }
-                            if(functionCostList.size()>0){
+                            }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                                 membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
+                            }else {
+                                if(functionTimeList.size()>0 && functionCostList.size()>0){
+                                    membRowData.add(String.valueOf(resultList.get(0).get("cost")));
+                                    membRowData.add(String.valueOf(resultList.get(0).get("costMoney")));
+                                }
                             }
+
                             costTime += (Double)resultList.get(0).get("cost");
                             moneyCost = moneyCost.add((BigDecimal)resultList.get(0).get("costMoney"));
                         }else{
-                            if(functionTimeList.size()>0){
+                            if ("hours".equals(exportContent) && functionTimeList.size()>0){
                                 membRowData.add("");
-                            }
-                            if(functionCostList.size()>0){
+                            }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                                 membRowData.add("");
+                            }else {
+                                if(functionTimeList.size()>0 && functionCostList.size()>0){
+                                    membRowData.add("");
+                                    membRowData.add("");
+                                }
                             }
                         }
                     }
-                    if(functionTimeList.size()>0){
+                    if ("hours".equals(exportContent) && functionTimeList.size()>0){
                         membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
-                    }
-                    if(functionCostList.size()>0){
+                    }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                         membRowData.add(moneyCost.toString());
+                    }else {
+                        if(functionTimeList.size()>0 && functionCostList.size()>0){
+                            membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                            membRowData.add(moneyCost.toString());
+                        }
                     }
+
                     if(mapList.size()>0){
                         allList.add(membRowData);
                     }

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -1020,6 +1020,7 @@
         from user us
         left join  department dp on dp.department_id=us.department_id
         where us.company_id=#{companyId}
+        and us.id NOT IN (SELECT id FROM `user` WHERE company_id=#{companyId} and inactive_date IS NOT NULL AND inactive_date &lt; #{startDate})
         <if test="userId!=null and userId!=''">
             and us.id=#{userId}
         </if>
@@ -1059,6 +1060,7 @@
         from user us
         left join  department dp on dp.department_id=us.department_id
         where us.company_id=#{companyId}
+        and us.id NOT IN (SELECT id FROM `user` WHERE company_id=#{companyId} and inactive_date IS NOT NULL AND inactive_date &lt; #{startDate})
         <if test="userId!=null and userId!=''">
             and us.id=#{userId}
         </if>
@@ -1226,6 +1228,7 @@
         from user us
         left join department dp on dp.department_id=us.department_id
         where us.company_id=#{companyId}
+        and us.id NOT IN (SELECT id FROM `user` WHERE company_id=#{companyId} and inactive_date IS NOT NULL AND inactive_date &lt; #{startDate})
         <if test="userId!=null and userId!=''">
             and us.id=#{userId}
         </if>
@@ -1258,6 +1261,7 @@
         from user us
         left join  department dp on dp.department_id=us.department_id
         where us.company_id=#{companyId}
+        and us.id NOT IN (SELECT id FROM `user` WHERE company_id=#{companyId} and inactive_date IS NOT NULL AND inactive_date &lt; #{startDate})
         <if test="userId!=null and userId!=''">
             and us.id=#{userId}
         </if>

+ 18 - 4
fhKeeper/formulahousekeeper/timesheet/src/views/leave/list.vue

@@ -555,12 +555,13 @@
                 <span>{{ $t('departmentofscreening') }}</span>
                 <el-cascader
                 size="small"
+                collapse-tags 
                 @change="departmentOptionsChg"
                 v-model="departmentSel"
                 :options="departmentOptions"
                 :placeholder="$t('qing-xuan-ze-bu-men')"
                 :show-all-levels="false"
-                :props="{ checkStrictly: true }"
+                :props="{ multiple: true }"
                 clearable></el-cascader>
               </div>
               <div>
@@ -930,8 +931,14 @@ export default {
       let param = {
         leaveCode: this.leaveTypeItem,
         companyId: this.user.companyId,
-        departmentId: this.departmentSel ? this.departmentSel[this.departmentSel.length - 1] : '',
+        // departmentId: this.departmentSel ? this.departmentSel[this.departmentSel.length - 1] : '',
       }
+      let arrList = []
+      for(let i in this.departmentSel) {
+        arrList.push(this.departmentSel[i][this.departmentSel[i].length - 1])
+      }
+      console.log(arrList, '处理好的')
+      param.departmentId = arrList
       if(this.userSelId != '') {
         param.userId = this.userSelId
       }
@@ -1034,9 +1041,16 @@ export default {
           pageIndex: this.page,
           leaveCode: this.leaveTypeItem
         }
-        if(this.departmentSel.length != 0){
-          item.departmentId = this.departmentSel[this.departmentSel.length - 1]
+        console.log(this.departmentSel, '甚于')
+        // if(this.departmentSel.length != 0){
+        //   item.departmentId = this.departmentSel[this.departmentSel.length - 1]
+        // }
+        let arrList = []
+        for(let i in this.departmentSel) {
+          arrList.push(this.departmentSel[i][this.departmentSel[i].length - 1])
         }
+        console.log(arrList, '处理好的')
+        item.departmentId = arrList
         if(this.userSelId != ''){
           item.userId = this.userSelId
         }