diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/controller/DeviceInfoController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/controller/DeviceInfoController.java index e108eb1e..caaa5ca4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/controller/DeviceInfoController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/controller/DeviceInfoController.java @@ -11,6 +11,7 @@ import org.dromara.device.domain.bo.DeviceAccessRecordBo; import org.dromara.device.domain.vo.DeviceAccessRecordVo; import org.dromara.device.domain.vo.DeviceInfoCountVo; import org.dromara.device.service.IDeviceAccessRecordService; +import org.redisson.api.RList; import org.springframework.web.bind.annotation.*; import org.springframework.validation.annotation.Validated; import org.dromara.common.idempotent.annotation.RepeatSubmit; @@ -137,4 +138,13 @@ public class DeviceInfoController extends BaseController { @PathVariable Long[] ids) { return toAjax(deviceInfoService.deleteWithValidByIds(List.of(ids), true)); } + + /** + * 设备信息列表 + */ + @GetMapping("/deviceList") + public R> deviceList(DeviceInfoBo bo) { + List list = deviceInfoService.queryList(bo); + return R.ok(list); + } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/domain/vo/DeviceAccessRecordVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/domain/vo/DeviceAccessRecordVo.java index b9639b15..0d92721d 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/domain/vo/DeviceAccessRecordVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/device/domain/vo/DeviceAccessRecordVo.java @@ -95,5 +95,10 @@ public class DeviceAccessRecordVo implements Serializable { @ExcelProperty(value = "详细说明", converter = ExcelDictConvert.class) private String details; + /** + * 创建时间 + */ + private Date createTime; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/qualityinspection/QltQualityInspectionUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/qualityinspection/QltQualityInspectionUpdateReq.java index ebb930f4..ae9882c6 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/qualityinspection/QltQualityInspectionUpdateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/quality/domain/dto/qualityinspection/QltQualityInspectionUpdateReq.java @@ -57,6 +57,15 @@ public class QltQualityInspectionUpdateReq implements Serializable { */ private String inspectionImgFile; + /** + * 整改单位(1分包 2班组) + */ + private String rectificationUnit; + + /** + * 整改单位id + */ + private Long rectificationId; /** * 班组id diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRewardsPunishmentsController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRewardsPunishmentsController.java index fa3cece4..4c139790 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRewardsPunishmentsController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRewardsPunishmentsController.java @@ -1,6 +1,7 @@ package org.dromara.safety.controller; import java.util.List; +import java.util.Map; import lombok.RequiredArgsConstructor; import jakarta.servlet.http.HttpServletResponse; @@ -13,6 +14,12 @@ import org.dromara.contractor.service.ISubContractorService; import org.dromara.project.domain.BusProjectTeam; import org.dromara.project.service.IBusProjectTeamService; import org.dromara.safety.domain.HseViolationRecord; +import org.dromara.safety.domain.dto.safetyinspection.HseSafetyInspectionQueryReq; +import org.dromara.safety.domain.dto.violationrecord.HseViolationRecordQueryReq; +import org.dromara.safety.domain.vo.HseRPCountVo; +import org.dromara.safety.domain.vo.safetyinspection.HseSafetyInspectionVo; +import org.dromara.safety.domain.vo.violationrecord.HseViolationRecordVo; +import org.dromara.safety.service.IHseSafetyInspectionService; import org.dromara.safety.service.IHseViolationRecordService; import org.dromara.system.domain.SysUser; import org.dromara.system.service.ISysUserService; @@ -52,6 +59,8 @@ public class HseRewardsPunishmentsController extends BaseController { private final ISubConstructionUserService constructionUserService; + private final IHseSafetyInspectionService safetyInspectionService; + private final IHseViolationRecordService hseViolationRecordService; /** * 查询奖惩记录列表 @@ -120,6 +129,22 @@ public class HseRewardsPunishmentsController extends BaseController { return toAjax(hseRewardsPunishmentsService.deleteWithValidByIds(List.of(ids), true)); } + /** + * 金额统计 + */ + @GetMapping("/amountCount/{projectId}") + public R amountCount(@PathVariable Long projectId) { + return R.ok(hseRewardsPunishmentsService.amountCount(projectId)); + } + + /** + * 类型统计 + */ + @GetMapping("/typeCount/{projectId}") + public R> typeCount(@PathVariable Long projectId) { + return R.ok(hseRewardsPunishmentsService.typeCount(projectId)); + } + /** * 分包单位列表 @@ -163,8 +188,23 @@ public class HseRewardsPunishmentsController extends BaseController { } + /** + * 查询安全工单列表 + */ + @GetMapping("/safetyInspectionList") + public TableDataInfo safetyInspectionList(HseSafetyInspectionQueryReq req, PageQuery pageQuery) { + req.setCheckCorrectorNull(true); + return safetyInspectionService.queryPageListWeb(req, pageQuery); + } - + /** + * 查询AI工单列表 + */ + @GetMapping("/aiList") + public TableDataInfo aiList(HseViolationRecordQueryReq req, PageQuery pageQuery) { + req.setCheckCorrectorNull(true); + return hseViolationRecordService.queryPageList(req, pageQuery); + } } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRpObjectController.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRpObjectController.java index 56a310db..a249a26d 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRpObjectController.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/controller/HseRpObjectController.java @@ -102,4 +102,16 @@ public class HseRpObjectController extends BaseController { @PathVariable Long[] ids) { return toAjax(hseRpPersonService.deleteWithValidByIds(List.of(ids), true)); } + + /** + * 奖惩对象列表 + */ + @GetMapping("/objectList/{rpId}") + public R> objectList(@PathVariable Long rpId) { + HseRpObjectBo bo = new HseRpObjectBo(); + bo.setRpId(rpId); + List list = hseRpPersonService.queryList(bo); + return R.ok(list); + } + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/HseRewardsPunishments.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/HseRewardsPunishments.java index 14fb6548..c2d031f4 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/HseRewardsPunishments.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/HseRewardsPunishments.java @@ -33,6 +33,11 @@ public class HseRewardsPunishments extends BaseEntity { */ private String rpCode; + /** + * 项目ID + */ + private Long projectId; + /** * 类型:1-奖励,2-惩罚 */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/bo/HseRewardsPunishmentsBo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/bo/HseRewardsPunishmentsBo.java index e8bb28a2..22984dc7 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/bo/HseRewardsPunishmentsBo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/bo/HseRewardsPunishmentsBo.java @@ -9,6 +9,7 @@ import lombok.Data; import lombok.EqualsAndHashCode; import jakarta.validation.constraints.*; import java.math.BigDecimal; +import java.util.Date; import java.util.List; /** @@ -33,6 +34,8 @@ public class HseRewardsPunishmentsBo extends BaseEntity { */ private String rpCode; + private Long projectId; + /** * 类型:1-奖励,2-惩罚 */ @@ -86,7 +89,19 @@ public class HseRewardsPunishmentsBo extends BaseEntity { /** - * 备注 + * 开始时间 + */ + private Date startTime; + + /** + * 结束时间 + */ + private Date endTime; + + + + /** + * 对象信息 */ private List persons; diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionQueryReq.java index e3b17f29..c0c9c62b 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionQueryReq.java @@ -62,4 +62,7 @@ public class HseSafetyInspectionQueryReq implements Serializable { private Long createBy; + + + private Boolean checkCorrectorNull=false; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionUpdateReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionUpdateReq.java index d2288bfa..a8880e22 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionUpdateReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/safetyinspection/HseSafetyInspectionUpdateReq.java @@ -49,6 +49,16 @@ public class HseSafetyInspectionUpdateReq implements Serializable { */ private String inspectionResult; + /** + * 整改单位(1分包 2班组) + */ + private String rectificationUnit; + + /** + * 整改单位id + */ + private Long rectificationId; + /** * 整改班组id */ diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java index 5df372d0..d4e8c1af 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/dto/violationrecord/HseViolationRecordQueryReq.java @@ -48,4 +48,6 @@ public class HseViolationRecordQueryReq implements Serializable { private String status; + private Boolean checkCorrectorNull=false; + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/HseRPCountVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/HseRPCountVo.java new file mode 100644 index 00000000..b73954b7 --- /dev/null +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/HseRPCountVo.java @@ -0,0 +1,56 @@ +package org.dromara.safety.domain.vo; + +import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; +import com.alibaba.excel.annotation.ExcelProperty; +import io.github.linpeilie.annotations.AutoMapper; +import lombok.Data; +import org.dromara.common.excel.annotation.ExcelDictFormat; +import org.dromara.common.excel.convert.ExcelDictConvert; +import org.dromara.common.translation.annotation.Translation; +import org.dromara.common.translation.constant.TransConstant; +import org.dromara.safety.domain.HseRewardsPunishments; + +import java.io.Serial; +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + + +/** + * 奖惩记录视图对象 hse_rewards_punishments + * + * @author Lion Li + * @date 2025-12-04 + */ +@Data +@ExcelIgnoreUnannotated +@AutoMapper(target = HseRewardsPunishments.class) +public class HseRPCountVo implements Serializable { + + @Serial + private static final long serialVersionUID = 1L; + + /** + * 总数 + */ + private Integer total; + + /** + * 待审批数量 + */ + private Long waitApproval; + + /** + * 奖励金额 + */ + private BigDecimal reward; + + /** + * 惩罚金额 + */ + private BigDecimal penalty; + + + +} diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/HseRewardsPunishmentsVo.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/HseRewardsPunishmentsVo.java index bbdfaff7..f35f8792 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/HseRewardsPunishmentsVo.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/domain/vo/HseRewardsPunishmentsVo.java @@ -1,6 +1,9 @@ package org.dromara.safety.domain.vo; import java.math.BigDecimal; + +import org.dromara.common.translation.annotation.Translation; +import org.dromara.common.translation.constant.TransConstant; import org.dromara.safety.domain.HseRewardsPunishments; import com.alibaba.excel.annotation.ExcelIgnoreUnannotated; import com.alibaba.excel.annotation.ExcelProperty; @@ -12,7 +15,7 @@ import lombok.Data; import java.io.Serial; import java.io.Serializable; import java.util.Date; - +import java.util.List; /** @@ -42,6 +45,8 @@ public class HseRewardsPunishmentsVo implements Serializable { @ExcelDictFormat(readConverterExp = "如=RP001") private String rpCode; + private Long projectId; + /** * 类型:1-奖励,2-惩罚 */ @@ -74,6 +79,12 @@ public class HseRewardsPunishmentsVo implements Serializable { @ExcelProperty(value = "发起人") private Long submitter; + /** + * 发起人名称 + */ + @Translation(type = TransConstant.USER_ID_TO_NICKNAME, mapper = "submitter") + private String submitterName; + /** * 奖惩对象类型(1-分包 2-班组 3-人) */ @@ -99,11 +110,25 @@ public class HseRewardsPunishmentsVo implements Serializable { @ExcelProperty(value = "附件") private String file; + /** + * 附件url + */ + @Translation(type = TransConstant.OSS_ID_TO_URL, mapper = "file") + private String fileUrl; + /** * 备注 */ @ExcelProperty(value = "备注") private String remark; + /** + * 创建时间 + */ + private Date createTime; + /** + * 奖惩对象列表 + */ + private List rpObjects; } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseRewardsPunishmentsService.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseRewardsPunishmentsService.java index 2901ba89..e44ce68d 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseRewardsPunishmentsService.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/IHseRewardsPunishmentsService.java @@ -1,5 +1,6 @@ package org.dromara.safety.service; +import org.dromara.safety.domain.vo.HseRPCountVo; import org.dromara.safety.domain.vo.HseRewardsPunishmentsVo; import org.dromara.safety.domain.bo.HseRewardsPunishmentsBo; import org.dromara.safety.domain.HseRewardsPunishments; @@ -7,8 +8,11 @@ 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.springframework.web.bind.annotation.PathVariable; + import java.util.Collection; import java.util.List; +import java.util.Map; /** * 奖惩记录Service接口 @@ -67,4 +71,20 @@ public interface IHseRewardsPunishmentsService extends IService ids, Boolean isValid); + + + /** + * 金额统计 + * + * @param projectId 项目ID + */ + HseRPCountVo amountCount( Long projectId); + + + /** + * 类型统计 + * + * @param projectId 项目ID + */ + Map typeCount(Long projectId); } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseQuestionUserAnswerServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseQuestionUserAnswerServiceImpl.java index 77bc7338..285421b8 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseQuestionUserAnswerServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseQuestionUserAnswerServiceImpl.java @@ -215,7 +215,7 @@ public class HseQuestionUserAnswerServiceImpl extends ServiceImpl idCardList = tempList.stream().map(HseQuestionUserAnswerUploadTemp::getUserIdCard) diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseRewardsPunishmentsServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseRewardsPunishmentsServiceImpl.java index 2c1e6ca5..a272fe9f 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseRewardsPunishmentsServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseRewardsPunishmentsServiceImpl.java @@ -1,6 +1,12 @@ package org.dromara.safety.service.impl; +import cn.hutool.core.convert.Convert; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import org.dromara.common.core.domain.event.ProcessDeleteEvent; +import org.dromara.common.core.domain.event.ProcessEvent; +import org.dromara.common.core.domain.event.ProcessTaskEvent; +import org.dromara.common.core.enums.BusinessStatusEnum; import org.dromara.common.core.utils.MapstructUtils; import org.dromara.common.core.utils.StringUtils; import org.dromara.common.mybatis.core.page.TableDataInfo; @@ -9,16 +15,26 @@ 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.design.domain.DesScheme; +import org.dromara.safety.domain.HseRpObject; +import org.dromara.safety.domain.bo.HseRpObjectBo; +import org.dromara.safety.domain.vo.HseRPCountVo; +import org.dromara.safety.domain.vo.HseRpPersonVo; +import org.dromara.safety.service.IHseRpObjectService; +import org.dromara.system.domain.vo.SysDictDataVo; +import org.dromara.system.service.ISysDictTypeService; +import org.springframework.context.event.EventListener; import org.springframework.stereotype.Service; import org.dromara.safety.domain.bo.HseRewardsPunishmentsBo; import org.dromara.safety.domain.vo.HseRewardsPunishmentsVo; import org.dromara.safety.domain.HseRewardsPunishments; import org.dromara.safety.mapper.HseRewardsPunishmentsMapper; import org.dromara.safety.service.IHseRewardsPunishmentsService; +import org.springframework.transaction.annotation.Transactional; -import java.util.List; -import java.util.Map; -import java.util.Collection; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; /** * 奖惩记录Service业务层处理 @@ -28,10 +44,14 @@ import java.util.Collection; */ @RequiredArgsConstructor @Service +@Slf4j public class HseRewardsPunishmentsServiceImpl extends ServiceImpl implements IHseRewardsPunishmentsService { private final HseRewardsPunishmentsMapper baseMapper; + private final IHseRpObjectService rpObjectService; + + private final ISysDictTypeService dictTypeService; /** * 查询奖惩记录 * @@ -40,7 +60,12 @@ public class HseRewardsPunishmentsServiceImpl extends ServiceImpl hseRpPersonVos = rpObjectService.queryList(hseRpObjectBo); + hseRewardsPunishmentsVo.setRpObjects(hseRpPersonVos); + return hseRewardsPunishmentsVo; } /** @@ -73,6 +98,7 @@ public class HseRewardsPunishmentsServiceImpl extends ServiceImpl params = bo.getParams(); LambdaQueryWrapper lqw = Wrappers.lambdaQuery(); lqw.orderByDesc(HseRewardsPunishments::getId); + lqw.eq(bo.getProjectId()!=null, HseRewardsPunishments::getProjectId, bo.getProjectId()); lqw.eq(StringUtils.isNotBlank(bo.getRpCode()), HseRewardsPunishments::getRpCode, bo.getRpCode()); lqw.eq(StringUtils.isNotBlank(bo.getType()), HseRewardsPunishments::getType, bo.getType()); lqw.eq(StringUtils.isNotBlank(bo.getCategory()), HseRewardsPunishments::getCategory, bo.getCategory()); @@ -83,6 +109,7 @@ public class HseRewardsPunishmentsServiceImpl extends ServiceImpl hseRpObjects = new ArrayList<>(); + for (HseRpObjectBo item : bo.getPersons()) { + HseRpObject hseRpObject = new HseRpObject(); + hseRpObject.setRpId(add.getId()); + hseRpObject.setObjectId(item.getObjectId()); + hseRpObject.setObjectName(item.getObjectName()); + hseRpObject.setAmount(item.getAmount()); + hseRpObjects.add(hseRpObject); + } + if (!hseRpObjects.isEmpty()) { + rpObjectService.saveBatch(hseRpObjects); + } return flag; } @@ -137,4 +177,88 @@ public class HseRewardsPunishmentsServiceImpl extends ServiceImpl 0; } + + @Override + public HseRPCountVo amountCount(Long projectId) { + List list = lambdaQuery().eq(HseRewardsPunishments::getProjectId, projectId).list(); + HseRPCountVo hseRPCountVo = new HseRPCountVo(); + hseRPCountVo.setTotal(list.size()); + hseRPCountVo.setWaitApproval(list.stream().filter(item -> BusinessStatusEnum.WAITING.getStatus().equals(item.getStatus())).count()); + hseRPCountVo.setReward(list.stream().filter(item -> "1".equals(item.getType())).map(HseRewardsPunishments::getAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); + hseRPCountVo.setPenalty(list.stream().filter(item -> "2".equals(item.getType())).map(HseRewardsPunishments::getAmount).reduce(BigDecimal::add).orElse(BigDecimal.ZERO)); + return hseRPCountVo; + } + + @Override + public Map typeCount(Long projectId) { + List list = lambdaQuery().eq(HseRewardsPunishments::getProjectId, projectId).list(); + + // 按category分组并统计数量 + Map categoryCountMap = list.stream() + // 过滤空分类(可选,根据业务需求决定是否保留null分类) + .filter(item -> item.getCategory() != null && !item.getCategory().trim().isEmpty()) + // 分组字段:category,统计方式:计数 + .collect(Collectors.groupingBy( + HseRewardsPunishments::getCategory, // 分组依据 + Collectors.counting() // 统计每个分组的数量 + )); + + List workOrderCategory = dictTypeService.selectDictDataByType("work_order_category"); + Map linkedHashMap = new LinkedHashMap<>(); + for (SysDictDataVo item : workOrderCategory) { + linkedHashMap.put(item.getDictLabel(), categoryCountMap.getOrDefault(item.getDictValue(), 0L)); + } + return linkedHashMap; + } + + /** + * 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等) + * 正常使用只需#processEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processEvent 参数 + */ + @org.springframework.context.event.EventListener(condition = "#processEvent.flowCode.endsWith('RewardsPunishments')") + public void processHandler(ProcessEvent processEvent) { + log.info("设计方案审核任务执行了{}", processEvent.toString()); + HseRewardsPunishments rewardsPunishments = this.getById(Convert.toLong(processEvent.getBusinessId())); + rewardsPunishments.setStatus(processEvent.getStatus()); + if (processEvent.getSubmit()) { + rewardsPunishments.setStatus(BusinessStatusEnum.WAITING.getStatus()); + } + this.updateById(rewardsPunishments); + + } + + /** + * 执行任务创建监听 + * 示例:也可通过 @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")进行判断 + * 在方法中判断流程节点key + * if ("xxx".equals(processTaskEvent.getNodeCode())) { + * //执行业务逻辑 + * } + * + * @param processTaskEvent 参数 + */ + @org.springframework.context.event.EventListener(condition = "#processTaskEvent.flowCode.endsWith('completeScheme')") + public void processTaskHandler(ProcessTaskEvent processTaskEvent) { + log.info("设计方案审核任务创建了{}", processTaskEvent.toString()); + } + + /** + * 监听删除流程事件 + * 正常使用只需#processDeleteEvent.flowCode=='leave1' + * 示例为了方便则使用startsWith匹配了全部示例key + * + * @param processDeleteEvent 参数 + */ + @EventListener(condition = "#processDeleteEvent.flowCode.endsWith('completeScheme')") + public void processDeleteHandler(ProcessDeleteEvent processDeleteEvent) { + log.info("监听删除流程事件,设计方案审核任务执行了{}", processDeleteEvent.toString()); + } + + + + + } diff --git a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseSafetyInspectionServiceImpl.java b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseSafetyInspectionServiceImpl.java index 7cd502d2..5fc7b752 100644 --- a/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseSafetyInspectionServiceImpl.java +++ b/xinnengyuan/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/safety/service/impl/HseSafetyInspectionServiceImpl.java @@ -395,6 +395,7 @@ public class HseSafetyInspectionServiceImpl extends ServiceImpl