优化
This commit is contained in:
		| @ -1,11 +1,14 @@ | ||||
| package com.ruoyi.bgt.domain.dto; | ||||
|  | ||||
| import com.fasterxml.jackson.annotation.JsonFormat; | ||||
| import com.ruoyi.common.core.domain.BaseEntity; | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
| import lombok.EqualsAndHashCode; | ||||
| import org.springframework.format.annotation.DateTimeFormat; | ||||
|  | ||||
| import java.time.LocalDate; | ||||
| import java.util.List; | ||||
|  | ||||
| @Data | ||||
| @ -32,4 +35,15 @@ public class BgtProjectRecruitApplyQueryDTO extends BaseEntity { | ||||
| 	@ApiModelProperty("务工者名字") | ||||
| 	private String username; | ||||
|  | ||||
| 	@ApiModelProperty("日期") | ||||
| 	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8") | ||||
| 	@DateTimeFormat(pattern = "yyyy-MM-dd") | ||||
| 	private LocalDate date; | ||||
|  | ||||
| 	@ApiModelProperty(value = "开始日期",hidden = true) | ||||
| 	private LocalDate beginDate; | ||||
|  | ||||
| 	@ApiModelProperty(value = "开始日期",hidden = true) | ||||
| 	private LocalDate endDate; | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -37,5 +37,11 @@ public class BgtAttendanceCountVO implements Serializable { | ||||
| 	@ApiModelProperty("缺勤人数") | ||||
| 	private Integer absenceDutyNum; | ||||
|  | ||||
| 	@ApiModelProperty("到岗率总和") | ||||
| 	private Integer rateSum; | ||||
|  | ||||
| 	@ApiModelProperty("到岗率天数") | ||||
| 	private Integer rateDay; | ||||
|  | ||||
|  | ||||
| } | ||||
|  | ||||
| @ -29,6 +29,9 @@ public class BgtMessageVO implements Serializable { | ||||
| 	@ApiModelProperty("表ID") | ||||
| 	private Long tableId; | ||||
|  | ||||
| 	@ApiModelProperty("发送人") | ||||
| 	private Long senderId; | ||||
|  | ||||
|     @ApiModelProperty("标题") | ||||
|     private String headline; | ||||
|  | ||||
|  | ||||
| @ -60,6 +60,9 @@ public class BgtProjectRecruitApplyVO implements Serializable { | ||||
| 	@ApiModelProperty("招工主题") | ||||
| 	private String recruitName; | ||||
|  | ||||
| 	@ApiModelProperty("任务Id") | ||||
| 	private Long taskId; | ||||
|  | ||||
| 	@ApiModelProperty("任务名") | ||||
| 	private String taskName; | ||||
|  | ||||
|  | ||||
| @ -115,4 +115,7 @@ public class BgtProjectRecruitDetailVO implements Serializable { | ||||
|  | ||||
| 	@ApiModelProperty("同意人数") | ||||
| 	private Integer passNum; | ||||
|  | ||||
| 	@ApiModelProperty("招工状态(1-进行中,2-已招满,3-已过期)") | ||||
| 	private String status; | ||||
| } | ||||
|  | ||||
| @ -55,6 +55,9 @@ public class BgtProjectRecruitVO implements Serializable { | ||||
| 	@ApiModelProperty("工种") | ||||
| 	private String typeOfWork; | ||||
|  | ||||
| 	@ApiModelProperty("招工状态(1-进行中,2-已招满,3-已过期)") | ||||
| 	private String status; | ||||
|  | ||||
| 	@ApiModelProperty("申请者列表") | ||||
| 	List<BgtProjectRecruitApplyVO> applyList; | ||||
|  | ||||
|  | ||||
| @ -129,4 +129,7 @@ public interface IBgtProjectRecruitApplyService extends IServicePlus<BgtProjectR | ||||
| 	 * 项目详情·确认|拒绝报名 | ||||
| 	 */ | ||||
| 	Boolean userConfirmRegistration(@Validated WgzAppConfirmRegistrationReq req); | ||||
|  | ||||
|  | ||||
| 	BgtProjectRecruitApply getOne(Long recruitId,Long userId); | ||||
| } | ||||
|  | ||||
| @ -170,6 +170,7 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt | ||||
| 	public TableDataInfo<BgtMessageVO> queryMyPageList(BgtMessageMyListDTO dto) { | ||||
| 		LambdaQueryWrapper<BgtMessage> wrapper = new LambdaQueryWrapper<>(); | ||||
| 		wrapper.eq(BgtMessage::getRecipientId, SecurityUtils.getAppUserId()); | ||||
| 		wrapper.orderByDesc(BgtMessage::getCreateTime); | ||||
| 		Page<BgtMessage> result = page(PageUtils.buildPage(), wrapper); | ||||
| 		Page<BgtMessageVO> bgtMessageVOPage = new Page<>(); | ||||
| 		bgtMessageVOPage.setTotal(result.getTotal()); | ||||
|  | ||||
| @ -48,6 +48,7 @@ import org.springframework.transaction.annotation.Transactional; | ||||
| import java.text.DecimalFormat; | ||||
| import java.time.LocalDate; | ||||
| import java.time.LocalTime; | ||||
| import java.time.temporal.TemporalAdjusters; | ||||
| import java.util.*; | ||||
|  | ||||
| import static com.ruoyi.common.constants.BgtMessageConstant.*; | ||||
| @ -145,7 +146,11 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec | ||||
| 				dto.getRecruitIds().addAll(recruitIdsByTaskId); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| 		if(dto.getDate()!=null){ | ||||
| 			LocalDate date = dto.getDate(); | ||||
| 			dto.setBeginDate(date.with(TemporalAdjusters.firstDayOfMonth())); | ||||
| 			dto.setEndDate(date.with(TemporalAdjusters.lastDayOfMonth())); | ||||
| 		} | ||||
| 		Page<BgtProjectRecruitApplyQueryDTO> queryDTOPage = new Page<>(); | ||||
| 		queryDTOPage.setCurrent(dto.getPageNum()); | ||||
| 		queryDTOPage.setSize(dto.getPageSize()); | ||||
| @ -179,6 +184,12 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec | ||||
| 		if (CollectionUtil.isNotEmpty(list)) { | ||||
| 			throw new BaseException("该务工者已进入其他工地"); | ||||
| 		} | ||||
|  | ||||
| 		BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(recruitApply.getRecruitId()); | ||||
| 		if(LocalDate.now().isAfter(recruit.getRecruitEndTime())){ | ||||
| 			throw new BaseException("该岗位已过期"); | ||||
| 		} | ||||
|  | ||||
| 		recruitApply.setEntryTime(dto.getEntryTime()); | ||||
| 		recruitApply.setStatus(RecruitApplyStatus.BGT_PASS.getCode()); | ||||
| 		dto.getEntryMaterials().addAll(dto.getInsurances()); | ||||
| @ -411,6 +422,9 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec | ||||
| 		double rawNewScore = wgzScoreRecords.stream() | ||||
| 			.mapToDouble(WgzScoreRecord::getScore) | ||||
| 			.sum(); | ||||
| 		if(!wgzScoreRecords.isEmpty()){ | ||||
| 			rawNewScore = rawNewScore/wgzScoreRecords.size(); | ||||
| 		} | ||||
| 		// 使用 DecimalFormat 格式化结果 | ||||
| 		DecimalFormat df = new DecimalFormat("#.0"); | ||||
| 		String formatted = df.format(rawNewScore); | ||||
| @ -545,4 +559,11 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec | ||||
| 		return false; | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	@Override | ||||
| 	public BgtProjectRecruitApply getOne(Long recruitId, Long userId) { | ||||
| 		List<BgtProjectRecruitApply> list = baseMapper.selectList(Wrappers.<BgtProjectRecruitApply>lambdaQuery().eq(BgtProjectRecruitApply::getRecruitId, recruitId) | ||||
| 			.eq(BgtProjectRecruitApply::getUserId, userId)); | ||||
| 		return list.get(0); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -103,9 +103,8 @@ public class BgtWageApplicationServiceImpl extends ServicePlusImpl<BgtWageApplic | ||||
| 			.setSubheading(map.get(SUBHEADING)) | ||||
| 			.setTableId(task.getId()) | ||||
| 			.setTableName(SqlHelper.table(FbsProjectTask.class).getTableName()) | ||||
| 			.setMessageLargeType(BGT_LARGE_TASK); | ||||
| 			.setMessageLargeType(BGT_LARGE_SETTLEMENT); | ||||
| 		bgtMessageService.sendAMessage(bgtMessage); | ||||
|  | ||||
|         return save; | ||||
|     } | ||||
|  | ||||
|  | ||||
| @ -3,6 +3,8 @@ package com.ruoyi.common.util; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import com.ruoyi.bgt.domain.vo.BgtAttendanceCountVO; | ||||
|  | ||||
| import java.math.BigDecimal; | ||||
| import java.math.RoundingMode; | ||||
| import java.time.*; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.util.*; | ||||
| @ -24,7 +26,7 @@ public class DataUtil { | ||||
| 		while (!currentDate.isAfter(endDate)) { | ||||
| 			if (!existingDates.contains(currentDate)) { | ||||
| 				// 如果当前日期不在已有日期集合中,创建一个新的 BgtAttendanceCountVO 对象并添加到结果列表中 | ||||
| 				filledList.add(new BgtAttendanceCountVO(0,0,currentDate,0)); | ||||
| 				filledList.add(new BgtAttendanceCountVO(0,0,currentDate,0,0,0)); | ||||
| 			} | ||||
| 			// 日期递增一天 | ||||
| 			currentDate = currentDate.plusDays(1); | ||||
| @ -50,11 +52,21 @@ public class DataUtil { | ||||
| 			if (monthMap.containsKey(yearMonth)) { | ||||
| 				BgtAttendanceCountVO existingVO = monthMap.get(yearMonth); | ||||
| 				existingVO.setReportToDutyNum(existingVO.getReportToDutyNum() + countVO.getReportToDutyNum()); | ||||
| 				existingVO.setTotalNum(existingVO.getTotalNum()>countVO.getTotalNum()?existingVO.getTotalNum():countVO.getTotalNum()); | ||||
| 				existingVO.setAbsenceDutyNum(existingVO.getAbsenceDutyNum() + countVO.getTotalNum()-countVO.getReportToDutyNum()); | ||||
| 				int rate = new BigDecimal(countVO.getReportToDutyNum()).divide(new BigDecimal(countVO.getTotalNum()), 2, RoundingMode.HALF_UP) | ||||
| 					.multiply(new BigDecimal(100)).intValue(); | ||||
| 				existingVO.setRateSum(existingVO.getRateSum()+rate); | ||||
| 				existingVO.setRateDay(existingVO.getRateDay()+1); | ||||
| 			} else { | ||||
| 				// 如果该月份不在 map 中,则创建一个新的 BgtAttendanceCountVO 对象 | ||||
| 				BgtAttendanceCountVO newVO = new BgtAttendanceCountVO(countVO.getReportToDutyNum(), countVO.getTotalNum(), date.withDayOfMonth(1),0); | ||||
| 				BgtAttendanceCountVO newVO = new BgtAttendanceCountVO(countVO.getReportToDutyNum(), countVO.getTotalNum(), date.withDayOfMonth(1),0,0,0); | ||||
| 				if(countVO.getTotalNum()>0){ | ||||
| 					newVO.setAbsenceDutyNum(countVO.getTotalNum()-countVO.getReportToDutyNum()); | ||||
| 					int rate = new BigDecimal(countVO.getReportToDutyNum()).divide(new BigDecimal(countVO.getTotalNum()), 2, RoundingMode.HALF_UP) | ||||
| 						.multiply(new BigDecimal(100)).intValue(); | ||||
| 					newVO.setRateSum(rate); | ||||
| 					newVO.setRateDay(1); | ||||
| 				} | ||||
| 				monthMap.put(yearMonth, newVO); | ||||
| 			} | ||||
| 		} | ||||
| @ -73,7 +85,7 @@ public class DataUtil { | ||||
| 				result.add(monthMap.get(currentMonth)); | ||||
| 			} else { | ||||
| 				// 如果该月份没有统计数据,则创建一个新的 BgtAttendanceCountVO 对象,将到岗人数和总人数都设置为 0 | ||||
| 				BgtAttendanceCountVO emptyVO = new BgtAttendanceCountVO(0, 0, currentMonth.atDay(1),0); | ||||
| 				BgtAttendanceCountVO emptyVO = new BgtAttendanceCountVO(0, 0, currentMonth.atDay(1),0,0,0); | ||||
| 				result.add(emptyVO); | ||||
| 			} | ||||
| 		} | ||||
|  | ||||
| @ -9,6 +9,7 @@ import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService; | ||||
| import com.ruoyi.bgt.service.IBgtProjectRecruitService; | ||||
| import com.ruoyi.common.constants.WgzAndBgtMessageConstant; | ||||
| import com.ruoyi.common.enums.RecruitApplyStatus; | ||||
| import com.ruoyi.common.enums.RecruitStatus; | ||||
| import com.ruoyi.fbs.domain.FbsProjectTask; | ||||
| import com.ruoyi.fbs.service.IFbsProjectTaskService; | ||||
| import com.ruoyi.wgz.domain.WgzAttendance; | ||||
| @ -77,11 +78,13 @@ public class BusinessTask | ||||
| 			.lt(BgtProjectRecruit::getRecruitEndTime, LocalDate.now())); | ||||
| 		if(CollectionUtil.isNotEmpty(recruitList)){ | ||||
| 			List<Long> recruitIds = recruitList.stream().map(BgtProjectRecruit::getId).collect(Collectors.toList()); | ||||
| 			recruitApplyService.<BgtProjectRecruitApply>lambdaUpdate() | ||||
| 			recruitApplyService.lambdaUpdate() | ||||
| 				.in(BgtProjectRecruitApply::getRecruitId, recruitIds) | ||||
| 				.in(BgtProjectRecruitApply::getStatus,status) | ||||
| 				.set(BgtProjectRecruitApply::getStatus,RecruitApplyStatus.BGT_REFUSE.getCode()) | ||||
| 				.update(); | ||||
| 			recruitService.lambdaUpdate().in(BgtProjectRecruit::getId, recruitIds) | ||||
| 				.set(BgtProjectRecruit::getStatus,RecruitStatus.OVERDUE.getCode()).update(); | ||||
| 		} | ||||
| 		Console.log("招工拒绝任务结束,此次拒绝任务个数:"+recruitList.size()); | ||||
| 	} | ||||
| @ -92,7 +95,7 @@ public class BusinessTask | ||||
| 	public void entry() | ||||
| 	{ | ||||
| 		Console.log("开始招工进场任务"); | ||||
| 		recruitApplyService.<BgtProjectRecruitApply>lambdaUpdate() | ||||
| 		recruitApplyService.lambdaUpdate() | ||||
| 			.eq(BgtProjectRecruitApply::getEntryTime, LocalDate.now()) | ||||
| 			.eq(BgtProjectRecruitApply::getStatus,RecruitApplyStatus.WGZ_PASS.getCode()) | ||||
| 			.set(BgtProjectRecruitApply::getStatus,RecruitApplyStatus.BGT_REFUSE.getCode()) | ||||
|  | ||||
| @ -75,4 +75,7 @@ public class WgzAppPersonalBasicInformationRes implements Serializable { | ||||
|  | ||||
| 	@ApiModelProperty("工种名") | ||||
| 	private String typeOfWorkName; | ||||
|  | ||||
| 	@ApiModelProperty("是否被选择") | ||||
| 	private Boolean isChoose; | ||||
| } | ||||
|  | ||||
| @ -23,4 +23,9 @@ public interface WgzAttendanceMapper extends BaseMapperPlus<WgzAttendance> { | ||||
|  | ||||
| 	List<BgtAttendanceCountVO> countByTaskId(@Param("taskId") Long taskId, @Param("beginDate")LocalDate beginDate | ||||
| 		, @Param("endDate")LocalDate endDate); | ||||
|  | ||||
| 	Integer dayTotalNum(@Param("taskId") Long taskId, @Param("date")LocalDate date); | ||||
|  | ||||
| 	Integer monthTotalNum(@Param("taskId") Long taskId, @Param("beginDate")LocalDate beginDate | ||||
| 		, @Param("endDate")LocalDate endDate); | ||||
| } | ||||
|  | ||||
| @ -106,7 +106,12 @@ public interface IWgzAttendanceService extends IServicePlus<WgzAttendance> { | ||||
| 	 */ | ||||
| 	List<BgtAttendanceCountVO> countByTaskId(Long taskId, LocalDate beginDate, LocalDate endDate); | ||||
|  | ||||
| 	/** | ||||
| 	 * 统计某天应打卡人数 | ||||
| 	 */ | ||||
| 	Integer dayTotalNum(Long taskId,LocalDate date); | ||||
|  | ||||
| 	Integer monthTotalNum(Long taskId,LocalDate beginDate, LocalDate endDate); | ||||
| 	/** | ||||
| 	 * 总体考勤情况 | ||||
| 	 */ | ||||
|  | ||||
| @ -45,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional; | ||||
| import java.math.BigDecimal; | ||||
| import java.math.RoundingMode; | ||||
| import java.text.DecimalFormat; | ||||
| import java.text.SimpleDateFormat; | ||||
| import java.time.*; | ||||
| import java.time.format.DateTimeFormatter; | ||||
| import java.time.temporal.TemporalAdjusters; | ||||
| @ -63,7 +62,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
| 	//上班打卡状态 0上 1下 | ||||
| 	public static final String Clocking = "0"; | ||||
| 	public static final String OffDuty= "1"; | ||||
| 	public static final String OffDuty = "1"; | ||||
|  | ||||
| 	@Autowired | ||||
| 	private IBgtProjectRecruitApplyService iBgtProjectRecruitApplyService; | ||||
| @ -72,7 +71,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 	private IBgtProjectRecruitService iBgtProjectRecruitService; | ||||
|  | ||||
| 	@Autowired | ||||
| 	private  IWgzLeaveService iWgzLeaveService; | ||||
| 	private IWgzLeaveService iWgzLeaveService; | ||||
|  | ||||
| 	@Autowired | ||||
| 	private IFbsProjectTaskService taskService; | ||||
| @ -82,72 +81,72 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
|  | ||||
| 	@Override | ||||
|     public WgzAttendance queryById(Long id){ | ||||
|         return getById(id); | ||||
|     } | ||||
| 	public WgzAttendance queryById(Long id) { | ||||
| 		return getById(id); | ||||
| 	} | ||||
|  | ||||
|     @Override | ||||
|     public TableDataInfo<WgzAttendance> queryPageList(WgzAttendanceQueryBo bo) { | ||||
|         Page<WgzAttendance> result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); | ||||
|         return PageUtils.buildDataInfo(result); | ||||
|     } | ||||
| 	@Override | ||||
| 	public TableDataInfo<WgzAttendance> queryPageList(WgzAttendanceQueryBo bo) { | ||||
| 		Page<WgzAttendance> result = page(PageUtils.buildPage(), buildQueryWrapper(bo)); | ||||
| 		return PageUtils.buildDataInfo(result); | ||||
| 	} | ||||
|  | ||||
|     @Override | ||||
|     public List<WgzAttendance> queryList(WgzAttendanceQueryBo bo) { | ||||
|         return list(buildQueryWrapper(bo)); | ||||
|     } | ||||
| 	@Override | ||||
| 	public List<WgzAttendance> queryList(WgzAttendanceQueryBo bo) { | ||||
| 		return list(buildQueryWrapper(bo)); | ||||
| 	} | ||||
|  | ||||
|     private LambdaQueryWrapper<WgzAttendance> buildQueryWrapper(WgzAttendanceQueryBo bo) { | ||||
|         Map<String, Object> params = bo.getParams(); | ||||
|         LambdaQueryWrapper<WgzAttendance> lqw = Wrappers.lambdaQuery(); | ||||
|         lqw.eq(bo.getRecruitId() != null, WgzAttendance::getRecruitId, bo.getRecruitId()); | ||||
|         lqw.eq(bo.getUserId() != null, WgzAttendance::getUserId, bo.getUserId()); | ||||
|         lqw.eq(bo.getLeaveMarkId() != null, WgzAttendance::getLeaveMarkId, bo.getLeaveMarkId()); | ||||
|         lqw.eq(bo.getDailyWage() != null, WgzAttendance::getDailyWage, bo.getDailyWage()); | ||||
|         lqw.eq(bo.getDate() != null, WgzAttendance::getDate, bo.getDate()); | ||||
|         lqw.eq(StrUtil.isNotBlank(bo.getPnchOsition()), WgzAttendance::getPnchOsition, bo.getPnchOsition()); | ||||
|         lqw.eq(bo.getClockInTime() != null, WgzAttendance::getClockInTime, bo.getClockInTime()); | ||||
|         lqw.eq(bo.getClockOutTime() != null, WgzAttendance::getClockOutTime, bo.getClockOutTime()); | ||||
|         lqw.eq(bo.getLate() != null, WgzAttendance::getLate, bo.getLate()); | ||||
|         lqw.eq(bo.getLateTime() != null, WgzAttendance::getLateTime, bo.getLateTime()); | ||||
|         lqw.eq(bo.getEarlyLeave() != null, WgzAttendance::getEarlyLeave, bo.getEarlyLeave()); | ||||
|         lqw.eq(bo.getEarlyLeaveTime() != null, WgzAttendance::getEarlyLeaveTime, bo.getEarlyLeaveTime()); | ||||
|         lqw.eq(bo.getMissedIn() != null, WgzAttendance::getMissedIn, bo.getMissedIn()); | ||||
|         lqw.eq(bo.getMissedOut() != null, WgzAttendance::getMissedOut, bo.getMissedOut()); | ||||
|         lqw.eq(StrUtil.isNotBlank(bo.getExceptionType()), WgzAttendance::getExceptionType, bo.getExceptionType()); | ||||
|         return lqw; | ||||
|     } | ||||
| 	private LambdaQueryWrapper<WgzAttendance> buildQueryWrapper(WgzAttendanceQueryBo bo) { | ||||
| 		Map<String, Object> params = bo.getParams(); | ||||
| 		LambdaQueryWrapper<WgzAttendance> lqw = Wrappers.lambdaQuery(); | ||||
| 		lqw.eq(bo.getRecruitId() != null, WgzAttendance::getRecruitId, bo.getRecruitId()); | ||||
| 		lqw.eq(bo.getUserId() != null, WgzAttendance::getUserId, bo.getUserId()); | ||||
| 		lqw.eq(bo.getLeaveMarkId() != null, WgzAttendance::getLeaveMarkId, bo.getLeaveMarkId()); | ||||
| 		lqw.eq(bo.getDailyWage() != null, WgzAttendance::getDailyWage, bo.getDailyWage()); | ||||
| 		lqw.eq(bo.getDate() != null, WgzAttendance::getDate, bo.getDate()); | ||||
| 		lqw.eq(StrUtil.isNotBlank(bo.getPnchOsition()), WgzAttendance::getPnchOsition, bo.getPnchOsition()); | ||||
| 		lqw.eq(bo.getClockInTime() != null, WgzAttendance::getClockInTime, bo.getClockInTime()); | ||||
| 		lqw.eq(bo.getClockOutTime() != null, WgzAttendance::getClockOutTime, bo.getClockOutTime()); | ||||
| 		lqw.eq(bo.getLate() != null, WgzAttendance::getLate, bo.getLate()); | ||||
| 		lqw.eq(bo.getLateTime() != null, WgzAttendance::getLateTime, bo.getLateTime()); | ||||
| 		lqw.eq(bo.getEarlyLeave() != null, WgzAttendance::getEarlyLeave, bo.getEarlyLeave()); | ||||
| 		lqw.eq(bo.getEarlyLeaveTime() != null, WgzAttendance::getEarlyLeaveTime, bo.getEarlyLeaveTime()); | ||||
| 		lqw.eq(bo.getMissedIn() != null, WgzAttendance::getMissedIn, bo.getMissedIn()); | ||||
| 		lqw.eq(bo.getMissedOut() != null, WgzAttendance::getMissedOut, bo.getMissedOut()); | ||||
| 		lqw.eq(StrUtil.isNotBlank(bo.getExceptionType()), WgzAttendance::getExceptionType, bo.getExceptionType()); | ||||
| 		return lqw; | ||||
| 	} | ||||
|  | ||||
|     @Override | ||||
|     public Boolean insert(WgzAttendance bo) { | ||||
|         WgzAttendance add = BeanUtil.toBean(bo, WgzAttendance.class); | ||||
|         validEntityBeforeSave(add); | ||||
|         return save(add); | ||||
|     } | ||||
| 	@Override | ||||
| 	public Boolean insert(WgzAttendance bo) { | ||||
| 		WgzAttendance add = BeanUtil.toBean(bo, WgzAttendance.class); | ||||
| 		validEntityBeforeSave(add); | ||||
| 		return save(add); | ||||
| 	} | ||||
|  | ||||
|     @Override | ||||
|     public Boolean update(WgzAttendance bo) { | ||||
|         WgzAttendance update = BeanUtil.toBean(bo, WgzAttendance.class); | ||||
|         validEntityBeforeSave(update); | ||||
|         return updateById(update); | ||||
|     } | ||||
| 	@Override | ||||
| 	public Boolean update(WgzAttendance bo) { | ||||
| 		WgzAttendance update = BeanUtil.toBean(bo, WgzAttendance.class); | ||||
| 		validEntityBeforeSave(update); | ||||
| 		return updateById(update); | ||||
| 	} | ||||
|  | ||||
|     /** | ||||
|      * 保存前的数据校验 | ||||
|      * | ||||
|      * @param entity 实体类数据 | ||||
|      */ | ||||
|     private void validEntityBeforeSave(WgzAttendance entity){ | ||||
|         //TODO 做一些数据校验,如唯一约束 | ||||
|     } | ||||
| 	/** | ||||
| 	 * 保存前的数据校验 | ||||
| 	 * | ||||
| 	 * @param entity 实体类数据 | ||||
| 	 */ | ||||
| 	private void validEntityBeforeSave(WgzAttendance entity) { | ||||
| 		//TODO 做一些数据校验,如唯一约束 | ||||
| 	} | ||||
|  | ||||
|     @Override | ||||
|     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { | ||||
|         if(isValid){ | ||||
|             //TODO 做一些业务上的校验,判断是否需要校验 | ||||
|         } | ||||
|         return removeByIds(ids); | ||||
|     } | ||||
| 	@Override | ||||
| 	public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) { | ||||
| 		if (isValid) { | ||||
| 			//TODO 做一些业务上的校验,判断是否需要校验 | ||||
| 		} | ||||
| 		return removeByIds(ids); | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	/** | ||||
| @ -177,8 +176,8 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 		//5、查看当前人、当前工地、当天的打卡记录 | ||||
| 		String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")); | ||||
| 		WgzAttendance we = publicFindByUserIdWait(appUserId, by.getRecruitId(), formattedDate); | ||||
| 		if (we !=null && we.getLeaveMarkId() != null && we.getLeaveMarkId()!= 0) { | ||||
| 			throw new RuntimeException("您有已通过的请假申请,请假时间为:"+formattedDate); | ||||
| 		if (we != null && we.getLeaveMarkId() != null && we.getLeaveMarkId() != 0) { | ||||
| 			throw new RuntimeException("您有已通过的请假申请,请假时间为:" + formattedDate); | ||||
| 		} | ||||
| 		//6、组装完整的打卡信息 | ||||
| 		WgzAttendance wgzAttendance = new WgzAttendance(). | ||||
| @ -188,10 +187,10 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 			setDate(LocalDate.now()); | ||||
| 		LocalDateTime now = LocalDateTime.now(); //当前完整年月日时分秒 | ||||
| 		LocalTime localTime = now.toLocalTime(); //获取时分秒 | ||||
| 		if (we !=null) { | ||||
| 		if (we != null) { | ||||
| 			//获取上次打卡时间与这次打卡时间的间隔是否超过3分钟 | ||||
| 			boolean flag = isMinutesDifferenceGreaterThanThree(we.getClockInTime(), now); | ||||
| 			if (!flag){ | ||||
| 			if (!flag) { | ||||
| 				throw new RuntimeException("打卡时间间隔不能少于3分钟"); | ||||
| 			} | ||||
| 			wgzAttendance.setClockOutTime(now); | ||||
| @ -201,11 +200,11 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 				wgzAttendance.setId(we.getId()); | ||||
| 				wgzAttendance.setEarlyLeave(1); //早退 | ||||
| 				wgzAttendance.setEarlyLeaveTime(now); | ||||
| 				wgzAttendance.setExceptionType(exceptionType+"2,"); | ||||
| 				wgzAttendance.setExceptionType(exceptionType + "2,"); | ||||
| 				wgzAttendance.setPnchOsitionX(req.getPnchOsition()); | ||||
| 			} | ||||
| 			return baseMapper.updateById(wgzAttendance) > 0; | ||||
| 		}else{ | ||||
| 		} else { | ||||
| 			wgzAttendance.setClockInTime(now); | ||||
| 			LocalTime beginWorkTime = appById.getBeginWorkTime(); //上班 | ||||
| 			if (!localTime.isBefore(beginWorkTime)) { | ||||
| @ -220,8 +219,9 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
| 	/** | ||||
| 	 * 判断两个 LocalDateTime 之间的差值分钟数是否超过 3 | ||||
| 	 * | ||||
| 	 * @param startTime 开始时间 | ||||
| 	 * @param endTime 结束时间 | ||||
| 	 * @param endTime   结束时间 | ||||
| 	 * @return 如果差值分钟数超过 3 返回 true,否则返回 false | ||||
| 	 */ | ||||
| 	public static boolean isMinutesDifferenceGreaterThanThree(LocalDateTime startTime, LocalDateTime endTime) { | ||||
| @ -244,17 +244,17 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 		//2、获取今日用户打卡状态 | ||||
| 		if (wgzAttendance == null) { | ||||
| 			res.setClockingCondition(0); //上班 | ||||
| 		}else{ | ||||
| 		} else { | ||||
| 			res.setClockingCondition(1); //下班 | ||||
| 			if (wgzAttendance.getLeaveMarkId() == null && wgzAttendance.getClockInTime()!=null && wgzAttendance.getClockOutTime()!=null){ | ||||
| 			if (wgzAttendance.getLeaveMarkId() == null && wgzAttendance.getClockInTime() != null && wgzAttendance.getClockOutTime() != null) { | ||||
| 				res.setClockingCondition(3); //已完成 | ||||
| 			} | ||||
| 			if (wgzAttendance.getLeaveMarkId() != null && wgzAttendance.getLeaveMarkId()!= 0) { | ||||
| 			if (wgzAttendance.getLeaveMarkId() != null && wgzAttendance.getLeaveMarkId() != 0) { | ||||
| 				res.setClockingCondition(2); //请假 | ||||
| 			} | ||||
| 		} | ||||
| 		//3、获取上下班状态 | ||||
| 		if (wgzAttendance!= null) { | ||||
| 		if (wgzAttendance != null) { | ||||
| 			String exceptionType = wgzAttendance.getExceptionType(); | ||||
| 			if (exceptionType.contains("0")) { | ||||
| 				res.setIn(0); | ||||
| @ -329,7 +329,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 				mp.put(date, two); | ||||
| 			} | ||||
| 		} | ||||
| 		return  new WgzAppPunchTheCalendarRecordRes().setMp(mp); | ||||
| 		return new WgzAppPunchTheCalendarRecordRes().setMp(mp); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| @ -381,7 +381,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public Integer attendanceDetail(Long userId,Long recruitId, Integer num){ | ||||
| 	public Integer attendanceDetail(Long userId, Long recruitId, Integer num) { | ||||
| 		LambdaQueryWrapper<WgzAttendance> apply = new LambdaQueryWrapper<WgzAttendance>(). | ||||
| 			eq(WgzAttendance::getUserId, userId). | ||||
| 			eq(WgzAttendance::getRecruitId, recruitId).and(wrapper -> wrapper | ||||
| @ -390,7 +390,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 				.isNotNull(WgzAttendance::getClockOutTime) | ||||
| 			); | ||||
| 		apply.orderByAsc(WgzAttendance::getDate); | ||||
| 		if (num!=null && num>0) { //表示查询指定天数的打卡记录,否则查询所有 | ||||
| 		if (num != null && num > 0) { //表示查询指定天数的打卡记录,否则查询所有 | ||||
| 			apply.last("LIMIT " + num); | ||||
| 		} | ||||
| 		return baseMapper.selectCount(apply); | ||||
| @ -402,6 +402,16 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 		return baseMapper.countByTaskId(taskId, beginDate, endDate); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public Integer dayTotalNum(Long taskId,LocalDate date){ | ||||
| 		return baseMapper.dayTotalNum(taskId,date); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public Integer monthTotalNum(Long taskId,LocalDate beginDate, LocalDate endDate){ | ||||
| 		return baseMapper.monthTotalNum(taskId,beginDate,endDate); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public BgtAttendanceVO attendanceDetail(BgtAttendanceDTO dto) { | ||||
| 		BgtAttendanceVO bgtAttendanceVO = new BgtAttendanceVO(); | ||||
| @ -412,57 +422,94 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
| 		LocalDate startData = null; | ||||
| 		LocalDate endData = null; | ||||
| 		LocalDate now = LocalDate.now(); | ||||
|  | ||||
| 		if(dto.getDateType().equals(DateUtils.DAY)){ | ||||
| 		if (dto.getDateType().equals(DateUtils.DAY)) { | ||||
| 			// 获取本月开始日期 | ||||
| 			startData = date.with(TemporalAdjusters.firstDayOfMonth()); | ||||
| 			endData = date; | ||||
|  | ||||
| 			List<BgtAttendanceCountVO> countVOS = countByTaskId(dto.getTaskId(), startData, endData); | ||||
| 			bgtAttendanceVO.setCountVOs(DataUtil.fillMissingDates(countVOS, startData, endData)); | ||||
| 			if(CollectionUtil.isNotEmpty(countVOS)){ | ||||
| 				BgtAttendanceCountVO countVO = countVOS.stream() | ||||
| 					.filter(vo -> vo.getDate().isEqual(date)) | ||||
| 					.findFirst().orElse(null); | ||||
| 				if (countVO != null) { | ||||
| 					bgtAttendanceVO.setReportToDutyNum(countVO.getReportToDutyNum()); | ||||
| 					bgtAttendanceVO.setTotalNum(countVO.getTotalNum()); | ||||
| 					bgtAttendanceVO.setAbsenceDutyNum(countVO.getTotalNum()-countVO.getReportToDutyNum()); | ||||
| 					if(bgtAttendanceVO.getTotalNum()!=0){ | ||||
| 						int rate = new BigDecimal(bgtAttendanceVO.getReportToDutyNum()).divide(new BigDecimal(bgtAttendanceVO.getTotalNum()), 2, RoundingMode.HALF_UP) | ||||
| 							.multiply(new BigDecimal(100)).intValue(); | ||||
| 						bgtAttendanceVO.setReportToDutyRate(rate); | ||||
| 					} | ||||
| 				} | ||||
| 			List<BgtAttendanceCountVO> bgtAttendanceCountVOS = DataUtil.fillMissingDates(countVOS, startData, endData); | ||||
|  | ||||
| 			// 因为当天可能还没有生成所有人的考勤数据,所以应到的总人数需要单独查询 | ||||
| 			// 判断当天是否在开始日期和结束日期之间(包含开始和结束日期) | ||||
| 			boolean isBetween = (now.isAfter(startData) || now.isEqual(startData)) | ||||
| 				&& (now.isBefore(endData) || now.isEqual(endData)); | ||||
| 			if (isBetween) { | ||||
| 				Integer i = dayTotalNum(task.getId(), now); | ||||
| 				BgtAttendanceCountVO countVO = bgtAttendanceCountVOS.stream() | ||||
| 					.filter(vo -> vo.getDate().isEqual(now)) | ||||
| 					.findFirst().orElse(null); | ||||
| 				countVO.setTotalNum(i); | ||||
| 			} | ||||
| 		}else if(dto.getDateType().equals(DateUtils.MONTH)){ | ||||
|  | ||||
| 			bgtAttendanceVO.setCountVOs(bgtAttendanceCountVOS); | ||||
| 			// 找出查询日期的考勤数据 | ||||
| 			BgtAttendanceCountVO countVO = bgtAttendanceCountVOS.stream() | ||||
| 				.filter(vo -> vo.getDate().isEqual(date)) | ||||
| 				.findFirst().orElse(null); | ||||
| 			if (countVO != null) { | ||||
| 				bgtAttendanceVO.setReportToDutyNum(countVO.getReportToDutyNum()); | ||||
| 				bgtAttendanceVO.setTotalNum(countVO.getTotalNum()); | ||||
| 				bgtAttendanceVO.setAbsenceDutyNum(countVO.getTotalNum() - countVO.getReportToDutyNum()); | ||||
| 				if (bgtAttendanceVO.getTotalNum() != 0) { | ||||
| 					int rate = new BigDecimal(bgtAttendanceVO.getReportToDutyNum()).divide(new BigDecimal(bgtAttendanceVO.getTotalNum()), 2, RoundingMode.HALF_UP) | ||||
| 						.multiply(new BigDecimal(100)).intValue(); | ||||
| 					bgtAttendanceVO.setReportToDutyRate(rate); | ||||
| 				} | ||||
| 			} | ||||
| 		} else if (dto.getDateType().equals(DateUtils.MONTH)) { | ||||
| 			// 获取本年开始日期 | ||||
| 			startData = date.with(TemporalAdjusters.firstDayOfYear()); | ||||
| 			endData = date.with(TemporalAdjusters.lastDayOfMonth()); | ||||
| 			if(endData.isAfter(now)){ | ||||
| 				endData= now; | ||||
| 			} | ||||
| 			List<BgtAttendanceCountVO> countVOS = countByTaskId(dto.getTaskId(), startData, endData); | ||||
| 			bgtAttendanceVO.setCountVOs(DataUtil.statisticsByMonth(countVOS,startData, endData)); | ||||
| 			BgtAttendanceCountVO countVO = countVOS.stream() | ||||
|  | ||||
| 			// 因为当天可能还没有生成所有人的考勤数据,所以应到的总人数需要单独查询 | ||||
| 			// 判断当天是否在开始日期和结束日期之间(包含开始和结束日期) | ||||
| 			boolean isBetween = (now.isAfter(startData) || now.isEqual(startData)) | ||||
| 				&& (now.isBefore(endData) || now.isEqual(endData)); | ||||
| 			if (isBetween) { | ||||
| 				Integer i = dayTotalNum(task.getId(), now); | ||||
| 				BgtAttendanceCountVO countVO = countVOS.stream() | ||||
| 					.filter(vo -> vo.getDate().isEqual(now)) | ||||
| 					.findFirst().orElse(null); | ||||
| 				if (countVO != null) { | ||||
| 					countVO.setTotalNum(i); | ||||
| 				}else { | ||||
| 					BgtAttendanceCountVO bgtAttendanceCountVO = new BgtAttendanceCountVO(0, i, now, 0, 0, 0); | ||||
| 					countVOS.add(bgtAttendanceCountVO); | ||||
| 				} | ||||
| 			} | ||||
| 			List<BgtAttendanceCountVO> bgtAttendanceCountVOS = DataUtil.statisticsByMonth(countVOS, startData, endData); | ||||
| 			bgtAttendanceVO.setCountVOs(bgtAttendanceCountVOS); | ||||
| 			BgtAttendanceCountVO countVO = bgtAttendanceCountVOS.stream() | ||||
| 				.filter(vo -> YearMonth.from(vo.getDate()).equals(YearMonth.from(date))) | ||||
| 				.findFirst().orElse(null); | ||||
| 			if (countVO != null) { | ||||
| 				bgtAttendanceVO.setReportToDutyNum(countVO.getReportToDutyNum()); | ||||
| 				bgtAttendanceVO.setTotalNum(countVO.getTotalNum()); | ||||
| 				bgtAttendanceVO.setAbsenceDutyNum(countVO.getAbsenceDutyNum()); | ||||
| 				int rate = new BigDecimal(countVO.getRateSum()).divide(new BigDecimal(countVO.getRateDay()), 2, RoundingMode.HALF_UP).intValue(); | ||||
| 				bgtAttendanceVO.setReportToDutyRate(rate); | ||||
| 			} | ||||
|  | ||||
| 			//设置本月的总人数 | ||||
| 			bgtAttendanceVO.setTotalNum(monthTotalNum(task.getId(), date.with(TemporalAdjusters.firstDayOfMonth()), endData)); | ||||
| 		} | ||||
| 		getLateAndLeave(bgtAttendanceVO, startData, endData); | ||||
| 		return bgtAttendanceVO; | ||||
| 	} | ||||
|  | ||||
| 	public void getLateAndLeave(BgtAttendanceVO vo,LocalDate startDate, LocalDate endDate){ | ||||
| 	public void getLateAndLeave(BgtAttendanceVO vo, LocalDate startDate, LocalDate endDate) { | ||||
| 		List<BgtProjectRecruit> bgtProjectRecruits = iBgtProjectRecruitService.getBaseMapper().selectList(Wrappers.<BgtProjectRecruit>lambdaQuery() | ||||
| 			.eq(BgtProjectRecruit::getTaskId, vo.getTaskId())); | ||||
| 		List<Long> recruitIds = bgtProjectRecruits.stream().map(BgtProjectRecruit::getId).collect(Collectors.toList()); | ||||
| 		if(CollectionUtil.isNotEmpty(recruitIds)){ | ||||
| 		if (CollectionUtil.isNotEmpty(recruitIds)) { | ||||
| 			Integer late = baseMapper.selectCount(Wrappers.<WgzAttendance>lambdaQuery().eq(WgzAttendance::getLate, 1) | ||||
| 				.in(WgzAttendance::getRecruitId, recruitIds).between(WgzAttendance::getDate, startDate, endDate)); | ||||
| 				.eq(WgzAttendance::getRecruitId, recruitIds).between(WgzAttendance::getDate, startDate, endDate)); | ||||
| 			Integer leave = baseMapper.selectCount(Wrappers.<WgzAttendance>lambdaQuery().isNotNull(WgzAttendance::getLeaveMarkId) | ||||
| 				.in(WgzAttendance::getRecruitId, recruitIds).between(WgzAttendance::getDate, startDate, endDate)); | ||||
| 			vo.setLateNum(late); | ||||
| @ -480,16 +527,17 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
| 	/** | ||||
| 	 * 获取指定人、指定工地、指定日期的打卡记录 | ||||
| 	 * | ||||
| 	 * @param appUserId 务工者用户id | ||||
| 	 * @param recruitId 工地id | ||||
| 	 * @param date	具体日期 | ||||
| 	 * @param date      具体日期 | ||||
| 	 * @return WgzAttendance | ||||
| 	 */ | ||||
| 	public WgzAttendance publicFindByUserIdWait(Long appUserId, Long recruitId, String date) { | ||||
| 		LambdaQueryWrapper<WgzAttendance> qw = new LambdaQueryWrapper<>(); | ||||
| 		qw.eq(WgzAttendance::getRecruitId,recruitId); | ||||
| 		qw.eq(WgzAttendance::getUserId,appUserId); | ||||
| 		qw.eq(WgzAttendance::getDate,date); | ||||
| 		qw.eq(WgzAttendance::getRecruitId, recruitId); | ||||
| 		qw.eq(WgzAttendance::getUserId, appUserId); | ||||
| 		qw.eq(WgzAttendance::getDate, date); | ||||
| 		return baseMapper.selectOne(qw); | ||||
| 	} | ||||
|  | ||||
| @ -520,21 +568,22 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
| 	/** | ||||
| 	 * 组装上班、下班打卡记录 | ||||
| 	 * @param wa 打卡记录 | ||||
| 	 * | ||||
| 	 * @param wa  打卡记录 | ||||
| 	 * @param num 1上班 2下班 | ||||
| 	 * @return WgzAppPunchTheCalendarRecordThree | ||||
| 	 */ | ||||
| 	public WgzAppPunchTheCalendarRecordThree sbOrXb( WgzAttendance wa,int num) { | ||||
| 	public WgzAppPunchTheCalendarRecordThree sbOrXb(WgzAttendance wa, int num) { | ||||
| 		WgzAppPunchTheCalendarRecordThree sbb = new WgzAppPunchTheCalendarRecordThree(). | ||||
| 			setClockingTime(wa.getClockInTime()). | ||||
| 			setPnchOsition(wa.getPnchOsition()). | ||||
| 			setPnchOsitionX(wa.getPnchOsitionX()). | ||||
| 			setClockingCondition(0); //正常 | ||||
| 		//判断是否请假 | ||||
| 		if (wa.getLeaveMarkId()!=null && wa.getLeaveMarkId()!=0) { | ||||
| 		if (wa.getLeaveMarkId() != null && wa.getLeaveMarkId() != 0) { | ||||
| 			sbb.setClockingCondition(7); | ||||
| 		} | ||||
| 		if (num == 1){ | ||||
| 		if (num == 1) { | ||||
| 			//判断上班迟到 | ||||
| 			if (wa.getLate() == 1) { | ||||
| 				sbb.setClockingCondition(1); | ||||
| @ -544,7 +593,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 				sbb.setClockingCondition(5); | ||||
| 			} | ||||
| 		} | ||||
| 		if (num == 2){ | ||||
| 		if (num == 2) { | ||||
| 			//判断下班早退 | ||||
| 			if (wa.getEarlyLeave() == 1) { | ||||
| 				sbb.setClockingCondition(2); | ||||
| @ -559,10 +608,11 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
| 	/** | ||||
| 	 * 补卡 | ||||
| 	 * @param wgzAttendance 打卡记录 | ||||
| 	 * @param type 1上班 2下班 | ||||
| 	 * | ||||
| 	 * @param wgzAttendance   打卡记录 | ||||
| 	 * @param type            1上班 2下班 | ||||
| 	 * @param fillingDataTime 补卡时间 | ||||
| 	 * @param list 补卡记录 | ||||
| 	 * @param list            补卡记录 | ||||
| 	 */ | ||||
| 	private void addRecord(WgzAttendance wgzAttendance, int type, LocalDateTime fillingDataTime, List<WgzAppCardReplacementApplicationTwo> list) { | ||||
| 		LocalDate date = wgzAttendance.getDate(); | ||||
| @ -581,7 +631,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 	public BgtAttendanceDetailVO bgtAttendanceDetail(BgtAttendanceDetailDTO dto) { | ||||
| 		BgtAttendanceDetailVO bgtAttendanceDetailVO = new BgtAttendanceDetailVO(); | ||||
|  | ||||
| 		WgzUser wgzUser = wgzUserService.getById(dto.getUserId()); | ||||
| 		WgzUser wgzUser = wgzUserService.findByUserId(dto.getUserId()); | ||||
| 		bgtAttendanceDetailVO.setUserId(wgzUser.getUserId()); | ||||
| 		bgtAttendanceDetailVO.setUsername(wgzUser.getUsername()); | ||||
| 		bgtAttendanceDetailVO.setAvatarName(wgzUser.getAvatarName()); | ||||
| @ -590,43 +640,43 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 			.eq(BgtProjectRecruit::getTaskId, dto.getTaskId())); | ||||
| 		List<Long> recruitIds = bgtProjectRecruits.stream().map(BgtProjectRecruit::getId).collect(Collectors.toList()); | ||||
|  | ||||
| 		BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.getById(recruitIds.get(0)); | ||||
| 		BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.getOne(recruitIds.get(0),wgzUser.getUserId()); | ||||
| 		bgtAttendanceDetailVO.setEntryTime(recruitApply.getEntryTime()); | ||||
| 		bgtAttendanceDetailVO.setStatus(recruitApply.getStatus()); | ||||
|  | ||||
| 		LambdaQueryWrapper<WgzAttendance> wrapper = new LambdaQueryWrapper<>(); | ||||
| 		wrapper.eq(WgzAttendance::getUserId,dto.getUserId()); | ||||
| 		wrapper.eq(WgzAttendance::getUserId, dto.getUserId()); | ||||
|  | ||||
| 		wrapper.in(WgzAttendance::getRecruitId,recruitIds); | ||||
| 		wrapper.in(WgzAttendance::getRecruitId, recruitIds); | ||||
| 		LocalDate date = dto.getDate(); | ||||
| 		LocalDate startDate = date.with(TemporalAdjusters.firstDayOfMonth()); | ||||
| 		LocalDate endData = date.with(TemporalAdjusters.lastDayOfMonth()); | ||||
| 		wrapper.between(WgzAttendance::getDate,startDate,endData); | ||||
| 		wrapper.between(WgzAttendance::getDate, startDate, endData); | ||||
| 		List<WgzAttendance> wgzAttendances = baseMapper.selectList(wrapper); | ||||
| 		// 创建SimpleDateFormat对象,格式化日期为中文星期 | ||||
| 		SimpleDateFormat sdf = new SimpleDateFormat("EEEE", java.util.Locale.CHINESE); | ||||
| 		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("EEEE", Locale.CHINA); | ||||
|  | ||||
| 		//获取招工打卡时间 | ||||
| 		List<BgtProjectRecruit> list = iBgtProjectRecruitService.list(Wrappers.<BgtProjectRecruit>lambdaQuery().in(BgtProjectRecruit::getId)); | ||||
| 		List<BgtProjectRecruit> list = iBgtProjectRecruitService.list(Wrappers.<BgtProjectRecruit>lambdaQuery().in(BgtProjectRecruit::getId,recruitIds)); | ||||
| 		Map<Long, BgtProjectRecruit> recruitMap = list.stream().collect(Collectors.toMap(BgtProjectRecruit::getId, recruit -> recruit)); | ||||
|  | ||||
|  | ||||
| 		List<WgzAttendanceRecordVO> lateRecords = new ArrayList<>(); | ||||
| 		List<WgzAttendanceRecordVO> earlyLeaveRecords= new ArrayList<>(); | ||||
| 		List<WgzAttendanceRecordVO> missRecords= new ArrayList<>(); | ||||
| 		List<WgzAttendanceRecordVO> records= new ArrayList<>(); | ||||
| 		List<WgzAttendanceRecordVO> earlyLeaveRecords = new ArrayList<>(); | ||||
| 		List<WgzAttendanceRecordVO> missRecords = new ArrayList<>(); | ||||
| 		List<WgzAttendanceRecordVO> records = new ArrayList<>(); | ||||
|  | ||||
|  | ||||
| 		for (WgzAttendance wgzAttendance:wgzAttendances){ | ||||
| 		for (WgzAttendance wgzAttendance : wgzAttendances) { | ||||
| 			WgzAttendanceRecordVO recordVO = new WgzAttendanceRecordVO(); | ||||
| 			recordVO.setDate(wgzAttendance.getDate()); | ||||
| 			recordVO.setWeek(sdf.format(date)); | ||||
| 			if(wgzAttendance.getMissedIn()==0 && wgzAttendance.getMissedOut()==0){ | ||||
| 			recordVO.setWeek(wgzAttendance.getDate().format(formatter)); | ||||
| 			if (wgzAttendance.getMissedIn() == 0 && wgzAttendance.getMissedOut() == 0) { | ||||
| 				recordVO.setDay(1D); | ||||
| 				records.add(recordVO); | ||||
| 			}else if(wgzAttendance.getMissedIn()==1 && wgzAttendance.getMissedOut()==1){ | ||||
| 			} else if (wgzAttendance.getMissedIn() == 1 && wgzAttendance.getMissedOut() == 1) { | ||||
| 				recordVO.setDay(0D); | ||||
| 			}else { | ||||
| 			} else { | ||||
| 				recordVO.setDay(0.5D); | ||||
| 				records.add(recordVO); | ||||
| 			} | ||||
| @ -638,13 +688,13 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 			if (wgzAttendance.getLate() == 1) { | ||||
| 				WgzAttendanceRecordVO LateRecordVO = BeanUtil.copyProperties(recordVO, WgzAttendanceRecordVO.class); | ||||
| 				LateRecordVO.setTime(clockInTime.toLocalTime()); | ||||
| 				LateRecordVO.setMinutes(DataUtil.getMinutes(clockInTime,beginWorkTime)); | ||||
| 				LateRecordVO.setMinutes(DataUtil.getMinutes(clockInTime, beginWorkTime)); | ||||
| 				lateRecords.add(LateRecordVO); | ||||
| 			} | ||||
| 			if (wgzAttendance.getEarlyLeave() == 1) { | ||||
| 				WgzAttendanceRecordVO earlyLeaveRecordVO = BeanUtil.copyProperties(recordVO, WgzAttendanceRecordVO.class); | ||||
| 				earlyLeaveRecordVO.setTime(clockOutTime.toLocalTime()); | ||||
| 				earlyLeaveRecordVO.setMinutes(DataUtil.getMinutes(clockOutTime,endWorkTime)); | ||||
| 				earlyLeaveRecordVO.setMinutes(DataUtil.getMinutes(clockOutTime, endWorkTime)); | ||||
| 				earlyLeaveRecords.add(earlyLeaveRecordVO); | ||||
| 			} | ||||
|  | ||||
| @ -670,12 +720,11 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 		bgtAttendanceDetailVO.setEarlyLeaveMinute(earlyLeaveRecords.stream().mapToInt(WgzAttendanceRecordVO::getMinutes).sum()); | ||||
| 		bgtAttendanceDetailVO.setEarlyLeaveRecords(earlyLeaveRecords); | ||||
|  | ||||
| 		bgtAttendanceDetailVO.setMissNum(earlyLeaveRecords.size()); | ||||
| 		bgtAttendanceDetailVO.setMissRecords(earlyLeaveRecords); | ||||
| 		bgtAttendanceDetailVO.setMissNum(missRecords.size()); | ||||
| 		bgtAttendanceDetailVO.setMissRecords(missRecords); | ||||
| 		return bgtAttendanceDetailVO; | ||||
|  | ||||
|  | ||||
|  | ||||
| 	} | ||||
|  | ||||
|  | ||||
| @ -686,12 +735,13 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
|  | ||||
| 	/** | ||||
| 	 * 获取对应用户指定天数的工资结算日期 | ||||
| 	 * | ||||
| 	 * @param userId | ||||
| 	 * @param recruitId | ||||
| 	 * @param num 结算天数 | ||||
| 	 * @param num       结算天数 | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public LocalDate findByNumGetDate(Long userId, Long recruitId,Integer num) { | ||||
| 	public LocalDate findByNumGetDate(Long userId, Long recruitId, Integer num) { | ||||
| 		LambdaQueryWrapper<WgzAttendance> wra = new LambdaQueryWrapper<>(); | ||||
| 		wra.eq(WgzAttendance::getRecruitId, recruitId); | ||||
| 		wra.eq(WgzAttendance::getUserId, userId); | ||||
|  | ||||
| @ -30,12 +30,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|                 wu.type_of_work, | ||||
|                 bpr.recruit_name, | ||||
|                 fpt.task_name, | ||||
|                 bpr.task_id, | ||||
|                 wsr.score  as hasScore | ||||
|         from bgt_project_recruit_apply bpra | ||||
|             left join wgz_user wu on bpra.user_id = wu.user_id | ||||
|             left join bgt_project_recruit bpr on bpr.id = bpra.recruit_id | ||||
|             left join fbs_project_task fpt on fpt.id = bpr.task_id | ||||
|             left join wgz_score_record wsr on bpra.user_id = wsr.user_id and bpra.id = wsr.recruit_id | ||||
|             left join wgz_score_record wsr on bpra.user_id = wsr.user_id and bpra.recruit_id = wsr.recruit_id | ||||
|         <where> | ||||
|             <if test="dto.username !=null and dto.username !='' "> | ||||
|                 and wu.username like concat('%', #{dto.username}, '%') | ||||
| @ -52,6 +53,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|                     #{item} | ||||
|                 </foreach> | ||||
|             </if> | ||||
|             <if test="dto.date != null"> | ||||
|                 AND (entry_time between #{dto.beginDate} and #{dto.endDate}) or (leave_time between #{dto.beginDate} and #{dto.endDate}) | ||||
|             </if> | ||||
|         </where> | ||||
|         order by  bpra.create_time desc,bpra.status asc | ||||
|     </select> | ||||
|  | ||||
| @ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|  | ||||
|     <select id="appQueryPageList" resultType="com.ruoyi.bgt.domain.vo.BgtProjectRecruitVO"> | ||||
|         select bpr.id,bpr.recruit_name,bpr.recruit_address,bpr.recruit_amount,bpr.recruit_staff_num, | ||||
|                bpr.recruit_requirement,bpr.create_time,fpt.task_name,bpr.type_of_work | ||||
|                bpr.recruit_requirement,bpr.create_time,fpt.task_name,bpr.type_of_work,bpr.status | ||||
|         from bgt_project_recruit bpr left join fbs_project_task  fpt on bpr.task_id = fpt.id | ||||
|         <where> | ||||
|             <if test="dto.userId != null "> | ||||
|  | ||||
| @ -33,7 +33,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|     <select id="countByTaskId" resultType="com.ruoyi.bgt.domain.vo.BgtAttendanceCountVO"> | ||||
|         select count(1) as reportToDutyNum, | ||||
|         date, | ||||
|         (select count(1) from bgt_project_recruit_apply where entry_time <= date and (leave_time is null or leave_time>date) | ||||
|         (select count(1) from bgt_project_recruit_apply where entry_time <= date and (leave_time is null or leave_time>=date) | ||||
|         and recruit_id in (select id from bgt_project_recruit where task_id = #{taskId} )) as totalNum | ||||
|         from wgz_attendance | ||||
|         where date between #{beginDate} and #{endDate} | ||||
| @ -42,4 +42,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         group by date order by date | ||||
|     </select> | ||||
|  | ||||
|  | ||||
|     <select id="dayTotalNum" resultType="Integer"> | ||||
|         select count(1) from bgt_project_recruit_apply where entry_time <= #{date} and ((leave_time is null and status = '5')or leave_time>=#{date}) | ||||
|         and recruit_id in (select id from bgt_project_recruit where task_id = #{taskId} ) | ||||
|     </select> | ||||
|  | ||||
|     <select id="monthTotalNum" resultType="Integer"> | ||||
|         select count(1) | ||||
|         from bgt_project_recruit_apply | ||||
|         where ((entry_time between #{beginDate} and #{endDate}) or (leave_time between #{beginDate} and #{endDate})) | ||||
|           and status in (5, 6) | ||||
|           and recruit_id in (select id from bgt_project_recruit where task_id = #{taskId}) | ||||
|     </select> | ||||
|  | ||||
| </mapper> | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 zt
					zt