zhangherong
2025-04-21 ebc4996578cc06cacda5561a45a4dfc2c951d070
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java
@@ -18,8 +18,11 @@
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.aspect.annotation.EquipmentHistoryLog;
import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum;
import org.jeecg.modules.eam.constant.InspectionStatus;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamInspectionOrder;
@@ -281,40 +284,42 @@
     * @return
     */
    @Override
    public Result<?> inspectionProcess(EamInspectionOrderRequest eamInspectionOrderRequest) {
    @Transactional(rollbackFor = Exception.class)
    @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.POINT_INSPECTION, businessTable = "eam_inspection_order")
    public EamInspectionOrder inspectionProcess(EamInspectionOrderRequest eamInspectionOrderRequest) {
        try {
            // 检查请求参数
            if (!isValidRequest(eamInspectionOrderRequest)) {
                return Result.error("非法参数");
                throw new JeecgBootException("非法参数");
            }
            // 获取当前登录用户
            LoginUser user = getCurrentUser();
            if (user == null || StrUtil.isBlank(user.getId())) {
                return Result.error("账号不存在");
                throw new JeecgBootException("账号不存在");
            }
            eamInspectionOrderRequest.setAssignee(user.getUsername());
            // 获取点检工单信息
            EamInspectionOrder eamInspectionOrder = getEamInspectionOrder(eamInspectionOrderRequest.getDataId());
            if (eamInspectionOrder == null) {
                return Result.error("未找到对应数据");
                throw new JeecgBootException("未找到对应数据");
            }
            // 获取流程业务记录
            FlowMyBusiness flowMyBusiness = getFlowMyBusiness(eamInspectionOrderRequest.getInstanceId());
            if (flowMyBusiness == null) {
                return Result.error("流程记录不存在");
                throw new JeecgBootException("流程记录不存在");
            }
            // 检查用户是否有权限操作任务
            if (!isUserAuthorized(flowMyBusiness, user)) {
                return Result.error("用户无权操作此任务");
                throw new JeecgBootException("用户无权操作此任务");
            }
            // 认领任务
            if (!claimTask(flowMyBusiness.getTaskId(), user)) {
                return Result.error("任务不存在、已完成或已被他人认领");
                throw new JeecgBootException("任务不存在、已完成或已被他人认领");
            }
            // 设置流程变量
@@ -334,9 +339,9 @@
                updateEamInspectionOrderDetail(eamInspectionOrder);
            }
            return Result.OK("操作成功");
            return eamInspectionOrder;
        } catch (Exception e) {
            return Result.error("操作失败:" + e.getMessage());
            throw new JeecgBootException("操作失败:" + e.getMessage());
        }
    }