|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|