解绑鉴权卡

This commit is contained in:
2023-11-28 17:03:43 +08:00
parent 5e54a3f38a
commit 943bd69068
3 changed files with 43 additions and 36 deletions

View File

@@ -1,29 +1,23 @@
package com.jsowell.web.controller.pile;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson2.JSON;
import com.jsowell.pile.dto.PileAuthCardDTO;
import com.jsowell.pile.vo.web.PileAuthCardVO;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.jsowell.common.annotation.Log;
import com.jsowell.common.core.controller.BaseController;
import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.pile.domain.PileAuthCard;
import com.jsowell.pile.service.IPileAuthCardService;
import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.poi.ExcelUtil;
import com.jsowell.pile.domain.PileAuthCard;
import com.jsowell.pile.dto.PileAuthCardDTO;
import com.jsowell.pile.service.IPileAuthCardService;
import com.jsowell.pile.vo.web.PileAuthCardVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 充电站鉴权卡Controller
@@ -88,7 +82,14 @@ public class PileAuthCardController extends BaseController {
@PostMapping
public AjaxResult add(@RequestBody PileAuthCardDTO dto) {
logger.info("新增充电站鉴权卡 params:{}", JSON.toJSONString(dto));
return toAjax(pileAuthCardService.addAuthCard(dto));
AjaxResult ajaxResult;
try {
pileAuthCardService.addAuthCard(dto);
ajaxResult = AjaxResult.success();
} catch (BusinessException e) {
ajaxResult = AjaxResult.error(e.getMessage());
}
return ajaxResult;
}
/**