浏览代码

代填获取的项目按照代填的人员来获取

QuYueTing 8 月之前
父节点
当前提交
1adbb9d349

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

@@ -99,8 +99,8 @@ public class ProjectController {
      * 获取项目列表
      * 获取项目列表
      */
      */
     @RequestMapping("/getProjectList")
     @RequestMapping("/getProjectList")
-    public HttpRespMsg getProjectList(@RequestParam(required = false, defaultValue = "0") Integer forReport) {
-        return projectService.getProjectList(forReport, request);
+    public HttpRespMsg getProjectList(@RequestParam(required = false, defaultValue = "0") Integer forReport, String userId) {
+        return projectService.getProjectList(forReport, userId, request);
     }
     }
 
 
     /**
     /**
@@ -1263,8 +1263,8 @@ public class ProjectController {
      * @return
      * @return
      */
      */
     @RequestMapping("/nearProject")
     @RequestMapping("/nearProject")
-    public HttpRespMsg nearProject(HttpServletRequest request){
-        return projectService.nearProject(request);
+    public HttpRespMsg nearProject(HttpServletRequest request, String userId){
+        return projectService.nearProject(request, userId);
     }
     }
 
 
     //FTE报表
     //FTE报表

+ 22 - 7
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -923,12 +923,21 @@ public class ReportController {
                     }
                     }
 
 
                     List<LocalDate> workDaysListInRange = WorkDayCalculateUtils.getWorkDaysListInRange(startDate, endDate, comTimeType.getIncludeWeekends());
                     List<LocalDate> workDaysListInRange = WorkDayCalculateUtils.getWorkDaysListInRange(startDate, endDate, comTimeType.getIncludeWeekends());
-                    if (workDaysListInRange.size() == 0) {
-                        HttpRespMsg msg = new HttpRespMsg();
-                        //msg.setError("工作日天数为0,无法提交。(批量填报会自动跳过节假日,请尝试填写日报或者重新选择日期范围)");
-                        msg.setError(MessageUtils.message("profession.SubmitErrorByDay"));
-                        return msg;
+                    if (targetUids==null || targetUids.length == 0) {
+                        if (workDaysListInRange.size() == 0) {//批量填报要按照工作日来计算
+                            HttpRespMsg msg = new HttpRespMsg();
+                            //msg.setError("工作日天数为0,无法提交。(批量填报会自动跳过节假日,请尝试填写日报或者重新选择日期范围)");
+                            msg.setError(MessageUtils.message("profession.SubmitErrorByDay"));
+                            return msg;
+                        }
+                    } else {
+                        //代填的情况,如果是指定日期,直接使用该日期
+                        if (startDate.equals(endDate)) {
+                            workDaysListInRange = new ArrayList<>();
+                            workDaysListInRange.add(LocalDate.parse(startDate, DateTimeFormatter.ofPattern("yyyy-MM-dd")));
+                        }
                     }
                     }
+
                     //获取当前填报人所在部门的自定义审核流程
                     //获取当前填报人所在部门的自定义审核流程
                     for (LocalDate localStartDate : workDaysListInRange) {
                     for (LocalDate localStartDate : workDaysListInRange) {
                         if (targetUserList == null) {
                         if (targetUserList == null) {
@@ -1786,7 +1795,8 @@ public class ReportController {
         }
         }
 
 
 
 
-        if (createDate[0].contains("@") && targetUserList == null) {
+        //个人和代填都要检验考勤时长
+        if (createDate[0].contains("@")) {
             //个人批量填报,判断是否需要考勤校验
             //个人批量填报,判断是否需要考勤校验
             if (comTimeType.getSyncCorpwxTime() == 1) {
             if (comTimeType.getSyncCorpwxTime() == 1) {
                 String[] dateArr = createDate[0].split("@");
                 String[] dateArr = createDate[0].split("@");
@@ -2432,7 +2442,12 @@ public class ReportController {
                             }
                             }
                         }
                         }
                     }
                     }
-                    msg.data = WorkDayCalculateUtils.getWorkDaysCountInRange(startDate, endDate, timeType.getIncludeWeekends());
+                    if (startDate.equals(endDate)) {
+                        //指定某一天,就不用计算是否是非工作日了
+                        msg.data = 1;
+                    } else {
+                        msg.data = WorkDayCalculateUtils.getWorkDaysCountInRange(startDate, endDate, timeType.getIncludeWeekends());
+                    }
                 }
                 }
             }
             }
         }
         }

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

