| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | /** |
| | | * @author Administrator |
| | |
| | | * @createDate 2025-07-08 16:50:15 |
| | | * @Entity com.ruoyi.approve.pojo.ApproveNode |
| | | */ |
| | | @Mapper |
| | | public interface ApproveNodeMapper extends BaseMapper<ApproveNode> { |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | |
| | | * @createDate 2025-07-08 16:44:05 |
| | | * @Entity com.ruoyi.approve.pojo.ApproveProcess |
| | | */ |
| | | @Mapper |
| | | public interface ApproveProcessMapper extends BaseMapper<ApproveProcess> { |
| | | |
| | | IPage<ApproveProcess> listPage(Page page,@Param("req") ApproveProcess approveProcess); |
| | |
| | | @ApiModel |
| | | public class ApproveProcess{ |
| | | /** |
| | | * |
| | | * |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.mapper.ApproveNodeMapper; |
| | | import com.ruoyi.approve.mapper.ApproveProcessMapper; |
| | | import com.ruoyi.approve.pojo.ApproveNode; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.IApproveNodeService; |
| | | import com.ruoyi.approve.vo.ApproveProcessVO; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.device.mapper.DeviceRepairMapper; |
| | |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import com.ruoyi.sales.service.impl.CommonFileServiceImpl; |
| | |
| | | |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | |
| | | |
| | | @Autowired |
| | | private TempFileServiceImpl tempFileService; |
| | | @Autowired |
| | | private ISysNoticeService sysNoticeService; |
| | | |
| | | @Autowired |
| | | private CommonFileMapper fileMapper; |
| | |
| | | approveProcessMapper.updateById(approveProcess); |
| | | |
| | | DeviceRepair deviceRepair = deviceRepairMapper.selectById(approveProcess.getDeviceRepairId()); |
| | | if(deviceRepair == null) throw new RuntimeException("设备报修不存在"); |
| | | if(approveProcess.getApproveStatus().equals(2)){ |
| | | // 同意 |
| | | deviceRepair.setStatus(1); |
| | | }else if(approveProcess.getApproveStatus().equals(3)){ |
| | | // 拒绝 |
| | | deviceRepair.setStatus(2); |
| | | if(ObjectUtils.isNotNull(deviceRepair)) { |
| | | if(approveProcess.getApproveStatus().equals(2)){ |
| | | // 同意 |
| | | deviceRepair.setStatus(1); |
| | | }else if(approveProcess.getApproveStatus().equals(3)){ |
| | | // 拒绝 |
| | | deviceRepair.setStatus(2); |
| | | } |
| | | deviceRepairMapper.updateById(deviceRepair); |
| | | } |
| | | deviceRepairMapper.updateById(deviceRepair); |
| | | // 绑定附件 |
| | | if(!CollectionUtils.isEmpty(approveNode.getTempFileIds()) && approveNode.getApproveNodeStatus() == 1){ |
| | | tempFileService.migrateTempFilesToFormal(approveNode.getId(), approveNode.getTempFileIds(), FileNameType.ApproveNode.getValue()); |
| | |
| | | switch (approveNode.getApproveNodeStatus()){ |
| | | case 1: |
| | | updateApproveProcessStatus(approveNode, Boolean.TRUE.equals(approveNode.getIsLast()) ? 2 : 1); |
| | | /*消息通知*/ |
| | | Integer nodeOrder = approveNode.getApproveNodeOrder(); |
| | | ApproveProcess approveProcess = approveProcessMapper.selectList(Wrappers.<ApproveProcess>lambdaQuery() |
| | | .eq(ApproveProcess::getApproveId, approveNode.getApproveProcessId())).get(0); |
| | | if (approveProcess.getApproveUserIds().split(",").length > nodeOrder){ |
| | | String id = approveProcess.getApproveUserIds().split(",")[nodeOrder]; |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcess.getApproveType()), |
| | | approveNode.getApproveProcessId()+"流程编号的审批需要您审核!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | approveNode.getTenantId(), |
| | | "/collaborativeApproval/approvalProcess?approveType="+approveProcess.getApproveType()+"&approveId="+approveNode.getApproveProcessId()); |
| | | } |
| | | break; |
| | | case 2: |
| | | updateApproveProcessStatus(approveNode, 3); |
| | |
| | | update(queryWrapper); |
| | | } |
| | | |
| | | //审批类型获取(与前端页面对应) |
| | | private String approveProcessType(Integer approveType){ |
| | | switch (approveType){ |
| | | case 1: |
| | | return "公出管理"; |
| | | case 2: |
| | | return "请假管理"; |
| | | case 3: |
| | | return "出差管理"; |
| | | case 4: |
| | | return "报销管理"; |
| | | case 5: |
| | | return "采购审批"; |
| | | case 6: |
| | | return "报价审批"; |
| | | case 7: |
| | | return "出库审批"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.ruoyi.project.system.domain.SysUser; |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.mapper.SysUserMapper; |
| | | import com.ruoyi.project.system.service.ISysNoticeService; |
| | | import com.ruoyi.sales.mapper.CommonFileMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import lombok.AllArgsConstructor; |
| | |
| | | private final ApproveProcessMapper approveProcessMapper; |
| | | private final TempFileServiceImpl tempFileService; |
| | | private final CommonFileMapper commonFileMapper; |
| | | private final ISysNoticeService sysNoticeService; |
| | | |
| | | @Override |
| | | public void addApprove(ApproveProcessVO approveProcessVO) throws Exception { |
| | |
| | | approveNodeService.initApproveNodes(approveProcessVO.getApproveUserIds(),approveID,approveProcessVO.getApproveDeptId()); |
| | | // 附件绑定 |
| | | tempFileService.migrateTempFilesToFormal(approveProcess.getId(), approveProcessVO.getTempFileIds(), FileNameType.ApproveProcess.getValue()); |
| | | /*消息通知*/ |
| | | String id = approveProcessVO.getApproveUserIds().split(",")[0]; |
| | | sysNoticeService.simpleNoticeByUser(approveProcessType(approveProcessVO.getApproveType()), |
| | | approveID+"流程编号的审批需要您审核!!!!!", |
| | | Arrays.asList(Long.valueOf(id)), |
| | | approveProcessVO.getApproveDeptId(), |
| | | "/collaborativeApproval/approvalProcess?approveType="+approveProcessVO.getApproveType()+"&approveId="+approveID); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | |
| | | //审批类型获取(与前端页面对应) |
| | | private String approveProcessType(Integer approveType){ |
| | | switch (approveType){ |
| | | case 1: |
| | | return "公出管理"; |
| | | case 2: |
| | | return "请假管理"; |
| | | case 3: |
| | | return "出差管理"; |
| | | case 4: |
| | | return "报销管理"; |
| | | case 5: |
| | | return "采购审批"; |
| | | case 6: |
| | | return "报价审批"; |
| | | case 7: |
| | | return "出库审批"; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | * @param needPushRoles 发送的角色
|
| | | * @param jumpPath 跳转地址
|
| | | */
|
| | | void simpleNoticeByRoles(final String title, final String message, final List<String> needPushRoles,
|
| | | void simpleNoticeByRoles(final String title, final String message, final Long tenantId,final List<String> needPushRoles,
|
| | | final String jumpPath);
|
| | |
|
| | | /**
|
| | |
| | | * @param needPerms 发送的权限者 已包含上级
|
| | | * @param jumpPath 跳转地址
|
| | | */
|
| | | void simpleNoticeByPerms(final String title, final String message, final List<String> needPerms,
|
| | | void simpleNoticeByPerms(final String title, final String message, final Long tenantId,final List<String> needPerms,
|
| | | final String jumpPath);
|
| | |
|
| | | /**
|
| | | * 通过指定人发送提醒
|
| | | * @param title 标题
|
| | | * @param message 消息
|
| | | * @param tenantId 租户id
|
| | | * @param jumpPath 跳转地址
|
| | | */
|
| | | void simpleNoticeByUser(final String title, final String message, Long consigneeId,
|
| | | final String jumpPath);
|
| | | void simpleNoticeByUser(final String title, final String message, final List<Long> consigneeId, final Long tenantId, final String jumpPath);
|
| | |
|
| | | /**
|
| | | * 通过所有人 发送提醒
|
| | |
| | | * @param message 消息
|
| | | * @param jumpPath 跳转地址
|
| | | */
|
| | | void simpleNoticeAll(final String title, final String message, final String jumpPath);
|
| | | void simpleNoticeAll(final String title, final String message,final Long tenantId,final String jumpPath);
|
| | |
|
| | | void insertBatch(final List<SysNotice> notices);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void simpleNoticeByRoles(final String title, String message, List<String> needPushRoles,
|
| | | public void simpleNoticeByRoles(final String title, String message, Long tenantId, List<String> needPushRoles,
|
| | | final String jumpPath) {
|
| | | Long userId = SecurityUtils.getUserId();
|
| | | if (StrUtil.isBlank(message) || CollectionUtils.isEmpty(needPushRoles)) {
|
| | |
| | | rolesWithAdmin.add("管理员");
|
| | | List<SysNotice> collect = rolesWithAdmin.stream()
|
| | | .flatMap(it -> userMapper.getUserByRole(it).stream())
|
| | | .map(it -> convertSysNotice(title, message, it, jumpPath, userId))
|
| | | .map(it -> convertSysNotice(title, message, it,tenantId, jumpPath, userId))
|
| | | .collect(Collectors.toList());
|
| | | sysNoticeService.insertBatch(collect);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void simpleNoticeByPerms(String title, String message, List<String> needPerms,
|
| | | public void simpleNoticeByPerms(String title, String message, Long tenantId, List<String> needPerms,
|
| | | String jumpPath) {
|
| | | Long userId = SecurityUtils.getLoginUser().getUserId();
|
| | | if (StrUtil.isBlank(message) || CollectionUtils.isEmpty(needPerms)) {
|
| | | return;
|
| | | }
|
| | | List<SysNotice> collect = userMapper.getUserByPerms(needPerms).stream().map(it -> convertSysNotice(title, message, it, jumpPath, userId)).collect(Collectors.toList());
|
| | | List<SysNotice> collect = userMapper.getUserByPerms(needPerms).stream().map(it -> convertSysNotice(title, message, it,tenantId, jumpPath, userId)).collect(Collectors.toList());
|
| | | sysNoticeService.insertBatch(collect);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void simpleNoticeByUser(String title, String message, Long consigneeId,
|
| | | public void simpleNoticeByUser(String title, String message, List<Long> consigneeId, Long tenantId,
|
| | | String jumpPath) {
|
| | | Long userId = SecurityUtils.getLoginUser().getUserId();
|
| | | SysNotice sysNotice = convertSysNotice(title, message, consigneeId, jumpPath, userId);
|
| | | sysNoticeService.save(sysNotice);
|
| | | List<SysNotice> sysNotices = consigneeId.stream().map(it -> convertSysNotice(title, message, it,tenantId, jumpPath, userId)).collect(Collectors.toList());
|
| | | sysNoticeService.saveBatch(sysNotices);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void simpleNoticeAll(String title, String message, String jumpPath) {
|
| | | public void simpleNoticeAll(String title, String message, Long tenantId,String jumpPath) {
|
| | | Long userId = SecurityUtils.getLoginUser().getUserId();
|
| | | List<SysNotice> collect = userMapper.selectList(null).stream().map(it -> convertSysNotice(title, message, it.getUserId(), jumpPath, userId)).collect(Collectors.toList());
|
| | | List<SysNotice> collect = userMapper.selectList(null).stream().map(it -> convertSysNotice(title, message, it.getUserId(),tenantId, jumpPath, userId)).collect(Collectors.toList());
|
| | | sysNoticeService.saveBatch(collect);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | }
|
| | |
|
| | | private SysNotice convertSysNotice(String title,String message,Long consigneeId,String jumpPath,Long currentUserId) {
|
| | | private SysNotice convertSysNotice(String title,String message,Long consigneeId, Long tenantId,String jumpPath,Long currentUserId) {
|
| | | SysNotice sysNotice = new SysNotice();
|
| | | sysNotice.setNoticeType("1");
|
| | | sysNotice.setNoticeTitle(title);//标题
|
| | |
| | | sysNotice.setConsigneeId(consigneeId);
|
| | | sysNotice.setSenderId(currentUserId);
|
| | | sysNotice.setJumpPath(jumpPath);
|
| | | sysNotice.setTenantId(tenantId);
|
| | | return sysNotice;
|
| | | }
|
| | | }
|
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.sales.pojo.CommonFile; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface CommonFileMapper extends BaseMapper<CommonFile> { |
| | | } |