zhangherong
2025-04-15 de05a9eb3524d8ebcfe26fcb1605696a02e6ab5e
art: 设备管理-周保-执行接口
已修改10个文件
424 ■■■■■ 文件已修改
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/WeekMaintenanceStatusEnum.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamWeekMaintenanceRequest.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamReportRepairService.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamWeekMaintenanceOrderService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java 248 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
@@ -24,4 +24,18 @@
    String SPARE_REQUISITION_STATUS_4 = "4";
    String SPARE_REQUISITION_STATUS_5 = "5";
    /**
     * 岗位编码
     */
    //操作工
    String PCR0001 = "PCR0001";
    //维修工
    String PCR0002 = "PCR0002";
    //班组长
    String PCR0003 = "PCR0003";
    //设备管理员
    String PCR0004 = "PCR0004";
    //设备能源部
    String PCR0005 = "PCR0005";
}
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/WeekMaintenanceStatusEnum.java
@@ -9,4 +9,14 @@
    COMPLETE,  //已完成
    ABOLISH, //已作废
    ;
    public static WeekMaintenanceStatusEnum getInstance(String code) {
        WeekMaintenanceStatusEnum[] values = WeekMaintenanceStatusEnum.values();
        for (WeekMaintenanceStatusEnum value : values) {
            if (value.name().equals(code)) {
                return value;
            }
        }
        return null;
    }
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.eam.controller;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
@@ -208,4 +209,29 @@
        EamWeekMaintenanceOrder eamWeekMaintenanceOrder = eamWeekMaintenanceOrderService.getById(id);
        return Result.OK(eamWeekMaintenanceOrder);
    }
    /**
     * 我的待办,审批动作
     * @param request
     * @return
     */
    @ApiOperation(value = "周保工单-执行操作", notes = "周保工单-执行操作")
    @PutMapping(value = "/approval")
    public Result<?> approval(@RequestBody EamWeekMaintenanceRequest request) {
        if (request == null) {
            return Result.error("审批的对象不能为空!");
        }
        if (CollectionUtil.isEmpty(request.getTableDetailList())) {
            return Result.error("保养项不能为空!");
        }
        // 检查请求参数
        if (StrUtil.isBlank(request.getTaskId()) || StrUtil.isBlank(request.getDataId()) || StrUtil.isBlank(request.getInstanceId())) {
            return Result.error("审批任务错误或不存在!");
        }
        boolean b = eamWeekMaintenanceOrderService.approval(request);
        if(!b) {
            return Result.error("操作失败!");
        }
        return Result.ok("操作成功!");
    }
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/request/EamWeekMaintenanceRequest.java
@@ -6,7 +6,9 @@
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.api.vo.FileUploadResult;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail;
import org.jeecg.modules.flowable.domain.vo.FlowTaskVo;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
@@ -17,7 +19,7 @@
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="eam_maintenance_standard对象", description="保养标准")
public class EamWeekMaintenanceRequest implements Serializable {
public class EamWeekMaintenanceRequest extends FlowTaskVo implements Serializable {
    /**主键*/
    @ApiModelProperty(value = "主键")
@@ -42,6 +44,9 @@
    /**保养图片*/
    @ApiModelProperty(value = "保养图片")
    private String imageFiles;
    /**保养图片*/
    @ApiModelProperty(value = "保养图片")
    private List<FileUploadResult> imageFilesResult;
    /**备注*/
    @ApiModelProperty(value = "备注")
    private String remark;
@@ -51,4 +56,31 @@
    /**删除 保养项明细*/
    @ApiModelProperty(value = "删除 保养项明细")
    private List<EamWeekMaintenanceOrderDetail> removeDetailList;
    //确认操作
    /**确认意见*/
    @ApiModelProperty(value = "确认意见")
    private String confirmComment;
    @ApiModelProperty(value = "确认类型")
    private String confirmDealType;
    //初验收操作
    /**初验收意见*/
    @ApiModelProperty(value = "初验收意见")
    private String initialAcceptanceComment;
    /**初验收附件*/
    @ApiModelProperty(value = "初验收附件")
    private String initialAcceptanceFiles;
    /**初验收附件*/
    @ApiModelProperty(value = "初验收附件")
    private List<FileUploadResult> initialAcceptanceFilesResult;
    //终验收操作
    /**终验收意见*/
    @ApiModelProperty(value = "终验收意见")
    private String finalAcceptanceComment;
    /**终验收附件*/
    @ApiModelProperty(value = "终验收附件")
    private String finalAcceptanceFiles;
    /**终验收附件*/
    @ApiModelProperty(value = "终验收附件")
    private List<FileUploadResult> finalAcceptanceFilesResult;
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamReportRepairService.java
@@ -2,9 +2,13 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.eam.entity.EamReportRepair;
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.eam.entity.EamInspectionOrderDetail;
import org.jeecg.modules.eam.entity.EamReportRepair;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail;
import org.jeecg.modules.eam.request.EamReportRepairQuery;
import java.util.List;
/**
 * @Description: 故障报修
@@ -20,4 +24,19 @@
     * @return
     */
    IPage<EamReportRepair> pageList(Page<EamReportRepair> page, EamReportRepairQuery eamReportRepairQuery);
    /**
     * 从周保中生成报修
     * @param detailList
     * @return
     */
    boolean reportRepairFromMaintenance(String equipmentId, String reportUser, List<EamWeekMaintenanceOrderDetail> detailList);
    /**
     * 从周保中生成报修
     * @param detailList
     * @return
     */
    boolean reportRepairFromInspection(String equipmentId, String reportUser, List<EamInspectionOrderDetail> detailList);
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamWeekMaintenanceOrderService.java
@@ -43,4 +43,11 @@
     * @return
     */
    boolean collect(String id);
    /**
     * 我的待办,审批动作
     * @param request
     * @return
     */
    boolean approval(EamWeekMaintenanceRequest request);
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamReportRepairServiceImpl.java
@@ -4,17 +4,23 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.eam.constant.ReportRepairEnum;
import org.jeecg.modules.eam.entity.EamInspectionOrderDetail;
import org.jeecg.modules.eam.entity.EamReportRepair;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail;
import org.jeecg.modules.eam.mapper.EamReportRepairMapper;
import org.jeecg.modules.eam.request.EamReportRepairQuery;
import org.jeecg.modules.eam.service.IEamReportRepairService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
@@ -46,4 +52,48 @@
        }
        return this.baseMapper.pageList(page, eamReportRepairQuery, sysUser.getId(), equipmentIds);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean reportRepairFromMaintenance(String equipmentId, String reportUser, List<EamWeekMaintenanceOrderDetail> detailList) {
        StringBuilder sb = new StringBuilder();
        detailList.forEach(detail -> {
            sb.append(detail.getItemCode()).append("、");
            sb.append(detail.getExceptionDescription()).append(";");
        });
        EamReportRepair entity = new EamReportRepair();
        entity.setEquipmentId(equipmentId);
        entity.setCreateBy(reportUser);
        entity.setFaultStartTime(new Date());
        entity.setBreakdownFlag(CommonConstant.DEFAULT_0);
        entity.setDelFlag(CommonConstant.DEL_FLAG_0);
        entity.setFaultName("周保执行报修处理");
        entity.setFaultDescription(sb.toString());
        entity.setFaultType(CommonConstant.DEFAULT_1);
        entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name());
        this.baseMapper.insert(entity);
        return true;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean reportRepairFromInspection(String equipmentId, String reportUser, List<EamInspectionOrderDetail> detailList) {
        StringBuilder sb = new StringBuilder();
        detailList.forEach(detail -> {
            sb.append(detail.getItemCode()).append("、");
            sb.append(detail.getExceptionDescription()).append(";");
        });
        EamReportRepair entity = new EamReportRepair();
        entity.setEquipmentId(equipmentId);
        entity.setCreateBy(reportUser);
        entity.setFaultStartTime(new Date());
        entity.setBreakdownFlag(CommonConstant.DEFAULT_0);
        entity.setDelFlag(CommonConstant.DEL_FLAG_0);
        entity.setFaultName("点检执行报修处理");
        entity.setFaultDescription(sb.toString());
        entity.setFaultType(CommonConstant.DEFAULT_1);
        entity.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name());
        this.baseMapper.insert(entity);
        return true;
    }
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamWeekMaintenanceOrderServiceImpl.java
@@ -2,31 +2,45 @@
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.flowable.engine.TaskService;
import org.flowable.task.api.Task;
import org.jeecg.common.api.vo.FileUploadResult;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.constant.DataBaseConstant;
import org.jeecg.common.exception.JeecgBootException;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum;
import org.jeecg.modules.eam.constant.BusinessCodeConst;
import org.jeecg.modules.eam.constant.OrderCreationMethodEnum;
import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrderDetail;
import org.jeecg.modules.eam.mapper.EamWeekMaintenanceOrderMapper;
import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery;
import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest;
import org.jeecg.modules.eam.service.IEamEquipmentService;
import org.jeecg.modules.eam.service.IEamReportRepairService;
import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderDetailService;
import org.jeecg.modules.eam.service.IEamWeekMaintenanceOrderService;
import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService;
import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI;
import org.jeecg.modules.flowable.apithird.service.FlowCommonService;
import org.jeecg.modules.flowable.service.IFlowDefinitionService;
import org.jeecg.modules.flowable.service.IFlowTaskService;
import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.system.vo.UserSelector;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -38,7 +52,7 @@
/**
 * @Description: 周保工单
 * @Author: jeecg-boot
 * @Date:   2025-04-02
 * @Date: 2025-04-02
 * @Version: V1.0
 */
