| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | 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.fasterxml.jackson.core.JsonProcessingException; |
| | |
| | | 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.*; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamRepairOrder; |
| | | import org.jeecg.modules.eam.entity.EamReportRepair; |
| | | import org.jeecg.modules.eam.mapper.EamRepairOrderMapper; |
| | | import org.jeecg.modules.eam.request.EamRepairOrderQuery; |
| | | import org.jeecg.modules.eam.request.EamRepairOrderRequest; |
| | | import org.jeecg.modules.eam.request.EamRepairOrderResponse; |
| | | import org.jeecg.modules.eam.request.*; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentExtendService; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamRepairOrderService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | | import org.jeecg.modules.eam.vo.RepairmanRankingVO; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCommonService; |
| | | import org.jeecg.modules.flowable.domain.vo.WorkTaskDataVo; |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.qywx.message.vo.TemplateCard; |
| | | import org.jeecg.modules.qywx.message.vo.TemplateCardEntity; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.system.vo.UserSelector; |
| | | import org.jeecg.modules.system.service.impl.ThirdAppWechatEnterpriseServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @Description: 维修工单 |
| | |
| | | private IFlowTaskService flowTaskService; |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | |
| | | @Resource |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | private ThirdAppWechatEnterpriseServiceImpl wechatEnterpriseService; |
| | | |
| | | @Resource |
| | | private ISysUserService sysUserService; |
| | | |
| | | @Value("${wechatEnterprise.cardActionUrl}") |
| | | private String cardActionUrl; |
| | | |
| | | /** |
| | | * 分页列表 |
| | | * |
| | | * @param page |
| | | * @param eamRepairOrderQuery |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<EamRepairOrder> pageList(Page<EamRepairOrder> page, EamRepairOrderQuery eamRepairOrderQuery) { |
| | | public IPage<EamRepairOrder> pageList(Page<EamRepairOrder> page, EamRepairOrderQuery query) { |
| | | // //用户数据权限 |
| | | // LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // if (sysUser == null) { |
| | | // return page; |
| | | // } |
| | | // List<String> equipmentIds = new ArrayList<>(); |
| | | // if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { |
| | | // //选择了设备,根据设备id过滤设备 |
| | | // equipmentIds = Arrays.asList(sysUser.getEquipmentIds().split(",")); |
| | | // } |
| | | // return this.baseMapper.pageList(page, eamRepairOrderQuery, sysUser.getId(), equipmentIds); |
| | | QueryWrapper<EamRepairOrder> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("wmo.del_flag", CommonConstant.DEL_FLAG_0); |
| | | //用户数据权限 |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (sysUser == null) { |
| | | return page; |
| | | } |
| | | List<String> equipmentIds = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(sysUser.getEquipmentIds())) { |
| | | //选择了设备,根据设备id过滤设备 |
| | | equipmentIds = Arrays.asList(sysUser.getEquipmentIds().split(",")); |
| | | 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()); |
| | | } |
| | | return this.baseMapper.pageList(page, eamRepairOrderQuery, sysUser.getId(), equipmentIds); |
| | | //查询条件过滤 |
| | | if (query != null) { |
| | | if (StringUtils.isNotBlank(query.getEquipmentId())) { |
| | | queryWrapper.eq("wmo.equipment_id", query.getEquipmentId()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getEquipmentCode())) { |
| | | queryWrapper.like("e.equipment_code", query.getEquipmentCode()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getEquipmentName())) { |
| | | queryWrapper.like("e.equipment_name", query.getEquipmentName()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getRepairStatus())) { |
| | | queryWrapper.eq("wmo.repair_status", query.getRepairStatus()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getRepairer())) { |
| | | queryWrapper.like("wmo.repairer", query.getRepairer()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getRepairCode())) { |
| | | queryWrapper.like("wmo.repair_code", query.getRepairCode()); |
| | | } |
| | | if (StringUtils.isNotBlank(query.getSparePartDescription())) { |
| | | queryWrapper.like("wmo.spare_part_description", query.getSparePartDescription()); |
| | | } |
| | | // if(query.getStartTime() != null && query.getEndTime() != null) { |
| | | // queryWrapper.between("wmo.fault_start_time", query.getStartTime(), query.getEndTime()); |
| | | // } |
| | | //排序 |
| | | 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 baseMapper.queryPageList(page, queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | |
| | | eamRepairOrder.setActualStartTime(DateUtils.getNow()); |
| | | eamRepairOrder.setIsUseSpare(0); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | eamRepairOrder.setRepairer(user.getRealname()); |
| | | eamRepairOrder.setRepairer(user.getUsername()); |
| | | super.save(eamRepairOrder); |
| | | EamEquipment eamEquipment = eamEquipmentService.getById(eamReportRepair.getEquipmentId()); |
| | | // 启动维修流程 |
| | | flowCommonService.initActBusiness("维修工单号:" + codeSeq + ", 设备编号:" + eamEquipment.getEquipmentCode() + "开始维修", |
| | | flowCommonService.initActBusiness("工单号:" + codeSeq + ", 设备编号:" + eamEquipment.getEquipmentCode() + ";安装位置: " + eamEquipment.getInstallationPosition(), |
| | | eamRepairOrder.getId(), |
| | | "IEamRepairOrderService", |
| | | "eam_repair", |
| | |
| | | eamReportRepairService.updateById(eamReportRepair); |
| | | //更新设备维修状态 |
| | | eamEquipmentExtendService.updateEquipmentRepairStatus(eamReportRepair.getEquipmentId(), EquipmentRepairStatus.UNDER_REPAIR.name()); |
| | | //推送企业微信消息 |
| | | sendQywxTemplateCardMessage(eamRepairOrder, eamReportRepair, null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 指派 |
| | | * @param eamReportRepairQuery |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void assign(EamReportRepairQuery eamReportRepairQuery) { |
| | | EamRepairOrder eamRepairOrder = new EamRepairOrder(); |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.REPAIR_ORDER_CODE_RULE); |
| | | eamRepairOrder.setRepairCode(codeSeq); |
| | | EamReportRepair eamReportRepair = eamReportRepairService.getById(eamReportRepairQuery.getId()); |
| | | eamRepairOrder.setReportId(eamReportRepairQuery.getId()); |
| | | eamRepairOrder.setDelFlag(CommonConstant.DEL_FLAG_0); |
| | | eamRepairOrder.setEquipmentId(eamReportRepair.getEquipmentId()); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.UNDER_REPAIR.name()); |
| | | eamRepairOrder.setActualStartTime(DateUtils.getNow()); |
| | | eamRepairOrder.setIsUseSpare(0); |
| | | eamRepairOrder.setRepairer(eamReportRepairQuery.getRepairer()); |
| | | super.save(eamRepairOrder); |
| | | EamEquipment eamEquipment = eamEquipmentService.getById(eamReportRepair.getEquipmentId()); |
| | | // 启动维修流程 |
| | | flowCommonService.initActBusiness("工单号: " + codeSeq + ";设备编号: " + eamEquipment.getEquipmentCode() + ";安装位置: " + eamEquipment.getInstallationPosition(), |
| | | eamRepairOrder.getId(), |
| | | "IEamRepairOrderService", |
| | | "eam_repair", |
| | | null); |
| | | Map<String, Object> variables = new HashMap<>(); |
| | | variables.put("dataId", eamRepairOrder.getId()); |
| | | variables.put("organization", "维修工单启动流程"); |
| | | variables.put("comment", "维修工单启动流程"); |
| | | variables.put("proofreading", true); |
| | | List<String> usernames = new ArrayList<>(); |
| | | usernames.add(eamReportRepairQuery.getRepairer()); |
| | | variables.put("NextAssignee", usernames); |
| | | Result result = flowDefinitionService.startProcessInstanceByKey("eam_repair", variables); |
| | | if (!result.isSuccess()) { |
| | | super.removeById(eamRepairOrder); |
| | | } else { |
| | | eamReportRepair.setReportStatus(ReportRepairEnum.UNDER_REPAIR.name()); |
| | | eamReportRepairService.updateById(eamReportRepair); |
| | | //更新设备维修状态 |
| | | eamEquipmentExtendService.updateEquipmentRepairStatus(eamReportRepair.getEquipmentId(), EquipmentRepairStatus.UNDER_REPAIR.name()); |
| | | //推送企业微信消息 |
| | | sendQywxTemplateCardMessage(eamRepairOrder, null, null); |
| | | } |
| | | } |
| | | |
| | | private void sendQywxTemplateCardMessage(EamRepairOrder eamRepairOrder, EamReportRepair reportRepair, EamRepairOrderRequest request) { |
| | | TemplateCard templateCard = new TemplateCard(); |
| | | String repairStatus = eamRepairOrder.getRepairStatus(); |
| | | EamEquipment equipment = eamEquipmentService.getById(eamRepairOrder.getEquipmentId()); |
| | | eamRepairOrder.setEquipmentCode(equipment.getEquipmentCode()); |
| | | if (ReportRepairEnum.UNDER_REPAIR.name().equals(repairStatus)) { |
| | | //工单已指派,推送消息给维修工 |
| | | String repairer = eamRepairOrder.getRepairer(); |
| | | String touser = wechatEnterpriseService.getTouser(repairer, false); |
| | | templateCard.setTouser(touser); |
| | | } |
| | | if (ReportRepairEnum.WAIT_SPARES.name().equals(repairStatus)) { |
| | | //工单进入等待备件状态,推送消息给设备管理员 |
| | | List<String> nextAssignee = (List<String>) request.getValues().get("NextAssignee"); |
| | | String nextAssigneeStr = nextAssignee.stream() |
| | | .filter(Objects::nonNull) // 可选:过滤 null 值 |
| | | .collect(Collectors.joining(",")); |
| | | String touser = wechatEnterpriseService.getTouser(nextAssigneeStr, false); |
| | | templateCard.setTouser(touser); |
| | | } |
| | | if (ReportRepairEnum.WAIT_CONFIRM.name().equals(repairStatus)) { |
| | | //工单进入待确认状态,推送消息给报修员 |
| | | String touser = wechatEnterpriseService.getTouser(reportRepair.getCreateBy(), false); |
| | | templateCard.setTouser(touser); |
| | | } |
| | | |
| | | TemplateCardEntity templateCardEntity = new TemplateCardEntity(); |
| | | templateCard.setTemplate_card(templateCardEntity); |
| | | templateCardEntity.setTask_id(eamRepairOrder.getId()); |
| | | TemplateCardEntity.MainTitle mainTitle = new TemplateCardEntity.MainTitle(); |
| | | mainTitle.setTitle("设备维修"); |
| | | templateCardEntity.setMain_title(mainTitle); |
| | | |
| | | if (ReportRepairEnum.UNDER_REPAIR.name().equals(repairStatus)) { |
| | | if (Objects.isNull(reportRepair) && Objects.isNull(request)) { |
| | | templateCardEntity.setSub_title_text("收到指派工单: " + eamRepairOrder.getRepairCode() + " 请开始进行维修"); |
| | | } else if (Objects.isNull(request)) { |
| | | templateCardEntity.setSub_title_text("已领取维修工单: " + eamRepairOrder.getRepairCode() + " 开始进行维修"); |
| | | } |
| | | else { |
| | | templateCardEntity.setSub_title_text("维修工单: " + eamRepairOrder.getRepairCode() + " 备件已到位,请继续进行维修"); |
| | | } |
| | | } |
| | | if (ReportRepairEnum.WAIT_SPARES.name().equals(repairStatus)) { |
| | | templateCardEntity.setSub_title_text("维修工单: " + eamRepairOrder.getRepairCode() + " 需要领用备件"); |
| | | } |
| | | if (ReportRepairEnum.WAIT_CONFIRM.name().equals(repairStatus)) { |
| | | templateCardEntity.setSub_title_text("工单: " + eamRepairOrder.getRepairCode() + " 已完成设备维修,请进入系统确认"); |
| | | } |
| | | |
| | | List<TemplateCardEntity.HorizontalContent> horizontalContentList = CollectionUtil.newArrayList(); |
| | | TemplateCardEntity.HorizontalContent content1 = new TemplateCardEntity.HorizontalContent(); |
| | | content1.setKeyname("工单号"); |
| | | content1.setValue(eamRepairOrder.getRepairCode()); |
| | | horizontalContentList.add(content1); |
| | | TemplateCardEntity.HorizontalContent content2 = new TemplateCardEntity.HorizontalContent(); |
| | | content2.setKeyname("设备编号"); |
| | | content2.setValue(eamRepairOrder.getEquipmentCode()); |
| | | horizontalContentList.add(content2); |
| | | |
| | | //如果工单状态为待维修(没指派维修人),流程是没有启动的,无法获取节点信息 |
| | | if (!ReportRepairEnum.WAIT_REPAIR.name().equals(repairStatus)) { |
| | | WorkTaskDataVo previousFlowInfo = flowTaskService.getPreviousFlowInfo(eamRepairOrder.getId()); |
| | | TemplateCardEntity.HorizontalContent content3 = new TemplateCardEntity.HorizontalContent(); |
| | | content3.setKeyname("前驱节点"); |
| | | content3.setValue(previousFlowInfo.getPreNode()); |
| | | horizontalContentList.add(content3); |
| | | TemplateCardEntity.HorizontalContent content4 = new TemplateCardEntity.HorizontalContent(); |
| | | content4.setKeyname("当前节点"); |
| | | if (InspectionStatus.COMPLETE.name().equals(repairStatus)) { |
| | | content4.setValue("已完成"); |
| | | } else { |
| | | content4.setValue(previousFlowInfo.getName()); |
| | | } |
| | | horizontalContentList.add(content4); |
| | | } |
| | | |
| | | if (ReportRepairEnum.UNDER_REPAIR.name().equals(repairStatus)) { |
| | | TemplateCardEntity.HorizontalContent content3 = new TemplateCardEntity.HorizontalContent(); |
| | | SysUser sysUser = sysUserService.getUserByName(eamRepairOrder.getRepairer()); |
| | | if (Objects.isNull(reportRepair) && Objects.isNull(request)) { |
| | | content3.setKeyname("指派人"); |
| | | SysUser assignUser = sysUserService.getUserByName(eamRepairOrder.getCreateBy()); |
| | | content3.setValue(assignUser.getRealname()); |
| | | horizontalContentList.add(content3); |
| | | } else if (Objects.isNull(request)) { |
| | | TemplateCardEntity.HorizontalContent content = new TemplateCardEntity.HorizontalContent(); |
| | | content.setKeyname("领取人"); |
| | | content.setValue(sysUser.getRealname()); |
| | | horizontalContentList.add(content); |
| | | } else { |
| | | content3.setKeyname("备件领取人"); |
| | | SysUser assignUser = sysUserService.getUserByName(request.getAssignee()); |
| | | content3.setValue(assignUser.getRealname()); |
| | | horizontalContentList.add(content3); |
| | | } |
| | | } |
| | | if (ReportRepairEnum.WAIT_SPARES.name().equals(repairStatus) || ReportRepairEnum.WAIT_CONFIRM.name().equals(repairStatus)) { |
| | | TemplateCardEntity.HorizontalContent content3 = new TemplateCardEntity.HorizontalContent(); |
| | | content3.setKeyname("维修人"); |
| | | SysUser repairUser = sysUserService.getUserByName(eamRepairOrder.getRepairer()); |
| | | content3.setValue(repairUser.getRealname()); |
| | | horizontalContentList.add(content3); |
| | | } |
| | | |
| | | templateCardEntity.setHorizontal_content_list(horizontalContentList); |
| | | |
| | | TemplateCardEntity.CardAction cardAction = new TemplateCardEntity.CardAction(); |
| | | cardAction.setType(1); |
| | | cardAction.setUrl(cardActionUrl); |
| | | templateCardEntity.setCard_action(cardAction); |
| | | |
| | | wechatEnterpriseService.sendTemplateCardMsg(templateCard, true); |
| | | } |
| | | |
| | | @Override |
| | | public List<RepairmanRankingVO> repairmanRanking(String start, String end) { |
| | | return this.baseMapper.repairmanRanking(start, end); |
| | | } |
| | | |
| | | /** |
| | |
| | | throw new JeecgBootException("设备不存在,请检查!"); |
| | | } |
| | | |
| | | ReportRepairEnum status = ReportRepairEnum.getInstance(request.getRepairStatus()); |
| | | ReportRepairEnum status = ReportRepairEnum.getInstance(eamRepairOrder.getRepairStatus()); |
| | | if (status == null) { |
| | | return null; |
| | | } |
| | |
| | | switch (status) { |
| | | case UNDER_REPAIR: |
| | | //维修中:下一步 判断是否需要备件, 需要备件转设备管理员领用备件, 不需要则转到设备报修员确认维修完成 |
| | | if (request.getStatus() == 1) { |
| | | if (request.getIsUseSpare() == 1) { |
| | | // 需要 |
| | | List<UserSelector> userSelectors = sysUserService.selectOperatorList(equipment.getEquipmentCode(), equipment.getOrgId(), BusinessCodeConst.PCR0004); |
| | | if (CollectionUtil.isEmpty(userSelectors)) { |
| | | if (StringUtils.isBlank(equipment.getEquipmentManager())) { |
| | | throw new JeecgBootException("设备未分配设备管理员,无法进入下级审批!"); |
| | | } |
| | | values.put("dataId", eamRepairOrder.getId()); |
| | | values.put("organization", "维修工单进入等备件状态"); |
| | | values.put("comment", "维修工单进入等备件状态"); |
| | | values.put("NextAssignee", userSelectors); |
| | | values.put("status", 1); |
| | | request.setComment("维修工单进入等备件状态"); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.WAIT_SPARES.name()); |
| | | eamReportRepair.setReportStatus(ReportRepairEnum.WAIT_SPARES.name()); |
| | | eamRepairOrder.setIsUseSpare(1); |
| | | if (StringUtils.isBlank(eamRepairOrder.getSparePartDescription())) { |
| | | values.put("dataId", eamRepairOrder.getId()); |
| | | values.put("organization", "维修工单进入等备件状态"); |
| | | values.put("comment", "维修工单进入等备件状态"); |
| | | //values.put("NextAssignee", equipment.getEquipmentManager().split(",")); |
| | | //设备台账表维护的设备管理员工号是带 WK前缀的 |
| | | values.put("NextAssignee", Arrays.stream(equipment.getEquipmentManager().split(",")) |
| | | .map(s -> s.substring(2)) |
| | | .collect(Collectors.toList())); |
| | | values.put("status", 1); |
| | | request.setComment("维修工单进入等备件状态"); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.WAIT_SPARES.name()); |
| | | eamReportRepair.setReportStatus(ReportRepairEnum.WAIT_SPARES.name()); |
| | | eamRepairOrder.setIsUseSpare(1); |
| | | } else { |
| | | values.put("dataId", eamRepairOrder.getId()); |
| | | values.put("organization", "维修工单进入报修员确认阶段"); |
| | | values.put("comment", "维修工单进入报修员确认阶段"); |
| | | values.put("NextAssignee", Arrays.asList(eamReportRepair.getCreateBy().split(","))); |
| | | request.setComment("维修工单进入等备件状态"); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.WAIT_CONFIRM.name()); |
| | | eamReportRepair.setReportStatus(ReportRepairEnum.WAIT_CONFIRM.name()); |
| | | eamRepairOrder.setFaultReason(request.getFaultReason()); |
| | | eamRepairOrder.setRepairDescription(request.getRepairDescription()); |
| | | // 处理附件 |
| | | if (CollectionUtil.isNotEmpty(request.getImageFilesResult())) { |
| | | List<FileUploadResult> fileUploadResultList = request.getImageFilesResult(); |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | try { |
| | | String referenceFile = mapper.writeValueAsString(fileUploadResultList); |
| | | eamRepairOrder.setImageFiles(referenceFile); |
| | | } catch (JsonProcessingException e) { |
| | | log.error("JSON转换失败:" + e.getMessage(), e); |
| | | } |
| | | } |
| | | //更新设备维修状态 |
| | | eamEquipmentExtendService.updateEquipmentRepairStatus(eamReportRepair.getEquipmentId(), EquipmentRepairStatus.WAIT_CONFIRM.name()); |
| | | } |
| | | } else { |
| | | // 不需要 |
| | | values.put("dataId", eamRepairOrder.getId()); |
| | | values.put("organization", "维修工单进入报修员确认阶段"); |
| | | values.put("comment", "维修工单进入报修员确认阶段"); |
| | | values.put("NextAssignee", eamReportRepair.getCreateBy()); |
| | | values.put("NextAssignee", Arrays.asList(eamReportRepair.getCreateBy().split(","))); |
| | | values.put("status", 0); |
| | | request.setComment("维修工单进入报修员确认阶段"); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.WAIT_CONFIRM.name()); |
| | |
| | | values.put("dataId", eamRepairOrder.getId()); |
| | | values.put("organization", "维修工单进入维修员继续维修阶段"); |
| | | values.put("comment", "维修工单进入维修员继续维修阶段"); |
| | | values.put("NextAssignee", eamRepairOrder.getRepairer()); |
| | | values.put("NextAssignee", Arrays.asList(eamRepairOrder.getRepairer().split(","))); |
| | | values.put("status", 0); |
| | | request.setComment("维修工单进入维修员继续维修阶段"); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.UNDER_REPAIR.name()); |
| | |
| | | values.put("dataId", eamRepairOrder.getId()); |
| | | values.put("organization", "维修工单流程结束"); |
| | | values.put("comment", "维修工单流程结束"); |
| | | values.put("NextAssignee", eamReportRepair.getCreateBy()); |
| | | values.put("NextAssignee", Arrays.asList(eamReportRepair.getCreateBy().split(","))); |
| | | values.put("status", 0); |
| | | request.setComment("维修工单进入报修员确认阶段"); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.COMPLETE.name()); |
| | |
| | | this.baseMapper.updateById(eamRepairOrder); |
| | | // 同步更新报修表状态 |
| | | eamReportRepairService.updateById(eamReportRepair); |
| | | if (!ReportRepairEnum.COMPLETE.name().equals(eamRepairOrder.getRepairStatus())) { |
| | | //推送企业微信消息(流程完结不发送消息) |
| | | sendQywxTemplateCardMessage(eamRepairOrder, eamReportRepair, request); |
| | | } |
| | | return eamRepairOrder; |
| | | } |
| | | |
| | |
| | | BeanUtils.copyProperties(eamReportRepair, eamRepairOrderResponse); |
| | | eamRepairOrderResponse.setReportImageFiles(eamReportRepair.getImageFiles()); |
| | | eamRepairOrderResponse.setImageFiles(eamRepairOrder.getImageFiles()); |
| | | eamRepairOrderResponse.setReporter(eamReportRepair.getCreateBy()); |
| | | return eamRepairOrderResponse; |
| | | } |
| | | |