浏览代码

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

QuYueTing 9 月之前
父节点
当前提交
f9dedcdb20
共有 24 个文件被更改,包括 1411 次插入115 次删除
  1. 8 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ContractController.java
  2. 13 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java
  3. 4 5
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  4. 5 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java
  5. 8 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ContractCustom.java
  6. 1 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java
  7. 22 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java
  8. 2 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ContractService.java
  9. 1 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ExcelExportService.java
  10. 3 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java
  11. 2 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java
  12. 324 7
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java
  13. 77 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ExcelExportServiceImpl.java
  14. 516 90
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java
  15. 9 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  16. 71 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  17. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java
  18. 138 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/ExcelUtil.java
  19. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ContractCustomMapper.xml
  20. 157 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml
  21. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml
  22. 二进制
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/upload/上海民航合同模板.xlsx
  23. 44 5
      fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue
  24. 1 1
      fhKeeper/formulahousekeeper/timesheet/src/views/project/finance.vue

+ 8 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ContractController.java

@@ -54,6 +54,14 @@ public class ContractController {
         return contractService.ExportContract(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId);
     }
 
+    /**
+     * 导出合同
+     */
+    @RequestMapping("/ExportContractOneToMany")
+    public HttpRespMsg ExportContractOneToMany (HttpServletRequest request, String number,String name,String typeName,Integer status,String startDate,String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId){
+        return contractService.ExportContractOneToMany(request,number,name,typeName,status,startDate,endDate, paymentStartDate, paymentEndDate, secTypeId);
+    }
+
     /**
      * 导入合同
      */

+ 13 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -103,6 +103,14 @@ public class ProjectController {
         return projectService.getProjectList(forReport, userId, request);
     }
 
+    /**
+     * 获取项目列表
+     */
+    @RequestMapping("/getProjectListByPage")
+    public HttpRespMsg getProjectListByPage(@RequestParam Integer pageIndex, @RequestParam Integer pageSize,@RequestParam(required = false)String infoString,@RequestParam(required = false) Integer id,@RequestParam(required = false, defaultValue = "0") Integer forReport) {
+        return projectService.getProjectListByPage(pageIndex,pageSize,infoString,id,forReport, request);
+    }
+
     /**
      * 分页获取项目列表
      * pageIndex 页数
@@ -269,6 +277,11 @@ public class ProjectController {
         return projectService.exportTimeCost(withMainProject, exportContent,startDate, endDate, projectId, userIds, projectSum,type,deptId,stateKey, withPercent,projectCategoryId, request);
     }
 
+    @RequestMapping("/exportTimeByProjectAndEmployee")
+    public HttpRespMsg exportTimeByProjectAndEmployee(@RequestParam String date, HttpServletRequest request) {
+        return projectService.exportTimeByProjectAndEmployee(date, request);
+    }
+
     /**
      * 导出查询者所在公司每个项目分类的工时成本
      */

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

