|
@@ -35,11 +35,9 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.sql.Timestamp;
|
|
|
-import java.text.DateFormat;
|
|
|
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;
|
|
@@ -3090,25 +3088,20 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
@Override
|
|
|
public HttpRespMsg getUserReportTimelinessRate(HttpServletRequest request, String startDate, String endDate, Integer departmentId, String userId,Integer pageIndex,Integer pageSize) {
|
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
|
- DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm");
|
|
|
DecimalFormat dft = new DecimalFormat("0%");
|
|
|
- LocalDateTime sDate = LocalDate.parse(startDate).atTime(LocalTime.now());
|
|
|
- LocalDateTime eDate = LocalDate.parse(endDate).atTime(LocalTime.now());
|
|
|
+ LocalDateTime sDate = LocalDate.parse(startDate).atTime(LocalTime.MIN);
|
|
|
+ LocalDateTime eDate = LocalDate.parse(endDate).atTime(LocalTime.MIN);
|
|
|
List<LocalDateTime> dateTimeList = getDays(sDate, eDate);
|
|
|
- Duration duration=Duration.between(sDate,eDate);
|
|
|
//去掉非工作日
|
|
|
- long days = duration.toDays();
|
|
|
+ long days =dateTimeList.size();
|
|
|
for (LocalDateTime localDateTime : dateTimeList) {
|
|
|
- if(WorkDayCalculateUtils.isWorkDay(localDateTime.toLocalDate())){
|
|
|
+ if(!WorkDayCalculateUtils.isWorkDay(localDateTime.toLocalDate())){
|
|
|
days-=1;
|
|
|
}
|
|
|
}
|
|
|
- System.out.println(days);
|
|
|
Integer companyId= userMapper.selectById(request.getHeader("token")).getCompanyId();
|
|
|
TimeType timeType = timeTypeMapper.selectById(companyId);
|
|
|
- String alertTime = timeType.getAlertTime();
|
|
|
- Integer alertType = timeType.getAlertType();
|
|
|
- LocalTime alert = LocalTime.parse(alertTime);
|
|
|
+ Integer timeliness = timeType.getTimeliness();
|
|
|
List<Map<String,Object>> reportList=reportMapper.getUserReportTimelinessRate(companyId,startDate,endDate);
|
|
|
System.out.println(reportList);
|
|
|
QueryWrapper<User> queryWrapper=new QueryWrapper();
|
|
@@ -3149,12 +3142,14 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
Timestamp timestamp = (Timestamp) map.get("createTime");
|
|
|
LocalDate createDate = LocalDate.parse(String.valueOf(date));
|
|
|
LocalDate createTimeDate =timestamp.toLocalDateTime().toLocalDate();
|
|
|
- LocalTime createTime =timestamp.toLocalDateTime().toLocalTime();
|
|
|
- //根据提醒类型 判断比较昨天还是今天
|
|
|
- if(alertType==1){
|
|
|
- createDate=createDate.plusDays(1);
|
|
|
+ //根据设置
|
|
|
+ switch (timeliness){
|
|
|
+ case 1:createDate=createDate.plusDays(1);
|
|
|
+ break;
|
|
|
+ case 2:createDate=createDate.plusDays(2);
|
|
|
+ break;
|
|
|
}
|
|
|
- if(createTimeDate.isBefore(createDate)||(createTimeDate.isEqual(createDate)&&createTime.isBefore(alert))){
|
|
|
+ if(createTimeDate.isBefore(createDate)||createTimeDate.isEqual(createDate)){
|
|
|
num++;
|
|
|
}
|
|
|
}
|
|
@@ -3278,8 +3273,9 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
return allList;
|
|
|
}
|
|
|
private List<LocalDateTime> getDays(LocalDateTime start, LocalDateTime end) {
|
|
|
- List<LocalDateTime> result = new ArrayList<LocalDateTime>();
|
|
|
+ List<LocalDateTime> result = new ArrayList();
|
|
|
while (start.isBefore(end)) {
|
|
|
+ result.add(start);
|
|
|
result.add(start.plusDays(1));
|
|
|
start=start.plusDays(1);
|
|
|
}
|