yusm 23 часов назад
Родитель
Сommit
54b7ed6ebd

+ 9 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeTypeController.java

@@ -1,26 +1,30 @@
 package com.management.platform.controller;
 
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.management.platform.entity.*;
+import com.management.platform.entity.TimeAutoExclude;
+import com.management.platform.entity.TimeType;
+import com.management.platform.entity.User;
+import com.management.platform.entity.WxCorpInfo;
 import com.management.platform.mapper.TimeAutoExcludeMapper;
 import com.management.platform.mapper.UserMapper;
 import com.management.platform.mapper.WxCorpInfoMapper;
-import com.management.platform.service.DepartmentService;
-import com.management.platform.service.HolidaySettingService;
 import com.management.platform.service.TimeTypeService;
 import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
+import com.management.platform.util.WorkDayCalculateUtils;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
+import java.time.LocalDate;
+import java.time.YearMonth;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.Map;
 
 /**
  * <p>

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

@@ -6,22 +6,20 @@ import com.alibaba.fastjson.JSONObject;
 import com.aliyun.dingtalkcontact_1_0.models.SearchUserResponse;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.*;
 import com.management.platform.entity.vo.SysRichFunction;
-import com.management.platform.entity.vo.WorktimeItem;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.util.*;
-import org.apache.commons.io.FileUtils;
 import org.apache.poi.EncryptedDocumentException;
 import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.util.StringUtils;
 import org.springframework.web.bind.annotation.RequestMapping;
-
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
@@ -2534,4 +2532,152 @@ public class UserCorpwxTimeController {
         msg.setData(userCorpwxTime);
         return msg;
     }
+
+
+    @RequestMapping("/getUserFictitiousAttendanceList")
+    public HttpRespMsg getUserFictitiousAttendanceList(String month, Integer pageIndex, Integer pageSize){
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        try {
+            if (pageIndex == null || pageIndex < 1) {
+                pageIndex = 1;
+            }
+            if (pageSize == null || pageSize < 1) {
+                pageSize = 20;
+            }
+            String token = request.getHeader("TOKEN");
+            User loginUser = userMapper.selectById(token);
+            if (loginUser == null) {
+                httpRespMsg.setError("未获取到登录用户");
+                return httpRespMsg;
+            }
+            if (month == null || month.trim().isEmpty()) {
+                month = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM"));
+            }
+            LocalDate monthStart = LocalDate.parse(month + "-01", DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+            LocalDate monthEnd = monthStart.plusMonths(1).minusDays(1);
+            int daysInMonth = monthStart.lengthOfMonth();
+            List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(loginUser.getRoleId(), "全部员工假勤数据");
+            QueryWrapper<UserCorpwxTime> monthQuery = new QueryWrapper<UserCorpwxTime>()
+                    .eq("company_id", loginUser.getCompanyId())
+                    .between("create_date", monthStart, monthEnd);
+            if (functionList == null || functionList.isEmpty()) {
+                Integer manageDeptId = loginUser.getManageDeptId();
+                List<Integer> deptIds = new ArrayList<>();
+                if (manageDeptId != null && manageDeptId != 0) {
+                    List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", loginUser.getCompanyId()));
+                    deptIds = departmentService.getAllManagedDeptIdList(loginUser, allDeptList);
+                }
+                if (deptIds.isEmpty()) {
+                    monthQuery.in("corpwx_userid", Collections.singletonList("__NONE__"));
+                } else {
+                    List<User> deptUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", loginUser.getCompanyId()).in("department_id", deptIds));
+                    List<String> deptCorpwxUserIds = deptUserList.stream().map(User::getCorpwxUserid).filter(org.springframework.util.StringUtils::hasText).collect(Collectors.toList());
+                    List<String> deptNames = deptUserList.stream().map(User::getName).filter(org.springframework.util.StringUtils::hasText).collect(Collectors.toList());
+                    if (!deptCorpwxUserIds.isEmpty() && !deptNames.isEmpty()) {
+                        monthQuery.and(q -> q.in("corpwx_userid", deptCorpwxUserIds).or().in("name", deptNames));
+                    } else if (!deptCorpwxUserIds.isEmpty()) {
+                        monthQuery.in("corpwx_userid", deptCorpwxUserIds);
+                    } else if (!deptNames.isEmpty()) {
+                        monthQuery.in("name", deptNames);
+                    } else {
+                        monthQuery.in("corpwx_userid", Collections.singletonList("__NONE__"));
+                    }
+                }
+            }
+            monthQuery.orderByAsc("create_date", "name");
+            Page<UserCorpwxTime> page = new Page<>(pageIndex, pageSize);
+            IPage<UserCorpwxTime> monthPage = userCorpwxTimeMapper.selectPage(page, monthQuery);
+            List<UserCorpwxTime> monthList = monthPage.getRecords();
+
+            List<LocalDate> restDayDates = WorkDayCalculateUtils.getNonWorkDaysListInRange(
+                    monthStart.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
+                    monthEnd.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))
+            );
+            List<String> restDayList = restDayDates.stream().map(d -> d.format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))).collect(Collectors.toList());
+
+            Map<String, List<UserCorpwxTime>> grouped = monthList.stream()
+                    .collect(Collectors.groupingBy(item -> item.getCorpwxUserid() != null ? item.getCorpwxUserid() : item.getName(), LinkedHashMap::new, Collectors.toList()));
+
+            List<Map<String, Object>> attendanceList = new ArrayList<>();
+            DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+            for (Map.Entry<String, List<UserCorpwxTime>> entry : grouped.entrySet()) {
+                List<UserCorpwxTime> userTimes = entry.getValue();
+                if (userTimes.isEmpty()) {
+                    continue;
+                }
+                UserCorpwxTime first = userTimes.get(0);
+                Map<String, Object> row = new HashMap<>();
+                row.put("userId", first.getCorpwxUserid());
+                row.put("employeeName", first.getName());
+                row.put("jobNumber", null);
+                User sysUser = null;
+                if (first.getCorpwxUserid() != null) {
+                    sysUser = userMapper.selectOne(new QueryWrapper<User>().eq("corpwx_userid", first.getCorpwxUserid()).eq("company_id", loginUser.getCompanyId()));
+                }
+                if (sysUser == null && first.getName() != null) {
+                    sysUser = userMapper.selectOne(new QueryWrapper<User>().eq("name", first.getName()).eq("company_id", loginUser.getCompanyId()));
+                }
+                if (sysUser != null) {
+                    row.put("userId", sysUser.getId());
+                    row.put("employeeName", sysUser.getName());
+                    row.put("jobNumber", sysUser.getJobNumber());
+                    Department dept = null;
+                    if (sysUser.getDepartmentId() != null) {
+                        dept = departmentMapper.selectById(sysUser.getDepartmentId());
+                    }
+                    row.put("departmentName", dept == null ? "" : dept.getCorpwxDeptid());
+                } else {
+                    row.put("departmentName", "");
+                }
+                Map<String, UserCorpwxTime> dayMap = userTimes.stream().collect(Collectors.toMap(t -> t.getCreateDate().format(df), t -> t, (a, b) -> a));
+                List<String> attendanceArray = new ArrayList<>();
+                double holidayCount = 0;
+                for (int i = 1; i <= daysInMonth; i++) {
+                    LocalDate date = monthStart.withDayOfMonth(i);
+                    String dateStr = date.format(df);
+                    UserCorpwxTime time = dayMap.get(dateStr);
+                    String value = "";
+                    Double leaveTime = 0D;
+                    if (time != null) {
+                        String leaveType = time.getAskLeaveType() == null ? "" : String.valueOf(time.getAskLeaveType());
+                        leaveTime = time.getAskLeaveTime() == null ? 0D : time.getAskLeaveTime();
+                        if (leaveTime > 0 || !leaveType.isEmpty()) {
+                            value = leaveType.isEmpty() ? String.valueOf(leaveTime) : leaveType+leaveTime;
+                            holidayCount += leaveTime;
+                        }
+                    }
+                    if (leaveTime > 0 || !value.isEmpty()) {
+                        attendanceArray.add(value.isEmpty() ? String.valueOf(leaveTime) : value);
+                    } else {
+                        attendanceArray.add("");
+                    }
+                }
+                row.put("fictitiousAttendanceArray", attendanceArray);
+                row.put("holidayCount", holidayCount);
+                attendanceList.add(row);
+            }
+
+            int total = (int) monthPage.getTotal();
+            List<Map<String, Object>> pageList = attendanceList;
+
+            Map<String, Object> result = new HashMap<>();
+            List<String> dateList = new ArrayList<>();
+            List<String> weekList = new ArrayList<>();
+            for (int i = 1; i <= daysInMonth; i++) {
+                LocalDate date = monthStart.withDayOfMonth(i);
+                dateList.add(String.valueOf(i));
+                weekList.add(date.getDayOfWeek().getDisplayName(TextStyle.SHORT, Locale.CHINESE).replace("星期", ""));
+            }
+            result.put("dateList", dateList);
+            result.put("weekList", weekList);
+            result.put("restDayList", restDayList);
+            result.put("list", pageList);
+            result.put("total", total);
+            httpRespMsg.data = result;
+        } catch (Exception e) {
+            e.printStackTrace();
+            httpRespMsg.setError("获取员工假勤数据失败:" + e.getMessage());
+        }
+        return httpRespMsg;
+    }
 }

+ 11 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/UserCorpwxTime.java

@@ -1,18 +1,18 @@
 package com.management.platform.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.extension.activerecord.Model;
-import java.time.LocalDate;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableField;
-import java.io.Serializable;
-
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
+import java.io.Serializable;
+import java.time.LocalDate;
+
 /**
  * <p>
  * 
@@ -84,6 +84,12 @@ public class UserCorpwxTime extends Model<UserCorpwxTime> {
     @TableField("ask_leave_time")
     private Double askLeaveTime;
 
+    /**
+     * 请假类型
+     */
+    @TableField("ask_leave_type")
+    private String askLeaveType;
+
     /**
      * 周几数字
      */

