| | |
| | | package com.sandu.ximon.admin.controller; |
| | | |
| | | import com.sandu.common.domain.ResponseVO; |
| | | import com.sandu.common.execption.BusinessException; |
| | | import com.sandu.common.object.BaseConditionVO; |
| | | import com.sandu.common.security.annotation.AnonymousAccess; |
| | | import com.sandu.common.util.ResponseUtil; |
| | | import com.sandu.ximon.admin.param.C3ChargingAddParam; |
| | | import com.sandu.ximon.admin.param.C3ChargingParam; |
| | | import com.sandu.ximon.admin.security.PermissionConfig; |
| | | import com.sandu.ximon.admin.service.C3ChargingService; |
| | | import com.sandu.ximon.dao.enums.MenuEnum; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | @RequestMapping("/v1/admin/C3Charging") |
| | | public class C3ChargingController { |
| | | private C3ChargingService c3ChargingService; |
| | | private PermissionConfig permissionConfig; |
| | | |
| | | |
| | | @PostMapping("/C3ChargingList") |
| | | public ResponseVO<Object> C3ChargingList(BaseConditionVO baseConditionVO, @RequestBody(required = false) C3ChargingParam c3ChargingParam) { |
| | | return ResponseUtil.successPage(c3ChargingService.getC3ChargingListByKeyword(baseConditionVO, c3ChargingParam)); |
| | | } |
| | | |
| | | @PostMapping("/getByC3Mac/{c3Mac}") |
| | | public ResponseVO<Object> getByC3Mac(String c3Mac) { |
| | | return ResponseUtil.success(c3ChargingService.getByC3Mac(c3Mac)); |
| | | } |
| | | |
| | | /** |
| | | * 充电开启 |
| | | */ |
| | | @PostMapping("/startCharging") |
| | | public ResponseVO<Object> startCharging(@RequestBody C3ChargingParam c3ChargingParam) { |
| | | String result = c3ChargingService.startCharging(c3ChargingParam.getC3Mac(), c3ChargingParam.getChargingCapacity(), c3ChargingParam.getChargeAmount()); |
| | | if ("操作成功".equals(result)) { |
| | | return ResponseUtil.success(result); |
| | | } else { |
| | | return ResponseUtil.fail(result); |
| | | public ResponseVO<Object> C3ChargingList(BaseConditionVO baseConditionVO, @RequestBody(required = false) C3ChargingParam c3ChargingParam |
| | | , @RequestParam(value = "order", required = false) Integer order |
| | | ,@RequestParam(value = "seq", required = false) Integer seq) { |
| | | if (!permissionConfig.check(MenuEnum.C3_CHARGING_LIST.getCode())) { |
| | | return ResponseUtil.fail("缺少对应用户权限"); |
| | | } |
| | | |
| | | return ResponseUtil.success(c3ChargingService.getC3ChargingListByKeyword(baseConditionVO, c3ChargingParam, order, seq)); |
| | | } |
| | | |
| | | @AnonymousAccess |
| | | @GetMapping("/chargingInfo") |
| | | public ResponseVO<Object> getChargingInfo(@RequestParam(required = false, value = "poleId") String poleId) { |
| | | return ResponseUtil.success(c3ChargingService.getChargingInfo(poleId)); |
| | | } |
| | | |
| | | // /** |
| | | // * 充电开启 |
| | | // */ |
| | | // @AnonymousAccess |
| | | // @PostMapping("/startCharging") |
| | | // public ResponseVO<Object> startCharging(@RequestBody C3ChargingParam c3ChargingParam) { |
| | | // String result = c3ChargingService.startCharging(c3ChargingParam.getC3Mac(), c3ChargingParam.getChargingCapacity(), c3ChargingParam.getChargeAmount()); |
| | | // if ("操作成功".equals(result)) { |
| | | // return ResponseUtil.success(result); |
| | | // } else { |
| | | // return ResponseUtil.fail(result); |
| | | // } |
| | | // |
| | | // } |
| | | |
| | | /** |
| | | * 充电结束 |
| | | * 充电结束——小程序用户结束,不需要token,需要openId |
| | | */ |
| | | @PostMapping("/finishCharging") |
| | | public ResponseVO<Object> finishCharging(@RequestBody C3ChargingParam c3ChargingParam) { |
| | | String result = c3ChargingService.finishCharging(c3ChargingParam.getC3Mac()); |
| | | if (c3ChargingParam.getC3Mac() == null || c3ChargingParam.getOpenId() == null) { |
| | | throw new BusinessException("参数错误!"); |
| | | } |
| | | String result = c3ChargingService.finishCharging(c3ChargingParam.getC3Mac(), c3ChargingParam.getOpenId()); |
| | | |
| | | if ("操作成功".equals(result)) { |
| | | return ResponseUtil.success(result); |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 二维码 |
| | | */ |
| | | @PostMapping("/QrCode") |
| | | public ResponseVO<Object> QrCode(@RequestBody C3ChargingParam c3ChargingParam) { |
| | | String result = c3ChargingService.QrCode(c3ChargingParam.getC3Mac(), c3ChargingParam.getQrCodeData()); |
| | | |
| | | if ("操作成功".equals(result)) { |
| | | return ResponseUtil.success(result); |
| | | } else { |
| | | return ResponseUtil.fail(result); |
| | | } |
| | | } |
| | | // /** |
| | | // * 二维码 |
| | | // */ |
| | | // @PostMapping("/QrCode") |
| | | // public ResponseVO<Object> QrCode(@RequestBody C3ChargingParam c3ChargingParam) { |
| | | // //String testUrl = "http://www.ximonsmart.com/charge/#/charge/" +streetlightId+"/"+System.currentTimeMillis(); |
| | | // String result = c3ChargingService.QrCode(c3ChargingParam.getC3Mac(), c3ChargingParam.getQrCodeData()); |
| | | // |
| | | // if ("操作成功".equals(result)) { |
| | | // return ResponseUtil.success(result); |
| | | // } else { |
| | | // return ResponseUtil.fail(result); |
| | | // } |
| | | // } |
| | | |
| | | /** |
| | | * 查询版本 |
| | |
| | | |
| | | /** |
| | | * 修改充电桩硬件设备名称 |
| | | * |
| | | * @param c3ChargingAddParam |
| | | * @return |
| | | */ |