zhangherong
2 天以前 63c9ec27a1f717cff8b36ad7db23d56e41dfae8f
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamThirdMaintenanceOrderServiceImpl.java
@@ -5,6 +5,7 @@
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -22,12 +23,8 @@
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog;
import org.jeecg.modules.eam.constant.*;
import org.jeecg.modules.eam.entity.EamBaseHFCode;
import org.jeecg.modules.eam.entity.EamEquipment;
import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrder;
import org.jeecg.modules.eam.entity.EamThirdMaintenanceOrderDetail;
import org.jeecg.modules.eam.entity.*;
import org.jeecg.modules.eam.mapper.EamThirdMaintenanceOrderMapper;
import org.jeecg.modules.eam.request.EamInspectionOrderRequest;
import org.jeecg.modules.eam.request.EamThirdMaintenanceQuery;
import org.jeecg.modules.eam.request.EamThirdMaintenanceRequest;
import org.jeecg.modules.eam.service.*;
@@ -268,7 +265,7 @@
        eamThirdMaintenanceOrderMapper.updateById(entity);
        //启动流程
        flowCommonService.initActBusiness("工单号:" + entity.getOrderNum() + ";设备编号: " + equipment.getEquipmentCode() + (equipment.getInstallationPosition() == null ? "" : ";安装位置: " + equipment.getInstallationPosition()),
        flowCommonService.initActBusiness("工单号:" + entity.getOrderNum() + ";设备编号: " + equipment.getEquipmentCode(),
                entity.getId(), "IEamThirdMaintenanceOrderService", "third_maintenance_process", null);
        Map<String, Object> variables = new HashMap<>();
        variables.put("dataId", entity.getId());
@@ -360,6 +357,18 @@
        return Result.ok(eamThirdMaintenanceRequestList);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean updateMaintenanceStatus(String orderId, String maintenanceStatus) {
        LambdaUpdateWrapper<EamThirdMaintenanceOrder> updateWrapper = new LambdaUpdateWrapper<>();
        updateWrapper.eq(EamThirdMaintenanceOrder::getId, orderId);
        updateWrapper.set(EamThirdMaintenanceOrder::getMaintenanceStatus, maintenanceStatus);
        updateWrapper.eq(EamThirdMaintenanceOrder::getDelFlag, CommonConstant.DEL_FLAG_0);
        updateWrapper.in(EamThirdMaintenanceOrder::getMaintenanceStatus, Arrays.asList(ThirdMaintenanceStatusEnum.WAIT_MAINTENANCE.name(), ThirdMaintenanceStatusEnum.FREEZE.name()));
        int update = this.getBaseMapper().update(null, updateWrapper);
        return update > 0;
    }
    /**
     * 设置流程变量
     */
@@ -375,7 +384,7 @@
                values.put("dataId", order.getId());
                values.put("organization", "技术状态鉴定结束");
                values.put("comment", "技术状态鉴定结束");
                if (CommonConstant.YN_Y.equals(request.getFullyFunctional()) && CommonConstant.YN_Y.equals(request.getRunningNormally())) {
                if (CommonConstant.YN_1.equals(request.getFullyFunctional()) && CommonConstant.YN_1.equals(request.getRunningNormally())) {
                    values.put("confirmation", "1");
                    // 获取下一步执行人
                    userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
@@ -384,12 +393,12 @@
                    }
                    userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                    values.put("NextAssignee", userApprovalList);
                    request.setComment("检查人检查结束");
                    //更新设备保养状态
                    eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_THIRD_MAINTENANCE.name());
                } else {
                    values.put("confirmation", "2");
                }
                request.setComment("检查人检查结束");
                break;
            case UNDER_MAINTENANCE:
                // 保养结束
@@ -397,9 +406,9 @@
                values.put("organization", "保养人保养结束");
                values.put("comment", "保养人保养结束");
                // 获取下一步执行人
                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0002);
                userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getFactoryOrgCode(), BusinessCodeConst.PCR0003);
                if (CollectionUtil.isEmpty(userSelectors)) {
                    throw new JeecgBootException("设备未分配给维修工,无法进入下级审批!");
                    throw new JeecgBootException("设备未分配给设备检验员,无法进入下级审批!");
                }
                userApprovalList = userSelectors.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                values.put("NextAssignee", userApprovalList);
@@ -522,7 +531,7 @@
                    order.setFullyFunctional(request.getFullyFunctional());
                    order.setRunningNormally(request.getRunningNormally());
                    order.setInspectTime(new Date());
                    if (CommonConstant.YN_Y.equals(request.getFullyFunctional()) && CommonConstant.YN_Y.equals(request.getRunningNormally())) {
                    if (CommonConstant.YN_1.equals(request.getFullyFunctional()) && CommonConstant.YN_1.equals(request.getRunningNormally())) {
                        // 鉴定通过
                        order.setMaintenanceStatus(ThirdMaintenanceStatusEnum.UNDER_MAINTENANCE.name());
                    } else {