From 80608a62d431a1f00f2c9da67606228ca3b8658c Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期二, 15 三月 2022 15:10:29 +0800
Subject: [PATCH] 党员认证Bug修改
---
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java
index 0a4c17a..d519b32 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/McsOrderServiceImpl.java
@@ -11,6 +11,8 @@
import com.panzhihua.common.utlis.SmsUtil;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.common.utlis.WxPayUtils;
+import com.panzhihua.service_community.dao.McsMerchantDAO;
+import com.panzhihua.service_community.entity.McsMerchant;
import com.panzhihua.service_community.entity.McsOrder;
import com.panzhihua.service_community.dao.McsOrderDao;
import com.panzhihua.service_community.service.McsMerchantService;
@@ -26,6 +28,8 @@
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.Date;
+
+import static java.util.Objects.nonNull;
/**
* 商业街订单表(McsOrder)表服务实现类
@@ -50,6 +54,8 @@
private RabbitTemplate rabbitTemplate;
@Resource
private McsMerchantService mcsMerchantService;
+ @Resource
+ private McsMerchantDAO mcsMerchantDAO;
private static String H5_LOGIN_APPID="wx475fcd33c8030df8";
@Override
@@ -59,8 +65,17 @@
@Override
public R insert(McsOrderVO mcsOrderVO) {
+ McsMerchant mcsMerchant = mcsMerchantDAO.selectOne(new QueryWrapper<McsMerchant>().lambda()
+ .eq(McsMerchant::getUserId, mcsOrderVO.getUserId()));
McsOrder mcsOrder=new McsOrder();
BeanUtils.copyProperties(mcsOrderVO,mcsOrder);
+ if (nonNull(mcsMerchant)) {
+ if (mcsMerchant.getIsDel()) {
+ mcsMerchantDAO.deleteById(mcsMerchant.getId());
+ } else {
+ mcsOrder.setMerchantId(mcsMerchant.getId());
+ }
+ }
mcsOrder.setStatus(0);
mcsOrder.setCreateTime(new Date());
mcsOrder.setOrderNo(DateUtils.getCurrentDateStrNoSignal());
@@ -92,7 +107,7 @@
}
// 调用wx支付
String realAppId=appid;
- if(mcsOrder.getOrderNo().equals("JSAPI")){
+ if(mcsOrderVO.getTradeType().equals("JSAPI")){
realAppId=H5_LOGIN_APPID;
}
String result = WxPayUtils.h5pay(realAppId, mchId, payKey, notifyUrl, "点亮支付", mcsOrderVO.getOpenId(),
@@ -129,9 +144,14 @@
mcsOrderBase.setStatus(1);
mcsOrderBase.setPayNo(mcsOrderVO.getPayNo());
mcsOrderBase.setPayTime(mcsOrderVO.getPayTime());
+ mcsOrderBase.setPaymentMethod("微信支付");
int i=this.baseMapper.updateById(mcsOrderBase);
if(i>0){
- mcsMerchantService.updateOrAddMcsMerchantAfterOrder(mcsOrderBase.getMerchantName(),mcsOrderBase.getConfigId(),mcsOrderBase.getUserId());
+ R r = mcsMerchantService.updateOrAddMcsMerchantAfterOrder(mcsOrderBase.getOrderNo(), mcsOrderBase.getConfigId(), mcsOrderBase.getUserId());
+ if (R.isOk(r) && nonNull(r.getData())) {
+ mcsOrderBase.setMerchantId(JSONObject.parseObject(JSONObject.toJSONString(r.getData()), Long.class));
+ this.baseMapper.updateById(mcsOrderBase);
+ }
}
return R.ok();
}
--
Gitblit v1.7.1