ganzi-api/inventory-ent/src/main/java/com/rzyc/controller/EnterpriseEquipmentController.java

486 lines
20 KiB
Java
Raw Normal View History

package com.rzyc.controller;
import com.common.utils.model.SingleResult;
import com.rzyc.config.MethodAnnotation;
import com.rzyc.model.*;
import com.rzyc.model.dto.*;
import com.rzyc.service.PcBusinessService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author Xuwanxin
* @date 2022/10/18
*/
@Api(tags = "企业端设备模块接口")
@CrossOrigin("*")
@RequestMapping("equipment")
@Controller
@Validated
public class EnterpriseEquipmentController extends BaseController {
PcBusinessService pcBusinessService;
public EnterpriseEquipmentController(PcBusinessService pcBusinessService) {
this.pcBusinessService = pcBusinessService;
}
/**
* 企业设备类型列表
* @param enterpriseId 企业id
* @return 企业设备类型列表
* @throws Exception
*/
@ApiOperation(value = "企业设备类型列表", notes = "企业设备类型列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string")
})
@GetMapping(value = "/entEquipmentTypeList")
@PreAuthorize("hasAnyAuthority('entEquipmentTypeList','entEquipmentList:update')")
@MethodAnnotation(authorizations = {"entEquipmentTypeList","entEquipmentList:update"},name = "企业设备类型列表")
@ResponseBody
public SingleResult<List<EntDeviceType>> entEquipmentTypeList(@RequestParam(required = true) String enterpriseId)throws Exception{
return pcBusinessService.entEquipmentTypeList(enterpriseId);
}
/**
* 企业设备列表
* @param enterpriseId 企业id
* @param typeId 设备类型id
* @return 企业设备列表
* @throws Exception
*/
@ApiOperation(value = "企业设备列表", notes = "企业设备列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string"),
@ApiImplicitParam(name = "typeId", value = "设备类型id", required = false, dataType = "string"),
@ApiImplicitParam(name = "page", value = "page", required = true, dataType = "string"),
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "string")
})
@GetMapping(value = "/entEquipmentList")
@PreAuthorize("hasAnyAuthority('entEquipmentList','entEquipmentList:update')")
@MethodAnnotation(authorizations = {"entEquipmentList","entEquipmentList:update"},name = "企业设备列表")
@ResponseBody
public SingleResult<List<EntDevice>> entEquipmentList(@RequestParam(required = true) String enterpriseId, String typeId,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.entEquipmentList(enterpriseId,typeId,page,pageSize);
}
/**
* 企业设备详细
* @param deviceId 设备id
* @return 企业设备
* @throws Exception
*/
@ApiOperation(value = "企业设备详细", notes = "企业设备详细")
@ApiImplicitParams({
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataType = "string"),
})
@GetMapping(value = "/deviceDetail")
@PreAuthorize("hasAnyAuthority('entEquipmentList')")
@MethodAnnotation(authorizations = {"entEquipmentList"},name = "企业设备详细")
@ResponseBody
public SingleResult<EntDevice> deviceDetail(@RequestParam(required = true) String deviceId)throws Exception{
return pcBusinessService.deviceDetail(deviceId);
}
/**
* 企业设备保养和维修检查记录统计
* @param enterpriseId 企业id
* @param deviceId 设备id
* @return 企业设备列表
* @throws Exception
*/
@ApiOperation(value = "企业设备保养和维修检查记录统计", notes = "企业设备保养和维修检查记录统计")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "公司id", required = true, dataType = "string"),
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true, dataType = "string")
})
@GetMapping(value = "/entEquipmentStatistic")
@PreAuthorize("hasAnyAuthority('entEquipmentStatistic')")
@MethodAnnotation(authorizations = {"entEquipmentStatistic"},name = "企业设备保养和维修检查记录统计")
@ResponseBody
public SingleResult<EntDevice> entEquipmentStatistic(@RequestParam(required = true) String enterpriseId, String deviceId)throws Exception{
return pcBusinessService.entEquipmentStatistic(enterpriseId,deviceId);
}
/**
* 新增设备类型,修改设备类型
* @return 新增设备类型,修改设备类型
* @throws Exception
*/
@ApiOperation(value = "新增设备类型,修改设备类型", notes = "新增设备类型,修改设备类型")
@PostMapping(value = "/addOrUpdateEntEquipmentType")
@PreAuthorize("hasAnyAuthority('entEquipmentType:update')")
@MethodAnnotation(authorizations = {"entEquipmentType:update"},name = "新增设备类型,修改设备类型")
@ResponseBody
public SingleResult addOrUpdateEntEquipmentType(@RequestBody AddOrUpdateEntEquipmentTypeDto addOrUpdateEntEquipmentTypeDto)throws Exception{
return pcBusinessService.addOrUpdateEntEquipmentType(addOrUpdateEntEquipmentTypeDto);
}
/**
* 新增设备,修改设备
* @return 新增设备,修改设备
* @throws Exception
*/
@ApiOperation(value = "新增设备,修改设备", notes = "新增设备,修改设备")
@PostMapping(value = "/addOrUpdateEntEquipment")
@PreAuthorize("hasAnyAuthority('entEquipment:update')")
@MethodAnnotation(authorizations = {"entEquipment:update"},name = "新增设备,修改设备")
@ResponseBody
public SingleResult addOrUpdateEntEquipment(@RequestBody AddOrUpdateEntEquipmentDto addOrUpdateEntEquipmentDto)throws Exception{
return pcBusinessService.addOrUpdateEntEquipment(addOrUpdateEntEquipmentDto);
}
/**
* 设备周期巡检
* @return 设备周期巡检
* @throws Exception
*/
@ApiOperation(value = "设备周期巡检", notes = "设备周期巡检")
@GetMapping(value = "/deviceInspectionCycle")
@PreAuthorize("hasAnyAuthority('deviceInspectionCycle','deviceInspectionCycle:update')")
@MethodAnnotation(authorizations = {"deviceInspectionCycle","deviceInspectionCycle:update"},name = "设备维护周期")
@ApiImplicitParams({
@ApiImplicitParam(name = "inspectionName", value = "巡检名", required = false, dataType = "string"),
@ApiImplicitParam(name = "deviceId", value = "设备id", required = false, dataType = "string")
})
@ResponseBody
public SingleResult<List<EntDeviceInsCycle>> deviceInspectionCycle(String inspectionName,String deviceId,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.deviceInspectionCycle(inspectionName,deviceId,page,pageSize);
}
/**
* 设备周期巡检-添加和修巡检项目
* @return 设备周期巡检-添加和修巡检项目
* @throws Exception
*/
@ApiOperation(value = "设备周期巡检-添加和修改巡检项目", notes = "设备周期巡检-添加和修巡检项目")
@PostMapping(value = "/addOrUpdateDeviceInspectionCycle")
@PreAuthorize("hasAnyAuthority('deviceInspectionCycle:update')")
@MethodAnnotation(authorizations = {"deviceInspectionCycle:update"},name = "设备周期巡检-添加和修巡检项目")
@ResponseBody
public SingleResult addOrUpdateDeviceInspectionCycle(@RequestBody AddOrUpdateDeviceInspectionCycleDto addOrUpdateDeviceInspectionCycleDto)throws Exception{
return pcBusinessService.addOrUpdateDeviceInspectionCycle(addOrUpdateDeviceInspectionCycleDto);
}
/**
* 设备巡检记录-添加和修改巡检记录
* @return 设备巡检记录-添加和修改巡检记录
* @throws Exception
*/
@ApiOperation(value = "设备巡检记录-添加和修改巡检记录", notes = "设备巡检记录-添加和修改巡检记录")
@PostMapping(value = "/addOrUpdateInspectionAddOrRecord")
@PreAuthorize("hasAnyAuthority('addOrUpdateInspectionRecord:update')")
@MethodAnnotation(authorizations = {"addOrUpdateInspectionRecord:update"},name = "设备巡检记录-添加和修改巡检记录")
@ResponseBody
public SingleResult addOrUpdateInspectionRecord(@RequestBody AddOrUpdateInspectionRecordDto addOrUpdateInspectionRecordDto)throws Exception{
return pcBusinessService.addOrUpdateInspectionRecord(addOrUpdateInspectionRecordDto);
}
/**
* 设备巡检记录
* @return 设备巡检记录
* @throws Exception
*/
@ApiOperation(value = "设备巡检记录", notes = "设备巡检记录")
@GetMapping(value = "/insRecord")
@PreAuthorize("hasAnyAuthority('insRecord','insRecord:update')")
@MethodAnnotation(authorizations = {"insRecord","insRecord:update"},name = "设备巡检记录")
@ResponseBody
public SingleResult<List<EntInsRecord>> insRecord(String deviceId,String inspectionRecordName,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.selectInsRecord(deviceId,inspectionRecordName,page,pageSize);
}
/**
* 备件列表
* @return 备件列表
* @throws Exception
**/
@ApiOperation(value = "备件列表", notes = "备件列表")
@GetMapping(value = "/sparePartList")
@PreAuthorize("hasAnyAuthority('sparePartList','sparePartList:update')")
@MethodAnnotation(authorizations = {"sparePartList","sparePartList:update"},name = "备件列表")
@ResponseBody
public SingleResult<List<SparePart>> sparePartList(String name, Integer page, Integer pageSize)throws Exception{
return pcBusinessService.sparePartList(name,page,pageSize);
}
/**
* 备件列表-新增和修改
* @return 备件列表-新增和修改
* @throws Exception
**/
@ApiOperation(value = "备件列表-新增和修改", notes = "备件列表-新增和修改")
@PostMapping(value = "/sparePartAddOrUpdate")
@PreAuthorize("hasAnyAuthority('sparePartList:update')")
@MethodAnnotation(authorizations = {"sparePartList:update"},name = "备件列表-新增和修改")
@ResponseBody
public SingleResult sparePartUpdate(SparePartDto sparePartDto)throws Exception{
return pcBusinessService.sparePartUpdate(sparePartDto);
}
/**
* 保养计划-新增和修改
* @return 保养计划-新增和修改
* @throws Exception
**/
@ApiOperation(value = "保养计划-新增和修改", notes = "保养计划-新增和修改")
@PostMapping(value = "/entDeviceMaintenancePlanAddOrUpdate")
@PreAuthorize("hasAnyAuthority('entDeviceMaintenancePlan:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenancePlan:update"},name = "保养计划-新增和修改")
@ResponseBody
public SingleResult entDeviceMaintenancePlanUpdate(@RequestBody EntDeviceMaintenancePlanDto deviceMaintenancePlanDto)throws Exception{
return pcBusinessService.entDeviceMaintenancePlanUpdate(deviceMaintenancePlanDto);
}
/**
* 保养计划列表
* @return 保养计划列表
* @throws Exception
**/
@ApiOperation(value = "保养计划列表", notes = "保养计划列表")
@GetMapping(value = "/entDeviceMaintenancePlan")
@PreAuthorize("hasAnyAuthority('entDeviceMaintenancePlan','entDeviceMaintenancePlan:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenancePlan","entDeviceMaintenancePlan:update"},name = "保养计划列表")
@ResponseBody
public SingleResult<List<EntDeviceMaintenancePlan>> entDeviceMaintenancePlan(String deviceId,Integer page, Integer pageSize)throws Exception{
return pcBusinessService.entDeviceMaintenancePlan(deviceId,page,pageSize) ;
}
/**
* 保养记录-新增和修改
* @return 保养记录-新增和修改
* @throws Exception
**/
@ApiOperation(value = "保养记录-新增和修改", notes = "保养记录-新增和修改")
@PostMapping(value = "/entDeviceMaintenanceRecordAddOrUpdate")
@PreAuthorize("hasAnyAuthority('entDeviceMaintenanceRecord:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenanceRecord:update"},name = "保养记录-新增和修改")
@ResponseBody
public SingleResult entDeviceMaintenanceRecordUpdate(@RequestBody EntDeviceMaintenanceRecordDto entDeviceMaintenanceRecordDto)throws Exception{
return pcBusinessService.entDeviceMaintenanceRecordUpdate(entDeviceMaintenanceRecordDto);
}
/**
* 保养记录
* @return 保养记录
* @throws Exception
**/
@ApiOperation(value = "保养记录", notes = "保养记录")
@GetMapping(value = "/entDeviceMaintenanceRecord")
@PreAuthorize("hasAnyAuthority('entDeviceMaintenanceRecord','entDeviceMaintenanceRecord:update')")
@MethodAnnotation(authorizations = {"entDeviceMaintenanceRecord","entDeviceMaintenanceRecord:update"},name = "保养记录")
@ResponseBody
public SingleResult<List<EntDeviceMaintenanceRecord>> entDeviceMaintenanceRecord(String deviceId,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.entDeviceMaintenanceRecord(deviceId,page,pageSize);
}
/**
* 送检记录
* @return 送检记录
* @throws Exception
**/
@ApiOperation(value = "送检记录", notes = "送检记录")
@GetMapping(value = "/inspectionRecord")
@PreAuthorize("hasAnyAuthority('inspectionRecord','inspectionRecord:update')")
@MethodAnnotation(authorizations = {"inspectionRecord","inspectionRecord:update"},name = "送检记录")
@ResponseBody
public SingleResult<List<EntInspectionRecord>> inspectionRecord(@Param("startTime") String startTime, @Param("endTime")String endTime,Integer page,Integer pageSize,String deviceId)throws Exception {
return pcBusinessService.inspectionRecord(startTime, endTime, page, pageSize,deviceId);
}
/**
* 送检操作
* @return 送检操作
* @throws Exception
**/
@ApiOperation(value = "送检操作", notes = "送检操作")
@PostMapping(value = "/submitInspection")
@PreAuthorize("hasAnyAuthority('inspectionRecord:update')")
@MethodAnnotation(authorizations = {"inspectionRecord:update"},name = "送检操作")
@ResponseBody
public SingleResult submitInspection(@RequestBody InspectionRecordDto inspectionRecordDto)throws Exception{
return pcBusinessService.submitInspection(inspectionRecordDto);
}
/**
* 维修计划
* @return 维修计划
* @throws Exception
**/
@ApiOperation(value = "维修计划", notes = "维修计划")
@GetMapping(value = "/repairPlan")
@PreAuthorize("hasAnyAuthority('repairPlan','repairPlan:update')")
@MethodAnnotation(authorizations = {"repairPlan","repairPlan:update"},name = "维修计划")
@ResponseBody
public SingleResult<EntRepairPlan> repairPlan(String deviceId,Integer page,Integer pageSize)throws Exception{
return pcBusinessService.repairPlan(page,pageSize,deviceId);
}
/**
* 维修计划-新增,修改
* @return 维修计划-新增,修改
* @throws Exception
**/
@ApiOperation(value = "维修计划-新增,修改", notes = "维修计划-新增,修改")
@PostMapping(value = "/repairPlanAddOrUpdate")
@PreAuthorize("hasAnyAuthority('repairPlan:update')")
@MethodAnnotation(authorizations = {"repairPlan:update"},name = "维修计划-新增,修改")
@ResponseBody
public SingleResult repairPlanAddOrUpdate(@RequestBody EntRepairPlanDto entRepairPlanDto)throws Exception{
return pcBusinessService.repairPlanUpdate(entRepairPlanDto);
}
/**
* 维修记录
* @return 维修记录
* @throws Exception
**/
@ApiOperation(value = "维修记录", notes = "维修记录")
@GetMapping(value = "/repairRecord")
@PreAuthorize("hasAnyAuthority('repairRecord','repairRecord:update')")
@MethodAnnotation(authorizations = {"repairRecord","repairRecord:update"},name = "维修记录")
@ResponseBody
public SingleResult<EntRepairRecord> repairRecord(Integer page,Integer pageSize,String deviceId)throws Exception{
return pcBusinessService.repairRecord(page,pageSize,deviceId);
}
/**
* 维修记录修改/新增
* @return int
* @throws Exception
**/
@ApiOperation(value = "维修记录修改/新增", notes = "维修记录修改/新增")
@PostMapping(value = "/repairRecordUpdate")
@PreAuthorize("hasAnyAuthority('repairRecord:update')")
@MethodAnnotation(authorizations = {"repairRecord:update"},name = "维修记录修改/新增")
@ResponseBody
public SingleResult repairRecordUpdate(@RequestBody EntRepairRecordDto entRepairRecordDto)throws Exception{
return pcBusinessService.repairRecordUpdate(entRepairRecordDto);
}
/**
* 报修记录
* @return 报修记录
* @throws Exception
**/
@ApiOperation(value = "报修记录", notes = "报修记录")
@GetMapping(value = "/reportRecord")
@PreAuthorize("hasAnyAuthority('reportRecord','reportRecord:update')")
@MethodAnnotation(authorizations = {"reportRecord","reportRecord:update"},name = "报修记录")
@ResponseBody
public SingleResult<EntReportRepair> reportRecord(Integer page,Integer pageSize,String deviceId)throws Exception{
return pcBusinessService.reportRecord(page,pageSize,deviceId);
}
/**
* 新增报修
* @throws Exception
**/
@ApiOperation(value = "新增报修", notes = "新增报修")
@PostMapping(value = "/addOrUpdateReportRecord")
@PreAuthorize("hasAnyAuthority('reportRecord:update')")
@MethodAnnotation(authorizations = {"reportRecord:update"},name = "新增报修")
@ResponseBody
public SingleResult addOrUpdateReportRecord(@RequestBody ReportRecordDto reportRecordDto)throws Exception{
return pcBusinessService.addOrUpdateReportRecord(reportRecordDto);
}
/**
* 设备安标
* @throws Exception
* */
/**
* 操作规程
*
* */
@ApiOperation(value = "操作规程", notes = "操作规程")
@GetMapping(value = "/operatingInstructions")
@PreAuthorize("hasAnyAuthority('operatingInstructions','operatingInstructions:update')")
@MethodAnnotation(authorizations = {"operatingInstructions","operatingInstructions:update"},name = "操作规程")
@ResponseBody
public SingleResult<EntOperatingInstruction> operatingInstructions(@RequestBody OperatingInstructionDto operatingInstructionDto)throws Exception{
return pcBusinessService.operatingInstructions(operatingInstructionDto);
}
/**
* 新增,修改操作规程
* @throws Exception
* */
@ApiOperation(value = "新增,修改操作规程", notes = "新增,修改操作规程")
@PostMapping(value = "/operatingInstructionsAddOrUpdate")
@PreAuthorize("hasAnyAuthority('operatingInstructions:update')")
@MethodAnnotation(authorizations = {"operatingInstructions:update"},name = "新增,修改操作规程")
@ResponseBody
public SingleResult operatingInstructionsAddOrUpdate(@RequestBody OperatingInstructionsDto operatingInstructionsDto)throws Exception{
return pcBusinessService.operatingInstructionsAddOrUpdate(operatingInstructionsDto);
}
/**
* 企业设备过期列表
* @return Data
* @throws Exception
*/
@ApiOperation(value = "企业设备过期列表", notes = "企业设备过期列表")
@GetMapping(value = "/entDeviceOverdue")
@PreAuthorize("hasAnyAuthority('entDeviceOverdue')")
@MethodAnnotation(authorizations = {"entDeviceOverdue"},name = "应急资源删除")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "企业id",required = true, dataType = "string"),
})
@ResponseBody
public SingleResult<List<EntDevice>> selectEntEquipmentOverdue(@RequestParam("enterpriseId") String enterpriseId,Integer state ,Integer deviceName)throws Exception{
return pcBusinessService.selectEntEquipmentOverdue(enterpriseId,state,deviceName);
}
}