审批
This commit is contained in:
@ -69,4 +69,9 @@ public class BusLeaveAddReq implements Serializable {
|
||||
* 申请人类型(0-施工人员 1-管理人员 2-分包人员)
|
||||
*/
|
||||
private String userType;
|
||||
|
||||
private Long gangerId;
|
||||
|
||||
private String gangerName;
|
||||
|
||||
}
|
||||
|
||||
@ -25,13 +25,12 @@ public class BusReissueCardManagerReviewReq implements Serializable {
|
||||
/**
|
||||
* 管理员意见(1未读 2同意 3拒绝)
|
||||
*/
|
||||
@NotNull(message = "管理员意见不能为空")
|
||||
private String managerOpinion;
|
||||
private String gangerOpinion;
|
||||
|
||||
/**
|
||||
* 管理员说明
|
||||
* 班组长说明
|
||||
*/
|
||||
private String managerExplain;
|
||||
private String gangerExplain;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
|
||||
@ -60,6 +60,8 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static org.dromara.common.core.constant.TenantConstants.SUPER_ADMIN_ID;
|
||||
|
||||
/**
|
||||
* 施工人员补卡申请Service业务层处理
|
||||
*
|
||||
@ -185,60 +187,46 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean managerReview(BusReissueCardManagerReviewReq req) {
|
||||
// Long id = req.getId();
|
||||
// String managerOpinion = req.getManagerOpinion();
|
||||
// // 判断该补卡记录是否存在
|
||||
// BusReissueCard oldReissueCard = this.getById(id);
|
||||
// if (oldReissueCard == null) {
|
||||
// throw new ServiceException("施工人员补卡申请不存在", HttpStatus.NOT_FOUND);
|
||||
// }
|
||||
// // 如果已经审核过,则返回
|
||||
// if (!BusOpinionStatusEnum.UNREAD.getValue().equals(managerOpinion)) {
|
||||
// throw new ServiceException("该请假已审核,请勿重复操作", HttpStatus.BAD_REQUEST);
|
||||
// }
|
||||
// // 判断班组长是否审核通过
|
||||
// String gangerOpinion = oldReissueCard.getGangerOpinion();
|
||||
// if (!BusOpinionStatusEnum.PASS.getValue().equals(gangerOpinion)) {
|
||||
// throw new ServiceException("请等待班组长审核通过后再进行操作", HttpStatus.BAD_REQUEST);
|
||||
// }
|
||||
// // todo 判断当前用户是否为项目管理员
|
||||
// // 填充默认值,更新数据
|
||||
// BusReissueCard reissueCard = new BusReissueCard();
|
||||
// reissueCard.setId(id);
|
||||
// reissueCard.setManagerOpinion(managerOpinion);
|
||||
// reissueCard.setManagerExplain(req.getManagerExplain());
|
||||
// reissueCard.setManagerTime(new Date());
|
||||
// reissueCard.setRemark(req.getRemark());
|
||||
// boolean result = this.updateById(reissueCard);
|
||||
// if (!result) {
|
||||
// throw new ServiceException("更新管理员审核操作失败", HttpStatus.ERROR);
|
||||
// }
|
||||
// // 更新考勤表记录
|
||||
// BusAttendance oldAttendance = attendanceService.getById(oldReissueCard.getAttendanceId());
|
||||
// if (oldAttendance == null) {
|
||||
// throw new ServiceException("考勤记录不存在", HttpStatus.NOT_FOUND);
|
||||
// }
|
||||
// BusAttendance attendance = new BusAttendance();
|
||||
// BusProject project = projectService.getById(oldReissueCard.getProjectId());
|
||||
// // 根据补卡类型更新考勤时间
|
||||
// String[] clockTime = project.getPunchRange().split(",");
|
||||
// String reissueCardType = oldReissueCard.getReissueCardType();
|
||||
// if (BusAttendanceCommuterEnum.CLOCKIN.getValue().equals(reissueCardType)) {
|
||||
// // 拼接时间,获取项目的上班打卡时间
|
||||
// Date date = DateUtils.combineDateAndTime(oldAttendance.getClockDate(), clockTime[0] + ":00");
|
||||
// attendance.setClockTime(date);
|
||||
// } else if (BusAttendanceCommuterEnum.CLOCKOUT.getValue().equals(reissueCardType)) {
|
||||
// // 拼接时间,获取项目的下班打卡时间
|
||||
// Date date = DateUtils.combineDateAndTime(oldAttendance.getClockDate(), clockTime[1] + ":00");
|
||||
// attendance.setClockTime(date);
|
||||
// }
|
||||
// attendance.setId(oldReissueCard.getAttendanceId());
|
||||
// attendance.setClockStatus(BusAttendanceClockStatusEnum.REISSUE.getValue());
|
||||
// boolean updateAttendance = attendanceService.updateById(attendance);
|
||||
// if (!updateAttendance) {
|
||||
// throw new ServiceException("更新考勤记录失败", HttpStatus.ERROR);
|
||||
// }
|
||||
return true;
|
||||
|
||||
BusReissueCard bean = getById(req.getId());
|
||||
if (bean == null) {
|
||||
throw new ServiceException("未找到该申请");
|
||||
}
|
||||
Long attendanceId = bean.getAttendanceId();
|
||||
BeanUtil.copyProperties(req, bean);
|
||||
boolean b = updateById(bean);
|
||||
if("2".equals(bean.getGangerOpinion())){
|
||||
BusAttendance byId = attendanceService.getById(attendanceId);
|
||||
String clockStatus = byId.getClockStatus();
|
||||
byId.setClockStatus(BusAttendanceClockStatusEnum.REISSUE.getValue());
|
||||
attendanceService.updateById(byId);
|
||||
//缺卡补充当天的工资表
|
||||
if(BusAttendanceClockStatusEnum.UNCLOCK.getValue().equals(clockStatus)){
|
||||
userSalaryDetailService.insertByAttendance(byId.getUserId(),byId.getClockDate());
|
||||
}
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
chatServerHandler.sendSystemMessageToUser(bean.getUserId(),"补卡申请已通过","1");
|
||||
} catch (Exception e) {
|
||||
log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", bean.getUserId(), "补卡申请已通过", e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
if("3".equals(bean.getGangerOpinion())){
|
||||
BusAttendance byId = attendanceService.getById(attendanceId);
|
||||
byId.setHandle("0");
|
||||
attendanceService.updateById(byId);
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
chatServerHandler.sendSystemMessageToUser(bean.getUserId(),"补卡申请未通过","1");
|
||||
} catch (Exception e) {
|
||||
log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", bean.getUserId(), "补卡申请未通过", e);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -312,13 +300,15 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
|
||||
// 精确查询
|
||||
lqw.eq(ObjectUtils.isNotEmpty(id), BusReissueCard::getId, id);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(userId), BusReissueCard::getUserId, userId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(gangerId), BusReissueCard::getGangerId, gangerId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(gangerId) && !Objects.equals(gangerId, SUPER_ADMIN_ID), BusReissueCard::getGangerId, gangerId);
|
||||
lqw.eq(StringUtils.isNotBlank(gangerOpinion), BusReissueCard::getGangerOpinion, gangerOpinion);
|
||||
lqw.eq(StringUtils.isNotBlank(managerOpinion), BusReissueCard::getManagerOpinion, managerOpinion);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(projectId), BusReissueCard::getProjectId, projectId);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(teamId), BusReissueCard::getTeamId, teamId);
|
||||
lqw.eq(StringUtils.isNotBlank(reissueCardType), BusReissueCard::getReissueCardType, reissueCardType);
|
||||
lqw.eq(ObjectUtils.isNotEmpty(attendanceId), BusReissueCard::getAttendanceId, attendanceId);
|
||||
|
||||
lqw.orderByDesc(BusReissueCard::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user