@@ -626,21 +626,20 @@ public class ReportController {
             }
         } else if (comTimeType.getReportAuditType() == 1 || comTimeType.getReportAuditType() == 2 || comTimeType.getReportAuditType() == 9) {
             List<TaskGroup> groupList = taskGroupService.list(new QueryWrapper<TaskGroup>().in("id", Arrays.asList(groupId)));
-
             for (int i=0;i<projectAuditorId.length; i++) {
                 if (projectAuditorId[i] == null) {
                     //取分组的负责人进行审核
                     int finalPid = projectId[i];
                     Integer finalGroupId = groupId[i];
                     TaskGroup targetGroup = groupList.stream().filter(g->g.getId().equals(finalGroupId)).findFirst().orElse(null);
-                    if (targetGroup != null) {
-                        projectAuditorId[i] = targetGroup.getInchargerId();
-                    } else {
-                        //没有分组的情况,返回错误信息
+                    if (targetGroup == null || targetGroup.getInchargerId() == null) {
+                        //没有分组的情况或者分组没有设置负责人的情况下,返回错误信息
                         HttpRespMsg msg = new HttpRespMsg();
                         msg.setError("请设置"+projectList.stream().filter(project -> project.getId().equals(finalPid)).findFirst().get().getProjectName()+
                                 "项目下"+targetGroup.getName()+"分组的负责人");
                         return msg;
+                    } else {
+                        projectAuditorId[i] = targetGroup.getInchargerId();
                     }
                 }
             }

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java

@@ -172,6 +172,11 @@ public class UserController {
         return userService.getSimpleActiveUserList(departmentId,request,keyword,cursor);
     }
 
+    @RequestMapping("/getSimpleActiveUserListPage")
+    public HttpRespMsg getSimpleActiveUserListPage(@RequestParam Integer pageIndex, @RequestParam Integer pageSize,Integer departmentId,String keyword,String cursor,@RequestParam(required = false) String userIds) throws Exception {
+        return userService.getSimpleActiveUserListPage(pageIndex,pageSize,departmentId,request,keyword,cursor,userIds);
+    }
+
     @RequestMapping("/getUserListByRole")
     public HttpRespMsg getUserListByRole(String tableName){
         return userService.getUserListByRole(request,tableName);

+ 8 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/ContractCustom.java

@@ -11,11 +11,11 @@ import lombok.experimental.Accessors;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author Seyason
- * @since 2024-09-23
+ * @since 2024-09-30
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -102,6 +102,12 @@ public class ContractCustom extends Model<ContractCustom> {
     @TableField("currency")
     private String currency;
 
+    /**
+     * 是否固定金额 0否,1是
+     */
+    @TableField("is_amount_fixed")
+    private Boolean isAmountFixed;
+
     /**
      * 合同状态(是否结清):1-履约中,2-履约结束
      */

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/User.java

@@ -10,6 +10,7 @@ import java.io.Serializable;
 import java.util.List;
 
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonInclude;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;

+ 22 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java

@@ -198,4 +198,26 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
     @Update("update project set category=null,category_name=null where id=#{id}")
     void updateProjectCategoryToNull(@Param("id") Integer id);
+
+    List<Map<String, Object>> getOnlyJoinProjectsPage(String id, Integer companyId, Integer pageIndex, Integer pageSize, String infoString);
+
+    Integer getOnlyJoinProjectsTotal(String id, Integer companyId, Integer pageIndex, Integer pageSize, String infoString);
+
+    List<Map<String, Object>> getOnlyJoinProjectsById(String id, Integer companyId, Integer projectId);
+
+    List<Map<String, Object>> getParticipatedProjectPage(String id, Integer companyId, Integer pageIndex, Integer pageSize, String infoString);
+
+    Integer getParticipatedProjectTotal(String id, Integer companyId, Integer pageIndex, Integer pageSize, String infoString);
+
+    List<Map<String, Object>> getParticipatedProjectById(String id, Integer companyId, Integer projectId);
+
+    List<Map<String, Object>> getTimeCostGroupByProjectUserSumTime(Integer companyId, String startDate, String endDate);
+
+    List<Map<String, Object>> getTimeCostProjectUserWorkTime(Integer companyId, String startDate, String endDate);
+
+    List<Map<String, Object>> getCostTimeByUserSum(Integer companyId, String startDate, String endDate);
+
+    List<Map<String, Object>> getCostTimeByUserForDay(Integer companyId, String startDate, String endDate);
+
+    List<Map<String, Object>> getTotalProjectByTime(Integer companyId, String startDate, String endDate);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ContractService.java

@@ -38,4 +38,6 @@ public interface ContractService extends IService<Contract> {
     HttpRespMsg contractFile(HttpServletRequest request, Integer id);
 
     HttpRespMsg deleteContract(HttpServletRequest request, Integer id);
+
+    HttpRespMsg ExportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId);
 }

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ExcelExportService.java

@@ -12,6 +12,7 @@ public interface ExcelExportService {
     public HttpRespMsg exportGeneralExcelByTitleAndList(WxCorpInfo wxCorpInfo, CompanyDingding dingding, String title, List<List<String>> list, String downloadPath) throws Exception;
     public HttpRespMsg exportGeneralExcelByTitleAndList2(WxCorpInfo wxCorpInfo, CompanyDingding dingding, String title, List<List<String>> list, String downloadPath) throws Exception;
     public HttpRespMsg exportMultiSheetGeneralExcelByTitleAndList(WxCorpInfo wxCorpInfo, CompanyDingding dingding,String title, List<List<String>>[] multiSheetList, String downloadPath,String[] sheetsName) throws Exception;
+    public HttpRespMsg exportMultiSheetGeneralExcelByTitleAndListNew(WxCorpInfo wxCorpInfo, CompanyDingding dingding,String title, List<List<String>>[] multiSheetList, String downloadPath,String[] sheetsName) throws Exception;
     public HttpRespMsg exportTranForwx(WxCorpInfo wxCorpInfo, CompanyDingding dingding,String title) throws Exception;
     void testAdd(String jobId);
     HttpRespMsg exportGeneralExcelForExpense(WxCorpInfo wxCorpInfo, CompanyDingding dingding, String fileName, List<List<String>> allList, List<Map> mapList, String path) throws Exception;

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

@@ -310,4 +310,7 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg exportGroupExpendProcessListForUser(String startDate, String endDate, String projectIds, String groupNames,String titleStr, String deptIdStr) throws UnsupportedEncodingException;
 
+    HttpRespMsg getProjectListByPage(Integer pageIndex, Integer pageSize, String infoString, Integer id, Integer forReport, HttpServletRequest request);
+
+    HttpRespMsg exportTimeByProjectAndEmployee(String date, HttpServletRequest request);
 }

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java

@@ -104,4 +104,6 @@ public interface UserService extends IService<User> {
     HttpRespMsg setActiveByIds(String ids, int isActive);
 
     HttpRespMsg deleteUserSalaryById(String id);
+
+    HttpRespMsg getSimpleActiveUserListPage(Integer pageIndex, Integer pageSize, Integer departmentId, HttpServletRequest request, String keyword, String cursor, String userIds) throws Exception;
 }

+ 324 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ContractServiceImpl.java

@@ -86,6 +86,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
     private String path;
     @Autowired
     private ContractTypeSecMapper contractTypeSecMapper;
+    @Autowired
+    private ContractPayCustomizedMapper contractPayCustomizedMapper;
 
     /**
      * 分页查询合同
@@ -837,14 +839,18 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                 if (StringUtils.isNotBlank(taxAmountStr)){
                     customItem.setAmountsNoTax(new BigDecimal(taxAmountStr));
                 }
+                if (row.getCell(19)!=null&&row.getCell(19).getStringCellValue().equals("是")){
+                    customItem.setIsAmountFixed(true);
+                }else {
+                    customItem.setIsAmountFixed(false);
+                }
+                customItem.setCurrency(row.getCell(20)==null?null:row.getCell(20).getStringCellValue());
 
-                customItem.setCurrency(row.getCell(19)==null?null:row.getCell(19).getStringCellValue());
-
-                String s = row.getCell(20) == null ? null : row.getCell(20).getStringCellValue();
+//                String s = row.getCell(21) == null ? null : row.getCell(21).getStringCellValue();
                 /*if (StringUtils.isNotBlank(s)){
                     customItem.setPayedAmount(new BigDecimal(s));
                 }*/
-                String s1 = (row.getCell(21) == null) ? null : row.getCell(21).getStringCellValue();
+//                String s1 = (row.getCell(22) == null) ? null : row.getCell(22).getStringCellValue();
                 /*if (StringUtils.isNotBlank(s1)){
                     if ("预付".equals(s1)) {
                         customItem.setPayWay(1);
@@ -866,7 +872,7 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                 if (StringUtils.isNotBlank(s4)){
                     customItem.setPendingAmounts(new BigDecimal(s4));
                 }*/
-                String status = row.getCell(20)==null?null:row.getCell(20).getStringCellValue();
+                String status = row.getCell(21)==null?null:row.getCell(21).getStringCellValue();
                 if (StringUtils.isNotBlank(status)){
                     if ("履约中".equals(status)) {
                         customItem.setFinishStatus(1);
@@ -874,8 +880,8 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
                         customItem.setFinishStatus(2);
                     }
                 }
-                String remarks = row.getCell(21)==null?null:row.getCell(21).getStringCellValue();
-                customItem.setStampDutyItems(row.getCell(22)==null?null:row.getCell(22).getStringCellValue());
+                String remarks = row.getCell(22)==null?null:row.getCell(22).getStringCellValue();
+                customItem.setStampDutyItems(row.getCell(23)==null?null:row.getCell(23).getStringCellValue());
                 Contract item = new Contract();
                 //检查合同编号是否存在
                 if (StringUtils.isNotBlank(No)){
@@ -1166,4 +1172,315 @@ public class ContractServiceImpl extends ServiceImpl<ContractMapper, Contract> i
         msg.msg = MessageUtils.message("other.deleteScu");
         return msg;
     }
+
+    @Override
+    public HttpRespMsg ExportContractOneToMany(HttpServletRequest request, String number, String name, String typeName, Integer status, String startDate, String endDate, String paymentStartDate, String paymentEndDate, Integer secTypeId) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        User user = userMapper.selectById(request.getHeader("token"));
+        List<SysRichFunction> functionContractList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "导出合同");
+        if(functionContractList.size() <= 0){
+            httpRespMsg.setError(MessageUtils.message("access.operationError"));
+            return httpRespMsg;
+        }
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
+        CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
+        HttpRespMsg contractPage = getContractPage(request, null, null, number, name, typeName, status, startDate, endDate, paymentStartDate, paymentEndDate, secTypeId);
+        HashMap<String, Object> resultDate = (HashMap<String, Object>) contractPage.data;
+        List<ContractPageVO> data = (List<ContractPageVO>)resultDate.get("data");
+        List<String> headList = new ArrayList<String>();
+//        headList.add("合同编号");
+//        headList.add("合同名称");
+//        headList.add("合同开始时间");
+//        headList.add("合同结束时间");
+//        headList.add("合同创建者");
+//        headList.add("合同金额(¥)");
+//        headList.add("合同类型");
+//        headList.add("状态");
+//        headList.add("创建时间");
+//        headList.add("备注");
+
+        ArrayList<List<String>> allList = new ArrayList<>();
+
+        if ( user.getCompanyId() == 4215){
+            headList.add("序号");
+            headList.add("合同名称");
+            headList.add("合同号");
+            headList.add("合同类别");
+            headList.add("二级分类");
+            headList.add("对方单位");
+            headList.add("对方联系人");
+            headList.add("对方联系电话");
+            headList.add("使用部门");
+            headList.add("经费来源");
+            headList.add("合同承办人");
+            headList.add("委托代理人");
+            headList.add("签订日期");
+            headList.add("合同生效日期");
+            headList.add("合同终止日期");
+            headList.add("备案日期");
+            headList.add("合同金额(元)/含税价");
+            headList.add("增值税税率");
+            headList.add("合同金额(元)/不含税价");
+            headList.add("是否固定金额");
+            headList.add("币种");
+            headList.add("合同状态(是否结清)");
+            headList.add("备注");
+            headList.add("印花税税目");
+
+            headList.add("付款日期");
+            headList.add("已付款金额(元)");
+            headList.add("付款类型");
+            headList.add("凭证号");
+            headList.add("待付款金额(元)");
+            allList.add(headList);
+
+            List<Integer> contractIds = data.stream().map(Contract::getId).filter(Objects::nonNull).collect(Collectors.toList());
+            QueryWrapper<ContractPayCustomized> customizedQueryWrapper = new QueryWrapper<>();
+            customizedQueryWrapper.in("contract_id", contractIds).eq("is_payed",1);
+            List<ContractPayCustomized> customizedList = contractPayCustomizedMapper.selectList(customizedQueryWrapper);
+
+            int i=0;
+            for (ContractPageVO contract : data) {
+                i++;
+                List<ContractPayCustomized> payCustomizedList = customizedList.stream().filter(c -> c.getContractId().equals(contract.getId())).collect(Collectors.toList());
+                if (!payCustomizedList.isEmpty()){
+                    for (int j = 0; j < payCustomizedList.size(); j++) {
+                        if (j==0){
+                            ArrayList<String> item = new ArrayList<>();
+                            item.add(i+"");
+                            item.add(contract.getName()== null ? "" : contract.getName());
+                            item.add(contract.getNumber() == null ? "" : contract.getNumber());
+                            item.add(contract.getTypeName() == null ? "" : contract.getTypeName() );
+                            item.add(contract.getSecTypeName() == null ? "" : contract.getSecTypeName() );
+                            ContractCustom customData = contract.getCustomData();
+                            if (customData!=null){
+                                item.add(customData.getCustomerOrg()==null?"":customData.getCustomerOrg());
+                                item.add(customData.getCustomerContact()==null?"":customData.getCustomerContact());
+                                item.add(customData.getCustomerPhone()==null?"":customData.getCustomerPhone());
+                                item.add(customData.getUseDepartment()==null?"":customData.getUseDepartment());
+                                item.add(customData.getFundsSource()==null?"":customData.getFundsSource());
+                                item.add(customData.getUndertaker()==null?"":customData.getUndertaker());
+                                item.add(customData.getAgent()==null?"":customData.getAgent());
+                                item.add(customData.getSignDate()==null?"":customData.getSignDate());
+                            }else {
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                            }
+                            item.add(contract.getStartDate() == null ? "" : contract.getStartDate() + "");
+                            item.add(contract.getEndDate() == null ? "" : contract.getEndDate() + "");
+                            if (customData!=null) {
+                                item.add(customData.getFilingsDate() == null ? "" : customData.getFilingsDate());
+                            }else {
+                                item.add("");
+                            }
+                            item.add(contract.getAmounts() == null ? "" : contract.getAmounts()+"" );
+                            if (customData!=null) {
+                                item.add(customData.getTaxRate() == null ? "" : customData.getTaxRate()+"");
+                                item.add(customData.getAmountsNoTax() == null ? "" : customData.getAmountsNoTax()+"");
+                                if (customData.getIsAmountFixed() == null){
+                                    item.add("");
+                                }else if (customData.getIsAmountFixed().equals(false)){
+                                    item.add("否");
+                                }else if (customData.getIsAmountFixed().equals(true)){
+                                    item.add("是");
+                                }
+                                item.add(customData.getCurrency() == null ? "" : customData.getCurrency());
+
+                                if (customData.getFinishStatus() == null){
+                                    item.add("");
+                                }else if ((customData.getFinishStatus()+"").equals("1")){
+                                    item.add("履约中");
+                                }else if ((customData.getFinishStatus()+"").equals("2")){
+                                    item.add("履约结束");
+                                }
+                            }else {
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                                item.add("");
+                            }
+                            item.add(contract.getRemarks() == null ? "" : contract.getRemarks()+"" );
+                            if (customData!=null) {
+                                item.add(customData.getStampDutyItems() == null ? "" : customData.getStampDutyItems());
+                            }else {
+                                item.add("");
+                            }
+
+                            item.add(payCustomizedList.get(j).getPayDate()==null?"":payCustomizedList.get(j).getPayDate());
+                            item.add(payCustomizedList.get(j).getPayedAmount()==null?"":payCustomizedList.get(j).getPayedAmount()+"");
+                            if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==1){
+                                item.add("预付");
+                            } else if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==2) {
+                                item.add("报账");
+                            }else {
+                                item.add("");
+                            }
+                            item.add(payCustomizedList.get(j).getBillNumber()==null?"":payCustomizedList.get(j).getBillNumber());
+                            item.add(payCustomizedList.get(j).getPendingAmounts()==null?"":payCustomizedList.get(j).getPendingAmounts()+"");
+                            allList.add(item);
+                        }
+                        else {
+                            ArrayList<String> item = new ArrayList<>();
+                            for (int i1 = 0; i1 < 24; i1++) {
+                                item.add("" );
+                            }
+
+                            item.add(payCustomizedList.get(j).getPayDate()==null?"":payCustomizedList.get(j).getPayDate());
+                            item.add(payCustomizedList.get(j).getPayedAmount()==null?"":payCustomizedList.get(j).getPayedAmount()+"");
+                            if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==1){
+                                item.add("预付");
+                            } else if (payCustomizedList.get(j).getPayWay()!=null&&payCustomizedList.get(j).getPayWay()==2) {
+                                item.add("报账");
+                            }else {
+                                item.add("");
+                            }
+                            item.add(payCustomizedList.get(j).getBillNumber()==null?"":payCustomizedList.get(j).getBillNumber());
+                            item.add(payCustomizedList.get(j).getPendingAmounts()==null?"":payCustomizedList.get(j).getPendingAmounts()+"");
+                            allList.add(item);
+                        }
+                    }
+                }
+                else {
+                    ArrayList<String> item = new ArrayList<>();
+                    item.add(i+"");
+                    item.add(contract.getName()== null ? "" : contract.getName());
+                    item.add(contract.getNumber() == null ? "" : contract.getNumber());
+                    item.add(contract.getTypeName() == null ? "" : contract.getTypeName() );
+                    item.add(contract.getSecTypeName() == null ? "" : contract.getSecTypeName() );
+                    ContractCustom customData = contract.getCustomData();
+                    if (customData!=null){
+                        item.add(customData.getCustomerOrg()==null?"":customData.getCustomerOrg());
+                        item.add(customData.getCustomerContact()==null?"":customData.getCustomerContact());
+                        item.add(customData.getCustomerPhone()==null?"":customData.getCustomerPhone());
+                        item.add(customData.getUseDepartment()==null?"":customData.getUseDepartment());
+                        item.add(customData.getFundsSource()==null?"":customData.getFundsSource());
+                        item.add(customData.getUndertaker()==null?"":customData.getUndertaker());
+                        item.add(customData.getAgent()==null?"":customData.getAgent());
+                        item.add(customData.getSignDate()==null?"":customData.getSignDate());
+                    }else {
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                    }
+                    item.add(contract.getStartDate() == null ? "" : contract.getStartDate() + "");
+                    item.add(contract.getEndDate() == null ? "" : contract.getEndDate() + "");
+                    if (customData!=null) {
+                        item.add(customData.getFilingsDate() == null ? "" : customData.getFilingsDate());
+                    }else {
+                        item.add("");
+                    }
+                    item.add(contract.getAmounts() == null ? "" : contract.getAmounts()+"" );
+                    if (customData!=null) {
+                        item.add(customData.getTaxRate() == null ? "" : customData.getTaxRate()+"");
+                        item.add(customData.getAmountsNoTax() == null ? "" : customData.getAmountsNoTax()+"");
+                        if (customData.getIsAmountFixed() == null){
+                            item.add("");
+                        }else if (customData.getIsAmountFixed().equals(false)){
+                            item.add("否");
+                        }else if (customData.getIsAmountFixed().equals(true)){
+                            item.add("是");
+                        }
+                        item.add(customData.getCurrency() == null ? "" : customData.getCurrency());
+
+                        if (customData.getFinishStatus() == null){
+                            item.add("");
+                        }else if ((customData.getFinishStatus()+"").equals("1")){
+                            item.add("履约中");
+                        }else if ((customData.getFinishStatus()+"").equals("2")){
+                            item.add("履约结束");
+                        }
+                    }else {
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                        item.add("");
+                    }
+                    item.add(contract.getRemarks() == null ? "" : contract.getRemarks()+"" );
+                    if (customData!=null) {
+                        item.add(customData.getStampDutyItems() == null ? "" : customData.getStampDutyItems());
+                    }else {
+                        item.add("");
+                    }
+
+                    item.add("");
+                    item.add("");
+                    item.add("");
+                    item.add("");
+                    item.add("");
+                    allList.add(item);
+
+                }
+            }
+        }
+        else {
+            headList.add(MessageUtils.message("entry.contractNo"));
+            headList.add(MessageUtils.message("contract.name"));
+            headList.add(MessageUtils.message("Contract.startDate"));
+            headList.add(MessageUtils.message("Contract.endDate"));
+            headList.add(MessageUtils.message("Contract.creatorName"));
+            headList.add(MessageUtils.message("entry.contract"));
+            headList.add(MessageUtils.message("contract.type"));
+            headList.add(MessageUtils.message("leave.status"));
+            headList.add(MessageUtils.message("excel.creatTime"));
+            headList.add(MessageUtils.message("leave.task"));
+            allList.add(headList);
+            for (ContractPageVO contract : data) {
+                ArrayList<String> item = new ArrayList<>();
+                item.add(contract.getNumber() == null ? "" : contract.getNumber());
+                item.add(contract.getName());
+                item.add(contract.getStartDate() == null ? "" : contract.getStartDate() + "");
+                item.add(contract.getEndDate() == null ? "" : contract.getEndDate() + "");
+                if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
+                    contract.setCreatorName("$userName=" + contract.getCreatorWxCorpId() + "$");
+                } else if (dingding != null && dingding.getContactNeedTranslate() == 1) {
+                    contract.setCreatorName("$userName=" + contract.getCreatorName() + "$");
+                } else {
+                    contract.setCreatorName(contract.getCreatorName());
+                }
+                item.add(contract.getCreatorName());
+                BigDecimal bigDecimal = null;
+                if (contract.getAmounts() != null) {
+                    bigDecimal = new BigDecimal(contract.getAmounts().toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
+                }
+                item.add(contract.getAmounts() == null ? "" : bigDecimal + "");
+                item.add(contract.getTypeName());
+                switch (contract.getStatus()) {
+                    case 0:
+                        item.add("审核通过");
+                        break;
+                    case 1:
+                        item.add("待审核");
+                        break;
+                    case 2:
+                        item.add("驳回");
+                        break;
+                    default:
+                        item.add("_");
+                }
+                item.add(contract.getIndate().toString());
+                item.add(contract.getRemarks() == null ? "" : contract.getRemarks());
+                allList.add(item);
+            }
+        }
+        String fileName = MessageUtils.message("contract.export")+System.currentTimeMillis();
+        try {
+            return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName,allList, path);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return httpRespMsg;
+    }
 }

