优化
This commit is contained in:
		@ -249,7 +249,11 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
			throw new RuntimeException("已有工地!不可再次申请!");
 | 
			
		||||
		}
 | 
			
		||||
		WgzUser byId = wgzUserService.findByUserId(appUserId);
 | 
			
		||||
		if (!Objects.equals(appById.getTypeOfWork(), byId.getTypeOfWork())) {
 | 
			
		||||
		if (byId == null) {
 | 
			
		||||
			throw new RuntimeException("查询不到用户信息!");
 | 
			
		||||
		}
 | 
			
		||||
		List<String> list = Arrays.asList(byId.getTypeOfWork().split(","));
 | 
			
		||||
		if (!list.contains(appById.getTypeOfWork())){
 | 
			
		||||
			throw new RuntimeException("工种不匹配!");
 | 
			
		||||
		}
 | 
			
		||||
		//4、判断当前用户是否已经申请过了,如果已经申请过了,就不能再次申请了
 | 
			
		||||
@ -263,6 +267,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
		}
 | 
			
		||||
		//3、插入数据
 | 
			
		||||
		BgtProjectRecruitApply bgtProjectRecruitApply = new BgtProjectRecruitApply();
 | 
			
		||||
		bgtProjectRecruitApply.setTaskId(appById.getTaskId());
 | 
			
		||||
		bgtProjectRecruitApply.setRecruitId(id);
 | 
			
		||||
		bgtProjectRecruitApply.setUserId(appUserId);
 | 
			
		||||
		int insert = baseMapper.insert(bgtProjectRecruitApply);
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
 | 
			
		||||
/**
 | 
			
		||||
 * 业务定时任务
 | 
			
		||||
 *
 | 
			
		||||
 * @author ruoyi
 | 
			
		||||
 * @author ruoyi  businessTask.leave
 | 
			
		||||
 */
 | 
			
		||||
@Slf4j
 | 
			
		||||
@Component("businessTask")
 | 
			
		||||
@ -138,7 +138,7 @@ public class BusinessTask
 | 
			
		||||
						.setDailyWage(recruit.getRecruitAmount())
 | 
			
		||||
						.setDate(now)
 | 
			
		||||
						.setMissedIn(1)
 | 
			
		||||
						.setExceptionType("3,");
 | 
			
		||||
						.setExceptionType("3,").setUpdateBy("系统").setCreateBy("系统");
 | 
			
		||||
					lists.add(attendance);
 | 
			
		||||
					//添加消息提醒
 | 
			
		||||
					WgzMessage wgzMessage = new WgzMessage().
 | 
			
		||||
@ -150,7 +150,7 @@ public class BusinessTask
 | 
			
		||||
//						setTableId(apply.getId()).
 | 
			
		||||
//						setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
						setMessageLargeType(LARGE_OTHER).
 | 
			
		||||
						setMessageSmallType(SMALL_SYSTEM);
 | 
			
		||||
						setMessageSmallType(SMALL_SYSTEM).setUpdateBy("系统").setCreateBy("系统");
 | 
			
		||||
					messages.add(wgzMessage);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@ -210,7 +210,7 @@ public class BusinessTask
 | 
			
		||||
					WgzAttendance attendance = new WgzAttendance()
 | 
			
		||||
						.setId(one.getId())
 | 
			
		||||
						.setMissedOut(1)
 | 
			
		||||
						.setExceptionType("4,");
 | 
			
		||||
						.setExceptionType("4,").setUpdateBy("系统").setCreateBy("系统");
 | 
			
		||||
					lists.add(attendance);
 | 
			
		||||
					//添加消息提醒
 | 
			
		||||
					WgzMessage wgzMessage = new WgzMessage().
 | 
			
		||||
@ -222,7 +222,7 @@ public class BusinessTask
 | 
			
		||||
//						setTableId(apply.getId()).
 | 
			
		||||
//						setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
						setMessageLargeType(LARGE_OTHER).
 | 
			
		||||
						setMessageSmallType(SMALL_SYSTEM);
 | 
			
		||||
						setMessageSmallType(SMALL_SYSTEM).setUpdateBy("系统").setCreateBy("系统");
 | 
			
		||||
					messages.add(wgzMessage);
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -58,9 +58,9 @@ public class WgzAppRealNameAuthenticationReq implements Serializable {
 | 
			
		||||
	@NotBlank(message = "地址不能为空")
 | 
			
		||||
	private String site;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("联系电话")
 | 
			
		||||
	@NotBlank(message = "联系电话不能为空")
 | 
			
		||||
	private String phone;
 | 
			
		||||
//	@ApiModelProperty("联系电话")
 | 
			
		||||
//	@NotBlank(message = "联系电话不能为空")
 | 
			
		||||
//	private String phone;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("银行")
 | 
			
		||||
	@NotBlank(message = "银行不能为空")
 | 
			
		||||
 | 
			
		||||
@ -163,7 +163,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
		//2、获取当前用户所在的工地id
 | 
			
		||||
		BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
 | 
			
		||||
		//3、根据工地id得到完整的工地信息
 | 
			
		||||
		BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId());
 | 
			
		||||
		BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId());
 | 
			
		||||
