|
@@ -707,41 +707,45 @@ public class LiftCaseServiceImpl extends ServiceImpl<LiftCaseMapper, LiftCaseEnt
|
|
|
|
|
|
@Override
|
|
|
public RestResponse refusedExperts(Long id) {
|
|
|
- LiftCaseEntity selectById = caseMapper.selectById(id);
|
|
|
- if (selectById.getAcceptStatus() == 2) {
|
|
|
+ LiftCaseEntity liftCaseEntity = caseMapper.selectById(id);
|
|
|
+ if (liftCaseEntity.getAcceptStatus() == 2) {
|
|
|
return RestResponse.fail("订单已拒绝");
|
|
|
}
|
|
|
- if (selectById.getDataTable() == 1) {
|
|
|
+ if (liftCaseEntity.getDataTable() == 1) {
|
|
|
// 退款
|
|
|
- userInfoMapper.rechargePayBalance(selectById.getCreateUserId(), selectById.getPayCost() == null ? BigDecimal.ZERO : selectById.getPayCost());
|
|
|
+ userInfoMapper.rechargePayBalance(liftCaseEntity.getCreateUserId(), liftCaseEntity.getPayCost() == null ? BigDecimal.ZERO : liftCaseEntity.getPayCost());
|
|
|
// 插入个人流水记录
|
|
|
- UserInfoEntity byUserId = userInfoMapper.getByUserId(selectById.getCreateUserId());
|
|
|
+ UserInfoEntity userInfoEntity = userInfoMapper.getByUserId(liftCaseEntity.getCreateUserId());
|
|
|
+ //如果订单被拒绝,那么用户的退款流水记录支付渠道=发生时的支付渠道
|
|
|
+ UserBillEntity paiedBill = Optional.ofNullable(userBillMapper.selectOne(new QueryWrapper<UserBillEntity>().eq("flow_num", liftCaseEntity.getOrderSerialNumber()))).orElse(new UserBillEntity());
|
|
|
+
|
|
|
UserBillEntity ube = new UserBillEntity();
|
|
|
- ube.setUserId(selectById.getCreateUserId());
|
|
|
- ube.setTargetUserId(selectById.getChargerId());
|
|
|
- ube.setBalance(byUserId.getBalance());
|
|
|
+ ube.setUserId(liftCaseEntity.getCreateUserId());
|
|
|
+ ube.setTargetUserId(liftCaseEntity.getChargerId());
|
|
|
+ ube.setBalance(userInfoEntity.getBalance());
|
|
|
ube.setType(2);
|
|
|
+ ube.setPayType(paiedBill.getPayType());
|
|
|
ube.setBusinessType(8);
|
|
|
ube.setDescr("拒绝接单退款到余额");
|
|
|
- ube.setFlowNum(selectById.getOrderSerialNumber());
|
|
|
- ube.setAmount(selectById.getPayCost() == null ? BigDecimal.ZERO : selectById.getPayCost());
|
|
|
+ ube.setFlowNum(liftCaseEntity.getOrderSerialNumber());
|
|
|
+ ube.setAmount(liftCaseEntity.getPayCost() == null ? BigDecimal.ZERO : liftCaseEntity.getPayCost());
|
|
|
userBillMapper.insert(ube);
|
|
|
}
|
|
|
// 清除房间
|
|
|
chatSessionMapper.delete(new QueryWrapper<ChatSessionEntity>()
|
|
|
.eq("data_id", id)
|
|
|
- .eq("user_id", selectById.getCreateUserId()));
|
|
|
+ .eq("user_id", liftCaseEntity.getCreateUserId()));
|
|
|
// 返还卡券
|
|
|
- if (selectById.getCouponId() != null) {
|
|
|
- couponMapper.updateUserCouponStatuz(selectById.getCouponId());
|
|
|
+ if (liftCaseEntity.getCouponId() != null) {
|
|
|
+ couponMapper.updateUserCouponStatuz(liftCaseEntity.getCouponId());
|
|
|
}
|
|
|
- if (selectById.getRedEnvelopeId() != null) {
|
|
|
- couponMapper.updateUserCouponStatuz(selectById.getRedEnvelopeId());
|
|
|
+ if (liftCaseEntity.getRedEnvelopeId() != null) {
|
|
|
+ couponMapper.updateUserCouponStatuz(liftCaseEntity.getRedEnvelopeId());
|
|
|
}
|
|
|
// 修改诊单状态
|
|
|
caseMapper.refusedExperts(id);
|
|
|
// 推送消息
|
|
|
- PushUserInfo pushUserInfo = iUserAccountService.getPushUserInfoByUserId(selectById.getCreateUserId().toString());
|
|
|
+ PushUserInfo pushUserInfo = iUserAccountService.getPushUserInfoByUserId(liftCaseEntity.getCreateUserId().toString());
|
|
|
PushMessage pushMessage = PushMessage.orderChargeStatus("已拒绝");
|
|
|
pushMessage.sendTokenOnPlatform(jmsMessagingTemplate, pushUserInfo);
|
|
|
|
|
@@ -1005,38 +1009,41 @@ public class LiftCaseServiceImpl extends ServiceImpl<LiftCaseMapper, LiftCaseEnt
|
|
|
|
|
|
@Override
|
|
|
public RestResponse cancelCase(Long id) {
|
|
|
- LiftCaseEntity selectById = caseMapper.selectById(id);
|
|
|
- if (selectById.getAcceptStatus() == 9) {
|
|
|
+ LiftCaseEntity liftCaseEntity = caseMapper.selectById(id);
|
|
|
+ if (liftCaseEntity.getAcceptStatus() == 9) {
|
|
|
return RestResponse.fail("订单已取消");
|
|
|
}
|
|
|
- if (selectById.getDataTable() == 1 && selectById.getStatuz() == 1) {
|
|
|
+ if (liftCaseEntity.getDataTable() == 1 && liftCaseEntity.getStatuz() == 1) {
|
|
|
// 退款
|
|
|
- userInfoMapper.rechargePayBalance(selectById.getCreateUserId(), selectById.getPayCost() == null ? BigDecimal.ZERO : selectById.getPayCost());
|
|
|
+ userInfoMapper.rechargePayBalance(liftCaseEntity.getCreateUserId(), liftCaseEntity.getPayCost() == null ? BigDecimal.ZERO : liftCaseEntity.getPayCost());
|
|
|
+ //退款渠道=支付渠道
|
|
|
+ UserBillEntity paiedBill = Optional.ofNullable(userBillMapper.selectOne(new QueryWrapper<UserBillEntity>().eq("flow_num", liftCaseEntity.getOrderSerialNumber()))).orElse(new UserBillEntity());
|
|
|
// 插入个人流水记录
|
|
|
- UserInfoEntity byUserId = userInfoMapper.getByUserId(selectById.getCreateUserId());
|
|
|
+ UserInfoEntity byUserId = userInfoMapper.getByUserId(liftCaseEntity.getCreateUserId());
|
|
|
UserBillEntity ube = new UserBillEntity();
|
|
|
- ube.setUserId(selectById.getCreateUserId());
|
|
|
- ube.setTargetUserId(selectById.getChargerId());
|
|
|
+ ube.setUserId(liftCaseEntity.getCreateUserId());
|
|
|
+ ube.setTargetUserId(liftCaseEntity.getChargerId());
|
|
|
ube.setBalance(byUserId.getBalance());
|
|
|
ube.setType(2);
|
|
|
+ ube.setPayType(paiedBill.getPayType());
|
|
|
ube.setBusinessType(14);
|
|
|
ube.setDescr("取消订单退款到余额");
|
|
|
- ube.setFlowNum(selectById.getOrderSerialNumber());
|
|
|
- ube.setAmount(selectById.getPayCost() == null ? BigDecimal.ZERO : selectById.getPayCost());
|
|
|
+ ube.setFlowNum(liftCaseEntity.getOrderSerialNumber());
|
|
|
+ ube.setAmount(liftCaseEntity.getPayCost() == null ? BigDecimal.ZERO : liftCaseEntity.getPayCost());
|
|
|
userBillMapper.insert(ube);
|
|
|
}
|
|
|
// 清除房间
|
|
|
chatSessionMapper.delete(new QueryWrapper<ChatSessionEntity>()
|
|
|
.eq("data_id", id)
|
|
|
- .eq("create_user_id", selectById.getCreateUserId())
|
|
|
+ .eq("create_user_id", liftCaseEntity.getCreateUserId())
|
|
|
// .last("and FIND_IN_SET("+selectById.getCreateUserId()+",user_id)")
|
|
|
);
|
|
|
// 返还卡券
|
|
|
- if (selectById.getCouponId() != null) {
|
|
|
- couponMapper.updateUserCouponStatuz(selectById.getCouponId());
|
|
|
+ if (liftCaseEntity.getCouponId() != null) {
|
|
|
+ couponMapper.updateUserCouponStatuz(liftCaseEntity.getCouponId());
|
|
|
}
|
|
|
- if (selectById.getRedEnvelopeId() != null) {
|
|
|
- couponMapper.updateUserCouponStatuz(selectById.getRedEnvelopeId());
|
|
|
+ if (liftCaseEntity.getRedEnvelopeId() != null) {
|
|
|
+ couponMapper.updateUserCouponStatuz(liftCaseEntity.getRedEnvelopeId());
|
|
|
}
|
|
|
// 修改诊单状态
|
|
|
caseMapper.cancelCase(id);
|