提现修改
parent
bdd434d826
commit
6e4913b2b5
|
@ -0,0 +1,247 @@
|
|||
package com.ruoyi.mybasic.Text;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 身份证号验证
|
||||
* @Author WenHao.Sao
|
||||
*/
|
||||
public class IdCardCheck {
|
||||
|
||||
|
||||
/*********************************** 身份证验证开始 ****************************************/
|
||||
/**
|
||||
* 身份证号码验证 1、号码的结构 公民身份号码是特征组合码,由十七位数字本体码和一位校验码组成。排列顺序从左至右依次为:六位数字地址码,
|
||||
* 八位数字出生日期码,三位数字顺序码和一位数字校验码。 2、地址码(前六位数)
|
||||
* 表示编码对象常住户口所在县(市、旗、区)的行政区划代码,按GB/T2260的规定执行。 3、出生日期码(第七位至十四位)
|
||||
* 表示编码对象出生的年、月、日,按GB/T7408的规定执行,年、月、日代码之间不用分隔符。 4、顺序码(第十五位至十七位)
|
||||
* 表示在同一地址码所标识的区域范围内,对同年、同月、同日出生的人编定的顺序号, 顺序码的奇数分配给男性,偶数分配给女性。 5、校验码(第十八位数)
|
||||
* (1)十七位数字本体码加权求和公式 S = Sum(Ai * Wi), i = 0, ... , 16 ,先对前17位数字的权求和
|
||||
* Ai:表示第i位置上的身份证号码数字值 Wi:表示第i位置上的加权因子 Wi: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4
|
||||
* 2 (2)计算模 Y = mod(S, 11) (3)通过模得到对应的校验码 Y: 0 1 2 3 4 5 6 7 8 9 10 校验码: 1 0
|
||||
* X 9 8 7 6 5 4 3 2
|
||||
*/
|
||||
/**
|
||||
* 功能:身份证的有效验证
|
||||
*
|
||||
* @param IDStr 身份证号 [url=home.php?mod=space&uid=7300]@return[/url] 有效:返回""
|
||||
* 无效:返回String信息
|
||||
*/
|
||||
public static boolean IDCardValidate(String IDStr) {
|
||||
@SuppressWarnings("unused")
|
||||
String errorInfo = "";// 记录错误信息
|
||||
String[] ValCodeArr = {"1", "0", "X", "9", "8", "7", "6", "5", "4",
|
||||
"3", "2"};
|
||||
String[] Wi = {"7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7",
|
||||
"9", "10", "5", "8", "4", "2"};
|
||||
String Ai = "";
|
||||
// ================ 号码的长度 15位或18位 ================
|
||||
if (IDStr.length() != 15 && IDStr.length() != 18) {
|
||||
errorInfo = "身份证号码长度应该为15位或18位。";
|
||||
return false;
|
||||
}
|
||||
// =======================(end)========================
|
||||
// ================ 数字 除最后以为都为数字 ================
|
||||
if (IDStr.length() == 18) {
|
||||
Ai = IDStr.substring(0, 17);
|
||||
} else if (IDStr.length() == 15) {
|
||||
Ai = IDStr.substring(0, 6) + "19" + IDStr.substring(6, 15);
|
||||
}
|
||||
if (isNumeric(Ai) == false) {
|
||||
errorInfo = "身份证15位号码都应为数字 ; 18位号码除最后一位外,都应为数字。";
|
||||
return false;
|
||||
}
|
||||
// =======================(end)========================
|
||||
// ================ 出生年月是否有效 ================
|
||||
String strYear = Ai.substring(6, 10);// 年份
|
||||
String strMonth = Ai.substring(10, 12);// 月份
|
||||
String strDay = Ai.substring(12, 14);// 月份
|
||||
if (isDate(strYear + "-" + strMonth + "-" + strDay) == false) {
|
||||
errorInfo = "身份证生日无效。";
|
||||
return false;
|
||||
}
|
||||
GregorianCalendar gc = new GregorianCalendar();
|
||||
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
if ((gc.get(Calendar.YEAR) - Integer.parseInt(strYear)) > 150
|
||||
|| (gc.getTime().getTime() - s.parse(
|
||||
strYear + "-" + strMonth + "-" + strDay).getTime()) < 0) {
|
||||
errorInfo = "身份证生日不在有效范围。";
|
||||
return false;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
} catch (java.text.ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) {
|
||||
errorInfo = "身份证月份无效";
|
||||
return false;
|
||||
}
|
||||
if (Integer.parseInt(strDay) > 31 || Integer.parseInt(strDay) == 0) {
|
||||
errorInfo = "身份证日期无效";
|
||||
return false;
|
||||
}
|
||||
// =====================(end)=====================
|
||||
// ================ 地区码时候有效 ================
|
||||
Map<String, String> h = GetAreaCode();
|
||||
if (h.get(Ai.substring(0, 2)) == null) {
|
||||
errorInfo = "身份证地区编码错误。";
|
||||
return false;
|
||||
}
|
||||
// ==============================================
|
||||
// ================ 判断最后一位的值 ================
|
||||
int TotalmulAiWi = 0;
|
||||
for (int i = 0; i < 17; i++) {
|
||||
TotalmulAiWi = TotalmulAiWi
|
||||
+ Integer.parseInt(String.valueOf(Ai.charAt(i)))
|
||||
* Integer.parseInt(Wi[i]);
|
||||
}
|
||||
int modValue = TotalmulAiWi % 11;
|
||||
String strVerifyCode = ValCodeArr[modValue];
|
||||
Ai = Ai + strVerifyCode;
|
||||
if (IDStr.length() == 18) {
|
||||
if (Ai.equals(IDStr) == false) {
|
||||
errorInfo = "身份证无效,不是合法的身份证号码";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// =====================(end)=====================
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:设置地区编码
|
||||
*
|
||||
* @return Hashtable 对象
|
||||
*/
|
||||
private static Map<String, String> GetAreaCode() {
|
||||
Map<String, String> hashtable = new HashMap<String, String>();
|
||||
hashtable.put("11", "北京");
|
||||
hashtable.put("12", "天津");
|
||||
hashtable.put("13", "河北");
|
||||
hashtable.put("14", "山西");
|
||||
hashtable.put("15", "内蒙古");
|
||||
hashtable.put("21", "辽宁");
|
||||
hashtable.put("22", "吉林");
|
||||
hashtable.put("23", "黑龙江");
|
||||
hashtable.put("31", "上海");
|
||||
hashtable.put("32", "江苏");
|
||||
hashtable.put("33", "浙江");
|
||||
hashtable.put("34", "安徽");
|
||||
hashtable.put("35", "福建");
|
||||
hashtable.put("36", "江西");
|
||||
hashtable.put("37", "山东");
|
||||
hashtable.put("41", "河南");
|
||||
hashtable.put("42", "湖北");
|
||||
hashtable.put("43", "湖南");
|
||||
hashtable.put("44", "广东");
|
||||
hashtable.put("45", "广西");
|
||||
hashtable.put("46", "海南");
|
||||
hashtable.put("50", "重庆");
|
||||
hashtable.put("51", "四川");
|
||||
hashtable.put("52", "贵州");
|
||||
hashtable.put("53", "云南");
|
||||
hashtable.put("54", "西藏");
|
||||
hashtable.put("61", "陕西");
|
||||
hashtable.put("62", "甘肃");
|
||||
hashtable.put("63", "青海");
|
||||
hashtable.put("64", "宁夏");
|
||||
hashtable.put("65", "新疆");
|
||||
hashtable.put("71", "台湾");
|
||||
hashtable.put("81", "香港");
|
||||
hashtable.put("82", "澳门");
|
||||
hashtable.put("91", "国外");
|
||||
return hashtable;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:判断字符串是否为数字
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private static boolean isNumeric(String str) {
|
||||
Pattern pattern = Pattern.compile("[0-9]*");
|
||||
Matcher isNum = pattern.matcher(str);
|
||||
if (isNum.matches()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:判断字符串是否为日期格式
|
||||
*
|
||||
* @param strDate
|
||||
* @return
|
||||
*/
|
||||
public static boolean isDate(String strDate) {
|
||||
String regxStr = "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$";
|
||||
Pattern pattern = Pattern.compile(regxStr);
|
||||
Matcher m = pattern.matcher(strDate);
|
||||
if (m.matches()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*********************************** 身份证验证结束 ****************************************/
|
||||
|
||||
|
||||
|
||||
|
||||
/*********************************** 银行卡验证开始 ****************************************/
|
||||
/*
|
||||
校验过程:
|
||||
1、从卡号最后一位数字开始,逆向将奇数位(1、3、5等等)相加。
|
||||
2、从卡号最后一位数字开始,逆向将偶数位数字,先乘以2(如果乘积为两位数,将个位十位数字相加,即将其减去9),再求和。
|
||||
3、将奇数位总和加上偶数位总和,结果应该可以被10整除。
|
||||
*/
|
||||
/**
|
||||
* 校验银行卡卡号
|
||||
*/
|
||||
public static boolean BankCardValidate(String bankCard) {
|
||||
if(bankCard.length() < 15 || bankCard.length() > 19) {
|
||||
return false;
|
||||
}
|
||||
char bit = getBankCardCheckCode(bankCard.substring(0, bankCard.length() - 1));
|
||||
if(bit == 'N'){
|
||||
return false;
|
||||
}
|
||||
return bankCard.charAt(bankCard.length() - 1) == bit;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从不含校验位的银行卡卡号采用 Luhm 校验算法获得校验位
|
||||
* @param nonCheckCodeBankCard
|
||||
* @return
|
||||
*/
|
||||
public static char getBankCardCheckCode(String nonCheckCodeBankCard){
|
||||
if(nonCheckCodeBankCard == null || nonCheckCodeBankCard.trim().length() == 0
|
||||
|| !nonCheckCodeBankCard.matches("\\d+")) {
|
||||
//如果传的不是数据返回N
|
||||
return 'N';
|
||||
}
|
||||
char[] chs = nonCheckCodeBankCard.trim().toCharArray();
|
||||
int luhmSum = 0;
|
||||
for(int i = chs.length - 1, j = 0; i >= 0; i--, j++) {
|
||||
int k = chs[i] - '0';
|
||||
if(j % 2 == 0) {
|
||||
k *= 2;
|
||||
k = k / 10 + k % 10;
|
||||
}
|
||||
luhmSum += k;
|
||||
}
|
||||
return (luhmSum % 10 == 0) ? '0' : (char)((10 - luhmSum % 10) + '0');
|
||||
}
|
||||
|
||||
/*********************************** 银行卡验证开始 ****************************************/
|
||||
}
|
|
@ -1,81 +1,81 @@
|
|||
package com.ruoyi.mybasic.Text;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName Queue
|
||||
* @Description 数据结构队列测试
|
||||
* @Author WenHao.Sao
|
||||
*/
|
||||
|
||||
/**
|
||||
* 队列
|
||||
* @author
|
||||
*/
|
||||
@Data
|
||||
public class Queue {
|
||||
|
||||
private int[] dataArray;//定义了一个数组
|
||||
|
||||
private int front;//队头
|
||||
|
||||
private int rear;//尾端
|
||||
|
||||
public Queue(int capacity){
|
||||
this.dataArray = new int[capacity];
|
||||
}
|
||||
|
||||
public void enQueue(int element){
|
||||
if ((rear + 1 ) % dataArray.length == front){
|
||||
System.out.println("队伍已经满了");
|
||||
System.out.println();
|
||||
return;
|
||||
}
|
||||
dataArray[rear] = element;
|
||||
rear = (rear + 1) % dataArray.length;
|
||||
System.out.println("入队后队头元素为:"+dataArray[front]);
|
||||
System.out.println("出队!后 队尾元素" + element);
|
||||
}
|
||||
|
||||
public int deQueue(){
|
||||
if (rear == front){
|
||||
System.out.println("队以空");
|
||||
System.out.println("");
|
||||
}
|
||||
int deQueueElement = dataArray[front];
|
||||
front = (front + 1) % dataArray.length;
|
||||
System.out.println("出队后对头元素为:"+ dataArray[front]);
|
||||
System.out.println("出队后队元素为:"+dataArray[rear - 1]);
|
||||
System.out.println();
|
||||
return deQueueElement;
|
||||
}
|
||||
|
||||
|
||||
public void print(){
|
||||
for (int i = front; i != rear - i ; i = (i+1) % dataArray.length){
|
||||
System.out.println(dataArray[i] + "-->");
|
||||
}
|
||||
System.out.println(dataArray[rear -1]);
|
||||
System.out.println();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Queue queue = new Queue(6);
|
||||
queue.enQueue(1);
|
||||
queue.enQueue(2);
|
||||
queue.enQueue(3);
|
||||
queue.enQueue(4);
|
||||
queue.enQueue(5);
|
||||
queue.enQueue(6);
|
||||
queue.print();
|
||||
queue.deQueue();
|
||||
queue.deQueue();
|
||||
queue.deQueue();
|
||||
queue.print();
|
||||
queue.enQueue(6);
|
||||
queue.enQueue(7);
|
||||
queue.print();
|
||||
}
|
||||
}
|
||||
|
||||
//package com.ruoyi.mybasic.Text;
|
||||
//
|
||||
//import lombok.Data;
|
||||
//
|
||||
///**
|
||||
// * @ClassName Queue
|
||||
// * @Description 数据结构队列测试
|
||||
// * @Author WenHao.Sao
|
||||
// */
|
||||
//
|
||||
///**
|
||||
// * 队列
|
||||
// * @author
|
||||
// */
|
||||
//@Data
|
||||
//public class Queue {
|
||||
//
|
||||
// private int[] dataArray;//定义了一个数组
|
||||
//
|
||||
// private int front;//队头
|
||||
//
|
||||
// private int rear;//尾端
|
||||
//
|
||||
// public Queue(int capacity){
|
||||
// this.dataArray = new int[capacity];
|
||||
// }
|
||||
//
|
||||
// public void enQueue(int element){
|
||||
// if ((rear + 1 ) % dataArray.length == front){
|
||||
// System.out.println("队伍已经满了");
|
||||
// System.out.println();
|
||||
// return;
|
||||
// }
|
||||
// dataArray[rear] = element;
|
||||
// rear = (rear + 1) % dataArray.length;
|
||||
// System.out.println("入队后队头元素为:"+dataArray[front]);
|
||||
// System.out.println("出队!后 队尾元素" + element);
|
||||
// }
|
||||
//
|
||||
// public int deQueue(){
|
||||
// if (rear == front){
|
||||
// System.out.println("队以空");
|
||||
// System.out.println("");
|
||||
// }
|
||||
// int deQueueElement = dataArray[front];
|
||||
// front = (front + 1) % dataArray.length;
|
||||
// System.out.println("出队后对头元素为:"+ dataArray[front]);
|
||||
// System.out.println("出队后队元素为:"+dataArray[rear - 1]);
|
||||
// System.out.println();
|
||||
// return deQueueElement;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public void print(){
|
||||
// for (int i = front; i != rear - i ; i = (i+1) % dataArray.length){
|
||||
// System.out.println(dataArray[i] + "-->");
|
||||
// }
|
||||
// System.out.println(dataArray[rear -1]);
|
||||
// System.out.println();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// Queue queue = new Queue(6);
|
||||
// queue.enQueue(1);
|
||||
// queue.enQueue(2);
|
||||
// queue.enQueue(3);
|
||||
// queue.enQueue(4);
|
||||
// queue.enQueue(5);
|
||||
// queue.enQueue(6);
|
||||
// queue.print();
|
||||
// queue.deQueue();
|
||||
// queue.deQueue();
|
||||
// queue.deQueue();
|
||||
// queue.print();
|
||||
// queue.enQueue(6);
|
||||
// queue.enQueue(7);
|
||||
// queue.print();
|
||||
// }
|
||||
//}
|
||||
//
|
||||
|
|
|
@ -18,7 +18,7 @@ public class SpinLockDemo {
|
|||
|
||||
AtomicReference<Thread> atomicReference = new AtomicReference<>();
|
||||
public void lock(){
|
||||
// Thread.
|
||||
|
||||
Thread thread = Thread.currentThread();
|
||||
System.out.println(Thread.currentThread().getName() + "------->swh come in");
|
||||
while (!atomicReference.compareAndSet(null,thread)){
|
||||
|
|
|
@ -0,0 +1,215 @@
|
|||
package com.ruoyi.mybasic.Text;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 用户身份证验证测试类
|
||||
*/
|
||||
// 用户类
|
||||
public class User {
|
||||
private String name; // 用户名
|
||||
private String idCard; // 身份证号码
|
||||
private boolean isVerified; // 是否已实名认证
|
||||
|
||||
public User(String name, String idCard) {
|
||||
this.name = name;
|
||||
this.idCard = idCard;
|
||||
this.isVerified = false;
|
||||
}
|
||||
|
||||
|
||||
// 实名认证方法
|
||||
public void verifyIdCard() {
|
||||
// 调用身份证验证接口,验证身份证号码的合法性
|
||||
boolean isValid = IDCardValidate(idCard);
|
||||
if (isValid) {
|
||||
isVerified = true;
|
||||
System.out.println("1111!");
|
||||
} else {
|
||||
System.out.println("22222,请检查身份证号码是否正确!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 功能:身份证的有效验证
|
||||
*
|
||||
* @param IDStr 身份证号 [url=home.php?mod=space&uid=7300]@return[/url] 有效:返回""
|
||||
* 无效:返回String信息
|
||||
*/
|
||||
public static boolean IDCardValidate(String IDStr) {
|
||||
@SuppressWarnings("unused")
|
||||
String errorInfo = "";// 记录错误信息
|
||||
String[] ValCodeArr = {"1", "0", "X", "9", "8", "7", "6", "5", "4",
|
||||
"3", "2"};
|
||||
String[] Wi = {"7", "9", "10", "5", "8", "4", "2", "1", "6", "3", "7",
|
||||
"9", "10", "5", "8", "4", "2"};
|
||||
String Ai = "";
|
||||
// ================ 号码的长度 15位或18位 ================
|
||||
if (IDStr.length() != 15 && IDStr.length() != 18) {
|
||||
errorInfo = "身份证号码长度应该为15位或18位。";
|
||||
return false;
|
||||
}
|
||||
// =======================(end)========================
|
||||
// ================ 数字 除最后以为都为数字 ================
|
||||
if (IDStr.length() == 18) {
|
||||
Ai = IDStr.substring(0, 17);
|
||||
} else if (IDStr.length() == 15) {
|
||||
Ai = IDStr.substring(0, 6) + "19" + IDStr.substring(6, 15);
|
||||
}
|
||||
if (isNumeric(Ai) == false) {
|
||||
errorInfo = "身份证15位号码都应为数字 ; 18位号码除最后一位外,都应为数字。";
|
||||
return false;
|
||||
}
|
||||
// =======================(end)========================
|
||||
// ================ 出生年月是否有效 ================
|
||||
String strYear = Ai.substring(6, 10);// 年份
|
||||
String strMonth = Ai.substring(10, 12);// 月份
|
||||
String strDay = Ai.substring(12, 14);// 月份
|
||||
if (isDate(strYear + "-" + strMonth + "-" + strDay) == false) {
|
||||
errorInfo = "身份证生日无效。";
|
||||
return false;
|
||||
}
|
||||
GregorianCalendar gc = new GregorianCalendar();
|
||||
SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd");
|
||||
try {
|
||||
if ((gc.get(Calendar.YEAR) - Integer.parseInt(strYear)) > 150
|
||||
|| (gc.getTime().getTime() - s.parse(
|
||||
strYear + "-" + strMonth + "-" + strDay).getTime()) < 0) {
|
||||
errorInfo = "身份证生日不在有效范围。";
|
||||
return false;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
} catch (java.text.ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (Integer.parseInt(strMonth) > 12 || Integer.parseInt(strMonth) == 0) {
|
||||
errorInfo = "身份证月份无效";
|
||||
return false;
|
||||
}
|
||||
if (Integer.parseInt(strDay) > 31 || Integer.parseInt(strDay) == 0) {
|
||||
errorInfo = "身份证日期无效";
|
||||
return false;
|
||||
}
|
||||
// =====================(end)=====================
|
||||
// ================ 地区码时候有效 ================
|
||||
Map<String, String> h = GetAreaCode();
|
||||
if (h.get(Ai.substring(0, 2)) == null) {
|
||||
errorInfo = "身份证地区编码错误。";
|
||||
return false;
|
||||
}
|
||||
// ==============================================
|
||||
// ================ 判断最后一位的值 ================
|
||||
int TotalmulAiWi = 0;
|
||||
for (int i = 0; i < 17; i++) {
|
||||
TotalmulAiWi = TotalmulAiWi
|
||||
+ Integer.parseInt(String.valueOf(Ai.charAt(i)))
|
||||
* Integer.parseInt(Wi[i]);
|
||||
}
|
||||
int modValue = TotalmulAiWi % 11;
|
||||
String strVerifyCode = ValCodeArr[modValue];
|
||||
Ai = Ai + strVerifyCode;
|
||||
if (IDStr.length() == 18) {
|
||||
if (Ai.equals(IDStr) == false) {
|
||||
errorInfo = "身份证无效,不是合法的身份证号码";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// =====================(end)=====================
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:设置地区编码
|
||||
*
|
||||
* @return Hashtable 对象
|
||||
*/
|
||||
private static Map<String, String> GetAreaCode() {
|
||||
Map<String, String> hashtable = new HashMap<String, String>();
|
||||
hashtable.put("11", "北京");
|
||||
hashtable.put("12", "天津");
|
||||
hashtable.put("13", "河北");
|
||||
hashtable.put("14", "山西");
|
||||
hashtable.put("15", "内蒙古");
|
||||
hashtable.put("21", "辽宁");
|
||||
hashtable.put("22", "吉林");
|
||||
hashtable.put("23", "黑龙江");
|
||||
hashtable.put("31", "上海");
|
||||
hashtable.put("32", "江苏");
|
||||
hashtable.put("33", "浙江");
|
||||
hashtable.put("34", "安徽");
|
||||
hashtable.put("35", "福建");
|
||||
hashtable.put("36", "江西");
|
||||
hashtable.put("37", "山东");
|
||||
hashtable.put("41", "河南");
|
||||
hashtable.put("42", "湖北");
|
||||
hashtable.put("43", "湖南");
|
||||
hashtable.put("44", "广东");
|
||||
hashtable.put("45", "广西");
|
||||
hashtable.put("46", "海南");
|
||||
hashtable.put("50", "重庆");
|
||||
hashtable.put("51", "四川");
|
||||
hashtable.put("52", "贵州");
|
||||
hashtable.put("53", "云南");
|
||||
hashtable.put("54", "西藏");
|
||||
hashtable.put("61", "陕西");
|
||||
hashtable.put("62", "甘肃");
|
||||
hashtable.put("63", "青海");
|
||||
hashtable.put("64", "宁夏");
|
||||
hashtable.put("65", "新疆");
|
||||
hashtable.put("71", "台湾");
|
||||
hashtable.put("81", "香港");
|
||||
hashtable.put("82", "澳门");
|
||||
hashtable.put("91", "国外");
|
||||
return hashtable;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:判断字符串是否为数字
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private static boolean isNumeric(String str) {
|
||||
Pattern pattern = Pattern.compile("[0-9]*");
|
||||
Matcher isNum = pattern.matcher(str);
|
||||
if (isNum.matches()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能:判断字符串是否为日期格式
|
||||
*
|
||||
* @param strDate
|
||||
* @return
|
||||
*/
|
||||
public static boolean isDate(String strDate) {
|
||||
String regxStr = "^((\\d{2}(([02468][048])|([13579][26]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])))))|(\\d{2}(([02468][1235679])|([13579][01345789]))[\\-\\/\\s]?((((0?[13578])|(1[02]))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(3[01])))|(((0?[469])|(11))[\\-\\/\\s]?((0?[1-9])|([1-2][0-9])|(30)))|(0?2[\\-\\/\\s]?((0?[1-9])|(1[0-9])|(2[0-8]))))))(\\s(((0?[0-9])|([1-2][0-3]))\\:([0-5]?[0-9])((\\s)|(\\:([0-5]?[0-9])))))?$";
|
||||
Pattern pattern = Pattern.compile(regxStr);
|
||||
Matcher m = pattern.matcher(strDate);
|
||||
if (m.matches()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/*********************************** 身份证验证结束 ****************************************/
|
||||
|
||||
// 测试类
|
||||
public static void main(String[] args) {
|
||||
User user = new User("张三", "411623200307253418");
|
||||
user.verifyIdCard();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,35 +1,56 @@
|
|||
package com.ruoyi.mybasic.common.domain;
|
||||
|
||||
import com.alibaba.druid.sql.visitor.functions.Char;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName MoneyLog
|
||||
* @Description 钱包收支记录
|
||||
* @Author WenHao.Sao
|
||||
* 钱包收支记录表
|
||||
* @author WenHao.Sao
|
||||
*/
|
||||
@Data
|
||||
public class MoneyLog {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
private Long userId; //用户id
|
||||
|
||||
private int status;//状态 1:支出 2 收入
|
||||
|
||||
private Date createTime;//操作时间
|
||||
|
||||
private String moneyTypeName;//详情
|
||||
|
||||
private Integer amountIncome;//收入支出金额
|
||||
|
||||
private String createBy;//创建人
|
||||
|
||||
private Char delFlag;//删除标志
|
||||
|
||||
private String updateBy;//修改人
|
||||
|
||||
private Date updateTime;//修改时间
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 状态 1:支出 2 收入
|
||||
*/
|
||||
private int status;
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
private String moneyTypeName;
|
||||
/**
|
||||
* 收入支出金额
|
||||
*/
|
||||
private Integer amountIncome;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
private Char delFlag;
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateBy;
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.ruoyi.mybasic.common.domain;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 提现记录表
|
||||
* @author WenHao.Sao
|
||||
*/
|
||||
@Data
|
||||
public class MoneyWithdraw {
|
||||
|
||||
/**
|
||||
* 提现记录主建
|
||||
*/
|
||||
private long id;
|
||||
/**
|
||||
* 提现用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 银行卡编号-用于支付宝字段
|
||||
*/
|
||||
private String bankId;
|
||||
/**
|
||||
* 操作时间
|
||||
*/
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 提现状态0:处理中 1:已提现
|
||||
*/
|
||||
private int statue;
|
||||
/**
|
||||
* 提现金额
|
||||
*/
|
||||
private String amount;
|
||||
|
||||
|
||||
}
|
|
@ -3,9 +3,7 @@ package com.ruoyi.mybasic.common.domain.ailPay;
|
|||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName AilPay
|
||||
* @Description 描述
|
||||
* @Author WenHao.Sao
|
||||
* 支付宝硬性条件
|
||||
*/
|
||||
@Data
|
||||
public class AliPay {
|
||||
|
@ -14,6 +12,4 @@ public class AliPay {
|
|||
private String subject;//主题
|
||||
private String alipayTraceNo;//支付宝跟踪号
|
||||
|
||||
// private String amount;//前台传入金额
|
||||
|
||||
}
|
||||
|
|
|
@ -5,9 +5,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @ClassName AlipayConfig
|
||||
* @Description 描述
|
||||
* @Author WenHao.Sao
|
||||
* 支付宝配置-->用于映射
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.ruoyi.mybasic.common.domain.emal;
|
||||
|
||||
|
||||
/**
|
||||
* 定义枚举增加H币
|
||||
*/
|
||||
public enum IncomeAmount {
|
||||
ONE_DOLLAR(10),
|
||||
FIVE_DOLLARS(20),
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
package com.ruoyi.mybasic.common.domain;
|
||||
package com.ruoyi.mybasic.common.domain.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @ClassName IdCard
|
||||
* @Description 身份证表
|
||||
* @Author WenHao.Sao
|
||||
* 身份证表
|
||||
*/
|
||||
@Data
|
||||
public class IdCard {
|
|
@ -1,118 +0,0 @@
|
|||
//import com.alipay.api.AlipayApiException;
|
||||
//import com.alipay.api.AlipayClient;
|
||||
//import com.alipay.api.DefaultAlipayClient;
|
||||
//import com.alipay.api.domain.AlipayTradeAppPayModel;
|
||||
//import com.alipay.api.internal.util.AlipaySignature;
|
||||
//import com.alipay.api.request.AlipayTradeAppPayRequest;
|
||||
//import com.alipay.api.response.AlipayTradeAppPayResponse;
|
||||
//import org.springframework.web.bind.annotation.GetMapping;
|
||||
//import org.springframework.web.bind.annotation.PostMapping;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.bind.annotation.RestController;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.Iterator;
|
||||
//import java.util.Map;
|
||||
//
|
||||
//
|
||||
//@RestController
|
||||
//@RequestMapping("/pay/ali")
|
||||
//public class AliPayController {
|
||||
//
|
||||
// //!!!!!注意这里是你的APPID沙箱里查看
|
||||
// //应用id
|
||||
// private final static String APP_ID="9021000130611735";
|
||||
//
|
||||
// //!!!!!注意这里是你的应用私钥,在支付宝开发平台助手里(就是刚才生成的私钥)
|
||||
// //应用私钥
|
||||
// private final static String APP_PRIVATE_KEY="MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCLKDV+wVS8g3jC20HNe5uS3cx8TX7cfX5PaDVV2AzISTWi9AWBGA7gFs56b13dQTxriVdButiEMT99AFftJ3VMtYgl8P3/qqjbf6Ar6ZjzthJLOWSnEiH3AyExMParGS6fBwLk9peTGpq6bhyHMtmuEfleXJezynk3c6tSPusIPPGYySkGhT36JPbj6AvKZzC3OvvMhvNm98v3v5HUgrWnkAwFOb8GZVqxtxXo51gU/VYXd/2/qGC8QunTaZ6h25NIdNPk6oirV1Iz6IyRwTKheG9PlvOLDP6xjBmgnmQuofrSBub5sId7B3GqZ0R9qtymZ9QtNCWqFwq3BLwV5f+zAgMBAAECggEAdX6qxG6qhE0hnq0QP1ZZwkTCDkZEkhjnmFZtiiDUkhu2TPNq3lgY3z6CckAr6c/WGxoocZg4jk0ixQGQO+4wDWfNH/P+EmvfDQ4SiGFBQq19fsRj5ujZgr3Cvc0QyOCHS8DYwcgvrQYulLC6J7FYuK/2dKULdcPEW3yvr87uFdJTiTxo8nGdPVIj/n4vMSnhzPjzS9I9frmMd2NrChGTXCp+n2Va8drmLV/BQU+RquNzM/gub7sfQpkEDazI8SbV298khPtqdT6ccUIFwQjZBKb3OBwsBlQDi7UGiF3W3jlrT9f6VXnwrG2KuePya/x+fxjhSvCuxLY8jCRulR/zwQKBgQDhcXSvmBdZHFKeTerw9uMfYbDltqeDm+GrfPVeZ210ZluBP4aiwpUsCzUPyFafvhRkCWzQMgzogz/n1antLCTyhCLqYCpFm75lgJWnwlwh5E1FGzv3+FrLTDXPqgeDFrk0LqP5svD4vV3sJo3Wj862Go1jLH/9Miz19ZenbbBbUwKBgQCeBMC1FGzjDaIm1xvNXFl+/SwdQLODM3m+2+XXaPjS6sRSP3FNqzyCKhF2JlXQCcrg21GCvlRhg168gl1GDewAmUpFsZcOuEPezIHxolhWh627FC6M6tLV8vwJYckCbkJTdq9lL1/lwtjsLm37CJwpO0Ke6mee7ejrLTmkMl+eIQKBgFzzV2XysmW2TMYiYCTb1kchEzuTNLwJsGDxU4WJ5VIhxcajd5Jx4elX8ZfBRR311Bhu3mN0z2eqfdXLfZVhJxaqrm6uGZ+7mCPngUy60RvUMpu0n+QcjOrXUDR/6Tr+SnweYtNYGQylnyz3tHFrt5HTnsnuFhNB9dGvYcjRa+4rAoGAO+PjQf5u0pONPJlU0T3KMcY03RVztCtjXkIr17vSauZN6DphcCWRdmgJXDVlWscLXLPjLeGDS74lvt7OCUong4aVztpjPVH7b0sliPaV8p3T687XYdNye2JvwgKM094ER2v5SClveD6kRsfGKVn3De2G74I6KdNT7yah7SimcuECgYAbKGo7dYEc4jcrSBaQ3PrmYl1orc1/F8v3lyw/Ts3jryXS71a6OHk5WhokWYqClz+Yi9yhtOTl8JgBLPR9edwASO9iRZjvwqkETcSb1VrzbI80NjDJrDkH+w3o4Yp5ySPcNF63Xufd/x7zjr37/VW6mC2UNplNRiWUH4/cj1+JNA==/";
|
||||
// //字符集
|
||||
// private final static String CHARSET="UTF-8";
|
||||
//
|
||||
// //!!!!!注意这里是你的支付宝公钥,在沙箱环境中RSA2(SHA256)密钥 弹窗里面的,支付宝公钥
|
||||
// //应用公钥
|
||||
// private final static String ALIPAY_PUBLIC_KEY="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiyg1fsFUvIN4wttBzXubkt3MfE1+3H1+T2g1VdgMyEk1ovQFgRgO4BbOem9d3UE8a4lXQbrYhDE/fQBX7Sd1TLWIJfD9/6qo23+gK+mY87YSSzlkpxIh9wMhMTD2qxkunwcC5PaXkxqaum4chzLZrhH5XlyXs8p5N3OrUj7rCDzxmMkpBoU9+iT24+gLymcwtzr7zIbzZvfL97+R1IK1p5AMBTm/BmVasbcV6OdYFP1WF3f9v6hgvELp02meoduTSHTT5OqIq1dSM+iMkcEyoXhvT5bziwz+sYwZoJ5kLqH60gbm+bCHewdxqmdEfarcpmfULTQlqhcKtwS8FeX/swIDAQAB";
|
||||
//
|
||||
// //!!!!!注意这里是你的支付宝网关,在沙箱环境里查看
|
||||
// //网关
|
||||
// private final static String GATEWAY_URL="https://openapi-sandbox.dl.alipaydev.com/gateway.do";
|
||||
//
|
||||
// //格式化
|
||||
// private final static String FORMAT="json";
|
||||
// //签名类型
|
||||
// private final static String SIGNTYPE="RSA2";
|
||||
// /*
|
||||
// * 获取订单信息
|
||||
// * */
|
||||
// @GetMapping("getOrderInfo")
|
||||
// public String getOrderInfo() {
|
||||
// //实例化客户端
|
||||
// AlipayClient alipayClient = new DefaultAlipayClient(GATEWAY_URL, APP_ID, APP_PRIVATE_KEY, FORMAT, CHARSET, ALIPAY_PUBLIC_KEY, SIGNTYPE);
|
||||
// //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay
|
||||
// AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
|
||||
// //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
|
||||
// AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
|
||||
// model.setBody("我是测试数据");
|
||||
// model.setSubject("App支付测试Java");
|
||||
// model.setOutTradeNo("这里是交易订单号");
|
||||
// model.setTimeoutExpress("30m");
|
||||
// model.setTotalAmount("0.01");
|
||||
// model.setProductCode("QUICK_MSECURITY_PAY");
|
||||
// request.setBizModel(model);
|
||||
// request.setNotifyUrl("商户外网可以访问的异步地址");
|
||||
// try {
|
||||
// //这里和普通的接口调用不同,使用的是sdkExecute
|
||||
// AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
|
||||
// System.out.println(response.getBody());//就是orderString 可以直接给客户端请求,无需再做处理。
|
||||
// return response.getBody();
|
||||
// } catch (AlipayApiException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @PostMapping("/notify_url")
|
||||
// public String notify_url(HttpServletRequest request){
|
||||
// //获取支付宝POST过来反馈信息
|
||||
// Map<String,String> params = new HashMap<String,String>();
|
||||
// Map requestParams = request.getParameterMap();
|
||||
// for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext();) {
|
||||
// String name = (String) iter.next();
|
||||
// String[] values = (String[]) requestParams.get(name);
|
||||
// String valueStr = "";
|
||||
// for (int i = 0; i < values.length; i++) {
|
||||
// valueStr = (i == values.length - 1) ? valueStr + values[i]
|
||||
// : valueStr + values[i] + ",";
|
||||
// }
|
||||
// //乱码解决,这段代码在出现乱码时使用。
|
||||
// //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
|
||||
// params.put(name, valueStr);
|
||||
// }
|
||||
// //切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
|
||||
// //boolean AlipaySignature.rsaCheckV1(Map<String, String> params, String publicKey, String charset, String sign_type)
|
||||
// try {
|
||||
//
|
||||
// boolean flag = AlipaySignature.rsaCheckV1(params, ALIPAY_PUBLIC_KEY, CHARSET,SIGNTYPE);
|
||||
// //如果验签失败
|
||||
// if(!flag){
|
||||
// return "fail";
|
||||
// }
|
||||
// //验签成功后
|
||||
// //商户的业务逻辑 比如修改订单号
|
||||
// System.out.println("修改订单成功");
|
||||
//
|
||||
// } catch (AlipayApiException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return "success";
|
||||
// }
|
||||
//
|
||||
//
|
||||
// //这里是main方法用来生成alipay_sdk信息
|
||||
// public static void main(String[] args) {
|
||||
// AliPayController aliPayController = new AliPayController();
|
||||
// aliPayController.getOrderInfo();
|
||||
// }
|
||||
//}
|
||||
//
|
|
@ -1,7 +1,5 @@
|
|||
package com.ruoyi.mybasic.controller;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
|
||||
import com.ruoyi.mybasic.common.domain.request.ConsultationRequest;
|
||||
import com.ruoyi.mybasic.common.domain.request.DoctorGiftRecordRequest;
|
||||
import com.ruoyi.mybasic.common.domain.request.InterrogationRequest;
|
||||
|
@ -14,9 +12,7 @@ import java.util.List;
|
|||
|
||||
|
||||
/**
|
||||
* @ClassName FavorableRateController
|
||||
* @Description 好评率
|
||||
* @Author WenHao.Sao
|
||||
* 好评率-->服务患者次数控制层
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/favorableRate")
|
||||
|
|
|
@ -34,8 +34,12 @@ import java.util.Map;
|
|||
* @Description 钱包的
|
||||
* @Author WenHao.Sao
|
||||
*/
|
||||
|
||||
/**
|
||||
* 钱包接口--->旧
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/purse")
|
||||
@RequestMapping("/purseOld")
|
||||
@Log4j2
|
||||
public class PurseController {
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import com.ruoyi.common.core.exception.ServiceException;
|
|||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.mybasic.api.domain.UserMoneyLogs;
|
||||
import com.ruoyi.mybasic.common.domain.MoneyLog;
|
||||
import com.ruoyi.mybasic.common.domain.MoneyWithdraw;
|
||||
import com.ruoyi.mybasic.common.domain.Purse;
|
||||
import com.ruoyi.mybasic.common.domain.RechargeLog;
|
||||
import com.ruoyi.mybasic.common.domain.ailPay.AliPay;
|
||||
|
@ -35,12 +36,11 @@ import java.util.Map;
|
|||
*/
|
||||
|
||||
/**
|
||||
* 我的钱包小模块接口
|
||||
* 我的钱包小模块接口-->新
|
||||
*/
|
||||
//@CrossOrigin(origins = "*")
|
||||
@RestController
|
||||
@RequestMapping("purse")//purse
|
||||
//@MapperScan("com.ruoyi.mybasic.mapper")
|
||||
@RequestMapping("/purse")//purse
|
||||
public class PurseControllerTwo {
|
||||
|
||||
private static final String GATEWAY_URL = "https://openapi-sandbox.dl.alipaydev.com/gateway.do";
|
||||
|
@ -209,10 +209,9 @@ public class PurseControllerTwo {
|
|||
* 消息队列根据消息调用api接口 消息队列根据api接口的返回结果进行不同的操作失败:根据参数中的提现记录id 把对应记录状态改为失败
|
||||
* 成功:根据参数中的充值记录id 把对应记录状态改为成功 用户的余额减少 增加一条收支记录表
|
||||
*/
|
||||
@PostMapping("/withdrawPurse")//未完成
|
||||
public R<?> withdrawPurse(AliPay aliPay, HttpServletResponse httpResponse){
|
||||
//获取当前用户的userId 里面的余额
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
@PostMapping("/withdrawPurse")//完成
|
||||
public void withdrawPurse(AliPay aliPay){
|
||||
|
||||
PurseResponse purseResponse = purseServiceTwo.purseObject();
|
||||
//获取当前用户的余额
|
||||
int balanceFee = purseResponse.getBalanceFee();
|
||||
|
@ -222,22 +221,28 @@ public class PurseControllerTwo {
|
|||
if (totalAmount * 100 > balanceFee){
|
||||
throw new ServiceException("H币不足,请重新输入");
|
||||
}else{
|
||||
|
||||
//获取一个空对象
|
||||
PurseRequest purseRequest = new PurseRequest();
|
||||
purseRequest.setUserId(userId + "");
|
||||
purseRequest.setAmount(totalAmount);
|
||||
//修改H币 以及添加提现事物里面的金额
|
||||
purseServiceTwo.updWithdrawPurse(purseRequest);
|
||||
UserMoneyLogs userMoneyLogs = new UserMoneyLogs();
|
||||
|
||||
//添加记录表
|
||||
MoneyLogsRequest moneyLogsRequest = new MoneyLogsRequest();
|
||||
moneyLogsRequest.setStatus(1);
|
||||
|
||||
userMoneyLogs.setUserId(Math.toIntExact(SecurityUtils.getUserId()));
|
||||
userMoneyLogs.setAmountIncome((int) totalAmount);
|
||||
userMoneyLogs.setMoneyTypeName("提现入支付宝");
|
||||
userMoneyLogs.setStatus(1);
|
||||
//调用修改钱包接口
|
||||
purseServiceTwo.purseBalanceChange(userMoneyLogs);
|
||||
|
||||
//提现记录表
|
||||
MoneyWithdraw moneyWithdraw = new MoneyWithdraw();
|
||||
moneyWithdraw.setUserId(SecurityUtils.getUserId());
|
||||
moneyWithdraw.setBankId("支付宝");
|
||||
moneyWithdraw.setAmount(totalAmount + "");
|
||||
moneyWithdraw.setStatue(1);
|
||||
purseServiceTwo.insertWithdrawalLog(moneyWithdraw);
|
||||
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -16,6 +16,10 @@ import java.util.List;
|
|||
* @Description 描述
|
||||
* @Author WenHao.Sao
|
||||
*/
|
||||
|
||||
/**
|
||||
* 钱包Mapper接口-->旧
|
||||
*/
|
||||
@Mapper
|
||||
public interface PurseMapper {
|
||||
|
||||
|
|
|
@ -1,23 +1,16 @@
|
|||
package com.ruoyi.mybasic.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.mybasic.api.domain.UserMoneyLogs;
|
||||
import com.ruoyi.mybasic.common.domain.MoneyLog;
|
||||
import com.ruoyi.mybasic.common.domain.MoneyWithdraw;
|
||||
import com.ruoyi.mybasic.common.domain.Purse;
|
||||
import com.ruoyi.mybasic.common.domain.RechargeLog;
|
||||
import com.ruoyi.mybasic.common.domain.request.MoneyLogsRequest;
|
||||
import com.ruoyi.mybasic.common.domain.request.PurseRequest;
|
||||
import com.ruoyi.mybasic.common.domain.response.PurseResponse;
|
||||
import io.swagger.models.auth.In;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PurseMapperTwo
|
||||
* @Description 描述
|
||||
* 钱包Mapper接口-->新
|
||||
* @Author WenHao.Sao
|
||||
*/
|
||||
@Mapper
|
||||
|
@ -51,4 +44,5 @@ public interface PurseMapperTwo{
|
|||
|
||||
int insertRechargeLog(RechargeLog rechargeLog);
|
||||
|
||||
void insertWithdrawalLog(MoneyWithdraw moneyWithdraw);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ package com.ruoyi.mybasic.service.Impl;
|
|||
import com.ruoyi.common.core.exception.ServiceException;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.mybasic.api.domain.UserMoneyLogs;
|
||||
import com.ruoyi.mybasic.common.domain.MoneyWithdraw;
|
||||
import com.ruoyi.mybasic.common.domain.Purse;
|
||||
import com.ruoyi.mybasic.common.domain.RechargeLog;
|
||||
import com.ruoyi.mybasic.common.domain.request.PurseRequest;
|
||||
|
@ -56,6 +57,17 @@ public class PurseServiceTwoImpl implements PurseServiceTwo {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加充值记录
|
||||
* @param rechargeLog
|
||||
*/
|
||||
@Override
|
||||
public void insertRechargeLog(RechargeLog rechargeLog) {
|
||||
int i = purseMapperTwo.insertRechargeLog(rechargeLog);
|
||||
if (i <1 ){
|
||||
throw new ServiceException("系统繁忙");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 进行添加充值记录表
|
||||
|
@ -84,15 +96,12 @@ public class PurseServiceTwoImpl implements PurseServiceTwo {
|
|||
}
|
||||
|
||||
/**
|
||||
* 添加充值记录
|
||||
* @param rechargeLog
|
||||
* 提现记录表
|
||||
* @param moneyWithdraw
|
||||
*/
|
||||
@Override
|
||||
public void insertRechargeLog(RechargeLog rechargeLog) {
|
||||
int i = purseMapperTwo.insertRechargeLog(rechargeLog);
|
||||
if (i <1 ){
|
||||
throw new ServiceException("系统繁忙");
|
||||
}
|
||||
public void insertWithdrawalLog(MoneyWithdraw moneyWithdraw) {
|
||||
purseMapperTwo.insertWithdrawalLog(moneyWithdraw);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -12,10 +12,9 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @ClassName PurseService
|
||||
* @Description 描述
|
||||
* @Author WenHao.Sao
|
||||
* 钱包持久层-->旧
|
||||
*/
|
||||
public interface PurseService {
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.mybasic.service;
|
|||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.mybasic.api.domain.UserMoneyLogs;
|
||||
import com.ruoyi.mybasic.common.domain.MoneyLog;
|
||||
import com.ruoyi.mybasic.common.domain.MoneyWithdraw;
|
||||
import com.ruoyi.mybasic.common.domain.RechargeLog;
|
||||
import com.ruoyi.mybasic.common.domain.request.PurseRequest;
|
||||
import com.ruoyi.mybasic.common.domain.response.PurseResponse;
|
||||
|
@ -11,9 +12,7 @@ import org.apache.ibatis.annotations.Param;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @ClassName PurseServiceTwo
|
||||
* @Description 描述
|
||||
* @Author WenHao.Sao
|
||||
* 钱包持久层-->新
|
||||
*/
|
||||
public interface PurseServiceTwo {
|
||||
PurseResponse purseObject();
|
||||
|
@ -32,4 +31,6 @@ public interface PurseServiceTwo {
|
|||
|
||||
|
||||
void insertRechargeLog(RechargeLog rechargeLog);
|
||||
|
||||
void insertWithdrawalLog(MoneyWithdraw moneyWithdraw);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
# Tomcat
|
||||
server:
|
||||
port: 9001
|
||||
port: 9090
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: health-mybasic
|
||||
name: health-mybasicTwo
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
@ -43,43 +43,4 @@ spring:
|
|||
# alipay.notifyUrl: http://vhzkca.natappfree.cc/alipay/notify
|
||||
# alipay.returnUrl: http://localhost:8000/orders
|
||||
|
||||
##APPID
|
||||
# alipay.appId=
|
||||
# #开启公钥模式:点击查看中的公钥
|
||||
# alipay.appPrivateKey=
|
||||
# #开启公钥模式:点击查看中的私钥
|
||||
# alipay.alipayPublicKey=
|
||||
# #启动nata内网穿透后命令提示框中的http地址,上面启动后保留的地址
|
||||
# # /alipay/notify为处理回调参数的接口地址
|
||||
# alipay.notifyUrl=http://udgc9y.natappfree.cc/alipay/notify
|
||||
#fdfs:
|
||||
# so-timeout: 1500 # socket 连接时长
|
||||
# connect-timeout: 600 # 连接 tracker 服务器超时时长
|
||||
# # 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
|
||||
#
|
||||
# tracker-list: 10.100.1.4:22122
|
||||
# web-server-url: 10.100.1.4:8888
|
||||
# pool:
|
||||
# jmx-enabled: false
|
||||
#
|
||||
# # 生成缩略图
|
||||
# thumb-image:
|
||||
# height: 500
|
||||
# width: 500
|
||||
## 应用ID,您的APPID
|
||||
#alipay.appId: 9021000130611735
|
||||
## 支付宝公私钥生成地址:https://miniu.alipay.com/keytool/create
|
||||
## 商户私钥,您的PKCS8格式RSA2私钥
|
||||
#alipay.merchantPrivateKey: MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDM7+9TRvFFs0acZNRvgKrTUnig4k1Th/Pl02VRI4aTNpQIHpiTcViytaIr9ByioCNzmE5D3hMMp4arN3MiXnH9c+R9holwDtjbQyDC9QLRwZVMRnduXdZ42h2+5jhbt34wKXp61t3rFW9X9gA2iPJYbV6LRmyX+iuhfGtk5YPrTu307D79E6p7n7h+UBxaS0w0u5pm2eoiKFml3hRRhuY6IqEOo87gg7psjpj+KEV81cpDpvlICYRfVq425PWA+wTKVPsV2YGK0V6da3qbo17bNeBU6vIOUaDDkfflCZG2wSdRKzmrVrrr2i+lzuC3pxNimFDavvaRBdF1RzdvmeHBAgMBAAECggEAIEloxhD2MAn3hOopwctenl5u3MHqds+DcGDmpGrZZ9YAamsPlKMV20ncW9pgrIpYK30CT5TsIWE/STg6Ll78zHZ2uAP7ISllpt2jirN5FzzNXa/4Xu3vvSh36TxyApkdC09tmW7ClafR2+TI0c6vh5jrfTvCHgtu1kk4zjOOngKPxRielI7qcSyO0GGlNPYIXZO7X9De/lqNsAu0e8j8DbAWhOx/0EZ7zpZEBTVyZe2s7Lbq1lEWqn07vYjKWCoAp9O1IEll/9963U5yfV+rMj47lP+k5x/oa6HVd5TxeUeOX2vd/HZitxBeq4lPt5cqHciLWnPgvv68VrviB5pmZQKBgQD/orVuGXdcw3zOBHnzqOclC05sZH2UO6CrJERn82gKCgdx5wQwE1WwqgI0S+oGVpO6wgAM/1g6vT8U6EgovMbdmjZ+Adf657EHLEBOYee34PrVLRcc+uMbFTTwM7E31l+SUIcYLXw2zqu2/QXv7/4K6cWx0cIhCse3NvWc6oRb4wKBgQDNOrlwlYV316ZZp5II5EmqKMEvAx+Lf/4SqPBdj0BDCtZGqM0ADMUCBb0mATnRebalgGqPbIWgIDKrHXUOy2Kr5ARIRERp3oV1csXFAwIgxMncyOKJqGAHZBLeQFkLP6PEL7gniIGAIsIT5ecu5EzuEUQNHxLSVD7c5BZTmK+FCwKBgACNy7LXX0jWK5kOrWz3urh708msVhFSJ8D3LSbEgj8zUlzO0VWBVTgyxhpy56jn2x4WeYWNsBVAf7h94FomPpAQW3neaydiBSIs2F7TG3tsg16e4GPxrzhJzXmPwxyJ3F8myYQl5RUBUaHt3mtsq7I+W21NNQx5R4GAHvweDfddAoGAPetS2bnzC+ZfhTs+nzopU5J6PrHliZQzVvPrmX7H97JEVgtF1pcDtYl/uQCzrhTX23U0MVOfuWEdiG0ZzT3l5lCkTh1yurJtd7MKIle3A6X79YYSe0/2sSQrYSzu8KrhwSZYnGzeDYfvIEvEBWzSHR3Od1sBtb2/Pav/ZHdztWMCgYEA7/DECBPTvQaXLWYZO96UQ7y1WCelmfCa0XbRvwL/i3DB5/aK0d8eSDUVQ9aXTmegRMcXrvGgf3YmLteipUpwUq0i6KNM/ynDbx3W0LtG53+BOsFSnVkNsN53GZJ6C+ZoxmPcouCWdaxdjPoJFF1pPv1lb8Ia5qnhHaoMjLYoSpQ=
|
||||
## 支付宝公钥,查看地址:https://openhome.alipay.com/platform/keyManage.htm
|
||||
#alipay.alipayPublicKey: MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzhwYjyXibFiJbj+N15ANZVoQXIprD4LGAtUrt1rDTIz3D+BwouhcGYHV5S+Tin6vJ7jsEul4tU/i+vI+KIHbfr/Kha0MtyUSHjfyf1URZQXxLChYxrjidS/9xF7HYXEUzIRVN55M9Qzk764BrGkdZ5IsuUt32PXFMF4D0MWOynAdBIRRCUVUD0IE1IfcMIhIP1UdjMRLwOGZWHUw8L7B2A/f8hIeAqeWZs+w/Um1m5cKXJceJGxq/QrqLBAFHlF2oKKcVQaFdMgDX3OlKvUzUQ/tz82NpnftB7A2tIHWWmPTRGQ5lwy21/y7jLF91E9YK7Y99HcQT/ag40XJZVQLnwIDAQAB
|
||||
## 页面跳转异步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
|
||||
#alipay.notifyUrl: http://5ktbak.natappfree.cc/payment/alipay
|
||||
## 页面跳转同步通知页面路径,需http://格式的完整路径,不能加?id=123这类自定义参数,必须外网可以正常访问
|
||||
#alipay.returnUrl: http://5ktbak.natappfree.cc/alipayResult
|
||||
## 签名方式
|
||||
#alipay.signType: RSA2
|
||||
## 字符编码格式
|
||||
#alipay.charset: utf-8
|
||||
## 支付宝网关
|
||||
#alipay.gatewayUrl: https://openapi.alipaydev.com/gateway.do
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
<mapper namespace="com.ruoyi.mybasic.mapper.InvitationMapper">
|
||||
|
||||
|
||||
|
||||
<select id="show" resultType="com.ruoyi.mybasic.common.domain.request.InvitationRecordRequest">
|
||||
|
||||
</select>
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
)
|
||||
</insert>
|
||||
|
||||
<!-- 充值记录表-->
|
||||
<insert id="insertRechargeLog">
|
||||
insert into t_recharger_log
|
||||
(user_id,recharge_type,recharge_amount,create_time)
|
||||
|
@ -152,4 +153,12 @@
|
|||
balance_fee = balance_fee - (#{amount} * 100)
|
||||
where user_id = #{userId}
|
||||
</update>
|
||||
|
||||
<!-- 提现记录表-->
|
||||
<insert id="insertWithdrawalLog">
|
||||
insert into t_money_withdraw
|
||||
(user_id,bank_id,amount,create_time)
|
||||
values
|
||||
(#{userId},#{bankId},(#{amount}*100),now())
|
||||
</insert>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue