| | |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.TranslateDictTextUtils; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.dto.EamRepairOrderDto; |
| | | import org.jeecg.modules.eam.entity.EamRepairOrder; |
| | | import org.jeecg.modules.eam.request.EamRepairOrderQuery; |
| | | import org.jeecg.modules.eam.request.EamRepairOrderRequest; |
| | |
| | | /** |
| | | * 领取 |
| | | * |
| | | * @param eamRepairOrder |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "维修工单-领取") |
| | | @ApiOperation(value = "维修工单-领取", notes = "维修工单-领取") |
| | | @PostMapping(value = "/add") |
| | | public Result<?> add(@RequestBody EamRepairOrder eamRepairOrder) { |
| | | if (StringUtils.isBlank(eamRepairOrder.getReportId())) { |
| | | return Result.error("领取失败,请选择维修记录!"); |
| | | } |
| | | @AutoLog(value = "维修工单-提交") |
| | | @ApiOperation(value = "维修工单-提交", notes = "维修工单-提交") |
| | | @GetMapping(value = "/submit") |
| | | public Result<?> submit(String id) { |
| | | // 校验领取权限 |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (!BusinessCodeConst.PCR0002.equals(user.getPost())) { |
| | | return Result.error("领取失败,没有领取权限!"); |
| | | return Result.error("提交失败,没有提交权限!,请登录维修工岗位用户"); |
| | | } |
| | | eamRepairOrderService.saveRepairOrder(eamRepairOrder); |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | | /** |
| | | * 指派 |
| | | * |
| | | * @param |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "故障报修-指派") |
| | | @ApiOperation(value = "故障报修-指派", notes = "故障报修-指派") |
| | | @PostMapping(value = "/assign") |
| | | public Result<?> assign(@RequestBody EamReportRepairQuery eamReportRepairQuery) { |
| | | if (StringUtils.isBlank(eamReportRepairQuery.getRepairer())) { |
| | | return Result.error("指派失败,请选择维修工!"); |
| | | } |
| | | // 校验指派权限 |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (!BusinessCodeConst.PCR0004.equals(user.getPost())) { |
| | | return Result.error("指派失败,没有指派权限!"); |
| | | } |
| | | // 校验维修工权限 |
| | | SysUser sysUser = sysUserService.getUserByName(eamReportRepairQuery.getRepairer()); |
| | | if (sysUser == null) { |
| | | return Result.error("指派失败,未找到此维修工用户!"); |
| | | } |
| | | if (!BusinessCodeConst.PCR0002.equals(sysUser.getPost())) { |
| | | return Result.error("指派失败,此用户不是维修工!"); |
| | | } |
| | | eamRepairOrderService.assign(eamReportRepairQuery); |
| | | |
| | | return Result.OK("指派成功!"); |
| | | eamRepairOrderService.saveRepairOrder(id); |
| | | return Result.OK("提交成功!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | /** |
| | | * 填报详情 |
| | | * @param id |
| | | */ |
| | | @AutoLog(value = "维修工单-填报详情") |
| | | @ApiOperation(value = "维修工单-填报详情", notes = "维修工单-填报详情") |
| | | @GetMapping(value = "/queryByReportId") |
| | | public Result<?> queryByReportId(@RequestParam(name = "id", required = true) String id) { |
| | | return Result.ok(eamRepairOrderService.queryByReportId(id)); |
| | | } |
| | | |
| | | /** |
| | | * 填报维修工单 |
| | | * @param eamRepairOrderDto |
| | | */ |
| | | @ApiOperation(value = "维修工单-填报维修工单", notes = "维修工单-填报维修工单") |
| | | @PostMapping(value = "/report") |
| | | public Result<?> report(@RequestBody EamRepairOrderDto eamRepairOrderDto) { |
| | | // 校验领取权限 |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if (!BusinessCodeConst.PCR0002.equals(user.getPost())) { |
| | | return Result.error("填报失败,没有填报权限!,请登录维修工岗位用户"); |
| | | } |
| | | if (eamRepairOrderDto == null) { |
| | | return Result.error("填报的对象不能为空!"); |
| | | }else { |
| | | boolean b = eamRepairOrderService.report(eamRepairOrderDto); |
| | | if(!b) { |
| | | return Result.error("填报失败,请重试"); |
| | | }else { |
| | | return Result.OK("填报成功"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 通过id查询 |
| | | * |
| | | * @param id |
| | |
| | | translateDictTextUtils.translateField("reportStatus", eamRepairOrder.getReportStatus(), item, "report_repair_status"); |
| | | translateDictTextUtils.translateField("equipmentId", eamRepairOrder.getEquipmentId(), item, "eam_equipment,id,equipment_code"); |
| | | translateDictTextUtils.translateField("repairStatus", eamRepairOrder.getRepairStatus(), item, "report_repair_status"); |
| | | translateDictTextUtils.translateField("repairer", eamRepairOrder.getRepairer(), item, "sys_user,username,realname"); |
| | | return Result.OK(item); |
| | | } catch (Exception e) { |
| | | return Result.error("数据转译失败!"); |