@Service("IEamWeekMaintenanceOrderService")
@@ -50,10 +64,23 @@
    @Autowired
    private IEamWeekMaintenanceOrderDetailService eamWeekMaintenanceOrderDetailService;
    @Resource
    @Autowired
    private FlowCommonService flowCommonService;
    @Resource
    @Autowired
    private IFlowDefinitionService flowDefinitionService;
    @Autowired
    private IFlowMyBusinessService flowMyBusinessService;
    @Autowired
    private TaskService taskService;
    @Autowired
    private IFlowTaskService flowTaskService;
    @Autowired
    private ISysUserService sysUserService;
    @Autowired
    private IEamEquipmentService eamEquipmentService;
    @Autowired
    private IEamReportRepairService eamReportRepairService;
    @Override
    @Transactional(rollbackFor = Exception.class)
@@ -72,7 +99,7 @@
        order.setDelFlag(CommonConstant.DEL_FLAG_0);
        eamWeekMaintenanceOrderMapper.insert(order);
        //处理明细数据
        if(CollectionUtil.isNotEmpty(request.getTableDetailList())) {
        if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
            request.getTableDetailList().forEach(tableDetail -> {
                tableDetail.setId(null);
                tableDetail.setOrderId(order.getId());
@@ -80,7 +107,7 @@
            eamWeekMaintenanceOrderDetailService.saveBatch(request.getTableDetailList());
        }
        //判断是否存在保养人 如果存在则启动流程
        if(StringUtils.isNotBlank(order.getOperator())) {
        if (StringUtils.isNotBlank(order.getOperator())) {
            //启动流程
            flowCommonService.initActBusiness("工单号:" + order.getOrderNum() + ";开始进行设备周保",
                    order.getId(), "IEamWeekMaintenanceOrderService", "week_maintenance_process", null);
@@ -98,7 +125,7 @@
            usernames.add(order.getOperator());
            variables.put("NextAssignee", usernames);
            Result result = flowDefinitionService.startProcessInstanceByKey("week_maintenance_process", variables);
            if(result != null){
            if (result != null) {
                //更新周保状态
                order.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
                order.setActualStartTime(new Date());
@@ -165,10 +192,10 @@
    @Transactional(rollbackFor = Exception.class)
    public boolean editWeekMaintenance(EamWeekMaintenanceRequest request) {
        EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderMapper.selectById(request.getId());
        if(entity == null){
        if (entity == null) {
            throw new JeecgBootException("编辑的数据已删除,请刷新重试!");
        }
        if(!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())){
        if (!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
            throw new JeecgBootException("只有待保养状态的数据才可编辑!");
        }
        entity.setMaintenanceDate(request.getMaintenanceDate());
@@ -177,30 +204,30 @@
        eamWeekMaintenanceOrderMapper.updateById(entity);
        //处理详情
        if(CollectionUtil.isNotEmpty(request.getTableDetailList())) {
        if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
            List<EamWeekMaintenanceOrderDetail> addList = new ArrayList<>();
            List<EamWeekMaintenanceOrderDetail> updateList = new ArrayList<>();
            request.getTableDetailList().forEach(tableDetail -> {
                tableDetail.setOrderId(entity.getId());
                if(tableDetail.getId() == null){
                if (tableDetail.getId() == null) {
                    addList.add(tableDetail);
                }else {
                } else {
                    updateList.add(tableDetail);
                }
            });
            if(CollectionUtil.isNotEmpty(addList)){
            if (CollectionUtil.isNotEmpty(addList)) {
                eamWeekMaintenanceOrderDetailService.saveBatch(addList);
            }
            if(CollectionUtil.isNotEmpty(updateList)){
            if (CollectionUtil.isNotEmpty(updateList)) {
                eamWeekMaintenanceOrderDetailService.updateBatchById(updateList);
            }
        }
        if(CollectionUtil.isNotEmpty(request.getRemoveDetailList())) {
        if (CollectionUtil.isNotEmpty(request.getRemoveDetailList())) {
            List<String> ids = request.getRemoveDetailList().stream().map(EamWeekMaintenanceOrderDetail::getId).collect(Collectors.toList());
            eamWeekMaintenanceOrderDetailService.removeBatchByIds(ids);
        }
        //判断是否存在保养人 如果存在则启动流程
        if(StringUtils.isNotBlank(entity.getOperator())) {
        if (StringUtils.isNotBlank(entity.getOperator())) {
            //启动流程
            flowCommonService.initActBusiness("工单号:" + entity.getOrderNum() + ";开始进行设备周保",
                    entity.getId(), "IEamWeekMaintenanceOrderService", "week_maintenance_process", null);
@@ -218,7 +245,7 @@
            usernames.add(entity.getOperator());
            variables.put("NextAssignee", usernames);
            Result result = flowDefinitionService.startProcessInstanceByKey("week_maintenance_process", variables);
            if(result != null){
            if (result != null) {
                //更新周保状态
                entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
                entity.setActualStartTime(new Date());
@@ -233,10 +260,10 @@
    @Transactional(rollbackFor = Exception.class)
    public boolean collect(String id) {
        EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderMapper.selectById(id);
        if(entity == null) {
        if (entity == null) {
            throw new JeecgBootException("要领取的工单不存在,请刷新重试!");
        }
        if(!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
        if (!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
            throw new JeecgBootException("该工单已进行过领取!");
        }
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
@@ -262,9 +289,188 @@
        usernames.add(entity.getOperator());
        variables.put("NextAssignee", usernames);
        Result result = flowDefinitionService.startProcessInstanceByKey("week_maintenance_process", variables);
        if(result != null){
        if (result != null) {
            return result.isSuccess();
        }
        return true;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean approval(EamWeekMaintenanceRequest request) {
        EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderMapper.selectById(request.getId());
        if (entity == null) {
            throw new JeecgBootException("审批的数据已删除,请刷新重试!");
        }
        // 获取当前登录用户
        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        if (user == null || StrUtil.isBlank(user.getId())) {
            throw new JeecgBootException("未获取到登录用户,请重新登录后再试!");
        }
        request.setAssignee(user.getUsername());
        // 获取流程业务记录
        FlowMyBusiness flowMyBusiness = flowMyBusinessService.getFlowMyBusiness(request.getInstanceId());
        if (flowMyBusiness == null) {
            throw new JeecgBootException("流程实例不存在,请刷新后重试!");
        }
        boolean userAuthorized = isUserAuthorized(flowMyBusiness, user);
        if (!userAuthorized) {
            throw new JeecgBootException("用户无权操作此任务,请刷新后重试!");
        }
        // 认领任务
        if (!claimTask(flowMyBusiness.getTaskId(), user)) {
            throw new JeecgBootException("任务不存在、已完成或已被他人认领!");
        }
        EamEquipment equipment = eamEquipmentService.getById(entity.getEquipmentId());
        if (equipment == null) {
            throw new JeecgBootException("设备不存在,请检查!");
        }
        WeekMaintenanceStatusEnum status = WeekMaintenanceStatusEnum.getInstance(entity.getMaintenanceStatus());
        if (status == null) {
            return false;
        }
        //流程变量
        Map<String, Object> values = new HashMap<>();
        switch (status) {
            case UNDER_MAINTENANCE:
                //执行完成
                List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0003);
                if (CollectionUtil.isEmpty(userSelectors)) {
                    throw new JeecgBootException("设备未分配给班组长,无法进入下级审批!");
                }
                List<String> userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                values.put("dataId", entity.getId());
                values.put("organization", "周保执行结束");
                values.put("comment", "周保执行结束");
                values.put("NextAssignee", userApprovalList);
                request.setComment("周保执行结束");
                //设置entity
                entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.WAIT_CONFIRM.name());
                entity.setActualEndTime(new Date());
                //处理附件
                if (CollectionUtil.isNotEmpty(request.getImageFilesResult())) {
                    List<FileUploadResult> fileUploadResultList = request.getImageFilesResult();
                    ObjectMapper mapper = new ObjectMapper();
                    try {
                        String referenceFile = mapper.writeValueAsString(fileUploadResultList);
                        entity.setImageFiles(referenceFile);
                    } catch (JsonProcessingException e) {
                        log.error("JSON转换失败:" + e.getMessage(), e);
                    }
                }
                //处理详情
                if (CollectionUtil.isNotEmpty(request.getTableDetailList())) {
                    eamWeekMaintenanceOrderDetailService.updateBatchById(request.getTableDetailList());
                }
                break;
            case WAIT_CONFIRM:
                //班组长确认
                userApprovalList = new ArrayList<>();
                userApprovalList.add(equipment.getEquipmentManager());
                values.put("dataId", entity.getId());
                values.put("organization", request.getConfirmComment());
                values.put("comment", request.getConfirmComment());
                values.put("NextAssignee", userApprovalList);
                values.put("confirmation", request.getConfirmDealType());
                request.setComment(request.getConfirmComment());
                //设置entity
                entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.WAIT_INITIAL_ACCEPTANCE.name());
                entity.setConfirmUser(user.getUsername());
                entity.setConfirmComment(request.getConfirmComment());
                entity.setConfirmTime(new Date());
                if (CommonConstant.HAS_CANCLE.equals(request.getConfirmDealType())) {
                    //驳回
                    userApprovalList = new ArrayList<>();
                    userApprovalList.add(entity.getOperator());
                    values.put("NextAssignee", userApprovalList);
                    entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
                }
                //处理报修
                List<EamWeekMaintenanceOrderDetail> collect = request.getTableDetailList().stream().filter((detail) -> CommonConstant.DEFAULT_1.equals(detail.getReportFlag())).collect(Collectors.toList());
                if (CollectionUtil.isNotEmpty(collect)) {
                    eamReportRepairService.reportRepairFromMaintenance(equipment.getId(), entity.getOperator(), collect);
                }
                break;
            case WAIT_INITIAL_ACCEPTANCE:
                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0005);
                if (CollectionUtil.isEmpty(userSelectors)) {
                    throw new JeecgBootException("设备未分配给班组长,无法进入下级审批!");
                }
                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                values.put("dataId", entity.getId());
                values.put("organization", request.getInitialAcceptanceComment());
                values.put("comment", request.getInitialAcceptanceComment());
                values.put("NextAssignee", userApprovalList);
                request.setComment(request.getInitialAcceptanceComment());
                //设置entity
                entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.WAIT_FINAL_ACCEPTANCE.name());
                entity.setInitialAcceptanceUser(user.getUsername());
                entity.setInitialAcceptanceComment(request.getInitialAcceptanceComment());
                entity.setInitialAcceptanceTime(new Date());
                //处理附件
                if (CollectionUtil.isNotEmpty(request.getInitialAcceptanceFilesResult())) {
                    List<FileUploadResult> fileUploadResultList = request.getInitialAcceptanceFilesResult();
                    ObjectMapper mapper = new ObjectMapper();
                    try {
                        String referenceFile = mapper.writeValueAsString(fileUploadResultList);
                        entity.setInitialAcceptanceFiles(referenceFile);
                    } catch (JsonProcessingException e) {
                        log.error("JSON转换失败:" + e.getMessage(), e);
                    }
                }
                break;
            case WAIT_FINAL_ACCEPTANCE:
                values.put("dataId", entity.getId());
                values.put("organization", request.getInitialAcceptanceComment());
                values.put("comment", request.getInitialAcceptanceComment());
                request.setComment(request.getInitialAcceptanceComment());
                //设置entity
                entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.COMPLETE.name());
                entity.setFinalAcceptanceUser(user.getUsername());
                entity.setFinalAcceptanceComment(request.getFinalAcceptanceComment());
                entity.setFinalAcceptanceTime(new Date());
                //处理附件
                if (CollectionUtil.isNotEmpty(request.getFinalAcceptanceFilesResult())) {
                    List<FileUploadResult> fileUploadResultList = request.getFinalAcceptanceFilesResult();
                    ObjectMapper mapper = new ObjectMapper();
                    try {
                        String referenceFile = mapper.writeValueAsString(fileUploadResultList);
                        entity.setFinalAcceptanceFiles(referenceFile);
                    } catch (JsonProcessingException e) {
                        log.error("JSON转换失败:" + e.getMessage(), e);
                    }
                }
                break;
        }
        request.setValues(values);
        // 完成流程任务
        Result result = flowTaskService.complete(request);
        if (!result.isSuccess()) {
            throw new JeecgBootException("审批失败,请刷新查看!");
        }
        //保存工单
        eamWeekMaintenanceOrderMapper.updateById(entity);
        return true;
    }
    private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) {
        List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class);
        return todoUsers != null && todoUsers.contains(user.getUsername());
    }
    private boolean claimTask(String taskId, LoginUser user) {
        Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
        if (task == null) {
            return false;
        }
        if (task.getAssignee() != null && !task.getAssignee().equals(user.getUsername())) {
            return false;
        }
        taskService.claim(taskId, user.getUsername());
        return true;
    }
@@ -289,7 +495,7 @@
    public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) {
        //业务是否干预流程,业务干预,流程干预,指定人员进行处理
        //获取下一步处理人
        Object object=values.get("NextAssignee");
        Object object = values.get("NextAssignee");
        return (List<String>) object;
    }
}
lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/IFlowMyBusinessService.java
@@ -10,4 +10,10 @@
 */
public interface IFlowMyBusinessService extends IService<FlowMyBusiness> {
    /**
     * 根据流程实例id 获取 我的待办
     * @param instanceId 流程实例id
     * @return
     */
    FlowMyBusiness getFlowMyBusiness(String instanceId);
}
lxzn-module-flowable/src/main/java/org/jeecg/modules/flowable/apithird/business/service/impl/FlowMyBusinessServiceImpl.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.flowable.apithird.business.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -124,4 +125,11 @@
        });
        return flowMyBusinessDtoIPage;
    }
    @Override
    public FlowMyBusiness getFlowMyBusiness(String instanceId) {
        List<FlowMyBusiness> businessList = super.list(
                new QueryWrapper<FlowMyBusiness>().eq("process_instance_id", instanceId));
        return businessList.isEmpty() ? null : businessList.get(0);
    }
}