Browse Source

八爪鱼增加项目预算工时开关
工时管家填写日报针对开启项目预算工时校验的功能

yurk 2 years ago
parent
commit
ff1f8a83bf

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

@@ -161,12 +161,13 @@ public class ProjectController {
                                    ProjectSeparate projectSeparate,
                                    Double outputValue,
                                    Integer deptId,
+                                   Integer manDay,
                                    @RequestParam(defaultValue = "false") boolean onlyChangeParticipate,
                                    String buId) {
         return projectService.editProject(id, name, code, userId, inchargerId, isPublic, planStartDate, planEndDate, level, contractAmount,changeContractReason,
                 projectBaseCostData,projectKeyNodesData,
                  budget,customerId,chosenLeaders, associateDegrees, associateDegreeNames,
-                taskGpIncharge,auditUserIds, category, projectDesc,projectMainId, providerIds, providerNames, request,projectSeparate,outputValue,deptId,onlyChangeParticipate,buId);
+                taskGpIncharge,auditUserIds, category, projectDesc,projectMainId, providerIds, providerNames, request,projectSeparate,outputValue,deptId,onlyChangeParticipate,buId,manDay);
     }
 
     @RequestMapping("/adjustBase")

+ 25 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/controller/ReportController.java

@@ -29,6 +29,7 @@ import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.text.DecimalFormat;
+import java.text.NumberFormat;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
@@ -883,6 +884,30 @@ public class ReportController {
             }
         }
 
+        //如果开启了项目人天
+        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));
+            List<Project> targetProjectList = projectList.stream().filter(pl -> projectIds.contains(pl.getId())).collect(Collectors.toList());
+            for (Report report : reportList) {
+                    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 sum = needCheckReportList.stream().filter(npl -> npl.getProjectId().equals(first.get().getId()) && (npl.getState() == 0 || npl.getState() == 1)).mapToDouble(Report::getWorkingTime).sum();
+                    if(first.get().getManDay()!=null){
+                        BigDecimal hasReport = new BigDecimal(sum).add(new BigDecimal(nowReport));
+                        BigDecimal multiply = new BigDecimal(first.get().getManDay()).multiply(new BigDecimal(comTimeType.getAllday()));
+                        if(hasReport.doubleValue()>multiply.doubleValue()){
+                            httpRespMsg.setError("超过当前项目["+first.get().getProjectName()+"]预算工时,无法继续提交工时");
+                            return httpRespMsg;
+                        }
+                    }
+                }
+            }
+        }
+
         //如果锁定工作时长上限的话,需要校验每日的合计工作时长
         if (comTimeType.getLockWorktime() == 1) {
             for (Report report : reportList) {

+ 7 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/Project.java

@@ -18,7 +18,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author Seyason
@@ -366,6 +366,12 @@ public class Project extends Model<Project> {
     @TableField(exist = false)
     private String projectMainCode;
 
+    /**
+     * 项目人天
+     */
+    @TableField("man_day")
+    private Integer manDay;
+
     @Override
     protected Serializable pkVal() {
         return this.id;

+ 5 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -444,6 +444,11 @@ public class TimeType extends Model<TimeType> {
     @TableField("work_overtime_need_check")
     private Integer workOvertimeNeedCheck;
 
+    /**
+     * 0-否 1-是  是否开启项目人天校验功能
+     */
+    @TableField("project_man_day")
+    private Integer projectManDay;
 
     @Override
     protected Serializable pkVal() {

+ 1 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/entity/vo/TimelinessRateVO.java

@@ -18,5 +18,6 @@ public class TimelinessRateVO {
     private String timelinessRate;
     private String timelinessRateWithLeave;
     private String jobNumber;
+    private String userId;
     private List<Map<String,Object>> dataList;
 }

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

@@ -47,7 +47,7 @@ public interface ProjectService extends IService<Project> {
                             String providerIds,
                             String providerNames,
                             HttpServletRequest request,
-                            ProjectSeparate projectSeparate,Double outputValue,Integer deptId,boolean onlyChangeParticipate,String buId);
+                            ProjectSeparate projectSeparate,Double outputValue,Integer deptId,boolean onlyChangeParticipate,String buId,Integer manDay);
 
     HttpRespMsg deleteProject(Integer id, Integer force);
 

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

@@ -497,7 +497,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                                    String providerIds,
                                    String providerNames,
                                    HttpServletRequest request,
-                                   ProjectSeparate projectSeparate,Double outputValue,Integer deptId,boolean onlyChangeParticipate,String buId) {
+                                   ProjectSeparate projectSeparate,Double outputValue,Integer deptId,boolean onlyChangeParticipate,String buId,Integer manDay) {
         HttpRespMsg httpRespMsg = new HttpRespMsg();
         User user = userMapper.selectById(request.getHeader("Token"));
         Integer companyId = user.getCompanyId();
@@ -573,6 +573,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                             }
                         }
                     }
+                    if(timeType.getProjectManDay()==1){
+                        project.setManDay(manDay);
+                    }
                     if(timeType.getOutputValueStatus()==1){
                         project.setOutputValue(outputValue==null?0.00:outputValue);
                     }
@@ -688,6 +691,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                         }
                     }
                 }
