소스 검색

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

Min 2 년 전
부모
커밋
af02eebfb0
13개의 변경된 파일404개의 추가작업 그리고 144개의 파일을 삭제
  1. 28 10
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  2. 65 7
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeAutoExcludeController.java
  3. 12 8
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserFvTimeController.java
  4. 6 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeAutoExclude.java
  5. 21 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/MonthWorkingTimeVO.java
  6. 3 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java
  7. 3 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TimeAutoExcludeService.java
  8. 5 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  9. 8 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeAutoExcludeServiceImpl.java
  10. 14 8
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java
  11. 110 46
      fhKeeper/formulahousekeeper/timesheet/src/views/project/vueGantt.vue
  12. 68 26
      fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue
  13. 61 39
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

+ 28 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.github.pagehelper.util.StringUtil;
 import com.management.platform.config.LimitRequest;
 import com.management.platform.entity.*;
+import com.management.platform.entity.vo.MonthWorkingTimeVO;
 import com.management.platform.entity.vo.SysRichFunction;
 import com.management.platform.entity.vo.WorktimeItem;
 import com.management.platform.mapper.*;
@@ -123,7 +124,9 @@ public class ReportController {
             worktimeItemList.add(worktimeItem);
         }
         User user = userMapper.selectById(token);
+        //按当前填报人所属部门或者全公司来匹配
         List<TimeAutoExclude> excludeTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", user.getCompanyId()));
+        excludeTimeList = excludeTimeList.stream().filter(ex->ex.getDId() == null || ex.getDId().equals(user.getDepartmentId())).collect(Collectors.toList());
 
         int totalMinutes = 0;
         for (WorktimeItem worktimeItem : worktimeItemList) {
@@ -161,7 +164,7 @@ public class ReportController {
             totalMinutes += minutes;
         }
         double hours = totalMinutes*1.0f/60;
-        DecimalFormat df = new DecimalFormat("0.00");
+        DecimalFormat df = new DecimalFormat("0.0");
         msg.data = df.format(hours);
         return msg;
     }
