Jelajahi Sumber

项目报表中增加俩列:首次填报日期和最后填报日期

yusm 1 tahun lalu
induk
melakukan
0384a8f665

+ 11 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/ProjectVO.java

@@ -1,12 +1,15 @@
 package com.management.platform.entity.vo;
 
+import com.fasterxml.jackson.annotation.JsonFormat;
 import com.management.platform.entity.Participation;
 import com.management.platform.entity.ParticipationUser;
 import com.management.platform.entity.Project;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
 
+import java.time.LocalDate;
 import java.util.List;
 import java.util.Map;
 
@@ -23,4 +26,12 @@ public class ProjectVO extends Project {
     String projectAuditorName;
     String projectAuditorId;
     List<Map<String,Object>> providerInfoList;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate minFilingDate;
+
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @DateTimeFormat(pattern = "yyyy-MM-dd")
+    private LocalDate maxFilingDate;
 }

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

@@ -639,6 +639,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     totalProgress = totalProgress/100/100;
                     projectVO.setProgress(totalProgress);
                 }
+                Optional<LocalDate> maxFillDate = reportList.stream().filter(report -> report.getCreateDate() != null && projectVO.getId().equals(report.getProjectId())).map(Report::getCreateDate).max(Comparator.comparing(date -> date.toEpochDay()));
+                Optional<LocalDate> minFillDate = reportList.stream().filter(report -> report.getCreateDate() != null && projectVO.getId().equals(report.getProjectId())).map(Report::getCreateDate).min(Comparator.comparing(date -> date.toEpochDay()));
+                maxFillDate.ifPresent(projectVO::setMaxFilingDate);
+                minFillDate.ifPresent(projectVO::setMinFilingDate);
 
                 list.add(projectVO);
             }
@@ -2751,12 +2755,16 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
         DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         List<Project> projectList = projectMapper.selectList(queryWrapper);
         List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", companyId));
+        List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>().select("id, create_date, project_id, working_time").eq("company_id",companyId).and(wrapper -> wrapper.eq("state", 0).or().eq("state", 1).or().eq("state", 3)));
         List<ProjectVO> list = new ArrayList<>();
         //String[] statusNames = {"-","进行中","已完成","已撤销","暂停"};
         String[] statusNames = {"-",MessageUtils.message("excel.onGoing"),MessageUtils.message("excel.complete"),MessageUtils.message("excel.revoke"),MessageUtils.message("excel.pause")};
         List<List<String>> exportList = new ArrayList<>();
         //String[] titles = {"项目编号", "项目名称", "负责人", "项目金额(元)", "状态","计划开始时间", "计划结束时间", "完成度"};
-        String[] titles = {MessageUtils.message("entry.projectId"), MessageUtils.message("entry.projectName"), MessageUtils.message("excel.charge"), MessageUtils.message("excel.projectAmount")+"(元)", MessageUtils.message("leave.status"),MessageUtils.message("excel.planStart"), MessageUtils.message("excel.planEnd"), MessageUtils.message("excel.degree")};
+        String[] titles = {MessageUtils.message("entry.projectId"), MessageUtils.message("entry.projectName"),
+                MessageUtils.message("excel.charge"), MessageUtils.message("excel.projectAmount")+"(元)", MessageUtils.message("leave.status")
+                ,MessageUtils.message("excel.planStart"), MessageUtils.message("excel.planEnd"),
+                MessageUtils.message("excel.minFillDate"), MessageUtils.message("excel.maxFillDate"),MessageUtils.message("excel.degree")};
         exportList.add(Lists.list(titles));
         for (Project project : projectList) {
             List<String> data = new ArrayList<>();
@@ -2779,6 +2787,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             data.add(project.getStatus()==null?"":statusNames[project.getStatus()]);
             data.add(project.getPlanStartDate() != null?df.format(project.getPlanStartDate()):"");
             data.add(project.getPlanEndDate() != null?df.format(project.getPlanEndDate()):"");
+
+            Optional<LocalDate> maxFillDate = reportList.stream().filter(report -> report.getCreateDate() != null && project.getId().equals(report.getProjectId())).map(Report::getCreateDate).max(Comparator.comparing(date -> date.toEpochDay()));
+            Optional<LocalDate> minFillDate = reportList.stream().filter(report -> report.getCreateDate() != null && project.getId().equals(report.getProjectId())).map(Report::getCreateDate).min(Comparator.comparing(date -> date.toEpochDay()));
+            data.add(minFillDate.map(String::valueOf).orElse(""));
+            data.add(maxFillDate.map(String::valueOf).orElse(""));
+
             data.add(project.getProgress() != null?project.getProgress()+"%" :"");
             exportList.add(data);
         }

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

@@ -630,6 +630,8 @@ excel.remarks=备注
 excel.charge=负责人
 excel.projectAmount=项目金额
 excel.planStart=计划开始时间
+excel.minFillDate=首次填报日期
+excel.maxFillDate=最后填报日期
 excel.planEnd=计划结束时间
 excel.degree=完成度
 excel.genExp=一般费用

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

@@ -631,6 +631,8 @@ excel.charge=person in charge
 excel.projectAmount=Project amount
 excel.planStart=Planned start time
 excel.planEnd=Planned end time
+excel.minFillDate=min fill Date
+excel.maxFillDate=max fill Date
 excel.degree=Degree of completion
 excel.genExp=General expenses
 excel.traExp=Travel expenses

+ 2 - 0
fhKeeper/formulahousekeeper/timesheet/src/i18n/en.json

@@ -567,6 +567,8 @@
   "schedulestarttime": "plan start time",
   "completeness": "Completeness",
   "scheduleendtime": "planned end time",
+  "minFillDate": "min fill Date",
+  "maxFillDate": "max fill Date",
   "artificialcost": "Labor cost",
   "expirationdate": "expiration date",
   "shi-ji-gong-shi": "Actual working hours",

+ 2 - 0
fhKeeper/formulahousekeeper/timesheet/src/i18n/zh.json

@@ -568,6 +568,8 @@
   "he-tong-jine-yuan": "合同金额(元)",
   "schedulestarttime": "计划开始时间",
   "scheduleendtime": "计划结束时间",
+  "minFillDate": "首次填报日期",
+  "maxFillDate": "最后填报日期",
   "completeness": "完成度",
   "shi-ji-gong-shi": "实际工时",
   "expirationdate": "截止日期",

+ 10 - 0
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -246,6 +246,16 @@
                         {{scope.row.planEndDate}}
                     </template>
                 </el-table-column>
+                <el-table-column prop="minFilingDate" :label="$t('minFillDate')" >
+                    <template slot-scope="scope">
+                        {{scope.row.minFilingDate}}
+                    </template>
+                </el-table-column>
+                <el-table-column prop="maxFilingDate" :label="$t('maxFillDate')" >
+                    <template slot-scope="scope">
+                        {{scope.row.maxFilingDate}}
+                    </template>
+                </el-table-column>
                 <el-table-column prop="progress" :label="$t('completeness')">
                     <template slot-scope="scope">
                         {{scope.row.progress==null?"-":scope.row.progress}}%