Browse Source

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

Lijy 1 year ago
parent
commit
af04054903

+ 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);
 
                         //如果需要更新员工成本

+ 37 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java

@@ -649,6 +649,9 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
             BigDecimal totalField7 = cusColList.size() > 6?BigDecimal.valueOf(0):null;
 
             List<String> headList = new ArrayList<String>();
+            List<String> sheetNameList = new ArrayList<String>();
+            sheetNameList.add("财务数据分摊总表");
+            int fixedColCount = 4;
             if (groupByCategory == 0) {
                 //headList.add("项目编号");
                 headList.add(MessageUtils.message("entry.projectId"));
@@ -656,28 +659,39 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                 headList.add(MessageUtils.message("entry.projectName"));
                 //headList.add("人员");
                 headList.add(MessageUtils.message("entry.personnel"));
-                headList.add("部门");
+                headList.add(MessageUtils.message("entry.dept"));
                 for (UserCustom userCustom : userCustoms) {
                     headList.add(userCustom.getName());
+                    fixedColCount++;
                 }
                 //headList.add("工时(h)");
                 headList.add(MessageUtils.message("entry.workHours")+"(h)");
+                fixedColCount++;
             } else {
                 //headList.add("项目分类");
                 headList.add(MessageUtils.message("entry.projectType"));
             }
             FinanceFixedcolname fixedItem = financeFixedcolnameService.getFixed(companyId);
             headList.add(fixedItem.getMonthCost()+"(元)");
+            sheetNameList.add(fixedItem.getMonthCost()+"分摊表");
             headList.add(fixedItem.getBonus()+"(元)");
+            sheetNameList.add(fixedItem.getBonus()+"分摊表");
             headList.add(fixedItem.getAllowance()+"(元)");
+            sheetNameList.add(fixedItem.getAllowance()+"分摊表");
             headList.add(fixedItem.getInsuranceOld()+"(元)");
+            sheetNameList.add(fixedItem.getInsuranceOld()+"分摊表");
             headList.add(fixedItem.getInsuranceMedical()+"(元)");
+            sheetNameList.add(fixedItem.getInsuranceMedical()+"分摊表");
             headList.add(fixedItem.getInsuranceLosejob()+"(元)");
+            sheetNameList.add(fixedItem.getInsuranceLosejob()+"分摊表");
             headList.add(fixedItem.getInsuranceInjury()+"(元)");
+            sheetNameList.add(fixedItem.getInsuranceInjury()+"分摊表");
             headList.add(fixedItem.getHouseFund()+"(元)");
+            sheetNameList.add(fixedItem.getHouseFund()+"分摊表");
 //            headList.add("其他(元)");
             for (FinanceTblcuscol col : cusColList) {
                 headList.add(col.getFieldName());
+                sheetNameList.add(col.getFieldName()+"分摊表");
             }
             //headList.add("总成本(元)");
             headList.add(MessageUtils.message("entry.totalCost")+"(元)");
@@ -1463,9 +1477,29 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
             allList.add(sumRow);
             //生成excel文件导出
             //String fileName = yearMonth+(groupByCategory==0?"财务人员成本_":"财务项目分类成本_")+System.currentTimeMillis();
-            String fileName = yearMonth+(groupByCategory==0?MessageUtils.message("fileName.costFinancialPersonnel"):MessageUtils.message("fileName.proClassCost"))+System.currentTimeMillis();
+            String fileName = yearMonth+(groupByCategory == 0?MessageUtils.message("fileName.costFinancialPersonnel"):MessageUtils.message("fileName.proClassCost"))+System.currentTimeMillis();
             try {
-                return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , allList, path);
+                if (groupByCategory == 0) {
+                    //一个总表和自定义字段多个sheet
+                    List[] multiSheetDataList = new ArrayList[sheetNameList.size()];
+                    multiSheetDataList[0] = allList;
+                    for (int i = 1; i < sheetNameList.size(); i++) {
+                        multiSheetDataList[i] = new ArrayList();
+                        for (List<String> rowData : allList) {
+                            List<String> newRow = new ArrayList<String>();
+                            //取前面固定的列
+//                            System.out.println("before: "+rowData.size());
+                            rowData.subList(0, fixedColCount).forEach(newRow::add);
+//                            System.out.println("after: "+rowData.size());
+                            //按当前表单的顺序,取数据部分
+                            newRow.add(rowData.get(fixedColCount + i - 1));
+                            multiSheetDataList[i].add(newRow);
+                        }
+                    }
+                    return excelExportService.exportMultiSheetGeneralExcelByTitleAndList(wxCorpInfo,fileName , multiSheetDataList, path, sheetNameList.toArray(new String[0]));
+                } else {
+                    return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , allList, path);
+                }
             } catch (Exception e) {
                 e.printStackTrace();
             }

+ 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);

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages.properties

@@ -415,6 +415,7 @@ entry.Participants=参与人
 entry.projectManager=项目经理
 entry.level=级别
 entry.department=所属部门
+entry.dept=部门
 entry.customer=客户
 entry.startData=开始日期
 entry.endDate=截止日期

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/i18n/messages_en_US.properties

@@ -415,6 +415,7 @@ entry.Participants=Participants
 entry.projectManager=project manager
 entry.level=level
 entry.department=Department
+entry.dept=Department
 entry.customer=customer
 entry.startData=Start Date
 entry.endDate=end date