安全事故bug修改和意见箱bug修改
This commit is contained in:
@ -333,6 +333,9 @@ public class BusComplaintBoxServiceImpl extends ServiceImpl<BusComplaintBoxMappe
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int editStatus(BusComplaintBoxBo bo) {
|
||||
if (bo.getStatus() == null){
|
||||
throw new ServiceException("意见状态不能为空");
|
||||
}
|
||||
BusComplaintBoxVo busComplaintBoxVo = baseMapper.selectVoById(bo.getId());
|
||||
if (busComplaintBoxVo == null){
|
||||
throw new ServiceException("找不到意见!!");
|
||||
@ -343,7 +346,7 @@ public class BusComplaintBoxServiceImpl extends ServiceImpl<BusComplaintBoxMappe
|
||||
LambdaUpdateWrapper<BusComplaintBox> lqw = new LambdaUpdateWrapper<BusComplaintBox>();
|
||||
lqw.set(BusComplaintBox::getStatus, bo.getStatus());
|
||||
lqw.eq(BusComplaintBox::getId, bo.getId());
|
||||
if ("5".equals(busComplaintBoxVo.getStatus())){
|
||||
if ("5".equals(bo.getStatus())){
|
||||
BusComplaintBoxDisposeLogging logging = new BusComplaintBoxDisposeLogging();
|
||||
logging.setComplaintId(bo.getId());
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
@ -351,6 +354,7 @@ public class BusComplaintBoxServiceImpl extends ServiceImpl<BusComplaintBoxMappe
|
||||
if (sysUserVo == null){
|
||||
throw new ServiceException("找不到当前登录用户信息!");
|
||||
}
|
||||
lqw.set(BusComplaintBox::getCurrentDisposeUserId, loginUser.getUserId());
|
||||
logging.setUserId(loginUser.getUserId());
|
||||
logging.setUserName(sysUserVo.getNickName());
|
||||
logging.setAvatar(sysUserVo.getAvatar());
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package org.dromara.safety.accident.controller;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.contractor.domain.vo.contractor.SubContractorManagerVo;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.safety.accident.domain.bo.HseSafetySgdcBo;
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgdcVo;
|
||||
import org.dromara.safety.accident.domain.vo.SgsbCountVo;
|
||||
import org.dromara.safety.accident.service.IHseSafetySgdcService;
|
||||
import org.dromara.system.domain.bo.SysUserBo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全-事故调查
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-05
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/accident/public")
|
||||
public class HseSafetyPublicController extends BaseController {
|
||||
|
||||
private final ISysUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@GetMapping("/getUserList")
|
||||
public TableDataInfo<SysUserVo> list(SysUserBo user, PageQuery pageQuery) {
|
||||
return userService.selectPageUserList(user, pageQuery);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -15,6 +15,10 @@ import org.dromara.common.log.enums.BusinessType;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.contractor.domain.vo.contractor.SubContractorManagerVo;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.project.domain.vo.projectteam.BusProjectTeamForemanVo;
|
||||
import org.dromara.project.service.IBusProjectTeamService;
|
||||
import org.dromara.safety.accident.domain.bo.HseSafetySgdcBo;
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgdcVo;
|
||||
import org.dromara.safety.accident.domain.vo.SgsbCountVo;
|
||||
@ -38,6 +42,32 @@ public class HseSafetySgdcController extends BaseController {
|
||||
|
||||
private final IHseSafetySgdcService hseSafetySgdcService;
|
||||
|
||||
private final IBusProjectTeamService busProjectTeamService;
|
||||
|
||||
private final ISubContractorService contractorService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目id查询项目班组班组长信息列表
|
||||
*/
|
||||
@SaCheckPermission("accident:safetySgdc:edit")
|
||||
@GetMapping("/listForeman/{projectId}")
|
||||
public R<List<BusProjectTeamForemanVo>> listForeman(@NotNull(message = "项目id不能为空")
|
||||
@PathVariable Long projectId) {
|
||||
return R.ok(busProjectTeamService.queryForemanListByProjectId(projectId));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据项目id查询分包方管理人员信息列表
|
||||
*/
|
||||
@SaCheckPermission("accident:safetySgdc:edit")
|
||||
@GetMapping("/listManager/{projectId}")
|
||||
public R<List<SubContractorManagerVo>> listManager(@NotNull(message = "项目id不能为空")
|
||||
@PathVariable Long projectId) {
|
||||
return R.ok(contractorService.queryManagerListByProjectId(projectId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询安全-事故调查列表
|
||||
*/
|
||||
|
||||
@ -44,7 +44,7 @@ public class HseSafetySgzgbhController extends BaseController {
|
||||
/**
|
||||
* 头部数据返回
|
||||
*/
|
||||
@SaCheckPermission("jxzgbh:yhzgbh:list")
|
||||
@SaCheckPermission("accident:safetySgzgbh:list")
|
||||
@GetMapping("/getListHead")
|
||||
public R<HseSafetySgzgbhHeadVo> getListHead(HseSafetySgzgbhBo bo) {
|
||||
return R.ok(hseSafetySgzgbhService.getListHead(bo));
|
||||
|
||||
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 安全-事故调查业务对象 hse_safety_sgdc
|
||||
* 档案-事故调查信息
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-05
|
||||
@ -44,16 +44,19 @@ public class HseSafetySgdcxqReq implements Serializable {
|
||||
* 责任部门
|
||||
*/
|
||||
private Long zrbm;
|
||||
private String zrbmName;
|
||||
|
||||
/**
|
||||
* 主要负责人
|
||||
*/
|
||||
private Long zyfzr;
|
||||
private String zyfzrName;
|
||||
|
||||
/**
|
||||
* 次要负责人
|
||||
*/
|
||||
private Long cyfzr;
|
||||
private String cyfzrName;
|
||||
|
||||
/**
|
||||
* 责任划分
|
||||
|
||||
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 安全-事故上报业务对象 hse_safety_sgsb
|
||||
* 档案-损失情况信息
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-05
|
||||
|
||||
@ -12,7 +12,7 @@ import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 安全-事故上报业务对象 hse_safety_sgsb
|
||||
* 档案-事故详情信息
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-05
|
||||
|
||||
@ -18,7 +18,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全-事故整改闭环业务对象 hse_safety_sgzgbh
|
||||
* 档案-事故整改与复查信息
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-05
|
||||
|
||||
@ -2,8 +2,12 @@ package org.dromara.safety.accident.domain.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
|
||||
import java.io.Serial;
|
||||
@ -38,6 +42,8 @@ public class HseSafetySgsbVo implements Serializable {
|
||||
*/
|
||||
@ExcelProperty(value = "关联项目")
|
||||
private Long projectId;
|
||||
@Translation(type = TransConstant.PROJECT_ID_TO_NAME, mapper = "projectId")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 事故编号
|
||||
@ -162,4 +168,9 @@ public class HseSafetySgsbVo implements Serializable {
|
||||
*/
|
||||
private String createByName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
|
||||
@ -8,24 +8,24 @@ import java.math.BigDecimal;
|
||||
public class SgsbCountVo {
|
||||
|
||||
/**
|
||||
* 本月上报事故
|
||||
* 本月总上报事故
|
||||
*/
|
||||
private Long bysbsg;
|
||||
|
||||
/**
|
||||
* 待处理事故
|
||||
*/
|
||||
private Long dclsg;
|
||||
|
||||
/**
|
||||
* 已闭环事故
|
||||
*/
|
||||
private Long ybhsg;
|
||||
|
||||
/**
|
||||
* 事故整改完成率
|
||||
* 待整改事故
|
||||
*/
|
||||
private BigDecimal sgzgwcl;
|
||||
private Long dzgsg;
|
||||
/**
|
||||
* 已整改事故
|
||||
*/
|
||||
private Long yzgsg;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 待调查事故
|
||||
@ -43,8 +43,8 @@ public class SgsbCountVo {
|
||||
private Long ywcdc;
|
||||
|
||||
/**
|
||||
* 待整改事故
|
||||
* 总调查事故
|
||||
*/
|
||||
private Long dzgsg;
|
||||
private Long zdcsg;
|
||||
|
||||
}
|
||||
|
||||
@ -66,7 +66,19 @@ public enum SGStatusEnum {
|
||||
/**
|
||||
* 未闭环
|
||||
*/
|
||||
OPEN_LOOP("1", "未闭环");
|
||||
OPEN_LOOP("1", "未闭环"),
|
||||
|
||||
|
||||
//事故调查保存状态
|
||||
/**
|
||||
* 草稿
|
||||
*/
|
||||
DRAFT("0", "草稿"),
|
||||
/**
|
||||
* 提交
|
||||
*/
|
||||
SUBMIT("1", "提交");
|
||||
|
||||
|
||||
private final String code;
|
||||
|
||||
|
||||
@ -313,6 +313,8 @@ public class HseSafetySgdcServiceImpl extends ServiceImpl<HseSafetySgdcMapper, H
|
||||
sgzg.setSglx(sgsb.getSglx());
|
||||
//事故等级
|
||||
sgzg.setSgdj(sgsb.getSgdj());
|
||||
//事发时间
|
||||
sgzg.setSfsj(sgsb.getSfsj());
|
||||
//事故原因
|
||||
sgzg.setSgyy(sgsb.getSgyy());
|
||||
//调查人
|
||||
@ -325,6 +327,8 @@ public class HseSafetySgdcServiceImpl extends ServiceImpl<HseSafetySgdcMapper, H
|
||||
sgzg.setZgStatus(SGStatusEnum.TO_BE_RECTIFIED.getCode());
|
||||
//整改人
|
||||
sgzg.setZgr(sgdc.getZgfzr());
|
||||
//复查人
|
||||
sgzg.setFcr(sgdc.getFcry());
|
||||
//是否预期
|
||||
sgzg.setIsFinish("0");
|
||||
//调查id
|
||||
@ -343,43 +347,40 @@ public class HseSafetySgdcServiceImpl extends ServiceImpl<HseSafetySgdcMapper, H
|
||||
long ddcsg = 0;
|
||||
long dczsg = 0;
|
||||
long ywcdc = 0;
|
||||
long dzgsg = 0;
|
||||
long zdcsg = 0;
|
||||
|
||||
List<HseSafetySgsb> sbList = baseMapper.getSgsbListByProjectId(projectId);
|
||||
if (sbList != null && !sbList.isEmpty()){
|
||||
zdcsg = sbList.size();
|
||||
}
|
||||
for (HseSafetySgsb sgsb : sbList) {
|
||||
//待调查事故 上报后 审核后 待调查
|
||||
if (sgsb.getSgzt().equals(SGStatusEnum.UNDER_INVESTIGATION.getCode())){
|
||||
HseSafetySgdcVo sgdcVo = baseMapper.selectVoOne(new LambdaQueryWrapper<HseSafetySgdc>().eq(HseSafetySgdc::getSgId, sgsb.getId()));
|
||||
if (sgdcVo != null){
|
||||
//待调查事故 已生成调查事件但还未调查
|
||||
if (sgdcVo.getBczt() == null){
|
||||
ddcsg++;
|
||||
}else if (sgsb.getSgzt().equals(SGStatusEnum.SG_TO_BE_RECTIFIED.getCode())){
|
||||
//调查中事故 待调查 填写完数据提交后 待整改
|
||||
continue;
|
||||
}
|
||||
//调查中事故 已调查但提交状态为草稿
|
||||
if (SGStatusEnum.DRAFT.getCode().equals(sgdcVo.getBczt())){
|
||||
dczsg++;
|
||||
}else if (sgsb.getSgzt().equals(SGStatusEnum.SG_HAS_BEEN_RECTIFIED.getCode())){
|
||||
//已完成调查 待整改 -> 已整改
|
||||
}
|
||||
}
|
||||
|
||||
}else if (sgsb.getSgzt().equals(SGStatusEnum.SG_TO_BE_RECTIFIED.getCode())){
|
||||
//待整改
|
||||
ywcdc++;
|
||||
}
|
||||
//待整改事项 查看整改表关联此调查的数据 整改状态为待整改
|
||||
LambdaQueryWrapper<HseSafetySgdc> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(HseSafetySgdc::getSgId,sgsb.getId());
|
||||
List<HseSafetySgdc> sgdcs = list(queryWrapper);
|
||||
for (HseSafetySgdc sgdc : sgdcs) {
|
||||
//寻找对应整改数据
|
||||
LambdaQueryWrapper<HseSafetySgzgbh> zgqwr = new LambdaQueryWrapper<>();
|
||||
zgqwr.eq(HseSafetySgzgbh::getDcId,sgdc.getId());
|
||||
List<HseSafetySgzgbh> zgs = zgbhService.list(zgqwr);
|
||||
for (HseSafetySgzgbh zg : zgs) {
|
||||
//寻找待整改
|
||||
if (zg.getZgStatus().equals(SGStatusEnum.TO_BE_RECTIFIED.getCode())){
|
||||
dzgsg++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
countVo.setDdcsg(ddcsg);
|
||||
countVo.setDczsg(dczsg);
|
||||
countVo.setYwcdc(ywcdc);
|
||||
countVo.setDzgsg(dzgsg);
|
||||
countVo.setZdcsg(zdcsg);
|
||||
|
||||
return countVo;
|
||||
}
|
||||
|
||||
@ -16,6 +16,7 @@ import org.dromara.safety.accident.domain.HseSafetySgzgbh;
|
||||
import org.dromara.safety.accident.domain.bo.HseSafetySgdcBo;
|
||||
import org.dromara.safety.accident.domain.bo.HseSafetySgsbBo;
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgsbVo;
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgzgbhHeadVo;
|
||||
import org.dromara.safety.accident.domain.vo.SgsbCountVo;
|
||||
import org.dromara.safety.accident.mapper.HseSafetySgsbMapper;
|
||||
import org.dromara.safety.accident.menu.SGStatusEnum;
|
||||
@ -186,68 +187,79 @@ public class HseSafetySgsbServiceImpl extends ServiceImpl<HseSafetySgsbMapper, H
|
||||
*/
|
||||
@Override
|
||||
public SgsbCountVo getCount(Long projectId){
|
||||
//获取对应列表
|
||||
LambdaQueryWrapper<HseSafetySgsb> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(HseSafetySgsb::getProjectId, projectId);
|
||||
List<HseSafetySgsb> list = this.list(lambdaQueryWrapper);
|
||||
//获取整改对应列表
|
||||
List<HseSafetySgzgbh> zgxxes = baseMapper.getSgzgList();
|
||||
//获取调查列表
|
||||
List<HseSafetySgdc> dcList = sgdcService.list();
|
||||
//初始化统计信息
|
||||
SgsbCountVo sgsbCountVo = new SgsbCountVo();
|
||||
sgsbCountVo.setSgzgwcl(BigDecimal.ZERO);
|
||||
|
||||
long sbsg = 0;
|
||||
long dclsg = 0;
|
||||
long ybhsg = 0;
|
||||
long zgwc = 0;
|
||||
//获取时间
|
||||
Date firstDay = getFirstDayOfMonth();
|
||||
Date lastDay = getLastDayOfMonth();
|
||||
for (HseSafetySgsb hseSafetySgsb : list) {
|
||||
//本月上报事故
|
||||
if (hseSafetySgsb.getCreateTime().after(firstDay) && hseSafetySgsb.getCreateTime().before(lastDay)){
|
||||
sbsg++;
|
||||
//本月完成数量
|
||||
for (HseSafetySgdc safetySgdc : dcList) {
|
||||
if (hseSafetySgsb.getId() == safetySgdc.getSgId()){
|
||||
//事故找到 调查 调查寻找整改
|
||||
for (HseSafetySgzgbh zgxx : zgxxes) {
|
||||
if (zgxx.getSgId() == safetySgdc.getId()){
|
||||
//如果调查找到了整改 则查看状态
|
||||
if (zgxx.getIsFinish().equals("1") || zgxx.getIsFinish().equals("3")){
|
||||
zgwc++;
|
||||
break;
|
||||
SgsbCountVo sgzgbhHeadVo = new SgsbCountVo();
|
||||
List<HseSafetySgsb> sgzgbhs = this.getBaseMapper().selectList(new LambdaQueryWrapper<HseSafetySgsb>().eq(HseSafetySgsb::getProjectId, projectId).le(HseSafetySgsb::getCreateTime, LocalDate.now().plusDays(1)).ge(HseSafetySgsb::getCreateTime, LocalDate.now().minusDays(29)));
|
||||
if (sgzgbhs != null && !sgzgbhs.isEmpty()) {
|
||||
sgzgbhHeadVo.setBysbsg((long) sgzgbhs.size());
|
||||
sgzgbhHeadVo.setDdcsg(sgzgbhs.stream().filter(jxYhzgbh -> SGStatusEnum.UNDER_INVESTIGATION.getCode().equals(jxYhzgbh.getSgzt())).count());
|
||||
sgzgbhHeadVo.setDzgsg(sgzgbhs.stream().filter(jxYhzgbh -> SGStatusEnum.SG_TO_BE_RECTIFIED.getCode().equals(jxYhzgbh.getSgzt())).count());
|
||||
sgzgbhHeadVo.setYzgsg(sgzgbhs.stream().filter(jxYhzgbh -> SGStatusEnum.SG_HAS_BEEN_RECTIFIED.getCode().equals(jxYhzgbh.getSgzt())).count());
|
||||
sgzgbhHeadVo.setYbhsg(sgzgbhs.stream().filter(jxYhzgbh -> SGStatusEnum.SG_CLOSED_LOOP_OPERATION.getCode().equals(jxYhzgbh.getSgzt())).count());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
//待处理事故 新增后为已上报 审核通过后向调查新增 状态为草稿 原数据状态改为待调查
|
||||
if (hseSafetySgsb.getSgzt().equals(SGStatusEnum.REPORTED.getCode())){
|
||||
dclsg++;
|
||||
}
|
||||
//已闭环事故
|
||||
if (hseSafetySgsb.getSgzt().equals(SGStatusEnum.CLOSED_LOOP_OPERATION.getCode())){
|
||||
ybhsg++;
|
||||
}
|
||||
}
|
||||
sgsbCountVo.setBysbsg(sbsg);
|
||||
sgsbCountVo.setDclsg(dclsg);
|
||||
sgsbCountVo.setYbhsg(ybhsg);
|
||||
|
||||
BigDecimal wcl;
|
||||
if (sbsg == 0){
|
||||
wcl = BigDecimal.ZERO;
|
||||
}else {
|
||||
wcl = new BigDecimal(zgwc).divide(new BigDecimal(sbsg), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
||||
}
|
||||
sgsbCountVo.setSgzgwcl(wcl);
|
||||
|
||||
return sgsbCountVo;
|
||||
return sgzgbhHeadVo;
|
||||
// //获取对应列表
|
||||
// LambdaQueryWrapper<HseSafetySgsb> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.eq(HseSafetySgsb::getProjectId, projectId);
|
||||
// List<HseSafetySgsb> list = this.list(lambdaQueryWrapper);
|
||||
// //获取整改对应列表
|
||||
// List<HseSafetySgzgbh> zgxxes = baseMapper.getSgzgList();
|
||||
// //获取调查列表
|
||||
// List<HseSafetySgdc> dcList = sgdcService.list();
|
||||
// //初始化统计信息
|
||||
// SgsbCountVo sgsbCountVo = new SgsbCountVo();
|
||||
// sgsbCountVo.setSgzgwcl(BigDecimal.ZERO);
|
||||
//
|
||||
// long sbsg = 0;
|
||||
// long dclsg = 0;
|
||||
// long ybhsg = 0;
|
||||
// long zgwc = 0;
|
||||
// //获取时间
|
||||
// Date firstDay = getFirstDayOfMonth();
|
||||
// Date lastDay = getLastDayOfMonth();
|
||||
// for (HseSafetySgsb hseSafetySgsb : list) {
|
||||
// //本月上报事故
|
||||
// if (hseSafetySgsb.getCreateTime().after(firstDay) && hseSafetySgsb.getCreateTime().before(lastDay)){
|
||||
// sbsg++;
|
||||
// //本月完成数量
|
||||
// for (HseSafetySgdc safetySgdc : dcList) {
|
||||
// if (hseSafetySgsb.getId() == safetySgdc.getSgId()){
|
||||
// //事故找到 调查 调查寻找整改
|
||||
// for (HseSafetySgzgbh zgxx : zgxxes) {
|
||||
// if (zgxx.getSgId() == safetySgdc.getId()){
|
||||
// //如果调查找到了整改 则查看状态
|
||||
// if (zgxx.getIsFinish().equals("1") || zgxx.getIsFinish().equals("3")){
|
||||
// zgwc++;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// //待处理事故 新增后为已上报 审核通过后向调查新增 状态为草稿 原数据状态改为待调查
|
||||
// if (hseSafetySgsb.getSgzt().equals(SGStatusEnum.REPORTED.getCode())){
|
||||
// dclsg++;
|
||||
// }
|
||||
// //已闭环事故
|
||||
// if (hseSafetySgsb.getSgzt().equals(SGStatusEnum.CLOSED_LOOP_OPERATION.getCode())){
|
||||
// ybhsg++;
|
||||
// }
|
||||
// }
|
||||
// sgsbCountVo.setBysbsg(sbsg);
|
||||
// sgsbCountVo.setDclsg(dclsg);
|
||||
// sgsbCountVo.setYbhsg(ybhsg);
|
||||
//
|
||||
// BigDecimal wcl;
|
||||
// if (sbsg == 0){
|
||||
// wcl = BigDecimal.ZERO;
|
||||
// }else {
|
||||
// wcl = new BigDecimal(zgwc).divide(new BigDecimal(sbsg), 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
||||
// }
|
||||
// sgsbCountVo.setSgzgwcl(wcl);
|
||||
//
|
||||
// return sgsbCountVo;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.toolkit.BeanUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.dromara.common.core.domain.model.LoginUser;
|
||||
import org.dromara.common.core.exception.ServiceException;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
@ -14,6 +15,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.common.utils.BatchNumberGenerator;
|
||||
import org.dromara.mechanical.jxzgbh.domain.JxYhzgbh;
|
||||
import org.dromara.mechanical.jxzgbh.domain.vo.JxZgxxHeadVo;
|
||||
@ -26,6 +28,10 @@ import org.dromara.safety.accident.domain.bo.*;
|
||||
import org.dromara.safety.accident.domain.vo.*;
|
||||
import org.dromara.safety.accident.menu.SGStatusEnum;
|
||||
import org.dromara.safety.accident.service.*;
|
||||
import org.dromara.system.domain.vo.SysDeptVo;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysDeptService;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgzgbh;
|
||||
@ -65,6 +71,12 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
@Lazy
|
||||
@Resource
|
||||
private IHseSafetySgdcService sgdcService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private ISysUserService userService;
|
||||
@Lazy
|
||||
@Resource
|
||||
private ISysDeptService deptService;
|
||||
|
||||
/**
|
||||
* 查询安全-事故整改闭环
|
||||
@ -73,11 +85,11 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
* @return 安全-事故整改闭环
|
||||
*/
|
||||
@Override
|
||||
public HseSafetySgzgbhVo queryById(Long id){
|
||||
public HseSafetySgzgbhVo queryById(Long id) {
|
||||
HseSafetySgzgbhVo vo = baseMapper.selectVoById(id);
|
||||
if (null != vo){
|
||||
List<HseSafetyZgxxVo> zgxxVos =zgxxService.getZGBGInfoVoByIdList(vo.getId());
|
||||
if(!zgxxVos.isEmpty()){
|
||||
if (null != vo) {
|
||||
List<HseSafetyZgxxVo> zgxxVos = zgxxService.getZGBGInfoVoByIdList(vo.getId());
|
||||
if (!zgxxVos.isEmpty()) {
|
||||
vo.setZgxxVos(zgxxVos);
|
||||
}
|
||||
}
|
||||
@ -167,7 +179,7 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HseSafetySgzgbh entity){
|
||||
private void validEntityBeforeSave(HseSafetySgzgbh entity) {
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
@ -180,7 +192,7 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
if (isValid) {
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
@ -196,17 +208,24 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addZGxx(HseSafetyZgxxBo bo) {
|
||||
HseSafetySgzgbh sgzgbh = baseMapper.selectById(bo.getMasterId());
|
||||
if(sgzgbh == null){
|
||||
if (sgzgbh == null) {
|
||||
throw new ServiceException("找不到整改与闭环信息数据!!!");
|
||||
}
|
||||
if (SGStatusEnum.CLOSED_LOOP_OPERATION.getCode().equals(sgzgbh.getReviewStatus())){
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (loginUser == null) {
|
||||
throw new ServiceException("找不到当前登录人信息!!");
|
||||
}
|
||||
if (!sgzgbh.getZgr().equals(loginUser.getUserId())){
|
||||
throw new ServiceException("当前登录人不是整改人不能进行整改填报!!");
|
||||
}
|
||||
if (SGStatusEnum.CLOSED_LOOP_OPERATION.getCode().equals(sgzgbh.getReviewStatus())) {
|
||||
throw new ServiceException("已闭环,不需要再新增整改信息");
|
||||
}
|
||||
if (!SGStatusEnum.TO_BE_RECTIFIED.getCode().equals(sgzgbh.getZgStatus())){
|
||||
if (!SGStatusEnum.TO_BE_RECTIFIED.getCode().equals(sgzgbh.getZgStatus())) {
|
||||
throw new ServiceException("已整改,不需要再新增整改信息");
|
||||
}
|
||||
HseSafetySgsb hseSafetySgsb = sgsbService.getBaseMapper().selectById(sgzgbh.getSgId());
|
||||
if (hseSafetySgsb == null){
|
||||
if (hseSafetySgsb == null) {
|
||||
throw new ServiceException("找不到事故信息");
|
||||
}
|
||||
hseSafetySgsb.setSgzt(SGStatusEnum.SG_HAS_BEEN_RECTIFIED.getCode());
|
||||
@ -221,6 +240,7 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
|
||||
/**
|
||||
* 新增复查信息
|
||||
*
|
||||
* @param bo
|
||||
* @return
|
||||
*/
|
||||
@ -228,28 +248,35 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean addFCxx(HseSafetyFcxxBo bo) {
|
||||
HseSafetySgzgbh sgzgbh = baseMapper.selectById(bo.getMasterId());
|
||||
if(sgzgbh == null){
|
||||
if (sgzgbh == null) {
|
||||
throw new ServiceException("找不到整改与闭环信息数据!!!");
|
||||
}
|
||||
if (SGStatusEnum.CLOSED_LOOP_OPERATION.getCode().equals(sgzgbh.getReviewStatus())){
|
||||
LoginUser loginUser = LoginHelper.getLoginUser();
|
||||
if (loginUser == null) {
|
||||
throw new ServiceException("找不到当前登录人信息!!");
|
||||
}
|
||||
if (!sgzgbh.getFcr().equals(loginUser.getUserId())){
|
||||
throw new ServiceException("当前登录人不是复查人不能进行复查填报!!");
|
||||
}
|
||||
if (SGStatusEnum.CLOSED_LOOP_OPERATION.getCode().equals(sgzgbh.getReviewStatus())) {
|
||||
throw new ServiceException("已闭环,不需要再新增复查信息");
|
||||
}
|
||||
if (!SGStatusEnum.HAS_BEEN_RECTIFIED.getCode().equals(sgzgbh.getZgStatus())){
|
||||
if (!SGStatusEnum.HAS_BEEN_RECTIFIED.getCode().equals(sgzgbh.getZgStatus())) {
|
||||
throw new ServiceException("未整改,不能添加复查信息");
|
||||
}
|
||||
HseSafetySgsb hseSafetySgsb = sgsbService.getBaseMapper().selectById(sgzgbh.getSgId());
|
||||
if (hseSafetySgsb == null){
|
||||
if (hseSafetySgsb == null) {
|
||||
throw new ServiceException("归档失败,找不到事故信息,请联系管理员");
|
||||
}
|
||||
HseSafetyZgxx zgxx = zgxxService.getBaseMapper().selectOne(new LambdaQueryWrapper<HseSafetyZgxx>().eq(HseSafetyZgxx::getMasterId, sgzgbh.getId()).orderByDesc(HseSafetyZgxx::getCreateTime).last("limit 1"));
|
||||
if (zgxx == null){
|
||||
if (zgxx == null) {
|
||||
throw new ServiceException("找不到整改信息");
|
||||
}
|
||||
bo.setZgId(zgxx.getId());
|
||||
Boolean b = fcxxService.insertByBo(bo);
|
||||
//修改主数据整改状态合复查状态
|
||||
sgzgbh.setFcStatus(bo.getReviewState());
|
||||
if (SGStatusEnum.PASS.getCode().equals(bo.getReviewState())){
|
||||
if (SGStatusEnum.PASS.getCode().equals(bo.getReviewState())) {
|
||||
sgzgbh.setReviewStatus(SGStatusEnum.CLOSED_LOOP_OPERATION.getCode());
|
||||
hseSafetySgsb.setSgzt(SGStatusEnum.SG_CLOSED_LOOP_OPERATION.getCode());
|
||||
//复查通过则生成档案信息数据
|
||||
@ -258,7 +285,7 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
String banBen = BatchNumberGenerator.generateBatchNumber("ANQSGDANJL-");
|
||||
sgdanjlBo.setDanbh(banBen);
|
||||
BusProjectVo projectVo = projectService.selectById(hseSafetySgsb.getProjectId());
|
||||
if (projectVo != null){
|
||||
if (projectVo != null) {
|
||||
sgdanjlBo.setProject(projectVo.getProjectName());
|
||||
}
|
||||
sgdanjlBo.setSgbh(hseSafetySgsb.getSgbh());
|
||||
@ -275,18 +302,29 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
sgdanjlBo.setSsqk(JSONUtil.toJsonStr(sgssqkReq));
|
||||
//事故调查详情填充
|
||||
HseSafetySgdcVo sgdcVo = sgdcService.queryById(sgzgbh.getDcId());
|
||||
if (sgdcVo == null){
|
||||
if (sgdcVo == null) {
|
||||
throw new ServiceException("归档失败,找不到事故调查信息,请联系管理员");
|
||||
}
|
||||
HseSafetySgdcxqReq sgdcxqReq = BeanUtil.copyProperties(sgdcVo, HseSafetySgdcxqReq.class);
|
||||
if (sgdcxqReq != null) {
|
||||
if (sgdcxqReq.getZrbm() != null) {
|
||||
sgdcxqReq.setZrbmName(deptService.selectDeptNameById(sgdcxqReq.getZrbm()));
|
||||
}
|
||||
if (sgdcxqReq.getZyfzr() != null) {
|
||||
sgdcxqReq.setZyfzrName(userService.queryNameById(sgdcxqReq.getZyfzr()));
|
||||
}
|
||||
if (sgdcxqReq.getCyfzr() != null) {
|
||||
sgdcxqReq.setCyfzrName(userService.queryNameById(sgdcxqReq.getCyfzr()));
|
||||
}
|
||||
}
|
||||
sgdanjlBo.setDcxq(JSONUtil.toJsonStr(sgdcxqReq));
|
||||
//事故整改与复查信息填充
|
||||
HseSafetySgzgbhVo vo = queryById(sgzgbh.getId());
|
||||
if (vo == null){
|
||||
if (vo == null) {
|
||||
throw new ServiceException("归档失败,找不到事故整改与复查信息,请联系管理员");
|
||||
}
|
||||
List<HseSafetySgzgfcxqReq> reqs = new ArrayList<>();
|
||||
if (vo.getZgxxVos() != null){
|
||||
if (vo.getZgxxVos() != null) {
|
||||
vo.getZgxxVos().forEach(v -> {
|
||||
HseSafetySgzgfcxqReq req = new HseSafetySgzgfcxqReq();
|
||||
req.setAbarbeitungMeasure(v.getAbarbeitungMeasure());
|
||||
@ -294,7 +332,7 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
req.setZgFileUrls(v.getFileUrls());
|
||||
req.setZgPdfId(v.getPdfId());
|
||||
req.setZgPdfUrls(v.getPdfUrls());
|
||||
if (v.getFcxxVo() == null){
|
||||
if (v.getFcxxVo() == null) {
|
||||
throw new ServiceException("归档失败,找不到对应的复查记录,请联系管理员");
|
||||
}
|
||||
req.setReviewState(v.getFcxxVo().getReviewState());
|
||||
@ -310,7 +348,7 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
sgdanjlBo.setZgfcxq(JSONUtil.toJsonStr(reqs));
|
||||
sgdanjlService.insertByBo(sgdanjlBo);
|
||||
|
||||
}else {
|
||||
} else {
|
||||
hseSafetySgsb.setSgzt(SGStatusEnum.SG_TO_BE_RECTIFIED.getCode());
|
||||
sgzgbh.setZgStatus(SGStatusEnum.TO_BE_RECTIFIED.getCode());
|
||||
}
|
||||
@ -322,8 +360,8 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
@Override
|
||||
public HseSafetySgzgbhHeadVo getListHead(HseSafetySgzgbhBo bo) {
|
||||
HseSafetySgzgbhHeadVo sgzgbhHeadVo = new HseSafetySgzgbhHeadVo();
|
||||
List<HseSafetySgzgbh> sgzgbhs = this.getBaseMapper().selectList(new LambdaQueryWrapper<HseSafetySgzgbh>().eq(HseSafetySgzgbh::getProjectId,bo.getProjectId()).le(HseSafetySgzgbh::getCreateTime, LocalDate.now().plusDays(1)).ge(HseSafetySgzgbh::getCreateTime, LocalDate.now().minusDays(29)));
|
||||
if ( sgzgbhs != null && !sgzgbhs.isEmpty()) {
|
||||
List<HseSafetySgzgbh> sgzgbhs = this.getBaseMapper().selectList(new LambdaQueryWrapper<HseSafetySgzgbh>().eq(HseSafetySgzgbh::getProjectId, bo.getProjectId()).le(HseSafetySgzgbh::getCreateTime, LocalDate.now().plusDays(1)).ge(HseSafetySgzgbh::getCreateTime, LocalDate.now().minusDays(29)));
|
||||
if (sgzgbhs != null && !sgzgbhs.isEmpty()) {
|
||||
sgzgbhHeadVo.setZs((long) sgzgbhs.size());
|
||||
sgzgbhHeadVo.setDzg(sgzgbhs.stream().filter(jxYhzgbh -> jxYhzgbh.getZgStatus().equals(SGStatusEnum.TO_BE_RECTIFIED.getCode())).count());
|
||||
sgzgbhHeadVo.setDys(sgzgbhs.stream().filter(jxYhzgbh -> SGStatusEnum.HAS_BEEN_RECTIFIED.getCode().equals(jxYhzgbh.getZgStatus()) && SGStatusEnum.OPEN_LOOP.getCode().equals(jxYhzgbh.getReviewStatus())).count());
|
||||
@ -335,11 +373,11 @@ public class HseSafetySgzgbhServiceImpl extends ServiceImpl<HseSafetySgzgbhMappe
|
||||
@Override
|
||||
public String getNoPass(HseSafetySgzgbhBo bo) {
|
||||
HseSafetyZgxx zgxx = zgxxService.getBaseMapper().selectOne(new LambdaQueryWrapper<HseSafetyZgxx>().eq(HseSafetyZgxx::getMasterId, bo.getId()).orderByDesc(HseSafetyZgxx::getCreateTime).last("limit 1"));
|
||||
if (zgxx == null){
|
||||
if (zgxx == null) {
|
||||
throw new ServiceException("找不到整改信息");
|
||||
}
|
||||
HseSafetyFcxx fcxx = fcxxService.getBaseMapper().selectOne(new LambdaQueryWrapper<HseSafetyFcxx>().eq(HseSafetyFcxx::getZgId, zgxx.getId()).orderByDesc(HseSafetyFcxx::getCreateTime).last("limit 1"));
|
||||
if (fcxx == null){
|
||||
if (fcxx == null) {
|
||||
throw new ServiceException("找不到复查信息");
|
||||
}
|
||||
return fcxx.getNotPassCause();
|
||||
|
||||
@ -3,7 +3,7 @@ package org.dromara.safety.enums;
|
||||
public enum AqEnums {
|
||||
|
||||
AQJDZT_S("是否交底", "1"),
|
||||
AQJDZT_F("是否交底", "2"),
|
||||
AQJDZT_F("是否交底", "0"),
|
||||
AQWXJX_S("是否存在危险迹象", "1"),
|
||||
AQWXJX_F("是否存在危险迹象", "0");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user