消息发送完成
This commit is contained in:
		@ -39,7 +39,7 @@ public interface BgtProjectRecruitMapper extends BaseMapperPlus<BgtProjectRecrui
 | 
			
		||||
	List<WgzAppCancelRegistrationProjectDetailsTwo> GetsTheMembersUnderTheCurrentProject (@Param("recruitId") Long recruitId);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	TableDataInfo<WgzAppJobListingRes> userJobListing(@Param("page") Page<WgzAppJobListingReq> page);
 | 
			
		||||
	Page<WgzAppJobListingRes> userJobListing(@Param("page") Page<WgzAppJobListingReq> page);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -17,6 +17,7 @@ import com.ruoyi.bgt.service.IBgtMessageService;
 | 
			
		||||
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
 | 
			
		||||
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
 | 
			
		||||
import com.ruoyi.common.constants.WgzAndBgtMessageConstant;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysDictData;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.enums.RecruitApplyStatus;
 | 
			
		||||
@ -24,6 +25,7 @@ import com.ruoyi.common.exception.BaseException;
 | 
			
		||||
import com.ruoyi.common.service.IAnnexService;
 | 
			
		||||
import com.ruoyi.common.utils.PageUtils;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.system.service.ISysDictTypeService;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppConfirmRegistrationReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppUnderwayReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppUnderwayRes;
 | 
			
		||||
