From 57c673aa3e83677bcf5d30b4b45d06bae6609db8 Mon Sep 17 00:00:00 2001 From: liusuyi <1951119284@qq.com> Date: 星期四, 08 八月 2024 16:14:40 +0800 Subject: [PATCH] 优化:获取会话 --- ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java | 175 ++++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 150 insertions(+), 25 deletions(-) diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java index 78e357e..523ac98 100644 --- a/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java +++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/well/controller/ArdAlarmpointsWellController.java @@ -5,12 +5,21 @@ import javax.servlet.http.HttpServletResponse; import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell; +import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam; import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService; -import com.ruoyi.common.annotation.Anonymous; +import com.ruoyi.common.core.domain.entity.SysConfig; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.system.service.ISysConfigService; +import com.ruoyi.system.service.ISysDeptService; +import com.ruoyi.system.service.ISysUserService; +import com.ruoyi.utils.data.Query; +import com.ruoyi.utils.pagehelper.JpaPageInfo; +import com.ruoyi.utils.result.Results; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -27,21 +36,32 @@ import com.ruoyi.common.core.page.TableDataInfo; import org.springframework.web.multipart.MultipartFile; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 浜曠鐞咰ontroller - * + * * @author 鍒樿嫃涔� * @date 2023-03-07 */ @RestController @RequestMapping("/alarmpoints/well") @Api(tags = "浜曠鐞嗘帴鍙�") -public class ArdAlarmpointsWellController extends BaseController -{ +public class ArdAlarmpointsWellController extends BaseController { @Resource private IArdAlarmpointsWellService ardAlarmpointsWellService; + + @Autowired + private ISysUserService sysUserService; + + @Autowired + private ISysDeptService sysDeptService; + + @Autowired + private ISysConfigService sysConfigService; /** * 鏌ヨ浜曠鐞嗗垪琛� @@ -49,11 +69,18 @@ @PreAuthorize("@ss.hasPermi('alarmpoints:well:list')") @GetMapping("/list") @ApiOperation("鏌ヨ浜曞垪琛�") - public TableDataInfo list(ArdAlarmpointsWell ardAlarmpointsWell) - { + public TableDataInfo list(ArdAlarmpointsWell ardAlarmpointsWell) { startPage(); List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell); return getDataTable(list); + } + + @PreAuthorize("@ss.hasPermi('alarmpoints:well:list')") + @GetMapping("/nonPageList") + @ApiOperation("鏌ヨ浜曞垪琛�-涓嶅垎椤�") + public AjaxResult nonPageList(ArdAlarmpointsWell ardAlarmpointsWell) { + List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell); + return success(list); } /** @@ -63,8 +90,7 @@ @Log(title = "浜曠鐞�", businessType = BusinessType.EXPORT) @PostMapping("/export") @ApiOperation("瀵煎嚭浜曞垪琛�") - public void export(HttpServletResponse response, ArdAlarmpointsWell ardAlarmpointsWell) - { + public void export(HttpServletResponse response, ArdAlarmpointsWell ardAlarmpointsWell) { List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellList(ardAlarmpointsWell); ExcelUtil<ArdAlarmpointsWell> util = new ExcelUtil<ArdAlarmpointsWell>(ArdAlarmpointsWell.class); util.exportExcel(response, list, "浜曠鐞嗘暟鎹�"); @@ -76,8 +102,7 @@ @PreAuthorize("@ss.hasPermi('alarmpoints:well:query')") @GetMapping(value = "/{id}") @ApiOperation("鑾峰彇浜曡缁嗕俊鎭�") - public AjaxResult getInfo(@PathVariable("id") String id) - { + public AjaxResult getInfo(@PathVariable("id") String id) { return success(ardAlarmpointsWellService.selectArdAlarmpointsWellById(id)); } @@ -88,9 +113,12 @@ @Log(title = "浜曠鐞�", businessType = BusinessType.INSERT) @PostMapping @ApiOperation("鏂板浜�") - public AjaxResult add(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) - { - return toAjax(ardAlarmpointsWellService.insertArdAlarmpointsWell(ardAlarmpointsWell)); + public AjaxResult add(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) { + try { + return toAjax(ardAlarmpointsWellService.insertArdAlarmpointsWell(ardAlarmpointsWell)); + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } } /** @@ -100,9 +128,12 @@ @Log(title = "浜曠鐞�", businessType = BusinessType.UPDATE) @PutMapping @ApiOperation("淇敼浜�") - public AjaxResult edit(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) - { - return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell)); + public AjaxResult edit(@RequestBody ArdAlarmpointsWell ardAlarmpointsWell) { + try { + return toAjax(ardAlarmpointsWellService.updateArdAlarmpointsWell(ardAlarmpointsWell)); + } catch (Exception e) { + return AjaxResult.error(e.getMessage()); + } } /** @@ -110,10 +141,9 @@ */ @PreAuthorize("@ss.hasPermi('alarmpoints:well:remove')") @Log(title = "浜曠鐞�", businessType = BusinessType.DELETE) - @DeleteMapping("/{ids}") + @DeleteMapping("/{ids}") @ApiOperation("鍒犻櫎浜�") - public AjaxResult remove(@PathVariable String[] ids) - { + public AjaxResult remove(@PathVariable String[] ids) { return toAjax(ardAlarmpointsWellService.deleteArdAlarmpointsWellByIds(ids)); } @@ -121,19 +151,114 @@ @PreAuthorize("@ss.hasPermi('alarmpoints:well:import')") @PostMapping("/importData") @ApiOperation("瀵煎叆浜�") - public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception - { + public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception { ExcelUtil<ArdAlarmpointsWell> util = new ExcelUtil<ArdAlarmpointsWell>(ArdAlarmpointsWell.class); - List<ArdAlarmpointsWell> userList = util.importExcel(file.getInputStream()); + List<ArdAlarmpointsWell> wellList = util.importExcel(file.getInputStream()); String operName = getUsername(); - String message = ardAlarmpointsWellService.importUser(userList, updateSupport, operName); + String message = ardAlarmpointsWellService.importWell(wellList, updateSupport, operName); return success(message); } + @PostMapping("/importTemplate") @ApiOperation("浜曞鍏ユā鏉�") - public void importTemplate(HttpServletResponse response) - { + public void importTemplate(HttpServletResponse response) { ExcelUtil<ArdAlarmpointsWell> util = new ExcelUtil<ArdAlarmpointsWell>(ArdAlarmpointsWell.class); util.importTemplateExcel(response, "浜曟暟鎹�"); } + + /** + * 浜曢�夐」鏁版嵁 + */ + @GetMapping("/options") + @ApiOperation("浜曢�夐」鏁版嵁") + public List options(ArdAlarmpointsWell ardAlarmpointsWell) { + List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.selectArdAlarmpointsWellByWellIdLike(ardAlarmpointsWell); + List options = new ArrayList(); + for (ArdAlarmpointsWell item : list) { + Map option = new HashMap(); + option.put("value", item.getId()); + option.put("label", item.getWellId()); + option.put("description", item.getOilProduction()); + options.add(option); + } + return options; + } + + @GetMapping("/wellById/{id}") + @ApiOperation("鏌ヨ鍗曟潯鍏磋叮鐐�") + public Results wellById(@PathVariable String id) { + return Results.succeed(ardAlarmpointsWellService.wellById(id)); + } + + @PostMapping("/wellList") + @ApiOperation("鏌ヨ鏉冮檺涓嬫墍鏈夊叴瓒g偣") + public Results wellList() { + /*String usersId = SecurityUtils.getUserId(); + //鏍规嵁userId鏌ヨ閮ㄩ棬Id + SysUser sysUser = sysUserService.selectUserById(usersId); + //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId + List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());*/ + List<Long> deptList = sysDeptService.selectDeptIdBySubAndUserId(SecurityUtils.getDeptId(),SecurityUtils.getUserId()); + //鏍规嵁deptId鑾峰彇瀵瑰簲鍏磋叮鐐规暟鎹� + List<ArdAlarmpointsWell> list = ardAlarmpointsWellService.wellList(deptList); + return Results.succeed(list); + } + + @PostMapping("/conditionList") + @ApiOperation("鏌ョ湅閮ㄩ棬涓嬬瓫閫夋潯浠剁殑鍏磋叮鐐�") + public Results conditionList(ArdAlarmpointsWellParam ardAlarmpointsWellParam) { + /*String usersId = SecurityUtils.getUserId(); + //鏍规嵁userId鏌ヨ閮ㄩ棬Id + SysUser sysUser = sysUserService.selectUserById(usersId); + //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId + List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());*/ + List<Long> deptList = sysDeptService.selectDeptIdBySubAndUserId(SecurityUtils.getDeptId(),SecurityUtils.getUserId()); + ardAlarmpointsWellParam.setDeptList(deptList); + //鏍规嵁deptId鑾峰彇瀵瑰簲鍏磋叮鐐规暟鎹� + return Results.succeed(ardAlarmpointsWellService.conditionList(ardAlarmpointsWellParam)); + } + + @PostMapping("/getNearbyWells") + @ApiOperation("鏌ヨ闄勮繎鐨勬墍鏈変簳") + public AjaxResult getNearbyWells(Double longitude,Double latitude, Long deptId, Integer pageNum, Integer pageSize) { + JpaPageInfo jpaPageInfo = new JpaPageInfo(); + jpaPageInfo.setPageNum(pageNum); + jpaPageInfo.setPageSize(pageSize); + List<ArdAlarmpointsWell> nearbyWellList = ardAlarmpointsWellService.getNearbyWellList(longitude,latitude, deptId, 1000); + jpaPageInfo.doPage(nearbyWellList); + return AjaxResult.success(jpaPageInfo); + } + + @GetMapping("/getRTUDataYJ8") + @ApiOperation("鏌ヨ璁惧杩愯鐘舵��") + public AjaxResult getRTUDataYJ8(String wellId){ + return AjaxResult.success(Query.getRTUDataYJ8(wellId)); + } + + @GetMapping("/getWellDataByWellId") + @ApiOperation("鏌ヨ璁惧鍔ㄩ潤鎬佸睘鎬�") + public AjaxResult getWellData(String wellId){ + SysConfig config = new SysConfig(); + config.setConfigKey("3coracle"); + List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config); + Map<String,Object> result = ardAlarmpointsWellService.getWellDataByWellId(wellId,sysConfigResult); + return AjaxResult.success(result); + } + + @PostMapping("/getWellDataByPatrolplanIdAndPosition") + @ApiOperation("鏌ヨ鏈�杩戝贰妫�璁惧鍔ㄩ潤鎬佸睘鎬�") + public AjaxResult getWellDataByPatrolplanIdAndPosition(@RequestBody Map<String,Object> para){ + SysConfig config = new SysConfig(); + config.setConfigKey("3coracle"); + List<SysConfig> sysConfigResult = sysConfigService.selectConfigList(config); + Map<String,Object> result = ardAlarmpointsWellService.getWellDataByPatrolplanIdAndPosition(para,sysConfigResult); + return AjaxResult.success(result); + } + + @PostMapping("/getWellById") + @ApiOperation("鏍规嵁鏌ヨ鍏磋叮鐐瑰熀鏈睘鎬�") + public AjaxResult getWellById(@RequestBody Map<String,String> para){ + ArdAlarmpointsWell result = ardAlarmpointsWellService.getWellById(para.get("id")); + return AjaxResult.success(result); + } } -- Gitblit v1.9.3