seyason преди 1 година
родител
ревизия
4dc44891b3

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

@@ -98,6 +98,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
     @Resource
     private SysFunctionMapper sysFunctionMapper;
     @Resource
+    private EstimateTimeSettingMapper estimateTimeSettingMapper;
+    @Resource
     private ProjectCustomMapper projectCustomMapper;
     @Resource
     private UserMapper userMapper;
@@ -928,10 +930,57 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
                     }
                 }
                 if(timeType.getProjectManDay()==1){
+                    EstimateTimeSetting estimateTimeSetting = estimateTimeSettingMapper.selectById(companyId);
                     p.setManDay(manDay);
                     if (!StringUtils.isEmpty(manDayStartDate)) {
                         p.setManDayStartDate(LocalDate.parse(manDayStartDate));
                     }
+                    //检查项目人天是否超过已经填报的项目工时
+                    Report report = reportMapper.selectOne(new QueryWrapper<Report>().select("sum(working_time) as working_time").eq("project_id", id).and(i->i.eq("state", 0).or().eq("state", 1)));
+                    if(report!=null){
+                        DecimalFormat df = new DecimalFormat("0.0");
+                        if (estimateTimeSetting.getProjectManDayFillMode() == 0) {
+                            //非必填;填了大于0的数据,就得校验
+                            if(manDay!=null && manDay > 0){
+                                if(manDay*timeType.getAllday()<report.getWorkingTime()){
+                                    httpRespMsg.setError("项目人天不能小于已经填报的工时:"+df.format(report.getWorkingTime()/timeType.getAllday())+"人天");
+                                    return httpRespMsg;
+                                }
+                            }
+                        } else if (estimateTimeSetting.getProjectManDayFillMode() == 1) {
+                            //工时系统必填,同步的非必填
+                            if (oldProject.getFromOutside() == 0) {
+                                if(manDay!=null && manDay > 0){
+                                    if(manDay*timeType.getAllday()<report.getWorkingTime()){
+                                        httpRespMsg.setError("项目人天不能小于已经填报的工时:"+df.format(report.getWorkingTime()/timeType.getAllday())+"人天");
+                                        return httpRespMsg;
+                                    }
+                                } else {
+                                    httpRespMsg.setError("项目人天不能小于已经填报的工时:"+df.format(report.getWorkingTime()/timeType.getAllday())+"人天");
+                                    return httpRespMsg;
+                                }
+                            } else {
+                                //同步的外部项目
+                                if(manDay!=null && manDay > 0){
+                                    if(manDay*timeType.getAllday()<report.getWorkingTime()){
+                                        httpRespMsg.setError("项目人天不能小于已经填报的工时:"+df.format(report.getWorkingTime()/timeType.getAllday())+"人天");
+                                        return httpRespMsg;
+                                    }
+                                }
+                            }
+                        } else if (estimateTimeSetting.getProjectManDayFillMode() == 2) {
+                            //都必填
+                            if(manDay!=null && manDay > 0){
+                                if(manDay*timeType.getAllday()<report.getWorkingTime()){
+                                    httpRespMsg.setError("项目人天不能小于已经填报的工时:"+df.format(report.getWorkingTime()/timeType.getAllday())+"人天");
+                                    return httpRespMsg;
+                                }
+                            } else {
+                                httpRespMsg.setError("项目人天不能小于已经填报的工时:"+df.format(report.getWorkingTime()/timeType.getAllday())+"人天");
+                                return httpRespMsg;
+                            }
+                        }
+                    }
                 }
                 //编辑项目合同修改 添加记录
                 if(contractAmount!=null&&project.getContractAmount().doubleValue()!=contractAmount){
@@ -1036,13 +1085,18 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
             //编辑关系
             participationMapper.delete(new QueryWrapper<Participation>().eq("project_id", id));
             if (userIds != null) {
+                List<Participation> pList = new ArrayList<>();
                 for (String userId : userIds) {
-                    participationMapper.insert(new Participation().setProjectId(id).setUserId(userId));
+                    Participation p = new Participation();
+                    p.setProjectId(id);
+                    p.setUserId(userId);
+                    pList.add(p);
+                }
+                if (pList.size() > 0) {
+                    //批量保存参与人
+                    participationService.saveBatch(pList);
                 }
             }
-            //生成相关领导的表
-            projectNotifyUserService.remove(new QueryWrapper<ProjectNotifyUser>().eq("project_id", id));
-
             if (chosenLeaders != null && chosenLeaders.length() > 0) {
                 JSONArray array = JSONArray.parseArray(chosenLeaders);
                 List<ProjectNotifyUser> notifyUsers = new ArrayList<>();

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

@@ -626,14 +626,14 @@
                         <el-tooltip effect="dark" :content="$t('根据系统基础设置每日正常工作时长计算,1人天为一个每日正常工作时长')" placement="top-start" style="margin-left:180px">
                                         <i class="el-icon-question" style="color:#606266"></i>
                         </el-tooltip>
-                        <span style="margin-left:63px;margin-right:10px;" >{{'管控开始日期'}}</span>
-                        <el-date-picker v-model="addForm.manDayStartDate"
+                        <span style="margin-left:63px;margin-right:10px;" v-if="user.companyId != 936" >{{'管控开始日期'}}</span>
+                        <el-date-picker v-model="addForm.manDayStartDate"  v-if="user.companyId != 936"
                         :editable="false" style="width:20%;" 
                         format="yyyy-MM-dd" 
                         value-format="yyyy-MM-dd"
                         :clearable="false" type="date" 
                         :placeholder="$t('optiondate')"></el-date-picker>
-                        <el-tooltip effect="dark" :content="$t('从该日期起,填报工时开始占用预算人天工时')" placement="top-start" style="margin-left:10px">
+                        <el-tooltip effect="dark" :content="$t('从该日期起,填报工时开始占用预算人天工时')" placement="top-start" style="margin-left:10px"  v-if="user.companyId != 936">
                                         <i class="el-icon-question" style="color:#606266"></i>
                         </el-tooltip>
                     </el-form-item>