+                if(timeType.getProjectManDay()==1){
+                    p.setManDay(manDay);
+                }
                 //编辑项目合同修改 添加记录
                 if(contractAmount!=null&&project.getContractAmount().doubleValue()!=contractAmount){
                     ContractModifyRecord contractModifyRecord=new ContractModifyRecord();
@@ -6589,6 +6595,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             TimelinessRateVO timelinessRateVO=new TimelinessRateVO();
             timelinessRateVO.setUserName(user.getName());
             timelinessRateVO.setJobNumber(user.getJobNumber());
+            timelinessRateVO.setUserId(user.getId());
 
 //            timelinessRateVO.setCorpwxDeptId(user.getCorpwxDeptid());
             timelinessRateVO.setCorpwxUserId(user.getCorpwxUserid());
@@ -8674,9 +8681,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     Optional<User> first = userList.stream().filter(ul ->(ul.getJobNumber()!=null&&ul.getJobNumber().equals(timelinessRateVO.getJobNumber()))||ul.getName().equals(timelinessRateVO.getUserName())).findFirst();
                     String startDate1 =String.valueOf( datum.get("startDate"));
                     String endDate1 =String.valueOf( datum.get("endDate"));
-                    HttpRespMsg itemMsg = getUserReportTimelinessRate(request, startDate1, endDate1, null, first.get().getId(), null, null);
+                    List<TimelinessRateVO> itemList = list.stream().filter(l -> l.getUserId().equals(first.get().getId())).collect(Collectors.toList());
+                    /*HttpRespMsg itemMsg = getUserReportTimelinessRate(request, startDate1, endDate1, null, first.get().getId(), null, null);
                     HashMap itemMap= (HashMap) itemMsg.data;
-                    List<TimelinessRateVO> itemList = (List<TimelinessRateVO>) itemMap.get("list");
+                    List<TimelinessRateVO> itemList = (List<TimelinessRateVO>) itemMap.get("list");*/
                     for (TimelinessRateVO rateVO : itemList) {
                         item.add(rateVO.getTimelinessRate());
                     }

File diff suppressed because it is too large
+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/ProjectMapper.xml


File diff suppressed because it is too large
+ 2 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/resources/mapper/TimeTypeMapper.xml


+ 4 - 1
fhKeeper/formulahousekeeper/octopus/src/views/customer/list.vue

@@ -235,7 +235,8 @@
                             <i class="el-icon-question"></i>
                         </el-tooltip>
                     </el-form-item>
-                     <el-form-item><el-checkbox v-model="dialogData.subProMustFill">子项目是否必填</el-checkbox></el-form-item>
+                    <el-form-item><el-checkbox v-model="dialogData.subProMustFill">子项目是否必填</el-checkbox></el-form-item>
+                    <el-form-item><el-checkbox v-model="dialogData.projectManDay">是否开启项目人天字段</el-checkbox></el-form-item>
                 </el-form>
             </div>
             <!-- 是否开启审批流设置,是否启用主项目模式,是否秘薪模式,是否显示日报审批流程,是否CRO企业,是否仅使用导入日报审核(不要项目审核) reportAuditType-->
@@ -401,6 +402,7 @@
                             this.$set(this.dialogData,'reportAutoApproveDays',res.data.reportAutoApproveDays)
                             this.$set(this.dialogData,'restartTaskNeedReason',res.data.restartTaskNeedReason ? true : false)
                             this.$set(this.dialogData,'subProMustFill',res.data.subProMustFill ? true : false)
+                            this.$set(this.dialogData,'projectManDay',res.data.projectManDay ? true : false)
                         }else{
                             this.$message({
                                 message: res.msg,
@@ -717,6 +719,7 @@
                     reportAutoApproveDays: this.dialogData.reportAutoApproveDays, // 自动审核的天数
                     restartTaskNeedReason: this.dialogData.restartTaskNeedReason ? 1 : 0,
                     subProMustFill: this.dialogData.subProMustFill ? 1 : 0,
+                    projectManDay: this.dialogData.projectManDay ? 1 : 0,
                 },res => {
                     if(res.code == 'ok'){
                         this.editDialogG = false

+ 12 - 1
fhKeeper/formulahousekeeper/ops-platform/src/main/java/com/management/platform/entity/TimeType.java

@@ -13,7 +13,7 @@ import lombok.experimental.Accessors;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author Seyason
@@ -425,6 +425,17 @@ public class TimeType extends Model<TimeType> {
     @TableField("sub_pro_must_fill")
     private Integer subProMustFill;
 
+    /**
+     * 0-否 1-是  加班时长是否需要校验
+     */
+    @TableField("work_overtime_need_check")
+    private Integer workOvertimeNeedCheck;
+
+    /**
+     * 0-否 1-是  是否开启项目人天校验功能
+     */
+    @TableField("project_man_day")
+    private Integer projectManDay;
 
     @Override
     protected Serializable pkVal() {

File diff suppressed because it is too large
+ 3 - 1
fhKeeper/formulahousekeeper/ops-platform/src/main/resources/mapper/TimeTypeMapper.xml


+ 22 - 2
fhKeeper/formulahousekeeper/timesheet/src/views/project/list.vue

@@ -361,6 +361,11 @@
                     {{scope.row.progress==null?"-":scope.row.progress}}%
                 </template>
             </el-table-column>
+            <el-table-column prop="manDay" :label="'预估工时'" min-width="100"   v-if="user.timeType.projectManDay == 1">
+                <template slot-scope="scope">
+                    {{scope.row.manDay==null?"":scope.row.manDay}}<span v-if="scope.row.manDay">人天</span>
+                </template>
+            </el-table-column>
             <el-table-column :label="$t('operation')" :width="showColumnWidth" align="left" fixed="right" v-if="showColumnWidth != '0' || permissions.projectManagement">
                 <template slot-scope="scope">
                     <el-button v-if="(permissions.projectManagement || user.id==scope.row.creatorId) && user.timeType.mainProjectState != '1'" size="mini"  @click="subProject(scope.row)">{{ $t('lable.subproject') }}</el-button>
@@ -577,6 +582,11 @@
                         <vueCascader :size="'small'" :subjectId="addForm.bu" :widthStr="'200'" :clearable="true" :subject="buOption" :radios="true" :distinction="'32'" @vueCasader="vueCasader" v-if="user.userNameNeedTranslate == 1"></vueCascader>
                     </el-form-item>
 
+                    <!-- 增加项目人天字段 绎维固定字段 -->
+                    <el-form-item label="项目人天" v-if="user.timeType.projectManDay == 1">
+                        <el-input v-model.number="addForm.manDay" :placeholder="$t('peaseenterthe')"  style="width: 100px"></el-input><span style="margin-left:10px;position:absolute;">人天</span>
+                    </el-form-item>
+
                     <el-form-item :label="$t('projectoutput')" prop="outputValue"  v-if="user.timeType.outputValueStatus == 1">
                         <el-input id="outputValue" v-model="addForm.outputValue" style="width:32%;" :disabled="canOnlyModParticipator"
                         placeholder="" clearable  @keyup.native="restrictNumber('outputValue')">
@@ -3689,7 +3699,8 @@ a {
                         creatorId: this.user.id,
                         projectMainId: '',
                         outputValue: '',
-                        bu: []
+                        bu: [],
+                        manDay:0
                         // deptId: []
                     }
 
@@ -3705,6 +3716,9 @@ a {
                         this.$set(this.addForm, 'region', '')
                         this.$set(this.addForm, 'bu', '')
                     }
+                    if(this.user.timeType.projectManDay){
+                        this.$set(this.addForm, 'manDay',0)
+                    }
                     // if(this.user.companyId == '428') {
                     //     this.$set(this.addForm, 'projectCategorySub', '')
                     // }
@@ -3797,7 +3811,9 @@ a {
                         outputValue: item.outputValue,
                         // deptId: array.reverse(),
                         changeContractReason: '',
-                        bu: buascaderList
+                        bu: buascaderList,
+                        manDay:item.manDay==null?0:item.manDay,
+                        manDayDisable:item.manDay
                     }
                     this.contractAmountOld = item.contractAmount ? item.contractAmount : 0
                     // console.log(this.addForm, '数据')
@@ -4147,6 +4163,10 @@ a {
                             }
                         }
                         formData.append("buId", this.addForm.bu ? this.addForm.bu : '');
+                        if(this.user.timeType.projectManDay){
+                            formData.append("manDay", this.addForm.manDay ? this.addForm.manDay : '');
+                        }
+                    
                         // formData.append("associateDegreeNames", listName)
                         //console.log("addform",this.addForm);
                         //return