|
|
@@ -1,8 +1,8 @@
|
|
|
package com.ruoyi.project.service.impl;
|
|
|
|
|
|
-import com.mchange.v2.lang.SystemUtils;
|
|
|
import com.ruoyi.common.config.RuoYiConfig;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.domain.OutMontClockBo;
|
|
|
import com.ruoyi.common.core.domain.entity.SysDept;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
import com.ruoyi.common.core.domain.model.LoginUser;
|
|
|
@@ -14,10 +14,7 @@ import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.bean.BeanValidators;
|
|
|
import com.ruoyi.common.utils.file.FileUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
-import com.ruoyi.project.bo.MyMonthDays;
|
|
|
-import com.ruoyi.project.bo.ProjectStaffRecordInput;
|
|
|
-import com.ruoyi.project.bo.ProjectStaffRecordOut;
|
|
|
-import com.ruoyi.project.bo.batchExamineRecordInput;
|
|
|
+import com.ruoyi.project.bo.*;
|
|
|
import com.ruoyi.project.domain.ProjectStaffRecord;
|
|
|
import com.ruoyi.project.domain.ProjectStaffRecordLog;
|
|
|
import com.ruoyi.project.domain.ProjectTask;
|
|
|
@@ -35,7 +32,6 @@ import org.apache.commons.io.IOUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.security.core.parameters.P;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -776,12 +772,23 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String,Object>> getMonthClock(Integer id, String yearMonth) {
|
|
|
- yearMonth=yearMonth+"-01";
|
|
|
- LocalDate startDate = LocalDate.parse(yearMonth, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
+ public OutMontClockBo getMonthClock(Integer id, String yearMonth) {
|
|
|
+ OutMontClockBo out = new OutMontClockBo();
|
|
|
+ ProjectTask projectTask = getProjectTask(id);
|
|
|
+ SysDept sysDept = deptService.selectDeptByPid(projectTask.getId());
|
|
|
+ out.setProjectName(projectTask.getName());
|
|
|
+ out.setDepartmentName(sysDept.getDeptName());
|
|
|
+ if (sysDept.getCompanyName()!=null){
|
|
|
+ out.setCompanyName(sysDept.getCompanyName());
|
|
|
+ }else {
|
|
|
+ out.setCompanyName(sysDept.getDeptName());
|
|
|
+ }
|
|
|
+ String dateYMD=yearMonth+"-01";
|
|
|
+ LocalDate startDate = LocalDate.parse(dateYMD, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
startDate=startDate.withDayOfMonth(1);
|
|
|
int year=startDate.getYear();
|
|
|
int month=startDate.getMonthValue();
|
|
|
+ out.setTableName(year+"年"+month+"月工时记录表");
|
|
|
int lastMonth = month;
|
|
|
if(startDate.getMonthValue()== Month.DECEMBER.getValue()){
|
|
|
lastMonth=1;
|
|
|
@@ -794,6 +801,7 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
// monthClock = monthClock.stream().filter(e -> e.getAid() == 48).collect(Collectors.toList());
|
|
|
LocalDate lastDay = startDate.with(TemporalAdjusters.lastDayOfMonth());
|
|
|
List<Map<String,Object>> listData = new ArrayList<>();
|
|
|
+
|
|
|
//将数据与表头匹配
|
|
|
for (ProjectStaffRecord e : monthClock) {
|
|
|
//先匹配是否存在这个人,不存证则需要新增
|
|
|
@@ -839,26 +847,20 @@ public class ProjectStaffRecordServiceImpl implements ProjectStaffRecordService
|
|
|
}
|
|
|
//将数据统计,计算出所有工时与分摊率
|
|
|
pushDurationAndProportion(listData);
|
|
|
- return listData;
|
|
|
+ out.setList(listData);
|
|
|
+ return out;
|
|
|
+ }
|
|
|
+
|
|
|
+ private ProjectTask getProjectTask(Integer id) {
|
|
|
+ ProjectTask projectTask = projectTaskMapper.selectByPrimaryKey(Long.valueOf(id));
|
|
|
+ return projectTask;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void getMonthClockExport(Integer id, String yearMonth, HttpServletResponse response) {
|
|
|
- ProjectTask projectTask = projectTaskMapper.selectByPrimaryKey(Long.valueOf(id));
|
|
|
- SysDept sysDept = deptService.selectDeptByPid(projectTask.getId());
|
|
|
- String projectName=projectTask.getName();
|
|
|
- String departmentName=sysDept.getDeptName();
|
|
|
- String companyName=sysDept.getCompanyName();
|
|
|
- if (sysDept.getCompanyId()==null){
|
|
|
- companyName=sysDept.getDeptName();
|
|
|
- }
|
|
|
- LocalDate startDate = LocalDate.parse(yearMonth, DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
|
|
- startDate=startDate.withDayOfMonth(1);
|
|
|
- int year=startDate.getYear();
|
|
|
- int month=startDate.getMonthValue();
|
|
|
- List<Map<String, Object>> listData = getMonthClock(id, yearMonth);
|
|
|
+ OutMontClockBo out = getMonthClock(id, yearMonth);
|
|
|
ExcelUtil<Object> util = new ExcelUtil<>(Object.class);
|
|
|
- util.exportProjectMonthClockExcel(response,listData, projectName, departmentName, companyName, year,month);
|
|
|
+ util.exportProjectMonthClockExcel(response,out);
|
|
|
}
|
|
|
|
|
|
@Override
|