소스 검색

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

Min 1 년 전
부모
커밋
9b9c4161b8

+ 66 - 15
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -692,7 +692,6 @@ public class ReportController {
                 LocalDate curMonthDeadline = LocalDate.now().withDayOfMonth(compTimeType.getFillMonthOnDay());
                 if (createDate.length > 0) {
                     String createDateOne = createDate[0];
-                    //日期都是一样的,取第一个就行了
                     if (fillMonths == 2) {
                         //补填到上个月的情况,要检查当前日期,是否在设置的日期之前
                         LocalDate lastMonth = LocalDate.now().minusMonths(1);
@@ -712,15 +711,20 @@ public class ReportController {
                                 }
                             }
                         } else {
-                            //单日填报,检查日期是否早于限制时间
-                            if (LocalDate.parse(createDateOne, dateTimeFormatter).isBefore(targetDate)) {
-                                isForbidden = true;
-                            } else {
-                                if (LocalDate.parse(createDateOne, dateTimeFormatter).getMonth().getValue() == lastMonth.getMonth().getValue()) {
-                                    //补填到上个月的情况,要检查当前日期,是否在设置的日期之前
-                                    if (LocalDate.now().isAfter(curMonthDeadline)) {
-                                        isForbidden = true;
-                                        isLastMonthFail = true;
+                            //单日或者按周填报
+                            String checkDate = getCheckDate(createDate, id);
+                            //可能返回的是Null,表示都是待审核或者已通过的
+                            if (checkDate != null) {
+                                //检查目标是否早于限制时间
+                                if (LocalDate.parse(checkDate, dateTimeFormatter).isBefore(targetDate)) {
+                                    isForbidden = true;
+                                } else {
+                                    if (LocalDate.parse(checkDate, dateTimeFormatter).getMonth().getValue() == lastMonth.getMonth().getValue()) {
+                                        //补填到上个月的情况,要检查当前日期,是否在设置的日期之前
+                                        if (LocalDate.now().isAfter(curMonthDeadline)) {
+                                            isForbidden = true;
+                                            isLastMonthFail = true;
+                                        }
                                     }
                                 }
                             }
@@ -734,10 +738,14 @@ public class ReportController {
                                 isForbidden = true;
                             }
                         } else {
-                            //单日填报,检查日期是否早于限制时间
-                            if (LocalDate.parse(createDateOne, dateTimeFormatter).isBefore(targetDate)) {
-                                isForbidden = true;
+                            //单日填报,检查日期是否早于限制时间; //可能返回的是Null,表示都是待审核或者已通过的
+                            String checkDate = getCheckDate(createDate, id);
+                            if (checkDate != null) {
+                                if (LocalDate.parse(checkDate, dateTimeFormatter).isBefore(targetDate)) {
+                                    isForbidden = true;
+                                }
                             }
+
                         }
                     }
                 }
@@ -1238,14 +1246,12 @@ public class ReportController {
                                 }else {
                                     groupSum = needCheckReportList.stream().filter(npl -> npl.getGroupId().equals(targetGpId) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
                                 }
-                                System.out.println("groupSum:"+groupSum);
                                 nowReport = reportList.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时检查是否超额
                                 if (tgp != null && tgp.getManDay() != null && tgp.getManDay() > 0) {
                                     multiply = new BigDecimal(tgp.getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
-                                    System.out.println("hasReport:"+hasReport+" multiply:"+multiply);
                                     if (hasReport.doubleValue() > multiply.doubleValue()) {
                                         if (estimateTimeSetting.getGroupFronzeOnLack() == 1) {
                                             httpRespMsg.setError("超过当前项目["+first.get().getProjectName()+"]分组["+tgp.getName()+"]预算工时,无法继续提交工时");
@@ -2338,5 +2344,50 @@ public class ReportController {
         return reportService.getUserTimeCostByThird(json);
     }
 
+
+    private String getCheckDate(String[] createDate, Integer[] id) {
+        String checkDate = null;
+        String createDateOne = createDate[0];
+        if (createDate.length == 1) {
+            checkDate = createDateOne;
+        } else {
+            List<Integer> idParams = ListUtil.fromIntegers(id);
+            //只取填报过的日报id,新增加的不用检查
+            idParams = idParams.stream().filter(i->i!=-1).collect(Collectors.toList());
+            if (idParams.size() >0) {
+                //已通过或待审核的日报
+                System.out.println("=============查询已通过或者待审核的日报==================");
+                List<Report> passOrPendingReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id").in("id", idParams).and(reportQueryWrapper -> reportQueryWrapper.eq("state", 1).or().eq("state", 0)));
+                if (passOrPendingReportList.size() > 0) {
+                    List<Integer> collect = passOrPendingReportList.stream().map(Report::getId).collect(Collectors.toList());
+                    for (int i=0;i<id.length; i++) {
+                        if (!collect.contains(id[i])) {
+                            if (checkDate == null) {
+                                checkDate = createDate[i];
+                            } else {
+                                //取最早的日期
+                                if (createDate[i].compareTo(checkDate) < 0) {
+                                    checkDate = createDate[i];
+                                }
+                            }
+                        }
+                    }
+                }
+            } else {
+                //全是新增的情况,取最早的一个日期
+                for (int i=0;i<createDate.length; i++) {
+                    if (checkDate == null) {
+                        checkDate = createDate[i];
+                    } else {
+                        //取最早的日期
+                        if (createDate[i].compareTo(checkDate) < 0) {
+                            checkDate = createDate[i];
+                        }
+                    }
+                }
+            }
+        }
+        return checkDate;
+    }
 }
 

+ 2 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Report.java

@@ -403,6 +403,8 @@ public class Report extends Model<Report> {
     @TableField("sap_service_id")
     private Integer sapServiceId;
 
+    @TableField(exist = false)
+    private List<SapProjectService> serviceList;
 
     @Override
     protected Serializable pkVal() {

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

@@ -1845,37 +1845,37 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             }
                             if (withPercent == 1) {
                                 //工时占比
-                                membRowData.add(String.valueOf(new BigDecimal((Double)resultList.get(0).get("cost")/curUserTotalTime*100).setScale(1, BigDecimal.ROUND_HALF_UP))+"%");
+                                membRowData.add(String.valueOf(new BigDecimal((Double)resultList.get(0).get("cost")/curUserTotalTime*100).setScale(2, BigDecimal.ROUND_HALF_UP))+"%");
                             }
                             costTime += (Double)resultList.get(0).get("cost");
                             moneyCost = moneyCost.add((BigDecimal)resultList.get(0).get("costMoney"));
                         }else{
                             if ("hours".equals(exportContent) && functionTimeList.size()>0){
-                                membRowData.add("");
+                                membRowData.add("0");
                             }else if ("cost".equals(exportContent) && functionCostList.size()>0){
-                                membRowData.add("");
+                                membRowData.add("0");
                             }else {
                                 if(functionTimeList.size()>0){
-                                    membRowData.add("");
+                                    membRowData.add("0");
                                 }
                                 if(functionCostList.size()>0){
-                                    membRowData.add("");
+                                    membRowData.add("0");
                                 }
                             }
                             if (withPercent == 1) {
                                 //工时占比
-                                membRowData.add("");
+                                membRowData.add("0");
                             }
                         }
                     }
 
                     if ("hours".equals(exportContent) && functionTimeList.size()>0){
-                        membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                        membRowData.add(""+new BigDecimal(costTime).setScale(2, BigDecimal.ROUND_HALF_UP));
                     }else if ("cost".equals(exportContent) && functionCostList.size()>0){
                         membRowData.add(moneyCost.toString());
                     }else {
                         if(functionTimeList.size()>0){
-                            membRowData.add(""+new BigDecimal(costTime).setScale(1, BigDecimal.ROUND_HALF_UP));
+                            membRowData.add(""+new BigDecimal(costTime).setScale(2, BigDecimal.ROUND_HALF_UP));
                         }
                         if(functionCostList.size()>0){
                             membRowData.add(moneyCost.toString());

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

@@ -204,6 +204,8 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
     @Resource
     private ReportAuditLogService reportAuditLogService;
     @Resource
+    private TaskExecutorMapper taskExecutorMapper;
+    @Resource
     private TimeTypeService timeTypeService;
     @Resource
     private HttpServletRequest request;
@@ -792,6 +794,20 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                     List<ProFunWorkContext> workContentList = ((List<ProFunWorkContext>)funWorkContextList.data);
                     r.setWorkContentList(workContentList);
                 }
+                //依斯贝要返回服务
+                if (companyId == 3092) {
+                    Integer taskId = r.getTaskId();
+                    if (taskId != null) {
+                        List<TaskExecutor> executorList = taskExecutorMapper.selectList(new QueryWrapper<TaskExecutor>().eq("task_id", taskId).eq("executor_id", r.getCreatorId()));
+                        List<String> sapServiceIds = executorList.stream().map(TaskExecutor::getServiceId).collect(Collectors.toList());
+                        if (sapServiceIds.size() > 0) {
+                            List<SapProjectService> sapSList = sapProjectServiceMapper.selectList(new QueryWrapper<SapProjectService>().in("id", sapServiceIds));
+                            r.setServiceList(sapSList);
+                        } else {
+                            r.setServiceList(new ArrayList<>());
+                        }
+                    }
+                }
             });
             resultMap.put("report", reports);
             TimeType timeType = timeTypeMapper.selectById(companyId);
@@ -1590,6 +1606,19 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 targetUids = ListUtil.convertLongIdsArrayToList(userId);
             }
             List<Map<String, Object>> auditReportList = reportMapper.getAuditReportList(date, companyId, departmentId, projectId, leaderId, isEngeering, startDate, endDate, targetUids);
+            //针对依斯贝增加服务名称显示
+            if (companyId == 3092) {
+                List<SapProjectService> serviceList = sapProjectServiceMapper.selectList(new QueryWrapper<SapProjectService>().eq("company_id", companyId));
+                for (Map<String, Object> mapItem : auditReportList) {
+                    Integer sapServiceId = (Integer)mapItem.get("sapServiceId");
+                    if (sapServiceId != null) {
+                        Optional<SapProjectService> first = serviceList.stream().filter(s -> s.getId().equals(sapServiceId)).findFirst();
+                        if (first.isPresent()) {
+                            mapItem.put("sapServiceName", first.get().getServiceName());
+                        }
+                    }
+                }
+            }
             //抽取姓名,进行分组
             List<Map<String, Object>> nameList = new ArrayList<Map<String, Object>>();
             Map<String, Object> lastName = null;

+ 7 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/util/ListUtil.java

@@ -154,4 +154,11 @@ public class ListUtil {
 		}
 		return ids;
 	}
+	public static List<Integer> fromIntegers(Integer[] data) {
+		List<Integer> ids = new ArrayList<>();
+		for (int i : data) {
+			ids.add(i);
+		}
+		return ids;
+	}
 }

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

@@ -234,10 +234,10 @@
             and executor_id like '%${userId}%'
         </if>
         <if test="stage != null">
-            and stages.stagesName = #{stage}
+            and stages.stages_name = #{stage}
         </if>
         <if test="groupId != null">
-            and task.gruop_id = #{groupId}
+            and task.group_id = #{groupId}
         </if>
         and task_status = 0 order by task.id desc limit 50
     </select>

+ 1 - 1
fhKeeper/formulahousekeeper/timesheet/src/components/taskComponent.vue

@@ -69,7 +69,7 @@
             <el-form-item :label="$t('zhi-hang-ren') + (index+1)" v-for="(executorItem, index) in addForm.executorListFront" :key="index">
                 <div class="editingTask">
                     <div style="margin-right: 30px">
-                        <el-select v-if="user.userNameNeedTranslate != 1" v-model="executorItem.executorId" :disabled="(addForm.id != null && user.id != addForm.createrId && currentProject.inchargerId != user.id) && !permissions.projectManagement && !(groupResponsibleId == user.id)" size="small" filterable clearable :placeholder="$t('pleaseselectanexecutor')" style="width:40%;" @change="$forceUpdate()">
+                        <el-select v-if="user.userNameNeedTranslate != 1" v-model="executorItem.executorId" :disabled="(addForm.id != null && user.id != addForm.createrId && currentProject.inchargerId != user.id) && !permissions.projectManagement && !(groupResponsibleId == user.id)" size="small" filterable clearable :placeholder="$t('pleaseselectanexecutor')" style="width: 150px" @change="$forceUpdate()">
                             <el-option v-for="item in users" :key="item.id" :label="item.name" :value="item.id">
                                 <span style="float: left">{{ item.name }}</span>
                                 <span style="float: right; color: #8492a6; font-size: 13px;margin-left: 20px" v-if="item.jobNumber">{{ item.jobNumber }}</span>

+ 3 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/team/index.vue

@@ -451,7 +451,7 @@
                               <span style="float: right; color: #8492a6; font-size: 13px">{{item.departmentName}}</span>
                           </el-option>
                       </el-select>
-                      <selectCat :size="'medium'" :widthStr="'360'" v-if="user.userNameNeedTranslate == '1'" :subject="users" :subjectId="depForm.managerId" :distinction="'3'" @selectCal="selectCal"></selectCat>
+                      <selectCat :size="'medium'" :widthStr="'360'" v-if="user.userNameNeedTranslate == '1'" :subject="users" :subjectId="insertForm.superiorId" :distinction="'6'" @selectCal="selectCal"></selectCat>
                   </el-form-item>
                   <el-form-item :label="$t('jiao-se')" prop="roleId" v-if="roleNameFlg != $t('role.superAdministrator')">
                       <el-select v-model="insertForm.roleId" :placeholder="$t('defaultText.pleaseChoose')" style="width: 100%">
@@ -3554,6 +3554,8 @@ export default {
       } else if(obj.distinction == '23') {
         console.log(obj, '返回qwe')
         this.transferActive.takeoverId = obj.id
+      } else if (obj.distinction == '6') {
+        this.insertForm.superiorId = obj.id;
       }
     },
     // 企业微信可见范围设置

+ 78 - 3
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -1251,9 +1251,12 @@
         <!-- 按部门选择人员 -->
         <el-dialog :title="$t('defaultText.selectthepersonwhneedstofillinthereport')"  v-if="chooseParticipVisible" :visible.sync="chooseParticipVisible" :close-on-click-modal="false" customClass="customWidth" width="500px">
             <el-input v-if="user.userNameNeedTranslate != 1" style="width:100%" v-model="deptMembDataText" :placeholder="$t('defaultText.pleaseEnterNametoSearch')"></el-input>
+            <el-input v-if="user.userNameNeedTranslate == 1" placeholder="请输入姓名搜索" v-model.trim="nameAearch" class="input-with-select" clearable @input="nameAearchSeek(false)">
+                <el-button slot="append" icon="el-icon-search" @click="nameAearchSeek(true)"></el-button>
+            </el-input>
             <div class="tree" style="height:400px">
                 <el-scrollbar style="height:100%">
-                <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id"
+                <el-tree :data="deptMembData" show-checkbox :props="defaultProps" node-key="id" v-loading="deptMembDataLoading"
                     ref="chooseMembTree" @check-change="onTreeItemChange" :default-checked-keys="workForm.userId"
                     highlight-current :filter-node-method="filterNode">
                     <span class="custom-tree-node" slot-scope="{ node }">
@@ -1268,6 +1271,7 @@
                         <span v-if="user.userNameNeedTranslate != '1'">
                             {{ node.label }}
                         </span>
+                        <!-- {{ node.label }} -->
                     </span>    
                 </el-tree>
                 </el-scrollbar>
@@ -2207,6 +2211,10 @@
                 weekIndex: 1,
                 weekParentData: {},
                 deptIdForNoReport:[],
+
+                nameAearch: '', // 企业微信姓名搜索
+                deptMembDataBackups: [], // 企业微信备份代填日报的树形结构
+                deptMembDataLoading: false
             };
         },
         watch: {
@@ -4622,6 +4630,8 @@
                                 }
                                 this.setUserToDept(noAllData);
                                 this.deptMembData = noAllData;
