安全评分改动
This commit is contained in:
parent
b529d8282b
commit
a0acb5fcab
@ -230,7 +230,7 @@ public class HiddenDangerInspectRecordServiceImpl extends ServiceImpl<HiddenDang
|
||||
vo.setProjectSn(hiddenDangerInspectRecord.getProjectSn());
|
||||
vo.setWorkerId(workerInfo.getId());
|
||||
vo.setTypeName(hiddenDangerInspectRecord.getCheckItem());
|
||||
vo.setDeductScore(item.getDeductScore());
|
||||
vo.setDeductScore(-item.getDeductScore());
|
||||
vo.setType(1);
|
||||
vo.setCreateDate(new Date());
|
||||
vo.setCurScore(workerInfo.getSafeScore() - item.getDeductScore() >= 0 ? workerInfo.getSafeScore() - item.getDeductScore() : 0);
|
||||
|
||||
@ -125,7 +125,7 @@ public class ExamPaperController {
|
||||
if (examPaperEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = examPaperService.updateById(examPaper);
|
||||
boolean ok = examPaperService.updateInfo(examPaper);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
|
||||
@ -81,6 +81,43 @@ public class ExamTrainRecordController {
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "教育培训记录信息管理", operType = "分页查询", operDesc = "分页列表查询教育培训记录信息信息")
|
||||
@ApiOperation(value = " 分页列表查询教育培训记录信息信息", notes = "分页列表查询教育培训记录信息信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
|
||||
})
|
||||
@PostMapping(value = "/examRecordPage")
|
||||
public Result<IPage<ExamTrainRecordVo>> examRecordPage(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<ExamTrainRecord> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamTrainRecord.class, map);
|
||||
Page<ExamTrainRecord> page = PageUtil.getPage(map);
|
||||
IPage<ExamTrainRecordVo> pageList = examTrainRecordService.examPageList(page, queryWrapper);
|
||||
return Result.success(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@OperLog(operModul = "教育培训记录信息管理", operType = "分页查询", operDesc = "分页列表查询教育培训记录信息信息")
|
||||
@ApiOperation(value = " 分页列表查询教育培训记录信息信息", notes = "分页列表查询教育培训记录信息信息", httpMethod = "POST")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "pageNo", value = "页数", paramType = "body", required = true, defaultValue = "1", dataType = "Integer"),
|
||||
@ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "body", required = true, defaultValue = "10", dataType = "Integer")
|
||||
})
|
||||
@PostMapping(value = "/examRecordList")
|
||||
public Result<List<ExamTrainRecordVo>> examRecordList(@ApiIgnore @RequestBody Map<String, Object> map) {
|
||||
QueryWrapper<ExamTrainRecord> queryWrapper = QueryGenerator.initPageQueryWrapper(ExamTrainRecord.class, map);
|
||||
IPage<ExamTrainRecordVo> pageList = examTrainRecordService.examPageList(new Page(-1, -1), queryWrapper);
|
||||
return Result.success(pageList.getRecords());
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
|
||||
@ -21,4 +21,6 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
public interface ExamTrainRecordMapper extends BaseMapper<ExamTrainRecord> {
|
||||
|
||||
Page<ExamTrainRecordVo> pageList(Page page, @Param(Constants.WRAPPER)Wrapper<ExamTrainRecord> wrapper);
|
||||
|
||||
Page<ExamTrainRecordVo> examPageList(Page page, @Param(Constants.WRAPPER)Wrapper<ExamTrainRecord> wrapper);
|
||||
}
|
||||
|
||||
@ -9,4 +9,13 @@
|
||||
left join exam_course c on et.course_id = c.id) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="examPageList" resultType="com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo">
|
||||
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
|
||||
where et.exam_paper_id IS NOT NULL) a
|
||||
${ew.customSqlSegment}
|
||||
</select>
|
||||
</mapper>
|
||||
@ -23,6 +23,8 @@ public interface IExamPaperService extends IService<ExamPaper> {
|
||||
|
||||
boolean saveInfo(ExamPaperVo examPaperVo);
|
||||
|
||||
boolean updateInfo(ExamPaper examPaper);
|
||||
|
||||
ExamPaperVo queryDetailById(Long examId);
|
||||
|
||||
List<ExamQuestionBankVo> queryQuestionById(Long examId);
|
||||
|
||||
@ -19,6 +19,8 @@ public interface IExamTrainRecordService extends IService<ExamTrainRecord> {
|
||||
|
||||
Page<ExamTrainRecordVo> pageList(Page page, Wrapper<ExamTrainRecord> wrapper);
|
||||
|
||||
Page<ExamTrainRecordVo> examPageList(Page page, Wrapper<ExamTrainRecord> wrapper);
|
||||
|
||||
ExamTrainRecord submit(List<ExamAnswerQuestion> examAnswerQuestionList);
|
||||
|
||||
void submitStudy(ExamCourseRecord examCourseRecord);
|
||||
|
||||
@ -75,6 +75,18 @@ public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateInfo(ExamPaper examPaper) {
|
||||
if (StringUtils.isNotBlank(examPaper.getQuestions())) {
|
||||
List<Long> list = Arrays.asList(examPaper.getQuestions().split(",")).stream().map(Long::new).collect(Collectors.toList());
|
||||
List<ExamQuestionBank> examQuestionBankList = examQuestionBankService.listByIds(list);
|
||||
int sum = examQuestionBankList.stream().mapToInt(e -> e.getScore()).sum();
|
||||
examPaper.setTotalScore(sum);
|
||||
}
|
||||
boolean flag = this.updateById(examPaper);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamPaperVo queryDetailById(Long examId) {
|
||||
ExamPaper byId = this.getById(examId);
|
||||
|
||||
@ -60,6 +60,11 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
return baseMapper.pageList(page, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<ExamTrainRecordVo> examPageList(Page page, Wrapper<ExamTrainRecord> wrapper) {
|
||||
return baseMapper.examPageList(page, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ExamTrainRecord submit(List<ExamAnswerQuestion> examAnswerQuestionList) {
|
||||
ExamTrainRecord examTrainRecord = this.getById(examAnswerQuestionList.get(0).getTrainRecordId());
|
||||
@ -98,13 +103,20 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
@Override
|
||||
public void submitStudy(ExamCourseRecord examCourseRecord) {
|
||||
ExamTrain examTrain = examTrainService.getById(examCourseRecord.getTrainId());
|
||||
ExamCourseRecord courseRecord = examCourseRecordService.getOne(Wrappers.<ExamCourseRecord>lambdaQuery()
|
||||
.eq(ExamCourseRecord::getTrainId, examCourseRecord.getTrainId())
|
||||
.eq(ExamCourseRecord::getWorkerId, examCourseRecord.getWorkerId()));
|
||||
if (courseRecord.getNumber() != null && courseRecord.getNumber() > 0) {
|
||||
return;
|
||||
}
|
||||
LambdaUpdateWrapper<ExamCourseRecord> wrapper = Wrappers.<ExamCourseRecord>lambdaUpdate();
|
||||
wrapper.set(ExamCourseRecord::getBeginTime, examCourseRecord.getBeginTime());
|
||||
wrapper.set(ExamCourseRecord::getEndTime, examCourseRecord.getEndTime());
|
||||
wrapper.set(ExamCourseRecord::getNumber, 1);
|
||||
// wrapper.eq(ExamCourseRecord::getCourseId, examCourseRecord.getCourseId());
|
||||
wrapper.eq(ExamCourseRecord::getTrainId, examCourseRecord.getTrainId());
|
||||
examCourseRecordService.update(wrapper);
|
||||
wrapper.eq(ExamCourseRecord::getWorkerId, examCourseRecord.getWorkerId());
|
||||
boolean update = examCourseRecordService.update(wrapper);
|
||||
//TODO 积分管理
|
||||
List<ExamPointConfig> list = examPointConfigService.list(Wrappers.<ExamPointConfig>lambdaQuery().eq(ExamPointConfig::getProjectSn, examTrain.getProjectSn()));
|
||||
if (list.size() > 0) {
|
||||
@ -114,38 +126,31 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
point("6", list, examCourseRecord.getWorkerId(), "没在规定时间内完成" + examTrain.getName() + "学习任务,扣");
|
||||
}
|
||||
}
|
||||
if (examTrain.getExamPaperId() == null) {
|
||||
ExamTrainRecord examTrainRecord = this.getOne(Wrappers.<ExamTrainRecord>lambdaQuery()
|
||||
.eq(ExamTrainRecord::getTrainId, courseRecord.getTrainId())
|
||||
.eq(ExamTrainRecord::getWorkerId, courseRecord.getWorkerId()));
|
||||
examTrainRecord.setIsPass(1);
|
||||
this.updateById(examTrainRecord);
|
||||
}
|
||||
}
|
||||
|
||||
private void point(String dictData, List<ExamPointConfig> list, Long workerId, String desc) {
|
||||
List<ExamPointConfig> collect = list.stream().filter(l -> l.getDictData().equals(dictData)).collect(Collectors.toList());
|
||||
int score = 0;
|
||||
int flag = -1;
|
||||
if (collect.size() > 0) {
|
||||
if (collect.get(0).getType().equals("+")) {
|
||||
//加分
|
||||
score = collect.get(0).getPoint();
|
||||
flag = 1;
|
||||
} else {
|
||||
//扣分
|
||||
score = collect.get(0).getPoint();
|
||||
flag = 0;
|
||||
}
|
||||
}
|
||||
WorkerInfo workerInfo = workerInfoService.getById(workerId);
|
||||
LambdaUpdateWrapper<WorkerInfo> wrapper = Wrappers.<WorkerInfo>lambdaUpdate();
|
||||
if (flag == 1) {
|
||||
wrapper.set(WorkerInfo::getSafeScore, workerInfo.getSafeScore() + score);
|
||||
} else {
|
||||
if (workerInfo.getSafeScore() < score) {
|
||||
wrapper.set(WorkerInfo::getSafeScore, 0);
|
||||
} else {
|
||||
wrapper.set(WorkerInfo::getSafeScore, workerInfo.getSafeScore() - score);
|
||||
score = -collect.get(0).getPoint();
|
||||
}
|
||||
}
|
||||
//扣分
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("id", workerInfo.getId());
|
||||
map.put("deductScore", score);
|
||||
map.put("id", workerId);
|
||||
map.put("deductScore", -score);
|
||||
workerInfoService.updateScoreSendAuth(map);
|
||||
XzDeductScoreRecord xzDeductScoreRecord = new XzDeductScoreRecord();
|
||||
xzDeductScoreRecord.setCreateDate(new Date());
|
||||
@ -153,6 +158,8 @@ public class ExamTrainRecordServiceImpl extends ServiceImpl<ExamTrainRecordMappe
|
||||
DateUtil.format(new Date(), "yyyy年MM月dd日HH:mm:ss"), Double.valueOf(score)));
|
||||
xzDeductScoreRecord.setDeductScore(Double.valueOf(score));
|
||||
xzDeductScoreRecord.setCurScore(workerInfoService.getById(workerId).getSafeScore());
|
||||
xzDeductScoreRecord.setWorkerId(workerId);
|
||||
xzDeductScoreRecord.setProjectSn(collect.get(0).getProjectSn());
|
||||
xzDeductScoreRecordService.save(xzDeductScoreRecord);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.zhgd.xmgl.modules.exam.entity.ExamTrain;
|
||||
import com.zhgd.xmgl.modules.exam.entity.ExamTrainRecord;
|
||||
import com.zhgd.xmgl.modules.exam.mapper.ExamTrainMapper;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamCourseRecordService;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamPaperService;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainRecordService;
|
||||
import com.zhgd.xmgl.modules.exam.service.IExamTrainService;
|
||||
import com.zhgd.xmgl.modules.exam.vo.ExamTrainRecordVo;
|
||||
@ -37,6 +38,9 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
||||
@Autowired
|
||||
private IExamTrainRecordService examTrainRecordService;
|
||||
|
||||
@Autowired
|
||||
private IExamPaperService examPaperService;
|
||||
|
||||
@Autowired
|
||||
private IExamCourseRecordService examCourseRecordService;
|
||||
|
||||
@ -62,7 +66,12 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
||||
@Override
|
||||
public boolean saveInfo(ExamTrain examTrain) {
|
||||
List<ExamTrainRecord> recordList = examTrain.getExamTrainRecordList();
|
||||
Integer passLine = 0;
|
||||
if (examTrain.getExamPaperId() != null) {
|
||||
passLine = examPaperService.getById(examTrain.getExamPaperId()).getPassLine();
|
||||
}
|
||||
UserInfo user = SecurityUtils.getUser();
|
||||
examTrain.setPassLine(passLine);
|
||||
examTrain.setCreateBy(user.getUserId().toString());
|
||||
examTrain.setWorkerNum(recordList.size());
|
||||
boolean flag = this.save(examTrain);
|
||||
@ -74,18 +83,21 @@ public class ExamTrainServiceImpl extends ServiceImpl<ExamTrainMapper, ExamTrain
|
||||
r.setProjectSn(examTrain.getProjectSn());
|
||||
r.setCreateBy(examTrain.getCreateBy());
|
||||
r.setTrainId(examTrain.getId());
|
||||
|
||||
ExamCourseRecord examCourseRecord = new ExamCourseRecord();
|
||||
examCourseRecord.setProjectSn(examTrain.getProjectSn());
|
||||
examCourseRecord.setCreateBy(examTrain.getCreateBy());
|
||||
examCourseRecord.setCourseId(examTrain.getCourseId());
|
||||
examCourseRecord.setNumber(0);
|
||||
examCourseRecord.setWorkerId(r.getWorkerId());
|
||||
examCourseRecord.setWorkerName(r.getWorkerName());
|
||||
examCourseRecord.setWorkerCard(r.getWorkerCard());
|
||||
examCourseRecord.setTrainId(examTrain.getId());
|
||||
examCourseRecordList.add(examCourseRecord);
|
||||
});
|
||||
if (examTrain.getCourseId() != null) {
|
||||
recordList.forEach(r -> {
|
||||
ExamCourseRecord examCourseRecord = new ExamCourseRecord();
|
||||
examCourseRecord.setProjectSn(examTrain.getProjectSn());
|
||||
examCourseRecord.setCreateBy(examTrain.getCreateBy());
|
||||
examCourseRecord.setCourseId(examTrain.getCourseId());
|
||||
examCourseRecord.setNumber(0);
|
||||
examCourseRecord.setWorkerId(r.getWorkerId());
|
||||
examCourseRecord.setWorkerName(r.getWorkerName());
|
||||
examCourseRecord.setWorkerCard(r.getWorkerCard());
|
||||
examCourseRecord.setTrainId(examTrain.getId());
|
||||
examCourseRecordList.add(examCourseRecord);
|
||||
});
|
||||
}
|
||||
examTrainRecordService.saveBatch(recordList);
|
||||
examCourseRecordService.saveBatch(examCourseRecordList);
|
||||
}
|
||||
|
||||
@ -349,7 +349,7 @@ public class QualityInspectionRecordServiceImpl extends ServiceImpl<QualityInspe
|
||||
vo.setProjectSn(hiddenDangerInspectRecord.getProjectSn());
|
||||
vo.setWorkerId(workerInfo.getId());
|
||||
vo.setTypeName(item.getContent());
|
||||
vo.setDeductScore(item.getDeductScore());
|
||||
vo.setDeductScore(-item.getDeductScore());
|
||||
vo.setType(3);
|
||||
vo.setCreateDate(new Date());
|
||||
vo.setCurScore(workerInfo.getSafeScore() - item.getDeductScore() >= 0 ? workerInfo.getSafeScore() - item.getDeductScore() : 0);
|
||||
|
||||
@ -517,7 +517,7 @@ public class AiAnalyseHardWareAlarmRecordServiceImpl extends ServiceImpl<AiAnaly
|
||||
if (item != null) {
|
||||
vo.setTypeName(item.getName());
|
||||
}
|
||||
vo.setDeductScore(deductScore);
|
||||
vo.setDeductScore(-deductScore);
|
||||
vo.setType(2);
|
||||
vo.setCurScore(wi.getSafeScore());
|
||||
vo.setCreateDate(new Date());
|
||||
|
||||
@ -363,7 +363,7 @@ public class XzSecurityXzSecurityQualityInspectionRecordServiceImpl extends Serv
|
||||
vo.setProjectSn(hiddenDangerInspectRecord.getProjectSn());
|
||||
vo.setWorkerId(workerInfo.getId());
|
||||
vo.setTypeName(item.getContent());
|
||||
vo.setDeductScore(item.getDeductScore());
|
||||
vo.setDeductScore(-item.getDeductScore());
|
||||
vo.setType(1);
|
||||
vo.setCreateDate(new Date());
|
||||
vo.setCurScore(workerInfo.getSafeScore() - item.getDeductScore() >= 0 ? workerInfo.getSafeScore() - item.getDeductScore() : 0);
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.zhgd.xmgl.modules.xz.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchConfig;
|
||||
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchConfigService;
|
||||
@ -102,7 +103,12 @@ public class XzWorkerSafeWatchConfigController {
|
||||
@ApiOperation(value = " 添加安全履职配置信息信息", notes = "添加安全履职配置信息信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody XzWorkerSafeWatchConfig xzWorkerSafeWatchConfig) {
|
||||
Result<XzWorkerSafeWatchConfig> result = new Result<XzWorkerSafeWatchConfig>();
|
||||
XzWorkerSafeWatchConfig workerSafeWatchConfig = xzWorkerSafeWatchConfigService.getOne(Wrappers.<XzWorkerSafeWatchConfig>lambdaQuery()
|
||||
.eq(XzWorkerSafeWatchConfig::getProjectSn, xzWorkerSafeWatchConfig.getProjectSn())
|
||||
.eq(XzWorkerSafeWatchConfig::getType, xzWorkerSafeWatchConfig.getType()));
|
||||
if (workerSafeWatchConfig != null) {
|
||||
return Result.error("已存在该配置!");
|
||||
}
|
||||
xzWorkerSafeWatchConfigService.save(xzWorkerSafeWatchConfig);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -122,11 +128,19 @@ public class XzWorkerSafeWatchConfigController {
|
||||
if (xzWorkerSafeWatchConfigEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = xzWorkerSafeWatchConfigService.updateById(xzWorkerSafeWatchConfig);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
XzWorkerSafeWatchConfig workerSafeWatchConfig = xzWorkerSafeWatchConfigService.getOne(Wrappers.<XzWorkerSafeWatchConfig>lambdaQuery()
|
||||
.eq(XzWorkerSafeWatchConfig::getProjectSn, xzWorkerSafeWatchConfig.getProjectSn())
|
||||
.eq(XzWorkerSafeWatchConfig::getType, xzWorkerSafeWatchConfig.getType())
|
||||
.ne(XzWorkerSafeWatchConfig::getId, xzWorkerSafeWatchConfig.getId()));
|
||||
if (workerSafeWatchConfig != null) {
|
||||
result.error500("已存在该配置!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
boolean ok = xzWorkerSafeWatchConfigService.updateById(xzWorkerSafeWatchConfig);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
package com.zhgd.xmgl.modules.xz.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.zhgd.annotation.OperLog;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchConfig;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchManager;
|
||||
import com.zhgd.xmgl.modules.xz.service.IXzWorkerSafeWatchManagerService;
|
||||
import com.zhgd.xmgl.util.PageUtil;
|
||||
@ -84,7 +86,12 @@ public class XzWorkerSafeWatchManagerController {
|
||||
@ApiOperation(value = " 添加安全履职报警推送人信息信息", notes = "添加安全履职报警推送人信息信息", httpMethod = "POST")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<Object> add(@RequestBody XzWorkerSafeWatchManager xzWorkerSafeWatchManager) {
|
||||
Result<XzWorkerSafeWatchManager> result = new Result<XzWorkerSafeWatchManager>();
|
||||
XzWorkerSafeWatchManager workerSafeWatchManager = xzWorkerSafeWatchManagerService.getOne(Wrappers.<XzWorkerSafeWatchManager>lambdaQuery()
|
||||
.eq(XzWorkerSafeWatchManager::getWatchConfigId, xzWorkerSafeWatchManager.getWatchConfigId())
|
||||
.eq(XzWorkerSafeWatchManager::getEnterpriseId, xzWorkerSafeWatchManager.getEnterpriseId()));
|
||||
if (workerSafeWatchManager != null) {
|
||||
return Result.error("已存在该企业信息!");
|
||||
}
|
||||
xzWorkerSafeWatchManagerService.save(xzWorkerSafeWatchManager);
|
||||
return Result.success("添加成功!");
|
||||
}
|
||||
@ -104,11 +111,19 @@ public class XzWorkerSafeWatchManagerController {
|
||||
if (xzWorkerSafeWatchManagerEntity == null) {
|
||||
result.error500("未找到对应实体");
|
||||
} else {
|
||||
boolean ok = xzWorkerSafeWatchManagerService.updateById(xzWorkerSafeWatchManager);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
XzWorkerSafeWatchManager workerSafeWatchManager = xzWorkerSafeWatchManagerService.getOne(Wrappers.<XzWorkerSafeWatchManager>lambdaQuery()
|
||||
.eq(XzWorkerSafeWatchManager::getWatchConfigId, xzWorkerSafeWatchManager.getWatchConfigId())
|
||||
.eq(XzWorkerSafeWatchManager::getEnterpriseId, xzWorkerSafeWatchManager.getEnterpriseId())
|
||||
.ne(XzWorkerSafeWatchManager::getId, xzWorkerSafeWatchManager.getId()));
|
||||
if (workerSafeWatchManager != null) {
|
||||
result.error500("已存在该企业信息");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
boolean ok = xzWorkerSafeWatchManagerService.updateById(xzWorkerSafeWatchManager);
|
||||
if (ok) {
|
||||
result.success("修改成功!");
|
||||
} else {
|
||||
result.success("操作失败!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +62,12 @@ public class XzWorkerSafeWatchAlarm implements Serializable {
|
||||
@Excel(name = "姓名", width = 15)
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String workerName;
|
||||
/**
|
||||
* 企业ID
|
||||
*/
|
||||
@Excel(name = "企业ID", width = 15)
|
||||
@ApiModelProperty(value = "企业ID")
|
||||
private Long enterpriseId;
|
||||
/**
|
||||
* 企业名称
|
||||
*/
|
||||
|
||||
@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.xz.mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.zhgd.annotation.DataScope;
|
||||
import com.zhgd.xmgl.modules.xz.entity.XzWorkerSafeWatchAlarm;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
* @version: V1.0
|
||||
*/
|
||||
@Mapper
|
||||
@DataScope
|
||||
public interface XzWorkerSafeWatchAlarmMapper extends BaseMapper<XzWorkerSafeWatchAlarm> {
|
||||
|
||||
}
|
||||
|
||||
@ -48,6 +48,10 @@ public class ExamTask {
|
||||
@Autowired
|
||||
private IExamTrainRecordService examTrainRecordService;
|
||||
|
||||
@Autowired
|
||||
private IExamNoticeService examNoticeService;
|
||||
|
||||
|
||||
@Scheduled(cron = "0 0/1 * * * ?")
|
||||
public void examNotice() {
|
||||
List<Project> list = projectService.list();
|
||||
@ -73,17 +77,13 @@ public class ExamTask {
|
||||
noticeList.add(examNotice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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) {
|
||||
List<ExamCourseRecord> examCourseRecords = examCourseRecordService.list(Wrappers.<ExamCourseRecord>lambdaQuery()
|
||||
.eq(ExamCourseRecord::getTrainId, examTrainList.get(j).getId()));
|
||||
for (int i2 = 0; i2 < examCourseRecords.size(); i2++) {
|
||||
if (examCourseRecords.get(i2).getNumber() == null || examCourseRecords.get(i2).getNumber() == 0) {
|
||||
ExamNotice examNotice = new ExamNotice();
|
||||
examNotice.setWorkerId(examCourseRecords.get(i1).getWorkerId().toString());
|
||||
examNotice.setWorkerName(examCourseRecords.get(i1).getWorkerName());
|
||||
examNotice.setWorkerId(examCourseRecords.get(i2).getWorkerId().toString());
|
||||
examNotice.setWorkerName(examCourseRecords.get(i2).getWorkerName());
|
||||
examNotice.setType(1);
|
||||
examNotice.setContent("参加安全教育课程学习");
|
||||
examNotice.setProjectSn(list.get(i).getProjectSn());
|
||||
@ -136,14 +136,15 @@ public class ExamTask {
|
||||
// }
|
||||
}
|
||||
}
|
||||
examNoticeService.saveBatch(noticeList);
|
||||
}
|
||||
|
||||
private DateTime getTime(int type, int num){
|
||||
DateTime dateTime = null;
|
||||
if (type == 1) {
|
||||
dateTime = DateUtil.offsetHour(new Date(), -num);
|
||||
dateTime = DateUtil.offsetHour(new Date(), num);
|
||||
} else if (type == 2) {
|
||||
dateTime = DateUtil.offsetDay(new Date(), -num);
|
||||
dateTime = DateUtil.offsetDay(new Date(), num);
|
||||
}
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@ package com.zhgd.xmgl.task;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
@ -382,8 +383,12 @@ public class WorkerTask {
|
||||
if (personSn.size() > 0) {
|
||||
Map<String, Object> requestParam = new HashMap<>();
|
||||
requestParam.put("personSns", personSn);
|
||||
requestParam.put("inserviceType", 1);
|
||||
List<WorkerInfo> workerInfoList = workerInfoMapper.selectWorkerInfoList(new Page<>(-1, -1), requestParam);
|
||||
for (WorkerInfo workerInfo : workerInfoList) {
|
||||
if (workerInfo.getEnterpriseId() == null) {
|
||||
continue;
|
||||
}
|
||||
XzWorkerSafeWatchAlarm xzWorkerSafeWatchAlarm = new XzWorkerSafeWatchAlarm();
|
||||
xzWorkerSafeWatchAlarm.setWorkerId(workerInfo.getId());
|
||||
xzWorkerSafeWatchAlarm.setWorkerName(workerInfo.getWorkerName());
|
||||
@ -395,6 +400,7 @@ public class WorkerTask {
|
||||
xzWorkerSafeWatchAlarm.setType(type);
|
||||
xzWorkerSafeWatchAlarm.setProjectSn(project.getProjectSn());
|
||||
xzWorkerSafeWatchAlarm.setDayNum(dayNum);
|
||||
xzWorkerSafeWatchAlarm.setEnterpriseId(workerInfo.getEnterpriseId());
|
||||
alarmList.add(xzWorkerSafeWatchAlarm);
|
||||
|
||||
Long id = xzWorkerSafeWatchConfig.getId();
|
||||
@ -403,15 +409,17 @@ public class WorkerTask {
|
||||
.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(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);
|
||||
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.setTitle("人员安全履职预警提醒");
|
||||
notice.setIsRead(0);
|
||||
notice.setAccountId(Long.valueOf(userId));
|
||||
notice.setSendTime(DateUtil.formatDateTime(new Date()));
|
||||
noticeList.add(notice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user