| | |
| | | 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.XpElectronicFence; |
| | | import com.xiaopeng.api.model.operation.XpStation; |
| | | import com.xiaopeng.api.query.operation.XpStationQuery; |
| | | import com.xiaopeng.api.vo.account.LoginUser; |
| | |
| | | import com.xiaopeng.common.core.web.page.PageInfo; |
| | | import com.xiaopeng.common.security.service.TokenService; |
| | | import com.xiaopeng.map.exportExcel.XpStationExportExcel; |
| | | import com.xiaopeng.map.service.XpElectronicFenceService; |
| | | import com.xiaopeng.map.service.XpPointService; |
| | | import com.xiaopeng.map.service.XpStationService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | |
| | | @Resource |
| | | private TokenService tokenService; |
| | | @Resource |
| | | private XpPointService xpPointService; |
| | | @Resource |
| | | private XpElectronicFenceService xpElectronicFenceService; |
| | | |
| | | |
| | | @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)); |
| | | public R<List<XpStation>> findListByCityCode(@RequestParam String cityCode) { |
| | | XpStationQuery query = new XpStationQuery(); |
| | | query.setCityCode(cityCode); |
| | | return R.ok( xpStationService.findList(query)); |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "场站管理列表", tags = {"管理后台-运营-场站管理"}) |
| | | @PostMapping("/findList") |
| | | public R<List<XpStation>> findList(@RequestBody XpStationQuery query) { |
| | | List<XpStation> list = xpStationService.findList(query); |
| | | return R.ok(list); |
| | | } |
| | | |
| | | @ApiOperation(value = "场站管理分页列表", tags = {"管理后台-运营-场站管理"}) |
| | |
| | | public R<PageInfo<XpStation>> pageList(@RequestBody XpStationQuery query) { |
| | | PageInfo<XpStation> pageList = xpStationService.pageList(query); |
| | | return R.ok(pageList); |
| | | } |
| | | |
| | | @GetMapping("/getById/{id}") |
| | | @ApiOperation(value = "详情场站管理", tags = {"管理后台-运营-场站管理"}) |
| | | public R getById(@PathVariable Long id) { |
| | | XpStation bean = xpStationService.getById(id); |
| | | if (bean == null) { |
| | | return R.fail("参数错误"); |
| | | } |
| | | XpStationVo beanVo = new XpStationVo(); |
| | | BeanUtils.copyProperties(bean, beanVo); |
| | | beanVo.setXpPointList(xpPointService.listByStationId(bean.getId())); |
| | | |
| | | XpElectronicFence electronicFence = xpElectronicFenceService.getById(bean.getElectronicId()); |
| | | |
| | | beanVo.setFenceEffectType(electronicFence.getEffectType()); |
| | | beanVo.setFenceEffectTime(electronicFence.getEffectTime()); |
| | | beanVo.setFenceFailureType(electronicFence.getFailureType()); |
| | | beanVo.setFenceFailureTime(electronicFence.getFailureTime()); |
| | | |
| | | return R.ok(beanVo); |
| | | } |
| | | |
| | | /** |
| | |
| | | if(vo.getId() == null){ |
| | | return R.fail("参数错误"); |
| | | } |
| | | xpStationService.validate(vo); |
| | | XpStation bean = xpStationService.getById(vo.getId()); |
| | | if(bean == null){ |
| | | return R.fail("参数错误"); |
| | | } |
| | | xpStationService.validate(vo); |
| | | //场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效 |
| | | if(bean.getStatus() == 2){ |
| | | return R.fail("场站在启动中不能编辑"); |
| | | } |
| | | // if(bean.getStatus() == 2){ |
| | | // return R.fail("场站在启动中不能编辑"); |
| | | // } |
| | | |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | |
| | |
| | | */ |
| | | @ApiOperation(value = "停用" , tags = {"管理后台-运营-场站管理"}) |
| | | @GetMapping("/updateStatus/{id}") |
| | | public R updateStatusStop(@PathVariable Long id, @RequestParam Boolean isEnable, @RequestParam Boolean pointStop) { |
| | | public R updateStatus(@PathVariable Long id, @RequestParam Boolean isEnable, @RequestParam Boolean pointStop) { |
| | | XpStation bean = xpStationService.getById(id); |
| | | if (bean == null) { |
| | | throw new ServiceException("场站不存在,请刷新重试"); |
| | |
| | | if(isEnable){ |
| | | xpStationService.updateStatusEnable(bean); |
| | | }else{ |
| | | if(bean.getStatus() == 2){//场站状态 0=草稿 1=待启用 2=启用中 3=已停用 4=失效 |
| | | return R.fail("场站状态未启动,不能停用"); |
| | | } |
| | | // 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); |
| | | } |