hyingbo
5 天以前 650b17081633bd2cce2a07d8fb4ebbfbd50a8edf
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamInspectionOrderServiceImpl.java
@@ -6,6 +6,7 @@
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.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -35,13 +36,13 @@
import org.jeecg.modules.eam.service.IEamInspectionOrderDetailService;
import org.jeecg.modules.eam.service.IEamInspectionOrderService;
import org.jeecg.modules.eam.service.IEamReportRepairService;
import org.jeecg.modules.eam.vo.InspectionVo;
import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness;
import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl;
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.entity.SysUser;
import org.jeecg.modules.system.service.IMdcUserProductionService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -50,7 +51,6 @@
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @Description: 点检工单
@@ -197,8 +197,7 @@
        } else {
            eamInspectionOrder.setEquipmentCode(equipment.getEquipmentCode());
        }
        System.out.println("设备点检:" + eamInspectionOrder.getId());
        flowCommonService.initActBusiness("工单号:" + eamInspectionOrder.getOrderNum() + "设备编号" + eamInspectionOrder.getEquipmentCode() + "进行设备点检",
        flowCommonService.initActBusiness("工单号: " + eamInspectionOrder.getOrderNum() + ";设备编号: " + eamInspectionOrder.getEquipmentCode() + ";安装位置: " + equipment.getInstallationPosition(),
                eamInspectionOrder.getId(), "IEamInspectionOrderService", "eam_inspection", null);
        Map<String, Object> variables = new HashMap<>();
        variables.put("dataId", eamInspectionOrder.getId());
@@ -394,17 +393,13 @@
        Map<String, Object> values = new HashMap<>();
        if (InspectionStatus.UNDER_INSPECTION.name().equals(order.getInspectionStatus()) && user.getUsername().equals(order.getOperator())) {
            // 点检人点检结束
            String orgId = Optional.ofNullable(iEamEquipmentService.getById(order.getEquipmentId()))
                    .map(equipment -> equipment.getOrgId())
            String manager = Optional.ofNullable(iEamEquipmentService.getById(order.getEquipmentId()))
                    .map(EamEquipment::getEquipmentManager)
                    .orElse(null);
            if (orgId == null) {
                throw new IllegalArgumentException("未找到设备的组织 ID");
            if (manager == null) {
                throw new IllegalArgumentException("设备管理员未配置");
            }
            List<SysUser> sysUserList = mdcUserProductionService.queryByPostAndProId("PCR0003", orgId);
            List<String> usernameList = sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList());
            if (usernameList.isEmpty()) {
                throw new IllegalArgumentException("未找到该设备对应车间的班组长,请联系管理员处理");
            }
            List<String> usernameList = Collections.singletonList(manager);
            values.put("dataId", order.getId());
            values.put("organization", "点检人点检结束");
            values.put("comment", "点检人点检结束");
@@ -470,6 +465,10 @@
        List<EamInspectionOrderDetail> eamInspectionOrderDetails = eamInspectionOrderDetailService
                .list(new QueryWrapper<EamInspectionOrderDetail>()
                        .eq("order_id", eamInspectionOrder.getId()).eq("report_flag", "1").eq("inspection_result", "2"));
        //只有保养项明细中“点检结果”为“异常”,并且"异常是否报修"为“是”的情况才会生成故障数据,其他情况则不生成
        if (CollectionUtils.isEmpty(eamInspectionOrderDetails)) {
            return;
        }
        eamReportRepairService.reportRepairFromInspection(eamInspectionOrder.getEquipmentId(), eamInspectionOrder.getOperator(), eamInspectionOrderDetails);
    }
@@ -547,4 +546,19 @@
        Object object = values.get("NextAssignee");
        return (List<String>) object;
    }
    @Override
    public List<InspectionVo> findInspectionResult(String equipmentId,String itemDemand,String yearMonth) {
        return this.baseMapper.findInspectionResult(equipmentId,itemDemand,yearMonth);
    }
    @Override
    public List<InspectionVo> findInspectionUser(String equipmentId,String yearMonth) {
        return this.baseMapper.findInspectionUser(equipmentId,yearMonth);
    }
    @Override
    public List<Map<String, Object>> findInspectionStandard(String equipmentId) {
        return this.baseMapper.findInspectionStandard(equipmentId);
    }
}