|
|
|
@ -1,11 +1,7 @@
|
|
|
|
|
package com.charge.task.controller;
|
|
|
|
|
|
|
|
|
|
import com.charge.bizcommon.util.JwtUtil;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
|
|
|
import com.jfinal.plugin.activerecord.Record;
|
|
|
|
|
import io.jsonwebtoken.Claims;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
public class YltModel {
|
|
|
|
@ -23,25 +19,6 @@ public class YltModel {
|
|
|
|
|
return record;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:根据JWT的token获取当前用户信息
|
|
|
|
|
*
|
|
|
|
|
* @param request
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public Record getUser(HttpServletRequest request) {
|
|
|
|
|
//从Http请求头中获取Authorization
|
|
|
|
|
String Authorization = request.getHeader("Authorization");
|
|
|
|
|
String secret = JwtUtil.SECRET;
|
|
|
|
|
String token = Authorization.replaceFirst(JwtUtil.AUTHORIZATION_STARTER, "");
|
|
|
|
|
Claims cs = JwtUtil.getClaimsFromToken(token, secret);
|
|
|
|
|
String userId = cs.get("userId", String.class);
|
|
|
|
|
String phone = cs.get("phone", String.class);
|
|
|
|
|
Record record = new Record();
|
|
|
|
|
record.set("userId", userId);
|
|
|
|
|
record.set("phone", phone);
|
|
|
|
|
return record;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:传入一个订单ID,判断它所在的车场是不是第三方道闸的车场
|
|
|
|
@ -134,4 +111,14 @@ public class YltModel {
|
|
|
|
|
record.set("result", result);
|
|
|
|
|
Db.save("t_ext_dz_log", "order_no", record);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 功能:找出所有符合条件的退款单号列表
|
|
|
|
|
* @param userId
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public List<Record> getRefundIds(String userId) {
|
|
|
|
|
String sql = "select * from t_account_recharge where user_id=? and refund_state=0 order by id desc";
|
|
|
|
|
return Db.find(sql, userId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|