奖惩
This commit is contained in:
@ -110,6 +110,7 @@ public class OutConstructionValueRangeServiceImpl extends ServiceImpl<OutConstru
|
||||
OutConstructionValueRangeVo vo = baseMapper.selectVoById(id);
|
||||
OutConstructionValueBo bo = new OutConstructionValueBo();
|
||||
bo.setRangeId(id);
|
||||
bo.setProjectId(vo.getProjectId());
|
||||
vo.setConstructionValueVoList(constructionValueService.queryList(bo));
|
||||
return vo;
|
||||
}
|
||||
|
||||
@ -2,15 +2,25 @@ package org.dromara.safety.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.constraints.*;
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import org.dromara.contractor.domain.SubContractor;
|
||||
import org.dromara.contractor.service.ISubContractorService;
|
||||
import org.dromara.project.domain.BusProjectTeam;
|
||||
import org.dromara.project.domain.dto.projectteammember.BusProjectTeamMemberQueryReq;
|
||||
import org.dromara.project.domain.vo.projectteammember.BusProjectTeamMemberVo;
|
||||
import org.dromara.project.service.IBusProjectTeamMemberService;
|
||||
import org.dromara.project.service.IBusProjectTeamService;
|
||||
import org.dromara.safety.domain.bo.HazardRuleBo;
|
||||
import org.dromara.safety.domain.dto.EvaluateDto;
|
||||
import org.dromara.safety.domain.vo.HazardRuleVo;
|
||||
import org.dromara.safety.domain.vo.HiddenDangerCountVo;
|
||||
import org.dromara.safety.service.IHazardRuleService;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.dromara.common.idempotent.annotation.RepeatSubmit;
|
||||
@ -43,6 +53,14 @@ public class HazardHiddenDangerController extends BaseController {
|
||||
|
||||
private final IHazardRuleService hazardRuleService;
|
||||
|
||||
private final ISubContractorService contractorService;
|
||||
|
||||
private final ISysUserService userService;
|
||||
|
||||
private final IBusProjectTeamService projectTeamService;
|
||||
|
||||
private final IBusProjectTeamMemberService projectTeamMemberService;
|
||||
|
||||
/**
|
||||
* 查询隐患信息列表
|
||||
*/
|
||||
@ -68,7 +86,7 @@ public class HazardHiddenDangerController extends BaseController {
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDanger:query")
|
||||
// @SaCheckPermission("safety:hiddenDanger:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<HazardHiddenDangerVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
@ -118,8 +136,6 @@ public class HazardHiddenDangerController extends BaseController {
|
||||
return R.ok(count);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 隐患级别列表
|
||||
*/
|
||||
@ -129,11 +145,10 @@ public class HazardHiddenDangerController extends BaseController {
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 评估隐患
|
||||
*/
|
||||
@SaCheckPermission("safety:hiddenDanger:edit")
|
||||
@SaCheckPermission("safety:hiddenDanger:evaluate")
|
||||
@Log(title = "隐患信息", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping("/evaluate")
|
||||
@ -142,19 +157,54 @@ public class HazardHiddenDangerController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分包单位列表
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
@GetMapping("/contractorList")
|
||||
public R<List<SubContractor>> contractorList(Long projectId) {
|
||||
List<SubContractor> list = contractorService.lambdaQuery()
|
||||
.select(SubContractor::getId, SubContractor::getName)
|
||||
.eq(SubContractor::getProjectId, projectId)
|
||||
.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分包人员列表
|
||||
* @param contractorId 分包ID
|
||||
*/
|
||||
@GetMapping("/contractorUserList")
|
||||
public R<List<SysUser>> contractorUserList(Long contractorId) {
|
||||
List<SysUser> sysUsers = userService.selectUserListByContractorId(contractorId);
|
||||
return R.ok(sysUsers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组列表
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
@GetMapping("/teamList")
|
||||
public R<List<BusProjectTeam>> teamList(Long projectId) {
|
||||
List<BusProjectTeam> list = projectTeamService.lambdaQuery()
|
||||
.select(BusProjectTeam::getId, BusProjectTeam::getTeamName)
|
||||
.eq(BusProjectTeam::getProjectId, projectId)
|
||||
.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 班组长列表
|
||||
* @param teamId 班组ID
|
||||
*/
|
||||
@GetMapping("/teamUserList")
|
||||
public R<List<BusProjectTeamMemberVo>> teamUserList(Long teamId) {
|
||||
BusProjectTeamMemberQueryReq req = new BusProjectTeamMemberQueryReq();
|
||||
req.setTeamId(teamId);
|
||||
req.setPostId("1");
|
||||
List<BusProjectTeamMemberVo> busProjectTeamMemberVos = projectTeamMemberService.queryList(req);
|
||||
return R.ok(busProjectTeamMemberVos);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,170 @@
|
||||
package org.dromara.safety.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.dromara.contractor.domain.SubConstructionUser;
|
||||
import org.dromara.contractor.domain.SubContractor;
|
||||
import org.dromara.contractor.service.ISubConstructionUserService;
|
||||
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.service.IHseViolationRecordService;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
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 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.domain.vo.HseRewardsPunishmentsVo;
|
||||
import org.dromara.safety.domain.bo.HseRewardsPunishmentsBo;
|
||||
import org.dromara.safety.service.IHseRewardsPunishmentsService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 奖惩记录
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/safety/rewardsPunishments")
|
||||
public class HseRewardsPunishmentsController extends BaseController {
|
||||
|
||||
private final IHseRewardsPunishmentsService hseRewardsPunishmentsService;
|
||||
|
||||
private final ISubContractorService contractorService;
|
||||
|
||||
private final IBusProjectTeamService projectTeamService;
|
||||
|
||||
private final ISubConstructionUserService constructionUserService;
|
||||
|
||||
private final IHseViolationRecordService hseViolationRecordService;
|
||||
/**
|
||||
* 查询奖惩记录列表
|
||||
*/
|
||||
@SaCheckPermission("safety:rewardsPunishments:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HseRewardsPunishmentsVo> list(HseRewardsPunishmentsBo bo, PageQuery pageQuery) {
|
||||
return hseRewardsPunishmentsService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出奖惩记录列表
|
||||
*/
|
||||
@SaCheckPermission("safety:rewardsPunishments:export")
|
||||
@Log(title = "奖惩记录", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HseRewardsPunishmentsBo bo, HttpServletResponse response) {
|
||||
List<HseRewardsPunishmentsVo> list = hseRewardsPunishmentsService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "奖惩记录", HseRewardsPunishmentsVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取奖惩记录详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:rewardsPunishments:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<HseRewardsPunishmentsVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(hseRewardsPunishmentsService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增奖惩记录
|
||||
*/
|
||||
@SaCheckPermission("safety:rewardsPunishments:add")
|
||||
@Log(title = "奖惩记录", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody HseRewardsPunishmentsBo bo) {
|
||||
return toAjax(hseRewardsPunishmentsService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改奖惩记录
|
||||
*/
|
||||
@SaCheckPermission("safety:rewardsPunishments:edit")
|
||||
@Log(title = "奖惩记录", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HseRewardsPunishmentsBo bo) {
|
||||
return toAjax(hseRewardsPunishmentsService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除奖惩记录
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:rewardsPunishments:remove")
|
||||
@Log(title = "奖惩记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(hseRewardsPunishmentsService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 分包单位列表
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
@GetMapping("/contractorList")
|
||||
public R<List<SubContractor>> contractorList(Long projectId) {
|
||||
List<SubContractor> list = contractorService.lambdaQuery()
|
||||
.select(SubContractor::getId, SubContractor::getName)
|
||||
.eq(SubContractor::getProjectId, projectId)
|
||||
.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 班组列表
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
@GetMapping("/teamList")
|
||||
public R<List<BusProjectTeam>> teamList(Long projectId) {
|
||||
List<BusProjectTeam> list = projectTeamService.lambdaQuery()
|
||||
.select(BusProjectTeam::getId, BusProjectTeam::getTeamName)
|
||||
.eq(BusProjectTeam::getProjectId, projectId)
|
||||
.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 施工人员列表
|
||||
* @param projectId 项目ID
|
||||
*/
|
||||
@GetMapping("/constructUserList")
|
||||
public R<List<SubConstructionUser>> constructUserList(Long projectId) {
|
||||
List<SubConstructionUser> list = constructionUserService.lambdaQuery()
|
||||
.select(SubConstructionUser::getSysUserId, SubConstructionUser::getUserName)
|
||||
.eq(SubConstructionUser::getProjectId, projectId)
|
||||
.isNotNull(SubConstructionUser::getTeamId)
|
||||
.eq(SubConstructionUser::getUserRole, "0")
|
||||
.list();
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,105 @@
|
||||
package org.dromara.safety.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 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.domain.vo.HseRpPersonVo;
|
||||
import org.dromara.safety.domain.bo.HseRpObjectBo;
|
||||
import org.dromara.safety.service.IHseRpObjectService;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 奖惩对象
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Validated
|
||||
@RequiredArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/safety/rpPerson")
|
||||
public class HseRpObjectController extends BaseController {
|
||||
|
||||
private final IHseRpObjectService hseRpPersonService;
|
||||
|
||||
/**
|
||||
* 查询奖惩对象列表
|
||||
*/
|
||||
@SaCheckPermission("safety:rpPerson:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo<HseRpPersonVo> list(HseRpObjectBo bo, PageQuery pageQuery) {
|
||||
return hseRpPersonService.queryPageList(bo, pageQuery);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出奖惩对象列表
|
||||
*/
|
||||
@SaCheckPermission("safety:rpPerson:export")
|
||||
@Log(title = "奖惩对象", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HseRpObjectBo bo, HttpServletResponse response) {
|
||||
List<HseRpPersonVo> list = hseRpPersonService.queryList(bo);
|
||||
ExcelUtil.exportExcel(list, "奖惩对象", HseRpPersonVo.class, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取奖惩对象详细信息
|
||||
*
|
||||
* @param id 主键
|
||||
*/
|
||||
@SaCheckPermission("safety:rpPerson:query")
|
||||
@GetMapping("/{id}")
|
||||
public R<HseRpPersonVo> getInfo(@NotNull(message = "主键不能为空")
|
||||
@PathVariable Long id) {
|
||||
return R.ok(hseRpPersonService.queryById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增奖惩对象
|
||||
*/
|
||||
@SaCheckPermission("safety:rpPerson:add")
|
||||
@Log(title = "奖惩对象", businessType = BusinessType.INSERT)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody HseRpObjectBo bo) {
|
||||
return toAjax(hseRpPersonService.insertByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改奖惩对象
|
||||
*/
|
||||
@SaCheckPermission("safety:rpPerson:edit")
|
||||
@Log(title = "奖惩对象", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody HseRpObjectBo bo) {
|
||||
return toAjax(hseRpPersonService.updateByBo(bo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除奖惩对象
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("safety:rpPerson:remove")
|
||||
@Log(title = "奖惩对象", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Long[] ids) {
|
||||
return toAjax(hseRpPersonService.deleteWithValidByIds(List.of(ids), true));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,87 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 奖惩记录对象 hse_rewards_punishments
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hse_rewards_punishments")
|
||||
public class HseRewardsPunishments extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 奖惩编号(如RP001)
|
||||
*/
|
||||
private String rpCode;
|
||||
|
||||
/**
|
||||
* 类型:1-奖励,2-惩罚
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 分类(如AI工单、其他、安全工单等)
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 金额(元)
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 关联工单id
|
||||
*/
|
||||
private Long relatedWorkId;
|
||||
|
||||
/**
|
||||
* 发起人
|
||||
*/
|
||||
private Long submitter;
|
||||
|
||||
/**
|
||||
* 奖惩对象类型(1-分包 2-班组 3-人)
|
||||
*/
|
||||
private String recipientType;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 奖惩原因
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
private String file;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package org.dromara.safety.domain;
|
||||
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* 奖惩对象对象 hse_rp_person
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("hse_rp_object")
|
||||
public class HseRpObject extends BaseEntity {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(value = "id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联奖惩记录ID(rewards_punishments.id)
|
||||
*/
|
||||
private Long rpId;
|
||||
|
||||
/**
|
||||
* 对象id
|
||||
*/
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 对象名称(人员姓名或班组名称)
|
||||
*/
|
||||
private String objectName;
|
||||
|
||||
/**
|
||||
* 个人/班组金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,94 @@
|
||||
package org.dromara.safety.domain.bo;
|
||||
|
||||
import org.dromara.safety.domain.HseRewardsPunishments;
|
||||
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 lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 奖惩记录业务对象 hse_rewards_punishments
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = HseRewardsPunishments.class, reverseConvertGenerate = false)
|
||||
public class HseRewardsPunishmentsBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 奖惩编号(如RP001)
|
||||
*/
|
||||
private String rpCode;
|
||||
|
||||
/**
|
||||
* 类型:1-奖励,2-惩罚
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 分类(如AI工单、其他、安全工单等)
|
||||
*/
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 金额(元)
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 关联工单id
|
||||
*/
|
||||
private Long relatedWorkId;
|
||||
|
||||
/**
|
||||
* 发起人
|
||||
*/
|
||||
@NotNull(message = "发起人不能为空", groups = { AddGroup.class, EditGroup.class })
|
||||
private Long submitter;
|
||||
|
||||
/**
|
||||
* 奖惩对象类型(1-分包 2-班组 3-人)
|
||||
*/
|
||||
private String recipientType;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 奖惩原因
|
||||
*/
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
private String file;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private List<HseRpObjectBo> persons;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package org.dromara.safety.domain.bo;
|
||||
|
||||
import org.dromara.safety.domain.HseRpObject;
|
||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
||||
import org.dromara.common.core.validate.EditGroup;
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 奖惩对象业务对象 hse_rp_person
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@AutoMapper(target = HseRpObject.class, reverseConvertGenerate = false)
|
||||
public class HseRpObjectBo extends BaseEntity {
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@NotNull(message = "ID不能为空", groups = { EditGroup.class })
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联奖惩记录ID(rewards_punishments.id)
|
||||
*/
|
||||
private Long rpId;
|
||||
|
||||
/**
|
||||
* 对象id
|
||||
*/
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 对象名称(人员姓名或班组名称)
|
||||
*/
|
||||
private String objectName;
|
||||
|
||||
/**
|
||||
* 个人/班组金额
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
}
|
||||
@ -52,8 +52,18 @@ public class EvaluateDto {
|
||||
private String reporterFile;
|
||||
|
||||
/**
|
||||
* 整改时间
|
||||
* 整改单位 1-班组 2-分包
|
||||
*/
|
||||
private LocalDateTime rectifyTime;
|
||||
private String rectifyUnit;
|
||||
|
||||
/**
|
||||
* 整改单位ID
|
||||
*/
|
||||
private Long rectifyUnitId;
|
||||
|
||||
/**
|
||||
* 整改负责人Id
|
||||
*/
|
||||
private Long rectifyUserId;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,109 @@
|
||||
package org.dromara.safety.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.dromara.safety.domain.HseRewardsPunishments;
|
||||
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 java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 奖惩记录视图对象 hse_rewards_punishments
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = HseRewardsPunishments.class)
|
||||
public class HseRewardsPunishmentsVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 奖惩编号(如RP001)
|
||||
*/
|
||||
@ExcelProperty(value = "奖惩编号", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=RP001")
|
||||
private String rpCode;
|
||||
|
||||
/**
|
||||
* 类型:1-奖励,2-惩罚
|
||||
*/
|
||||
@ExcelProperty(value = "类型:1-奖励,2-惩罚")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 分类(如AI工单、其他、安全工单等)
|
||||
*/
|
||||
@ExcelProperty(value = "分类", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "如=AI工单、其他、安全工单等")
|
||||
private String category;
|
||||
|
||||
/**
|
||||
* 金额(元)
|
||||
*/
|
||||
@ExcelProperty(value = "金额", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "元=")
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 关联工单id
|
||||
*/
|
||||
@ExcelProperty(value = "关联工单id")
|
||||
private Long relatedWorkId;
|
||||
|
||||
/**
|
||||
* 发起人
|
||||
*/
|
||||
@ExcelProperty(value = "发起人")
|
||||
private Long submitter;
|
||||
|
||||
/**
|
||||
* 奖惩对象类型(1-分包 2-班组 3-人)
|
||||
*/
|
||||
@ExcelProperty(value = "奖惩对象类型", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "1=-分包,2=-班组,3=-人")
|
||||
private String recipientType;
|
||||
|
||||
/**
|
||||
* 审核状态
|
||||
*/
|
||||
@ExcelProperty(value = "审核状态")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 奖惩原因
|
||||
*/
|
||||
@ExcelProperty(value = "奖惩原因")
|
||||
private String reason;
|
||||
|
||||
/**
|
||||
* 附件
|
||||
*/
|
||||
@ExcelProperty(value = "附件")
|
||||
private String file;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package org.dromara.safety.domain.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import org.dromara.safety.domain.HseRpObject;
|
||||
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 java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* 奖惩对象视图对象 hse_rp_person
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
@AutoMapper(target = HseRpObject.class)
|
||||
public class HseRpPersonVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@ExcelProperty(value = "ID")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 关联奖惩记录ID(rewards_punishments.id)
|
||||
*/
|
||||
@ExcelProperty(value = "关联奖惩记录ID", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "r=ewards_punishments.id")
|
||||
private Long rpId;
|
||||
|
||||
/**
|
||||
* 对象id
|
||||
*/
|
||||
@ExcelProperty(value = "对象id")
|
||||
private Long objectId;
|
||||
|
||||
/**
|
||||
* 对象名称(人员姓名或班组名称)
|
||||
*/
|
||||
@ExcelProperty(value = "对象名称", converter = ExcelDictConvert.class)
|
||||
@ExcelDictFormat(readConverterExp = "人=员姓名或班组名称")
|
||||
private String objectName;
|
||||
|
||||
/**
|
||||
* 个人/班组金额
|
||||
*/
|
||||
@ExcelProperty(value = "个人/班组金额")
|
||||
private BigDecimal amount;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import org.dromara.safety.domain.HseRewardsPunishments;
|
||||
import org.dromara.safety.domain.vo.HseRewardsPunishmentsVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 奖惩记录Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface HseRewardsPunishmentsMapper extends BaseMapperPlus<HseRewardsPunishments, HseRewardsPunishmentsVo> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package org.dromara.safety.mapper;
|
||||
|
||||
import org.dromara.safety.domain.HseRpObject;
|
||||
import org.dromara.safety.domain.vo.HseRpPersonVo;
|
||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||
|
||||
/**
|
||||
* 奖惩对象Mapper接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface HseRpObjectMapper extends BaseMapperPlus<HseRpObject, HseRpPersonVo> {
|
||||
|
||||
}
|
||||
@ -9,6 +9,8 @@ import org.dromara.safety.domain.HseViolationRecord;
|
||||
import org.dromara.safety.domain.vo.violationrecord.HseViolationRecordVo;
|
||||
import org.dromara.system.domain.SysUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 违规记录Mapper接口
|
||||
*
|
||||
@ -18,4 +20,8 @@ import org.dromara.system.domain.SysUser;
|
||||
public interface HseViolationRecordMapper extends BaseMapperPlus<HseViolationRecord, HseViolationRecordVo> {
|
||||
|
||||
Page<HseViolationRecord> selectPageList(@Param("page") Page<HseViolationRecord> page, @Param(Constants.WRAPPER) Wrapper<HseViolationRecord> queryWrapper);
|
||||
|
||||
List<HseViolationRecord> selectLatestList( @Param(Constants.WRAPPER) Wrapper<HseViolationRecord> queryWrapper);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,70 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import org.dromara.safety.domain.vo.HseRewardsPunishmentsVo;
|
||||
import org.dromara.safety.domain.bo.HseRewardsPunishmentsBo;
|
||||
import org.dromara.safety.domain.HseRewardsPunishments;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 奖惩记录Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface IHseRewardsPunishmentsService extends IService<HseRewardsPunishments>{
|
||||
|
||||
/**
|
||||
* 查询奖惩记录
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 奖惩记录
|
||||
*/
|
||||
HseRewardsPunishmentsVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询奖惩记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 奖惩记录分页列表
|
||||
*/
|
||||
TableDataInfo<HseRewardsPunishmentsVo> queryPageList(HseRewardsPunishmentsBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的奖惩记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 奖惩记录列表
|
||||
*/
|
||||
List<HseRewardsPunishmentsVo> queryList(HseRewardsPunishmentsBo bo);
|
||||
|
||||
/**
|
||||
* 新增奖惩记录
|
||||
*
|
||||
* @param bo 奖惩记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(HseRewardsPunishmentsBo bo);
|
||||
|
||||
/**
|
||||
* 修改奖惩记录
|
||||
*
|
||||
* @param bo 奖惩记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(HseRewardsPunishmentsBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除奖惩记录信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
package org.dromara.safety.service;
|
||||
|
||||
import org.dromara.safety.domain.vo.HseRpPersonVo;
|
||||
import org.dromara.safety.domain.bo.HseRpObjectBo;
|
||||
import org.dromara.safety.domain.HseRpObject;
|
||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 奖惩对象Service接口
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
public interface IHseRpObjectService extends IService<HseRpObject>{
|
||||
|
||||
/**
|
||||
* 查询奖惩对象
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 奖惩对象
|
||||
*/
|
||||
HseRpPersonVo queryById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询奖惩对象列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 奖惩对象分页列表
|
||||
*/
|
||||
TableDataInfo<HseRpPersonVo> queryPageList(HseRpObjectBo bo, PageQuery pageQuery);
|
||||
|
||||
/**
|
||||
* 查询符合条件的奖惩对象列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 奖惩对象列表
|
||||
*/
|
||||
List<HseRpPersonVo> queryList(HseRpObjectBo bo);
|
||||
|
||||
/**
|
||||
* 新增奖惩对象
|
||||
*
|
||||
* @param bo 奖惩对象
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
Boolean insertByBo(HseRpObjectBo bo);
|
||||
|
||||
/**
|
||||
* 修改奖惩对象
|
||||
*
|
||||
* @param bo 奖惩对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
Boolean updateByBo(HseRpObjectBo bo);
|
||||
|
||||
/**
|
||||
* 校验并批量删除奖惩对象信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid);
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
package org.dromara.safety.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 lombok.RequiredArgsConstructor;
|
||||
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 java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 奖惩记录Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HseRewardsPunishmentsServiceImpl extends ServiceImpl<HseRewardsPunishmentsMapper, HseRewardsPunishments> implements IHseRewardsPunishmentsService {
|
||||
|
||||
private final HseRewardsPunishmentsMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询奖惩记录
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 奖惩记录
|
||||
*/
|
||||
@Override
|
||||
public HseRewardsPunishmentsVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询奖惩记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 奖惩记录分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseRewardsPunishmentsVo> queryPageList(HseRewardsPunishmentsBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<HseRewardsPunishments> lqw = buildQueryWrapper(bo);
|
||||
Page<HseRewardsPunishmentsVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的奖惩记录列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 奖惩记录列表
|
||||
*/
|
||||
@Override
|
||||
public List<HseRewardsPunishmentsVo> queryList(HseRewardsPunishmentsBo bo) {
|
||||
LambdaQueryWrapper<HseRewardsPunishments> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HseRewardsPunishments> buildQueryWrapper(HseRewardsPunishmentsBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<HseRewardsPunishments> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(HseRewardsPunishments::getId);
|
||||
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());
|
||||
lqw.eq(bo.getAmount() != null, HseRewardsPunishments::getAmount, bo.getAmount());
|
||||
lqw.eq(bo.getRelatedWorkId() != null, HseRewardsPunishments::getRelatedWorkId, bo.getRelatedWorkId());
|
||||
lqw.eq(bo.getSubmitter() != null, HseRewardsPunishments::getSubmitter, bo.getSubmitter());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getRecipientType()), HseRewardsPunishments::getRecipientType, bo.getRecipientType());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getStatus()), HseRewardsPunishments::getStatus, bo.getStatus());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getReason()), HseRewardsPunishments::getReason, bo.getReason());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getFile()), HseRewardsPunishments::getFile, bo.getFile());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增奖惩记录
|
||||
*
|
||||
* @param bo 奖惩记录
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(HseRewardsPunishmentsBo bo) {
|
||||
HseRewardsPunishments add = MapstructUtils.convert(bo, HseRewardsPunishments.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改奖惩记录
|
||||
*
|
||||
* @param bo 奖惩记录
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(HseRewardsPunishmentsBo bo) {
|
||||
HseRewardsPunishments update = MapstructUtils.convert(bo, HseRewardsPunishments.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HseRewardsPunishments entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除奖惩记录信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,134 @@
|
||||
package org.dromara.safety.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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.dromara.safety.domain.bo.HseRpObjectBo;
|
||||
import org.dromara.safety.domain.vo.HseRpPersonVo;
|
||||
import org.dromara.safety.domain.HseRpObject;
|
||||
import org.dromara.safety.mapper.HseRpObjectMapper;
|
||||
import org.dromara.safety.service.IHseRpObjectService;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 奖惩对象Service业务层处理
|
||||
*
|
||||
* @author Lion Li
|
||||
* @date 2025-12-04
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Service
|
||||
public class HseRpObjectServiceImpl extends ServiceImpl<HseRpObjectMapper, HseRpObject> implements IHseRpObjectService {
|
||||
|
||||
private final HseRpObjectMapper baseMapper;
|
||||
|
||||
/**
|
||||
* 查询奖惩对象
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 奖惩对象
|
||||
*/
|
||||
@Override
|
||||
public HseRpPersonVo queryById(Long id){
|
||||
return baseMapper.selectVoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询奖惩对象列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return 奖惩对象分页列表
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<HseRpPersonVo> queryPageList(HseRpObjectBo bo, PageQuery pageQuery) {
|
||||
LambdaQueryWrapper<HseRpObject> lqw = buildQueryWrapper(bo);
|
||||
Page<HseRpPersonVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询符合条件的奖惩对象列表
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @return 奖惩对象列表
|
||||
*/
|
||||
@Override
|
||||
public List<HseRpPersonVo> queryList(HseRpObjectBo bo) {
|
||||
LambdaQueryWrapper<HseRpObject> lqw = buildQueryWrapper(bo);
|
||||
return baseMapper.selectVoList(lqw);
|
||||
}
|
||||
|
||||
private LambdaQueryWrapper<HseRpObject> buildQueryWrapper(HseRpObjectBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<HseRpObject> lqw = Wrappers.lambdaQuery();
|
||||
lqw.orderByDesc(HseRpObject::getId);
|
||||
lqw.eq(bo.getRpId() != null, HseRpObject::getRpId, bo.getRpId());
|
||||
lqw.eq(bo.getObjectId() != null, HseRpObject::getObjectId, bo.getObjectId());
|
||||
lqw.like(StringUtils.isNotBlank(bo.getObjectName()), HseRpObject::getObjectName, bo.getObjectName());
|
||||
lqw.eq(bo.getAmount() != null, HseRpObject::getAmount, bo.getAmount());
|
||||
return lqw;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增奖惩对象
|
||||
*
|
||||
* @param bo 奖惩对象
|
||||
* @return 是否新增成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean insertByBo(HseRpObjectBo bo) {
|
||||
HseRpObject add = MapstructUtils.convert(bo, HseRpObject.class);
|
||||
validEntityBeforeSave(add);
|
||||
boolean flag = baseMapper.insert(add) > 0;
|
||||
if (flag) {
|
||||
bo.setId(add.getId());
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改奖惩对象
|
||||
*
|
||||
* @param bo 奖惩对象
|
||||
* @return 是否修改成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateByBo(HseRpObjectBo bo) {
|
||||
HseRpObject update = MapstructUtils.convert(bo, HseRpObject.class);
|
||||
validEntityBeforeSave(update);
|
||||
return baseMapper.updateById(update) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存前的数据校验
|
||||
*/
|
||||
private void validEntityBeforeSave(HseRpObject entity){
|
||||
//TODO 做一些数据校验,如唯一约束
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验并批量删除奖惩对象信息
|
||||
*
|
||||
* @param ids 待删除的主键集合
|
||||
* @param isValid 是否进行有效性校验
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
||||
if(isValid){
|
||||
//TODO 做一些业务上的校验,判断是否需要校验
|
||||
}
|
||||
return baseMapper.deleteByIds(ids) > 0;
|
||||
}
|
||||
}
|
||||
@ -498,4 +498,13 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
|
||||
return vo;
|
||||
}).toList();
|
||||
}
|
||||
|
||||
|
||||
// @Override
|
||||
// public List<HseViolationRecord> selectLatestList(HseViolationRecordQueryReq req) {
|
||||
// LambdaQueryWrapper<HseViolationRecord> lqw = this.buildQueryWrapper(req);
|
||||
// lqw.isNotNull(HseViolationRecord::getJobKey);
|
||||
// lqw.isNotNull(HseViolationRecord::get);
|
||||
// baseMapper.selectLatestList(req);
|
||||
// }
|
||||
}
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HseRewardsPunishmentsMapper">
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.safety.mapper.HseRpObjectMapper">
|
||||
|
||||
</mapper>
|
||||
@ -18,4 +18,19 @@
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
<select id="selectLatestList" resultType="org.dromara.safety.domain.HseViolationRecord">
|
||||
SELECT t.*
|
||||
FROM hse_violation_record t
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
job_key,
|
||||
MAX(version) AS latest_version
|
||||
FROM hse_violation_record
|
||||
WHERE job_key IS NOT NULL
|
||||
AND version IS NOT NULL
|
||||
GROUP BY job_key
|
||||
) sub ON t.job_key = sub.job_key AND t.version = sub.latest_version
|
||||
${ew.getCustomSqlSegment}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user