Преглед изворни кода

资源分配接口,任务增加开始时间,审批流部门

seyason пре 3 година
родитељ
комит
5440fb8933
24 измењених фајлова са 289 додато и 162 уклоњено
  1. 2 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/constant/Constant.java
  2. 41 18
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/FinanceTblcuscolController.java
  3. 2 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ProjectController.java
  4. 3 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserController.java
  5. 23 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/UserCorpwxTimeController.java
  6. 8 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/FinanceFixedcolname.java
  7. 7 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/SubProject.java
  8. 10 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Task.java
  9. 1 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/GanttDataItem.java
  10. 6 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/mapper/ProjectMapper.java
  11. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/ProjectService.java
  12. 1 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/UserService.java
  13. 1 1
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DepartmentServiceImpl.java
  14. 4 2
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java
  15. 27 64
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java
  16. 30 47
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java
  17. 47 12
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java
  18. 15 0
      fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java
  19. 36 0
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml
  20. 2 1
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/SubProjectMapper.xml
  21. 5 3
      fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml
  22. 1 1
      fhKeeper/formulahousekeeper/timesheet/src/views/project/project_gantt.vue
  23. 8 6
      fhKeeper/formulahousekeeper/timesheet/src/views/workflow/report.vue
  24. 8 0
      fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/constant/Constant.java

@@ -29,4 +29,6 @@ public class Constant {
             "Adobe After Effects","Axure RP","Sketch"};//定时任务未处理的状态码
 //    public static final String ACCESS_KEY = "280d6f0e4a774117905ba789a9f0b978";//百度图像识别accessKey
 //    public static final String SECRET_KEY = "43b460e124eb474c8cdb7441dc30d66d";//百度图像识别secretKey
+    //角色定义
+    public static final String[] ROLE_NAMES = {"普通员工","超级管理员", "系统管理员", "无","财务管理员","项目管理员","公司领导"};
 }

+ 41 - 18
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/FinanceTblcuscolController.java

