12-05-事故管理-事故上报
This commit is contained in:
@ -1,26 +1,28 @@
|
||||
package org.dromara.safety.accident.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
import org.dromara.common.log.annotation.Log;
|
||||
import org.dromara.common.web.core.BaseController;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
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.log.enums.BusinessType;
|
||||
import org.dromara.common.excel.utils.ExcelUtil;
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgsbVo;
|
||||
import org.dromara.safety.accident.domain.bo.HseSafetySgsbBo;
|
||||
import org.dromara.safety.accident.service.IHseSafetySgsbService;
|
||||
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.safety.accident.domain.bo.HseSafetySgsbBo;
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgsbVo;
|
||||
import org.dromara.safety.accident.domain.vo.SgsbCountVo;
|
||||
import org.dromara.safety.accident.service.IHseSafetySgsbService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 安全-事故上报
|
||||
@ -102,4 +104,14 @@ public class HseSafetySgsbController extends BaseController {
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(hseSafetySgsbService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计数据
|
||||
*/
|
||||
@GetMapping("/getCount/{projectId}")
|
||||
@SaCheckPermission("accident:safetySgsb:list")
|
||||
public R<SgsbCountVo> getCount(@PathVariable Long projectId) {
|
||||
return R.ok(hseSafetySgsbService.getCount(projectId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package org.dromara.safety.accident.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 安全-事故调查对象 hse_safety_sgdc
|
||||
@ -154,5 +154,9 @@ public class HseSafetySgdc extends BaseEntity {
|
||||
*/
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 保存状态0草稿1提交
|
||||
*/
|
||||
private String bczt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
package org.dromara.safety.accident.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 安全-事故上报对象 hse_safety_sgsb
|
||||
@ -82,7 +83,7 @@ public class HseSafetySgsb extends BaseEntity {
|
||||
/**
|
||||
* 初步估算(万元-角分)
|
||||
*/
|
||||
private Long cbgs;
|
||||
private BigDecimal cbgs;
|
||||
|
||||
/**
|
||||
* 事故原因
|
||||
@ -120,7 +121,7 @@ public class HseSafetySgsb extends BaseEntity {
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 事故状态(待上报,已上报,待调查,待整改,已整改,需整改,已闭环)
|
||||
* 事故状态(已上报,待调查,待整改,已整改,,已闭环)
|
||||
*/
|
||||
private String sgzt;
|
||||
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
package org.dromara.safety.accident.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 安全-事故整改闭环对象 hse_safety_sgzgbh
|
||||
@ -119,5 +119,14 @@ public class HseSafetySgzgbh extends BaseEntity {
|
||||
*/
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 是否完成(0未逾期,1未逾期已完成,2已逾期未完成,3已逾期已完成)
|
||||
*/
|
||||
private String isFinish;
|
||||
|
||||
/**
|
||||
* 调查id
|
||||
*/
|
||||
private Long dcId;
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
package org.dromara.safety.accident.domain.bo;
|
||||
|
||||
import org.dromara.safety.accident.domain.HseSafetySgdc;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgdc;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 安全-事故调查业务对象 hse_safety_sgdc
|
||||
@ -153,5 +152,9 @@ public class HseSafetySgdcBo extends BaseEntity {
|
||||
*/
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 保存状态0草稿1提交
|
||||
*/
|
||||
private String bczt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
package org.dromara.safety.accident.domain.bo;
|
||||
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 安全-事故上报业务对象 hse_safety_sgsb
|
||||
@ -81,7 +81,7 @@ public class HseSafetySgsbBo extends BaseEntity {
|
||||
/**
|
||||
* 初步估算(万元-角分)
|
||||
*/
|
||||
private Long cbgs;
|
||||
private BigDecimal cbgs;
|
||||
|
||||
/**
|
||||
* 事故原因
|
||||
@ -119,7 +119,7 @@ public class HseSafetySgsbBo extends BaseEntity {
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 事故状态(待上报,已上报,待调查,待整改,已整改,需整改,已闭环)
|
||||
* 事故状态(已上报,待调查,待整改,已整改,,已闭环)
|
||||
*/
|
||||
private String sgzt;
|
||||
|
||||
|
||||
@ -1,15 +1,14 @@
|
||||
package org.dromara.safety.accident.domain.bo;
|
||||
|
||||
import org.dromara.safety.accident.domain.HseSafetySgzgbh;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.AddGroup;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgzgbh;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 安全-事故整改闭环业务对象 hse_safety_sgzgbh
|
||||
@ -119,5 +118,14 @@ public class HseSafetySgzgbhBo extends BaseEntity {
|
||||
*/
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 是否完成(0未逾期,1未逾期已完成,2已逾期未完成,3已逾期已完成)
|
||||
*/
|
||||
private String isFinish;
|
||||
|
||||
/**
|
||||
* 调查id
|
||||
*/
|
||||
private Long dcId;
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
package org.dromara.safety.accident.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgdc;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgdc;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -186,5 +182,9 @@ public class HseSafetySgdcVo implements Serializable {
|
||||
@ExcelProperty(value = "审核状态")
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 保存状态0草稿1提交
|
||||
*/
|
||||
private String bczt;
|
||||
|
||||
}
|
||||
|
||||
@ -1,17 +1,14 @@
|
||||
package org.dromara.safety.accident.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
@ -100,7 +97,7 @@ public class HseSafetySgsbVo implements Serializable {
|
||||
* 初步估算(万元-角分)
|
||||
*/
|
||||
@ExcelProperty(value = "初步估算(万元-角分)")
|
||||
private Long cbgs;
|
||||
private BigDecimal cbgs;
|
||||
|
||||
/**
|
||||
* 事故原因
|
||||
@ -126,6 +123,11 @@ public class HseSafetySgsbVo implements Serializable {
|
||||
@ExcelProperty(value = "接收人")
|
||||
private Long jsr;
|
||||
|
||||
/**
|
||||
* 接收人名称
|
||||
*/
|
||||
private String jsrmc;
|
||||
|
||||
/**
|
||||
* 紧急措施
|
||||
*/
|
||||
@ -147,7 +149,7 @@ public class HseSafetySgsbVo implements Serializable {
|
||||
/**
|
||||
* 事故状态(待上报,已上报,待调查,待整改,已整改,需整改,已闭环)
|
||||
*/
|
||||
@ExcelProperty(value = "事故状态(待上报,已上报,待调查,待整改,已整改,需整改,已闭环)")
|
||||
@ExcelProperty(value = "事故状态(已上报,待调查,待整改,已整改,,已闭环)")
|
||||
private String sgzt;
|
||||
|
||||
|
||||
|
||||
@ -1,14 +1,10 @@
|
||||
package org.dromara.safety.accident.domain.vo;
|
||||
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgzgbh;
|
||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import org.dromara.common.excel.annotation.ExcelDictFormat;
|
||||
import org.dromara.common.excel.convert.ExcelDictConvert;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgzgbh;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
@ -143,11 +139,19 @@ public class HseSafetySgzgbhVo implements Serializable {
|
||||
@ExcelProperty(value = "审核状态")
|
||||
private String shzt;
|
||||
|
||||
/**
|
||||
* 是否完成(0未逾期,1未逾期已完成,2已逾期未完成,3已逾期已完成)
|
||||
*/
|
||||
private String isFinish;
|
||||
|
||||
/**
|
||||
* 整改与复查记录
|
||||
*/
|
||||
private List<HseSafetyZgxxVo> zgxxVos;
|
||||
|
||||
/**
|
||||
* 调查id
|
||||
*/
|
||||
private Long dcId;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,30 @@
|
||||
package org.dromara.safety.accident.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class SgsbCountVo {
|
||||
|
||||
/**
|
||||
* 本月上报事故
|
||||
*/
|
||||
private Long bysbsg;
|
||||
|
||||
/**
|
||||
* 待处理事故
|
||||
*/
|
||||
private Long dclsg;
|
||||
|
||||
/**
|
||||
* 已闭环事故
|
||||
*/
|
||||
private Long ybhsg;
|
||||
|
||||
/**
|
||||
* 事故整改完成率
|
||||
*/
|
||||
private BigDecimal sgzgwcl;
|
||||
|
||||
}
|
||||
@ -1,12 +1,13 @@
|
||||
package org.dromara.safety.accident.service;
|
||||
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgsbVo;
|
||||
import org.dromara.safety.accident.domain.bo.HseSafetySgsbBo;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
import org.dromara.safety.accident.domain.bo.HseSafetySgsbBo;
|
||||
import org.dromara.safety.accident.domain.vo.HseSafetySgsbVo;
|
||||
import org.dromara.safety.accident.domain.vo.SgsbCountVo;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
@ -67,4 +68,11 @@ public interface IHseSafetySgsbService extends IService<HseSafetySgsb>{
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
* @param projectId
|
||||
* @return
|
||||
*/
|
||||
SgsbCountVo getCount(Long projectId);
|
||||
}
|
||||
|
||||
@ -1,24 +1,39 @@
|
||||
package org.dromara.safety.accident.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.common.core.utils.MapstructUtils;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.utils.BatchNumberGenerator;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgdc;
|
||||
import org.dromara.safety.accident.domain.HseSafetySgsb;
|
||||
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.HseSafetySgsb;
|
||||
import org.dromara.safety.accident.domain.vo.SgsbCountVo;
|
||||
import org.dromara.safety.accident.mapper.HseSafetySgsbMapper;
|
||||
import org.dromara.safety.accident.menu.SGStatusEnum;
|
||||
import org.dromara.safety.accident.service.IHseSafetySgsbService;
|
||||
import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.impl.SysUserServiceImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 安全-事故上报Service业务层处理
|
||||
@ -31,6 +46,14 @@ import java.util.Collection;
|
||||
public class HseSafetySgsbServiceImpl extends ServiceImpl<HseSafetySgsbMapper, HseSafetySgsb> implements IHseSafetySgsbService {
|
||||
|
||||
private final HseSafetySgsbMapper baseMapper;
|
||||
@Autowired
|
||||
private SysUserServiceImpl sysUserService;
|
||||
// @Autowired
|
||||
// private HseSafetyZgxxServiceImpl zgxxService;
|
||||
@Autowired
|
||||
private HseSafetySgdcServiceImpl sgdcService;
|
||||
@Autowired
|
||||
private HseSafetySgzgbhServiceImpl sgzgbhService;
|
||||
|
||||
/**
|
||||
* 查询安全-事故上报
|
||||
@ -40,7 +63,14 @@ public class HseSafetySgsbServiceImpl extends ServiceImpl<HseSafetySgsbMapper, H
|
||||
*/
|
||||
@Override
|
||||
public HseSafetySgsbVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
HseSafetySgsbVo hseSafetySgsbVo = baseMapper.selectVoById(id);
|
||||
if (hseSafetySgsbVo != null) {
|
||||
List<HseSafetySgsbVo> hseSafetySgsbVo1 = List.of(hseSafetySgsbVo);
|
||||
setValue(hseSafetySgsbVo1);
|
||||
return hseSafetySgsbVo1.getFirst();
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -54,6 +84,7 @@ public class HseSafetySgsbServiceImpl extends ServiceImpl<HseSafetySgsbMapper, H
|
||||
public TableDataInfo<HseSafetySgsbVo> queryPageList(HseSafetySgsbBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<HseSafetySgsb> lqw = buildQueryWrapper(bo);
|
||||
Page<HseSafetySgsbVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
setValue(result.getRecords());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
@ -104,11 +135,14 @@ public class HseSafetySgsbServiceImpl extends ServiceImpl<HseSafetySgsbMapper, H
|
||||
@Override
|
||||
public Boolean insertByBo(HseSafetySgsbBo bo) {
|
||||
HseSafetySgsb add = MapstructUtils.convert(bo, HseSafetySgsb.class);
|
||||
add.setSgzt(SGStatusEnum.REPORTED.getCode());
|
||||
add.setSgbh(BatchNumberGenerator.generateBatchNumber("SGBH-"));
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
addDcxx( bo);
|
||||
return flag;
|
||||
}
|
||||
|
||||
@ -146,4 +180,123 @@ public class HseSafetySgsbServiceImpl extends ServiceImpl<HseSafetySgsbMapper, H
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取统计信息
|
||||
*/
|
||||
@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 = sgzgbhService.list();
|
||||
//获取调查列表
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 装填信息
|
||||
*/
|
||||
public void setValue(List<HseSafetySgsbVo> vos){
|
||||
for (HseSafetySgsbVo vo : vos) {
|
||||
if (vo.getJsr() != null){
|
||||
SysUserVo sysUserVo = sysUserService.selectUserById(vo.getJsr());
|
||||
if (sysUserVo != null){
|
||||
vo.setJsrmc(sysUserVo.getNickName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本月第一天
|
||||
* @return 本月第一天的Date对象
|
||||
*/
|
||||
public static Date getFirstDayOfMonth() {
|
||||
LocalDate firstDay = LocalDate.now().with(TemporalAdjusters.firstDayOfMonth());
|
||||
return Date.from(firstDay.atStartOfDay(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取本月最后一天
|
||||
* @return 本月最后一天的Date对象
|
||||
*/
|
||||
public static Date getLastDayOfMonth() {
|
||||
LocalDate lastDay = LocalDate.now().with(TemporalAdjusters.lastDayOfMonth());
|
||||
return Date.from(lastDay.atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
|
||||
}
|
||||
|
||||
/**
|
||||
* 对调查进行新增一条数据 有审核后放在审核后进行 现在放在新增里
|
||||
*/
|
||||
public void addDcxx(HseSafetySgsbBo bo){
|
||||
HseSafetySgdcBo dcBo = new HseSafetySgdcBo();
|
||||
dcBo.setDcbh(BatchNumberGenerator.generateBatchNumber("SGDC-"));
|
||||
dcBo.setSgId(bo.getId());
|
||||
dcBo.setBczt("0");
|
||||
sgdcService.insertByBo(dcBo);
|
||||
//更新事故上报的状态
|
||||
HseSafetySgsb byId = getById(bo.getId());
|
||||
if (byId != null){
|
||||
byId.setSgzt(SGStatusEnum.UNDER_INVESTIGATION.getCode());
|
||||
updateById(byId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user