| | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelExportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.ExportParams; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.xiaopeng.api.model.operation.XpStation; |
| | | import com.xiaopeng.api.query.operation.XpStationQuery; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | |
| | | private TokenService tokenService; |
| | | |
| | | |
| | | @ApiOperation(value = "场站管理列表", tags = {"管理后台-运营-场站管理"}) |
| | | @ApiOperation(value = "场站管理已经启动列表", tags = {"管理后台-运营-场站管理"}) |
| | | @GetMapping("/findListEnable") |
| | | public R<List<XpStation>> findListEnable(@RequestParam String cityCode) { |
| | | LambdaQueryWrapper<XpStation> queryWrapper = new LambdaQueryWrapper<>(); |
| | | queryWrapper.eq(XpStation::getStatus, 2); |
| | | queryWrapper.eq(XpStation::getCityCode, cityCode); |
| | | queryWrapper.eq(XpStation::getDeleted, false); |
| | | return R.ok( xpStationService.list(queryWrapper)); |
| | | } |
| | | |
| | | @ApiOperation(value = "场站管理分页列表", tags = {"管理后台-运营-场站管理"}) |
| | | @PostMapping("/pageList") |
| | | public R<PageInfo<XpStation>> pageList(@RequestBody XpStationQuery query) { |
| | | PageInfo<XpStation> pageList = xpStationService.pageList(query); |
| | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | |
| | | vo.setCreateBy(loginUser.getUsername()); |
| | | vo.setUpdateBy(loginUser.getUsername()); |
| | | vo.setCreateTime(LocalDateTime.now()); |
| | | |
| | | vo.setUpdateBy(loginUser.getUsername()); |
| | | vo.setUpdateTime(LocalDateTime.now()); |
| | | |
| | | |
| | | return xpStationService.add(vo); |
| | | } |
| | |
| | | if(bean == null){ |
| | | return R.fail("参数错误"); |
| | | } |
| | | //场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效 |
| | | if(bean.getStatus() == 2){ |
| | | return R.fail("场站在启动中不能编辑"); |
| | | } |
| | | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | |
| | |
| | | * - 否:子点位维持当前状态,但自动退回为“独立点位”。 |
| | | */ |
| | | @ApiOperation(value = "停用" , tags = {"管理后台-运营-场站管理"}) |
| | | @PostMapping("/updateStatus/{id}") |
| | | public R updateStatusStop(@PathVariable Long id, @RequestParam Boolean pointStop) { |
| | | @GetMapping("/updateStatus/{id}") |
| | | public R updateStatusStop(@PathVariable Long id, @RequestParam Boolean isEnable, @RequestParam Boolean pointStop) { |
| | | XpStation bean = xpStationService.getById(id); |
| | | if (bean == null) { |
| | | throw new ServiceException("场站不存在,请刷新重试"); |
| | | } |
| | | // Integer status =6; |
| | | // if(!statusEnable){ |
| | | // status = 7; |
| | | // } |
| | | if(isEnable){ |
| | | xpStationService.updateStatusEnable(bean); |
| | | }else{ |
| | | if(bean.getStatus() == 2){//场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效 |
| | | return R.fail("场站状态未启动,不能停用"); |
| | | } |
| | | //场站状态 0=草稿 1=待测试 2=测试中 3=测试不通过 4=可运营 5=待生效 6=启用中 7=已停用 8=失效 |
| | | xpStationService.updateStatusStop(bean,pointStop); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | /** |
| | |
| | | if (bean == null) { |
| | | throw new ServiceException("场站不存在,请刷新重试"); |
| | | } |
| | | // 场站状态 0=草稿 1=待测试 2=测试中 3=测试不通过 4=可运营 5=待生效 6=启用中 7=已停用 8=失效 |
| | | // 场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效 |
| | | // 只有状态为已停用(7)时才能删除 |
| | | if (bean.getStatus() == 4 || bean.getStatus() == 5 || bean.getStatus() == 6) { |
| | | String msg = ""; |
| | | if(bean.getStatus() == 4){ |
| | | msg = "可运营"; |
| | | }else if (bean.getStatus() == 5){ |
| | | msg = "待生效"; |
| | | }else { |
| | | msg = "启用中"; |
| | | } |
| | | throw new ServiceException("场站"+msg+",无法删除"); |
| | | if (bean.getStatus() == 2 ) { |
| | | throw new ServiceException("场站启用中,无法删除"); |
| | | } |
| | | boolean b = xpStationService.removeById(bean,pointDelete); |
| | | if (b){ |