diff --git a/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java b/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java index 5f33047..9703c37 100644 --- a/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java +++ b/imt-server/imt-module-system/imt-module-system-api/src/main/java/com/inspur/module/system/enums/ErrorCodeConstants.java @@ -173,6 +173,9 @@ public interface ErrorCodeConstants { // ========== DNC管理 ========== ErrorCode DNC_PROGRAM_INFO_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到DNC程序信息"); + // ========== 维修管理 ==========、 + ErrorCode REMOTE_MAINTENANCE_ORDER_NOT_EXISTS = new ErrorCode(1_002_028_000, "未获取到维修工单信息"); + // ========== 设备管理模块 ========== ErrorCode GATEWAY_INFO_NOT_EXISTS = new ErrorCode(1_002_029_000, "机床网关信息不存在"); // ========== 报警管理模块 ========== diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/ComponentInfoController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/ComponentInfoController.java index e050080..2563b7c 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/ComponentInfoController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/ComponentInfoController.java @@ -2,10 +2,7 @@ package com.inspur.module.system.controller.equip; import cn.hutool.core.collection.CollUtil; import com.inspur.framework.common.pojo.PageResult; -import com.inspur.module.system.controller.equip.vo.ComponentInfoPageReqVO; -import com.inspur.module.system.controller.equip.vo.ComponentInfoRespVO; -import com.inspur.module.system.controller.equip.vo.ComponentInfoSaveReqVO; -import com.inspur.module.system.controller.equip.vo.EquipSelectionVO; +import com.inspur.module.system.controller.equip.vo.*; import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO; import com.inspur.module.system.service.equip.ComponentInfoService; import com.inspur.module.system.service.equip.EquipInfoService; @@ -117,4 +114,11 @@ public class ComponentInfoController { ExcelUtils.write(response, "机床组件信息.xls", "数据", ComponentInfoRespVO.class,voList); } + @GetMapping("/selection") + @Operation(summary = "机床组件信息下拉") + @PreAuthorize("@ss.hasPermission('imt:component-info:query')") + public List selection(){ + return componentInfoService.selection(); + } + } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/ComponentSelectionVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/ComponentSelectionVO.java new file mode 100644 index 0000000..84e5cc9 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/equip/vo/ComponentSelectionVO.java @@ -0,0 +1,21 @@ +package com.inspur.module.system.controller.equip.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * 机床组件下拉 + * + * @Author xusd + * @Date 2024/9/4 11:17 + **/ +@Data +public class ComponentSelectionVO { + + @Schema(description = "机床组件id") + private String componentId; + + @Schema(description = "机床组件名称") + private String componentName; + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/MaintenanceOrderController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/MaintenanceOrderController.java new file mode 100644 index 0000000..b3b1bcb --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/MaintenanceOrderController.java @@ -0,0 +1,94 @@ +package com.inspur.module.system.controller.maintenance; + +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderRespVO; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderSaveReqVO; +import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO; +import com.inspur.module.system.service.maintenance.MaintenanceOrderService; +import org.springframework.web.bind.annotation.*; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import org.springframework.security.access.prepost.PreAuthorize; +import io.swagger.v3.oas.annotations.tags.Tag; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Operation; +import javax.validation.*; +import javax.servlet.http.*; +import java.io.IOException; +import java.util.List; + +import com.inspur.framework.common.pojo.PageParam; +import com.inspur.framework.common.pojo.CommonResult; +import com.inspur.framework.common.util.object.BeanUtils; +import static com.inspur.framework.common.pojo.CommonResult.success; + +import com.inspur.framework.excel.core.util.ExcelUtils; + +import com.inspur.framework.apilog.core.annotation.ApiAccessLog; +import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*; + +@Tag(name = "管理后台 - 远程维修工单") +@RestController +@RequestMapping("/admin-api/maintenance") +@Validated +public class MaintenanceOrderController { + + @Resource + private MaintenanceOrderService maintenanceOrderService; + + @PostMapping("/create") + @Operation(summary = "创建远程维修工单") + @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:create')") + public CommonResult createRemoteMaintenanceOrder(@Valid @RequestBody MaintenanceOrderSaveReqVO createReqVO) { + return success(maintenanceOrderService.createRemoteMaintenanceOrder(createReqVO)); + } + + @PutMapping("/update") + @Operation(summary = "更新远程维修工单") + @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:update')") + public CommonResult updateRemoteMaintenanceOrder(@Valid @RequestBody MaintenanceOrderSaveReqVO updateReqVO) { + maintenanceOrderService.updateRemoteMaintenanceOrder(updateReqVO); + return success(true); + } + + @DeleteMapping("/delete") + @Operation(summary = "删除远程维修工单") + @Parameter(name = "id", description = "编号", required = true) + @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:delete')") + public CommonResult deleteRemoteMaintenanceOrder(@RequestParam("id") String id) { + maintenanceOrderService.deleteRemoteMaintenanceOrder(id); + return success(true); + } + + @GetMapping("/get") + @Operation(summary = "获得远程维修工单") + @Parameter(name = "id", description = "编号", required = true, example = "1024") + @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:query')") + public CommonResult getRemoteMaintenanceOrder(@RequestParam("id") String id) { + MaintenanceOrderDO remoteMaintenanceOrder = maintenanceOrderService.getRemoteMaintenanceOrder(id); + return success(BeanUtils.toBean(remoteMaintenanceOrder, MaintenanceOrderRespVO.class)); + } + + @GetMapping("/page") + @Operation(summary = "获得远程维修工单分页") + @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:query')") + public CommonResult> getRemoteMaintenanceOrderPage(@Valid MaintenanceOrderPageReqVO pageReqVO) { + PageResult pageResult = maintenanceOrderService.getRemoteMaintenanceOrderPage(pageReqVO); + return success(BeanUtils.toBean(pageResult, MaintenanceOrderRespVO.class)); + } + + @GetMapping("/export-excel") + @Operation(summary = "导出远程维修工单 Excel") + @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:export')") + @ApiAccessLog(operateType = EXPORT) + public void exportRemoteMaintenanceOrderExcel(@Valid MaintenanceOrderPageReqVO pageReqVO, + HttpServletResponse response) throws IOException { + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); + List list = maintenanceOrderService.getRemoteMaintenanceOrderPage(pageReqVO).getList(); + // 导出 Excel + ExcelUtils.write(response, "远程维修工单.xls", "数据", MaintenanceOrderRespVO.class, + BeanUtils.toBean(list, MaintenanceOrderRespVO.class)); + } + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderPageReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderPageReqVO.java new file mode 100644 index 0000000..dc59279 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderPageReqVO.java @@ -0,0 +1,28 @@ +package com.inspur.module.system.controller.maintenance.vo; + +import lombok.*; +import io.swagger.v3.oas.annotations.media.Schema; +import com.inspur.framework.common.pojo.PageParam; + +@Schema(description = "管理后台 - 远程维修工单分页 Request VO") +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class MaintenanceOrderPageReqVO extends PageParam { + + @Schema(description = "维修工单编号") + private String maintenanceOrderNo; + + @Schema(description = "机床设备id") + private String equipId; + + @Schema(description = "机床组件id") + private String componentId; + + @Schema(description = "机床客户id") + private String customerId; + + @Schema(description = "状态") + private String status; + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderRespVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderRespVO.java new file mode 100644 index 0000000..75a01ea --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderRespVO.java @@ -0,0 +1,89 @@ +package com.inspur.module.system.controller.maintenance.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import java.time.LocalDateTime; +import java.util.Date; + +import com.alibaba.excel.annotation.*; +import com.inspur.framework.excel.core.annotations.DictFormat; +import com.inspur.framework.excel.core.convert.DictConvert; + +import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; + +@Schema(description = "管理后台 - 远程维修工单 Response VO") +@Data +@ExcelIgnoreUnannotated +public class MaintenanceOrderRespVO { + + @Schema(description = "维修工单id", requiredMode = Schema.RequiredMode.REQUIRED) + private String maintenanceOrderId; + + @Schema(description = "维修工单编号", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("维修工单编号") + private String maintenanceOrderNo; + + @Schema(description = "本地诊断报告id") + private String diagnoiseReportId; + + @Schema(description = "机床设备id") + private String equipId; + + @ExcelProperty("机床设备") + private String equipNo; + + @Schema(description = "机床组件id") + private String componentId; + + @ExcelProperty("机床组件") + private String componentName; + + @Schema(description = "机床客户信息id") + private String customerId; + + @ExcelProperty("机床客户信息") + private String customerName; + + @Schema(description = "故障类型") + @ExcelProperty(value = "故障类型", converter = DictConvert.class) + @DictFormat("fault_type") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer faultType; + + @Schema(description = "故障描述") + @ExcelProperty("故障描述") + private String description; + + @Schema(description = "优先级") + @ExcelProperty(value = "优先级", converter = DictConvert.class) + @DictFormat("maintenance_priority") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer priority; + + @Schema(description = "完成时间") + @ExcelProperty("完成时间") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date completeTime; + + @Schema(description = "状态") + @ExcelProperty(value = "状态", converter = DictConvert.class) + @DictFormat("maintenance_status") // TODO 代码优化:建议设置到对应的 DictTypeConstants 枚举类中 + private Integer status; + + @Schema(description = "维修人id") + @ExcelProperty("维修人id") + private Long executorId; + + @ExcelProperty("维修人") + private String executorName; + + @Schema(description = "流程实例编号") + @ExcelProperty("流程实例编号") + private String processInstanceId; + + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) + @ExcelProperty("创建时间") + private LocalDateTime createTime; + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java new file mode 100644 index 0000000..d7b4ac3 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java @@ -0,0 +1,58 @@ +package com.inspur.module.system.controller.maintenance.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.*; + +import javax.validation.constraints.*; +import java.time.LocalDateTime; +import java.util.Date; + +import static com.inspur.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; +import static com.inspur.framework.common.util.date.DateUtils.TIME_ZONE_DEFAULT; + +@Schema(description = "管理后台 - 远程维修工单新增/修改 Request VO") +@Data +public class MaintenanceOrderSaveReqVO { + + @Schema(description = "维修工单id", requiredMode = Schema.RequiredMode.REQUIRED) + private String maintenanceOrderId; + + @Schema(description = "维修工单编号", requiredMode = Schema.RequiredMode.REQUIRED) + private String maintenanceOrderNo; + + @Schema(description = "本地诊断报告id") + private String diagnoiseReportId; + + @Schema(description = "机床设备id") + private String equipId; + + @Schema(description = "机床组件id") + private String componentId; + + @Schema(description = "故障描述") + private String description; + + @Schema(description = "优先级") + private Integer priority; + + @Schema(description = "完成时间") + @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) + private Date completeTime; + + @Schema(description = "状态") + private Integer status; + + @Schema(description = "维修人id") + private Long executorId; + + @Schema(description = "流程实例编号") + private String processInstanceId; + + @Schema(description = "机床客户信息id") + private String customerId; + + @Schema(description = "故障类型") + private Integer faultType; + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/maintenance/MaintenanceOrderDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/maintenance/MaintenanceOrderDO.java new file mode 100644 index 0000000..a53faa2 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/maintenance/MaintenanceOrderDO.java @@ -0,0 +1,89 @@ +package com.inspur.module.system.dal.dataobject.maintenance; + +import lombok.*; + +import java.util.Date; + +import com.baomidou.mybatisplus.annotation.*; +import com.inspur.framework.mybatis.core.dataobject.BaseDO; + +/** + * 远程维修工单 DO + * + * @author 芋道源码 + */ +@TableName("imt_maintenance_order") +@KeySequence("imt_maintenance_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class MaintenanceOrderDO extends BaseDO { + + /** + * 维修工单id + */ + @TableId(type = IdType.ASSIGN_UUID) + private String maintenanceOrderId; + /** + * 维修工单编号 + */ + private String maintenanceOrderNo; + /** + * 诊断报告id + */ + private String diagnoiseReportId; + /** + * 机床设备id + */ + private String equipId; + /** + * 机床组件id + */ + private String componentId; + /** + * 故障描述 + */ + private String description; + /** + * 优先级 + * + */ + private Integer priority; + /** + * 完成时间 + */ + private Date completeTime; + /** + * 状态 + * + */ + private Integer status; + /** + * 维修人id + */ + private Long executorId; + /** + * 流程实例编号 + */ + private String processInstanceId; + /** + * 机床客户信息id + */ + private String customerId; + /** + * 故障类型 + */ + private Integer faultType; + + @TableField(exist = false) + private String equipNo; + @TableField(exist = false) + private String componentName; + @TableField(exist = false) + private String customerName; + @TableField(exist = false) + private String executorName; +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/equip/ComponentInfoMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/equip/ComponentInfoMapper.java index c9d0d31..591030a 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/equip/ComponentInfoMapper.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/equip/ComponentInfoMapper.java @@ -1,12 +1,16 @@ package com.inspur.module.system.dal.mysql.equip; import com.inspur.framework.common.pojo.PageResult; +import com.inspur.framework.common.util.object.BeanUtils; import com.inspur.framework.mybatis.core.mapper.BaseMapperX; import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; import com.inspur.module.system.controller.equip.vo.ComponentInfoPageReqVO; +import com.inspur.module.system.controller.equip.vo.ComponentSelectionVO; import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO; import org.apache.ibatis.annotations.Mapper; +import java.util.List; + /** * 机床组件信息 Mapper * @@ -25,4 +29,8 @@ public interface ComponentInfoMapper extends BaseMapperX { .orderByDesc(ComponentInfoDO::getCreateTime)); } + default List selection(){ + List componentInfoDOS = selectList(); + return BeanUtils.toBean(componentInfoDOS, ComponentSelectionVO.class); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/maintenance/MaintenanceOrderMapper.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/maintenance/MaintenanceOrderMapper.java new file mode 100644 index 0000000..74a7076 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/mysql/maintenance/MaintenanceOrderMapper.java @@ -0,0 +1,28 @@ +package com.inspur.module.system.dal.mysql.maintenance; + +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.framework.mybatis.core.mapper.BaseMapperX; +import com.inspur.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO; +import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO; +import org.apache.ibatis.annotations.Mapper; + +/** + * 远程维修工单 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface MaintenanceOrderMapper extends BaseMapperX { + + default PageResult selectPage(MaintenanceOrderPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(MaintenanceOrderDO::getMaintenanceOrderNo, reqVO.getMaintenanceOrderNo()) + .eqIfPresent(MaintenanceOrderDO::getEquipId, reqVO.getEquipId()) + .eqIfPresent(MaintenanceOrderDO::getComponentId, reqVO.getComponentId()) + .eqIfPresent(MaintenanceOrderDO::getCustomerId, reqVO.getCustomerId()) + .eqIfPresent(MaintenanceOrderDO::getStatus, reqVO.getStatus()) + .orderByDesc(MaintenanceOrderDO::getCreateTime)); + } + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoService.java index a356e0e..ab46b57 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoService.java @@ -3,9 +3,11 @@ package com.inspur.module.system.service.equip; import com.inspur.framework.common.pojo.PageResult; import com.inspur.module.system.controller.equip.vo.ComponentInfoPageReqVO; import com.inspur.module.system.controller.equip.vo.ComponentInfoSaveReqVO; +import com.inspur.module.system.controller.equip.vo.ComponentSelectionVO; import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO; import javax.validation.*; +import java.util.List; /** * 机床组件信息 Service 接口 @@ -52,4 +54,12 @@ public interface ComponentInfoService { */ PageResult getComponentInfoPage(ComponentInfoPageReqVO pageReqVO); + /** + * 机床组件信息下拉 + * + * @Author xusd + * @Date 11:20 2024/9/4 + * @return java.util.List + */ + List selection(); } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoServiceImpl.java index b395aaf..23aa021 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/equip/ComponentInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.inspur.module.system.service.equip; import com.inspur.framework.common.pojo.PageResult; import com.inspur.module.system.controller.equip.vo.ComponentInfoPageReqVO; import com.inspur.module.system.controller.equip.vo.ComponentInfoSaveReqVO; +import com.inspur.module.system.controller.equip.vo.ComponentSelectionVO; import com.inspur.module.system.dal.dataobject.equip.ComponentInfoDO; import com.inspur.module.system.dal.mysql.equip.ComponentInfoMapper; import org.springframework.stereotype.Service; @@ -10,6 +11,9 @@ import javax.annotation.Resource; import org.springframework.validation.annotation.Validated; import com.inspur.framework.common.util.object.BeanUtils; +import java.util.Collections; +import java.util.List; + import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.inspur.module.system.enums.ErrorCodeConstants.COMPONENT_INFO_NOT_EXISTS; @@ -67,4 +71,8 @@ public class ComponentInfoServiceImpl implements ComponentInfoService { return componentInfoMapper.selectPage(pageReqVO); } + @Override + public List selection() { + return componentInfoMapper.selection(); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java new file mode 100644 index 0000000..abc1f7e --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java @@ -0,0 +1,55 @@ +package com.inspur.module.system.service.maintenance; + +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderSaveReqVO; +import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO; + +import javax.validation.*; + +/** + * 远程维修工单 Service 接口 + * + * @author 芋道源码 + */ +public interface MaintenanceOrderService { + + /** + * 创建远程维修工单 + * + * @param createReqVO 创建信息 + * @return 编号 + */ + String createRemoteMaintenanceOrder(@Valid MaintenanceOrderSaveReqVO createReqVO); + + /** + * 更新远程维修工单 + * + * @param updateReqVO 更新信息 + */ + void updateRemoteMaintenanceOrder(@Valid MaintenanceOrderSaveReqVO updateReqVO); + + /** + * 删除远程维修工单 + * + * @param id 编号 + */ + void deleteRemoteMaintenanceOrder(String id); + + /** + * 获得远程维修工单 + * + * @param id 编号 + * @return 远程维修工单 + */ + MaintenanceOrderDO getRemoteMaintenanceOrder(String id); + + /** + * 获得远程维修工单分页 + * + * @param pageReqVO 分页查询 + * @return 远程维修工单分页 + */ + PageResult getRemoteMaintenanceOrderPage(MaintenanceOrderPageReqVO pageReqVO); + +} \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java new file mode 100644 index 0000000..7c409e8 --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java @@ -0,0 +1,119 @@ +package com.inspur.module.system.service.maintenance; + +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.date.DateUtil; +import cn.hutool.core.util.RandomUtil; +import com.inspur.framework.common.enums.CommonStatusEnum; +import com.inspur.framework.common.pojo.PageResult; +import com.inspur.module.system.controller.baseData.vo.CustomerInfoSelectionVO; +import com.inspur.module.system.controller.equip.vo.ComponentSelectionVO; +import com.inspur.module.system.controller.equip.vo.EquipSelectionVO; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderPageReqVO; +import com.inspur.module.system.controller.maintenance.vo.MaintenanceOrderSaveReqVO; +import com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO; +import com.inspur.module.system.dal.dataobject.user.AdminUserDO; +import com.inspur.module.system.dal.mysql.maintenance.MaintenanceOrderMapper; +import com.inspur.module.system.service.baseData.CustomerInfoService; +import com.inspur.module.system.service.equip.ComponentInfoService; +import com.inspur.module.system.service.equip.EquipInfoService; +import com.inspur.module.system.service.user.AdminUserService; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; +import org.springframework.validation.annotation.Validated; +import com.inspur.framework.common.util.object.BeanUtils; + +import java.util.Date; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +import static com.inspur.framework.common.exception.util.ServiceExceptionUtil.exception; +import static com.inspur.module.system.enums.ErrorCodeConstants.REMOTE_MAINTENANCE_ORDER_NOT_EXISTS; + +/** + * 远程维修工单 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { + + @Resource + private MaintenanceOrderMapper maintenanceOrderMapper; + + @Resource + private EquipInfoService equipInfoService; + + @Resource + private ComponentInfoService componentInfoService; + + @Resource + private CustomerInfoService customerInfoService; + + @Resource + private AdminUserService userService; + + @Override + public String createRemoteMaintenanceOrder(MaintenanceOrderSaveReqVO createReqVO) { + // 插入 + MaintenanceOrderDO remoteMaintenanceOrder = BeanUtils.toBean(createReqVO, MaintenanceOrderDO.class); + remoteMaintenanceOrder.setMaintenanceOrderNo("WXGD" + DateUtil.format(new Date(),"yyyyMMddHHmmss") + RandomUtil.randomInt(1, 10)); + maintenanceOrderMapper.insert(remoteMaintenanceOrder); + // 返回 + return remoteMaintenanceOrder.getMaintenanceOrderId(); + } + + @Override + public void updateRemoteMaintenanceOrder(MaintenanceOrderSaveReqVO updateReqVO) { + // 校验存在 + validateRemoteMaintenanceOrderExists(updateReqVO.getMaintenanceOrderId()); + // 更新 + MaintenanceOrderDO updateObj = BeanUtils.toBean(updateReqVO, MaintenanceOrderDO.class); + maintenanceOrderMapper.updateById(updateObj); + } + + @Override + public void deleteRemoteMaintenanceOrder(String id) { + // 校验存在 + validateRemoteMaintenanceOrderExists(id); + // 删除 + maintenanceOrderMapper.deleteById(id); + } + + private void validateRemoteMaintenanceOrderExists(String id) { + if (maintenanceOrderMapper.selectById(id) == null) { + throw exception(REMOTE_MAINTENANCE_ORDER_NOT_EXISTS); + } + } + + @Override + public MaintenanceOrderDO getRemoteMaintenanceOrder(String id) { + return maintenanceOrderMapper.selectById(id); + } + + @Override + public PageResult getRemoteMaintenanceOrderPage(MaintenanceOrderPageReqVO pageReqVO) { + PageResult page = maintenanceOrderMapper.selectPage(pageReqVO); + List list = page.getList(); + if (CollUtil.isNotEmpty(list)){ + List equipList = equipInfoService.selection(); + Map equipMap = equipList.stream().collect(Collectors.toMap(EquipSelectionVO::getEquipId, EquipSelectionVO::getEquipNo)); + List componentList = componentInfoService.selection(); + Map componentMap = componentList.stream().collect(Collectors.toMap(ComponentSelectionVO::getComponentId, ComponentSelectionVO::getComponentName)); + List customerList = customerInfoService.selection(true); + Map customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName)); + List userList = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus()); + Map userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, AdminUserDO::getNickname)); + list.forEach(item->{ + item.setEquipNo(equipMap.get(item.getEquipId())); + item.setCustomerName(customerMap.get(item.getCustomerId())); + item.setComponentName(componentMap.get(item.getComponentId())); + item.setExecutorName(userMap.get(item.getExecutorId())); + }); + } + page.setList(list); + return page; + } + +} \ No newline at end of file diff --git a/imt-ui/src/api/system/equip/componentInfo.js b/imt-ui/src/api/system/equip/componentInfo.js index 55fa3a3..9605e40 100644 --- a/imt-ui/src/api/system/equip/componentInfo.js +++ b/imt-ui/src/api/system/equip/componentInfo.js @@ -51,3 +51,11 @@ export function exportComponentInfoExcel(params) { responseType: 'blob' }) } + +// 机床组件下拉 +export function getComponentSelection() { + return request({ + url: '/equip/component/selection', + method: 'get' + }) +} diff --git a/imt-ui/src/api/system/maintenance/maintenance.js b/imt-ui/src/api/system/maintenance/maintenance.js new file mode 100644 index 0000000..c9f32b6 --- /dev/null +++ b/imt-ui/src/api/system/maintenance/maintenance.js @@ -0,0 +1,53 @@ +import request from '@/utils/request' + +// 创建远程维修工单 +export function createRemoteMaintenanceOrder(data) { + return request({ + url: '/maintenance/create', + method: 'post', + data: data + }) +} + +// 更新远程维修工单 +export function updateRemoteMaintenanceOrder(data) { + return request({ + url: '/maintenance/update', + method: 'put', + data: data + }) +} + +// 删除远程维修工单 +export function deleteRemoteMaintenanceOrder(id) { + return request({ + url: '/maintenance/delete?id=' + id, + method: 'delete' + }) +} + +// 获得远程维修工单 +export function getRemoteMaintenanceOrder(id) { + return request({ + url: '/maintenance/get?id=' + id, + method: 'get' + }) +} + +// 获得远程维修工单分页 +export function getRemoteMaintenanceOrderPage(params) { + return request({ + url: '/maintenance/page', + method: 'get', + params + }) +} +// 导出远程维修工单 Excel +export function exportRemoteMaintenanceOrderExcel(params) { + return request({ + url: '/maintenance/export-excel', + method: 'get', + params, + responseType: 'blob' + }) +} diff --git a/imt-ui/src/utils/dict.js b/imt-ui/src/utils/dict.js index 75d4073..5ad9dbf 100644 --- a/imt-ui/src/utils/dict.js +++ b/imt-ui/src/utils/dict.js @@ -26,6 +26,9 @@ export const DICT_TYPE = { JUDGE_RULES: "judge_rules", EQU_ALARM_STATUS: "equip_alarm_status", TREND_ANALY_STATUS: "trend_analy_status", + MAINTENANCE_STATUS: "maintenance_status", + MAINTENANCE_PRIORITY: "maintenance_priority", + FAULT_TYPE: "fault_type", // ========== SYSTEM 模块 ========== SYSTEM_USER_SEX: "system_user_sex", SYSTEM_MENU_TYPE: "system_menu_type", diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/RemoteMaintenanceOrderForm.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/RemoteMaintenanceOrderForm.vue new file mode 100644 index 0000000..983cc01 --- /dev/null +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/RemoteMaintenanceOrderForm.vue @@ -0,0 +1,230 @@ + + + diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue new file mode 100644 index 0000000..053854b --- /dev/null +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue @@ -0,0 +1,227 @@ + + +