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

This commit is contained in:
GUO 2024-06-01 15:56:30 +08:00
commit dd9b8ac263
7 changed files with 298 additions and 9 deletions

View File

@ -291,13 +291,17 @@ public class FlowOrgRepositoryServiceImpl implements OrgRepositoryService {
for (String userDeptId : userDeptIds) { for (String userDeptId : userDeptIds) {
UserDeptDo userDeptDo = new UserDeptDo(); UserDeptDo userDeptDo = new UserDeptDo();
String[] split = userDeptId.split("_"); String[] split = userDeptId.split("_");
UserDo user = this.getUserById(split[0]); UserVo user = this.getUserDetail(split[0]);
DeptDo deptById = this.getDeptById(split[1]); DeptDo deptById = this.getDeptById(split[1]);
userDeptDo.setUserId(user.getUserId()); userDeptDo.setUserId(user.getUserId());
userDeptDo.setUserName(user.getUserName()); userDeptDo.setUserName(user.getUsername());
userDeptDo.setAvatar(user.getAvatar()); userDeptDo.setAvatar(user.getAvatar());
userDeptDo.setDeptId(deptById.getId()); userDeptDo.setDeptId(deptById.getId());
userDeptDo.setDeptName(deptById.getDeptName()); userDeptDo.setDeptName(deptById.getDeptName());
List<String> roles = user.getRoles();
if (roles != null && roles.size() > 0) {
userDeptDo.setRoleName(roles.get(0));
}
list.add(userDeptDo); list.add(userDeptDo);
} }
return list.stream().collect(Collectors.toMap(UserDeptDo::getUserId, v -> v, (a, b) -> a)); return list.stream().collect(Collectors.toMap(UserDeptDo::getUserId, v -> v, (a, b) -> a));

View File

@ -4,9 +4,18 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhgd.annotation.OperLog; import com.zhgd.annotation.OperLog;
import com.zhgd.exception.CustomException;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
import com.zhgd.xmgl.modules.basicdata.service.ISystemUserService;
import com.zhgd.xmgl.modules.exam.entity.ExamQuestionOption;
import com.zhgd.xmgl.modules.exam.entity.ExamSubject;
import com.zhgd.xmgl.modules.exam.service.IExamQuestionOptionService;
import com.zhgd.xmgl.modules.exam.service.IExamSubjectService;
import com.zhgd.xmgl.modules.exam.vo.ExamQuestionBankImport;
import com.zhgd.xmgl.modules.exam.vo.ExamQuestionBankQuery; import com.zhgd.xmgl.modules.exam.vo.ExamQuestionBankQuery;
import com.zhgd.xmgl.modules.exam.vo.ExamQuestionBankVo; import com.zhgd.xmgl.modules.exam.vo.ExamQuestionBankVo;
import com.zhgd.xmgl.modules.exam.vo.RandomQuery; import com.zhgd.xmgl.modules.exam.vo.RandomQuery;
import com.zhgd.xmgl.security.entity.UserInfo;
import com.zhgd.xmgl.security.util.SecurityUtils; import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.PageUtil; import com.zhgd.xmgl.util.PageUtil;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -39,7 +48,9 @@ import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams; import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
@ -63,6 +74,15 @@ public class ExamQuestionBankController {
@Autowired @Autowired
private IExamQuestionBankService examQuestionBankService; private IExamQuestionBankService examQuestionBankService;
@Autowired
private IExamQuestionOptionService examQuestionOptionService;
@Autowired
private IExamSubjectService examSubjectService;
@Autowired
private ISystemUserService systemUserService;
/** /**
* 分页列表查询 * 分页列表查询
* *
@ -310,15 +330,40 @@ public class ExamQuestionBankController {
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
// UserInfo user = SecurityUtils.getUser();
//Step.2 AutoPoi 导出Excel //Step.2 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
List<ExamQuestionBank> pageList = examQuestionBankService.list(queryWrapper); List<ExamQuestionBank> pageList = examQuestionBankService.list(queryWrapper);
List<ExamSubject> subList = examSubjectService.list();
List<ExamQuestionBankImport> resultList = new ArrayList<>();
int index = 1;
for (ExamQuestionBank examQuestionBank : pageList) {
ExamSubject examSubject = subList.stream().filter(s -> s.getId().toString().equals(examQuestionBank.getSubjectId().toString()))
.collect(Collectors.toList()).get(0);
ExamQuestionBankImport examQuestionBankImport = new ExamQuestionBankImport();
examQuestionBankImport.setIndex(index + "");
examQuestionBankImport.setSubjectName(examSubject.getName());
examQuestionBankImport.setQuestionName(examQuestionBank.getQuestionName());
examQuestionBankImport.setTypeName(getType(examQuestionBank.getType()));
examQuestionBankImport.setDifficulty(getDifficulty(examQuestionBank.getDifficulty()));
examQuestionBankImport.setOptions(examQuestionBank.getOptions());
examQuestionBankImport.setIsEnable(examQuestionBank.getIsEnable() == 1 ? "" : "");
examQuestionBankImport.setScore(examQuestionBank.getScore());
resultList.add(examQuestionBankImport);
List<ExamQuestionOption> questionOptions = examQuestionOptionService.list(Wrappers.<ExamQuestionOption>lambdaQuery().eq(ExamQuestionOption::getQuestionId, examQuestionBank.getId()));
for (ExamQuestionOption questionOption : questionOptions) {
ExamQuestionBankImport examQuestionBankImport1 = new ExamQuestionBankImport();
examQuestionBankImport1.setSubjectName(questionOption.getOptionCode());
examQuestionBankImport1.setQuestionName(questionOption.getOptionDesc());
resultList.add(examQuestionBankImport1);
}
index++;
}
//导出文件名称 //导出文件名称
mv.addObject(NormalExcelConstants.FILE_NAME, "题目管理列表"); mv.addObject(NormalExcelConstants.FILE_NAME, "题目管理列表");
mv.addObject(NormalExcelConstants.CLASS, ExamQuestionBank.class); mv.addObject(NormalExcelConstants.CLASS, ExamQuestionBankImport.class);
mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("题目管理列表数据", "导出人:Jeecg", "导出信息")); mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("题目管理列表数据", "导出人:Jeecg", "导出信息"));
mv.addObject(NormalExcelConstants.DATA_LIST, pageList); mv.addObject(NormalExcelConstants.DATA_LIST, resultList);
return mv; return mv;
} }
@ -334,6 +379,9 @@ public class ExamQuestionBankController {
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap(); Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
List<ExamSubject> subList = examSubjectService.list();
UserInfo user = SecurityUtils.getUser();
SystemUser systemUser = systemUserService.getById(user.getUserId());
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) { for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile file = entity.getValue();// 获取上传文件对象 MultipartFile file = entity.getValue();// 获取上传文件对象
ImportParams params = new ImportParams(); ImportParams params = new ImportParams();
@ -341,11 +389,52 @@ public class ExamQuestionBankController {
params.setHeadRows(1); params.setHeadRows(1);
params.setNeedSave(true); params.setNeedSave(true);
try { try {
List<ExamQuestionBank> listExamQuestionBanks = ExcelImportUtil.importExcel(file.getInputStream(), ExamQuestionBank.class, params); List<ExamQuestionBankImport> examQuestionBankImports = ExcelImportUtil.importExcel(file.getInputStream(), ExamQuestionBankImport.class, params);
for (ExamQuestionBank examQuestionBankExcel : listExamQuestionBanks) { List<ExamQuestionBank> examQuestionBankList = new ArrayList<>();
examQuestionBankService.save(examQuestionBankExcel); List<ExamQuestionOption> examQuestionOptionList = new ArrayList<>();
int index = 0;
for (ExamQuestionBankImport examQuestionBankImport : examQuestionBankImports) {
if (StringUtils.isNotBlank(examQuestionBankImport.getIndex())) {
index++;
List<ExamSubject> subjects = subList.stream().filter(s -> s.getName().equals(examQuestionBankImport.getSubjectName())).collect(Collectors.toList());
if (subjects == null || subjects.size() == 0) {
throw new CustomException("没有对应的科目名称,请检查", HttpStatus.INTERNAL_SERVER_ERROR);
} }
return Result.ok("文件导入成功!数据行数:" + listExamQuestionBanks.size()); ExamQuestionBank examQuestionBank = new ExamQuestionBank();
examQuestionBank.setId((long) index);
examQuestionBank.setSubjectId(subjects.get(0).getId());
examQuestionBank.setQuestionName(examQuestionBankImport.getQuestionName());
examQuestionBank.setType(getType(examQuestionBankImport.getTypeName()));
examQuestionBank.setDifficulty(getDifficulty(examQuestionBankImport.getDifficulty()));
examQuestionBank.setOptions(examQuestionBankImport.getOptions());
examQuestionBank.setIsEnable(examQuestionBankImport.getIsEnable().equals("") ? 1 : 0);
examQuestionBank.setScore(examQuestionBankImport.getScore());
examQuestionBank.setProjectSn(systemUser.getSn());
examQuestionBank.setCreateBy(systemUser.getUserId().toString());
examQuestionBank.setCreateTime(new Date());
examQuestionBank.setUpdateBy(systemUser.getUserId().toString());
examQuestionBank.setUpdateTime(examQuestionBank.getCreateTime());
examQuestionBankList.add(examQuestionBank);
} else {
ExamQuestionOption examQuestionOption = new ExamQuestionOption();
examQuestionOption.setQuestionId((long) index);
examQuestionOption.setOptionCode(examQuestionBankImport.getSubjectName());
examQuestionOption.setOptionDesc(examQuestionBankImport.getQuestionName());
examQuestionOptionList.add(examQuestionOption);
}
}
for (ExamQuestionBank examQuestionBank : examQuestionBankList) {
ExamQuestionBankVo examQuestionBankVo = new ExamQuestionBankVo();
List<ExamQuestionOption> collect = examQuestionOptionList.stream().filter(e -> e.getQuestionId().toString().equals(examQuestionBank.getId().toString())).collect(Collectors.toList());
for (ExamQuestionOption examQuestionOption : collect) {
examQuestionOption.setQuestionId(null);
}
examQuestionBank.setId(null);
BeanUtils.copyProperties(examQuestionBank, examQuestionBankVo);
examQuestionBankVo.setOptionList(collect);
examQuestionBankService.saveInfo(examQuestionBankVo);
}
return Result.ok("文件导入成功!数据行数:" + examQuestionBankImports.size());
} catch (Exception e) { } catch (Exception e) {
log.error(e.getMessage()); log.error(e.getMessage());
return Result.error("文件导入失败!"); return Result.error("文件导入失败!");
@ -360,4 +449,60 @@ public class ExamQuestionBankController {
return Result.ok("文件导入失败!"); return Result.ok("文件导入失败!");
} }
private String getType(int type) {
String typeName = null;
switch (type) {
case 1 :
typeName = "单选题";
break;
case 2 :
typeName = "多选题";
break;
case 3 :
typeName = "填空题";
break;
}
return typeName;
}
private Integer getType(String typeName) {
Integer type = 0;
if (typeName.equals("单选题")) {
type = 1;
} else if (typeName.equals("多选题")) {
type = 2;
} else if (typeName.equals("填空题")) {
type = 3;
}
return type;
}
private String getDifficulty(int type) {
String difficulty = null;
switch (type) {
case 1 :
difficulty = "简单";
break;
case 2 :
difficulty = "一般";
break;
case 3 :
difficulty = "困难";
break;
}
return difficulty;
}
private Integer getDifficulty(String difficulty) {
Integer type = 0;
if (difficulty.equals("简单")) {
type = 1;
} else if (difficulty.equals("一般")) {
type = 2;
} else if (difficulty.equals("困难")) {
type = 3;
}
return type;
}
} }

View File

@ -0,0 +1,43 @@
package com.zhgd.xmgl.modules.exam.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecgframework.poi.excel.annotation.Excel;
@Data
@ApiModel(value = "试题导入(VO)", description = "ExamQuestionBankImport")
public class ExamQuestionBankImport {
@Excel(name = "试题序号", width = 15)
@ApiModelProperty(value = "试题序号")
private String index;
@Excel(name = "科目名称/选项代码", width = 15)
@ApiModelProperty(value = "科目名称/选项代码")
private String subjectName;
@Excel(name = "试题名称/选项描述", width = 15)
@ApiModelProperty(value = "试题名称/选项描述")
private String questionName;
@Excel(name = "试题类型(单选题;多选题;填空题;)", width = 15)
@ApiModelProperty(value = "试题类型(单选题;多选题;填空题;)")
private String typeName;
@Excel(name = "难易程度", width = 15)
@ApiModelProperty(value = "难易程度")
private String difficulty;
@Excel(name = "试题答案", width = 15)
@ApiModelProperty(value = "试题答案")
private String options;
@Excel(name = "是否应用(否;是)", width = 15)
@ApiModelProperty(value = "是否应用(否;是)")
private String isEnable;
@Excel(name = "作答正确得分", width = 15)
@ApiModelProperty(value = "作答正确得分")
private Integer score;
}

View File

@ -52,6 +52,7 @@ import com.zhgd.xmgl.modules.xz.security.mapper.XzSecurityQualityRectifyRecordMa
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskItemRecordService; import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskItemRecordService;
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskRecordService; import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityInspectTaskRecordService;
import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService; import com.zhgd.xmgl.modules.xz.security.service.IXzSecurityQualityInspectionRecordService;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchConfigService;
import com.zhgd.xmgl.push.config.PushPayloads; import com.zhgd.xmgl.push.config.PushPayloads;
import com.zhgd.xmgl.util.*; import com.zhgd.xmgl.util.*;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
@ -117,6 +118,8 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
private IXzSecurityInspectTaskRecordService xzSecurityInspectTaskRecordService; private IXzSecurityInspectTaskRecordService xzSecurityInspectTaskRecordService;
@Autowired @Autowired
private IXzSecurityInspectTaskItemRecordService xzSecurityInspectTaskItemRecordService; private IXzSecurityInspectTaskItemRecordService xzSecurityInspectTaskItemRecordService;
@Autowired
private IXzWorkerSafeWatchConfigService xzWorkerSafeWatchConfigService;
private static List<Long> getChildrenByQualityRegionId(Long regionId, List<QualityRegion> all) { private static List<Long> getChildrenByQualityRegionId(Long regionId, List<QualityRegion> all) {
ArrayList<Long> list = new ArrayList<>(); ArrayList<Long> list = new ArrayList<>();
@ -315,6 +318,11 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
noticeBigScreen("31", record, record.getInspectTime(), StrUtil.format("{}检查到一条{}的{}安全隐患问题,请注意监督整改!", noticeBigScreen("31", record, record.getInspectTime(), StrUtil.format("{}检查到一条{}的{}安全隐患问题,请注意监督整改!",
record.getRegionName(), enterpriseInfo.getEnterpriseName(), StrUtil.subAfter(record.getDangerItemContent(), "/", true))); 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()));
//安全履职记录
xzWorkerSafeWatchConfigService.saveInfo(record.getProjectSn(), 5, count, record.getChangeId().toString(), record.getDangerItemContent());
} else if (record.getRecordType() == 2) { } else if (record.getRecordType() == 2) {
XzSecurityDangerItemRecord dangerItemRecord = dangerItemRecordMapper.selectById(record.getDangerItemId()); XzSecurityDangerItemRecord dangerItemRecord = dangerItemRecordMapper.selectById(record.getDangerItemId());
record.setLevel(dangerItemRecord.getLevel()); record.setLevel(dangerItemRecord.getLevel());

View File

@ -11,4 +11,5 @@ import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchConfig;
*/ */
public interface IXzWorkerSafeWatchConfigService extends IService<XzWorkerSafeWatchConfig> { public interface IXzWorkerSafeWatchConfigService extends IService<XzWorkerSafeWatchConfig> {
void saveInfo(String projectSn, Integer type, Integer num, String workerId, String desc);
} }

View File

@ -1,12 +1,33 @@
package com.zhgd.xmgl.modules.xz.service.impl; package com.zhgd.xmgl.modules.xz.service.impl;
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.zhgd.xmgl.modules.basicdata.entity.Notice;
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
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.XzWorkerSafeWatchConfig;
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchManager;
import com.zhgd.xmgl.modules.xz.mapper.XzWorkerSafeWatchConfigMapper; 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.IXzWorkerSafeWatchConfigService;
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchManagerService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.util.*;
import java.util.stream.Collectors;
/** /**
* @Description: 安全履职配置信息 * @Description: 安全履职配置信息
* @author pengj * @author pengj
@ -16,4 +37,71 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@Service @Service
public class XzWorkerSafeWatchConfigServiceImpl extends ServiceImpl<XzWorkerSafeWatchConfigMapper, XzWorkerSafeWatchConfig> implements IXzWorkerSafeWatchConfigService { public class XzWorkerSafeWatchConfigServiceImpl extends ServiceImpl<XzWorkerSafeWatchConfigMapper, XzWorkerSafeWatchConfig> implements IXzWorkerSafeWatchConfigService {
@Autowired
private IXzWorkerSafeWatchManagerService xzWorkerSafeWatchManagerService;
@Autowired
private IXzWorkerSafeWatchAlarmService xzWorkerSafeWatchAlarmService;
@Autowired
private INoticeService noticeService;
@Autowired
private ISystemUserService systemUserService;
@Autowired
private WorkerInfoMapper workerInfoMapper;
@Async
@Override
public void saveInfo(String projectSn, Integer type, Integer num, String workerId, String desc) {
List<XzWorkerSafeWatchConfig> list = this.list(Wrappers.<XzWorkerSafeWatchConfig>lambdaQuery()
.eq(XzWorkerSafeWatchConfig::getProjectSn, projectSn));
List<XzWorkerSafeWatchConfig> collect = list.stream().filter(l -> l.getType().equals(type.toString())).collect(Collectors.toList());
if (collect != null && collect.size() > 0) {
XzWorkerSafeWatchConfig xzWorkerSafeWatchConfig = collect.get(0);
int dayNum = xzWorkerSafeWatchConfig.getDayNum();
if (num >= dayNum) {
SystemUser systemUser = systemUserService.getById(workerId);
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);
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(projectSn);
xzWorkerSafeWatchAlarm.setDayNum(dayNum);
xzWorkerSafeWatchAlarm.setEnterpriseId(workerInfo.getEnterpriseId());
xzWorkerSafeWatchAlarmService.save(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(","));
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()));
noticeList.add(notice);
}
}
noticeService.saveBatch(noticeList);
}
}
}
} }