|
@@ -58,6 +58,7 @@ import java.io.*;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
import java.net.URLDecoder;
|
|
import java.net.URLDecoder;
|
|
|
|
+import java.sql.Array;
|
|
import java.sql.Timestamp;
|
|
import java.sql.Timestamp;
|
|
import java.text.DecimalFormat;
|
|
import java.text.DecimalFormat;
|
|
import java.text.NumberFormat;
|
|
import java.text.NumberFormat;
|
|
@@ -13848,12 +13849,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
//根据人员权限来获取,
|
|
//根据人员权限来获取,
|
|
String token = request.getHeader("TOKEN");
|
|
String token = request.getHeader("TOKEN");
|
|
User user = userMapper.selectById(token);
|
|
User user = userMapper.selectById(token);
|
|
- List<ProjectLeader> projectLeaderList = projectLeaderService.list(new QueryWrapper<ProjectLeader>().eq("company_id", user.getCompanyId()));
|
|
|
|
|
|
+ List<List<String>> dataList=new ArrayList<>();
|
|
|
|
+ List<String> titleList=new ArrayList<>();
|
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ CompanyDingding dingding = companyDingdingMapper.selectOne(new QueryWrapper<CompanyDingding>().eq("company_id", user.getCompanyId()));
|
|
List<String> userIds = new ArrayList<>();
|
|
List<String> userIds = new ArrayList<>();
|
|
- List<String> userIdsExtra = new ArrayList<>();
|
|
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部项目");
|
|
List<SysRichFunction> functionList = sysFunctionMapper.getRoleFunctions(user.getRoleId(), "查看全部项目");
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", user.getCompanyId()));
|
|
- List<User> AllUser = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
|
|
|
|
+ List<User> allUser = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
List<Integer> projectIds = null;
|
|
List<Integer> projectIds = null;
|
|
if (functionList.size() == 0) {
|
|
if (functionList.size() == 0) {
|
|
//担任部门主要负责人
|
|
//担任部门主要负责人
|
|
@@ -13887,22 +13890,106 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
userIds = userIds.stream().filter(u->u.equals(targetUserId)).collect(Collectors.toList());
|
|
userIds = userIds.stream().filter(u->u.equals(targetUserId)).collect(Collectors.toList());
|
|
}
|
|
}
|
|
|
|
|
|
- List<Map> mapList = projectMapper.getTaskPlanByMemb(userIds, startDate + " 00:00:00", endDate + " 23:59:59", user.getCompanyId(), user.getId(), deptId, taskStatus);
|
|
|
|
-
|
|
|
|
|
|
+ List<GantExportVo> gantExportVos = projectMapper.getexportTaskPlanByMemb(userIds, startDate + " 00:00:00", endDate + " 23:59:59", user.getCompanyId(), user.getId(), deptId, taskStatus);
|
|
QueryWrapper<LeaveSheet> lsQueryWrapper=new QueryWrapper();
|
|
QueryWrapper<LeaveSheet> lsQueryWrapper=new QueryWrapper();
|
|
lsQueryWrapper.in("owner_id", userIds);
|
|
lsQueryWrapper.in("owner_id", userIds);
|
|
if (startDate != null && endDate != null) {
|
|
if (startDate != null && endDate != null) {
|
|
lsQueryWrapper.le("start_date", endDate).ge("end_date", startDate);
|
|
lsQueryWrapper.le("start_date", endDate).ge("end_date", startDate);
|
|
}
|
|
}
|
|
- List<LeaveSheet> leaveSheetList = leaveSheetMapper.selectList(lsQueryWrapper);
|
|
|
|
|
|
|
|
- HashMap<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("mapList",mapList);
|
|
|
|
- map.put("leaveSheetList",leaveSheetList);
|
|
|
|
- msg.data=map;
|
|
|
|
|
|
+ List<String> headerList = new ArrayList<>();
|
|
|
|
+ headerList.add("姓名");
|
|
|
|
+ headerList.add("部门");
|
|
|
|
+
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
+ LocalDate startDateParse = LocalDate.parse(startDate, formatter);
|
|
|
|
+ LocalDate endDateParse = LocalDate.parse(endDate, formatter);
|
|
|
|
+ List<String> headersDate = generateDateHeaders(startDateParse, endDateParse);// 返回: [5.30(周五), 5.31(周六)]
|
|
|
|
+ List<String> dateStrList = generateDateList(startDateParse, endDateParse);// 返回: [2025-05-30, 2025-05-31]
|
|
|
|
+ headerList.addAll(headersDate);
|
|
|
|
+ dataList.add(headerList);
|
|
|
|
+ List<GantExportVo> gantExportVoListCollect = gantExportVos.stream().filter(g -> g.getAllocateTaskId() != null).collect(Collectors.toList());
|
|
|
|
+ Map<String, List<GantExportVo>> gantByUserIdCollect = gantExportVoListCollect.stream().collect(Collectors.groupingBy(GantExportVo::getUserId));
|
|
|
|
+ Set<Map.Entry<String, List<GantExportVo>>> entries = gantByUserIdCollect.entrySet();
|
|
|
|
+ for (Map.Entry<String, List<GantExportVo>> entry : entries) {
|
|
|
|
+ List<String> strings = new ArrayList<>();
|
|
|
|
+ String userId = entry.getKey();
|
|
|
|
+ List<GantExportVo> voList = entry.getValue();
|
|
|
|
+ GantExportVo gantExportVo = voList.get(0);
|
|
|
|
+ strings.add(gantExportVo.getUserName());
|
|
|
|
+ strings.add(gantExportVo.getDeptName());
|
|
|
|
+ for (String dateStr : dateStrList) {
|
|
|
|
+ List<GantExportVo> gantExportVoList = voList.stream().filter(v -> v.getAllocateDate() != null && formatter.format(v.getAllocateDate()).equals(dateStr)).collect(Collectors.toList());
|
|
|
|
+ if (!gantExportVoList.isEmpty()) {
|
|
|
|
+ StringBuilder content= new StringBuilder();
|
|
|
|
+ double sum = gantExportVoList.stream().mapToDouble(GantExportVo::getTotalWorkHour).sum();
|
|
|
|
+ double remain = 7.5 - sum;
|
|
|
|
+ content.append("共").append(sum).append("h(剩余工时)").append(remain).append("h\n");
|
|
|
|
+
|
|
|
|
+ for (GantExportVo exportVo : gantExportVoList) {
|
|
|
|
+ content.append(exportVo.getProjectName()).append(" ").append(exportVo.getTotalWorkHour()).append("h\n");
|
|
|
|
+ }
|
|
|
|
+ strings.add(content.toString());
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ strings.add("共0h(剩余工时7.5h)");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ dataList.add(strings);
|
|
|
|
+ }
|
|
|
|
+ String fileName = "工作计划导出报表"+System.currentTimeMillis();
|
|
|
|
+ try {
|
|
|
|
+ return excelExportService.exportGeneralExcelByTitleAndListGant(wxCorpInfo,dingding,fileName, dataList, path);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ msg.data = pathPrefix + fileName+".xlsx";
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static List<String> generateDateHeaders(LocalDate startDate, LocalDate endDate) {
|
|
|
|
+ List<String> headers = new ArrayList<>();
|
|
|
|
+ DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("M.d");
|
|
|
|
+
|
|
|
|
+ LocalDate current = startDate;
|
|
|
|
+ while (!current.isAfter(endDate)) {
|
|
|
|
+ String dayOfWeek = getChineseDayOfWeek(current.getDayOfWeek());
|
|
|
|
+ String formattedDate = current.format(dayFormatter) + "(" + dayOfWeek + ")";
|
|
|
|
+ headers.add(formattedDate);
|
|
|
|
+ current = current.plusDays(1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return headers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static List<String> generateDateList(LocalDate startDate, LocalDate endDate) {
|
|
|
|
+ List<String> headers = new ArrayList<>();
|
|
|
|
+ DateTimeFormatter dayFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
+
|
|
|
|
+ LocalDate current = startDate;
|
|
|
|
+ while (!current.isAfter(endDate)) {
|
|
|
|
+
|
|
|
|
+ String formattedDate = current.format(dayFormatter);
|
|
|
|
+ headers.add(formattedDate);
|
|
|
|
+ current = current.plusDays(1);
|
|
|
|
+ }
|
|
|
|
+ return headers;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private static String getChineseDayOfWeek(DayOfWeek dayOfWeek) {
|
|
|
|
+ switch (dayOfWeek) {
|
|
|
|
+ case MONDAY: return "周一";
|
|
|
|
+ case TUESDAY: return "周二";
|
|
|
|
+ case WEDNESDAY: return "周三";
|
|
|
|
+ case THURSDAY: return "周四";
|
|
|
|
+ case FRIDAY: return "周五";
|
|
|
|
+ case SATURDAY: return "周六";
|
|
|
|
+ case SUNDAY: return "周日";
|
|
|
|
+ default: return "";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
//导出FTE报表数据
|
|
//导出FTE报表数据
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg exportFTEData(String monthStart,String monthEnd, String area,Integer departmentId,HttpServletRequest request) {
|
|
public HttpRespMsg exportFTEData(String monthStart,String monthEnd, String area,Integer departmentId,HttpServletRequest request) {
|