Przeglądaj źródła

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

# Conflicts:
#	fhKeeper/formulahousekeeper/timesheet_h5/vue.config.js
山水共长天一色 3 lat temu
rodzic
commit
7b698ce454
14 zmienionych plików z 309 dodań i 153 usunięć
  1. 2 3
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java
  2. 2 6
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java
  3. 1 5
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/GanttDataItem.java
  4. 3 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java
  5. 5 4
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java
  6. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java
  7. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ReportService.java
  8. 226 110
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java
  9. 5 5
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  10. 26 4
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml
  11. 9 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ReportMapper.xml
  12. 13 6
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue
  13. 15 6
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue
  14. 0 1
      fhKeeper/formulahousekeeper/timesheet_h5/vue.config.js

+ 2 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java

@@ -14,7 +14,6 @@ import org.springframework.web.multipart.MultipartFile;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
@@ -156,8 +155,8 @@ public class ProjectController {
      * 导出查询者所在公司每个项目的工时成本
      */
     @RequestMapping("/exportTimeCost")
-    public HttpRespMsg exportTimeCost(String startDate, String endDate, Integer projectId, String userId, Boolean projectSum) {
-        return projectService.exportTimeCost(startDate, endDate, projectId, userId, projectSum, request);
+    public HttpRespMsg exportTimeCost(String startDate, String endDate, Integer projectId, String userId, Boolean projectSum,Integer type) {
+        return projectService.exportTimeCost(startDate, endDate, projectId, userId, projectSum,type, request);
     }
 
     /**

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

@@ -14,9 +14,7 @@ import com.management.platform.service.ReportService;
 import com.management.platform.service.UserSalaryService;
 import com.management.platform.service.UserService;
 import com.management.platform.util.HttpRespMsg;
-import com.management.platform.util.ListUtil;
 import com.management.platform.util.WorkDayCalculateUtils;
-import org.apache.log4j.helpers.DateTimeDateFormat;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
@@ -28,9 +26,7 @@ import javax.servlet.http.HttpServletRequest;
 import java.math.BigDecimal;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
-import java.time.DayOfWeek;
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -96,8 +92,8 @@ public class ReportController {
      * date 日期 格式yyyy-mm-dd
      */
     @RequestMapping("/exportReport")
-    public HttpRespMsg exportReport(String startDate, String endDate, Integer projectId) {
-        return reportService.exportReport(startDate, endDate, projectId, request);
+    public HttpRespMsg exportReport(String startDate, String endDate, Integer projectId,@RequestParam(defaultValue = "0") Integer stateKey) {
+        return reportService.exportReport(startDate, endDate, projectId,stateKey, request);
     }
 
 

+ 1 - 5
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/GanttDataItem.java

@@ -1,11 +1,6 @@
 package com.management.platform.entity.vo;
 
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
 import lombok.Data;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import java.util.Date;
 
 @Data
 public class GanttDataItem {
@@ -20,4 +15,5 @@ public class GanttDataItem {
     public String parent;
     public Integer projectId;
     public String render;
+    public String type;
 }

+ 3 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java

@@ -30,7 +30,7 @@ public interface ProjectMapper extends BaseMapper<Project> {
     List<Map<String, Object>> getCustomDataSum(@Param("companyId") Integer companyId, @Param("startDate") String startDate, @Param("endDate") String endDate,
                                           @Param("projectId") Integer projectId, @Param("userId") String userId);
 
-    List<Map<String, Object>> getProjectCost(@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Integer projectId, @Param("userId") String userId);
+    List<Map<String, Object>> getProjectCost(@Param("companyId")Integer companyId,@Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Integer projectId, @Param("userId") String userId);
 
     List<Map<String, Object>> getProjectCusDataSumItem(@Param("companyId") Integer companyId, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("projectId") Integer projectId, @Param("userId") String userId);
 
@@ -80,4 +80,6 @@ public interface ProjectMapper extends BaseMapper<Project> {
     List<HashMap> getProjectCostAlarm(Integer companyId, Integer pageStart, Integer pageSize);
 
     List getBaseCostAndRealCost(Integer companyId, Integer pageStart, Integer pageSize);
+
+    List<Map<String, Object>> getProjectCostGroupByProject(Integer companyId, String startDate, String endDate, Integer projectId);
 }

+ 5 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ReportMapper.java

@@ -5,7 +5,6 @@ import com.management.platform.entity.Report;
 import org.apache.ibatis.annotations.Param;
 
 import java.time.LocalDate;
-import java.time.LocalDateTime;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -23,20 +22,22 @@ public interface ReportMapper extends BaseMapper<Report> {
                                                      @Param("companyId") Integer companyId,
                                                      @Param("userId") String userId,
                                                      @Param("endDate") String endDate,
-                                                     @Param("projectId") Integer projectId
+                                                     @Param("projectId") Integer projectId,
+                                                     @Param("stateKey") Integer stateKey
                                                  );
 
     List<HashMap<String, Object>> getProjectMembReportByDate(@Param("startDate") String startDate,
                                                      @Param("companyId") Integer companyId,
                                                      @Param("leaderId") String leaderId,
                                                      @Param("endDate") String endDate,
-                                                     @Param("projectId") Integer projectId);
+                                                     @Param("projectId") Integer projectId,
+                                                     @Param("stateKey") Integer stateKey);
 
     //获取部门下的人员的日报
     List<HashMap<String, Object>> getDeptMembReportByDate(@Param("startDate") String startDate,
                                                              @Param("companyId") Integer companyId,
                                                              @Param("deptIds") List<Integer> deptIds,
-                                                             @Param("endDate") String endDate, @Param("projectId") Integer projectId);
+                                                             @Param("endDate") String endDate, @Param("projectId") Integer projectId,@Param("stateKey")Integer stateKey);
 
     //按当前人员获取本人报告
     List<Map<String, Object>> getReportByDate(@Param("date") String date, @Param("id") String id);

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

@@ -50,7 +50,7 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg getAllMembCost(String startDate, String endDate, Integer projectId, HttpServletRequest request);
 
-    HttpRespMsg exportTimeCost(String startDate, String endDate, Integer projectId,String userId, Boolean projectSum, HttpServletRequest request);
+    HttpRespMsg exportTimeCost(String startDate, String endDate, Integer projectId,String userId, Boolean projectSum,Integer type,HttpServletRequest request);
 
     HttpRespMsg updateProgress(Integer id, Integer progress, HttpServletRequest request);
 

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

@@ -23,7 +23,7 @@ import java.util.List;
 public interface ReportService extends IService<Report> {
     HttpRespMsg getReportList(String date, Integer deptId, String userId, HttpServletRequest request);
 
-    HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate, Integer projectId, HttpServletRequest request);
+    HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate, Integer projectId,Integer stateKey, HttpServletRequest request);
 
     HttpRespMsg getReport(String date, HttpServletRequest request);
 

+ 226 - 110
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -117,6 +117,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     LeaveSheetMapper leaveSheetMapper;
     @Resource
     BusinessTripMapper businessTripMapper;
+    @Resource
+    BustripProjectMapper bustripProjectMapper;
 
     @Resource
     private HttpServletResponse response;
@@ -725,83 +727,132 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
 
     //导出查询者所在公司每个项目的工时成本,包括项目人员明细统计
     @Override
-    public HttpRespMsg exportTimeCost(String startDate, String endDate,Integer projectId, String userId, Boolean projectSum, HttpServletRequest request) {
+    public HttpRespMsg exportTimeCost(String startDate, String endDate,Integer projectId, String userId, Boolean projectSum,Integer type, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
             Integer companyId = userMapper.selectById(request.getHeader("Token")).getCompanyId();
             Map<String, Object> resultMap = new HashMap<>();
             List<Map<String, Object>> list = projectMapper.getTimeCost(companyId, startDate, endDate, projectId, userId);
             BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
-            List<String> headList = new ArrayList<String>();
-            headList.add("项目编号");
-            headList.add("项目名称");
-            headList.add("项目分类");
-            headList.add("人员");
-            headList.add("部门");
-            headList.add("工时(h)");
-            headList.add("成本(元)");
-            List<List<String>> allList = new ArrayList<List<String>>();
-            allList.add(headList);
-            double totalCostTime = 0;
-            for (Map<String, Object> map : list) {
-                if (!map.containsKey("cost")) {
-                    map.put("cost", 0);
-                }
-                if (!map.containsKey("costMoney")) {
-                    map.put("costMoney", 0);
-                } else {
-                    totalMoneyCost = totalMoneyCost.add((BigDecimal)map.get("costMoney"));
-                }
-                totalCostTime += (Double)map.get("cost");
-                List<String> rowData = new ArrayList<String>();
-                rowData.add((String)map.get("projectCode"));
-                rowData.add((String)map.get("project"));
-                rowData.add((String)map.get("categoryName"));
-                rowData.add("");
-                rowData.add("");
-                rowData.add(((Double)map.get("cost")).toString());
-                rowData.add(((BigDecimal)map.get("costMoney")).toString());
-                if (projectSum != null && projectSum == true) {
-                    allList.add(rowData);
-                }
-
-                //统计每个项目中的人员时间成本投入
-                int curProjectId = (Integer)map.get("id");
-                List<Map<String, Object>> membList = projectMapper.getProjectCost(startDate, endDate, curProjectId, userId);
-                map.put("membList", membList);
-                for (Map<String, Object> membMap : membList) {
-                    List<String> membRowData = new ArrayList<String>();
-                    if (projectSum == null || projectSum == false) {
-                        membRowData.add((String)map.get("projectCode"));
-                        membRowData.add((String)map.get("project"));
-                        membRowData.add((String)map.get("categoryName"));
+            List<List<String>> allList=null ;
+            List<String> sumRow = null;
+            if(type==0){
+                List<String> headList = new ArrayList<String>();
+                headList.add("项目编号");
+                headList.add("项目名称");
+                headList.add("项目分类");
+                headList.add("人员");
+                headList.add("部门");
+                headList.add("工时(h)");
+                headList.add("成本(元)");
+                allList=new ArrayList<>();
+                allList.add(headList);
+                double totalCostTime = 0;
+                for (Map<String, Object> map : list) {
+                    if (!map.containsKey("cost")) {
+                        map.put("cost", 0);
+                    }
+                    if (!map.containsKey("costMoney")) {
+                        map.put("costMoney", 0);
                     } else {
-                        membRowData.add("");
-                        membRowData.add("");
-                        membRowData.add("");
+                        totalMoneyCost = totalMoneyCost.add((BigDecimal)map.get("costMoney"));
                     }
+                    totalCostTime += (Double)map.get("cost");
+                    List<String> rowData = new ArrayList<String>();
+                    rowData.add((String)map.get("projectCode"));
+                    rowData.add((String)map.get("project"));
+                    rowData.add((String)map.get("categoryName"));
+                    rowData.add("");
+                    rowData.add("");
+                    rowData.add(((Double)map.get("cost")).toString());
+                    rowData.add(((BigDecimal)map.get("costMoney")).toString());
+                    if (projectSum != null && projectSum == true) {
+                        allList.add(rowData);
+                    }
+                    //统计每个项目中的人员时间成本投入
+                    int curProjectId = (Integer)map.get("id");
+                    List<Map<String, Object>> membList = projectMapper.getProjectCost(companyId,startDate, endDate, curProjectId, userId);
+                    map.put("membList", membList);
+                    for (Map<String, Object> membMap : membList) {
+                        List<String> membRowData = new ArrayList<String>();
+                        if (projectSum == null || projectSum == false) {
+                            membRowData.add((String)map.get("projectCode"));
+                            membRowData.add((String)map.get("project"));
+                            membRowData.add((String)map.get("categoryName"));
+                        } else {
+                            membRowData.add("");
+                            membRowData.add("");
+                            membRowData.add("");
+                        }
 
-                    membRowData.add((String)membMap.get("name"));
-                    membRowData.add((String)membMap.get("departmentName"));
-                    membRowData.add(((Double)membMap.get("cost")).toString());
-                    membRowData.add(((BigDecimal)membMap.get("costMoney")).toString());
-                    allList.add(membRowData);
+                        membRowData.add((String)membMap.get("name"));
+                        membRowData.add((String)membMap.get("departmentName"));
+                        membRowData.add(((Double)membMap.get("cost")).toString());
+                        membRowData.add(((BigDecimal)membMap.get("costMoney")).toString());
+                        allList.add(membRowData);
+                    }
                 }
+                //合计
+                sumRow=new ArrayList<>();
+                sumRow.add("合计");
+                sumRow.add("");
+                sumRow.add("");
+                sumRow.add("");
+                sumRow.add("");
+                sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                sumRow.add(totalMoneyCost.toString());
+                allList.add(sumRow);
+            }else{
+                List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId).eq("is_active", 1));
+                List<Object> projectNames = list.stream().map(mp -> mp.get("project")).collect(Collectors.toList());
+                List<Object> projectIds = list.stream().map(mp -> mp.get("id")).collect(Collectors.toList());
+                List<String> headList = new ArrayList<String>();
+                headList.add("人员");
+                projectNames.forEach(pn->{
+                    headList.add(String.valueOf(pn)+"/工时");
+                    headList.add(String.valueOf(pn)+"/成本");
+                });
+                allList=new ArrayList<>();
+                allList.add(headList);
+                //统计当前所有项目所有人的时间成本投入
+                List<Map<String, Object>> membList = projectMapper.getProjectCostGroupByProject(companyId,startDate, endDate, projectId);
+                double lineCostTime=0;
+                BigDecimal lineMoneyCost = BigDecimal.valueOf(0);
+                for (User user : userList) {
+                    boolean flag=false;
+                    List<Map<String, Object>> mapList = membList.stream().filter(mb -> mb.get("creatorId").equals(user.getId())).collect(Collectors.toList());
+                    List<String> membRowData=new ArrayList<>();
+                    membRowData.add(user.getName());
+                        for(Map<String, Object> membMap :mapList){
+                            for(Object i:projectIds){
+                                if(membMap.get("projectId").equals(i)){
+                                    membRowData.add(String.valueOf(membMap.get("cost")));
+                                    membRowData.add(String.valueOf(membMap.get("costMoney")));
+                                    flag=true;
+                                }
+                            }
+                            lineCostTime += (Double)membMap.get("cost");
+                            lineMoneyCost = lineMoneyCost.add((BigDecimal)membMap.get("costMoney"));
+                    }
+                        if(flag){
+                            allList.add(membRowData);
+                        }
+                }
+                //合计
+                /*sumRow=new ArrayList<>();
+                sumRow.add("合计");
+                List<String> finalSumRow = sumRow;
+                BigDecimal finalLineMoneyCost = lineMoneyCost;
+                double finalLineCostTime = lineCostTime;
+                projectNames.forEach(pn->{
+                    finalSumRow.add(""+new BigDecimal(String.valueOf(finalLineCostTime)).setScale(1, BigDecimal.ROUND_HALF_UP));
+                    finalSumRow.add(finalLineMoneyCost.toString());
+                });
+                allList.add(sumRow);*/
             }
-            //合计
-            List<String> sumRow = new ArrayList<String>();
-            sumRow.add("合计");
-            sumRow.add("");
-            sumRow.add("");
-            sumRow.add("");
-            sumRow.add("");
-            sumRow.add(""+new BigDecimal(totalCostTime).setScale(1, BigDecimal.ROUND_HALF_UP));
-            sumRow.add(totalMoneyCost.toString());
-            allList.add(sumRow);
             //生成excel文件导出
-            String fileName = "项目成本统计_"+System.currentTimeMillis();
+            String fileName = "项目成本工时统计_"+System.currentTimeMillis();
             String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
-
             httpRespMsg.data = resp;
         } catch (NullPointerException e) {
             httpRespMsg.setError("验证失败");
@@ -966,7 +1017,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 TimeType timeType = timeTypeMapper.selectById(companyId);
                 if (timeType.getFixMonthcost() == 0) {
                     Map<String, Object> resultMap = new HashMap<>();
-                    List<Map<String, Object>> list = projectMapper.getProjectCost(startDate, endDate, projectId, null);
+                    List<Map<String, Object>> list = projectMapper.getProjectCost(companyId,startDate, endDate, projectId, null);
                     BigDecimal totalMoneyCost = BigDecimal.valueOf(0);
                     for (Map<String, Object> map : list) {
                         if (!map.containsKey("costMoney")) {
@@ -983,7 +1034,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     endDate = endDate + "-31";
                     List<Map<String, Object>> userMonthTimeCostList = projectMapper.getUserMonthTimeCost(companyId, startDate+"-01", endDate+"-31");
 
-                    List<Map<String, Object>> list = projectMapper.getProjectCost(startDate, endDate, projectId, null);
+                    List<Map<String, Object>> list = projectMapper.getProjectCost(companyId,startDate, endDate, projectId, null);
 
                     //检查财务表中是否已经导入成本
                     List<Finance> financeList = financeMapper.selectList(new QueryWrapper<Finance>().eq("ymonth", startDate).eq("company_id", companyId));
@@ -1402,6 +1453,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         User user = userMapper.selectById(token);
         List<String> userIds = new ArrayList<>();
         List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部项目");
+        List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
+        List<User> AllUser = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
         if (functionList.size() == 0) {
             //看看是部门经理还是项目负责人
             if (user.getManageDeptId() != null && user.getManageDeptId() != 0) {
@@ -1464,10 +1517,32 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     btQueryWrapper.le("start_date", endDate).ge("end_date", startDate);
                 }
                 List<BusinessTrip> businessTripList = businessTripMapper.selectList(btQueryWrapper);
+                for(Department department:departmentList){
+                    GanttDataItem parent = new GanttDataItem();
+                    parent.id=department.getDepartmentId().toString();
+                    parent.time = 0;
+                    parent.text=department.getDepartmentName();
+                    parent.type="";
+                    if(department.getSuperiorId()!=null){
+                       parent.parent=String.valueOf(department.getSuperiorId());
+                       parent.type="milestone";
+                    }
+                    Set set=new HashSet();
+                    if(set.add(parent.id)){
+                        itemList.add(parent);
+                    }
+                }
                 for(int i=0;i<leaveSheetList.size();i++){
                     GanttDataItem curItem = new GanttDataItem();;
                     if (!leaveSheetList.get(i).getOwnerId().equals(lsLastItemId)) {
                         //抽取父级对象,人员名称
+                        int finalI = i;
+                        Optional<User> first = AllUser.stream().filter(us -> us.getId().equals(leaveSheetList.get(finalI).getOwnerId())).findFirst();
+                        Integer departmentId =null;
+                        if(first.isPresent()){
+                            departmentId=first.get().getDepartmentId();
+                        }
+                        System.out.println("====================="+departmentId+"======================");
                         GanttDataItem parent = new GanttDataItem();
                         parent.id = leaveSheetList.get(i).getOwnerId();
                         parent.userId = leaveSheetList.get(i).getOwnerId();
@@ -1476,10 +1551,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         parent.start_date = leaveSheetList.get(i).getStartDate().toString();
                         parent.end_date = leaveSheetList.get(i).getEndDate().toString();
                         parent.time = 0;
+                        parent.parent=String.valueOf(departmentId);
                         itemList.add(parent);
                         lsLastItemId =leaveSheetList.get(i).getOwnerId();
                     }
-
                     curItem.id = "请假_"+leaveSheetList.get(i).getId();
                     curItem.userId = leaveSheetList.get(i).getOwnerId();
                     curItem.text = "请假";
@@ -1494,6 +1569,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     GanttDataItem curItem = new GanttDataItem();;
                     if (!businessTripList.get(i).getOwnerId().equals(btLastItemId)) {
                         //抽取父级对象,人员名称
+                        int finalI = i;
+                        Optional<User> first = AllUser.stream().filter(us -> us.getId().equals(businessTripList.get(finalI).getOwnerId())).findFirst();
+                        Integer departmentId =null;
+                        if(first.isPresent()){
+                            departmentId=first.get().getDepartmentId();
+                        }
                         GanttDataItem parent = new GanttDataItem();
                         parent.id = businessTripList.get(i).getOwnerId();
                         parent.userId = businessTripList.get(i).getOwnerId();
@@ -1502,6 +1583,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         parent.start_date = businessTripList.get(i).getStartDate().toString();
                         parent.end_date = businessTripList.get(i).getEndDate().toString();
                         parent.time = 0;
+                        parent.parent=String.valueOf(departmentId);
                         itemList.add(parent);
                         btLastItemId =businessTripList.get(i).getOwnerId();
                     }
@@ -1516,43 +1598,56 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     btLastItemId = businessTripList.get(i).getOwnerId();
                 }
             } else {
+                //按照项目获取
                 String btLastItemId = null;
                 GanttDataItem btLastParentItem=null;
                 ganttData = projectMapper.getTaskPlanByProject(projectIds, startDate ,endDate, user.getCompanyId());
                 QueryWrapper<BusinessTrip> btQueryWrapper =new QueryWrapper<>();
+                QueryWrapper<BustripProject> bpQueryWrapper =new QueryWrapper<>();
                 btQueryWrapper.in("owner_id", userIds);
                 if (startDate != null && endDate != null) {
-                    btQueryWrapper.le("start_date", endDate).ge("end_date", startDate);
+                    bpQueryWrapper.le("start_date", endDate).ge("end_date", startDate);
+                }
+                List<Integer> btIdList=new ArrayList<>();
+                List<BusinessTrip> businessTripList = businessTripMapper.selectList(btQueryWrapper);
+                if(businessTripList.size()>0){
+                    businessTripList.forEach(bt->{
+                        btIdList.add(bt.getId());
+                    });
+                    bpQueryWrapper.in("bustrip_id", btIdList);
+                }
+                List<BustripProject> bustripProjectList = bustripProjectMapper.selectList(bpQueryWrapper);
+                List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", user.getCompanyId()));
+                for(BusinessTrip businessTrip:businessTripList){
+                    List<BustripProject> collect = bustripProjectList.stream().filter(bp -> bp.getBustripId().equals(businessTrip.getId())).collect(Collectors.toList());
+                    for(BustripProject bustripProject:collect){
+                        GanttDataItem curItem = new GanttDataItem();
+                        if(bustripProject.getProjectId()!=null) {
+                            Project project = projectList.stream().filter(pro -> pro.getId().equals(bustripProject.getProjectId())).collect(Collectors.toList()).get(0);
+                            if (!bustripProject.getProjectId().equals(btLastItemId)) {
+                                //抽取父级对象,项目名称
+                                GanttDataItem parent = new GanttDataItem();
+                                parent.id = String.valueOf(bustripProject.getProjectId());
+                                parent.userId = businessTrip.getOwnerId();
+                                parent.text = project.getProjectName();
+                                parent.render = "split";
+                                parent.start_date = bustripProject.getStartDate().toString();
+                                parent.end_date = bustripProject.getEndDate().toString();
+                                parent.time = 0;
+                                itemList.add(parent);
+                                btLastItemId = String.valueOf(bustripProject.getProjectId());
+                            }
+                            curItem.id = "出差_" + businessTrip.getId();
+                            curItem.userId = businessTrip.getOwnerId();
+                            curItem.text = "出差/" + businessTrip.getOwnerName();
+                            curItem.start_date = bustripProject.getStartDate().toString();
+                            curItem.end_date = bustripProject.getEndDate().toString();
+                            curItem.parent = btLastItemId;
+                            itemList.add(curItem);
+                            btLastItemId = String.valueOf(bustripProject.getProjectId());
+                        }
+                    }
                 }
-//                List<BusinessTrip> businessTripList = businessTripMapper.selectList(btQueryWrapper);
-//                for(int i=0;i<businessTripList.size();i++){
-//                    GanttDataItem curItem = new GanttDataItem();
-//                    if(businessTripList.get(i).getProjectId()!=null) {
-//                        Project project = projectMapper.selectById(businessTripList.get(i).getProjectId());
-//                        businessTripList.get(i).setProjectName(project.getProjectName());
-//                        if (!businessTripList.get(i).getProjectId().equals(btLastItemId)) {
-//                            //抽取父级对象,项目名称
-//                            GanttDataItem parent = new GanttDataItem();
-//                            parent.id = String.valueOf(businessTripList.get(i).getProjectId());
-//                            parent.userId = businessTripList.get(i).getOwnerId();
-//                            parent.text = businessTripList.get(i).getProjectName();
-//                            parent.render = "split";
-//                            parent.start_date = businessTripList.get(i).getStartDate().toString();
-//                            parent.end_date = businessTripList.get(i).getEndDate().toString();
-//                            parent.time = 0;
-//                            itemList.add(parent);
-//                            btLastItemId = String.valueOf(businessTripList.get(i).getProjectId());
-//                        }
-//                        curItem.id = "出差_" + businessTripList.get(i).getId();
-//                        curItem.userId = businessTripList.get(i).getOwnerId();
-//                        curItem.text = "出差/" + businessTripList.get(i).getOwnerName();
-//                        curItem.start_date = businessTripList.get(i).getStartDate().toString();
-//                        curItem.end_date = businessTripList.get(i).getEndDate().toString();
-//                        curItem.parent = btLastItemId;
-//                        itemList.add(curItem);
-//                        btLastItemId = String.valueOf(businessTripList.get(i).getProjectId());
-//                    }
-//                }
             }
             String lastItemId = null;
             GanttDataItem lastParentItem = null;
@@ -1560,10 +1655,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             for (int i=0;i<ganttData.size(); i++) {
                 Map map = ganttData.get(i);
                 String userId = (String) map.get("user_id");
+                List<Map> finalGanttData = ganttData;
+                int finalI = i;
+                Optional<User> first = AllUser.stream().filter(us -> us.getId().equals(finalGanttData.get(finalI).get("user_id"))).findFirst();
+                Integer departmentId =null;
+                if(first.isPresent()){
+                    departmentId=first.get().getDepartmentId();
+                }
                 String start_date = sdf.format((Date) map.get("start_date"));
                 String end_date = sdf.format((Date) map.get("end_date"));
                 String projectId = ""+ (Integer) map.get("id");
-                String exeId = ""+ (Integer) map.get("exe_id");
+                String exeId = "任务"+ (Integer) map.get("exe_id");
                 String taskId = ""+ (Integer) map.get("task_id");
 
                 GanttDataItem curItem = new GanttDataItem();;
@@ -1578,6 +1680,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         parent.start_date = start_date;
                         parent.end_date = end_date;
                         parent.time = 0;
+                        parent.parent=String.valueOf(departmentId);
                         itemList.add(parent);
                         lastItemId = userId;
                         lastParentItem = parent;
@@ -1817,18 +1920,22 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 }
                 //项目编号	项目名称 参与人 负责人 级别 开始日期 截止日期 合同金额
                 XSSFCell codeCell = row.getCell(0);
-                XSSFCell nameCell = row.getCell(1);
-                XSSFCell subNameCell = row.getCell(2);
-                XSSFCell participatorCell = row.getCell(3);
-                XSSFCell inchargerCell = row.getCell(4);
-                XSSFCell levelCell = row.getCell(5);
-                XSSFCell startDateCell = row.getCell(6);
-                XSSFCell endDateCell = row.getCell(7);
-                XSSFCell amountCell = row.getCell(8);
-                XSSFCell isPublicCell = row.getCell(9);
+                XSSFCell categoryCell = row.getCell(1);
+                XSSFCell isPublicCell = row.getCell(2);
+                XSSFCell nameCell = row.getCell(3);
+                XSSFCell subNameCell = row.getCell(4);
+                XSSFCell participatorCell = row.getCell(5);
+                XSSFCell inchargerCell = row.getCell(6);
+                XSSFCell levelCell = row.getCell(7);
+                XSSFCell startDateCell = row.getCell(8);
+                XSSFCell endDateCell = row.getCell(9);
+                XSSFCell amountCell = row.getCell(10);
+
 
                 if (codeCell != null)codeCell.setCellType(CellType.STRING);
                 if (nameCell != null)nameCell.setCellType(CellType.STRING);
+                if (categoryCell != null)categoryCell.setCellType(CellType.STRING);
+                if (isPublicCell != null)isPublicCell.setCellType(CellType.STRING);
                 if (subNameCell != null)subNameCell.setCellType(CellType.STRING);
                 if (participatorCell != null)participatorCell.setCellType(CellType.STRING);
                 if (inchargerCell != null)inchargerCell.setCellType(CellType.STRING);
@@ -1836,11 +1943,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 if (startDateCell != null)startDateCell.setCellType(CellType.NUMERIC);
                 if (endDateCell != null)endDateCell.setCellType(CellType.NUMERIC);
                 if (amountCell != null)amountCell.setCellType(CellType.STRING);
-                if (isPublicCell != null)isPublicCell.setCellType(CellType.STRING);
                 if (nameCell == null) {//项目名称为空的直接跳过
                     throw new Exception("项目名称不能为空");
                 }
-
                 Project project = new Project();
                 if (codeCell != null) {
                     String code = codeCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
@@ -1852,6 +1957,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         //跳过第一行标题
                         continue;
                     }
+                    //检查项目是否存在
+                    List<ProjectCategory> projectCategoryList = projectCategoryMapper.selectList(new QueryWrapper<ProjectCategory>().eq("company_id", user.getCompanyId()));
+                    Optional<ProjectCategory> category = projectCategoryList.stream().filter(pc -> pc.getName().equals(categoryCell.getStringCellValue())).findFirst();
+                    if(!category.isPresent()){
+                        throw  new Exception("项目分类["+categoryCell.getStringCellValue()+"]不存在");
+                    }
+                    project.setCategory(category.get().getId());
+                    project.setCategoryName(categoryCell.getStringCellValue());
                     //检查编号是否已经存在
                     if (!StringUtils.isEmpty(code)) {
                         int cnt = projectMapper.selectCount(new QueryWrapper<Project>().eq("project_code", code).eq("company_id", user.getCompanyId()));
@@ -1861,7 +1974,6 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     }
                     project.setProjectCode(code);
                 }
-
                 String name = nameCell.getStringCellValue().trim().replaceAll("\\u00a0", "");
                 project.setCompanyId(user.getCompanyId());
                 project.setCreatorId(userId);
@@ -1991,6 +2103,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         Company company = companyMapper.selectById(user.getCompanyId());
         List<String> headList = new ArrayList<String>();
         headList.add("项目编号");
+        headList.add("项目分类");
+        headList.add("是否为公共项目");
         headList.add("项目名称");
         headList.add("负责人");
         headList.add("参与人");
@@ -2017,6 +2131,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         for (Map<String, Object> map : list) {
             List<String> rowData = new ArrayList<>();
             rowData.add((String)map.get("project_code"));
+            rowData.add((String)map.get("category_name"));
+            rowData.add(("1".equals(map.get("is_public").toString())?"是":"否"));
             rowData.add((String)map.get("project_name"));
             rowData.add((String)map.get("incharger_name"));
             rowData.add((String)map.get("participators"));

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

@@ -2492,7 +2492,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 
     //导出报告
     @Override
-    public HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate, Integer projectId, HttpServletRequest request) {
+    public HttpRespMsg exportReport(@RequestParam String startDate, @RequestParam String endDate, Integer projectId,Integer stateKey, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
             String userId = request.getHeader("Token");
@@ -2590,17 +2590,17 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                         allSubDepts.addAll(getSubDepts(dept, allDeptList));
                     }
                     List<Integer> collect = allSubDepts.stream().map(Department::getDepartmentId).collect(Collectors.toList());
-                    allReportByDate = reportMapper.getDeptMembReportByDate(startDate, null, collect, endDate, projectId);
+                    allReportByDate = reportMapper.getDeptMembReportByDate(startDate, null, collect, endDate, projectId,stateKey);
                 }
 
                 List<HashMap<String, Object>> reportsFromProjects = null;
                 //检查是否是项目负责人
                 int cnt = projectMapper.selectCount(new QueryWrapper<Project>().eq("incharger_id", user.getId()));
                 if (cnt > 0) {
-                    reportsFromProjects = reportMapper.getProjectMembReportByDate(startDate, null, user.getId(), endDate, projectId);
+                    reportsFromProjects = reportMapper.getProjectMembReportByDate(startDate, null, user.getId(), endDate, projectId,stateKey);
                 } else {
                     //普通员工只能看自己的
-                    reportsFromProjects = reportMapper.getAllReportByDate(startDate, null, user.getId(), endDate, projectId);
+                    reportsFromProjects = reportMapper.getAllReportByDate(startDate, null, user.getId(), endDate, projectId,stateKey);
                 }
                 if (allReportByDate == null) {
                     allReportByDate = reportsFromProjects;
@@ -2620,7 +2620,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
 //            }
             else {
                 //看公司所有人的
-                allReportByDate = reportMapper.getAllReportByDate(startDate, user.getCompanyId(), null, endDate, projectId);
+                allReportByDate = reportMapper.getAllReportByDate(startDate, user.getCompanyId(), null, endDate, projectId,stateKey);
             }
             if (timeType.getMultiWorktime() == 1) {
                 java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00");

+ 26 - 4
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml

@@ -124,6 +124,9 @@
     </select>
 
 
+
+
+
     <!--获取自定义数值的项目统计 -->
     <select id="getCustomDataSum" resultType="java.util.Map">
         SELECT a.id, a.project_code as projectCode, a.project_name AS project, IFNULL(SUM(b.custom_data), 0) AS cost
@@ -175,12 +178,14 @@
 
     <!--获取某个项目每个人分别需要的工时-->
     <select id="getProjectCost" resultType="java.util.Map">
-        SELECT b.id as creatorId, b.name,a.dept_id as deptId, IFNULL(department.department_name, '未分配') as departmentName, SUM(a.working_time) AS cost, SUM(a.cost) AS costMoney
+        SELECT b.id as creatorId,a.project_id as projectId, b.name,a.dept_id as deptId, IFNULL(department.department_name, '未分配') as departmentName, SUM(a.working_time) AS cost, SUM(a.cost) AS costMoney
         FROM report AS a
         JOIN user AS b ON a.creator_id = b.id
         left join department on department.department_id = a.dept_id
-        WHERE a.project_id = #{projectId}
-        AND a.state = 1
+        WHERE a.company_id=#{companyId} and a.state = 1
+        <if test="projectId != null">
+            and a.project_id = #{projectId}
+        </if>
         <if test="startDate != null and endDate != null">
             AND a.create_date between #{startDate} and #{endDate}
         </if>
@@ -191,6 +196,23 @@
         ORDER BY b.id ASC, a.dept_id ASC
     </select>
 
+    <!--获取个人每个项目分别需要的工时-->
+    <select id="getProjectCostGroupByProject" resultType="java.util.Map">
+        SELECT b.id as creatorId,a.creator_id as creatorId,a.project_id as projectId, b.name,a.dept_id as deptId, IFNULL(department.department_name, '未分配') as departmentName, SUM(a.working_time) AS cost, SUM(a.cost) AS costMoney
+        FROM report AS a
+        JOIN user AS b ON a.creator_id = b.id
+        left join department on department.department_id = a.dept_id
+        WHERE a.company_id=#{companyId} and a.state = 1
+        <if test="projectId != null">
+            and a.project_id = #{projectId}
+        </if>
+        <if test="startDate != null and endDate != null">
+            AND a.create_date between #{startDate} and #{endDate}
+        </if>
+        GROUP BY b.id, a.dept_id,a.project_id
+        ORDER BY b.id ASC, a.dept_id ASC
+    </select>
+
 
     <!-- 获取人员在日报填写的自定义数值 -->
     <select id="getProjectCusDataSumItem" resultType="java.util.Map">
@@ -408,7 +430,7 @@
     </select>
     <!--项目导出数据-->
     <select id="getExportData" resultType="java.util.HashMap" >
-        SELECT project.id, project_name, project_code, plan_start_date, d.name AS incharger_name,GROUP_CONCAT(u.name) AS participators,
+        SELECT project.id, project_name, project_code,category_name,is_public,plan_start_date, d.name AS incharger_name,GROUP_CONCAT(u.name) AS participators,
         plan_end_date, progress, LEVEL, STATUS, finish_date, creator_id, creator_name, create_date, contract_amount,
         customer_name, associate_degree_names
         FROM project LEFT JOIN sub_project ON sub_project.id = project.`id`

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

@@ -82,6 +82,9 @@
         <if test="userId != null">
             AND a.creator_id = #{userId}
         </if>
+        <if test="stateKey!=null and stateKey==1">
+            or a.state =0
+        </if>
         ORDER BY a.creator_id, a.create_date desc
     </select>
 
@@ -142,6 +145,9 @@
         <if test="leaderId != null">
             AND b.incharger_id = #{leaderId}
         </if>
+        <if test="stateKey!=null and stateKey==1">
+            or a.state=0
+        </if>
         ORDER BY a.creator_id, a.create_date desc
     </select>
 
@@ -171,6 +177,9 @@
         <if test="projectId != null">
             AND a.project_id = #{projectId}
         </if>
+        <if test="stateKey!=null and stateKey==0">
+            AND a.state in (1,2,3)
+        </if>
         <if test="deptIds != null">
             AND c.department_id in
             <foreach collection="deptIds" item="deptId" separator="," close=")" open="(" index="index">

+ 13 - 6
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -305,9 +305,12 @@
         <!-- 选择项目弹窗 -->
         <van-popup v-model="showPickerUserddp" position="bottom" style="height: 80%">
             <!-- <van-search v-model="userName" placeholder="输入项目名称搜索" @clear="sea()" @blur="sea()" @search="sea()"></van-search> -->
-            <van-search v-model="userName" placeholder="请输入项目名称" @clear="sea()" @blur="sea()" @search="sea()" @input="sea()"/>
+            <van-search v-model="userName" placeholder="请输入项目名称/编号" @clear="sea()" @blur="sea()" @search="sea()" @input="sea()"/>
             <div style="minHeight:300px;">
-                <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">{{item.projectName}}</div>
+                <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">
+                    <p>{{item.projectName}}</p> 
+                    <p style="margin-top: 5px;color: #9697B2;">{{item.projectCode}}</p> 
+                </div>
             </div>
         </van-popup> 
     </div>
@@ -438,7 +441,11 @@
                     let text = this.userName
                     let reg = new RegExp(text)
                     let data = this.proads.filter(item => reg.test(item.projectName)) //返回
-                    this.projectss = data
+                    let datas = this.proads.filter(item => reg.test(item.projectCode))
+                    let dataTree = data.concat(datas)
+                    let arrList = Array.from(new Set(dataTree))
+                    // this.projectss = data
+                    this.projectss = arrList
                 } else {
                     console.log(456)
                     this.projectss = this.proads
@@ -1653,9 +1660,9 @@
       z-index: 999; 
   }
   .ryuan {
-        padding: 0 20px;
-        line-height: 40px;
-        height: 40px;
+            padding: 0.3rem 0.53333rem;
+        // line-height: 40px;
+        // height: 40px;
         color: #333;
         border-bottom: 2px solid #f6f6f6;
         width: 100%;

+ 15 - 6
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/weekEdit.vue

@@ -318,9 +318,12 @@
         <!-- 选择项目弹窗 -->
         <van-popup v-model="showPickerUserddp" position="bottom" style="height: 80%">
             <!-- <van-search v-model="userName" placeholder="输入项目名称搜索" @clear="sea()" @blur="sea()" @search="sea()"></van-search> -->
-            <van-search v-model="userName" placeholder="请输入项目名称" @clear="sea()" @blur="sea()" @search="sea()" @input="sea()"/>
+            <van-search v-model="userName" placeholder="请输入项目名称/编号" @clear="sea()" @blur="sea()" @search="sea()" @input="sea()"/>
             <div style="minHeight:300px;">
-                <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">{{item.projectName}}</div>
+                <div v-for="(item, index) in projectss" :key="item.id" class="ryuan" @click="fZr(item, index)">
+                    <p>{{item.projectName}}</p> 
+                    <p style="margin-top: 5px;color: #9697B2;">{{item.projectCode}}</p> 
+                </div>
             </div>
         </van-popup> 
     </div>
@@ -520,8 +523,13 @@
                     console.log(123)
                     let text = this.userName
                     let reg = new RegExp(text)
+                    // let data = this.proads.filter(item => reg.test(item.projectName)) //返回
                     let data = this.proads.filter(item => reg.test(item.projectName)) //返回
-                    this.projectss = data
+                    let datas = this.proads.filter(item => reg.test(item.projectCode))
+                    let dataTree = data.concat(datas)
+                    let arrList = Array.from(new Set(dataTree))
+                    // this.projectss = data
+                    this.projectss = arrList
                 } else {
                     console.log(456)
                     this.projectss = this.proads
@@ -1734,9 +1742,10 @@
       z-index: 999; 
   }
   .ryuan {
-        padding: 0 20px;
-        line-height: 40px;
-        height: 40px;
+       padding: 0.3rem 0.53333rem;
+        // padding: 0 20px;
+        // line-height: 40px;
+        // height: 40px;
         color: #333;
         border-bottom: 2px solid #f6f6f6;
         width: 100%;

+ 0 - 1
fhKeeper/formulahousekeeper/timesheet_h5/vue.config.js

@@ -4,7 +4,6 @@ const path = require('path');
 const themePath = path.resolve(__dirname,'src/assets/style/theme.less');
 
 // var ip = '127.0.0.1'
-// var ip = '192.168.2.4'
 var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
 for (var i in ifaces) {
     for (var j in ifaces[i]) {