|
@@ -146,25 +146,32 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
public R getRectifyReportData(Map<String, Object> map) {
|
|
public R getRectifyReportData(Map<String, Object> map) {
|
|
Object projectIdObj = map.get("projectId");
|
|
Object projectIdObj = map.get("projectId");
|
|
if(ObjectUtil.isEmpty(projectIdObj)){
|
|
if(ObjectUtil.isEmpty(projectIdObj)){
|
|
- return R.error();
|
|
|
|
|
|
+ return R.error("");
|
|
}
|
|
}
|
|
String projectId = (String) projectIdObj;
|
|
String projectId = (String) projectIdObj;
|
|
LambdaQueryWrapper<ZhcxProjectRectifyDo> queryWrapper = Wrappers.lambdaQuery();
|
|
LambdaQueryWrapper<ZhcxProjectRectifyDo> queryWrapper = Wrappers.lambdaQuery();
|
|
queryWrapper.and(i -> i.eq(ZhcxProjectRectifyDo::getPrjid, projectId));
|
|
queryWrapper.and(i -> i.eq(ZhcxProjectRectifyDo::getPrjid, projectId));
|
|
queryWrapper.and(i -> i.eq(ZhcxProjectRectifyDo::getDeleted, "0"));
|
|
queryWrapper.and(i -> i.eq(ZhcxProjectRectifyDo::getDeleted, "0"));
|
|
- ZhcxProjectRectifyDo zhcxProjectRectifyDo = projectRectifyService.getOne(queryWrapper);
|
|
|
|
- if (zhcxProjectRectifyDo != null) {
|
|
|
|
|
|
+ List<ZhcxProjectRectifyDo> rectifyDos = projectRectifyService.list(queryWrapper);
|
|
|
|
+ if (rectifyDos != null && rectifyDos.size() > 0) {
|
|
RectifyReportDto rectifyReportDto = new RectifyReportDto();
|
|
RectifyReportDto rectifyReportDto = new RectifyReportDto();
|
|
- String machineno = zhcxProjectRectifyDo.getMachineno();
|
|
|
|
|
|
+ String machineno = rectifyDos.get(0).getMachineno();
|
|
if (StringUtils.isNotBlank(machineno)) {
|
|
if (StringUtils.isNotBlank(machineno)) {
|
|
List<String> machineNoList = Arrays.asList(machineno .split(","));
|
|
List<String> machineNoList = Arrays.asList(machineno .split(","));
|
|
//这里要存机号列表
|
|
//这里要存机号列表
|
|
rectifyReportDto.setNoList(machineNoList);
|
|
rectifyReportDto.setNoList(machineNoList);
|
|
QueryWrapper<ZhcxProjectRectifyMachineDo> wrapper = new QueryWrapper<>();
|
|
QueryWrapper<ZhcxProjectRectifyMachineDo> wrapper = new QueryWrapper<>();
|
|
- wrapper.eq("PRJID", zhcxProjectRectifyDo.getPrjid());
|
|
|
|
|
|
+ wrapper.eq("PRJID", rectifyDos.get(0).getPrjid());
|
|
|
|
+ wrapper.isNotNull("DEPTID");
|
|
|
|
+ wrapper.isNotNull("STATUS");
|
|
List<ZhcxProjectRectifyMachineDo> list = projectRectifyMachineService.list(wrapper);
|
|
List<ZhcxProjectRectifyMachineDo> list = projectRectifyMachineService.list(wrapper);
|
|
|
|
+ //根据施工部门分组
|
|
Map<String, List<ZhcxProjectRectifyMachineDo>> groupDeptList
|
|
Map<String, List<ZhcxProjectRectifyMachineDo>> groupDeptList
|
|
= list.stream().collect(Collectors.groupingBy(ZhcxProjectRectifyMachineDo::getDeptname));
|
|
= list.stream().collect(Collectors.groupingBy(ZhcxProjectRectifyMachineDo::getDeptname));
|
|
|
|
+ //根据一级部门分组
|
|
|
|
+ Map<String, List<ZhcxProjectRectifyMachineDo>> groupFirstDeptList
|
|
|
|
+ = list.stream().filter(e -> Objects.nonNull(e.getFirstdeptname()))
|
|
|
|
+ .collect(Collectors.groupingBy(ZhcxProjectRectifyMachineDo::getFirstdeptname));
|
|
List<RectifyDto> rectifyDtoList = new ArrayList<>();
|
|
List<RectifyDto> rectifyDtoList = new ArrayList<>();
|
|
groupDeptList.forEach((k, v) ->{
|
|
groupDeptList.forEach((k, v) ->{
|
|
RectifyDto rectifyDto = new RectifyDto();
|
|
RectifyDto rectifyDto = new RectifyDto();
|
|
@@ -172,6 +179,7 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
rectifyDto.setFirstdeptname(v.get(0).getFirstdeptname());
|
|
rectifyDto.setFirstdeptname(v.get(0).getFirstdeptname());
|
|
rectifyDto.setDeptid(v.get(0).getDeptid());
|
|
rectifyDto.setDeptid(v.get(0).getDeptid());
|
|
rectifyDto.setDeptname(v.get(0).getDeptname());
|
|
rectifyDto.setDeptname(v.get(0).getDeptname());
|
|
|
|
+ //根据机号分组
|
|
Map<String, List<ZhcxProjectRectifyMachineDo>> groupMachineList
|
|
Map<String, List<ZhcxProjectRectifyMachineDo>> groupMachineList
|
|
= v.stream().collect(Collectors.groupingBy(ZhcxProjectRectifyMachineDo::getMachineno));
|
|
= v.stream().collect(Collectors.groupingBy(ZhcxProjectRectifyMachineDo::getMachineno));
|
|
List<RectifyMachineDto> rectifyMachineDtoList = new ArrayList<>();
|
|
List<RectifyMachineDto> rectifyMachineDtoList = new ArrayList<>();
|
|
@@ -193,13 +201,14 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
int x = collect.getOrDefault("X", 0L).intValue();
|
|
int x = collect.getOrDefault("X", 0L).intValue();
|
|
rectifyMachine.setUnfinishedCount(x);
|
|
rectifyMachine.setUnfinishedCount(x);
|
|
//完成率1
|
|
//完成率1
|
|
- int rateOne = divideAndRoundUp(ok + i,v2.size());
|
|
|
|
- rectifyMachine.setFinishRateOne(rateOne+"%");
|
|
|
|
|
|
+ int rateOne = divideAndRoundUp((ok + i),v2.size());
|
|
|
|
+ rectifyMachine.setFinishRateOne(rateOne+"%");
|
|
//完成率2
|
|
//完成率2
|
|
- int rateTwo = divideAndRoundUp(x,v2.size());
|
|
|
|
|
|
+ int rateTwo = divideAndRoundUp(ok,v2.size());
|
|
rectifyMachine.setFinishRateTwo(rateTwo+"%");
|
|
rectifyMachine.setFinishRateTwo(rateTwo+"%");
|
|
rectifyMachineDtoList.add(rectifyMachine);
|
|
rectifyMachineDtoList.add(rectifyMachine);
|
|
});
|
|
});
|
|
|
|
+
|
|
rectifyDto.setData(rectifyMachineDtoList);
|
|
rectifyDto.setData(rectifyMachineDtoList);
|
|
rectifyDtoList.add(rectifyDto);
|
|
rectifyDtoList.add(rectifyDto);
|
|
});
|
|
});
|
|
@@ -216,7 +225,7 @@ public class ZhcxProjectManageServiceImpl extends ServiceImpl<ZhcxProjectManageD
|
|
throw new IllegalArgumentException("Denominator cannot be zero");
|
|
throw new IllegalArgumentException("Denominator cannot be zero");
|
|
}
|
|
}
|
|
|
|
|
|
- return (int) Math.ceil((double) numerator / denominator);
|
|
|
|
|
|
+ return (int) Math.round((double) numerator*100 / denominator);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|