diff --git a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java index a7416ce08..a3b65eb1e 100644 --- a/jsowell-admin/src/main/java/com/jsowell/service/PileService.java +++ b/jsowell-admin/src/main/java/com/jsowell/service/PileService.java @@ -243,6 +243,17 @@ public class PileService { .build(); memberService.checkVerificationCode(registerAndLoginDTO); + // 判断桩是否为个人桩 + PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(dto.getPileSn()); + if (pileBasicInfo == null) { + // 未查到则说明没有此桩 + throw new BusinessException(ReturnCodeEnum.CODE_PILE_NOT_INFO); + } + String businessType = pileBasicInfo.getBusinessType(); + if (!StringUtils.equals(BusinessTypeEnum.INDIVIDUAL_PILE.getValue(), businessType)){ + // 不一致则此桩不是个人桩 + throw new BusinessException(ReturnCodeEnum.CODE_THIS_PILE_NOT_PERSONAL_PILE); + } // 检查桩是否已经被绑定 PileMemberRelation pileMemberRelation = new PileMemberRelation(); pileMemberRelation.setPileSn(dto.getPileSn()); @@ -252,11 +263,6 @@ public class PileService { throw new BusinessException(ReturnCodeEnum.CODE_PILE_HAS_BEEN_BINDING_ERROR); } // 如果没被绑定,先校验桩密钥是否一致 - PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(dto.getPileSn()); - if (pileBasicInfo == null) { - // 未查到则说明没有此桩 - throw new BusinessException(ReturnCodeEnum.CODE_PILE_NOT_INFO); - } if (!StringUtils.equals(pileBasicInfo.getSecretKey(), dto.getSecretKey())) { // 错误的密钥信息 throw new BusinessException(ReturnCodeEnum.CODE_SECRET_KEY_ERROR); diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileAuthCardController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileAuthCardController.java new file mode 100644 index 000000000..09164a085 --- /dev/null +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileAuthCardController.java @@ -0,0 +1,98 @@ +package com.jsowell.web.controller.pile; + +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +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; + +/** + * 充电站鉴权卡Controller + * + * @author jsowell + * @date 2023-03-16 + */ +@RestController +@RequestMapping("/pile/card") +public class PileAuthCardController extends BaseController { + @Autowired + private IPileAuthCardService pileAuthCardService; + + /** + * 查询充电站鉴权卡列表 + */ + @PreAuthorize("@ss.hasPermi('pile:card:list')") + @GetMapping("/list") + public TableDataInfo list(PileAuthCard pileAuthCard) { + startPage(); + List list = pileAuthCardService.selectPileAuthCardList(pileAuthCard); + return getDataTable(list); + } + + /** + * 导出充电站鉴权卡列表 + */ + @PreAuthorize("@ss.hasPermi('pile:card:export')") + @Log(title = "充电站鉴权卡", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, PileAuthCard pileAuthCard) { + List list = pileAuthCardService.selectPileAuthCardList(pileAuthCard); + ExcelUtil util = new ExcelUtil(PileAuthCard.class); + util.exportExcel(response, list, "充电站鉴权卡数据"); + } + + /** + * 获取充电站鉴权卡详细信息 + */ + @PreAuthorize("@ss.hasPermi('pile:card:query')") + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) { + return AjaxResult.success(pileAuthCardService.selectPileAuthCardById(id)); + } + + /** + * 新增充电站鉴权卡 + */ + @PreAuthorize("@ss.hasPermi('pile:card:add')") + @Log(title = "充电站鉴权卡", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody PileAuthCard pileAuthCard) { + return toAjax(pileAuthCardService.insertPileAuthCard(pileAuthCard)); + } + + /** + * 修改充电站鉴权卡 + */ + @PreAuthorize("@ss.hasPermi('pile:card:edit')") + @Log(title = "充电站鉴权卡", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody PileAuthCard pileAuthCard) { + return toAjax(pileAuthCardService.updatePileAuthCard(pileAuthCard)); + } + + /** + * 删除充电站鉴权卡 + */ + @PreAuthorize("@ss.hasPermi('pile:card:remove')") + @Log(title = "充电站鉴权卡", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) { + return toAjax(pileAuthCardService.deletePileAuthCardByIds(ids)); + } +} diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java index 8118061f5..5401d694d 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/ykc/ReturnCodeEnum.java @@ -121,6 +121,8 @@ public enum ReturnCodeEnum { CODE_PILE_NOT_INFO("00400012", "未查到该该桩的信息,请检查!"), CODE_SECRET_KEY_ERROR("00400013", "填写的桩密钥有误,请检查!"), + + CODE_THIS_PILE_NOT_PERSONAL_PILE("00400014", "此桩不是个人桩!"), ; private String value; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileAuthCard.java b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileAuthCard.java new file mode 100644 index 000000000..80d708be4 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/domain/PileAuthCard.java @@ -0,0 +1,60 @@ +package com.jsowell.pile.domain; + +import com.jsowell.common.annotation.Excel; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * 充电站鉴权卡对象 pile_auth_card + * + * @author jsowell + * @date 2023-03-16 + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class PileAuthCard { + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private Long id; + + /** + * 逻辑卡号 + */ + @Excel(name = "逻辑卡号") + private String logicCard; + + /** + * 物理卡号 + */ + @Excel(name = "物理卡号") + private String physicsCard; + + /** + * 所属用户的会员id + */ + @Excel(name = "所属用户的会员id") + private String memberId; + + /** + * 删除标识(0-正常;1-删除) + */ + private String delFlag; + + private Date createTime; + + private String createBy; + + private Date updateTime; + + private String updateBy; + +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileAuthCardMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileAuthCardMapper.java new file mode 100644 index 000000000..5c0ca9c22 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/PileAuthCardMapper.java @@ -0,0 +1,63 @@ +package com.jsowell.pile.mapper; + +import java.util.List; + +import com.jsowell.pile.domain.PileAuthCard; +import org.springframework.stereotype.Repository; + +/** + * 充电站鉴权卡Mapper接口 + * + * @author jsowell + * @date 2023-03-16 + */ +@Repository +public interface PileAuthCardMapper { + /** + * 查询充电站鉴权卡 + * + * @param id 充电站鉴权卡主键 + * @return 充电站鉴权卡 + */ + public PileAuthCard selectPileAuthCardById(Long id); + + /** + * 查询充电站鉴权卡列表 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 充电站鉴权卡集合 + */ + public List selectPileAuthCardList(PileAuthCard pileAuthCard); + + /** + * 新增充电站鉴权卡 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 结果 + */ + public int insertPileAuthCard(PileAuthCard pileAuthCard); + + /** + * 修改充电站鉴权卡 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 结果 + */ + public int updatePileAuthCard(PileAuthCard pileAuthCard); + + /** + * 删除充电站鉴权卡 + * + * @param id 充电站鉴权卡主键 + * @return 结果 + */ + public int deletePileAuthCardById(Long id); + + /** + * 批量删除充电站鉴权卡 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + public int deletePileAuthCardByIds(Long[] ids); +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileAuthCardService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileAuthCardService.java new file mode 100644 index 000000000..61542a040 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/IPileAuthCardService.java @@ -0,0 +1,61 @@ +package com.jsowell.pile.service; + +import java.util.List; + +import com.jsowell.pile.domain.PileAuthCard; + +/** + * 充电站鉴权卡Service接口 + * + * @author jsowell + * @date 2023-03-16 + */ +public interface IPileAuthCardService { + /** + * 查询充电站鉴权卡 + * + * @param id 充电站鉴权卡主键 + * @return 充电站鉴权卡 + */ + public PileAuthCard selectPileAuthCardById(Long id); + + /** + * 查询充电站鉴权卡列表 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 充电站鉴权卡集合 + */ + public List selectPileAuthCardList(PileAuthCard pileAuthCard); + + /** + * 新增充电站鉴权卡 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 结果 + */ + public int insertPileAuthCard(PileAuthCard pileAuthCard); + + /** + * 修改充电站鉴权卡 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 结果 + */ + public int updatePileAuthCard(PileAuthCard pileAuthCard); + + /** + * 批量删除充电站鉴权卡 + * + * @param ids 需要删除的充电站鉴权卡主键集合 + * @return 结果 + */ + public int deletePileAuthCardByIds(Long[] ids); + + /** + * 删除充电站鉴权卡信息 + * + * @param id 充电站鉴权卡主键 + * @return 结果 + */ + public int deletePileAuthCardById(Long id); +} diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileAuthCardServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileAuthCardServiceImpl.java new file mode 100644 index 000000000..7c8ecbe79 --- /dev/null +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileAuthCardServiceImpl.java @@ -0,0 +1,88 @@ +package com.jsowell.pile.service.impl; + +import java.util.List; + +import com.jsowell.common.util.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.jsowell.pile.mapper.PileAuthCardMapper; +import com.jsowell.pile.domain.PileAuthCard; +import com.jsowell.pile.service.IPileAuthCardService; + +/** + * 充电站鉴权卡Service业务层处理 + * + * @author jsowell + * @date 2023-03-16 + */ +@Service +public class PileAuthCardServiceImpl implements IPileAuthCardService { + @Autowired + private PileAuthCardMapper pileAuthCardMapper; + + /** + * 查询充电站鉴权卡 + * + * @param id 充电站鉴权卡主键 + * @return 充电站鉴权卡 + */ + @Override + public PileAuthCard selectPileAuthCardById(Long id) { + return pileAuthCardMapper.selectPileAuthCardById(id); + } + + /** + * 查询充电站鉴权卡列表 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 充电站鉴权卡 + */ + @Override + public List selectPileAuthCardList(PileAuthCard pileAuthCard) { + return pileAuthCardMapper.selectPileAuthCardList(pileAuthCard); + } + + /** + * 新增充电站鉴权卡 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 结果 + */ + @Override + public int insertPileAuthCard(PileAuthCard pileAuthCard) { + return pileAuthCardMapper.insertPileAuthCard(pileAuthCard); + } + + /** + * 修改充电站鉴权卡 + * + * @param pileAuthCard 充电站鉴权卡 + * @return 结果 + */ + @Override + public int updatePileAuthCard(PileAuthCard pileAuthCard) { + return pileAuthCardMapper.updatePileAuthCard(pileAuthCard); + } + + /** + * 批量删除充电站鉴权卡 + * + * @param ids 需要删除的充电站鉴权卡主键 + * @return 结果 + */ + @Override + public int deletePileAuthCardByIds(Long[] ids) { + return pileAuthCardMapper.deletePileAuthCardByIds(ids); + } + + /** + * 删除充电站鉴权卡信息 + * + * @param id 充电站鉴权卡主键 + * @return 结果 + */ + @Override + public int deletePileAuthCardById(Long id) { + return pileAuthCardMapper.deletePileAuthCardById(id); + } +} diff --git a/jsowell-pile/src/main/resources/mapper/pile/PileAuthCardMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/PileAuthCardMapper.xml new file mode 100644 index 000000000..df50717c0 --- /dev/null +++ b/jsowell-pile/src/main/resources/mapper/pile/PileAuthCardMapper.xml @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + select id, logic_card, physics_card, member_id, create_time, create_by, update_time, update_by, del_flag from pile_auth_card + + + + + + + + insert into pile_auth_card + + logic_card, + physics_card, + member_id, + create_time, + create_by, + update_time, + update_by, + del_flag, + + + #{logicCard}, + #{physicsCard}, + #{memberId}, + #{createTime}, + #{createBy}, + #{updateTime}, + #{updateBy}, + #{delFlag}, + + + + + update pile_auth_card + + logic_card = #{logicCard}, + physics_card = #{physicsCard}, + member_id = #{memberId}, + create_time = #{createTime}, + create_by = #{createBy}, + update_time = #{updateTime}, + update_by = #{updateBy}, + del_flag = #{delFlag}, + + where id = #{id} + + + + delete from pile_auth_card where id = #{id} + + + + delete from pile_auth_card where id in + + #{id} + + + \ No newline at end of file diff --git a/jsowell-ui/src/api/pile/card.js b/jsowell-ui/src/api/pile/card.js new file mode 100644 index 000000000..dbc81f274 --- /dev/null +++ b/jsowell-ui/src/api/pile/card.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询充电站鉴权卡列表 +export function listCard(query) { + return request({ + url: '/pile/card/list', + method: 'get', + params: query + }) +} + +// 查询充电站鉴权卡详细 +export function getCard(id) { + return request({ + url: '/pile/card/' + id, + method: 'get' + }) +} + +// 新增充电站鉴权卡 +export function addCard(data) { + return request({ + url: '/pile/card', + method: 'post', + data: data + }) +} + +// 修改充电站鉴权卡 +export function updateCard(data) { + return request({ + url: '/pile/card', + method: 'put', + data: data + }) +} + +// 删除充电站鉴权卡 +export function delCard(id) { + return request({ + url: '/pile/card/' + id, + method: 'delete' + }) +} diff --git a/jsowell-ui/src/views/pile/card/index.vue b/jsowell-ui/src/views/pile/card/index.vue new file mode 100644 index 000000000..c5f779f6a --- /dev/null +++ b/jsowell-ui/src/views/pile/card/index.vue @@ -0,0 +1,281 @@ + + +