| | |
| | | String inspectionStatus = eamInspectionOrder.getInspectionStatus(); |
| | | EamEquipment equipment = eamEquipmentService.getById(eamInspectionOrder.getEquipmentId()); |
| | | eamInspectionOrder.setEquipmentCode(equipment.getEquipmentCode()); |
| | | //todo 目前确认,待领取工单不推送 |
| | | //if (InspectionStatus.WAIT_INSPECTION.name().equals(inspectionStatus)) { |
| | | // //工单待领取,推送消息给所有操作工 |
| | | // String orgId = Optional.ofNullable(eamEquipmentService.getById(eamInspectionOrder.getEquipmentId())) |
| | | // .map(EamEquipment::getOrgId) |
| | | // .orElse(null); |
| | | // if (orgId == null) { |
| | | // throw new IllegalArgumentException("未找到设备的组织 ID"); |
| | | // } |
| | | // //查询该设备所属产线的所有操作工 |
| | | // List<SysUser> sysUserList = mdcUserProductionService.queryByPostAndProId("PCR0001", orgId); |
| | | // List<String> usernameList = sysUserList.stream().map(SysUser::getUsername).collect(Collectors.toList()); |
| | | // if (usernameList.isEmpty()) { |
| | | // throw new IllegalArgumentException("未找到该设备所属产线的操作工,请联系管理员处理"); |
| | | // } |
| | | // String nextAssigneeStr = usernameList.stream() |
| | | // .filter(Objects::nonNull) // 可选:过滤 null 值 |
| | | // .collect(Collectors.joining(",")); |
| | | // String touser = wechatEnterpriseService.getTouser(nextAssigneeStr, false); |
| | | // templateCard.setTouser(touser); |
| | | //} |
| | | if (InspectionStatus.UNDER_INSPECTION.name().equals(inspectionStatus)) { |
| | | //工单已开始点检,推送消息给具体操作工(新增工单时指定、领取工单的操作工) |
| | | String operator = eamInspectionOrder.getOperator(); |
| | |
| | | String touser = wechatEnterpriseService.getTouser(nextAssigneeStr, false); |
| | | templateCard.setTouser(touser); |
| | | } |
| | | //todo 工单完成,不推送消息 |
| | | //if (InspectionStatus.COMPLETE.name().equals(inspectionStatus)) { |
| | | // //工单已确认完成,推送消息给点检人 |
| | | // String touser = wechatEnterpriseService.getTouser(eamInspectionOrder.getOperator(), false); |
| | | // templateCard.setTouser(touser); |
| | | //} |
| | | |
| | | TemplateCardEntity templateCardEntity = new TemplateCardEntity(); |
| | | templateCard.setTemplate_card(templateCardEntity); |
| | |
| | | mainTitle.setTitle("设备点检"); |
| | | templateCardEntity.setMain_title(mainTitle); |
| | | |
| | | //if (InspectionStatus.WAIT_INSPECTION.name().equals(inspectionStatus)) { |
| | | // templateCardEntity.setSub_title_text("新增设备点检工单: " + eamInspectionOrder.getOrderNum() + " ,请进入系统领取"); |
| | | //} |
| | | if (InspectionStatus.UNDER_INSPECTION.name().equals(inspectionStatus)) { |
| | | if (Objects.nonNull(request) && StrUtil.isNotBlank(request.getConfirmDealType())) { |
| | | //是驳回的单子 |
| | |
| | | if (InspectionStatus.WAIT_CONFIRM.name().equals(inspectionStatus)) { |
| | | templateCardEntity.setSub_title_text("工单: " + eamInspectionOrder.getOrderNum() + " 已完成设备点检,请进入系统确认"); |
| | | } |
| | | //if (InspectionStatus.COMPLETE.name().equals(inspectionStatus)) { |
| | | // templateCardEntity.setSub_title_text("工单: " + eamInspectionOrder.getOrderNum() + " 已完成点检后确认"); |
| | | //} |
| | | |
| | | List<TemplateCardEntity.HorizontalContent> horizontalContentList = CollectionUtil.newArrayList(); |
| | | TemplateCardEntity.HorizontalContent content1 = new TemplateCardEntity.HorizontalContent(); |
| | |
| | | horizontalContentList.add(content4); |
| | | } |
| | | |
| | | //if (InspectionStatus.WAIT_INSPECTION.name().equals(inspectionStatus)) { |
| | | // TemplateCardEntity.HorizontalContent content3 = new TemplateCardEntity.HorizontalContent(); |
| | | // content3.setKeyname("发起人"); |
| | | // SysUser sysUser = sysUserService.getUserByName(eamInspectionOrder.getCreateBy()); |
| | | // content3.setValue(sysUser.getRealname()); |
| | | // horizontalContentList.add(content3); |
| | | //} |
| | | if (InspectionStatus.UNDER_INSPECTION.name().equals(inspectionStatus)) { |
| | | if (Objects.isNull(request)) { |
| | | TemplateCardEntity.HorizontalContent content = new TemplateCardEntity.HorizontalContent(); |
| | |
| | | content3.setValue(sysUser.getRealname()); |
| | | horizontalContentList.add(content3); |
| | | } |
| | | //if ((InspectionStatus.COMPLETE.name().equals(inspectionStatus))) { |
| | | // TemplateCardEntity.HorizontalContent content3 = new TemplateCardEntity.HorizontalContent(); |
| | | // TemplateCardEntity.HorizontalContent content4 = new TemplateCardEntity.HorizontalContent(); |
| | | // content3.setKeyname("确认人"); |
| | | // SysUser sysUser = sysUserService.getUserByName(eamInspectionOrder.getCreateBy()); |
| | | // content3.setValue(sysUser.getRealname()); |
| | | // horizontalContentList.add(content3); |
| | | // content4.setKeyname("确认意见"); |
| | | // content4.setValue("通过"); |
| | | // horizontalContentList.add(content4); |
| | | //} |
| | | |
| | | templateCardEntity.setHorizontal_content_list(horizontalContentList); |
| | | |
| | | TemplateCardEntity.CardAction cardAction = new TemplateCardEntity.CardAction(); |