111
This commit is contained in:
		@ -524,7 +524,7 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
		BgtProjectRecruitApply recruitApply = queryById(req.getRecruitApplyId());
 | 
			
		||||
		BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getRecruitId());
 | 
			
		||||
		//数据库行级锁
 | 
			
		||||
		String s = new WgzMessageServiceImpl().JudgingRecruitment(req.getRecruitApplyId(), recruit.getRecruitStaffNum(), recruit.getRecruitEndTime());
 | 
			
		||||
		String s = iWgzMessageService.JudgingRecruitment(req.getRecruitApplyId(), recruit.getRecruitStaffNum(), recruit.getRecruitEndTime());
 | 
			
		||||
		switch (s) {
 | 
			
		||||
			case "1":
 | 
			
		||||
				throw new RuntimeException("已招满!");
 | 
			
		||||
 | 
			
		||||
@ -47,6 +47,10 @@ public class WgzAppJobListingRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("工种")
 | 
			
		||||
	private String typeOfWork;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("工种名称")
 | 
			
		||||
	private String typeOfWorkLabel;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("申请者数量")
 | 
			
		||||
	private Integer numberOfRegistered;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -74,6 +74,12 @@ public class WgzAppProjectDetailsRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("招工要求")
 | 
			
		||||
	private String recruitRequirement;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("工种")
 | 
			
		||||
	private String typeOfWork;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("工种名称")
 | 
			
		||||
	private String typeOfWorkLabel;
 | 
			
		||||
 | 
			
		||||
	//---------
 | 
			
		||||
	//---------
 | 
			
		||||
	//---------
 | 
			
		||||
 | 
			
		||||
@ -32,7 +32,7 @@ public class WgzAppRegisteredProjectRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("招工名称")
 | 
			
		||||
	private String recruitName;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("创建时间")
 | 
			
		||||
	@ApiModelProperty("创建时间/报名时间")
 | 
			
		||||
	private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("封面图(多个逗号分隔)")
 | 
			
		||||
@ -59,5 +59,11 @@ public class WgzAppRegisteredProjectRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("已报名数量")
 | 
			
		||||
	private Integer numberOfRegistered;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("工种")
 | 
			
		||||
	private String typeOfWork;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("工种名称")
 | 
			
		||||
	private String typeOfWorkLabel;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -82,6 +82,9 @@ public class WgzAppRegistrationInformationRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("招工是否正常(0正常 1已招满 2已失效)")
 | 
			
		||||
	private String full;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("务工者同意拒绝状态:3务工者同意  4务工者拒绝")
 | 
			
		||||
	private String status;
 | 
			
		||||
 | 
			
		||||
//	@ApiModelProperty("附件实体数据")
 | 
			
		||||
//	private List<Annex> annex;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -11,6 +11,7 @@ import com.ruoyi.wgz.domain.WgzMessage;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.BaseMapperPlus;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.cache.MybatisPlusRedisCache;
 | 
			
		||||
import org.apache.ibatis.annotations.CacheNamespace;
 | 
			
		||||
import org.apache.ibatis.annotations.Options;
 | 
			
		||||
import org.apache.ibatis.annotations.Param;
 | 
			
		||||
import org.apache.ibatis.annotations.Select;
 | 
			
		||||
 | 
			
		||||
@ -35,6 +36,7 @@ public interface WgzMessageMapper extends BaseMapperPlus<WgzMessage> {
 | 
			
		||||
	//分页查询消息列表
 | 
			
		||||
	Page<WgzAppGetMessageListRes> pagingQueryTheMessageList(@Param("page") Page<WgzAppGetMessageListReq> page,@Param("req") WgzAppGetMessageListReq req);
 | 
			
		||||
 | 
			
		||||
	@Select("SELECT count(1)  FROM bgt_project_recruit_apply WHERE recruit_id = #{recruitId} and status in ('3','4')")
 | 
			
		||||
	int countRecruitApply(Long recruitId);
 | 
			
		||||
	@Select("SELECT count(1)  FROM bgt_project_recruit_apply WHERE recruit_id = #{recruitId} and status in ('3','4')  FOR UPDATE")
 | 
			
		||||
	@Options(useCache = false)  // 禁用 MyBatis 缓存
 | 
			
		||||
	int countRecruitApply(@Param("recruitId") Long recruitId);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,7 @@ import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@ -87,6 +88,11 @@ public interface IWgzMessageService extends IServicePlus<WgzMessage> {
 | 
			
		||||
	 */
 | 
			
		||||
	WgzAppRegistrationInformationRes userRegistrationInformation(Long messageId);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 判断招工是否已招满或已过期
 | 
			
		||||
	 */
 | 
			
		||||
	String JudgingRecruitment(Long recruitId, int num, LocalDate recruitEndTime);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 修改已读未读状态
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
@ -160,16 +160,13 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
		BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
 | 
			
		||||
		//3、根据工地id得到完整的工地信息
 | 
			
		||||
		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);
 | 
			
		||||
//		if (wgzLeave != null) { //表示有请假申请
 | 
			
		||||
//			LocalDateTime startTime = wgzLeave.getStartTime();
 | 
			
		||||
//			LocalDate localDate = startTime.toLocalDate();
 | 
			
		||||
//			throw new RuntimeException("您有已通过的请假申请,请假时间为:"+localDate);
 | 
			
		||||
//		}
 | 
			
		||||
		//4、在进场时间时才能打卡,如果有退场记录就不允许打卡
 | 
			
		||||
 | 
			
		||||
		if (by.getEntryTime() == null) {
 | 
			
		||||
			throw new RuntimeException("需要进场才能实现打卡操作!");
 | 
			
		||||
		}
 | 
			
		||||
		if (by.getLeaveTime() != null) {
 | 
			
		||||
			throw new RuntimeException("您已离场,无法进行打卡操作!");
 | 
			
		||||
		}
 | 
			
		||||
		//5、查看当前人、当前工地、当天的打卡记录
 | 
			
		||||
		String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
 | 
			
		||||
		WgzAttendance we = publicFindByUserIdWait(appUserId, by.getRecruitId(), formattedDate);
 | 
			
		||||
 | 
			
		||||
@ -36,6 +36,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
			
		||||
import com.ruoyi.wgz.bo.WgzMessageQueryBo;
 | 
			
		||||
import com.ruoyi.wgz.mapper.WgzMessageMapper;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzMessageService;
 | 
			
		||||
import org.springframework.transaction.annotation.Propagation;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
@ -228,14 +230,10 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
 | 
			
		||||
	 * @param recruitEndTime 招工结束时间
 | 
			
		||||
	 * @return
 | 
			
		||||
	 */
 | 
			
		||||
	@Override
 | 
			
		||||
	public String JudgingRecruitment(Long recruitId,int num,LocalDate recruitEndTime) {
 | 
			
		||||
		//使用数据库行级锁
 | 
			
		||||
		int count = baseMapper.countRecruitApply(recruitId);
 | 
			
		||||
//		int count = iBgtProjectRecruitApplyService.count(
 | 
			
		||||
//			Wrappers.<BgtProjectRecruitApply>lambdaQuery()
 | 
			
		||||
//				.eq(BgtProjectRecruitApply::getRecruitId, recruitId)
 | 
			
		||||
//				.in(BgtProjectRecruitApply::getStatus, Arrays.asList("3", "4"))
 | 
			
		||||
//		);
 | 
			
		||||
		if(count == num){
 | 
			
		||||
			return "1";
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user