完成刷卡解绑接口

This commit is contained in:
wen 2022-02-16 11:51:44 +08:00
parent 97e6dc7380
commit 7dbe72e9a9
4 changed files with 76 additions and 0 deletions

View File

@ -188,5 +188,18 @@ public class XhpcCardController extends BaseController {
return xhpcCardService.queryRechargingRecord(queryRechargingRecordRequest); 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<Object> removeBinding(@RequestParam Long cardRecordId) {
return xhpcCardService.removeBinding(cardRecordId);
}
} }

View File

@ -82,6 +82,9 @@ public class CardList {
@JsonProperty("userAccount") @JsonProperty("userAccount")
private String userAccount; private String userAccount;
/**
* 卡记录id
*/
@JsonProperty("cardRecordId") @JsonProperty("cardRecordId")
private Integer cardRecordId; private Integer cardRecordId;

View File

@ -149,4 +149,13 @@ public interface IXhpcCardService {
*/ */
R<QueryRechargingRecordResponse> queryRechargingRecord(QueryRechargingRecordRequest queryRechargingRecordRequest); R<QueryRechargingRecordResponse> queryRechargingRecord(QueryRechargingRecordRequest queryRechargingRecordRequest);
/**
* remove binding of card
*
* @author WH
* @date 2022/2/16 10:30
* @since version-1.0
*/
R<Object> removeBinding(Long cardRecordId);
} }

View File

@ -607,6 +607,57 @@ public class XhpcCardServiceImpl implements IXhpcCardService {
} }
} }
@Override
@Transactional(rollbackFor = Exception.class)
public R<Object> 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数据 * 用于QueryRechargeRecord方法封装DTO数据
* *