zhangherong
2025-04-15 de05a9eb3524d8ebcfe26fcb1605696a02e6ab5e
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;
    }
}