|
@@ -44,6 +44,7 @@ import org.apache.poi.xssf.streaming.SXSSFWorkbook;
|
|
import org.apache.poi.xssf.usermodel.*;
|
|
import org.apache.poi.xssf.usermodel.*;
|
|
import org.assertj.core.util.Lists;
|
|
import org.assertj.core.util.Lists;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -264,10 +265,15 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
@Resource
|
|
@Resource
|
|
private ProjectLeaderService projectLeaderService;
|
|
private ProjectLeaderService projectLeaderService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private TaskTypeService taskTypeService;
|
|
|
|
+
|
|
@Value(value = "${upload.path}")
|
|
@Value(value = "${upload.path}")
|
|
private String path;
|
|
private String path;
|
|
@Value("${configEnv.isDev}")
|
|
@Value("${configEnv.isDev}")
|
|
public boolean isDev;
|
|
public boolean isDev;
|
|
|
|
+ @Autowired
|
|
|
|
+ private TaskDailyAllocateMapper taskDailyAllocateMapper;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg getProjectListByPage(Integer pageIndex, Integer pageSize, String infoString, Integer id, Integer forReport, HttpServletRequest request) {
|
|
public HttpRespMsg getProjectListByPage(Integer pageIndex, Integer pageSize, String infoString, Integer id, Integer forReport, HttpServletRequest request) {
|
|
@@ -1271,6 +1277,11 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
projectIds.add(projectId);
|
|
projectIds.add(projectId);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ List<Project> managerList = projectMapper.selectList(new QueryWrapper<Project>().eq("incharger_id", user.getId()));
|
|
|
|
+ if (!managerList.isEmpty()){
|
|
|
|
+ List<Integer> list = managerList.stream().distinct().map(Project::getId).collect(Collectors.toList());
|
|
|
|
+ projectIds.addAll(list);
|
|
|
|
+ }
|
|
eq.in("id", projectIds);
|
|
eq.in("id", projectIds);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -5240,6 +5251,13 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
}
|
|
}
|
|
|
|
|
|
msg.data = itemList;
|
|
msg.data = itemList;
|
|
|
|
+ if (type==1){
|
|
|
|
+ for (GanttDataItem dataItem : itemList) {
|
|
|
|
+ if (dataItem.getProjectId()==null){
|
|
|
|
+ dataItem.setTime(0.0);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (type==0){
|
|
if (type==0){
|
|
for (GanttDataItem dataItem : itemList) {
|
|
for (GanttDataItem dataItem : itemList) {
|
|
if (!dataItem.getId().contains("任务_")){
|
|
if (!dataItem.getId().contains("任务_")){
|
|
@@ -13694,6 +13712,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
List<Department> userDepartmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", user.getId()).eq("company_id",user.getCompanyId()));
|
|
List<Department> userDepartmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("manager_id", user.getId()).eq("company_id",user.getCompanyId()));
|
|
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()));
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", user.getCompanyId()));
|
|
|
|
+ List<TaskType> taskTypeList = taskTypeService.list(new QueryWrapper<TaskType>().eq("company_id", user.getCompanyId()));
|
|
|
|
+
|
|
//判断查看权限
|
|
//判断查看权限
|
|
if(functionAllList.size()==0){
|
|
if(functionAllList.size()==0){
|
|
deptIds=new ArrayList<>();
|
|
deptIds=new ArrayList<>();
|
|
@@ -13724,10 +13744,21 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", user.getCompanyId()));
|
|
TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", user.getCompanyId()));
|
|
Float monthTime = days * allDay.getAllday();
|
|
Float monthTime = days * allDay.getAllday();
|
|
List<Map<String, Object>> list = projectMapper.getFTETaskPlanData(user.getCompanyId(), startDate, endDate, null, null, area, userId, null, null, null, deptIds, departmentId);
|
|
List<Map<String, Object>> list = projectMapper.getFTETaskPlanData(user.getCompanyId(), startDate, endDate, null, null, area, userId, null, null, null, deptIds, departmentId);
|
|
|
|
+ List<TaskDailyAllocate> dailyAllocateArrayList = new ArrayList<>();
|
|
|
|
+ List<Integer> taskIdList = list.stream().map(t -> (Integer)t.get("id")).distinct().collect(Collectors.toList());
|
|
|
|
+ dailyAllocateArrayList=taskDailyAllocateMapper.selectList(new QueryWrapper<TaskDailyAllocate>().in("task_id",taskIdList));
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
List<List<String>> dataList=new ArrayList<>();
|
|
List<String> titleList=new ArrayList<>();
|
|
List<String> titleList=new ArrayList<>();
|
|
|
|
|
|
titleList.add("序号");
|
|
titleList.add("序号");
|
|
|
|
+ titleList.add("起止时间");
|
|
|
|
+ titleList.add("天数");
|
|
|
|
+ titleList.add("所属部门");
|
|
|
|
+ titleList.add("岗位");
|
|
|
|
+ titleList.add("姓名");
|
|
|
|
+ titleList.add("工作计划类型");
|
|
|
|
+ titleList.add("项目编号");
|
|
|
|
+ titleList.add("项目名称");
|
|
titleList.add("项目分类");
|
|
titleList.add("项目分类");
|
|
titleList.add("项目经理");
|
|
titleList.add("项目经理");
|
|
titleList.add("研究中心");
|
|
titleList.add("研究中心");
|
|
@@ -13741,9 +13772,73 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
titleList.add("审核状态");
|
|
titleList.add("审核状态");
|
|
dataList.add(titleList);
|
|
dataList.add(titleList);
|
|
|
|
|
|
|
|
+ DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
|
|
|
|
+
|
|
for (int i = 0; i < list.size(); i++) {
|
|
for (int i = 0; i < list.size(); i++) {
|
|
List<String> item=new ArrayList<>();
|
|
List<String> item=new ArrayList<>();
|
|
item.add((i+1)+"");
|
|
item.add((i+1)+"");
|
|
|
|
+ Map<String, Object> map = list.get(i);
|
|
|
|
+ Integer taskId= (Integer) map.get("id");
|
|
|
|
+ String userIdStr= (String) map.get("userId");
|
|
|
|
+ Integer departmentIdStr= Math.toIntExact((Long) map.get("departmentId"));
|
|
|
|
+ Optional<Department> deptFirst = allDepartmentList.stream().filter(f -> f.getDepartmentId().equals(departmentIdStr)).findFirst();
|
|
|
|
+
|
|
|
|
+ List<TaskDailyAllocate> sortedList = dailyAllocateArrayList.stream()
|
|
|
|
+ .filter(t -> t.getTaskId().equals(taskId)&&t.getUserId().equals(userIdStr))
|
|
|
|
+ .sorted(Comparator.comparing(TaskDailyAllocate::getAllocateDate)) // 按 AllocateDate 递增排序
|
|
|
|
+ .collect(Collectors.toList());
|
|
|
|
+ String dateStr="";
|
|
|
|
+ if (!sortedList.isEmpty()){
|
|
|
|
+ if (sortedList.size()==1) {
|
|
|
|
+ TaskDailyAllocate t1 = sortedList.get(0);
|
|
|
|
+ dateStr=t1.getAllocateDate().format(formatter)+"-"+t1.getAllocateDate().format(formatter);
|
|
|
|
+ }else {
|
|
|
|
+ LocalDate d1 = sortedList.get(0).getAllocateDate();
|
|
|
|
+ LocalDate d2 = sortedList.get(sortedList.size()-1).getAllocateDate();
|
|
|
|
+ dateStr=d1.format(formatter)+"-"+d2.format(formatter);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ item.add(dateStr);//起止时间
|
|
|
|
+ item.add(sortedList.size()+"天");//天数
|
|
|
|
+
|
|
|
|
+ //所属部门
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ if(!deptFirst.isPresent()){
|
|
|
|
+ item.add("未分配");
|
|
|
|
+ }else {
|
|
|
|
+ item.add(departmentService.exportWxDepartment(deptFirst.get(),allDepartmentList));
|
|
|
|
+ }
|
|
|
|
+ }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
|
+ if(!deptFirst.isPresent()){
|
|
|
|
+ item.add("未分配");
|
|
|
|
+ }else {
|
|
|
|
+ item.add(departmentService.exportDdDepartment(deptFirst.get(),allDepartmentList));
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ item.add(departmentService.getSupDepartment(deptFirst.get(),allDepartmentList));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //岗位
|
|
|
|
+ item.add(list.get(i).get("roleName")==null?"":list.get(i).get("roleName").toString());
|
|
|
|
+ //姓名
|
|
|
|
+ if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
|
|
+ item.add((String)("$userName="+map.get("corpwxUserId")+"$"));
|
|
|
|
+
|
|
|
|
+ }else if(dingding!=null&&dingding.getContactNeedTranslate()==1){
|
|
|
|
+ item.add((String)("$userName="+map.get("userName")+"$"));
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ item.add((String)map.get("userName"));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Integer taskPlanType= (Integer) map.get("taskPlanType");
|
|
|
|
+ Optional<TaskType> typeOptional = taskTypeList.stream().filter(t -> t.getId().equals(taskPlanType)).findFirst();
|
|
|
|
+ item.add(typeOptional.isPresent()?typeOptional.get().getName():""); //工作计划类型
|
|
|
|
+ item.add(list.get(i).get("projectCode")==null?"":list.get(i).get("projectCode").toString());//项目编号
|
|
|
|
+ item.add(list.get(i).get("projectName")==null?"":list.get(i).get("projectName").toString());//项目名称
|
|
|
|
+
|
|
item.add(list.get(i).get("categoryName")==null?"":list.get(i).get("categoryName").toString());
|
|
item.add(list.get(i).get("categoryName")==null?"":list.get(i).get("categoryName").toString());
|
|
String inchargerId = list.get(i).get("inchargerId") != null ? list.get(i).get("inchargerId").toString() : "";
|
|
String inchargerId = list.get(i).get("inchargerId") != null ? list.get(i).get("inchargerId").toString() : "";
|
|
if (!StringUtils.isEmpty(inchargerId)){
|
|
if (!StringUtils.isEmpty(inchargerId)){
|