From 7dbe72e9a983632d9d07837d331f15b8bc6b67b7 Mon Sep 17 00:00:00 2001 From: wen <1455474577@qq.com> Date: Wed, 16 Feb 2022 11:51:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E6=88=90=E5=88=B7=E5=8D=A1=E8=A7=A3?= =?UTF-8?q?=E7=BB=91=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../card/controller/XhpcCardController.java | 13 +++++ .../java/com/xhpc/card/domain/CardList.java | 3 ++ .../xhpc/card/service/IXhpcCardService.java | 9 ++++ .../service/impl/XhpcCardServiceImpl.java | 51 +++++++++++++++++++ 4 files changed, 76 insertions(+) diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java index fa0b04c7..3723390d 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/controller/XhpcCardController.java @@ -188,5 +188,18 @@ public class XhpcCardController extends BaseController { return xhpcCardService.queryRechargingRecord(queryRechargingRecordRequest); } + /** + * remove binding of card + * + * @author WH + * @date 2022/2/16 10:10 + * @since version-1.0 + */ + @PatchMapping("/card/removeBinding") + public R removeBinding(@RequestParam Long cardRecordId) { + + return xhpcCardService.removeBinding(cardRecordId); + } + } diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/CardList.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/CardList.java index e4deeebd..17b16c55 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/CardList.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/domain/CardList.java @@ -82,6 +82,9 @@ public class CardList { @JsonProperty("userAccount") private String userAccount; + /** + * 卡记录id + */ @JsonProperty("cardRecordId") private Integer cardRecordId; diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java index a7804f1e..7093067c 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/IXhpcCardService.java @@ -149,4 +149,13 @@ public interface IXhpcCardService { */ R queryRechargingRecord(QueryRechargingRecordRequest queryRechargingRecordRequest); + /** + * remove binding of card + * + * @author WH + * @date 2022/2/16 10:30 + * @since version-1.0 + */ + R removeBinding(Long cardRecordId); + } diff --git a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java index d6a6e553..5330f6e6 100644 --- a/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java +++ b/xhpc-modules/xhpc-card/src/main/java/com/xhpc/card/service/impl/XhpcCardServiceImpl.java @@ -607,6 +607,57 @@ public class XhpcCardServiceImpl implements IXhpcCardService { } } + @Override + @Transactional(rollbackFor = Exception.class) + public R removeBinding(Long cardRecordId) { + //1.find card record according card id + //2.完成联网卡表的状态改变 + //3.完成朱老师那边的卡表状态改变 + //4.写日志到log表中 + XhpcIcCardInfo xhpcIcCardInfo = xhpcCardMapper.selectBytCardId(String.valueOf(cardRecordId)); + if (xhpcIcCardInfo.getDelFlag() == 1) { + return R.fail("该卡已经解绑,不能重复解绑"); + } + xhpcIcCardInfo.setDelFlag(1L); + xhpcCardMapper.updateByPrimaryKeySelective(xhpcIcCardInfo); + TIccardInfo tIccardInfo = tIccardInfoMapper.selectByPrimaryKey(Math.toIntExact(cardRecordId)); + tIccardInfo.setStatus(5); + tIccardInfoMapper.updateByPrimaryKeySelective(tIccardInfo); + TIccardLog tIccardLog = new TIccardLog(); + tIccardLog.setUniqueid(tIccardInfo.getCardid()); + tIccardLog.setType((byte) 0); + tIccardLog.setOperate((byte) 11); + LoginUser loginUser = tokenService.getLoginUser(); + SysUser sysUser = loginUser.getSysUser(); + Long operatorId = sysUser.getOperatorId(); + if (operatorId != null) { + tIccardLog.setOperatorid(Math.toIntExact(operatorId)); + } + tIccardLog.setCreatetime(new Date()); + //log部分 + CardLogInfo.CardInfoDTO cardInfoDTO = new CardLogInfo.CardInfoDTO(); + cardInfoDTO.setCardID(tIccardInfo.getCardid()); + cardInfoDTO.setCardNo(tIccardInfo.getCardno()); + cardInfoDTO.setCardType(tIccardInfo.getCardtype()); + cardInfoDTO.setPassword(tIccardInfo.getPassword()); + cardInfoDTO.setUserIndex(tIccardInfo.getUserindex()); + cardInfoDTO.setCorpNo(tIccardInfo.getCorpno()); + cardInfoDTO.setCashPledge(tIccardInfo.getCashpledge()); + cardInfoDTO.setBalance(tIccardInfo.getBalance()); + cardInfoDTO.setStatus(tIccardInfo.getStatus()); + cardInfoDTO.setPrepay(null); + CardLogInfo cardLogInfo = new CardLogInfo(); + cardLogInfo.setCardInfo(cardInfoDTO); + cardLogInfo.setOperate(11); + if (operatorId != null) { + cardLogInfo.setOperatorId(operatorId); + } + String cardLogInfoStr = JSONUtil.toJsonStr(cardLogInfo); + tIccardLog.setLog(cardLogInfoStr); + tIccardLogMapper.updateByPrimaryKeySelective(tIccardLog); + return R.ok(); + } + /** * 用于QueryRechargeRecord方法封装DTO数据 *