|
@@ -12391,15 +12391,307 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public HttpRespMsg groupExpendProcessList(String startDate, String endDate, Integer pageIndex, Integer pageSize) {
|
|
|
|
|
|
+ public HttpRespMsg groupExpendProcessList(String startDate, String endDate) {
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
|
|
+ percentFormat.setMaximumFractionDigits(2);
|
|
Integer companyId = user.getCompanyId();
|
|
Integer companyId = user.getCompanyId();
|
|
boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部分组耗用进度表");
|
|
boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部分组耗用进度表");
|
|
boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门分组耗用进度表");
|
|
boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门分组耗用进度表");
|
|
List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
List<Map<String,Object>> resultList;
|
|
List<Map<String,Object>> resultList;
|
|
Long total;
|
|
Long total;
|
|
|
|
+ //是否具有查看全部数据的权限
|
|
|
|
+ if(!viewAll){
|
|
|
|
+ if(!incharger){
|
|
|
|
+ //只能查看本人的数据
|
|
|
|
+ resultList=projectMapper.groupExpendProcessList(user.getId(),companyId,startDate,endDate,null);
|
|
|
|
+ total=projectMapper.groupExpendProcessListCount(user.getId(),companyId,startDate,endDate,null);
|
|
|
|
+ }else {
|
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
|
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
|
|
+ List<Integer> deptIds=new ArrayList<>();
|
|
|
|
+ List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
|
+ theCollect.add(-1);
|
|
|
|
+ List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
|
+ otherCollect.add(-1);
|
|
|
|
+ theCollect.addAll(otherCollect);
|
|
|
|
+ for (Integer integer : theCollect) {
|
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
|
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
|
+ }
|
|
|
|
+ resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,deptIds);
|
|
|
|
+ total=projectMapper.groupExpendProcessListCount(null,companyId,startDate,endDate,deptIds);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ resultList=projectMapper.groupExpendProcessList(null,companyId,startDate,endDate,null);
|
|
|
|
+ total=projectMapper.groupExpendProcessListCount(null,companyId,startDate,endDate,null);
|
|
|
|
+ }
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupList = resultList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("corpwxDeptId"))));
|
|
|
|
+ List<String> departmentNameList = resultList.stream().map(m -> String.valueOf(m.get("corpwxDeptId"))).distinct().collect(Collectors.toList());
|
|
|
|
+ List<Map<String,Object>> lastList=new ArrayList<>();
|
|
|
|
+ for (String deptName : departmentNameList) {
|
|
|
|
+ List<Map<String, Object>> maps = listMapGroupList.get(deptName);
|
|
|
|
+ //再根据每个部门下员工数据长度合并人员名称列
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("groupName"))));
|
|
|
|
+ List<String> groupNameList = maps.stream().map(m -> String.valueOf(m.get("groupName"))).distinct().collect(Collectors.toList());
|
|
|
|
+ for (String groupName : groupNameList) {
|
|
|
|
+ List<Map<String, Object>> mapList1 = listMapGroupList2.get(groupName);
|
|
|
|
+ double planHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("planHour")))).sum();
|
|
|
|
+ double normalHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("normalHour")))).sum();
|
|
|
|
+ double overHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("overHour")))).sum();
|
|
|
|
+ double realHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realHour")))).sum();
|
|
|
|
+ double realCost = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realCost")))).sum();
|
|
|
|
+ double planHourNum = new BigDecimal(planHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double normalHourNum = new BigDecimal(normalHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double overHourNum = new BigDecimal(overHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double realHourNum = new BigDecimal(realHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double realCostNum = new BigDecimal(realCost).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ BigDecimal decimal = new BigDecimal(realHourNum);
|
|
|
|
+ decimal=decimal.divide(new BigDecimal(planHourNum),4,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ Map<String,Object> item=new HashMap<>();
|
|
|
|
+ item.put("deptId",deptName);
|
|
|
|
+ item.put("corpwxDeptId",maps.get(0).get("corpwxDeptId"));
|
|
|
|
+ item.put("groupName",groupName);
|
|
|
|
+ item.put("planHour",planHourNum);
|
|
|
|
+ item.put("normalHour",normalHourNum);
|
|
|
|
+ item.put("overHour",overHourNum);
|
|
|
|
+ item.put("realHour",realHourNum);
|
|
|
|
+ item.put("realCost",realCostNum);
|
|
|
|
+ item.put("process",percentFormat.format(decimal.doubleValue()));
|
|
|
|
+ lastList.add(item);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map<String,Object> resultMap=new HashMap<>();
|
|
|
|
+ resultMap.put("record",lastList);
|
|
|
|
+ msg.setData(resultMap);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportGroupExpendProcessList(String startDate, String endDate) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
|
|
+ percentFormat.setMaximumFractionDigits(2);
|
|
|
|
+ HttpRespMsg resultMsg = groupExpendProcessList(startDate,endDate);
|
|
|
|
+ Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
|
|
|
|
+ List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
|
+ Company company = companyMapper.selectById(companyId);
|
|
|
|
+ //1.创建一个workbook,对应一个excel文件
|
|
|
|
+ SXSSFWorkbook workBook = new SXSSFWorkbook();
|
|
|
|
+ //2.在workbook中添加一个sheet,对应Excel中的sheet
|
|
|
|
+ SXSSFSheet sheet = workBook.createSheet("分组耗用进度表");
|
|
|
|
+ //设置每一列的列宽
|
|
|
|
+ sheet.setColumnWidth(0,256*15);
|
|
|
|
+ sheet.setColumnWidth(1,256*15);
|
|
|
|
+ //3.设置样式以及字体样式
|
|
|
|
+ //设置冻结
|
|
|
|
+ sheet.createFreezePane(0, 2);
|
|
|
|
+ sheet.setDefaultColumnWidth(16);
|
|
|
|
+ //设置字体样式
|
|
|
|
+ Font headFont = workBook.createFont();
|
|
|
|
+ headFont.setBold(true);
|
|
|
|
+ headFont.setFontHeightInPoints((short) 10);
|
|
|
|
+ headFont.setFontName("黑体");
|
|
|
|
+
|
|
|
|
+ Font titleFont = workBook.createFont();
|
|
|
|
+ titleFont.setBold(true);
|
|
|
|
+ titleFont.setFontHeightInPoints((short) 10);
|
|
|
|
+ titleFont.setFontName("黑体");
|
|
|
|
+
|
|
|
|
+ Font font = workBook.createFont();
|
|
|
|
+ font.setFontHeightInPoints((short) 10);
|
|
|
|
+ font.setFontName("宋体");
|
|
|
|
+
|
|
|
|
+ //设置单元格样式
|
|
|
|
+ XSSFCellStyle headStyle = (XSSFCellStyle) workBook.createCellStyle();
|
|
|
|
+ headStyle.setFont(headFont);
|
|
|
|
+ headStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
|
|
|
+ headStyle.setWrapText(true);
|
|
|
|
+ headStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
|
|
|
+ headStyle.setBorderLeft(BorderStyle.THIN);//左边框
|
|
|
|
+ headStyle.setBorderTop(BorderStyle.THIN);//上边框
|
|
|
|
+ headStyle.setBorderRight(BorderStyle.THIN);//右边框
|
|
|
|
+
|
|
|
|
+ String color = "c0c0c0"; //此处得到的color为16进制的字符串
|
|
|
|
+ //转为RGB码
|
|
|
|
+ int r = Integer.parseInt((color.substring(0,2)),16); //转为16进制
|
|
|
|
+ int g = Integer.parseInt((color.substring(2,4)),16);
|
|
|
|
+ int b = Integer.parseInt((color.substring(4,6)),16);
|
|
|
|
+
|
|
|
|
+ //设置自定义颜色
|
|
|
|
+ XSSFColor xssfColor = new XSSFColor();
|
|
|
|
+ byte[] colorRgb = { (short)9, (byte) r, (byte) g, (byte) b };
|
|
|
|
+ xssfColor.setRGB(colorRgb);
|
|
|
|
+
|
|
|
|
+ headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
|
|
|
|
+ headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);// 填充模式(和背景颜色成对使用)
|
|
|
|
+ /*headStyle.setFillForegroundColor(IndexedColors.AQUA.getIndex());*/ //设置自带的颜色
|
|
|
|
+
|
|
|
|
+ CellStyle titleStyle = workBook.createCellStyle();
|
|
|
|
+ titleStyle.setFont(titleFont);
|
|
|
|
+ titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
|
|
|
+ titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); //填充单元格
|
|
|
|
+ titleStyle.setFillForegroundColor((short)9); //填色
|
|
|
|
+ titleStyle.setWrapText(true);
|
|
|
|
+ titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
|
|
|
+ titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
|
|
|
|
+ titleStyle.setBorderTop(BorderStyle.THIN);//上边框
|
|
|
|
+ titleStyle.setBorderRight(BorderStyle.THIN);//右边框
|
|
|
|
+
|
|
|
|
+ CellStyle cellStyle = workBook.createCellStyle();
|
|
|
|
+ cellStyle.setFont(font);
|
|
|
|
+ cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
|
|
|
+ cellStyle.setWrapText(true);
|
|
|
|
+ cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
|
|
|
+ cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
|
|
|
|
+ cellStyle.setBorderTop(BorderStyle.THIN);//上边框
|
|
|
|
+ cellStyle.setBorderRight(BorderStyle.THIN);//右边框
|
|
|
|
+ //行号
|
|
|
|
+ int rowNum = 0;
|
|
|
|
+ //第一行
|
|
|
|
+ SXSSFRow row0 = sheet.createRow(rowNum++);
|
|
|
|
+ row0.setHeight((short)500);
|
|
|
|
+ List<String> row_first =new ArrayList<>();
|
|
|
|
+ row_first.add("负责部门");
|
|
|
|
+ row_first.add("任务分组");
|
|
|
|
+ row_first.add("计划工时(财务)");
|
|
|
|
+ row_first.add("实际工时成本");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("工时耗用率");
|
|
|
|
+ for (int i = 0; i < row_first.size(); i++) {
|
|
|
|
+ SXSSFCell tempCell = row0.createCell(i);
|
|
|
|
+ tempCell.setCellValue(row_first.get(i));
|
|
|
|
+ tempCell.setCellStyle(headStyle);
|
|
|
|
+ }
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,0,3,6));
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,2,2));
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,7,7));
|
|
|
|
+ //第二行
|
|
|
|
+ SXSSFRow row1 = sheet.createRow(rowNum++);
|
|
|
|
+ row1.setHeight((short)500);
|
|
|
|
+ List<String> row_second =new ArrayList<>();
|
|
|
|
+ row_second.add("");
|
|
|
|
+ row_second.add("");
|
|
|
|
+ row_second.add("");
|
|
|
|
+ row_second.add("正常工时");
|
|
|
|
+ row_second.add("加班工时");
|
|
|
|
+ row_second.add("合计工时");
|
|
|
|
+ row_second.add("合计工时成本");
|
|
|
|
+ row_second.add("");
|
|
|
|
+ for (int i = 0; i < row_second.size(); i++) {
|
|
|
|
+ SXSSFCell tempCell = row1.createCell(i);
|
|
|
|
+ tempCell.setCellValue(row_second.get(i));
|
|
|
|
+ tempCell.setCellStyle(headStyle);
|
|
|
|
+ }
|
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupList = mapList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("corpwxDeptId"))));
|
|
|
|
+ List<String> departmentNameList = mapList.stream().map(m -> String.valueOf(m.get("corpwxDeptId"))).distinct().collect(Collectors.toList());
|
|
|
|
+ //根据每个部门下数据长度合并部门名称列
|
|
|
|
+ int deptIndex=rowNum;
|
|
|
|
+ int allRowNum=0;
|
|
|
|
+ for (String deptName : departmentNameList) {
|
|
|
|
+ List<Map<String, Object>> maps = listMapGroupList.get(deptName);
|
|
|
|
+ //再根据每个部门下员工数据长度合并人员名称列
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("groupName"))));
|
|
|
|
+ List<String> groupNameList = maps.stream().map(m -> String.valueOf(m.get("groupName"))).distinct().collect(Collectors.toList());
|
|
|
|
+ if(groupNameList.size()>1){
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(deptIndex,deptIndex+groupNameList.size()-1,0,0));
|
|
|
|
+ }
|
|
|
|
+ deptIndex+=groupNameList.size();
|
|
|
|
+ for (String groupName : groupNameList) {
|
|
|
|
+ List<Map<String, Object>> mapList1 = listMapGroupList2.get(groupName);
|
|
|
|
+ list.add("$departmentName="+deptName+"$");
|
|
|
|
+ list.add(groupName);
|
|
|
|
+ double planHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("planHour")))).sum();
|
|
|
|
+ double normalHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("normalHour")))).sum();
|
|
|
|
+ double overHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("overHour")))).sum();
|
|
|
|
+ double realHour = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realHour")))).sum();
|
|
|
|
+ double realCost = mapList1.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("realCost")))).sum();
|
|
|
|
+ double planHourNum = new BigDecimal(planHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double normalHourNum = new BigDecimal(normalHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double overHourNum = new BigDecimal(overHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double realHourNum = new BigDecimal(realHour).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ double realCostNum = new BigDecimal(realCost).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
|
+ list.add(String.valueOf(planHourNum));
|
|
|
|
+ list.add(String.valueOf(normalHourNum));
|
|
|
|
+ list.add(String.valueOf(overHourNum));
|
|
|
|
+ list.add(String.valueOf(realHourNum));
|
|
|
|
+ list.add(String.valueOf(realCostNum));
|
|
|
|
+ BigDecimal decimal = new BigDecimal(realHourNum);
|
|
|
|
+ decimal=decimal.divide(new BigDecimal(planHourNum),4,BigDecimal.ROUND_HALF_UP);
|
|
|
|
+ list.add(percentFormat.format(decimal.doubleValue()));
|
|
|
|
+ }
|
|
|
|
+ allRowNum+=groupNameList.size();
|
|
|
|
+ }
|
|
|
|
+ int k=0;
|
|
|
|
+ for(int i = 0;i<allRowNum;i++){
|
|
|
|
+ SXSSFRow tempRow = sheet.createRow(rowNum++);
|
|
|
|
+ tempRow.setHeight((short)500);
|
|
|
|
+ for(int j=0;j<8;j++){
|
|
|
|
+ SXSSFCell tempCell = tempRow.createCell(j);
|
|
|
|
+ String cellValue = "";
|
|
|
|
+ tempCell.setCellStyle(cellStyle);
|
|
|
|
+ if(k>=list.size()){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ cellValue=list.get(k);
|
|
|
|
+ tempCell.setCellValue(cellValue);
|
|
|
|
+ k++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //导出excel
|
|
|
|
+ String result="系统提示:Excel文件导出成功!";
|
|
|
|
+ String title= "分组耗用进度表_"+company.getCompanyName()+System.currentTimeMillis();
|
|
|
|
+ String fileName= title+".xlsx";
|
|
|
|
+ try {
|
|
|
|
+ File dir = null;
|
|
|
|
+ dir = new File(path);
|
|
|
|
+ if (!dir.exists()) {
|
|
|
|
+ dir.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ FileOutputStream os = new FileOutputStream(path+fileName);//保存到本地
|
|
|
|
+ workBook.write(os);
|
|
|
|
+ os.flush();
|
|
|
|
+ os.close();
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ return excelExportService.exportTranForwx(wxCorpInfo, title);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ httpRespMsg.data ="/upload/"+fileName;
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg projectExpendProcessList(Integer projectId, Integer categoryId, String userId, Integer pageIndex, Integer pageSize) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
|
|
+ percentFormat.setMaximumFractionDigits(2);
|
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
|
+ boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部项目耗用进度表");
|
|
|
|
+ boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门项目耗用进度表");
|
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
|
|
+ List<Map<String,Object>> resultList;
|
|
|
|
+ Long total;
|
|
Integer size=null;
|
|
Integer size=null;
|
|
Integer start=null;
|
|
Integer start=null;
|
|
if(pageIndex!=null&&pageSize!=null){
|
|
if(pageIndex!=null&&pageSize!=null){
|
|
@@ -12410,8 +12702,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
if(!viewAll){
|
|
if(!viewAll){
|
|
if(!incharger){
|
|
if(!incharger){
|
|
//只能查看本人的数据
|
|
//只能查看本人的数据
|
|
- resultList=projectMapper.groupExpendProcessList(user.getId(),companyId,null,start,size);
|
|
|
|
- total=projectMapper.groupExpendProcessListCount(user.getId(),companyId,null);
|
|
|
|
|
|
+ resultList=projectMapper.projectExpendProcessList(projectId,categoryId,user.getId(),companyId,null,start,size);
|
|
|
|
+ total=projectMapper.projectExpendProcessListCount(projectId,categoryId,user.getId(),companyId,null);
|
|
}else {
|
|
}else {
|
|
List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
|
|
List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
|
|
List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
@@ -12425,12 +12717,39 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
|
|
List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
|
|
deptIds.addAll(branchDepartment);
|
|
deptIds.addAll(branchDepartment);
|
|
}
|
|
}
|
|
- resultList=projectMapper.groupExpendProcessList(null,companyId,deptIds,start,size);
|
|
|
|
- total=projectMapper.groupExpendProcessListCount(null,companyId,deptIds);
|
|
|
|
|
|
+ resultList=projectMapper.projectExpendProcessList(projectId,categoryId,userId,companyId,deptIds,start,size);
|
|
|
|
+ total=projectMapper.projectExpendProcessListCount(projectId,categoryId,userId,companyId,deptIds);
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
- resultList=projectMapper.groupExpendProcessList(null,companyId,null,start,size);
|
|
|
|
- total=projectMapper.groupExpendProcessListCount(null,companyId,null);
|
|
|
|
|
|
+ resultList=projectMapper.projectExpendProcessList(projectId,categoryId,userId,companyId,null,start,size);
|
|
|
|
+ total=projectMapper.projectExpendProcessListCount(projectId,categoryId,userId,companyId,null);
|
|
|
|
+ }
|
|
|
|
+ for (Map<String, Object> map : resultList) {
|
|
|
|
+ if(StringUtils.isEmpty(String.valueOf(map.get("executorString")))){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String executorString = String.valueOf(map.get("executorString"));
|
|
|
|
+ List<String> list = ListUtil.convertLongIdsArrayToList(executorString);
|
|
|
|
+ List<Map<String,Object>> itemList=new ArrayList<>();
|
|
|
|
+ for (String str : list) {
|
|
|
|
+ String[] split = str.split("\\|");
|
|
|
|
+ Map<String,Object> item=new HashMap<>();
|
|
|
|
+ item.put("userName",split[0]);
|
|
|
|
+ item.put("progress",split[1]);
|
|
|
|
+ itemList.add(item);
|
|
|
|
+ }
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroup = itemList.stream().collect(Collectors.groupingBy(i -> String.valueOf(i.get("userName"))));
|
|
|
|
+ List<String> userNameList = itemList.stream().map(i -> String.valueOf(i.get("userName"))).distinct().collect(Collectors.toList());
|
|
|
|
+ List<Map<String,Object>> targetLsit=new ArrayList<>();
|
|
|
|
+ for (String userName : userNameList) {
|
|
|
|
+ List<Map<String, Object>> mapList = listMapGroup.get(userName);
|
|
|
|
+ double progress = mapList.stream().mapToDouble(m -> Double.valueOf(String.valueOf(m.get("progress")))).sum();
|
|
|
|
+ Map<String,Object> item=new HashMap<>();
|
|
|
|
+ item.put("userName",userName);
|
|
|
|
+ item.put("progress",percentFormat.format(progress/Double.valueOf(String.valueOf(map.get("planHour"))).doubleValue()));
|
|
|
|
+ targetLsit.add(item);
|
|
|
|
+ }
|
|
|
|
+ map.put("userProgress",targetLsit);
|
|
}
|
|
}
|
|
Map<String,Object> resultMap=new HashMap<>();
|
|
Map<String,Object> resultMap=new HashMap<>();
|
|
resultMap.put("record",resultList);
|
|
resultMap.put("record",resultList);
|
|
@@ -12440,7 +12759,308 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public HttpRespMsg exportGroupExpendProcessList(String startDate, String endDate) {
|
|
|
|
- return null;
|
|
|
|
|
|
+ public HttpRespMsg exportProjectExpendProcessList(Integer projectId, Integer categoryId, String userId) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
|
|
+ percentFormat.setMaximumFractionDigits(2);
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
|
+ HttpRespMsg resultMsg = projectExpendProcessList(projectId,categoryId,userId,null,null);
|
|
|
|
+ Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
|
|
|
|
+ List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
|
|
|
|
+ List<List<String>> dataList=new ArrayList<>();
|
|
|
|
+ List<String> titleList=new ArrayList<>();
|
|
|
|
+ titleList.add("项目名称");
|
|
|
|
+ titleList.add("项目分类");
|
|
|
|
+ titleList.add("项目编号");
|
|
|
|
+ titleList.add("分配工时");
|
|
|
|
+ titleList.add("已消耗工时");
|
|
|
|
+ titleList.add("已消耗工时成本");
|
|
|
|
+ titleList.add("剩余工时");
|
|
|
|
+ titleList.add("参与员工");
|
|
|
|
+ dataList.add(titleList);
|
|
|
|
+ for (Map<String, Object> map : mapList) {
|
|
|
|
+ List<String> item=new ArrayList<>();
|
|
|
|
+ item.add(String.valueOf(map.get("projectName")));
|
|
|
|
+ item.add(String.valueOf(map.get("categoryName")));
|
|
|
|
+ item.add(String.valueOf(map.get("projectCode")));
|
|
|
|
+ item.add(String.valueOf(map.get("planHour")));
|
|
|
|
+ item.add(String.valueOf(map.get("realHour")));
|
|
|
|
+ item.add(String.valueOf(map.get("realCost")));
|
|
|
|
+ item.add(String.valueOf(map.get("residueHour")));
|
|
|
|
+ List<Map<String, Object>> userProgress = (List<Map<String, Object>>) map.get("userProgress");
|
|
|
|
+ StringBuilder sb=new StringBuilder();
|
|
|
|
+ for (int i = 0; i < userProgress.size(); i++) {
|
|
|
|
+ if(i==userProgress.size()-1){
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ sb.append("$userName="+String.valueOf(userProgress.get(i).get("userName"))+"$"+String.valueOf(userProgress.get(i).get("progress")));
|
|
|
|
+ }else {
|
|
|
|
+ sb.append(String.valueOf(userProgress.get(i).get("userName"))+String.valueOf(userProgress.get(i).get("progress")));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ sb.append("$userName="+String.valueOf(userProgress.get(i).get("userName"))+"$"+String.valueOf(userProgress.get(i).get("progress"))+",");
|
|
|
|
+ }else {
|
|
|
|
+ sb.append(String.valueOf(userProgress.get(i).get("userName"))+String.valueOf(userProgress.get(i).get("progress"))+",");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ item.add(sb.toString());
|
|
|
|
+ dataList.add(item);
|
|
|
|
+ }
|
|
|
|
+ String fileName = "项目耗用进度表_"+System.currentTimeMillis();
|
|
|
|
+ try {
|
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndList(wxCorpInfo,fileName , dataList, path);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ return httpRespMsg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg userTaskProcessList(Integer deptId, String userId, Integer projectId,String startDate,String endDate, Integer pageIndex, Integer pageSize) {
|
|
|
|
+ HttpRespMsg msg=new HttpRespMsg();
|
|
|
|
+ User user = userMapper.selectById(request.getHeader("token"));
|
|
|
|
+ Integer companyId = user.getCompanyId();
|
|
|
|
+ boolean viewAll = sysFunctionService.hasPriviledge(user.getRoleId(), "全部员工项目进度表");
|
|
|
|
+ boolean incharger = sysFunctionService.hasPriviledge(user.getRoleId(), "负责部门员工项目进度表");
|
|
|
|
+ List<Department> allDeptList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().eq(Department::getCompanyId, companyId));
|
|
|
|
+ List<Map<String,Object>> resultList;
|
|
|
|
+ Long total;
|
|
|
|
+ Integer size=null;
|
|
|
|
+ Integer start=null;
|
|
|
|
+ if(pageIndex!=null&&pageSize!=null){
|
|
|
|
+ size=pageSize;
|
|
|
|
+ start=(pageIndex-1)*size;
|
|
|
|
+ }
|
|
|
|
+ //是否具有查看全部数据的权限
|
|
|
|
+ if(!viewAll){
|
|
|
|
+ if(!incharger){
|
|
|
|
+ //只能查看本人的数据
|
|
|
|
+ resultList=projectMapper.userTaskProcessList(deptId,user.getId(),projectId,companyId,null,startDate,endDate,start,size);
|
|
|
|
+ total=projectMapper.userTaskProcessListCount(deptId,user.getId(),projectId,companyId,null,startDate,endDate);
|
|
|
|
+ }else {
|
|
|
|
+ List<Department> departmentList = departmentMapper.selectList(new LambdaQueryWrapper<Department>().select(Department::getDepartmentId).eq(Department::getManagerId, user.getId()));
|
|
|
|
+ List<DepartmentOtherManager> departmentOtherManagerList = departmentOtherManagerMapper.selectList(new QueryWrapper<DepartmentOtherManager>().eq("other_manager_id", user.getId()));
|
|
|
|
+ List<Integer> deptIds=new ArrayList<>();
|
|
|
|
+ List<Integer> theCollect = departmentList.stream().map(dm -> dm.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
|
+ theCollect.add(-1);
|
|
|
|
+ List<Integer> otherCollect = departmentOtherManagerList.stream().map(dom -> dom.getDepartmentId()).distinct().collect(Collectors.toList());
|
|
|
|
+ otherCollect.add(-1);
|
|
|
|
+ theCollect.addAll(otherCollect);
|
|
|
|
+ for (Integer integer : theCollect) {
|
|
|
|
+ List<Integer> branchDepartment = getBranchDepartment(integer, allDeptList);
|
|
|
|
+ deptIds.addAll(branchDepartment);
|
|
|
|
+ }
|
|
|
|
+ resultList=projectMapper.userTaskProcessList(deptId,userId,projectId,companyId,deptIds,startDate,endDate,start,size);
|
|
|
|
+ total=projectMapper.userTaskProcessListCount(deptId,userId,projectId,companyId,deptIds,startDate,endDate);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ resultList=projectMapper.userTaskProcessList(deptId,userId,projectId,companyId,null,startDate,endDate,start,size);
|
|
|
|
+ total=projectMapper.userTaskProcessListCount(deptId,userId,projectId,companyId,null,startDate,endDate);
|
|
|
|
+ }
|
|
|
|
+ Map<String,Object> resultMap=new HashMap<>();
|
|
|
|
+ resultMap.put("record",resultList);
|
|
|
|
+ resultMap.put("total",total);
|
|
|
|
+ msg.setData(resultMap);
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public HttpRespMsg exportUserTaskProcessList(Integer deptId, String userId, Integer projectId,String startDate,String endDate) {
|
|
|
|
+ HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
|
+ HttpRespMsg resultMsg = userTaskProcessList(deptId, userId, projectId,startDate,endDate, null, null);
|
|
|
|
+ Map<String, Object> msgData = (Map<String, Object>) resultMsg.getData();
|
|
|
|
+ List<Map<String, Object>> mapList = (List<Map<String, Object>>) msgData.get("record");
|
|
|
|
+ Integer companyId = userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new LambdaQueryWrapper<WxCorpInfo>().eq(WxCorpInfo::getCompanyId, companyId));
|
|
|
|
+ Company company = companyMapper.selectById(companyId);
|
|
|
|
+ //1.创建一个workbook,对应一个excel文件
|
|
|
|
+ SXSSFWorkbook workBook = new SXSSFWorkbook();
|
|
|
|
+ //2.在workbook中添加一个sheet,对应Excel中的sheet
|
|
|
|
+ SXSSFSheet sheet = workBook.createSheet("员工项目进度表");
|
|
|
|
+ //设置每一列的列宽
|
|
|
|
+ sheet.setColumnWidth(0,256*15);
|
|
|
|
+ sheet.setColumnWidth(1,256*15);
|
|
|
|
+ //3.设置样式以及字体样式
|
|
|
|
+ //设置冻结
|
|
|
|
+ sheet.createFreezePane(0, 2);
|
|
|
|
+ sheet.setDefaultColumnWidth(16);
|
|
|
|
+ //设置字体样式
|
|
|
|
+ Font headFont = workBook.createFont();
|
|
|
|
+ headFont.setBold(true);
|
|
|
|
+ headFont.setFontHeightInPoints((short) 10);
|
|
|
|
+ headFont.setFontName("黑体");
|
|
|
|
+
|
|
|
|
+ Font titleFont = workBook.createFont();
|
|
|
|
+ titleFont.setBold(true);
|
|
|
|
+ titleFont.setFontHeightInPoints((short) 10);
|
|
|
|
+ titleFont.setFontName("黑体");
|
|
|
|
+
|
|
|
|
+ Font font = workBook.createFont();
|
|
|
|
+ font.setFontHeightInPoints((short) 10);
|
|
|
|
+ font.setFontName("宋体");
|
|
|
|
+
|
|
|
|
+ //设置单元格样式
|
|
|
|
+ XSSFCellStyle headStyle = (XSSFCellStyle) workBook.createCellStyle();
|
|
|
|
+ headStyle.setFont(headFont);
|
|
|
|
+ headStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ headStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
|
|
|
+ headStyle.setWrapText(true);
|
|
|
|
+ headStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
|
|
|
+ headStyle.setBorderLeft(BorderStyle.THIN);//左边框
|
|
|
|
+ headStyle.setBorderTop(BorderStyle.THIN);//上边框
|
|
|
|
+ headStyle.setBorderRight(BorderStyle.THIN);//右边框
|
|
|
|
+
|
|
|
|
+ String color = "c0c0c0"; //此处得到的color为16进制的字符串
|
|
|
|
+ //转为RGB码
|
|
|
|
+ int r = Integer.parseInt((color.substring(0,2)),16); //转为16进制
|
|
|
|
+ int g = Integer.parseInt((color.substring(2,4)),16);
|
|
|
|
+ int b = Integer.parseInt((color.substring(4,6)),16);
|
|
|
|
+
|
|
|
|
+ //设置自定义颜色
|
|
|
|
+ XSSFColor xssfColor = new XSSFColor();
|
|
|
|
+ byte[] colorRgb = { (short)9, (byte) r, (byte) g, (byte) b };
|
|
|
|
+ xssfColor.setRGB(colorRgb);
|
|
|
|
+
|
|
|
|
+ headStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.index);
|
|
|
|
+ headStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);// 填充模式(和背景颜色成对使用)
|
|
|
|
+ /*headStyle.setFillForegroundColor(IndexedColors.AQUA.getIndex());*/ //设置自带的颜色
|
|
|
|
+
|
|
|
|
+ CellStyle titleStyle = workBook.createCellStyle();
|
|
|
|
+ titleStyle.setFont(titleFont);
|
|
|
|
+ titleStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ titleStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
|
|
|
+ titleStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND); //填充单元格
|
|
|
|
+ titleStyle.setFillForegroundColor((short)9); //填色
|
|
|
|
+ titleStyle.setWrapText(true);
|
|
|
|
+ titleStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
|
|
|
+ titleStyle.setBorderLeft(BorderStyle.THIN);//左边框
|
|
|
|
+ titleStyle.setBorderTop(BorderStyle.THIN);//上边框
|
|
|
|
+ titleStyle.setBorderRight(BorderStyle.THIN);//右边框
|
|
|
|
+
|
|
|
|
+ CellStyle cellStyle = workBook.createCellStyle();
|
|
|
|
+ cellStyle.setFont(font);
|
|
|
|
+ cellStyle.setAlignment(HorizontalAlignment.CENTER);
|
|
|
|
+ cellStyle.setVerticalAlignment(org.apache.poi.ss.usermodel.VerticalAlignment.CENTER);
|
|
|
|
+ cellStyle.setWrapText(true);
|
|
|
|
+ cellStyle.setBorderBottom(BorderStyle.THIN); //下边框
|
|
|
|
+ cellStyle.setBorderLeft(BorderStyle.THIN);//左边框
|
|
|
|
+ cellStyle.setBorderTop(BorderStyle.THIN);//上边框
|
|
|
|
+ cellStyle.setBorderRight(BorderStyle.THIN);//右边框
|
|
|
|
+ //行号
|
|
|
|
+ int rowNum = 0;
|
|
|
|
+ //第一行
|
|
|
|
+ SXSSFRow row0 = sheet.createRow(rowNum++);
|
|
|
|
+ row0.setHeight((short)500);
|
|
|
|
+ List<String> row_first =new ArrayList<>();
|
|
|
|
+ row_first.add("部门");
|
|
|
|
+ row_first.add("员工");
|
|
|
|
+ row_first.add("项目");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ row_first.add("");
|
|
|
|
+ for (int i = 0; i < row_first.size(); i++) {
|
|
|
|
+ SXSSFCell tempCell = row0.createCell(i);
|
|
|
|
+ tempCell.setCellValue(row_first.get(i));
|
|
|
|
+ tempCell.setCellStyle(headStyle);
|
|
|
|
+ }
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,0,2,6));
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,0,0));
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(0,1,1,1));
|
|
|
|
+ //第二行
|
|
|
|
+ SXSSFRow row1 = sheet.createRow(rowNum++);
|
|
|
|
+ row1.setHeight((short)500);
|
|
|
|
+ List<String> row_second =new ArrayList<>();
|
|
|
|
+ row_second.add("");
|
|
|
|
+ row_second.add("");
|
|
|
|
+ row_second.add("项目名称");
|
|
|
|
+ row_second.add("项目编号");
|
|
|
|
+ row_second.add("项目任务");
|
|
|
|
+ row_second.add("计划工时");
|
|
|
|
+ row_second.add("消耗工时");
|
|
|
|
+ for (int i = 0; i < row_second.size(); i++) {
|
|
|
|
+ SXSSFCell tempCell = row1.createCell(i);
|
|
|
|
+ tempCell.setCellValue(row_second.get(i));
|
|
|
|
+ tempCell.setCellStyle(headStyle);
|
|
|
|
+ }
|
|
|
|
+ List<String> list=new ArrayList<>();
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupList = mapList.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("departmentName"))));
|
|
|
|
+ List<String> departmentNameList = mapList.stream().map(m -> String.valueOf(m.get("departmentName"))).distinct().collect(Collectors.toList());
|
|
|
|
+ //根据每个部门下数据长度合并部门名称列
|
|
|
|
+ int deptIndex=rowNum;
|
|
|
|
+ for (String deptName : departmentNameList) {
|
|
|
|
+ List<Map<String, Object>> maps = listMapGroupList.get(deptName);
|
|
|
|
+ //再根据每个部门下员工数据长度合并人员名称列
|
|
|
|
+ Map<String, List<Map<String, Object>>> listMapGroupList2 = maps.stream().collect(Collectors.groupingBy(m -> String.valueOf(m.get("jobNumber"))));
|
|
|
|
+ List<String> userNameList = maps.stream().map(m -> String.valueOf(m.get("jobNumber"))).distinct().collect(Collectors.toList());
|
|
|
|
+ if(maps.size()>1){
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(deptIndex,deptIndex+maps.size()-1,0,0));
|
|
|
|
+ int userIndex=deptIndex;
|
|
|
|
+ for (String userName : userNameList) {
|
|
|
|
+ List<Map<String, Object>> mapList1 = listMapGroupList2.get(userName);
|
|
|
|
+ if(mapList1.size()>1){
|
|
|
|
+ sheet.addMergedRegion(new CellRangeAddress(userIndex,userIndex+mapList1.size()-1,1,1));
|
|
|
|
+ }
|
|
|
|
+ userIndex+=mapList1.size();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ deptIndex+=maps.size();
|
|
|
|
+ for (int i = 0; i < maps.size(); i++) {
|
|
|
|
+ list.add("$departmentName="+String.valueOf(maps.get(i).get("corpwxDeptId"))+"$");
|
|
|
|
+ list.add("$userName="+maps.get(i).get("corpwxUserId")+"$");
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("projectName")));
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("projectCode")));
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("taskName")));
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("planHour")));
|
|
|
|
+ list.add(String.valueOf(maps.get(i).get("consumeTime")));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ int k=0;
|
|
|
|
+ for(int i = 0;i<mapList.size();i++){
|
|
|
|
+ SXSSFRow tempRow = sheet.createRow(rowNum++);
|
|
|
|
+ tempRow.setHeight((short)500);
|
|
|
|
+ for(int j=0;j<7;j++){
|
|
|
|
+ SXSSFCell tempCell = tempRow.createCell(j);
|
|
|
|
+ String cellValue = "";
|
|
|
|
+ tempCell.setCellStyle(cellStyle);
|
|
|
|
+ if(k>=list.size()){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ cellValue=list.get(k);
|
|
|
|
+ tempCell.setCellValue(cellValue);
|
|
|
|
+ k++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //导出excel
|
|
|
|
+ String result="系统提示:Excel文件导出成功!";
|
|
|
|
+ String title= "员工任务完成表_"+company.getCompanyName()+System.currentTimeMillis();
|
|
|
|
+ String fileName= title+".xlsx";
|
|
|
|
+ try {
|
|
|
|
+ File dir = null;
|
|
|
|
+ dir = new File(path);
|
|
|
|
+ if (!dir.exists()) {
|
|
|
|
+ dir.mkdirs();
|
|
|
|
+ }
|
|
|
|
+ FileOutputStream os = new FileOutputStream(path+fileName);//保存到本地
|
|
|
|
+ workBook.write(os);
|
|
|
|
+ os.flush();
|
|
|
|
+ os.close();
|
|
|
|
+ }catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ if(wxCorpInfo != null && wxCorpInfo.getSaasSyncContact() == 1){
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ return excelExportService.exportTranForwx(wxCorpInfo, title);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ httpRespMsg.data ="/upload/"+fileName;
|
|
|
|
+ return httpRespMsg;
|
|
}
|
|
}
|
|
}
|
|
}
|