diff --git a/src/main/java/com/jmfy/controller/OrderInfoController.java b/src/main/java/com/jmfy/controller/OrderInfoController.java new file mode 100644 index 0000000..f3fb983 --- /dev/null +++ b/src/main/java/com/jmfy/controller/OrderInfoController.java @@ -0,0 +1,113 @@ +package com.jmfy.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.jmfy.dao.MailDao; +import com.jmfy.dao.UserInfoDao; +import com.jmfy.model.*; +import com.jmfy.redisProperties.RedisUserKey; + +import com.jmfy.utils.JsonUtil; +import com.jmfy.utils.RedisUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpSession; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.net.HttpURLConnection; +import java.net.URL; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.*; + +/** + * Created by huangds on 2017/10/24. + */ +@Controller +public class OrderInfoController { + @Resource + private MailDao mailDao; + @Resource + private UserInfoDao userInfoDao; + private static final Logger LOGGER = LoggerFactory.getLogger(OrderInfoController.class); + + @RequestMapping(value = "/getOrder", method = {RequestMethod.POST, RequestMethod.GET}) + public String getSendMail(HttpSession session, HttpServletRequest request, ModelMap map ) throws Exception { + HashMap parameterMap = JsonUtil.getInstence().getParameterMap(request); + long startTime = JsonUtil.getAppointTimeInXDay(Long.parseLong(JsonUtil.date3TimeStamp(request.getParameter("startTime"))), 0); + long endTime = JsonUtil.getAppointTimeInXDay(Long.parseLong(JsonUtil.date3TimeStamp(request.getParameter("endTime"))), 0); + String serverId1 = parameterMap.get("serverId"); + String userId = parameterMap.get("userId"); + String startData = JsonUtil.timeStamp2Date(String.valueOf(startTime)); + + List days = JsonUtil.getDays(startData,JsonUtil.timeStamp2Date(String.valueOf(endTime))); + + + List cgPayOrders = new ArrayList<>(); + + CUserInfo userInfo =null; + if(userId!=null&&!userId.isEmpty()){ + userInfo = userInfoDao.findUserInfoByUserId(Integer.parseInt(userId)); + } + + + for (String date :days){ + Map map1 = RedisUtil.getInstence().getMap(RedisUserKey.C_PAYORDER_MAP + ":" + date, CGPayOrder.class, -1); + for (Map.Entry entry: map1.entrySet()){ + CGPayOrder cgPayOrder = entry.getValue(); + String accountid = cgPayOrder.getUserId(); + int serverId = cgPayOrder.getServerId(); + if(!String.valueOf(serverId).equals(serverId1)) + { + continue; + } + if (userInfo!=null &&!accountid.equals(userInfo.getOpenId())){ + continue; + } + Corder corder = new Corder(); + corder.setAccountid(accountid); + corder.setAmount(cgPayOrder.getAmount()); + corder.setOrderNo(cgPayOrder.getOrderNo()); + String payTime = cgPayOrder.getDelivery_time(); + corder.setPayTime(payTime); + corder.setProductid(cgPayOrder.getGoodsId()); + corder.setServerId(String.valueOf(serverId)); + corder.setRecharge_type(cgPayOrder.getRecharge_type()); + cgPayOrders.add(corder); + } + } + map.put("cgPayOrders",cgPayOrders); + return "userOrderInfo"; + } + + + private static JSONObject sendGet(String params) throws IOException { + StringBuilder sb = new StringBuilder(); +// URL url = new URL(URL); + URL url = new URL("http://60.1.1.212:9991/delivery/callback"); + HttpURLConnection urlCon = (HttpURLConnection)url.openConnection(); + urlCon.setDoOutput(true); + urlCon.setDoInput(true); + urlCon.setRequestMethod("POST"); + urlCon.setRequestProperty("Cookie","lhuj1i5hcu80edg3fjhesj4ak3"); + OutputStreamWriter out = new OutputStreamWriter(urlCon.getOutputStream(), "UTF-8"); + out.write(params); + out.flush(); + out.close(); + BufferedReader reader = new BufferedReader(new InputStreamReader(urlCon.getInputStream(), "UTF-8")); + String line; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + return JSON.parseObject(sb.toString()); + } +} diff --git a/src/main/java/com/jmfy/model/CGPayOrder.java b/src/main/java/com/jmfy/model/CGPayOrder.java new file mode 100644 index 0000000..7084a98 --- /dev/null +++ b/src/main/java/com/jmfy/model/CGPayOrder.java @@ -0,0 +1,112 @@ +package com.jmfy.model; + +import org.springframework.data.annotation.Id; +import org.springframework.data.mongodb.core.mapping.Document; +import org.springframework.data.mongodb.core.mapping.Field; + +/** + * Created by Administrator on 2016/3/22. + */ +@Document(collection = "c_pay_order") +public class CGPayOrder { + @Id + private String orderId;//充值回调中的pOrderId + + @Field(value = "serverId") + private int serverId;// + + @Field(value = "userId") + private String userId;//充值回调中的userId + + @Field(value = "roleId") + private String roleId; + + @Field(value = "goodsId") + private String goodsId; + + @Field(value = "orderNo") + private String orderNo; //平台订单好 + + @Field(value = "delivery_time") + private String delivery_time; //支付时间 + + + @Field(value = "recharge_type") + private String recharge_type ; // 货币类型 + + @Field(value = "amount") + private String amount ; //充值金额 + + + public String getOrderId() { + return orderId; + } + + public void setOrderId(String orderId) { + this.orderId = orderId; + } + + public int getServerId() { + return serverId; + } + + public void setServerId(int serverId) { + this.serverId = serverId; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getDelivery_time() { + return delivery_time; + } + + public void setDelivery_time(String delivery_time) { + this.delivery_time = delivery_time; + } + + public String getRecharge_type() { + return recharge_type; + } + + public void setRecharge_type(String recharge_type) { + this.recharge_type = recharge_type; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getRoleId() { + return roleId; + } + + public void setRoleId(String roleId) { + this.roleId = roleId; + } + + public String getGoodsId() { + return goodsId; + } + + public void setGoodsId(String goodsId) { + this.goodsId = goodsId; + } +} diff --git a/src/main/java/com/jmfy/model/Corder.java b/src/main/java/com/jmfy/model/Corder.java new file mode 100644 index 0000000..b647f14 --- /dev/null +++ b/src/main/java/com/jmfy/model/Corder.java @@ -0,0 +1,74 @@ +package com.jmfy.model; + +public class Corder { + + private String accountid; //玩家id + + private String orderNo; //平台订单好 + + private String payTime; //支付时间 + + private String productid; //礼包id + + private String recharge_type ; // qucik--quick uc-- 九游 sujie--速接 + + private String amount ; //充值金额 + + private String serverId; + + public String getAccountid() { + return accountid; + } + + public void setAccountid(String accountid) { + this.accountid = accountid; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getPayTime() { + return payTime; + } + + public void setPayTime(String payTime) { + this.payTime = payTime; + } + + public String getProductid() { + return productid; + } + + public void setProductid(String productid) { + this.productid = productid; + } + + public String getRecharge_type() { + return recharge_type; + } + + public void setRecharge_type(String recharge_type) { + this.recharge_type = recharge_type; + } + + public String getAmount() { + return amount; + } + + public void setAmount(String amount) { + this.amount = amount; + } + + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } +} diff --git a/src/main/java/com/jmfy/redisProperties/RedisUserKey.java b/src/main/java/com/jmfy/redisProperties/RedisUserKey.java index 035cf86..524d623 100644 --- a/src/main/java/com/jmfy/redisProperties/RedisUserKey.java +++ b/src/main/java/com/jmfy/redisProperties/RedisUserKey.java @@ -26,7 +26,8 @@ public class RedisUserKey { public static final String AUTOOPENTIME = "AUTOOPENTIME"; public static final String CHAT_INFO_CACHE = "CHAT_INFO_CACHE";//聊天信息缓存,gm后台使用 public static final String MAIL_RED_POINT = "MAIL_RED_POINT"; - + public final static String C_PAYORDER = "C_PAYORDER"; + public final static String C_PAYORDER_MAP = "C_PAYORDER_MAP"; /** * 在线人数 updata/min */ diff --git a/src/main/java/com/jmfy/utils/JsonUtil.java b/src/main/java/com/jmfy/utils/JsonUtil.java index 76fba10..ee9c0f8 100644 --- a/src/main/java/com/jmfy/utils/JsonUtil.java +++ b/src/main/java/com/jmfy/utils/JsonUtil.java @@ -5,12 +5,10 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.http.HttpServletRequest; +import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.Date; -import java.util.Enumeration; -import java.util.HashMap; +import java.util.*; public class JsonUtil { @@ -139,4 +137,31 @@ public class JsonUtil { calendar.set(Calendar.MILLISECOND, 0); return calendar.getTimeInMillis(); } + + public static List getDays(String startTime, String endTime) { + + // 返回的日期集合 + List days = new ArrayList(); + + DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); + try { + Date start = dateFormat.parse(startTime); + Date end = dateFormat.parse(endTime); + + Calendar tempStart = Calendar.getInstance(); + tempStart.setTime(start); + + Calendar tempEnd = Calendar.getInstance(); + tempEnd.setTime(end); + tempEnd.add(Calendar.DATE, +1);// 日期加1(包含结束) + while (tempStart.before(tempEnd)) { + days.add(dateFormat.format(tempStart.getTime())); + tempStart.add(Calendar.DAY_OF_YEAR, 1); + } + } catch (ParseException e) { + e.printStackTrace(); + } + + return days; + } } diff --git a/src/main/resources/static/html/findOrder.html b/src/main/resources/static/html/findOrder.html new file mode 100644 index 0000000..685f7e3 --- /dev/null +++ b/src/main/resources/static/html/findOrder.html @@ -0,0 +1,140 @@ + + + + + + + + + + + + + + + + + + + + +玩家订单查询 + + + +
+
+
+
+ 玩家订单查询 +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+ +
+ + +
+
+
+
+
+
+ +
+
+
+
+ + + + + + + + + + + + + + + + + diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index e05f4f9..2d4250c 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -108,6 +108,8 @@
  • 发送gm
  • 公告信息
  • 添加白名单账号
  • + + @@ -131,6 +133,7 @@
    diff --git a/src/main/resources/templates/userOrderInfo.html b/src/main/resources/templates/userOrderInfo.html new file mode 100644 index 0000000..784b402 --- /dev/null +++ b/src/main/resources/templates/userOrderInfo.html @@ -0,0 +1,82 @@ + + + + + + + + + + + + + + + + + + + 玩家充值订单信息 + + + +
    +

    玩家充值订单信息

    +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    订单id充值时间服务器id用户id礼包id充值金额支付方式
    +
    +
    + + + + + + + + + + + + + \ No newline at end of file