| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.moral.api.entity.Device; |
| | | import com.moral.api.entity.ManageAccount; |
| | | import com.moral.api.entity.Organization; |
| | | import com.moral.api.entity.User; |
| | | import com.moral.api.pojo.vo.device.DeviceVO; |
| | | |
| | | import com.moral.api.service.DeviceService; |
| | | import com.moral.api.service.OrganizationService; |
| | | import com.moral.constant.Constants; |
| | | import com.moral.constant.ResultMessage; |
| | | import com.moral.util.PageResult; |
| | | |
| | |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | |
| | | @Autowired |
| | | private OrganizationService organizationService; |
| | | |
| | | @ApiOperation(value = "添加设备", notes = "添加设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "insert", method = RequestMethod.POST) |
| | | public ResultMessage insert(@RequestBody Device device) { |
| | | public ResultMessage insert(Device device) { |
| | | deviceService.insert(device); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "维护人列表", notes = "维护人列表") |
| | | @ApiOperation(value = "删除设备", notes = "删除设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "operators", method = RequestMethod.GET) |
| | | public ResultMessage selectOperators() { |
| | | List<ManageAccount> operators = deviceService.selectAllOperator(); |
| | | return ResultMessage.ok(operators); |
| | | @RequestMapping(value = "delete", method = RequestMethod.GET) |
| | | public ResultMessage delete(Integer deviceId) { |
| | | deviceService.delete(deviceId); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "修改设备", notes = "修改设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "update", method = RequestMethod.POST) |
| | | public ResultMessage update(Device device) { |
| | | deviceService.update(device); |
| | | return ResultMessage.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页设备列表", notes = "分页设备列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "当前页", required = false, paramType = "query", dataType = "Integer"), |
| | | @ApiImplicitParam(name = "size", value = "每页条数", required = false, paramType = "query", dataType = "Integer"), |
| | | @ApiImplicitParam(name = "order", value = "排序字段", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "orderType", value = "排序类型,升序:0,降序:1", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), |
| | | @ApiImplicitParam(name = "name", value = "设备名称模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "mac", value = "mac模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | }) |
| | | @RequestMapping(value = "select", method = RequestMethod.POST) |
| | | public ResultMessage select(@RequestBody Map<String, Object> parameters) { |
| | | IPage<Device> page = deviceService.selectDevices(parameters); |
| | | PageResult<Device> pageResult = new PageResult<>( |
| | | page.getTotal(), page.getPages(), page.getRecords() |
| | | ); |
| | | return ResultMessage.ok(pageResult); |
| | | } |
| | | |
| | | @ApiOperation(value = "查询设备信息", notes = "查询设备信息") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "deviceInfo", method = RequestMethod.GET) |
| | | public ResultMessage selectDeviceInfoById(Integer deviceId) { |
| | | Map<String, Object> result = deviceService.selectDeviceInfoById(deviceId); |
| | | return ResultMessage.ok(result); |
| | | } |
| | | |
| | | @ApiOperation(value = "所有组织", notes = "所有组织") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "allOrganization", method = RequestMethod.GET) |
| | | public ResultMessage selectAllOrganization() { |
| | | List<Map<String, Object>> organizations = deviceService.selectAllOrganization(); |
| | | return ResultMessage.ok(organizations); |
| | | } |
| | | |
| | | @ApiOperation(value = "所有站点", notes = "所有站点") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "allMonitorPoint", method = RequestMethod.GET) |
| | | public ResultMessage selectAllMonitorPoint() { |
| | | List<Map<String, Object>> organizations = deviceService.selectAllMonitorPoint(); |
| | | return ResultMessage.ok(organizations); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据组织查站点", notes = "根据组织查站点") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "monitorPoints", method = RequestMethod.GET) |
| | | public ResultMessage selectMonitorPoints(Integer orgId) { |
| | | List<Map<String, Object>> monitorPoints = deviceService.selectMonitorsByOrgId(orgId); |
| | | return ResultMessage.ok(monitorPoints); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据组织查设备", notes = "根据组织查设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "devicesByOrgId", method = RequestMethod.GET) |
| | | public ResultMessage selectDevicesByOrg(Integer orgId) { |
| | | List<Map<String, Object>> devices = deviceService.selectDevicesByOrgId(orgId); |
| | | return ResultMessage.ok(devices); |
| | | } |
| | | |
| | | @ApiOperation(value = "根据站点查设备", notes = "根据站点查设备") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "devicesByMpId", method = RequestMethod.GET) |
| | | public ResultMessage selectDevicesByMp(Integer mpId) { |
| | | List<Map<String, Object>> devices = deviceService.selectDevicesByMpId(mpId); |
| | | return ResultMessage.ok(devices); |
| | | } |
| | | |
| | | @ApiOperation(value = "型号列表", notes = "型号列表") |
| | |
| | | return null; |
| | | } |
| | | |
| | | @ApiOperation(value = "组织列表", notes = "组织列表") |
| | | @ApiOperation(value = "维护人列表", notes = "维护人列表") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "organizations", method = RequestMethod.GET) |
| | | public ResultMessage selectOrganizations() { |
| | | List<Organization> organizations = deviceService.selectAllOrganization(); |
| | | return ResultMessage.ok(organizations); |
| | | @RequestMapping(value = "operators", method = RequestMethod.GET) |
| | | public ResultMessage selectOperators() { |
| | | return ResultMessage.ok(deviceService.selectAllOperators()); |
| | | } |
| | | |
| | | @ApiOperation(value = "分页设备列表", notes = "分页设备列表") |
| | | @ApiOperation(value = "所有行业", notes = "所有行业") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "page", value = "当前页", required = false, paramType = "query", dataType = "Integer"), |
| | | @ApiImplicitParam(name = "size", value = "每页条数", required = false, paramType = "query", dataType = "Integer"), |
| | | @ApiImplicitParam(name = "order", value = "排序字段", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "orderType", value = "排序类型,升序:0,降序:1", defaultValue = "0", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String"), |
| | | @ApiImplicitParam(name = "organizationName", value = "组织模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "monitorPointName", value = "站点模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "deviceName", value = "设备名称模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "mac", value = "mac模糊查询", required = false, paramType = "query", dataType = "String"), |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "select", method = RequestMethod.POST) |
| | | public ResultMessage select(@RequestBody Map<String, Object> parameters) { |
| | | Page<DeviceVO> userPage = deviceService.selectDevices(parameters); |
| | | PageResult<DeviceVO> pageResult = new PageResult<>( |
| | | userPage.getTotal(), userPage.getPages(), userPage.getRecords() |
| | | ); |
| | | return ResultMessage.ok(pageResult); |
| | | @RequestMapping(value = "professions", method = RequestMethod.GET) |
| | | public ResultMessage selectProfessions() { |
| | | List<Map<String, Object>> professions = deviceService.selectDeviceDictData(Constants.SYSTEM_DICT_TYPE_PROFESSION); |
| | | return ResultMessage.ok(professions); |
| | | } |
| | | |
| | | @ApiOperation(value = "所有工艺", notes = "所有工艺") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "techs", method = RequestMethod.GET) |
| | | public ResultMessage selectTechs() { |
| | | List<Map<String, Object>> professions = deviceService.selectDeviceDictData(Constants.SYSTEM_DICT_TYPE_TECH); |
| | | return ResultMessage.ok(professions); |
| | | } |
| | | |
| | | @ApiOperation(value = "所有设备检测器", notes = "所有设备检测器") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "detectors", method = RequestMethod.GET) |
| | | public ResultMessage selectDetectors() { |
| | | List<Map<String, Object>> professions = deviceService.selectDeviceDictData(Constants.SYSTEM_DICT_TYPE_DETECTOR); |
| | | return ResultMessage.ok(professions); |
| | | } |
| | | |
| | | @ApiOperation(value = "所有采购商", notes = "所有采购商") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "token", value = "token", required = true, paramType = "header", dataType = "String") |
| | | }) |
| | | @RequestMapping(value = "purchasers", method = RequestMethod.GET) |
| | | public ResultMessage selectPurchasers() { |
| | | List<Map<String, Object>> professions = deviceService.selectDeviceDictData(Constants.SYSTEM_DICT_TYPE_PURCHASER); |
| | | return ResultMessage.ok(professions); |
| | | } |
| | | } |