commit
This commit is contained in:
parent
d24470ecfd
commit
114aaa28f4
@ -1,5 +1,6 @@
|
|||||||
package com.zhgd.xmgl.modules.exam.controller;
|
package com.zhgd.xmgl.modules.exam.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.zhgd.annotation.OperLog;
|
import com.zhgd.annotation.OperLog;
|
||||||
import com.zhgd.xmgl.security.entity.UserInfo;
|
import com.zhgd.xmgl.security.entity.UserInfo;
|
||||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
@ -116,10 +117,18 @@ public class ExamSubjectController {
|
|||||||
@ApiOperation(value = " 添加考试科目信息", notes = "添加考试科目信息", httpMethod = "POST")
|
@ApiOperation(value = " 添加考试科目信息", notes = "添加考试科目信息", httpMethod = "POST")
|
||||||
@PostMapping(value = "/add")
|
@PostMapping(value = "/add")
|
||||||
public Result<Object> add(@RequestBody ExamSubject examSubject) {
|
public Result<Object> add(@RequestBody ExamSubject examSubject) {
|
||||||
UserInfo user = SecurityUtils.getUser();
|
Result<Object> result = new Result<Object>();
|
||||||
examSubject.setCreateBy(user.getUserId().toString());
|
ExamSubject examSubjectEntity = examSubjectService.getOne(Wrappers.<ExamSubject>lambdaQuery()
|
||||||
examSubjectService.save(examSubject);
|
.eq(ExamSubject::getName, examSubject.getName()));
|
||||||
return Result.success("添加成功!");
|
if (examSubjectEntity != null) {
|
||||||
|
result.error500("该科目名称已存在");
|
||||||
|
} else {
|
||||||
|
UserInfo user = SecurityUtils.getUser();
|
||||||
|
examSubject.setCreateBy(user.getUserId().toString());
|
||||||
|
examSubjectService.save(examSubject);
|
||||||
|
result.success("添加成功!");
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,20 +142,25 @@ public class ExamSubjectController {
|
|||||||
@PostMapping(value = "/edit")
|
@PostMapping(value = "/edit")
|
||||||
public Result<ExamSubject> edit(@RequestBody ExamSubject examSubject) {
|
public Result<ExamSubject> edit(@RequestBody ExamSubject examSubject) {
|
||||||
Result<ExamSubject> result = new Result<ExamSubject>();
|
Result<ExamSubject> result = new Result<ExamSubject>();
|
||||||
ExamSubject examSubjectEntity = examSubjectService.getById(examSubject.getId());
|
ExamSubject examSubjectEntity = examSubjectService.getOne(Wrappers.<ExamSubject>lambdaQuery()
|
||||||
if (examSubjectEntity == null) {
|
.eq(ExamSubject::getName, examSubject.getName()).ne(ExamSubject::getId, examSubject.getId()));
|
||||||
result.error500("未找到对应实体");
|
if (examSubjectEntity != null) {
|
||||||
|
result.error500("该科目名称已存在");
|
||||||
} else {
|
} else {
|
||||||
UserInfo user = SecurityUtils.getUser();
|
examSubjectEntity = examSubjectService.getById(examSubject.getId());
|
||||||
examSubject.setUpdateBy(user.getUserId().toString());
|
if (examSubjectEntity == null) {
|
||||||
boolean ok = examSubjectService.updateById(examSubject);
|
result.error500("未找到对应实体");
|
||||||
if (ok) {
|
|
||||||
result.success("修改成功!");
|
|
||||||
} else {
|
} else {
|
||||||
result.success("操作失败!");
|
UserInfo user = SecurityUtils.getUser();
|
||||||
|
examSubject.setUpdateBy(user.getUserId().toString());
|
||||||
|
boolean ok = examSubjectService.updateById(examSubject);
|
||||||
|
if (ok) {
|
||||||
|
result.success("修改成功!");
|
||||||
|
} else {
|
||||||
|
result.success("操作失败!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -148,7 +148,7 @@ public class ExamTrainController {
|
|||||||
if (examTrainEntity == null) {
|
if (examTrainEntity == null) {
|
||||||
result.error500("未找到对应实体");
|
result.error500("未找到对应实体");
|
||||||
} else {
|
} else {
|
||||||
boolean ok = examTrainService.removeById(examTrain.getId());
|
boolean ok = examTrainService.delInfo(examTrain);
|
||||||
if (ok) {
|
if (ok) {
|
||||||
result.success("删除成功!");
|
result.success("删除成功!");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.modules.exam.mapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@ -18,5 +19,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface ExamCourseRecordMapper extends BaseMapper<ExamCourseRecord> {
|
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">
|
<mapper namespace="com.zhgd.xmgl.modules.exam.mapper.ExamCourseRecordMapper">
|
||||||
|
|
||||||
<select id="pageList" resultType="com.zhgd.xmgl.modules.exam.entity.ExamCourseRecord">
|
<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}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -3,10 +3,10 @@
|
|||||||
<mapper namespace="com.zhgd.xmgl.modules.exam.mapper.ExamTrainRecordMapper">
|
<mapper namespace="com.zhgd.xmgl.modules.exam.mapper.ExamTrainRecordMapper">
|
||||||
|
|
||||||
<select id="pageList" resultType="com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo">
|
<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_train et on ec.train_id = et.id
|
||||||
left join exam_subject es on et.subject_id = es.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}
|
${ew.customSqlSegment}
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@ -17,4 +17,6 @@ public interface IExamTrainService extends IService<ExamTrain> {
|
|||||||
Page<ExamTrain> pageList(Page page, Wrapper<ExamTrain> wrapper);
|
Page<ExamTrain> pageList(Page page, Wrapper<ExamTrain> wrapper);
|
||||||
|
|
||||||
boolean saveInfo(ExamTrain examTrain);
|
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.IExamCourseRecordService;
|
||||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainRecordService;
|
import com.zhgd.xmgl.modules.exam.service.IExamTrainRecordService;
|
||||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainService;
|
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.entity.UserInfo;
|
||||||
import com.zhgd.xmgl.security.util.SecurityUtils;
|
import com.zhgd.xmgl.security.util.SecurityUtils;
|
||||||
import com.zhgd.xmgl.util.DateUtils;
|
import com.zhgd.xmgl.util.DateUtils;
|
||||||
@ -90,4 +91,10 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
|||||||
}
|
}
|
||||||
return flag;
|
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) {
|
public Result<IPage<XzWorkerSafeWatchAlarm>> queryPageList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||||
QueryWrapper<XzWorkerSafeWatchAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(XzWorkerSafeWatchAlarm.class, map);
|
QueryWrapper<XzWorkerSafeWatchAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(XzWorkerSafeWatchAlarm.class, map);
|
||||||
Page<XzWorkerSafeWatchAlarm> page = PageUtil.getPage(map);
|
Page<XzWorkerSafeWatchAlarm> page = PageUtil.getPage(map);
|
||||||
|
queryWrapper.lambda().orderByDesc(XzWorkerSafeWatchAlarm::getAlarmTime);
|
||||||
IPage<XzWorkerSafeWatchAlarm> pageList = xzWorkerSafeWatchAlarmService.page(page, queryWrapper);
|
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);
|
return Result.success(pageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,8 +219,12 @@ public class XzWorkerSafeWatchAlarmController {
|
|||||||
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, Map<String, Object> map) {
|
public ModelAndView exportXls(HttpServletRequest request, HttpServletResponse response, Map<String, Object> map) {
|
||||||
// Step.1 组装查询条件
|
// Step.1 组装查询条件
|
||||||
QueryWrapper<XzWorkerSafeWatchAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(XzWorkerSafeWatchAlarm.class, map);
|
QueryWrapper<XzWorkerSafeWatchAlarm> queryWrapper = QueryGenerator.initPageQueryWrapper(XzWorkerSafeWatchAlarm.class, map);
|
||||||
|
queryWrapper.lambda().orderByDesc(XzWorkerSafeWatchAlarm::getAlarmTime);
|
||||||
IPage<XzWorkerSafeWatchAlarm> pageList = xzWorkerSafeWatchAlarmService.page(new Page<>(-1, -1), queryWrapper);
|
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
|
//Step.2 AutoPoi 导出Excel
|
||||||
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
|
||||||
//导出文件名称
|
//导出文件名称
|
||||||
|
|||||||
@ -54,11 +54,11 @@ public class ExamTask {
|
|||||||
List<ExamNotice> noticeList = new ArrayList<>();
|
List<ExamNotice> noticeList = new ArrayList<>();
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
ExamNoticeConfig examNoticeConfig = examConfigService.getOne(Wrappers.<ExamNoticeConfig>lambdaQuery()
|
ExamNoticeConfig examNoticeConfig = examConfigService.getOne(Wrappers.<ExamNoticeConfig>lambdaQuery()
|
||||||
.eq(ExamNoticeConfig::getProjectSn, list.get(i))
|
.eq(ExamNoticeConfig::getProjectSn, list.get(i).getProjectSn())
|
||||||
.eq(ExamNoticeConfig::getEnable, 1));
|
.eq(ExamNoticeConfig::getEnable, 1));
|
||||||
if (examNoticeConfig != null) {
|
if (examNoticeConfig != null) {
|
||||||
if (examNoticeConfig.getExamNum() != null && examNoticeConfig.getExamType() != 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++) {
|
for (int j = 0; j < examTrainList.size(); j++) {
|
||||||
if (DateUtil.compare(examTrainList.get(j).getTrainBeginTime(), getTime(examNoticeConfig.getExamType(), examNoticeConfig.getExamNum())) < 0) {
|
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()));
|
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) {
|
// 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.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
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.Notice;
|
||||||
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
import com.zhgd.xmgl.modules.basicdata.entity.SystemUser;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemLogoConfigMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.SystemLogoConfigMapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
import com.zhgd.xmgl.modules.basicdata.mapper.SystemUserMapper;
|
||||||
import com.zhgd.xmgl.modules.basicdata.service.INoticeService;
|
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.Project;
|
||||||
import com.zhgd.xmgl.modules.project.entity.ProjectExternalSystemService;
|
import com.zhgd.xmgl.modules.project.entity.ProjectExternalSystemService;
|
||||||
import com.zhgd.xmgl.modules.project.mapper.ProjectExternalSystemServiceMapper;
|
import com.zhgd.xmgl.modules.project.mapper.ProjectExternalSystemServiceMapper;
|
||||||
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
import com.zhgd.xmgl.modules.project.mapper.ProjectMapper;
|
||||||
import com.zhgd.xmgl.modules.project.service.IProjectUfaceConfigService;
|
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.WorkerAttendance;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerBlacklist;
|
import com.zhgd.xmgl.modules.worker.entity.WorkerBlacklist;
|
||||||
import com.zhgd.xmgl.modules.worker.entity.WorkerInfo;
|
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.XzCertificateExpireAlarmRecord;
|
||||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchAlarm;
|
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.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.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 com.zhgd.xmgl.modules.xz.service.impl.XzCertificateExpireAlarmRecordServiceImpl;
|
import com.zhgd.xmgl.modules.xz.service.impl.XzCertificateExpireAlarmRecordServiceImpl;
|
||||||
import com.zhgd.xmgl.util.ElecardUtil;
|
import com.zhgd.xmgl.util.ElecardUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||||
|
import org.apache.commons.collections.MapUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
@ -99,6 +112,18 @@ public class WorkerTask {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private IXzWorkerSafeWatchAlarmService xzWorkerSafeWatchAlarmService;
|
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")
|
@RequestMapping("/workerSafeWatchAlarm")
|
||||||
public void workerSafeWatchAlarm() {
|
public void workerSafeWatchAlarm() {
|
||||||
log.info("开始执行对人员未履职情况进行监测");
|
log.info("开始执行对人员未履职情况进行监测");
|
||||||
|
String [] typeName = {"人员日常考勤", "每个项目自检任务", "一个月内缺勤超过", "一个月内迟到超过"};
|
||||||
List<Project> projects = projectMapper.selectList(Wrappers.<Project>lambdaQuery().eq(Project::getStatus, 2));
|
List<Project> projects = projectMapper.selectList(Wrappers.<Project>lambdaQuery().eq(Project::getStatus, 2));
|
||||||
int day = DateUtil.dayOfMonth(new Date());
|
int day = DateUtil.dayOfMonth(new Date());
|
||||||
for (Project project : projects) {
|
for (Project project : projects) {
|
||||||
if (project.getEnableWorkerSafeWatch() != null && project.getEnableWorkerSafeWatch() == 1) {
|
if (project.getEnableWorkerSafeWatch() != null && project.getEnableWorkerSafeWatch() == 1) {
|
||||||
if (StringUtils.isNotBlank(project.getWorkerSafeWatchTime()) &&
|
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()
|
List<XzWorkerSafeWatchConfig> list = xzWorkerSafeWatchConfigService.list(Wrappers.<XzWorkerSafeWatchConfig>lambdaQuery()
|
||||||
.eq(XzWorkerSafeWatchConfig::getProjectSn, project.getProjectSn()));
|
.eq(XzWorkerSafeWatchConfig::getProjectSn, project.getProjectSn()));
|
||||||
List<XzWorkerSafeWatchAlarm> alarmList = new ArrayList<>();
|
List<XzWorkerSafeWatchAlarm> alarmList = new ArrayList<>();
|
||||||
List<Notice> noticeList = new ArrayList<>();
|
List<Notice> noticeList = new ArrayList<>();
|
||||||
for (XzWorkerSafeWatchConfig xzWorkerSafeWatchConfig : list) {
|
for (XzWorkerSafeWatchConfig xzWorkerSafeWatchConfig : list) {
|
||||||
String type = xzWorkerSafeWatchConfig.getType();
|
String type = xzWorkerSafeWatchConfig.getType();
|
||||||
|
int dayNum = xzWorkerSafeWatchConfig.getDayNum();
|
||||||
Set<String> personSn = new HashSet<>();
|
Set<String> personSn = new HashSet<>();
|
||||||
//计算日常考勤规则
|
//计算日常考勤规则
|
||||||
if (xzWorkerSafeWatchConfig.getType().equals("1")) {
|
if (type.equals("1")) {
|
||||||
DateTime dateTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -3));
|
DateTime dateTime = DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -3));
|
||||||
Set<String> personSet = workerAttendanceService.list(Wrappers.<WorkerAttendance>lambdaQuery().between(WorkerAttendance::getCreateTime
|
Set<String> personSet = workerAttendanceService.list(Wrappers.<WorkerAttendance>lambdaQuery().between(WorkerAttendance::getCreateTime
|
||||||
, dateTime, new Date())).stream().map(w -> w.getPersonSn()).collect(Collectors.toSet());
|
, 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);
|
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 (count == 0) {
|
||||||
|
personSn.add(workerInfo.getPersonSn());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (xzWorkerSafeWatchConfig.getType().equals("3")) {
|
if (type.equals("3")) {
|
||||||
Integer dayNum = xzWorkerSafeWatchConfig.getDayNum();
|
|
||||||
List<WorkerMonthAttendanceStatistics> list1 = workerMonthAttendanceStatisticsService.list(Wrappers.<WorkerMonthAttendanceStatistics>
|
List<WorkerMonthAttendanceStatistics> list1 = workerMonthAttendanceStatisticsService.list(Wrappers.<WorkerMonthAttendanceStatistics>
|
||||||
lambdaQuery().eq(WorkerMonthAttendanceStatistics::getProjectSn, project.getProjectSn())
|
lambdaQuery().eq(WorkerMonthAttendanceStatistics::getProjectSn, project.getProjectSn())
|
||||||
.eq(WorkerMonthAttendanceStatistics::getQueryTime, DateUtil.format(new Date(), "yyyy-MM")));
|
.eq(WorkerMonthAttendanceStatistics::getQueryTime, DateUtil.format(new Date(), "yyyy-MM")));
|
||||||
@ -308,8 +359,7 @@ public class WorkerTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (xzWorkerSafeWatchConfig.getType().equals("4")) {
|
if (type.equals("4")) {
|
||||||
Integer dayNum = xzWorkerSafeWatchConfig.getDayNum();
|
|
||||||
List<WorkerMonthAttendanceStatistics> list1 = workerMonthAttendanceStatisticsService.list(Wrappers.<WorkerMonthAttendanceStatistics>
|
List<WorkerMonthAttendanceStatistics> list1 = workerMonthAttendanceStatisticsService.list(Wrappers.<WorkerMonthAttendanceStatistics>
|
||||||
lambdaQuery().eq(WorkerMonthAttendanceStatistics::getProjectSn, project.getProjectSn())
|
lambdaQuery().eq(WorkerMonthAttendanceStatistics::getProjectSn, project.getProjectSn())
|
||||||
.eq(WorkerMonthAttendanceStatistics::getQueryTime, DateUtil.format(new Date(), "yyyy-MM")));
|
.eq(WorkerMonthAttendanceStatistics::getQueryTime, DateUtil.format(new Date(), "yyyy-MM")));
|
||||||
@ -329,25 +379,41 @@ public class WorkerTask {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Map<String, Object> requestParam = new HashMap<>();
|
if (personSn.size() > 0) {
|
||||||
requestParam.put("personSns", personSn);
|
Map<String, Object> requestParam = new HashMap<>();
|
||||||
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(new Page<>(-1, -1), requestParam);
|
requestParam.put("personSns", personSn);
|
||||||
for (WorkerInfo workerInfo : workerInfoList) {
|
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(new Page<>(-1, -1), requestParam);
|
||||||
XzWorkerSafeWatchAlarm xzWorkerSafeWatchAlarm = new XzWorkerSafeWatchAlarm();
|
for (WorkerInfo workerInfo : workerInfoList) {
|
||||||
xzWorkerSafeWatchAlarm.setWorkerId(workerInfo.getId());
|
XzWorkerSafeWatchAlarm xzWorkerSafeWatchAlarm = new XzWorkerSafeWatchAlarm();
|
||||||
xzWorkerSafeWatchAlarm.setWorkerName(workerInfo.getWorkerName());
|
xzWorkerSafeWatchAlarm.setWorkerId(workerInfo.getId());
|
||||||
xzWorkerSafeWatchAlarm.setDeptName(workerInfo.getDepartmentName() + workerInfo.getTeamName());
|
xzWorkerSafeWatchAlarm.setWorkerName(workerInfo.getWorkerName());
|
||||||
xzWorkerSafeWatchAlarm.setEnterpriseName(workerInfo.getEnterpriseName());
|
String deptName = workerInfo.getDepartmentName() == null ? "" : workerInfo.getDepartmentName();
|
||||||
xzWorkerSafeWatchAlarm.setAlarmTime(new Date());
|
String teamName = workerInfo.getTeamName() == null ? "" : workerInfo.getTeamName();
|
||||||
xzWorkerSafeWatchAlarm.setType(type);
|
xzWorkerSafeWatchAlarm.setDeptName(deptName + teamName);
|
||||||
alarmList.add(xzWorkerSafeWatchAlarm);
|
xzWorkerSafeWatchAlarm.setEnterpriseName(workerInfo.getEnterpriseName());
|
||||||
|
xzWorkerSafeWatchAlarm.setAlarmTime(new Date());
|
||||||
|
xzWorkerSafeWatchAlarm.setType(type);
|
||||||
|
xzWorkerSafeWatchAlarm.setProjectSn(project.getProjectSn());
|
||||||
|
xzWorkerSafeWatchAlarm.setDayNum(dayNum);
|
||||||
|
alarmList.add(xzWorkerSafeWatchAlarm);
|
||||||
|
|
||||||
Notice notice = new Notice();
|
Long id = xzWorkerSafeWatchConfig.getId();
|
||||||
notice.setType("35");
|
|
||||||
notice.setMsg("");
|
List<String> userIds = Arrays.asList(xzWorkerSafeWatchManagerService.list(Wrappers.<XzWorkerSafeWatchManager>lambdaQuery()
|
||||||
notice.setTitle("");
|
.eq(XzWorkerSafeWatchManager::getWatchConfigId, id))
|
||||||
notice.setIsRead(0);
|
.stream().map(l -> l.getUserId()).collect(Collectors.joining(",")).split(","));
|
||||||
noticeList.add(notice);
|
for (String userId : userIds) {
|
||||||
|
Notice notice = new Notice();
|
||||||
|
notice.setType("35");
|
||||||
|
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);
|
xzWorkerSafeWatchAlarmService.saveBatch(alarmList);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user