commit
This commit is contained in:
parent
d24470ecfd
commit
114aaa28f4
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.exam.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
@ -116,10 +117,18 @@ public class ExamSubjectController {
|
||||
@ApiOperation(value = " 添加考试科目信息", notes = "添加考试科目信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody ExamSubject examSubject) {
|
||||
Result<Object> result = new Result<Object>();
|
||||
ExamSubject examSubjectEntity = examSubjectService.getOne(Wrappers.<ExamSubject>lambdaQuery()
|
||||
.eq(ExamSubject::getName, examSubject.getName()));
|
||||
if (examSubjectEntity != null) {
|
||||
result.error500("该科目名称已存在");
|
||||
} else {
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
examSubject.setCreateBy(user.getUserId().toString());
|
||||
examSubjectService.save(examSubject);
|
||||
return Result.success("添加成功!");
|
||||
result.success("添加成功!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -133,7 +142,12 @@ public class ExamSubjectController {
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<ExamSubject> edit(@RequestBody ExamSubject examSubject) {
|
||||
Result<ExamSubject> result = new Result<ExamSubject>();
|
||||
ExamSubject examSubjectEntity = examSubjectService.getById(examSubject.getId());
|
||||
ExamSubject examSubjectEntity = examSubjectService.getOne(Wrappers.<ExamSubject>lambdaQuery()
|
||||
.eq(ExamSubject::getName, examSubject.getName()).ne(ExamSubject::getId, examSubject.getId()));
|
||||
if (examSubjectEntity != null) {
|
||||
result.error500("该科目名称已存在");
|
||||
} else {
|
||||
examSubjectEntity = examSubjectService.getById(examSubject.getId());
|
||||
if (examSubjectEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
@ -146,7 +160,7 @@ public class ExamSubjectController {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@ -148,7 +148,7 @@ public class ExamTrainController {
|
||||
if (examTrainEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = examTrainService.removeById(examTrain.getId());
|
||||
boolean ok = examTrainService.delInfo(examTrain);
|
||||
if (ok) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
|
||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.exam.mapper;
|
||||
import java.util.List;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -18,5 +19,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
@Mapper
|
||||
public interface ExamCourseRecordMapper extends BaseMapper<ExamCourseRecord> {
|
||||
|
||||
Page<ExamCourseRecord> pageList(Page page, Wrapper<ExamCourseRecord> wrapper);
|
||||
Page<ExamCourseRecord> pageList(Page page, @Param(Constants.WRAPPER) Wrapper<ExamCourseRecord> wrapper);
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<mapper namespace="com.zhgd.xmgl.modules.exam.mapper.ExamCourseRecordMapper">
|
||||
|
||||
<select id="pageList" resultType="com.zhgd.xmgl.modules.exam.entity.ExamCourseRecord">
|
||||
select * from (select e.*, c.course_name from exam_course_record e left join exam_course c on e.course_id = c.id)
|
||||
select * from (select e.*, c.course_name from exam_course_record e left join exam_course c on e.course_id = c.id) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -3,10 +3,10 @@
|
||||
<mapper namespace="com.zhgd.xmgl.modules.exam.mapper.ExamTrainRecordMapper">
|
||||
|
||||
<select id="pageList" resultType="com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo">
|
||||
select ec.*, et.exam_paper_id, et.course_id, es.name subjectName, et.title, et.train_begin_time, et.train_end_time, et.name trainName from exam_train_record ec
|
||||
select * from (select ec.*, et.exam_paper_id, et.course_id, es.name subjectName, et.title, et.train_begin_time, et.train_end_time, et.name trainName from exam_train_record ec
|
||||
left join exam_train et on ec.train_id = et.id
|
||||
left join exam_subject es on et.subject_id = es.id
|
||||
-- left join exam_course c on et.course_id = c.id
|
||||
left join exam_course c on et.course_id = c.id) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -17,4 +17,6 @@ public interface IExamTrainService extends IService<ExamTrain> {
|
||||
Page<ExamTrain> pageList(Page page, Wrapper<ExamTrain> wrapper);
|
||||
|
||||
boolean saveInfo(ExamTrain examTrain);
|
||||
|
||||
boolean delInfo(ExamTrain examTrain);
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.zhgd.xmgl.modules.exam.mapper.ExamTrainMapper;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamCourseRecordService;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainRecordService;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainService;
|
||||
import com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo;
|
||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||
import com.zhgd.xmgl.util.DateUtils;
|
||||
@ -90,4 +91,10 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delInfo(ExamTrain examTrain) {
|
||||
examTrainRecordService.remove(Wrappers.<ExamTrainRecord>lambdaQuery().eq(ExamTrainRecord::getTrainId, examTrain.getId()));
|
||||
return this.removeById(examTrain.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,7 +75,12 @@ public class XzWorkerSafeWatchAlarmController {
|
||||
public Result<IPage<XzWorkerSafeWatchAlarm>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<XzWorkerSafeWatchAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(XzWorkerSafeWatchAlarm.class, map);
|
||||
Page<XzWorkerSafeWatchAlarm> page = PageUtil.getPage(map);
|
||||
queryWrapper.lambda().orderByDesc(XzWorkerSafeWatchAlarm::getAlarmTime);
|
||||
IPage<XzWorkerSafeWatchAlarm> pageList = xzWorkerSafeWatchAlarmService.page(page, queryWrapper);
|
||||
String [] typeName = {"人员日常考勤", "每个项目自检任务", "一个月内缺勤超过", "一个月内迟到超过"};
|
||||
for (XzWorkerSafeWatchAlarm record : pageList.getRecords()) {
|
||||
record.setType(typeName[Integer.parseInt(record.getType()) - 1]);
|
||||
}
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
@ -214,8 +219,12 @@ public class XzWorkerSafeWatchAlarmController {
|
||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, Map<String, Object> map) {
|
||||
// Step.1 组装查询条件
|
||||
QueryWrapper<XzWorkerSafeWatchAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(XzWorkerSafeWatchAlarm.class, map);
|
||||
queryWrapper.lambda().orderByDesc(XzWorkerSafeWatchAlarm::getAlarmTime);
|
||||
IPage<XzWorkerSafeWatchAlarm> pageList = xzWorkerSafeWatchAlarmService.page(new Page<>(-1, -1), queryWrapper);
|
||||
|
||||
String [] typeName = {"人员日常考勤", "每个项目自检任务", "一个月内缺勤超过", "一个月内迟到超过"};
|
||||
for (XzWorkerSafeWatchAlarm record : pageList.getRecords()) {
|
||||
record.setType(typeName[Integer.parseInt(record.getType()) - 1]);
|
||||
}
|
||||
//Step.2 AutoPoi 导出Excel
|
||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||
//导出文件名称
|
||||
|
||||
@ -54,11 +54,11 @@ public class ExamTask {
|
||||
List<ExamNotice> noticeList = new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ExamNoticeConfig examNoticeConfig = examConfigService.getOne(Wrappers.<ExamNoticeConfig>lambdaQuery()
|
||||
.eq(ExamNoticeConfig::getProjectSn, list.get(i))
|
||||
.eq(ExamNoticeConfig::getProjectSn, list.get(i).getProjectSn())
|
||||
.eq(ExamNoticeConfig::getEnable, 1));
|
||||
if (examNoticeConfig != null) {
|
||||
if (examNoticeConfig.getExamNum() != null && examNoticeConfig.getExamType() != null) {
|
||||
List<ExamTrain> examTrainList = examTrainService.list(Wrappers.<ExamTrain>lambdaQuery().eq(ExamTrain::getProjectSn, list.get(i)));
|
||||
List<ExamTrain> examTrainList = examTrainService.list(Wrappers.<ExamTrain>lambdaQuery().eq(ExamTrain::getProjectSn, list.get(i).getProjectSn()));
|
||||
for (int j = 0; j < examTrainList.size(); j++) {
|
||||
if (DateUtil.compare(examTrainList.get(j).getTrainBeginTime(), getTime(examNoticeConfig.getExamType(), examNoticeConfig.getExamNum())) < 0) {
|
||||
List<ExamTrainRecord> examTrainRecordList = examTrainRecordService.list(Wrappers.<ExamTrainRecord>lambdaQuery().eq(ExamTrainRecord::getTrainId, examTrainList.get(j).getId()));
|
||||
@ -75,6 +75,23 @@ public class ExamTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
List<ExamCourse> examCourseList = examCourseService.list(Wrappers.<ExamCourse>lambdaQuery().eq(ExamCourse::getProjectSn, list.get(i).getProjectSn()));
|
||||
for (int j = 0; j < examCourseList.size(); j++) {
|
||||
if (DateUtil.compare(new Date(), getTime(examNoticeConfig.getExamType(), examNoticeConfig.getExamNum())) < 0) {
|
||||
List<ExamCourseRecord> examCourseRecords = examCourseRecordService.list(Wrappers.<ExamCourseRecord>lambdaQuery().eq(ExamCourseRecord::getCourseId, examCourseList.get(j)));
|
||||
for (int i1 = 0; i1 < examCourseRecords.size(); i1++) {
|
||||
if (examCourseRecords.get(i).getNumber() == null || examCourseRecords.get(i).getNumber() == 0) {
|
||||
ExamNotice examNotice = new ExamNotice();
|
||||
examNotice.setWorkerId(examCourseRecords.get(i1).getWorkerId().toString());
|
||||
examNotice.setWorkerName(examCourseRecords.get(i1).getWorkerName());
|
||||
examNotice.setType(1);
|
||||
examNotice.setContent("参加安全教育课程学习");
|
||||
examNotice.setProjectSn(list.get(i).getProjectSn());
|
||||
noticeList.add(examNotice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (examNoticeConfig.getExamNum() != null && examNoticeConfig.getExamType() != null) {
|
||||
|
||||
@ -8,16 +8,20 @@ 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.jeecg.common.mybatis.EntityMap;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.Notice;
|
||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemLogoConfigMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
||||
import com.zhgd.xmgl.modules.dangerous.entity.HiddenDangerInspectRecord;
|
||||
import com.zhgd.xmgl.modules.dangerous.service.IHiddenDangerInspectRecordService;
|
||||
import com.zhgd.xmgl.modules.project.entity.Project;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectExternalSystemService;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectExternalSystemServiceMapper;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||
import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService;
|
||||
import com.zhgd.xmgl.modules.quality.entity.QualityInspectionRecord;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerAttendance;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerBlacklist;
|
||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
||||
@ -32,12 +36,21 @@ import com.zhgd.xmgl.modules.worker.service.IWorkerMonthAttendanceStatisticsServ
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzCertificateExpireAlarmRecord;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchAlarm;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchConfig;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchManager;
|
||||
import com.zhgd.xmgl.modules.xz.security.entity.XzSecurityInspectTaskItemRecord;
|
||||
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.service.IXzSecurityQualityInspectionRecordService;
|
||||
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.modules.xz.service.impl.XzCertificateExpireAlarmRecordServiceImpl;
|
||||
import com.zhgd.xmgl.util.ElecardUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@ -99,6 +112,18 @@ public class WorkerTask {
|
||||
@Autowired
|
||||
private IXzWorkerSafeWatchAlarmService xzWorkerSafeWatchAlarmService;
|
||||
|
||||
@Autowired
|
||||
private IXzWorkerSafeWatchManagerService xzWorkerSafeWatchManagerService;
|
||||
|
||||
@Autowired
|
||||
private XzSecurityInspectTaskRecordMapper xzSecurityInspectTaskRecordMapper;
|
||||
@Autowired
|
||||
private XzSecurityInspectTaskItemRecordMapper xzSecurityInspectTaskItemRecordMapper;
|
||||
@Autowired
|
||||
private IHiddenDangerInspectRecordService hiddenDangerInspectRecordService;
|
||||
@Autowired
|
||||
private IXzSecurityQualityInspectionRecordService qualityInspectionRecordService;
|
||||
|
||||
/**
|
||||
* 定时修改用户码状态
|
||||
*/
|
||||
@ -258,37 +283,63 @@ public class WorkerTask {
|
||||
/**
|
||||
* 对人员未履职情况进行监测,及时反馈预警
|
||||
*/
|
||||
@Scheduled(cron = "0 0 0/1 * * ?")
|
||||
@Scheduled(cron = "0 0/1 * * * ?")
|
||||
@RequestMapping("/workerSafeWatchAlarm")
|
||||
public void workerSafeWatchAlarm() {
|
||||
log.info("开始执行对人员未履职情况进行监测");
|
||||
String [] typeName = {"人员日常考勤", "每个项目自检任务", "一个月内缺勤超过", "一个月内迟到超过"};
|
||||
List<Project> projects = projectMapper.selectList(Wrappers.<Project>lambdaQuery().eq(Project::getStatus, 2));
|
||||
int day = DateUtil.dayOfMonth(new Date());
|
||||
for (Project project : projects) {
|
||||
if (project.getEnableWorkerSafeWatch() != null && project.getEnableWorkerSafeWatch() == 1) {
|
||||
if (StringUtils.isNotBlank(project.getWorkerSafeWatchTime()) &&
|
||||
DateUtil.format(new Date(), "HH:ss").equals(project.getWorkerSafeWatchTime())) {
|
||||
DateUtil.format(new Date(), "HH:mm").equals(
|
||||
DateUtil.format(DateUtil.parseTime(project.getWorkerSafeWatchTime()), "HH:mm"))) {
|
||||
List<XzWorkerSafeWatchConfig> list = xzWorkerSafeWatchConfigService.list(Wrappers.<XzWorkerSafeWatchConfig>lambdaQuery()
|
||||
.eq(XzWorkerSafeWatchConfig::getProjectSn, project.getProjectSn()));
|
||||
List<XzWorkerSafeWatchAlarm> alarmList = new ArrayList<>();
|
||||
List<Notice> noticeList = new ArrayList<>();
|
||||
for (XzWorkerSafeWatchConfig xzWorkerSafeWatchConfig : list) {
|
||||
String type = xzWorkerSafeWatchConfig.getType();
|
||||
int dayNum = xzWorkerSafeWatchConfig.getDayNum();
|
||||
Set<String> personSn = new HashSet<>();
|
||||
//计算日常考勤规则
|
||||
if (xzWorkerSafeWatchConfig.getType().equals("1")) {
|
||||
if (type.equals("1")) {
|
||||
DateTime dateTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -3));
|
||||
Set<String> personSet = workerAttendanceService.list(Wrappers.<WorkerAttendance>lambdaQuery().between(WorkerAttendance::getCreateTime
|
||||
, dateTime, new Date())).stream().map(w -> w.getPersonSn()).collect(Collectors.toSet());
|
||||
Set<String> workerSet = workerInfoMapper.selectList(Wrappers.<WorkerInfo>lambdaQuery().eq(WorkerInfo::getPresence, 1)).stream().map(w -> w.getPersonSn()).collect(Collectors.toSet());
|
||||
Set<String> workerSet = workerInfoMapper.selectList(Wrappers.<WorkerInfo>lambdaQuery().eq(WorkerInfo::getInserviceType, 1)).stream().map(w -> w.getPersonSn()).collect(Collectors.toSet());
|
||||
workerSet.removeAll(personSet);
|
||||
personSn = workerSet;
|
||||
personSn.addAll(workerSet);
|
||||
}
|
||||
if (xzWorkerSafeWatchConfig.getType().equals("2")) {
|
||||
|
||||
if (type.equals("2")) {
|
||||
List<XzSecurityInspectTaskRecord> xzSecurityInspectTaskRecords = xzSecurityInspectTaskRecordMapper.selectList(Wrappers.<XzSecurityInspectTaskRecord>lambdaQuery()
|
||||
.eq(XzSecurityInspectTaskRecord::getSn, project.getProjectSn())
|
||||
.le(XzSecurityInspectTaskRecord::getEndTime, DateUtil.offsetDay(new Date(), -dayNum)));
|
||||
if (xzSecurityInspectTaskRecords.size() > 0) {
|
||||
List<XzSecurityInspectTaskItemRecord> itemList = xzSecurityInspectTaskItemRecordMapper.selectList(Wrappers.<XzSecurityInspectTaskItemRecord>lambdaQuery()
|
||||
.in(XzSecurityInspectTaskItemRecord::getTaskId, xzSecurityInspectTaskRecords.stream().map(s -> s.getId()).collect(Collectors.toList())));
|
||||
if (itemList != null && itemList.size() > 0) {
|
||||
for (XzSecurityInspectTaskItemRecord data : itemList) {
|
||||
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 (xzWorkerSafeWatchConfig.getType().equals("3")) {
|
||||
Integer dayNum = xzWorkerSafeWatchConfig.getDayNum();
|
||||
if (count == 0) {
|
||||
personSn.add(workerInfo.getPersonSn());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (type.equals("3")) {
|
||||
List<WorkerMonthAttendanceStatistics> list1 = workerMonthAttendanceStatisticsService.list(Wrappers.<WorkerMonthAttendanceStatistics>
|
||||
lambdaQuery().eq(WorkerMonthAttendanceStatistics::getProjectSn, project.getProjectSn())
|
||||
.eq(WorkerMonthAttendanceStatistics::getQueryTime, DateUtil.format(new Date(), "yyyy-MM")));
|
||||
@ -308,8 +359,7 @@ public class WorkerTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (xzWorkerSafeWatchConfig.getType().equals("4")) {
|
||||
Integer dayNum = xzWorkerSafeWatchConfig.getDayNum();
|
||||
if (type.equals("4")) {
|
||||
List<WorkerMonthAttendanceStatistics> list1 = workerMonthAttendanceStatisticsService.list(Wrappers.<WorkerMonthAttendanceStatistics>
|
||||
lambdaQuery().eq(WorkerMonthAttendanceStatistics::getProjectSn, project.getProjectSn())
|
||||
.eq(WorkerMonthAttendanceStatistics::getQueryTime, DateUtil.format(new Date(), "yyyy-MM")));
|
||||
@ -329,6 +379,7 @@ public class WorkerTask {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (personSn.size() > 0) {
|
||||
Map<String, Object> requestParam = new HashMap<>();
|
||||
requestParam.put("personSns", personSn);
|
||||
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(new Page<>(-1, -1), requestParam);
|
||||
@ -336,20 +387,35 @@ public class WorkerTask {
|
||||
XzWorkerSafeWatchAlarm xzWorkerSafeWatchAlarm = new XzWorkerSafeWatchAlarm();
|
||||
xzWorkerSafeWatchAlarm.setWorkerId(workerInfo.getId());
|
||||
xzWorkerSafeWatchAlarm.setWorkerName(workerInfo.getWorkerName());
|
||||
xzWorkerSafeWatchAlarm.setDeptName(workerInfo.getDepartmentName() + workerInfo.getTeamName());
|
||||
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);
|
||||
xzWorkerSafeWatchAlarm.setProjectSn(project.getProjectSn());
|
||||
xzWorkerSafeWatchAlarm.setDayNum(dayNum);
|
||||
alarmList.add(xzWorkerSafeWatchAlarm);
|
||||
|
||||
Long id = xzWorkerSafeWatchConfig.getId();
|
||||
|
||||
List<String> userIds = Arrays.asList(xzWorkerSafeWatchManagerService.list(Wrappers.<XzWorkerSafeWatchManager>lambdaQuery()
|
||||
.eq(XzWorkerSafeWatchManager::getWatchConfigId, id))
|
||||
.stream().map(l -> l.getUserId()).collect(Collectors.joining(",")).split(","));
|
||||
for (String userId : userIds) {
|
||||
Notice notice = new Notice();
|
||||
notice.setType("35");
|
||||
notice.setMsg("");
|
||||
notice.setTitle("");
|
||||
notice.setMsg(String.format("事件:{},人员名称:{},身份证号:{}",
|
||||
typeName[Integer.parseInt(type) - 1] + dayNum + "天未履职", workerInfo.getWorkerName(), workerInfo.getIdCard()));
|
||||
notice.setTitle("人员安全履职预警提醒");
|
||||
notice.setIsRead(0);
|
||||
notice.setAccountId(Long.valueOf(userId));
|
||||
notice.setSendTime(DateUtil.formatDateTime(new Date()));
|
||||
noticeList.add(notice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
xzWorkerSafeWatchAlarmService.saveBatch(alarmList);
|
||||
noticeService.saveBatch(noticeList);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user