|
@@ -39,6 +39,7 @@ import java.sql.Timestamp;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.NumberFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
+import java.time.Duration;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
@@ -292,6 +293,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
List<ProjectVO> list = new ArrayList<>();
|
|
|
+ List<Map<String,Object>> particpationList=participationMapper.getAllParticipator(projectIds);
|
|
|
for (Project project : projectList) {
|
|
|
ProjectVO projectVO = new ProjectVO();
|
|
|
if(timeType.getProjectLevelState()==1){
|
|
@@ -306,7 +308,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
projectVO.setDepartmentName(optional.get().getDepartmentName());
|
|
|
}
|
|
|
/**/
|
|
|
- projectVO.setParticipator(participationMapper.getParticipator(projectVO.getId()));
|
|
|
+ List<Map<String, Object>> maps = particpationList.stream().filter(pl ->Integer.valueOf(String.valueOf(pl.get("projectId"))).equals(project.getId())).collect(Collectors.toList());
|
|
|
+ projectVO.setParticipator(maps);
|
|
|
Optional<User> first = userList.stream().filter(u -> u.getId().equals(project.getInchargerId())).findFirst();
|
|
|
if (first.isPresent()) {
|
|
|
User incharger = first.get();
|
|
@@ -2898,6 +2901,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
List<ProjectLevel> projectLevelList = projectLevelMapper.selectList(new QueryWrapper<ProjectLevel>().eq("company_id", user.getCompanyId()));
|
|
|
//获取项目阶段
|
|
|
List<ProjectStage> projectStageList = projectStageMapper.selectList(new QueryWrapper<ProjectStage>().eq("company_id", company.getId()));
|
|
|
+ //获取部门
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
TimeType timeType = timeTypeMapper.selectById(company.getId());
|
|
|
List<Project> projectList = new ArrayList<Project>();
|
|
|
//由于第一行需要指明列对应的标题
|
|
@@ -2937,6 +2942,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
HSSFCell participatorCell=null;
|
|
|
HSSFCell inchargerCell=null;
|
|
|
HSSFCell levelCell=null;
|
|
|
+ HSSFCell deptCell=null;
|
|
|
HSSFCell customerCell=null;
|
|
|
HSSFCell startDateCell=null;
|
|
|
HSSFCell endDateCell=null;
|
|
@@ -2952,6 +2958,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
int i=0;
|
|
|
int k=0;
|
|
|
int c=0;
|
|
|
+ int d=0;
|
|
|
if(timeType.getMainProjectState()==1){
|
|
|
mainNameCell = row.getCell(0);
|
|
|
codeCell = row.getCell(1);
|
|
@@ -2964,8 +2971,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
participatorCell = row.getCell(4+c);
|
|
|
inchargerCell = row.getCell(5+c);
|
|
|
levelCell = row.getCell(6+c);
|
|
|
+ if(timeType.getProjectWithDept()==1){
|
|
|
+ deptCell=row.getCell(7+c);
|
|
|
+ d++;
|
|
|
+ }
|
|
|
if(company.getPackageCustomer()==1){
|
|
|
- customerCell=row.getCell(7+c);
|
|
|
+ customerCell=row.getCell(7+c+d);
|
|
|
i++;
|
|
|
}
|
|
|
if(company.getPackageProvider()==1){
|
|
@@ -2975,17 +2986,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){
|
|
|
- warrantyStartDateCell=row.getCell(10+i+k+c);
|
|
|
- warrantyEndDateCell=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);
|
|
|
+ warrantyStartDateCell=row.getCell(10+i+k+c+d);
|
|
|
+ warrantyEndDateCell=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 {
|
|
|
codeCell = row.getCell(0);
|
|
@@ -3000,8 +3011,12 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
participatorCell = row.getCell(5+c);
|
|
|
inchargerCell = row.getCell(6+c);
|
|
|
levelCell = row.getCell(7+c);
|
|
|
+ if(timeType.getProjectWithDept()==1){
|
|
|
+ deptCell=row.getCell(8+c);
|
|
|
+ d++;
|
|
|
+ }
|
|
|
if(company.getPackageCustomer()==1){
|
|
|
- customerCell=row.getCell(8+c);
|
|
|
+ customerCell=row.getCell(8+c+d);
|
|
|
i++;
|
|
|
}
|
|
|
if(company.getPackageProvider()==1){
|
|
@@ -3011,17 +3026,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){
|
|
|
- warrantyStartDateCell=row.getCell(11+i+k+c);
|
|
|
- warrantyEndDateCell=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);
|
|
|
+ warrantyStartDateCell=row.getCell(11+i+k+c+d);
|
|
|
+ warrantyEndDateCell=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);
|
|
@@ -3033,6 +3048,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if (participatorCell != null)participatorCell.setCellType(CellType.STRING);
|
|
|
if (inchargerCell != null)inchargerCell.setCellType(CellType.STRING);
|
|
|
if (levelCell != null)levelCell.setCellType(CellType.STRING);
|
|
|
+ if (deptCell != null)deptCell.setCellType(CellType.STRING);
|
|
|
if (customerCell != null)customerCell.setCellType(CellType.STRING);
|
|
|
/*if (startDateCell != null)startDateCell.setCellType(CellType.NUMERIC);
|
|
|
if (endDateCell != null)endDateCell.setCellType(CellType.NUMERIC);*/
|
|
@@ -3144,6 +3160,21 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ if(deptCell!=null){
|
|
|
+ String stringCellValue = deptCell.getStringCellValue();
|
|
|
+ if(!StringUtils.isEmpty(stringCellValue)){
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dl -> dl.getDepartmentName().equals(stringCellValue)).findFirst();
|
|
|
+ if(!first.isPresent()){
|
|
|
+ msg.setError("部门["+stringCellValue+"]不存在");
|
|
|
+ return msg;
|
|
|
+ }else {
|
|
|
+ project.setDeptId(first.get().getDepartmentId());
|
|
|
+ project.setDeptCascade(first.get().getDepartmentId() == null ?
|
|
|
+ convertDepartmentIdToCascade(0) :
|
|
|
+ convertDepartmentIdToCascade(first.get().getDepartmentId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if(customerCell!=null){
|
|
|
String cellStringCellValue = customerCell.getStringCellValue();
|
|
|
if(!StringUtils.isEmpty(cellStringCellValue)){
|
|
@@ -3424,8 +3455,10 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
|
|
|
@Override
|
|
|
public HttpRespMsg exportData(HttpServletRequest request) {
|
|
|
+ LocalDateTime time=LocalDateTime.now();
|
|
|
String token = request.getHeader("TOKEN");
|
|
|
User user = userMapper.selectById(token);
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
|
String userId = null;
|
|
|
List<SysRoleFunction> functionList = sysRoleFunctionMapper.getRoleFunctionNames(user.getRoleId());
|
|
|
if(!functionList.stream().anyMatch(fun->fun.getFunctionName().equals("查看全部项目"))) {
|
|
@@ -3459,6 +3492,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
headList.add(s);
|
|
|
}
|
|
|
}
|
|
|
+ if(timeType.getProjectWithDept()==1){
|
|
|
+ headList.add("所属部门");
|
|
|
+ }
|
|
|
if(company.getPackageCustomer()==1){
|
|
|
headList.add("客户");
|
|
|
}
|
|
@@ -3530,6 +3566,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ if(timeType.getProjectWithDept()==1){
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dl -> dl.getDepartmentId().equals(projectVO.getDeptId())).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ rowData.add(first.get().getDepartmentName());
|
|
|
+ }else {
|
|
|
+ rowData.add("");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
if(company.getPackageCustomer()==1){
|
|
|
rowData.add(projectVO.getCustomerName());
|
|
|
}
|
|
@@ -3579,7 +3624,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}
|
|
|
allList.add(rowData);
|
|
|
}
|
|
|
-
|
|
|
+ LocalDateTime time1=LocalDateTime.now();
|
|
|
+ Duration between = Duration.between(time1, time);
|
|
|
+ System.out.println("耗时"+between.toMillis()+"毫秒");
|
|
|
//生成excel文件导出
|
|
|
String fileName = "项目导出_"+company.getCompanyName()+System.currentTimeMillis();
|
|
|
String resp = ExcelUtil.exportGeneralExcelByTitleAndList(fileName , allList, path);
|