@@ -22,7 +22,7 @@ import java.time.LocalDate;
  * @since 2020-01-03
  * @since 2020-01-03
  */
  */
 public interface ProjectService extends IService<Project> {
 public interface ProjectService extends IService<Project> {
-    HttpRespMsg getProjectList(Integer forReport, HttpServletRequest request);
+    HttpRespMsg getProjectList(Integer forReport, String userId, HttpServletRequest request);
 
 
     HttpRespMsg getProjectPage(Integer pageIndex, Integer pageSize, String keyword, Integer searchField,
     HttpRespMsg getProjectPage(Integer pageIndex, Integer pageSize, String keyword, Integer searchField,
                                Integer status, Integer category, Integer projectId,Integer projectMainId,Integer deptId, String sortProp, Integer sortOrder,String inchagerId,String participation,String startDate,String endDate, HttpServletRequest request);
                                Integer status, Integer category, Integer projectId,Integer projectMainId,Integer deptId, String sortProp, Integer sortOrder,String inchagerId,String participation,String startDate,String endDate, HttpServletRequest request);
@@ -246,7 +246,7 @@ public interface ProjectService extends IService<Project> {
 
 
     HttpRespMsg timeCostAndExpenseByProject(HttpServletRequest request, String startDate, String endDate, Integer projectId);
     HttpRespMsg timeCostAndExpenseByProject(HttpServletRequest request, String startDate, String endDate, Integer projectId);
 
 
-    HttpRespMsg nearProject(HttpServletRequest request);
+    HttpRespMsg nearProject(HttpServletRequest request, String userId);
 
 
     HttpRespMsg getFTEData(Integer pageIndex, Integer pageSize,String monthStart,String monthEnd, String area,String userId,String sortProp, Integer sortOrder,Integer departmentId,HttpServletRequest request);
     HttpRespMsg getFTEData(Integer pageIndex, Integer pageSize,String monthStart,String monthEnd, String area,String userId,String sortProp, Integer sortOrder,Integer departmentId,HttpServletRequest request);
 
 

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

@@ -256,10 +256,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     public boolean isDev;
     public boolean isDev;
     //获取项目列表
     //获取项目列表
     @Override
     @Override
-    public HttpRespMsg getProjectList(Integer forReport, HttpServletRequest request) {
+    public HttpRespMsg getProjectList(Integer forReport, String userId, HttpServletRequest request) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         try {
         try {
-            User user = userMapper.selectById(request.getHeader("Token"));
+            System.out.println("userId===="+userId);
+            if (userId == null) {
+                userId = request.getHeader("Token");
+            }
+            User user = userMapper.selectById(userId);
             if (forReport == 1) {
             if (forReport == 1) {
                 if (!sysFunctionService.hasPriviledge(user.getRoleId(), "可填报全部项目")) {
                 if (!sysFunctionService.hasPriviledge(user.getRoleId(), "可填报全部项目")) {
                     //只能看本人参与的项目
                     //只能看本人参与的项目
@@ -12166,10 +12170,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
      * @return
      * @return
      */
      */
     @Override
     @Override
-    public HttpRespMsg nearProject(HttpServletRequest request) {
+    public HttpRespMsg nearProject(HttpServletRequest request, String userId) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         HttpRespMsg httpRespMsg = new HttpRespMsg();
-        User user = userMapper.selectById(request.getHeader("token"));
-        List<Project> projects = projectMapper.selectNearProject(user.getId());
+        if (userId == null) {
+            userId = request.getHeader("token");
+        }
+        List<Project> projects = projectMapper.selectNearProject(userId);
         httpRespMsg.data = projects;
         httpRespMsg.data = projects;
         return httpRespMsg;
         return httpRespMsg;
     }
     }

+ 50 - 14
fhKeeper/formulahousekeeper/timesheet/src/views/workReport/daily.vue

@@ -2228,6 +2228,7 @@
         },
         },
         data() {
         data() {
             return {
             return {
+                subFillProjectList:[],
                 curAuditNode: 1,
                 curAuditNode: 1,
                 refreshingTime: false,
                 refreshingTime: false,
                 substitudeStep: 1,
                 substitudeStep: 1,
@@ -2991,19 +2992,20 @@
                     );
                     );
                 }).catch(() => {this.startDeleting = false});
                 }).catch(() => {this.startDeleting = false});
             },
             },
-            getRecentlyProject() {
-                this.http.post('/project/nearProject',{},res => {
+            getRecentlyProject(userId) {
+                this.http.post('/project/nearProject',{userId: userId},res => {
                     if(res.code == 'ok'){
                     if(res.code == 'ok'){
+                        var bottomList = userId == null?this.fillProjectList:this.subFillProjectList;
                         let topObj = {
                         let topObj = {
                             label: this.$t('zuiJinXuanZeXiangMu'),
                             label: this.$t('zuiJinXuanZeXiangMu'),
                             peojectList: res.data 
                             peojectList: res.data 
                         }
                         }
                         let botomObj = {
                         let botomObj = {
                             label: this.$t('other.allProject'),
                             label: this.$t('other.allProject'),
-                            peojectList: this.fillProjectList
+                            peojectList: bottomList
                         }
                         }
                         //最近项目如果在fillProjectList中不存在,需要移除
                         //最近项目如果在fillProjectList中不存在,需要移除
-                        topObj.peojectList = topObj.peojectList.filter(top=>this.fillProjectList.find(fp=>fp.id==top.id) != null);
+                        topObj.peojectList = topObj.peojectList.filter(top=>bottomList.find(fp=>fp.id==top.id) != null);
                         this.integrationProjectList = [topObj, botomObj]
                         this.integrationProjectList = [topObj, botomObj]
                     }else {
                     }else {
                         this.$message({
                         this.$message({
@@ -4519,15 +4521,13 @@
             chooseParticip() {
             chooseParticip() {
                 var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
                 var chosenList = this.$refs.chooseMembTree.getCheckedNodes();
                 this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
                 this.chosenMembList = chosenList.filter(item=>item.isUser == 1);
-                //针对专业版,只能选择一个人进行代填,防止任务有问题
-                if (this.user.company.packageProject == 1) {
-                    if (this.chosenMembList.length > 1) {
-                        this.$message({
-                            message: this.$t('meiCiJinZhiChiDaiTianYiGeRen'),
-                            type: "error",
-                        });
-                        return;
-                    }
+                //只能选择一个人进行代填,防止任务有问题
+                if (this.chosenMembList.length > 1) {
+                    this.$message({
+                        message: this.$t('meiCiJinZhiChiDaiTianYiGeRen'),
+                        type: "error",
+                    });
+                    return;
                 }
                 }
                 this.chooseParticipVisible = false;
                 this.chooseParticipVisible = false;
                 this.workForm.userNames = '';
                 this.workForm.userNames = '';
@@ -4548,7 +4548,10 @@
                         this.workForm.userNames = this.workForm.userNames.split(',')
                         this.workForm.userNames = this.workForm.userNames.split(',')
                     }
                     }
                 }
                 }
-                
+                //加载该人员的可填报项目
+                if (this.workForm.userId.length > 0) {
+                    this.getSubUsersFillProjectList(this.workForm.userId[0]);
+                }
             },
             },
 
 
             notifySel(sel){
             notifySel(sel){
@@ -6077,6 +6080,33 @@
                     });
                     });
                 });
                 });
             },
             },
+            getSubUsersFillProjectList(userId) {
+                this.http.post( this.port.project.list, {
+                    forReport: 1,
+                    userId: userId
+                },res => {
+                    if (res.code == "ok") {
+                        for(var i in res.data) {
+                            if(res.data[i].projectCode == null || res.data[i].projectCode == 'null') {
+                                res.data[i].projectCode = ''
+                            }
+                        }
+                        this.subFillProjectList = res.data;
+                        this.getRecentlyProject(userId) 
+                    } else {
+                        this.$message({
+                            message: res.msg,
+                            type: "error"
+                        });
+                    }
+                },
+                error => {
+                    this.$message({
+                        message: error,
+                        type: "error"
+                    });
+                });
+            },
             // 获取填报日报的项目下拉列表
             // 获取填报日报的项目下拉列表
             getFillProjectList() {
             getFillProjectList() {
                 this.http.post( this.port.project.list, {
                 this.http.post( this.port.project.list, {
@@ -6104,6 +6134,10 @@
                     });
                     });
                 });
                 });
             },
             },
