| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | 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.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.aspect.annotation.EquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; |
| | | import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum; |
| | | import org.jeecg.modules.eam.constant.InspectionStatus; |
| | | import org.jeecg.modules.eam.constant.ReportRepairEnum; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamInspectionOrder; |
| | | import org.jeecg.modules.eam.entity.EamInspectionOrderDetail; |
| | | import org.jeecg.modules.eam.mapper.EamInspectionOrderMapper; |
| | | import org.jeecg.modules.eam.request.EamInspectionOrderQuery; |
| | | import org.jeecg.modules.eam.request.EamInspectionOrderRequest; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | |
| | | /** |
| | | * @Description: 点检工单 |
| | | * @Author: jeecg-boot |
| | | * @Date: 2025-04-02 |
| | | * @Date: 2025-04-02 |
| | | * @Version: V1.0 |
| | | */ |
| | | @Service("IEamInspectionOrderService") |
| | | public class EamInspectionOrderServiceImpl extends ServiceImpl<EamInspectionOrderMapper, EamInspectionOrder> implements IEamInspectionOrderService, FlowCallBackServiceI { |
| | | |
| | | @Resource |
| | | private EamInspectionOrderMapper eamInspectionOrderMapper; |
| | | @Autowired |
| | | private IEamInspectionOrderDetailService eamInspectionOrderDetailService; |
| | | @Resource |
| | |
| | | @Autowired |
| | | private IEamReportRepairService eamReportRepairService; |
| | | @Autowired |
| | | private IEamEquipmentFaultReasonService eamEquipmentFaultReasonService; |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | |
| | | @Override |
| | | public IPage<EamInspectionOrder> queryPageList(Page<EamInspectionOrder> page, EamInspectionOrderQuery query) { |
| | | QueryWrapper<EamInspectionOrder> queryWrapper = new QueryWrapper<>(); |
| | | //用户数据权限 |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return page; |
| | | } |
| | | if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { |
| | | //选择了设备,根据设备id过滤设备 |
| | | List<String> equipArr = Arrays.asList(sysUser.getEquipmentIds().split(",")); |
| | | queryWrapper.in("e.equipment_code", equipArr); |
| | | } else { |
| | | //没有选择设备,根据车间过滤设备 |
| | | queryWrapper.exists("select 1 from mdc_user_production t where t.user_id={0} and t.pro_id=e.org_id ", sysUser.getId()); |
| | | } |
| | | //查询条件过滤 |
| | | if (query != null) { |
| | | if (StringUtils.isNotBlank(query.getEquipmentId())) { |
| | | queryWrapper.eq("wmo.equipment_id", query.getEquipmentId()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getOrderNum())) { |
| | | queryWrapper.like("wmo.order_num", query.getOrderNum()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getInspectionStatus())) { |
| | | queryWrapper.eq("wmo.inspection_status", query.getInspectionStatus()); |
| | | } |
| | | if (query.getInspectionDateBegin() != null && query.getInspectionDateEnd() != null) { |
| | | queryWrapper.between("wmo.inspection_date", query.getInspectionDateBegin(), query.getInspectionDateEnd()); |
| | | } |
| | | //排序 |
| | | if (StringUtils.isNotBlank(query.getColumn()) && StringUtils.isNotBlank(query.getOrder())) { |
| | | String column = query.getColumn(); |
| | | if (column.endsWith(CommonConstant.DICT_TEXT_SUFFIX)) { |
| | | column = column.substring(0, column.lastIndexOf(CommonConstant.DICT_TEXT_SUFFIX)); |
| | | } |
| | | if (DataBaseConstant.SQL_ASC.equalsIgnoreCase(query.getOrder())) { |
| | | queryWrapper.orderByAsc("wmo." + oConvertUtils.camelToUnderline(column)); |
| | | } else { |
| | | queryWrapper.orderByDesc("wmo." + oConvertUtils.camelToUnderline(column)); |
| | | } |
| | | } else { |
| | | queryWrapper.orderByDesc("wmo.create_time"); |
| | | } |
| | | } else { |
| | | queryWrapper.orderByDesc("wmo.create_time"); |
| | | } |
| | | |
| | | return eamInspectionOrderMapper.queryPageList(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<EamInspectionOrder> selectUnCompleteOrder(String expiredDate) { |
| | | LambdaQueryWrapper<EamInspectionOrder> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.lt(EamInspectionOrder::getInspectionDate, expiredDate); |
| | | List<String> unCompleteStatus = new ArrayList<>(); |
| | | unCompleteStatus.add(InspectionStatus.WAIT_INSPECTION.name()); |
| | | unCompleteStatus.add(InspectionStatus.UNDER_INSPECTION.name()); |
| | | queryWrapper.in(EamInspectionOrder::getInspectionStatus, unCompleteStatus); |
| | | queryWrapper.orderByAsc(EamInspectionOrder::getInspectionDate); |
| | | return eamInspectionOrderMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean addInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) { |
| | | EamInspectionOrder eamInspectionOrder = new EamInspectionOrder(); |
| | | BeanUtils.copyProperties(eamInspectionOrderRequest,eamInspectionOrder); |
| | | BeanUtils.copyProperties(eamInspectionOrderRequest, eamInspectionOrder); |
| | | //修改状态 |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())){ |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.IN_PROGRESS.getCode()); |
| | | }else { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.INIT.getCode()); |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | } else { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.WAIT_INSPECTION.name()); |
| | | } |
| | | save(eamInspectionOrder); |
| | | //处理明细数据 |
| | | if(CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getTableDetailList())) { |
| | | if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getTableDetailList())) { |
| | | eamInspectionOrderRequest.getTableDetailList().forEach(tableDetail -> { |
| | | tableDetail.setOrderId(eamInspectionOrder.getId()); |
| | | tableDetail.setId(null); |
| | |
| | | eamInspectionOrderDetailService.saveBatch(eamInspectionOrderRequest.getTableDetailList()); |
| | | } |
| | | //处理附件 |
| | | if(CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getFileList())) { |
| | | if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getFileList())) { |
| | | FileUploadResult fileUploadResult = eamInspectionOrderRequest.getFileList().get(0); |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | |
| | | log.error("JSON转换失败:" + e.getMessage(), e); |
| | | } |
| | | } |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())){ |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) { |
| | | triggerProcess(eamInspectionOrder); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 触发流程 |
| | | * |
| | | * @param eamInspectionOrder |
| | | * @return |
| | | */ |
| | |
| | | EamEquipment equipment = eamEquipmentService.getById(eamInspectionOrder.getEquipmentId()); |
| | | if (equipment == null) { |
| | | return false; |
| | | }else { |
| | | } else { |
| | | eamInspectionOrder.setEquipmentCode(equipment.getEquipmentCode()); |
| | | } |
| | | System.out.println("设备点检:" + eamInspectionOrder.getId()); |
| | | flowCommonService.initActBusiness("工单号:"+eamInspectionOrder.getOrderNum()+"设备编号"+eamInspectionOrder.getEquipmentCode()+"进行设备点检", |
| | | flowCommonService.initActBusiness("工单号:" + eamInspectionOrder.getOrderNum() + "设备编号" + eamInspectionOrder.getEquipmentCode() + "进行设备点检", |
| | | eamInspectionOrder.getId(), "IEamInspectionOrderService", "eam_inspection", null); |
| | | Map<String, Object> variables = new HashMap<>(); |
| | | variables.put("dataId", eamInspectionOrder.getId()); |
| | | if (StrUtil.isEmpty(eamInspectionOrder.getRemark())){ |
| | | if (StrUtil.isEmpty(eamInspectionOrder.getRemark())) { |
| | | variables.put("organization", "新增点检工单默认启动流程"); |
| | | variables.put("comment", "新增点检工单默认启动流程"); |
| | | }else { |
| | | } else { |
| | | variables.put("organization", eamInspectionOrder.getRemark()); |
| | | variables.put("comment", eamInspectionOrder.getRemark()); |
| | | } |
| | | variables.put("proofreading",true); |
| | | List<String> usernames=new ArrayList<>(); |
| | | variables.put("proofreading", true); |
| | | List<String> usernames = new ArrayList<>(); |
| | | usernames.add(eamInspectionOrder.getOperator()); |
| | | variables.put("NextAssignee", usernames); |
| | | Result result= flowDefinitionService.startProcessInstanceByKey("eam_inspection", variables); |
| | | Result result = flowDefinitionService.startProcessInstanceByKey("eam_inspection", variables); |
| | | return result.isSuccess(); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean editInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) { |
| | | EamInspectionOrder eamInspectionOrder = new EamInspectionOrder(); |
| | | BeanUtils.copyProperties(eamInspectionOrderRequest, eamInspectionOrder); |
| | | if (StrUtil.isNotEmpty(eamInspectionOrder.getOperator())){ |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.IN_PROGRESS.getCode()); |
| | | if (StrUtil.isNotEmpty(eamInspectionOrder.getOperator())) { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | triggerProcess(eamInspectionOrder); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | } |
| | | updateById(eamInspectionOrder); |
| | | super.updateById(eamInspectionOrder); |
| | | //处理明细数据 |
| | | if (CollectionUtil.isNotEmpty(eamInspectionOrderRequest.getTableDetailList())) { |
| | | eamInspectionOrderRequest.getTableDetailList().forEach(tableDetail -> { |
| | |
| | | |
| | | /** |
| | | * 领取点检工单 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean takeInspectionOrder(String id){ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean takeInspectionOrder(String id) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | EamInspectionOrder eamInspectionOrder=this.getById(id); |
| | | if (eamInspectionOrder==null) { |
| | | if(user == null || !BusinessCodeConst.PCR0001.equals(user.getPost())) { |
| | | throw new JeecgBootException("不是操作工,无法领取此工单!"); |
| | | } |
| | | EamInspectionOrder eamInspectionOrder = this.getById(id); |
| | | if (eamInspectionOrder == null) { |
| | | return false; |
| | | }else { |
| | | } else { |
| | | eamInspectionOrder.setOperator(user.getUsername()); |
| | | //修改状态 |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.IN_PROGRESS.getCode()); |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | this.triggerProcess(eamInspectionOrder); |
| | | this.updateById(eamInspectionOrder); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 作废点检工单 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean cancelInspectionOrder(String id){ |
| | | public boolean cancelInspectionOrder(String id) { |
| | | EamInspectionOrder eamInspectionOrder = this.getById(id); |
| | | if (eamInspectionOrder == null) { |
| | | return false; |
| | | }else { |
| | | eamInspectionOrder.setInspectionStatus("5"); |
| | | } else { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.ABOLISH.name()); |
| | | return updateById(eamInspectionOrder); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 点检流程 |
| | | * |
| | | * @param eamInspectionOrderRequest |
| | | * @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("任务不存在、已完成或已被他人认领"); |
| | | } |
| | | |
| | | // 设置流程变量 |
| | |
| | | updateEamInspectionOrder(eamInspectionOrder); |
| | | |
| | | //查询数据,进行设备维修处理 |
| | | if (eamInspectionOrder.getInspectionStatus().equals(InspectionStatus.CONFIRMED.getCode())){ |
| | | if (eamInspectionOrder.getInspectionStatus().equals(InspectionStatus.WAIT_CONFIRM.name())) { |
| | | updateEamInspectionOrderDetail(eamInspectionOrder); |
| | | } |
| | | |
| | | return Result.OK("操作成功"); |
| | | return eamInspectionOrder; |
| | | } catch (Exception e) { |
| | | return Result.error("操作失败:" + e.getMessage()); |
| | | throw new JeecgBootException("操作失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | private boolean isValidRequest(EamInspectionOrderRequest request) { |
| | | return StrUtil.isNotBlank(request.getTaskId()) && StrUtil.isNotBlank(request.getDataId()); |
| | |
| | | |
| | | private void setupProcessVariables(EamInspectionOrderRequest request, EamInspectionOrder order, LoginUser user) { |
| | | Map<String, Object> values = new HashMap<>(); |
| | | if (InspectionStatus.IN_PROGRESS.getCode().equals(order.getInspectionStatus()) && user.getUsername().equals(order.getOperator())) { |
| | | 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()) |
| | |
| | | } else { |
| | | // 班组长确认 |
| | | values.put("dataId", order.getId()); |
| | | values.put("organization", request.getDealSuggestion()); |
| | | values.put("comment", request.getDealSuggestion()); |
| | | values.put("confirmation", request.getDealType()); |
| | | request.setComment(request.getDealSuggestion()); |
| | | if ("2".equals(request.getDealType())) { |
| | | values.put("organization", request.getConfirmComment()); |
| | | values.put("comment", request.getConfirmComment()); |
| | | values.put("confirmation", request.getConfirmDealType()); |
| | | request.setComment(request.getConfirmComment()); |
| | | if ("2".equals(request.getConfirmDealType())) { |
| | | // 班组长驳回 |
| | | List<String> usernames = new ArrayList<>(); |
| | | usernames.add(order.getOperator()); |
| | | order.setInspectionStatus("2"); |
| | | order.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | values.put("NextAssignee", usernames); |
| | | } |
| | | } |
| | |
| | | |
| | | private void updateOrderStatus(Result result, EamInspectionOrderRequest request, EamInspectionOrder order, LoginUser user) { |
| | | if (result.isSuccess()) { |
| | | if (InspectionStatus.IN_PROGRESS.getCode().equals(order.getInspectionStatus()) && StrUtil.isEmpty(request.getDealType())) { |
| | | if (InspectionStatus.UNDER_INSPECTION.name().equals(order.getInspectionStatus()) && StrUtil.isEmpty(request.getConfirmDealType())) { |
| | | // 点检完成 |
| | | order.setInspectionStatus("3"); |
| | | order.setInspectionStatus(InspectionStatus.WAIT_CONFIRM.name()); |
| | | order.setOperateTime(new Date()); |
| | | if (CollectionUtil.isNotEmpty(request.getFileList())) { |
| | | List<FileUploadResult> fileUploadResultList = request.getFileList(); |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | | String referenceFile = mapper.writeValueAsString(fileUploadResultList); |
| | | order.setImageFiles(referenceFile); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("JSON转换失败:" + e.getMessage(), e); |
| | | } |
| | | } |
| | | eamInspectionOrderDetailService.remove(new QueryWrapper<EamInspectionOrderDetail>().eq("order_id", order.getId())); |
| | | eamInspectionOrderDetailService.saveBatch(request.getTableDetailList()); |
| | | } else if (InspectionStatus.COMPLETED.getCode().equals(order.getInspectionStatus()) && StrUtil.isNotEmpty(request.getDealType())) { |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.INSPECTION_CONFIRM.name()); |
| | | } else if (InspectionStatus.WAIT_CONFIRM.name().equals(order.getInspectionStatus()) && StrUtil.isNotEmpty(request.getConfirmDealType())) { |
| | | // 班组长确认任务 |
| | | order.setInspectionStatus("4"); |
| | | order.setInspectionStatus(InspectionStatus.COMPLETE.name()); |
| | | order.setConfirmUser(user.getUsername()); |
| | | order.setConfirmComment(request.getConfirmComment()); |
| | | order.setConfirmDealType(request.getConfirmDealType()); |
| | | order.setConfirmTime(new Date()); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name()); |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | /** |
| | | * 设备是否存在异常,并进行设备维修 |
| | | * |
| | | * @param eamInspectionOrder |
| | | */ |
| | | private void updateEamInspectionOrderDetail(EamInspectionOrder eamInspectionOrder) { |
| | | EamEquipmentFaultReason eamEquipmentFaultReason=eamEquipmentFaultReasonService. |
| | | getOne(new QueryWrapper<EamEquipmentFaultReason>().eq("fault_code","EFR20250003")); |
| | | List<EamInspectionOrderDetail> eamInspectionOrderDetails = eamInspectionOrderDetailService |
| | | .list(new QueryWrapper<EamInspectionOrderDetail>() |
| | | .eq("order_id", eamInspectionOrder.getId()).eq("report_flag","1")); |
| | | List<EamReportRepair> eamReportRepairs = new ArrayList<>(); |
| | | if (!eamInspectionOrderDetails.isEmpty()) { |
| | | eamInspectionOrderDetails.forEach(item->{ |
| | | EamReportRepair eamReportRepair=new EamReportRepair(); |
| | | eamReportRepair.setEquipmentId(eamInspectionOrder.getEquipmentId()); |
| | | eamReportRepair.setFaultName(eamEquipmentFaultReason.getFaultName()); |
| | | eamReportRepair.setFaultType(eamEquipmentFaultReason.getFaultCategory()); |
| | | eamReportRepair.setFaultDescription(eamEquipmentFaultReason.getFaultDescription()); |
| | | eamReportRepair.setReportStatus(ReportRepairEnum.WAIT_REPAIR.name()); |
| | | eamReportRepair.setBreakdownFlag("1"); |
| | | eamReportRepair.setDelFlag(CommonConstant.DEL_FLAG_0); |
| | | eamReportRepair.setFaultStartTime(new Date()); |
| | | eamReportRepair.setRemark(item.getExceptionDescription()); |
| | | eamReportRepairs.add(eamReportRepair); |
| | | }); |
| | | } |
| | | if (!eamReportRepairs.isEmpty()) { |
| | | eamReportRepairService.saveBatch(eamReportRepairs); |
| | | } |
| | | .eq("order_id", eamInspectionOrder.getId()).eq("report_flag", "1").eq("inspection_result", "2")); |
| | | eamReportRepairService.reportRepairFromInspection(eamInspectionOrder.getEquipmentId(), eamInspectionOrder.getOperator(), eamInspectionOrderDetails); |
| | | } |
| | | |
| | | /** |
| | | * 批量作废与领取 |
| | | * |
| | | * @param ids |
| | | * @param type |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result<?> batchCancelOrTakeInspectionOrder(String ids, String type){ |
| | | public Result<?> batchCancelOrTakeInspectionOrder(String ids, String type) { |
| | | if (type == null) { |
| | | return Result.error("请选择操作类型"); |
| | | } |
| | | LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | QueryWrapper<EamInspectionOrder> queryWrapper =new QueryWrapper<>(); |
| | | QueryWrapper<EamInspectionOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.in("id", list); |
| | | queryWrapper.eq("inspection_status", "1"); |
| | | List<EamInspectionOrder> eamInspectionOrderList =this.list(queryWrapper); |
| | | if (!eamInspectionOrderList.isEmpty()){ |
| | | queryWrapper.eq("inspection_status", InspectionStatus.WAIT_INSPECTION.name()); |
| | | List<EamInspectionOrder> eamInspectionOrderList = this.list(queryWrapper); |
| | | if (!eamInspectionOrderList.isEmpty()) { |
| | | eamInspectionOrderList.forEach(eamInspectionOrder -> { |
| | | eamInspectionOrder.setInspectionStatus(type); |
| | | if (type.equals("2")){ |
| | | if (InspectionStatus.UNDER_INSPECTION.name().equals(type)) { |
| | | eamInspectionOrder.setOperator(loginUser.getUsername()); |
| | | this.triggerProcess(eamInspectionOrder); |
| | | }else { |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | } else { |
| | | eamInspectionOrder.setOperator(null); |
| | | } |
| | | }); |
| | |
| | | |
| | | |
| | | @Override |
| | | public Result<?> selectVoById(String id){ |
| | | List<EamInspectionOrder> eamInspectionOrders=this.list(new QueryWrapper<EamInspectionOrder>().eq("id", id)); |
| | | List<EamInspectionOrderRequest> eamInspectionOrderRequestList=new ArrayList<>(); |
| | | public Result<?> selectVoById(String id) { |
| | | List<EamInspectionOrder> eamInspectionOrders = this.list(new QueryWrapper<EamInspectionOrder>().eq("id", id)); |
| | | List<EamInspectionOrderRequest> eamInspectionOrderRequestList = new ArrayList<>(); |
| | | eamInspectionOrders.forEach(eamInspectionOrder -> { |
| | | EamInspectionOrderRequest eamInspectionOrderRequest=new EamInspectionOrderRequest(); |
| | | BeanUtils.copyProperties(eamInspectionOrder,eamInspectionOrderRequest); |
| | | List<EamInspectionOrderDetail> eamInspectionOrderDetails=eamInspectionOrderDetailService |
| | | EamInspectionOrderRequest eamInspectionOrderRequest = new EamInspectionOrderRequest(); |
| | | BeanUtils.copyProperties(eamInspectionOrder, eamInspectionOrderRequest); |
| | | List<EamInspectionOrderDetail> eamInspectionOrderDetails = eamInspectionOrderDetailService |
| | | .list(new QueryWrapper<EamInspectionOrderDetail>().eq("order_id", eamInspectionOrder.getId())); |
| | | eamInspectionOrderRequest.setTableDetailList(eamInspectionOrderDetails); |
| | | eamInspectionOrderRequestList.add(eamInspectionOrderRequest); |
| | |
| | | public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { |
| | | //业务是否干预流程,业务干预,流程干预,指定人员进行处理 |
| | | //获取下一步处理人 |
| | | Object object=values.get("NextAssignee"); |
| | | Object object = values.get("NextAssignee"); |
| | | return (List<String>) object; |
| | | } |
| | | } |