|
@@ -148,6 +148,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
ProjectSeparateMapper projectSeparateMapper;
|
|
ProjectSeparateMapper projectSeparateMapper;
|
|
@Resource
|
|
@Resource
|
|
ProjectStageMapper projectStageMapper;
|
|
ProjectStageMapper projectStageMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ UserCustomMapper userCustomMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ SubUserCustomMapper subUserCustomMapper;
|
|
|
|
+
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private HttpServletResponse response;
|
|
private HttpServletResponse response;
|
|
@@ -258,7 +263,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
List<Integer> projectIds = projectList.stream().distinct().map(pl -> pl.getId()).collect(Collectors.toList());
|
|
List<Integer> projectIds = projectList.stream().distinct().map(pl -> pl.getId()).collect(Collectors.toList());
|
|
List<ProjectSeparate> projectSeparateList=new ArrayList<>();
|
|
List<ProjectSeparate> projectSeparateList=new ArrayList<>();
|
|
- if(companyId==936){
|
|
|
|
|
|
+ if(companyId==936||companyId==428){
|
|
if (projectIds.size() > 0) {
|
|
if (projectIds.size() > 0) {
|
|
projectSeparateList = projectSeparateMapper.selectList(new QueryWrapper<ProjectSeparate>().in("id", projectIds));
|
|
projectSeparateList = projectSeparateMapper.selectList(new QueryWrapper<ProjectSeparate>().in("id", projectIds));
|
|
}
|
|
}
|
|
@@ -319,7 +324,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
projectVO.setProviderInfoList(mapList);
|
|
projectVO.setProviderInfoList(mapList);
|
|
}
|
|
}
|
|
- if(companyId==936){
|
|
|
|
|
|
+ if(companyId==936||companyId==428){
|
|
Optional<ProjectSeparate> first1 = projectSeparateList.stream().filter(ps -> ps.getId().equals(project.getId())).findFirst();
|
|
Optional<ProjectSeparate> first1 = projectSeparateList.stream().filter(ps -> ps.getId().equals(project.getId())).findFirst();
|
|
if(first1.isPresent()){
|
|
if(first1.isPresent()){
|
|
projectVO.setProjectSeparate(first1.get());
|
|
projectVO.setProjectSeparate(first1.get());
|
|
@@ -365,11 +370,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
String providerIds,
|
|
String providerIds,
|
|
String providerNames,
|
|
String providerNames,
|
|
HttpServletRequest request,
|
|
HttpServletRequest request,
|
|
- ProjectSeparate projectSeparate,boolean onlyChangeParticipate) {
|
|
|
|
|
|
+ ProjectSeparate projectSeparate,Double outputValue,boolean onlyChangeParticipate) {
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
HttpRespMsg httpRespMsg = new HttpRespMsg();
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
User user = userMapper.selectById(request.getHeader("Token"));
|
|
Integer companyId = user.getCompanyId();
|
|
Integer companyId = user.getCompanyId();
|
|
-
|
|
|
|
|
|
+ TimeType timeType = timeTypeMapper.selectById(user.getCompanyId());
|
|
boolean isNew = true;
|
|
boolean isNew = true;
|
|
//检查负责人要在参与人中
|
|
//检查负责人要在参与人中
|
|
if (inchargerId != null) {
|
|
if (inchargerId != null) {
|
|
@@ -423,6 +428,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
.setTaskGpIncharge(taskGpIncharge)
|
|
.setTaskGpIncharge(taskGpIncharge)
|
|
.setProviderIds(providerIds)
|
|
.setProviderIds(providerIds)
|
|
.setProviderNames(providerNames);
|
|
.setProviderNames(providerNames);
|
|
|
|
+ if(timeType.getOutputValueStatus()==1){
|
|
|
|
+ project.setOutputValue(outputValue==null?0.00:outputValue);
|
|
|
|
+ }
|
|
ProjectMain projectMain = projectMainMapper.selectById(projectMainId);
|
|
ProjectMain projectMain = projectMainMapper.selectById(projectMainId);
|
|
if(projectMain!=null){
|
|
if(projectMain!=null){
|
|
project.setCategory(projectMain.getCategoryId());
|
|
project.setCategory(projectMain.getCategoryId());
|
|
@@ -471,7 +479,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
id = project.getId();
|
|
id = project.getId();
|
|
- if(companyId==936){
|
|
|
|
|
|
+ if(companyId==936||companyId==428){
|
|
projectSeparate.setId(id);
|
|
projectSeparate.setId(id);
|
|
projectSeparateMapper.insert(projectSeparate);
|
|
projectSeparateMapper.insert(projectSeparate);
|
|
}
|
|
}
|
|
@@ -502,6 +510,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
.setTaskGpIncharge(taskGpIncharge)
|
|
.setTaskGpIncharge(taskGpIncharge)
|
|
.setProviderIds(providerIds)
|
|
.setProviderIds(providerIds)
|
|
.setProviderNames(providerNames);
|
|
.setProviderNames(providerNames);
|
|
|
|
+ if(timeType.getOutputValueStatus()==1){
|
|
|
|
+ p.setOutputValue(outputValue==null?0.00:outputValue);
|
|
|
|
+ }
|
|
if (category != null) {
|
|
if (category != null) {
|
|
ProjectCategory projectCategory = projectCategoryMapper.selectById(category);
|
|
ProjectCategory projectCategory = projectCategoryMapper.selectById(category);
|
|
if (projectCategory != null) {
|
|
if (projectCategory != null) {
|
|
@@ -509,7 +520,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
p.setCategoryName(projectCategory.getName());
|
|
p.setCategoryName(projectCategory.getName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(companyId==936){
|
|
|
|
|
|
+ if(companyId==936||companyId==428){
|
|
//编辑之前的项目是否存在子表数据
|
|
//编辑之前的项目是否存在子表数据
|
|
ProjectSeparate separate = projectSeparateMapper.selectById(id);
|
|
ProjectSeparate separate = projectSeparateMapper.selectById(id);
|
|
projectSeparate.setId(id);
|
|
projectSeparate.setId(id);
|
|
@@ -1179,7 +1190,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<ProjectAuditor> auditorList = projectAuditorMapper.selectList(new QueryWrapper<ProjectAuditor>().eq("project_id", id));
|
|
List<ProjectAuditor> auditorList = projectAuditorMapper.selectList(new QueryWrapper<ProjectAuditor>().eq("project_id", id));
|
|
project.setAuditorList(auditorList);
|
|
project.setAuditorList(auditorList);
|
|
project.setAuditUserIds(auditorList.stream().map(ProjectAuditor::getAuditorId).collect(Collectors.toList()));
|
|
project.setAuditUserIds(auditorList.stream().map(ProjectAuditor::getAuditorId).collect(Collectors.toList()));
|
|
- if(project.getCompanyId()==936){
|
|
|
|
|
|
+ if(project.getCompanyId()==936||project.getCompanyId()==428){
|
|
ProjectSeparate projectSeparate = projectSeparateMapper.selectById(id);
|
|
ProjectSeparate projectSeparate = projectSeparateMapper.selectById(id);
|
|
project.setProjectSeparate(projectSeparate);
|
|
project.setProjectSeparate(projectSeparate);
|
|
}
|
|
}
|
|
@@ -2772,20 +2783,25 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
int i=0;
|
|
int i=0;
|
|
int k=0;
|
|
int k=0;
|
|
int c=0;
|
|
int c=0;
|
|
|
|
+ int d=0;
|
|
if(timeType.getMainProjectState()==1){
|
|
if(timeType.getMainProjectState()==1){
|
|
mainNameCell = row.getCell(0);
|
|
mainNameCell = row.getCell(0);
|
|
- codeCell = row.getCell(1);
|
|
|
|
|
|
+ if(company.getId()==428){
|
|
|
|
+ projectCategorySubCell=row.getCell(1);
|
|
|
|
+ d++;
|
|
|
|
+ }
|
|
|
|
+ codeCell = row.getCell(1+d);
|
|
if(company.getId()==936){
|
|
if(company.getId()==936){
|
|
- contractCell=row.getCell(2);
|
|
|
|
|
|
+ contractCell=row.getCell(2+d);
|
|
c++;
|
|
c++;
|
|
}
|
|
}
|
|
- isPublicCell = row.getCell(2+c);
|
|
|
|
- nameCell = row.getCell(3+c);
|
|
|
|
- participatorCell = row.getCell(4+c);
|
|
|
|
- inchargerCell = row.getCell(5+c);
|
|
|
|
- levelCell = row.getCell(6+c);
|
|
|
|
|
|
+ isPublicCell = row.getCell(2+c+d);
|
|
|
|
+ nameCell = row.getCell(3+c+d);
|
|
|
|
+ participatorCell = row.getCell(4+c+d);
|
|
|
|
+ inchargerCell = row.getCell(5+c+d);
|
|
|
|
+ levelCell = row.getCell(6+c+d);
|
|
if(company.getPackageCustomer()==1){
|
|
if(company.getPackageCustomer()==1){
|
|
- customerCell=row.getCell(7+c);
|
|
|
|
|
|
+ customerCell=row.getCell(7+c+d);
|
|
i++;
|
|
i++;
|
|
}
|
|
}
|
|
if(company.getPackageProvider()==1){
|
|
if(company.getPackageProvider()==1){
|
|
@@ -2795,17 +2811,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- startDateCell = row.getCell(7+i+k+c);
|
|
|
|
- endDateCell = row.getCell(8+i+k+c);
|
|
|
|
- amountCell = row.getCell(9+i+k+c);
|
|
|
|
|
|
+ startDateCell = row.getCell(7+i+k+c+d);
|
|
|
|
+ endDateCell = row.getCell(8+i+k+c+d);
|
|
|
|
+ amountCell = row.getCell(9+i+k+c+d);
|
|
if(company.getId()==936){
|
|
if(company.getId()==936){
|
|
- warrantyEndDateCell=row.getCell(10+i+k+c);
|
|
|
|
- warrantyStartDateCell=row.getCell(11+i+k+c);
|
|
|
|
- projectCategorySubCell=row.getCell(12+i+k+c);
|
|
|
|
- regionCell=row.getCell(13+i+k+c);
|
|
|
|
- buCell=row.getCell(14+i+k+c);
|
|
|
|
- stateCell=row.getCell(15+i+k+c);
|
|
|
|
- stageCell=row.getCell(16+i+k+c);
|
|
|
|
|
|
+ warrantyEndDateCell=row.getCell(10+i+k+c+d);
|
|
|
|
+ warrantyStartDateCell=row.getCell(11+i+k+c+d);
|
|
|
|
+ projectCategorySubCell=row.getCell(12+i+k+c+d);
|
|
|
|
+ regionCell=row.getCell(13+i+k+c+d);
|
|
|
|
+ buCell=row.getCell(14+i+k+c+d);
|
|
|
|
+ stateCell=row.getCell(15+i+k+c+d);
|
|
|
|
+ stageCell=row.getCell(16+i+k+c+d);
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
codeCell = row.getCell(0);
|
|
codeCell = row.getCell(0);
|
|
@@ -2813,15 +2829,19 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
contractCell=row.getCell(1);
|
|
contractCell=row.getCell(1);
|
|
c++;
|
|
c++;
|
|
}
|
|
}
|
|
- categoryCell = row.getCell(1+c);
|
|
|
|
- isPublicCell = row.getCell(2+c);
|
|
|
|
- nameCell = row.getCell(3+c);
|
|
|
|
- subNameCell = row.getCell(4+c);
|
|
|
|
- participatorCell = row.getCell(5+c);
|
|
|
|
- inchargerCell = row.getCell(6+c);
|
|
|
|
- levelCell = row.getCell(7+c);
|
|
|
|
|
|
+ if(company.getId()==428){
|
|
|
|
+ projectCategorySubCell=row.getCell(1+c);
|
|
|
|
+ d++;
|
|
|
|
+ }
|
|
|
|
+ categoryCell = row.getCell(1+c+d);
|
|
|
|
+ isPublicCell = row.getCell(2+c+d);
|
|
|
|
+ nameCell = row.getCell(3+c+d);
|
|
|
|
+ subNameCell = row.getCell(4+c+d);
|
|
|
|
+ participatorCell = row.getCell(5+c+d);
|
|
|
|
+ inchargerCell = row.getCell(6+c+d);
|
|
|
|
+ levelCell = row.getCell(7+c+d);
|
|
if(company.getPackageCustomer()==1){
|
|
if(company.getPackageCustomer()==1){
|
|
- customerCell=row.getCell(8+c);
|
|
|
|
|
|
+ customerCell=row.getCell(8+c+d);
|
|
i++;
|
|
i++;
|
|
}
|
|
}
|
|
if(company.getPackageProvider()==1){
|
|
if(company.getPackageProvider()==1){
|
|
@@ -2831,17 +2851,17 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- startDateCell = row.getCell(8+i+k+c);
|
|
|
|
- endDateCell = row.getCell(9+i+k+c);
|
|
|
|
- amountCell = row.getCell(10+i+k+c);
|
|
|
|
|
|
+ startDateCell = row.getCell(8+i+k+c+d);
|
|
|
|
+ endDateCell = row.getCell(9+i+k+c+d);
|
|
|
|
+ amountCell = row.getCell(10+i+k+c+d);
|
|
if(company.getId()==936){
|
|
if(company.getId()==936){
|
|
- warrantyEndDateCell=row.getCell(11+i+k+c);
|
|
|
|
- warrantyStartDateCell=row.getCell(12+i+k+c);
|
|
|
|
- projectCategorySubCell=row.getCell(13+i+k+c);
|
|
|
|
- regionCell=row.getCell(14+i+k+c);
|
|
|
|
- buCell=row.getCell(15+i+k+c);
|
|
|
|
- stateCell=row.getCell(16+i+k+c);
|
|
|
|
- stageCell=row.getCell(17+i+k+c);
|
|
|
|
|
|
+ warrantyEndDateCell=row.getCell(11+i+k+c+d);
|
|
|
|
+ warrantyStartDateCell=row.getCell(12+i+k+c+d);
|
|
|
|
+ projectCategorySubCell=row.getCell(13+i+k+c+d);
|
|
|
|
+ regionCell=row.getCell(14+i+k+c+d);
|
|
|
|
+ buCell=row.getCell(15+i+k+c+d);
|
|
|
|
+ stateCell=row.getCell(16+i+k+c+d);
|
|
|
|
+ stageCell=row.getCell(17+i+k+c+d);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (codeCell != null)codeCell.setCellType(CellType.STRING);
|
|
if (codeCell != null)codeCell.setCellType(CellType.STRING);
|
|
@@ -3094,7 +3114,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
if(company.getId()==936){
|
|
if(company.getId()==936){
|
|
ProjectSeparate projectSeparate=new ProjectSeparate();
|
|
ProjectSeparate projectSeparate=new ProjectSeparate();
|
|
projectSeparate.setId(id);
|
|
projectSeparate.setId(id);
|
|
- if (warrantyStartDateCell !=null && !StringUtils.isEmpty(warrantyStartDateCell.getDateCellValue())) {
|
|
|
|
|
|
+ if (warrantyStartDateCell !=null&& warrantyStartDateCell.getCellTypeEnum() == CellType.NUMERIC && !StringUtils.isEmpty(warrantyStartDateCell.getDateCellValue())) {
|
|
projectSeparate.setWarrantyStartDate(LocalDate.parse(sdf.format(warrantyStartDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
|
projectSeparate.setWarrantyStartDate(LocalDate.parse(sdf.format(warrantyStartDateCell.getDateCellValue()), DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
|
}
|
|
}
|
|
if (warrantyEndDateCell !=null && warrantyEndDateCell.getCellTypeEnum() == CellType.NUMERIC && !StringUtils.isEmpty(warrantyEndDateCell.getDateCellValue())) {
|
|
if (warrantyEndDateCell !=null && warrantyEndDateCell.getCellTypeEnum() == CellType.NUMERIC && !StringUtils.isEmpty(warrantyEndDateCell.getDateCellValue())) {
|
|
@@ -3115,6 +3135,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
projectSeparateMapper.insert(projectSeparate);
|
|
projectSeparateMapper.insert(projectSeparate);
|
|
}
|
|
}
|
|
|
|
+ if(company.getId()==428){
|
|
|
|
+ ProjectSeparate projectSeparate=new ProjectSeparate();
|
|
|
|
+ projectSeparate.setId(id);
|
|
|
|
+ if (projectCategorySubCell != null && !StringUtils.isEmpty(projectCategorySubCell.getStringCellValue())) {
|
|
|
|
+ projectSeparate.setProjectCategorySub(projectCategorySubCell.getStringCellValue());
|
|
|
|
+ }
|
|
|
|
+ projectSeparateMapper.insert(projectSeparate);
|
|
|
|
+ }
|
|
importCount++;
|
|
importCount++;
|
|
//参与人
|
|
//参与人
|
|
if(inchargerCell!=null){
|
|
if(inchargerCell!=null){
|
|
@@ -3290,6 +3318,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
headList.add("项目状态");
|
|
headList.add("项目状态");
|
|
headList.add("项目阶段");
|
|
headList.add("项目阶段");
|
|
}
|
|
}
|
|
|
|
+ if(company.getId()==428){
|
|
|
|
+ headList.add("项目分组");
|
|
|
|
+ }
|
|
List<List<String>> allList = new ArrayList<List<String>>();
|
|
List<List<String>> allList = new ArrayList<List<String>>();
|
|
allList.add(headList);
|
|
allList.add(headList);
|
|
String[] levelArray = new String[]{"正常","紧急","重要","重要且紧急","低风险","中风险","高风险"};
|
|
String[] levelArray = new String[]{"正常","紧急","重要","重要且紧急","低风险","中风险","高风险"};
|
|
@@ -3390,6 +3421,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
rowData.add(projectVO.getCurrentStageName()==null?"":projectVO.getCurrentStageName());
|
|
rowData.add(projectVO.getCurrentStageName()==null?"":projectVO.getCurrentStageName());
|
|
}
|
|
}
|
|
|
|
+ if(company.getId()==428){
|
|
|
|
+ Optional<ProjectSeparate> first = projectSeparateList.stream().filter(ps -> ps.getId().equals(projectVO.getId())).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ ProjectSeparate projectSeparate = first.get();
|
|
|
|
+ rowData.add(projectSeparate.getProjectCategorySub()==null?"":projectSeparate.getProjectCategorySub());
|
|
|
|
+ }else {
|
|
|
|
+ rowData.add("");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
allList.add(rowData);
|
|
allList.add(rowData);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -5024,6 +5064,200 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
return httpRespMsg;
|
|
return httpRespMsg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getProjectBaseCost(Integer projectId, HttpServletRequest request, Integer pageIndex, Integer pageSize) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("Token"));
|
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
|
+ List<Project> projectList = projectMapper.selectList(new QueryWrapper<Project>().eq("company_id", companyId));
|
|
|
|
+ List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "全部项目成本基线表");
|
|
|
|
+ List<SysRichFunction> functionInchargeList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "负责项目成本基线表");
|
|
|
|
+ //判断查看权限
|
|
|
|
+ List<Integer> inchagerIds=null;
|
|
|
|
+ if(functionAllList.size()==0){
|
|
|
|
+ inchagerIds=new ArrayList<>();
|
|
|
|
+ if(functionInchargeList.size()>0){
|
|
|
|
+ List<Project> list = projectList.stream().filter(pl ->(pl.getInchargerId()==null?0:pl.getInchargerId()).equals(user.getId())).collect(Collectors.toList());
|
|
|
|
+ if(list!=null){
|
|
|
|
+ List<Integer> collect = list.stream().map(li -> li.getId()).collect(Collectors.toList());
|
|
|
|
+ inchagerIds.addAll(collect);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ inchagerIds.add(-1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ QueryWrapper<Project> queryWrapper=new QueryWrapper<>();
|
|
|
|
+ if(projectId!=null){
|
|
|
|
+ queryWrapper.eq("id",projectId);
|
|
|
|
+ }
|
|
|
|
+ if(inchagerIds!=null){
|
|
|
|
+ queryWrapper.in("id",inchagerIds);
|
|
|
|
+ }
|
|
|
|
+ IPage<Project> projectIPage;
|
|
|
|
+ if(pageIndex!=null && pageSize!=null){
|
|
|
|
+ projectIPage= projectMapper.selectPage(new Page<>(pageIndex, pageSize),
|
|
|
|
+ queryWrapper.eq("company_id",user.getCompanyId()));
|
|
|
|
+ }else {
|
|
|
|
+ projectIPage= projectMapper.selectPage(new Page<>(-1,-1),
|
|
|
|
+ queryWrapper.eq("company_id",user.getCompanyId()));
|
|
|
|
+ }
|
|
|
|
+ List<Project> targetProjectList = projectIPage.getRecords();
|
|
|
|
+ List<Integer> collect = targetProjectList.stream().distinct().map(Project::getId).collect(Collectors.toList());
|
|
|
|
+ List<ProjectBasecost> projectBasecostList=new ArrayList<>();
|
|
|
|
+ if(collect!=null&&collect.size()>0){
|
|
|
|
+ projectBasecostList = projectBasecostMapper.selectList(new QueryWrapper<ProjectBasecost>().in("project_id", collect));
|
|
|
|
+ }
|
|
|
|
+ List<ProjectBasecostSetting> settingList = projectBasecostSettingMapper.selectList(new QueryWrapper<ProjectBasecostSetting>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ List<String> titleList = settingList.stream().distinct().map(ProjectBasecostSetting::getName).collect(Collectors.toList());
|
|
|
|
+ for (Project project : targetProjectList) {
|
|
|
|
+ List<ProjectBasecost> basecostList = projectBasecostList.stream().filter(pb -> pb.getProjectId().equals(project.getId())).collect(Collectors.toList());
|
|
|
|
+ if(basecostList!=null){
|
|
|
|
+ project.setProjectBasecostList(basecostList);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ HashMap map=new HashMap();
|
|
|
|
+ map.put("total",projectIPage.getTotal());
|
|
|
|
+ map.put("title",titleList);
|
|
|
|
+ map.put("result",targetProjectList);
|
|
|
|
+ httpRespMsg.data=map;
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportProjectBaseCost(HttpServletRequest request) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ HttpRespMsg projectBaseCost = getProjectBaseCost(null, request, null, null);
|
|
|
|
+ HashMap map= (HashMap) projectBaseCost.data;
|
|
|
|
+ List<Project> resultProjectList= (List<Project>) map.get("result");
|
|
|
|
+ List<List<String>> dataList=new ArrayList<>();
|
|
|
|
+ List<String> titleList= (List<String>) map.get("title");
|
|
|
|
+ List<String> firstTitle=new ArrayList<>();
|
|
|
|
+ firstTitle.add("项目编号");
|
|
|
|
+ firstTitle.add("项目名称");
|
|
|
|
+ firstTitle.addAll(titleList);
|
|
|
|
+ dataList.add(firstTitle);
|
|
|
|
+ for (Project project : resultProjectList) {
|
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
|
+ item.add(project.getProjectCode());
|
|
|
|
+ item.add(project.getProjectName());
|
|
|
|
+ for (String s : titleList) {
|
|
|
|
+ List<ProjectBasecost> projectBasecostList = project.getProjectBasecostList();
|
|
|
|
+ if(projectBasecostList!=null){
|
|
|
|
+ Optional<ProjectBasecost> first = projectBasecostList.stream().filter(pb -> pb.getBaseName().equals(s)).findFirst();
|
|
|
|
+ if(first.isPresent()){
|
|
|
|
+ ProjectBasecost projectBasecost = first.get();
|
|
|
|
+ item.add(String.valueOf(projectBasecost.getBaseAmount()));
|
|
|
|
+ }else item.add("");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ dataList.add(item);
|
|
|
|
+ }
|
|
|
|
+ //生成excel文件导出
|
|
|
|
+ String fileName = "项目成本基线表_"+System.currentTimeMillis();
|
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
|
+ httpRespMsg.data = resp;
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg getTimeCostByUserCustom(String startDate, String endDate, String subCustomName, Integer customId,HttpServletRequest request,String fieldName) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ User targetUser = userMapper.selectById(request.getHeader("Token"));
|
|
|
|
+ Integer companyId =targetUser.getCompanyId();
|
|
|
|
+ Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ //当前用户管理部门
|
|
|
|
+ List<Integer> deptIds=null;
|
|
|
|
+ List<Department> allDepartmentList=departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",companyId));
|
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", targetUser.getId()).eq("company_id", companyId));
|
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", targetUser.getId()));
|
|
|
|
+ List<SysRichFunction> functionAllList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看全公司");
|
|
|
|
+ List<SysRichFunction> functionDpartList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看负责部门");
|
|
|
|
+ List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
|
|
+ List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
|
|
+ //判断查看权限
|
|
|
|
+ if(functionAllList.size()==0){
|
|
|
|
+ deptIds=new ArrayList<>();
|
|
|
|
+ deptIds.add(-1);
|
|
|
|
+ if(functionDpartList.size()>0){
|
|
|
|
+ if(functionTimeList.size()>0||functionCostList.size()>0){
|
|
|
|
+ List<Integer> collect = departmentList.stream().distinct().map(dm -> dm.getDepartmentId()).collect(Collectors.toList());
|
|
|
|
+ List<Integer> otherCollect = departmentOtherManagerList.stream().distinct().map(dom -> dom.getDepartmentId()).collect(Collectors.toList());
|
|
|
|
+ collect.addAll(otherCollect);
|
|
|
|
+ for (Integer integer : collect) {
|
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDepartmentList);
|
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ List<Map<String, Object>> list= projectMapper.getCostByUserCustom(startDate, endDate,companyId,deptIds,customId,subCustomName,fieldName);
|
|
|
|
+ BigDecimal totalCostMoney = new BigDecimal(0);
|
|
|
|
+ Map<String, Object> finalMap = new HashMap<>();
|
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
+ totalCostMoney=totalCostMoney.add((BigDecimal) map.get("costMoney"));
|
|
|
|
+ }
|
|
|
|
+ finalMap.put("totalCostMoney", totalCostMoney);
|
|
|
|
+ finalMap.put("list", list);
|
|
|
|
+ if(functionCostList.size()==0){
|
|
|
|
+ finalMap.put("totalCostMoney",null);
|
|
|
|
+ list.forEach(li->{
|
|
|
|
+ List<Map<String,Object>> mapList= (List<Map<String, Object>>) li.get("name");
|
|
|
|
+ mapList.forEach(ml->{
|
|
|
|
+ ml.put("costMoney",null);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if(functionTimeList.size()==0){
|
|
|
|
+ list.forEach(li->{
|
|
|
|
+ List<Map<String,Object>> mapList= (List<Map<String, Object>>) li.get("name");
|
|
|
|
+ mapList.forEach(ml->{
|
|
|
|
+ ml.put("cost",null);
|
|
|
|
+ });
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ httpRespMsg.data = finalMap;
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportTimeCostByUserCustom(String startDate, String endDate, String subCustomName, Integer customId, HttpServletRequest request, String fieldName) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ User targetUser = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ List<SysRichFunction> functionTimeList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看工时统计");
|
|
|
|
+ List<SysRichFunction> functionCostList = sysFunctionMapper.getRoleFunctions(targetUser.getRoleId(), "查看成本统计");
|
|
|
|
+ HttpRespMsg msg = getTimeCostByUserCustom(startDate, endDate, null, customId, request, fieldName);
|
|
|
|
+ HashMap map= (HashMap) msg.data;
|
|
|
|
+ UserCustom userCustom = userCustomMapper.selectById(customId);
|
|
|
|
+ List<Map<String,Object>> resultList= (List<Map<String, Object>>) map.get("list");
|
|
|
|
+ List<List<String>> dataList=new ArrayList<>();
|
|
|
|
+ List<String> titleList=new ArrayList<>();
|
|
|
|
+ titleList.add(userCustom.getName());
|
|
|
|
+ if(functionTimeList.size()>0){
|
|
|
|
+ titleList.add("工时");
|
|
|
|
+ }
|
|
|
|
+ if(functionCostList.size()>0){
|
|
|
|
+ titleList.add("成本");
|
|
|
|
+ }
|
|
|
|
+ dataList.add(titleList);
|
|
|
|
+ for (Map<String, Object> stringObjectMap : resultList) {
|
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
|
+ item.add(String.valueOf(stringObjectMap.get("name")));
|
|
|
|
+ if(functionTimeList.size()>0){
|
|
|
|
+ item.add(String.valueOf(stringObjectMap.get("cost"))==null?"":String.valueOf(stringObjectMap.get("cost")));
|
|
|
|
+ }
|
|
|
|
+ if(functionCostList.size()>0){
|
|
|
|
+ item.add(String.valueOf(stringObjectMap.get("costMoney"))==null?"":String.valueOf(stringObjectMap.get("costMoney")));
|
|
|
|
+ }
|
|
|
|
+ dataList.add(item);
|
|
|
|
+ }
|
|
|
|
+ //生成excel文件导出
|
|
|
|
+ String fileName = userCustom.getName()+"工时成本统计_"+System.currentTimeMillis();
|
|
|
|
+ String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , dataList, path);
|
|
|
|
+ httpRespMsg.data = resp;
|
|
|
|
+
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
private List<Department> getSubDepts(Department dp, List<Department> list) {
|
|
private List<Department> getSubDepts(Department dp, List<Department> list) {
|
|
List<Department> collect = list.stream().filter(l -> dp.getDepartmentId().equals(l.getSuperiorId())).collect(Collectors.toList());
|
|
List<Department> collect = list.stream().filter(l -> dp.getDepartmentId().equals(l.getSuperiorId())).collect(Collectors.toList());
|