|
@@ -719,7 +719,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
+ /*@Override
|
|
|
public HttpRespMsg getProjectEstimatedWorkNew(Integer pageIndex, Integer pageSize, Integer projectId, Integer type,Integer isWarn, HttpServletRequest request) {
|
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
//通过公司id获取该公司所有的项目列表
|
|
@@ -870,6 +870,88 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
resultMap.put("records",subList);
|
|
|
httpRespMsg.data=resultMap;
|
|
|
return httpRespMsg;
|
|
|
+ }*/
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public HttpRespMsg getProjectEstimatedWorkNew(Integer pageIndex, Integer pageSize, Integer projectId, Integer type,Integer isWarn, HttpServletRequest request) {
|
|
|
+ HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
|
+ //通过公司id获取该公司所有的项目列表
|
|
|
+ User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
+ EstimateTimeSetting estimateTimeSetting = estimateTimeSettingMapper.selectOne(new QueryWrapper<EstimateTimeSetting>().eq("company_id", companyId));
|
|
|
+ //该公司下的allday
|
|
|
+ float allday=timeTypeMapper.selectOne(new QueryWrapper<TimeType>()
|
|
|
+ .eq("company_id",companyId)).getAllday();
|
|
|
+
|
|
|
+ Integer projectWarningPercent = estimateTimeSetting.getProjectWarningPercent();
|
|
|
+ Integer groupWarningPercent = estimateTimeSetting.getGroupWarningPercent();
|
|
|
+
|
|
|
+ Map<String,Object> map=new HashMap<String,Object>();
|
|
|
+ pageIndex=(pageIndex-1)*pageSize;
|
|
|
+ map.put("pageIndex", pageIndex);
|
|
|
+ map.put("pageSize", pageSize);
|
|
|
+ map.put("projectId",projectId );
|
|
|
+ map.put("isWarn",isWarn );
|
|
|
+ map.put("allday",allday );
|
|
|
+ map.put("companyId",companyId);
|
|
|
+
|
|
|
+
|
|
|
+ List<Map<String,Object>> list=new ArrayList<>();
|
|
|
+ Integer total=0;
|
|
|
+ if (type==0){
|
|
|
+ map.put("warningPercent",projectWarningPercent );
|
|
|
+
|
|
|
+ list= projectMapper.selectProjectEestimatedWorkTimeList(map);
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ list.forEach(l-> {
|
|
|
+ l.put("groupName", null);
|
|
|
+ l.put("id", null);
|
|
|
+ l.put("isRed",null);
|
|
|
+ /*if (Double.parseDouble(l.get("remainWorkTime").toString())<0){
|
|
|
+ l.put("remainWorkTime","\\");
|
|
|
+ }*/
|
|
|
+ if(l.get("remainWorkTimeProportion")!=null) {
|
|
|
+ l.put("remainWorkTimeProportion",new BigDecimal(l.get("remainWorkTimeProportion").toString()).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ if (Double.parseDouble(l.get("remainWorkTimeProportion").toString())<Double.parseDouble(map.get("warningPercent").toString())){
|
|
|
+ l.put("isRed",true );
|
|
|
+ }
|
|
|
+ l.put("remainWorkTimeProportion",l.get("remainWorkTimeProportion").toString()+"%");
|
|
|
+ }else{
|
|
|
+ l.put("remainWorkTimeProportion","\\");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ total= projectMapper.selectProjectEestimatedWorkTimeCount(map);
|
|
|
+ }else {
|
|
|
+ map.put("warningPercent",groupWarningPercent );
|
|
|
+
|
|
|
+ list= projectMapper.selectGroupEestimatedWorkTimeList(map);
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ list.forEach(l-> {
|
|
|
+ l.put("isRed",null);
|
|
|
+ /*if (Double.parseDouble(l.get("remainWorkTime").toString())<0){
|
|
|
+ l.put("remainWorkTime","\\");
|
|
|
+ }*/
|
|
|
+ if(l.get("remainWorkTimeProportion")!=null) {
|
|
|
+ l.put("remainWorkTimeProportion",new BigDecimal(l.get("remainWorkTimeProportion").toString()).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ if (Double.parseDouble(l.get("remainWorkTimeProportion").toString())<Double.parseDouble(map.get("warningPercent").toString())){
|
|
|
+ l.put("isRed",true );
|
|
|
+ }
|
|
|
+ l.put("remainWorkTimeProportion",l.get("remainWorkTimeProportion").toString()+"%");
|
|
|
+ }else{
|
|
|
+ l.put("remainWorkTimeProportion","\\");
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ total= projectMapper.selectGroupEestimatedWorkTimeCount(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String,Object> resultMap=new HashMap<>();
|
|
|
+ resultMap.put("total",total);
|
|
|
+ resultMap.put("records",list);
|
|
|
+ httpRespMsg.data=resultMap;
|
|
|
+ return httpRespMsg;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -882,113 +964,61 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
//该公司下的allday
|
|
|
float allday=timeTypeMapper.selectOne(new QueryWrapper<TimeType>()
|
|
|
.eq("company_id",companyId)).getAllday();
|
|
|
- //根据公司的id搜索该公司有哪些项目 20231108之前完成的不统计,状态为进行中/已完成
|
|
|
- List<Project> records = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId).in("status", 1, 2)
|
|
|
- .and(wrapper -> wrapper.isNull("finish_date").or()
|
|
|
- .ge("finish_date", "2023-11-08")).eq(projectId != null, "id", projectId));
|
|
|
|
|
|
- List<Integer> collectIds = records.stream().map(Project::getId).collect(Collectors.toList());
|
|
|
+ Integer projectWarningPercent = estimateTimeSetting.getProjectWarningPercent();
|
|
|
+ Integer groupWarningPercent = estimateTimeSetting.getGroupWarningPercent();
|
|
|
|
|
|
- //根据查询道德project列表查询总的reporeList
|
|
|
- List<Report> reportList = reportMapper.selectList(new QueryWrapper<Report>()
|
|
|
- .in("project_id", collectIds));
|
|
|
- //根据查询道德project列表查询总的task_groupList
|
|
|
- List<TaskGroup> taskGroups = taskGroupMapper.selectList(new QueryWrapper<TaskGroup>()
|
|
|
- .in("project_id", collectIds));
|
|
|
+ Map<String,Object> map=new HashMap<String,Object>();
|
|
|
+ map.put("projectId",projectId );
|
|
|
+ map.put("isWarn",isWarn );
|
|
|
+ map.put("allday",allday );
|
|
|
+ map.put("companyId",companyId);
|
|
|
|
|
|
- DecimalFormat df = new DecimalFormat("0.00");
|
|
|
- List<GroupEstimatedWorkVO> lastList=new ArrayList<>();
|
|
|
- for (Project project : records) {
|
|
|
|
|
|
- List<TaskGroup> taskGroupCollect = taskGroups.stream().filter(t -> t.getProjectId().equals(project.getId())).collect(Collectors.toList());
|
|
|
+ List<Map<String,Object>> list=new ArrayList<>();
|
|
|
|
|
|
- //0代表按项目查看
|
|
|
- if (type==0){
|
|
|
- GroupEstimatedWorkVO estimatedWorkVO = new GroupEstimatedWorkVO();
|
|
|
- Double reallWorkTime = reportList.stream().filter(r -> r.getProjectId() .equals( project.getId())&&r.getWorkingTime()!=null)
|
|
|
- .mapToDouble(Report::getWorkingTime).sum();
|
|
|
- String rWorkTime=reallWorkTime==null ? "0":df.format(reallWorkTime);
|
|
|
- estimatedWorkVO.setProjectId(project.getId());
|
|
|
- estimatedWorkVO.setProjectName(project.getProjectName());
|
|
|
- estimatedWorkVO.setProjectCode(project.getProjectCode());
|
|
|
- estimatedWorkVO.setWorkTime(rWorkTime);
|
|
|
- String pEstimatedWork=project.getManDay()==null? "0": (project.getManDay()*allday+"");
|
|
|
- estimatedWorkVO.setEstimatedWorkTime(pEstimatedWork);
|
|
|
- if (project.getManDay()==null){
|
|
|
- estimatedWorkVO.setRemainWorkTime("\\");
|
|
|
- estimatedWorkVO.setRemainWorkTimeProportion("\\");
|
|
|
- }else{
|
|
|
- double rWorkTimeDouble = Double.parseDouble(rWorkTime);
|
|
|
- double pEstimatedWorkDouble = Double.parseDouble(pEstimatedWork);
|
|
|
- double remainDouble = pEstimatedWorkDouble - rWorkTimeDouble;
|
|
|
- estimatedWorkVO.setRemainWorkTime(String.format("%.2f", remainDouble));
|
|
|
- double proportion = (remainDouble / pEstimatedWorkDouble)*100;
|
|
|
- estimatedWorkVO.setRemainWorkTimeProportion(String.format("%.2f", proportion));
|
|
|
- }
|
|
|
- lastList.add(estimatedWorkVO);
|
|
|
+ if (type==0){
|
|
|
+ map.put("warningPercent",projectWarningPercent );
|
|
|
+
|
|
|
+ list= projectMapper.selectProjectEestimatedWorkTimeList(map);
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ list.forEach(l-> {
|
|
|
+ l.put("groupName", null);
|
|
|
+ l.put("id", null);
|
|
|
+ l.put("isRed",null);
|
|
|
+ /*if (Double.parseDouble(l.get("remainWorkTime").toString())<0){
|
|
|
+ l.put("remainWorkTime","\\");
|
|
|
+ }*/
|
|
|
+ if(l.get("remainWorkTimeProportion")!=null) {
|
|
|
+ l.put("remainWorkTimeProportion",new BigDecimal(l.get("remainWorkTimeProportion").toString()).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ if (Double.parseDouble(l.get("remainWorkTimeProportion").toString())<Double.parseDouble(map.get("warningPercent").toString())){
|
|
|
+ l.put("isRed",true );
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ l.put("remainWorkTimeProportion","\\");
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
- else {
|
|
|
- if (taskGroupCollect.size()>0){
|
|
|
- List<Integer> groupIds = taskGroupCollect.stream().map(TaskGroup::getId).collect(Collectors.toList());
|
|
|
- List<Report> getByProjectAndGroup = reportMapper.selectList(new QueryWrapper<Report>()
|
|
|
- .eq("project_id", project.getId())
|
|
|
- .in("group_id", groupIds));
|
|
|
- for (TaskGroup taskGroup : taskGroupCollect) {
|
|
|
- Double gReallWorkTime = getByProjectAndGroup.stream().filter(r -> r.getGroupId().equals( taskGroup.getId()))
|
|
|
- .mapToDouble(r->r.getWorkingTime()).sum();
|
|
|
- GroupEstimatedWorkVO groupEstimatedWorkVO = new GroupEstimatedWorkVO();
|
|
|
- String grWorkTime=gReallWorkTime==null ? "0":gReallWorkTime+"";
|
|
|
- String gEstimatedWork=taskGroup.getManDay()==null ? 0*allday+"": taskGroup.getManDay()*allday+"";
|
|
|
|
|
|
- if (taskGroup.getManDay()==null){
|
|
|
- groupEstimatedWorkVO.setRemainWorkTime("\\");
|
|
|
- groupEstimatedWorkVO.setRemainWorkTimeProportion("\\");
|
|
|
- }else{
|
|
|
- double grWorkTimeDouble = Double.parseDouble(grWorkTime);
|
|
|
- double gEstimatedWorkDouble = Double.parseDouble(gEstimatedWork);
|
|
|
- double remainDouble = gEstimatedWorkDouble - grWorkTimeDouble;
|
|
|
- groupEstimatedWorkVO.setRemainWorkTime(String.format("%.2f", remainDouble));
|
|
|
- double proportion = (remainDouble / gEstimatedWorkDouble)*100;
|
|
|
- groupEstimatedWorkVO.setRemainWorkTimeProportion(String.format("%.2f", proportion));
|
|
|
+ }else {
|
|
|
+ map.put("warningPercent",groupWarningPercent );
|
|
|
+
|
|
|
+ list= projectMapper.selectGroupEestimatedWorkTimeList(map);
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ list.forEach(l-> {
|
|
|
+ l.put("isRed",null);
|
|
|
+ /*if (Double.parseDouble(l.get("remainWorkTime").toString())<=0){
|
|
|
+ l.put("remainWorkTime","\\");
|
|
|
+ }*/
|
|
|
+ if(l.get("remainWorkTimeProportion")!=null) {
|
|
|
+ l.put("remainWorkTimeProportion",new BigDecimal(l.get("remainWorkTimeProportion").toString()).multiply(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
|
|
|
+ if (Double.parseDouble(l.get("remainWorkTimeProportion").toString())<Double.parseDouble(map.get("warningPercent").toString())){
|
|
|
+ l.put("isRed",true );
|
|
|
}
|
|
|
-
|
|
|
- groupEstimatedWorkVO.setWorkTime(grWorkTime);
|
|
|
- groupEstimatedWorkVO.setEstimatedWorkTime(gEstimatedWork);
|
|
|
- groupEstimatedWorkVO.setId(taskGroup.getId());
|
|
|
- groupEstimatedWorkVO.setGroupName(taskGroup.getName());
|
|
|
- groupEstimatedWorkVO.setProjectId(project.getId());
|
|
|
- groupEstimatedWorkVO.setProjectName(project.getProjectName());
|
|
|
-
|
|
|
- lastList.add(groupEstimatedWorkVO);
|
|
|
+ }else{
|
|
|
+ l.put("remainWorkTimeProportion","\\");
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
- GroupEstimatedWorkVO groupEstimatedWorkVO = new GroupEstimatedWorkVO();
|
|
|
- groupEstimatedWorkVO.setWorkTime("");
|
|
|
- groupEstimatedWorkVO.setEstimatedWorkTime("");
|
|
|
- groupEstimatedWorkVO.setId(null);
|
|
|
- groupEstimatedWorkVO.setGroupName("");
|
|
|
- groupEstimatedWorkVO.setProjectId(project.getId());
|
|
|
- groupEstimatedWorkVO.setProjectName(project.getProjectName());
|
|
|
- groupEstimatedWorkVO.setRemainWorkTime("\\");
|
|
|
- groupEstimatedWorkVO.setRemainWorkTimeProportion("\\");
|
|
|
- lastList.add(groupEstimatedWorkVO);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- Integer projectWarningPercent = estimateTimeSetting.getProjectWarningPercent();
|
|
|
- Integer groupWarningPercent = estimateTimeSetting.getGroupWarningPercent();
|
|
|
- if (isWarn!=null){
|
|
|
- lastList = lastList.stream().
|
|
|
- filter(l -> !StringUtils.isEmpty(l.getRemainWorkTimeProportion()) && !l.getRemainWorkTimeProportion().equals("\\")).collect(Collectors.toList());
|
|
|
- if (type==0){
|
|
|
- lastList = lastList.stream().
|
|
|
- filter(l -> Double.parseDouble(l.getRemainWorkTimeProportion()) < projectWarningPercent)
|
|
|
- .collect(Collectors.toList());
|
|
|
- }else {
|
|
|
- lastList = lastList.stream().
|
|
|
- filter(l -> Double.parseDouble(l.getRemainWorkTimeProportion()) < groupWarningPercent)
|
|
|
- .collect(Collectors.toList());
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1006,20 +1036,21 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<List<String>> allList = new ArrayList<>();
|
|
|
allList.add(headList);
|
|
|
|
|
|
- if (!lastList.isEmpty()){
|
|
|
- for (int i = 0; i < lastList.size(); i++) {
|
|
|
- ArrayList<String> list = new ArrayList<>();
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getProjectName())?"":lastList.get(i).getProjectName());
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getEstimatedWorkTime())?"":lastList.get(i).getEstimatedWorkTime());
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getWorkTime())?"":lastList.get(i).getWorkTime());
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getRemainWorkTime())?"":lastList.get(i).getRemainWorkTime());
|
|
|
- if (!StringUtils.isEmpty(lastList.get(i).getRemainWorkTimeProportion())&&lastList.get(i).getRemainWorkTimeProportion().equals("\\")){
|
|
|
- list.add("\\");
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ ArrayList<String> listString = new ArrayList<>();
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("projectName").toString())?"":list.get(i).get("projectName").toString());
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("estimatedWorkTime").toString())?"":list.get(i).get("estimatedWorkTime").toString());
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("workTime").toString())?"":list.get(i).get("workTime").toString());
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("remainWorkTime").toString())?"":list.get(i).get("remainWorkTime").toString());
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(list.get(i).get("remainWorkTimeProportion"))&&list.get(i).get("remainWorkTimeProportion").equals("\\")){
|
|
|
+ listString.add("\\");
|
|
|
}else {
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getRemainWorkTimeProportion())?"":lastList.get(i).getRemainWorkTimeProportion()+"%");
|
|
|
- }
|
|
|
+ listString.add((StringUtils.isEmpty(list.get(i).get("remainWorkTimeProportion").toString())?"":list.get(i).get("remainWorkTimeProportion").toString())+"%");
|
|
|
|
|
|
- allList.add(list);
|
|
|
+ }
|
|
|
+ allList.add(listString);
|
|
|
}
|
|
|
}
|
|
|
try {
|
|
@@ -1043,20 +1074,30 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<List<String>> allList = new ArrayList<>();
|
|
|
allList.add(headList);
|
|
|
|
|
|
- if (!lastList.isEmpty()){
|
|
|
- for (int i = 0; i < lastList.size(); i++) {
|
|
|
- ArrayList<String> list = new ArrayList<>();
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getProjectName())?"":lastList.get(i).getProjectName());
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getGroupName())?"":lastList.get(i).getGroupName());
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getEstimatedWorkTime())?"":lastList.get(i).getEstimatedWorkTime());
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getWorkTime())?"":lastList.get(i).getWorkTime());
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getRemainWorkTime())?"":lastList.get(i).getRemainWorkTime());
|
|
|
- if (!StringUtils.isEmpty(lastList.get(i).getRemainWorkTimeProportion())&&lastList.get(i).getRemainWorkTimeProportion().equals("\\")){
|
|
|
- list.add("\\");
|
|
|
+ if (!list.isEmpty()){
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
+ ArrayList<String> listString = new ArrayList<>();
|
|
|
+ if (list.get(i).get("projectName")!=null){
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("projectName").toString())?"":list.get(i).get("projectName").toString());
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ listString.add("");
|
|
|
+ }
|
|
|
+ if (list.get(i).get("groupName")!=null){
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("groupName").toString())?"":list.get(i).get("groupName").toString());
|
|
|
+ }else {
|
|
|
+ listString.add("");
|
|
|
+ }
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("estimatedWorkTime").toString())?"":list.get(i).get("estimatedWorkTime").toString());
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("workTime").toString())?"":list.get(i).get("workTime").toString());
|
|
|
+ listString.add(StringUtils.isEmpty(list.get(i).get("remainWorkTime").toString())?"":list.get(i).get("remainWorkTime").toString());
|
|
|
+
|
|
|
+ if (!StringUtils.isEmpty(list.get(i).get("remainWorkTimeProportion"))&&list.get(i).get("remainWorkTimeProportion").equals("\\")){
|
|
|
+ listString.add("\\");
|
|
|
}else {
|
|
|
- list.add(StringUtils.isEmpty(lastList.get(i).getRemainWorkTimeProportion())?"":lastList.get(i).getRemainWorkTimeProportion()+"%");
|
|
|
+ listString.add((StringUtils.isEmpty(list.get(i).get("remainWorkTimeProportion").toString())?"":list.get(i).get("remainWorkTimeProportion").toString())+"%");
|
|
|
}
|
|
|
- allList.add(list);
|
|
|
+ allList.add(listString);
|
|
|
}
|
|
|
}
|
|
|
try {
|