Merge remote-tracking branch 'origin/guoshengxiong' into guoshengxiong

This commit is contained in:
guoshengxiong 2024-06-02 12:40:10 +08:00
commit 233a20c02a
2 changed files with 78 additions and 14 deletions

View File

@ -318,11 +318,12 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
noticeBigScreen("31", record, record.getInspectTime(), StrUtil.format("{}检查到一条{}的{}安全隐患问题,请注意监督整改!",
record.getRegionName(), enterpriseInfo.getEnterpriseName(), StrUtil.subAfter(record.getDangerItemContent(), "/", true)));
}
Integer count = xzSecurityQualityInspectionRecordMapper.selectCount(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
.eq(XzSecurityQualityInspectionRecord::getRecordType, 1)
.eq(XzSecurityQualityInspectionRecord::getDangerItemId, record.getDangerItemId()));
// Integer count = xzSecurityQualityInspectionRecordMapper.selectCount(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
// .eq(XzSecurityQualityInspectionRecord::getRecordType, 1)
// .eq(XzSecurityQualityInspectionRecord::getEnterpriseSn, record.getEnterpriseSn())
// .eq(XzSecurityQualityInspectionRecord::getDangerItemId, record.getDangerItemId()));
//安全履职记录
xzWorkerSafeWatchConfigService.saveInfo(record.getProjectSn(), 5, count, record.getChangeId().toString(), record.getDangerItemContent());
// xzWorkerSafeWatchConfigService.saveInfo(record.getProjectSn(), 5, count, record.getChangeId().toString(), record.getDangerItemContent());
} else if (record.getRecordType() == 2) {
XzSecurityDangerItemRecord dangerItemRecord = dangerItemRecordMapper.selectById(record.getDangerItemId());
record.setLevel(dangerItemRecord.getLevel());

View File

@ -43,6 +43,7 @@ import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityInspectTaskRecord;
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityQualityInspectionRecord;
import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityInspectTaskItemRecordMapper;
import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityInspectTaskRecordMapper;
import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityQualityInspectionRecordMapper;
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchAlarmService;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchConfigService;
@ -106,6 +107,9 @@ public class WorkerTask {
@Autowired
private IWorkerMonthAttendanceStatisticsService workerMonthAttendanceStatisticsService;
@Autowired
private XzSecurityQualityInspectionRecordMapper xzSecurityQualityInspectionRecordMapper;
@Autowired
private IWorkerAttendanceService workerAttendanceService;
@ -327,16 +331,18 @@ public class WorkerTask {
XzSecurityInspectTaskRecord xzSecurityInspectTaskRecord = xzSecurityInspectTaskRecords.stream().filter(s -> s.getId().toString().equals(data.getTaskId().toString())).collect(Collectors.toList()).get(0);
SystemUser systemUser = systemUserMapper.selectById(xzSecurityInspectTaskRecord.getInspectUser());
WorkerInfo workerInfo = workerInfoMapper.selectById(systemUser.getWorkerId());
int count = 0;
if (xzSecurityInspectTaskRecord.getType() == 1) {
count = hiddenDangerInspectRecordService.count(Wrappers.<HiddenDangerInspectRecord>lambdaQuery()
.eq(HiddenDangerInspectRecord::getInspectHiddenDangerItemRecordId, data.getId()));
} else {
count = qualityInspectionRecordService.count(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
.eq(XzSecurityQualityInspectionRecord::getItemId, data.getId()));
}
if (count == 0) {
personSn.add(workerInfo.getPersonSn());
if(workerInfo != null) {
int count = 0;
if (xzSecurityInspectTaskRecord.getType() == 1) {
count = hiddenDangerInspectRecordService.count(Wrappers.<HiddenDangerInspectRecord>lambdaQuery()
.eq(HiddenDangerInspectRecord::getInspectHiddenDangerItemRecordId, data.getId()));
} else {
count = qualityInspectionRecordService.count(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
.eq(XzSecurityQualityInspectionRecord::getItemId, data.getId()));
}
if (count == 0) {
personSn.add(workerInfo.getPersonSn());
}
}
}
}
@ -382,6 +388,63 @@ public class WorkerTask {
}
}
}
if (type.equals("5")) {
List<XzSecurityQualityInspectionRecord> xzSecurityQualityInspectionRecords = xzSecurityQualityInspectionRecordMapper.selectList(Wrappers.<XzSecurityQualityInspectionRecord>lambdaQuery()
.eq(XzSecurityQualityInspectionRecord::getRecordType, 1)
.orderByDesc(XzSecurityQualityInspectionRecord::getCreateTime));
Set<String> ids = new HashSet<>();
for (XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord : xzSecurityQualityInspectionRecords) {
String id = xzSecurityQualityInspectionRecord.getEnterpriseSn() + "-" + xzSecurityQualityInspectionRecord.getDangerItemId();
ids.add(id);
}
for (String id : ids) {
String[] split = id.split("-");
List<XzSecurityQualityInspectionRecord> collect = xzSecurityQualityInspectionRecords.stream().filter(x -> x.getEnterpriseSn().equals(split[0]) && x.getDangerItemId().toString().equals(split[1])).collect(Collectors.toList());
if (collect.size() >= dayNum) {
XzSecurityQualityInspectionRecord xzSecurityQualityInspectionRecord = collect.get(0);
SystemUser systemUser = systemUserMapper.selectById(xzSecurityQualityInspectionRecord.getChangeId());
Map<String, Object> requestParam = new HashMap<>();
requestParam.put("id", systemUser.getWorkerId());
requestParam.put("inserviceType", 1);
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(new Page<>(-1, -1), requestParam);
if (workerInfoList.size() > 0) {
WorkerInfo workerInfo = workerInfoList.get(0);
XzWorkerSafeWatchAlarm xzWorkerSafeWatchAlarm = new XzWorkerSafeWatchAlarm();
xzWorkerSafeWatchAlarm.setWorkerId(workerInfo.getId());
xzWorkerSafeWatchAlarm.setWorkerName(workerInfo.getWorkerName());
String deptName = workerInfo.getDepartmentName() == null ? "" : workerInfo.getDepartmentName();
String teamName = workerInfo.getTeamName() == null ? "" : workerInfo.getTeamName();
xzWorkerSafeWatchAlarm.setDeptName(deptName + teamName);
xzWorkerSafeWatchAlarm.setEnterpriseName(workerInfo.getEnterpriseName());
xzWorkerSafeWatchAlarm.setAlarmTime(new Date());
xzWorkerSafeWatchAlarm.setType(type.toString());
xzWorkerSafeWatchAlarm.setProjectSn(xzSecurityQualityInspectionRecord.getProjectSn());
xzWorkerSafeWatchAlarm.setDayNum(dayNum);
xzWorkerSafeWatchAlarm.setEnterpriseId(workerInfo.getEnterpriseId());
alarmList.add(xzWorkerSafeWatchAlarm);
List<String> userIds = Arrays.asList(xzWorkerSafeWatchManagerService.list(Wrappers.<XzWorkerSafeWatchManager>lambdaQuery()
.eq(XzWorkerSafeWatchManager::getWatchConfigId, xzWorkerSafeWatchConfig.getId()))
.stream().map(l -> l.getUserId()).collect(Collectors.joining(",")).split(","));
for (String userId : userIds) {
if (StringUtils.isNotBlank(userId)) {
Notice notice = new Notice();
notice.setType("35");
notice.setMsg(StrUtil.format("事件:【{}】已连续被检查到【{}】{}次,请提醒责任人【{}】及时整改并加强对此风险的管控措施",
workerInfo.getEnterpriseName(), xzSecurityQualityInspectionRecord.getDangerItemContent(),
collect.size(), workerInfo.getWorkerName()));
notice.setTitle("人员安全履职预警提醒");
notice.setIsRead(0);
notice.setAccountId(Long.valueOf(userId));
notice.setSendTime(DateUtil.formatDateTime(new Date()));
noticeList.add(notice);
}
}
}
}
}
}
if (personSn.size() > 0) {
Map<String, Object> requestParam = new HashMap<>();
requestParam.put("personSns", personSn);