|
@@ -17,6 +17,7 @@ import com.caimei365.order.model.po.UserVipPo;
|
|
|
import com.caimei365.order.model.vo.DiscernReceiptVo;
|
|
|
import com.caimei365.order.model.vo.OrderPayLinkVo;
|
|
|
import com.caimei365.order.service.PayNonOrderService;
|
|
|
+import com.caimei365.order.service.RemoteCallService;
|
|
|
import com.caimei365.order.utils.CodeUtil;
|
|
|
import com.caimei365.order.utils.MathUtil;
|
|
|
import com.caimei365.order.utils.PayUtil;
|
|
@@ -56,6 +57,9 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
private String secondHandUrl;
|
|
|
@Value("${pay.vip-notify-url}")
|
|
|
private String superVipUrl;
|
|
|
+ @Resource
|
|
|
+ private RemoteCallService remoteCallService;
|
|
|
+
|
|
|
/**
|
|
|
* 二手发布微信线上支付
|
|
|
*
|
|
@@ -73,7 +77,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
// payDto -> payParam
|
|
|
BeanUtils.copyProperties(paySecondDto, tempParam);
|
|
|
ResponseJson<PayParamBo> jsonParam = getWeChatResponseJson(tempParam, headers);
|
|
|
- if (-1 == jsonParam.getCode()){
|
|
|
+ if (-1 == jsonParam.getCode()) {
|
|
|
return ResponseJson.error(jsonParam.getMsg(), null);
|
|
|
}
|
|
|
PayParamBo payParam = jsonParam.getData();
|
|
@@ -114,7 +118,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
Map<String, Object> map = weChatService.getInfoMapByWeb(payParam.getCode(), "crm");
|
|
|
openId = (String) map.get(WeChatService.Keys.OPEN_ID);
|
|
|
} catch (Exception e) {
|
|
|
- log.error("try-catch:",e);
|
|
|
+ log.error("try-catch:", e);
|
|
|
}
|
|
|
if (StringUtils.isEmpty(openId)) {
|
|
|
return ResponseJson.error("微信公众号获取openId失败!", null);
|
|
@@ -133,7 +137,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
* productId 二手发布商品id
|
|
|
* returnUrl 页面回调地址
|
|
|
* }
|
|
|
- * @param headers HttpHeaders
|
|
|
+ * @param headers HttpHeaders
|
|
|
*/
|
|
|
@Override
|
|
|
public ResponseJson<JSONObject> paySecondByAlipay(PaySecondDto paySecondDto, HttpHeaders headers) {
|
|
@@ -159,7 +163,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
* bankCode 银行编码(银联支付使用)
|
|
|
* userType 用户类型(银联支付使用)企业:ENTERPRISE,个人:USER
|
|
|
* }
|
|
|
- * @param headers HttpHeaders
|
|
|
+ * @param headers HttpHeaders
|
|
|
*/
|
|
|
@Override
|
|
|
public ResponseJson<JSONObject> paySecondByUnionPay(PaySecondDto paySecondDto, HttpHeaders headers) {
|
|
@@ -318,6 +322,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
}
|
|
|
return json;
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 升级超级会员-微信线上支付
|
|
|
*
|
|
@@ -335,17 +340,17 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
// payDto -> payParam
|
|
|
BeanUtils.copyProperties(payVipDto, tempParam);
|
|
|
ResponseJson<PayParamBo> jsonParam = getWeChatResponseJson(tempParam, headers);
|
|
|
- if (-1 == jsonParam.getCode()){
|
|
|
+ if (-1 == jsonParam.getCode()) {
|
|
|
return ResponseJson.error(jsonParam.getMsg(), null);
|
|
|
}
|
|
|
PayParamBo payParam = jsonParam.getData();
|
|
|
// 获取会员套餐记录
|
|
|
VipRecordBo record = payOrderMapper.getVipPackageRecord(payParam.getVipRecordId());
|
|
|
- if (null == record){
|
|
|
- log.info("【升级超级会员-微信线上支付】该笔记录异常,记录Id:"+payParam.getVipRecordId());
|
|
|
+ if (null == record) {
|
|
|
+ log.info("【升级超级会员-微信线上支付】该笔记录异常,记录Id:" + payParam.getVipRecordId());
|
|
|
return ResponseJson.error("该笔记录异常!", null);
|
|
|
}
|
|
|
- if (null != record.getPayStatus() && 1 == record.getPayStatus()){
|
|
|
+ if (null != record.getPayStatus() && 1 == record.getPayStatus()) {
|
|
|
return ResponseJson.error("该笔记录已支付,请勿重复支付!", null);
|
|
|
}
|
|
|
payParam.setVipId(record.getPackageId());
|
|
@@ -354,7 +359,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
Double price = payOrderMapper.getVipPackagePriceById(record.getPackageId());
|
|
|
payParam.setPayAmount(MathUtil.mul(price, 100).intValue());
|
|
|
payParam.setNotifyUrl(superVipUrl);
|
|
|
- log.info("【升级超级会员微信支付】>>>>>>>>>>>vipRecordId:" + payParam.getVipRecordId()+",获取openId:" + payParam.getOpenId());
|
|
|
+ log.info("【升级超级会员微信支付】>>>>>>>>>>>vipRecordId:" + payParam.getVipRecordId() + ",获取openId:" + payParam.getOpenId());
|
|
|
return toPaySuperVip(payParam, headers);
|
|
|
}
|
|
|
|
|
@@ -377,7 +382,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
payParam.setPayType("ALIPAY_H5");
|
|
|
// 获取会员套餐记录
|
|
|
VipRecordBo record = payOrderMapper.getVipPackageRecord(payParam.getVipRecordId());
|
|
|
- if (null != record.getPayStatus() && 1 == record.getPayStatus()){
|
|
|
+ if (null != record.getPayStatus() && 1 == record.getPayStatus()) {
|
|
|
return ResponseJson.error("该笔记录已支付,请勿重复支付!", null);
|
|
|
}
|
|
|
payParam.setVipId(record.getPackageId());
|
|
@@ -411,7 +416,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
payParam.setPayType("GATEWAY_UNIONPAY");
|
|
|
// 获取会员套餐记录
|
|
|
VipRecordBo record = payOrderMapper.getVipPackageRecord(payParam.getVipRecordId());
|
|
|
- if (null != record.getPayStatus() && 1 == record.getPayStatus()){
|
|
|
+ if (null != record.getPayStatus() && 1 == record.getPayStatus()) {
|
|
|
return ResponseJson.error("该笔记录已支付,请勿重复支付!", null);
|
|
|
}
|
|
|
payParam.setVipId(record.getPackageId());
|
|
@@ -444,7 +449,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
environment = "BETA";
|
|
|
}
|
|
|
// 商户订单号
|
|
|
- String orderId = payParam.getUserId()+ "R" + payParam.getVipRecordId() + "V" + payParam.getVipId() + "T" + time + environment;
|
|
|
+ String orderId = payParam.getUserId() + "R" + payParam.getVipRecordId() + "V" + payParam.getVipId() + "T" + time + environment;
|
|
|
json.put("orderId", orderId);
|
|
|
//商品名称
|
|
|
String product = "采美订单" + orderId;
|
|
@@ -506,7 +511,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
splitAccount.setPayStatus(0);
|
|
|
// 保存分账详情
|
|
|
payOrderMapper.insertSplitAccount(splitAccount);
|
|
|
- log.info("【升级超级会员支付成功!】>>>>>>>>>>>vipRecordId:" + payParam.getVipRecordId() + ",data:" +data.toJSONString());
|
|
|
+ log.info("【升级超级会员支付成功!】>>>>>>>>>>>vipRecordId:" + payParam.getVipRecordId() + ",data:" + data.toJSONString());
|
|
|
return ResponseJson.success(result);
|
|
|
}
|
|
|
|
|
@@ -637,6 +642,17 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
log.info("【升级超级会员异步回调】>>>>>>>>>>>收款项和购买历史关系(insert[cm_receipt_order_relation])id:" + relation.getId() + ",vipRecordId:" + recordId);
|
|
|
//修改分账付款状态
|
|
|
payOrderMapper.updateSplitAccountByPay(mbOrderId);
|
|
|
+ //已支付推送
|
|
|
+ boolean smsPushFlag = !orderRequestNo.contains("BETA") && !orderRequestNo.contains("DEV");
|
|
|
+ String bindMobile = baseMapper.getBindMobileByUserId(userId);
|
|
|
+ if (smsPushFlag && StringUtils.isNotBlank(bindMobile)) {
|
|
|
+ String shortLink = remoteCallService.getShortLink(8, 2, "https://www.caimei365.com/user/member.html?userId=" + userId);
|
|
|
+ String content = "恭喜您成功开通采美平台超级会员,为期"+mouth+"个月,快戳采美网站链接www.caimei365.com/t/" + shortLink+ "或微信搜索“采美采购商城”小程序登录采美平台畅享会员特权吧。关注公众号“采美365网”可获取更多优惠和精彩资讯。退订回T";
|
|
|
+ boolean sendSms = remoteCallService.getSendSms(2, bindMobile, content);
|
|
|
+ if (!sendSms) {
|
|
|
+ log.info("购买会员短信推送失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
return "SUCCESS";
|
|
|
}
|
|
|
|
|
@@ -659,7 +675,7 @@ public class PayNonOrderServiceImpl implements PayNonOrderService {
|
|
|
json.put("time", time);
|
|
|
//商户退款流水号,由商户自行生成,必须唯一
|
|
|
String randomLetter = CodeUtil.randomLetter(6);
|
|
|
- String merchantRefundNo = payVipDto.getVipRecordId() + payVipDto.getCode() + randomLetter + "##" + discernReceipt.getId();
|
|
|
+ String merchantRefundNo = payVipDto.getVipRecordId() + payVipDto.getCode() + randomLetter + "##" + discernReceipt.getId();
|
|
|
json.put("merchantRefundNo", merchantRefundNo);
|
|
|
//退款金额,单位分,必须大于0
|
|
|
double refundAmt = MathUtil.mul(discernReceipt.getAssociateAmount(), 100).doubleValue();
|