From 69c3106e2dc7f255619730ff93b42efebce4b672 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E6=88=90?= <2847920761@qq.com> Date: Mon, 17 Mar 2025 11:45:27 +0800 Subject: [PATCH] =?UTF-8?q?3.17=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wgz/controller/WgzAppController.java | 4 +-- .../wgz/bo/req/WgzAppDailyRecordReq.java | 2 ++ .../WgzAppUserPunchTheCalendarRecordReq.java | 20 +++++++++++++++ .../wgz/service/IWgzAttendanceService.java | 3 ++- .../impl/WgzAttendanceServiceImpl.java | 25 ++++++++++--------- .../impl/WgzDailyClockServiceImpl.java | 11 ++++---- .../mapper/wgz/WgzDailyClockMapper.xml | 6 +++-- 7 files changed, 48 insertions(+), 23 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppUserPunchTheCalendarRecordReq.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java index 6302462..8858540 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzAppController.java @@ -304,8 +304,8 @@ @ApiOperation("【考勤打卡】【打卡日历】 打卡日历记录") //@PreAuthorize("@ss.hasPermi('wgzApp:user:userPunchTheCalendarRecord')") @GetMapping("/WgzAppUserPunchTheCalendarRecord") - public AjaxResult userPunchTheCalendarRecord() { - return AjaxResult.success(iWgzAttendanceService.userPunchTheCalendarRecord()); + public AjaxResult userPunchTheCalendarRecord(@Validated WgzAppUserPunchTheCalendarRecordReq req) { + return AjaxResult.success(iWgzAttendanceService.userPunchTheCalendarRecord(req)); } /** diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppDailyRecordReq.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppDailyRecordReq.java index 060479a..9ce35fa 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppDailyRecordReq.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppDailyRecordReq.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; +import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDate; @@ -21,5 +22,6 @@ public class WgzAppDailyRecordReq extends PageReq { private String types; @ApiModelProperty(value = "日期(格式:年-月-日)") + @DateTimeFormat(pattern = "yyyy-MM-dd") private LocalDate rq; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppUserPunchTheCalendarRecordReq.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppUserPunchTheCalendarRecordReq.java new file mode 100644 index 0000000..359ac05 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppUserPunchTheCalendarRecordReq.java @@ -0,0 +1,20 @@ +package com.ruoyi.wgz.bo.req; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import java.io.Serializable; + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("务工者APP-打卡日历请求对象") +public class WgzAppUserPunchTheCalendarRecordReq implements Serializable { + @ApiModelProperty("年月日期:2025-02") + @NotBlank(message = "年月不能为空") + private String yearMonth; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzAttendanceService.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzAttendanceService.java index 807991c..118c36f 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzAttendanceService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzAttendanceService.java @@ -10,6 +10,7 @@ import com.ruoyi.common.core.mybatisplus.core.IServicePlus; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.wgz.bo.WgzAttendanceQueryBo; import com.ruoyi.wgz.bo.req.WgzAppSubmitTheClockReq; +import com.ruoyi.wgz.bo.req.WgzAppUserPunchTheCalendarRecordReq; import com.ruoyi.wgz.bo.res.WgzAppCardReplacementApplicationRes; import com.ruoyi.wgz.bo.res.WgzAppPunchTheCalendarRecordRes; import com.ruoyi.wgz.bo.res.WgzAppUserClockingConditionRes; @@ -86,7 +87,7 @@ public interface IWgzAttendanceService extends IServicePlus { /** * 打卡日历记录 */ - WgzAppPunchTheCalendarRecordRes userPunchTheCalendarRecord(); + WgzAppPunchTheCalendarRecordRes userPunchTheCalendarRecord(@Validated WgzAppUserPunchTheCalendarRecordReq req); /** * 根据id查询具体的打卡详情 diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java index bd12859..b4a156e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzAttendanceServiceImpl.java @@ -25,6 +25,7 @@ import com.ruoyi.fbs.domain.FbsProjectTask; import com.ruoyi.fbs.service.IFbsProjectTaskService; import com.ruoyi.wgz.bo.WgzAttendanceQueryBo; import com.ruoyi.wgz.bo.req.WgzAppSubmitTheClockReq; +import com.ruoyi.wgz.bo.req.WgzAppUserPunchTheCalendarRecordReq; import com.ruoyi.wgz.bo.res.WgzAppCardReplacementApplicationRes; import com.ruoyi.wgz.bo.res.WgzAppPunchTheCalendarRecordRes; import com.ruoyi.wgz.bo.res.WgzAppUserClockingConditionRes; @@ -40,12 +41,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.validation.annotation.Validated; import java.text.DecimalFormat; -import java.time.Duration; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; +import java.time.*; import java.time.format.DateTimeFormatter; import java.time.temporal.TemporalAdjusters; import java.util.*; @@ -295,11 +294,13 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl dates = new ArrayList<>(); @@ -308,35 +309,35 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl apply = new LambdaQueryWrapper(). eq(WgzAttendance::getUserId, appUserId). eq(WgzAttendance::getRecruitId, by.getRecruitId()). - apply("DATE_FORMAT(date, '%Y-%m') = {0}", format); + apply("DATE_FORMAT(date, '%Y-%m') = {0}", req.getYearMonth()); List wgzAttendances = baseMapper.selectList(apply); //3、组装返回数据 - Map mp = new HashMap<>(); + Map mp = new LinkedHashMap <>(); for (LocalDate date : dates) { for (WgzAttendance wa : wgzAttendances) { WgzAppPunchTheCalendarRecordTwo two = new WgzAppPunchTheCalendarRecordTwo().setId(wa.getId()); LocalDate clockDate = wa.getDate(); if (clockDate.equals(date)) { //上班 - if (wa.getClockInTime() != null || wa.getMissedIn()== 1) { + if (wa.getClockInTime() != null || wa.getMissedIn() == 1 || wa.getLeaveMarkId() != 0) { two.setNum(1); two.setSb(sbOrXb(wa, 1)); } //下班 - if (wa.getClockOutTime() != null || wa.getMissedOut()== 1) { + if (wa.getClockOutTime() != null || wa.getMissedOut()== 1 || wa.getLeaveMarkId() != 0) { two.setNum(2); if (wa.getClockInTime() != null && wa.getClockOutTime() != null ) { two.setManHour(calculateWorkingHours(wa.getClockInTime(), wa.getClockOutTime())); } two.setXb(sbOrXb(wa, 2)); } + mp.put(date, two); + break; } - mp.put(date, two); } } return new WgzAppPunchTheCalendarRecordRes().setMp(mp); diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java index 4431368..26750a4 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java @@ -170,7 +170,6 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl dates = new ArrayList<>(); @@ -186,24 +185,24 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl ll = iWgzLeaveService.selectByUserCancelLeave(req.getYearMonth()); //4、将获取的年月与数据库中的日期进行比对,然后填充数据 - Map fh = new HashMap<>(); + Map fh = new LinkedHashMap<>(); dates.forEach(date -> { - wgzDailyClocks.forEach(wgzDailyClock -> { + for (WgzDailyClock wgzDailyClock : wgzDailyClocks) { LocalDate clockDate = wgzDailyClock.getDilyTime().toLocalDate(); //两个时间一致就填充数据;如若有请假的日期需要将状态改为请假 if (clockDate.equals(date)) { WgzAppAttachmentAcquisitionTwo wgzAppAttachmentAcquisitionTwo = new WgzAppAttachmentAcquisitionTwo(). setStatus("0").//正常上传日志 - setId(wgzDailyClock.getId()). + setId(wgzDailyClock.getId()). setDilyTime(wgzDailyClock.getDilyTime()). setPnchOsition(wgzDailyClock.getPnchOsition()); if (ll.get(date) !=null && ll.get(date).equals(clockDate)) { wgzAppAttachmentAcquisitionTwo.setStatus("2"); //全天请假 } - fh.put(date.toString(),wgzAppAttachmentAcquisitionTwo); + break; } - }); + } }); //4、获取当前务工者的招工信息的主题及招工创建人的基本信息 BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(SecurityUtils.getAppUserId()); diff --git a/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml b/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml index 667ecbf..a1f752b 100644 --- a/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/wgz/WgzDailyClockMapper.xml @@ -44,9 +44,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN wgz_user b ON (a.user_id = b.user_id and b.del_flag = 0) WHERE a.user_id = #{req.userId} and - DATE_FORMAT(dily_time, '%Y-%m-%d') = #{req.rq} and + + DATE_FORMAT(a.dily_time, '%Y-%m-%d') = #{req.rq} and + - status = #{req.types} and + a.status = #{req.types} and a.del_flag = 0 ORDER BY