Bladeren bron

vip过期判断为空

小么熊🐻 3 jaren geleden
bovenliggende
commit
f5faf3f207

+ 0 - 3
jsjp-admin/src/main/java/com/miaxis/app/controller/wx/WxJsjpController.java

@@ -8,16 +8,13 @@ import com.miaxis.common.constant.Constants;
 import com.miaxis.common.core.controller.BaseController;
 import com.miaxis.common.core.domain.Response;
 import com.miaxis.common.core.domain.entity.SysDictData;
-import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.common.enums.OrderStatusEnum;
 import com.miaxis.common.exception.CustomException;
-import com.miaxis.common.utils.SecurityUtils;
 import com.miaxis.common.utils.uuid.CommonUtils;
 import com.miaxis.newgzpt.domain.GzptUserInfo;
 import com.miaxis.newgzpt.service.IGzptUserInfoService;
 import com.miaxis.system.service.ISysDictDataService;
 import com.miaxis.wx.domain.WxJsOrder;
-import com.miaxis.wx.domain.WxOrder;
 import com.miaxis.wx.dto.WxOrderDTO;
 import com.miaxis.wx.service.IWxJsOrderService;
 import io.swagger.annotations.Api;

+ 25 - 2
jsjp-admin/src/main/java/com/miaxis/app/controller/wx/WxNotifyController.java

@@ -12,6 +12,7 @@ import com.miaxis.newgzpt.domain.GzptVideoVip;
 import com.miaxis.newgzpt.dto.GzptVideoVipDTO;
 import com.miaxis.newgzpt.service.IGzptUserInfoService;
 import com.miaxis.newgzpt.service.IGzptVideoVipService;
+import com.miaxis.system.service.ISysUserService;
 import com.miaxis.wx.domain.RefundRecord;
 import com.miaxis.wx.domain.WxJsOrder;
 import com.miaxis.wx.domain.WxOrder;
@@ -220,6 +221,19 @@ public class WxNotifyController {
         wxJsOrderService.updateById(wxJsOrder);
     }
 
+//    public static void main(String[] args) {
+//        Date date = DateUtils.parseDate("2021-03-04");
+//        Date now = new Date();
+//
+//        if(date.compareTo(now)<0){
+//            System.out.println("11111111111");
+//        } else {
+//
+//            System.out.println("33333333333");
+//        }
+//
+//    }
+
 
     @Transactional
     public void writeVipDataToDb(WxJsOrder wxJsOrder) {
@@ -229,7 +243,7 @@ public class WxNotifyController {
         if ("科目二视频".equals(wxJsOrder.getGoodsName())){
                 GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
                 gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
-                GzptVideoVip gv = videoVipService.getGzptVideoVipByUserId(gzptVideoVipDTO);
+                GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
                 if(gv!=null) {
                     //修改会员信息
                     Date km2Date = gv.getSubject2();
@@ -245,6 +259,11 @@ public class WxNotifyController {
                             gv.setSubject2(km2oneYear);
                             videoVipService.updateGzptVideoVipByUserId(gv);
                         }
+                    } else {
+                        long x = now.getTime() + oneYearLong;
+                        Date km2oneYear = new Date(x);
+                        gv.setSubject2(km2oneYear);
+                        videoVipService.updateGzptVideoVipByUserId(gv);
                     }
                 } else {
                     //新增会员信息
@@ -254,7 +273,6 @@ public class WxNotifyController {
                     long x = now.getTime() + oneYearLong;
                     Date km2oneYear = new Date(x);
                     videoVip.setSubject2(km2oneYear);
-                    System.out.println(videoVip);
                     videoVipService.saveGzptVideoVip(videoVip);
                 }
 
@@ -277,6 +295,11 @@ public class WxNotifyController {
                             gv.setSubject3(km3oneYear);
                             videoVipService.updateGzptVideoVipByUserId(gv);
                         }
+                    } else {
+                        long x = now.getTime() + oneYearLong;
+                        Date km3oneYear = new Date(x);
+                        gv.setSubject3(km3oneYear);
+                        videoVipService.updateGzptVideoVipByUserId(gv);
                     }
                 } else {
                     //新增会员信息

+ 1 - 1
jsjp-service/src/main/java/com/miaxis/newgzpt/service/IGzptVideoVipService.java

@@ -22,5 +22,5 @@ public interface IGzptVideoVipService extends IService<GzptVideoVip> {
 
     GzptVideoVip getGzptVideoVipByUserId(GzptVideoVipDTO gzptVideoVipDTO);
 
-
+    GzptVideoVip getGzptVideoVipByUserIdForLocal(GzptVideoVipDTO gzptVideoVipDTO);
 }

+ 9 - 1
jsjp-service/src/main/java/com/miaxis/newgzpt/service/impl/GzptVideoVipServiceImpl.java

@@ -55,8 +55,16 @@ public class GzptVideoVipServiceImpl extends ServiceImpl<GzptVideoVipMapper, Gzp
                     vv.setSubject3(null);
                 }
             }
+            return vv;
+        } else {
+            GzptVideoVip v2 = new GzptVideoVip();
+            return v2;
         }
-        return vv;
+    }
+
+    @Override
+    public GzptVideoVip getGzptVideoVipByUserIdForLocal(GzptVideoVipDTO gzptVideoVipDTO) {
+        return mapper.getGzptVideoVipByUserId(gzptVideoVipDTO);
     }
 
 }