支付模块,调通对 ping++ 的调用,以实现模拟支付。

当然,整体代码还是有点乱,后面花点时间重构下~

现在,缺一个异步 MQ 通知业务方订单支付成功
This commit is contained in:
YunaiV
2019-03-13 20:27:53 +08:00
parent c772da6716
commit 7d423c8ed2
24 changed files with 579 additions and 16 deletions

View File

@@ -0,0 +1,20 @@
package cn.iocoder.common.framework.util;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateUtil {
/**
* @param date 时间。若为空,则返回空串
* @param pattern 时间格式化
* @return 格式化后的时间字符串.
*/
public static String format(Date date, String pattern) {
if (date == null) {
return "";
}
return new SimpleDateFormat(pattern).format(date);
}
}

View File

@@ -0,0 +1,33 @@
package cn.iocoder.common.framework.util;
import java.util.Random;
public class MathUtil {
/**
* 随机对象
*/
private static final Random RANDOM = new Random(); // TODO 后续优化
/**
* 随机[min, max]范围内的数字
*
* @param min 随机开始
* @param max 随机结束
* @return 数字
*/
public static int random(int min, int max) {
if (min == max) {
return min;
}
if (min > max) {
int temp = min;
min = max;
max = temp;
}
// 随即开始
int diff = max - min + 1;
return RANDOM.nextInt(diff) + min;
}
}