//		//4、查看当前用户是否有请假申请,有请假申请并且通过,那就无法进行打卡------------------>此处代码将改写逻辑为:每天凌晨1分的时候直接找出已请假的人然后定时插入数据到打卡记录中标记为请假
 | 
			
		||||
//		String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
 | 
			
		||||
//		WgzLeave wgzLeave = iWgzLeaveService.FindAskForLeaveOrNotInfo(appUserId, by.getId(), formattedDate);
 | 
			
		||||
@ -174,7 +174,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
//		}
 | 
			
		||||
		//5、查看当前人、当前工地、当天的打卡记录
 | 
			
		||||
		String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
 | 
			
		||||
		WgzAttendance we = publicFindByUserIdWait(appUserId, by.getId(), formattedDate);
 | 
			
		||||
		WgzAttendance we = publicFindByUserIdWait(appUserId, by.getRecruitId(), formattedDate);
 | 
			
		||||
		if (we !=null && we.getLeaveMarkId() != null && we.getLeaveMarkId()!= 0) {
 | 
			
		||||
			throw new RuntimeException("您有已通过的请假申请,请假时间为:"+formattedDate);
 | 
			
		||||
		}
 | 
			
		||||
@ -187,17 +187,8 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
			setPnchOsition(req.getPnchOsition());
 | 
			
		||||
		LocalDateTime now = LocalDateTime.now(); //当前完整年月日时分秒
 | 
			
		||||
		LocalTime localTime = now.toLocalTime(); //获取时分秒
 | 
			
		||||
		if (Objects.isNull(we)) { //表示当天第一次打卡---上班  否则  表示当天不是第一次打卡---下班
 | 
			
		||||
			wgzAttendance.setClockInTime(now);
 | 
			
		||||
			LocalTime beginWorkTime = appById.getBeginWorkTime(); //上班
 | 
			
		||||
			if (!localTime.isBefore(beginWorkTime)) {
 | 
			
		||||
				wgzAttendance.setLate(1); //迟到
 | 
			
		||||
				wgzAttendance.setLateTime(now);
 | 
			
		||||
				wgzAttendance.setExceptionType("1,");
 | 
			
		||||
			}
 | 
			
		||||
			return baseMapper.insert(wgzAttendance) > 0;
 | 
			
		||||
		}else{
 | 
			
		||||
			//7、获取上次打卡时间与这次打卡时间的间隔是否超过3分钟
 | 
			
		||||
		if (we !=null) {
 | 
			
		||||
			//获取上次打卡时间与这次打卡时间的间隔是否超过3分钟
 | 
			
		||||
			boolean flag = isMinutesDifferenceGreaterThanThree(we.getClockInTime(), now);
 | 
			
		||||
			if (!flag){
 | 
			
		||||
				throw new RuntimeException("打卡时间间隔不能少于3分钟");
 | 
			
		||||
@ -212,6 +203,15 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
				wgzAttendance.setExceptionType(exceptionType+"2,");
 | 
			
		||||
			}
 | 
			
		||||
			return baseMapper.updateById(wgzAttendance) > 0;
 | 
			
		||||
		}else{
 | 
			
		||||
			wgzAttendance.setClockInTime(now);
 | 
			
		||||
			LocalTime beginWorkTime = appById.getBeginWorkTime(); //上班
 | 
			
		||||
			if (!localTime.isBefore(beginWorkTime)) {
 | 
			
		||||
				wgzAttendance.setLate(1); //迟到
 | 
			
		||||
				wgzAttendance.setLateTime(now);
 | 
			
		||||
				wgzAttendance.setExceptionType("1,");
 | 
			
		||||
			}
 | 
			
		||||
			return baseMapper.insert(wgzAttendance) > 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -237,7 +237,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
		Long appUserId = SecurityUtils.getAppUserId();
 | 
			
		||||
		BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
 | 
			
		||||
		String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
 | 
			
		||||
		WgzAttendance wgzAttendance = publicFindByUserIdWait(appUserId, by.getId(), formattedDate);
 | 
			
		||||
		WgzAttendance wgzAttendance = publicFindByUserIdWait(appUserId, by.getRecruitId(), formattedDate);
 | 
			
		||||
		//2、获取今日用户打卡状态
 | 
			
		||||
		if (wgzAttendance == null) {
 | 
			
		||||
			res.setClockingCondition(0); //上班
 | 
			
		||||
 | 
			
		||||
@ -182,7 +182,7 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe
 | 
			
		||||
		});
 | 
			
		||||
		//4、获取当前务工者的招工信息的主题及招工创建人的基本信息
 | 
			
		||||
		BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(SecurityUtils.getAppUserId());
 | 
			
		||||
		BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId());
 | 
			
		||||
		BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getRecruitId());
 | 
			
		||||
		BgtUser one = iBgtUserService.getOne(
 | 
			
		||||
			new LambdaQueryWrapper<BgtUser>().
 | 
			
		||||
				eq(BgtUser::getUserId, appById.getUserId())
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user