提交 54d39da3 authored 作者: 任建彩's avatar 任建彩

优化

上级 1485bd37
......@@ -98,7 +98,7 @@ public class ProjectController {
QueryWrapper<StatisticsProject> qw = new QueryWrapper<StatisticsProject>();
if(id!=null) {
qw.ne("id", id);
qw.ne("project", projectName);
qw.eq("project", projectName);
}else {
if(StringUtils.isNotEmpty(id)) {
qw.eq("id", id);
......@@ -111,7 +111,7 @@ public class ProjectController {
if(list.size()>0) {
throw new BaseException("项目名已被占用,请换一个");
}
return CommonResult.success("1");
return CommonResult.success();
}
......
package com.zrqx.olive.project.dao;
import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
......@@ -31,6 +32,14 @@ public interface TeamDao extends BaseMapper<Team> {
+ "</if>"
+ "</script>")
List<TeamVo> getProjectId(String projectId);
@Select("<script>"
+ "SELECT sum(allocate_surplus) FROM t_team where 1=1 "
// 项目ID
+ "<if test = 'projectId!=\"\" and projectId!=null '> "
+ " AND project_id = #{projectId} "
+ "</if>"
+ "</script>")
BigDecimal queryAllocateSurplus(String projectId);
......
......@@ -57,6 +57,8 @@ public class StatisticsProject {
private BigDecimal totalApplyTime;
@ApiModelProperty("待分配工时")
private BigDecimal toBeAllocated;
@ApiModelProperty("已分配剩余")
private BigDecimal allocateSurplus;
@ApiModelProperty(value = "部门Id")
private String departmentId;
}
......@@ -26,10 +26,12 @@ import com.zrqx.olive.project.dao.ProjectFileDao;
import com.zrqx.olive.project.dao.ProjectRecordDao;
import com.zrqx.olive.project.dao.ProjectUserDao;
import com.zrqx.olive.project.dao.StatisticsProjectDao;
import com.zrqx.olive.project.dao.TeamDao;
import com.zrqx.olive.project.model.Customer;
import com.zrqx.olive.project.model.ProjectFile;
import com.zrqx.olive.project.model.ProjectUser;
import com.zrqx.olive.project.model.StatisticsProject;
import com.zrqx.olive.project.model.Team;
import com.zrqx.olive.project.request.QueryProjectRequest;
import com.zrqx.olive.project.request.SaveProjectRequest;
import com.zrqx.olive.project.request.StatisticsProjectRequest;
......@@ -60,6 +62,9 @@ public class StatisticsProjectServiceImpl extends ServiceImpl<StatisticsProjectD
private TimeApplyChangeDao timeApplyChangeMapper;
@Autowired
private TaskService taskService;
@Autowired
private TeamDao teamDao;
@Override
public PageInfo<ProjectListVo> page(QueryProjectRequest form, PageParamRequest pageParamRequest) {
//开启分页
......@@ -80,11 +85,11 @@ public class StatisticsProjectServiceImpl extends ServiceImpl<StatisticsProjectD
}
//项目的剩余总工时
BigDecimal querySurplus = taskService.querySurplus(projectListVo.getId(),null,null);
if(querySurplus!=null) {
if(projectListVo.getTotal()!=null) {
projectListVo.setSurplus(projectListVo.getTotal().subtract(querySurplus));
}
}
projectListVo.setSurplus(querySurplus);
//已分配剩余工时
BigDecimal allocateSurplus = teamDao.queryAllocateSurplus(projectListVo.getId());
projectListVo.setAllocateSurplus(allocateSurplus);
}
return CommonPage.copyPageInfo(startPage, list);
}
......
......@@ -65,7 +65,7 @@ public class TeamServiceImpl extends ServiceImpl<TeamDao, Team> implements Team
}
BigDecimal querySurplus = taskService.querySurplus(team.getProjectId(),null,team.getDepartmentId());
if(querySurplus!=null) {
team.setSurplus(team.getTotal().subtract(querySurplus));
team.setSurplus(querySurplus);
}
TeamRequest aqr = new TeamRequest();
BeanUtils.copyProperties(team, aqr);
......
......@@ -37,4 +37,6 @@ public class ProjectListVo {
private BigDecimal surplus;
@ApiModelProperty("待分配")
private BigDecimal toBeAllocated;
@ApiModelProperty("已分配剩余")
private BigDecimal allocateSurplus;
}
......@@ -194,7 +194,7 @@ public interface TaskDao extends BaseMapper<Task> {
BigDecimal queryConsume(String id,Integer userId,Integer departmentId,String presale);
@Select("<script>"
+ " select sum(working_hours) FROM t_task a where 1=1 "
+ " and (task_status=1 or task_status=2 or task_status=3)"
+ " and task_status=1 "
+ "<if test = 'id!=null and id!=\"\"'> "
+ " AND a.project_id = #{id} "
+ "</if>"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论