+ 77 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ExcelExportServiceImpl.java

@@ -405,6 +405,83 @@ public class ExcelExportServiceImpl implements ExcelExportService {
         return httpRespMsg;
     }
 
+    @Override
+    public HttpRespMsg exportMultiSheetGeneralExcelByTitleAndListNew(WxCorpInfo wxCorpInfo, CompanyDingding dingding, String title, List<List<String>>[] multiSheetList, String downloadPath, String[] sheetsName) throws Exception {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String resp = ExcelUtil.exportMultiSheetGeneralExcelByTitleAndListNew(title,multiSheetList, downloadPath,sheetsName);
+        if (title.contains("/")) {
+            //文件名不能含有路径,得替换掉
+            title = title.replace("/", "@");
+        }
+        if (title.contains("\\")) {
+            //文件名不能含有路径,得替换掉
+            title = title.replace("\\", "@");
+        }
+        String fileUrlSuffix = title + ".xlsx";
+        if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
+            String mediaId = wxCorpInfoService.getTranslationMediaId(fileUrlSuffix);
+            String jobId = wxCorpInfoService.syncTranslation(wxCorpInfo.getCorpid(),mediaId,fileUrlSuffix, null);
+            int i = 0;
+            String syncTranslationResult = null;
+            /**
+             * 异步上传转译文件的任务完成时会触发回调,在WeiXinCorpController中的commonDevCallbackPost实现了对回调的处理,存储到corpwxJobResult表中
+             * 此处轮询查询本地数据库,检测到有任务的回调数据时继续执行查询操作
+             */
+            while (i < 10) {
+                Thread.sleep(300);
+                CorpwxJobResult corpwxJobResult = corpwxJobCenter.get(jobId);
+                if (corpwxJobResult != null) {
+                    if (corpwxJobResult.getErrCode() == 0) {
+                        syncTranslationResult = wxCorpInfoService.getSyncTranslationResult(jobId);
+                        corpwxJobCenter.remove(jobId);
+                    } else {
+                        httpRespMsg.setError(corpwxJobResult.getErrMsg());
+                        return httpRespMsg;
+                    }
+                    break;
+                }
+                i++;
+            }
+            if (syncTranslationResult != null) {
+                httpRespMsg.data = syncTranslationResult;
+            } else {
+                //httpRespMsg.setError("处理超时...");
+                httpRespMsg.setError(MessageUtils.message("request.outTime"));
+            }
+        }else if(dingding != null && dingding.getContactNeedTranslate() == 1){
+            User user = userMapper.selectById(request.getHeader("token"));
+            String mediaId = dingDingService.getTranslationMediaId(fileUrlSuffix,dingding);
+            String jobId = dingDingService.syncTranslation(mediaId,fileUrlSuffix,user.getDingdingUnionid(), dingding);
+            int i = 0;
+            String syncTranslationResult = null;
+            /**
+             * 异步上传转译文件的任务完成时会触发回调,在DingDingController中的callback实现了对回调的处理,存储到corpddJobCenter缓存中
+             * 此处轮询查询本地数据库,检测到有任务的回调数据时继续执行查询操作
+             */
+            while (i < 10) {
+                Thread.sleep(300);
+                Integer status = corpddJobCenter.get(jobId);
+                if (status != null) {
+                    if (status == 1) {
+                        syncTranslationResult = dingDingService.getSyncTranslationResult(jobId,dingding);
+                        corpddJobCenter.remove(jobId);
+                    }
+                    break;
+                }
+                i++;
+            }
+            if (syncTranslationResult != null) {
+                httpRespMsg.data = syncTranslationResult;
+            } else {
+                //httpRespMsg.setError("处理超时...");
+                httpRespMsg.setError(MessageUtils.message("request.outTime"));
+            }
+        }else {
+            httpRespMsg.data = resp;
+        }
+        return httpRespMsg;
+    }
+
     public  HttpRespMsg exportTranForwx(WxCorpInfo wxCorpInfo, CompanyDingding dingding,String title) throws Exception {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         if (title.contains("/")) {

+ 516 - 90
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.google.common.collect.ImmutableMap;
 import com.management.platform.entity.*;
 import com.management.platform.entity.Task;
 import com.management.platform.entity.vo.*;
@@ -254,6 +255,431 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     private String path;
     @Value("${configEnv.isDev}")
     public boolean isDev;
+
+    @Override
+    public HttpRespMsg getProjectListByPage(Integer pageIndex, Integer pageSize, String infoString, Integer id, Integer forReport, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        try {
+            User user = userMapper.selectById(request.getHeader("Token"));
+            if (forReport == 1) {
+                if (!sysFunctionService.hasPriviledge(user.getRoleId(), "可填报全部项目")) {
+                    //只能看本人参与的项目
+                    pageIndex=(pageIndex-1)*pageSize;
+                    List<Map<String, Object>> data = projectMapper.getOnlyJoinProjectsPage(user.getId(), user.getCompanyId(),pageIndex,pageSize,infoString);
+                    Integer total = projectMapper.getOnlyJoinProjectsTotal(user.getId(), user.getCompanyId(),pageIndex,pageSize,infoString);
+                    HashMap<String, Object> resultMap = new HashMap<>();
+                    resultMap.put("total", total);
+                    if (id!=null){
+                        List<Map<String, Object>> dataByID = projectMapper.getOnlyJoinProjectsById(user.getId(), user.getCompanyId(),id);
+                        data.addAll(0,dataByID);
+                    }
+                    resultMap.put("data", data);
+
+                    httpRespMsg.data = resultMap;
+
+                } else {
+                    //有权限的填报全部的进行中项目
+                    QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+                    if (!StringUtils.isEmpty(infoString)){
+                        queryWrapper.eq("company_id", user.getCompanyId())
+                                .eq("status", 1)
+                                .and(i->i.like("project_name",infoString).or()
+                                        .like("project_code",infoString))
+                                .orderByDesc("is_public")
+                                .orderByAsc("id")
+                                .select("id", "project_code", "project_name");
+                    }else {
+                        queryWrapper.eq("company_id", user.getCompanyId())
+                                .eq("status", 1)
+                                .orderByDesc("is_public")
+                                .orderByAsc("id")
+                                .select("id", "project_code", "project_name");
+                    }
+
+
+                    Page<Project> projectPage = new Page<>(pageIndex, pageSize);
+                    IPage<Project> projectIPage = projectMapper.selectPage(projectPage, queryWrapper);
+
+                    HashMap<String, Object> resultMap = new HashMap<>();
+                    resultMap.put("total", projectIPage.getTotal());
+                    List<Project> projectList = projectIPage.getRecords();
+                    if (id!=null){
+                        Project project = projectMapper.selectOne(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()).eq("status", 1).eq("id", id).select("id", "project_code", "project_name"));
+                        if (project!=null){
+                            projectList.add(0,project);
+                        }
+                    }
+                    resultMap.put("data", projectList);
+                    httpRespMsg.data = resultMap;
+                }
+            } else {
+                if (!sysFunctionService.hasPriviledge(user.getRoleId(), "查看全部项目")) {
+                    //只能看本人相关的项目
+                    pageIndex=(pageIndex-1)*pageSize;
+                    List<Map<String, Object>> data = projectMapper.getParticipatedProjectPage(user.getId(), user.getCompanyId(),pageIndex,pageSize,infoString);
+                    Integer total = projectMapper.getParticipatedProjectTotal(user.getId(), user.getCompanyId(),pageIndex,pageSize,infoString);
+                    HashMap<String, Object> resultMap = new HashMap<>();
+                    resultMap.put("total", total);
+                    if (id!=null){
+                        List<Map<String, Object>> dataByID = projectMapper.getParticipatedProjectById(user.getId(), user.getCompanyId(),id);
+                        data.addAll(0,dataByID);
+                    }
+                    resultMap.put("data", data);
+                    httpRespMsg.data = resultMap;
+                } else {
+                    //有权限的看全部的
+                    httpRespMsg.data = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()).orderByDesc("is_public").orderByAsc("id"));
+                    QueryWrapper<Project> queryWrapper = new QueryWrapper<>();
+                    if (!StringUtils.isEmpty(infoString)){
+                        queryWrapper.eq("company_id", user.getCompanyId())
+                                .and(i->i.like("project_name",infoString).or().like("project_code",infoString))
+                                .orderByDesc("is_public").orderByAsc("id")
+                                .select("id", "project_code", "project_name");
+                    }else {
+                        queryWrapper.eq("company_id", user.getCompanyId())
+                                .orderByDesc("is_public").orderByAsc("id")
+                                .select("id", "project_code", "project_name");
+                    }
+                    Page<Project> projectPage =new Page<>(pageIndex, pageSize);
+                    IPage<Project> projectIPage = projectMapper.selectPage(projectPage, queryWrapper);
+                    HashMap<String, Object> resultMap = new HashMap<>();
+                    resultMap.put("total", projectIPage.getTotal());
+                    List<Project> projectList = projectIPage.getRecords();
+                    if (id!=null){
+                        Project project = projectMapper.selectOne(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()).eq("id", id).select("id", "project_code", "project_name"));
+                        if (project!=null){
+                            projectList.add(0,project);
+                        }
+                    }
+                    resultMap.put("data", projectList);
+                    httpRespMsg.data = resultMap;
+                }
+            }
+        } catch (NullPointerException e) {
+            //httpRespMsg.setError("验证失败");
+            httpRespMsg.setError(MessageUtils.message("access.verificationError"));
+            return httpRespMsg;
+        }
+        return httpRespMsg;
+    }
+
+    @Override
+    public HttpRespMsg exportTimeByProjectAndEmployee(String date, HttpServletRequest request) {
+        HttpRespMsg httpRespMsg = new HttpRespMsg();
+        String[] strings = date.split("-");
+        int year = Integer.parseInt(strings[0]);
+        int month = Integer.parseInt(strings[1]);
+        YearMonth yearMonth = YearMonth.of((year), month);
+        int daysInMonth = yearMonth.lengthOfMonth();
+
+        // 获取该月份的第一天
+        String startDate = String.format("%04d-%02d-01", year, month);
+        // 获取下个月的第一天
+        LocalDate lastDate = LocalDate.of(year, month, 1).plusDays(LocalDate.of(year, month, 1).lengthOfMonth() - 1);
+        String endDate = String.format("%04d-%02d-%02d", year, month, lastDate.getDayOfMonth());
+        try {
+            User targetUser = userMapper.selectById(request.getHeader("Token"));
+            Integer companyId = targetUser.getCompanyId();
+            WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
+            CompanyDingding dingding = companyDingdingMapper.selectOne(new LambdaQueryWrapper<CompanyDingding>().eq(CompanyDingding::getCompanyId, companyId));
+
+            //当前用户管理部门
+            List<Department> allDepartmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", targetUser.getCompanyId()));
+            Department[] deptArray = allDepartmentList.toArray(new Department[0]);
+
+            List<Map<String, Object>> list = new ArrayList<>();
+            List<List<String>> allList = null;
+            List<String> sumRow = null;
+
+            List<String> headList = new ArrayList<String>();
+            //headList.add("项目编号");
+            headList.add(MessageUtils.message("entry.projectId"));
+            //headList.add("项目名称");
+            headList.add(MessageUtils.message("entry.projectName"));
+            //headList.add("项目分类");
+            headList.add(MessageUtils.message("entry.projectType"));
+            //headList.add("人员");
+            headList.add(MessageUtils.message("entry.personnel"));
+            //headList.add("部门");
+            headList.add(MessageUtils.message("excel.department"));
+            headList.add("月度总工时(h)");
+            for (int i = 1; i <= daysInMonth; i++) {
+                headList.add(i+"日");
+            }
+
+            allList = new ArrayList<>();
+            allList.add(headList);
+
+            //查询到的前六个字段
+            List<Map<String, Object>> dataList = projectMapper.getTimeCostGroupByProjectUserSumTime(companyId,startDate, endDate);
+            for (Map<String, Object> membMap : dataList) {
+                Department dept = null;
+                Department targetDept = new Department();
+                if (membMap.get("deptId") != null) {
+                    targetDept.setDepartmentId(Integer.valueOf(membMap.get("deptId").toString()));
+                    int index = Arrays.binarySearch(deptArray, targetDept, Comparator.comparing(Department::getDepartmentId));
+                    if (index >= 0) {
+                        dept = deptArray[index];
+                    }
+                }
+                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    if(membMap.get("departmentName").equals("未分配")){
+                        membMap.put("departmentNameComplete","未分配");
+                    }else {
+                        membMap.put("departmentNameComplete",departmentService.exportWxDepartment(dept,allDepartmentList));
+                    }
+                }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
+                    if(membMap.get("departmentName").equals("未分配")){
+                        membMap.put("departmentNameComplete","未分配");
+                    }else {
+                        membMap.put("departmentNameComplete",departmentService.exportDdDepartment(dept,allDepartmentList));
+                    }
+                }else {
+                    membMap.put("departmentNameComplete",departmentService.getSupDepartment(dept,allDepartmentList));
+                }
+            }
+
+            //抽取出来项目编号,项目名称
+            List<Map<String, Object>> uniqueDataList = dataList.stream()
+                    .distinct() // 确保唯一性
+                    .map(item -> ImmutableMap.of(
+                            "id", item.get("id"),
+                            "projectCode", item.get("projectCode"),
+                            "projectName", item.get("projectName")
+                    ))
+                    .collect(Collectors.toList());
+
+            //查询项目对应人员填写的每次工时时长
+            List<Map<String, Object>> dataDetailList = projectMapper.getTimeCostProjectUserWorkTime(companyId,startDate, endDate);
+
+
+            for (Map<String, Object> map : uniqueDataList) {
+                //每个项目的统计
+                List<String> rowList = new ArrayList<String>();
+                rowList.add(map.get("projectCode")==null?"":map.get("projectCode").toString());
+                rowList.add(map.get("projectName")==null?"":map.get("projectName").toString());
+                rowList.add("");//项目分类
+                rowList.add("");//人员
+                rowList.add("");//部门
+                double sumCost = dataList.stream().filter(d -> d.get("id").toString().equals(map.get("id").toString()))
+                        .mapToDouble(d -> Double.parseDouble(d.get("cost").toString())) // 映射到 cost
+                        .sum();// 计算总和
+                rowList.add(sumCost+"");//月度总工时
+                for (int i = 1; i <= daysInMonth; i++) {
+                    int finalI = i;
+                    double sumDay=0;
+                    sumDay = dataDetailList.stream().filter(d -> d.get("id").toString().equals(map.get("id").toString())&&d.get("dayOnly")!=null && d.get("dayOnly").toString().equals("" + finalI))
+                            .mapToDouble(d -> Double.parseDouble(d.get("cost").toString())) // 映射到 cost
+                            .sum();
+                    if (sumDay==0){
+                        rowList.add("");//每天填报总工时
+                    }else {
+                        rowList.add(sumDay+"");//每天的该项目的填报总工时
+                    }
+
+                }
+                allList.add(rowList);
+
+                //项目下每个员工的记录
+                List<Map<String, Object>> userDataList = dataList.stream().filter(d -> d.get("id").toString().equals(map.get("id").toString())).collect(Collectors.toList());
+                for (Map<String, Object> objectMap : userDataList) {
+                    List<String> rowUserList = new ArrayList<String>();
+                    rowUserList.add("");//项目编号
+                    rowUserList.add("");//项目名称
+                    rowUserList.add(objectMap.get("categoryName")==null?"":objectMap.get("categoryName").toString());
+                    String name = objectMap.get("name")==null?"":objectMap.get("name").toString();
+                    if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
+                        rowUserList.add("$userName="+name+"$");
+                    } else {
+                        rowUserList.add(name);
+                    }
+
+                    rowUserList.add(objectMap.get("departmentNameComplete")==null?"":objectMap.get("departmentNameComplete").toString());
+                    rowUserList.add(objectMap.get("cost")==null?"":objectMap.get("cost").toString());
+                    for (int i = 1; i <= daysInMonth; i++) {
+                        int finalI = i;
+                        double sumDay=0;
+                        sumDay = dataDetailList.stream().filter(
+                                        d -> d.get("id").toString().equals(objectMap.get("id").toString())
+                                                &&d.get("dayOnly")!=null
+                                                && d.get("dayOnly").toString().equals("" + finalI)
+                                                && d.get("userId").toString().equals(objectMap.get("userId").toString())
+                                )
+                                .mapToDouble(d -> Double.parseDouble(d.get("cost").toString())) // 映射到 cost
+                                .sum();
+                        if (sumDay==0){
+                            rowUserList.add("");//每天填报总工时
+                        }else {
+                            rowUserList.add(sumDay+"");//每天的该项目的填报总工时
+                        }
+
+                    }
+                    allList.add(rowUserList);
+                }
+            }
+            List<String> rowEndList = new ArrayList<String>();
+            rowEndList.add("总计");
+            rowEndList.add("");
+            rowEndList.add("");
+            rowEndList.add("");
+            rowEndList.add("");
+            double totalCost = dataList.stream()
+                    .mapToDouble(d -> Double.parseDouble(d.get("cost").toString())) // 映射到 cost
+                    .sum();
+            rowEndList.add(""+totalCost);//月度总工时
+            for (int i = 1; i <= daysInMonth; i++) {
+                int finalI = i;
+                double sumDay=0;
+                sumDay = dataDetailList.stream().filter(
+                                d -> d.get("dayOnly")!=null&& d.get("dayOnly").toString().equals("" + finalI)
+                        )
+                        .mapToDouble(d -> Double.parseDouble(d.get("cost").toString())) // 映射到 cost
+                        .sum();
+                if (sumDay==0){
+                    rowEndList.add("");//每天填报总工时
+                }else {
+                    rowEndList.add(sumDay+"");//每天填报总工时
+                }
+
+            }
+            allList.add(rowEndList);
+
+
+            List<Map<String, Object>> costTimeByUser=projectMapper.getCostTimeByUserSum(companyId,startDate, endDate);
+            List<Map<String, Object>> costTimeByUserForDay=projectMapper.getCostTimeByUserForDay(companyId,startDate, endDate);
+            List<Map<String, Object>> allProjectNew=projectMapper.getTotalProjectByTime(companyId,startDate, endDate);
+            for (Map<String, Object> membMap : costTimeByUser) {
+                Department dept = null;
+                Department targetDept = new Department();
+                if (membMap.get("deptId") != null) {
+                    targetDept.setDepartmentId(Integer.valueOf(membMap.get("deptId").toString()));
+                    int index = Arrays.binarySearch(deptArray, targetDept, Comparator.comparing(Department::getDepartmentId));
+                    if (index >= 0) {
+                        dept = deptArray[index];
+                    }
+                }
+                if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                    if(membMap.get("departmentName").equals("未分配")){
+                        membMap.put("departmentNameComplete","未分配");
+                    }else {
+                        membMap.put("departmentNameComplete",departmentService.exportWxDepartment(dept,allDepartmentList));
+                    }
+                }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
+                    if(membMap.get("departmentName").equals("未分配")){
+                        membMap.put("departmentNameComplete","未分配");
+                    }else {
+                        membMap.put("departmentNameComplete",departmentService.exportDdDepartment(dept,allDepartmentList));
+                    }
+                }else {
+                    membMap.put("departmentNameComplete",departmentService.getSupDepartment(dept,allDepartmentList));
+                }
+            }
+
+            List<List<String>> secondList = new ArrayList<>();
+            List<String> headsecondList = new ArrayList<String>();
+            headsecondList.add("工号");
+            headsecondList.add("姓名");
+            headsecondList.add("部门");
+            headsecondList.add("月度总工时(h)");
+            headsecondList.add(month+"月");
+            for (int i = 2; i <= daysInMonth; i++) {
+                headsecondList.add("");
+            }
+            headsecondList.add("项目工时分配");
+            if (!allProjectNew.isEmpty()){
+                for (int i = 1; i <= allProjectNew.size()-1; i++) {
+                    headsecondList.add("");
+                }
+            }
+            secondList.add(headsecondList);
+
+            List<String> headsecondList_new = new ArrayList<String>();
+            headsecondList_new.add("");
+            headsecondList_new.add("");
+            headsecondList_new.add("");
+            headsecondList_new.add("");
+            for (int i = 1; i <= daysInMonth; i++) {
+                headsecondList_new.add(i+"日");
+            }
+            if (!allProjectNew.isEmpty()){
+                for (Map<String, Object> map : allProjectNew) {
+                    headsecondList_new.add(map.get("projectName")==null?"":map.get("projectName").toString());
+                }
+            }else {
+                headsecondList_new.add("");
+            }
+            secondList.add(headsecondList_new);
+
+            if (!costTimeByUser.isEmpty()){
+                for (Map<String, Object> map : costTimeByUser) {
+                    List<String> row = new ArrayList<String>();
+                    row.add(map.get("jobNumber")==null?"":map.get("jobNumber").toString());
+                    if (wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1) {
+                        row.add("$userName="+map.get("name").toString()+"$");
+                    } else {
+                        row.add(map.get("name")==null?"":map.get("name").toString());
+                    }
+                    row.add(map.get("departmentNameComplete")==null?"":map.get("departmentNameComplete").toString());
+                    row.add(map.get("cost")==null?"":map.get("cost").toString());
+                    for (int i = 1; i <=daysInMonth; i++) {
+                        double sum=0;
+                        int finalI = i;
+                        sum = costTimeByUserForDay.stream().filter(c -> c.get("userId").toString().equals(map.get("userId").toString())
+                                        && c.get("dayOnly") != null && c.get("dayOnly").toString().equals(finalI + ""))
+                                .mapToDouble(d -> Double.parseDouble(d.get("cost").toString()))
+                                .sum();
+                        if (sum==0){
+                            row.add("");
+                        }else {
+                            row.add(sum+"");
+                        }
+                    }
+                    if (!allProjectNew.isEmpty()){
+                        for (Map<String, Object> objectMap : allProjectNew) {
+                            double sum=0;
+                            sum = costTimeByUserForDay.stream().filter(c -> c.get("projectId").toString().equals(objectMap.get("projectId").toString())
+                                            && c.get("userId").toString().equals(map.get("userId").toString()))
+                                    .mapToDouble(d -> Double.parseDouble(d.get("cost").toString()))
+                                    .sum();
+                            if (sum==0){
+                                row.add("");
+                            }else {
+                                row.add(sum+"");
+                            }
+                        }
+                    }else {
+                        row.add("");
+                    }
+
+                    secondList.add(row);
+                }
+            }
+
+            List[] totalList = new ArrayList[2];
+            totalList[0] = allList;
+            totalList[1] = secondList;
+
+            String[] sheetNames = new String[2];
+            sheetNames[0] = "项目统计表";
+            sheetNames[1] = "人员统计表";
+
+
+
+//            return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,"月度工时统计表" , allList, path);
+//            return excelExportService.exportMultiSheetGeneralExcelByTitleAndList(wxCorpInfo,dingding,"月度工时统计表" , totalList, path,sheetNames);
+            return excelExportService.exportMultiSheetGeneralExcelByTitleAndListNew(wxCorpInfo,dingding,"月度工时统计表" , totalList, path,sheetNames);
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+            //httpRespMsg.setError("验证失败");
+            httpRespMsg.setError(MessageUtils.message("access.verificationError"));
+            return httpRespMsg;
+        } catch (Exception exception) {
+            exception.printStackTrace();
+            httpRespMsg.setError(exception.getMessage());
+        }
+        return httpRespMsg;
+    }
+
     //获取项目列表
     @Override
     public HttpRespMsg getProjectList(Integer forReport, String userId, HttpServletRequest request) {
@@ -626,10 +1052,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     projectVO.setProviderInfoList(mapList);
                 }
                 if(companyId==936){
-                        Optional<ProjectSeparate> first1 = projectSeparateList.stream().filter(ps -> ps.getId().equals(project.getId())).findFirst();
-                        if(first1.isPresent()){
-                            projectVO.setProjectSeparate(first1.get());
-                        }
+                    Optional<ProjectSeparate> first1 = projectSeparateList.stream().filter(ps -> ps.getId().equals(project.getId())).findFirst();
+                    if(first1.isPresent()){
+                        projectVO.setProjectSeparate(first1.get());
+                    }
                 }
                 //工程专业版:计算当前项目的总进度
                 if (company.getPackageEngineering() == 1) {
@@ -1719,7 +2145,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     //导出查询者所在公司每个项目的工时成本,包括项目人员明细统计
     @Override
     public HttpRespMsg exportTimeCost(Integer withMainProject, String exportContent,String startDate, String endDate,Integer projectId, String userIds,
-                                        Boolean projectSum,Integer type,Integer deptId, Integer stateKey, Integer withPercent,Integer projectCategoryId, HttpServletRequest request) {
+                                      Boolean projectSum,Integer type,Integer deptId, Integer stateKey, Integer withPercent,Integer projectCategoryId, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
             User targetUser = userMapper.selectById(request.getHeader("Token"));
@@ -2379,7 +2805,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             ProjectSeparate projectSeparate = projectSeparateMapper.selectById(id);
             project.setProjectSeparate(projectSeparate);
         }
-		//判断当前用户是否是这个项目所属BU的直接或者上级部门负责人(主要或其他负责人)
+        //判断当前用户是否是这个项目所属BU的直接或者上级部门负责人(主要或其他负责人)
         String deptCascade = project.getDeptCascade();
         if (!StringUtils.isEmpty(deptCascade)) {
             if (user.getManageDeptId() > 0) {
@@ -2404,7 +2830,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 }
             }
         }
