Просмотр исходного кода

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

Guo1B0 11 месяцев назад
Родитель
Сommit
32f2028a53
14 измененных файлов с 275 добавлено и 257 удалено
  1. 30 8
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContactsController.java
  2. 21 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ReportController.java
  3. 6 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/vo/UserVO.java
  4. 1 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/CustomMapper.java
  5. 5 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/UserMapper.java
  6. 1 1
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContactsService.java
  7. 4 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/CustomService.java
  8. 1 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsDocumentServiceImpl.java
  9. 15 3
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsServiceImpl.java
  10. 41 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java
  11. 2 0
      fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java
  12. 36 0
      fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/UserMapper.xml
  13. 75 164
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserWithBeisenController.java
  14. 37 81
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

+ 30 - 8
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/controller/ContactsController.java

@@ -1,6 +1,7 @@
 package com.management.platform.controller;
 
 
+import com.alibaba.fastjson.JSONArray;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.management.platform.entity.Contacts;
 import com.management.platform.entity.Custom;
@@ -56,8 +57,8 @@ public class ContactsController {
         return contactsService.addContacts(contacts, request);
     }
     @RequestMapping("/getAllContacts")
-    public HttpRespMsg getAllContacts(HttpServletRequest request){
-        return contactsService.getAllContacts(request);
+    public HttpRespMsg getAllContacts(Integer customerId,HttpServletRequest request){
+        return contactsService.getAllContacts(customerId,request);
     }
 
     /**
@@ -101,8 +102,15 @@ public class ContactsController {
      * @return
      */
     @RequestMapping("deleteContacts")
-    public HttpRespMsg deleteContacts( List<Integer> ids){
-        return contactsService.deleteContacts(ids,request);
+    public HttpRespMsg deleteContacts( String ids){
+        if (!StringUtils.isEmpty(ids)) {
+            ids="["+ids+"]";
+            List<Integer> array = JSONArray.parseArray(ids, Integer.class);
+            return contactsService.deleteContacts(array,request);
+        }
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.setError("参数不能为空");
+        return msg;
     }
 
     /**
@@ -120,8 +128,15 @@ public class ContactsController {
      * 批量删除回收站中的联系人
      */
     @RequestMapping("confirmDeleteContacts")
-    public HttpRespMsg confirmDeleteContacts(List<Integer> ids){
-        return contactsService.confirmDeleteContacts(ids);
+    public HttpRespMsg confirmDeleteContacts(String ids){
+        if (!StringUtils.isEmpty(ids)) {
+            ids="["+ids+"]";
+            List<Integer> array = JSONArray.parseArray(ids, Integer.class);
+            return contactsService.confirmDeleteContacts(array);
+        }
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.setError("参数不能为空");
+        return msg;
     }
 
     /**
@@ -130,8 +145,15 @@ public class ContactsController {
      * @return
      */
     @RequestMapping("returnContacts")
-    public HttpRespMsg returnContacts(List<Integer> ids){
-        return contactsService.returnContacts(ids);
+    public HttpRespMsg returnContacts(String ids){
+        if (!StringUtils.isEmpty(ids)) {
+            ids="["+ids+"]";
+            List<Integer> array = JSONArray.parseArray(ids, Integer.class);
+            return contactsService.returnContacts(array);
+        }
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.setError("参数不能为空");
+        return msg;
     }
 
     @RequestMapping("getContactsDetail")

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

@@ -15,6 +15,7 @@ import com.management.platform.entity.vo.WorktimeItem;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
 import com.management.platform.util.*;
+import me.chanjar.weixin.mp.constant.WxMpEventConstants;
 import okhttp3.OkHttpClient;
 import okhttp3.Request;
 import okhttp3.WebSocket;
@@ -106,6 +107,9 @@ public class ReportController {
     @Resource
     private EstimateTimeSettingMapper estimateTimeSettingMapper;
 
+    @Autowired
+    private CustomService customService;
+
     //获取任务相关的日报列表
     @RequestMapping("/getTaskReportList")
     public HttpRespMsg getTaskReportList(Integer taskId) {
@@ -214,6 +218,23 @@ public class ReportController {
         return reportService.getReportFillStatus(startDate, endDate, userId, request);
     }
 
+    /**
+     * 客户总量分析
+     * @param startDate
+     * @param endDate
+     * @param userId
+     * @return
+     */
+    @RequestMapping("/getCustomerTotalCount")
+    public HttpRespMsg getCustomerTotalCount(String startDate, String endDate, String userId) {
+        return  customService.getCustomerTotalCount(startDate, endDate, userId, request);
+    }
+
+    @RequestMapping("/getCustomerTransferRate")
+    public HttpRespMsg getCustomerTransferRate(String startDate, String endDate, String userId) {
+        return  customService.getCustomerTransferRate(startDate, endDate, userId, request);
+    }
+
     @RequestMapping("/getReportList")
     public HttpRespMsg getReportList(@RequestParam String date, @RequestParam(required = false) Integer deptId, @RequestParam(required = false) String userId) {
         return reportService.getReportList(date, deptId, userId, request);

+ 6 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/entity/vo/UserVO.java

@@ -26,4 +26,10 @@ public class UserVO extends User {
 
     private boolean hasAuditDept;
 
+    private Integer customertotal;//客户总量
+    private Integer customerDeal;//客户成交量
+    private Double dealRate;//客户成交量率
+    private Integer num;//客户数量
+    private Integer saleNum;//交易客户数量
+
 }

+ 1 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/CustomMapper.java

@@ -3,6 +3,7 @@ package com.management.platform.mapper;
 import com.management.platform.entity.Clue;
 import com.management.platform.entity.Custom;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.management.platform.util.HttpRespMsg;
 import org.apache.ibatis.annotations.Param;
 
 import java.util.List;

+ 5 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/mapper/UserMapper.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.toolkit.Constants;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.management.platform.entity.User;
+import com.management.platform.entity.vo.UserVO;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
 
@@ -57,4 +58,8 @@ public interface UserMapper extends BaseMapper<User> {
     List<User> getInActiveBewttenStartAndEndList(ArrayList<Integer> deptIds, String startDate, String endDate);
 
     void updateActiveByIds(List<String> array, int isActive);
+
+    List<UserVO> getCustomerTotalCount(String startDate, String endDate, String userId, Integer companyId);
+
+    List<UserVO> getCustomerTransferRate(String startDate, String endDate, String userId, Integer companyId);
 }

+ 1 - 1
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/ContactsService.java

@@ -42,7 +42,7 @@ public interface ContactsService extends IService<Contacts> {
 
     HttpRespMsg exportData(String customName, String name, String email, String creatorName, String phone, String ownerName, HttpServletRequest request) throws Exception;
 
-    HttpRespMsg getAllContacts(HttpServletRequest request);
+    HttpRespMsg getAllContacts(Integer customerId, HttpServletRequest request);
 
     int transferContacts(Contacts contactsGet, User user);
 }

+ 4 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/CustomService.java

@@ -54,4 +54,8 @@ public interface CustomService extends IService<Custom> {
     Map<String, Object> getDataSummary(Integer companyId,String startDate, String endDate, String userId,@Param("list") List<String> targetUserIds);
 
     void deleterDelete(List<Integer> ids);
+
+    HttpRespMsg getCustomerTotalCount(String startDate, String endDate, String userId, HttpServletRequest request);
+
+    HttpRespMsg getCustomerTransferRate(String startDate, String endDate, String userId, HttpServletRequest request);
 }

+ 1 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsDocumentServiceImpl.java

@@ -155,6 +155,7 @@ public class ContactsDocumentServiceImpl extends ServiceImpl<ContactsDocumentMap
         ContactsDocument contactsDocument = contactsDocumentMapper.selectById(fileId);
         if (contactsDocument==null){
             msg.setError("文件不存在");
+            return msg;
         }
         LambdaUpdateWrapper<ContactsDocument> ulw = new LambdaUpdateWrapper<>();
         ulw.set(ContactsDocument::getDocumentName,newName).eq(ContactsDocument::getId,fileId);

+ 15 - 3
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/ContactsServiceImpl.java

@@ -88,15 +88,19 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
         Integer companyId = user.getCompanyId();
         if (StringUtils.isEmpty(contacts.getName())){
             httpRespMsg.setError("请输入联系人姓名");
+            return httpRespMsg;
         }
         if (contacts.getCustomId()==null){
             httpRespMsg.setError("客户信息为空");
+            return httpRespMsg;
         }
         if (StringUtils.isEmpty(contacts.getPhone())){
             httpRespMsg.setError("联系人电话号码为空");
+            return httpRespMsg;
         }
         if (contacts.getOwnerId() == null) {
             httpRespMsg.setError("负责人信息为空!");
+            return httpRespMsg;
         }
 
         LambdaQueryWrapper<Contacts> lqw_contacts = new LambdaQueryWrapper<>();
@@ -107,6 +111,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
         Contacts selectedOne = contactsMapper.selectOne(lqw_contacts);
         if (selectedOne != null) {
             httpRespMsg.setError("已存在该联系人!");
+            return httpRespMsg;
         }
         contacts.setCompanyId(companyId)
                 //todo:联系人的所有人是可选择的
@@ -203,6 +208,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
                     oName+=businessOpportunity.getName()+" ";
                 }
                 msg.setError(oName+"等商机正在进行且跟联系人有关");
+                return msg;
             }
         }
         List<Task> taskList = taskMapper.selectList(new QueryWrapper<Task>().in("contacts_id", ids));
@@ -210,6 +216,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
             List<Task> collect = taskList.stream().filter(t ->t.getStatus()!=null&&t.getStatus() != 2).collect(Collectors.toList());
             if (!collect.isEmpty()){
                 msg.setError("存在任务未完成且跟联系人有关");
+                return msg;
             }
         }
         contactsUpdateWrapper.in("id", ids);
@@ -305,7 +312,7 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
 
             //附件信息查询
             LambdaQueryWrapper<ContactsDocument> cDLqw = new LambdaQueryWrapper<>();
-            cDLqw.eq(ContactsDocument::getContactsId,contactsSelect.getId());
+            cDLqw.eq(ContactsDocument::getContactsId,contactsSelect.getId()).ne(ContactsDocument::getIsDeleted,1);
             List<ContactsDocument> contactsDocuments = contactsDocumentMapper.selectList(cDLqw);
 
             //返回数据
@@ -579,10 +586,15 @@ public class ContactsServiceImpl extends ServiceImpl<ContactsMapper, Contacts> i
     }
 
     @Override
-    public HttpRespMsg getAllContacts(HttpServletRequest request) {
+    public HttpRespMsg getAllContacts(Integer customerId, HttpServletRequest request) {
         User user = userMapper.selectById(request.getHeader("token"));
         HttpRespMsg mgs = new HttpRespMsg();
-        mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>().eq("company_id",user.getCompanyId())));
+        if (customerId!=null){
+            mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>()
+                    .eq("company_id",user.getCompanyId())
+                    .eq("custom_id",customerId)));
+        }else
+            mgs.setData(contactsMapper.selectList(new QueryWrapper<Contacts>().eq("company_id",user.getCompanyId())));
         return mgs;
     }
 

