|
@@ -381,7 +381,9 @@ public class WorkScheduleAttendanceController {
|
|
BigDecimal leaveNum = requestForLeaveInfoService.sumDaysByPersonIdAndTimeRange(pi.getId(),startDate,endDate);
|
|
BigDecimal leaveNum = requestForLeaveInfoService.sumDaysByPersonIdAndTimeRange(pi.getId(),startDate,endDate);
|
|
wsaDTO.setLeaveNum(leaveNum);
|
|
wsaDTO.setLeaveNum(leaveNum);
|
|
|
|
|
|
- wsaList.add(wsaDTO);
|
|
|
|
|
|
+ String remark = queryRemark(String.valueOf(pi.getId()),startMonth,endMonth);
|
|
|
|
+ wsaDTO.setRemark(remark);
|
|
|
|
+ wsaList.add(wsaDTO);
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -403,6 +405,82 @@ public class WorkScheduleAttendanceController {
|
|
return msgResult;
|
|
return msgResult;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ public String queryRemark(String personId,String startMonth,String endMonth){
|
|
|
|
+
|
|
|
|
+ String workShiftDayNotes = "";
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Map<String, Object> searchParams = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(personId)) {
|
|
|
|
+ searchParams.put("personId", personId);
|
|
|
|
+ }else{
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<String> months = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ if (StringUtils.isNotEmpty(startMonth) && StringUtils.isNotEmpty(endMonth)) {
|
|
|
|
+ searchParams.put("startMonth", startMonth + "%");
|
|
|
|
+ searchParams.put("endMonth", endMonth + "%");
|
|
|
|
+
|
|
|
|
+ months.add(startMonth + "%");
|
|
|
|
+ months.add(endMonth + "%");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ PersonInfo pi = personInfoService.get(Long.valueOf(personId));
|
|
|
|
+
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ //获取需要统计的日期
|
|
|
|
+ List<Date> schedulingDayList = workPersonSchedulingService.findSchedulingDayByPersonIdSDateAndEDate(pi.getId(), sdf.parse(startMonth), sdf.parse(endMonth), true);
|
|
|
|
+
|
|
|
|
+ //统计班次次数
|
|
|
|
+ Map<String,Object> workShiftDayMap = new HashMap<>();
|
|
|
|
+
|
|
|
|
+ for(Date attendanceDate : schedulingDayList) {
|
|
|
|
+ WorkPersonScheduling wps = workPersonSchedulingService.findByPersonIdSchedulingDay(pi.getId(), attendanceDate);
|
|
|
|
+ PersonInfoDayWSADTO wsaDayDTO = new PersonInfoDayWSADTO();
|
|
|
|
+ if (wps != null) {
|
|
|
|
+ String shifts = wps.getShiftIds();
|
|
|
|
+
|
|
|
|
+ if (shifts != null) {
|
|
|
|
+ String[] shiftIds = shifts.split(",");
|
|
|
|
+ for (int i = 0; i < shiftIds.length; i++) {
|
|
|
|
+ String shiftId = shiftIds[i];
|
|
|
|
+
|
|
|
|
+ WorkShiftInfo workShiftInfo = workShiftInfoService.get(shiftId);
|
|
|
|
+
|
|
|
|
+ int workShiftNum = 0;
|
|
|
|
+ if(workShiftDayMap.get(workShiftInfo.getName()) != null){
|
|
|
|
+ workShiftNum = Integer.parseInt(workShiftDayMap.get(workShiftInfo.getName()).toString());
|
|
|
|
+ }
|
|
|
|
+ if(workShiftNum > 0){
|
|
|
|
+ workShiftDayMap.replace(workShiftInfo.getName(),workShiftNum+1);
|
|
|
|
+ }else{
|
|
|
|
+ workShiftDayMap.put(workShiftInfo.getName(),workShiftNum+1);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ Set<Map.Entry<String, Object>> entryseSet = workShiftDayMap.entrySet();
|
|
|
|
+
|
|
|
|
+ for (Map.Entry<String, Object> entry:entryseSet) {
|
|
|
|
+ workShiftDayNotes = workShiftDayNotes + "" + entry.getKey()+":"+entry.getValue() + "次;";
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }catch (Exception ex){
|
|
|
|
+ ex.printStackTrace();
|
|
|
|
+ logger.error(ex.getMessage(),ex);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return workShiftDayNotes;
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation(value="后勤-考勤按月统计")
|
|
@ApiOperation(value="后勤-考勤按月统计")
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParam(name="companyId",value = "单位编号",required = true,paramType = "form"),
|
|
@ApiImplicitParam(name="companyId",value = "单位编号",required = true,paramType = "form"),
|
|
@@ -1956,6 +2034,8 @@ public class WorkScheduleAttendanceController {
|
|
cellTitle13.setCellValue("出差天数");
|
|
cellTitle13.setCellValue("出差天数");
|
|
XSSFCell cellTitle14 = rowTitle.createCell(14);
|
|
XSSFCell cellTitle14 = rowTitle.createCell(14);
|
|
cellTitle14.setCellValue("请假天数");
|
|
cellTitle14.setCellValue("请假天数");
|
|
|
|
+ XSSFCell cellTitle15 = rowTitle.createCell(15);
|
|
|
|
+ cellTitle15.setCellValue("备注");
|
|
|
|
|
|
JSONArray array = requestBody.getJSONArray("data");
|
|
JSONArray array = requestBody.getJSONArray("data");
|
|
|
|
|
|
@@ -2015,6 +2095,8 @@ public class WorkScheduleAttendanceController {
|
|
|
|
|
|
row.createCell(colIndex).setCellValue(jsonObject.getString("leaveNum"));
|
|
row.createCell(colIndex).setCellValue(jsonObject.getString("leaveNum"));
|
|
colIndex++;
|
|
colIndex++;
|
|
|
|
+ row.createCell(colIndex).setCellValue(jsonObject.getString("remark"));
|
|
|
|
+ colIndex++;
|
|
|
|
|
|
//todo 将wb保存到oss
|
|
//todo 将wb保存到oss
|
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
|
ByteArrayOutputStream output = new ByteArrayOutputStream();
|