| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.ReportRepairEnum; |
| | | 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.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamRepairOrderService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | 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.mdc.util.DateUtils; |
| | | import org.jeecg.modules.system.service.ISysBusinessCodeRuleService; |
| | | 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.List; |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @Description: 维修工单 |
| | | * @Author: Lius |
| | | * @Date: 2025-04-03 |
| | | */ |
| | | @Service |
| | | public class EamRepairOrderServiceImpl extends ServiceImpl<EamRepairOrderMapper, EamRepairOrder> implements IEamRepairOrderService { |
| | | @Service("IEamRepairOrderService") |
| | | public class EamRepairOrderServiceImpl extends ServiceImpl<EamRepairOrderMapper, EamRepairOrder> implements IEamRepairOrderService, FlowCallBackServiceI { |
| | | |
| | | @Resource |
| | | private FlowCommonService flowCommonService; |
| | | |
| | | @Resource |
| | | private ISysBusinessCodeRuleService businessCodeRuleService; |
| | | |
| | | @Resource |
| | | private IEamReportRepairService eamReportRepairService; |
| | | |
| | | @Resource |
| | | private IFlowDefinitionService flowDefinitionService; |
| | | |
| | | @Resource |
| | | private IEamEquipmentService eamEquipmentService; |
| | | |
| | | /** |
| | | * 分页列表 |
| | |
| | | } |
| | | return this.baseMapper.pageList(page, eamRepairOrder, sysUser.getId(), equipmentIds); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveRepairOrder(EamRepairOrder eamRepairOrder) { |
| | | String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.REPAIR_ORDER_CODE_RULE); |
| | | eamRepairOrder.setRepairCode(codeSeq); |
| | | EamReportRepair eamReportRepair = eamReportRepairService.getById(eamRepairOrder.getReportId()); |
| | | eamRepairOrder.setDelFlag(CommonConstant.DEL_FLAG_0); |
| | | eamRepairOrder.setEquipmentId(eamReportRepair.getEquipmentId()); |
| | | eamRepairOrder.setRepairStatus(ReportRepairEnum.UNDER_REPAIR.name()); |
| | | eamRepairOrder.setActualStartTime(DateUtils.getNow()); |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | eamRepairOrder.setRepairer(user.getRealname()); |
| | | super.save(eamRepairOrder); |
| | | EamEquipment eamEquipment = eamEquipmentService.getById(eamReportRepair.getEquipmentId()); |
| | | // 启动维修流程 |
| | | flowCommonService.initActBusiness("维修工单号:" + codeSeq + ", 设备编号:" + eamEquipment.getEquipmentCode() + "开始维修", |
| | | 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(user.getUsername()); |
| | | 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); |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void afterFlowHandle(FlowMyBusiness business) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public Object getBusinessDataById(String dataId) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Object> flowValuesOfTask(String taskNameId, Map<String, Object> values) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> flowCandidateUsernamesOfTask(String taskNameId, Map<String, Object> values) { |
| | | //获取下一步处理人 |
| | | Object object=values.get("NextAssignee"); |
| | | return (List<String>) object; |
| | | } |
| | | } |