|
@@ -1,20 +1,25 @@
|
|
|
package com.miaxis.order.service.impl;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
-import com.miaxis.common.utils.DateUtils;
|
|
|
+import com.miaxis.newgzpt.domain.GzptSchActivation;
|
|
|
+import com.miaxis.newgzpt.domain.GzptSchPayLog;
|
|
|
+import com.miaxis.newgzpt.domain.GzptUserInfo;
|
|
|
+import com.miaxis.newgzpt.service.IGzptSchActivationService;
|
|
|
+import com.miaxis.newgzpt.service.IGzptSchPayLogService;
|
|
|
+import com.miaxis.newgzpt.service.IGzptUserInfoService;
|
|
|
+import com.miaxis.order.domain.OrderInfo;
|
|
|
+import com.miaxis.order.dto.QuerySchoolOrderListDTO;
|
|
|
+import com.miaxis.order.mapper.OrderInfoMapper;
|
|
|
+import com.miaxis.order.service.IOrderInfoService;
|
|
|
+import com.miaxis.order.vo.QuerySchoolOrderListVo;
|
|
|
import com.miaxis.userInfo.domain.UserVip;
|
|
|
import com.miaxis.userInfo.service.IUserVipService;
|
|
|
+import com.miaxis.wx.domain.WxJsOrder;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
-import org.apache.commons.lang3.StringUtils;
|
|
|
-import com.miaxis.order.mapper.OrderInfoMapper;
|
|
|
-import com.miaxis.order.domain.OrderInfo;
|
|
|
-import com.miaxis.order.service.IOrderInfoService;
|
|
|
+
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* 订单信息Service业务层处理
|
|
@@ -57,8 +62,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
|
|
|
|
|
|
|
|
|
- @Override
|
|
|
- public void writeVipDataToDb(WxJsOrder order,int payType) {
|
|
|
+ public void writeVipDataToDb(WxJsOrder order, int payType) {
|
|
|
long oneYearLong = 1000 * 60 * 60 * 24 * 365l;
|
|
|
Date now = new Date();
|
|
|
|
|
@@ -71,37 +75,16 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
orderInfo.setTradeType(1);
|
|
|
orderInfo.setSuccessTime(now);
|
|
|
orderInfo.setPayType(payType);
|
|
|
- orderInfo.setDqbh(order.getDqbh());
|
|
|
- orderInfo.setDqmc(order.getDqmc());
|
|
|
- orderInfo.setIsShare(order.getIsShare());
|
|
|
- orderInfo.setSchool(order.getSchool());
|
|
|
- orderInfo.setSchoolName(order.getSchoolName());
|
|
|
- orderInfo.setSchoolCommission(order.getSchoolCommission());
|
|
|
- orderInfo.setPhoneType(order.getPhoneType());
|
|
|
|
|
|
|
|
|
- if("理论计时".equals(orderInfo.getGoodsName())) {
|
|
|
- //激活操作
|
|
|
- GzptSchActivation schActivation = new GzptSchActivation();
|
|
|
- schActivation.setDqbh(order.getDqbh());
|
|
|
- schActivation.setDqmc(order.getDqmc());
|
|
|
- schActivation.setJxbh(order.getSchool());
|
|
|
- schActivation.setJxmc(order.getSchoolName());
|
|
|
- schActivation.setUserId(order.getUserId());
|
|
|
- schActivation.setStuId(gzptUserInfo.getOutId());
|
|
|
- schActivation.setCrtime(new Date());
|
|
|
- schActivationService.saveSchActivation(schActivation);
|
|
|
-
|
|
|
- GzptSchPayLog gzptSchPayLog = new GzptSchPayLog();
|
|
|
- gzptSchPayLog.setStuId(gzptUserInfo.getOutId());
|
|
|
- gzptSchPayLog.setDqbh(order.getDqbh());
|
|
|
- gzptSchPayLog.setPrice(order.getTotal());
|
|
|
- gzptSchPayLog.setJxbh(order.getSchool());
|
|
|
- gzptSchPayLog.setCrtime(new Date());
|
|
|
-
|
|
|
|
|
|
- if ("科一专项VIP".equals(goodsName)) {
|
|
|
- UserVip userVip = userVipService.getUserVipByUserId(userId);
|
|
|
+ if("理论计时".equals(order.getGoodsName())) {
|
|
|
+ //激活操作
|
|
|
+ saveActiva(order, gzptUserInfo);
|
|
|
+ //插入日志表
|
|
|
+ savePayLog(order, gzptUserInfo);
|
|
|
+ } else if ("科一专项VIP".equals(order.getGoodsName())) {
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
|
|
|
if (userVip != null) {
|
|
|
//修改会员信息
|
|
|
Date km1Date = userVip.getSubject1();
|
|
@@ -136,7 +119,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
this.save(orderInfo);
|
|
|
}
|
|
|
|
|
|
- } else if ("科二专项VIP".equals(orderInfo.getGoodsName())) {
|
|
|
+ } else if ("科二专项VIP".equals(order.getGoodsName())) {
|
|
|
UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
|
|
|
if (userVip != null) {
|
|
|
//修改会员信息
|
|
@@ -171,8 +154,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
userVipService.save(uv);
|
|
|
this.save(orderInfo);
|
|
|
}
|
|
|
- } else if ("科三专项VIP".equals(goodsName)) {
|
|
|
- UserVip userVip = userVipService.getUserVipByUserId(userId);
|
|
|
+ } else if ("科三专项VIP".equals(order.getGoodsName())) {
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
|
|
|
if (userVip != null) {
|
|
|
//修改会员信息
|
|
|
Date km3Date = userVip.getSubject3();
|
|
@@ -207,7 +190,7 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
this.save(orderInfo);
|
|
|
}
|
|
|
|
|
|
- } else if ("科四专项VIP".equals(orderInfo.getGoodsName())) {
|
|
|
+ } else if ("科四专项VIP".equals(order.getGoodsName())) {
|
|
|
UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
|
|
|
if (userVip != null) {
|
|
|
//修改会员信息
|
|
@@ -234,8 +217,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
} else {
|
|
|
//新增会员信息
|
|
|
UserVip uv = new UserVip();
|
|
|
- uv.setUserId(userId);
|
|
|
- uv.setUserName(userName);
|
|
|
+ uv.setUserId(order.getUserId());
|
|
|
+ uv.setUserName(order.getUserName());
|
|
|
long x = now.getTime() + oneYearLong;
|
|
|
Date km4oneYear = new Date(x);
|
|
|
uv.setSubject4(km4oneYear);
|
|
@@ -243,8 +226,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
this.save(orderInfo);
|
|
|
}
|
|
|
|
|
|
- } else if ("科目一二三四所有付费权益".equals(goodsName)) {
|
|
|
- UserVip userVip = userVipService.getUserVipByUserId(userId);
|
|
|
+ } else if ("科目一二三四所有付费权益".equals(order.getGoodsName())) {
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(order.getUserId());
|
|
|
if (userVip != null) {
|
|
|
//修改会员信息
|
|
|
Date km1Date = userVip.getSubject1();
|
|
@@ -292,8 +275,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
} else {
|
|
|
//新增会员信息
|
|
|
UserVip uv = new UserVip();
|
|
|
- uv.setUserId(userId);
|
|
|
- uv.setUserName(userName);
|
|
|
+ uv.setUserId(order.getUserId());
|
|
|
+ uv.setUserName(order.getUserName());
|
|
|
long x = now.getTime() + oneYearLong;
|
|
|
Date oneYear = new Date(x);
|
|
|
uv.setSubject1(oneYear);
|
|
@@ -307,6 +290,8 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public void writeVipDataToDb(String goodsName, Long userId, String userName, String outTrandeNo, Integer total, Integer payType) {
|
|
|
long oneYearLong = 1000 * 60 * 60 * 24 * 365l;
|
|
@@ -752,4 +737,45 @@ public class OrderInfoServiceImpl extends ServiceImpl<OrderInfoMapper, OrderInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<QuerySchoolOrderListVo> selectSchoolOrderInfoList(QuerySchoolOrderListDTO schoolOrderListDTO) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void writeVipDataToDb(String goodsName, Long userId, String userName, String outTrandeNo, Integer total, Integer payType, String dqbh, String dqmc, int isStare, String school, String schoolName, int schoolCommission, int phoneType) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 插入支付记录
|
|
|
+ * @param order
|
|
|
+ * @param gzptUserInfo
|
|
|
+ */
|
|
|
+ private void savePayLog(WxJsOrder order, GzptUserInfo gzptUserInfo) {
|
|
|
+ GzptSchPayLog gzptSchPayLog = new GzptSchPayLog();
|
|
|
+ gzptSchPayLog.setStuId(gzptUserInfo.getOutId());
|
|
|
+ gzptSchPayLog.setDqbh(order.getDqbh());
|
|
|
+ gzptSchPayLog.setPrice(order.getTotal());
|
|
|
+ gzptSchPayLog.setJxbh(order.getSchool());
|
|
|
+ gzptSchPayLog.setCrtime(new Date());
|
|
|
+ schPayLogService.saveSchPayLog(gzptSchPayLog);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 插入激活记录
|
|
|
+ * @param order
|
|
|
+ * @param gzptUserInfo
|
|
|
+ */
|
|
|
+ private void saveActiva(WxJsOrder order, GzptUserInfo gzptUserInfo) {
|
|
|
+ GzptSchActivation schActivation = new GzptSchActivation();
|
|
|
+ schActivation.setDqbh(order.getDqbh());
|
|
|
+ schActivation.setDqmc(order.getDqmc());
|
|
|
+ schActivation.setJxbh(order.getSchool());
|
|
|
+ schActivation.setJxmc(order.getSchoolName());
|
|
|
+ schActivation.setUserId(order.getUserId());
|
|
|
+ schActivation.setStuId(gzptUserInfo.getOutId());
|
|
|
+ schActivation.setCrtime(new Date());
|
|
|
+ schActivationService.saveSchActivation(schActivation);
|
|
|
+ }
|
|
|
}
|