通知也给项目级别账号来一份

This commit is contained in:
guoshengxiong 2024-07-29 19:32:03 +08:00
parent 1db3d4ef06
commit caecafc350
16 changed files with 218 additions and 76 deletions

View File

@ -344,11 +344,10 @@ public interface ISystemUserService extends IService<SystemUser> {
/**
* 根据用户id获取用户名称
*
* @param changeId
* @param userId
* @return
*/
String getFrameUserName(Long changeId);
String getFrameUserName(Long userId);
/**
* 根据用户ids获取用户名称s
@ -373,4 +372,5 @@ public interface ISystemUserService extends IService<SystemUser> {
* @param workerName
*/
void updateRealNameFromWorker(Long workerId, String workerName);
}

View File

@ -161,12 +161,12 @@ public class NoticeServiceImpl extends ServiceImpl<NoticeMapper, Notice> impleme
@Override
public void addProjectLevelNoticeAndApp(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) {
// addUserNoticeAndApp(systemUser.getUserId(), title, msg, type, jsonPayload != null ? JSONObject.toJSONString(jsonPayload, config) : null);
// }
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) {
addUserNoticeAndApp(systemUser.getUserId(), title, msg, type, jsonPayload != null ? JSONObject.toJSONString(jsonPayload, config) : null);
}
}
@Override

View File

