package com.ruoyi.project.tr.hiddenDangerCheckPoint.service.impl;
|
|
import com.ruoyi.common.utils.text.Convert;
|
import com.ruoyi.doublePrevention.entity.CJReport.CJdto.Data;
|
import com.ruoyi.framework.web.service.JpushService;
|
import com.ruoyi.project.system.user.domain.User;
|
import com.ruoyi.project.system.user.service.IUserService;
|
import com.ruoyi.project.tr.hiddenDangerCheck.domain.HiddenDangerCheck;
|
import com.ruoyi.project.tr.hiddenDangerCheck.mapper.HiddenDangerCheckMapper;
|
import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.BaseCheckPointDTO;
|
import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint;
|
import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.RiskCheckPointDTO;
|
import com.ruoyi.project.tr.hiddenDangerCheckPoint.mapper.HiddenDangerCheckPointMapper;
|
import com.ruoyi.project.tr.hiddenDangerCheckPoint.service.IHiddenDangerCheckPointService;
|
import com.ruoyi.project.tr.report.mapper.ReportMapper;
|
import com.ruoyi.project.tr.report.service.ReportService;
|
import com.ruoyi.project.tr.riskCheckPoint.domain.RiskCheckPoint;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
|
import java.util.Date;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
/**
|
* 隐患排查检查点信息Service业务层处理
|
*
|
*
|
* @date 2020-05-08
|
*/
|
@Service
|
public class HiddenDangerCheckPointServiceImpl implements IHiddenDangerCheckPointService
|
{
|
@Autowired
|
private HiddenDangerCheckPointMapper hiddenDangerCheckPointMapper;
|
|
|
@Autowired
|
private HiddenDangerCheckMapper hiddenDangerCheckMapper;
|
|
@Autowired
|
private ReportService reportService;
|
|
@Autowired
|
private ReportMapper reportMapper;
|
|
@Autowired
|
JpushService jpushService;
|
|
|
@Autowired
|
IUserService userService;//用户Service
|
|
|
/**
|
* 查询隐患排查检查点信息
|
*
|
* @param id 隐患排查检查点信息ID
|
* @return 隐患排查检查点信息
|
*/
|
@Override
|
public HiddenDangerCheckPoint selectHiddenDangerCheckPointById(Long id)
|
{
|
return hiddenDangerCheckPointMapper.selectHiddenDangerCheckPointById(id);
|
}
|
|
/**
|
* 查询隐患排查检查点信息列表
|
*
|
* @param hiddenDangerCheckPoint 隐患排查检查点信息
|
* @return 隐患排查检查点信息
|
*/
|
@Override
|
public List<HiddenDangerCheckPoint> selectHiddenDangerCheckPointList(HiddenDangerCheckPoint hiddenDangerCheckPoint)
|
{
|
return hiddenDangerCheckPointMapper.selectHiddenDangerCheckPointList(hiddenDangerCheckPoint);
|
}
|
|
/**
|
* 查询隐患信息列表
|
|
*/
|
@Override
|
public List<HiddenDangerCheckPoint> selectHiddenDangerCheckPointListNew(HiddenDangerCheckPoint hiddenDangerCheckPoint) {
|
return hiddenDangerCheckPointMapper.selectHiddenDangerCheckPointListNew(hiddenDangerCheckPoint);
|
}
|
|
|
/**
|
* 新增隐患排查检查点信息
|
*
|
* @param hiddenDangerCheckPoint 隐患排查检查点信息
|
* @return 结果
|
*/
|
@Override
|
public int insertHiddenDangerCheckPoint(HiddenDangerCheckPoint hiddenDangerCheckPoint)
|
{
|
return hiddenDangerCheckPointMapper.insertHiddenDangerCheckPoint(hiddenDangerCheckPoint);
|
}
|
|
/**
|
* 修改隐患排查检查点信息
|
*
|
* @param hiddenDangerCheckPoint 隐患排查检查点信息
|
* @return 结果
|
*/
|
@Override
|
public int updateHiddenDangerCheckPoint(HiddenDangerCheckPoint hiddenDangerCheckPoint)
|
{
|
return hiddenDangerCheckPointMapper.updateHiddenDangerCheckPoint(hiddenDangerCheckPoint);
|
}
|
|
/**
|
* 删除隐患排查检查点信息对象
|
*
|
* @param ids 需要删除的数据ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteHiddenDangerCheckPointByIds(String ids)
|
{
|
return hiddenDangerCheckPointMapper.deleteHiddenDangerCheckPointByIds(Convert.toStrArray(ids));
|
}
|
|
/**
|
* 删除隐患排查检查点信息信息
|
*
|
* @param id 隐患排查检查点信息ID
|
* @return 结果
|
*/
|
@Override
|
public int deleteHiddenDangerCheckPointById(Long id)
|
{
|
return hiddenDangerCheckPointMapper.deleteHiddenDangerCheckPointById(id);
|
}
|
|
|
/**
|
* 查询检查点(根据隐患排查id)
|
*
|
* @param riskCheckPointDTO
|
* @return
|
*/
|
@Override
|
public List<RiskCheckPointDTO> selectRiskCheckPointListByCheckId(RiskCheckPointDTO riskCheckPointDTO)
|
{
|
return hiddenDangerCheckPointMapper.selectRiskCheckPointListByCheckId(riskCheckPointDTO);
|
}
|
|
/**
|
* 查询基础清单检查点(根据隐患排查id)
|
*
|
* @param baseCheckPointDTO
|
* @return
|
*/
|
@Override
|
public List<BaseCheckPointDTO> selectBaseCheckPointListByCheckId(BaseCheckPointDTO baseCheckPointDTO)
|
{
|
return hiddenDangerCheckPointMapper.selectBaseCheckPointListByCheckId(baseCheckPointDTO);
|
}
|
|
|
//查询未执行任务总数量
|
public void getTaskCountTotal(Long userId) {
|
int total = 0;
|
User user = userService.selectUserById(userId);
|
Long companyId = user.getCompanyId();
|
int reviewCount = reportMapper.selectRiskReviewCount(userId);
|
int troubleCheckCount = reportMapper.selectTroubleCheckCount(userId);
|
int troubleReportCount = reportMapper.selectTroubleReportCount(userId);
|
int troubleExamineCount = reportMapper.selectTroubleExamineCount(userId);
|
int troubleRectifyCount = reportMapper.selectTroubleRectifyCount(userId);
|
int troubleAcceptCount = reportMapper.selectTroubleAcceptCount(userId);
|
|
|
HiddenDangerCheck hiddenDangerCheck = new HiddenDangerCheck();
|
hiddenDangerCheck.setScheduleCheckUserId(userId);//定时任务排查执行人
|
hiddenDangerCheck.setScheduleCheckStatus("0");//定时任务排查状态(未排查)
|
List<HiddenDangerCheck> resultList = hiddenDangerCheckMapper.selectHiddenDangerCheckList(hiddenDangerCheck);
|
|
total = reviewCount+troubleCheckCount+troubleReportCount+troubleExamineCount+troubleRectifyCount+troubleAcceptCount
|
+resultList.size();
|
|
String title = "您有新消息,请注意查收";
|
String content = "【双预防】您有新的未执行任务,请注意查收。";
|
|
Map<String, String> extrasMap = new HashMap<String, String>();
|
extrasMap.put("message", "查询未执行任务总数量");
|
extrasMap.put("methodType", "getTaskCountTotal");
|
extrasMap.put("total",total+"");
|
|
//大文本通知栏样式
|
jpushService.sendCustomPush(title, content, extrasMap, userId.toString());
|
}
|
|
|
/**
|
* 查询by Id
|
*/
|
@Override
|
public HiddenDangerCheckPoint getHiddenDangerCheckPointById(Long dangerCheckPointId) {
|
return hiddenDangerCheckPointMapper.getHiddenDangerCheckPointById(dangerCheckPointId);
|
}
|
|
/**
|
* 查询by CheckId
|
*/
|
|
@Override
|
public List<HiddenDangerCheckPoint> getHiddenDangerCheckPointByCheckId(Long checkId) {
|
return hiddenDangerCheckPointMapper.getHiddenDangerCheckPointByCheckId(checkId);
|
}
|
|
@Override
|
public int rectifyTimeOut(Long id , Date rectifyDeadlineTime) {
|
Date date = new Date();
|
if (rectifyDeadlineTime.getTime() - date.getTime() < 0L){
|
throw new RuntimeException("延期时间设置不合理");
|
}
|
return hiddenDangerCheckPointMapper.rectifyTimeOut(id, rectifyDeadlineTime);
|
}
|
|
@Override
|
public int updateConfirm(HiddenDangerCheckPoint hdcp) {
|
return hiddenDangerCheckPointMapper.updateConfirm(hdcp);
|
}
|
|
@Override
|
public int editDangerLevel(HiddenDangerCheckPoint hdcp) {
|
return hiddenDangerCheckPointMapper.editDangerLevel(hdcp);
|
}
|
|
|
}
|