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 e446e32..c37e849 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 @@ -84,6 +84,9 @@ public class WgzAppController { @Autowired private IWgzAttendanceService iWgzAttendanceService; + @Autowired + private IWgzReissueacardService iWgzReissueacardService; + /** * 【注册】务工者注册 @@ -243,6 +246,16 @@ public class WgzAppController { return AjaxResult.success(iWgzDailyClockService.userCheckDailyNewspaper(id)); } + /** + * 【考勤打卡】【打卡】 提交上下班打卡·查看当前用户的打卡状态(0上班 1下班 2请假) + */ + @ApiOperation("【考勤打卡】【打卡】 提交上下班打卡·用户今日打卡状态(0上班 1下班 2请假)") + @PreAuthorize("@ss.hasPermi('wgzApp:user:userClockingCondition')") + @GetMapping("/WgzAppUserClockingCondition") + public AjaxResult userClockingCondition() { + return AjaxResult.success(iWgzAttendanceService.userClockingCondition()); + } + /** * 【考勤打卡】【打卡】 提交上下班打卡 */ @@ -250,7 +263,47 @@ public class WgzAppController { @PreAuthorize("@ss.hasPermi('wgzApp:user:userSubmitTheClock')") @PostMapping("/WgzAppUserSubmitTheClock") public AjaxResult userSubmitTheClock(@Validated @RequestBody WgzAppSubmitTheClockReq req) { - return AjaxResult.success(true); + return AjaxResult.success(iWgzAttendanceService.userSubmitTheClock(req)); + } + + /** + * 【考勤打卡】【打卡日历】 打卡日历记录 + */ + @ApiOperation("【考勤打卡】【打卡日历】 打卡日历记录)") + @PreAuthorize("@ss.hasPermi('wgzApp:user:userPunchTheCalendarRecord')") + @GetMapping("/WgzAppUserPunchTheCalendarRecord") + public AjaxResult userPunchTheCalendarRecord() { + return AjaxResult.success(iWgzAttendanceService.userPunchTheCalendarRecord()); + } + + /** + * 【考勤打卡】【打卡日历】 补卡申请列表 + */ + @ApiOperation("【考勤打卡】【打卡日历】 补卡申请列表") + @PreAuthorize("@ss.hasPermi('wgzApp:user:userCardReplacementApplicationList')") + @GetMapping("/WgzAppUserCardReplacementApplicationList") + public AjaxResult userCardReplacementApplication() { + return AjaxResult.success(iWgzAttendanceService.userCardReplacementApplication()); + } + + /** + * 【考勤打卡】【打卡日历】 补卡申请 + */ + @ApiOperation("【考勤打卡】【打卡日历】 补卡申请)") + @PreAuthorize("@ss.hasPermi('wgzApp:user:userCardReplacementApplication')") + @PostMapping("/WgzAppUserCardReplacementApplication") + public AjaxResult userCardReplacementApplication(@Validated @RequestBody WgzAppCardReplacementApplicationReq req) { + return AjaxResult.success(iWgzReissueacardService.userCardReplacementApplication(req)); + } + + /** + * 【考勤打卡】【打卡日历】 补卡记录 + */ + @ApiOperation("【考勤打卡】【打卡日历】 补卡记录)") + @PreAuthorize("@ss.hasPermi('wgzApp:user:userReplacementCardRecord')") + @GetMapping("/WgzAppUserReplacementCardRecord") + public TableDataInfo userReplacementCardRecord(@Validated WgzAppReplacementCardRecordReq req) { + return iWgzReissueacardService.userReplacementCardRecord(req); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzReissueacardController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzReissueacardController.java new file mode 100644 index 0000000..0d383da --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/wgz/controller/WgzReissueacardController.java @@ -0,0 +1,108 @@ +package com.ruoyi.web.controller.wgz.controller; + +import java.util.List; +import java.util.Arrays; + +import com.ruoyi.wgz.domain.WgzReissueacard; +import lombok.RequiredArgsConstructor; +import javax.validation.constraints.*; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.validation.annotation.Validated; +import com.ruoyi.common.annotation.RepeatSubmit; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.wgz.bo.WgzReissueacardQueryBo; +import com.ruoyi.wgz.service.IWgzReissueacardService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +/** + * 补卡申请Controller + * + * @author ruoyi + * @date 2025-02-20 + */ +@Api(value = "补卡申请控制器", tags = {"补卡申请管理"}) +@RequiredArgsConstructor(onConstructor_ = @Autowired) +@RestController +@RequestMapping("/wgz/reissueacard") +public class WgzReissueacardController extends BaseController { + + private final IWgzReissueacardService iWgzReissueacardService; + + /** + * 查询补卡申请列表 + */ + @ApiOperation("查询补卡申请列表") + @PreAuthorize("@ss.hasPermi('wgz:reissueacard:list')") + @GetMapping("/list") + public TableDataInfo list(@Validated WgzReissueacardQueryBo bo) { + return iWgzReissueacardService.queryPageList(bo); + } + + /** + * 导出补卡申请列表 + */ + @ApiOperation("导出补卡申请列表") + @PreAuthorize("@ss.hasPermi('wgz:reissueacard:export')") + @Log(title = "补卡申请", businessType = BusinessType.EXPORT) + @GetMapping("/export") + public AjaxResult export(@Validated WgzReissueacardQueryBo bo) { + List list = iWgzReissueacardService.queryList(bo); + ExcelUtil util = new ExcelUtil(WgzReissueacard.class); + return util.exportExcel(list, "补卡申请"); + } + + /** + * 获取补卡申请详细信息 + */ + @ApiOperation("获取补卡申请详细信息") + @PreAuthorize("@ss.hasPermi('wgz:reissueacard:query')") + @GetMapping("/{id}") + public AjaxResult getInfo(@NotNull(message = "主键不能为空") + @PathVariable("id") Long id) { + return AjaxResult.success(iWgzReissueacardService.queryById(id)); + } + + /** + * 新增补卡申请 + */ + @ApiOperation("新增补卡申请") + @PreAuthorize("@ss.hasPermi('wgz:reissueacard:add')") + @Log(title = "补卡申请", businessType = BusinessType.INSERT) + @RepeatSubmit + @PostMapping() + public AjaxResult add(@Validated @RequestBody WgzReissueacard bo) { + return toAjax(iWgzReissueacardService.insert(bo) ? 1 : 0); + } + + /** + * 修改补卡申请 + */ + @ApiOperation("修改补卡申请") + @PreAuthorize("@ss.hasPermi('wgz:reissueacard:edit')") + @Log(title = "补卡申请", businessType = BusinessType.UPDATE) + @RepeatSubmit + @PutMapping() + public AjaxResult edit(@Validated @RequestBody WgzReissueacard bo) { + return toAjax(iWgzReissueacardService.update(bo) ? 1 : 0); + } + + /** + * 删除补卡申请 + */ + @ApiOperation("删除补卡申请") + @PreAuthorize("@ss.hasPermi('wgz:reissueacard:remove')") + @Log(title = "补卡申请" , businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@NotEmpty(message = "主键不能为空") + @PathVariable Long[] ids) { + return toAjax(iWgzReissueacardService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0); + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/WgzReissueacardQueryBo.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/WgzReissueacardQueryBo.java new file mode 100644 index 0000000..63e1148 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/WgzReissueacardQueryBo.java @@ -0,0 +1,79 @@ +package com.ruoyi.wgz.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.LocalDate; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 补卡申请分页查询对象 wgz_reissueacard + * + * @author ruoyi + * @date 2025-02-20 + */ + +@Data +@EqualsAndHashCode(callSuper = true) +@ApiModel("补卡申请分页查询对象") +public class WgzReissueacardQueryBo extends BaseEntity { + + /** 分页大小 */ + @ApiModelProperty("分页大小") + private Integer pageSize; + /** 当前页数 */ + @ApiModelProperty("当前页数") + private Integer pageNum; + /** 排序列 */ + @ApiModelProperty("排序列") + private String orderByColumn; + /** 排序的方向desc或者asc */ + @ApiModelProperty(value = "排序的方向", example = "asc,desc") + private String isAsc; + + + /** 项目ID */ + @ApiModelProperty("项目ID") + private Long recruitId; + /** 人员ID */ + @ApiModelProperty("人员ID") + private Long userId; + /** 打卡ID */ + @ApiModelProperty("打卡ID") + private Long attendanceId; + /** 状态(0上班补卡 1下班补卡) */ + @ApiModelProperty("状态(0上班补卡 1下班补卡)") + private String type; + /** 项目名称 */ + @ApiModelProperty("项目名称") + private String recruitName; + /** 原打卡时间 */ + @ApiModelProperty("原打卡时间") + private String rawTime; + /** 现补卡时间 */ + @ApiModelProperty("现补卡时间") + private LocalDateTime nowTime; + /** 补卡理由 */ + @ApiModelProperty("补卡理由") + private String reason; + /** 审核人ID */ + @ApiModelProperty("审核人ID") + private Long auditorUserId; + /** 审核状态(0待审核 1审核中 2已同意 3已拒绝) */ + @ApiModelProperty("审核状态(0待审核 1审核中 2已同意 3已拒绝)") + private String auditorType; + /** 审核意见 */ + @ApiModelProperty("审核意见") + private String auditorOpinion; + /** 同意|拒绝时间 */ + @ApiModelProperty("同意|拒绝时间") + private LocalDateTime auditorTime; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppCardReplacementApplicationReq.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppCardReplacementApplicationReq.java new file mode 100644 index 0000000..5269ae8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppCardReplacementApplicationReq.java @@ -0,0 +1,44 @@ +package com.ruoyi.wgz.bo.req; + +import com.baomidou.mybatisplus.annotation.FieldFill; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("补卡申请请求对象") +public class WgzAppCardReplacementApplicationReq implements Serializable { + + /** 打卡ID */ + @Excel(name = "打卡ID") + @ApiModelProperty("打卡ID") + private Long attendanceId; + + /** 状态(0上班补卡 1下班补卡) */ + @Excel(name = "状态" , readConverterExp = "0=上班补卡,1=下班补卡") + @ApiModelProperty("状态(0上班补卡 1下班补卡)") + private String type; + + /** 现补卡时间 */ + @Excel(name = "现补卡时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("现补卡时间") + private LocalDateTime nowTime; + + /** 补卡理由 */ + @Excel(name = "补卡理由") + @ApiModelProperty("补卡理由") + private String reason; + + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppReplacementCardRecordReq.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppReplacementCardRecordReq.java new file mode 100644 index 0000000..3fffb86 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/req/WgzAppReplacementCardRecordReq.java @@ -0,0 +1,14 @@ +package com.ruoyi.wgz.bo.req; + +import com.ruoyi.common.bo.PageReq; +import io.swagger.annotations.ApiModel; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("补卡申请历史记录请求对象") +public class WgzAppReplacementCardRecordReq extends PageReq { +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppCardReplacementApplicationRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppCardReplacementApplicationRes.java new file mode 100644 index 0000000..af60347 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppCardReplacementApplicationRes.java @@ -0,0 +1,22 @@ +package com.ruoyi.wgz.bo.res; + +import com.ruoyi.wgz.bo.rests.WgzAppCardReplacementApplicationTwo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.List; + + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("补卡申请列表返回对象") +public class WgzAppCardReplacementApplicationRes implements Serializable { + List list; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppLeaveHistoryListPageRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppLeaveHistoryListPageRes.java index 7b02a41..1b04ef5 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppLeaveHistoryListPageRes.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppLeaveHistoryListPageRes.java @@ -44,10 +44,10 @@ public class WgzAppLeaveHistoryListPageRes implements Serializable { private Long auditorUserId; @ApiModelProperty("审核人头像") - private Long auditorHead; + private String auditorHead; @ApiModelProperty("审核人名称") - private Long auditorName; + private String auditorname; @ApiModelProperty("审核状态(0待审核 1审核中 2已同意 3已拒绝 4已取消)") private String auditorType; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppPunchTheCalendarRecordRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppPunchTheCalendarRecordRes.java new file mode 100644 index 0000000..4ac7f3c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppPunchTheCalendarRecordRes.java @@ -0,0 +1,22 @@ +package com.ruoyi.wgz.bo.res; + +import com.ruoyi.wgz.bo.rests.WgzAppPunchTheCalendarRecordTwo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDate; +import java.util.Map; + + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("打卡-打卡日历返回对象") +public class WgzAppPunchTheCalendarRecordRes implements Serializable { + @ApiModelProperty("日历") + private Map mp; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserClockingConditionRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserClockingConditionRes.java new file mode 100644 index 0000000..80ed826 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppUserClockingConditionRes.java @@ -0,0 +1,18 @@ +package com.ruoyi.wgz.bo.res; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("考勤打卡·APP用户今日打卡状态") +public class WgzAppUserClockingConditionRes implements Serializable { + @ApiModelProperty("务工者今日打卡状态:0上班 1下班 2请假") + private Integer clockingCondition; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzReplacementCardRecordRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzReplacementCardRecordRes.java new file mode 100644 index 0000000..8e5aaaf --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzReplacementCardRecordRes.java @@ -0,0 +1,71 @@ +package com.ruoyi.wgz.bo.res; + +import com.ruoyi.common.annotation.Excel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +@Data +@NoArgsConstructor +@Accessors(chain = true) +@ApiModel("补卡申请历史记录返回对象") +public class WgzReplacementCardRecordRes implements Serializable { + + + @ApiModelProperty("项目ID") + private Long recruitId; + + @ApiModelProperty("申请人ID") + private Long userId; + + @ApiModelProperty("申请人姓名") + private String userName; + + @ApiModelProperty("打卡ID") + private Long attendanceId; + + @ApiModelProperty("状态(0上班补卡 1下班补卡)") + private String type; + + @ApiModelProperty("项目名称") + private String recruitName; + + @ApiModelProperty("原打卡时间") + private String rawTime; + + @ApiModelProperty("现补卡时间") + private LocalDateTime nowTime; + + @ApiModelProperty("补卡理由") + private String reason; + + @ApiModelProperty("审核人ID") + private Long auditorUserId; + + @ApiModelProperty("审核人头像") + private String auditorHead; + + @ApiModelProperty("审核人名称") + private String auditorname; + + @ApiModelProperty("审核状态(0待审核 1审核中 2已同意 3已拒绝)") + private String auditorType; + + @ApiModelProperty("审核意见") + private String auditorOpinion; + + /** 同意|拒绝时间 */ + @Excel(name = "同意|拒绝时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("同意|拒绝时间") + private LocalDateTime auditorTime; + + + @ApiModelProperty("创建时间|申请时间") + private LocalDateTime createTime; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppCardReplacementApplicationTwo.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppCardReplacementApplicationTwo.java new file mode 100644 index 0000000..8a33859 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppCardReplacementApplicationTwo.java @@ -0,0 +1,31 @@ +package com.ruoyi.wgz.bo.rests; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDate; +import java.time.LocalDateTime; + +@Data +@NoArgsConstructor +@Accessors(chain = true) +public class WgzAppCardReplacementApplicationTwo implements Serializable { + @ApiModelProperty("补卡自增ID") + private Long id; + + @ApiModelProperty("补卡状态(1迟到 2早退 3上班缺卡 4下班缺卡)") + private Integer type; + + @ApiModelProperty("补卡时间") + private LocalDate fillingData; + + @ApiModelProperty("星期") + private String week; + + @ApiModelProperty("原本打卡时间(如果是缺卡会直接返回项目的上班或下班的时间)") + private LocalDateTime fillingDataTime; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppPunchTheCalendarRecordThree.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppPunchTheCalendarRecordThree.java new file mode 100644 index 0000000..87abde5 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppPunchTheCalendarRecordThree.java @@ -0,0 +1,31 @@ +package com.ruoyi.wgz.bo.rests; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.time.LocalDateTime; + + +@Data +@NoArgsConstructor +@Accessors(chain = true) +public class WgzAppPunchTheCalendarRecordThree implements Serializable { + @ApiModelProperty("打卡时间") + private LocalDateTime clockingTime; + + @ApiModelProperty("打卡位置") + private String pnchOsition; + + @ApiModelProperty("打卡状态(0正常 1迟到 2早退 3上班缺卡 4下班缺卡 5上班补卡 6下班补卡 7请假)") + private Integer clockingCondition; + +// @ApiModelProperty("补卡自增ID") +// private Integer clockingCondition; +// +// @ApiModelProperty("补卡状态") +// private Integer clockingCondition; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppPunchTheCalendarRecordTwo.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppPunchTheCalendarRecordTwo.java new file mode 100644 index 0000000..fbfd12c --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/rests/WgzAppPunchTheCalendarRecordTwo.java @@ -0,0 +1,29 @@ +package com.ruoyi.wgz.bo.rests; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +@Data +@NoArgsConstructor +@Accessors(chain = true) +public class WgzAppPunchTheCalendarRecordTwo implements Serializable { + @ApiModelProperty("主键自增ID") + private Long id; + + @ApiModelProperty("今日打卡次数") + private Integer num; + + @ApiModelProperty("今日工时") + private Double manHour; + + @ApiModelProperty("上班情况") + private WgzAppPunchTheCalendarRecordThree sb; + + @ApiModelProperty("下班情况") + private WgzAppPunchTheCalendarRecordThree xb; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzReissueacard.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzReissueacard.java new file mode 100644 index 0000000..264da94 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzReissueacard.java @@ -0,0 +1,133 @@ +package com.ruoyi.wgz.domain; + +import com.ruoyi.common.annotation.Excel; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import com.baomidou.mybatisplus.annotation.*; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; +import java.io.Serializable; +import java.util.Date; +import java.math.BigDecimal; + +import java.time.LocalDateTime; +import java.time.LocalTime; +import java.time.LocalDate; + +/** + * 补卡申请对象 wgz_reissueacard + * + * @author ruoyi + * @date 2025-02-20 + */ +@Data +@NoArgsConstructor +@Accessors(chain = true) +@TableName("wgz_reissueacard") +@ApiModel("补卡申请视图对象") +public class WgzReissueacard implements Serializable { + + private static final long serialVersionUID=1L; + + /** 主键自增ID */ + @ApiModelProperty("主键自增ID") + @TableId(value = "id") + private Long id; + + /** 项目ID */ + @Excel(name = "项目ID") + @ApiModelProperty("项目ID") + private Long recruitId; + + /** 人员ID */ + @Excel(name = "人员ID") + @ApiModelProperty("人员ID") + private Long userId; + + /** 打卡ID */ + @Excel(name = "打卡ID") + @ApiModelProperty("打卡ID") + private Long attendanceId; + + /** 状态(0上班补卡 1下班补卡) */ + @Excel(name = "状态" , readConverterExp = "0=上班补卡,1=下班补卡") + @ApiModelProperty("状态(0上班补卡 1下班补卡)") + private String type; + + /** 项目名称 */ + @Excel(name = "项目名称") + @ApiModelProperty("项目名称") + private String recruitName; + + /** 原打卡时间 */ + @Excel(name = "原打卡时间") + @ApiModelProperty("原打卡时间") + private String rawTime; + + /** 现补卡时间 */ + @Excel(name = "现补卡时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("现补卡时间") + private LocalDateTime nowTime; + + /** 补卡理由 */ + @Excel(name = "补卡理由") + @ApiModelProperty("补卡理由") + private String reason; + + /** 审核人ID */ + @Excel(name = "审核人ID") + @ApiModelProperty("审核人ID") + private Long auditorUserId; + + /** 审核状态(0待审核 1审核中 2已同意 3已拒绝) */ + @Excel(name = "审核状态" , readConverterExp = "0=待审核,1=审核中,2=已同意,3=已拒绝") + @ApiModelProperty("审核状态(0待审核 1审核中 2已同意 3已拒绝)") + private String auditorType; + + /** 审核意见 */ + @Excel(name = "审核意见") + @ApiModelProperty("审核意见") + private String auditorOpinion; + + /** 同意|拒绝时间 */ + @Excel(name = "同意|拒绝时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("同意|拒绝时间") + private LocalDateTime auditorTime; + + /** 删除标志(0代表存在 2代表删除) */ + @Excel(name = "删除标志" , readConverterExp = "0=代表存在,2=代表删除") + @ApiModelProperty("删除标志(0代表存在 2代表删除)") + private String delFlag; + + /** 创建者 */ + @Excel(name = "创建者") + @ApiModelProperty("创建者") + @TableField(fill = FieldFill.INSERT) + private String createBy; + + /** 创建时间 */ + @Excel(name = "创建时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("创建时间") + @TableField(fill = FieldFill.INSERT) + private LocalDateTime createTime; + + /** 更新者 */ + @Excel(name = "更新者") + @ApiModelProperty("更新者") + @TableField(fill = FieldFill.INSERT_UPDATE) + private String updateBy; + + /** 更新时间 */ + @Excel(name = "更新时间" , width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") + @ApiModelProperty("更新时间") + @TableField(fill = FieldFill.INSERT_UPDATE) + private LocalDateTime updateTime; + + /** 备注 */ + @Excel(name = "备注") + @ApiModelProperty("备注") + private String remark; + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzReissueacardMapper.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzReissueacardMapper.java new file mode 100644 index 0000000..454214b --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/mapper/WgzReissueacardMapper.java @@ -0,0 +1,25 @@ +package com.ruoyi.wgz.mapper; + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ruoyi.wgz.bo.res.WgzReplacementCardRecordRes; +import com.ruoyi.wgz.domain.WgzReissueacard; +import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus; +import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache; +import org.apache.ibatis.annotations.CacheNamespace; + +/** + * 补卡申请Mapper接口 + * + * @author ruoyi + * @date 2025-02-20 + */ +// 如使需切换数据源 请勿使用缓存 会造成数据不一致现象 +@CacheNamespace(implementation = MybatisPlusRedisCache.class, eviction = MybatisPlusRedisCache.class) +public interface WgzReissueacardMapper extends BaseMapperPlus { + /** + * 查询关联数据并支持分页 + * @param page 分页对象 + * @return 分页查询结果 + */ + Page userReplacementCardRecordListPage(Page page); +} 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 5af33ac..146c981 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 @@ -2,6 +2,9 @@ package com.ruoyi.wgz.service; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.wgz.bo.req.WgzAppSubmitTheClockReq; +import com.ruoyi.wgz.bo.res.WgzAppCardReplacementApplicationRes; +import com.ruoyi.wgz.bo.res.WgzAppPunchTheCalendarRecordRes; +import com.ruoyi.wgz.bo.res.WgzAppUserClockingConditionRes; import com.ruoyi.wgz.domain.WgzAttendance; import com.ruoyi.wgz.bo.WgzAttendanceQueryBo; import com.ruoyi.common.core.mybatisplus.core.IServicePlus; @@ -69,8 +72,23 @@ public interface IWgzAttendanceService extends IServicePlus { */ Boolean userSubmitTheClock(@Validated @RequestBody WgzAppSubmitTheClockReq req); -// /** -// * 查看当前人、当前工地、当前日期的打卡记录 -// */ -// WgzAttendance findByUserIdWait(Long appUserId, Long recruitId, String date); + /** + * 用户今日打卡状态(0上班 1下班 2请假) + */ + WgzAppUserClockingConditionRes userClockingCondition(); + + /** + * 打卡日历记录 + */ + WgzAppPunchTheCalendarRecordRes userPunchTheCalendarRecord(); + + /** + * 根据id查询具体的打卡详情 + */ + WgzAttendance findById(Long id); + + /** + * 补卡申请列表 + */ + WgzAppCardReplacementApplicationRes userCardReplacementApplication(); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzReissueacardService.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzReissueacardService.java new file mode 100644 index 0000000..4828252 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/IWgzReissueacardService.java @@ -0,0 +1,79 @@ +package com.ruoyi.wgz.service; + +import com.ruoyi.wgz.bo.req.WgzAppReplacementCardRecordReq; +import com.ruoyi.wgz.bo.req.WgzAppCardReplacementApplicationReq; +import com.ruoyi.wgz.bo.res.WgzAppCardReplacementApplicationRes; +import com.ruoyi.wgz.bo.res.WgzReplacementCardRecordRes; +import com.ruoyi.wgz.domain.WgzReissueacard; +import com.ruoyi.wgz.bo.WgzReissueacardQueryBo; +import com.ruoyi.common.core.mybatisplus.core.IServicePlus; +import com.ruoyi.common.core.page.TableDataInfo; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.Collection; +import java.util.List; + +/** + * 补卡申请Service接口 + * + * @author ruoyi + * @date 2025-02-20 + */ +public interface IWgzReissueacardService extends IServicePlus { + /** + * 查询单个 + * @return + */ + WgzReissueacard queryById(Long id); + + /** + * 查询列表 + */ + TableDataInfo queryPageList(WgzReissueacardQueryBo bo); + + /** + * 查询列表 + */ + List queryList(WgzReissueacardQueryBo bo); + + /** + * 根据新增业务对象插入补卡申请 + * @param bo 补卡申请新增业务对象 + * @return + */ + Boolean insert(WgzReissueacard bo); + + /** + * 根据编辑业务对象修改补卡申请 + * @param bo 补卡申请编辑业务对象 + * @return + */ + Boolean update(WgzReissueacard bo); + + /** + * 校验并删除数据 + * @param ids 主键集合 + * @param isValid 是否校验,true-删除前校验,false-不校验 + * @return + */ + Boolean deleteWithValidByIds(Collection ids, Boolean isValid); + + /** + * APP相关 + * ================================================================================================================= + * ================================================================================================================= + * ================================================================================================================= + */ + + /** + * APP补卡申请 + */ + Boolean userCardReplacementApplication(@Validated @RequestBody WgzAppCardReplacementApplicationReq req); + + /** + * 补卡记录(分页) + */ + TableDataInfo userReplacementCardRecord(@Validated WgzAppReplacementCardRecordReq req); + +} 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 5072ae8..51c5d91 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 @@ -13,8 +13,15 @@ import com.ruoyi.common.core.page.PagePlus; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.wgz.bo.req.WgzAppSubmitTheClockReq; +import com.ruoyi.wgz.bo.res.WgzAppCardReplacementApplicationRes; +import com.ruoyi.wgz.bo.res.WgzAppPunchTheCalendarRecordRes; +import com.ruoyi.wgz.bo.res.WgzAppUserClockingConditionRes; +import com.ruoyi.wgz.bo.rests.WgzAppCardReplacementApplicationTwo; +import com.ruoyi.wgz.bo.rests.WgzAppPunchTheCalendarRecordThree; +import com.ruoyi.wgz.bo.rests.WgzAppPunchTheCalendarRecordTwo; import com.ruoyi.wgz.domain.WgzLeave; import com.ruoyi.wgz.service.IWgzLeaveService; +import org.aspectj.weaver.ast.Var; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; @@ -27,13 +34,11 @@ import com.ruoyi.wgz.service.IWgzAttendanceService; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.reactive.TransactionalOperator; -import java.time.LocalDate; -import java.time.LocalDateTime; -import java.time.LocalTime; +import java.text.DecimalFormat; +import java.time.*; import java.time.format.DateTimeFormatter; -import java.util.List; -import java.util.Map; -import java.util.Collection; +import java.time.temporal.TemporalAdjusters; +import java.util.*; /** * 考勤打卡Service业务层处理 @@ -143,54 +148,260 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl此处代码将改写逻辑为:每天凌晨1分的时候直接找出已请假的人然后定时插入数据到打卡记录中标记为请假 +// String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); +// WgzLeave wgzLeave = iWgzLeaveService.FindAskForLeaveOrNotInfo(appUserId, by.getId(), formattedDate); +// if (wgzLeave != null) { //表示有请假申请 +// LocalDateTime startTime = wgzLeave.getStartTime(); +// LocalDate localDate = startTime.toLocalDate(); +// throw new RuntimeException("您有已通过的请假申请,请假时间为:"+localDate); +// } + //5、查看当前人、当前工地、当天的打卡记录 String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); - WgzLeave wgzLeave = iWgzLeaveService.FindAskForLeaveOrNotInfo(appUserId, by.getId(), formattedDate); - if (wgzLeave != null) { //表示有请假申请 - LocalDateTime startTime = wgzLeave.getStartTime(); - LocalDate localDate = startTime.toLocalDate(); - throw new RuntimeException("您有已通过的请假申请,请假时间为:"+localDate); + WgzAttendance we = publicFindByUserIdWait(appUserId, by.getId(), formattedDate); + String exceptionType = we.getExceptionType(); + if (we.getLeaveMarkId() != null && we.getLeaveMarkId()!= 0) { + throw new RuntimeException("您有已通过的请假申请,请假时间为:"+formattedDate); } - //5、查看当前人、当前工地、当天是否有打卡记录 - //4、组装完整的打卡信息 + //6、组装完整的打卡信息 WgzAttendance wgzAttendance = new WgzAttendance(). setRecruitId(appById.getId()). setUserId(appUserId). setDailyWage(appById.getRecruitAmount()). setDate(LocalDate.now()). - setPnchOsition(req.getPnchOsition()). - setDate(LocalDate.now()); - //设置打卡时间 + setPnchOsition(req.getPnchOsition()); LocalDateTime now = LocalDateTime.now(); //当前完整年月日时分秒 LocalTime localTime = now.toLocalTime(); //获取时分秒 - if (req.getType().equals(Clocking)) { + if (Objects.isNull(we)) { //表示当天第一次打卡---上班 wgzAttendance.setClockInTime(now); - //判断当前打卡时间是否在上班时间之前 LocalTime beginWorkTime = appById.getBeginWorkTime(); //上班 if (!localTime.isBefore(beginWorkTime)) { wgzAttendance.setLate(1); //迟到 wgzAttendance.setLateTime(now); wgzAttendance.setExceptionType("1,"); } - } - if (req.getType().equals(OffDuty)) { + }else{ //表示当天不是第一次打卡---下班 wgzAttendance.setClockOutTime(now); - //判断当前打卡时间是否在下班时间之后 LocalTime endWorkTime = appById.getEndWorkTime(); //下班 if (!localTime.isAfter(endWorkTime)) { wgzAttendance.setEarlyLeave(1); //早退 wgzAttendance.setEarlyLeaveTime(now); - wgzAttendance.setExceptionType("2,"); + wgzAttendance.setExceptionType(exceptionType+"2,"); + } + } + return baseMapper.insert(wgzAttendance) > 0; + } + + @Override + public WgzAppUserClockingConditionRes userClockingCondition() { + WgzAppUserClockingConditionRes res = new WgzAppUserClockingConditionRes(); + //1、获取打卡信息 + Long appUserId = SecurityUtils.getAppUserId(); + BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); + String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); + WgzAttendance wgzAttendance = publicFindByUserIdWait(appUserId, by.getId(), formattedDate); + //2、获取今日用户打卡状态 + if (Objects.isNull(wgzAttendance)) { + res.setClockingCondition(0); //上班 + }else{ + res.setClockingCondition(1); //下班 + if (wgzAttendance.getLeaveMarkId()!= null && wgzAttendance.getLeaveMarkId()!= 0) { + res.setClockingCondition(2); //请假 + } + } + return res; + } + + @Override + public WgzAppPunchTheCalendarRecordRes userPunchTheCalendarRecord() { + Long appUserId = SecurityUtils.getAppUserId(); + BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); + //1、获取当月的所有日期 + LocalDate currentDate = LocalDate.now(); + LocalDate firstDayOfMonth = currentDate.with(TemporalAdjusters.firstDayOfMonth()); + LocalDate lastDayOfMonth = currentDate.with(TemporalAdjusters.lastDayOfMonth()); + List dates = new ArrayList<>(); + LocalDate tempDate = firstDayOfMonth; + while (!tempDate.isAfter(lastDayOfMonth)) { + dates.add(tempDate); + tempDate = tempDate.plusDays(1); + } + String format = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM")); + //2、获取当前人、当前工地、当前月的所有考勤记录 + LambdaQueryWrapper apply = new LambdaQueryWrapper(). + eq(WgzAttendance::getUserId, appUserId). + eq(WgzAttendance::getRecruitId, by.getId()). + apply("DATE_FORMAT(date, '%Y-%m') = {0}", format); + List wgzAttendances = baseMapper.selectList(apply); + //3、组装返回数据 + Map mp = new HashMap<>(); + 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) { + two.setNum(1); + two.setSb(sbOrXb(wa, 1)); + } + //下班 + if (wa.getClockOutTime() != null) { + two.setNum(2); + two.setManHour(calculateWorkingHours(wa.getClockInTime(), wa.getClockOutTime())); + two.setSb(sbOrXb(wa, 2)); + } + } + mp.put(date, two); + } + } + return new WgzAppPunchTheCalendarRecordRes().setMp(mp); + } + + @Override + public WgzAttendance findById(Long id) { + return getById(id); + } + + @Override + public WgzAppCardReplacementApplicationRes userCardReplacementApplication() { + //1、获取当前用户信息 + Long appUserId = SecurityUtils.getAppUserId(); + //2、获取当前用户所在的工地id + BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); + //3、根据工地id得到完整的工地信息 + BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId()); + //4、查询所有缺卡、迟到、早退的打卡记录 + LambdaQueryWrapper apply = new LambdaQueryWrapper(). + eq(WgzAttendance::getUserId, appUserId). + eq(WgzAttendance::getRecruitId, by.getId()). + eq(WgzAttendance::getRecruitId, by.getId()) + .and(wrapper -> wrapper + .eq(WgzAttendance::getLate, 1) + .or() + .eq(WgzAttendance::getEarlyLeave, 1) + .or() + .eq(WgzAttendance::getMissedIn, 1) + .or() + .eq(WgzAttendance::getMissedOut, 1) + ); + List wgzAttendances = baseMapper.selectList(apply); + //4、将这些数据进行拆分 + ArrayList list = new ArrayList<>(); + for (WgzAttendance wgzAttendance : wgzAttendances) { + String exceptionType = wgzAttendance.getExceptionType(); + if (exceptionType.contains("1")) { // 迟到 + addRecord(wgzAttendance, 1, wgzAttendance.getClockInTime(), list); + } + if (exceptionType.contains("2")) { // 早退 + addRecord(wgzAttendance, 2, wgzAttendance.getClockOutTime(), list); + } + if (exceptionType.contains("3")) { // 上班缺卡 + addRecord(wgzAttendance, 3, LocalDateTime.from(appById.getBeginWorkTime()), list); + } + if (exceptionType.contains("4")) { // 下班缺卡 + addRecord(wgzAttendance, 4, LocalDateTime.from(appById.getEndWorkTime()), list); } } return null; } -// @Override -// public WgzAttendance findByUserIdWait(Long appUserId, Long recruitId, String date) { -// LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); -// qw.eq(WgzAttendance::getRecruitId,recruitId); -// qw.eq(WgzAttendance::getUserId,appUserId); -// return null; -// } + + /** + * 获取指定人、指定工地、指定日期的打卡记录 + * @param appUserId 务工者用户id + * @param recruitId 工地id + * @param date 具体日期 + * @return WgzAttendance + */ + public WgzAttendance publicFindByUserIdWait(Long appUserId, Long recruitId, String date) { + LambdaQueryWrapper qw = new LambdaQueryWrapper<>(); + qw.eq(WgzAttendance::getRecruitId,recruitId); + qw.eq(WgzAttendance::getUserId,appUserId); + qw.eq(WgzAttendance::getDate,date); + return baseMapper.selectOne(qw); + } + + /** + * 计算两个时间之间的工作小时数 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return 工作小时数 + */ + public double calculateWorkingHours(LocalDateTime startTime, LocalDateTime endTime) { + // 计算两个时间之间的持续时间 + Duration duration = Duration.between(startTime, endTime); + + // 将持续时间转换为分钟 + long minutes = duration.toMinutes(); + + // 将分钟转换为小时 + double hours = (double) minutes / 60; + + // 使用 DecimalFormat 保留两位小数 + DecimalFormat df = new DecimalFormat("#.00"); + String formattedHours = df.format(hours); + + // 将格式化后的字符串转换回 double 类型 + return Double.parseDouble(formattedHours); + } + + /** + * 组装上班、下班打卡记录 + * @param wa 打卡记录 + * @param num 1上班 2下班 + * @return WgzAppPunchTheCalendarRecordThree + */ + public WgzAppPunchTheCalendarRecordThree sbOrXb( WgzAttendance wa,int num) { + WgzAppPunchTheCalendarRecordThree sbb = new WgzAppPunchTheCalendarRecordThree(). + setClockingTime(wa.getClockInTime()). + setPnchOsition(wa.getPnchOsition()). + setClockingCondition(0); //正常 + //判断是否请假 + if (wa.getLeaveMarkId()!=null && wa.getLeaveMarkId()!=0) { + sbb.setClockingCondition(7); + } + if (num == 1){ + //判断上班迟到 + if (wa.getLate() == 1) { + sbb.setClockingCondition(1); + } + //判断是否上班补卡 + if (wa.getExceptionType().contains("5")) { + sbb.setClockingCondition(5); + } + } + if (num == 2){ + //判断下班早退 + if (wa.getEarlyLeave() == 1) { + sbb.setClockingCondition(2); + } + //判断是否下班补卡 + if (wa.getExceptionType().contains("6")) { + sbb.setClockingCondition(6); + } + } + return sbb; + } + + /** + * 补卡 + * @param wgzAttendance 打卡记录 + * @param type 1上班 2下班 + * @param fillingDataTime 补卡时间 + * @param list 补卡记录 + */ + private void addRecord(WgzAttendance wgzAttendance, int type, LocalDateTime fillingDataTime, List list) { + LocalDate date = wgzAttendance.getDate(); + DayOfWeek dayOfWeek = date.getDayOfWeek(); + String week = dayOfWeek.toString(); + WgzAppCardReplacementApplicationTwo two = new WgzAppCardReplacementApplicationTwo() + .setId(wgzAttendance.getId()) + .setType(type) + .setFillingData(date) + .setWeek(week) + .setFillingDataTime(fillingDataTime); + list.add(two); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java index 84d963e..a33dc24 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzLeaveServiceImpl.java @@ -155,6 +155,7 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl implements IWgzReissueacardService { + + @Autowired + private IBgtProjectRecruitApplyService iBgtProjectRecruitApplyService; + + @Autowired + private IBgtProjectRecruitService iBgtProjectRecruitService; + + @Autowired + private IWgzAttendanceService iWgzAttendanceService; + + @Override + public WgzReissueacard queryById(Long id){ + return getById(id); + } + + + + @Override + public TableDataInfo queryPageList(WgzReissueacardQueryBo bo) { + Page result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); + return PageUtils.buildDataInfo(result); + } + + @Override + public List queryList(WgzReissueacardQueryBo bo) { + return list(buildQueryWrapper(bo)); + } + + private LambdaQueryWrapper buildQueryWrapper(WgzReissueacardQueryBo bo) { + Map params = bo.getParams(); + LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); + lqw.eq(bo.getRecruitId() != null, WgzReissueacard::getRecruitId, bo.getRecruitId()); + lqw.eq(bo.getUserId() != null, WgzReissueacard::getUserId, bo.getUserId()); + lqw.eq(bo.getAttendanceId() != null, WgzReissueacard::getAttendanceId, bo.getAttendanceId()); + lqw.eq(StrUtil.isNotBlank(bo.getType()), WgzReissueacard::getType, bo.getType()); + lqw.like(StrUtil.isNotBlank(bo.getRecruitName()), WgzReissueacard::getRecruitName, bo.getRecruitName()); + lqw.eq(StrUtil.isNotBlank(bo.getRawTime()), WgzReissueacard::getRawTime, bo.getRawTime()); + lqw.eq(bo.getNowTime() != null, WgzReissueacard::getNowTime, bo.getNowTime()); + lqw.eq(StrUtil.isNotBlank(bo.getReason()), WgzReissueacard::getReason, bo.getReason()); + lqw.eq(bo.getAuditorUserId() != null, WgzReissueacard::getAuditorUserId, bo.getAuditorUserId()); + lqw.eq(StrUtil.isNotBlank(bo.getAuditorType()), WgzReissueacard::getAuditorType, bo.getAuditorType()); + lqw.eq(StrUtil.isNotBlank(bo.getAuditorOpinion()), WgzReissueacard::getAuditorOpinion, bo.getAuditorOpinion()); + lqw.eq(bo.getAuditorTime() != null, WgzReissueacard::getAuditorTime, bo.getAuditorTime()); + return lqw; + } + + @Override + public Boolean insert(WgzReissueacard bo) { + WgzReissueacard add = BeanUtil.toBean(bo, WgzReissueacard.class); + validEntityBeforeSave(add); + return save(add); + } + + @Override + public Boolean update(WgzReissueacard bo) { + WgzReissueacard update = BeanUtil.toBean(bo, WgzReissueacard.class); + validEntityBeforeSave(update); + return updateById(update); + } + + /** + * 保存前的数据校验 + * + * @param entity 实体类数据 + */ + private void validEntityBeforeSave(WgzReissueacard entity){ + //TODO 做一些数据校验,如唯一约束 + } + + @Override + public Boolean deleteWithValidByIds(Collection ids, Boolean isValid) { + if(isValid){ + //TODO 做一些业务上的校验,判断是否需要校验 + } + return removeByIds(ids); + } + + /** + * APP相关 + * ================================================================================================================= + * ================================================================================================================= + * ================================================================================================================= + */ + + + @Override + @Transactional + public Boolean userCardReplacementApplication(WgzAppCardReplacementApplicationReq req) { + //1、获取当前用户信息 + Long appUserId = SecurityUtils.getAppUserId(); + //2、获取当前用户所在的工地id + BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId); + //3、根据招工id获取到具体招工信息 + BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId()); + //4、获取到原打卡的信息 + WgzAttendance attendanceInfo = iWgzAttendanceService.findById(req.getAttendanceId()); + if (Objects.isNull(attendanceInfo)) { + throw new RuntimeException("打卡信息不存在"); + } + String rawTime = ""; + if (attendanceInfo.getClockInTime() == null) { + rawTime = "缺卡"; + }else{ + rawTime = attendanceInfo.getClockInTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); + } + //5、组装补卡申请数据 + WgzReissueacard wgzReissueacard = new WgzReissueacard(). + setRecruitId(by.getRecruitId()). + setUserId(appUserId). + setAttendanceId(req.getAttendanceId()). + setType(req.getType()). + setRecruitName(appById.getRecruitName()). + setRawTime(rawTime). + setNowTime(req.getNowTime()). + setReason(req.getReason()). + setAttendanceId(appById.getUserId()); + return baseMapper.insert(wgzReissueacard) > 0; + } + + + @Override + public TableDataInfo userReplacementCardRecord(WgzAppReplacementCardRecordReq req) { + Page queryDTOPage = new Page<>(); + queryDTOPage.setCurrent(req.getPageNum()); + queryDTOPage.setSize(req.getPageSize()); + return PageUtils.buildDataInfo(baseMapper.userReplacementCardRecordListPage(queryDTOPage)); + } + +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzUserServiceImpl.java index 1484cdd..6f6ec15 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzUserServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzUserServiceImpl.java @@ -116,6 +116,7 @@ public class WgzUserServiceImpl extends ServicePlusImpl //注册 @Override + @Transactional public Boolean userRegister(WgzAppRegisterReq bo) { WgzUser wgzUser = new WgzUser(); //1、查询手机号是否存在 @@ -135,6 +136,7 @@ public class WgzUserServiceImpl extends ServicePlusImpl } @Override + @Transactional public Boolean userModifyingUserProfilePicture(WgzAppModifyingUserProfilePictureReq req) { WgzUser user = new WgzUser(); BeanUtils.copyProperties(req, user); diff --git a/ruoyi-system/src/main/resources/mapper/wgz/WgzReissueacardMapper.xml b/ruoyi-system/src/main/resources/mapper/wgz/WgzReissueacardMapper.xml new file mode 100644 index 0000000..ef3737b --- /dev/null +++ b/ruoyi-system/src/main/resources/mapper/wgz/WgzReissueacardMapper.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +