优化
This commit is contained in:
@ -132,6 +132,11 @@ public interface IWgzAttendanceService extends IServicePlus<WgzAttendance> {
|
||||
*/
|
||||
Integer attendanceDetail(Long userId,Long recruitId, Integer num);
|
||||
|
||||
/**
|
||||
* 务工者个人未结算工资统计
|
||||
*/
|
||||
Integer unFinishCount(Long userId,Long recruitId, Long recruitApplyId);
|
||||
|
||||
/**
|
||||
* 务工者个人考勤统计
|
||||
*/
|
||||
|
||||
@ -117,7 +117,7 @@ public interface IWgzPayCalculationService extends IServicePlus<WgzPayCalculatio
|
||||
/**
|
||||
* 总体考勤情况-工资结算-基础信息
|
||||
*/
|
||||
BgtPayCalculationDetailBaseVO baseInfo(Long userId, Long recruitId);
|
||||
BgtPayCalculationDetailBaseVO baseInfo(Long userId, Long recruitApplyId);
|
||||
|
||||
/**
|
||||
* 总体考勤情况-工资结算-结算记录
|
||||
@ -132,7 +132,7 @@ public interface IWgzPayCalculationService extends IServicePlus<WgzPayCalculatio
|
||||
/**
|
||||
* 结算基础信息
|
||||
*/
|
||||
BgtApplyForWgzPayAddInfoVO payInfo(Long userId, Long recruitId);
|
||||
BgtApplyForWgzPayAddInfoVO payInfo(Long userId, Long recruitApplyId);
|
||||
|
||||
/**
|
||||
* 是否还有在审核的申请
|
||||
|
||||
@ -417,7 +417,23 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
return baseMapper.selectCount(apply);
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public Integer unFinishCount(Long userId, Long recruitId, Long recruitApplyId) {
|
||||
|
||||
LambdaQueryWrapper<WgzAttendance> apply = new LambdaQueryWrapper<WgzAttendance>().
|
||||
eq(WgzAttendance::getUserId, userId).
|
||||
eq(WgzAttendance::getApplyKey, recruitApplyId).
|
||||
eq(WgzAttendance::getSettlement, 0). //为0就表示当天工资还未结算
|
||||
eq(WgzAttendance::getRecruitId, recruitId).and(wrapper -> wrapper
|
||||
.isNotNull(WgzAttendance::getClockInTime)
|
||||
.or()
|
||||
.isNotNull(WgzAttendance::getClockOutTime)
|
||||
);
|
||||
apply.orderByAsc(WgzAttendance::getDate);
|
||||
return baseMapper.selectCount(apply);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Integer attendanceDetail(Long userId, Long recruitId, Integer num) {
|
||||
// LambdaQueryWrapper<WgzAttendance> apply = new LambdaQueryWrapper<WgzAttendance>().
|
||||
// eq(WgzAttendance::getUserId, userId).
|
||||
@ -703,14 +719,15 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
BgtAttendancePersonCountVO bgtAttendanceDetailVO = new BgtAttendancePersonCountVO();
|
||||
|
||||
//获取任务下的所有招工
|
||||
List<BgtProjectRecruit> bgtProjectRecruits = iBgtProjectRecruitService.getBaseMapper().selectList(Wrappers.<BgtProjectRecruit>lambdaQuery()
|
||||
.eq(BgtProjectRecruit::getTaskId, dto.getTaskId()));
|
||||
List<Long> recruitIds = bgtProjectRecruits.stream().map(BgtProjectRecruit::getId).collect(Collectors.toList());
|
||||
// List<BgtProjectRecruit> bgtProjectRecruits = iBgtProjectRecruitService.getBaseMapper().selectList(Wrappers.<BgtProjectRecruit>lambdaQuery()
|
||||
// .eq(BgtProjectRecruit::getTaskId, dto.getTaskId()));
|
||||
// List<Long> recruitIds = bgtProjectRecruits.stream().map(BgtProjectRecruit::getId).collect(Collectors.toList());
|
||||
|
||||
//查询该务工者在这个项目里指定月份的所有考勤数据
|
||||
LambdaQueryWrapper<WgzAttendance> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WgzAttendance::getUserId, dto.getUserId());
|
||||
wrapper.in(WgzAttendance::getRecruitId, recruitIds);
|
||||
// wrapper.in(WgzAttendance::getRecruitId, recruitIds);
|
||||
wrapper.eq(WgzAttendance::getApplyKey, dto.getRecruitApplyId());
|
||||
LocalDate date = dto.getDate();
|
||||
LocalDate startDate = date.with(TemporalAdjusters.firstDayOfMonth());
|
||||
LocalDate endData = date.with(TemporalAdjusters.lastDayOfMonth());
|
||||
@ -719,8 +736,15 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
List<WgzAttendance> wgzAttendances = baseMapper.selectList(wrapper);
|
||||
|
||||
//获取招工打卡时间
|
||||
List<BgtProjectRecruit> list = iBgtProjectRecruitService.list(Wrappers.<BgtProjectRecruit>lambdaQuery().in(BgtProjectRecruit::getId,recruitIds));
|
||||
Map<Long, BgtProjectRecruit> recruitMap = list.stream().collect(Collectors.toMap(BgtProjectRecruit::getId, recruit -> recruit));
|
||||
// List<BgtProjectRecruit> list = iBgtProjectRecruitService.list(Wrappers.<BgtProjectRecruit>lambdaQuery().in(BgtProjectRecruit::getId,recruitIds));
|
||||
// Map<Long, BgtProjectRecruit> recruitMap = list.stream().collect(Collectors.toMap(BgtProjectRecruit::getId, recruit -> recruit));
|
||||
|
||||
BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.getById(dto.getRecruitApplyId());
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitApply.getRecruitId());
|
||||
//上班时间
|
||||
LocalTime beginWorkTime = recruit.getBeginWorkTime();
|
||||
//下班时间
|
||||
LocalTime endWorkTime = recruit.getEndWorkTime();
|
||||
|
||||
// 创建SimpleDateFormat对象,格式化日期为中文星期
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEEE", Locale.CHINA);
|
||||
@ -734,10 +758,6 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
|
||||
for (WgzAttendance wgzAttendance : wgzAttendances) {
|
||||
|
||||
//上下班时间
|
||||
BgtProjectRecruit recruit = recruitMap.get(wgzAttendance.getRecruitId());
|
||||
LocalTime beginWorkTime = recruit.getBeginWorkTime();
|
||||
LocalTime endWorkTime = recruit.getEndWorkTime();
|
||||
//上下班打卡时间
|
||||
LocalDateTime clockInTime = wgzAttendance.getClockInTime();
|
||||
LocalDateTime clockOutTime = wgzAttendance.getClockOutTime();
|
||||
|
||||
@ -467,7 +467,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
}
|
||||
|
||||
@Override
|
||||
public BgtPayCalculationDetailBaseVO baseInfo(Long userId, Long recruitId) {
|
||||
public BgtPayCalculationDetailBaseVO baseInfo(Long userId, Long recruitApplyId) {
|
||||
BgtPayCalculationDetailBaseVO vo = new BgtPayCalculationDetailBaseVO();
|
||||
WgzUser wgzUser = wgzUserService.findByUserId(userId);
|
||||
vo.setScore(wgzUser.getScore());
|
||||
@ -475,6 +475,12 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
vo.setAvatarName(wgzUser.getAvatarName());
|
||||
vo.setIdentityCard(wgzUser.getIdentityCard());
|
||||
|
||||
//招工信息
|
||||
BgtProjectRecruitApply apply = iBgtProjectRecruitApplyService.getById(recruitApplyId);
|
||||
vo.setEntryTime(apply.getEntryTime());
|
||||
|
||||
Long recruitId = apply.getRecruitId();
|
||||
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitId);
|
||||
vo.setRecruitName(recruit.getRecruitName());
|
||||
|
||||
@ -485,15 +491,10 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
vo.setRecruitId(recruitId);
|
||||
vo.setTaskId(recruit.getTaskId());
|
||||
|
||||
BgtProjectRecruitApply apply = iBgtProjectRecruitApplyService.getOne(Wrappers.<BgtProjectRecruitApply>lambdaQuery()
|
||||
.eq(BgtProjectRecruitApply::getRecruitId, recruitId).eq(BgtProjectRecruitApply::getUserId, userId)
|
||||
.orderByDesc(BgtProjectRecruitApply::getId)
|
||||
.last("limit 1"));
|
||||
vo.setEntryTime(apply.getEntryTime());
|
||||
|
||||
int i = iWgzAttendanceService.count(
|
||||
new LambdaQueryWrapper<WgzAttendance>().
|
||||
eq(WgzAttendance::getUserId, userId).
|
||||
eq(WgzAttendance::getApplyKey,recruitApplyId).
|
||||
eq(WgzAttendance::getRecruitId,recruitId).and(wrapper -> wrapper
|
||||
.isNotNull(WgzAttendance::getClockInTime)
|
||||
.or()
|
||||
@ -515,7 +516,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
vo.setResidueAmount(vo.getAllAmount().subtract(vo.getPayAmount()));
|
||||
|
||||
//未结算天数
|
||||
Integer days = attendanceService.attendanceDetail(userId, recruitId, null);
|
||||
Integer days = attendanceService.unFinishCount(userId, recruitId, recruitApplyId);
|
||||
vo.setIsPay(days>0);
|
||||
return vo;
|
||||
}
|
||||
@ -525,6 +526,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
LambdaQueryWrapper<WgzPayCalculation> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(WgzPayCalculation::getUserId, dto.getUserId())
|
||||
.eq(WgzPayCalculation::getRecruitId, dto.getRecruitId())
|
||||
.eq(WgzPayCalculation::getApplyKey, dto.getRecruitApplyId())
|
||||
.eq(WgzPayCalculation::getAuditorUserId, SecurityUtils.getAppUserId())
|
||||
.in(WgzPayCalculation::getAuditorType,AuditStatus.getAudit())
|
||||
.orderByDesc(WgzPayCalculation::getCreateTime);
|
||||
@ -546,6 +548,7 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
payCalculation.setAuditorTime(LocalDateTime.now());
|
||||
payCalculation.setAuditorUserId(SecurityUtils.getAppUserId());
|
||||
payCalculation.setAuditorUserName(SecurityUtils.getUsername());
|
||||
payCalculation.setApplyKey(dto.getRecruitApplyId());
|
||||
payCalculation.setOperatorType(Constants.BGT);
|
||||
boolean save = save(payCalculation);
|
||||
|
||||
@ -567,6 +570,8 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
|
||||
//修改其余未审批申请的状态
|
||||
List<WgzPayCalculation> payList = list(Wrappers.<WgzPayCalculation>lambdaQuery().eq(WgzPayCalculation::getAuditorType, AuditStatus.UNREAD.getCode())
|
||||
.eq(WgzPayCalculation::getRecruitId, dto.getRecruitId())
|
||||
.eq(WgzPayCalculation::getApplyKey, dto.getRecruitApplyId())
|
||||
.eq(WgzPayCalculation::getUserId, dto.getUserId()));
|
||||
if(CollectionUtil.isNotEmpty(payList)) {
|
||||
payList.forEach(pay -> {
|
||||
@ -587,10 +592,17 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
}
|
||||
|
||||
@Override
|
||||
public BgtApplyForWgzPayAddInfoVO payInfo(Long userId, Long recruitId) {
|
||||
public BgtApplyForWgzPayAddInfoVO payInfo(Long userId, Long recruitApplyId) {
|
||||
BgtApplyForWgzPayAddInfoVO vo = new BgtApplyForWgzPayAddInfoVO();
|
||||
|
||||
//申请信息
|
||||
BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.getById(recruitApplyId);
|
||||
vo.setEntryTime(recruitApply.getEntryTime());
|
||||
vo.setLeaveTime(recruitApply.getLeaveTime());
|
||||
vo.setWorkingState(recruitApply.getStatus().equals("5")?"1":"2");
|
||||
|
||||
//招工信息
|
||||
Long recruitId = recruitApply.getRecruitId();
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitId);
|
||||
vo.setRecruitId(recruitId);
|
||||
vo.setRecruitAmount(recruit.getRecruitAmount());
|
||||
@ -601,16 +613,9 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
|
||||
vo.setTaskId(task.getId());
|
||||
vo.setTaskName(task.getTaskName());
|
||||
vo.setTaskAddress(task.getTaskAddress());
|
||||
|
||||
//申请信息
|
||||
BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.getOneByUserIdAndRecruitId(userId, recruitId);
|
||||
vo.setEntryTime(recruitApply.getEntryTime());
|
||||
vo.setLeaveTime(recruitApply.getLeaveTime());
|
||||
vo.setWorkingState(recruitApply.getStatus().equals("5")?"1":"2");
|
||||
|
||||
//出勤天数
|
||||
//未结算天数
|
||||
Integer i = attendanceService.attendanceDetail(userId, recruitId, null);
|
||||
Integer i = attendanceService.unFinishCount(userId, recruitId, recruitApplyId);
|
||||
|
||||
if(i<=0){
|
||||
throw new BaseException("工资已全部结算完毕");
|
||||
|
||||
Reference in New Issue
Block a user