Browse Source

跨天请假时,针对赛元微电子的请假时长有误,中间天计算不对

seyason 1 year ago
parent
commit
fd167db062

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

@@ -442,7 +442,7 @@ public class ReportController {
         }
 
         if (overtimeHours == null) {
-            overtimeHours = new Double[projectId.length];
+            overtimeHours = new Double[projectAuditorId.length];
             for(int i=0;i<projectAuditorId.length; i++) {
                 overtimeHours[i] = null;
             }

+ 47 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceImportServiceImpl.java

@@ -1,6 +1,7 @@
 package com.management.platform.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.github.pagehelper.util.StringUtil;
 import com.management.platform.entity.*;
 import com.management.platform.mapper.*;
 import com.management.platform.service.*;
@@ -356,10 +357,18 @@ public class FinanceImportServiceImpl extends ServiceImpl<FinanceImportMapper, F
                     Cell field1 = cusColList.size() > 0?row.getCell(9):null;
                     Cell field2 = cusColList.size() > 1?row.getCell(10):null;
                     Cell field3 = cusColList.size() > 2?row.getCell(11):null;
+                    Cell field4 = cusColList.size() > 3?row.getCell(12):null;
+                    Cell field5 = cusColList.size() > 4?row.getCell(13):null;
+                    Cell field6 = cusColList.size() > 5?row.getCell(14):null;
+                    Cell field7 = cusColList.size() > 6?row.getCell(15):null;
 
                     if (field1 != null)field1.setCellType(CellType.STRING);
                     if (field2 != null)field2.setCellType(CellType.STRING);
                     if (field3 != null)field3.setCellType(CellType.STRING);
+                    if (field4 != null)field4.setCellType(CellType.STRING);
+                    if (field5 != null)field5.setCellType(CellType.STRING);
+                    if (field6 != null)field6.setCellType(CellType.STRING);
+                    if (field7 != null)field7.setCellType(CellType.STRING);
 
                     finance.setCompanyId(companyId);
                     finance.setName(name);
@@ -385,49 +394,49 @@ public class FinanceImportServiceImpl extends ServiceImpl<FinanceImportMapper, F
                         if (bonusCell != null) {
                             bonusCell.setCellType(CellType.STRING);
                             String bonusString = bonusCell.getStringCellValue();
-                            BigDecimal bonus = bonusString != null ? new BigDecimal(bonusString.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal bonus = !StringUtil.isEmpty(bonusString) ? new BigDecimal(bonusString.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setBonus(bonus);
                             if (financeConfig.getBonusCalculate()==1) total = total.add(bonus);
                         }
                         if (allowanceCell != null) {
                             allowanceCell.setCellType(CellType.STRING);
                             String item = allowanceCell.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setAllowance(value);
                             if (financeConfig.getAllowanceCalculate()==1) total = total.add(value);
                         }
                         if (inJobCell != null) {
                             inJobCell.setCellType(CellType.STRING);
                             String item = inJobCell.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setInsuranceLosejob(value);
                             if (financeConfig.getInsuranceLosejobCalculate()==1) total = total.add(value);
                         }
                         if (inMedicalCell != null) {
                             inMedicalCell.setCellType(CellType.STRING);
                             String item = inMedicalCell.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setInsuranceMedical(value);
                             if (financeConfig.getInsuranceMedicalCalculate()==1) total = total.add(value);
                         }
                         if (inOldCell != null) {
                             inOldCell.setCellType(CellType.STRING);
                             String item = inOldCell.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setInsuranceOld(value);
                             if (financeConfig.getInsuranceOldCalculate()==1) total = total.add(value);
                         }
                         if (injuryCell != null) {
                             injuryCell.setCellType(CellType.STRING);
                             String item = injuryCell.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setInsuranceInjury(value);
                             if (financeConfig.getInsuranceInjuryCalculate()==1) total = total.add(value);
                         }
                         if (houseFundCell != null) {
                             houseFundCell.setCellType(CellType.STRING);
                             String item = houseFundCell.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setHouseFund(value);
                             if (financeConfig.getHouseFundCalculate()==1) total = total.add(value);
                         }
@@ -435,24 +444,52 @@ public class FinanceImportServiceImpl extends ServiceImpl<FinanceImportMapper, F
                         if (field1 != null) {
                             field1.setCellType(CellType.STRING);
                             String item = field1.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setCustomField1(value);
                             if (financeConfig.getField1Calculate() != null && financeConfig.getField1Calculate()==1) total = total.add(value);
                         }
                         if (field2 != null) {
                             field2.setCellType(CellType.STRING);
                             String item = field2.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item) ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setCustomField2(value);
                             if (financeConfig.getField2Calculate() != null && financeConfig.getField2Calculate()==1) total = total.add(value);
                         }
                         if (field3 != null) {
                             field3.setCellType(CellType.STRING);
                             String item = field3.getStringCellValue();
-                            BigDecimal value = item != null ? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            BigDecimal value = !StringUtil.isEmpty(item)? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
                             finance.setCustomField3(value);
                             if (financeConfig.getField3Calculate() != null && financeConfig.getField3Calculate()==1) total = total.add(value);
                         }
+                        if (field4 != null) {
+                            field4.setCellType(CellType.STRING);
+                            String item = field4.getStringCellValue();
+                            BigDecimal value = !StringUtil.isEmpty(item)? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            finance.setCustomField4(value);
+                            if (financeConfig.getField4Calculate() != null && financeConfig.getField4Calculate()==1) total = total.add(value);
+                        }
+                        if (field5 != null) {
+                            field5.setCellType(CellType.STRING);
+                            String item = field5.getStringCellValue();
+                            BigDecimal value = !StringUtil.isEmpty(item)? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            finance.setCustomField5(value);
+                            if (financeConfig.getField5Calculate() != null && financeConfig.getField5Calculate()==1) total = total.add(value);
+                        }
+                        if (field6 != null) {
+                            field6.setCellType(CellType.STRING);
+                            String item = field6.getStringCellValue();
+                            BigDecimal value = !StringUtil.isEmpty(item)? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            finance.setCustomField6(value);
+                            if (financeConfig.getField6Calculate() != null && financeConfig.getField6Calculate()==1) total = total.add(value);
+                        }
+                        if (field7 != null) {
+                            field7.setCellType(CellType.STRING);
+                            String item = field7.getStringCellValue();
+                            BigDecimal value = !StringUtil.isEmpty(item)? new BigDecimal(item.trim().replaceAll("\\u00a0", "")) : BigDecimal.valueOf(0);
+                            finance.setCustomField7(value);
+                            if (financeConfig.getField7Calculate() != null && financeConfig.getField7Calculate()==1) total = total.add(value);
+                        }
                         finance.setTotalCost(total);
 
                         //如果需要更新员工成本

+ 1 - 6
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java

@@ -1475,11 +1475,6 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
             if (cusColList.size() > 6) sumRow.add(totalField7.toString());
             sumRow.add(totalMoneyCost.toString());
             allList.add(sumRow);
-            System.out.println("fixedColCount:"+fixedColCount+", allList col size:"+allList.get(0).size());
-            System.out.println("第一行:");
-            allList.get(0).forEach(System.out::println);
-            System.out.println("第二行:");
-            allList.get(1).forEach(System.out::println);
             //生成excel文件导出
             //String fileName = yearMonth+(groupByCategory==0?"财务人员成本_":"财务项目分类成本_")+System.currentTimeMillis();
             String fileName = yearMonth+(groupByCategory == 0?MessageUtils.message("fileName.costFinancialPersonnel"):MessageUtils.message("fileName.proClassCost"))+System.currentTimeMillis();
@@ -1501,7 +1496,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                             multiSheetDataList[i].add(newRow);
                         }
                     }