-		List<ProjectCustom> proCustomList = projectCustomMapper.selectList(new QueryWrapper<ProjectCustom>().eq("company_id", companyId));
+        List<ProjectCustom> proCustomList = projectCustomMapper.selectList(new QueryWrapper<ProjectCustom>().eq("company_id", companyId));
         //按顺序存储项目自定义字段 对应plate
         HashMap map=new HashMap();
         for(int i=0;i<proCustomList.size();i++){
@@ -2463,7 +2889,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             }
         }
         project.setPlateMap(map);
-		HttpRespMsg msg = new HttpRespMsg();
+        HttpRespMsg msg = new HttpRespMsg();
         msg.data = project;
         return msg;
     }
@@ -2485,11 +2911,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             project.setEstimatedWorkTime(format);
             //todo:计算剩余工时
             List<Report> reportList;
-                if(project.getManDayStartDate()!=null){
-                    reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).gt("create_date",project.getManDayStartDate()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
-                }else {
-                    reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
-                }
+            if(project.getManDayStartDate()!=null){
+                reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).gt("create_date",project.getManDayStartDate()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
+            }else {
+                reportList  = reportMapper.selectList(new QueryWrapper<Report>().eq("project_id", project.getId()).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
+            }
             //已发送工时
             double sum = reportList.stream().mapToDouble(Report::getWorkingTime).sum();
             bigDecimal=bigDecimal.subtract(new BigDecimal(sum));
@@ -3656,8 +4082,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     parent.text=department.getDepartmentName();
                     parent.type="";
                     if(department.getSuperiorId()!=null){
-                       parent.parent=String.valueOf(department.getSuperiorId());
-                       parent.type="milestone";
+                        parent.parent=String.valueOf(department.getSuperiorId());
+                        parent.type="milestone";
                     }
                     Set set=new HashSet();
                     if(set.add(parent.id)){
@@ -4052,8 +4478,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         List<Integer> inchagerIds=null;
         if(functionAllList.size()==0){
             if(functionInchargeList.size()>0){
-                 record = projectMapper.selectWithStage(companyId, null, null, null,user.getId(),startDate,endDate);
-                 allStageCostList = projectMapper.selectStageSum(projectIds,projectId,user.getId(),startDate,endDate);
+                record = projectMapper.selectWithStage(companyId, null, null, null,user.getId(),startDate,endDate);
+                allStageCostList = projectMapper.selectStageSum(projectIds,projectId,user.getId(),startDate,endDate);
             }
         }
         //获取全部的列
@@ -5782,7 +6208,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                 case "全部":
                                 case "whole":
                                     project.setStatus(0);
-                                break;
+                                    break;
                                 case "进行中":
                                 case "on going":
                                     project.setStatus(1);
@@ -5958,18 +6384,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             //兼容中英文逗号
                             String mainName = mainNameCell.getStringCellValue();
                             if (mainName != null) {
-                                    if (!StringUtils.isEmpty(mainName)) {
-                                        Optional<ProjectMain> first = projectMainList.stream().filter(pm -> pm.getName().equals(mainName)).findFirst();
-                                        if(first.isPresent()){
-                                            project.setProjectMainId(first.get().getId());
-                                            project.setCategory(first.get().getCategoryId());
-                                            project.setCategoryName(first.get().getCategoryName());
-                                        }else {
-                                            //msg.setError("主项目["+mainName+"]不存在");
-                                            msg.setError(MessageUtils.message("project.masterProjectNull",mainName));
-                                            return msg;
-                                        }
+                                if (!StringUtils.isEmpty(mainName)) {
+                                    Optional<ProjectMain> first = projectMainList.stream().filter(pm -> pm.getName().equals(mainName)).findFirst();
+                                    if(first.isPresent()){
+                                        project.setProjectMainId(first.get().getId());
+                                        project.setCategory(first.get().getCategoryId());
+                                        project.setCategoryName(first.get().getCategoryName());
+                                    }else {
+                                        //msg.setError("主项目["+mainName+"]不存在");
+                                        msg.setError(MessageUtils.message("project.masterProjectNull",mainName));
+                                        return msg;
                                     }
+                                }
                             }
                         }
                     }
@@ -6012,7 +6438,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             projectSeparate.setProjectCategorySub(projectCategorySubCell.getStringCellValue());
                         }
                         if(exists&&check){
-                           projectSeparateMapper.updateById(projectSeparate);
+                            projectSeparateMapper.updateById(projectSeparate);
                             List<ProjectKeyNodes> nodes = projectKeyNodesMapper.selectList(new QueryWrapper<ProjectKeyNodes>().eq("project_id", id));
                             for (int x = 0; x < projectKeyNodesSettingList.size(); x++) {
                                 ProjectKeyNodesSetting projectKeyNodesSetting = projectKeyNodesSettingList.get(x);
@@ -6379,7 +6805,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             for (String str : partSplit) {
                                 String s1;
                                 if(str.startsWith("/")){
-                                   s1=str.substring(1,str.length());
+                                    s1=str.substring(1,str.length());
                                 }else s1=str;
                                 String s2;
                                 if(s1.endsWith("/")){
@@ -7203,11 +7629,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 if (inchargerId!=null&&!inchargerId.equals("")) {
                     Optional<User> incharger = userList.stream().filter(u -> u.getId().equals(inchargerId)).findFirst();
                     if(incharger.isPresent()){
-                       if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
-                           item.add("$userName="+incharger.get().getCorpwxUserid()+"$");
-                       }else if(dingding!=null&&dingding.getContactNeedTranslate()==1) {
-                           item.add("$userName="+incharger.get().getDingdingUserid()+"$");
-                       }
+                        if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
+                            item.add("$userName="+incharger.get().getCorpwxUserid()+"$");
+                        }else if(dingding!=null&&dingding.getContactNeedTranslate()==1) {
+                            item.add("$userName="+incharger.get().getDingdingUserid()+"$");
+                        }
                     }else {
                         item.add("");
                     }
@@ -8482,7 +8908,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         long total = list.size();
         List<Map<String, Object>> resultList = null;
         if (pageIndex!=null && pageSize!=null){
-             resultList = list.stream().skip((pageIndex - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
+            resultList = list.stream().skip((pageIndex - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
         }else {
             resultList = list;
         }
@@ -8810,10 +9236,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     //根据设置
                     switch (timeliness){
                         case 1:createDate=createDate.plusDays(1);
-                                while(!WorkDayCalculateUtils.isWorkDay(createDate)){
-                                    createDate=createDate.plusDays(1);
-                                }
-                        break;
+                            while(!WorkDayCalculateUtils.isWorkDay(createDate)){
+                                createDate=createDate.plusDays(1);
+                            }
+                            break;
                         case 2:
                             Integer a=0;
                             while(a!=2){
@@ -8822,7 +9248,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                     a++;
                                 }
                             }
-                        break;
+                            break;
                     }
                     if(createTimeDate.isBefore(createDate)||createTimeDate.isEqual(createDate)){
                         num++;
@@ -8837,7 +9263,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 BigDecimal divide;
                 BigDecimal divideWithLeave;
                 if(days!=0){
-                     divide = bigDecimal.divide(BigDecimal.valueOf(days), 2, BigDecimal.ROUND_HALF_UP);
+                    divide = bigDecimal.divide(BigDecimal.valueOf(days), 2, BigDecimal.ROUND_HALF_UP);
                 }else if(days==0){
                     divide=new BigDecimal(1);
                     //查看当天有请假直接算100%
@@ -9094,11 +9520,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             }
             OperationRecord operationRecord=new OperationRecord();
             operationRecord.setModuleName("项目管理")
-                           .setOperatorName(user.getName())
-                           .setProjectName(project.getProjectName())
-                           .setCompanyId(user.getCompanyId())
-                           .setOperationTime(LocalDateTime.now())
-                           .setContent("批量添加项目参与人");
+                    .setOperatorName(user.getName())
+                    .setProjectName(project.getProjectName())
+                    .setCompanyId(user.getCompanyId())
+                    .setOperationTime(LocalDateTime.now())
+                    .setContent("批量添加项目参与人");
             operationRecordService.save(operationRecord);
         }
         participationService.saveBatch(list);
@@ -9123,7 +9549,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         return new HttpRespMsg();
     }
 
-	@Override
+    @Override
     public HttpRespMsg getUserWorkingTimeStatic(String startDate, String endDate, Integer pageIndex, Integer pageSize, HttpServletRequest request,String userId,Integer departmentId) {
         HttpRespMsg httpRespMsg =new HttpRespMsg();
         DecimalFormat dft =  new DecimalFormat("0%");
@@ -9237,7 +9663,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
 
 
 
-	@Override
+    @Override
     public HttpRespMsg batchDeleteProject(String projectIdArray, HttpServletRequest request) {
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
@@ -10035,44 +10461,44 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             //msg.data = "成功导入" + importCount + "条数据。";
             msg.data = MessageUtils.message("data.importSucRow",importCount);
         }catch(IOException e){
-                e.printStackTrace();
-                //msg.setError("文件处理出错");
-                msg.setError(MessageUtils.message("file.error"));
-                return msg;
-            } catch(NullPointerException e){
-                e.printStackTrace();
-                //msg.setError("数据格式有误或存在空数据 导入失败");
-                msg.setError(MessageUtils.message("file.dataFormatError"));
-                return msg;
-            }catch(InvalidFormatException e){
-                e.printStackTrace();
-                //msg.setError("文件格式错误,如果安装了加密软件需要先解密再上传");
-                msg.setError(MessageUtils.message("file.FormatErrorAndDecrypt"));
-            }catch(EncryptedDocumentException e){
-                e.printStackTrace();
-                //msg.setError("文件加密状态,需要先解除加密状态再上传");
-                msg.setError(MessageUtils.message("file.encryption"));
-                return msg;
-            } catch(Exception e){
-                e.printStackTrace();
-                //msg.setError("上传失败:" + e.getMessage());
-                msg.setError(MessageUtils.message("file.uploadError",e.getMessage()));
-                return msg;
-            } finally{
-                //关闭流
-                try {
-                    if (outputStream != null && inputStream != null) {
-                        outputStream.close();
-                        inputStream.close();
-                        System.out.println("流已关闭");
-                    }
-                } catch (IOException e) {
-                    e.printStackTrace();
+            e.printStackTrace();
+            //msg.setError("文件处理出错");
+            msg.setError(MessageUtils.message("file.error"));
+            return msg;
+        } catch(NullPointerException e){
+            e.printStackTrace();
+            //msg.setError("数据格式有误或存在空数据 导入失败");
+            msg.setError(MessageUtils.message("file.dataFormatError"));
+            return msg;
+        }catch(InvalidFormatException e){
+            e.printStackTrace();
+            //msg.setError("文件格式错误,如果安装了加密软件需要先解密再上传");
+            msg.setError(MessageUtils.message("file.FormatErrorAndDecrypt"));
+        }catch(EncryptedDocumentException e){
+            e.printStackTrace();
+            //msg.setError("文件加密状态,需要先解除加密状态再上传");
+            msg.setError(MessageUtils.message("file.encryption"));
+            return msg;
+        } catch(Exception e){
+            e.printStackTrace();
+            //msg.setError("上传失败:" + e.getMessage());
+            msg.setError(MessageUtils.message("file.uploadError",e.getMessage()));
+            return msg;
+        } finally{
+            //关闭流
+            try {
+                if (outputStream != null && inputStream != null) {
+                    outputStream.close();
+                    inputStream.close();
+                    System.out.println("流已关闭");
                 }
-//            file.deleteOnExit();//程序退出时删除临时文件
-                System.out.println(file.delete());
+            } catch (IOException e) {
+                e.printStackTrace();
             }
-            return msg;
+//            file.deleteOnExit();//程序退出时删除临时文件
+            System.out.println(file.delete());
+        }
+        return msg;
     }
 
     @Override
@@ -12119,9 +12545,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             itemList=new ArrayList<>();
         }
         for (GanttDataItem ganttDataItem : itemList) {
-                if(ganttDataItem.getId().equals(userGantt.parent)){
-                    ganttDataItem.children.add(userGantt);
-                }
+            if(ganttDataItem.getId().equals(userGantt.parent)){
+                ganttDataItem.children.add(userGantt);
+            }
             getUserGanttDataItemList(userGantt,ganttDataItem.children);
         }
         return itemList;
@@ -14342,7 +14768,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         }
         String fileName = "项目耗用进度表_"+System.currentTimeMillis();
         try {
-           return   excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName , dataList, path);
+            return   excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,dingding,fileName , dataList, path);
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 9 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -1716,14 +1716,21 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     for (Map map : nameList) {
                         String corpwxUserid = (String)map.get("corpwxUserid");
                         String dateStr = (String)map.get("dateStr");
-                        userCorpwxTimeQueryWrapper.or(wrapper->wrapper.eq("corpwx_userid", corpwxUserid).eq("create_date", dateStr));
+                        String name = (String)map.get("name");
+                        if (corpwxUserid != null) {
+                            userCorpwxTimeQueryWrapper.or(wrapper->wrapper.eq("corpwx_userid", corpwxUserid).eq("create_date", dateStr));
+                        } else {
+                            userCorpwxTimeQueryWrapper.or(wrapper->wrapper.eq("name", name).eq("create_date", dateStr));
+                        }
+
                     }
                     List<UserCorpwxTime> timeList = userCorpwxTimeMapper.selectList(userCorpwxTimeQueryWrapper);
                     //过滤匹配当前的数据
                     for (Map map : nameList) {
                         String corpwxUserid = (String)map.get("corpwxUserid");
+                        String name = (String)map.get("name");
                         String dateStr = (String)map.get("dateStr");
-                        Optional<UserCorpwxTime> first = timeList.stream().filter(time -> time.getCorpwxUserid().equals(corpwxUserid) && dtf.format(time.getCreateDate()).equals(dateStr)).findFirst();
+                        Optional<UserCorpwxTime> first = timeList.stream().filter(time -> ((time.getCorpwxUserid() != null && time.getCorpwxUserid().equals(corpwxUserid)) || (time.getCorpwxUserid() == null && name != null && name.equals(time.getName()))) && dtf.format(time.getCreateDate()).equals(dateStr)).findFirst();
                         if (first.isPresent()) {
                             double wh = first.get().getWorkHours();
                             //赋值打卡时长

+ 71 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -6,6 +6,7 @@ import com.aliyun.dingtalkcontact_1_0.models.SearchUserResponse;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.management.platform.constant.Constant;
@@ -2450,6 +2451,76 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         }
     }
 
+
+    @Override
+    public HttpRespMsg getSimpleActiveUserListPage(Integer pageIndex, Integer pageSize, Integer departmentId, HttpServletRequest request, String keyword, String cursor, String userIds) throws Exception {
+        HttpRespMsg msg = new HttpRespMsg();
+        String token = request.getHeader("TOKEN");
+        User user = userMapper.selectById(token);
+        String nextCursor = "";
+        //企业微信通讯录搜索功能
+        Integer WXCompanyId = user.getCompanyId();
+        WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", WXCompanyId));
+        //当企业开启了微信通讯录的情况下
+        if (org.apache.commons.lang3.StringUtils.isNotBlank(keyword) && wxCorpInfo!=null && wxCorpInfo.getSaasSyncContact()==1){
+            HashMap<String, List> result = wxCorpInfoService.getOpenId(wxCorpInfo.getCorpid(), keyword, cursor,1,200);
+            HashMap<String, Object> msgResult = new HashMap<>();
+            List users = result.get("user");
+            msg.data = msgResult;
+            QueryWrapper<User> wrapper = new QueryWrapper<User>().in("corpwx_userid", users).select("id", "name", "job_number");
+            Page<User> page = new Page<>(pageIndex, pageSize);
+            if (users.size()!=0){
+                IPage<User> userIPage = userMapper.selectPage(page, wrapper);
+                msgResult.put("total",userIPage.getTotal());
+                List<User> userList = userIPage.getRecords();
+                List<String> targetUids;
+                if (!StringUtils.isEmpty(userIds)) {
+                    targetUids = ListUtil.convertLongIdsArrayToList(userIds);
+
+                    QueryWrapper<User> queryWrapper = new QueryWrapper<>();
+                    queryWrapper.select("id", "name",  "job_number").in("id", targetUids).eq("is_active", 1);
+                    List<User> userData = userMapper.selectList(queryWrapper);
+                    userList.addAll(0,userData);
+                }
+                msgResult.put("data",userList);
+                return msg;
+            }else {
+                msgResult.put("data",new ArrayList<User>());
+                msgResult.put("total",0);
+                return msg;
+            }
+        }else {
+            QueryWrapper<User> wrapper = new QueryWrapper<User>()
+                    .select("id", "name",  "job_number").eq("company_id", user.getCompanyId()).eq("is_active", 1);
+            if (departmentId != null) {
+                //获取全部子部门
+                List<Department> allDeptList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
+                List<Integer> deptIds = departmentService.getDeptIncludeSubDeptIds(departmentId, allDeptList);
+                wrapper.in("department_id", deptIds);
+            }
+//            List<User> userList = userMapper.selectList(wrapper);
+//            msg.data = userList;
+            Page<User> page = new Page<>(pageIndex, pageSize);
+            IPage<User> userIPage = userMapper.selectPage(page, wrapper);
+            HashMap<String, Object> resultMap = new HashMap<>();
+            resultMap.put("total", userIPage.getTotal());
+            List<User> userList = userIPage.getRecords();
+            List<String> targetUids;
+            if (!StringUtils.isEmpty(userIds)) {
+                targetUids = ListUtil.convertLongIdsArrayToList(userIds);
+
+                QueryWrapper<User> queryWrapper = new QueryWrapper<>();
+                queryWrapper.select("id", "name",  "job_number").in("id", targetUids).eq("is_active", 1);
+                List<User> users = userMapper.selectList(queryWrapper);
+                userList.addAll(0,users);
+            }
+
+            resultMap.put("data", userList);
+            msg.data=resultMap;
+            return msg;
+        }
+    }
+
     @Override
     public HttpRespMsg getUserListByRole(HttpServletRequest request,String tableName) {
         HttpRespMsg httpRespMsg=new HttpRespMsg();

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -1602,7 +1602,8 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                                     //检查请假时间段是否在打卡的时间范围内
                                     if (baseMorningStart.equals(leaveStart) && baseMorningEnd.equals(leaveEnd)) {
                                         morningLeave = true;
-                                    } else if (baseAfternoonStart.equals(leaveStart) && baseAfternoonEnd.equals(leaveEnd)) {
+                                    } else if ((baseAfternoonStart.equals(leaveStart) || "14:00".equals(leaveStart)) && baseAfternoonEnd.equals(leaveEnd)) {
+                                        //补充14:00是因为企业微信传递的数据不规则,有时候下午请假正常是13:00-18:00,有时候是14:00-18:00
                                         afternoonLeave = true;
                                     }
 

+ 138 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/ExcelUtil.java

@@ -765,4 +765,142 @@ public class ExcelUtil {
         }
         return true;
     }
+
+    public static String exportMultiSheetGeneralExcelByTitleAndListNew(String title, List<List<String>>[] multiSheetList, String downloadPath, String[] sheetsName) {
+        String result="系统提示:Excel文件导出成功!";
+        String fileName= title+".xlsx";
+        try {
+            // 创建工作簿
+            SXSSFWorkbook workBook = new SXSSFWorkbook();
+            // 创建工作类
+            for (int sheetIndex=0;sheetIndex<multiSheetList.length; sheetIndex++) {
+                Sheet sheetOne = workBook.createSheet();
+                workBook.setSheetName(sheetIndex,sheetsName[sheetIndex]);
+                sheetOne.setDefaultColumnWidth(16);
+
+                //设置字体样式
+                Font headFont = workBook.createFont();
+                headFont.setBold(true);
+                headFont.setFontHeightInPoints((short) 10);
+                headFont.setFontName("黑体");
+
+                Font titleFont = workBook.createFont();
+                titleFont.setBold(true);
+                titleFont.setFontHeightInPoints((short) 10);
+                titleFont.setFontName("黑体");
+
+                Font font = workBook.createFont();
+                font.setFontHeightInPoints((short) 10);
+                font.setFontName("宋体");
+
+                //设置单元格样式
+                XSSFCellStyle  headStyle = (XSSFCellStyle) workBook.createCellStyle();
+                headStyle.setFont(headFont);
+                headStyle.setAlignment(HorizontalAlignment.CENTER);
+                headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+                headStyle.setWrapText(true);
+                headStyle.setBorderBottom(BorderStyle.THIN); //下边框
+                headStyle.setBorderLeft(BorderStyle.THIN);//左边框
+                headStyle.setBorderTop(BorderStyle.THIN);//上边框
+                headStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+                String color = "c0c0c0";    //此处得到的color为16进制的字符串
+                //转为RGB码
+                int r = Integer.parseInt((color.substring(0,2)),16);   //转为16进制
+                int g = Integer.parseInt((color.substring(2,4)),16);
+                int b = Integer.parseInt((color.substring(4,6)),16);
+
+                //自定义cell颜色
+//            HSSFPalette palette = workBook.getCustomPalette();
+                //这里的9是索引
+//            palette.setColorAtIndex((short)9, (byte) r, (byte) g, (byte) b);
+
+                //设置自定义颜色
+                XSSFColor xssfColor = new XSSFColor();
+                byte[] colorRgb = { (byte)118, (byte)147, (byte)60 };
+                xssfColor.setRGB(colorRgb);
+//                headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
+//                headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);// 填充模式(和背景颜色成对使用)
+                //cs.setFillForegroundColor(IndexedColors.AQUA.getIndex()); //设置自带的颜色
+
+                CellStyle titleStyle = workBook.createCellStyle();
+                titleStyle.setFont(titleFont);
+                titleStyle.setAlignment(HorizontalAlignment.CENTER);
+                titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+                titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);  //填充单元格
+//                titleStyle.setFillForegroundColor((short)9);    //填色
+                titleStyle.setWrapText(true);
+                titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
+                titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
+                titleStyle.setBorderTop(BorderStyle.THIN);//上边框
+                titleStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+                CellStyle cellStyle = workBook.createCellStyle();
+                cellStyle.setFont(font);
+                cellStyle.setAlignment(HorizontalAlignment.CENTER);
+                cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
+                cellStyle.setWrapText(true);
+                cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
+                cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
+                cellStyle.setBorderTop(BorderStyle.THIN);//上边框
+                cellStyle.setBorderRight(BorderStyle.THIN);//右边框
+
+                if(multiSheetList[sheetIndex].size() > 0) {
+                    int start = 0;
+                    for(List<String> rowList : multiSheetList[sheetIndex]) {
+                        Row row = sheetOne.createRow(start);
+                        row.setHeightInPoints(24);
+                        for(int i = 0; i < rowList.size(); i++) {
+                            Cell cell = row.createCell(i);
+                            if(start == 0) {
+                                cell.setCellStyle(headStyle);
+                            }else {
+                                cell.setCellStyle(cellStyle);
+                            }
+                            cell.setCellValue(rowList.get(i));
+                        }
+                        start++;
+                    }
+                    if (sheetIndex==1){
+                        Row row0 = sheetOne.getRow(0);
+                        for (int i = 0; i < 4; i++) {
+                            sheetOne.addMergedRegion(new CellRangeAddress(0, 1, i,i));
+                        }
+                        int numberOfCells = row0.getPhysicalNumberOfCells();
+                        int index=-1;
+                        for (int i = 0; i < numberOfCells; i++) {
+                            if (row0.getCell(i).getStringCellValue().equals("项目工时分配")){
+                                index=i;
+                                break;
+                            }
+                        }
+                        if (index!=-1){
+                            sheetOne.addMergedRegion(new CellRangeAddress(0, 0, 4,index-1));
+                        }
+                        short lastCellNum = row0.getLastCellNum();
+                        if (index!=-1&&index<lastCellNum-1){
+                            sheetOne.addMergedRegion(new CellRangeAddress(0, 0, index,lastCellNum-1));
+                        }
+
+
+
+                    }
+                }
+            }
+
+
+            File dir = new File(downloadPath);
+            if (!dir.exists()) {
+                dir.mkdirs();
+            }
+            FileOutputStream os = new FileOutputStream(downloadPath+fileName);//保存到本地
+            workBook.write(os);
+            os.flush();
+            os.close();
+        }catch(Exception e) {
+            System.out.println(result);
+            e.printStackTrace();
+        }
+        return "/upload/"+fileName;
+    }
 }

+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ContractCustomMapper.xml

@@ -17,13 +17,14 @@
         <result column="tax_rate" property="taxRate" />
         <result column="amounts_no_tax" property="amountsNoTax" />
         <result column="currency" property="currency" />
+        <result column="is_amount_fixed" property="isAmountFixed" />
         <result column="finish_status" property="finishStatus" />
         <result column="stamp_duty_items" property="stampDutyItems" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        contract_id, customer_org, customer_contact, customer_phone, use_department, funds_source, undertaker, agent, sign_date, filings_date, tax_rate, amounts_no_tax, currency, finish_status, stamp_duty_items
+        contract_id, customer_org, customer_contact, customer_phone, use_department, funds_source, undertaker, agent, sign_date, filings_date, tax_rate, amounts_no_tax, currency, is_amount_fixed, finish_status, stamp_duty_items
     </sql>
 
 </mapper>

+ 157 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -2375,5 +2375,162 @@
         order by d.department_id,u.id
         ) as total
     </select>
