|
@@ -98,6 +98,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
@Resource
|
|
@Resource
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
private SysFunctionMapper sysFunctionMapper;
|
|
@Resource
|
|
@Resource
|
|
|
|
+ private EstimateTimeSettingMapper estimateTimeSettingMapper;
|
|
|
|
+ @Resource
|
|
private ProjectCustomMapper projectCustomMapper;
|
|
private ProjectCustomMapper projectCustomMapper;
|
|
@Resource
|
|
@Resource
|
|
private UserMapper userMapper;
|
|
private UserMapper userMapper;
|
|
@@ -928,10 +930,57 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(timeType.getProjectManDay()==1){
|
|
if(timeType.getProjectManDay()==1){
|
|
|
|
+ EstimateTimeSetting estimateTimeSetting = estimateTimeSettingMapper.selectById(companyId);
|
|
p.setManDay(manDay);
|
|
p.setManDay(manDay);
|
|
if (!StringUtils.isEmpty(manDayStartDate)) {
|
|
if (!StringUtils.isEmpty(manDayStartDate)) {
|
|
p.setManDayStartDate(LocalDate.parse(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){
|
|
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));
|
|
participationMapper.delete(new QueryWrapper<Participation>().eq("project_id", id));
|
|
if (userIds != null) {
|
|
if (userIds != null) {
|
|
|
|
+ List<Participation> pList = new ArrayList<>();
|
|
for (String userId : userIds) {
|
|
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) {
|
|
if (chosenLeaders != null && chosenLeaders.length() > 0) {
|
|
JSONArray array = JSONArray.parseArray(chosenLeaders);
|
|
JSONArray array = JSONArray.parseArray(chosenLeaders);
|
|
List<ProjectNotifyUser> notifyUsers = new ArrayList<>();
|
|
List<ProjectNotifyUser> notifyUsers = new ArrayList<>();
|