完成刷卡解绑接口
This commit is contained in:
parent
97e6dc7380
commit
7dbe72e9a9
@ -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<Object> removeBinding(@RequestParam Long cardRecordId) {
|
||||
|
||||
return xhpcCardService.removeBinding(cardRecordId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -82,6 +82,9 @@ public class CardList {
|
||||
@JsonProperty("userAccount")
|
||||
private String userAccount;
|
||||
|
||||
/**
|
||||
* 卡记录id
|
||||
*/
|
||||
@JsonProperty("cardRecordId")
|
||||
private Integer cardRecordId;
|
||||
|
||||
|
||||
@ -149,4 +149,13 @@ public interface IXhpcCardService {
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@ -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数据
|
||||
*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user