Procházet zdrojové kódy

获取用户订单

jk-GitHub-coder před 3 roky
rodič
revize
3b2d2ed9fe

+ 14 - 12
YijiaRestful/src/main/java/com/platform/yijia/controller/PayOrderController.java

@@ -1,5 +1,6 @@
 package com.platform.yijia.controller;
 import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
 import com.platform.yijia.config.YiJiaRequest;
 import com.platform.yijia.dao.PayOrderMapper;
 import com.platform.yijia.param.request.PayOrderRequest;
@@ -1271,7 +1272,7 @@ public class PayOrderController {
     /***
      * //营销方案活动日优惠
      * @param discountType              活动日时间类型
-     * @param discountDate              活动日时间字符串,格式:1,2,3,4
+     * @param discountDate              活动日时间字符串,格式:1,2,3,4,5
      * @return
      */
     public boolean isActivityDay(String discountType, String discountDate){
@@ -1336,19 +1337,20 @@ public class PayOrderController {
      */
     @RequestMapping(value = "/getOrderListByOpenIdAndUserType", method = RequestMethod.GET)
     @ResponseBody
-    public String getOrderListByOpenIdAndUserType(@RequestParam("openId") String openId, @RequestParam("userType") String userType){
-        Gson gson =new Gson();
+    public String getOrderListByOpenIdAndUserType(@RequestParam("openId") String openId){
+        Gson gson =new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
         ResultData resultData =null;
-            if(StringUtils.isNotBlank(openId) && StringUtils.isNotBlank(userType)){
+            if(StringUtils.isNotBlank(openId)){
                 AppUserInfo appUserInfo = new AppUserInfo();
-                switch (userType){
-                    case "1":
-                        appUserInfo.setBlogOpenid(openId);
-                        break;
-                    case "2":
-                        appUserInfo.setALiId(openId);
-                        break;
-                }
+                appUserInfo.setMinaOpenid(openId);
+//                switch (userType){
+//                    case "1":
+//                        appUserInfo.setMinaOpenid(openId);
+//                        break;
+//                    case "2":
+//                        appUserInfo.setALiId(openId);
+//                        break;
+//                }
                 List<PayOrder> payOrderList = payOrderService.getOrderListByOpenIdAndUserType(appUserInfo);
                 resultData=ResultData.success(payOrderList);
             }else {

+ 3 - 1
YijiaRestful/src/main/resources/mapper/PayOrderMapper.xml

@@ -420,8 +420,9 @@
     FROM
         app_user_info           AS A  LEFT JOIN pay_order AS B ON A.user_id = B.consumer_id
     <where>
+        B.status ="1"
       <if test="userType != null and userType !=''">
-        A.user_type = #{userType}
+        AND A.user_type = #{userType}
       </if>
       <if test="blogOpenid != null and blogOpenid !=''">
         AND A.blog_openid = #{blogOpenid}
@@ -431,6 +432,7 @@
       </if>
     </where>
     ORDER BY B.created_date DESC
+      LIMIT 0, 2
   </select>
 
 

+ 5 - 2
YijiaRestful/src/test/java/com/palatform/yijia/test.java

@@ -24,8 +24,11 @@ public class test {
 //        String location = LocationUtil.getLocation("117.12009", "36.65184");
 //        System.out.println(location);
         //117.022388,36.667508
-        JSONObject locationInfo = BaiduMapUtil.getLocation("117.12009", "36.65184");
-        System.out.println(locationInfo);
+//        JSONObject locationInfo = BaiduMapUtil.getLocation("117.12009", "36.65184");
+//        System.out.println(locationInfo);
+
+
+
 //        String detailAddress = BaiduMapUtil.getDetailAddress("117.12009", "36.65184");
 //        System.out.println(detailAddress);