修改消息小类型的全部查询
This commit is contained in:
		@ -39,7 +39,7 @@ public interface BgtProjectRecruitMapper extends BaseMapperPlus<BgtProjectRecrui
 | 
			
		||||
	List<WgzAppCancelRegistrationProjectDetailsTwo> GetsTheMembersUnderTheCurrentProject (@Param("recruitId") Long recruitId);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	Page<WgzAppJobListingRes> userJobListing(@Param("page") Page<WgzAppJobListingReq> page);
 | 
			
		||||
	Page<WgzAppJobListingRes> userJobListing(@Param("page") Page<WgzAppJobListingReq> page,@Param("req") WgzAppJobListingReq req);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -209,7 +209,7 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl<BgtProjectRecr
 | 
			
		||||
		//1、获取项目基础信息
 | 
			
		||||
		WgzAppProjectDetailsRes wgzAppProjectDetailsRes = baseMapper.userProjectDetails(recruitId);
 | 
			
		||||
		//2、获取当前项目下的成员
 | 
			
		||||
		List<WgzAppCancelRegistrationProjectDetailsTwo> wgzUser = baseMapper.GetsTheMembersUnderTheCurrentProject(recruitId);
 | 
			
		||||
		List<WgzAppCancelRegistrationProjectDetailsTwo> wgzUser = baseMapper.GetsTheMembersUnderTheCurrentProject(wgzAppProjectDetailsRes.getId());
 | 
			
		||||
		//3、数据组装
 | 
			
		||||
		WgzAppCancelRegistrationProjectDetailsRes res = new WgzAppCancelRegistrationProjectDetailsRes();
 | 
			
		||||
		BeanUtils.copyProperties(wgzAppProjectDetailsRes,res);
 | 
			
		||||