@@ -571,7 +574,10 @@ public class ReportController {
             List<TimeAutoExclude> excludeTimeList = new ArrayList<>();
             //按照时间段填报的模式下,检查是否设置了休息时间段,要自动剔除
             if (comTimeType.getType() == 2) {
-                excludeTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", company.getId()));
+                excludeTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", user.getCompanyId()));
+                //按当前填报人所属部门或者全公司来匹配
+                excludeTimeList = excludeTimeList.stream().filter(ex->ex.getDId() == null || ex.getDId().equals(user.getDepartmentId())).collect(Collectors.toList());
+
             }
 
             for (int i = 0; i < id.length; i++) {
@@ -1748,7 +1754,8 @@ public class ReportController {
             TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", compId));
             List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", compId));
             //获取休息设置
-            TimeAutoExclude timeAutoExclude = timeAutoExcludeMapper.selectOne(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
+            List<TimeAutoExclude> excludeTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
+
             //Todo: 获取考勤打卡数据
             HttpRespMsg workDataMsg = dockWithMLD.getResult("http://10.1.10.51:20175/api/cube/restful/interface/getModeDataPageList/getWorkData", jsonString);
             List<Map<String,Object>> workDataList= (List<Map<String, Object>>) workDataMsg.data;
@@ -1762,6 +1769,9 @@ public class ReportController {
             List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("job_number", userIds));
             List<LocalDateTime> dateTimeList = getDays(yesterday, yesterday.plusDays(2));
             for (User user : userList) {
+                //按当前填报人所属部门或者全公司来匹配
+                excludeTimeList = excludeTimeList.stream().filter(ex->ex.getDId() == null || ex.getDId().equals(user.getDepartmentId())).collect(Collectors.toList());
+
                 for (LocalDateTime localDateTime : dateTimeList) {
                     LocalDate workDate=localDateTime.toLocalDate();
                     //当天的考勤记录
@@ -1808,14 +1818,16 @@ public class ReportController {
                         userFvTime.setCompanyId(user.getCompanyId());
                         userFvTime.setUserId(user.getId());
                         long workHours = between.toHours();
-                        long restHours;
-                        if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
-                                &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
-                            Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
-                            restHours=bt.toHours();
-                        }else {
-                            restHours=0;
+                        long restHours = 0;
+                        //处理排除时间段
+                        for (TimeAutoExclude timeAutoExclude : excludeTimeList) {
+                            if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
+                                    &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
+                                Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
+                                restHours += bt.toHours();
+                            }
                         }
+
                         userFvTime.setWorkHours(BigDecimal.valueOf(workHours).subtract(BigDecimal.valueOf(restHours)).floatValue());
                         Optional<UserFvTime> first = oldUserFvTimeList.stream().filter(ol -> ol.getWorkDate().isEqual(userFvTime.getWorkDate()) && ol.getUserId().equals(userFvTime.getUserId())).findFirst();
                         if(first.isPresent()){
@@ -1965,5 +1977,11 @@ public class ReportController {
         return result;
     }
 
+    //为单个人补足工时
+    @RequestMapping("/fillWorkingHours")
+    public HttpRespMsg fillWorkingHours(String yearMonth, MonthWorkingTimeVO monthVO){
+        return reportService.fillWorkingHours(yearMonth,monthVO,request);
+    }
+
 }
 

+ 65 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/TimeAutoExcludeController.java

@@ -7,6 +7,7 @@ import com.management.platform.mapper.*;
 import com.management.platform.service.TimeAutoExcludeService;
 import com.management.platform.util.HttpRespMsg;
 import com.management.platform.util.MessageUtils;
+import org.apache.poi.ss.formula.ptg.NotEqualPtg;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -38,23 +39,77 @@ public class TimeAutoExcludeController {
     private DepartmentMapper departmentMapper;
     @Resource
     private WxCorpInfoMapper wxCorpInfoMapper;
+    @Resource
+    private TimeAutoExcludeMapper timeAutoExcludeMapper;
 
     @RequestMapping("/addOrMod")
     public HttpRespMsg addOrMod(TimeAutoExclude item) {
+        String start1 = item.getStartTime();
+        String end1 = item.getEndTime();
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
+        HttpRespMsg msg = new HttpRespMsg();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+        if (item.getType().equals(1)){
+            List<TimeAutoExclude> timeItem = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", user.getCompanyId()));
+            for (TimeAutoExclude timeAutoExclude : timeItem) {
+                Boolean b = timeAutoExcludeService.timeCheck(start1, timeAutoExclude.getStartTime(), end1, timeAutoExclude.getEndTime());
+                if (item.getId() == null){
+                    //如果是新增
+                    if (b) {
+                        msg.setError("与已设置时间段存在重叠情况,请重新设置!");
+                        return msg;
+                    }
+                }else {
+                    //如果是修改
+                    if (b && !timeAutoExclude.getId().equals(item.getId())) {
+                        msg.setError("与已设置时间段存在重叠情况,请重新设置!");
+                        return msg;
+                    }
+                }
+            }
+            item.setCompanyId(user.getCompanyId());
+            timeAutoExcludeService.saveOrUpdate(item);
+            return msg;
+        }
+        List<TimeAutoExclude> companyTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", user.getCompanyId()).isNull("d_id"));
         //修改
         if (item.getId() != null){
+            TimeAutoExclude timeAutoExclude = timeAutoExcludeMapper.selectById(item.getId());
+            item.setDId(item.getDepartmentId().get(0));
+            if (!item.getDepartmentId().get(0).equals(timeAutoExclude.getDId())){
+                //如果修改了部门
+                Department department = departmentMapper.selectById(item.getDId());
+                if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact().equals(1)){
+                    item.setDName(department.getCorpwxDeptid()==null?"":department.getCorpwxDeptid().toString());
+                }else {
+                    item.setDName(department.getDepartmentName());
+                }
+            }
+            List<TimeAutoExclude> dList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("d_id", item.getDId()).ne("id",item.getId()));
+            dList.addAll(companyTimeList);
+            for (TimeAutoExclude autoExclude : dList) {
+                Boolean b = timeAutoExcludeService.timeCheck(start1, autoExclude.getStartTime(), end1, autoExclude.getEndTime());
+                if (b) {
+                    msg.setError("与已设置时间段存在重叠情况,请重新设置!");
+                    return msg;
+                }
+            }
             timeAutoExcludeService.updateById(item);
-            return new HttpRespMsg();
+            return msg;
         }
         //新增
-        //先去重
-        item.setDepartmentId(item.getDepartmentId().stream().distinct().collect(Collectors.toList()));
-        //删除掉已设置过的部门
-        timeAutoExcludeService.remove(new QueryWrapper<TimeAutoExclude>().in("d_id",item.getDepartmentId()));
+        //如果某部门曾设置过重叠的时间段,不予添加
+        List<TimeAutoExclude> times = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().in("d_id", item.getDepartmentId()));
+        times.addAll(companyTimeList);
+        for (TimeAutoExclude t : times) {
+            Boolean b = timeAutoExcludeService.timeCheck(start1, t.getStartTime(), end1, t.getEndTime());
+            if (b) {
+                msg.setError("与已设置时间段存在重叠情况,请重新设置!");
+                return msg;
+            }
+        }
         List<Department> deptList = departmentMapper.selectList(new QueryWrapper<Department>().in("department_id", item.getDepartmentId()));
-        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
         ArrayList<TimeAutoExclude> timeAutoExcludes = new ArrayList<>();
         for (Integer deptId : item.getDepartmentId()) {
             TimeAutoExclude timeAutoExclude = new TimeAutoExclude();
@@ -76,11 +131,14 @@ public class TimeAutoExcludeController {
         }
 
         timeAutoExcludeService.saveBatch(timeAutoExcludes);
-        return new HttpRespMsg();
+        return msg;
     }
 
     @RequestMapping("/delete")
     public HttpRespMsg delete(Integer id) {
+        if (id == null){
+            return new HttpRespMsg();
+        }
         String token = request.getHeader("TOKEN");
         HttpRespMsg msg = new HttpRespMsg();
         User user = userMapper.selectById(token);

+ 12 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserFvTimeController.java

@@ -87,7 +87,7 @@ public class UserFvTimeController {
             TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", compId));
             List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", compId));
             //获取休息设置
-            TimeAutoExclude timeAutoExclude = timeAutoExcludeMapper.selectOne(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
+            List<TimeAutoExclude> excludeTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
             //Todo: 获取考勤打卡数据
             HttpRespMsg workDataMsg = dockWithMLD.getResult("http://10.1.10.51:20175/api/cube/restful/interface/getModeDataPageList/getWorkData", jsonString);
             List<Map<String,Object>> workDataList= (List<Map<String, Object>>) workDataMsg.data;
@@ -101,6 +101,8 @@ public class UserFvTimeController {
             List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("job_number", userIds));
             List<LocalDateTime> dateTimeList = getDays(yesterday, yesterday.plusDays(2));
             for (User user : userList) {
+                //按当前填报人所属部门或者全公司来匹配
+                excludeTimeList = excludeTimeList.stream().filter(ex->ex.getDId() == null || ex.getDId().equals(user.getDepartmentId())).collect(Collectors.toList());
                 for (LocalDateTime localDateTime : dateTimeList) {
                     LocalDate workDate=localDateTime.toLocalDate();
                     //当天的考勤记录
@@ -147,14 +149,16 @@ public class UserFvTimeController {
                         userFvTime.setCompanyId(user.getCompanyId());
                         userFvTime.setUserId(user.getId());
                         long workHours = between.toHours();
-                        long restHours;
-                        if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
-                                &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
-                            Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
-                            restHours=bt.toHours();
-                        }else {
-                            restHours=0;
+                        long restHours = 0;
+                        //处理排除时间段
+                        for (TimeAutoExclude timeAutoExclude : excludeTimeList) {
+                            if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
+                                    &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
+                                Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
+                                restHours += bt.toHours();
+                            }
                         }
+
                         userFvTime.setWorkHours(BigDecimal.valueOf(workHours).subtract(BigDecimal.valueOf(restHours)).floatValue());
                         Optional<UserFvTime> first = oldUserFvTimeList.stream().filter(ol -> ol.getWorkDate().isEqual(userFvTime.getWorkDate()) && ol.getUserId().equals(userFvTime.getUserId())).findFirst();
                         if(first.isPresent()){

+ 6 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeAutoExclude.java

@@ -38,6 +38,12 @@ public class TimeAutoExclude extends Model<TimeAutoExclude> {
     @TableField(exist = false)
     private List<Integer> departmentId;
 
+    /**
+     * 1代表针对全公司设置,2代表针对部门设置
+     */
+    @TableField(exist = false)
+    private Integer type;
+
     /**
      * 部门id
      */

+ 21 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/MonthWorkingTimeVO.java

@@ -0,0 +1,21 @@
+package com.management.platform.entity.vo;
+
+import lombok.Data;
+
+/**
+ * @author cs
+ * @version 1.0
+ * @ClassName MonthWorkingTimeVO
+ * @Description
+ * @date 2023-04-18 15:25
+ */
+@Data
+public class MonthWorkingTimeVO {
+    private Double allday;
+    private Double leaveTime;
+    private String name;
+    private Double standardHours;
+    private String userId;
+    private Integer whether;
+    private Double workingTime;
+}

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

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.management.platform.entity.Report;
 import com.management.platform.entity.User;
+import com.management.platform.entity.vo.MonthWorkingTimeVO;
 import com.management.platform.util.HttpRespMsg;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
@@ -107,4 +108,6 @@ public interface ReportService extends IService<Report> {
 	HttpRespMsg approveDeptAuditReport(User user, String auditDeptId);
 
     void moveReport(User sourceUser,User targetUser);
+
+    HttpRespMsg fillWorkingHours(String yearMonth, MonthWorkingTimeVO monthVO, HttpServletRequest request);
 }

+ 3 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/TimeAutoExcludeService.java

@@ -3,6 +3,8 @@ package com.management.platform.service;
 import com.management.platform.entity.TimeAutoExclude;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.security.PrivateKey;
+
 /**
  * <p>
  *  服务类
@@ -13,4 +15,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface TimeAutoExcludeService extends IService<TimeAutoExclude> {
 
+    public Boolean timeCheck(String startO,String startT,String endO,String endT);
 }

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

@@ -5743,4 +5743,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             reportLogDetailService.updateBatchById(reportLogDetailsList);
         }
     }
+
+    @Override
+    public HttpRespMsg fillWorkingHours(String yearMonth, MonthWorkingTimeVO monthVO, HttpServletRequest request) {
+        return null;
+    }
 }

+ 8 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/TimeAutoExcludeServiceImpl.java

@@ -17,4 +17,12 @@ import org.springframework.stereotype.Service;
 @Service
 public class TimeAutoExcludeServiceImpl extends ServiceImpl<TimeAutoExcludeMapper, TimeAutoExclude> implements TimeAutoExcludeService {
 
+    @Override
+    public Boolean timeCheck(String start1, String start2, String end1, String end2) {
+        Boolean check = false;
+        if (end1.compareTo(start2) > 0 && start1.compareTo(end2) < 0){
+            check = true;
+        }
+        return check;
+    }
 }

+ 14 - 8
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -310,7 +310,8 @@ public class TimingTask {
             TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", compId));
             List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", compId));
             //获取休息设置
-            TimeAutoExclude timeAutoExclude = timeAutoExcludeMapper.selectOne(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
+            List<TimeAutoExclude> excludeTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
+
             //Todo: 获取考勤打卡数据
             HttpRespMsg workDataMsg = dockWithMLD.getResult("http://10.1.10.51:20175/api/cube/restful/interface/getModeDataPageList/getWorkData", jsonString);
             List<Map<String,Object>> workDataList= (List<Map<String, Object>>) workDataMsg.data;
@@ -324,6 +325,9 @@ public class TimingTask {
             List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("job_number", userIds));
             List<LocalDateTime> dateTimeList = getDays(yesterday, yesterday.plusDays(2));
             for (User user : userList) {
+                //按当前填报人所属部门或者全公司来匹配
+                excludeTimeList = excludeTimeList.stream().filter(ex->ex.getDId() == null || ex.getDId().equals(user.getDepartmentId())).collect(Collectors.toList());
+
                 for (LocalDateTime localDateTime : dateTimeList) {
                     LocalDate workDate=localDateTime.toLocalDate();
                     //当天的考勤记录
@@ -370,14 +374,16 @@ public class TimingTask {
                         userFvTime.setCompanyId(user.getCompanyId());
                         userFvTime.setUserId(user.getId());
                         long workHours = between.toHours();
-                        long restHours;
-                        if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
-                                &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
-                            Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
-                            restHours=bt.toHours();
-                        }else {
-                            restHours=0;
+                        long restHours = 0;
+                        //处理排除时间段
+                        for (TimeAutoExclude timeAutoExclude : excludeTimeList) {
+                            if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
+                                    &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
+                                Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
+                                restHours += bt.toHours();
+                            }
                         }
+
                         userFvTime.setWorkHours(BigDecimal.valueOf(workHours).subtract(BigDecimal.valueOf(restHours)).floatValue());
                         Optional<UserFvTime> first = oldUserFvTimeList.stream().filter(ol -> ol.getWorkDate().isEqual(userFvTime.getWorkDate()) && ol.getUserId().equals(userFvTime.getUserId())).findFirst();
                         if(first.isPresent()){

+ 110 - 46
fhKeeper/formulahousekeeper/timesheet/src/views/project/vueGantt.vue

@@ -32,10 +32,14 @@
                     <ww-open-data type='userName' :openid='scope.row.text'></ww-open-data>
                   </span> -->
                   <span v-if="scope.row.translationType != 'user' && stafforpro != '按项目查看'">
-                    {{scope.row.end_date | dataValue(scope.column, scope.row)}}
+                    <!-- {{scope.row.end_date | dataValue(scope.column, scope.row)}} -->
+                    <!-- {{scope.row.start_date | dataValue(scope.column, scope.row)}} -->
+                    {{scope.row.con_data | dataValue(scope.column, scope.row)}}
                   </span>
                   <span v-if="stafforpro == '按项目查看'">
-                    {{scope.row.end_date | dataValue(scope.column, scope.row)}}
+                    <!-- {{scope.row.end_date | dataValue(scope.column, scope.row)}} -->
+                    <!-- {{scope.row.start_date | dataValue(scope.column, scope.row)}} -->
+                    {{scope.row.con_data | dataValue(scope.column, scope.row)}}
                   </span>
                 </div>
               </template>
@@ -68,6 +72,7 @@ export default {
   components: {},
   data() {
     return {
+        that: this,
         initialMonth: '', // 开始月份
         headerData: [], // 表头数据
         treeDataList: [],
@@ -78,16 +83,43 @@ export default {
     };
   },
   filters: {
+    // dataValue: function (endDate, item, value) {
+    //   if(endDate) {
+    //     let biaoto = item.label.split(' ')[0]
+    //     if(biaoto == value.end_date) {
+    //       if(value.text.indexOf('/') != '-1') {
+    //         return value.text.split('/')[1]
+    //       } else {
+    //         return value.text
+    //       }
+    //     }
+    //   }
+    // }
+
     dataValue: function (endDate, item, value) {
       if(endDate) {
         let biaoto = item.label.split(' ')[0]
-        if(biaoto == value.end_date) {
-          if(value.text.indexOf('/') != '-1') {
-            return value.text.split('/')[1]
-          } else {
-            return value.text
-          }
+        let maxData =  value.numData
+        let str = ''
+        if(value.text.indexOf('/') != '-1') {
+          str = value.text.split('/')[1]
+        } else {
+          str = value.text
+        }
+
+        if(maxData == 2 && biaoto == value.end_date) {
+          return str
+        } else if(maxData != 2 && biaoto == value.con_data){
+          return str
         }
+
+        // if(biaoto == endDate) {
+        //   if(value.text.indexOf('/') != '-1') {
+        //     return value.text.split('/')[1]
+        //   } else {
+        //     return value.text
+        //   }
+        // }
       }
     }
   },
@@ -95,6 +127,8 @@ export default {
   watch: {},
   created() {},
   mounted() {
+    console.log(this.dayjs('2023-04-14').diff('2023-04-12', 'day'), '值差异') 
+    console.log(this.dayjs('2023-04-14').add(Math.ceil((3/2)),'day').format('YYYY-MM-DD'))
     console.log(this.stafforpro,'值')
     // 重置两个属性值
     this.num = 0,
@@ -113,7 +147,6 @@ export default {
 
     this.treeDataList = this.recursive(this.tasks.data);
 
-    // this.treeDataList = this.integrationTree(this.tasks.data)
     console.log(this.mergeList, '合并数据')
     console.log(this.treeDataList, '合并完全的数据')
   },
@@ -123,20 +156,6 @@ export default {
       for (let i in data) {
             if(this.stafforpro == '按项目查看') {
               data[i].color = '#409EFF'
-              // if(data[i].type == 'user' && data[i].text) {
-              //   let arr = []
-              //   if(data[i].text.indexOf('/') != '-1') {
-              //     let str = data[i].text.split('/')[0]
-              //     if(str.indexOf(',') != '-1') {
-              //       let arrList = str.split(',')
-              //       data[i].userNameList = arrList
-              //     } else {
-              //       arr.push(str)
-              //       data[i].userNameList = arr
-              //     }
-              //     data[i].proNameText = data[i].text.split('/')[1]
-              //   }
-              // }
               if(data[i].translationType == 'user' && data[i].text) {
                 let arr = []
                 arr = data[i].text.split(',')
@@ -155,32 +174,62 @@ export default {
               numDay: 1,
               column: 1
             }
+
             if(data[i].end_date) {
-              let day = this.dayjs(data[i].end_date).diff(data[i].start_date, 'day') // 和并多少行
-              let column = +this.dayjs(data[i].end_date).diff(this.valueDateList[0], 'day') + 1 // 从多少列开始
-              if(day >= 1) {
-                if(day >= 3) {
-                  if(this.valueDateList[0] > data[i].start_date) {
-                    obj.column = 1
-                    day >= column ? obj.numDay = column : obj.numDay = day
-                  } else {
-                    let num = this.dayjs(data[i].start_date).diff(this.valueDateList[0], 'day')
-                    obj.column = +num + 1
-                    day >= column ? obj.numDay = column : obj.numDay = day
-                  }
-                } else {
-                  day >= column ? obj.numDay = column : obj.numDay = day
-                  obj.column = column
-                }
+              var endData = ''
+              var starData = ''
+              if(data[i].end_date < this.valueDateList[1]) {
+                endData = data[i].end_date
+              } else {
+                endData = this.valueDateList[1]
               }
-            }
-            if(data[i].end_date != data[i].start_date && data[i].end_date != this.valueDateList[0]) {
-              data[i].end_date = this.dayjs(this.valueDateList[0]).add('1','day').format('YYYY-MM-DD')
-              if(data[i].end_date < data[i].start_date) {
-                data[i].end_date = this.dayjs(data[i].start_date).add('1','day').format('YYYY-MM-DD')
+
+              if(data[i].start_date < this.valueDateList[0]) {
+                starData = this.valueDateList[0]
+              } else {
+                starData = data[i].start_date
+              }
+
+              obj.numDay = +this.dayjs(endData).diff(starData, 'day') + 1
+              obj.column = +this.dayjs(starData).diff(this.valueDateList[0], 'day') + 1
+
+              if(data[i].text == '209') {
+                console.log(obj, '看看数据')
+              }
+              if(obj.numDay > 2) {
+                data[i].con_data = this.dayjs(starData).add(1,'day').format('YYYY-MM-DD')
+              } else {
+                data[i].con_data = starData
               }
+              data[i].numData = obj.numDay
             }
 
+            // if(data[i].end_date) {
+            //   let day = this.dayjs(data[i].end_date).diff(data[i].start_date, 'day') // 和并多少行
+            //   let column = +this.dayjs(data[i].end_date).diff(this.valueDateList[0], 'day') + 1 // 从多少列开始
+            //   if(day >= 1) {
+            //     if(day >= 3) {
+            //       if(this.valueDateList[0] > data[i].start_date) {
+            //         obj.column = 1
+            //         day >= column ? obj.numDay = column : obj.numDay = day
+            //       } else {
+            //         let num = this.dayjs(data[i].start_date).diff(this.valueDateList[0], 'day')
+            //         obj.column = +num + 1
+            //         day >= column ? obj.numDay = column : obj.numDay = day
+            //       }
+            //     } else {
+            //       day >= column ? obj.numDay = column : obj.numDay = day
+            //       obj.column = column
+            //     }
+            //   }
+            // }
+            // if(data[i].end_date != data[i].start_date && data[i].end_date != this.valueDateList[0]) {
+            //   data[i].end_date = this.dayjs(this.valueDateList[0]).add('1','day').format('YYYY-MM-DD')
+            //   if(data[i].end_date < data[i].start_date) {
+            //     data[i].end_date = this.dayjs(data[i].start_date).add('1','day').format('YYYY-MM-DD')
+            //   }
+            // }
+
             this.mergeList.push(obj)
             if(data[i].id.indexOf(this.$t('chu-cha')) != '-1') {
               data[i].color = '#E6A23C'
@@ -310,15 +359,30 @@ export default {
     },
     // 设置每一个单元格的样式
     TableCellStyle(row) {
-      if(row.row.color) {
+      let maxData =  +this.dayjs(row.row.end_date).diff(row.row.start_date, 'day') + 1
+      if(row.row.color && maxData < 3) {
         let biaoto = row.column.label.split(' ')[0]
-        // if(biaoto >= row.row.start_date && biaoto <= row.row.end_date) {
         if(biaoto == row.row.end_date) {
           if(row.row.color) {
             return 'background-color: '+ row.row.color +' !important;color: #fff'
           }
         }
+      } else {
+        let biaoto = row.column.label.split(' ')[0]
+        if(biaoto == row.row.con_data) {
+          return 'background-color: '+ row.row.color +' !important;color: #fff'
+        }
       }
+
+      // if(row.row.color) {
+      //   let biaoto = row.column.label.split(' ')[0]
+      //   if(biaoto == row.row.con_data) {
+      //     if(row.row.color) {
+      //       return 'background-color: '+ row.row.color +' !important;color: #fff'
+      //     }
+      //   }
+      // }
+
     }
   },
 };

+ 68 - 26
fhKeeper/formulahousekeeper/timesheet/src/views/settings/timetype.vue

@@ -444,28 +444,31 @@
         </el-dialog>
 
         <!-- 设置休息时间段 -->
-        <el-dialog :title="$t('settingrestPeriod')" v-if="setupRestDialog" :visible.sync="setupRestDialog" :close-on-click-modal="false" customClass="customWidth" width="600px">
+        <el-dialog :title="$t('settingrestPeriod')" v-if="setupRestDialog" :visible.sync="setupRestDialog" :close-on-click-modal="false" customClass="customWidth" width="400px">
             <el-table :data="restList" highlight-current-row height="400" style="width: 100%;">
                 <el-table-column prop="id" width="60" :label="$t('headerTop.serialNumber')">
                     <template slot-scope="scope" >
                         {{scope.$index + 1}}
                     </template>
                 </el-table-column>
-                <el-table-column :label="$t('message.period')"  width="100" >
+                <el-table-column :label="$t('message.period')"  width="150">
                     <template slot-scope="scope">
                         <span>{{scope.row.startTime + '-' + scope.row.endTime}}</span>
                     </template>
                 </el-table-column>
-                <el-table-column label="部门">
+                <!-- <el-table-column label="有效范围">
                     <template slot-scope="scope">
-                        <div>
+                        <div v-if="scope.row.dname==null">
+                            <div>全公司</div>
+                        </div>
+                        <div v-else>
                             <div v-if="user.userNameNeedTranslate == 1">
                                 <ww-open-data type='departmentName' :openid='scope.row.dname'></ww-open-data>
                             </div>
                             <div v-else>{{scope.row.dname}}</div>
                         </div>
                     </template>
-                </el-table-column>
+                </el-table-column> -->
                 <el-table-column :label="$t('operation')" width="150">
                     <template slot-scope="scope" >
                         <el-button size="small" type="primary" @click="setupRestEdit(scope.row)">{{ $t('bian-ji') }}</el-button>
@@ -485,14 +488,23 @@
                     <el-form-item :label="$t('time.endTime')">
                         <el-time-picker v-model="restTime.endTime" :placeholder="$t('message.Pleaseselectatime')" format="HH:mm" value-format="HH:mm" @change="timeRule(1)"></el-time-picker>
                     </el-form-item>
-            
-                    <div v-if="setupItemId == null" style="max-height: 280px;overflow: auto;">
+                    <!-- <el-form-item label="有效范围">
+                        <template>
+                            <el-radio v-model="restTime.type" label="1">全公司</el-radio>
+                            <el-radio v-model="restTime.type" label="2">部门</el-radio>
+                        </template>
+                    </el-form-item> -->
+                    <div style="max-height: 280px;overflow: auto;">
                         <el-tree
+                            v-if="restTime.type == 2"
                             ref="deptTree"
                             :props="deptProps"
                             :data="options"
+                            :check-strictly = "checkStrictly"
                             node-key="id"
-                            :default-expanded-keys="[-1]"
+                            :default-expanded-keys="expandedKeys"
+                            :default-checked-keys = checkedKeys
+                            @check-change="handleNodeClick"
                             show-checkbox>
                             <span class="custom-tree-node" slot-scope="{ node }">
                                 <span v-if="!user.userNameNeedTranslate == 1">{{ node.label }} </span>
@@ -561,6 +573,16 @@
         },
         data() {
             return {
+                expandedKeys: [],
+                checkStrictly: false,
+                checkedKeys:[],
+                restTime: {
+                    dId: null,
+                    type: 1,
+                    departmentId: null,
+                    startTime: null,
+                    endTime: null
+                },
                 deptProps:{
                     children: 'children',
                     label: 'label'
@@ -649,11 +671,6 @@
                 iptss: '',
                 setupRestDialog: false,
                 setupRestAppendDialog: false,
-                restTime: {
-                    departmentId:null,
-                    startTime: null,
-                    endTime: null
-                },
                 restList: [],
                 setupItemId: null,
 
@@ -709,7 +726,7 @@
                 },res => {
                     if(res.code == 'ok'){
                         console.log(res.data)
-                        var all = {id:-1,label: '全选',children:[]}
+                        var all = {id:-1,label: '全选',disabled:false,children:[]}
                         all.children = JSON.parse(JSON.stringify(res.data))
                         this.options.unshift(all)
                     }else {
@@ -724,6 +741,11 @@
                         type: 'error'
                     })
                 })
+            },
+            handleNodeClick(data, checked){
+                if(checked && this.setupItemId != null){
+                    this.$refs.deptTree.setCheckedNodes([data])
+                }
             },
              myCustomNextStepCallback(currentStep) {
                 console.log(currentStep, '看看')
@@ -804,15 +826,30 @@
             },
             setupRestNew(){
                 this.setupItemId = null
+                this.options[0].disabled = false
+                this.checkedKeys = []
+                this.checkStrictly = false
+                this.expandedKeys = [-1]
+                this.restTime = {startTime: null, endTime: null, type: "1"}
                 this.setupRestAppendDialog = true
-                this.restTime = {startTime: null, endTime: null}
             },
             setupRestEdit(item){
+                this.checkStrictly = true
                 this.setupItemId = item.id
                 this.setupRestAppendDialog = true
                 let Jitem = JSON.parse(JSON.stringify(item))
+                if(item.did == null){
+                    this.restTime.type = '1'
+                    this.expandedKeys = [-1]
+                }else{
+                    this.restTime.type = '2'
+                    this.checkedKeys = [item.did]
+                    this.expandedKeys = [item.did]
+                }
+                this.options[0].disabled = true
                 this.restTime = {
                     departmentId:Jitem.departmentId,
+                    type: this.restTime.type,
                     startTime: Jitem.startTime,
                     endTime: Jitem.endTime
                 }
@@ -841,7 +878,11 @@
                 })
             },
             setupRestSure(){
-                    if(this.setupItemId == null){
+                    if(this.restTime.startTime == null || this.restTime.endTime == null){
+                        this.$message(this.$t('qing-xuan-ze-shi-jian-duan'))
+                        return
+                    }
+                    if(this.restTime.type == 2){
                         var data = this.$refs.deptTree.getCheckedNodes()
                         var deptId = [];
                         for(var i in data){
@@ -849,26 +890,27 @@
                                 deptId.push(data[i].id)
                             }
                         }
+                        this.restTime.departmentId = deptId
+                        if(this.restTime.departmentId.length == 0){
+                            this.$message("请选择部门")
+                            return
+                        }
                     }
-                    this.restTime.departmentId = deptId
                     if(this.setupItemId != null){
                         this.restTime.id = this.setupItemId
                     }
-                    if(this.setupItemId == null && this.restTime.departmentId.length == 0){
-                        this.$message("请选择部门")
-                        return
-                    }
-                    if(this.restTime.startTime == null || this.restTime.endTime == null){
-                        this.$message(this.$t('qing-xuan-ze-shi-jian-duan'))
-                        return
-                    }
                     this.http.post('/time-auto-exclude/addOrMod',this.restTime,
                     res => {
                         if(res.code == 'ok'){
+                            if(res.msg){
+                                this.$message({
+                                message: res.msg,
+                                type: 'success'
+                            })
+                            }
                             this.getRestList()
                             this.setupRestAppendDialog = false
                         }else {
-                            this.setupRestAppendDialog = false
                             this.$message({
                                 message: res.msg,
                                 type: 'error'

+ 61 - 39
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -16,7 +16,7 @@
                         </template>
                         <span style="margin-left:20px">总填报时长:</span>
                         <span>{{totalReportHours}}h</span>
-                    </div>
+                    </div> 
                 </template>
                 <template #right-icon>
                     <van-button icon="replay" native-type="button" type="default" size="mini" style="height:0.6rem;padding:0 0.16667rem;" :loading="cardRefLoading" loading-size="0.26667rem" @click.stop.native="cardtimeRefresh(form.createDate)" v-if="user.timeType.syncCorpwxTime==1 && (form.createDate == today || !report.time || report.time.workHours <= 0) && (user.timeType.syncDingding == 1 || user.timeType.syncCorpwxTime == 1)"></van-button>
@@ -997,6 +997,7 @@ import timetoolVue from '../timetool/timetool.vue';
                     this.curWorktime.endTime = this.endTime;
                     this.showWorkEndTime = false;
                 }
+                this.setTotalReportHours()
             },
 
             confirmTime(item, field, index) {
@@ -1018,61 +1019,78 @@ import timetoolVue from '../timetool/timetool.vue';
                 let domains = this.form.domains
                 let hours = 0
                 let arrNum = [] //  用于时间段计算加班时间
+                let timeArr = []
                 for(let i in domains){
-                    // if(domains[i].projectId){
-                        // hours += parseFloat(domains[i].workingTime)
                         if(this.reportTimeType.multiWorktime == 1){
                             for(let m in domains[i].worktimeList){
                                 if(domains[i].worktimeList[m].startTime && domains[i].worktimeList[m].endTime){
-                                    hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
+                                    // hours += this.getHour(domains[i].worktimeList[m].startTime, domains[i].worktimeList[m].endTime)
+                                    timeArr.push({startTime: domains[i].worktimeList[m].startTime, endTime:domains[i].worktimeList[m].endTime})
                                 }
                             }
                         }else{
                             if(this.user.timeType.type == 2){
                                 if(domains[i].startTime && domains[i].endTime){
-                                    let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
-                                    let subtractedData = 0
-                                    let arr = JSON.parse(JSON.stringify(this.vacationTime))
-                                    arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
-                                    for(var j in arr) {
-                                        subtractedData += +this.timeOverlap(j, arr)
-                                    }
-                                    console.log(selectionTime, subtractedData)
-                                    hours += +selectionTime - +subtractedData
-                                    console.log(hours)
-                                    arrNum.push(+selectionTime - +subtractedData)
+                                    // let selectionTime = this.getHour(domains[i].startTime, domains[i].endTime)
+                                    // let subtractedData = 0
+                                    // let arr = JSON.parse(JSON.stringify(this.vacationTime))
+                                    // arr.unshift({s: domains[i].startTime, e: domains[i].endTime})
+                                    // for(var j in arr) {
+                                    //     subtractedData += +this.timeOverlap(j, arr)
+                                    // }
+                                    // console.log(selectionTime, subtractedData)
+                                    // hours += +selectionTime - +subtractedData
+                                    // console.log(hours)
+                                    // arrNum.push(+selectionTime - +subtractedData)
+                                    timeArr.push({startTime: domains[i].startTime, endTime: domains[i].endTime})
                                 }
                             } else {
                                 hours += domains[i].workingTime ? parseFloat(domains[i].workingTime) : 0
                             }
                         }
-                    // }
                 }
-                // return hours.toFixed(2)
-                this.totalReportHours = hours.toFixed(2)
-
-                if(this.user.timeType.type == 2 && this.reportTimeType.multiWorktime != 1) {
-                    let flg = false
-                    let zuiNum = 0
-                    for(let j in arrNum) {
-                        zuiNum += arrNum[j]
-                        console.log(zuiNum, arrNum[j], flg)
-                        if(flg) {
-                            this.$set(this.form.domains[j],'isOvertime', true)
-                            this.$set(this.form.domains[j],'overtimeHours', arrNum[j])
-                        }
-                        if(zuiNum > this.user.timeType.allday && !flg) {
-                            flg = true
-                            this.$set(this.form.domains[j],'isOvertime', true)
-                            this.$set(this.form.domains[j],'overtimeHours', zuiNum - this.user.timeType.allday)
-                        }
 
-                        if(zuiNum < this.user.timeType.allday && !flg) {
-                            this.$set(this.form.domains[j],'isOvertime', false)
-                            this.$set(this.form.domains[j],'overtimeHours', '')
-                        }
-                    }
+                // this.totalReportHours = hours.toFixed(2)
+                console.log('timeArr', timeArr)
+                if(this.reportTimeType.multiWorktime == 1 || this.user.timeType.type == 2){
+                    this.getTimeHours(timeArr)
+                } else {
+                    this.totalReportHours = hours.toFixed(2)
                 }
+
+                // if(this.user.timeType.type == 2 && this.reportTimeType.multiWorktime != 1) {
+                //     let flg = false
+                //     let zuiNum = 0
+                //     for(let j in arrNum) {
+                //         zuiNum += arrNum[j]
+                //         console.log(zuiNum, arrNum[j], flg)
+                //         if(flg) {
+                //             this.$set(this.form.domains[j],'isOvertime', true)
+                //             this.$set(this.form.domains[j],'overtimeHours', arrNum[j])
+                //         }
+                //         if(zuiNum > this.user.timeType.allday && !flg) {
+                //             flg = true
+                //             this.$set(this.form.domains[j],'isOvertime', true)
+                //             this.$set(this.form.domains[j],'overtimeHours', zuiNum - this.user.timeType.allday)
+                //         }
+
+                //         if(zuiNum < this.user.timeType.allday && !flg) {
+                //             this.$set(this.form.domains[j],'isOvertime', false)
+                //             this.$set(this.form.domains[j],'overtimeHours', '')
+                //         }
+                //     }
+                // }
+            },
+            getTimeHours(arr) {
+                this.$axios.post("/report/getHoursByTimeRange", {timeJsonStr: JSON.stringify(arr)})
+                .then(res => {
+                    if(res.code == "ok") {
+                        this.totalReportHours = res.data
+                    } else {
+                        this.$toast.clear();
+                        this.$toast.fail('获取失败');
+                    }
+                }).catch(err=> {this.$toast.clear();});
             },
 
             filter(type, options) {
@@ -1688,6 +1706,8 @@ import timetoolVue from '../timetool/timetool.vue';
                 }
                 
                 this.form.domains.push(item)
+                //重新计算总时长
+                this.setTotalReportHours();
                 this.canEdit = true
                 this.$forceUpdate()
             },
@@ -1699,6 +1719,8 @@ import timetoolVue from '../timetool/timetool.vue';
                     message: '是否移除当前项目'
                 }).then(() => {
                     this.form.domains.splice(i,1);
+                    //重新计算总时长
+                    this.setTotalReportHours();
                 }).catch(() => {
                 });
             },