|
@@ -45,7 +45,7 @@ import java.util.Date;
|
|
|
|
|
|
@RestController
|
|
@RestController
|
|
@RequiredArgsConstructor
|
|
@RequiredArgsConstructor
|
|
-@RequestMapping(Constants.OPEN_PREFIX+"/wx/notify")
|
|
|
|
|
|
+@RequestMapping(Constants.OPEN_PREFIX + "/wx/notify")
|
|
@Api(tags = {"【APP-微信回调】"})
|
|
@Api(tags = {"【APP-微信回调】"})
|
|
@Slf4j
|
|
@Slf4j
|
|
public class WxNotifyController {
|
|
public class WxNotifyController {
|
|
@@ -57,7 +57,7 @@ public class WxNotifyController {
|
|
private IWxJsOrderService wxJsOrderService;
|
|
private IWxJsOrderService wxJsOrderService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
- private IRefundRecordService refundRecordService;
|
|
|
|
|
|
+ private IRefundRecordService refundRecordService;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
private AutoUpdateCertificatesVerifier verifier;
|
|
private AutoUpdateCertificatesVerifier verifier;
|
|
@@ -82,7 +82,7 @@ public class WxNotifyController {
|
|
@ApiOperation("微信支付回调")
|
|
@ApiOperation("微信支付回调")
|
|
public WxNotifyReturnDTO wxpayNotify(@RequestBody WxpayNotifyDTO wxpayNotifyDTO, HttpServletRequest request) throws GeneralSecurityException, IOException {
|
|
public WxNotifyReturnDTO wxpayNotify(@RequestBody WxpayNotifyDTO wxpayNotifyDTO, HttpServletRequest request) throws GeneralSecurityException, IOException {
|
|
String bodyString = getBodyString(request);
|
|
String bodyString = getBodyString(request);
|
|
- if (!validate(request,bodyString)){
|
|
|
|
|
|
+ if (!validate(request, bodyString)) {
|
|
throw new CustomException("签名失败");
|
|
throw new CustomException("签名失败");
|
|
}
|
|
}
|
|
String resourceString = getSourString(wxpayNotifyDTO);
|
|
String resourceString = getSourString(wxpayNotifyDTO);
|
|
@@ -98,41 +98,31 @@ public class WxNotifyController {
|
|
}
|
|
}
|
|
|
|
|
|
private String getBodyString(HttpServletRequest request) {
|
|
private String getBodyString(HttpServletRequest request) {
|
|
- BufferedReader br = null;
|
|
|
|
- StringBuilder sb = new StringBuilder("");
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- br = request.getReader();
|
|
|
|
- String str;
|
|
|
|
- while ((str = br.readLine()) != null)
|
|
|
|
- {
|
|
|
|
- sb.append(str);
|
|
|
|
- }
|
|
|
|
- br.close();
|
|
|
|
- }
|
|
|
|
- catch (IOException e)
|
|
|
|
- {
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ BufferedReader br = null;
|
|
|
|
+ StringBuilder sb = new StringBuilder("");
|
|
|
|
+ try {
|
|
|
|
+ br = request.getReader();
|
|
|
|
+ String str;
|
|
|
|
+ while ((str = br.readLine()) != null) {
|
|
|
|
+ sb.append(str);
|
|
}
|
|
}
|
|
- finally
|
|
|
|
- {
|
|
|
|
- if (null != br)
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- br.close();
|
|
|
|
- }
|
|
|
|
- catch (IOException e)
|
|
|
|
- {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ br.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ if (null != br) {
|
|
|
|
+ try {
|
|
|
|
+ br.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- return sb.toString();
|
|
|
|
|
|
+ }
|
|
|
|
+ return sb.toString();
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private Boolean validate(HttpServletRequest request, String bodyString) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
|
|
|
|
|
|
+ private Boolean validate(HttpServletRequest request, String bodyString) throws NoSuchAlgorithmException, InvalidKeyException, SignatureException {
|
|
String sign = request.getHeader("Wechatpay-Signature");
|
|
String sign = request.getHeader("Wechatpay-Signature");
|
|
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
|
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
|
String nonce = request.getHeader("Wechatpay-Nonce");
|
|
String nonce = request.getHeader("Wechatpay-Nonce");
|
|
@@ -149,7 +139,7 @@ public class WxNotifyController {
|
|
// 把我们构造的验签名串更新到签名器中
|
|
// 把我们构造的验签名串更新到签名器中
|
|
signature.update(sb.toString().getBytes(StandardCharsets.UTF_8));
|
|
signature.update(sb.toString().getBytes(StandardCharsets.UTF_8));
|
|
Boolean result = signature.verify(Base64Utils.decodeFromString(sign));
|
|
Boolean result = signature.verify(Base64Utils.decodeFromString(sign));
|
|
- log.info("微信支付回调验签:"+result.toString());
|
|
|
|
|
|
+ log.info("微信支付回调验签:" + result.toString());
|
|
return result;
|
|
return result;
|
|
|
|
|
|
}
|
|
}
|
|
@@ -162,14 +152,14 @@ public class WxNotifyController {
|
|
@ApiOperation("微信退款回调")
|
|
@ApiOperation("微信退款回调")
|
|
public WxNotifyReturnDTO refundNotify(@RequestBody WxpayNotifyDTO wxpayNotifyDTO, HttpServletRequest request) throws GeneralSecurityException, IOException {
|
|
public WxNotifyReturnDTO refundNotify(@RequestBody WxpayNotifyDTO wxpayNotifyDTO, HttpServletRequest request) throws GeneralSecurityException, IOException {
|
|
String bodyString = getBodyString(request);
|
|
String bodyString = getBodyString(request);
|
|
- if (!validate(request,bodyString)){
|
|
|
|
|
|
+ if (!validate(request, bodyString)) {
|
|
throw new CustomException("签名失败");
|
|
throw new CustomException("签名失败");
|
|
}
|
|
}
|
|
String resourceString = getSourString(wxpayNotifyDTO);
|
|
String resourceString = getSourString(wxpayNotifyDTO);
|
|
log.info(resourceString);
|
|
log.info(resourceString);
|
|
JSONObject jsonObject = JSONObject.parseObject(resourceString);
|
|
JSONObject jsonObject = JSONObject.parseObject(resourceString);
|
|
//将回调数据写入数据库
|
|
//将回调数据写入数据库
|
|
- writeRefundNotifyDataToDb(jsonObject);
|
|
|
|
|
|
+ writeRefundNotifyDataToDb2(jsonObject);
|
|
|
|
|
|
WxNotifyReturnDTO wxNotifyReturnDTO = new WxNotifyReturnDTO();
|
|
WxNotifyReturnDTO wxNotifyReturnDTO = new WxNotifyReturnDTO();
|
|
wxNotifyReturnDTO.setCode("SUCCESS");
|
|
wxNotifyReturnDTO.setCode("SUCCESS");
|
|
@@ -177,6 +167,11 @@ public class WxNotifyController {
|
|
return wxNotifyReturnDTO;
|
|
return wxNotifyReturnDTO;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 原退款接口
|
|
|
|
+ * @param jsonObject
|
|
|
|
+ */
|
|
private void writeRefundNotifyDataToDb(JSONObject jsonObject) {
|
|
private void writeRefundNotifyDataToDb(JSONObject jsonObject) {
|
|
String refundId = jsonObject.getString("refund_id");
|
|
String refundId = jsonObject.getString("refund_id");
|
|
String outTradeNo = jsonObject.getString("out_trade_no");
|
|
String outTradeNo = jsonObject.getString("out_trade_no");
|
|
@@ -190,18 +185,18 @@ public class WxNotifyController {
|
|
refundRecord.setStatus(jsonObject.getString("refund_status"));
|
|
refundRecord.setStatus(jsonObject.getString("refund_status"));
|
|
refundRecordService.updateById(refundRecord);
|
|
refundRecordService.updateById(refundRecord);
|
|
|
|
|
|
- if("SUCCESS".equals(refundRecord.getStatus())){
|
|
|
|
|
|
+ if ("SUCCESS".equals(refundRecord.getStatus())) {
|
|
//退款成功
|
|
//退款成功
|
|
- long oneYearLong = 1000*60*60*24*365l;
|
|
|
|
- WxJsOrder wxJsOrder= wxJsOrderService.getByOutTradeNo(outTradeNo);
|
|
|
|
- if ("科目二视频".equals(wxJsOrder.getGoodsName())){
|
|
|
|
|
|
+ long oneYearLong = 1000 * 60 * 60 * 24 * 365l;
|
|
|
|
+ WxJsOrder wxJsOrder = wxJsOrderService.getByOutTradeNo(outTradeNo);
|
|
|
|
+ if ("科目二视频".equals(wxJsOrder.getGoodsName())) {
|
|
GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
- if(gv!=null) {
|
|
|
|
|
|
+ if (gv != null) {
|
|
//修改会员信息
|
|
//修改会员信息
|
|
Date km2Date = gv.getSubject2();
|
|
Date km2Date = gv.getSubject2();
|
|
- if(km2Date!=null) { //扣掉一年时间
|
|
|
|
|
|
+ if (km2Date != null) { //扣掉一年时间
|
|
long x = km2Date.getTime() - oneYearLong;
|
|
long x = km2Date.getTime() - oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
gv.setSubject2(km2oneYear);
|
|
gv.setSubject2(km2oneYear);
|
|
@@ -212,30 +207,30 @@ public class WxNotifyController {
|
|
GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
- if(gv!=null) {
|
|
|
|
|
|
+ if (gv != null) {
|
|
//修改会员信息
|
|
//修改会员信息
|
|
Date km3Date = gv.getSubject3();
|
|
Date km3Date = gv.getSubject3();
|
|
- if(km3Date!=null) { //扣掉一年时间
|
|
|
|
|
|
+ if (km3Date != null) { //扣掉一年时间
|
|
long x = km3Date.getTime() - oneYearLong;
|
|
long x = km3Date.getTime() - oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
gv.setSubject3(km3oneYear);
|
|
gv.setSubject3(km3oneYear);
|
|
videoVipService.updateGzptVideoVipByUserId(gv);
|
|
videoVipService.updateGzptVideoVipByUserId(gv);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- } else if ("全套实操视频".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
|
|
+ } else if ("全套实操视频".equals(wxJsOrder.getGoodsName())) {
|
|
GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
- if(gv!=null) {
|
|
|
|
|
|
+ if (gv != null) {
|
|
//修改会员信息
|
|
//修改会员信息
|
|
Date km2Date = gv.getSubject2();
|
|
Date km2Date = gv.getSubject2();
|
|
Date km3Date = gv.getSubject3();
|
|
Date km3Date = gv.getSubject3();
|
|
- if(km2Date!=null) { //扣掉一年时间
|
|
|
|
|
|
+ if (km2Date != null) { //扣掉一年时间
|
|
long x = km2Date.getTime() - oneYearLong;
|
|
long x = km2Date.getTime() - oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
gv.setSubject2(km2oneYear);
|
|
gv.setSubject2(km2oneYear);
|
|
}
|
|
}
|
|
- if(km3Date!=null) { //扣掉一年时间
|
|
|
|
|
|
+ if (km3Date != null) { //扣掉一年时间
|
|
long x = km3Date.getTime() - oneYearLong;
|
|
long x = km3Date.getTime() - oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
gv.setSubject3(km3oneYear);
|
|
gv.setSubject3(km3oneYear);
|
|
@@ -247,9 +242,116 @@ public class WxNotifyController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 新退款方便
|
|
|
|
+ * @param jsonObject
|
|
|
|
+ */
|
|
|
|
+ private void writeRefundNotifyDataToDb2(JSONObject jsonObject) {
|
|
|
|
+ String refundId = jsonObject.getString("refund_id");
|
|
|
|
+ String outTradeNo = jsonObject.getString("out_trade_no");
|
|
|
|
+ RefundRecord refundRecord = refundRecordService.getByRefundId(refundId);
|
|
|
|
+ if (refundRecord == null) {
|
|
|
|
+ log.error("该退款订单不存在");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ refundRecord.setTransactionId(jsonObject.getString("transaction_id"));
|
|
|
|
+ refundRecord.setUserReceivedAccount(jsonObject.getString("user_received_account"));
|
|
|
|
+ refundRecord.setStatus(jsonObject.getString("refund_status"));
|
|
|
|
+ refundRecordService.updateById(refundRecord);
|
|
|
|
|
|
|
|
+ if ("SUCCESS".equals(refundRecord.getStatus())) {
|
|
|
|
+ //退款成功
|
|
|
|
+ long oneYearLong = 1000 * 60 * 60 * 24 * 365l;
|
|
|
|
+ WxJsOrder wxJsOrder = wxJsOrderService.getByOutTradeNo(outTradeNo);
|
|
|
|
+ if ("科一专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
|
|
+ if (userVip != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km1Date = userVip.getSubject1();
|
|
|
|
+ if (km1Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km1Date.getTime() - oneYearLong;
|
|
|
|
+ Date km1oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject1(km1oneYear);
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if ("科二专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
|
|
+ if (userVip != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km2Date = userVip.getSubject2();
|
|
|
|
+ if (km2Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km2Date.getTime() - oneYearLong;
|
|
|
|
+ Date km2oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject2(km2oneYear);
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if ("科三专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
|
|
+ if (userVip != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km3Date = userVip.getSubject3();
|
|
|
|
+ if (km3Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km3Date.getTime() - oneYearLong;
|
|
|
|
+ Date km3oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject3(km3oneYear);
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if ("科四专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
|
|
+ if (userVip != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km4Date = userVip.getSubject4();
|
|
|
|
+ if (km4Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km4Date.getTime() - oneYearLong;
|
|
|
|
+ Date km4oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject4(km4oneYear);
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else if ("科目一二三四所有付费权益".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
|
|
+ if (userVip != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km1Date = userVip.getSubject1();
|
|
|
|
+ Date km2Date = userVip.getSubject2();
|
|
|
|
+ Date km3Date = userVip.getSubject3();
|
|
|
|
+ Date km4Date = userVip.getSubject4();
|
|
|
|
+ if (km1Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km1Date.getTime() - oneYearLong;
|
|
|
|
+ Date km1oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject1(km1oneYear);
|
|
|
|
+ }
|
|
|
|
+ if (km2Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km2Date.getTime() - oneYearLong;
|
|
|
|
+ Date km2oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject2(km2oneYear);
|
|
|
|
+ }
|
|
|
|
+ if (km3Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km3Date.getTime() - oneYearLong;
|
|
|
|
+ Date km3oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject3(km3oneYear);
|
|
|
|
+ }
|
|
|
|
+ if (km4Date != null) { //扣掉一年时间
|
|
|
|
+ long x = km4Date.getTime() - oneYearLong;
|
|
|
|
+ Date km4oneYear = new Date(x);
|
|
|
|
+ userVip.setSubject4(km4oneYear);
|
|
|
|
+ }
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ OrderInfo orderInfo = orderInfoService.getByOutTradeNo(outTradeNo);
|
|
|
|
+ try {
|
|
|
|
+ orderInfo.setOutRefundNo(refundRecord.getOutRefundNo());
|
|
|
|
+ orderInfoService.updateById(orderInfo);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
@Transactional
|
|
@Transactional
|
|
@@ -261,8 +363,8 @@ public class WxNotifyController {
|
|
log.error("该订单不存在");
|
|
log.error("该订单不存在");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if("SUCCESS".equals(wxJsOrder.getTradeState())){
|
|
|
|
- log.info("订单号为"+wxJsOrder.getOutTradeNo()+"的订单已完成操作,无法重复操作!");
|
|
|
|
|
|
+ if ("SUCCESS".equals(wxJsOrder.getTradeState())) {
|
|
|
|
+ log.info("订单号为" + wxJsOrder.getOutTradeNo() + "的订单已完成操作,无法重复操作!");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
wxJsOrder.setTransactionId(jsonObject.getString("transaction_id"));
|
|
wxJsOrder.setTransactionId(jsonObject.getString("transaction_id"));
|
|
@@ -273,7 +375,7 @@ public class WxNotifyController {
|
|
wxJsOrder.setPayerCurrency(amount.getString("payer_currency"));
|
|
wxJsOrder.setPayerCurrency(amount.getString("payer_currency"));
|
|
wxJsOrder.setTradeState(jsonObject.getString("trade_state"));
|
|
wxJsOrder.setTradeState(jsonObject.getString("trade_state"));
|
|
wxJsOrder.setBankType(jsonObject.getString("bank_type"));
|
|
wxJsOrder.setBankType(jsonObject.getString("bank_type"));
|
|
- DateTime dateTime = new DateTime(jsonObject.getString("success_time"));
|
|
|
|
|
|
+ DateTime dateTime = new DateTime(jsonObject.getString("success_time"));
|
|
wxJsOrder.setSuccessTime(dateTime.toDate());
|
|
wxJsOrder.setSuccessTime(dateTime.toDate());
|
|
wxJsOrder.setTradeStateDesc(jsonObject.getString("trade_state_desc"));
|
|
wxJsOrder.setTradeStateDesc(jsonObject.getString("trade_state_desc"));
|
|
wxJsOrder.setTradeType(jsonObject.getString("trade_type"));
|
|
wxJsOrder.setTradeType(jsonObject.getString("trade_type"));
|
|
@@ -284,145 +386,141 @@ public class WxNotifyController {
|
|
writeVipDataToDb2(wxJsOrder);
|
|
writeVipDataToDb2(wxJsOrder);
|
|
wxJsOrderService.updateById(wxJsOrder);
|
|
wxJsOrderService.updateById(wxJsOrder);
|
|
|
|
|
|
- //插入订单主表
|
|
|
|
- OrderInfo orderInfo = new OrderInfo();
|
|
|
|
- orderInfo.setGoodsName(wxJsOrder.getGoodsName());
|
|
|
|
- orderInfo.setUserId(wxJsOrder.getUserId());
|
|
|
|
- orderInfo.setOutTradeNo(wxJsOrder.getOutTradeNo());
|
|
|
|
- orderInfo.setTradeType(1);
|
|
|
|
- orderInfo.setSuccessTime(wxJsOrder.getSuccessTime());
|
|
|
|
- orderInfo.setPayType(1);
|
|
|
|
- orderInfo.setCreateTime(new Date());
|
|
|
|
- orderInfoService.save(orderInfo);
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@Transactional
|
|
@Transactional
|
|
public void writeVipDataToDb(WxJsOrder wxJsOrder) {
|
|
public void writeVipDataToDb(WxJsOrder wxJsOrder) {
|
|
- long oneYearLong = 1000*60*60*24*365l;
|
|
|
|
|
|
+ long oneYearLong = 1000 * 60 * 60 * 24 * 365l;
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
|
|
|
|
- if ("科目二视频".equals(wxJsOrder.getGoodsName())){
|
|
|
|
- GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
|
|
- gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
|
|
- GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
|
|
- if(gv!=null) {
|
|
|
|
- //修改会员信息
|
|
|
|
- Date km2Date = gv.getSubject2();
|
|
|
|
- if(km2Date!=null) { //存在会员时间
|
|
|
|
- if(km2Date.compareTo(now)<0) { //会员已过期
|
|
|
|
- long x = now.getTime() + oneYearLong;
|
|
|
|
- Date km2oneYear = new Date(x);
|
|
|
|
- gv.setSubject2(km2oneYear);
|
|
|
|
- videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
- } else { //会员时间延长
|
|
|
|
- long x = km2Date.getTime() + oneYearLong;
|
|
|
|
- Date km2oneYear = new Date(x);
|
|
|
|
- gv.setSubject2(km2oneYear);
|
|
|
|
- videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
|
|
+ if ("科目二视频".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
|
|
+ gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
|
|
+ GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
|
|
+ if (gv != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km2Date = gv.getSubject2();
|
|
|
|
+ if (km2Date != null) { //存在会员时间
|
|
|
|
+ if (km2Date.compareTo(now) < 0) { //会员已过期
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
gv.setSubject2(km2oneYear);
|
|
gv.setSubject2(km2oneYear);
|
|
videoVipService.updateGzptVideoVipByUserId(gv);
|
|
videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
+ } else { //会员时间延长
|
|
|
|
+ long x = km2Date.getTime() + oneYearLong;
|
|
|
|
+ Date km2oneYear = new Date(x);
|
|
|
|
+ gv.setSubject2(km2oneYear);
|
|
|
|
+ videoVipService.updateGzptVideoVipByUserId(gv);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- //新增会员信息
|
|
|
|
- GzptVideoVip videoVip = new GzptVideoVip();
|
|
|
|
- videoVip.setUserId(wxJsOrder.getUserId());
|
|
|
|
- videoVip.setUserName(wxJsOrder.getUserName());
|
|
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
- videoVip.setSubject2(km2oneYear);
|
|
|
|
- videoVipService.saveGzptVideoVip(videoVip);
|
|
|
|
|
|
+ gv.setSubject2(km2oneYear);
|
|
|
|
+ videoVipService.updateGzptVideoVipByUserId(gv);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //新增会员信息
|
|
|
|
+ GzptVideoVip videoVip = new GzptVideoVip();
|
|
|
|
+ videoVip.setUserId(wxJsOrder.getUserId());
|
|
|
|
+ videoVip.setUserName(wxJsOrder.getUserName());
|
|
|
|
+ long x = now.getTime() + oneYearLong;
|
|
|
|
+ Date km2oneYear = new Date(x);
|
|
|
|
+ videoVip.setSubject2(km2oneYear);
|
|
|
|
+ videoVipService.saveGzptVideoVip(videoVip);
|
|
|
|
+ }
|
|
|
|
|
|
- } else if ("科目三视频".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
- GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
|
|
- gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
|
|
- GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
|
|
- if(gv!=null) {
|
|
|
|
- //修改会员信息
|
|
|
|
- Date km3Date = gv.getSubject3();
|
|
|
|
- if(km3Date!=null) { //存在会员时间
|
|
|
|
- if(km3Date.compareTo(now)<0) { //会员已过期
|
|
|
|
- long x = now.getTime() + oneYearLong;
|
|
|
|
- Date km3oneYear = new Date(x);
|
|
|
|
- gv.setSubject3(km3oneYear);
|
|
|
|
- videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
- } else { //会员时间延长
|
|
|
|
- long x = km3Date.getTime() + oneYearLong;
|
|
|
|
- Date km3oneYear = new Date(x);
|
|
|
|
- gv.setSubject3(km3oneYear);
|
|
|
|
- videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
|
|
+ } else if ("科目三视频".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
|
|
+ gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
|
|
+ GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
|
|
+ if (gv != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km3Date = gv.getSubject3();
|
|
|
|
+ if (km3Date != null) { //存在会员时间
|
|
|
|
+ if (km3Date.compareTo(now) < 0) { //会员已过期
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
gv.setSubject3(km3oneYear);
|
|
gv.setSubject3(km3oneYear);
|
|
videoVipService.updateGzptVideoVipByUserId(gv);
|
|
videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
+ } else { //会员时间延长
|
|
|
|
+ long x = km3Date.getTime() + oneYearLong;
|
|
|
|
+ Date km3oneYear = new Date(x);
|
|
|
|
+ gv.setSubject3(km3oneYear);
|
|
|
|
+ videoVipService.updateGzptVideoVipByUserId(gv);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- //新增会员信息
|
|
|
|
- GzptVideoVip videoVip = new GzptVideoVip();
|
|
|
|
- videoVip.setUserId(wxJsOrder.getUserId());
|
|
|
|
- videoVip.setUserName(wxJsOrder.getUserName());
|
|
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
- videoVip.setSubject3(km3oneYear);
|
|
|
|
- videoVipService.saveGzptVideoVip(videoVip);
|
|
|
|
|
|
+ gv.setSubject3(km3oneYear);
|
|
|
|
+ videoVipService.updateGzptVideoVipByUserId(gv);
|
|
}
|
|
}
|
|
|
|
+ } else {
|
|
|
|
+ //新增会员信息
|
|
|
|
+ GzptVideoVip videoVip = new GzptVideoVip();
|
|
|
|
+ videoVip.setUserId(wxJsOrder.getUserId());
|
|
|
|
+ videoVip.setUserName(wxJsOrder.getUserName());
|
|
|
|
+ long x = now.getTime() + oneYearLong;
|
|
|
|
+ Date km3oneYear = new Date(x);
|
|
|
|
+ videoVip.setSubject3(km3oneYear);
|
|
|
|
+ videoVipService.saveGzptVideoVip(videoVip);
|
|
|
|
+ }
|
|
|
|
|
|
- } else if ("全套实操视频".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
- GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
|
|
- gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
|
|
- GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
|
|
- if(gv!=null) {
|
|
|
|
- //修改会员信息
|
|
|
|
- Date km2Date = gv.getSubject2();
|
|
|
|
- Date km3Date = gv.getSubject3();
|
|
|
|
- if(km2Date!=null) { //科目二处理
|
|
|
|
- long x = km2Date.getTime() + oneYearLong;
|
|
|
|
- Date km2oneYear = new Date(x);
|
|
|
|
- gv.setSubject2(km2oneYear);
|
|
|
|
- } else {
|
|
|
|
- long x = now.getTime() + oneYearLong;
|
|
|
|
- Date km2oneYear = new Date(x);
|
|
|
|
- gv.setSubject2(km2oneYear);
|
|
|
|
- }
|
|
|
|
- if(km3Date!=null) { //科目三处理
|
|
|
|
- long x = km3Date.getTime() + oneYearLong;
|
|
|
|
- Date km3oneYear = new Date(x);
|
|
|
|
- gv.setSubject3(km3oneYear);
|
|
|
|
- } else {
|
|
|
|
- long x = now.getTime() + oneYearLong;
|
|
|
|
- Date km3oneYear = new Date(x);
|
|
|
|
- gv.setSubject3(km3oneYear);
|
|
|
|
- }
|
|
|
|
- videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
|
|
+ } else if ("全套实操视频".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
+ GzptVideoVipDTO gzptVideoVipDTO = new GzptVideoVipDTO();
|
|
|
|
+ gzptVideoVipDTO.setUserId(wxJsOrder.getUserId());
|
|
|
|
+ GzptVideoVip gv = videoVipService.getGzptVideoVipByUserIdForLocal(gzptVideoVipDTO);
|
|
|
|
+ if (gv != null) {
|
|
|
|
+ //修改会员信息
|
|
|
|
+ Date km2Date = gv.getSubject2();
|
|
|
|
+ Date km3Date = gv.getSubject3();
|
|
|
|
+ if (km2Date != null) { //科目二处理
|
|
|
|
+ long x = km2Date.getTime() + oneYearLong;
|
|
|
|
+ Date km2oneYear = new Date(x);
|
|
|
|
+ gv.setSubject2(km2oneYear);
|
|
} else {
|
|
} else {
|
|
- //新增会员信息
|
|
|
|
- GzptVideoVip videoVip = new GzptVideoVip();
|
|
|
|
- videoVip.setUserId(wxJsOrder.getUserId());
|
|
|
|
- videoVip.setUserName(wxJsOrder.getUserName());
|
|
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
- Date oneYear = new Date(x);
|
|
|
|
- videoVip.setSubject2(oneYear);
|
|
|
|
- videoVip.setSubject3(oneYear);
|
|
|
|
- videoVipService.saveGzptVideoVip(videoVip);
|
|
|
|
|
|
+ Date km2oneYear = new Date(x);
|
|
|
|
+ gv.setSubject2(km2oneYear);
|
|
}
|
|
}
|
|
|
|
+ if (km3Date != null) { //科目三处理
|
|
|
|
+ long x = km3Date.getTime() + oneYearLong;
|
|
|
|
+ Date km3oneYear = new Date(x);
|
|
|
|
+ gv.setSubject3(km3oneYear);
|
|
|
|
+ } else {
|
|
|
|
+ long x = now.getTime() + oneYearLong;
|
|
|
|
+ Date km3oneYear = new Date(x);
|
|
|
|
+ gv.setSubject3(km3oneYear);
|
|
|
|
+ }
|
|
|
|
+ videoVipService.updateGzptVideoVipByUserId(gv);
|
|
|
|
+ } else {
|
|
|
|
+ //新增会员信息
|
|
|
|
+ GzptVideoVip videoVip = new GzptVideoVip();
|
|
|
|
+ videoVip.setUserId(wxJsOrder.getUserId());
|
|
|
|
+ videoVip.setUserName(wxJsOrder.getUserName());
|
|
|
|
+ long x = now.getTime() + oneYearLong;
|
|
|
|
+ Date oneYear = new Date(x);
|
|
|
|
+ videoVip.setSubject2(oneYear);
|
|
|
|
+ videoVip.setSubject3(oneYear);
|
|
|
|
+ videoVipService.saveGzptVideoVip(videoVip);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
@Transactional
|
|
@Transactional
|
|
public void writeVipDataToDb2(WxJsOrder wxJsOrder) {
|
|
public void writeVipDataToDb2(WxJsOrder wxJsOrder) {
|
|
long oneYearLong = 1000 * 60 * 60 * 24 * 365l;
|
|
long oneYearLong = 1000 * 60 * 60 * 24 * 365l;
|
|
Date now = new Date();
|
|
Date now = new Date();
|
|
|
|
+ OrderInfo orderInfo = new OrderInfo();
|
|
|
|
+ orderInfo.setGoodsName(wxJsOrder.getGoodsName());
|
|
|
|
+ orderInfo.setUserId(wxJsOrder.getUserId());
|
|
|
|
+ orderInfo.setOutTradeNo(wxJsOrder.getOutTradeNo());
|
|
|
|
+ orderInfo.setTotal(wxJsOrder.getTotal());
|
|
|
|
+ orderInfo.setTradeType(1);
|
|
|
|
+ orderInfo.setSuccessTime(wxJsOrder.getSuccessTime());
|
|
|
|
+ orderInfo.setPayType(1);
|
|
|
|
+
|
|
|
|
|
|
if ("科一专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
if ("科一专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
@@ -434,18 +532,19 @@ public class WxNotifyController {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km1oneYear = new Date(x);
|
|
Date km1oneYear = new Date(x);
|
|
userVip.setSubject1(km1oneYear);
|
|
userVip.setSubject1(km1oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
} else { //会员时间延长
|
|
} else { //会员时间延长
|
|
long x = km1Date.getTime() + oneYearLong;
|
|
long x = km1Date.getTime() + oneYearLong;
|
|
Date km1oneYear = new Date(x);
|
|
Date km1oneYear = new Date(x);
|
|
userVip.setSubject1(km1oneYear);
|
|
userVip.setSubject1(km1oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
}
|
|
}
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
} else {
|
|
} else {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km1oneYear = new Date(x);
|
|
Date km1oneYear = new Date(x);
|
|
userVip.setSubject1(km1oneYear);
|
|
userVip.setSubject1(km1oneYear);
|
|
userVipService.updateById(userVip);
|
|
userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//新增会员信息
|
|
//新增会员信息
|
|
@@ -456,6 +555,7 @@ public class WxNotifyController {
|
|
Date km1oneYear = new Date(x);
|
|
Date km1oneYear = new Date(x);
|
|
uv.setSubject1(km1oneYear);
|
|
uv.setSubject1(km1oneYear);
|
|
userVipService.save(uv);
|
|
userVipService.save(uv);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
|
|
|
|
} else if ("科二专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
} else if ("科二专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
@@ -468,18 +568,19 @@ public class WxNotifyController {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
userVip.setSubject2(km2oneYear);
|
|
userVip.setSubject2(km2oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
} else { //会员时间延长
|
|
} else { //会员时间延长
|
|
long x = km2Date.getTime() + oneYearLong;
|
|
long x = km2Date.getTime() + oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
userVip.setSubject2(km2oneYear);
|
|
userVip.setSubject2(km2oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
}
|
|
}
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
} else {
|
|
} else {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
userVip.setSubject2(km2oneYear);
|
|
userVip.setSubject2(km2oneYear);
|
|
userVipService.updateById(userVip);
|
|
userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//新增会员信息
|
|
//新增会员信息
|
|
@@ -490,6 +591,7 @@ public class WxNotifyController {
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
uv.setSubject2(km2oneYear);
|
|
uv.setSubject2(km2oneYear);
|
|
userVipService.save(uv);
|
|
userVipService.save(uv);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
} else if ("科三专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
} else if ("科三专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
@@ -501,18 +603,19 @@ public class WxNotifyController {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
userVip.setSubject3(km3oneYear);
|
|
userVip.setSubject3(km3oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
} else { //会员时间延长
|
|
} else { //会员时间延长
|
|
long x = km3Date.getTime() + oneYearLong;
|
|
long x = km3Date.getTime() + oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
userVip.setSubject3(km3oneYear);
|
|
userVip.setSubject3(km3oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
}
|
|
}
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
} else {
|
|
} else {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
userVip.setSubject3(km3oneYear);
|
|
userVip.setSubject3(km3oneYear);
|
|
userVipService.updateById(userVip);
|
|
userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//新增会员信息
|
|
//新增会员信息
|
|
@@ -523,6 +626,7 @@ public class WxNotifyController {
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
uv.setSubject3(km3oneYear);
|
|
uv.setSubject3(km3oneYear);
|
|
userVipService.save(uv);
|
|
userVipService.save(uv);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
|
|
|
|
} else if ("科四专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
} else if ("科四专项VIP".equals(wxJsOrder.getGoodsName())) {
|
|
@@ -535,18 +639,19 @@ public class WxNotifyController {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km4oneYear = new Date(x);
|
|
Date km4oneYear = new Date(x);
|
|
userVip.setSubject4(km4oneYear);
|
|
userVip.setSubject4(km4oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
} else { //会员时间延长
|
|
} else { //会员时间延长
|
|
long x = km4Date.getTime() + oneYearLong;
|
|
long x = km4Date.getTime() + oneYearLong;
|
|
Date km4oneYear = new Date(x);
|
|
Date km4oneYear = new Date(x);
|
|
userVip.setSubject4(km4oneYear);
|
|
userVip.setSubject4(km4oneYear);
|
|
- userVipService.updateById(userVip);
|
|
|
|
}
|
|
}
|
|
|
|
+ userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
} else {
|
|
} else {
|
|
long x = now.getTime() + oneYearLong;
|
|
long x = now.getTime() + oneYearLong;
|
|
Date km4oneYear = new Date(x);
|
|
Date km4oneYear = new Date(x);
|
|
userVip.setSubject4(km4oneYear);
|
|
userVip.setSubject4(km4oneYear);
|
|
userVipService.updateById(userVip);
|
|
userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
//新增会员信息
|
|
//新增会员信息
|
|
@@ -557,17 +662,18 @@ public class WxNotifyController {
|
|
Date km4oneYear = new Date(x);
|
|
Date km4oneYear = new Date(x);
|
|
uv.setSubject4(km4oneYear);
|
|
uv.setSubject4(km4oneYear);
|
|
userVipService.save(uv);
|
|
userVipService.save(uv);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
|
|
|
|
- } else if ("科目一二三四所有付费权益".equals(wxJsOrder.getGoodsName())) {
|
|
|
|
|
|
+ } else if ("科目一二三四所有付费权益".equals(wxJsOrder.getGoodsName())) {
|
|
UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
UserVip userVip = userVipService.getUserVipByUserId(wxJsOrder.getUserId());
|
|
- if(userVip!=null) {
|
|
|
|
|
|
+ if (userVip != null) {
|
|
//修改会员信息
|
|
//修改会员信息
|
|
Date km1Date = userVip.getSubject1();
|
|
Date km1Date = userVip.getSubject1();
|
|
Date km2Date = userVip.getSubject2();
|
|
Date km2Date = userVip.getSubject2();
|
|
Date km3Date = userVip.getSubject3();
|
|
Date km3Date = userVip.getSubject3();
|
|
Date km4Date = userVip.getSubject4();
|
|
Date km4Date = userVip.getSubject4();
|
|
- if(km1Date!=null) { //科目一处理
|
|
|
|
|
|
+ if (km1Date != null) { //科目一处理
|
|
long x = km1Date.getTime() + oneYearLong;
|
|
long x = km1Date.getTime() + oneYearLong;
|
|
Date km1oneYear = new Date(x);
|
|
Date km1oneYear = new Date(x);
|
|
userVip.setSubject1(km1oneYear);
|
|
userVip.setSubject1(km1oneYear);
|
|
@@ -576,7 +682,7 @@ public class WxNotifyController {
|
|
Date km1oneYear = new Date(x);
|
|
Date km1oneYear = new Date(x);
|
|
userVip.setSubject1(km1oneYear);
|
|
userVip.setSubject1(km1oneYear);
|
|
}
|
|
}
|
|
- if(km2Date!=null) { //科目二处理
|
|
|
|
|
|
+ if (km2Date != null) { //科目二处理
|
|
long x = km2Date.getTime() + oneYearLong;
|
|
long x = km2Date.getTime() + oneYearLong;
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
userVip.setSubject2(km2oneYear);
|
|
userVip.setSubject2(km2oneYear);
|
|
@@ -585,7 +691,7 @@ public class WxNotifyController {
|
|
Date km2oneYear = new Date(x);
|
|
Date km2oneYear = new Date(x);
|
|
userVip.setSubject2(km2oneYear);
|
|
userVip.setSubject2(km2oneYear);
|
|
}
|
|
}
|
|
- if(km3Date!=null) { //科目三处理
|
|
|
|
|
|
+ if (km3Date != null) { //科目三处理
|
|
long x = km3Date.getTime() + oneYearLong;
|
|
long x = km3Date.getTime() + oneYearLong;
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
userVip.setSubject3(km3oneYear);
|
|
userVip.setSubject3(km3oneYear);
|
|
@@ -594,7 +700,7 @@ public class WxNotifyController {
|
|
Date km3oneYear = new Date(x);
|
|
Date km3oneYear = new Date(x);
|
|
userVip.setSubject3(km3oneYear);
|
|
userVip.setSubject3(km3oneYear);
|
|
}
|
|
}
|
|
- if(km4Date!=null) { //科目四处理
|
|
|
|
|
|
+ if (km4Date != null) { //科目四处理
|
|
long x = km4Date.getTime() + oneYearLong;
|
|
long x = km4Date.getTime() + oneYearLong;
|
|
Date km4oneYear = new Date(x);
|
|
Date km4oneYear = new Date(x);
|
|
userVip.setSubject4(km4oneYear);
|
|
userVip.setSubject4(km4oneYear);
|
|
@@ -604,6 +710,7 @@ public class WxNotifyController {
|
|
userVip.setSubject4(km4oneYear);
|
|
userVip.setSubject4(km4oneYear);
|
|
}
|
|
}
|
|
userVipService.updateById(userVip);
|
|
userVipService.updateById(userVip);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
} else {
|
|
} else {
|
|
//新增会员信息
|
|
//新增会员信息
|
|
UserVip uv = new UserVip();
|
|
UserVip uv = new UserVip();
|
|
@@ -616,12 +723,12 @@ public class WxNotifyController {
|
|
uv.setSubject3(oneYear);
|
|
uv.setSubject3(oneYear);
|
|
uv.setSubject4(oneYear);
|
|
uv.setSubject4(oneYear);
|
|
userVipService.updateById(uv);
|
|
userVipService.updateById(uv);
|
|
|
|
+ orderInfoService.save(orderInfo);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
private String getSourString(WxpayNotifyDTO wxpayNotifyDTO) throws GeneralSecurityException, IOException {
|
|
private String getSourString(WxpayNotifyDTO wxpayNotifyDTO) throws GeneralSecurityException, IOException {
|
|
AesUtil aesUtil = new AesUtil(wxpayConfig.getV3key().getBytes());
|
|
AesUtil aesUtil = new AesUtil(wxpayConfig.getV3key().getBytes());
|
|
WxpayNotifyDTO.WxpaySource wxpaySource = wxpayNotifyDTO.getResource();
|
|
WxpayNotifyDTO.WxpaySource wxpaySource = wxpayNotifyDTO.getResource();
|
|
@@ -629,8 +736,6 @@ public class WxNotifyController {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
@Data
|
|
@Data
|
|
public class FilmNotifyReturnDTO {
|
|
public class FilmNotifyReturnDTO {
|
|
String code;
|
|
String code;
|