@ -11,23 +11,23 @@ public enum XzCheckingRouteFrequencyTypeEnum implements BaseEnum {
/**
*
*/
TIME(1, ""),
TIME(1, "1"),
/**
*
*/
DAY(2, ""),
DAY(2, "1次/"),
/**
*
*/
WEEK(3, ""),
WEEK(3, "1次/"),
/**
*
*/
MONTH(4, ""),
MONTH(4, "1次/"),
/**
*
*/
YEAR(5, ""),
YEAR(5, "1次/"),
;
private Integer value;
@ -57,4 +57,13 @@ public enum XzCheckingRouteFrequencyTypeEnum implements BaseEnum {
public void setDesc(String desc) {
this.desc = desc;
}
public static XzCheckingRouteFrequencyTypeEnum getEnumByCode(Integer value) {
for (XzCheckingRouteFrequencyTypeEnum e : XzCheckingRouteFrequencyTypeEnum.values()) {
if (e.value.equals(value)) {
return e;
}
}
return null;
}
}

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.async.AsyncCheckingPoint;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
import com.zhgd.xmgl.modules.checking.entity.CheckingPoint;
import com.zhgd.xmgl.modules.checking.entity.CheckingPointAlarm;
import com.zhgd.xmgl.modules.checking.entity.dto.PointIdCountDTO;
@ -18,6 +20,7 @@ import com.zhgd.xmgl.modules.checking.mapper.CheckingPointAlarmMapper;
import com.zhgd.xmgl.modules.checking.mapper.CheckingPointInfoMapper;
import com.zhgd.xmgl.modules.checking.service.CheckingPointAlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -39,15 +42,17 @@ import java.util.stream.Collectors;
@Service("checkingPointAlarmService")
@Slf4j
public class CheckingPointAlarmServiceImpl extends ServiceImpl<CheckingPointAlarmMapper, CheckingPointAlarm> implements CheckingPointAlarmService {
@Resource
private CheckingPointAlarmMapper checkingPointAlarmMapper;
@Resource
CheckingPointInfoMapper checkingPointInfoMapper;
@Resource
@Lazy
AsyncCheckingPoint asyncCheckingPoint;
@Resource
private CheckingPointAlarmMapper checkingPointAlarmMapper;
@Autowired
private INoticeService noticeService;
@Autowired
private SystemUserServiceImpl systemUserService;
@Override
public IPage<CheckingPointAlarm> selectPageInfo(Page<CheckingPointAlarm> page, CheckingPointAlarmQO checkingPointAlarmQo) {
@ -73,7 +78,6 @@ public class CheckingPointAlarmServiceImpl extends ServiceImpl<CheckingPointAlar
return checkingPointAlarmMapper.selectPage(page, wrapper);
}
/**
* 处理巡检点数据
*
@ -115,9 +119,10 @@ public class CheckingPointAlarmServiceImpl extends ServiceImpl<CheckingPointAlar
alarmList.add(new CheckingPointAlarm(IdUtil.getSnowflake().nextId(), checkingPointId, format, PointAlarmTypeEnum.NUMBER_NO_STANDARDS.getId()));
// 发送通知
if (CharSequenceUtil.isNotBlank(point.getNoticeUserIds())) {
asyncCheckingPoint.sendMqAndAppUserIdColl("巡检点巡检次数未达标", format, "巡检点巡检次数未达标", CharSequenceUtil.split(point.getNoticeUserIds(), ","), "/pages/projectEnd/projectIndex/projectIndex");
String tile = "巡检点巡检次数未达标";
asyncCheckingPoint.sendMqAndAppUserIdColl(tile, format, "巡检点巡检次数未达标", CharSequenceUtil.split(point.getNoticeUserIds(), ","), "/pages/projectEnd/projectIndex/projectIndex");
noticeService.addProjectLevelNotice(point.getProjectSn(), tile, systemUserService.getFrameUserNames(point.getNoticeUserIds()) + format, "19", null);
}
}
});
return alarmList;

View File

@ -14,24 +14,26 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.basicdata.service.impl.SystemUserServiceImpl;
import com.zhgd.xmgl.modules.checking.entity.CheckingPoint;
import com.zhgd.xmgl.modules.checking.entity.CheckingPointAlarm;
import com.zhgd.xmgl.modules.checking.entity.CheckingPointInfo;
import com.zhgd.xmgl.modules.checking.entity.XzCheckingRouteTask;
import com.zhgd.xmgl.modules.checking.entity.dto.CheckingPointInfoPageDto;
import com.zhgd.xmgl.modules.checking.entity.qo.ProjectSnQO;
import com.zhgd.xmgl.modules.checking.enums.PointStatusEnum;
import com.zhgd.xmgl.modules.checking.mapper.CheckingPointInfoMapper;
import com.zhgd.xmgl.modules.checking.mapper.CheckingPointMapper;
import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteTaskMapper;
import com.zhgd.xmgl.modules.checking.service.CheckingPointAlarmService;
import com.zhgd.xmgl.modules.checking.service.CheckingPointInfoService;
import com.zhgd.xmgl.modules.checking.service.CheckingPointService;
import com.zhgd.xmgl.modules.project.service.IProjectService;
import com.zhgd.xmgl.modules.checking.entity.XzCheckingRouteTask;
import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteTaskMapper;
import com.zhgd.xmgl.security.entity.UserInfo;
import com.zhgd.xmgl.security.util.SecurityUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -70,6 +72,9 @@ public class CheckingPointInfoServiceImpl extends ServiceImpl<CheckingPointInfoM
CheckingPointService checkingPointService;
@Autowired
XzCheckingRouteTaskMapper xzCheckingRouteTaskMapper;
@Lazy
@Autowired
private SystemUserServiceImpl systemUserService;
@Override
public IPage<CheckingPointInfo> selectCheckingPointInfoPage(CheckingPointInfoPageDto dto) {
@ -138,13 +143,18 @@ public class CheckingPointInfoServiceImpl extends ServiceImpl<CheckingPointInfoM
//通知
List<String> userIds = StrUtil.split(noticeUserIds, ",");
String title = "巡检点记录新增";
String projectMsg = String.format("新增巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate()), systemUserService.getUserNamesByUserIds(userIds), getStatus(info.getStatus()));
for (String userId : userIds) {
SystemUser systemUser = systemUserMapper.selectById(userId);
String msg = String.format("新增巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate()), systemUser.getRealName(), getStatus(info.getStatus()));
noticeService.addUserNotice(Long.valueOf(userId),
"巡检点记录新增", String.format("新增巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate()), systemUser.getRealName(), getStatus(info.getStatus())),
title, msg,
"19");
}
noticeService.addProjectLevelNotice(checkingPoint.getProjectSn(), title, systemUserService.getFrameUserNames(noticeUserIds) + projectMsg, "19", null);
}
private void checkDuplicateAndPointExist(CheckingPointInfo checkingPointInfo) {
@ -177,13 +187,18 @@ public class CheckingPointInfoServiceImpl extends ServiceImpl<CheckingPointInfoM
CheckingPoint checkingPoint = checkingPointMapper.selectById(cpi.getCheckingPointId());
//通知
List<String> userIds = StrUtil.split(checkingPoint.getInspectUserIds(), ",");
String projectMsg = String.format("编辑巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cpi.getCreateDate()), systemUserService.getUserNamesByUserIds(userIds), getStatus(cpi.getStatus()));
String title = "巡检点记录编辑";
for (String userId : userIds) {
SystemUser systemUser = systemUserMapper.selectById(userId);
String msg = String.format("编辑巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cpi.getCreateDate()), systemUser.getRealName(), getStatus(cpi.getStatus()));
noticeService.addUserNotice(Long.valueOf(userId),
"巡检点记录编辑", String.format("编辑巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cpi.getCreateDate()), systemUser.getRealName(), getStatus(cpi.getStatus())),
title, msg,
"19");
}
noticeService.addProjectLevelNotice(checkingPoint.getProjectSn(), title, systemUserService.getFrameUserNames(checkingPoint.getInspectUserIds()) + projectMsg, "19", null);
}
@Override
@ -195,13 +210,18 @@ public class CheckingPointInfoServiceImpl extends ServiceImpl<CheckingPointInfoM
CheckingPoint checkingPoint = checkingPointMapper.selectById(cpi.getCheckingPointId());
//通知
List<String> userIds = StrUtil.split(checkingPoint.getInspectUserIds(), ",");
String projectMsg = String.format("删除巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cpi.getCreateDate()), systemUserService.getUserNamesByUserIds(userIds), getStatus(cpi.getStatus()));
String title = "巡检点记录删除";
for (String userId : userIds) {
SystemUser systemUser = systemUserMapper.selectById(userId);
String msg = String.format("删除巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cpi.getCreateDate()), systemUser.getRealName(), getStatus(cpi.getStatus()));
noticeService.addUserNotice(Long.valueOf(userId),
"巡检点记录删除", String.format("删除巡检点记录,巡检点名称为%s巡检位置为%s巡检时间为%s巡检人员为%s巡检状态为%s请注意。",
checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cpi.getCreateDate()), systemUser.getRealName(), getStatus(cpi.getStatus())),
title, msg,
"19");
}
noticeService.addProjectLevelNotice(checkingPoint.getProjectSn(), title, systemUserService.getFrameUserNames(checkingPoint.getInspectUserIds()) + projectMsg, "19", null);
}
private String getStatus(Integer status) {

View File

@ -17,6 +17,7 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.execption.OpenPromptException;
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.checking.entity.CheckingPoint;
import com.zhgd.xmgl.modules.checking.entity.CheckingPointInfo;
import com.zhgd.xmgl.modules.checking.entity.XzCheckingRouteTask;
@ -63,6 +64,9 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
@Lazy
@Autowired
IXzCheckingRouteToPointService xzCheckingRouteToPointService;
@Lazy
@Autowired
private SystemUserServiceImpl systemUserService;
@Override
public IPage<CheckingPoint> selectCheckingPointPage(ProjectSnQO projectSnQo) {
@ -122,11 +126,14 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
CheckingPoint cp = checkingPointMapper.selectById(checkingPoint.getId());
//通知
List<String> userIds = getNoticeUserIds(checkingPoint);
String title = "巡检点新增";
String msg = String.format("新增巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cp.getCreateDate()));
for (String userId : userIds) {
noticeService.addUserNotice(Long.valueOf(userId),
"巡检点新增", String.format("新增巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(cp.getCreateDate())),
title, msg,
"19");
}
noticeService.addProjectLevelNotice(checkingPoint.getProjectSn(), title, systemUserService.getFrameUserNames(checkingPoint.getInspectUserIds()) + msg, "19", null);
}
private List<String> getNoticeUserIds(CheckingPoint checkingPoint) {
@ -152,11 +159,14 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
updateById(checkingPoint);
//通知
List<String> userIds = getNoticeUserIds(checkingPoint);
String title = "巡检点修改";
String msg = String.format("修改巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate()));
for (String userId : userIds) {
noticeService.addUserNotice(Long.valueOf(userId),
"巡检点修改", String.format("修改巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate())),
title, msg,
"19");
}
noticeService.addProjectLevelNotice(checkingPoint.getProjectSn(), title, systemUserService.getFrameUserNames(checkingPoint.getInspectUserIds()) + msg, "19", null);
}
@Override
@ -170,11 +180,14 @@ public class CheckingPointServiceImpl extends ServiceImpl<CheckingPointMapper, C
removeById(id);
//通知
List<String> userIds = getNoticeUserIds(checkingPoint);
String title = "巡检点删除";
String msg = String.format("删除巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate()));
for (String userId : userIds) {
noticeService.addUserNotice(Long.valueOf(userId),
"巡检点删除", String.format("删除巡检点,巡检点名称为%s巡检位置为%s巡检创建时间为%s请注意。", checkingPoint.getCheckingPointName(), checkingPoint.getPosition(), DateUtil.formatDateTime(checkingPoint.getCreateDate())),
title, msg,
"19");
}
noticeService.addProjectLevelNotice(checkingPoint.getProjectSn(), title, systemUserService.getFrameUserNames(checkingPoint.getInspectUserIds()) + msg, "19", null);
}
@Override

View File

@ -19,6 +19,15 @@ import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteMapper;
import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteTaskMapper;
import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteToPointMapper;
import com.zhgd.xmgl.modules.checking.service.CheckingPointInfoService;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.basicdata.service.impl.NoticeServiceImpl;
import com.zhgd.xmgl.modules.checking.entity.XzCheckingRoute;
import com.zhgd.xmgl.modules.checking.entity.XzCheckingRouteTask;
import com.zhgd.xmgl.modules.checking.entity.XzCheckingRouteToPoint;
import com.zhgd.xmgl.modules.checking.enums.XzCheckingRouteFrequencyTypeEnum;
import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteMapper;
import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteTaskMapper;
import com.zhgd.xmgl.modules.checking.mapper.XzCheckingRouteToPointMapper;
import com.zhgd.xmgl.modules.checking.service.IXzCheckingRouteService;
import com.zhgd.xmgl.modules.checking.service.IXzCheckingRouteTaskService;
import com.zhgd.xmgl.modules.checking.service.IXzCheckingRouteToPointService;
@ -61,6 +70,12 @@ public class XzCheckingRouteServiceImpl extends ServiceImpl<XzCheckingRouteMappe
private XzCheckingRouteTaskMapper xzCheckingRouteTaskMapper;
@Autowired
private XzCheckingRouteToPointMapper xzCheckingRouteToPointMapper;
@Lazy
@Autowired
private NoticeServiceImpl noticeService;
@Lazy
@Autowired
private ISystemUserService systemUserService;
@Override
public IPage<XzCheckingRoute> queryPageList(HashMap<String, Object> paramMap) {
@ -97,11 +112,22 @@ public class XzCheckingRouteServiceImpl extends ServiceImpl<XzCheckingRouteMappe
}
@Override
public void add(XzCheckingRoute xzCheckingRoute) {
xzCheckingRoute.setId(null);
baseMapper.insert(xzCheckingRoute);
saveRouteToPoint(xzCheckingRoute);
saveTask(xzCheckingRoute);
public void add(XzCheckingRoute route) {
route.setId(null);
baseMapper.insert(route);
saveRouteToPoint(route);
saveTask(route);
//通知
String noticeUserIds = route.getNoticeUserIds();
List<String> userIds = StrUtil.split(noticeUserIds, ",");
String title = "巡检路线新增";
String msg = StrUtil.format("新增巡检路线,路线名称为{},计划检查时间{},检查频次{},请注意。", route.getRouteName(), DateUtil.formatDateTime(route.getStartTime()), XzCheckingRouteFrequencyTypeEnum.getEnumByCode(route.getFrequencyType()).getDesc());
for (String userId : userIds) {
noticeService.addUserNotice(Long.valueOf(userId),
title, msg,
"19");
}
noticeService.addProjectLevelNotice(route.getProjectSn(), title, systemUserService.getFrameUserNames(noticeUserIds) + msg, "19", null);
}
private void saveTask(XzCheckingRoute xzCheckingRoute) {

View File

@ -292,7 +292,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
Long changeId = qualityInspectionRecord.getChangeId();
noticeService.addUserNoticeAndApp(changeId, title, "您有一条质量检查待整改,问题:" + qualityInspectionRecord.getDangerItemContent(), "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(qualityInspectionRecord.getProjectSn(), title, systemUserService.getFrameUserName(changeId) + "有一条质量检查待整改,问题:" + qualityInspectionRecord.getDangerItemContent(), "11", null);
noticeService.addProjectLevelNoticeAndApp(qualityInspectionRecord.getProjectSn(), title, systemUserService.getFrameUserNames(changeId+"") + "有一条质量检查待整改,问题:" + qualityInspectionRecord.getDangerItemContent(), "11", null);
}
sanjiangDataCall.sendAddQualityInspectionRecord(qualityInspectionRecord);
deductScoreIf(qualityInspectionRecord);

View File

@ -128,7 +128,7 @@ public class QualityRectifyRecordServiceImpl extends ServiceImpl<QualityRectifyR
String title = "质量管理整改结果待复查";
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getReviewId(), title, "您有一条质量检查的整改结果需要复查,请及时查看。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(projectSn, title, systemUserService.getFrameUserName(tempQualityInspectionRecord.getReviewId()) + "有一条质量检查的整改结果需要复查,请及时查看。", "11",
noticeService.addProjectLevelNoticeAndApp(projectSn, title, systemUserService.getFrameUserNames(tempQualityInspectionRecord.getReviewId()+"") + "有一条质量检查的整改结果需要复查,请及时查看。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
} else {
qualityInspectionRecord.setStatus(2);
@ -139,13 +139,13 @@ public class QualityRectifyRecordServiceImpl extends ServiceImpl<QualityRectifyR
qualityInspectionRecord.setStatus(4);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getVerifyManId(), "质量管理整改结果核验通知", "您有一条质量检查的整改结果需要核验,请及时查看。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果核验通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getVerifyManId()) + "有一条质量检查的整改结果需要核验,请及时查看。", "11",
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果核验通知", systemUserService.getFrameUserNames(tempQualityInspectionRecord.getVerifyManId()+"") + "有一条质量检查的整改结果需要核验,请及时查看。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
} else {
qualityInspectionRecord.setStatus(2);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getChangeId(), "质量管理整改结果复查通知", "您提交的质量检查的整改结果复查不通过,请及时重新整改。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果复查通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getChangeId()) + "提交的质量检查的整改结果复查不通过,请及时重新整改。", "11",
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果复查通知", systemUserService.getFrameUserNames(tempQualityInspectionRecord.getChangeId()+"") + "提交的质量检查的整改结果复查不通过,请及时重新整改。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
}
} else {
@ -154,13 +154,13 @@ public class QualityRectifyRecordServiceImpl extends ServiceImpl<QualityRectifyR
qualityInspectionRecord.setStatus(5);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getChangeId(), "质量管理整改结果核验通知", "您提交的质量检查的整改结果已通过核验。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果核验通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getChangeId()) + "提交的质量检查的整改结果已通过核验。", "11",
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果核验通知", systemUserService.getFrameUserNames(String.valueOf(tempQualityInspectionRecord.getChangeId())) + "提交的质量检查的整改结果已通过核验。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
} else {
qualityInspectionRecord.setStatus(2);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getChangeId(), "质量管理整改结果核验通知", "您提交的质量检查的整改结果核验不通过,请及时重新整改。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果核验通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getChangeId()) + "提交的质量检查的整改结果核验不通过,请及时重新整改。", "11",
noticeService.addProjectLevelNoticeAndApp(projectSn, "质量管理整改结果核验通知", systemUserService.getFrameUserNames(String.valueOf(tempQualityInspectionRecord.getChangeId())) + "提交的质量检查的整改结果核验不通过,请及时重新整改。", "11",
PushPayloads.buildPushPayload(11, qualityInspectionRecord));
}
}

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.jeecg.common.execption.OpenAlertException;
import com.zhgd.jeecg.common.mybatis.EntityMap;
import com.zhgd.xmgl.constant.Cts;
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.worker.entity.*;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoAuditRecordMapper;
import com.zhgd.xmgl.modules.worker.service.*;
@ -16,6 +18,7 @@ import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
@ -47,7 +50,12 @@ public class WorkerInfoAuditRecordServiceImpl extends ServiceImpl<WorkerInfoAudi
@Autowired
private IWorkerInsuranceService workerInsuranceService;
@Lazy
@Autowired
private ISystemUserService systemUserService;
@Lazy
@Autowired
private INoticeService noticeService;
@Override
public IPage<EntityMap> selectWorkerInfoAuditList(Map<String, Object> map) {
@ -155,6 +163,10 @@ public class WorkerInfoAuditRecordServiceImpl extends ServiceImpl<WorkerInfoAudi
}
//删除审核表记录
workerInfoAuditRecordMapper.deleteById(MapUtils.getString(map, "id"));
//发送给项目账号通知
String title = "人员入场审批已经通过";
noticeService.addProjectLevelNotice(workerInfoAuditRecord.getProjectSn(), title, systemUserService.getFrameUserNames(MapUtils.getString(map, "startUser")) + "提交的人员入场审批已经通过", "1", null);
return null;
}

View File

@ -347,6 +347,7 @@ public class XzWorkerInfoAuditRecordController {
paramMap.put("ufaceDevId", ufaceDevIds);
paramMap.put("accountType", 2);
paramMap.put("registerType", 2);
paramMap.put("startUser", paramMap.getString("startUser"));
String workerId = workerInfoAuditRecordService.adoptWorkerInfo(paramMap);
if (workerId != null) {
String[] split = workerId.split("#");
@ -364,9 +365,12 @@ public class XzWorkerInfoAuditRecordController {
collect.addAll(xzSystemUserToCompanyProjects.stream().map(x -> x.getUserId()).collect(Collectors.toList()));
collect.add(Long.valueOf(paramMap.getString("startUser")));
WorkerInfoAuditRecord wia = workerInfoAuditRecordService.getById(split[0]);
String title = "人员审批数据同步失败";
String msg = StrUtil.format("人员同步异常,原因:{},姓名:{},身份证号:{}", split[1], wia.getWorkerName(), wia.getIdCard());
for (Long userId : collect) {
noticeService.addUserNotice(userId, "人员审批数据同步失败", StrUtil.format("人员同步异常,原因:{},姓名:{},身份证号:{}", split[1], wia.getWorkerName(), wia.getIdCard()), "1");
noticeService.addUserNotice(userId, title, msg, "1");
}
noticeService.addProjectLevelNotice(paramMap.getString("projectSn"), title, msg, "1", null);
}
}
}

View File

@ -219,15 +219,22 @@ public class XzEmergencyRecordServiceImpl extends ServiceImpl<XzEmergencyRecordM
return;
}
XzEmergencyType type = xzEmergencyTypeMapper.selectById(entity.getEmergencyTypeId());
String title = "有应急消息待处理";
String msg = null;
for (String userId : userIds) {
if (entity.getEmergencyTypeId() == -1) {
noticeService.addUserNoticeAndApp(Long.valueOf(userId), "有应急消息待处理", StrUtil.format("{}人员在{}位置发起一键报警,请及时救援!", wi.getWorkerName(), StrUtil.isNotBlank(entity.getIncidentSite()) ? entity.getIncidentSite() : "未知"),
msg = StrUtil.format("{}人员在{}位置发起一键报警,请及时救援!", wi.getWorkerName(), StrUtil.isNotBlank(entity.getIncidentSite()) ? entity.getIncidentSite() : "未知");
noticeService.addUserNoticeAndApp(Long.valueOf(userId), title, msg,
"33");
} else {
noticeService.addUserNoticeAndApp(Long.valueOf(userId), "有应急消息待处理", StrUtil.format("{}人员在{}位置发起【{}】应急报警,请及时救援!", wi.getWorkerName(), StrUtil.isNotBlank(entity.getIncidentSite()) ? entity.getIncidentSite() : "未知", type != null ? type.getEmergencyType() : "其他类型"),
msg = StrUtil.format("{}人员在{}位置发起【{}】应急报警,请及时救援!", wi.getWorkerName(), StrUtil.isNotBlank(entity.getIncidentSite()) ? entity.getIncidentSite() : "未知", type != null ? type.getEmergencyType() : "其他类型");
noticeService.addUserNoticeAndApp(Long.valueOf(userId), title, msg,
"33");
}
}
if (msg != null) {
noticeService.addProjectLevelNotice(type.getProjectSn(), title, systemUserService.getFrameUserNames(push.getEmergencyManagerId()) + msg, "33", null);
}
}
@Override

View File

@ -362,7 +362,7 @@ public class XzSecurityQualityInspectionRecordServiceImpl extends ServiceImpl<Xz
if (Objects.equals(record.getRecordType(), XzSecurityQualityInspectionRecordRecordTypeEnum.DANGER.getValue()) && Objects.equals(record.getStatus(), XzSecurityQualityInspectionRecordStatusEnum.NOT_RECTIFIED.getValue())) {
noticeService.addUserNoticeAndApp(record.getChangeId(), "安全管理待整改", "您有一条安全检查待整改,问题:" + record.getDangerItemContent(), "10",
PushPayloads.buildPushPayload(10, record));
noticeService.addProjectLevelNoticeAndApp(record.getProjectSn(), "安全管理待整改", systemUserService.getFrameUserName(record.getChangeId()) + "有一条安全检查待整改,问题:" + record.getDangerItemContent(), "10",
noticeService.addProjectLevelNoticeAndApp(record.getProjectSn(), "安全管理待整改", systemUserService.getFrameUserNames(String.valueOf(record.getChangeId())) + "有一条安全检查待整改,问题:" + record.getDangerItemContent(), "10",
PushPayloads.buildPushPayload(10, record));
if (Objects.equals(record.getType(), 1)) {
DangerousEngineeringRecord d = dangerousEngineeringRecordMapper.selectById(record.getEngineeringId());
@ -742,17 +742,17 @@ public class XzSecurityQualityInspectionRecordServiceImpl extends ServiceImpl<Xz
if (Objects.equals(xzSecurityQualityInspectionRecord.getStatus(), XzSecurityQualityInspectionRecordStatusEnum.NOT_RECTIFIED.getValue())) {
noticeService.addUserNoticeAndApp(xzSecurityQualityInspectionRecord.getChangeId(), "安全管理待整改", "您有一条安全检查待整改,问题:" + xzSecurityQualityInspectionRecord.getDangerItemContent(), "10",
PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(xzSecurityQualityInspectionRecord.getProjectSn(), "安全管理待整改", systemUserService.getFrameUserName(xzSecurityQualityInspectionRecord.getChangeId()) + "有一条安全检查待整改,问题:" + xzSecurityQualityInspectionRecord.getDangerItemContent(), "10",
noticeService.addProjectLevelNoticeAndApp(xzSecurityQualityInspectionRecord.getProjectSn(), "安全管理待整改", systemUserService.getFrameUserNames(String.valueOf(xzSecurityQualityInspectionRecord.getChangeId())) + "有一条安全检查待整改,问题:" + xzSecurityQualityInspectionRecord.getDangerItemContent(), "10",
PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord));
} else if (Objects.equals(xzSecurityQualityInspectionRecord.getStatus(), XzSecurityQualityInspectionRecordStatusEnum.NOT_REVIEWED.getValue())) {
noticeService.addUserNoticeAndApp(xzSecurityQualityInspectionRecord.getReviewId(), "安全管理整改结果待复查", "您有一条安全检查的整改结果需要复查,请及时查看。", "10",
PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(xzSecurityQualityInspectionRecord.getProjectSn(), "安全管理整改结果待复查", systemUserService.getFrameUserName(xzSecurityQualityInspectionRecord.getReviewId()) + "有一条安全检查的整改结果需要复查,请及时查看。", "10",
noticeService.addProjectLevelNoticeAndApp(xzSecurityQualityInspectionRecord.getProjectSn(), "安全管理整改结果待复查", systemUserService.getFrameUserNames(String.valueOf(xzSecurityQualityInspectionRecord.getReviewId())) + "有一条安全检查的整改结果需要复查,请及时查看。", "10",
PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord));
} else if (Objects.equals(xzSecurityQualityInspectionRecord.getStatus(), XzSecurityQualityInspectionRecordStatusEnum.NOT_VERIFIED.getValue())) {
noticeService.addUserNoticeAndApp(xzSecurityQualityInspectionRecord.getVerifyManId(), "安全管理整改结果核验通知", "您有一条安全检查的整改结果需要核验,请及时查看。", "10",
PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(xzSecurityQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserName(xzSecurityQualityInspectionRecord.getVerifyManId()) + "有一条安全检查的整改结果需要核验,请及时查看。", "10",
noticeService.addProjectLevelNoticeAndApp(xzSecurityQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserNames(String.valueOf(xzSecurityQualityInspectionRecord.getVerifyManId())) + "有一条安全检查的整改结果需要核验,请及时查看。", "10",
PushPayloads.buildPushPayload(10, xzSecurityQualityInspectionRecord));
}
}

View File

@ -122,7 +122,7 @@ public class XzSecurityQualityRectifyRecordServiceImpl extends ServiceImpl<XzSec
tempQualityInspectionRecord.setStatus(3);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getReviewId(), "安全管理整改结果待复查", "您有一条安全检查的整改结果需要复查,请及时查看。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果待复查", systemUserService.getFrameUserName(tempQualityInspectionRecord.getReviewId()) + "有一条安全检查的整改结果需要复查,请及时查看。", "10",
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果待复查", systemUserService.getFrameUserNames(String.valueOf(tempQualityInspectionRecord.getReviewId())) + "有一条安全检查的整改结果需要复查,请及时查看。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
qualityInspectionRecordService.noticeBigScreen("31", tempQualityInspectionRecord, qualityRectifyRecord.getRectifyTime(), StrUtil.format("{}整改了{}的一条{}安全隐患问题,请注意监督复查!",
enterpriseInfo.getEnterpriseName(), tempQualityInspectionRecord.getRegionName(), StrUtil.subAfter(tempQualityInspectionRecord.getDangerItemContent(), "/", true)));
@ -135,7 +135,7 @@ public class XzSecurityQualityRectifyRecordServiceImpl extends ServiceImpl<XzSec
tempQualityInspectionRecord.setStatus(4);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getVerifyManId(), "安全管理整改结果核验通知", "您有一条安全检查的整改结果需要核验,请及时查看。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getVerifyManId()) + "有一条安全检查的整改结果需要核验,请及时查看。", "10",
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserNames(String.valueOf(tempQualityInspectionRecord.getVerifyManId())) + "有一条安全检查的整改结果需要核验,请及时查看。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
qualityInspectionRecordService.noticeBigScreen("31", tempQualityInspectionRecord, qualityRectifyRecord.getRectifyTime(), StrUtil.format("{}复查了{}的一条{}安全隐患问题,请注意监督复核!",
enterpriseInfo.getEnterpriseName(), tempQualityInspectionRecord.getRegionName(), StrUtil.subAfter(tempQualityInspectionRecord.getDangerItemContent(), "/", true)));
@ -143,7 +143,7 @@ public class XzSecurityQualityRectifyRecordServiceImpl extends ServiceImpl<XzSec
tempQualityInspectionRecord.setStatus(2);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getChangeId(), "安全管理整改结果复查通知", "您提交的安全检查的整改结果复查不通过,请及时重新整改。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果复查通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getChangeId()) + "提交的安全检查的整改结果复查不通过,请及时重新整改。", "10",
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果复查通知", systemUserService.getFrameUserNames(String.valueOf(tempQualityInspectionRecord.getChangeId())) + "提交的安全检查的整改结果复查不通过,请及时重新整改。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
}
} else {
@ -152,7 +152,7 @@ public class XzSecurityQualityRectifyRecordServiceImpl extends ServiceImpl<XzSec
tempQualityInspectionRecord.setStatus(5);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getChangeId(), "安全管理整改结果核验通知", "您提交的安全检查的整改结果已通过核验。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getChangeId()) + "提交的安全检查的整改结果已通过核验。", "10",
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserNames(String.valueOf(tempQualityInspectionRecord.getChangeId())) + "提交的安全检查的整改结果已通过核验。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
qualityInspectionRecordService.noticeBigScreen("31", tempQualityInspectionRecord, qualityRectifyRecord.getRectifyTime(), StrUtil.format("{}核验了{}的一条{}安全隐患问题,请注意查看!",
enterpriseInfo.getEnterpriseName(), tempQualityInspectionRecord.getRegionName(), StrUtil.subAfter(tempQualityInspectionRecord.getDangerItemContent(), "/", true)));
@ -160,7 +160,7 @@ public class XzSecurityQualityRectifyRecordServiceImpl extends ServiceImpl<XzSec
tempQualityInspectionRecord.setStatus(2);
noticeService.addUserNoticeAndApp(tempQualityInspectionRecord.getChangeId(), "安全管理整改结果核验通知", "您提交的安全检查的整改结果核验不通过,请及时重新整改。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserName(tempQualityInspectionRecord.getChangeId()) + "提交的安全检查的整改结果核验不通过,请及时重新整改。", "10",
noticeService.addProjectLevelNoticeAndApp(tempQualityInspectionRecord.getProjectSn(), "安全管理整改结果核验通知", systemUserService.getFrameUserNames(String.valueOf(tempQualityInspectionRecord.getChangeId())) + "提交的安全检查的整改结果核验不通过,请及时重新整改。", "10",
PushPayloads.buildPushPayload(10, tempQualityInspectionRecord));
}
}

View File

@ -1,9 +1,11 @@
package com.zhgd.xmgl.modules.xz.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhgd.xmgl.constant.Cts;
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
@ -11,7 +13,6 @@ import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
import com.zhgd.xmgl.modules.worker.mapper.WorkerInfoMapper;
import com.zhgd.xmgl.modules.worker.service.IWorkerInfoService;
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchAlarm;
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchConfig;
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchManager;
@ -19,13 +20,13 @@ import com.zhgd.xmgl.modules.xz.mapper.XzWorkerSafeWatchConfigMapper;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchAlarmService;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchConfigService;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchManagerService;
import com.zhgd.xmgl.util.MapBuilder;
import org.apache.commons.lang3.StringUtils;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.*;
import java.util.stream.Collectors;
@ -89,15 +90,19 @@ public class XzWorkerSafeWatchConfigServiceImpl extends ServiceImpl<XzWorkerSafe
List<Notice> noticeList = new ArrayList<>();
for (String userId : userIds) {
if (StringUtils.isNotBlank(userId)) {
Notice notice = new Notice();
notice.setType("35");
// 事件xxx企业名称已连续被检查到xxx隐患的描述x次请提醒责任人xxx责任人姓名及时整改并加强对此风险的管控措施
notice.setMsg(StrUtil.format("事件:【{}】已连续被检查到【{}】{}次,请提醒责任人【{}】及时整改并加强对此风险的管控措施",
workerInfo.getEnterpriseName(), desc, num, workerInfo.getWorkerName()));
notice.setTitle("人员安全履职预警提醒");
notice.setIsRead(0);
notice.setAccountId(Long.valueOf(userId));
notice.setSendTime(DateUtil.formatDateTime(new Date()));
Notice notice = getNotice(StrUtil.format("事件:【{}】已连续被检查到【{}】{}次,请提醒责任人【{}】及时整改并加强对此风险的管控措施",
workerInfo.getEnterpriseName(), desc, num, workerInfo.getWorkerName()), Long.valueOf(userId));
noticeList.add(notice);
}
}
if (CollUtil.isNotEmpty(userIds)) {
List<SystemUser> systemUsers = systemUserService.list(Wrappers.<SystemUser>lambdaQuery()
.in(SystemUser::getUserId, userIds));
String names = StrUtil.join(",", systemUsers.stream().map(SystemUser::getRealName).collect(Collectors.toList()));
List<SystemUser> noticeUsers = systemUserService.getSystemUsersBySn(new MapBuilder<String, Object>().put(Cts.SN, projectSn).put(Cts.QUERY_TYPE, Cts.PROJECT_LEVEL).build());
for (SystemUser user : noticeUsers) {
Notice notice = getNotice(StrUtil.format("【{}】事件:【{}】已连续被检查到【{}】{}次,请提醒责任人【{}】及时整改并加强对此风险的管控措施",
names, workerInfo.getEnterpriseName(), desc, num, workerInfo.getWorkerName()), user.getUserId());
noticeList.add(notice);
}
}
@ -105,4 +110,17 @@ public class XzWorkerSafeWatchConfigServiceImpl extends ServiceImpl<XzWorkerSafe
}
}
}
@NotNull
private Notice getNotice(String names, Long user) {
Notice notice = new Notice();
notice.setType("35");
// 事件xxx企业名称已连续被检查到xxx隐患的描述x次请提醒责任人xxx责任人姓名及时整改并加强对此风险的管控措施
notice.setMsg(names);
notice.setTitle("人员安全履职预警提醒");
notice.setIsRead(0);
notice.setAccountId(user);
notice.setSendTime(DateUtil.formatDateTime(new Date()));
return notice;
}
}

View File

@ -9,6 +9,7 @@ import com.alibaba.fastjson.JSONObject;
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.zhgd.xmgl.constant.Cts;
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.mapper.SystemLogoConfigMapper;
@ -51,6 +52,7 @@ import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchConfigService;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchManagerService;
import com.zhgd.xmgl.modules.xz.service.impl.XzCertificateExpireAlarmRecordServiceImpl;
import com.zhgd.xmgl.util.ElecardUtil;
import com.zhgd.xmgl.util.MapBuilder;
import com.zhgd.xmgl.util.NumberUtils;
import lombok.extern.slf4j.Slf4j;
import net.javacrumbs.shedlock.core.SchedulerLock;
@ -293,9 +295,11 @@ public class WorkerTask {
List<Project> projects = projectMapper.selectList(Wrappers.<Project>lambdaQuery().eq(Project::getStatus, 2));
for (Project project : projects) {
if (project.getEnableWorkerSafeWatch() != null && project.getEnableWorkerSafeWatch() == 1) {
List<SystemUser> projectLevelUsers = systemUserService.getSystemUsersBySn(new MapBuilder<String, Object>().put(Cts.SN, project.getProjectSn()).put(Cts.QUERY_TYPE, Cts.PROJECT_LEVEL).build());
List<XzWorkerSafeWatchConfig> list = xzWorkerSafeWatchConfigService.list(Wrappers.<XzWorkerSafeWatchConfig>lambdaQuery()
.eq(XzWorkerSafeWatchConfig::getProjectSn, project.getProjectSn()));
workerSafeWatchAlarmForHidden(list, project);
//安全履职预警增加规则
this.workerSafeWatchAlarmForHidden(list, project, projectLevelUsers);
if (StringUtils.isNotBlank(project.getWorkerSafeWatchTime()) &&
DateUtil.format(new Date(), "HH:mm").equals(
DateUtil.format(DateUtil.parseTime(project.getWorkerSafeWatchTime()), "HH:mm"))) {
@ -470,18 +474,31 @@ public class WorkerTask {
List<String> userIds = Arrays.asList(xzWorkerSafeWatchManagerService.list(Wrappers.<XzWorkerSafeWatchManager>lambdaQuery()
.eq(XzWorkerSafeWatchManager::getWatchConfigId, id))
.stream().map(l -> l.getUserId()).collect(Collectors.joining(",")).split(","));
userIds = userIds.stream().filter(s -> StringUtils.isNotBlank(s)).collect(Collectors.toList());
String msg = StrUtil.format("事件:{},人员名称:{},身份证号:{}",
typeName[Integer.parseInt(type) - 1] + dayNum + "天未履职", workerInfo.getWorkerName(), workerInfo.getIdCard());
for (String userId : userIds) {
if (StringUtils.isNotBlank(userId)) {
Notice notice = new Notice();
notice.setType("35");
notice.setMsg(StrUtil.format("事件:{},人员名称:{},身份证号:{}",
typeName[Integer.parseInt(type) - 1] + dayNum + "天未履职", workerInfo.getWorkerName(), workerInfo.getIdCard()));
notice.setMsg(msg);
notice.setTitle("人员安全履职预警提醒");
notice.setIsRead(0);
notice.setAccountId(Long.valueOf(userId));
notice.setSendTime(DateUtil.formatDateTime(new Date()));
noticeList.add(notice);
}
if (CollUtil.isNotEmpty(userIds)) {
String frameUserNames = systemUserService.getFrameUserNames(StrUtil.join(",", userIds))+ msg;
for (SystemUser user : projectLevelUsers) {
Notice notice = new Notice();
notice.setType("35");
notice.setMsg(frameUserNames);
notice.setTitle("人员安全履职预警提醒");
notice.setIsRead(0);
notice.setAccountId(user.getUserId());
notice.setSendTime(DateUtil.formatDateTime(new Date()));
noticeList.add(notice);
}
}
}
}
@ -494,7 +511,7 @@ public class WorkerTask {
}
private void workerSafeWatchAlarmForHidden(List<XzWorkerSafeWatchConfig> list, Project project) {
private void workerSafeWatchAlarmForHidden(List<XzWorkerSafeWatchConfig> list, Project project, List<SystemUser> projectLevelUsers) {
//定制安全履职预警增加规则四级安全隐患预警规则分级对未整改未复查未核验超过多少时间进行循环通知
List<XzWorkerSafeWatchAlarm> alarmList = new ArrayList<>();
List<Notice> noticeList = new ArrayList<>();
@ -528,16 +545,27 @@ public class WorkerTask {
HashSet<String> noticeUserIds = configIdToNoticeUserIdsMap.get(config.getId());
String now = DateUtil.now();
if (CollUtil.isNotEmpty(noticeUserIds)) {
String msg = StrUtil.format("有一条{}{}安全隐患预警,设置的预警时间是{}分钟,现在已超时{}分钟", getLevelName(level), getStatusName(status), minute, safeWatchAlarmExceedMinute);
for (String userId : noticeUserIds) {
//报警
Notice notice = new Notice();
notice.setType("35");
notice.setMsg(StrUtil.format("有一条{}{}安全隐患预警,设置的预警时间是{}分钟,现在已超时{}分钟", getLevelName(level), getStatusName(status), minute, safeWatchAlarmExceedMinute));
notice.setMsg(msg);
notice.setAccountId(Long.valueOf(userId));
notice.setTitle("安全隐患预警");
notice.setSendTime(now);
noticeList.add(notice);
}
String frameUserNames = systemUserService.getFrameUserNames(StrUtil.join(",", noticeUserIds))+ msg;
for (SystemUser user : projectLevelUsers) {
Notice notice = new Notice();
notice.setType("35");
notice.setMsg(frameUserNames);
notice.setTitle("安全隐患预警");
notice.setAccountId(user.getUserId());
notice.setSendTime(now);
noticeList.add(notice);
}
}
XzWorkerSafeWatchAlarm alarm = new XzWorkerSafeWatchAlarm();