优化
This commit is contained in:
		| @ -1,5 +1,8 @@ | ||||
| package com.ruoyi.common.enums; | ||||
|  | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
|  | ||||
| /** | ||||
|  * 审核状态 | ||||
|  * | ||||
| @ -30,4 +33,9 @@ public enum AuditStatus | ||||
|     { | ||||
|         return info; | ||||
|     } | ||||
|  | ||||
|  | ||||
| 	public static List<String> getAudit(){ | ||||
| 		return Arrays.asList(PASS.getCode(),REFUSE.getCode()); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -77,4 +77,8 @@ public class BgtMessageDetailVO implements Serializable { | ||||
| 	//任务 结算共用 | ||||
| 	@ApiModelProperty("任务名称") | ||||
| 	private String taskName; | ||||
|  | ||||
| 	// | ||||
| 	@ApiModelProperty("今日完成工作") | ||||
| 	private String finishToday; | ||||
| } | ||||
|  | ||||
| @ -20,7 +20,7 @@ import java.time.LocalTime; | ||||
| @Data | ||||
| @NoArgsConstructor | ||||
| @Accessors(chain = true) | ||||
| @ApiModel("考勤打卡视图对象") | ||||
| @ApiModel("考勤打卡统计记录对象") | ||||
| public class WgzAttendanceRecordVO implements Serializable { | ||||
|  | ||||
|     private static final long serialVersionUID=1L; | ||||
|  | ||||
| @ -25,13 +25,11 @@ import com.ruoyi.common.utils.PageUtils; | ||||
| import com.ruoyi.common.utils.SecurityUtils; | ||||
| import com.ruoyi.fbs.domain.FbsProjectTask; | ||||
| import com.ruoyi.fbs.service.IFbsProjectTaskService; | ||||
| import com.ruoyi.wgz.domain.WgzDailyClock; | ||||
| import com.ruoyi.wgz.domain.WgzLeave; | ||||
| import com.ruoyi.wgz.domain.WgzPayCalculation; | ||||
| import com.ruoyi.wgz.domain.WgzReissueacard; | ||||
| import com.ruoyi.wgz.service.IWgzLeaveService; | ||||
| import com.ruoyi.wgz.service.IWgzPayCalculationService; | ||||
| import com.ruoyi.wgz.service.IWgzReissueacardService; | ||||
| import com.ruoyi.wgz.service.IWgzUserService; | ||||
| import com.ruoyi.wgz.service.*; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Service; | ||||
| import org.springframework.transaction.annotation.Transactional; | ||||
| @ -75,6 +73,9 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt | ||||
| 	@Autowired | ||||
| 	private IFbsProjectTaskService taskService; | ||||
|  | ||||
| 	@Autowired | ||||
| 	private IWgzDailyClockService dailyClockService; | ||||
|  | ||||
| 	@Override | ||||
| 	public BgtMessage queryById(Long id) { | ||||
| 		return getById(id); | ||||
| @ -184,7 +185,10 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt | ||||
| 		wrapper.eq(BgtMessage::getRecipientId, SecurityUtils.getAppUserId()); | ||||
| 		wrapper.eq(StrUtil.isNotBlank(dto.getMessageLargeType()), BgtMessage::getMessageLargeType, dto.getMessageLargeType()); | ||||
| 		wrapper.eq(StrUtil.isNotBlank(dto.getMessageSmallType()), BgtMessage::getMessageSmallType, dto.getMessageSmallType()); | ||||
| 		wrapper.between(dto.getDate() != null, BgtMessage::getCreateTime, dto.getDate().atStartOfDay(), dto.getDate().atStartOfDay().with(LocalTime.MAX)); | ||||
| 		if(dto.getDate() != null) { | ||||
| 			wrapper.between(BgtMessage::getCreateTime, dto.getDate().atStartOfDay(), dto.getDate().atStartOfDay().with(LocalTime.MAX)); | ||||
| 		} | ||||
| 		wrapper.orderByDesc(BgtMessage::getCreateTime); | ||||
| 		Page<BgtMessage> result = page(PageUtils.buildPage(), wrapper); | ||||
| 		Page<BgtMessageDetailVO> bgtMessageVOPage = new Page<>(); | ||||
| 		bgtMessageVOPage.setTotal(result.getTotal()); | ||||
| @ -224,6 +228,12 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt | ||||
| 						bgtMessageDetailVO.setUsername(wgzUserService.getById(reissueCard.getUserId()).getUsername()); | ||||
| 						bgtMessageDetailVO.setNowTime(reissueCard.getNowTime()); | ||||
| 						break; | ||||
| 					case BGT_SMALL_REPORT_MAKE_UP: | ||||
| 						WgzDailyClock dailyClock = dailyClockService.getById(message.getTableId()); | ||||
| 						BgtProjectRecruit recruitClock = recruitService.getById(dailyClock.getRecruitId()); | ||||
| 						bgtMessageDetailVO.setUsername(wgzUserService.getById(dailyClock.getUserId()).getUsername()); | ||||
| 						bgtMessageDetailVO.setRecruitName(recruitClock.getRecruitName()); | ||||
| 						break; | ||||
| 					default: | ||||
| 						break; | ||||
| 				} | ||||
|  | ||||
| @ -6,14 +6,15 @@ import java.util.Map; | ||||
| public class BgtMessageConstant { | ||||
| 	// 公共常量 | ||||
|  | ||||
| 	public static final String BGT_LARGE_TASK = "1";           //大类型-任务 | ||||
| 	public static final String BGT_LARGE_SETTLEMENT = "2";     //大类型-结算 | ||||
| 	public static final String BGT_LARGE_OTHER = "3";          //大类型-其它 | ||||
| 	public static final String BGT_LARGE_TASK = "1";                 //大类型-任务 | ||||
| 	public static final String BGT_LARGE_SETTLEMENT = "2";           //大类型-结算 | ||||
| 	public static final String BGT_LARGE_OTHER = "3";                //大类型-其它 | ||||
|  | ||||
| 	public static final String BGT_SMALL_SIGN_UP = "1";        //小类型-务工者报名 | ||||
| 	public static final String BGT_SMALL_PAY = "2";            //小类型-付款 | ||||
| 	public static final String BGT_SMALL_LEAVE = "3";          //小类型-请假 | ||||
| 	public static final String BGT_SMALL_MAKE_UP = "4";        //小类型-补卡 | ||||
| 	public static final String BGT_SMALL_SIGN_UP = "1";              //小类型-务工者报名 | ||||
| 	public static final String BGT_SMALL_PAY = "2";                  //小类型-付款 | ||||
| 	public static final String BGT_SMALL_LEAVE = "3";                //小类型-请假 | ||||
| 	public static final String BGT_SMALL_MAKE_UP = "4";              //小类型-补卡 | ||||
| 	public static final String BGT_SMALL_REPORT_MAKE_UP = "5";       //小类型-日报补卡 | ||||
|  | ||||
| 	/** | ||||
| 	 * ============================================包工头->务工者 模板================================================== | ||||
| @ -40,15 +41,19 @@ public class BgtMessageConstant { | ||||
| 	//取消选择 | ||||
| 	public static final String BGT_LEAVE_CANSEL_HEADLINE = "您已从【%s】项目离开!"; | ||||
| 	public static final String BGT_LEAVE_CANSEL_SUBHEADING_ONE = "您在【%s】项目中被【%s】拒绝!"; | ||||
| 	//取消选择 | ||||
| 	public static final String BGT_LEAVE_REPORT_MAKE_UP_HEADLINE = "您【%s】项目的日报补卡已审批!"; | ||||
| 	public static final String BGT_LEAVE_REPORT_MAKE_UP_SUBHEADING_ONE = "您【%s】项目的日报补卡,审核人【%s】已%s"; | ||||
|  | ||||
|  | ||||
| 	//包工头->务工者  消息类型 | ||||
| 	public static final String BGT_TYPE_SIGN_UP = "1";    //务工者报名 | ||||
| 	public static final String BGT_TYPE_PAY = "2";        //付款 | ||||
| 	public static final String BGT_TYPE_LEAVE = "3";      //请假 | ||||
| 	public static final String BGT_TYPE_MAKE_UP = "4";    //补卡 | ||||
| 	public static final String BGT_TYPE_EXIT = "5";       //退场 | ||||
| 	public static final String BGT_TYPE_CANSEL = "11";    //取消选择 | ||||
| 	public static final String BGT_TYPE_SIGN_UP = "1";            //务工者报名 | ||||
| 	public static final String BGT_TYPE_PAY = "2";                //付款 | ||||
| 	public static final String BGT_TYPE_LEAVE = "3";              //请假 | ||||
| 	public static final String BGT_TYPE_MAKE_UP = "4";            //补卡 | ||||
| 	public static final String BGT_TYPE_EXIT = "5";               //退场 | ||||
| 	public static final String BGT_TYPE_CANSEL = "11";            //取消选择 | ||||
| 	public static final String BGT_TYPE_REPORT_MAKE_UP = "12";    //日报补卡 | ||||
|  | ||||
|  | ||||
| 	/** | ||||
| @ -155,6 +160,10 @@ public class BgtMessageConstant { | ||||
| 				map.put(HEADLINE, String.format(BGT_LEAVE_CANSEL_HEADLINE, projectName)); | ||||
| 				map.put(SUBHEADING, String.format(BGT_LEAVE_CANSEL_SUBHEADING_ONE, projectName,auditor)); | ||||
| 				break; | ||||
| 			case "12": | ||||
| 				map.put(HEADLINE, String.format(BGT_LEAVE_REPORT_MAKE_UP_HEADLINE, projectName)); | ||||
| 				map.put(SUBHEADING, String.format(BGT_LEAVE_REPORT_MAKE_UP_SUBHEADING_ONE, projectName,auditor,pass)); | ||||
| 				break; | ||||
| 			default: | ||||
| 				break; | ||||
| 		} | ||||
|  | ||||
| @ -628,6 +628,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 		LocalDate startDate = date.with(TemporalAdjusters.firstDayOfMonth()); | ||||
| 		LocalDate endData = date.with(TemporalAdjusters.lastDayOfMonth()); | ||||
| 		wrapper.between(WgzAttendance::getDate, startDate, endData); | ||||
| 		wrapper.orderByDesc(WgzAttendance::getDate); | ||||
| 		List<WgzAttendance> wgzAttendances = baseMapper.selectList(wrapper); | ||||
|  | ||||
| 		//获取招工打卡时间 | ||||
| @ -670,14 +671,14 @@ 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(Math.abs(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(Math.abs(DataUtil.getMinutes(clockOutTime, endWorkTime))); | ||||
| 				earlyLeaveRecords.add(earlyLeaveRecordVO); | ||||
| 			} | ||||
| 			//统计缺卡天数 | ||||
| @ -694,6 +695,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe | ||||
| 		} | ||||
| 		//出勤数据 | ||||
| 		bgtAttendanceDetailVO.setDayNum(records.stream().mapToDouble(WgzAttendanceRecordVO::getDay).sum()); | ||||
| 		bgtAttendanceDetailVO.setRecords(records); | ||||
| 		//迟到数据 | ||||
| 		bgtAttendanceDetailVO.setLateNum(lateRecords.size()); | ||||
| 		bgtAttendanceDetailVO.setLateMinute(lateRecords.stream().mapToInt(WgzAttendanceRecordVO::getMinutes).sum()); | ||||
|  | ||||
| @ -3,7 +3,6 @@ package com.ruoyi.wgz.service.impl; | ||||
| import cn.hutool.core.bean.BeanUtil; | ||||
| import cn.hutool.core.util.StrUtil; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
| import com.baomidou.mybatisplus.extension.toolkit.SqlHelper; | ||||
| @ -22,6 +21,7 @@ import com.ruoyi.common.constants.WgzAndBgtMessageConstant; | ||||
| import com.ruoyi.common.core.domain.entity.BgtUser; | ||||
| 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.utils.PageUtils; | ||||
| import com.ruoyi.common.utils.SecurityUtils; | ||||
| import com.ruoyi.wgz.bo.WgzDailyClockQueryBo; | ||||
| @ -34,7 +34,6 @@ import com.ruoyi.wgz.bo.res.WgzUserDailyCalendarRes; | ||||
| import com.ruoyi.wgz.bo.rests.WgzAppAttachmentAcquisitionTwo; | ||||
| import com.ruoyi.wgz.domain.WgzDailyClock; | ||||
| import com.ruoyi.wgz.domain.WgzMessage; | ||||
| import com.ruoyi.wgz.domain.WgzReissueacard; | ||||
| import com.ruoyi.wgz.domain.WgzUser; | ||||
| import com.ruoyi.wgz.mapper.WgzDailyClockMapper; | ||||
| import com.ruoyi.wgz.service.IWgzDailyClockService; | ||||
| @ -53,7 +52,6 @@ import java.util.*; | ||||
|  | ||||
| import static com.ruoyi.common.constants.BgtMessageConstant.*; | ||||
| import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*; | ||||
| import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.USERTYPE_BGT; | ||||
|  | ||||
| /** | ||||
|  * 日报打卡Service业务层处理 | ||||
| @ -330,8 +328,38 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl<WgzDailyClockMappe | ||||
|  | ||||
| 	@Override | ||||
| 	public Boolean appUpdate(BgtDailyClockUpdateDTO dto) { | ||||
| 		WgzDailyClock dailyClock = BeanUtil.copyProperties(dto, WgzDailyClock.class); | ||||
| 		dailyClock.setAuditorTime(LocalDateTime.now()); | ||||
|  | ||||
| 		WgzDailyClock dailyClock = getById(dto.getId()); | ||||
| 		if(dailyClock.getAuditorUserId() == null){ | ||||
| 			throw new RuntimeException("日报数据不存在!"); | ||||
| 		} | ||||
| 		BeanUtil.copyProperties(dto,dailyClock); | ||||
| 		if(AuditStatus.getAudit().contains(dto.getAuditorType())){ | ||||
| 			dailyClock.setAuditorTime(LocalDateTime.now()); | ||||
|  | ||||
| 			//补卡需要发消息 | ||||
| 			if("1".equals(dailyClock.getStatus())){ | ||||
|  | ||||
| 				BgtProjectRecruit recruit = iBgtProjectRecruitService.getById(dailyClock.getRecruitId()); | ||||
| 				HashMap<String, String> mp = new HashMap<>(); | ||||
| 				mp.put("projectName",recruit.getRecruitName()); | ||||
| 				mp.put("auditor",SecurityUtils.getUsername()); | ||||
| 				Map<String, String> map = bgtMessage(mp, BGT_TYPE_REPORT_MAKE_UP, AuditStatus.PASS.getCode().equals(dto.getAuditorType())); | ||||
| 				WgzMessage wgzMessage = new WgzMessage() | ||||
| 					.setSenderType(USERTYPE_BGT) | ||||
| 					.setSenderId(SecurityUtils.getAppUserId()) | ||||
| 					.setRecipientType(USERTYPE_WGZ) | ||||
| 					.setRecipientId(dailyClock.getUserId()) | ||||
| 					.setHeadline(map.get(HEADLINE)) | ||||
| 					.setSubheading(map.get(SUBHEADING)) | ||||
| 					.setTableId(dailyClock.getId()) | ||||
| 					.setTableName(SqlHelper.table(WgzDailyClock.class).getTableName()) | ||||
| 					.setMessageLargeType(LARGE_OTHER) | ||||
| 					.setMessageSmallType(SMALL_DAILY); | ||||
| 				iWgzMessageService.sendAMessage(wgzMessage); | ||||
| 			} | ||||
|  | ||||
| 		} | ||||
| 		return updateById(dailyClock); | ||||
| 	} | ||||
| } | ||||
|  | ||||
| @ -67,6 +67,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|         <if test="dto.recruit_id != null"> | ||||
|             and DATE(wdc.dily_time) = #{dto.dilyTime} | ||||
|         </if> | ||||
|         order by wdc.create_time desc | ||||
|     </select> | ||||
|  | ||||
|  | ||||
|  | ||||
| @ -193,6 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | ||||
|                 #{auditorType} | ||||
|             </foreach> | ||||
|         </if> | ||||
|         order by w.create_time desc | ||||
|     </select> | ||||
|  | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 zt
					zt