Prechádzať zdrojové kódy

手机端增加智能填报
日报非项目工时占比调整

QuYueTing 9 mesiacov pred
rodič
commit
b0b1be734f

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

@@ -381,7 +381,6 @@ public class ReportController {
         TimeType comTimeType = timeTypeMapper.selectById(user.getCompanyId());
         if (company.getId() == 1336) {
             //针对三友反馈的填写的日报内容,但是没有显示出来的问题,打印日志进行追踪
-            System.out.println("user: "+user.getId()+", 填写内容是:");
             if (content != null) {
                 for (int i=0;i<projectId.length; i++) {
                     if (i < content.length) {
@@ -1309,11 +1308,41 @@ public class ReportController {
         //校验非项目工时占比
         User reportOwner = userMapper.selectById(reportList.get(0).getCreatorId());
         if (reportOwner.getUserGroupId() != null) {
+            //获取最大的日期
+            LocalDate maxDate = reportList.stream().map(Report::getCreateDate).max(new Comparator<LocalDate>() {
+                @Override
+                public int compare(LocalDate o1, LocalDate o2) {
+                    return o1.compareTo(o2);
+                }
+            }).get();
+
+            //取最近五个工作日
+            int cnt = 0;
+            LocalDate passDate = maxDate;
+            List<LocalDate> dateCollect = new ArrayList<>();
+            while (true) {
+                if (WorkDayCalculateUtils.isWorkDay(passDate)) {
+                    cnt++;
+                    dateCollect.add(passDate);
+                }
+                if (cnt == 5) {
+                    break;
+                }
+                passDate = passDate.minusDays(1);
+            }
+            //打印dateCollect
+//            for (LocalDate date : dateCollect) {
+//                System.out.println(date);
+//            }
             //获取非项目列表
             List<Project> nonProjectList = projectMapper.selectList(new QueryWrapper<Project>().select("id").eq("is_public", 1).eq("company_id", reportOwner.getCompanyId()));
             List<Integer> collect = nonProjectList.stream().map(Project::getId).collect(Collectors.toList());
-            List<Report> oldRelatedReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id,project_id,working_time").eq("creator_id", reportOwner.getId()).and(wrapper->wrapper.eq("state",0).or().eq("state",1).or().eq("state",3)));
+            List<Report> oldRelatedReportList = reportMapper.selectList(new QueryWrapper<Report>().select("id,project_id,working_time")
+                    .eq("creator_id", reportOwner.getId())
+                    .and(wrapper->wrapper.eq("state",0).or().eq("state",1).or().eq("state",3))
+                    .in("create_date", dateCollect));
             //剔除掉当前日报中的
+
             oldRelatedReportList = oldRelatedReportList.stream().filter(old->!reportList.stream().map(Report::getId).collect(Collectors.toList()).contains(old.getId())).collect(Collectors.toList());
             oldRelatedReportList.addAll(reportList);
             double totalWorkingTime = oldRelatedReportList.stream().mapToDouble(Report::getWorkingTime).sum();

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

@@ -7833,7 +7833,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
         try {
             List<Integer> integerList = reports.stream().map(Report::getProjectId).collect(Collectors.toList());
             //开启状态的子项目
-            List<SubProject> subProjects = subProjectMapper.selectList(new QueryWrapper<SubProject>().in("project_id", integerList).eq("status", 1));
+            List<SubProject> subProjects = integerList.size() > 0?subProjectMapper.selectList(new QueryWrapper<SubProject>().in("project_id", integerList).eq("status", 1)):new ArrayList<>();
             List<SubProject> subProjectList = integerList.size() > 0?subProjects:new ArrayList<>();
             List<ProjectAuditor> auditorList = integerList.size() > 0?projectAuditorMapper.selectList(new QueryWrapper<ProjectAuditor>().in("project_id", integerList)): new ArrayList<>();
             List<Profession> professions = professionMapper.selectList(new QueryWrapper<Profession>().eq("company_id", companyId));
@@ -7843,6 +7843,7 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
             //获取当前项目的子项目列表,任务分组,任务列表,项目相关维度列表
             reports.forEach(r->{
                 r.setContent(null);
+                allProjectList.stream().filter(pItem->pItem.getId().equals(r.getProjectId())).findFirst().ifPresent(p->r.setProjectName(p.getProjectName()));
                 r.setSubProjectList(subProjectList.stream().filter(s->s.getProjectId().equals(r.getProjectId())).collect(Collectors.toList()));
                 r.setTaskList(taskMapper.recentSimpleList(r.getProjectId(), userId, r.getStage(), r.getGroupId()));
                 //获取当前项目的工程专业进度

+ 0 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -6073,9 +6073,7 @@
                                     subProjectId: aiReportData[i].subProjectId == 0?null:aiReportData[i].subProjectId,
                                     groupId: aiReportData[i].groupId == 0?null:aiReportData[i].groupId,
                                     taskId: aiReportData[i].taskId,
-                                    // startTime: `Fri May 16 2021 ${list.report[i].startTime}:12 GMT+0800 (中国标准时间)`,
                                     startTime: aiReportData[i].startTime,
-                                    // endTime: `Fri May 16 2021 ${list.report[i].endTime}:12 GMT+0800 (中国标准时间)`,
                                     endTime: aiReportData[i].endTime,
                                     isOvertime: 0,
                                     progress:aiReportData[i].progress,

+ 120 - 4
fhKeeper/formulahousekeeper/timesheet_h5/src/views/edit/index.vue

@@ -14,8 +14,17 @@
                     </template>
                 </van-field>
 
-                <van-field readonly clickable name="datetimePicker" :value="form.createDate" label="时间选择"
-                    placeholder="点击选择时间" @click="showPicker = true" :rules="rules.createDate" />
+                <van-cell >
+                    <van-field style="padding:0px" readonly clickable name="datetimePicker" :value="form.createDate" label="时间选择"
+                        placeholder="点击选择时间" @click="showPicker = true" :rules="rules.createDate" >
+                    </van-field>
+                    <template #right-icon>
+                        <!--先开放几家,试一下-->
+                        <span style="color:#20a0ff;" @click="getAIReport()" v-if="!hasWrittenReport && (user.companyId==10||user.companyId==7||user.companyId==7030)">智能填报</span>
+                    </template>
+                </van-cell>
+                
+                
                 <van-cell>
                     <template #default>
                         <div class="attendanceRecord">
@@ -573,7 +582,7 @@ export default {
             integrationProjectList: [],
             cardRefLoading: false,
             today: '',
-
+            hasWrittenReport: false,
             showPickerStage: false,
             showPickerTaskGroup: false,
             showPickerSubProject: false,
@@ -1497,7 +1506,113 @@ export default {
                     }
                 }).catch(err => { this.$toast.clear(); });
         },
-
+        getAIReport(createDate) {
+            const toast = this.$toast.loading({
+                forbidClick: true,
+                duration: 0
+            });
+            this.$axios.post('/report/getAIReport', {})
+            .then(res => {
+                if (res.code == "ok") {
+                    var quanbu = 0 
+                    this.jsDay = 1
+                    var zhi = ''
+                    var slp = res.data
+                    for(var i in slp) {
+                        var sp = +slp[i].workingTime + 0
+                        zhi = this.jsDay * sp
+                        quanbu = +quanbu + zhi
+                    }
+                    
+                    this.jsTime = quanbu
+                    var aiReportData = res.data;
+                    this.canCancelInDialog = false
+                    if(aiReportData.length != 0) {
+                        var arr = [];
+                        var list = aiReportData;
+                        console.log('11111111')
+                        for(var i in list) {
+                            var subProjectName = null;
+                            if (list[i].subProjectId) {
+                                subProjectName = list[i].subProjectList.filter(s => s.id == list[i].subProjectId)[0].name;
+                            }
+                            var projectName = list[i].projectName;
+                            console.log('in for loop=='+projectName)
+                            arr.push({
+                                id: list[i].id,
+                                projectId: list[i].projectId,
+                                projectName: projectName,
+                                workingTime: String(list[i].workingTime),
+                                content: list[i].content,
+                                state: list[i].state,
+                                timeType: list[i].timeType,
+                                // label: timeType[list[i].timeType].label,
+                                startTime: list[i].startTime,
+                                endTime: list[i].endTime,
+                                isOvertime: 0,
+                                progress: list[i].progress,
+                                taskList: list[i].taskList,
+                                taskId: list[i].taskId ? list[i].taskId : null,
+                                taskName: list[i].taskName,
+                                professionProgress: list[i].professionProgressList,
+                                pics: null,
+                                multiWorktime: list[i].multiWorktime,
+                                worktimeList: list[i].worktimeList,
+                                wuduList: list[i].degreeList,
+                                degreeId: list[i].degreeId==-1?null:list[i].degreeId,
+                                subProjectId: list[i].subProjectId,
+                                subProjectName: subProjectName,
+                                subProjectList: list[i].subProjectList,
+                                groupId: list[i].groupId == 0 ? null : list[i].groupId,
+                                groupName: list[i].groupName,
+                                taskGroups: list[i].taskGroups,
+                                stages: list[i].stages,
+                                stage: list[i].stage == '-' ? null : list[i].stage,
+                                customData: list[i].customData,
+                                projectAuditorId: list[i].projectAuditorId,
+                                projectAuditorName: list[i].projectAuditorName,
+                                auditUserList: list[i].auditUserList,
+                                overtimeHours: list[i].overtimeHours,
+                                customText: list[i].customText,
+                                basecostId: list[i].basecostId,
+                                //basecostName: basecostName,
+                                canEdit: true,
+                                auditorFirst: list[i].auditorFirst ? list[i].auditorFirst : { name: '', id: '' },
+                                auditorSec: list[i].auditorSec ? list[i].auditorSec : { name: '', id: '' },
+                                auditorThird: list[i].auditorThird ? list[i].auditorThird : { name: '', id: '' },
+                                ccUserid: list[i].ccUserid ? list[i].ccUserid : { name: '', id: '' },
+                                extraField1: list[i].extraField1,
+                                extraField1Name: list[i].extraField1Name,
+                                extraField2: list[i].extraField2,
+                                extraField2Name: list[i].extraField2Name,
+                                extraField3: list[i].extraField3,
+                                extraField3Name: list[i].extraField3Name,
+                                workContentList: list[i].workContentList,
+                                sapServiceId: list[i].sapServiceId,
+                                sapServiceName: list[i].sapServiceName,
+                                serviceList: list[i].serviceList,
+                                userReportDeptName: list[i].userReportDeptName,
+                                reportTargetDeptId: list[i].deptId
+                            })
+                            console.log('执行AIReoprt==========')
+                        }
+                        this.form.domains = arr;
+                        
+                        // this.setTotalReportHours()
+                    } else {
+                        
+                    }
+                    this.canEdit = true;
+                    this.originCanEdit = true;
+                    this.seleChn()
+                } else {
+                    this.$message({
+                        message: res.msg,
+                        type: "error"
+                    });
+                }
+            }).catch(err => { this.$toast.clear(); });
+        },
         // 获取日报
         getReport() {
             this.isWeekend = false
@@ -1534,6 +1649,7 @@ export default {
                         }
                         var list = res.data.report;
                         this.canCancelInDialog = false
+                        this.hasWrittenReport = list.length != 0;
                         if (list.length != 0 && !this.substitute) {
                             this.canEdit = false;
                             this.canCancel = false;