|
@@ -12,6 +12,7 @@ import com.management.platform.entity.vo.*;
|
|
|
import com.management.platform.mapper.*;
|
|
|
import com.management.platform.service.*;
|
|
|
import com.management.platform.util.*;
|
|
|
+import com.sun.star.bridge.oleautomation.Decimal;
|
|
|
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
|
|
import org.apache.http.client.methods.CloseableHttpResponse;
|
|
|
import org.apache.http.client.methods.HttpPost;
|
|
@@ -5843,8 +5844,8 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
if(departmentId!=null){
|
|
|
branchDepartment = getBranchDepartment(departmentId, allDepartmentList);
|
|
|
}
|
|
|
- List<Map<String, Object>> list = projectMapper.getUserWorkingTimeList(userId, user.getCompanyId(), startDate, endDate, projectId,start,size,branchDepartment,deptIds);
|
|
|
- long total=projectMapper.findCountWithUser(userId, user.getCompanyId(), startDate, endDate, projectId,null,null,departmentId,deptIds);
|
|
|
+ List<Map<String, Object>> list = projectMapper.getUserWorkingTimeList(userId, user.getCompanyId(), startDate, endDate, projectId,null,null,branchDepartment,deptIds);
|
|
|
+ //long total=projectMapper.findCountWithUser(userId, user.getCompanyId(), startDate, endDate, projectId,null,null,departmentId,deptIds);
|
|
|
Integer companyId = user.getCompanyId();
|
|
|
WxCorpInfo wxCorpInfo = wxCorpInfoMapper.selectOne(new QueryWrapper<WxCorpInfo>().eq("company_id", companyId));
|
|
|
List<LeaveSheet> leaveSheet = leaveSheetMapper.selectLeave(companyId,startDate,endDate);
|
|
@@ -5862,7 +5863,7 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
}else {
|
|
|
map.put("deptName",getSupDepartment(department));
|
|
|
}
|
|
|
- continue;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
if (!map.containsKey("deptName")){
|
|
@@ -5906,9 +5907,117 @@ public class ProjectServiceImpl extends ServiceImpl<ProjectMapper, Project> impl
|
|
|
NumberFormat nf = NumberFormat.getPercentInstance();
|
|
|
li.put("proportion",nf.format(divide));
|
|
|
});
|
|
|
+ //全月请假人员
|
|
|
+ List<Map<String, Object>> maps = leaveSheetMapper.selectLeaveAll(companyId, startDate, endDate);
|
|
|
+ TimeType timetype = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", user.getCompanyId()));
|
|
|
+ List<Map<String, Object>> leaveStaff = new ArrayList<>();
|
|
|
+ //去重
|
|
|
+ List<Map<String, Object>> collectMap = maps.stream().filter(m -> {
|
|
|
+ Boolean flag = true;
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
+ if (m.get("id").toString().equals(map.get("userId").toString())) {
|
|
|
+ flag = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return flag;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ for (Map<String, Object> map : collectMap) {
|
|
|
+ HashMap<String, Object> stringObjectHashMap = new HashMap<>();
|
|
|
+ stringObjectHashMap.put("deptId",map.get("departmentId"));
|
|
|
+ for (Department department : deptName) {
|
|
|
+ if (map.get("departmentId").toString().equals(department.getDepartmentId().toString())){
|
|
|
+ if (wxCorpInfo!=null && wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ stringObjectHashMap.put("deptName",getWxDepartment(department));
|
|
|
+ }else {
|
|
|
+ stringObjectHashMap.put("deptName",getSupDepartment(department));
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!stringObjectHashMap.containsKey("deptName")){
|
|
|
+ stringObjectHashMap.put("deptName","未分配");
|
|
|
+ }
|
|
|
+ stringObjectHashMap.put("isPublic",0);
|
|
|
+ stringObjectHashMap.put("jobNumber",map.get("jobNumber"));
|
|
|
+ Double leaveHours = 0.0;
|
|
|
+ int days = WorkDayCalculateUtils.getWorkDaysListInRange(map.get("startDate").toString(),map.get("endDate").toString(), 0).size();
|
|
|
+ for (Map<String, Object> stringObjectMap : collectMap) {
|
|
|
+ if (map.get("id").toString().equals(stringObjectMap.get("id"))){
|
|
|
+ LocalDate leaveStart = LocalDate.parse(map.get("startDate").toString(), dateTimeFormatter);
|
|
|
+ LocalDate leaveEnd = LocalDate.parse(map.get("endDate").toString(), dateTimeFormatter);
|
|
|
+ //当请假时间在当前时间段内的
|
|
|
+ if ((leaveStart.isEqual(localStartDate) || leaveStart.isAfter(localStartDate)) && (leaveEnd.isEqual(localEndDate) || leaveEnd.isBefore(localEndDate))){
|
|
|
+ leaveHours += Double.parseDouble(map.get("hours").toString());
|
|
|
+ }else{
|
|
|
+ float LeaveDay = leaveEnd.toEpochDay() - leaveStart.toEpochDay() + 1;
|
|
|
+ Float timeHours = Float.parseFloat(map.get("hours").toString());
|
|
|
+ //请假时间首尾跨时间段
|
|
|
+ if(leaveStart.isBefore(localStartDate) && leaveEnd.isAfter(localEndDate)){
|
|
|
+ int day = WorkDayCalculateUtils.getWorkDaysListInRange(localStartDate.toString(), localEndDate.toString(), 0).size();
|
|
|
+ leaveHours+= day * timetype.getAllday();
|
|
|
+ }else {
|
|
|
+ //当请假时间开始时间跨时间段
|
|
|
+ if (leaveStart.isBefore(localStartDate)){
|
|
|
+ //平均计算
|
|
|
+ float DifDay = localStartDate.toEpochDay() - leaveStart.toEpochDay();
|
|
|
+ leaveHours+= timeHours*(1 - DifDay/LeaveDay);
|
|
|
+ }else {
|
|
|
+ //当请假时间结束时间跨时间段
|
|
|
+ float DifDay = leaveEnd.toEpochDay() - localEndDate.toEpochDay();
|
|
|
+ leaveHours+= timeHours*(1 - DifDay/LeaveDay);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ leaveHours = new BigDecimal(leaveHours).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue();
|
|
|
+ stringObjectHashMap.put("leaveSum",leaveHours+"h");
|
|
|
+ stringObjectHashMap.put("proportion","0%");
|
|
|
+ stringObjectHashMap.put("unPublic",0);
|
|
|
+ stringObjectHashMap.put("userId",map.get("id"));
|
|
|
+ if (wxCorpInfo!=null && wxCorpInfo.getSaasSyncContact()==1){
|
|
|
+ stringObjectHashMap.put("username",map.get("wxOpenId"));
|
|
|
+ }else {
|
|
|
+ stringObjectHashMap.put("username",map.get("name"));
|
|
|
+ }
|
|
|
+ stringObjectHashMap.put("workingTime",leaveHours);
|
|
|
+ leaveStaff.add(stringObjectHashMap);
|
|
|
+ //去重
|
|
|
+ int flag = 0;
|
|
|
+ for (Map<String, Object> stringObjectMap : leaveStaff) {
|
|
|
+ if(stringObjectMap.get("userId").toString().equals(stringObjectHashMap.get("userId").toString())){
|
|
|
+ flag ++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (flag >= 2){
|
|
|
+ leaveStaff.remove(stringObjectHashMap);
|
|
|
+ }
|
|
|
+ int idFlag = 0;
|
|
|
+ //筛选人员
|
|
|
+ if (userId != null){
|
|
|
+ for (Map<String, Object> stringObjectMap : leaveStaff) {
|
|
|
+ if(!stringObjectMap.get("userId").toString().equals(userId)){
|
|
|
+ idFlag ++;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (idFlag >= 1){
|
|
|
+ leaveStaff.remove(stringObjectHashMap);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list.addAll(leaveStaff);
|
|
|
+ //计算总页数
|
|
|
+ long total = list.size();
|
|
|
+ List<Map<String, Object>> resultList = null;
|
|
|
+ if (pageIndex!=null && pageSize!=null){
|
|
|
+ resultList = list.stream().skip((pageIndex - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
|
|
|
+ }else {
|
|
|
+ resultList = list;
|
|
|
+ }
|
|
|
HashMap map=new HashMap();
|
|
|
map.put("total",total);
|
|
|
- map.put("result",list);
|
|
|
+ map.put("result",resultList);
|
|
|
msg.data = map;
|
|
|
return msg;
|
|
|
}
|