+                                this.deptMembDataBackups = JSON.parse(JSON.stringify(this.deptMembData))
+                                console.log(this.deptMembData, '代填人员数据')
                             } else {
                                 this.$message({
                                     message: res.msg,
@@ -5406,7 +5416,8 @@
                                     extraField2: list.report[i].extraField2,
                                     extraField3: list.report[i].extraField3,
                                     workContentList: list.report[i].workContentList,
-                                    filteredRespList: filteredRespList
+                                    filteredRespList: filteredRespList,
+                                    serviceList: list.report[i].serviceList
                                 })
                                 if (list.report[i].state >= 2) {
                                     this.canEdit = true;
@@ -7349,7 +7360,7 @@
                                 formData.append('extraField3', this.workForm.domains[i].extraField3);
                             }
                             //依斯贝的服务Id
-                            if (this.user.companyId == this.yisibeiCompId || this.user.companyId == 10) {
+                            if (this.user.companyId == this.yisibeiCompId) {
                                 formData.append('sapServiceId', this.workForm.domains[i].sapServiceId);
                             }
                         }
@@ -7609,6 +7620,70 @@
                 this.getDepartment();
                 this.getRecentlyProject()
             },
+            // 待填日报姓名搜索
+            nameAearchSeek(flg) {
+                if(!this.nameAearch) {
+                    this.deptMembData = JSON.parse(JSON.stringify(this.deptMembDataBackups))
+                    return
+                }
+                if(flg) {
+                    this.enterpriseWechatgetUser()
+                }
+            },
+            handleThreeData(userList) {
+                console.log(userList, '人员数据')
+                let deptMembDataBackups = JSON.parse(JSON.stringify(this.deptMembDataBackups))
+                this.deptMembData = this.filterTreeNodes(deptMembDataBackups, userList)
+            },
+            // 过滤树节点
+            filterTreeNodes(treeData, filterKeywords) {
+                return treeData.filter((node) => {
+                    if (filterKeywords.some((keyword) => node.label.includes(keyword))) {
+                        if (node.children && node.children.length > 0) {
+                        node.children = this.filterTreeNodes(node.children, filterKeywords);
+                        }
+                        return true;
+                    }
+                    if (node.children && node.children.length > 0) {
+                        node.children = this.filterTreeNodes(node.children, filterKeywords);
+                        return node.children.length > 0;
+                    }
+                    return false;
+                });
+            },
+            // 企业微信获取人员
+            enterpriseWechatgetUser() {
+                this.deptMembDataLoading = true
+                this.http.post('/user/getEmployeeList',{
+                    departmentId: -1,
+                    pageIndex: 1,
+                    pageSize: 100,
+                    keyword: this.nameAearch,
+                    status: '',
+                    roleId: '',
+                    cursor: '',
+                    onlyDirect: '',
+                    matchingType: ''
+                },res => {
+                    if(res.code == 'ok'){
+                        this.deptMembDataLoading = false
+                        const userListName = res.data.records.map(item => item.name)
+                        this.handleThreeData(userListName)
+                    }else{
+                        this.deptMembDataLoading = false
+                        this.$message({
+                            message: res.msg,
+                            type: 'error'
+                        })
+                    }
+                },err => {
+                    this.deptMembDataLoading = false
+                    this.$message({
+                        message: err,
+                        type: 'error'
+                    })
+                })
+            },
             // 自定义事件
             selectCal(obj) {
                 console.log(obj, '传数据来源')

+ 2 - 1
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/list.vue

@@ -130,7 +130,8 @@
                                                         <span>角色:{{item.extraField1? roleList.filter(r=>r.value == item.extraField1)[0].label:''}}</span>
                                                     <span style="margin-left:10px;">工作职责:{{ item.extraField2? item.extraField2Name:''}}</span>
                                                     <span style="margin-left:10px;">工作内容:{{ item.extraField3? item.extraField3Name:''}}</span></p>
-                                <p v-if="item.taskId != null">{{$t('other.task')}}:{{item.taskName}}</p>
+                                <p v-if="item.taskId != null">{{$t('other.task')}}:{{item.taskName}}
+                                    <span style="margin-left:10px;" v-if="user.companyId==3092">-- 服务:{{ item.sapServiceName }}</span></p>
                                 <p v-if="item.groupId">
                                     <span>{{$t('other.taskGroup')}}:{{item.groupName}}</span>
                                     <!-- 阶段 -->