Parcourir la source

赛元考勤处理,获取考勤记录也要重新计算工作时长

QuYueTing il y a 1 mois
Parent
commit
08c9cc97a0

+ 8 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1145,6 +1145,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     if (time < 0) {
                         time = 0;
                     } else {
+                        //盛立
                         if (corpInfo.getCompanyId() == 481) {
                             time = DateTimeUtil.getHalfHoursFromDouble(time);
                         } else {
@@ -1306,6 +1307,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     //获取上下午考勤规则中的工作时长
                     double baseMorningWorkTime = 0;
                     double baseAfternoonWorkTime = 0;
+                    //赛元微电子的处理
                     if (corpInfo.getCorpid().equals("wpy9TkCAAAgNp4jvqxKTpXrhvwFvyFHg")) {
                         if (workRules.size() > 0) {
                             JSONObject morTime = workRules.getJSONObject(0);
@@ -1347,7 +1349,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     } else {
                         restTime = 1.0 * (workRules.getJSONObject(1).getIntValue("work_sec") - workRules.getJSONObject(0).getIntValue("off_work_sec")) / 3600;
                     }
-
                     LocalDate localDate = LocalDateTime.ofInstant(Instant.ofEpochSecond(time), ZoneId.systemDefault()).toLocalDate();
                     UserCorpwxTime ct = new UserCorpwxTime();
                     ct.setCompanyId(corpInfo.getCompanyId());
@@ -1629,6 +1630,9 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                 }
                             }
                         }
+                        if (corpInfo.getCompanyId() == 469 || corpInfo.getCompanyId() == 7) {
+                            needRecaculate = true;//赛元微电子,都需要重新计算
+                        }
                         double timeDelta = 0;
                         //时间有变化,需要重新计算
                         if (needRecaculate) {
@@ -1811,7 +1815,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                         workTime -= restTime;
                                     }
                                     ct.setCardTime(workTime);
-                                    double calTime = DateTimeUtil.getHoursFromDouble(workTime) - ct.getAskLeaveTime();
+                                    double calTime = workTime - ct.getAskLeaveTime();
                                     if (calTime < 8.0 && ct.getOutdoorTime() > 0) {
                                         calTime += ct.getOutdoorTime();
                                     }
@@ -1819,7 +1823,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                         //给盛立安元0.5单位进位
                                         ct.setWorkHours(DateTimeUtil.getHalfHoursFromDouble(calTime));
                                     } else {
-                                        ct.setWorkHours(calTime);
+                                        ct.setWorkHours(DateTimeUtil.getHoursFromDouble(calTime));
                                     }
                                     if (showLog) System.out.println("workTime="+workTime+", 二次校正后workHours="+ct.getWorkHours());
                                 }
@@ -1871,7 +1875,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     //有工作时长或者打卡时长或者请假时长,外出时长,都算有效时间
                     boolean hasTimeRecord = ct.getWorkHours() > 0 || ct.getCardTime() >= 1.0 || ct.getAskLeaveTime() > 0 || ct.getOutdoorTime() > 0;
                     //对于赛元微电子,2025年4月1日之前的都不做处理,防止把数据覆盖掉
-                    if(corpInfo.getCompanyId() == 469 && ct.getCreateDate().isBefore(LocalDate.of(2025, 4, 1))) {
+                    if(corpInfo.getCompanyId() == 469 && ct.getCreateDate().isBefore(LocalDate.of(2025, 4, 14))) {
                         System.out.println("赛元微电子Skip");
                         continue;
                     }

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -716,6 +716,7 @@ export default {
 
                 let item = {
                     "value": yAxisValue == 0 ? (list[i].costMoney ? list[i].costMoney.toFixed(2) : 0) || list[i].costMoney : (list[i].cost ? list[i].cost.toFixed(1) : 0),
+                    "dayValue": yAxisValue == 0 ? 0 : (list[i].cost/this.user.timeType.allDay).toFixed(1),//人天单位
                     "id": list[i].id || i,
                 }
                 if (countCost) {
@@ -781,7 +782,7 @@ export default {
             chartData.yAxis = {
                 type: 'value',
                 axisLabel: {
-                    formatter: yAxisValue == 0 ? '{value} (' + '元' + ')' : '{value}' + '小时'
+                    formatter: yAxisValue == 0 ? '{value} (' + '元' + ')' : ('{value}' + '小时')
                 }
             }