@ -220,10 +220,13 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl<BgtProjectRecr
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public TableDataInfo<WgzAppJobListingRes> userJobListing(WgzAppJobListingReq req) {
 | 
			
		||||
		//获取当前用户
 | 
			
		||||
		Long appUserId = SecurityUtils.getAppUserId();
 | 
			
		||||
		req.setUserId(appUserId);
 | 
			
		||||
		Page<WgzAppJobListingReq> pe = new Page<>();
 | 
			
		||||
		pe.setCurrent(req.getPageNum());
 | 
			
		||||
		pe.setSize(req.getPageSize());
 | 
			
		||||
		return PageUtils.buildDataInfo(baseMapper.userJobListing(pe));
 | 
			
		||||
		return PageUtils.buildDataInfo(baseMapper.userJobListing(pe,req));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -17,9 +17,9 @@ public class WgzAppGetMessageListReq extends PageReq {
 | 
			
		||||
	@ApiModelProperty(value = "接收人",hidden = true)
 | 
			
		||||
	private Long recipientId;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("0 全部 1报名 2工资 3其他")
 | 
			
		||||
	@ApiModelProperty("字典(message_large_type)")
 | 
			
		||||
	private String largeType;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("largeType为3填写 (0补卡 1系统)")
 | 
			
		||||
	@ApiModelProperty("字典(message_small_type)largeType为3填写")
 | 
			
		||||
	private String smallType;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,9 +7,12 @@ import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.NotNull;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@ApiModel("首页-招工列表请求对象")
 | 
			
		||||
public class WgzAppJobListingReq extends PageReq {
 | 
			
		||||
	@ApiModelProperty(value = "唯一标识",hidden = true)
 | 
			
		||||
	private Long userId;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -19,9 +19,10 @@ import java.io.Serializable;
 | 
			
		||||
public class WgzAppSubmitTheClockReq implements Serializable {
 | 
			
		||||
	@ApiModelProperty("上下班打卡标识(0上班 1下班)")
 | 
			
		||||
	@NotBlank(message = "上下班打卡标识不能为空")
 | 
			
		||||
	@Pattern(regexp = "[01]", message = "上下班打卡标识只能为 0 或 1")
 | 
			
		||||
	@Pattern(regexp = "^[01]$", message = "上下班打卡标识只能是0或1")
 | 
			
		||||
	private String type;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("打卡位置")
 | 
			
		||||
	@NotBlank(message = "打卡位置不能为空")
 | 
			
		||||
	private String pnchOsition;
 | 
			
		||||
 | 
			
		||||
@ -33,6 +33,12 @@ public class WgzAppGetMessageListRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("读状态(0未读 1已读)")
 | 
			
		||||
	private String readStatus;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("大类型")
 | 
			
		||||
	private String messageLargeType;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("小类型")
 | 
			
		||||
	private String messageSmallType;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("创建时间")
 | 
			
		||||
	private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
@ -55,14 +61,33 @@ public class WgzAppGetMessageListRes implements Serializable {
 | 
			
		||||
	private Long otherId;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·补卡·补卡时间")
 | 
			
		||||
	private Long otherFillingTime;
 | 
			
		||||
	private LocalDateTime otherFillingTime;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·补卡·补卡理由")
 | 
			
		||||
	private Long otherReason;
 | 
			
		||||
	private String otherReason;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·补卡·申请人")
 | 
			
		||||
	private Long otherApplicant;
 | 
			
		||||
	private String otherApplicant;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·补卡·申请时间")
 | 
			
		||||
	private Long otherApplicationDate;
 | 
			
		||||
	private LocalDateTime otherApplicationDate;
 | 
			
		||||
 | 
			
		||||
	//其它·请假
 | 
			
		||||
	@ApiModelProperty("其它·请假·请假ID")
 | 
			
		||||
	private Long qjID;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·请假·请假起始时间")
 | 
			
		||||
	private LocalDateTime qjStartingTime;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·请假·请假结算时间")
 | 
			
		||||
	private LocalDateTime qjEndTime;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·请假·理由")
 | 
			
		||||
	private String qjReason;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·请假·请假人")
 | 
			
		||||
	private String qjName;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("其它·请假·请假时间")
 | 
			
		||||
	private LocalDateTime qjLeaveTime;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -10,6 +10,7 @@ import lombok.experimental.Accessors;
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
import java.time.LocalDate;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@ -17,6 +18,6 @@ import java.util.List;
 | 
			
		||||
@ApiModel("消息类型统计返回参数")
 | 
			
		||||
public class WgzAppMessageTypeStatisticsRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("消息类型")
 | 
			
		||||
	private List<WgzAppMessageTypeStatisticsTwo> list;
 | 
			
		||||
	private Map<String,Integer> mp;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -27,6 +27,9 @@ public interface WgzMessageMapper extends BaseMapperPlus<WgzMessage> {
 | 
			
		||||
 | 
			
		||||
	Page<WgzAppGetMessageListRes> userGetMessageList(@Param("page") Page<WgzAppGetMessageListReq> page,@Param("req") WgzAppGetMessageListReq req);
 | 
			
		||||
 | 
			
		||||
	//	//根据招工id获取到招工的信息+附件
 | 
			
		||||
	//根据招工id获取到招工的信息+附件
 | 
			
		||||
	WgzAppRegistrationInformationRes findByRecruitIdData(@Param("recruitId") Long recruitId);
 | 
			
		||||
 | 
			
		||||
	//分页查询消息列表
 | 
			
		||||
	Page<WgzAppGetMessageListRes> pagingQueryTheMessageList(@Param("page") Page<WgzAppGetMessageListReq> page,@Param("req") WgzAppGetMessageListReq req);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -134,4 +134,9 @@ public interface IWgzAttendanceService extends IServicePlus<WgzAttendance> {
 | 
			
		||||
	 */
 | 
			
		||||
	LocalDate findByNumGetDate(Long userId, Long recruitId,Integer num);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 根据日期得到剩余还未结算的记录
 | 
			
		||||
	 */
 | 
			
		||||
	List<WgzAttendance> findByDateGetDateList(Long userId, Long recruitId,LocalDate date);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -177,8 +177,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);
 | 
			
		||||
		String exceptionType = we.getExceptionType();
 | 
			
		||||
		if (we.getLeaveMarkId() != null && we.getLeaveMarkId()!= 0) {
 | 
			
		||||
		if (we !=null && we.getLeaveMarkId() != null && we.getLeaveMarkId()!= 0) {
 | 
			
		||||
			throw new RuntimeException("您有已通过的请假申请,请假时间为:"+formattedDate);
 | 
			
		||||
		}
 | 
			
		||||
		//6、组装完整的打卡信息
 | 
			
		||||
@ -198,6 +197,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
				wgzAttendance.setLateTime(now);
 | 
			
		||||
				wgzAttendance.setExceptionType("1,");
 | 
			
		||||
			}
 | 
			
		||||
			return baseMapper.insert(wgzAttendance) > 0;
 | 
			
		||||
		}else{
 | 
			
		||||
			//7、获取上次打卡时间与这次打卡时间的间隔是否超过3分钟
 | 
			
		||||
			boolean flag = isMinutesDifferenceGreaterThanThree(we.getClockInTime(), now);
 | 
			
		||||
@ -206,13 +206,15 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
			}
 | 
			
		||||
			wgzAttendance.setClockOutTime(now);
 | 
			
		||||
			LocalTime endWorkTime = appById.getEndWorkTime(); //下班
 | 
			
		||||
			String exceptionType = we.getExceptionType();
 | 
			
		||||
			if (!localTime.isAfter(endWorkTime)) {
 | 
			
		||||
				wgzAttendance.setId(we.getId());
 | 
			
		||||
				wgzAttendance.setEarlyLeave(1); //早退
 | 
			
		||||
				wgzAttendance.setEarlyLeaveTime(now);
 | 
			
		||||
				wgzAttendance.setExceptionType(exceptionType+"2,");
 | 
			
		||||
			}
 | 
			
		||||
			return baseMapper.updateById(wgzAttendance) > 0;
 | 
			
		||||
		}
 | 
			
		||||
		return baseMapper.insert(wgzAttendance) > 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
@ -691,4 +693,19 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 根据日期得到剩余还未结算的记录
 | 
			
		||||
	 */
 | 
			
		||||
	@Override
 | 
			
		||||
	public List<WgzAttendance> findByDateGetDateList(Long userId, Long recruitId, LocalDate date) {
 | 
			
		||||
		//1、获取所有考勤信息,前提条件是该用户的打卡时间要大于date
 | 
			
		||||
		LambdaQueryWrapper<WgzAttendance> wra = new LambdaQueryWrapper<>();
 | 
			
		||||
		wra.eq(WgzAttendance::getRecruitId, recruitId);
 | 
			
		||||
		wra.eq(WgzAttendance::getUserId, userId);
 | 
			
		||||
		wra.gt(WgzAttendance::getDate, date);
 | 
			
		||||
		wra.orderByAsc(WgzAttendance::getDate);
 | 
			
		||||
		List<WgzAttendance> wgzAttendances = baseMapper.selectList(wra);
 | 
			
		||||
		return wgzAttendances;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,12 @@ import com.ruoyi.wgz.bo.res.WgzAppGetMessageListRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppMessageTypeStatisticsRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppRegistrationInformationRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.rests.WgzAppMessageTypeStatisticsTwo;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzLeave;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzReissueacard;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzUser;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzLeaveService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzReissueacardService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzUserService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.scheduling.annotation.Async;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
@ -32,10 +38,7 @@ import com.ruoyi.wgz.domain.WgzMessage;
 | 
			
		||||
import com.ruoyi.wgz.mapper.WgzMessageMapper;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzMessageService;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 消息Service业务层处理
 | 
			
		||||
@ -52,6 +55,15 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IAnnexService annexService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IWgzReissueacardService iWgzReissueacardService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private  IWgzLeaveService iWgzLeaveService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IWgzUserService wgzUserService;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public WgzMessage queryById(Long id){
 | 
			
		||||
        return getById(id);
 | 
			
		||||
@ -131,33 +143,62 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
 | 
			
		||||
    @Override
 | 
			
		||||
    public WgzAppMessageTypeStatisticsRes userMessageTypeStatistics(Long id) {
 | 
			
		||||
        WgzAppMessageTypeStatisticsRes res = new WgzAppMessageTypeStatisticsRes();
 | 
			
		||||
        List<WgzAppMessageTypeStatisticsTwo> list = new ArrayList<>();
 | 
			
		||||
		Map<String, Integer> mp = new HashMap<>();
 | 
			
		||||
//        List<WgzAppMessageTypeStatisticsTwo> list = new ArrayList<>();
 | 
			
		||||
        //1、获取字典类型
 | 
			
		||||
        List<SysDictData> data = dictTypeService.selectDictDataByType("message_large_type");
 | 
			
		||||
        for (SysDictData datum : data) {
 | 
			
		||||
            WgzAppMessageTypeStatisticsTwo two = new WgzAppMessageTypeStatisticsTwo();
 | 
			
		||||
            //2、统计数据
 | 
			
		||||
            LambdaQueryWrapper<WgzMessage> wp = new LambdaQueryWrapper<WgzMessage>().
 | 
			
		||||
                    eq(WgzMessage::getRecipientId, id).
 | 
			
		||||
                    eq(WgzMessage::getRecipientType, "1").
 | 
			
		||||
                    eq(WgzMessage::getReadStatus, "0").
 | 
			
		||||
                    eq(WgzMessage::getMessageLargeType, datum.getDictValue());
 | 
			
		||||
            two.setType(datum.getDictValue());
 | 
			
		||||
            two.setNum(baseMapper.delete(wp));
 | 
			
		||||
            list.add(two);
 | 
			
		||||
			mp.put(datum.getDictValue(),baseMapper.selectCount(wp));
 | 
			
		||||
        }
 | 
			
		||||
        res.setList(list);
 | 
			
		||||
        return res;
 | 
			
		||||
        return res.setMp(mp);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public TableDataInfo<WgzAppGetMessageListRes> userGetMessageList(WgzAppGetMessageListReq req) {
 | 
			
		||||
		Long appUserId = SecurityUtils.getAppUserId();
 | 
			
		||||
		WgzUser wgz = wgzUserService.findByUserId(appUserId);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		req.setRecipientId(appUserId);
 | 
			
		||||
		Page<WgzAppGetMessageListReq> queryDTOPage = new Page<>();
 | 
			
		||||
		queryDTOPage.setCurrent(req.getPageNum());
 | 
			
		||||
		queryDTOPage.setSize(req.getPageSize());
 | 
			
		||||
		return PageUtils.buildDataInfo(baseMapper.userGetMessageList(queryDTOPage,req));
 | 
			
		||||
		//1、分页查询出所有的小类型,然后循环查询小类型对应标题数据
 | 
			
		||||
		if(req.getLargeType() !=null && req.getLargeType().equals("3") && req.getSmallType()==null){
 | 
			
		||||
			Page<WgzAppGetMessageListRes> pe = baseMapper.pagingQueryTheMessageList(queryDTOPage, req);
 | 
			
		||||
			//2、循环小类型,然后去查询对应不同类的查询标题(主要针对0补卡、3请假)
 | 
			
		||||
			pe.getRecords().stream().forEach(res -> {
 | 
			
		||||
				//3、根据小类型去查询标题
 | 
			
		||||
				if(res.getMessageSmallType().equals("0")){
 | 
			
		||||
					WgzReissueacard byId = iWgzReissueacardService.getById(res.getTableId());
 | 
			
		||||
					res.setOtherId(byId.getId()).
 | 
			
		||||
						setOtherFillingTime(byId.getNowTime()).
 | 
			
		||||
						setOtherReason(byId.getReason()).
 | 
			
		||||
						setOtherApplicant(wgz.getUsername()).
 | 
			
		||||
						setOtherApplicationDate(byId.getCreateTime());
 | 
			
		||||
				}
 | 
			
		||||
				if(res.getMessageSmallType().equals("3")){
 | 
			
		||||
					WgzLeave byId = iWgzLeaveService.getById(res.getTableId());
 | 
			
		||||
					res.setQjID(byId.getId()).
 | 
			
		||||
						setQjStartingTime(byId.getStartTime()).
 | 
			
		||||
						setQjEndTime(byId.getEndTime()).
 | 
			
		||||
						setQjReason(byId.getReason()).
 | 
			
		||||
						setQjName(wgz.getUsername()).
 | 
			
		||||
						setQjLeaveTime(byId.getCreateTime());
 | 
			
		||||
				}
 | 
			
		||||
			});
 | 
			
		||||
			return PageUtils.buildDataInfo(pe);
 | 
			
		||||
		}
 | 
			
		||||
		//2、走正常的全部+大类型+具体的小类型
 | 
			
		||||
		else{
 | 
			
		||||
			return PageUtils.buildDataInfo(baseMapper.userGetMessageList(queryDTOPage,req));
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -29,10 +29,7 @@ import com.ruoyi.wgz.bo.WgzPayCalculationQueryBo;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppApplyForPayrollSettlementListReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzApplyForPayrollSettlementAddReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppApplyForPayrollSettlementListRes;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzMessage;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzPayCalculation;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzPayCalculationFiles;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzUser;
 | 
			
		||||
import com.ruoyi.wgz.domain.*;
 | 
			
		||||
import com.ruoyi.wgz.mapper.WgzPayCalculationMapper;
 | 
			
		||||
import com.ruoyi.wgz.service.*;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
@ -175,26 +172,27 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
 | 
			
		||||
		SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
			
		||||
		BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId());
 | 
			
		||||
		BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getId());
 | 
			
		||||
//		//2、结算数据之前,需要先获取以往结算的数据,然后得到剩余结算天数,再从剩余天数重新进行数据结算
 | 
			
		||||
//		//2.1、获取以往结算的数据
 | 
			
		||||
//		WgzPayCalculation wgzts = baseMapper.selectOne(Wrappers.<WgzPayCalculation>lambdaQuery().
 | 
			
		||||
//			eq(WgzPayCalculation::getUserId, user.getUserId()).
 | 
			
		||||
//			eq(WgzPayCalculation::getRecruitId, recruitApply.getId()).
 | 
			
		||||
//			orderByDesc(WgzPayCalculation::getCreateTime).
 | 
			
		||||
//			last("LIMIT 1")
 | 
			
		||||
//		);
 | 
			
		||||
//		if (wgzts != null) {
 | 
			
		||||
//			LocalDate cutOffTime = wgzts.getCutOffTime();
 | 
			
		||||
//			Integer num = iWgzAttendanceService.attendanceDetail(user.getUserId(), recruitApply.getRecruitId(), null);
 | 
			
		||||
//		}
 | 
			
		||||
		//2、结算数据之前,需要先获取以往结算的数据(如果没有就说明第一次结算),然后得到剩余结算天数,再从剩余天数重新进行数据结算
 | 
			
		||||
		Integer num = 0;
 | 
			
		||||
		LocalDate byNumGetDate = null;
 | 
			
		||||
		WgzPayCalculation wgzts = baseMapper.selectOne(Wrappers.<WgzPayCalculation>lambdaQuery().
 | 
			
		||||
			eq(WgzPayCalculation::getUserId, user.getUserId()).
 | 
			
		||||
			eq(WgzPayCalculation::getRecruitId, recruitApply.getId()).
 | 
			
		||||
			orderByDesc(WgzPayCalculation::getCreateTime).
 | 
			
		||||
			last("LIMIT 1")
 | 
			
		||||
		);
 | 
			
		||||
		if (wgzts != null) {//得到最后一次的结算截止时间和剩余未结算天数
 | 
			
		||||
			byNumGetDate = wgzts.getCutOffTime();
 | 
			
		||||
			num = iWgzAttendanceService.findByDateGetDateList(user.getUserId(), recruitApply.getRecruitId(), byNumGetDate).size();
 | 
			
		||||
 | 
			
		||||
		//2、获取当前人一共考勤打卡了多少天,然后计算当前结算的天数得到具体是考勤打卡对应的哪一天
 | 
			
		||||
		Integer num = iWgzAttendanceService.attendanceDetail(user.getUserId(), recruitApply.getRecruitId(), null);
 | 
			
		||||
		if (num < req.getNum()) {
 | 
			
		||||
			throw new RuntimeException("你的剩余考勤天数不满足你当前想要结算的天数!");
 | 
			
		||||
		}else{//得到即将结算截止的日期和剩余未结算天数
 | 
			
		||||
			byNumGetDate = iWgzAttendanceService.findByNumGetDate(user.getUserId(), recruitApply.getRecruitId(), req.getNum());
 | 
			
		||||
			num = iWgzAttendanceService.attendanceDetail(user.getUserId(), recruitApply.getRecruitId(), null);
 | 
			
		||||
		}
 | 
			
		||||
		LocalDate byNumGetDate = iWgzAttendanceService.findByNumGetDate(user.getUserId(), recruitApply.getRecruitId(), req.getNum());
 | 
			
		||||
		//2、组装数据
 | 
			
		||||
		if (num < req.getNum()) { //判断剩余天数是否满足当前结算天数
 | 
			
		||||
			throw new RuntimeException("您剩余可结算天数为:"+num+"天,您当前想要结算的天数为:"+req.getNum()+"天,剩余天数不足!");
 | 
			
		||||
		}
 | 
			
		||||
		//4、组装数据
 | 
			
		||||
		WgzPayCalculation wgzPayCalculation = new WgzPayCalculation();
 | 
			
		||||
		BeanUtils.copyProperties(req,wgzPayCalculation);
 | 
			
		||||
		wgzPayCalculation.
 | 
			
		||||
@ -202,9 +200,9 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
 | 
			
		||||
			setUserName(user.getUserName()).
 | 
			
		||||
			setAuditorUserId(recruit.getUserId()).
 | 
			
		||||
			setCutOffTime(byNumGetDate);
 | 
			
		||||
		//3、获取附件信息并插入
 | 
			
		||||
		//5、获取附件信息并插入
 | 
			
		||||
		iWgzPayCalculationFilesService.saveBatch(req.getPayCalculation());
 | 
			
		||||
		//4、插入工资结算信息
 | 
			
		||||
		//6、插入工资结算信息
 | 
			
		||||
		boolean save = save(wgzPayCalculation);
 | 
			
		||||
		if (save) {
 | 
			
		||||
			WgzUser byId = wgzUserService.findByUserId(user.getUserId());
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user