This commit is contained in:
zt
2025-05-15 11:15:01 +08:00
parent ee9fd26068
commit 9b1fc6fe99
8 changed files with 128 additions and 6 deletions

View File

@ -96,4 +96,9 @@ public interface IBgtMessageService extends IServicePlus<BgtMessage> {
*/
void operation(String senderType,Long senderId,String recipientType,Long recipientId,Long tableId,String tableName);
/**
* 批量已操作
*/
void operationBatch(List<Long> tableId,String tableName,String messageLargeType,String messageSmallType);
}

View File

@ -1,6 +1,7 @@
package com.ruoyi.bgt.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@ -17,7 +18,9 @@ import com.ruoyi.bgt.domain.vo.BgtMessageDetailVO;
import com.ruoyi.bgt.domain.vo.BgtMessageVO;
import com.ruoyi.bgt.mapper.BgtMessageMapper;
import com.ruoyi.bgt.service.IBgtMessageService;
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
import com.ruoyi.bgt.service.IBgtWageApplicationService;
import com.ruoyi.common.constants.BgtMessageConstant;
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
@ -91,6 +94,10 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt
@Lazy
private IBgtWageApplicationService wageApplicationService;
@Autowired
@Lazy
private IBgtProjectRecruitService iBgtProjectRecruitService;
@Override
public BgtMessage queryById(Long id) {
return getById(id);
@ -187,7 +194,7 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt
.eq(BgtMessage::getRecipientId, SecurityUtils.getAppUserId())
.eq(BgtMessage::getIsOperation, OPERATION_NEED));
bgtMessageCountVO.setHandleMessageCount(handle);
redisCache.setCacheObject(REDIS_KEY+SecurityUtils.getAppUserId(), bgtMessageCountVO);
redisCache.setCacheObject(BgtMessageConstant.REDIS_KEY+SecurityUtils.getAppUserId(), bgtMessageCountVO);
return bgtMessageCountVO;
}
@ -285,6 +292,21 @@ public class BgtMessageServiceImpl extends ServicePlusImpl<BgtMessageMapper, Bgt
MessageUtil.operationMessagePush(recipientType, recipientId, 1);
}
@Override
public void operationBatch(List<Long> tableId, String tableName, String messageLargeType, String messageSmallType) {
if(CollectionUtil.isEmpty(tableId)){
return;
}
LambdaUpdateWrapper<BgtMessage> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(BgtMessage::getTableId, tableId);
wrapper.eq(BgtMessage::getTableName, tableName);
wrapper.eq(BgtMessage::getMessageLargeType, messageLargeType);
wrapper.eq(BgtMessage::getMessageSmallType, messageSmallType);
wrapper.eq(BgtMessage::getIsOperation, OPERATION_NEED);
wrapper.set(BgtMessage::getIsOperation, OPERATION_ALREADY);
update(wrapper);
}
@Override
public TableDataInfo<BgtMessageDetailVO> unAuditList(BgtMessageUnAuditDetailDTO dto) {

View File

@ -53,6 +53,9 @@ public class BgtMessageConstant {
//主动结算工资
public static final String BGT_ACTIVE_PAY_HEADLINE = "您【%s】项目的工资已结算";
public static final String BGT_ACTIVE_PAY_SUBHEADING = "您【%s】项目的工资已由包工头【%s】主动结算";
//过期拒绝
public static final String BGT_EXPIRED_REFUSE_HEADLINE = "您因【%s】项目过期而被系统自动拒绝";
public static final String BGT_EXPIRED_REFUSE_SUBHEADING = "您因【%s】项目过期而被系统自动拒绝";
//包工头->务工者 消息类型
public static final String BGT_TYPE_SIGN_UP = "1"; //务工者报名
@ -63,6 +66,7 @@ public class BgtMessageConstant {
public static final String BGT_TYPE_CANSEL = "11"; //取消选择
public static final String BGT_TYPE_REPORT_MAKE_UP = "12";
public static final String BGT_TYPE_ACTIVE_PAY = "14"; //主动结算工资
public static final String BGT_TYPE_EXPIRED_REFUSE= "15"; //过期拒绝
/**
@ -185,6 +189,10 @@ public class BgtMessageConstant {
map.put(HEADLINE, String.format(BGT_ACTIVE_PAY_HEADLINE, projectName));
map.put(SUBHEADING, String.format(BGT_ACTIVE_PAY_SUBHEADING, projectName,auditor));
break;
case "15":
map.put(HEADLINE, String.format(BGT_EXPIRED_REFUSE_HEADLINE, projectName));
map.put(SUBHEADING, String.format(BGT_EXPIRED_REFUSE_SUBHEADING, projectName));
break;
default:
break;
}

View File

@ -10,6 +10,7 @@ import com.ruoyi.bgt.domain.dto.BgtScoreDTO;
import com.ruoyi.bgt.service.IBgtMessageService;
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
import com.ruoyi.common.constants.BgtMessageConstant;
import com.ruoyi.common.constants.WgzAndBgtMessageConstant;
import com.ruoyi.common.enums.RecruitApplyStatus;
import com.ruoyi.common.enums.RecruitStatus;
@ -94,13 +95,25 @@ public class BusinessTask
.lt(BgtProjectRecruit::getRecruitEndTime, LocalDate.now()));
if(CollectionUtil.isNotEmpty(recruitList)){
List<Long> recruitIds = recruitList.stream().map(BgtProjectRecruit::getId).collect(Collectors.toList());
recruitApplyService.lambdaUpdate()
List<BgtProjectRecruitApply> list = recruitApplyService.list(Wrappers.<BgtProjectRecruitApply>lambdaQuery()
.in(BgtProjectRecruitApply::getRecruitId, recruitIds)
.in(BgtProjectRecruitApply::getStatus,status)
.in(BgtProjectRecruitApply::getStatus, status)
);
List<Long> recruitApplyIds = list.stream().map(BgtProjectRecruitApply::getId).collect(Collectors.toList());
recruitApplyService.lambdaUpdate()
.in(BgtProjectRecruitApply::getId, recruitApplyIds)
.set(BgtProjectRecruitApply::getStatus,RecruitApplyStatus.BGT_REFUSE.getCode())
.update();
recruitService.lambdaUpdate().in(BgtProjectRecruit::getId, recruitIds)
.set(BgtProjectRecruit::getStatus,RecruitStatus.OVERDUE.getCode()).update();
//处理消息操作状态
List<Long> bgtMessageHandleIds = list.stream().filter(vo->RecruitApplyStatus.SIGN_UP.getCode().equals(vo.getStatus())).map(BgtProjectRecruitApply::getId).collect(Collectors.toList());
iBgtMessageService.operationBatch(bgtMessageHandleIds,SqlHelper.table(BgtProjectRecruitApply.class).getTableName(), BgtMessageConstant.BGT_LARGE_OTHER, BgtMessageConstant.BGT_SMALL_SIGN_UP );
List<BgtProjectRecruitApply> wgzMessageList = list.stream().filter(vo->RecruitApplyStatus.BGT_PASS.getCode().equals(vo.getStatus())).collect(Collectors.toList());
iWgzMessageService.operationBatchSignUp(wgzMessageList);
//发送消息
iWgzMessageService.operationBatchReject(list);
}
Console.log("招工拒绝任务结束,此次拒绝任务个数:"+recruitList.size());
}

View File

@ -1,5 +1,6 @@
package com.ruoyi.wgz.service;
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
import com.ruoyi.common.core.mybatisplus.core.IServicePlus;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.wgz.bo.WgzMessageQueryBo;
@ -102,4 +103,14 @@ public interface IWgzMessageService extends IServicePlus<WgzMessage> {
* 修改操作状态
*/
Boolean updateOperationStatus(Long id);
/**
* 报名批量修改操作状态
*/
void operationBatchSignUp(List<BgtProjectRecruitApply> list);
/**
* 批量发送报名拒绝消息
*/
void operationBatchReject(List<BgtProjectRecruitApply> list);
}

View File

@ -1,11 +1,14 @@
package com.ruoyi.wgz.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
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.BgtProjectRecruit;
import com.ruoyi.bgt.domain.BgtProjectRecruitApply;
import com.ruoyi.bgt.service.IBgtProjectRecruitApplyService;
import com.ruoyi.bgt.service.IBgtProjectRecruitService;
import com.ruoyi.common.constants.WgzAndBgtMessageConstant;
@ -40,8 +43,9 @@ import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.util.*;
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.USERTYPE_BGT;
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.USERTYPE_WGZ;
import static com.ruoyi.common.constants.BgtMessageConstant.*;
import static com.ruoyi.common.constants.BgtMessageConstant.SUBHEADING;
import static com.ruoyi.common.constants.WgzAndBgtMessageConstant.*;
/**
* 消息Service业务层处理
@ -285,6 +289,55 @@ public class WgzMessageServiceImpl extends ServicePlusImpl<WgzMessageMapper, Wgz
}
@Override
public void operationBatchSignUp(List<BgtProjectRecruitApply> list) {
if(CollectionUtil.isEmpty(list)){
return ;
}
List<WgzMessage> updateList = new ArrayList<>();
for (BgtProjectRecruitApply apply : list) {
List<WgzMessage> wgzMessages = baseMapper.selectList(Wrappers.<WgzMessage>lambdaQuery()
.eq(WgzMessage::getTableId, apply.getId())
.eq(WgzMessage::getMessageLargeType, LARGE_APPLY)
.eq(WgzMessage::getIsOperation, OPERATION_NEED)
.eq(WgzMessage::getRecipientId, apply.getUserId())
.eq(WgzMessage::getRecipientType, USERTYPE_WGZ)
);
updateList.addAll(wgzMessages);
}
if(CollectionUtil.isNotEmpty(updateList)){
for (WgzMessage wgzMessage : updateList) {
wgzMessage.setIsOperation(OPERATION_ALREADY);
}
updateBatchById(updateList);
}
}
@Override
public void operationBatchReject(List<BgtProjectRecruitApply> list) {
//发消息
ArrayList<WgzMessage> wgzMessages = new ArrayList<>();
for(BgtProjectRecruitApply recruitApply : list){
HashMap<String, String> mp = new HashMap<>();
mp.put("projectName", iBgtProjectRecruitService.getById(recruitApply.getRecruitId()).getRecruitName());
Map<String, String> map = bgtMessage(mp, BGT_TYPE_EXPIRED_REFUSE, true);
WgzMessage wgzMessage = new WgzMessage()
.setSenderType(USERTYPE_SYSTEM)
.setSenderId(SYSTEM_ID)
.setRecipientType(USERTYPE_WGZ)
.setRecipientId(recruitApply.getUserId())
.setHeadline(map.get(HEADLINE))
.setSubheading(map.get(SUBHEADING))
.setTableId(recruitApply.getId())
.setTableName(SqlHelper.table(BgtProjectRecruitApply.class).getTableName())
.setMessageLargeType(LARGE_APPLY);
wgzMessages.add(wgzMessage);
}
if(CollectionUtil.isNotEmpty(wgzMessages)){
saveBatch(wgzMessages);
}
}
/**
* 判断招工是否已招满或已过期
* @param recruitId 招工ID

View File

@ -310,6 +310,16 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl<WgzQuestionSaveM
private String generateExamPaper(ExaminationPaper rs) throws IOException {
String fileName = DateUtils.datePath() + File.separator + rs.getUserId() + IdUtil.fastUUID() + ".pdf";
File desc = new File(RuoYiConfig.getUploadPath() + File.separator + fileName);
File parentDir = desc.getParentFile();
if (parentDir != null && !parentDir.exists()) {
// 创建所有父目录
boolean mkdirsSuccess = parentDir.mkdirs();
if (!mkdirsSuccess) {
throw new IOException("无法创建目录: " + parentDir.getAbsolutePath());
}
}
Path path = Paths.get(FileUploadUtils.callGetPathFileName(RuoYiConfig.getUploadPath(), fileName));
// 创建PDF文档
PdfWriter writer = new PdfWriter(desc);

View File

@ -243,7 +243,7 @@
const app = createApp({
data() {
return {
baseUrl: "http://192.168.110.3:9099",
baseUrl: "http://192.168.110.5:9097",
themeOptions: [],
selectedTheme: "",
currentList: [],