通知特殊作业和危大
This commit is contained in:
parent
c749c65561
commit
e3cdbc7c10
@ -90,7 +90,8 @@ public interface INoticeService extends IService<Notice> {
|
||||
|
||||
/**
|
||||
* 给某个项目级别(5和10)发通知
|
||||
* @param projectSn
|
||||
*
|
||||
* @param projectSn
|
||||
* @param title
|
||||
* @param msg
|
||||
* @param type
|
||||
@ -98,6 +99,17 @@ public interface INoticeService extends IService<Notice> {
|
||||
*/
|
||||
void addProjectLevelNoticeAndApp(String projectSn, String title, String msg, String type, Object jsonPayload);
|
||||
|
||||
/**
|
||||
* 给某个项目级别(5和10)发通知
|
||||
*
|
||||
* @param projectSn
|
||||
* @param title
|
||||
* @param msg
|
||||
* @param type
|
||||
* @param jsonPayload
|
||||
*/
|
||||
void addProjectLevelNotice(String projectSn, String title, String msg, String type, Object jsonPayload);
|
||||
|
||||
/**
|
||||
* 更新消息通知信息
|
||||
*
|
||||
|
||||
@ -214,6 +214,7 @@ public interface ISystemUserService extends IService<SystemUser> {
|
||||
|
||||
/**
|
||||
* 用户id登录
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@ -343,7 +344,16 @@ public interface ISystemUserService extends IService<SystemUser> {
|
||||
|
||||
/**
|
||||
* 根据用户id获取【用户名称】
|
||||
* @param userId
|
||||
*
|
||||
* @param changeId
|
||||
* @return
|
||||
*/
|
||||
String getFrameUserName(Long changeId);
|
||||
|
||||
/**
|
||||
* 根据用户ids获取【用户名称s】
|
||||
*
|
||||
* @param userIds
|
||||
* @return
|
||||
*/
|
||||
String getFrameUserNames(String userIds);
|
||||
|
||||
@ -149,6 +149,16 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addProjectLevelNotice(String projectSn, String title, String msg, String type, Object jsonPayload) {
|
||||
final SerializeConfig config = new SerializeConfig();
|
||||
config.put(Long.class, ToStringSerializer.instance);
|
||||
List<SystemUser> systemUsers = systemUserService.getSystemUsersBySn(new MapBuilder<String, Object>().put(Cts.SN, projectSn).put(Cts.QUERY_TYPE, Cts.PROJECT_LEVEL).build());
|
||||
for (SystemUser systemUser : systemUsers) {
|
||||
this.addUserNotice(systemUser.getUserId(), title, msg, type, jsonPayload != null ? JSONObject.toJSONString(jsonPayload, config) : null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void edit(Notice notice) {
|
||||
Notice old = noticeMapper.selectOne(new LambdaQueryWrapper<Notice>()
|
||||
|
||||
@ -916,9 +916,24 @@ public class SystemUserServiceImpl extends ServiceImpl<SystemUserMapper, SystemU
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrameUserName(Long userId) {
|
||||
SystemUser systemUser = systemUserMapper.selectById(userId);
|
||||
return "【" + (systemUser != null ? systemUser.getRealName() : "用户名") + "】";
|
||||
public String getFrameUserName(Long changeId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFrameUserNames(String userIds) {
|
||||
if (StrUtil.isNotBlank(userIds)) {
|
||||
List<SystemUser> systemUsers = systemUserMapper.selectList(new LambdaQueryWrapper<SystemUser>().in(SystemUser::getUserId, StrUtil.split(userIds, ",")));
|
||||
return "【" + (CollUtil.isNotEmpty(systemUsers) ? StrUtil.join(",", systemUsers.stream().map(SystemUser::getRealName).collect(Collectors.toList())) : "用户") + "】";
|
||||
} else {
|
||||
return "【用户】";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserNamesByUserIds(List<String> userIds) {
|
||||
List<SystemUser> systemUsers = systemUserMapper.selectList(new LambdaQueryWrapper<SystemUser>().in(SystemUser::getUserId, userIds));
|
||||
return StrUtil.join(",", systemUsers.stream().map(SystemUser::getRealName).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -3,6 +3,9 @@ package com.zhgd.xmgl.task;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.xmgl.constant.Cts;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
|
||||
import com.zhgd.xmgl.modules.dangerous.entity.DangerousEngineeringRecord;
|
||||
import com.zhgd.xmgl.modules.dangerous.service.impl.DangerousEngineeringRecordServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -25,6 +28,12 @@ public class DangerousEngineeringRecordTask {
|
||||
@Lazy
|
||||
@Autowired
|
||||
DangerousEngineeringRecordServiceImpl dangerousEngineeringRecordService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
SystemUserServiceImpl systemUserService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private INoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 计划开始时间和结束时间内,定时每天早上6点时,发送一条通知
|
||||
@ -36,6 +45,7 @@ public class DangerousEngineeringRecordTask {
|
||||
List<DangerousEngineeringRecord> list = dangerousEngineeringRecordService.list(new LambdaQueryWrapper<DangerousEngineeringRecord>()
|
||||
.ge(DangerousEngineeringRecord::getPlanEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(DangerousEngineeringRecord::getPlanStartTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(DangerousEngineeringRecord::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (DangerousEngineeringRecord dangerousEngineeringRecord : list) {
|
||||
dangerousEngineeringRecordService.noticeBigScreen(dangerousEngineeringRecord.getProjectSn(), dangerousEngineeringRecord.getPlanStartTime() + " - " + dangerousEngineeringRecord.getPlanEndTime(), Objects.equals(dangerousEngineeringRecord.getDangerType(), 2),
|
||||
@ -43,4 +53,40 @@ public class DangerousEngineeringRecordTask {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 危大工程、特殊作业的实施计划时间内发送消息去提醒责任人每日上传旁站记录。 消息模版【在施危大工程上传旁站记录提醒】 内容:您所负责的焙烧基坑工程【危大工程名称】,计划实施时间为2024年7月12日至2024年7月15日【计划实施时间】已开工,在施危大工程需每日上传旁站记录,请注意及时上传!
|
||||
* 危大工程、特殊作业的实施计划时间内发送消息去提醒责任人每日上传排查记录。 消息模版【在施危大工程上传排查记录提醒】 内容:您所负责的焙烧基坑工程【危大工程名称】,计划实施时间为2024年7月12日至2024年7月15日【计划实施时间】已开工,在施危大工程需每日上传排查记录,请注意及时上传!
|
||||
*/
|
||||
@Scheduled(cron = "0 1 0 * * ?")
|
||||
@SchedulerLock(name = "remindPersonUploadRecordsDaily", lockAtMostFor = 1000 * 60 * 2, lockAtLeastFor = 1000 * 60 * 1)
|
||||
@RequestMapping("remindPersonUploadRecordsDaily")
|
||||
public void remindPersonUploadRecordsDaily() {
|
||||
List<DangerousEngineeringRecord> list = dangerousEngineeringRecordService.list(new LambdaQueryWrapper<DangerousEngineeringRecord>()
|
||||
.ge(DangerousEngineeringRecord::getPlanEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(DangerousEngineeringRecord::getPlanStartTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(DangerousEngineeringRecord::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (DangerousEngineeringRecord record : list) {
|
||||
String personLiable = record.getPersonLiable();
|
||||
if (StrUtil.isBlank(personLiable)) {
|
||||
continue;
|
||||
}
|
||||
List<String> personIds = StrUtil.split(personLiable, Cts.COMMA);
|
||||
String title1 = "在施危大工程上传旁站记录提醒";
|
||||
String title2 = "在施危大工程上传排查记录提醒";
|
||||
String msg1 = StrUtil.format("您所负责的{},计划实施时间为{}至{}已开工,在施危大工程需每日上传旁站记录,请注意及时上传!", record.getEngineeringName(), record.getPlanStartTime(), record.getPlanEndTime());
|
||||
String msg2 = StrUtil.format("您所负责的{},计划实施时间为{}至{}已开工,在施危大工程需每日上传排查记录,请注意及时上传!", record.getEngineeringName(), record.getPlanStartTime(), record.getPlanEndTime());
|
||||
for (String personId : personIds) {
|
||||
noticeService.addUserNotice(Long.valueOf(personId), title1,
|
||||
msg1, "2");
|
||||
noticeService.addUserNotice(Long.valueOf(personId), title2,
|
||||
msg2, "2");
|
||||
|
||||
}
|
||||
noticeService.addProjectLevelNotice(record.getProjectSn(), title1, systemUserService.getFrameUserNames(personLiable) + msg1, "2", null);
|
||||
noticeService.addProjectLevelNotice(record.getProjectSn(), title2, systemUserService.getFrameUserNames(personLiable) + msg2, "2", null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
168
src/main/java/com/zhgd/xmgl/task/SpecialTask.java
Normal file
168
src/main/java/com/zhgd/xmgl/task/SpecialTask.java
Normal file
@ -0,0 +1,168 @@
|
||||
package com.zhgd.xmgl.task;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
|
||||
import com.zhgd.xmgl.modules.dangerous.service.impl.DangerousEngineeringRecordServiceImpl;
|
||||
import com.zhgd.xmgl.modules.xz.special.entity.*;
|
||||
import com.zhgd.xmgl.modules.xz.special.service.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/task")
|
||||
public class SpecialTask {
|
||||
|
||||
@Lazy
|
||||
@Autowired
|
||||
DangerousEngineeringRecordServiceImpl dangerousEngineeringRecordService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
SystemUserServiceImpl systemUserService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzBlindPlatePlugSafeService xzBlindPlatePlugSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzGroundSafetService iXzGroundSafetService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzHighJobSafeService iXzHighJobSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzHoistSafetyWorkService iXzHoistSafetyWorkService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzLimitSpaceSafeService iXzLimitSpaceSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzOpenCircuitSafeService iXzOpenCircuitSafeService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzSpecialOperationFireSafetyService iXzSpecialOperationFireSafetyService;
|
||||
@Lazy
|
||||
@Resource
|
||||
IXzTemporaryElectricitySafeService xzTemporaryElectricitySafeService;
|
||||
@Lazy
|
||||
@Autowired
|
||||
private INoticeService noticeService;
|
||||
|
||||
/**
|
||||
* "++"、特殊作业的实施计划时间内发送消息去提醒责任人每日上传旁站记录。 消息模版【在施危大工程上传旁站记录提醒】 内容:您所负责的焙烧基坑工程【危大工程名称】,计划实施时间为2024年7月12日至2024年7月15日【计划实施时间】已开工,在施危大工程需每日上传旁站记录,请注意及时上传!
|
||||
* 危大工程、特殊作业的实施计划时间内发送消息去提醒责任人每日上传排查记录。 消息模版【在施危大工程上传排查记录提醒】 内容:您所负责的焙烧基坑工程【危大工程名称】,计划实施时间为2024年7月12日至2024年7月15日【计划实施时间】已开工,在施危大工程需每日上传排查记录,请注意及时上传!
|
||||
*/
|
||||
@Scheduled(cron = "0 1 0 * * ?")
|
||||
@SchedulerLock(name = "remindPersonUploadRecordsDailyForSpecial", lockAtMostFor = 1000 * 60 * 2, lockAtLeastFor = 1000 * 60 * 1)
|
||||
@RequestMapping("remindPersonUploadRecordsDailyForSpecial")
|
||||
public void remindPersonUploadRecordsDailyForSpecial() {
|
||||
List<XzBlindPlatePlugSafe> list1 = xzBlindPlatePlugSafeService.list(new LambdaQueryWrapper<XzBlindPlatePlugSafe>()
|
||||
.ge(XzBlindPlatePlugSafe::getWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzBlindPlatePlugSafe::getWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzBlindPlatePlugSafe::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzBlindPlatePlugSafe record : list1) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "盲板抽堵作业", record.getWorkTicketCode(), record.getWorkExecutionBeginTime(), record.getWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
List<XzGroundSafet> list2 = iXzGroundSafetService.list(new LambdaQueryWrapper<XzGroundSafet>()
|
||||
.ge(XzGroundSafet::getWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzGroundSafet::getWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzGroundSafet::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzGroundSafet record : list2) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "动土作业", record.getWorkTicketCode(), record.getWorkExecutionBeginTime(), record.getWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
List<XzHighJobSafe> list3 = iXzHighJobSafeService.list(new LambdaQueryWrapper<XzHighJobSafe>()
|
||||
.ge(XzHighJobSafe::getWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzHighJobSafe::getWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzHighJobSafe::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzHighJobSafe record : list3) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "高处作业", record.getWorkTicketCode(), record.getWorkExecutionBeginTime(), record.getWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
List<XzHoistSafetyWork> list4 = iXzHoistSafetyWorkService.list(new LambdaQueryWrapper<XzHoistSafetyWork>()
|
||||
.ge(XzHoistSafetyWork::getWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzHoistSafetyWork::getWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzHoistSafetyWork::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzHoistSafetyWork record : list4) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "吊装安全作业", record.getWorkTicketCode(), record.getWorkExecutionBeginTime(), record.getWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
List<XzLimitSpaceSafe> list5 = iXzLimitSpaceSafeService.list(new LambdaQueryWrapper<XzLimitSpaceSafe>()
|
||||
.ge(XzLimitSpaceSafe::getWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzLimitSpaceSafe::getWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzLimitSpaceSafe::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzLimitSpaceSafe record : list5) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "受限空间作业", record.getWorkTicketCode(), record.getWorkExecutionBeginTime(), record.getWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
List<XzOpenCircuitSafe> list6 = iXzOpenCircuitSafeService.list(new LambdaQueryWrapper<XzOpenCircuitSafe>()
|
||||
.ge(XzOpenCircuitSafe::getWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzOpenCircuitSafe::getWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzOpenCircuitSafe::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzOpenCircuitSafe record : list6) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "断路作业", record.getWorkTicketCode(), record.getWorkExecutionBeginTime(), record.getWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
List<XzSpecialOperationFireSafety> list7 = iXzSpecialOperationFireSafetyService.list(new LambdaQueryWrapper<XzSpecialOperationFireSafety>()
|
||||
.ge(XzSpecialOperationFireSafety::getHotWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzSpecialOperationFireSafety::getHotWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzSpecialOperationFireSafety::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzSpecialOperationFireSafety record : list7) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "动火作业", record.getWorkTicketCode(), record.getHotWorkExecutionBeginTime(), record.getHotWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
List<XzTemporaryElectricitySafe> list8 = xzTemporaryElectricitySafeService.list(new LambdaQueryWrapper<XzTemporaryElectricitySafe>()
|
||||
.ge(XzTemporaryElectricitySafe::getWorkExecutionEndTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.le(XzTemporaryElectricitySafe::getWorkExecutionBeginTime, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.eq(XzTemporaryElectricitySafe::getFinalAcceptanceStatus, 1)
|
||||
);
|
||||
for (XzTemporaryElectricitySafe record : list8) {
|
||||
sendNotice(record.getAssignmentPersonInCharge(), "临时用电作业", record.getWorkTicketCode(), record.getWorkExecutionBeginTime(), record.getWorkExecutionEndTime(), record.getProjectSn());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送通知
|
||||
*
|
||||
* @param personId
|
||||
* @param specialName
|
||||
* @param workTicketCode
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @param projectSn
|
||||
*/
|
||||
private void sendNotice(Long personId, String specialName, String workTicketCode, Date startTime, Date endTime, String projectSn) {
|
||||
if (personId == null) {
|
||||
return;
|
||||
}
|
||||
String title1 = "在施" + specialName + "上传旁站记录提醒";
|
||||
String title2 = "在施" + specialName + "上传排查记录提醒";
|
||||
String msg1 = StrUtil.format("您所负责的{}{},计划实施时间为{}至{}已开工,在施" + specialName + "需每日上传旁站记录,请注意及时上传!", specialName, workTicketCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime));
|
||||
String msg2 = StrUtil.format("您所负责的{}{},计划实施时间为{}至{}已开工,在施" + specialName + "需每日上传排查记录,请注意及时上传!", specialName, workTicketCode, DateUtil.formatDateTime(startTime), DateUtil.formatDateTime(endTime));
|
||||
noticeService.addUserNotice(personId, title1, msg1, "2");
|
||||
noticeService.addUserNotice(personId, title2, msg2, "2");
|
||||
noticeService.addProjectLevelNotice(projectSn, title1, systemUserService.getFrameUserNames(String.valueOf(personId)) + msg1, "2", null);
|
||||
noticeService.addProjectLevelNotice(projectSn, title2, systemUserService.getFrameUserNames(String.valueOf(personId)) + msg2, "2", null);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user