记得上下班打卡 | git大法好,push需谨慎

Commit f18cd9a0 authored by jiangxiulong's avatar jiangxiulong

退款失败记录

parent 742d5b0b
......@@ -38,6 +38,7 @@ import org.springframework.util.MultiValueMap;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
......@@ -124,7 +125,7 @@ public class KylinRefundsStatusServiceImpl {
new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER)
);
dataUtils.delOrderTicketRedis(orderTicketsId);
mongoVoUtils.resetOrderListVo(orderInfo.getUserId(), 2, orderTicketsId,null);
mongoVoUtils.resetOrderListVo(orderInfo.getUserId(), 2, orderTicketsId, null);
// 订单入场人表 和 缓存
......@@ -228,8 +229,8 @@ public class KylinRefundsStatusServiceImpl {
Integer[] whereRefundingCount = {KylinTableStatusConst.ORDER_REFUND_STATUS_CANCEL, KylinTableStatusConst.ORDER_REFUND_STATUS_REFUNDED, KylinTableStatusConst.ORDER_REFUND_STATUS_REJECT};
int refundingCount = kylinOrderRefundsMapper.selectCount(
new QueryWrapper<KylinOrderRefunds>().eq("order_tickets_id", orderTicketsId)
.notIn("status", whereRefundingCount)
.ne("order_refunds_id", orderRefundsId)
.notIn("status", whereRefundingCount)
.ne("order_refunds_id", orderRefundsId)
);
if (refundingCount > 0) { // 存在其他正在退款的订单
......@@ -264,7 +265,7 @@ public class KylinRefundsStatusServiceImpl {
KylinOrderTickets orderInfo = kylinOrderTicketsMapper.selectOne(
new QueryWrapper<KylinOrderTickets>().eq("order_tickets_id", orderTicketsId)
);
mongoVoUtils.resetOrderListVo(orderInfo.getUserId(), 2, orderTicketsId,null);
mongoVoUtils.resetOrderListVo(orderInfo.getUserId(), 2, orderTicketsId, null);
// 入场人
for (String entitiesId : orderTicketEntitiesIdsArr) {
......@@ -442,9 +443,30 @@ public class KylinRefundsStatusServiceImpl {
HashMap hashMapResult = JsonUtils.fromJson(postResult, HashMap.class);
Boolean success = (Boolean) hashMapResult.get("success");
if (!success) {
String msg = (String) hashMapResult.get("message");
log.info("退款pay返回失败" + msg);
// return false;
String message = (String) hashMapResult.get("message");
log.info("退款pay返回失败" + message);
KylinOrderRefunds kylinOrderRefundsFail = new KylinOrderRefunds();
kylinOrderRefundsFail.setStatus(KylinTableStatusConst.ORDER_REFUND_STATUS_ERROR);
kylinOrderRefundsFail.setRefundError(message);
kylinOrderRefunds.setUpdatedAt(LocalDateTime.now());
kylinOrderRefundsMapper.update(
kylinOrderRefundsFail,
new UpdateWrapper<KylinOrderRefunds>().eq("order_refunds_id", refund.getOrderRefundsId())
);
// 修改缓存
KylinOrderRefundsVo kylinOrderRefundsVo = new KylinOrderRefundsVo();
BeanUtils.copyProperties(kylinOrderRefundsFail, kylinOrderRefundsVo);
BasicDBObject object = new BasicDBObject("$set", mongoConverter.convertToMongoType(kylinOrderRefundsVo));
UpdateResult updateResult = mongoTemplate.getCollection(KylinOrderRefundsVo.class.getSimpleName()).updateOne(
Query.query(Criteria.where("orderRefundsId").is(refund.getOrderRefundsId())).getQueryObject(),
object
);
List<String> strings = Arrays.asList(refund.getOrderRefundsId());
List<String> strings1 = Arrays.asList(refund.getOrderTicketsId());
dataUtils.delOrderRefundVo(strings);
dataUtils.delOrderRefundVoByOrderId(strings1);
continue;
}
} catch (Exception e) {
......@@ -585,7 +607,7 @@ public class KylinRefundsStatusServiceImpl {
orderVov
);
dataUtils.delOrderTicketRedis(orderTicketsId);
mongoVoUtils.resetOrderListVo(orderInfo.getUserId(), 2, orderTicketsId,null);
mongoVoUtils.resetOrderListVo(orderInfo.getUserId(), 2, orderTicketsId, null);
// 退款单完成
KylinOrderRefunds kylinOrderRefunds = new KylinOrderRefunds();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment