|
@@ -21,6 +21,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@RequestMapping("sporadicChargeInfo")
|
|
@RequestMapping("sporadicChargeInfo")
|
|
@@ -69,10 +71,25 @@ public class SporadicChargeInfoController extends BaseController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
SporadicChargeInfo info = sporadicChargeInfoService.get(sporadicPayDto.getSporadicId());
|
|
SporadicChargeInfo info = sporadicChargeInfoService.get(sporadicPayDto.getSporadicId());
|
|
- if (info.getMaxNum() != null) {
|
|
|
|
- int max = 100, min = 1;
|
|
|
|
- int ran2 = (int) (Math.random() * (max - min) + min);
|
|
|
|
- Thread.sleep(ran2);
|
|
|
|
|
|
+
|
|
|
|
+ if(info.getMaxNum() != null) {
|
|
|
|
+ String msg = "";
|
|
|
|
+ for (int i = 1; i <= 100; i++) {
|
|
|
|
+ try {
|
|
|
|
+ Map payMap = musicGroupService.sporadicPay(sporadicPayDto);
|
|
|
|
+ if (payMap.containsKey("tradeState")) {
|
|
|
|
+ return failed(HttpStatus.CREATED, "恭喜您,支付成功!");
|
|
|
|
+ }
|
|
|
|
+ return succeed(payMap);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ int max = 100, min = 1;
|
|
|
|
+ int times = (int) (Math.random() * (max - min) + min);
|
|
|
|
+ Thread.sleep(times);
|
|
|
|
+ msg = e.getMessage();
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return failed(msg);
|
|
}
|
|
}
|
|
|
|
|
|
Map payMap = musicGroupService.sporadicPay(sporadicPayDto);
|
|
Map payMap = musicGroupService.sporadicPay(sporadicPayDto);
|
|
@@ -105,5 +122,4 @@ public class SporadicChargeInfoController extends BaseController {
|
|
}
|
|
}
|
|
return succeed(chargeInfo);
|
|
return succeed(chargeInfo);
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|