+            //自己填写日报时,刷新到自己的可填报日报列表
+            refreshToMyReportProjectList() {
+                this.getRecentlyProject();
+            },
             getBasecostItemList() {
             getBasecostItemList() {
                 this.http.post('/project-basecost-setting/getReportBasecostList', {
                 this.http.post('/project-basecost-setting/getReportBasecostList', {
                     companyId: this.user.companyId
                     companyId: this.user.companyId
@@ -6396,6 +6430,8 @@
                 }
                 }
                 if (this.isSubstitude) {
                 if (this.isSubstitude) {
                     this.getSubstitudeUserDeptList();
                     this.getSubstitudeUserDeptList();
+                } else {
+                    this.refreshToMyReportProjectList();
                 }
                 }
                 if(i == -1 || this.isSubstitude) {
                 if(i == -1 || this.isSubstitude) {
                     this.isDisable = false;
                     this.isDisable = false;

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

@@ -806,8 +806,8 @@ export default {
                 }).catch(err => { })
                 }).catch(err => { })
         },
         },
 
 
-        getRecentlyProject() {
-            this.$axios.post('/project/nearProject', {})
+        getRecentlyProject(userId) {
+            this.$axios.post('/project/nearProject', {userId: userId})
                 .then(res => {
                 .then(res => {
                     if (res.code == 'ok') {
                     if (res.code == 'ok') {
                         this.integrationProjectList = res.data;
                         this.integrationProjectList = res.data;
@@ -901,12 +901,12 @@ export default {
             if(!this.substitute) {
             if(!this.substitute) {
                 this.form.domains[this.auditor.index][this.auditor.auditorIndex] = this.auditor.item
                 this.form.domains[this.auditor.index][this.auditor.auditorIndex] = this.auditor.item
             }
             }
+            this.auditorShow = false
             if(this.substitute) {
             if(this.substitute) {
                 const { id, name } = this.auditor.item
                 const { id, name } = this.auditor.item
                 this.fillingAgent = { id, name }
                 this.fillingAgent = { id, name }
+                this.getProject(this.fillingAgent.id);
             }
             }
-            this.auditorShow = false
-            console.log('searchAuditor');
         },
         },
         getAllUsersList() {
         getAllUsersList() {
             this.$axios.post('/user/getSimpleActiveUserList', {})
             this.$axios.post('/user/getSimpleActiveUserList', {})
@@ -958,8 +958,8 @@ export default {
             this.$forceUpdate();
             this.$forceUpdate();
         },
         },
         // 获取项目
         // 获取项目
-        getPeoject() {
-            this.$axios.post("/project/getProjectList", { forReport: 1 })
+        getProject(userId) {
+            this.$axios.post("/project/getProjectList", { forReport: 1, userId: userId})
                 .then(res => {
                 .then(res => {
                     if (res.code == "ok") {
                     if (res.code == "ok") {
                         for (var i in res.data) {
                         for (var i in res.data) {
@@ -971,7 +971,7 @@ export default {
                         this.project = res.data;
                         this.project = res.data;
                         this.projectss = this.projectss.filter(p => p.status == 1 || p.status == 4);
                         this.projectss = this.projectss.filter(p => p.status == 1 || p.status == 4);
                         this.proads = res.data
                         this.proads = res.data
-                        this.getRecentlyProject()
+                        this.getRecentlyProject(userId)
                     } else {
                     } else {
                         this.$toast.fail('获取失败:' + res.msg);
                         this.$toast.fail('获取失败:' + res.msg);
                     }
                     }
@@ -1485,29 +1485,6 @@ export default {
             for (var i = 0; i < len; i++) { s = '0' + s; }
             for (var i = 0; i < len; i++) { s = '0' + s; }
             return s;
             return s;
         },
         },
-
-        // 获取项目
-        getProject() {
-            const toast = this.$toast.loading({
-                forbidClick: true,
-                duration: 0
-            });
-            this.$axios.post("/project/getProjectList", {})
-                .then(res => {
-                    if (res.code == "ok") {
-                        this.$toast.clear();
-
-
-                        // if (this.project.length > 0) {
-                        //     console.log('this.project[0].id=='+this.project[0].id);
-                        //     this.getTaskList(this.project[0].id);
-                        // }
-                    } else {
-                        this.$toast.clear();
-                        this.$toast.fail('获取失败:' + res.msg);
-                    }
-                }).catch(err => { this.$toast.clear(); });
-        },
         getAIReport(createDate) {
         getAIReport(createDate) {
             const toast = this.$toast.loading({
             const toast = this.$toast.loading({
                 forbidClick: true,
                 forbidClick: true,
@@ -2797,8 +2774,7 @@ export default {
         } else if (ua.indexOf("micromessenger") > 0) {
         } else if (ua.indexOf("micromessenger") > 0) {
             this.isWX = true;
             this.isWX = true;
         }
         }
-        this.getPeoject() // 获取项目
-        // console.log('mounted');
+        this.getProject() //获取项目
         this.getReportBasecostList()
         this.getReportBasecostList()
         //获取传递过来的日期
         //获取传递过来的日期
         var passDate = this.$route.query.date;
         var passDate = this.$route.query.date;
@@ -2806,7 +2782,6 @@ export default {
             this.form.createDate = this.$route.query.date;
             this.form.createDate = this.$route.query.date;
         }
         }
 
 
-        // this.getProject();
         this.getReport();
         this.getReport();
         this.getAllUsersList()
         this.getAllUsersList()
         this.getTimeType();
         this.getTimeType();