+ 41 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/CustomServiceImpl.java

@@ -3,6 +3,7 @@ package com.management.platform.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.management.platform.entity.*;
+import com.management.platform.entity.vo.UserVO;
 import com.management.platform.mapper.*;
 import com.management.platform.service.CustomService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -391,6 +392,46 @@ public class CustomServiceImpl extends ServiceImpl<CustomMapper, Custom> impleme
         customMapper.deleteBatchIds(ids);
     }
 
+    @Override
+    public HttpRespMsg getCustomerTotalCount(String startDate, String endDate, String userId, HttpServletRequest request) {
+        User user = userMapper.selectById(request.getHeader("token"));
+        Integer companyId = user.getCompanyId();
+        List<UserVO> userVoList=userMapper.getCustomerTotalCount(startDate,endDate,userId,companyId);
+        if (userVoList!=null&&!userVoList.isEmpty()){
+            for (UserVO userVO : userVoList) {
+                if (userVO.getCustomertotal()==0){
+                    userVO.setDealRate((double) 0);
+                }else {
+                    userVO.setDealRate((double) (userVO.getCustomerDeal()/userVO.getCustomertotal()));
+                }
+            }
+        }
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.setData(userVoList);
+        return msg;
+    }
+
+    @Override
+    public HttpRespMsg getCustomerTransferRate(String startDate, String endDate, String userId, HttpServletRequest request) {
+        User user = userMapper.selectById(request.getHeader("token"));
+        Integer companyId = user.getCompanyId();
+        List<UserVO> userVoList=userMapper.getCustomerTransferRate(startDate,endDate,userId,companyId);
+        if (userVoList!=null&&!userVoList.isEmpty()){
+            for (UserVO userVO : userVoList) {
+                if (userVO.getNum()==0){
+                    userVO.setDealRate((double) 0);
+                }else {
+                    double v = (double) userVO.getSaleNum() / userVO.getNum();
+                    userVO.setDealRate(v);
+                }
+            }
+        }
+        HttpRespMsg msg = new HttpRespMsg();
+        msg.setData(userVoList);
+        return msg;
+
+    }
+
 
     private Custom setNull(Custom clue) {
         if (clue.getPlate1() == "") {

+ 2 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/java/com/management/platform/service/impl/TaskServiceImpl.java

@@ -272,6 +272,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
             List<Task> collect = taskList.stream().filter(task ->task.getStatus()!=0&& task.getStatus() != 2).collect(Collectors.toList());
             if (collect.size()>0){
                 msg.setError("存在任务未完成,不能删除");
+                return msg;
             }
             LambdaUpdateWrapper<Task> tUlw = new LambdaUpdateWrapper<>();
             tUlw.set(Task::getIsDelete,1).in(Task::getId,taskIds);
@@ -860,6 +861,7 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
         HttpRespMsg msg = new HttpRespMsg();
         if (taskDto==null||taskDto.getId()==null){
             msg.setError("缺少用户的关键信息");
+            return msg;
         }
         LambdaUpdateWrapper<Task> luw = new LambdaUpdateWrapper<>();
         luw.set(Task::getStatus,taskDto.getStatus()).eq(Task::getId,taskDto.getId());

+ 36 - 0
fhKeeper/formulahousekeeper/management-crm/src/main/resources/mapper/UserMapper.xml

@@ -277,6 +277,42 @@
         AND (induction_date &lt;= #{startDate} OR induction_date is NULL)
         AND id not IN (SELECT * from user_exclude)
     </select>
+    <select id="getCustomerTotalCount" resultType="com.management.platform.entity.vo.UserVO">
+
+        select count(*) as customertotal ,
+               sum(case when c.close_deal=1 then 1 else 0 end) as customerDeal ,
+               u.name,u.id
+            from custom c
+            left join user u on c.incharger_id=u.id
+        <where>
+            1=1 and c.company_id=#{companyId}
+
+            <if test="startDate !=null and startDate !='' and endDate !=null and endDate !=''">
+                AND  c.create_time BETWEEN #{startDate} AND #{endDate}
+            </if>
+            <if test="userId !=null and userId!=''">
+                AND  c.incharger_id=#{userId}
+            </if>
+        </where>
+            group by c.incharger_id
+
+    </select>
+    <select id="getCustomerTransferRate" resultType="com.management.platform.entity.vo.UserVO">
+        select count(distinct c.id) as num, count(distinct s.custom_id) as saleNum, c.incharger_id as id  ,u.name
+        from  custom c
+                  left join sales_order s on c.id=s.custom_id
+                  INNER JOIN user u on u.id=c.incharger_id
+        <where>
+            1=1 and c.company_id=#{companyId}
+            <if test="startDate !=null and startDate !='' and endDate !=null and endDate !=''">
+                AND  c.create_time BETWEEN #{startDate} AND #{endDate}
+            </if>
+            <if test="userId !=null and userId!=''">
+                AND  c.incharger_id=#{userId}
+            </if>
+        </where>
+        group by  c.incharger_id
+    </select>
 
     <update id="updateActiveByIds">
         update user set is_active=1 WHERE id IN

+ 75 - 164
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserWithBeisenController.java

@@ -229,117 +229,73 @@ public class UserWithBeisenController {
                         List<JSONObject> overTimeList = overTimeStream.filter(a -> a.getString("StaffId").equals(beisen.get().getUserId())
                                 && (a.getIntValue("ApproveStatus") == 2||a.getIntValue("ApproveStatus") == 1)).collect(Collectors.toList());
                         //加班数据可能存在结束日期是当前日期的情况的情况
-                        BigDecimal overTimeBigDecimal;
-                        if(workDay){
-                            overTimeBigDecimal = new BigDecimal(0);
-                        }else {
-                            overTimeBigDecimal = new BigDecimal(8);
-                        }
+                        BigDecimal overTimeBigDecimal= new BigDecimal(0);;
                         for (JSONObject o : overTimeList) {
                             //存在开始日期为当前日期的数据以及结束日期为当天日期的数据 分开计算
                             if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(localDate)){
                                 //存在开始日期为当天的数据
                                 if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate())){
                                     //开始日期和结束日期是相同的情况 说明是加班区间只存在于当天的情况
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 大于才算加班 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-//                                        //如果结束时间大于13:00
-//                                        if(max.get().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                            timeDurantion=timeDurantion.minusHours(1);
-//                                        }
-//                                        //如果结束时间大于18:00
-//                                        if(max.get().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                            timeDurantion=timeDurantion.minusMinutes(30);
-//                                        }
-                                        BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l = decimal.doubleValue();
-                                        if(l<o.getDouble("OverTimeDuration")){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
-                                        }
+                                    //判断打卡时间是不是大于19:00 大于才算加班 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
+                                    BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l = decimal.doubleValue();
+                                    if(l<o.getDouble("OverTimeDuration")){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l<0?0:l));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
                                     }
                                 }else {
                                     //开始日期和结束日期是不相同的情况 说明是加班区间存在加班到第二天的情况
                                     LocalDateTime start = LocalDateTime.parse(o.getString("StartDate"), df1);
                                     LocalDateTime stop = start.toLocalDate().atTime(LocalTime.MAX);
                                     Duration duration = Duration.between(start, stop);
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                        duration=duration.minusHours(1);
-//                                    }
-//                                    //如果结束时间大于18:00
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                        duration=duration.minusMinutes(30);
-//                                    }
                                     BigDecimal decimal = new BigDecimal(duration.toMinutes());
                                     decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
                                     double l = decimal.doubleValue();
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-                                        BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l1 = decimal1.doubleValue();
-                                        if(l1<l){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }
+                                    //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
+                                    BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l1 = decimal1.doubleValue();
+                                    if(l1<l){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1<0?0:l1));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
                                     }
                                 }
                             }else if(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate().isEqual(localDate)){
                                 //存在结束日期为当天的数据
                                 if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate())){
                                     //开始日期和结束日期是相同的情况 说明是加班区间只存在于当天的情况
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-//                                        //如果结束时间大于13:00
-//                                        if(max.get().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                            timeDurantion=timeDurantion.minusHours(1);
-//                                        }
-//                                        //如果结束时间大于18:00
-//                                        if(max.get().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                            timeDurantion=timeDurantion.minusMinutes(30);
-//                                        }
-                                        BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l = decimal.doubleValue();
-                                        if(l<o.getDouble("OverTimeDuration")){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
-                                        }
+                                    //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
+                                    BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l = decimal.doubleValue();
+                                    if(l<o.getDouble("OverTimeDuration")){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l<0?0:l));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
                                     }
                                 }else {
                                     //开始日期和结束日期是不相同的情况 说明是加班区间存在加班到第二天的情况
                                     LocalDateTime stop = LocalDateTime.parse(o.getString("StopDate"), df1);
                                     LocalDateTime start = stop.toLocalDate().atTime(LocalTime.MIN);
                                     Duration duration = Duration.between(start, stop);
-//                                    //如果结束时间大于13:00
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                        duration=duration.minusHours(1);
-//                                    }
-//                                    //如果结束时间大于18:00
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                        duration=duration.minusMinutes(30);
-//                                    }
                                     BigDecimal decimal = new BigDecimal(duration.toMinutes());
                                     decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
                                     double l = decimal.doubleValue();
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-                                        BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l1 = decimal1.doubleValue();
-                                        if(l1<l){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }
+                                    //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
+                                    BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l1 = decimal1.doubleValue();
+                                    if(l1<l){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1<0?0:l1));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
                                     }
                                 }
                             }