@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -40,50 +41,72 @@ public class FinanceTblcuscolController {
     @Resource
     private FinanceFixedcolnameService financeFixedcolnameService;
 
-    @RequestMapping("/get")
-    public HttpRespMsg get(Integer companyId) {
+//    @RequestMapping("/get")
+//    public HttpRespMsg get(Integer companyId) {
+//        List<FinanceTblcuscol> list = financeTblcuscolMapper.selectList(new QueryWrapper<FinanceTblcuscol>().eq("company_id", companyId));
+//        HttpRespMsg msg = new HttpRespMsg();
+//        msg.data = list;
+//        return msg;
+//    }
+
+    @RequestMapping("/getAll")
+    public HttpRespMsg getAll(Integer companyId) {
         List<FinanceTblcuscol> list = financeTblcuscolMapper.selectList(new QueryWrapper<FinanceTblcuscol>().eq("company_id", companyId));
         HttpRespMsg msg = new HttpRespMsg();
-        msg.data = list;
-        return msg;
-    }
+        FinanceFixedcolname item = financeFixedcolnameService.getFixed(companyId);
+        if (list.size() > 0) {
+            item.setField1(list.get(0).getFieldName());
+        }
+        if (list.size() > 1) {
+            item.setField2(list.get(1).getFieldName());
+        }
+        if (list.size() > 2) {
+            item.setField3(list.get(2).getFieldName());
+        }
+        msg.data = item;
 
-    @RequestMapping("/getFixed")
-    public HttpRespMsg getFixed(Integer companyId) {
-        HttpRespMsg msg = new HttpRespMsg();
-        msg.data = financeFixedcolnameService.getFixed(companyId);
         return msg;
     }
+//
+//    @RequestMapping("/getFixed")
+//    public HttpRespMsg getFixed(Integer companyId) {
+//        HttpRespMsg msg = new HttpRespMsg();
+//        msg.data = financeFixedcolnameService.getFixed(companyId);
+//        return msg;
+//    }
 
     @RequestMapping("/save")
-    public HttpRespMsg addOrMod(FinanceFixedcolname item, String field1, String field2, String field3) {
+    public HttpRespMsg addOrMod(FinanceFixedcolname item) {
         String token = request.getHeader("TOKEN");
         int companyId = userMapper.selectById(token).getCompanyId();
         financeTblcuscolMapper.delete(new QueryWrapper<FinanceTblcuscol>().eq("company_id", companyId));
-        if (!StringUtils.isEmpty(field1)) {
+        if (!StringUtils.isEmpty(item.getField1())) {
             FinanceTblcuscol col = new FinanceTblcuscol();
             col.setCompanyId(companyId);
-            col.setFieldName(field1);
+            col.setFieldName(item.getField1());
             financeTblcuscolMapper.insert(col);
         }
 
-        if (!StringUtils.isEmpty(field2)) {
+        if (!StringUtils.isEmpty(item.getField2())) {
             FinanceTblcuscol col = new FinanceTblcuscol();
             col.setCompanyId(companyId);
-            col.setFieldName(field2);
+            col.setFieldName(item.getField2());
             financeTblcuscolMapper.insert(col);
         }
 
-        if (!StringUtils.isEmpty(field3)) {
+        if (!StringUtils.isEmpty(item.getField3())) {
             FinanceTblcuscol col = new FinanceTblcuscol();
             col.setCompanyId(companyId);
-            col.setFieldName(field3);
+            col.setFieldName(item.getField3());
             financeTblcuscolMapper.insert(col);
         }
 
         //存储自定义的固定字段
-        item.setCompanyId(companyId);
-        financeFixedcolnameService.saveOrUpdate(item);
+        if (item.getMonthCost() != null || item.getBonus() != null || item.getAllowance() != null || item.getInsuranceInjury() != null
+            || item.getInsuranceLosejob() != null || item.getInsuranceMedical() != null || item.getInsuranceOld() != null || item.getHouseFund() != null) {
+            item.setCompanyId(companyId);
+            financeFixedcolnameService.saveOrUpdate(item);
+        }
 
         return new HttpRespMsg();
     }

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

@@ -306,8 +306,8 @@ public class ProjectController {
     }
 
     @RequestMapping("/getGanttData")
-    public HttpRespMsg getGanttData(HttpServletRequest request) {
-        return projectService.getGanttData(request);
+    public HttpRespMsg getGanttData(@RequestParam(required = false, defaultValue = "0") Integer type, String startDate, String endDate, String userId, Integer projectId, HttpServletRequest request) {
+        return projectService.getGanttData(type, startDate, endDate, userId, projectId, request);
     }
 
     /**

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

@@ -196,6 +196,9 @@ public class UserController {
     }
 
 
+    @RequestMapping("/batchUpdateDept")
+    public HttpRespMsg batchUpdateDept(String userIds, Integer deptId) {return userService.batchUpdateDept(userIds, deptId, request); }
+
 
 }
 

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

@@ -152,6 +152,21 @@ public class UserCorpwxTimeController {
             item.put("projects", new ArrayList<String>());
         }
 
+        //获取该时间段已经审核通过的报告
+        List<Report> reportList = reportService.list(new QueryWrapper<Report>()
+                .eq("company_id", user.getCompanyId()).between("create_date", startDate, endDate).eq("state", 1));
+
+        DateTimeFormatter splashDtf = DateTimeFormatter.ofPattern("yyyy/MM/dd");
+        //数据填充
+        for (Map dataItem : list) {
+            List<String> dataList = new ArrayList<>();
+            String userId = (String)dataItem.get("userId");
+            String createDate = (String)dataItem.get("createDate");
+            //检查该人员当天是否已经有审核通过的
+            boolean hasPassed = reportList.stream().anyMatch(r->r.getCreatorId().equals(userId) && splashDtf.format(r.getCreateDate()).equals(createDate));
+            dataItem.put("hasPassed", hasPassed);
+        }
+
         //返回数据
         HttpRespMsg msg = new HttpRespMsg();
         msg.data = item;
@@ -207,6 +222,7 @@ public class UserCorpwxTimeController {
         HttpRespMsg msg = new HttpRespMsg();
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
+        Integer companyId = user.getCompanyId();
         Integer manageDeptId = user.getManageDeptId();
 
         HttpRespMsg ret = getMyDeptMembsData(startDate, endDate);
@@ -232,10 +248,16 @@ public class UserCorpwxTimeController {
         }
         List<List<String>> allData = new ArrayList<>();
         allData.add(titles);
+
         //数据填充
         for (Map dataItem : list) {
             List<String> dataList = new ArrayList<>();
-            dataList.add((String)dataItem.get("createDate"));
+            boolean hasPassed = (boolean)dataItem.get("hasPassed");
+            if (hasPassed) {
+                continue;
+            }
+            String createDate = (String)dataItem.get("createDate");
+            dataList.add(createDate);
             dataList.add((String)dataItem.get("weekDayTxt"));
             dataList.add((String)dataItem.get("username"));
             dataList.add((String)dataItem.get("startTime"));

+ 8 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/FinanceFixedcolname.java

@@ -74,6 +74,14 @@ public class FinanceFixedcolname extends Model<FinanceFixedcolname> {
     @TableField("house_fund")
     private String houseFund;
 
+    @TableField(exist = false)
+    private String field1;
+
+    @TableField(exist = false)
+    private String field2;
+
+    @TableField(exist = false)
+    private String field3;
 
     @Override
     protected Serializable pkVal() {

+ 7 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/SubProject.java

@@ -15,7 +15,7 @@ import lombok.experimental.Accessors;
  * </p>
  *
  * @author Seyason
- * @since 2022-02-28
+ * @since 2022-03-16
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -42,6 +42,12 @@ public class SubProject extends Model<SubProject> {
     @TableField("company_id")
     private Integer companyId;
 
+    /**
+     * 编号
+     */
+    @TableField("code")
+    private String code;
+
 
     @Override
     protected Serializable pkVal() {

+ 10 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Task.java

@@ -14,7 +14,6 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
-import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * <p>
@@ -22,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestParam;
  * </p>
  *
  * @author Seyason
- * @since 2021-05-11
+ * @since 2022-03-18
  */
 @Data
 @EqualsAndHashCode(callSuper = false)
@@ -186,6 +185,15 @@ public class Task extends Model<Task> {
 
     @TableField(exist = false)
     private String projectName;
+    /**
+     * 开始日期
+     */
+    @TableField("start_date")
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate startDate;
+
+
     @Override
     protected Serializable pkVal() {
         return this.id;

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

@@ -12,6 +12,7 @@ public class GanttDataItem {
     public String userId;
     public String text;
     public Integer duration;
+    public double planHours;
     @JsonFormat(pattern = "yyyy-MM-dd")
     public Date start_date;
     @JsonFormat(pattern = "yyyy-MM-dd")

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

@@ -54,6 +54,12 @@ public interface ProjectMapper extends BaseMapper<Project> {
 
     List<Map> getGanttData(@Param("userIds") List<String> userIds, @Param("companyId") Integer companyId);
 
+    List<Map> getTaskPlanByMemb(@Param("userIds") List<String> userIds, @Param("startDate") String startDate,
+                                    @Param("endDate") String endDate, @Param("companyId") Integer companyId);
+
+    List<Map> getTaskPlanByProject(@Param("projectIds") List<Integer> projectIds, @Param("startDate") String startDate,
+                                @Param("endDate") String endDate, @Param("companyId") Integer companyId);
+
     List<ProjectWithStage> selectWithStage(Integer companyId, Integer startIndex, Integer endIndex);
 
     List<Map<String, Object>> getTimeCostReport(@Param("companyId") Integer companyId, @Param("startDate") String startDate, @Param("endDate") String endDate,

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

@@ -85,7 +85,7 @@ public interface ProjectService extends IService<Project> {
 
     HttpRespMsg exportCustomerProjectInAndOut(HttpServletRequest request);
 
-    HttpRespMsg getGanttData(HttpServletRequest request);
+    HttpRespMsg getGanttData(Integer type, String startDate, String endDate, String userId, Integer projectId,HttpServletRequest request);
 
     HttpRespMsg getProjectStagesCost(Integer pageIndex, Integer pageSize, HttpServletRequest request);
 

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

@@ -62,4 +62,5 @@ public interface UserService extends IService<User> {
 
     HttpRespMsg loginByUserId(String userId, HttpServletRequest request);
 
+    HttpRespMsg batchUpdateDept(String userIds, Integer deptId, HttpServletRequest request);
 }

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

@@ -424,7 +424,7 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
             }
 //            Map<String, Object> finalMap = new HashMap<>();
 //            List<Map<String, Object>> finalList = new ArrayList<>();
-            DecimalFormat df = new DecimalFormat("#.0");
+            DecimalFormat df = new DecimalFormat("#.00");
             List<List<String>> dataList = new ArrayList<List<String>>();
             String[] titles = {"人员", "项目", "工时(h)", "成本(元)"};
             List<String> titleList = Arrays.asList(titles.clone());

+ 4 - 2
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/FinanceServiceImpl.java

@@ -448,7 +448,7 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
 //            headList.add("失业保险(元)");
 //            headList.add("工伤保险(元)");
 //            headList.add("住房公积金(元)");
-            FinanceFixedcolname fixedItem = financeFixedcolnameService.getById(companyId);
+            FinanceFixedcolname fixedItem = financeFixedcolnameService.getFixed(companyId);
             headList.add(fixedItem.getMonthCost()+"(元)");
             headList.add(fixedItem.getBonus()+"(元)");
             headList.add(fixedItem.getAllowance()+"(元)");
@@ -1075,7 +1075,9 @@ public class FinanceServiceImpl extends ServiceImpl<FinanceMapper, Finance> impl
                 } else {
                     System.out.println("财务数据中未找到用户:"+creatorId);
                 }
-
+                if (curProject == null) {
+                    System.out.println("projectId="+projectId+", creatorId="+creatorId);
+                }
                 if (curProject.equals(item.project)) {
                     item.workingTime += workingTime;
                     item.cost = item.cost.add(cost);

+ 27 - 64
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/ProjectServiceImpl.java

@@ -1338,7 +1338,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     }
 
     @Override
-    public HttpRespMsg getGanttData(HttpServletRequest request) {
+    public HttpRespMsg getGanttData(Integer type, String startDate, String endDate, String targetUserId, Integer targetProjectId, HttpServletRequest request) {
         //根据人员权限来获取,
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
@@ -1366,10 +1366,22 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
             userIds = userList.stream().map(User::getId).collect(Collectors.toList());
         }
+        if (targetUserId != null) {
+            userIds = userIds.stream().filter(u->u.equals(targetUserId)).collect(Collectors.toList());
+        }
         HttpRespMsg msg = new HttpRespMsg();
         List<GanttDataItem> itemList = new ArrayList<>();
+        List<Integer> projectIds = null;
+        List<Map> ganttData = null;
         if (userIds.size() > 0) {
-            List<Map> ganttData = projectMapper.getGanttData(userIds, user.getCompanyId());
+            if (type == 0) {
+                //按人员获取
+                ganttData = projectMapper.getTaskPlanByMemb(userIds, startDate ,endDate, user.getCompanyId());
+            } else {
+                ganttData = projectMapper.getTaskPlanByProject(projectIds, startDate ,endDate, user.getCompanyId());
+
+            }
+//            List<Map> ganttData = projectMapper.getTaskPlanByMemb(userIds, user.getCompanyId());
             String lastUserId = null;
 
             GanttDataItem lastUserItem = null;
@@ -1378,73 +1390,24 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                 Map map = ganttData.get(i);
                 String userId = (String) map.get("user_id");
                 Date start_date = (Date) map.get("start_date");
-                Date plan_end_date = (Date) map.get("plan_end_date");
+                Date end_date = (Date) map.get("end_date");
 
-                if (!userId.equals(lastUserId)) {
-                    //新员工记录产生了
-                    lastUserItem = new GanttDataItem();
+                lastUserItem = new GanttDataItem();
+                if (type == 0) {
                     lastUserItem.text = (String) map.get("name");
-                    lastUserItem.id = userId;
-                    lastUserItem.userId = (String) map.get("user_id");
-                    lastUserItem.start_date = start_date;
-                    lastUserItem.end_date = plan_end_date;
-                    if (plan_end_date != null && start_date != null) {
-                        lastUserItem.duration = (int)(plan_end_date.getTime() - start_date.getTime())/(24*3600*1000);
-                    }
-
-                    itemList.add(lastUserItem);
-                    lastUserId = userId;
-                    //项目也放进去
-                    GanttDataItem projectItem = new GanttDataItem();
-                    projectItem.text = (String) map.get("project_name");
-                    projectItem.id = lastUserId + "_" + (Integer) map.get("id");
-                    projectItem.userId = (String) map.get("user_id");
-                    projectItem.start_date = start_date;
-                    projectItem.end_date = plan_end_date;
-                    if (plan_end_date != null && start_date != null) {
-                        projectItem.duration = (int)(plan_end_date.getTime() - start_date.getTime())/24*3600*1000;
-                    }
-                    projectItem.parent = lastUserId;
-                    itemList.add(projectItem);
                 } else {
-                    //计算开始和结束日期
-                    GanttDataItem projectItem = new GanttDataItem();
-                    projectItem.text = (String) map.get("project_name");
-                    projectItem.id = lastUserId + "_" + (Integer) map.get("id");
-                    projectItem.userId = (String) map.get("user_id");
-                    projectItem.start_date = start_date;
-                    projectItem.end_date = plan_end_date;
-                    if (plan_end_date != null && start_date != null) {
-                        projectItem.duration = (int)((plan_end_date.getTime() - start_date.getTime())/(24*3600*1000));
-
-                        System.out.println("projectItem.duration ==" + projectItem.duration );
-                    }
-                    projectItem.parent = lastUserId;
-                    boolean userItemChanged = false;
-                    if (lastUserItem.start_date == null && start_date != null) {
-                        lastUserItem.start_date = start_date;
-                        userItemChanged = true;
-                    }
-                    if (lastUserItem.end_date == null && plan_end_date != null) {
-                        lastUserItem.end_date = plan_end_date;
-                        userItemChanged = true;
-                    }
-
-                    if (start_date != null && start_date.getTime() < lastUserItem.start_date.getTime()) {
-                        lastUserItem.start_date = start_date;
-                        userItemChanged = true;
-                    }
-                    if (plan_end_date != null && plan_end_date.getTime() > lastUserItem.end_date.getTime()) {
-                        lastUserItem.end_date = plan_end_date;
-                        userItemChanged = true;
-                    }
+                    lastUserItem.text = (String) map.get("project_name");
+                }
 
-                    //重新计算时长
-                    if (userItemChanged && lastUserItem.start_date != null && lastUserItem.end_date != null) {
-                        lastUserItem.duration = (int)(lastUserItem.start_date.getTime() - lastUserItem.end_date.getTime())/(24*3600*1000);
-                    }
-                    itemList.add(projectItem);
+                lastUserItem.id = userId;
+                lastUserItem.userId = (String) map.get("user_id");
+                lastUserItem.start_date = start_date;
+                lastUserItem.end_date = end_date;
+                if (end_date != null && start_date != null) {
+                    lastUserItem.duration = (int)(end_date.getTime() - start_date.getTime())/(24*3600*1000);
                 }
+
+                itemList.add(lastUserItem);
             }
         }
 

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

@@ -1187,10 +1187,10 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             String str = null;
             String fillUserId = null;
             if (oneReport.getState() == -1) {//待部门直属领导审核
-                str = "您"+date+"导入的日报中"+pNames+"项目被直属领导驳回。原因:" + reason+",请重新导入。";
+                str = "您"+date+"导入的日报中"+pNames+"项目被["+user.getName()+"]驳回。原因:" + reason+",请重新导入。";
                 fillUserId = oneReport.getFillUserid();
             } else {
-                str = "您"+date+"填写的日报中"+pNames+"项目被领导驳回。原因:" + reason;
+                str = "您"+date+"填写的日报中"+pNames+"项目被["+user.getName()+"]驳回。原因:" + reason;
                 fillUserId = oneReport.getCreatorId();
             }
 
@@ -1802,30 +1802,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         String token = request.getHeader("TOKEN");
         User user = userMapper.selectById(token);
         Integer companyId = user.getCompanyId();
-
-//        String startDate = month + "-01";
-//        LocalDate ld = LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-//        int year = ld.getYear();
-//        boolean isLerpYear = false;
-//        if (year%4==0&&year%100!=0) {
-//            isLerpYear = true;
-//        } else if (year%400==0) {
-//            isLerpYear = true;
-//        }
-//
-//        int dm = ld.getMonthValue();
-//        int maxDaysOfMonth = 28;
-//        if (dm == 1 || dm == 3 || dm == 5 || dm == 7 || dm == 8 || dm == 10 || dm == 12) {
-//            maxDaysOfMonth = 31;
-//        } else if (dm == 2) {
-//            if (isLerpYear) {
-//                maxDaysOfMonth = 29;
-//            }
-//        } else {
-//            maxDaysOfMonth = 30;
-//        }
-
-//        String endDate = month + "-"+maxDaysOfMonth;
+        String[] weekDayCHN = {"周一","周二","周三","周四","周五","周六","周日"};
         HttpRespMsg msg = new HttpRespMsg();
         List<Map<String, Object>> list = null;
         //分角色权限:管理员看全部的,部门负责人看自己部门的,个人只能看自己的。
@@ -1877,12 +1854,19 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             lastUserId = id;
         }
         HashMap map = new HashMap();
-        List<Integer> days = new ArrayList<>();
-        LocalDate localStartDate = LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-        LocalDate localEndDate = LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+        List<HashMap> days = new ArrayList<HashMap>();
+        DateTimeFormatter standFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate localStartDate = LocalDate.parse(startDate, standFormatter);
+        LocalDate localEndDate = LocalDate.parse(endDate, standFormatter);
+        DateTimeFormatter mdFormat = DateTimeFormatter.ofPattern("M.d");
         long count = localStartDate.until(localEndDate, ChronoUnit.DAYS);
-        for (int i=1;i<=count;i++) {
-            days.add(i);
+        for (int i=0;i<=count;i++) {
+            LocalDate d = localStartDate.plusDays(i);
+            String dow = weekDayCHN[d.getDayOfWeek().getValue()-1];
+            HashMap mapItem = new HashMap();
+            mapItem.put("label", mdFormat.format(d)+"/"+dow);
+            mapItem.put("date", standFormatter.format(d));
+            days.add(mapItem);
         }
         map.put("days", days);
         map.put("list", userMonthWorks);
@@ -1895,19 +1879,18 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         HttpRespMsg msg = getUserDailyWorkTime(request, startDate, endDate);
         String[] weekDayCHN = {"周一","周二","周三","周四","周五","周六","周日"};
         HashMap map = (HashMap) msg.data;
-        List<Integer> days = (List<Integer>)map.get("days");
+        List<HashMap> days = (List<HashMap>)map.get("days");
         List<UserMonthWork> userMonthWorks = (List<UserMonthWork>) map.get("list");
         List<List<String>> dataList = new ArrayList<>();
         List<String> titleList = new ArrayList<>();
         titleList.add("序号");
         titleList.add("姓名");
         days.forEach(d->{
-            String dateStr = startDate;
-            LocalDate date = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-            date = date.plusDays(d-1);
-            String chn = weekDayCHN[date.getDayOfWeek().getValue()-1];
-            String m = ""+date.getMonthValue();
-            titleList.add(m+"."+d+"/"+chn);
+//            String dateStr = (String)d.get("date");
+//            LocalDate date = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+//            String chn = weekDayCHN[date.getDayOfWeek().getValue()-1];
+//            String m = ""+date.getMonthValue();
+            titleList.add((String)d.get("label"));
         });
         dataList.add(titleList);
         for (int i=0;i<userMonthWorks.size(); i++) {
@@ -1918,11 +1901,11 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             //找到那一天的工作时间
             List<Map<String, Object>> worktimeList = userMonthWork.worktimeList;
             days.forEach(d->{
-                String dateStr = startDate;
-                LocalDate date = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
-                //计算当前遍历到的那一天
-                date = date.plusDays(d-1);
-                final String fDateStr = DateTimeFormatter.ofPattern("yyyy-MM-dd").format(date);
+//                String dateStr = startDate;
+//                LocalDate date = LocalDate.parse(dateStr, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
+//                //计算当前遍历到的那一天
+//                date = date.plusDays(d-1);
+                final String fDateStr = (String)d.get("date");
                 Optional<Map<String, Object>> op = worktimeList.stream().filter(m -> ((String) m.get("createDate")).equals(fDateStr)).findFirst();
                 if (op.isPresent()) {
                     Map<String, Object> createDateHour = op.get();
@@ -2595,7 +2578,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         long cnt = localStart.until(localEnd, ChronoUnit.DAYS);
         //按人员过滤
         for (User curUser: allRangeUserList) {
-            for (int i=0;i<cnt; i++) {
+            for (int i=0;i<=cnt; i++) {
                 LocalDate date = localStart.plusDays(i);
                 final String dateStr = dtf.format(date);
                 if (!list.stream().anyMatch(item->item.get("id").equals(curUser.getId())&&sdf.format((java.sql.Date)item.get("createDate")).equals(dateStr))) {
@@ -2643,14 +2626,14 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     public HttpRespMsg exportNoReportUserList(HttpServletRequest request, String startDate, String endDate) {
         HttpRespMsg msg = getNoReportUserList(request, startDate, endDate);
         String[] weekDayCHN = {"周一","周二","周三","周四","周五","周六","周日"};
-        HashMap map = (HashMap) msg.data;
-        List<Integer> days = (List<Integer>)map.get("days");
-        List<UserDailyWorkItem> dailyWorkItems = (List<UserDailyWorkItem>) map.get("list");
+        List<UserDailyWorkItem> dailyWorkItems = (List<UserDailyWorkItem>) msg.data;
         List<List<String>> dataList = new ArrayList<>();
         List<String> titleList = new ArrayList<>();
         titleList.add("部门");
         titleList.add("姓名");
         titleList.add("未填日期");
+        dataList.add(titleList);
+
         for (int i=0;i<dailyWorkItems.size(); i++) {
             UserDailyWorkItem dataItem = dailyWorkItems.get(i);
             List<String> line = new ArrayList<>();

+ 47 - 12
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -1,5 +1,6 @@
 package com.management.platform.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.aliyun.dysmsapi20170525.models.SendSmsResponse;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -983,11 +984,12 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             sheet.setColumnWidth(1, 10 * 256);
             sheet.setColumnWidth(2, 20 * 256);
             sheet.setColumnWidth(3, 20 * 256);
-            sheet.setColumnWidth(4, 10 * 256);
-
+            sheet.setColumnWidth(4, 20 * 256);
             sheet.setColumnWidth(5, 10 * 256);
+
             sheet.setColumnWidth(6, 10 * 256);
             sheet.setColumnWidth(7, 10 * 256);
+            sheet.setColumnWidth(8, 10 * 256);
             //设置为居中加粗
             HSSFCellStyle headStyle = workbook.createCellStyle();
             HSSFFont font = workbook.createFont();
@@ -1002,18 +1004,21 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             headCell.setCellValue("姓名");
             headCell.setCellStyle(headStyle);
             headCell = headRow.createCell(2);
-            headCell.setCellValue("手机号");
+            headCell.setCellValue("角色");
             headCell.setCellStyle(headStyle);
             headCell = headRow.createCell(3);
-            headCell.setCellValue("部门");
+            headCell.setCellValue("手机号");
             headCell.setCellStyle(headStyle);
             headCell = headRow.createCell(4);
-            headCell.setCellValue("月薪");
+            headCell.setCellValue("部门");
             headCell.setCellStyle(headStyle);
             headCell = headRow.createCell(5);
-            headCell.setCellValue("薪");
+            headCell.setCellValue("薪");
             headCell.setCellStyle(headStyle);
             headCell = headRow.createCell(6);
+            headCell.setCellValue("时薪");
+            headCell.setCellStyle(headStyle);
+            headCell = headRow.createCell(7);
             headCell.setCellValue("状态");
             headCell.setCellStyle(headStyle);
 
@@ -1037,16 +1042,17 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
                 HSSFRow row = sheet.createRow(rowNum);
                 row.createCell(0).setCellValue(rowNum);
                 row.createCell(1).setCellValue(item.getName());
-                row.createCell(2).setCellValue(item.getPhone());
-                row.createCell(3).setCellValue(item.getDepartmentName());
-                row.createCell(4).setCellValue(item.getMonthCost()==null? 0 : item.getMonthCost().intValue());
-                row.createCell(5).setCellValue(item.getCost() == null?0.0 : item.getCost().doubleValue());
-                row.createCell(6).setCellValue(item.getIsActive()==1?"正常":"已停用");
+                row.createCell(2).setCellValue(Constant.ROLE_NAMES[item.getRole()]);
+                row.createCell(3).setCellValue(item.getPhone());
+                row.createCell(4).setCellValue(item.getDepartmentName());
+                row.createCell(5).setCellValue(item.getMonthCost()==null? 0 : item.getMonthCost().intValue());
+                row.createCell(6).setCellValue(item.getCost() == null?0.0 : item.getCost().doubleValue());
+                row.createCell(7).setCellValue(item.getIsActive()==1?"正常":"已停用");
 
                 rowNum++;
             }
             //生成Excel文件
-            String fileUrlSuffix = "全部员工列表" + System.currentTimeMillis() + ".xls";
+            String fileUrlSuffix = "员工列表" + System.currentTimeMillis() + ".xls";
             FileOutputStream fos = new FileOutputStream(path + fileUrlSuffix);
             workbook.write(fos);
             fos.flush();
@@ -1342,6 +1348,35 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
         return httpRespMsg;
     }
 
+    @Override
+    public HttpRespMsg batchUpdateDept(String userIds, Integer deptId, HttpServletRequest request) {
+        HttpRespMsg msg = new HttpRespMsg();
+        if (!StringUtils.isEmpty(userIds)) {
+            List<String> array = JSONArray.parseArray(userIds, String.class);
+            if (array.size() > 0) {
+                List<User> userList = new ArrayList<User>();
+                String deptCascade = deptId == null ?
+                        convertDepartmentIdToCascade(0) :
+                        convertDepartmentIdToCascade(deptId);
+                for (String id : array) {
+                    User u = new User();
+                    u.setId(id);
+                    u.setDepartmentId(deptId==null?0:deptId);
+                    u.setDepartmentCascade(deptCascade);
+                    userList.add(u);
+                }
+                updateBatchById(userList);
+            } else {
+                msg.setError("人员不能为空");
+            }
+        } else {
+            msg.setError("人员不能为空");
+        }
+
+
+        return msg;
+    }
+
 
     public boolean push(User user, String date) {
         //1,配置

+ 15 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/task/TimingTask.java

@@ -111,6 +111,21 @@ public class TimingTask {
         }
     }
 
+    //每个月6号早上6点同步上个月的企业微信考勤考勤打卡记录
+    @Scheduled(cron = "0 0 6 6 * ?")
+    private void synMonthCorpWXCardTime() {
+        LocalDateTime lastMonth = LocalDateTime.now().minusMonths(1);
+        LocalDateTime start = lastMonth.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
+        LocalDateTime now = LocalDateTime.now().withDayOfMonth(1);
+        LocalDateTime end = now.minusDays(1).withHour(0).withMinute(0).withSecond(0).withNano(0);
+        System.out.println("开始同步上个月的考勤记录");
+        List<TimeType> typeList = timeTypeMapper.selectList(new QueryWrapper<TimeType>().eq("sync_corpwx_time", 1));
+        for (TimeType type : typeList) {
+            Integer companyId = type.getCompanyId();
+            wxCorpInfoService.getUserCheckInDayData(companyId, null, start, end);
+        }
+    }
+
     //发送上周填写的工时统计
     @Scheduled(cron = "0 0 8 ? * *")
     private void lastWeekFillTimeAlert() {

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

@@ -305,6 +305,42 @@
         ORDER BY participation.user_id, project.`plan_start_date`
     </select>
 
+    <select id="getTaskPlanByMemb" resultType="java.util.Map">
+        SELECT user.`id` as user_id, user.`name`,project.id, project.`project_name`,task.id, task.name,
+            IFNULL(task.`start_date`, task.end_date) as start_date, task.`end_date`,
+        TIMESTAMPDIFF(DAY,task.`start_date`, task.`end_date`) AS duration, task.plan_hours FROM user
+        LEFT JOIN task ON user.id = task.`executor_id`
+        LEFT JOIN project ON project.`id` = task.`project_id`
+        WHERE user.`id` IN
+        <foreach collection="userIds" close=")" open="(" separator="," index="" item="item">
+            #{item}
+        </foreach>
+        and ((IFNULL(task.start_date , task.end_date) between #{startDate} and #{endDate}) or (task.end_date between #{startDate} and #{endDate}))
+        and task.end_date is not null
+        AND project.`status` = 1
+        ORDER BY user.id, task.start_date
+    </select>
+
+
+    <select id="getTaskPlanByProject" resultType="java.util.Map">
+        SELECT user.id as user_id, user.`name`,project.id, project.`project_name`,task.id, task.name,
+        IFNULL(task.`start_date`, task.end_date) as start_date, task.`end_date`,
+        TIMESTAMPDIFF(DAY,task.`start_date`, task.`end_date`) AS duration, task.plan_hours FROM project
+        LEFT JOIN task ON task.project_id = project.id
+        LEFT JOIN user ON user.`id` = task.`executor_id`
+        WHERE 1=1
+        <if test="projectIds != null">
+            and project.`id` IN
+            <foreach collection="projectIds" close=")" open="(" separator="," index="" item="item">
+                #{item}
+            </foreach>
+        </if>
+        and ((IFNULL(task.start_date , task.end_date) between #{startDate} and #{endDate}) or (task.end_date between #{startDate} and #{endDate}))
+        and task.end_date is not null
+        AND project.`status` = 1
+        ORDER BY project.id, task.start_date
+    </select>
+
     <!--获取加班统计报表 -->
     <select id="getOvertimeList" resultType="java.util.Map">
         SELECT report.`creator_id` AS userId, user.`name` AS username, SUM(report.`working_time`) AS workingTime,

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

@@ -8,11 +8,12 @@
         <result column="name" property="name" />
         <result column="project_id" property="projectId" />
         <result column="company_id" property="companyId" />
+        <result column="code" property="code" />
     </resultMap>
 
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, project_id, company_id
+        id, name, project_id, company_id, code
     </sql>
     <!--获取某个项目内子项目的工时成本统计-->
     <select id="getTimeCost" resultType="java.util.Map">

+ 5 - 3
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TaskMapper.xml

@@ -28,6 +28,7 @@
         <result column="task_type" property="taskType" />
         <result column="parent_tname" property="parentTname" />
         <result column="finish_date" property="finishDate" />
+        <result column="start_date" property="startDate" />
     </resultMap>
 
     <resultMap id="timeResultMap" type="com.management.platform.entity.TimeTask" >
@@ -55,6 +56,7 @@
         <result column="task_type" property="taskType" />
         <result column="parent_tname" property="parentTname" />
         <result column="finish_date" property="finishDate" />
+        <result column="start_date" property="startDate" />
         <result column="work_hours" property="workHours" />
     </resultMap>
     <resultMap id="RichResultMap" type="com.management.platform.entity.Task">
@@ -83,16 +85,16 @@
         <result column="parent_tname" property="parentTname" />
         <result column="finish_date" property="finishDate" />
         <result column="project_name" property="projectName" />
+        <result column="start_date" property="startDate" />
         <result column="stages_name" property="stagesName" />
     </resultMap>
 
-
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
-        id, name, task_desc, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date
+        id, name, task_desc, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date, start_date
     </sql>
     <select id="simpleList" resultMap="BaseResultMap">
-        select id, name, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date
+        select id, name, creater_id, creater_name, creator_color, executor_id, executor_name, executor_color, task_level, task_status, create_date, end_date, project_id, stages_id, company_id, indate, parent_tid, group_id, seq, plan_hours, task_type, parent_tname, finish_date, start_date
         from task
         ${ew.customSqlSegment}
     </select>

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

@@ -30,7 +30,7 @@ export default {
       },
 
       getList() {
-        this.http.post('/project/getGanttData',{},
+        this.http.post('/project/getGanttData',{type:0, startDate:'2022-03-01', endDate:'2022-03-31'},
                         res => {
                             if (res.code == "ok") {
                                 this.tasks = {data:res.data};

+ 8 - 6
fhKeeper/formulahousekeeper/timesheet/src/views/workflow/report.vue

@@ -18,9 +18,13 @@
         <el-col :span="18" >
             <el-scrollbar style="height:100%;border:1px solid #dddddd;margin-right:20px;" >
             <div class="tree" :style="'height:'+ (tableHeight-120) + 'px'">
-                <div style="padding:5px;color:#333;" v-if="depData != null && depData.children == null">设置 &lt;<span style="color:#20a0ff;">{{depData.label}}&gt;</span> 工时审批流程</div>
-                <div style="padding:5px;" v-if="depData == null || depData.children != null">请选择最末级部门</div>
-                <div style="width:100%;margin:0 auto;text-align: center; margin-top:50px;" v-if="depData != null && depData.children == null">
+                <div style="padding:5px;color:#333;" v-if="depData != null">设置 &lt;<span style="color:#20a0ff;">{{depData.label}}&gt;</span> 直属人员工时审批流程
+                    <el-tooltip effect="dark" v-if="depData != null && depData.children!=null" content="仅适用于当前部门的直属人员,子部门人员的审批流程需要单独设置" placement="top-start">
+                    <i class="el-icon-question"></i>
+                    </el-tooltip>
+                </div>
+                <div style="padding:5px;" v-if="depData == null">请选择部门</div>
+                <div style="width:100%;margin:0 auto;text-align: center; margin-top:50px;" v-if="depData != null">
                     <span>员工填报</span>
                     <icon class="iconfont firerock-iconright"></icon>
                     <icon class="iconfont firerock-iconInsertLine addNode" @click="showNodeDialog(0)"></icon>
@@ -212,9 +216,7 @@
                 if(this.depData == null || data.id != this.depData.id) {
                     this.depData = data;
                     console.log(this.depData);
-                    if (this.depData.children == null) {
-                        this.getSettings();
-                    }
+                    this.getSettings();
                 }
             },
 

+ 8 - 0
fhKeeper/formulahousekeeper/timesheet_h5/src/views/index/index.vue

@@ -112,6 +112,7 @@
                         url: '/project',
                         icon: 'label-o'
                     });
+                
                     // 自己加的
                 // this.routers.push({
                 //         name: '导入日报审核',
@@ -134,6 +135,13 @@
                         icon: 'label-o'
                     });
                 }
+                if (this.user.leader) {
+                    this.routers.push({
+                        name: '项目报告审核',
+                        url: '/review',
+                        icon: 'todo-list-o'
+                    });
+                }
             }
             if(this.user.role == 1 || this.user.role == 2) {
                 this.routers.push({