优化
This commit is contained in:
		@ -36,6 +36,9 @@ public class WgzScoreRecord implements Serializable {
 | 
			
		||||
    @ApiModelProperty("招工ID")
 | 
			
		||||
    private Long recruitId;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("招工申请ID")
 | 
			
		||||
	private Long  recruitApplyId;
 | 
			
		||||
 | 
			
		||||
    /** 被评人ID(务工者) */
 | 
			
		||||
    @Excel(name = "被评人ID(务工者)")
 | 
			
		||||
    @ApiModelProperty("被评人ID(务工者)")
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,6 @@
 | 
			
		||||
package com.ruoyi.wgz.service;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.bgt.domain.dto.BgtLeaveUpdateDTO;
 | 
			
		||||
import com.ruoyi.common.core.domain.AjaxResult;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.wgz.bo.WgzLeaveQueryBo;
 | 
			
		||||
@ -10,7 +9,6 @@ import com.ruoyi.wgz.bo.req.WgzAppLeaveHistoryListPageReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppSubmitLeaveReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppLeaveHistoryListPageRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppUserLeaveDetailsRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppUserReplacementCardRecordDetailsRes;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzLeave;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.PathVariable;
 | 
			
		||||
@ -110,4 +108,9 @@ public interface IWgzLeaveService extends IServicePlus<WgzLeave> {
 | 
			
		||||
	 */
 | 
			
		||||
	Boolean bgtAudit(BgtLeaveUpdateDTO dto);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 批量拒绝请假
 | 
			
		||||
	 */
 | 
			
		||||
	void refuseBatch(Long recruitId,Long userId);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -11,10 +11,8 @@ import com.ruoyi.wgz.bo.res.WgzAppUserReplacementCardRecordDetailsRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzReplacementCardRecordRes;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzReissueacard;
 | 
			
		||||
import org.springframework.validation.annotation.Validated;
 | 
			
		||||
import org.springframework.web.bind.annotation.PathVariable;
 | 
			
		||||
import org.springframework.web.bind.annotation.RequestBody;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
@ -92,4 +90,9 @@ public interface IWgzReissueacardService extends IServicePlus<WgzReissueacard> {
 | 
			
		||||
 | 
			
		||||
	WgzAppUserReplacementCardRecordDetailsRes userReplacementCardRecordDetails(Long id);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 拒绝批量操作
 | 
			
		||||
	 */
 | 
			
		||||
	void  refuseBatch(Long recruitId,Long userId);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -27,7 +27,6 @@ import com.ruoyi.wgz.bo.req.WgzAppLeaveHistoryListPageReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppSubmitLeaveReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppLeaveHistoryListPageRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppUserLeaveDetailsRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppUserReplacementCardRecordDetailsRes;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzAttendance;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzLeave;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzMessage;
 | 
			
		||||
@ -306,26 +305,44 @@ public class WgzLeaveServiceImpl extends ServicePlusImpl<WgzLeaveMapper, WgzLeav
 | 
			
		||||
			.setMessageSmallType(SMALL_LEAVE);
 | 
			
		||||
		iWgzMessageService.sendAMessage(wgzMessage);
 | 
			
		||||
 | 
			
		||||
		//考勤信息
 | 
			
		||||
		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.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);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return updateById(wgzLeave);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	@Transactional(rollbackFor = Exception.class)
 | 
			
		||||
	public void refuseBatch(Long recruitId, Long userId) {
 | 
			
		||||
		List<WgzLeave> list = list(Wrappers.<WgzLeave>lambdaQuery()
 | 
			
		||||
			.eq(WgzLeave::getRecruitId, recruitId)
 | 
			
		||||
			.eq(WgzLeave::getUserId, userId)
 | 
			
		||||
			.in(WgzLeave::getAuditorType, AuditStatus.getToAudit()));
 | 
			
		||||
		for(WgzLeave wgzLeave : list){
 | 
			
		||||
			BgtLeaveUpdateDTO dto = new BgtLeaveUpdateDTO();
 | 
			
		||||
			dto.setId(wgzLeave.getId());
 | 
			
		||||
			dto.setAuditorType(AuditStatus.REFUSE.getCode());
 | 
			
		||||
			dto.setAuditorOpinion("您已退场");
 | 
			
		||||
			bgtAudit(dto);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@ import com.ruoyi.bgt.service.IBgtProjectRecruitService;
 | 
			
		||||
import com.ruoyi.common.constants.WgzAndBgtMessageConstant;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.enums.AuditStatus;
 | 
			
		||||
import com.ruoyi.common.util.LocalDateToChineseWeekday;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
@ -40,7 +41,6 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
import static com.ruoyi.common.constants.BgtMessageConstant.*;
 | 
			
		||||
@ -243,39 +243,42 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
 | 
			
		||||
	public Boolean appUpdate(BgtReissueacardUpdateDTO dto) {
 | 
			
		||||
		WgzReissueacard byId = getById(dto.getId());
 | 
			
		||||
		BeanUtil.copyProperties(dto, byId);
 | 
			
		||||
		byId.setAuditorTime(LocalDateTime.now());
 | 
			
		||||
		boolean b = updateById(byId);
 | 
			
		||||
		boolean isPass = AuditStatus.PASS.getCode().equals(dto.getAuditorType());
 | 
			
		||||
		if(isPass){
 | 
			
		||||
			//修改考勤标记
 | 
			
		||||
			WgzAttendance attendance = iWgzAttendanceService.getById(byId.getAttendanceId());
 | 
			
		||||
 | 
			
		||||
		//修改考勤标记
 | 
			
		||||
		WgzAttendance attendance = iWgzAttendanceService.getById(byId.getAttendanceId());
 | 
			
		||||
			String exceptionType = attendance.getExceptionType();
 | 
			
		||||
			if ("0".equals(byId.getType())) { //上班补卡
 | 
			
		||||
				exceptionType = exceptionType.replace("\\b1\\b", "5");
 | 
			
		||||
				exceptionType = exceptionType.replace("\\b3\\b", "5");
 | 
			
		||||
				attendance.setExceptionType(exceptionType);
 | 
			
		||||
				attendance.setLate(1);
 | 
			
		||||
				attendance.setMissedIn(1);
 | 
			
		||||
				if(attendance.getClockInTime() == null){
 | 
			
		||||
					attendance.setClockInTime(byId.getNowTime());
 | 
			
		||||
				}
 | 
			
		||||
			} else { //下班补卡
 | 
			
		||||
				exceptionType = exceptionType.replace("\\b2\\b", "6");
 | 
			
		||||
				exceptionType = exceptionType.replace("\\b4\\b", "6");
 | 
			
		||||
				attendance.setExceptionType(exceptionType);
 | 
			
		||||
				attendance.setEarlyLeave(1);
 | 
			
		||||
				attendance.setMissedOut(1);
 | 
			
		||||
				if(attendance.getClockOutTime() == null){
 | 
			
		||||
					attendance.setClockOutTime(byId.getNowTime());
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			iWgzAttendanceService.updateById(attendance);
 | 
			
		||||
 | 
			
		||||
		String exceptionType = attendance.getExceptionType();
 | 
			
		||||
		if ("0".equals(byId.getType())) { //上班补卡
 | 
			
		||||
			exceptionType = exceptionType.replace("\\b1\\b", "5");
 | 
			
		||||
			exceptionType = exceptionType.replace("\\b3\\b", "5");
 | 
			
		||||
			attendance.setExceptionType(exceptionType);
 | 
			
		||||
			attendance.setLate(1);
 | 
			
		||||
			attendance.setMissedIn(1);
 | 
			
		||||
			if(attendance.getClockInTime() == null){
 | 
			
		||||
				attendance.setClockInTime(byId.getNowTime());
 | 
			
		||||
			}
 | 
			
		||||
		} else { //下班补卡
 | 
			
		||||
			exceptionType = exceptionType.replace("\\b2\\b", "6");
 | 
			
		||||
			exceptionType = exceptionType.replace("\\b4\\b", "6");
 | 
			
		||||
			attendance.setExceptionType(exceptionType);
 | 
			
		||||
			attendance.setEarlyLeave(1);
 | 
			
		||||
			attendance.setMissedOut(1);
 | 
			
		||||
			if(attendance.getClockOutTime() == null){
 | 
			
		||||
				attendance.setClockOutTime(byId.getNowTime());
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		iWgzAttendanceService.updateById(attendance);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		//发消息
 | 
			
		||||
		HashMap<String, String> mp = new HashMap<>();
 | 
			
		||||
		mp.put("projectName", iBgtProjectRecruitService.getById(byId.getRecruitId()).getRecruitName());
 | 
			
		||||
		mp.put("auditor", SecurityUtils.getUsername());
 | 
			
		||||
		Map<String, String> map = bgtMessage(mp, BGT_TYPE_MAKE_UP, true);
 | 
			
		||||
		Map<String, String> map = bgtMessage(mp, BGT_TYPE_MAKE_UP, isPass);
 | 
			
		||||
		WgzMessage wgzMessage = new WgzMessage()
 | 
			
		||||
			.setSenderType(USERTYPE_BGT)
 | 
			
		||||
			.setSenderId(SecurityUtils.getAppUserId())
 | 
			
		||||
@ -297,4 +300,20 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
 | 
			
		||||
		info.setWeek( LocalDateToChineseWeekday.getChineseWeekday(info.getRawTime().toLocalDate()));
 | 
			
		||||
		return info;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	@Transactional(rollbackFor = Exception.class)
 | 
			
		||||
	public void refuseBatch(Long recruitId, Long userId) {
 | 
			
		||||
		List<WgzReissueacard> list = list(new LambdaQueryWrapper<WgzReissueacard>()
 | 
			
		||||
			.eq(WgzReissueacard::getRecruitId, recruitId)
 | 
			
		||||
			.eq(WgzReissueacard::getUserId, userId)
 | 
			
		||||
			.in(WgzReissueacard::getAuditorType,AuditStatus.getToAudit()));
 | 
			
		||||
		for (WgzReissueacard wgzReissueacard : list) {
 | 
			
		||||
			BgtReissueacardUpdateDTO bgtReissueacardUpdateDTO = new BgtReissueacardUpdateDTO();
 | 
			
		||||
			bgtReissueacardUpdateDTO.setId(wgzReissueacard.getId());
 | 
			
		||||
			bgtReissueacardUpdateDTO.setAuditorType(AuditStatus.REFUSE.getCode());
 | 
			
		||||
			bgtReissueacardUpdateDTO.setAuditorOpinion("您已退场");
 | 
			
		||||
			appUpdate(bgtReissueacardUpdateDTO);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user