正在编写请假模块
This commit is contained in:
@ -0,0 +1,71 @@
|
||||
package com.ruoyi.wgz.service;
|
||||
|
||||
import com.ruoyi.wgz.bo.req.WgzAppJobListingReq;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserDailyCalendarRes;
|
||||
import com.ruoyi.wgz.bo.res.WfzUserDailyCalendarRes;
|
||||
import com.ruoyi.wgz.domain.WgzDailyClock;
|
||||
import com.ruoyi.wgz.bo.WgzDailyClockQueryBo;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日报打卡Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
public interface IWgzDailyClockService extends IServicePlus<WgzDailyClock> {
|
||||
/**
|
||||
* 查询单个
|
||||
* @return
|
||||
*/
|
||||
WgzDailyClock queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<WgzDailyClock> queryPageList(WgzDailyClockQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<WgzDailyClock> queryList(WgzDailyClockQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入日报打卡
|
||||
* @param bo 日报打卡新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insert(WgzDailyClock bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改日报打卡
|
||||
* @param bo 日报打卡编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean update(WgzDailyClock bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 务工者APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
/**
|
||||
* 日报日历
|
||||
*/
|
||||
WfzUserDailyCalendarRes userDailyCalendar(@Validated WgzAppUserDailyCalendarRes req);
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.ruoyi.wgz.service;
|
||||
|
||||
import com.ruoyi.wgz.bo.req.WgzAppSubmitLeaveRes;
|
||||
import com.ruoyi.wgz.domain.WgzLeave;
|
||||
import com.ruoyi.wgz.bo.WgzLeaveQueryBo;
|
||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.sun.org.apache.xpath.internal.operations.Bool;
|
||||
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-19
|
||||
*/
|
||||
public interface IWgzLeaveService extends IServicePlus<WgzLeave> {
|
||||
/**
|
||||
* 查询单个
|
||||
* @return
|
||||
*/
|
||||
WgzLeave queryById(Long id);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
TableDataInfo<WgzLeave> queryPageList(WgzLeaveQueryBo bo);
|
||||
|
||||
/**
|
||||
* 查询列表
|
||||
*/
|
||||
List<WgzLeave> queryList(WgzLeaveQueryBo bo);
|
||||
|
||||
/**
|
||||
* 根据新增业务对象插入请假
|
||||
* @param bo 请假新增业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean insert(WgzLeave bo);
|
||||
|
||||
/**
|
||||
* 根据编辑业务对象修改请假
|
||||
* @param bo 请假编辑业务对象
|
||||
* @return
|
||||
*/
|
||||
Boolean update(WgzLeave bo);
|
||||
|
||||
/**
|
||||
* 校验并删除数据
|
||||
* @param ids 主键集合
|
||||
* @param isValid 是否校验,true-删除前校验,false-不校验
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
|
||||
/**
|
||||
* APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
* 提交请假申请
|
||||
*/
|
||||
Boolean userSubmitLeave(@Validated @RequestBody WgzAppSubmitLeaveRes req);
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
package com.ruoyi.wgz.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppUserDailyCalendarRes;
|
||||
import com.ruoyi.wgz.bo.res.WfzUserDailyCalendarRes;
|
||||
import com.ruoyi.wgz.bo.rests.WgzAppAttachmentAcquisitionTwo;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.wgz.bo.WgzDailyClockQueryBo;
|
||||
import com.ruoyi.wgz.domain.WgzDailyClock;
|
||||
import com.ruoyi.wgz.mapper.WgzDailyClockMapper;
|
||||
import com.ruoyi.wgz.service.IWgzDailyClockService;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 日报打卡Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-18
|
||||
*/
|
||||
@Service
|
||||
public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMapper, WgzDailyClock> implements IWgzDailyClockService {
|
||||
|
||||
@Override
|
||||
public WgzDailyClock queryById(Long id){
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WgzDailyClock> queryPageList(WgzDailyClockQueryBo bo) {
|
||||
Page<WgzDailyClock> result = page(PageUtils.buildPage(), buildQueryWrapper(bo));
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WgzDailyClock> queryList(WgzDailyClockQueryBo bo) {
|
||||
return list(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WgzDailyClock> buildQueryWrapper(WgzDailyClockQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WgzDailyClock> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getRecruitId() != null, WgzDailyClock::getRecruitId, bo.getRecruitId());
|
||||
lqw.eq(bo.getUserId() != null, WgzDailyClock::getUserId, bo.getUserId());
|
||||
lqw.eq(bo.getDilyTime() != null, WgzDailyClock::getDilyTime, bo.getDilyTime());
|
||||
lqw.eq(bo.getDailyMark() != null, WgzDailyClock::getDailyMark, bo.getDailyMark());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getPnchOsition()), WgzDailyClock::getPnchOsition, bo.getPnchOsition());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getFinishToday()), WgzDailyClock::getFinishToday, bo.getFinishToday());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getUnfinished()), WgzDailyClock::getUnfinished, bo.getUnfinished());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getWorkTomorrow()), WgzDailyClock::getWorkTomorrow, bo.getWorkTomorrow());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getCoordinate()), WgzDailyClock::getCoordinate, bo.getCoordinate());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getAttachment()), WgzDailyClock::getAttachment, bo.getAttachment());
|
||||
lqw.eq(bo.getAuditorUserId() != null, WgzDailyClock::getAuditorUserId, bo.getAuditorUserId());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getAuditorType()), WgzDailyClock::getAuditorType, bo.getAuditorType());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getAuditorOpinion()), WgzDailyClock::getAuditorOpinion, bo.getAuditorOpinion());
|
||||
lqw.eq(bo.getAuditorTime() != null, WgzDailyClock::getAuditorTime, bo.getAuditorTime());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getExceptionType()), WgzDailyClock::getExceptionType, bo.getExceptionType());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insert(WgzDailyClock bo) {
|
||||
WgzDailyClock add = BeanUtil.toBean(bo, WgzDailyClock.class);
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(WgzDailyClock bo) {
|
||||
WgzDailyClock update = BeanUtil.toBean(bo, WgzDailyClock.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(WgzDailyClock entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 务工者APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
@Override
|
||||
public WfzUserDailyCalendarRes userDailyCalendar(WgzAppUserDailyCalendarRes req) {
|
||||
//1、获取当月的所有日期
|
||||
LocalDate currentDate = LocalDate.now();
|
||||
LocalDate firstDayOfMonth = currentDate.with(TemporalAdjusters.firstDayOfMonth());
|
||||
LocalDate lastDayOfMonth = currentDate.with(TemporalAdjusters.lastDayOfMonth());
|
||||
List<LocalDate> dates = new ArrayList<>();
|
||||
LocalDate tempDate = firstDayOfMonth;
|
||||
while (!tempDate.isAfter(lastDayOfMonth)) {
|
||||
dates.add(tempDate);
|
||||
tempDate = tempDate.plusDays(1);
|
||||
}
|
||||
//2、查询当前人员指定日期的所有日报情况
|
||||
QueryWrapper<WgzDailyClock> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.apply("DATE_FORMAT(dily_time, '%Y-%m') = {0}", req.getYearMonth()); // 使用 apply 方法添加自定义 SQL 条件
|
||||
List<WgzDailyClock> wgzDailyClocks = baseMapper.selectList(queryWrapper);
|
||||
//3、查看当前人,当前月是否有请假
|
||||
|
||||
//4、将获取的年月与数据库中的日期进行比对,然后填充数据
|
||||
Map<String, WgzAppAttachmentAcquisitionTwo> fh = new HashMap<>();
|
||||
dates.forEach(date -> {
|
||||
wgzDailyClocks.forEach(wgzDailyClock -> {
|
||||
LocalDate clockDate = wgzDailyClock.getDilyTime().toLocalDate();
|
||||
//两个时间一致就填充数据;如若有请假的日期需要将状态改为请假
|
||||
if (clockDate.equals(date)) {
|
||||
WgzAppAttachmentAcquisitionTwo wgzAppAttachmentAcquisitionTwo = new WgzAppAttachmentAcquisitionTwo().
|
||||
setStatus("0").//正常上传日志
|
||||
setId(wgzDailyClock.getId()).
|
||||
setDilyTime(wgzDailyClock.getDilyTime()).
|
||||
setPnchOsition(wgzDailyClock.getPnchOsition());
|
||||
// if (StrUtil.isNotBlank(wgzDailyClock.getDailyMark())) {
|
||||
// wgzAppAttachmentAcquisitionTwo.setStatus("2") //请假
|
||||
// }
|
||||
fh.put(date.toString(),wgzAppAttachmentAcquisitionTwo);
|
||||
}
|
||||
});
|
||||
});
|
||||
return new WfzUserDailyCalendarRes().setDailyCalendar(fh);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,109 @@
|
||||
package com.ruoyi.wgz.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.common.utils.PageUtils;
|
||||
import com.ruoyi.common.core.page.PagePlus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.wgz.bo.req.WgzAppSubmitLeaveRes;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.ruoyi.wgz.bo.WgzLeaveQueryBo;
|
||||
import com.ruoyi.wgz.domain.WgzLeave;
|
||||
import com.ruoyi.wgz.mapper.WgzLeaveMapper;
|
||||
import com.ruoyi.wgz.service.IWgzLeaveService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 请假Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-02-19
|
||||
*/
|
||||
@Service
|
||||
public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeave> implements IWgzLeaveService {
|
||||
|
||||
@Override
|
||||
public WgzLeave queryById(Long id){
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableDataInfo<WgzLeave> queryPageList(WgzLeaveQueryBo bo) {
|
||||
Page<WgzLeave> result = page(PageUtils.buildPage(), buildQueryWrapper(bo));
|
||||
return PageUtils.buildDataInfo(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WgzLeave> queryList(WgzLeaveQueryBo bo) {
|
||||
return list(buildQueryWrapper(bo));
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<WgzLeave> buildQueryWrapper(WgzLeaveQueryBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<WgzLeave> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getRecruitId() != null, WgzLeave::getRecruitId, bo.getRecruitId());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getSubject()), WgzLeave::getSubject, bo.getSubject());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getLeaveType()), WgzLeave::getLeaveType, bo.getLeaveType());
|
||||
lqw.eq(bo.getStartTime() != null, WgzLeave::getStartTime, bo.getStartTime());
|
||||
lqw.eq(bo.getEndTime() != null, WgzLeave::getEndTime, bo.getEndTime());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getReason()), WgzLeave::getReason, bo.getReason());
|
||||
lqw.eq(bo.getAuditorUserId() != null, WgzLeave::getAuditorUserId, bo.getAuditorUserId());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getAuditorType()), WgzLeave::getAuditorType, bo.getAuditorType());
|
||||
lqw.eq(StrUtil.isNotBlank(bo.getAuditorOpinion()), WgzLeave::getAuditorOpinion, bo.getAuditorOpinion());
|
||||
lqw.eq(bo.getAuditorTime() != null, WgzLeave::getAuditorTime, bo.getAuditorTime());
|
||||
lqw.eq(bo.getWorkingTime() != null, WgzLeave::getWorkingTime, bo.getWorkingTime());
|
||||
lqw.eq(bo.getClosingTime() != null, WgzLeave::getClosingTime, bo.getClosingTime());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insert(WgzLeave bo) {
|
||||
WgzLeave add = BeanUtil.toBean(bo, WgzLeave.class);
|
||||
validEntityBeforeSave(add);
|
||||
return save(add);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(WgzLeave bo) {
|
||||
WgzLeave update = BeanUtil.toBean(bo, WgzLeave.class);
|
||||
validEntityBeforeSave(update);
|
||||
return updateById(update);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*
|
||||
* @param entity 实体类数据
|
||||
*/
|
||||
private void validEntityBeforeSave(WgzLeave entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP相关
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
* =================================================================================================================
|
||||
*/
|
||||
|
||||
@Override
|
||||
public Boolean userSubmitLeave(WgzAppSubmitLeaveRes req) {
|
||||
//1、
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user