@@ -528,120 +484,75 @@ public class UserWithBeisenController {
 //                                &&LocalDateTime.parse(a.getString("StartDate"),df1).toLocalDate().isEqual(localDate)).collect(Collectors.toList());
                 List<JSONObject> overTimeList = overTimeStream.filter(a -> a.getString("StaffId").equals(beisen.get().getUserId())
                         && (a.getIntValue("ApproveStatus") == 2||a.getIntValue("ApproveStatus") == 1)).collect(Collectors.toList());
-                //加班数据可能存在结束日期是当前日期的情况的情况
-                BigDecimal overTimeBigDecimal;
-                if(workDay){
-                    overTimeBigDecimal = new BigDecimal(0);
-                }else {
-                    overTimeBigDecimal = new BigDecimal(8);
-                }
                 LocalDate localDate = LocalDate.parse(createDate, df);
+                //加班数据可能存在结束日期是当前日期的情况的情况
+                BigDecimal overTimeBigDecimal= new BigDecimal(0);
                 for (JSONObject o : overTimeList) {
                     //存在开始日期为当前日期的数据以及结束日期为当天日期的数据 分开计算
                     if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(localDate)){
                         //存在开始日期为当天的数据
                         if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate())){
                             //开始日期和结束日期是相同的情况 说明是加班区间只存在于当天的情况
-                            if(max.isAfter(LocalTime.parse("19:00:00",df4))){
-                                //判断打卡时间是不是大于19:00 大于才算加班 通过打卡计算加班时长 与加班单作比较 取小
-                                Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max);
-//                                //如果结束时间大于13:00
-//                                if(max.isAfter(LocalTime.parse("13:00:00",df4))){
-//                                    timeDurantion=timeDurantion.minusHours(1);
-//                                }
-//                                //如果结束时间大于18:00
-//                                if(max.isAfter(LocalTime.parse("18:00:00",df4))){
-//                                    timeDurantion=timeDurantion.minusMinutes(30);
-//                                }
-                                System.out.println(timeDurantion.toMinutes());
-                                BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
-                                decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                double l = decimal.doubleValue();
-                                if(l<o.getDouble("OverTimeDuration")){
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                }else {
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
-                                }
+                            //判断打卡时间是不是大于19:00 大于才算加班 通过打卡计算加班时长 与加班单作比较 取小
+                            Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max);
+                            BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
+                            decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                            double l = decimal.doubleValue();
+                            if(l<o.getDouble("OverTimeDuration")){
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l<0?0:l));
+                            }else {
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
                             }
                         }else {
                             //开始日期和结束日期是不相同的情况 说明是加班区间存在加班到第二天的情况
                             LocalDateTime start = LocalDateTime.parse(o.getString("StartDate"), df1);
                             LocalDateTime stop = start.toLocalDate().atTime(LocalTime.MAX);
                             Duration duration = Duration.between(start, stop);
-//                            if(stop.toLocalTime().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                duration=duration.minusHours(1);
-//                            }
-//                            //如果结束时间大于18:00
-//                            if(stop.toLocalTime().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                duration=duration.minusMinutes(30);
-//                            }
                             BigDecimal decimal = new BigDecimal(duration.toMinutes());
                             decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
                             double l = decimal.doubleValue();
-                            if(max.isAfter(LocalTime.parse("19:00:00",df4))){
-                                //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max);
-                                BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
-                                decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                double l1 = decimal1.doubleValue();
-                                if(l1<l){
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1));
-                                }else {
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                }
+                            //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                            Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max);
+                            BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
+                            decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                            double l1 = decimal1.doubleValue();
+                            if(l1<l){
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1<0?0:l1));
+                            }else {
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
                             }
                         }
                     }else if(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate().isEqual(localDate)){
                         //存在结束日期为当天的数据
                         if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate())){
                             //开始日期和结束日期是相同的情况 说明是加班区间只存在于当天的情况
-                            if(max.isAfter(LocalTime.parse("19:00:00",df4))){
-                                //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max);
-//                                //如果结束时间大于13:00
-//                                if(max.isAfter(LocalTime.parse("13:00:00",df4))){
-//                                    timeDurantion=timeDurantion.minusHours(1);
-//                                }
-//                                //如果结束时间大于18:00
-//                                if(max.isAfter(LocalTime.parse("18:00:00",df4))){
-//                                    timeDurantion=timeDurantion.minusMinutes(30);
-//                                }
-                                BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
-                                decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                double l = decimal.doubleValue();
-                                if(l<o.getDouble("OverTimeDuration")){
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                }else {
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
-                                }
+                            //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                            Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max);
+                            BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
+                            decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                            double l = decimal.doubleValue();
+                            if(l<o.getDouble("OverTimeDuration")){
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l<0?0:l));
+                            }else {
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
                             }
                         }else {
                             //开始日期和结束日期是不相同的情况 说明是加班区间存在加班到第二天的情况
                             LocalDateTime stop = LocalDateTime.parse(o.getString("StopDate"), df1);
                             LocalDateTime start = stop.toLocalDate().atTime(LocalTime.MIN);
                             Duration duration = Duration.between(start, stop);
-//                            //如果结束时间大于13:00
-//                            if(stop.toLocalTime().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                duration=duration.minusHours(1);
-//                            }
-//                            //如果结束时间大于18:00
-//                            if(stop.toLocalTime().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                duration=duration.minusMinutes(30);
-//                            }
                             BigDecimal decimal = new BigDecimal(duration.toMinutes());
                             decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
                             double l = decimal.doubleValue();
-                            if(max.isAfter(LocalTime.parse("19:00:00",df4))){
-                                //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max);
-                                BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
-                                decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                double l1 = decimal1.doubleValue();
-                                if(l1<l){
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1));
-                                }else {
-                                    overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                }
+                            //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                            Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max);
+                            BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
+                            decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                            double l1 = decimal1.doubleValue();
+                            if(l1<l){
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1<0?0:l1));
+                            }else {
+                                overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
                             }
                         }
                     }

+ 37 - 81
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -2180,117 +2180,73 @@ public class TimingTask {
                         List<JSONObject> overTimeList = overTimeStream.filter(a -> a.getString("StaffId").equals(beisen.get().getUserId())
                                 && (a.getIntValue("ApproveStatus") == 2||a.getIntValue("ApproveStatus") == 1)).collect(Collectors.toList());
                         //加班数据可能存在结束日期是当前日期的情况的情况
-                        BigDecimal overTimeBigDecimal;
-                        if(workDay){
-                            overTimeBigDecimal = new BigDecimal(0);
-                        }else {
-                            overTimeBigDecimal = new BigDecimal(8);
-                        }
+                        BigDecimal overTimeBigDecimal= new BigDecimal(0);;
                         for (JSONObject o : overTimeList) {
                             //存在开始日期为当前日期的数据以及结束日期为当天日期的数据 分开计算
                             if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(localDate)){
                                 //存在开始日期为当天的数据
                                 if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate())){
                                     //开始日期和结束日期是相同的情况 说明是加班区间只存在于当天的情况
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-//                                        //如果结束时间大于13:00
-//                                        if(max.get().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                            timeDurantion.minusHours(1);
-//                                        }
-//                                        //如果结束时间大于18:00
-//                                        if(max.get().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                            timeDurantion.minusMinutes(30);
-//                                        }
-                                        BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l = decimal.doubleValue();
-                                        if(l<o.getDouble("OverTimeDuration")){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
-                                        }
+                                    //判断打卡时间是不是大于19:00 大于才算加班 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max.get());
+                                    BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l = decimal.doubleValue();
+                                    if(l<o.getDouble("OverTimeDuration")){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l<0?0:l));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
                                     }
                                 }else {
                                     //开始日期和结束日期是不相同的情况 说明是加班区间存在加班到第二天的情况
                                     LocalDateTime start = LocalDateTime.parse(o.getString("StartDate"), df1);
                                     LocalDateTime stop = start.toLocalDate().atTime(LocalTime.MAX);
                                     Duration duration = Duration.between(start, stop);
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                        duration.minusHours(1);
-//                                    }
-//                                    //如果结束时间大于18:00
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                        duration.minusMinutes(30);
-//                                    }
                                     BigDecimal decimal = new BigDecimal(duration.toMinutes());
                                     decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
                                     double l = decimal.doubleValue();
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-                                        BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l1 = decimal1.doubleValue();
-                                        if(l1<l){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }
+                                    //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max.get());
+                                    BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l1 = decimal1.doubleValue();
+                                    if(l1<l){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1<0?0:l1));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
                                     }
                                 }
                             }else if(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate().isEqual(localDate)){
                                 //存在结束日期为当天的数据
                                 if(LocalDateTime.parse(o.getString("StartDate"),df1).toLocalDate().isEqual(LocalDateTime.parse(o.getString("StopDate"),df1).toLocalDate())){
                                     //开始日期和结束日期是相同的情况 说明是加班区间只存在于当天的情况
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-//                                        //如果结束时间大于13:00
-//                                        if(max.get().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                            timeDurantion.minusHours(1);
-//                                        }
-//                                        //如果结束时间大于18:00
-//                                        if(max.get().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                            timeDurantion.minusMinutes(30);
-//                                        }
-                                        BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l = decimal.doubleValue();
-                                        if(l<o.getDouble("OverTimeDuration")){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
-                                        }
+                                    //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max.get());
+                                    BigDecimal decimal = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l = decimal.doubleValue();
+                                    if(l<o.getDouble("OverTimeDuration")){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l<0?0:l));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(o.getDouble("OverTimeDuration")));
                                     }
                                 }else {
                                     //开始日期和结束日期是不相同的情况 说明是加班区间存在加班到第二天的情况
                                     LocalDateTime stop = LocalDateTime.parse(o.getString("StopDate"), df1);
                                     LocalDateTime start = stop.toLocalDate().atTime(LocalTime.MIN);
                                     Duration duration = Duration.between(start, stop);
-//                                    //如果结束时间大于13:00
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("13:00:00",df4))){
-//                                        duration.minusHours(1);
-//                                    }
-//                                    //如果结束时间大于18:00
-//                                    if(stop.toLocalTime().isAfter(LocalTime.parse("18:00:00",df4))){
-//                                        duration.minusMinutes(30);
-//                                    }
                                     BigDecimal decimal = new BigDecimal(duration.toMinutes());
                                     decimal=decimal.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
                                     double l = decimal.doubleValue();
-                                    if(max.get().isAfter(LocalTime.parse("19:00:00",df4))){
-                                        //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
-                                        Duration timeDurantion = Duration.between(LocalTime.parse("18:00:00", df4), max.get());
-                                        BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
-                                        decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
-                                        double l1 = decimal1.doubleValue();
-                                        if(l1<l){
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1));
-                                        }else {
-                                            overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
-                                        }
+                                    //判断打卡时间是不是大于19:00 通过打卡计算加班时长 与加班单作比较 取小
+                                    Duration timeDurantion = Duration.between(LocalTime.parse(workDay?"18:00:00":"08:30:00", df4), max.get());
+                                    BigDecimal decimal1 = new BigDecimal(timeDurantion.toMinutes());
+                                    decimal1=decimal1.divide(new BigDecimal(60),1,RoundingMode.HALF_UP);
+                                    double l1 = decimal1.doubleValue();
+                                    if(l1<l){
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l1<0?0:l1));
+                                    }else {
+                                        overTimeBigDecimal=overTimeBigDecimal.add(new BigDecimal(l));
                                     }
                                 }
                             }