-                    excelExportService.exportMultiSheetGeneralExcelByTitleAndList(wxCorpInfo,fileName , multiSheetDataList, path, sheetNameList.toArray(new String[0]));
+                    return excelExportService.exportMultiSheetGeneralExcelByTitleAndList(wxCorpInfo,fileName , multiSheetDataList, path, sheetNameList.toArray(new String[0]));
                 } else {
                     return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , allList, path);
                 }

+ 6 - 16
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1241,6 +1241,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                         //跨天请假的情况,中间如果有非工作日要自动补齐时间。
                         List<LocalDate> betweenNonWorkDays = new ArrayList<>();
                         int betweenTotalDays = 0;
+                        boolean isWholeDayLeave = false;
                         for (int t = 0; t < holidayItems.size(); t++) {
                             JSONObject holiday = holidayItems.getJSONObject(t);
                             JSONObject spTitle = holiday.getJSONObject("sp_title");
@@ -1277,6 +1278,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                             if (leaveStart.equals("上午")) {
                                                 leaveEnd = baseAfternoonEnd;//上午和下午都请假,算全天
                                                 leaveStart = baseMorningStart;
+                                                isWholeDayLeave = true;
                                             } else {
                                                 leaveStart = "14:00";
                                                 leaveEnd = baseAfternoonEnd;//请假的下班打卡时间,算上班结束的时间
@@ -1316,6 +1318,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                             if (showLog) System.out.println("跨天请假第一天leaveStart为:"+leaveStart);
                                             if (leaveStart.equals("上午")) {
                                                 leaveStart = baseMorningStart;
+                                                isWholeDayLeave = true;//第一天上午开始请假,第一天就算全天请假
                                             } else if (leaveStart.equals("下午")) {
                                                 leaveStart = baseAfternoonStart;
                                             }
@@ -1325,6 +1328,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                             //当前日期就是最后一天,需判断上下午半天请假的情况
                                             if (leaveEnd.equals("下午")) {
                                                 leaveEnd = baseAfternoonEnd;//请假到最后一天的下午,就算是全天
+                                                isWholeDayLeave = true;
                                             } else if (leaveEnd.equals("上午")) {
                                                 //上午请假
                                                 leaveEnd = baseMorningEnd;
@@ -1335,6 +1339,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                             //中间日期就是全天
                                             leaveStart = baseMorningStart;
                                             leaveEnd = baseAfternoonEnd;
+                                            isWholeDayLeave = true;
                                             if (showLog) System.out.println("===中间天请假===");
                                         }
                                     }
@@ -1498,21 +1503,6 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                             switch (spItem.getInteger("type")) {
                                 case 1://请假
                                     //单独计算请假时间
-//                                    Double leaveTime = ct.getAskLeaveTime();
-//                                    if (leaveTime == null) {
-//                                        leaveTime = 0.0;
-//                                    }
-//                                    int wxDuration = spItem.getInteger("duration");
-//                                    int seconds = 0;
-//                                    if (betweenNonWorkDays.size() > 0) {
-//                                        //跨天请假中含有非工作日的情况,要减去非工作日来重新计算实际工作日的每天请假时长。
-//                                        seconds = wxDuration * betweenTotalDays/(betweenTotalDays - betweenNonWorkDays.size());
-//                                    } else {
-//                                        seconds = wxDuration;
-//                                    }
-//                                    double curLeaveTime = convertDayTimeToHours(DateTimeUtil.getHoursFromSeconds(seconds));
-//                                    System.out.println("curLeaveTime============="+curLeaveTime);
-//                                    ct.setAskLeaveTime(leaveTime + curLeaveTime);
                                     break;
                                 case 2://补卡
                                 case 3://出差
@@ -1640,7 +1630,7 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                         }
                         //针对赛元微电子,请半天假的情况下。重新校正打卡和工作时长
                         if (corpInfo.getCorpid().equals("wpy9TkCAAAgNp4jvqxKTpXrhvwFvyFHg")) {
-                            if (morningLeave && afternoonLeave) {
+                            if ((morningLeave && afternoonLeave) || isWholeDayLeave) {
                                 ct.setAskLeaveTime(baseMorningWorkTime + baseAfternoonWorkTime);
                                 ct.setWorkHours(0.0);
                                 ct.setCardTime(0.0);