bug修复
This commit is contained in:
parent
e6ae6c94e0
commit
933f6ebb41
@ -83,5 +83,11 @@ public class WorkerAttendanceVo {
|
|||||||
private String mockTime;
|
private String mockTime;
|
||||||
private String enterpriseId;
|
private String enterpriseId;
|
||||||
private String enterpriseName;
|
private String enterpriseName;
|
||||||
|
/**
|
||||||
|
* 人员id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "人员id")
|
||||||
|
private java.lang.Long workerId;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,7 +73,7 @@ public class SafetyHatDataDailyStatisticsServiceImpl extends ServiceImpl<SafetyH
|
|||||||
WorkerInfo workerInfo = workerInfoService.queryById(workerId);
|
WorkerInfo workerInfo = workerInfoService.queryById(workerId);
|
||||||
String projectSn = workerInfo.getProjectSn();
|
String projectSn = workerInfo.getProjectSn();
|
||||||
Map<String, Long> devSn2WorkerMap = safetyHatDevService.list(new LambdaQueryWrapper<SafetyHatDev>()
|
Map<String, Long> devSn2WorkerMap = safetyHatDevService.list(new LambdaQueryWrapper<SafetyHatDev>()
|
||||||
.eq(SafetyHatDev::getProjectSn, projectSn)).stream().collect(Collectors.toMap(SafetyHatDev::getDevSn, SafetyHatDev::getWorkerInfoId, (o1, o2) -> o1));
|
.eq(SafetyHatDev::getProjectSn, projectSn)).stream().filter(d -> Objects.nonNull(d.getDevSn()) && Objects.nonNull(d.getWorkerInfoId())).collect(Collectors.toMap(SafetyHatDev::getDevSn, SafetyHatDev::getWorkerInfoId, (o1, o2) -> o1));
|
||||||
//实时计算
|
//实时计算
|
||||||
ArrayList<SafetyHatDataDailyStatisticsVo> vos = new ArrayList<>();
|
ArrayList<SafetyHatDataDailyStatisticsVo> vos = new ArrayList<>();
|
||||||
List<SafetyHatFence> fences = safetyHatFenceService.list(new LambdaQueryWrapper<SafetyHatFence>().eq(SafetyHatFence::getProjectSn, projectSn));
|
List<SafetyHatFence> fences = safetyHatFenceService.list(new LambdaQueryWrapper<SafetyHatFence>().eq(SafetyHatFence::getProjectSn, projectSn));
|
||||||
|
|||||||
@ -22,13 +22,16 @@ import com.zhgd.xmgl.async.AsyncAttendance;
|
|||||||
import com.zhgd.xmgl.base.entity.vo.echarts.ChartDataVo;
|
import com.zhgd.xmgl.base.entity.vo.echarts.ChartDataVo;
|
||||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||||
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
import com.zhgd.xmgl.modules.project.service.IProjectService;
|
||||||
|
import com.zhgd.xmgl.modules.worker.entity.EnterpriseInfo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerDailyAttendanceStatisticsV2;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerDailyAttendanceStatisticsV2;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||||
|
import com.zhgd.xmgl.modules.worker.entity.bo.ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerDailyAttendanceStatisticsV2Dto;
|
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerDailyAttendanceStatisticsV2Dto;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
||||||
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
|
import com.zhgd.xmgl.modules.worker.service.IWorkerAttendanceService;
|
||||||
import com.zhgd.xmgl.modules.worker.service.IWorkerDailyAttendanceStatisticsV2Service;
|
import com.zhgd.xmgl.modules.worker.service.IWorkerDailyAttendanceStatisticsV2Service;
|
||||||
|
import com.zhgd.xmgl.modules.worker.service.impl.EnterpriseInfoServiceImpl;
|
||||||
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
import com.zhgd.xmgl.modules.worker.service.impl.WorkerInfoServiceImpl;
|
||||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
import com.zhgd.xmgl.util.EasyPoiUtil;
|
import com.zhgd.xmgl.util.EasyPoiUtil;
|
||||||
@ -43,6 +46,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.collections.MapUtils;
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
import org.simpleframework.xml.core.Validate;
|
import org.simpleframework.xml.core.Validate;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Lazy;
|
import org.springframework.context.annotation.Lazy;
|
||||||
@ -76,6 +80,9 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
|||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
IProjectService projectService;
|
IProjectService projectService;
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
EnterpriseInfoServiceImpl enterpriseInfoService;
|
||||||
@Lazy
|
@Lazy
|
||||||
@Autowired
|
@Autowired
|
||||||
private IWorkerDailyAttendanceStatisticsV2Service workerDailyAttendanceStatisticsV2Service;
|
private IWorkerDailyAttendanceStatisticsV2Service workerDailyAttendanceStatisticsV2Service;
|
||||||
@ -250,6 +257,15 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
|||||||
vo.setDailyDayMap(dailyDayMap);
|
vo.setDailyDayMap(dailyDayMap);
|
||||||
vo.setDailyAttendanceMap(dailyAttendanceMap);
|
vo.setDailyAttendanceMap(dailyAttendanceMap);
|
||||||
vo.setPersonSn(workerInfo.getPersonSn());
|
vo.setPersonSn(workerInfo.getPersonSn());
|
||||||
|
vo.setWorkerId(workerInfo.getId());
|
||||||
|
vo.setWorkerTypeName(workerInfo.getTypeName());
|
||||||
|
vo.setPhoneNumber(workerInfo.getPhoneNumber());
|
||||||
|
vo.setIdCard(workerInfo.getIdCard());
|
||||||
|
vo.setSex(workerInfo.getSex());
|
||||||
|
vo.setEnterDate(workerInfo.getEnterDate());
|
||||||
|
vo.setProjectSn(workerInfo.getProjectSn());
|
||||||
|
vo.setPayRollBankName(workerInfo.getPayRollBankName());
|
||||||
|
vo.setPayRollBankNumber(workerInfo.getPayRollBankNumber());
|
||||||
vos.add(vo);
|
vos.add(vo);
|
||||||
}
|
}
|
||||||
IPage<StatisticsListVo> p = new Page<>();
|
IPage<StatisticsListVo> p = new Page<>();
|
||||||
@ -553,7 +569,7 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
|||||||
vo.setPersonType(workerInfo.getPersonType());
|
vo.setPersonType(workerInfo.getPersonType());
|
||||||
vo.setEnterpriseName(workerInfo.getEnterpriseName());
|
vo.setEnterpriseName(workerInfo.getEnterpriseName());
|
||||||
vo.setWorkerName(workerInfo.getWorkerName());
|
vo.setWorkerName(workerInfo.getWorkerName());
|
||||||
vo.setDeptName(workerInfo.getDepartmentName());
|
vo.setDeptName(Objects.equals(workerInfo.getPersonType(), 1) ? workerInfo.getTeamName() : workerInfo.getDepartmentName());
|
||||||
vo.setProjectSn(workerInfo.getProjectSn());
|
vo.setProjectSn(workerInfo.getProjectSn());
|
||||||
vo.setPersonSn(workerInfo.getPersonSn());
|
vo.setPersonSn(workerInfo.getPersonSn());
|
||||||
vo.setAttendanceDate(DateUtil.parseDate(attendanceDate));
|
vo.setAttendanceDate(DateUtil.parseDate(attendanceDate));
|
||||||
@ -571,14 +587,10 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
|||||||
}
|
}
|
||||||
List<WorkerAttendance> attendances = personSn2AttendancesMap.get(workerInfo.getPersonSn());
|
List<WorkerAttendance> attendances = personSn2AttendancesMap.get(workerInfo.getPersonSn());
|
||||||
if (Objects.equals(vo.getIsAttendance(), 1) && CollUtil.isNotEmpty(attendances)) {
|
if (Objects.equals(vo.getIsAttendance(), 1) && CollUtil.isNotEmpty(attendances)) {
|
||||||
String firstInTime = attendances.stream().filter(w -> Objects.equals(w.getPassType(), 1)).min(Comparator.comparing(WorkerAttendance::getCreateTime)).map(WorkerAttendance::getCreateTime).orElse(null);
|
vo.setFirstInTime(Optional.ofNullable(getFirstInTime(attendances)).map(WorkerAttendance::getCreateTime).orElse(null));
|
||||||
String endOutTime = attendances.stream().filter(w -> Objects.equals(w.getPassType(), 2)).max(Comparator.comparing(WorkerAttendance::getCreateTime)).map(WorkerAttendance::getCreateTime).orElse(null);
|
vo.setEndOutTime(Optional.ofNullable(getEndOutTime(attendances)).map(WorkerAttendance::getCreateTime).orElse(null));
|
||||||
vo.setFirstInTime(firstInTime);
|
vo.setFirstTimeAm(Optional.ofNullable(getFirstTimeAm(attendances)).map(WorkerAttendance::getCreateTime).orElse(null));
|
||||||
vo.setEndOutTime(endOutTime);
|
vo.setEndTimePm(Optional.ofNullable(getEndTimePm(attendances)).map(WorkerAttendance::getCreateTime).orElse(null));
|
||||||
String firstTimeAm = attendances.stream().filter(w -> DateUtil.compare(DateUtil.parseDateTime(w.getCreateTime()), DateUtil.parseDateTime(attendanceDate + " 12:00:00")) < 0).min(Comparator.comparing(WorkerAttendance::getCreateTime)).map(WorkerAttendance::getCreateTime).orElse(null);
|
|
||||||
vo.setFirstTimeAm(firstTimeAm);
|
|
||||||
String endTimePm = attendances.stream().filter(w -> DateUtil.compare(DateUtil.parseDateTime(w.getCreateTime()), DateUtil.parseDateTime(attendanceDate + " 12:00:00")) >= 0).max(Comparator.comparing(WorkerAttendance::getCreateTime)).map(WorkerAttendance::getCreateTime).orElse(null);
|
|
||||||
vo.setEndTimePm(endTimePm);
|
|
||||||
vo.setAttendanceList(attendances);
|
vo.setAttendanceList(attendances);
|
||||||
}
|
}
|
||||||
vo.setWorkerId(workerInfo.getId());
|
vo.setWorkerId(workerInfo.getId());
|
||||||
@ -592,6 +604,50 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 下午打卡(未次)
|
||||||
|
*
|
||||||
|
* @param attendances
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
private WorkerAttendance getEndTimePm(List<WorkerAttendance> attendances) {
|
||||||
|
return attendances.stream().filter(w -> DateUtil.compare(DateUtil.parseDateTime(w.getCreateTime()), DateUtil.parseDateTime(w.getCreateTime().substring(0, 10) + " 12:00:00")) >= 0)
|
||||||
|
.max(Comparator.comparing(WorkerAttendance::getCreateTime)).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上午打卡(首次)
|
||||||
|
*
|
||||||
|
* @param attendances
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
private WorkerAttendance getFirstTimeAm(List<WorkerAttendance> attendances) {
|
||||||
|
return attendances.stream().filter(w -> DateUtil.compare(DateUtil.parseDateTime(w.getCreateTime()), DateUtil.parseDateTime(w.getCreateTime().substring(0, 10) + " 12:00:00")) < 0)
|
||||||
|
.min(Comparator.comparing(WorkerAttendance::getCreateTime)).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取出场打卡(末次)
|
||||||
|
*
|
||||||
|
* @param attendances
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private WorkerAttendance getEndOutTime(List<WorkerAttendance> attendances) {
|
||||||
|
return attendances.stream().filter(w -> Objects.equals(w.getPassType(), 2)).max(Comparator.comparing(WorkerAttendance::getCreateTime)).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取进场打卡(首次)
|
||||||
|
*
|
||||||
|
* @param attendances
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private WorkerAttendance getFirstInTime(List<WorkerAttendance> attendances) {
|
||||||
|
return attendances.stream().filter(w -> Objects.equals(w.getPassType(), 1)).min(Comparator.comparing(WorkerAttendance::getCreateTime)).orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "统计考勤日报", notes = "统计考勤日报", httpMethod = "POST")
|
@ApiOperation(value = "统计考勤日报", notes = "统计考勤日报", httpMethod = "POST")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
|
||||||
@ -774,141 +830,372 @@ public class WorkerDailyAttendanceStatisticsV2Controller {
|
|||||||
@ApiImplicitParam(name = "startDate", value = "开始日期(yyyy-MM-dd)", paramType = "body", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "startDate", value = "开始日期(yyyy-MM-dd)", paramType = "body", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "endDate", value = "结束日期(yyyy-MM-dd)", paramType = "body", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "endDate", value = "结束日期(yyyy-MM-dd)", paramType = "body", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "groupByType", value = "1.按项目;2.按参建单位;3.按班组/部门;4.按人员", paramType = "body", required = true, dataType = "String"),
|
@ApiImplicitParam(name = "groupByType", value = "1.按项目;2.按参建单位;3.按班组/部门;4.按人员", paramType = "body", required = true, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "downloadType", value = "1上下午打卡2进出场打卡", paramType = "body", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "downloadType", value = "1每日明细(上下午打卡)2进出场打卡3每日工时4每日明细", paramType = "body", required = false, dataType = "String"),
|
||||||
@ApiImplicitParam(name = "effectiveHour", value = "有效工时", paramType = "body", required = false, dataType = "String"),
|
@ApiImplicitParam(name = "hourValBegin", value = "大于有效工时", paramType = "body", required = false, dataType = "String"),
|
||||||
|
@ApiImplicitParam(name = "enterpriseId", value = "单位id", paramType = "body", required = false, dataType = "String"),
|
||||||
})
|
})
|
||||||
@PostMapping(value = "/exportWorkerDailyAttendancesStaticsByMonthXls")
|
@PostMapping(value = "/exportWorkerDailyAttendancesStaticsByMonthXls")
|
||||||
public void exportWorkerDailyAttendancesStaticsByMonthXls(HttpServletResponse response, @RequestBody HashMap<String, Object> param) {
|
public void exportWorkerDailyAttendancesStaticsByMonthXls(HttpServletResponse response, @RequestBody HashMap<String, Object> param) {
|
||||||
// String templateUrl = null;
|
String templateUrl = null;
|
||||||
// try {
|
try {
|
||||||
// String projectSn = MapUtils.getString(param, "projectSn");
|
String projectSn = MapUtils.getString(param, "projectSn");
|
||||||
// String startDate = MapUtils.getString(param, "startDate");
|
Project project = projectService.getOne(new LambdaQueryWrapper<Project>()
|
||||||
// String endDate = MapUtils.getString(param, "endDate");
|
.eq(Project::getProjectSn, projectSn));
|
||||||
// Integer downloadType = MapUtils.getInteger(param, "downloadType");
|
String startDate = MapUtils.getString(param, "startDate");
|
||||||
// Integer groupByType = MapUtils.getInteger(param, "groupByType");
|
String endDate = MapUtils.getString(param, "endDate");
|
||||||
// List<DateTime> dateTimes = DateUtil.rangeToList(DateUtil.parseDate(startDate), DateUtil.parseDate(endDate), DateField.DAY_OF_YEAR);
|
Integer downloadType = MapUtils.getInteger(param, "downloadType");
|
||||||
// Map<Integer, Map<String, Object>> root = new HashMap<>();
|
Integer groupByType = MapUtils.getInteger(param, "groupByType");
|
||||||
// if (Objects.equals(groupByType, 3)) {
|
List<DateTime> dateTimes = DateUtil.rangeToList(DateUtil.parseDate(startDate), DateUtil.parseDate(endDate), DateField.DAY_OF_YEAR);
|
||||||
// //按班组/部门
|
Map<Integer, Map<String, Object>> root = new HashMap<>();
|
||||||
// if (Objects.equals(downloadType, 1)) {
|
int sheetIndex = 0;
|
||||||
// //考勤月报-按班组-每日出入(打卡记录明细).xlsx
|
List<String> sheetNames = new ArrayList<>();
|
||||||
// param.put("startTime", startDate);
|
String tempSheetName;
|
||||||
// param.put("endTime", endDate);
|
if (Objects.equals(groupByType, 3)) {
|
||||||
// param.put("pageSize", -1);
|
//按班组/部门
|
||||||
// List<StatisticsListVo> voList = this.doCountDailyAttendanceByDateRange(param).getRecords();
|
tempSheetName = "考勤月报-按班组.xlsx";
|
||||||
// Map<String, List<StatisticsListVo>> deptNameMap = voList.stream().collect(Collectors.groupingBy(StatisticsListVo::getDeptName));
|
//考勤月报-按班组.xlsx
|
||||||
// Map<String, Object> sheetMap = new HashMap<>();
|
param.put("startTime", startDate);
|
||||||
// List<Map<String, Object>> listMap = new ArrayList<>();
|
param.put("endTime", endDate);
|
||||||
// for (Map.Entry<String, List<StatisticsListVo>> entry : deptNameMap.entrySet()) {
|
param.put("pageSize", -1);
|
||||||
// int j = 0;
|
List<StatisticsListVo> voList = this.doCountDailyAttendanceByDateRange(param).getRecords();
|
||||||
// for (StatisticsListVo vo : entry.getValue()) {
|
Map<String, List<StatisticsListVo>> deptNameMap = voList.stream().collect(Collectors.groupingBy(StatisticsListVo::getDeptName));
|
||||||
// Map<String, Object> map = new HashMap<>();
|
Map<String, Map<String, List<WorkerAttendance>>> personSn2Date2AttendancesMap = workerAttendanceService.list(new LambdaQueryWrapper<WorkerAttendance>()
|
||||||
// map.put("firstInTimeYes", StrUtil.isNotBlank(vo.getFirstInTime()) ? "√" : "×");
|
.eq(WorkerAttendance::getProjectSn, projectSn)
|
||||||
// map.put("firstInTime", vo.getFirstInTime());
|
.ge(WorkerAttendance::getCreateTime, startDate)
|
||||||
// map.put("endOutTimeYes", StrUtil.isNotBlank(vo.getEndOutTime()) ? "√" : "×");
|
.le(WorkerAttendance::getCreateTime, DateUtil.formatDateTime(DateUtil.endOfDay(DateUtil.parseDate(endDate))))
|
||||||
// map.put("endOutTime", vo.getEndOutTime());
|
.select(WorkerAttendance::getPersonSn, WorkerAttendance::getCreateTime, WorkerAttendance::getPassType))
|
||||||
// map.put("firstTimeAmYes", StrUtil.isNotBlank(vo.getFirstTimeAm()) ? "√" : "×");
|
.stream().filter(w -> Objects.nonNull(w.getPersonSn())).collect(Collectors.groupingBy(WorkerAttendance::getPersonSn,
|
||||||
// map.put("firstTimeAm", vo.getFirstTimeAm());
|
Collectors.groupingBy(o -> DateUtil.formatDate(DateUtil.parseDate(o.getCreateTime())),
|
||||||
// map.put("endTimePmYes", StrUtil.isNotBlank(vo.getEndTimePm()) ? "√" : "×");
|
Collectors.toList())));
|
||||||
// map.put("endTimePm", vo.getEndTimePm());
|
BigDecimal totalAttendanceDay = BigDecimal.ZERO;
|
||||||
// map.put("personType", vo.getPersonType());
|
BigDecimal totalHour = BigDecimal.ZERO;
|
||||||
// map.put("enterpriseName", vo.getEnterpriseName());
|
for (Map.Entry<String, List<StatisticsListVo>> entry : deptNameMap.entrySet()) {
|
||||||
// map.put("workerName", vo.getWorkerName());
|
Map<String, Object> sheetMap = new HashMap<>();
|
||||||
// map.put("deptName", vo.getDeptName());
|
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||||
// map.put("projectSn", vo.getProjectSn());
|
List<StatisticsListVo> vos = entry.getValue();
|
||||||
// map.put("personSn", vo.getPersonSn());
|
int index = 0;
|
||||||
// map.put("attendanceDate", vo.getAttendanceDate());
|
for (StatisticsListVo vo : vos) {
|
||||||
// map.put("hourVal", vo.getHourVal());
|
Map<String, Object> map = new HashMap<>();
|
||||||
// map.put("dayVal", vo.getDayVal());
|
map.put("no", ++index);
|
||||||
// map.put("isAttendance", vo.getIsAttendance());
|
map.put("personType", vo.getPersonType());
|
||||||
// map.put("overtimeHourVal", vo.getOvertimeHourVal());
|
map.put("enterpriseName", vo.getEnterpriseName());
|
||||||
// map.put("overtimeDayVal", vo.getOvertimeDayVal());
|
map.put("workerName", vo.getWorkerName());
|
||||||
// map.put("inserviceType", vo.getInserviceType());
|
map.put("deptName", vo.getDeptName());
|
||||||
// AtomicInteger i = new AtomicInteger(1);
|
map.put("projectSn", vo.getProjectSn());
|
||||||
// map.put("attendanceList", Objects.nonNull(vo.getAttendanceList()) ? vo.getAttendanceList().stream().map(a -> {
|
map.put("personSn", vo.getPersonSn());
|
||||||
// return i.getAndIncrement() + ".(" + (Objects.equals(a.getPassType(), 1) ? "进场" : "出场") + a.getCreateTime() + ")";
|
map.put("workerTypeName", vo.getWorkerTypeName());
|
||||||
// }).collect(Collectors.joining("\n")) : "");
|
map.put("phoneNumber", vo.getPhoneNumber());
|
||||||
// map.put("workerTypeName", vo.getWorkerTypeName());
|
map.put("idCard", vo.getIdCard());
|
||||||
// map.put("phoneNumber", vo.getPhoneNumber());
|
map.put("sex", Objects.equals(vo.getSex(), 1) ? "男" : "女");
|
||||||
// map.put("idCard", vo.getIdCard());
|
map.put("enterDate", vo.getEnterDate());
|
||||||
// map.put("sex", Objects.equals(vo.getSex(), 1) ? "男" : "女");
|
for (int z = 0; z < dateTimes.size(); z++) {
|
||||||
// map.put("enterDate", vo.getEnterDate());
|
DateTime dateTime = dateTimes.get(z);
|
||||||
// listMap.add(map);
|
sheetMap.put("date" + (z + 1), DateUtil.format(dateTime, "M/d"));
|
||||||
// }
|
sheetMap.put("delete" + (z + 1), false);
|
||||||
// }
|
String value;
|
||||||
// sheetMap.put("date", DateUtil.formatDate(dateTime));
|
if (Objects.equals(downloadType, 1) || Objects.equals(downloadType, 2)) {
|
||||||
// sheetMap.put("listMap", listMap);
|
value = getExcelAmPmAttendanceByDate(personSn2Date2AttendancesMap, vo, dateTime, downloadType);
|
||||||
// root.put(j++, sheetMap);
|
} else if (Objects.equals(downloadType, 3)) {
|
||||||
// }
|
//每日工时
|
||||||
// }
|
value = Optional.ofNullable(vo.getDailyHourMap().get(DateUtil.formatDate(dateTime))).map(decimal -> decimal.toString()).orElse("");
|
||||||
//
|
} else {
|
||||||
// param.put("pageNo", 1);
|
//每日明细
|
||||||
// param.put("pageSize", -1);
|
value = Optional.ofNullable(vo.getDailyAttendanceMap().get(DateUtil.formatDate(dateTime))).map(integer -> Objects.equals(integer, 1) ? "√" : "×").orElse("x");
|
||||||
// int j = 0;
|
}
|
||||||
// String tempSheetName;
|
map.put("attendanceByDate" + (z + 1), value);
|
||||||
// if (Objects.equals(downloadType, 1)) {
|
}
|
||||||
// tempSheetName = "考勤日报-出勤导出模版(上午下午).xlsx";
|
for (int i = dateTimes.size(); i < 31; i++) {
|
||||||
// } else {
|
sheetMap.put("delete" + (i + 1), true);
|
||||||
// tempSheetName = "考勤日报-出勤导出模版(进场出场).xlsx";
|
}
|
||||||
// }
|
map.put("totalHour", vo.getTotalHour());
|
||||||
// for (DateTime dateTime : dateTimes) {
|
map.put("totalAttendanceDay", vo.getTotalAttendanceDay());
|
||||||
// param.put("attendanceDate", DateUtil.formatDate(dateTime));
|
totalAttendanceDay = NumberUtil.add(vo.getTotalAttendanceDay(), totalAttendanceDay);
|
||||||
// List<WorkerDailyAttendancesByDateVo> records = doGetWorkerDailyAttendancePageByDateVoIPage(param).getRecords();
|
totalHour = NumberUtil.add(vo.getTotalHour(), totalHour);
|
||||||
// Map<String, Object> sheetMap = new HashMap<>();
|
listMap.add(map);
|
||||||
// List<Map<String, Object>> listMap = new ArrayList<>();
|
}
|
||||||
// for (WorkerDailyAttendancesByDateVo vo : records) {
|
sheetMap.put("listMap", listMap);
|
||||||
// Map<String, Object> map = new HashMap<>();
|
sheetMap.put("projectName", project.getProjectName());
|
||||||
// map.put("firstInTimeYes", StrUtil.isNotBlank(vo.getFirstInTime()) ? "√" : "×");
|
StatisticsListVo vo = CollUtil.getFirst(vos);
|
||||||
// map.put("firstInTime", vo.getFirstInTime());
|
sheetMap.put("title", StrUtil.format("项目名称:{} 参建单位名称:{} {}名称:{} 总人数:{} 时间:({} - {})",
|
||||||
// map.put("endOutTimeYes", StrUtil.isNotBlank(vo.getEndOutTime()) ? "√" : "×");
|
project.getProjectName(), vo.getEnterpriseName(), vo.getPersonType() == 1 ? "班组" : "部门", vo.getDeptName(), vos.size(), startDate, endDate));
|
||||||
// map.put("endOutTime", vo.getEndOutTime());
|
sheetMap.put("totalAttendanceDay", totalAttendanceDay);
|
||||||
// map.put("firstTimeAmYes", StrUtil.isNotBlank(vo.getFirstTimeAm()) ? "√" : "×");
|
sheetMap.put("totalHour", totalHour);
|
||||||
// map.put("firstTimeAm", vo.getFirstTimeAm());
|
root.put(sheetIndex++, sheetMap);
|
||||||
// map.put("endTimePmYes", StrUtil.isNotBlank(vo.getEndTimePm()) ? "√" : "×");
|
sheetNames.add(entry.getKey());
|
||||||
// map.put("endTimePm", vo.getEndTimePm());
|
}
|
||||||
// map.put("personType", vo.getPersonType());
|
templateUrl = Fileutils.getExportTemplateFile("excel/workerDailyAttendanceStatisticsV2/" + tempSheetName).getAbsolutePath();
|
||||||
// map.put("enterpriseName", vo.getEnterpriseName());
|
String outputTemplateFilePath = PathUtil.getBasePath() + "/temp/" + IdUtil.randomUUID() + ".xlsx";
|
||||||
// map.put("workerName", vo.getWorkerName());
|
EasyPoiUtil.cloneSheetMultipleTimes(templateUrl, outputTemplateFilePath, "1", sheetNames.size() - 1);
|
||||||
// map.put("deptName", vo.getDeptName());
|
TemplateExportParams params = new TemplateExportParams(outputTemplateFilePath, true);
|
||||||
// map.put("projectSn", vo.getProjectSn());
|
params.setSheetName(sheetNames.toArray(new String[]{}));
|
||||||
// map.put("personSn", vo.getPersonSn());
|
Workbook workbook = ExcelExportUtil.exportExcel(root, params);
|
||||||
// map.put("attendanceDate", vo.getAttendanceDate());
|
ExcelUtils.downLoadExcel(tempSheetName, response, workbook);
|
||||||
// map.put("hourVal", vo.getHourVal());
|
} else if (Objects.equals(groupByType, 2)) {
|
||||||
// map.put("dayVal", vo.getDayVal());
|
//按参建单位
|
||||||
// map.put("isAttendance", vo.getIsAttendance());
|
tempSheetName = "考勤月报-按单位-出勤人数与考勤报表.xlsx";
|
||||||
// map.put("overtimeHourVal", vo.getOvertimeHourVal());
|
//导出sheet1上海振南出勤人数
|
||||||
// map.put("overtimeDayVal", vo.getOvertimeDayVal());
|
List<ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo> list = workerDailyAttendanceStatisticsV2Service.countExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo(param);
|
||||||
// map.put("inserviceType", vo.getInserviceType());
|
Map<String, List<ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo>> date2Map = list.stream().collect(Collectors.groupingBy(ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo::getDate));
|
||||||
// AtomicInteger i = new AtomicInteger(1);
|
Map<String, Object> sheetMap1 = new HashMap<>();
|
||||||
// map.put("attendanceList", Objects.nonNull(vo.getAttendanceList()) ? vo.getAttendanceList().stream().map(a -> {
|
List<Map<String, Object>> colList = new ArrayList<Map<String, Object>>();
|
||||||
// return i.getAndIncrement() + ".(" + (Objects.equals(a.getPassType(), 1) ? "进场" : "出场") + a.getCreateTime() + ")";
|
List<Map<String, Object>> listMap1 = new ArrayList<>();
|
||||||
// }).collect(Collectors.joining("\n")) : "");
|
Integer totalGlNum = 0;
|
||||||
// map.put("workerTypeName", vo.getWorkerTypeName());
|
Integer totalSgNum = 0;
|
||||||
// map.put("phoneNumber", vo.getPhoneNumber());
|
Map<String, Integer> deptKeyMap = new HashMap<>();
|
||||||
// map.put("idCard", vo.getIdCard());
|
for (Map.Entry<String, List<ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo>> entry : date2Map.entrySet()) {
|
||||||
// map.put("sex", Objects.equals(vo.getSex(), 1) ? "男" : "女");
|
int index = 0;
|
||||||
// map.put("enterDate", vo.getEnterDate());
|
Map<String, Object> map = new HashMap<>();
|
||||||
// listMap.add(map);
|
map.put("no", ++index);
|
||||||
// }
|
map.put("date", entry.getKey());
|
||||||
// sheetMap.put("date", DateUtil.formatDate(dateTime));
|
Integer glNum = 0;
|
||||||
// sheetMap.put("listMap", listMap);
|
Integer sgNum = 0;
|
||||||
// root.put(j++, sheetMap);
|
for (ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo bo : entry.getValue()) {
|
||||||
// }
|
Map<String, Object> e = new HashMap<>();
|
||||||
// templateUrl = Fileutils.getExportTemplateFile("excel/" + tempSheetName).getAbsolutePath();
|
e.put("name", bo.getDeptName() + (bo.getPersonType() == 2 ? "(部门)" : "(班组)"));
|
||||||
// String outputTemplateFilePath = PathUtil.getBasePath() + "/temp/" + IdUtil.randomUUID() + ".xlsx";
|
e.put("glName", "管理人数");
|
||||||
// EasyPoiUtil.cloneSheetMultipleTimes(templateUrl, outputTemplateFilePath, "1", dateTimes.size() - 1);
|
e.put("sgName", "施工人数");
|
||||||
// TemplateExportParams params = new TemplateExportParams(outputTemplateFilePath, true);
|
String glKey = "gl" + bo.getDeptName();
|
||||||
// params.setSheetName(dateTimes.stream().map(DateUtil::formatDate).collect(Collectors.toList()).toArray(new String[]{}));
|
String sgKey = "sg" + bo.getDeptName();
|
||||||
// Workbook workbook = ExcelExportUtil.exportExcel(root, params);
|
e.put("glNum", "t." + glKey);
|
||||||
// //设置下拉
|
e.put("sgNum", "t." + sgKey);
|
||||||
// ExcelUtils.downLoadExcel(tempSheetName, response, workbook);
|
e.put("glTotalNum", glKey);
|
||||||
// } catch (IOException e) {
|
e.put("sgTotalNum", sgKey);
|
||||||
// log.error("", e);
|
colList.add(e);
|
||||||
// throw new OpenAlertException("系统错误");
|
if (Objects.equals(bo.getPersonType(), 1)) {
|
||||||
// } finally {
|
sgNum = bo.getWorkerNum() + sgNum;
|
||||||
// if (templateUrl != null) {
|
} else {
|
||||||
// FileUtil.deleteFile(templateUrl);
|
glNum = bo.getWorkerNum() + glNum;
|
||||||
// }
|
}
|
||||||
// }
|
Integer glKeyVal = Objects.equals(bo.getPersonType(), 1) ? 0 : bo.getWorkerNum();
|
||||||
|
Integer sgKeyVal = Objects.equals(bo.getPersonType(), 2) ? 0 : bo.getWorkerNum();
|
||||||
|
map.put(glKey, glKeyVal);
|
||||||
|
map.put(sgKey, sgKeyVal);
|
||||||
|
deptKeyMap.merge(glKey, glKeyVal, (o, n) -> o + n);
|
||||||
|
deptKeyMap.merge(sgKey, sgKeyVal, (o, n) -> o + n);
|
||||||
|
}
|
||||||
|
map.put("glNum", glNum);
|
||||||
|
map.put("sgNum", sgNum);
|
||||||
|
map.put("totalNum", glNum + sgNum);
|
||||||
|
listMap1.add(map);
|
||||||
|
totalGlNum += glNum;
|
||||||
|
totalSgNum += sgNum;
|
||||||
|
}
|
||||||
|
sheetMap1.putAll(deptKeyMap);
|
||||||
|
sheetMap1.put("listMap", listMap1);
|
||||||
|
sheetMap1.put("totalGlNum", totalGlNum);
|
||||||
|
sheetMap1.put("totalSgNum", totalSgNum);
|
||||||
|
sheetMap1.put("totalNum", totalGlNum + totalSgNum);
|
||||||
|
sheetMap1.put("projectName", project.getProjectName());
|
||||||
|
String enterpriseId = MapUtils.getString(param, "enterpriseId");
|
||||||
|
sheetMap1.put("hourValBegin", MapUtils.getInteger(param, "hourValBegin"));
|
||||||
|
EnterpriseInfo enterpriseInfo = enterpriseInfoService.getById(enterpriseId);
|
||||||
|
String enterpriseName = enterpriseInfo.getEnterpriseName();
|
||||||
|
sheetMap1.put("enterpriseName", enterpriseName);
|
||||||
|
sheetMap1.put("colList", colList);
|
||||||
|
root.put(0, sheetMap1);
|
||||||
|
sheetNames.add(enterpriseName + "出勤人数");
|
||||||
|
|
||||||
|
//导出sheet2上海振南考勤报表
|
||||||
|
List<StatisticsListVo> voList = this.doCountDailyAttendanceByDateRange(param).getRecords();
|
||||||
|
Map<String, Object> sheetMap2 = new HashMap<>();
|
||||||
|
int index = 0;
|
||||||
|
List<Map<String, Object>> listMap2 = new ArrayList<>();
|
||||||
|
for (StatisticsListVo vo : voList) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("no", ++index);
|
||||||
|
map.put("personType", vo.getPersonType());
|
||||||
|
map.put("enterpriseName", vo.getEnterpriseName());
|
||||||
|
map.put("workerName", vo.getWorkerName());
|
||||||
|
map.put("deptName", vo.getDeptName());
|
||||||
|
map.put("projectSn", vo.getProjectSn());
|
||||||
|
map.put("personSn", vo.getPersonSn());
|
||||||
|
map.put("workerTypeName", vo.getWorkerTypeName());
|
||||||
|
map.put("phoneNumber", vo.getPhoneNumber());
|
||||||
|
map.put("idCard", vo.getIdCard());
|
||||||
|
map.put("sex", Objects.equals(vo.getSex(), 1) ? "男" : "女");
|
||||||
|
map.put("enterDate", vo.getEnterDate());
|
||||||
|
map.put("totalHour", vo.getTotalHour());
|
||||||
|
map.put("totalAttendanceDay", vo.getTotalAttendanceDay());
|
||||||
|
for (int z = 0; z < dateTimes.size(); z++) {
|
||||||
|
DateTime dateTime = dateTimes.get(z);
|
||||||
|
sheetMap2.put("date" + (z + 1), DateUtil.format(dateTime, "M/d"));
|
||||||
|
sheetMap2.put("delete" + (z + 1), false);
|
||||||
|
//每日工时
|
||||||
|
String value = Optional.ofNullable(vo.getDailyHourMap().get(DateUtil.formatDate(dateTime))).map(decimal -> decimal.toString()).orElse("");
|
||||||
|
map.put("attendanceByDate" + (z + 1), value);
|
||||||
|
}
|
||||||
|
for (int i = dateTimes.size(); i < 31; i++) {
|
||||||
|
sheetMap2.put("delete" + (i + 1), true);
|
||||||
|
}
|
||||||
|
listMap2.add(map);
|
||||||
|
}
|
||||||
|
sheetMap2.put("listMap", listMap2);
|
||||||
|
sheetMap2.put("projectName", project.getProjectName());
|
||||||
|
sheetMap2.put("title", StrUtil.format("项目名称:{} 参建单位名称:{} 班组名称:全部 总人数:{} 时间:({} - {})",
|
||||||
|
project.getProjectName(), enterpriseName, voList.size(), startDate, endDate));
|
||||||
|
sheetMap2.put("enterpriseName", enterpriseName);
|
||||||
|
root.put(1, sheetMap2);
|
||||||
|
sheetNames.add(enterpriseName + "考勤报表");
|
||||||
|
templateUrl = Fileutils.getExportTemplateFile("excel/workerDailyAttendanceStatisticsV2/" + tempSheetName).getAbsolutePath();
|
||||||
|
String outputTemplateFilePath = PathUtil.getBasePath() + "/temp/" + IdUtil.randomUUID() + ".xlsx";
|
||||||
|
TemplateExportParams params = new TemplateExportParams(outputTemplateFilePath, true);
|
||||||
|
params.setSheetName(sheetNames.toArray(new String[]{}));
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(root, params);
|
||||||
|
ExcelUtils.downLoadExcel(tempSheetName, response, workbook);
|
||||||
|
} else if (Objects.equals(groupByType, 4)) {
|
||||||
|
//按人员
|
||||||
|
tempSheetName = "单个人员考勤出入明细报表.xlsx";
|
||||||
|
List<StatisticsListVo> voList = this.doCountDailyAttendanceByDateRange(param).getRecords();
|
||||||
|
Map<String, Map<String, List<WorkerAttendance>>> personSn2Date2AttendancesMap = workerAttendanceService.list(new LambdaQueryWrapper<WorkerAttendance>()
|
||||||
|
.eq(WorkerAttendance::getProjectSn, projectSn)
|
||||||
|
.ge(WorkerAttendance::getCreateTime, startDate)
|
||||||
|
.le(WorkerAttendance::getCreateTime, DateUtil.formatDateTime(DateUtil.endOfDay(DateUtil.parseDate(endDate))))
|
||||||
|
.select(WorkerAttendance::getPersonSn, WorkerAttendance::getCreateTime, WorkerAttendance::getPassType))
|
||||||
|
.stream().filter(w -> Objects.nonNull(w.getPersonSn())).collect(Collectors.groupingBy(WorkerAttendance::getPersonSn,
|
||||||
|
Collectors.groupingBy(o -> DateUtil.formatDate(DateUtil.parseDate(o.getCreateTime())),
|
||||||
|
Collectors.toList())));
|
||||||
|
for (StatisticsListVo vo : voList) {
|
||||||
|
Map<String, Object> sheetMap = new HashMap<>();
|
||||||
|
sheetMap.put("startDate", startDate);
|
||||||
|
sheetMap.put("endDate", endDate);
|
||||||
|
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||||
|
for (int z = 0; z < dateTimes.size(); z++) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
DateTime date = dateTimes.get(z);
|
||||||
|
map.put("date", DateUtil.formatDate(date));
|
||||||
|
map.put("week", DateUtil.dayOfWeekEnum(date).toChinese());
|
||||||
|
map.put("detail", Optional.ofNullable(personSn2Date2AttendancesMap.get(vo.getPersonSn())).map(m -> m.get(DateUtil.formatDate(date)))
|
||||||
|
.map(attendances -> attendances.stream().sorted(Comparator.comparing(WorkerAttendance::getCreateTime))
|
||||||
|
.map(att -> DateUtil.format(DateUtil.parseDateTime(att.getCreateTime()), "HH:mm") + (att.getPassType() == 1 ? "入场" : "出场")).collect(Collectors.joining("\n"))).orElse(""));
|
||||||
|
listMap.add(map);
|
||||||
|
}
|
||||||
|
root.put(sheetIndex++, sheetMap);
|
||||||
|
sheetMap.put("projectName", project.getProjectName());
|
||||||
|
sheetMap.put("personType", vo.getPersonType() == 1 ? "班组" : "部门");
|
||||||
|
sheetMap.put("enterpriseName", vo.getEnterpriseName());
|
||||||
|
sheetMap.put("workerName", vo.getWorkerName());
|
||||||
|
sheetMap.put("deptName", vo.getDeptName());
|
||||||
|
sheetMap.put("workerTypeName", vo.getWorkerTypeName());
|
||||||
|
sheetMap.put("totalAttendanceDay", vo.getTotalAttendanceDay());
|
||||||
|
sheetNames.add(vo.getWorkerName());
|
||||||
|
}
|
||||||
|
templateUrl = Fileutils.getExportTemplateFile("excel/workerDailyAttendanceStatisticsV2/" + tempSheetName).getAbsolutePath();
|
||||||
|
String outputTemplateFilePath = PathUtil.getBasePath() + "/temp/" + IdUtil.randomUUID() + ".xlsx";
|
||||||
|
EasyPoiUtil.cloneSheetMultipleTimes(templateUrl, outputTemplateFilePath, "1", sheetNames.size() - 1);
|
||||||
|
TemplateExportParams params = new TemplateExportParams(outputTemplateFilePath, true);
|
||||||
|
params.setSheetName(sheetNames.toArray(new String[]{}));
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(root, params);
|
||||||
|
ExcelUtils.downLoadExcel(tempSheetName, response, workbook);
|
||||||
|
} else if (Objects.equals(groupByType, 1)) {
|
||||||
|
//按项目
|
||||||
|
tempSheetName = "考勤月报-按项目.xlsx";
|
||||||
|
param.put("startTime", startDate);
|
||||||
|
param.put("endTime", endDate);
|
||||||
|
param.put("pageSize", -1);
|
||||||
|
List<StatisticsListVo> vos = this.doCountDailyAttendanceByDateRange(param).getRecords();
|
||||||
|
Map<String, Map<String, List<WorkerAttendance>>> personSn2Date2AttendancesMap = workerAttendanceService.list(new LambdaQueryWrapper<WorkerAttendance>()
|
||||||
|
.eq(WorkerAttendance::getProjectSn, projectSn)
|
||||||
|
.ge(WorkerAttendance::getCreateTime, startDate)
|
||||||
|
.le(WorkerAttendance::getCreateTime, DateUtil.formatDateTime(DateUtil.endOfDay(DateUtil.parseDate(endDate))))
|
||||||
|
.select(WorkerAttendance::getPersonSn, WorkerAttendance::getCreateTime, WorkerAttendance::getPassType))
|
||||||
|
.stream().filter(w -> Objects.nonNull(w.getPersonSn())).collect(Collectors.groupingBy(WorkerAttendance::getPersonSn,
|
||||||
|
Collectors.groupingBy(o -> DateUtil.formatDate(DateUtil.parseDate(o.getCreateTime())),
|
||||||
|
Collectors.toList())));
|
||||||
|
BigDecimal totalAttendanceDay = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalHour = BigDecimal.ZERO;
|
||||||
|
Map<String, Object> sheetMap = new HashMap<>();
|
||||||
|
List<Map<String, Object>> listMap = new ArrayList<>();
|
||||||
|
int index = 0;
|
||||||
|
for (StatisticsListVo vo : vos) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("no", ++index);
|
||||||
|
map.put("personType", vo.getPersonType());
|
||||||
|
map.put("enterpriseName", vo.getEnterpriseName());
|
||||||
|
map.put("workerName", vo.getWorkerName());
|
||||||
|
map.put("deptName", vo.getDeptName());
|
||||||
|
map.put("projectSn", vo.getProjectSn());
|
||||||
|
map.put("personSn", vo.getPersonSn());
|
||||||
|
map.put("workerTypeName", vo.getWorkerTypeName());
|
||||||
|
map.put("phoneNumber", vo.getPhoneNumber());
|
||||||
|
map.put("idCard", vo.getIdCard());
|
||||||
|
map.put("sex", Objects.equals(vo.getSex(), 1) ? "男" : "女");
|
||||||
|
map.put("enterDate", vo.getEnterDate());
|
||||||
|
for (int z = 0; z < dateTimes.size(); z++) {
|
||||||
|
DateTime dateTime = dateTimes.get(z);
|
||||||
|
sheetMap.put("date" + (z + 1), DateUtil.format(dateTime, "M/d"));
|
||||||
|
sheetMap.put("delete" + (z + 1), false);
|
||||||
|
String value;
|
||||||
|
if (Objects.equals(downloadType, 1) || Objects.equals(downloadType, 2)) {
|
||||||
|
value = getExcelAmPmAttendanceByDate(personSn2Date2AttendancesMap, vo, dateTime, downloadType);
|
||||||
|
} else if (Objects.equals(downloadType, 3)) {
|
||||||
|
//每日工时
|
||||||
|
value = Optional.ofNullable(vo.getDailyHourMap().get(DateUtil.formatDate(dateTime))).map(decimal -> decimal.toString()).orElse("");
|
||||||
|
} else {
|
||||||
|
//每日明细
|
||||||
|
value = Optional.ofNullable(vo.getDailyAttendanceMap().get(DateUtil.formatDate(dateTime))).map(integer -> Objects.equals(integer, 1) ? "√" : "×").orElse("x");
|
||||||
|
}
|
||||||
|
map.put("attendanceByDate" + (z + 1), value);
|
||||||
|
}
|
||||||
|
for (int i = dateTimes.size(); i < 31; i++) {
|
||||||
|
sheetMap.put("delete" + (i + 1), true);
|
||||||
|
}
|
||||||
|
map.put("totalHour", vo.getTotalHour());
|
||||||
|
map.put("totalAttendanceDay", vo.getTotalAttendanceDay());
|
||||||
|
totalAttendanceDay = NumberUtil.add(vo.getTotalAttendanceDay(), totalAttendanceDay);
|
||||||
|
totalHour = NumberUtil.add(vo.getTotalHour(), totalHour);
|
||||||
|
listMap.add(map);
|
||||||
|
}
|
||||||
|
sheetMap.put("listMap", listMap);
|
||||||
|
sheetMap.put("totalAttendanceDay", totalAttendanceDay);
|
||||||
|
sheetMap.put("totalWorkerNum", vos.size());
|
||||||
|
sheetMap.put("totalHour", totalHour);
|
||||||
|
sheetMap.put("startDate", startDate);
|
||||||
|
sheetMap.put("endDate", endDate);
|
||||||
|
sheetMap.put("projectName", project.getProjectName());
|
||||||
|
root.put(0, sheetMap);
|
||||||
|
sheetNames.add(project.getProjectName());
|
||||||
|
templateUrl = Fileutils.getExportTemplateFile("excel/workerDailyAttendanceStatisticsV2/" + tempSheetName).getAbsolutePath();
|
||||||
|
String outputTemplateFilePath = PathUtil.getBasePath() + "/temp/" + IdUtil.randomUUID() + ".xlsx";
|
||||||
|
TemplateExportParams params = new TemplateExportParams(outputTemplateFilePath, true);
|
||||||
|
params.setSheetName(sheetNames.toArray(new String[]{}));
|
||||||
|
Workbook workbook = ExcelExportUtil.exportExcel(root, params);
|
||||||
|
ExcelUtils.downLoadExcel(tempSheetName, response, workbook);
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
log.error("", e);
|
||||||
|
throw new OpenAlertException("系统错误");
|
||||||
|
} finally {
|
||||||
|
if (templateUrl != null) {
|
||||||
|
FileUtil.deleteFile(templateUrl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一天上下午/进出场打卡,格式:
|
||||||
|
* 07:19入场;
|
||||||
|
* 17:39出场
|
||||||
|
*
|
||||||
|
* @param personSn2Date2AttendancesMap
|
||||||
|
* @param vo
|
||||||
|
* @param dateTime
|
||||||
|
* @param downloadType 1上下午打卡2进出场打卡
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getExcelAmPmAttendanceByDate(Map<String, Map<String, List<WorkerAttendance>>> personSn2Date2AttendancesMap, StatisticsListVo vo, DateTime dateTime, Integer downloadType) {
|
||||||
|
String attendanceByDate = "";
|
||||||
|
Optional<List<WorkerAttendance>> workerAttendances = Optional.ofNullable(personSn2Date2AttendancesMap.get(vo.getPersonSn())).map(m -> m.get(DateUtil.formatDate(dateTime)));
|
||||||
|
WorkerAttendance first = workerAttendances.map(attendances -> downloadType == 1 ? getFirstTimeAm(attendances) : getFirstInTime(attendances)).orElse(null);
|
||||||
|
if (first != null) {
|
||||||
|
attendanceByDate = DateUtil.format(DateUtil.parseDateTime(first.getCreateTime()), "HH:mm") + (first.getPassType() == 1 ? "入场" : "出场");
|
||||||
|
}
|
||||||
|
WorkerAttendance end = workerAttendances.map(attendances -> downloadType == 1 ? getEndTimePm(attendances) : getEndOutTime(attendances)).orElse(null);
|
||||||
|
if (end != null) {
|
||||||
|
if (StrUtil.isNotBlank(attendanceByDate)) {
|
||||||
|
attendanceByDate += "\n";
|
||||||
|
}
|
||||||
|
attendanceByDate += DateUtil.format(DateUtil.parseDateTime(end.getCreateTime()), "HH:mm") + (end.getPassType() == 1 ? "入场" : "出场");
|
||||||
|
}
|
||||||
|
return attendanceByDate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
package com.zhgd.xmgl.modules.worker.entity.bo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo {
|
||||||
|
/**
|
||||||
|
* 人员类型 1、劳务人员 2、管理人员
|
||||||
|
*/
|
||||||
|
private java.lang.Integer personType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private java.lang.String date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 班组/部门
|
||||||
|
*/
|
||||||
|
private java.lang.String deptName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人数
|
||||||
|
*/
|
||||||
|
private java.lang.Integer workerNum;
|
||||||
|
}
|
||||||
@ -64,4 +64,50 @@ public class StatisticsListVo {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value = "人员sn")
|
@ApiModelProperty(value = "人员sn")
|
||||||
private java.lang.String personSn;
|
private java.lang.String personSn;
|
||||||
|
/**
|
||||||
|
* 劳务人员Id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "劳务人员Id")
|
||||||
|
private java.lang.Long workerId;
|
||||||
|
/**
|
||||||
|
* 工种名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "工种名称")
|
||||||
|
private String workerTypeName;
|
||||||
|
/**
|
||||||
|
* 手机号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "手机号")
|
||||||
|
private java.lang.String phoneNumber;
|
||||||
|
/**
|
||||||
|
* 身份证号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "身份证号")
|
||||||
|
private java.lang.String idCard;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "性别,1男,2女")
|
||||||
|
private java.lang.Integer sex;
|
||||||
|
/**
|
||||||
|
* 进场日期
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "进场日期")
|
||||||
|
private java.lang.String enterDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 项目sn
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "项目sn")
|
||||||
|
private java.lang.String projectSn;
|
||||||
|
/**
|
||||||
|
* 工人工资卡银行开户行名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "工人工资卡银行开户行名称")
|
||||||
|
private java.lang.String payRollBankName;
|
||||||
|
/**
|
||||||
|
* 工人银行卡号
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(value = "工人银行卡号")
|
||||||
|
private java.lang.String payRollBankNumber;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerDailyAttendanceStatisticsV2;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerDailyAttendanceStatisticsV2;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.bo.CountWorkerDailyAttendanceStatisticsV2ByDateBo;
|
import com.zhgd.xmgl.modules.worker.entity.bo.CountWorkerDailyAttendanceStatisticsV2ByDateBo;
|
||||||
|
import com.zhgd.xmgl.modules.worker.entity.bo.ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -79,4 +80,6 @@ public interface WorkerDailyAttendanceStatisticsV2Mapper extends BaseMapper<Work
|
|||||||
List<CountByEnterpriseVo> countNumByEnterprise(HashMap<String, Object> param);
|
List<CountByEnterpriseVo> countNumByEnterprise(HashMap<String, Object> param);
|
||||||
|
|
||||||
List<CountNumByWorkerTypeVo> countNumByWorkerType(HashMap<String, Object> param);
|
List<CountNumByWorkerTypeVo> countNumByWorkerType(HashMap<String, Object> param);
|
||||||
|
|
||||||
|
List<ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo> countExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo(HashMap<String, Object> param);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -55,6 +55,7 @@
|
|||||||
,ei.id as enterprise_id
|
,ei.id as enterprise_id
|
||||||
,if(c.id is not null,c.id,d.id) as department_team_id
|
,if(c.id is not null,c.id,d.id) as department_team_id
|
||||||
,if(c.team_name is not null,c.team_name,d.department_name) as department_team_name
|
,if(c.team_name is not null,c.team_name,d.department_name) as department_team_name
|
||||||
|
,b.id as worker_id
|
||||||
from worker_attendance a
|
from worker_attendance a
|
||||||
LEFT JOIN worker_info b ON a.person_sn = b.person_sn
|
LEFT JOIN worker_info b ON a.person_sn = b.person_sn
|
||||||
LEFT JOIN team_info c ON b.team_id = c.id
|
LEFT JOIN team_info c ON b.team_id = c.id
|
||||||
|
|||||||
@ -49,7 +49,7 @@
|
|||||||
resultType="com.zhgd.xmgl.modules.worker.entity.vo.CountWorkerDailyAttendanceStatisticsV2Vo">
|
resultType="com.zhgd.xmgl.modules.worker.entity.vo.CountWorkerDailyAttendanceStatisticsV2Vo">
|
||||||
select
|
select
|
||||||
t.*
|
t.*
|
||||||
,ifnull(round(t.total_in_service_num/t.total_attendance_num*100,2),0) as attendance_rate_avg
|
,ifnull(round(t.total_attendance_num/t.total_in_service_num*100,2),0) as attendance_rate_avg
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
count(*) as total_in_service_num
|
count(*) as total_in_service_num
|
||||||
@ -57,11 +57,11 @@
|
|||||||
,ifnull(sum(t.hour_val),0) as hour_val_total
|
,ifnull(sum(t.hour_val),0) as hour_val_total
|
||||||
from worker_daily_attendance_statistics_v2 t
|
from worker_daily_attendance_statistics_v2 t
|
||||||
JOIN worker_info a on t.person_sn=a.person_sn
|
JOIN worker_info a on t.person_sn=a.person_sn
|
||||||
JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
LEFT JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
||||||
JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
LEFT JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
||||||
JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
LEFT JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
||||||
JOIN enterprise_info en ON en.id = a.enterprise_id
|
JOIN enterprise_info en ON en.id = a.enterprise_id
|
||||||
INNER JOIN project_enterprise pe ON a.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
INNER JOIN project_enterprise pe ON en.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
||||||
where t.project_sn=#{projectSn}
|
where t.project_sn=#{projectSn}
|
||||||
<if test="personSn != null and personSn != ''">
|
<if test="personSn != null and personSn != ''">
|
||||||
and a.person_sn = #{personSn}
|
and a.person_sn = #{personSn}
|
||||||
@ -97,7 +97,7 @@
|
|||||||
resultType="com.zhgd.xmgl.modules.worker.entity.bo.CountWorkerDailyAttendanceStatisticsV2ByDateBo">
|
resultType="com.zhgd.xmgl.modules.worker.entity.bo.CountWorkerDailyAttendanceStatisticsV2ByDateBo">
|
||||||
select
|
select
|
||||||
t.*
|
t.*
|
||||||
,ifnull(round(t.total_in_service_num/t.total_attendance_num*100,2),0) as attendance_rate_avg
|
,ifnull(round(t.total_attendance_num/t.total_in_service_num*100,2),0) as attendance_rate_avg
|
||||||
from (
|
from (
|
||||||
select
|
select
|
||||||
<if test="startMonth != null and startMonth != ''">
|
<if test="startMonth != null and startMonth != ''">
|
||||||
@ -110,11 +110,11 @@
|
|||||||
,ifnull(sum(t.is_attendance),0) as total_attendance_num
|
,ifnull(sum(t.is_attendance),0) as total_attendance_num
|
||||||
from worker_daily_attendance_statistics_v2 t
|
from worker_daily_attendance_statistics_v2 t
|
||||||
JOIN worker_info a on t.person_sn=a.person_sn
|
JOIN worker_info a on t.person_sn=a.person_sn
|
||||||
JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
LEFT JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
||||||
JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
LEFT JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
||||||
JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
LEFT JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
||||||
JOIN enterprise_info en ON en.id = a.enterprise_id
|
JOIN enterprise_info en ON en.id = a.enterprise_id
|
||||||
INNER JOIN project_enterprise pe ON a.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
INNER JOIN project_enterprise pe ON en.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
||||||
where t.project_sn=#{projectSn}
|
where t.project_sn=#{projectSn}
|
||||||
<if test="enterpriseTypeId != null and enterpriseTypeId != ''">
|
<if test="enterpriseTypeId != null and enterpriseTypeId != ''">
|
||||||
and pe.enterprise_type_id = #{enterpriseTypeId}
|
and pe.enterprise_type_id = #{enterpriseTypeId}
|
||||||
@ -152,11 +152,11 @@
|
|||||||
,ifnull(sum(t.day_val),0) as day_val_total
|
,ifnull(sum(t.day_val),0) as day_val_total
|
||||||
from worker_daily_attendance_statistics_v2 t
|
from worker_daily_attendance_statistics_v2 t
|
||||||
JOIN worker_info a on t.person_sn=a.person_sn
|
JOIN worker_info a on t.person_sn=a.person_sn
|
||||||
JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
LEFT JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
||||||
JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
LEFT JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
||||||
JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
LEFT JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
||||||
JOIN enterprise_info en ON en.id = a.enterprise_id
|
JOIN enterprise_info en ON en.id = a.enterprise_id
|
||||||
INNER JOIN project_enterprise pe ON a.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
INNER JOIN project_enterprise pe ON en.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
||||||
where t.project_sn=#{projectSn}
|
where t.project_sn=#{projectSn}
|
||||||
<if test="enterpriseTypeId != null and enterpriseTypeId != ''">
|
<if test="enterpriseTypeId != null and enterpriseTypeId != ''">
|
||||||
and pe.enterprise_type_id = #{enterpriseTypeId}
|
and pe.enterprise_type_id = #{enterpriseTypeId}
|
||||||
@ -195,11 +195,11 @@
|
|||||||
,ifnull(sum(t.is_attendance),0) as worker_count
|
,ifnull(sum(t.is_attendance),0) as worker_count
|
||||||
from worker_daily_attendance_statistics_v2 t
|
from worker_daily_attendance_statistics_v2 t
|
||||||
JOIN worker_info a on t.person_sn=a.person_sn
|
JOIN worker_info a on t.person_sn=a.person_sn
|
||||||
JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
LEFT JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
||||||
JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
LEFT JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
||||||
JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
LEFT JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
||||||
JOIN enterprise_info en ON en.id = a.enterprise_id
|
JOIN enterprise_info en ON en.id = a.enterprise_id
|
||||||
JOIN project_enterprise pe ON a.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
JOIN project_enterprise pe ON en.id = pe.enterprise_id and pe.project_sn=t.project_sn
|
||||||
where t.project_sn=#{projectSn}
|
where t.project_sn=#{projectSn}
|
||||||
<if test="personType != null and personType != ''">
|
<if test="personType != null and personType != ''">
|
||||||
and a.person_type = #{personType}
|
and a.person_type = #{personType}
|
||||||
@ -239,4 +239,30 @@
|
|||||||
</if>
|
</if>
|
||||||
group by wt.id) t
|
group by wt.id) t
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="countExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo"
|
||||||
|
resultType="com.zhgd.xmgl.modules.worker.entity.bo.ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo">
|
||||||
|
select
|
||||||
|
if(a.person_type=1,b.team_name,c.department_name) dept_name
|
||||||
|
,a.person_type
|
||||||
|
,t.attendance_date date
|
||||||
|
,count(*) as worker_num
|
||||||
|
from worker_daily_attendance_statistics_v2 t
|
||||||
|
JOIN worker_info a on t.person_sn=a.person_sn
|
||||||
|
LEFT JOIN team_info b ON a.team_id = b.id and a.person_type = 1
|
||||||
|
LEFT JOIN department_info c ON a.department_id = c.id and a.person_type = 2
|
||||||
|
LEFT JOIN worker_type wt ON b.worker_type_id = wt.id and a.person_type = 1
|
||||||
|
LEFT JOIN enterprise_info en ON en.id = a.enterprise_id
|
||||||
|
where a.project_sn=#{projectSn} and a.person_type in (1,2)
|
||||||
|
<if test="hourValBegin != null and hourValBegin != ''">
|
||||||
|
and t.hour_val >= #{hourValBegin}
|
||||||
|
</if>
|
||||||
|
<if test="startDate != null and startDate != ''">
|
||||||
|
and t.attendance_date >= #{startDate}
|
||||||
|
</if>
|
||||||
|
<if test="endDate != null and endDate != ''">
|
||||||
|
and t.attendance_date <![CDATA[<=]]> concat(#{endDate},' 23:59:59')
|
||||||
|
</if>
|
||||||
|
group by t.attendance_date,if(a.person_type=1,b.team_name,c.department_name)
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import com.zhgd.xmgl.base.entity.vo.echarts.ChartDataVo;
|
|||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceRuleV2;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendanceRuleV2;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerDailyAttendanceStatisticsV2;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerDailyAttendanceStatisticsV2;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.bo.CalAttendanceBo;
|
import com.zhgd.xmgl.modules.worker.entity.bo.CalAttendanceBo;
|
||||||
|
import com.zhgd.xmgl.modules.worker.entity.bo.ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerDailyAttendanceStatisticsV2Dto;
|
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerDailyAttendanceStatisticsV2Dto;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
||||||
|
|
||||||
@ -101,4 +102,12 @@ public interface IWorkerDailyAttendanceStatisticsV2Service extends IService<Work
|
|||||||
List<CountByEnterpriseVo> countNumByEnterprise(HashMap<String, Object> param);
|
List<CountByEnterpriseVo> countNumByEnterprise(HashMap<String, Object> param);
|
||||||
|
|
||||||
List<CountNumByWorkerTypeVo> countNumByWorkerType(HashMap<String, Object> param);
|
List<CountNumByWorkerTypeVo> countNumByWorkerType(HashMap<String, Object> param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取导出的
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo> countExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo(HashMap<String, Object> param);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,6 +19,7 @@ import com.zhgd.xmgl.modules.project.service.IProjectEnterpriseService;
|
|||||||
import com.zhgd.xmgl.modules.worker.entity.*;
|
import com.zhgd.xmgl.modules.worker.entity.*;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.bo.CalAttendanceBo;
|
import com.zhgd.xmgl.modules.worker.entity.bo.CalAttendanceBo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.bo.CountWorkerDailyAttendanceStatisticsV2ByDateBo;
|
import com.zhgd.xmgl.modules.worker.entity.bo.CountWorkerDailyAttendanceStatisticsV2ByDateBo;
|
||||||
|
import com.zhgd.xmgl.modules.worker.entity.bo.ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.bo.Hour2dayJsonBo;
|
import com.zhgd.xmgl.modules.worker.entity.bo.Hour2dayJsonBo;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerDailyAttendanceStatisticsV2Dto;
|
import com.zhgd.xmgl.modules.worker.entity.dto.WorkerDailyAttendanceStatisticsV2Dto;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
import com.zhgd.xmgl.modules.worker.entity.vo.*;
|
||||||
@ -450,7 +451,12 @@ public class WorkerDailyAttendanceStatisticsV2ServiceImpl extends ServiceImpl<Wo
|
|||||||
for (DateTime dateTime : range) {
|
for (DateTime dateTime : range) {
|
||||||
for (WorkerInfo worker : workerInfos) {
|
for (WorkerInfo worker : workerInfos) {
|
||||||
WorkerAttendanceRuleV2 ruleV2 = Optional.ofNullable(worker.getAttendanceGroupV2Id()).map(groupToRuleMap::get).orElse(null);
|
WorkerAttendanceRuleV2 ruleV2 = Optional.ofNullable(worker.getAttendanceGroupV2Id()).map(groupToRuleMap::get).orElse(null);
|
||||||
this.calAndSaveStatistics(worker.getProjectSn(), worker.getPersonSn(), worker.getInserviceType(), dateTime, ruleV2, attendances, allAttendances);
|
Integer inserviceType = worker.getInserviceType();
|
||||||
|
if (DateUtil.compare(StrUtil.isNotBlank(worker.getEnterDate()) ? DateUtil.parseDate(worker.getEnterDate()) : worker.getAddTime(), dateTime) > 0) {
|
||||||
|
//没入场不在职
|
||||||
|
inserviceType = 2;
|
||||||
|
}
|
||||||
|
this.calAndSaveStatistics(worker.getProjectSn(), worker.getPersonSn(), inserviceType, dateTime, ruleV2, attendances, allAttendances);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,4 +594,9 @@ public class WorkerDailyAttendanceStatisticsV2ServiceImpl extends ServiceImpl<Wo
|
|||||||
return baseMapper.countNumByWorkerType(param);
|
return baseMapper.countNumByWorkerType(param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo> countExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo(HashMap<String, Object> param) {
|
||||||
|
return baseMapper.countExportWorkerDailyAttendancesStaticsByDepartmentTeamXlsBo(param);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import cn.hutool.poi.excel.ExcelWriter;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@ -617,6 +618,10 @@ public class WorkerInfoServiceImpl extends ServiceImpl<WorkerInfoMapper, WorkerI
|
|||||||
if (Objects.equals(oldWorkerInfo.getInserviceType(), WorkerInfInserviceTypeoEnum.OUT.getCode()) && Objects.equals(workerInfo.getInserviceType(), 1)) {
|
if (Objects.equals(oldWorkerInfo.getInserviceType(), WorkerInfInserviceTypeoEnum.OUT.getCode()) && Objects.equals(workerInfo.getInserviceType(), 1)) {
|
||||||
workerInfo.setSafeScore(oldWorkerInfo.getExitSafeScore());
|
workerInfo.setSafeScore(oldWorkerInfo.getExitSafeScore());
|
||||||
}
|
}
|
||||||
|
workerInfoService.update(null, new LambdaUpdateWrapper<WorkerInfo>()
|
||||||
|
.set(WorkerInfo::getAttendanceGroupV2Id, workerInfo.getAttendanceGroupV2Id())
|
||||||
|
.eq(WorkerInfo::getId, workerInfo.getId())
|
||||||
|
);
|
||||||
workerInfoMapper.updateById(workerInfo);
|
workerInfoMapper.updateById(workerInfo);
|
||||||
systemUserService.updateRealNameFromWorker(workerInfo.getId(), workerInfo.getWorkerName());
|
systemUserService.updateRealNameFromWorker(workerInfo.getId(), workerInfo.getWorkerName());
|
||||||
boolean hikvisionConfig = projectUfaceConfigService.isHikvisionConfig(workerInfo.getProjectSn());
|
boolean hikvisionConfig = projectUfaceConfigService.isHikvisionConfig(workerInfo.getProjectSn());
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user