@ -66,6 +68,8 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
	private IWgzMessageService iWgzMessageService;
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IBgtMessageService iBgtMessageService;
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private ISysDictTypeService dictTypeService;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public BgtProjectRecruitApply queryById(Long id){
 | 
			
		||||
@ -176,12 +180,12 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
		lqw.eq(BgtProjectRecruitApply::getUserId, id).
 | 
			
		||||
			in(BgtProjectRecruitApply::getStatus, strings); //包工头+务工者同意 or 进场 才算进场ok
 | 
			
		||||
		List<BgtProjectRecruitApply> bgtProjectRecruitApplies = baseMapper.selectList(lqw);
 | 
			
		||||
		if (bgtProjectRecruitApplies.isEmpty()){
 | 
			
		||||
			throw new RuntimeException("异常,还未查询到您进入了工地!");
 | 
			
		||||
		}
 | 
			
		||||
		if (bgtProjectRecruitApplies.size()>1){
 | 
			
		||||
			throw new RuntimeException("异常,查询到用户同时在多个工地务工!");
 | 
			
		||||
		}
 | 
			
		||||
		if (bgtProjectRecruitApplies.isEmpty()){
 | 
			
		||||
			return null;
 | 
			
		||||
		}
 | 
			
		||||
		return bgtProjectRecruitApplies.get(0);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@ -221,15 +225,18 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
		int insert = baseMapper.insert(bgtProjectRecruitApply);
 | 
			
		||||
		//4、发送消息
 | 
			
		||||
		if (insert>0){
 | 
			
		||||
			SysDictData typeOfWork = dictTypeService.selectDictDataByTypeAndData("type_of_work", byId.getTypeOfWork());
 | 
			
		||||
			Map<String, String> mp = new HashMap<>();
 | 
			
		||||
			mp.put("projectName",appById.getRecruitName());
 | 
			
		||||
			mp.put("userName",byId.getUsername());
 | 
			
		||||
			mp.put("post",typeOfWork.getDictLabel());
 | 
			
		||||
			//4-1、系统发送消息给当前用户
 | 
			
		||||
			WgzMessage wgzMessage = new WgzMessage().
 | 
			
		||||
				setSenderType(USERTYPE_SYSTEM).
 | 
			
		||||
				setRecipientType(USERTYPE_WGZ).
 | 
			
		||||
				setRecipientId(appUserId).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"1")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"2")).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"101")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"102")).
 | 
			
		||||
				setTableId(bgtProjectRecruitApply.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(LARGE_OTHER).
 | 
			
		||||
@ -243,11 +250,12 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
				setSenderId(appUserId).
 | 
			
		||||
				setRecipientType(USERTYPE_BGT).
 | 
			
		||||
				setRecipientId(appById.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"3")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"4")).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"201")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"202")).
 | 
			
		||||
				setTableId(bgtProjectRecruitApply.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(LARGE_APPLY);
 | 
			
		||||
				setMessageLargeType(BGT_LARGE).
 | 
			
		||||
				setMessageSmallType(BGT_TYPE_SIGN_UP);
 | 
			
		||||
			if (!iBgtMessageService.sendAMessage(bgtMessage)){
 | 
			
		||||
				throw new RuntimeException("发送消息失败!");
 | 
			
		||||
			}
 | 
			
		||||
@ -304,8 +312,8 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
				setSenderType(USERTYPE_SYSTEM).
 | 
			
		||||
				setRecipientType(USERTYPE_WGZ).
 | 
			
		||||
				setRecipientId(appUserId).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"1")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"2")).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"103")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"104")).
 | 
			
		||||
				setTableId(bgtProjectRecruitApply.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(LARGE_OTHER).
 | 
			
		||||
@ -330,9 +338,85 @@ public class BgtProjectRecruitApplyServiceImpl extends ServicePlusImpl<BgtProjec
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Boolean userConfirmRegistration(WgzAppConfirmRegistrationReq req) {
 | 
			
		||||
		BgtProjectRecruitApply apply = new BgtProjectRecruitApply().setId(req.getRecruitApplyId()).setStatus(req.getStatus());
 | 
			
		||||
		//发送取消或拒绝的消息给包工头、系统
 | 
			
		||||
		return this.updateById(apply);
 | 
			
		||||
		//1、获取当前用户
 | 
			
		||||
		WgzUser byUserId = wgzUserService.findByUserId(SecurityUtils.getAppUserId());
 | 
			
		||||
		//2、当前申请报名的工地信息
 | 
			
		||||
		BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.queryById(req.getRecruitApplyId());
 | 
			
		||||
		BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getId());
 | 
			
		||||
		//3、更新报名状态
 | 
			
		||||
		BgtProjectRecruitApply apply = new BgtProjectRecruitApply();
 | 
			
		||||
		apply.setId(req.getRecruitApplyId());
 | 
			
		||||
		apply.setStatus(req.getStatus());
 | 
			
		||||
		int insert = baseMapper.insert(apply);
 | 
			
		||||
		if (insert == 0){
 | 
			
		||||
			throw new RuntimeException("插入数据失败!");
 | 
			
		||||
		}
 | 
			
		||||
		//4系统拒绝消息
 | 
			
		||||
		SysDictData typeOfWork = dictTypeService.selectDictDataByTypeAndData("type_of_work", recruit.getTypeOfWork());
 | 
			
		||||
		Map<String, String> mp = new HashMap<>();
 | 
			
		||||
		mp.put("projectName",recruit.getRecruitName());
 | 
			
		||||
		mp.put("userName",byUserId.getUsername());
 | 
			
		||||
		mp.put("post",typeOfWork.getDictLabel());
 | 
			
		||||
		if (req.getStatus().equals("3")){
 | 
			
		||||
			WgzMessage wgzMessage = new WgzMessage().
 | 
			
		||||
				setSenderType(USERTYPE_SYSTEM).
 | 
			
		||||
				setRecipientType(USERTYPE_WGZ).
 | 
			
		||||
				setRecipientId(byUserId.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"105")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"106")).
 | 
			
		||||
				setTableId(apply.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(LARGE_APPLY);
 | 
			
		||||
			if (!iWgzMessageService.sendAMessage(wgzMessage)){
 | 
			
		||||
				throw new RuntimeException("系统消息报名拒绝发送失败!");
 | 
			
		||||
			}
 | 
			
		||||
			BgtMessage bgtMessage = new BgtMessage().
 | 
			
		||||
				setSenderType(USERTYPE_WGZ).
 | 
			
		||||
				setSenderId(byUserId.getUserId()).
 | 
			
		||||
				setRecipientType(USERTYPE_BGT).
 | 
			
		||||
				setRecipientId(apply.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"203")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"204")).
 | 
			
		||||
				setTableId(apply.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(BGT_LARGE).
 | 
			
		||||
				setMessageSmallType(BGT_TYPE_SIGN_UP);
 | 
			
		||||
			if (!iBgtMessageService.sendAMessage(bgtMessage)){
 | 
			
		||||
				throw new RuntimeException("发送报名拒绝消息失败!");
 | 
			
		||||
			}
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		//系统同意消息
 | 
			
		||||
		if (req.getStatus().equals("4")){
 | 
			
		||||
			WgzMessage wgzMessage = new WgzMessage().
 | 
			
		||||
				setSenderType(USERTYPE_SYSTEM).
 | 
			
		||||
				setRecipientType(USERTYPE_WGZ).
 | 
			
		||||
				setRecipientId(byUserId.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"107")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"108")).
 | 
			
		||||
				setTableId(apply.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(LARGE_APPLY);
 | 
			
		||||
			if (!iWgzMessageService.sendAMessage(wgzMessage)){
 | 
			
		||||
				throw new RuntimeException("系统消息报名同意发送失败!");
 | 
			
		||||
			}
 | 
			
		||||
			BgtMessage bgtMessage = new BgtMessage().
 | 
			
		||||
				setSenderType(USERTYPE_WGZ).
 | 
			
		||||
				setSenderId(byUserId.getUserId()).
 | 
			
		||||
				setRecipientType(USERTYPE_BGT).
 | 
			
		||||
				setRecipientId(apply.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"205")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"206")).
 | 
			
		||||
				setTableId(apply.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(BGT_LARGE).
 | 
			
		||||
				setMessageSmallType(BGT_TYPE_SIGN_UP);
 | 
			
		||||
			if (!iBgtMessageService.sendAMessage(bgtMessage)){
 | 
			
		||||
				throw new RuntimeException("发送报名同意消息失败!");
 | 
			
		||||
			}
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -194,7 +194,7 @@ public class BgtProjectRecruitServiceImpl extends ServicePlusImpl<BgtProjectRecr
 | 
			
		||||
		Page<WgzAppJobListingReq> pe = new Page<>();
 | 
			
		||||
		pe.setCurrent(req.getPageNum());
 | 
			
		||||
		pe.setSize(req.getPageSize());
 | 
			
		||||
		return baseMapper.userJobListing(pe);
 | 
			
		||||
		return PageUtils.buildDataInfo(baseMapper.userJobListing(pe));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -22,38 +22,111 @@ public class WgzAndBgtMessageConstant {
 | 
			
		||||
	 * =====================================================务工者=====================================================
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	//【报名】系统给务工者提示
 | 
			
		||||
	/**
 | 
			
		||||
	 * 系统给务工者提示
 | 
			
		||||
	 */
 | 
			
		||||
	//【报名申请】1-2
 | 
			
		||||
	public static final String WGZ_SYSTEM_HEADLINE_APPLY = "您已申请【%s】项目!";
 | 
			
		||||
	public static final String WGZ_SYSTEM_SUBHEADING_APPLY = "您已成功申请到【%s】项目,请耐心等待回复!";
 | 
			
		||||
	//【取消报名】3-4
 | 
			
		||||
	public static final String WGZ_SYSTEM_HEADLINE_APPLY_CANCEL = "您已申请取消【%s】项目!";
 | 
			
		||||
	public static final String WGZ_SYSTEM_SUBHEADING_APPLY_CANCEL = "您已成功取消【%s】项目,祝您早日找到心仪的工作!";
 | 
			
		||||
	//【报名】务工者给包工头提示
 | 
			
		||||
	//【拒绝报名】5-6
 | 
			
		||||
	public static final String WGZ_SYSTEM_HEADLINE_APPLY_REFUSE = "您已回拒【%s】项目!";
 | 
			
		||||
	public static final String WGZ_SYSTEM_SUBHEADING_APPLY_REFUSE = "您已成功拒绝【%s】项目,祝您早日找到心仪的工作!";
 | 
			
		||||
	//【确认报名】7-8
 | 
			
		||||
	public static final String WGZ_SYSTEM_HEADLINE_APPLY_AFFIRM = "您已成功进入【%s】项目!";
 | 
			
		||||
	public static final String WGZ_SYSTEM_SUBHEADING_APPLY_AFFIRM = "您已成功进入【%s】项目,祝你平平安安赚大钱!";
 | 
			
		||||
	//【补卡申请】9-10
 | 
			
		||||
	public static final String WGZ_SYSTEM_HEADLINE_REISSUEACARD = "您已申请了【%s】项目,【%s】的补卡操作!";
 | 
			
		||||
	public static final String WGZ_SYSTEM_SUBHEADING_REISSUEACARD = "您已成功发起了【%s】的补卡申请,请耐心等待回复!";
 | 
			
		||||
	//【工资结算】11-12
 | 
			
		||||
	public static final String WGZ_SYSTEM_HEADLINE_PAYCALCULATION = "您正在申请【%s】项目,为期【%s】天的工资结算操作!";
 | 
			
		||||
	public static final String WGZ_SYSTEM_SUBHEADING_PAYCALCULATION = "您已成功发起为期【%s】天,金额为【%s】的工资结算操作,请耐心等待回复!";
 | 
			
		||||
	/**
 | 
			
		||||
	 * 务工者给包工头提示
 | 
			
		||||
	 */
 | 
			
		||||
	//【报名】1-2
 | 
			
		||||
	public static final String WGZ_HEADLINE_APPLY = "务工者【%s】正在向你申请【%s】的岗位!";
 | 
			
		||||
	public static final String WGZ__SUBHEADING_APPLY = "务工者【%s】正在向你申请【%s】岗位,您可点击查看更多信息!";
 | 
			
		||||
	//【拒绝报名】3-4
 | 
			
		||||
	public static final String WGZ_HEADLINE_APPLY_REFUSE = "务工者【%s】已委婉的回拒了您提供的【%s】岗位!";
 | 
			
		||||
	public static final String WGZ__SUBHEADING_APPLY_REFUSE = "务工者【%s】已委婉的回拒了您提供的【%s】岗位,并祝你做大做强!";
 | 
			
		||||
	//【确认报名】5-6
 | 
			
		||||
	public static final String WGZ_HEADLINE_APPLY_AFFIRM = "务工者【%s】已成功加入了您团队!";
 | 
			
		||||
	public static final String WGZ__SUBHEADING_APPLY_AFFIRM = "务工者【%s】已同意进入了您提供的【%s】岗位!";
 | 
			
		||||
	//【补卡申请】7-8
 | 
			
		||||
	public static final String WGZ_HEADLINE_REISSUEACARD = "务工者【%s】正在向你发起补卡申请!";
 | 
			
		||||
	public static final String WGZ__SUBHEADING_REISSUEACARD = "务工者【%s】向你发起【%s】的补卡申请操作!";
 | 
			
		||||
	//【工资结算】9-10
 | 
			
		||||
	public static final String WGZ_HEADLINE_PAYCALCULATION = "务工者【%s】正在向你发起工资结算!";
 | 
			
		||||
	public static final String WGZ__SUBHEADING_PAYCALCULATION = "务工者【%s】向你发起为期【%s】天,金额为【%s】圆整的工资结算操作!";
 | 
			
		||||
 | 
			
		||||
	//务工者消息返回
 | 
			
		||||
	public static String wgzMessage(Map<String, String> mp, String type) {
 | 
			
		||||
		switch (type){
 | 
			
		||||
			//系统申请报名提示
 | 
			
		||||
			case "1":
 | 
			
		||||
			case "101":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_HEADLINE_APPLY, mp.get("projectName"));
 | 
			
		||||
			case "2":
 | 
			
		||||
			case "102":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_SUBHEADING_APPLY, mp.get("projectName"));
 | 
			
		||||
			//务工者向包工头申请报名提示
 | 
			
		||||
			case "3":
 | 
			
		||||
				return String.format(WGZ_HEADLINE_APPLY, mp.get("userName"), mp.get("post"));
 | 
			
		||||
			case "4":
 | 
			
		||||
				return String.format(WGZ__SUBHEADING_APPLY, mp.get("userName"),mp.get("post"));
 | 
			
		||||
			//系统取消报名提示
 | 
			
		||||
			case "5":
 | 
			
		||||
			case "103":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_HEADLINE_APPLY_CANCEL, mp.get("projectName"));
 | 
			
		||||
			case "6":
 | 
			
		||||
			case "104":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_SUBHEADING_APPLY_CANCEL, mp.get("projectName"));
 | 
			
		||||
			//系统拒绝报名提示
 | 
			
		||||
			case "105":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_HEADLINE_APPLY_REFUSE, mp.get("projectName"));
 | 
			
		||||
			case "106":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_SUBHEADING_APPLY_REFUSE, mp.get("projectName"));
 | 
			
		||||
			//系统确认报名提示
 | 
			
		||||
			case "107":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_HEADLINE_APPLY_AFFIRM, mp.get("projectName"));
 | 
			
		||||
			case "108":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_SUBHEADING_APPLY_AFFIRM, mp.get("projectName"));
 | 
			
		||||
			//系统补卡申请提示
 | 
			
		||||
			case "109":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_HEADLINE_REISSUEACARD, mp.get("projectName"),mp.get("data"));
 | 
			
		||||
			case "110":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_SUBHEADING_REISSUEACARD, mp.get("projectName"));
 | 
			
		||||
			//系统工资结算申请提示
 | 
			
		||||
			case "111":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_HEADLINE_PAYCALCULATION,mp.get("projectName"), mp.get("num"));
 | 
			
		||||
			case "112":
 | 
			
		||||
				return String.format(WGZ_SYSTEM_SUBHEADING_PAYCALCULATION, mp.get("num"),mp.get("money"));
 | 
			
		||||
			//务工者向包工头申请报名
 | 
			
		||||
			case "201":
 | 
			
		||||
				return String.format(WGZ_HEADLINE_APPLY, mp.get("userName"), mp.get("post"));
 | 
			
		||||
			case "202":
 | 
			
		||||
				return String.format(WGZ__SUBHEADING_APPLY, mp.get("userName"),mp.get("post"));
 | 
			
		||||
			//务工者向包工头拒绝报名
 | 
			
		||||
			case "203":
 | 
			
		||||
				return String.format(WGZ_HEADLINE_APPLY_REFUSE, mp.get("userName"), mp.get("post"));
 | 
			
		||||
			case "204":
 | 
			
		||||
				return String.format(WGZ__SUBHEADING_APPLY_REFUSE, mp.get("userName"),mp.get("post"));
 | 
			
		||||
			//务工者向包工头确认报名
 | 
			
		||||
			case "205":
 | 
			
		||||
				return String.format(WGZ_HEADLINE_APPLY_AFFIRM, mp.get("userName"));
 | 
			
		||||
			case "206":
 | 
			
		||||
				return String.format(WGZ__SUBHEADING_APPLY_AFFIRM, mp.get("userName"),mp.get("post"));
 | 
			
		||||
			//务工者向包工头发起补卡申请
 | 
			
		||||
			case "207":
 | 
			
		||||
				return String.format(WGZ_HEADLINE_REISSUEACARD, mp.get("userName"));
 | 
			
		||||
			case "208":
 | 
			
		||||
				return String.format(WGZ__SUBHEADING_REISSUEACARD, mp.get("userName"),mp.get("data"));
 | 
			
		||||
			//务工者向包工头发起工资结算
 | 
			
		||||
			case "209":
 | 
			
		||||
				return String.format(WGZ_HEADLINE_PAYCALCULATION, mp.get("userName"));
 | 
			
		||||
			case "210":
 | 
			
		||||
				return String.format(WGZ__SUBHEADING_PAYCALCULATION, mp.get("userName"),mp.get("num"),mp.get("money"));
 | 
			
		||||
			default:
 | 
			
		||||
				return "未知类型";
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * =====================================================包工头=====================================================
 | 
			
		||||
	 * =====================================================包工头=====================================================
 | 
			
		||||
