| | |
| | | package com.ruoyi.app.patrolplan.controller; |
| | | |
| | | import java.text.ParseException; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; |
| | | import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService; |
| | | import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpoint; |
| | | import com.ruoyi.app.patrolplan.domain.ArdAppPatrolpointRecord; |
| | | import com.ruoyi.app.patrolplan.domain.param.ArdAppPatrolpointRecordParam; |
| | | import com.ruoyi.app.patrolplan.service.IArdAppPatrolpointRecordService; |
| | | import com.ruoyi.app.patrolplan.service.IArdAppPatrolpointService; |
| | | import com.ruoyi.app.patrolplan.service.IArdAppPatroluserService; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.spring.SpringUtils; |
| | | import com.ruoyi.system.service.ISysDeptService; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.utils.result.Results; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | @Resource |
| | | IArdAppPatroluserService ardAppPatroluserService; |
| | | |
| | | @Resource |
| | | ISysUserService sysUserService; |
| | | |
| | | @Resource |
| | | ISysDeptService sysDeptService; |
| | | |
| | | @Resource |
| | | IArdAlarmpointsWellService wellService; |
| | | |
| | | @Resource |
| | | IArdAppPatrolpointRecordService recordService; |
| | | |
| | | /** |
| | | * 查询app巡检计划列表 |
| | | */ |
| | |
| | | @ApiOperation("查询全部巡检列表及搜索筛选") |
| | | public Results list(ArdAppPatrolplan ardAppPatrolplan) |
| | | { |
| | | String userId = SecurityUtils.getUserId(); |
| | | ardAppPatrolplan.setUserId(userId); |
| | | if(ardAppPatrolplan.getPageNum()==null || ardAppPatrolplan.getPageNum() == 0){ |
| | | ardAppPatrolplan.setPageNum(1); |
| | | } |
| | | if(ardAppPatrolplan.getPageSize()==null || ardAppPatrolplan.getPageSize() == 0){ |
| | | ardAppPatrolplan.setPageSize(10); |
| | | } |
| | | PageHelper.startPage(ardAppPatrolplan.getPageNum(),ardAppPatrolplan.getPageSize()); |
| | | List<ArdAppPatrolplan> list = ardAppPatrolplanService.selectArdAppPatrolplanList(ardAppPatrolplan); |
| | | return Results.succeed(new PageInfo<>(list)); |
| | |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:userByPlanId')") |
| | | @GetMapping(value = "userByPlanId/{id}") |
| | | @ApiOperation("根据巡检ID查询巡检人") |
| | | @ApiOperation("根据巡检ID查询巡检人员") |
| | | public Results userByPlanId(@PathVariable String id) |
| | | { |
| | | return ardAppPatroluserService.userByPlanId(id); |
| | |
| | | return toAjax(ardAppPatrolplanService.deleteArdApp(id)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 新增app巡检计划 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:add')") |
| | | @Log(title = "app巡检计划", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ArdAppPatrolplan ardAppPatrolplan) |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:allPlanUser')") |
| | | @PostMapping("allPlanUser") |
| | | @ApiOperation("查询权限下全部人员和兴趣点") |
| | | public Results allPlanUser() |
| | | { |
| | | return toAjax(ardAppPatrolplanService.insertArdAppPatrolplan(ardAppPatrolplan)); |
| | | } |
| | | |
| | | /** |
| | | * 修改app巡检计划 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:edit')") |
| | | @Log(title = "app巡检计划", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ArdAppPatrolplan ardAppPatrolplan) |
| | | { |
| | | return toAjax(ardAppPatrolplanService.updateArdAppPatrolplan(ardAppPatrolplan)); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | String userId = SecurityUtils.getUserId(); |
| | | //根据userId查询部门Id |
| | | SysUser sysUser = sysUserService.selectUserById(userId); |
| | | //根据当前deptId或者当前及所属下级的所有deptId |
| | | List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId()); |
| | | //根据deptId列表获取到所有用户 |
| | | List<SysUser> sysUserList = sysUserService.userByDeptList(deptList); |
| | | jsonObject.put("user",sysUserList); |
| | | //根据deptId列表获取到所有兴趣点 |
| | | List<ArdAlarmpointsWell> wellList = wellService.wellByDeptList(deptList); |
| | | jsonObject.put("well",wellList); |
| | | return Results.succeed(jsonObject); |
| | | } |
| | | |
| | | /** |
| | |
| | | { |
| | | return toAjax(ardAppPatrolplanService.insertArdAppPatrolplan(para)); |
| | | } |
| | | |
| | | /** |
| | | * 查询单条数据 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:oneById')") |
| | | @PostMapping("/oneById/{id}") |
| | | @ApiOperation("查询单条数据") |
| | | public Results oneById(@PathVariable String id) |
| | | { |
| | | return ardAppPatrolplanService.oneById(id); |
| | | } |
| | | |
| | | /** |
| | | * 修改app巡检计划 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:edit')") |
| | | @Log(title = "app巡检计划", businessType = BusinessType.UPDATE) |
| | | @ApiOperation("修改单条数据") |
| | | @PutMapping("upd") |
| | | public Results edit(@RequestBody Map<String,Object> para) |
| | | { |
| | | return ardAppPatrolplanService.updateArdAppPatrolplan(para); |
| | | } |
| | | |
| | | /** |
| | | * 巡检打卡 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:record')") |
| | | @ApiOperation("巡检打卡") |
| | | @PostMapping("record") |
| | | public Results edit(@RequestBody ArdAppPatrolpointRecord ardAppPatrolpointRecord) { |
| | | return recordService.record(ardAppPatrolpointRecord); |
| | | } |
| | | |
| | | /** |
| | | * 管理端--巡检日历 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:recordMonth')") |
| | | @ApiOperation("管理端--巡检日历") |
| | | @PostMapping("recordMonth") |
| | | public Results recordMonth(@RequestBody ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException { |
| | | return recordService.recordMonth(ardAppPatrolpointRecordParam); |
| | | } |
| | | |
| | | /** |
| | | * 管理端--点击日历获取该记录下人员打卡记录 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:recordDetails')") |
| | | @ApiOperation("管理端--点击日历获取该记录下人员打卡记录") |
| | | @PostMapping("recordDetails") |
| | | public Results recordDetails(@RequestBody ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException { |
| | | return recordService.recordDetails(ardAppPatrolpointRecordParam); |
| | | } |
| | | |
| | | /** |
| | | * 管理端--单人详情 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('app:appPatrolplan:recordSolo')") |
| | | @ApiOperation("管理端--单人详情") |
| | | @PostMapping("recordSolo") |
| | | public Results recordSolo(@RequestBody ArdAppPatrolpointRecordParam ardAppPatrolpointRecordParam) throws ParseException { |
| | | return recordService.recordSolo(ardAppPatrolpointRecordParam); |
| | | } |
| | | } |