Ver código fonte

fix 提现账户信息参数校验以及容错积分回滚

zoujiajian 3 anos atrás
pai
commit
27f6cd1815

+ 1 - 1
netflix-service/src/main/java/com/cyksj/service/order/impl/OrderDonServiceImpl.java

@@ -594,7 +594,7 @@ public class OrderDonServiceImpl extends ServiceImpl<OrderDonMapper, OrderDon> i
 						throw new BusinessRuntimeException("订单用户与车位用户不匹配!");
 					} else {
 						if (GroupsRelation.Status.locking.equals(groupsRelation.getStatus())) {
-							log.info("清理用户userId:{}未支付订单orderNo:", orderDon.getUserId(), orderDon.getOrderNo());
+							log.info("清理用户userId:{}未支付订单", orderDon.getUserId());
 							groupsRelation.setUserId(0L);
 							groupsRelation.setStatus(GroupsRelation.Status.none);
 							groupsRelationMapper.updateById(groupsRelation);

+ 15 - 1
netflix-web/src/main/java/com/cyksj/web/controller/user/DistributePopularizeController.java

@@ -218,6 +218,9 @@ public class DistributePopularizeController {
 		if (ObjectUtil.hasEmpty(applyMoneyReq.getAccount(), applyMoneyReq.getRealName())) {
 			throw BusinessRuntimeException.getInstance("必填项不能为空");
 		}
+		if (applyMoneyReq.getAccount().length() > 255 || applyMoneyReq.getRealName().length() > 32) {
+			throw BusinessRuntimeException.getInstance("请输入正确的账户信息");
+		}
 		Boolean isTakeAll = applyMoneyReq.getIsTakeAll();
 		BigDecimal userPoints = user.getPoints();
 		DistributePointsExchangeMoney distributePointsExchangeMoney = distributePointsExchangeMoneyMapper.selectOne(Wrappers.lambdaQuery(DistributePointsExchangeMoney.class).orderByDesc(DistributePointsExchangeMoney::getPoints).last("limit 1"));
@@ -278,7 +281,18 @@ public class DistributePopularizeController {
 					return GatewayResponse.FAIL.newBuilder().setMsg(alipayResponse.getSubMsg()).toResult();
 				}
 			}
-			distributeMoneyApplyMapper.insert(distributeMoneyApply);
+			try {
+				distributeMoneyApplyMapper.insert(distributeMoneyApply);
+			} catch (Exception e) {
+				while (true) {
+					User db = userMapper.selectById(userId);
+					Integer success = userMapper.updatePoints(user.getId(), db.getPoints(), distributeMoneyApply.getPoints());
+					if (success == 1) {
+						break;
+					}
+				}
+				return GatewayResponse.FAIL.newBuilder().setMsg("网络错误,请重试").toResult();
+			}
 			return GatewayResponse.SUCCESS.newBuilder().toResult(distributeMoneyApply);
 		}
 		throw BusinessRuntimeException.getInstance("系统异常,请重新提交提现申请");