@ -78,6 +151,7 @@ public class WgzAndBgtMessageConstant {
 | 
			
		||||
	public static final String SUBHEADING = "subheading";      //副标题
 | 
			
		||||
 | 
			
		||||
	//消息类型
 | 
			
		||||
	public static final String BGT_LARGE = "3";    //大类型固定为3
 | 
			
		||||
	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";      //请假
 | 
			
		||||
 | 
			
		||||
@ -102,4 +102,13 @@ public interface ISysDictTypeService extends IServicePlus<SysDictType> {
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    public String checkDictTypeUnique(SysDictType dictType);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 根据字典类型+字典数据 = 指定字典
 | 
			
		||||
	 *
 | 
			
		||||
	 * @param dictType 字典类型
 | 
			
		||||
	 * @return 字典数据集合信息
 | 
			
		||||
	 */
 | 
			
		||||
	public SysDictData selectDictDataByTypeAndData(String dictType,String dictData);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import javax.annotation.PostConstruct;
 | 
			
		||||
import javax.annotation.Resource;
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.Collections;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@ -235,4 +236,25 @@ public class SysDictTypeServiceImpl extends ServicePlusImpl<SysDictTypeMapper, S
 | 
			
		||||
		}
 | 
			
		||||
		return UserConstants.UNIQUE;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public SysDictData selectDictDataByTypeAndData(String dictType, String dictData) {
 | 
			
		||||
		List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
 | 
			
		||||
		if (CollUtil.isNotEmpty(dictDatas)) {
 | 
			
		||||
			for (SysDictData data : dictDatas) {
 | 
			
		||||
				if (data.getDictValue().equals(dictData)){
 | 
			
		||||
					return data;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		dictDatas = dictDataMapper.selectDictDataByType(dictType);
 | 
			
		||||
		if (CollUtil.isNotEmpty(dictDatas)) {
 | 
			
		||||
			for (SysDictData data : dictDatas) {
 | 
			
		||||
				if (data.getDictValue().equals(dictData)){
 | 
			
		||||
					return data;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,18 @@
 | 
			
		||||
package com.ruoyi.wgz.bo.req;
 | 
			
		||||
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.NoArgsConstructor;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.io.Serializable;
 | 
			
		||||
 | 
			
		||||
@Data
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel("修改已读未读状态请求对象")
 | 
			
		||||
public class WgzAppReadUnreadReq implements Serializable {
 | 
			
		||||
	@ApiModelProperty("消息主键自增ID")
 | 
			
		||||
	private Long messageId;
 | 
			
		||||
}
 | 
			
		||||
@ -24,7 +24,7 @@ public class WgzAppPersonalBasicInformationRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("姓名")
 | 
			
		||||
	private String username;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("性别")
 | 
			
		||||
	@ApiModelProperty("性别字典sys_user_sex")
 | 
			
		||||
	private String gender;
 | 
			
		||||
 | 
			
		||||
	@ApiModelProperty("民族")
 | 
			
		||||
 | 
			
		||||
@ -13,6 +13,6 @@ import java.io.Serializable;
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@ApiModel("考勤打卡·APP用户今日打卡状态")
 | 
			
		||||
public class WgzAppUserClockingConditionRes implements Serializable {
 | 
			
		||||
	@ApiModelProperty("务工者今日打卡状态:0上班 1下班 2请假")
 | 
			
		||||
	@ApiModelProperty("务工者今日打卡状态:0上班 1下班 2请假 3已完成")
 | 
			
		||||
	private Integer clockingCondition;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -84,7 +84,7 @@ public class WgzPayCalculation implements Serializable {
 | 
			
		||||
    /** 出勤天数 */
 | 
			
		||||
    @Excel(name = "出勤天数")
 | 
			
		||||
    @ApiModelProperty("出勤天数")
 | 
			
		||||
    private Long num;
 | 
			
		||||
    private Integer num;
 | 
			
		||||
 | 
			
		||||
    /** 务工状态 */
 | 
			
		||||
    @Excel(name = "务工状态")
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,8 @@
 | 
			
		||||
package com.ruoyi.wgz.service;
 | 
			
		||||
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppConfirmRegistrationReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppGetMessageListReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppReadUnreadReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppGetMessageListRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppMessageTypeStatisticsRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppRegistrationInformationRes;
 | 
			
		||||
@ -84,4 +86,9 @@ public interface IWgzMessageService extends IServicePlus<WgzMessage> {
 | 
			
		||||
	 * 根据消息招工申请信息的主键ID去获取招工信息
 | 
			
		||||
	 */
 | 
			
		||||
	WgzAppRegistrationInformationRes userRegistrationInformation(Long messageId);
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 修改已读未读状态
 | 
			
		||||
	 */
 | 
			
		||||
	Boolean userReadUnread(@Validated WgzAppReadUnreadReq req);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -188,7 +188,7 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
			setPnchOsition(req.getPnchOsition());
 | 
			
		||||
		LocalDateTime now = LocalDateTime.now(); //当前完整年月日时分秒
 | 
			
		||||
		LocalTime localTime = now.toLocalTime(); //获取时分秒
 | 
			
		||||
		if (Objects.isNull(we)) { //表示当天第一次打卡---上班
 | 
			
		||||
		if (Objects.isNull(we)) { //表示当天第一次打卡---上班  否则  表示当天不是第一次打卡---下班
 | 
			
		||||
			wgzAttendance.setClockInTime(now);
 | 
			
		||||
			LocalTime beginWorkTime = appById.getBeginWorkTime(); //上班
 | 
			
		||||
			if (!localTime.isBefore(beginWorkTime)) {
 | 
			
		||||
@ -196,7 +196,12 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
				wgzAttendance.setLateTime(now);
 | 
			
		||||
				wgzAttendance.setExceptionType("1,");
 | 
			
		||||
			}
 | 
			
		||||
		}else{ //表示当天不是第一次打卡---下班
 | 
			
		||||
		}else{
 | 
			
		||||
			//7、获取上次打卡时间与这次打卡时间的间隔是否超过3分钟
 | 
			
		||||
			boolean flag = isMinutesDifferenceGreaterThanThree(we.getClockInTime(), now);
 | 
			
		||||
			if (!flag){
 | 
			
		||||
				throw new RuntimeException("打卡时间间隔不能少于3分钟");
 | 
			
		||||
			}
 | 
			
		||||
			wgzAttendance.setClockOutTime(now);
 | 
			
		||||
			LocalTime endWorkTime = appById.getEndWorkTime(); //下班
 | 
			
		||||
			if (!localTime.isAfter(endWorkTime)) {
 | 
			
		||||
@ -208,6 +213,21 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
		return baseMapper.insert(wgzAttendance) > 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/**
 | 
			
		||||
	 * 判断两个 LocalDateTime 之间的差值分钟数是否超过 3
 | 
			
		||||
	 * @param startTime 开始时间
 | 
			
		||||
	 * @param endTime 结束时间
 | 
			
		||||
	 * @return 如果差值分钟数超过 3 返回 true,否则返回 false
 | 
			
		||||
	 */
 | 
			
		||||
	public static boolean isMinutesDifferenceGreaterThanThree(LocalDateTime startTime, LocalDateTime endTime) {
 | 
			
		||||
		// 计算两个时间之间的持续时间
 | 
			
		||||
		Duration duration = Duration.between(startTime, endTime);
 | 
			
		||||
		// 获取持续时间的分钟数
 | 
			
		||||
		long minutes = duration.toMinutes();
 | 
			
		||||
		// 判断分钟数是否超过 3
 | 
			
		||||
		return Math.abs(minutes) > 3;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public WgzAppUserClockingConditionRes userClockingCondition() {
 | 
			
		||||
		WgzAppUserClockingConditionRes res = new WgzAppUserClockingConditionRes();
 | 
			
		||||
@ -217,10 +237,14 @@ public class WgzAttendanceServiceImpl extends ServicePlusImpl<WgzAttendanceMappe
 | 
			
		||||
		String formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
 | 
			
		||||
		WgzAttendance wgzAttendance = publicFindByUserIdWait(appUserId, by.getId(), formattedDate);
 | 
			
		||||
		//2、获取今日用户打卡状态
 | 
			
		||||
		if (Objects.isNull(wgzAttendance)) {
 | 
			
		||||
		if (wgzAttendance == null) {
 | 
			
		||||
			res.setClockingCondition(0); //上班
 | 
			
		||||
		}else{
 | 
			
		||||
			res.setClockingCondition(1); //下班
 | 
			
		||||
			//上下班都打卡了就是已完成
 | 
			
		||||
			if (wgzAttendance.getClockInTime()!=null && wgzAttendance.getClockOutTime()!=null){
 | 
			
		||||
				res.setClockingCondition(3); //已完成
 | 
			
		||||
			}
 | 
			
		||||
			if (wgzAttendance.getLeaveMarkId()!= null && wgzAttendance.getLeaveMarkId()!= 0) {
 | 
			
		||||
				res.setClockingCondition(2); //请假
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@ -13,8 +13,10 @@ import com.ruoyi.common.core.page.PagePlus;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
import com.ruoyi.common.utils.SecurityUtils;
 | 
			
		||||
import com.ruoyi.system.service.ISysDictTypeService;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppConfirmRegistrationReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppGetMessageListReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppLeaveHistoryListPageReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppReadUnreadReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppGetMessageListRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppMessageTypeStatisticsRes;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzAppRegistrationInformationRes;
 | 
			
		||||
@ -170,4 +172,10 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
 | 
			
		||||
//		byRecruitIdData.setAnnex(null);
 | 
			
		||||
		return byRecruitIdData;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
	public Boolean userReadUnread(WgzAppReadUnreadReq req) {
 | 
			
		||||
		WgzMessage wgzMessage = new WgzMessage().setId(req.getMessageId()).setReadStatus("1");
 | 
			
		||||
		return baseMapper.updateById(wgzMessage) > 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -5,14 +5,18 @@ import cn.hutool.core.util.StrUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
 | 
			
		||||
import com.ruoyi.bgt.domain.BgtMessage;
 | 
			
		||||
import com.ruoyi.bgt.domain.BgtProjectRecruit;
 | 
			
		||||
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
 | 
			
		||||
import com.ruoyi.bgt.domain.dto.BgtPayCalculationDetailBaseVO;
 | 
			
		||||
import com.ruoyi.bgt.domain.dto.BgtPayCalculationDetailListVO;
 | 
			
		||||
import com.ruoyi.bgt.domain.dto.BgtPayCalculationListDTO;
 | 
			
		||||
import com.ruoyi.bgt.domain.dto.BgtPayCalculationUpdateDTO;
 | 
			
		||||
import com.ruoyi.bgt.service.IBgtMessageService;
 | 
			
		||||
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
 | 
			
		||||
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
 | 
			
		||||
import com.ruoyi.common.constants.WgzAndBgtMessageConstant;
 | 
			
		||||
import com.ruoyi.common.core.domain.entity.SysUser;
 | 
			
		||||
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 | 
			
		||||
import com.ruoyi.common.core.page.TableDataInfo;
 | 
			
		||||
@ -24,14 +28,9 @@ 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.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.IWgzAttendanceService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzPayCalculationFilesService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzPayCalculationService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzUserService;
 | 
			
		||||
import com.ruoyi.wgz.service.*;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
@ -40,9 +39,12 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 工资结算Service业务层处理
 | 
			
		||||
 *
 | 
			
		||||
@ -70,6 +72,12 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IWgzAttendanceService attendanceService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IWgzMessageService iWgzMessageService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IBgtMessageService iBgtMessageService;
 | 
			
		||||
 | 
			
		||||
	@Override
 | 
			
		||||
    public WgzPayCalculation queryById(Long id){
 | 
			
		||||
        return getById(id);
 | 
			
		||||
@ -153,17 +161,54 @@ public class WgzPayCalculationServiceImpl extends ServicePlusImpl<WgzPayCalculat
 | 
			
		||||
	public Boolean userApplyForPayrollSettlementAdd(WgzApplyForPayrollSettlementAddReq req) {
 | 
			
		||||
		//1、获取当前人
 | 
			
		||||
		SysUser user = SecurityUtils.getLoginUser().getUser();
 | 
			
		||||
		BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId());
 | 
			
		||||
		BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId());
 | 
			
		||||
		BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(user.getUserId());
 | 
			
		||||
		BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getId());
 | 
			
		||||
		//2、组装数据
 | 
			
		||||
		WgzPayCalculation wgzPayCalculation = new WgzPayCalculation();
 | 
			
		||||
		BeanUtils.copyProperties(req,wgzPayCalculation);
 | 
			
		||||
		wgzPayCalculation.
 | 
			
		||||
			setUserId(user.getUserId()).
 | 
			
		||||
			setUserName(user.getUserName()).
 | 
			
		||||
			setAuditorUserId(appById.getUserId());
 | 
			
		||||
			setAuditorUserId(recruit.getUserId());
 | 
			
		||||
		//3、获取附件信息并插入
 | 
			
		||||
		iWgzPayCalculationFilesService.saveBatch(req.getPayCalculation());
 | 
			
		||||
		//4、插入工资结算信息
 | 
			
		||||
		boolean save = save(wgzPayCalculation);
 | 
			
		||||
		if (save) {
 | 
			
		||||
			WgzUser byId = wgzUserService.findByUserId(user.getUserId());
 | 
			
		||||
			Map<String, String> mp = new HashMap<>();
 | 
			
		||||
			mp.put("projectName", recruit.getRecruitName());
 | 
			
		||||
			mp.put("userName", byId.getUsername());
 | 
			
		||||
			mp.put("num", String.valueOf(wgzPayCalculation.getNum()));
 | 
			
		||||
			mp.put("money", String.valueOf(new BigDecimal(wgzPayCalculation.getNum()).multiply(wgzPayCalculation.getRecruitAmount())));
 | 
			
		||||
			WgzMessage wgzMessage = new WgzMessage().
 | 
			
		||||
				setSenderType(USERTYPE_SYSTEM).
 | 
			
		||||
				setRecipientType(USERTYPE_WGZ).
 | 
			
		||||
				setRecipientId(user.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"111")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"112")).
 | 
			
		||||
				setTableId(wgzPayCalculation.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(LARGE_SALARY);
 | 
			
		||||
			if (!iWgzMessageService.sendAMessage(wgzMessage)){
 | 
			
		||||
				throw new RuntimeException("系统工资结算消息发送失败!");
 | 
			
		||||
			}
 | 
			
		||||
			BgtMessage bgtMessage = new BgtMessage().
 | 
			
		||||
				setSenderType(USERTYPE_WGZ).
 | 
			
		||||
				setSenderId(user.getUserId()).
 | 
			
		||||
				setRecipientType(USERTYPE_BGT).
 | 
			
		||||
				setRecipientId(recruit.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"209")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"210")).
 | 
			
		||||
				setTableId(wgzPayCalculation.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(WgzPayCalculation.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(BGT_LARGE).
 | 
			
		||||
				setMessageSmallType(BGT_TYPE_PAY);
 | 
			
		||||
			if (!iBgtMessageService.sendAMessage(bgtMessage)){
 | 
			
		||||
				throw new RuntimeException("发送补卡消息失败!");
 | 
			
		||||
			}
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		return save(wgzPayCalculation);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,12 +5,16 @@ import cn.hutool.core.util.StrUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
 | 
			
		||||
import com.ruoyi.bgt.domain.BgtMessage;
 | 
			
		||||
import com.ruoyi.bgt.domain.BgtProjectRecruit;
 | 
			
		||||
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
 | 
			
		||||
import com.ruoyi.bgt.domain.dto.BgtReissueacardListDTO;
 | 
			
		||||
import com.ruoyi.bgt.domain.dto.BgtReissueacardUpdateDTO;
 | 
			
		||||
import com.ruoyi.bgt.service.IBgtMessageService;
 | 
			
		||||
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
 | 
			
		||||
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.utils.PageUtils;
 | 
			
		||||
@ -20,19 +24,23 @@ import com.ruoyi.wgz.bo.req.WgzAppCardReplacementApplicationReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.req.WgzAppReplacementCardRecordReq;
 | 
			
		||||
import com.ruoyi.wgz.bo.res.WgzReplacementCardRecordRes;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzAttendance;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzMessage;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzReissueacard;
 | 
			
		||||
import com.ruoyi.wgz.domain.WgzUser;
 | 
			
		||||
import com.ruoyi.wgz.mapper.WgzReissueacardMapper;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzAttendanceService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzMessageService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzReissueacardService;
 | 
			
		||||
import com.ruoyi.wgz.service.IWgzUserService;
 | 
			
		||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.math.BigDecimal;
 | 
			
		||||
import java.time.format.DateTimeFormatter;
 | 
			
		||||
import java.util.Collection;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
import java.util.Objects;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 补卡申请Service业务层处理
 | 
			
		||||
@ -52,6 +60,15 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IWgzAttendanceService iWgzAttendanceService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IWgzMessageService iWgzMessageService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IBgtMessageService iBgtMessageService;
 | 
			
		||||
 | 
			
		||||
	@Autowired
 | 
			
		||||
	private IWgzUserService wgzUserService;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public WgzReissueacard queryById(Long id){
 | 
			
		||||
        return getById(id);
 | 
			
		||||
@ -132,10 +149,8 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
 | 
			
		||||
	public Boolean userCardReplacementApplication(WgzAppCardReplacementApplicationReq req) {
 | 
			
		||||
		//1、获取当前用户信息
 | 
			
		||||
		Long appUserId = SecurityUtils.getAppUserId();
 | 
			
		||||
		//2、获取当前用户所在的工地id
 | 
			
		||||
		BgtProjectRecruitApply by = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
 | 
			
		||||
		//3、根据招工id获取到具体招工信息
 | 
			
		||||
		BgtProjectRecruit appById = iBgtProjectRecruitService.getAppById(by.getId());
 | 
			
		||||
		BgtProjectRecruitApply recruitApply = iBgtProjectRecruitApplyService.selectByUserIdProjectRecruitApplyId(appUserId);
 | 
			
		||||
		BgtProjectRecruit recruit = iBgtProjectRecruitService.getAppById(recruitApply.getId());
 | 
			
		||||
		//4、获取到原打卡的信息
 | 
			
		||||
		WgzAttendance attendanceInfo = iWgzAttendanceService.findById(req.getAttendanceId());
 | 
			
		||||
		if (Objects.isNull(attendanceInfo)) {
 | 
			
		||||
@ -149,16 +164,53 @@ public class WgzReissueacardServiceImpl extends ServicePlusImpl<WgzReissueacardM
 | 
			
		||||
		}
 | 
			
		||||
		//5、组装补卡申请数据
 | 
			
		||||
		WgzReissueacard wgzReissueacard = new WgzReissueacard().
 | 
			
		||||
			setRecruitId(by.getRecruitId()).
 | 
			
		||||
			setRecruitId(recruitApply.getRecruitId()).
 | 
			
		||||
			setUserId(appUserId).
 | 
			
		||||
			setAttendanceId(req.getAttendanceId()).
 | 
			
		||||
			setType(req.getType()).
 | 
			
		||||
			setRecruitName(appById.getRecruitName()).
 | 
			
		||||
			setRecruitName(recruit.getRecruitName()).
 | 
			
		||||
			setRawTime(rawTime).
 | 
			
		||||
			setNowTime(req.getNowTime()).
 | 
			
		||||
			setReason(req.getReason()).
 | 
			
		||||
			setAttendanceId(appById.getUserId());
 | 
			
		||||
		return baseMapper.insert(wgzReissueacard) > 0;
 | 
			
		||||
			setAttendanceId(recruit.getUserId());
 | 
			
		||||
		int insert = baseMapper.insert(wgzReissueacard);
 | 
			
		||||
		//6、发送消息
 | 
			
		||||
		WgzUser byId = wgzUserService.findByUserId(appUserId);
 | 
			
		||||
		Map<String, String> mp = new HashMap<>();
 | 
			
		||||
		mp.put("projectName", recruit.getRecruitName());
 | 
			
		||||
		mp.put("userName", byId.getUsername());
 | 
			
		||||
		mp.put("data",String.valueOf(req.getNowTime()));
 | 
			
		||||
		if (insert > 0) {
 | 
			
		||||
			WgzMessage wgzMessage = new WgzMessage().
 | 
			
		||||
				setSenderType(USERTYPE_SYSTEM).
 | 
			
		||||
				setRecipientType(USERTYPE_WGZ).
 | 
			
		||||
				setRecipientId(appUserId).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"109")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"110")).
 | 
			
		||||
				setTableId(wgzReissueacard.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(WgzReissueacard.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(LARGE_OTHER).
 | 
			
		||||
				setMessageSmallType(SMALL_CARD);
 | 
			
		||||
			if (!iWgzMessageService.sendAMessage(wgzMessage)){
 | 
			
		||||
				throw new RuntimeException("系统补卡消息发送失败!");
 | 
			
		||||
			}
 | 
			
		||||
			BgtMessage bgtMessage = new BgtMessage().
 | 
			
		||||
				setSenderType(USERTYPE_WGZ).
 | 
			
		||||
				setSenderId(appUserId).
 | 
			
		||||
				setRecipientType(USERTYPE_BGT).
 | 
			
		||||
				setRecipientId(recruit.getUserId()).
 | 
			
		||||
				setHeadline(WgzAndBgtMessageConstant.wgzMessage(mp,"207")).
 | 
			
		||||
				setSubheading(WgzAndBgtMessageConstant.wgzMessage(mp,"208")).
 | 
			
		||||
				setTableId(wgzReissueacard.getId()).
 | 
			
		||||
				setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName()).
 | 
			
		||||
				setMessageLargeType(BGT_LARGE).
 | 
			
		||||
				setMessageSmallType(BGT_TYPE_MAKE_UP);
 | 
			
		||||
			if (!iBgtMessageService.sendAMessage(bgtMessage)){
 | 
			
		||||
				throw new RuntimeException("发送补卡消息失败!");
 | 
			
		||||
			}
 | 
			
		||||
			return true;
 | 
			
		||||
		}
 | 
			
		||||
		return false;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user