优化
This commit is contained in:
@ -443,6 +443,12 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean quit(Long id) {
|
||||
BgtProjectRecruitApply recruitApply = getById(id);
|
||||
|
||||
if(RecruitApplyStatus.OUT_WORK.getCode().equals(recruitApply.getStatus())){
|
||||
throw new BaseException("您已退场!");
|
||||
}
|
||||
|
||||
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitApply.getRecruitId());
|
||||
if(RecruitStatus.FULL.getCode().equals(recruit.getStatus())){
|
||||
recruit.setStatus(RecruitStatus.PROGRESS.getCode());
|
||||
|
@ -482,9 +482,6 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
bgtAttendanceVO.setReportToDutyRate(rate);
|
||||
}
|
||||
|
||||
//缺勤人数
|
||||
bgtAttendanceVO.setAbsenceDutyNum(totalNum-bgtAttendanceVO.getReportToDutyNum());
|
||||
|
||||
//任务拥有的所有招工
|
||||
List<BgtProjectRecruit> bgtProjectRecruits = iBgtProjectRecruitService.getBaseMapper().selectList(Wrappers.<BgtProjectRecruit>lambdaQuery()
|
||||
.eq(BgtProjectRecruit::getTaskId, dto.getTaskId()));
|
||||
@ -505,6 +502,11 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
|
||||
.in(WgzAttendance::getRecruitId, recruitIds).eq(WgzAttendance::getDate, date));
|
||||
bgtAttendanceVO.setEarlyLeaveNum(earlyLeaveNum);
|
||||
}
|
||||
|
||||
//缺勤人数
|
||||
bgtAttendanceVO.setAbsenceDutyNum(totalNum-bgtAttendanceVO.getReportToDutyNum()-bgtAttendanceVO.getLeaveNum());
|
||||
|
||||
|
||||
return bgtAttendanceVO;
|
||||
}
|
||||
|
||||
|
@ -286,57 +286,59 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean bgtAudit(BgtLeaveUpdateDTO dto) {
|
||||
WgzLeave wgzLeave = getById(dto.getId());
|
||||
if(!AuditStatus.UNREAD.getCode().equals(wgzLeave.getAuditorType())){
|
||||
throw new BaseException("该条请假申请状态已改变,请刷新页面");
|
||||
if(AuditStatus.getAudit().contains(wgzLeave.getAuditorType())){
|
||||
throw new BaseException("该条请假已审批");
|
||||
}
|
||||
BeanUtil.copyProperties(dto, wgzLeave);
|
||||
wgzLeave.setAuditorTime(LocalDateTime.now());
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(wgzLeave.getRecruitId());
|
||||
|
||||
//发消息
|
||||
HashMap<String, String> mp = new HashMap<>();
|
||||
mp.put("projectName",recruit.getRecruitName());
|
||||
mp.put("auditor",SecurityUtils.getUsername());
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_LEAVE, AuditStatus.PASS.getCode().equals(dto.getAuditorType()));
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(wgzLeave.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
.setSubheading(map.get(SUBHEADING))
|
||||
.setTableId(wgzLeave.getId())
|
||||
.setTableName(SqlHelper.table(WgzLeave.class).getTableName())
|
||||
.setMessageLargeType(LARGE_OTHER)
|
||||
.setMessageSmallType(SMALL_LEAVE);
|
||||
iWgzMessageService.sendAMessage(wgzMessage);
|
||||
if(AuditStatus.getAudit().contains(dto.getAuditorType())){
|
||||
wgzLeave.setAuditorTime(LocalDateTime.now());
|
||||
BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(wgzLeave.getRecruitId());
|
||||
|
||||
if(AuditStatus.PASS.getCode().equals(dto.getAuditorType())){
|
||||
//考勤信息
|
||||
List<WgzAttendance> list = attendanceService.list(Wrappers.<WgzAttendance>lambdaQuery()
|
||||
.eq(WgzAttendance::getRecruitId, recruit.getId())
|
||||
.eq(WgzAttendance::getUserId, wgzLeave.getUserId())
|
||||
.eq(WgzAttendance::getDate, wgzLeave.getStartTime().toLocalDate()));
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
WgzAttendance wgzAttendance = list.get(0);
|
||||
wgzAttendance.setLeaveMarkId(wgzLeave.getId());
|
||||
wgzAttendance.setExceptionType("7");
|
||||
attendanceService.updateById(wgzAttendance);
|
||||
}else {
|
||||
WgzAttendance wgzAttendance = new WgzAttendance();
|
||||
wgzAttendance.setRecruitId(recruit.getId());
|
||||
wgzAttendance.setUserId(wgzLeave.getUserId());
|
||||
wgzAttendance.setLeaveMarkId(wgzLeave.getId());
|
||||
wgzAttendance.setDailyWage(recruit.getRecruitAmount());
|
||||
wgzAttendance.setDate(wgzLeave.getStartTime().toLocalDate());
|
||||
wgzAttendance.setExceptionType("7");
|
||||
attendanceService.save(wgzAttendance);
|
||||
//发消息
|
||||
HashMap<String, String> mp = new HashMap<>();
|
||||
mp.put("projectName",recruit.getRecruitName());
|
||||
mp.put("auditor",SecurityUtils.getUsername());
|
||||
Map<String, String> map = bgtMessage(mp, BGT_TYPE_LEAVE, AuditStatus.PASS.getCode().equals(dto.getAuditorType()));
|
||||
WgzMessage wgzMessage = new WgzMessage()
|
||||
.setSenderType(USERTYPE_BGT)
|
||||
.setSenderId(SecurityUtils.getAppUserId())
|
||||
.setRecipientType(USERTYPE_WGZ)
|
||||
.setRecipientId(wgzLeave.getUserId())
|
||||
.setHeadline(map.get(HEADLINE))
|
||||
.setSubheading(map.get(SUBHEADING))
|
||||
.setTableId(wgzLeave.getId())
|
||||
.setTableName(SqlHelper.table(WgzLeave.class).getTableName())
|
||||
.setMessageLargeType(LARGE_OTHER)
|
||||
.setMessageSmallType(SMALL_LEAVE);
|
||||
iWgzMessageService.sendAMessage(wgzMessage);
|
||||
|
||||
//处理消息
|
||||
iBgtMessageService.operation(USERTYPE_WGZ, wgzLeave.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), wgzLeave.getId(),SqlHelper.table(WgzLeave.class).getTableName());
|
||||
|
||||
if(AuditStatus.PASS.getCode().equals(dto.getAuditorType())){
|
||||
//考勤信息
|
||||
List<WgzAttendance> list = attendanceService.list(Wrappers.<WgzAttendance>lambdaQuery()
|
||||
.eq(WgzAttendance::getRecruitId, recruit.getId())
|
||||
.eq(WgzAttendance::getUserId, wgzLeave.getUserId())
|
||||
.eq(WgzAttendance::getDate, wgzLeave.getStartTime().toLocalDate()));
|
||||
if(CollectionUtil.isNotEmpty(list)){
|
||||
WgzAttendance wgzAttendance = list.get(0);
|
||||
wgzAttendance.setLeaveMarkId(wgzLeave.getId());
|
||||
wgzAttendance.setExceptionType("7");
|
||||
attendanceService.updateById(wgzAttendance);
|
||||
}else {
|
||||
WgzAttendance wgzAttendance = new WgzAttendance();
|
||||
wgzAttendance.setRecruitId(recruit.getId());
|
||||
wgzAttendance.setUserId(wgzLeave.getUserId());
|
||||
wgzAttendance.setLeaveMarkId(wgzLeave.getId());
|
||||
wgzAttendance.setDailyWage(recruit.getRecruitAmount());
|
||||
wgzAttendance.setDate(wgzLeave.getStartTime().toLocalDate());
|
||||
wgzAttendance.setExceptionType("7");
|
||||
attendanceService.save(wgzAttendance);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(AuditStatus.getAudit().contains(dto.getAuditorType())){{
|
||||
//处理消息
|
||||
iBgtMessageService.operation(USERTYPE_WGZ, wgzLeave.getUserId(), USERTYPE_BGT, SecurityUtils.getAppUserId(), wgzLeave.getId(),SqlHelper.table(WgzLeave.class).getTableName());
|
||||
}}
|
||||
return updateById(wgzLeave);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user