+ 12 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1841,8 +1841,19 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                         for (int j = 0; j < sp_items.size(); j++) {
                             JSONObject spItem = sp_items.getJSONObject(j);
                             switch (spItem.getInteger("type")) {
-                                case 1://
+                                case 1://
                                     //单独计算请假时间
+                                    Integer count = spItem.getInteger("count");
+                                    if(count>0){
+                                        String askTypeName = spItem.getString("name");
+                                        if(askTypeName.equals("调休假")){
+                                            ct.setAskLeaveType("T");
+                                        }else if(askTypeName.equals("病假")){
+                                            ct.setAskLeaveType("B");
+                                        }else {
+                                            ct.setAskLeaveType(askTypeName);
+                                        }
+                                    }
                                     break;
                                 case 2://补卡
                                 case 3://出差

+ 8 - 0
fhKeeper/formulahousekeeper/timesheet/src/permissions.js

@@ -124,6 +124,10 @@ const StringUtil = {
         allowance: false, //餐补表
         reportDailyWorkHours: false, //工时日报表
         reportDashboard: false, // 工时分析报告
+        allFictitiousAttendance: false, // 员工假勤表
+        fictitiousAttendance: false, // 员工假勤表
+        allEmployeeAttendance: false, // 员工考勤表
+        employeeAttendance: false, // 员工考勤表
         // 请假模块
         leaveFil : false, // 请假填报 // 
         leaveAudit : false, // 请假审核 //
@@ -336,6 +340,10 @@ const StringUtil = {
         arr[i] == '部门成本表' ? obj.reportDepartmentCost = true : ''
         arr[i] == '员工出勤表' ? obj.employeeAttendance = true : ''
         arr[i] == '施工进度表' ? obj.engineeringProgress = true : ''
+        arr[i] == '全部员工假勤数据' ? obj.allFictitiousAttendance = true : ''
+        arr[i] == '负责部门员工假勤数据' ? obj.fictitiousAttendance = true : ''
+        arr[i] == '全部员工考勤数据' ? obj.allEmployeeAttendance = true : ''
+        arr[i] == '负责部门员工考勤数据' ? obj.employeeAttendance = true : ''
         
     }
     return obj

Разница между файлами не показана из-за своего большого размера
+ 9932 - 4787
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue