Browse Source

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

Min 1 year ago
parent
commit
99c72d1421

+ 18 - 10
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -1193,7 +1193,6 @@ public class ReportController {
                             decimalFormat.format(report.getWorkingTime())));
                     return httpRespMsg;
                 }
-
             }
         }
         //如果开启了加班时长校验
@@ -1219,8 +1218,17 @@ public class ReportController {
         String warningGroupLack = "";
         EstimateTimeSetting estimateTimeSetting = null;
         if(comTimeType.getProjectManDay()==1){
-            Collection<Integer> projectIds = reportList.stream().map(Report::getProjectId).distinct().collect(Collectors.toList());
-            List<Report> needCheckReportList = reportMapper.selectList(new QueryWrapper<Report>().in("project_id", projectIds).and(wrapper->wrapper.eq("state",0).or().eq("state",1).or().eq("state",3)));
+            //剔除其中已通过的日报
+            List<Integer> filledReportIds = reportList.stream().filter(r->r.getId() != -1).map(Report::getId).collect(Collectors.toList());
+            List<Report> targetCheckList = reportList;
+            if (filledReportIds.size() > 0) {
+                List<Report> passedReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id").in("id", filledReportIds).eq("state", 1));
+                if (passedReportList.size() > 0) {
+                    targetCheckList = reportList.stream().filter(r->!passedReportList.stream().map(Report::getId).collect(Collectors.toList()).contains(r.getId())).collect(Collectors.toList());
+                }
+            }
+            Collection<Integer> projectIds = targetCheckList.stream().map(Report::getProjectId).distinct().collect(Collectors.toList());
+            List<Report> oldRelatedReportList = reportMapper.selectList(new QueryWrapper<Report>().in("project_id", projectIds).and(wrapper->wrapper.eq("state",0).or().eq("state",1).or().eq("state",3)));
             List<Project> targetProjectList = projectList.stream().filter(pl -> projectIds.contains(pl.getId())).collect(Collectors.toList());
             estimateTimeSetting = estimateTimeSettingMapper.selectById(company.getId());
             //如果没有设置过项目人天,就初始化一下
@@ -1230,18 +1238,18 @@ public class ReportController {
                 estimateTimeSettingMapper.insert(estimateTimeSetting);
                 estimateTimeSetting = estimateTimeSettingMapper.selectById(company.getId());
             }
-            for (Report report : reportList) {
+            for (Report report : targetCheckList) {
                 HttpRespMsg httpRespMsg = new HttpRespMsg();
                 Optional<Project> first = targetProjectList.stream().filter(tl -> tl.getId().equals(report.getProjectId())).findFirst();
                 if(first.isPresent()){
-                    double nowReport = reportList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId())).mapToDouble(Report::getWorkingTime).sum();
+                    double nowReport = targetCheckList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId())).mapToDouble(Report::getWorkingTime).sum();
                     if(first.get().getManDay()!=null){
                         //已填报的工时情况
                         double sum;
                         if(first.get().getManDayStartDate()!=null){
-                            sum = needCheckReportList.stream().filter(npl -> npl.getProjectId().equals(first.get().getId()) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
+                            sum = oldRelatedReportList.stream().filter(npl -> npl.getProjectId().equals(first.get().getId()) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
                         }else {
-                            sum = needCheckReportList.stream().filter(npl -> npl.getProjectId().equals(first.get().getId()) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
+                            sum = oldRelatedReportList.stream().filter(npl -> npl.getProjectId().equals(first.get().getId()) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
                         }
                         BigDecimal hasReport = new BigDecimal(sum).add(new BigDecimal(nowReport));
                         BigDecimal multiply = new BigDecimal(first.get().getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
@@ -1263,11 +1271,11 @@ public class ReportController {
                             if (targetGpId != null) {
                                 double groupSum = 0;
                                 if(first.get().getManDayStartDate()!=null){
-                                    groupSum = needCheckReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
+                                    groupSum = oldRelatedReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) &&(npl.getCreateDate().isAfter(first.get().getManDayStartDate())||npl.getCreateDate().isEqual(first.get().getManDayStartDate()))&& (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
                                 }else {
-                                    groupSum = needCheckReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
+                                    groupSum = oldRelatedReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
                                 }
-                                nowReport = reportList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId()) && targetGpId.equals(rl.getGroupId())).mapToDouble(Report::getWorkingTime).sum();
+                                nowReport = targetCheckList.stream().filter(rl -> rl.getCreateDate().equals(report.getCreateDate()) && rl.getCreatorId().equals(report.getCreatorId()) && targetGpId.equals(rl.getGroupId())).mapToDouble(Report::getWorkingTime).sum();
                                 hasReport = new BigDecimal(groupSum).add(new BigDecimal(nowReport));
                                 TaskGroup tgp = taskGroupService.getById(targetGpId);
                                 //设置的数值大于0时检查是否超额

+ 11 - 5
fhKeeper/formulahousekeeper/timesheet/src/views/corpreport/list.vue

@@ -1104,7 +1104,8 @@
             </el-table>
 
             <!-- 分组耗用进度表 -->
-            <el-table  v-if="ins == 24" :key="24" border :data="isbeCustomReport.consumptionSchedule" highlight-current-row v-loading="listLoading" :height="(+tableHeight + 50) - 1" style="width: 100%;" :span-method="objectSpanMethod">
+            <el-table  v-if="ins == 24" :key="24" border :data="isbeCustomReport.consumptionSchedule" highlight-current-row v-loading="listLoading" :height="(+tableHeight - 0) - 1" style="width: 100%;" :span-method="objectSpanMethod">
+              <el-table-column align="center" prop="projectName" label="项目名称" min-width="200"></el-table-column>
               <el-table-column align="center" prop="department_name" label="负责部门" min-width="150">
                 <template slot-scope="scope">
                   <div>
@@ -1220,7 +1221,7 @@
               <el-table-column align="center" prop="workTime" label="实际工时" min-width="150"></el-table-column>
             </el-table>
         <!--工具条-->
-        <el-col :span="24" class="toolbar" v-if="ins != 6 && ins != 20 && ins != 21 && ins != 24">
+        <el-col :span="24" class="toolbar" v-if="ins != 6 && ins != 20 && ins != 21">
           <el-pagination
                 v-if="ins == 12"
                 @size-change="groupSizeChange"
@@ -1790,14 +1791,16 @@ export default {
       if(this.permissions.reportProjectEstimated) {this.ssl(27);this.reportProjectEstimated = '1-28';return} else
       {this.allWrong = false}
     },
-    rowspan(spanArr,position,spanName,dataItem = []){
+    rowspan(spanArr,position,spanName,dataItem = [],fields=false){
       let newArray = dataItem.length > 0 ? dataItem : this.list1
       newArray.forEach((item,index) => {
         if(index == 0){
           spanArr.push(1)
           position = 0
         }else {
-          if(newArray[index][spanName] == newArray[index-1][spanName]){
+          let newArrFlag = newArray[index][spanName] == newArray[index-1][spanName] && (!fields || newArray[index][fields] == newArray[index-1][fields]);
+          // if(newArray[index][spanName] == newArray[index-1][spanName]){
+          if(newArrFlag){
             spanArr[position] += 1
             spanArr.push(0)
           }else {
@@ -3779,13 +3782,16 @@ export default {
       let parameter = {
         startDate: this.rangeDatas[0],
         endDate: this.rangeDatas[1],
+        pageIndex: this.page,
+        pageSize: this.size,
       }
       this.listLoading = true
       let { data } = await this.postData('/project/groupExpendProcessList', {
         ...parameter
       }) 
       this.resetMerge()
-      this.rowspan(this.listArr1, this.listPosition1, 'corpwxDeptId', data.record)
+      this.rowspan(this.listArr1, this.listPosition1, 'projectId', data.record)
+      this.rowspan(this.listArr2, this.listPosition2, 'corpwxDeptId', data.record, 'projectId')
       this.isbeCustomReport.consumptionSchedule = data.record
       this.total = data.total
       this.listLoading = false