+    <select id="getOnlyJoinProjectsPage" resultType="java.util.Map">
+        SELECT id, project_code AS projectCode, project_name AS projectName
+        FROM project
+        WHERE status = 1 and (id IN (
+            SELECT project_id
+            FROM participation
+            WHERE user_id = #{userId}
+        )
+            or (is_public = 1 and company_id = #{companyId}))
+        <if test="infoString !=null and infoString!='' ">
+            and (project_name like CONCAT('%', #{infoString}, '%')  or project_code like CONCAT('%', #{infoString}, '%') )
+        </if>
+        ORDER BY is_public DESC, id ASC
+        limit #{pageIndex},#{pageSize}
+    </select>
+    <select id="getOnlyJoinProjectsTotal" resultType="java.lang.Integer">
+        SELECT count(*) total
+        FROM project
+        WHERE status = 1 and (id IN (
+        SELECT project_id
+        FROM participation
+        WHERE user_id = #{userId}
+        )
+        or (is_public = 1 and company_id = #{companyId}))
+        <if test="infoString !=null and infoString!='' ">
+            and (project_name like CONCAT('%', #{infoString}, '%')  or project_code like CONCAT('%', #{infoString}, '%') )
+        </if>
+    </select>
+    <select id="getOnlyJoinProjectsById" resultType="java.util.Map">
+        SELECT id, project_code AS projectCode, project_name AS projectName
+        FROM project
+        WHERE status = 1 and (id IN (
+        SELECT project_id
+        FROM participation
+        WHERE user_id = #{userId}
+        )
+        or (is_public = 1 and company_id = #{companyId}))
+        and id =#{projectId}
+    </select>
+    <select id="getParticipatedProjectPage" resultType="java.util.Map">
+        SELECT id, project_code AS projectCode, project_name AS projectName
+        FROM project
+        WHERE id IN (
+            SELECT project_id
+            FROM participation
+            WHERE user_id = #{userId}
+        ) or incharger_id = #{userId}
+           or creator_id = #{userId}
+           or (is_public = 1 and company_id = #{companyId})
+        <if test="infoString !=null and infoString!='' ">
+            and (project_name like CONCAT('%', #{infoString}, '%')  or project_code like CONCAT('%', #{infoString}, '%') )
+        </if>
+        ORDER BY is_public DESC, id DESC
+        limit #{pageIndex},#{pageSize}
+    </select>
+    <select id="getParticipatedProjectTotal" resultType="java.lang.Integer">
+        SELECT count(*) total
+        FROM project
+        WHERE id IN (
+        SELECT project_id
+        FROM participation
+        WHERE user_id = #{userId}
+        ) or incharger_id = #{userId}
+        or creator_id = #{userId}
+        or (is_public = 1 and company_id = #{companyId})
+        <if test="infoString !=null and infoString!='' ">
+            and (project_name like CONCAT('%', #{infoString}, '%')  or project_code like CONCAT('%', #{infoString}, '%') )
+        </if>
+    </select>
+    <select id="getParticipatedProjectById" resultType="java.util.Map">
+        SELECT count(*) total
+        FROM project
+        WHERE id IN (
+        SELECT project_id
+        FROM participation
+        WHERE user_id = #{userId}
+        ) or incharger_id = #{userId}
+        or creator_id = #{userId}
+        or (is_public = 1 and company_id = #{companyId})
+        and id =#{projectId}
+    </select>
+    <select id="getTimeCostGroupByProjectUserSumTime" resultType="java.util.Map">
+        SELECT a.id, a.project_code as projectCode, a.project_name AS projectName,a.category_name as categoryName,
+        c.name name,sum(b.working_time) AS cost,
+        b.dept_id as deptId,department.corpwx_deptid as corpwxDeptId,department.dd_deptid as corpDdDeptId, IFNULL(department.department_name, '未分配') as departmentName,
+        c.id userId
+        FROM project AS a
+        LEFT JOIN report AS b ON b.project_id = a.id
+        JOIN user AS c ON b.creator_id = c.id
+        left join department on department.department_id = b.dept_id
+        WHERE a.company_id = #{companyId}
+        <if test="startDate != null and endDate != null">
+            AND b.create_date between #{startDate} and #{endDate}
+        </if>
+        AND b.state = 1
+        group by id,projectCode,projectName,categoryName,name
+        ORDER BY a.id ASC
+    </select>
+    <select id="getTimeCostProjectUserWorkTime" resultType="java.util.Map">
+        SELECT a.id, a.project_code as projectCode,a.project_name AS projectName,a.category_name as categoryName,
+               c.name name,b.working_time cost,
+               b.dept_id as deptId,department.corpwx_deptid as corpwxDeptId,department.dd_deptid as corpDdDeptId, IFNULL(department.department_name, '未分配') as departmentName,
+               b.create_date createDate,DAY(b.create_date) dayOnly,c.id userId
+        FROM project AS a
+            LEFT JOIN report AS b ON b.project_id = a.id
+            JOIN user AS c ON b.creator_id = c.id
+            left join department on department.department_id = b.dept_id
+        WHERE a.company_id = #{companyId}
+        <if test="startDate != null and endDate != null">
+            AND b.create_date between #{startDate} and #{endDate}
+        </if>
+            AND b.state = 1
+        ORDER BY a.id ASC ,c.name asc
+
+    </select>
+    <select id="getCostTimeByUserSum" resultType="java.util.Map">
+        SELECT c.id userId, c.job_number jobNumber,c.name name,sum(b.working_time) AS cost,
+               b.dept_id as deptId,department.corpwx_deptid as corpwxDeptId,department.dd_deptid as corpDdDeptId, IFNULL(department.department_name, '未分配') as departmentName
+        FROM   project AS a
+                   LEFT JOIN report AS b ON b.project_id = a.id
+                   JOIN user AS c ON b.creator_id = c.id
+                   left join department on department.department_id = b.dept_id
+        WHERE c.company_id = #{companyId}
+        <if test="startDate != null and endDate != null">
+            AND b.create_date between #{startDate} and #{endDate}
+        </if>
+        AND b.state = 1
+        group by userId
+    </select>
+    <select id="getCostTimeByUserForDay" resultType="java.util.Map">
+        SELECT c.id userId, c.job_number jobNumber,c.name name,b.working_time AS cost, a.id projectId,a.project_name ,
+               b.dept_id as deptId,department.corpwx_deptid as corpwxDeptId,department.dd_deptid as corpDdDeptId, IFNULL(department.department_name, '未分配') as departmentName,
+            DAY(b.create_date) dayOnly
+        FROM   project AS a
+            LEFT JOIN report AS b ON b.project_id = a.id
+            JOIN user AS c ON b.creator_id = c.id
+            left join department on department.department_id = b.dept_id
+        WHERE c.company_id = #{companyId}
+        <if test="startDate != null and endDate != null">
+            AND b.create_date between #{startDate} and #{endDate}
+        </if>
+        AND b.state = 1
+    </select>
+    <select id="getTotalProjectByTime" resultType="java.util.Map">
+        SELECT
+            a.id projectId,a.project_name projectName
+        FROM   project AS a
+                   LEFT JOIN report AS b ON b.project_id = a.id
+                   JOIN user AS c ON b.creator_id = c.id
+                   left join department on department.department_id = b.dept_id
+        WHERE c.company_id = #{companyId}
+        <if test="startDate != null and endDate != null">
+            AND b.create_date between #{startDate} and #{endDate}
+        </if>
+        AND b.state = 1
+        GROUP BY projectId
+    </select>
 
 </mapper>

+ 1 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml

@@ -1284,7 +1284,7 @@
            </foreach>
         </if>
         <if test="leaderId != null">
-            AND user.id in (select user_id from participation where project_id in (select id from project where incharger_id = #{leaderId}))
+            AND u.id in (select user_id from participation where project_id in (select id from project where incharger_id = #{leaderId}))
         </if>
         GROUP BY r.create_date,r.creator_id
         order by u.id,r.create_date

二进制
fhKeeper/formulahousekeeper/management-platform/src/main/resources/upload/上海民航合同模板.xlsx


+ 44 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/project/cost.vue

@@ -92,7 +92,18 @@
 
         <!--导出报表条件选择 -->
         <el-dialog :title="$t('timeReportExport')" v-if="exportDialog" :visible.sync="exportDialog" :close-on-click-modal="false" customClass="customWidth" width="500px">
+            
             <el-form ref="form3" :model="exportParam" >
+                <p style="text-align: center;">
+                    <el-radio-group size="medium" v-model="exportParam.reportType">
+                        <el-radio-button :label="0">常规报表</el-radio-button>
+                        <el-radio-button :label="1">月度报表</el-radio-button>
+                    </el-radio-group>
+                </p>
+                <el-form-item :label="this.$t('Selectmonth')" v-if="exportParam.reportType == 1">
+                    <el-date-picker size="small" v-model="exportParam.date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" :clearable="false" type="month" :placeholder="$t('Selectmonth')" style="margin-right: 20px"></el-date-picker>
+                </el-form-item>
+                <template v-else>
                 <el-form-item prop="projectCategoryId" :label="$t('projectclassification')" v-if="radio == $t('projectclassification')||radio==$t('other.project')">
                     <el-select v-model="exportParam.projectCategoryId" :placeholder="$t('classificationitems')"  clearable style="width:350px;" filterable="true" @change="filterCategory">
                         <el-option v-for="item in categoryList"  :key="item.id" :label="item.name" :value="item.id">
@@ -189,9 +200,10 @@
                 <el-form-item v-if="radio == $t('ren-yuan') && user.timeType.mainProjectState == 1">
                     <el-checkbox v-model="exportParam.mainProjectColumn" >{{ $t('hanZhuXiangMu') }}</el-checkbox>
                 </el-form-item>
+                </template>
             </el-form>
             <div slot="footer" class="dialog-footer">
-                <el-button type="primary" @click="exportProjectData" style="width:100%;" :loading="exporting">{{ $t('export.export') }}</el-button>
+                <el-button type="primary" @click="exportParam.reportType==0?exportProjectData():exportMonthlyProjectData()" style="width:100%;" :loading="exporting">{{ $t('export.export') }}</el-button>
             </div>
         </el-dialog>
     </section>
@@ -226,7 +238,7 @@
                 hasReportUserList:[],
                 projectList:[],
                 categoryList: [],
-                exportParam:{projectId:null,dateRange:[],userId: null,type: '0', withPercent: false},
+                exportParam:{projectId:null,dateRange:[],userId: null,type: '0', withPercent: false, date: null, reportType: 0},
                 exportDialog:false,
                 dateRange:[],
                 user: JSON.parse(sessionStorage.getItem("user")),
@@ -327,16 +339,15 @@
                 },
             
             showExportDialog() {
-                // console.log(12345)
                 // 清空选择的人
                 if(this.radio == this.$t('ren-yuan')) {
                     this.exportParam.userIds = new Array()
                 }
-                console.log(this.exportParam)
 
                 this.exportDialog = true;
                 this.exportParam.dateRange = this.dateRange;
-                // console.log(this.hasReportUserList)
+                var array = this.exportParam.dateRange[0].split('-');
+                this.exportParam.date = array[0] + '-' + array[1];
                 if (this.radio == this.$t('ren-yuan')) {
                     // this.exportParam.userIds = [];
                 }
@@ -381,6 +392,34 @@
                     });
                 });
             },
+            exportMonthlyProjectData() {
+                var url = '/project/exportTimeByProjectAndEmployee';
+                var fileName = this.exportParam.date + '月度工时统计表.xlsx';
+                this.exporting = true;
+                this.http.post(url, this.exportParam,
+                    res => {
+                        this.exporting = false;
+                        if (res.code == "ok") {
+                            this.exportDialog = false;
+                            var aTag = document.createElement('a');
+                            aTag.download = fileName;
+                            aTag.href = res.data;
+                            aTag.click();
+                        } else {
+                            this.$message({
+                                message: res.msg,
+                                type: "error"
+                            });
+                        }
+                    },
+                    error => {
+                        this.$message({
+                            message: error,
+                            type: "error"
+                        });
+                        this.exporting = false;
+                    });
+            },
             exportProjectData() {
                  var param = {stateKey: 1};
                  if (this.exportParam.dateRange != null) {

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

@@ -4,7 +4,7 @@
         <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
             <el-form :inline="true">
                 <!-- <el-form-item label="财务核算成本 | 月份选择" style="margin-top:5px;"> -->
-                <el-form-item :label="this.$t('Selectmonth')" >
+            <el-form-item :label="this.$t('Selectmonth')" >
                 <el-date-picker size="small" v-model="date" :editable="false" format="yyyy-MM" value-format="yyyy-MM" @change="loadMonthData" :clearable="false" type="month" :placeholder="$t('Selectmonth')" style="margin-right: 20px"></el-date-picker>
                 <el-link type="primary" :underline="false" @click="audits()" v-if="user.timeType.financeAudit == '1'">{{revaelse}}</el-link>
             </el-form-item>