Kaynağa Gözat

Merge remote-tracking branch 'origin/developerA' into developerA

chao 3 yıl önce
ebeveyn
işleme
45cb8b381b

+ 1 - 0
src/main/java/com/caimei365/user/mapper/SuperVipMapper.java

@@ -97,6 +97,7 @@ public interface SuperVipMapper {
      * @param payHistory
      */
     int addPayHistory(VipPayHistoryPo payHistory);
+
     void updatePayHistory(VipPayHistoryPo payHistory);
 
     /**

+ 44 - 39
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -953,44 +953,46 @@ public class RegisterServiceImpl implements RegisterService {
 
     /**
      * 现金买超级会员回调
+     *
      * @param userId
      * @param packageId
      * @return
      */
     @Transactional(rollbackFor = Exception.class)
     @Override
-    public ResponseJson superVipByMoney(Integer userId,Integer packageId) throws ParseException {
-        SuperVipDto endFlag = findEnd(userId);
-        VipPackage pac = vipMapper.findUserPackage(packageId);
-        Calendar cal = Calendar.getInstance();
-        SuperVipPo superVip = new SuperVipPo();
-        //flag=0未买过,-1过期,1有效,endTime过期时间
-        if (endFlag.getVipFlag() == 0) {
-            //svipuser表改生效时间,过期时间
-            Integer duration = pac.getDuration();
-            String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
-            today += " 00:00:00";
-            today= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(today);
-            Date parse = new SimpleDateFormat("yyyy-MM-dd").parse(today);
-            cal.setTime(parse);
-            Date beginTime = cal.getTime();
-            superVip.setBeginTime(beginTime);
-            superVip.setUpdateTime(beginTime);
-            cal.add(Calendar.MONTH,duration);
-            superVip.setEndTime(cal.getTime());
-            superVip.setUserId(userId);
-            superVip.setDelFlag(0);
-            vipMapper.addVip(superVip);
-            //sviphistory表加入现金买会员历史
-
-            //cm_discern_receipt加入收款记录
-        }else if(endFlag.getVipFlag() == -1){
-
-        }else if(endFlag.getVipFlag() == 1){
-
-        }
+    public ResponseJson superVipByMoney(Integer userId, Integer packageId) throws ParseException {
+//        SuperVipDto endFlag = findEnd(userId);
+//        VipPackage pac = vipMapper.findUserPackage(packageId);
+//        Calendar cal = Calendar.getInstance();
+//        SuperVipPo superVip = new SuperVipPo();
+//        //flag=0未买过,-1过期,1有效,endTime过期时间
+//        if (endFlag.getVipFlag() == 0) {
+//            //svipuser表改生效时间,过期时间
+//            Integer duration = pac.getDuration();
+//            String today = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+//            today += " 00:00:00";
+//            today= new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(today);
+//            Date parse = new SimpleDateFormat("yyyy-MM-dd").parse(today);
+//            cal.setTime(parse);
+//            Date beginTime = cal.getTime();
+//            superVip.setBeginTime(beginTime);
+//            superVip.setUpdateTime(beginTime);
+//            cal.add(Calendar.MONTH,duration);
+//            superVip.setEndTime(cal.getTime());
+//            superVip.setUserId(userId);
+//            superVip.setDelFlag(0);
+//            vipMapper.addVip(superVip);
+//            //sviphistory表加入现金买会员历史
+//
+//            //cm_discern_receipt加入收款记录
+//        }else if(endFlag.getVipFlag() == -1){
+//
+//        }else if(endFlag.getVipFlag() == 1){
+//
+//        }
         return null;
     }
+
     /**
      * 采美豆买超级会员
      */
@@ -1036,7 +1038,7 @@ public class RegisterServiceImpl implements RegisterService {
         }
         Calendar cal = Calendar.getInstance();
         Date beginTime = new Date();
-        if (null != endFlag.getVipFlag() && 1 == endFlag.getVipFlag()){
+        if (null != endFlag.getVipFlag() && 1 == endFlag.getVipFlag()) {
             // 有效期内续费
             beginTime = endFlag.getEndTime();
         }
@@ -1137,7 +1139,7 @@ public class RegisterServiceImpl implements RegisterService {
                 try {
                     smsFeign.getSendSms(mobile, message);
                 } catch (Exception e) {
-                    log.error("短信发送异常"+e);
+                    log.error("短信发送异常" + e);
                 }
             }
         } else if (repayFlag == 1) {
@@ -1158,13 +1160,13 @@ public class RegisterServiceImpl implements RegisterService {
             superVip.setPayWay(4);
             setHistory(superVip);
             //发短信
-            message="【采美365】恭喜您成功续费采美平台超级会员,为期" + userPackageTime + "个月,快戳采美网站链接 www.caimei365.com 或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美365网”可获取更多优惠和精彩资讯。";
+            message = "【采美365】恭喜您成功续费采美平台超级会员,为期" + userPackageTime + "个月,快戳采美网站链接 www.caimei365.com 或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美365网”可获取更多优惠和精彩资讯。";
             String mobile = vipMapper.findMobile(userId);
             if (mobile != null && mobile != "") {
                 try {
                     smsFeign.getSendSms(mobile, message);
                 } catch (Exception e) {
-                    log.error("短信发送异常"+e);
+                    log.error("短信发送异常" + e);
                 }
             }
         } else if (repayFlag == -1) {
@@ -1188,13 +1190,13 @@ public class RegisterServiceImpl implements RegisterService {
             superVip.setPayWay(4);
             setHistory(superVip);
             //发短信
-            message="【采美365】恭喜您成功续费采美平台超级会员,为期" + userPackageTime + "个月,快戳采美网站链接 www.caimei365.com 或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美365网”可获取更多优惠和精彩资讯。";
+            message = "【采美365】恭喜您成功续费采美平台超级会员,为期" + userPackageTime + "个月,快戳采美网站链接 www.caimei365.com 或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美365网”可获取更多优惠和精彩资讯。";
             String mobile = vipMapper.findMobile(userId);
             if (mobile != null && mobile != "") {
                 try {
                     smsFeign.getSendSms(mobile, message);
                 } catch (Exception e) {
-                    log.error("短信发送异常"+e);
+                    log.error("短信发送异常" + e);
                 }
             }
         }
@@ -1202,9 +1204,10 @@ public class RegisterServiceImpl implements RegisterService {
     }
 
     /**
-     * 修改超级会员记录表
+     * 增加sviphistory记录
      */
     private void setHistory(SuperVipPo vip) {
+        Calendar cal = Calendar.getInstance();
         VipPayHistoryPo payHistory = new VipPayHistoryPo();
         VipPackage pac = vipMapper.findUserPackage(vip.getPackageId());
         payHistory.setUserId(vip.getUserId());
@@ -1214,8 +1217,10 @@ public class RegisterServiceImpl implements RegisterService {
         payHistory.setPayWay(vip.getPayWay());
         payHistory.setPackageId(vip.getPackageId());
         payHistory.setPrice(0.00);
-        payHistory.setBeginTime(vip.getBeginTime());
-        payHistory.setEndTime(vip.getEndTime());
+        payHistory.setBeginTime(vip.getUpdateTime());
+        cal.setTime(vip.getUpdateTime());
+        cal.add(Calendar.MONTH, pac.getDuration());
+        payHistory.setEndTime(cal.getTime());
         vipMapper.addPayHistory(payHistory);
     }
 }