| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | |
| | | public Result<?> orderStart(@RequestBody RepairOrder repairOrder){ |
| | | if(StringUtils.isNotBlank(repairOrder.getReportRepairId())){ |
| | | EquipmentReportRepair equipmentReportRepair = equipmentReportRepairService.getById(repairOrder.getReportRepairId()); |
| | | equipmentReportRepair.setStatus("3"); |
| | | equipmentReportRepair.setStatus("2"); |
| | | equipmentReportRepairService.updateById(equipmentReportRepair); |
| | | if(StringUtils.isNotBlank(equipmentReportRepair.getEquipmentId())){ |
| | | Equipment equipment = equipmentService.getById(equipmentReportRepair.getEquipmentId()); |
| | |
| | | projectMaintenanceOrder.setTypeStatus("underExecution"); |
| | | projectMaintenanceOrderService.updateById(projectMaintenanceOrder); |
| | | } |
| | | return Result.OK(repairOrderService.update(new UpdateWrapper<RepairOrder>().set("status",3).set("actual_start_time",new Date(System.currentTimeMillis())).eq("id",repairOrder.getId()))); |
| | | repairOrder |
| | | .setStatus("3") |
| | | .setActualStartTime(new Date()) |
| | | .setRepairOrderUda1("normal"); |
| | | repairOrderService.updateById(repairOrder); |
| | | return Result.OK("开工成功"); |
| | | } |
| | | /** |
| | | * 工单报工 |
| | |
| | | * @return |
| | | */ |
| | | @PutMapping(value = "/report") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> orderReport(@RequestBody RepairOrder repairOrder){ |
| | | if(StringUtils.isNotBlank(repairOrder.getProjectMaintenanceOrderId())){ |
| | | //判断项目性维修子表状态 |
| | |
| | | } |
| | | LoginUser user= (LoginUser)SecurityUtils.getSubject().getPrincipal(); |
| | | if(StringUtils.isNotBlank(repairOrder.getReportRepairId())){ |
| | | equipmentReportRepairService.update(new UpdateWrapper<EquipmentReportRepair>().eq("id",repairOrder.getReportRepairId()).set("status",3)); |
| | | equipmentReportRepairService.update(new UpdateWrapper<EquipmentReportRepair>().eq("id",repairOrder.getReportRepairId()).set("status",4)); |
| | | } |
| | | return Result.OK(repairOrderService.update(new UpdateWrapper<RepairOrder>().set("status",4).set("actual_end_time",new Date(System.currentTimeMillis())).set("recipient_user_id",user.getId()).eq("id",repairOrder.getId()))); |
| | | Date now = new Date(); |
| | | Date start = repairOrder.getActualStartTime(); |
| | | long timeDifference = now.getTime() - start.getTime(); |
| | | BigDecimal hours = new BigDecimal(timeDifference) |
| | | .divide(new BigDecimal(60 * 60 * 1000), 3, BigDecimal.ROUND_HALF_EVEN); |
| | | repairOrder.setStatus("4"); |
| | | repairOrder.setActualEndTime(now); |
| | | repairOrder.setActualHour(hours); |
| | | repairOrder.setRecipientUserId(user.getId()); |
| | | repairOrderService.updateById(repairOrder); |
| | | return Result.OK("报工成功"); |
| | | } |
| | | /** |
| | | * 工单撤销 |
| | |
| | | equipmentReportRepairService.updateBatchById(equipmentReportRepairs); |
| | | return Result.OK("领取成功"); |
| | | } |
| | | /** |
| | | * 工单等备件 |
| | | * @param repairOrder |
| | | * @return |
| | | */ |
| | | @PutMapping(value = "/handleSpare") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> handleSpare(@RequestBody RepairOrder repairOrder){ |
| | | repairOrder.setRepairOrderUda2(new Date()); |
| | | repairOrder.setRepairOrderUda1("needSpare"); |
| | | repairOrderService.updateById(repairOrder); |
| | | return Result.OK("操作成功"); |
| | | } |
| | | /** |
| | | * 工单停止等备件 |
| | | * @param repairOrder |
| | | * @return |
| | | */ |
| | | @PutMapping(value = "/handleSpareStop") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> handleSpareStop(@RequestBody RepairOrder repairOrder){ |
| | | Date now = new Date(); |
| | | Date start = repairOrder.getRepairOrderUda2(); |
| | | long timeDifference = now.getTime() - start.getTime(); |
| | | BigDecimal hours = new BigDecimal(timeDifference) |
| | | .divide(new BigDecimal(60 * 60 * 1000), 3, BigDecimal.ROUND_HALF_EVEN); |
| | | repairOrder.setRepairOrderUda3(now); |
| | | repairOrder.setRepairOrderUda1("normal"); |
| | | repairOrder.setSpareTime(hours); |
| | | repairOrderService.updateById(repairOrder); |
| | | return Result.OK("操作成功"); |
| | | } |
| | | /** |
| | | * 工单等加工件 |
| | | * @param repairOrder |
| | | * @return |
| | | */ |
| | | @PutMapping(value = "/handlePart") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> handlePart(@RequestBody RepairOrder repairOrder){ |
| | | repairOrder.setRepairOrderUda4(new Date()); |
| | | repairOrder.setRepairOrderUda1("needPart"); |
| | | repairOrderService.updateById(repairOrder); |
| | | return Result.OK("操作成功"); |
| | | } |
| | | /** |
| | | * 工单停止等加工件 |
| | | * @param repairOrder |
| | | * @return |
| | | */ |
| | | @PutMapping(value = "/handlePartStop") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> handlePartStop(@RequestBody RepairOrder repairOrder){ |
| | | Date now = new Date(); |
| | | Date start = repairOrder.getRepairOrderUda4(); |
| | | long timeDifference = now.getTime() - start.getTime(); |
| | | BigDecimal hours = new BigDecimal(timeDifference) |
| | | .divide(new BigDecimal(60 * 60 * 1000), 3, BigDecimal.ROUND_HALF_EVEN); |
| | | repairOrder.setRepairOrderUda5(now); |
| | | repairOrder.setRepairOrderUda1("normal"); |
| | | repairOrder.setPartTime(hours); |
| | | repairOrderService.updateById(repairOrder); |
| | | return Result.OK("操作成功"); |
| | | } |
| | | } |